Commit df91cddd authored by KeYong's avatar KeYong

提交设备管理后台

parent 490a13b7
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.service.ICarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: CarStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/26 15:17
*/
@RestController
@Api(tags = "消防车统计Api")
@RequestMapping(value = "/center/car", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Slf4j
public class CarStatisticController extends AbstractBaseController {
@Autowired
@Lazy
ICarService iCarService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/used/info", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆用途统计信息", notes = "获取车辆用途统计信息")
public List<Map<String, Object>> getCarUsedInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarUsedInfo(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/type/info", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆用途统计信息", notes = "获取车辆用途统计信息")
public List<Map<String, Object>> getCarTypeInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeInfo(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆分类统计信息", notes = "获取车辆分类统计信息")
public List<Map<String, Object>> getCarInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeStatistic(bizOrgCode);
}
}
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.utils.CommonPageable;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author keyong
* @title: PoolStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/29 10:43
*/
@RestController
@Api(tags = "监盘总览组态需求 -- API")
@RequestMapping(value = "/center/pool", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class PoolStatisticController {
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/panel/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池统计信息", notes = "获取水池统计信息")
public ResponseModel getWaterPanelInfo( @RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoBySuper(bizOrgCode);
List<Map<String, Object>> poolList = new ArrayList<>();
List<Map<String, Object>> industryPoolList = new ArrayList<>();
if (!infoList.isEmpty()) {
industryPoolList = infoList.stream().filter(x -> "industryPool".equalsIgnoreCase(String.valueOf(x.get("resource_type")))).collect(Collectors.toList());
poolList = infoList.stream().filter(x -> "pool".equalsIgnoreCase(String.valueOf(x.get("resource_type")))).collect(Collectors.toList());
}
Map<String, Object> poolMap = new HashMap<>();
Map<String, List<Map<String, Object>>> pool = getPoolInfo(poolList);
poolMap.put("poolName", "消防水池");
poolMap.put("poolTotal", poolList.size());
poolMap.put("poolLow", pool.get("low"));
poolMap.put("poolHigh", pool.get("high"));
poolMap.put("poolNormal", pool.get("normal"));
poolMap.put("poolAbs", new BigDecimal(pool.get("normal").size()).divide(new BigDecimal(poolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
Map<String, List<Map<String, Object>>> industry = getPoolInfo(industryPoolList);
poolMap.put("industryName", "工业水池");
poolMap.put("industryTotal", industry.size());
poolMap.put("industryLow", pool.get("low"));
poolMap.put("industryHigh", pool.get("high"));
poolMap.put("industryNormal", pool.get("normal"));
poolMap.put("industryAbs", new BigDecimal(industry.get("normal").size()).divide(new BigDecimal(industryPoolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
return CommonResponseUtil.success(poolMap);
}
private Map<String, List<Map<String, Object>>> getPoolInfo(List<Map<String, Object>> infoList) {
Map<String, List<Map<String, Object>>> resMap = new HashMap<>();
List<Map<String, Object>> highList = new ArrayList<>();
List<Map<String, Object>> lowList = new ArrayList<>();
List<Map<String, Object>> normalList = new ArrayList<>();
if (!CollectionUtils.isEmpty(infoList)) {
for (Map<String, Object> m : infoList) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
if (IndexStatusEnum.LOW.getKey().equals(String.valueOf(transResult.get("status")))) {
lowList.add(map);
} else if (IndexStatusEnum.HIGH.getKey().equals(String.valueOf(transResult.get("status")))) {
highList.add(map);
} else {
normalList.add(map);
}
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
normalList.add(map);
}
}
}
resMap.put("low", lowList);
resMap.put("high", highList);
resMap.put("normal", normalList);
return resMap;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/panel/station/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池统计信息", notes = "获取水池统计信息")
public ResponseModel getStationWaterPanelInfo( @RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoBySuper(bizOrgCode);
List<Map<String, Object>> normalList = new ArrayList<>();
List<Map<String, Object>> abNormalList = new ArrayList<>();
if (!infoList.isEmpty()) {
for (Map<String, Object> m : infoList) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("levelStatus", "--");
}
m.put("abs", transResult.get("abs"));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, RoundingMode.HALF_UP);
m.put("volume", bigDecimal + "m³");
m.put("levelAbs", transResult.get("abs") + "%)");
} else if (String.valueOf(transResult.get("abs")).equals("100") && String.valueOf(transResult.get("status")).equals("1")) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume")));
m.put("volume", bigDecimal + "m³");
m.put("levelAbs", transResult.get("abs") + "%)");
} else {
m.put("levelAbs", transResult.get("abs"));
}
}
}
return CommonResponseUtil.success(infoList);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/status/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池统计信息", notes = "获取水池统计信息")
public ResponseModel getWaterInfo( @RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoBySuper(bizOrgCode);
List<Map<String, Object>> normalList = new ArrayList<>();
List<Map<String, Object>> abNormalList = new ArrayList<>();
if (!infoList.isEmpty()) {
for (Map<String, Object> m : infoList) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
if (IndexStatusEnum.LOW.getKey().equals(String.valueOf(transResult.get("status")))) {
abNormalList.add(map);
} else if (IndexStatusEnum.HIGH.getKey().equals(String.valueOf(transResult.get("status")))) {
abNormalList.add(map);
} else {
normalList.add(map);
}
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
normalList.add(map);
}
}
}
Map<String, Object> normalMap = new HashMap<>();
normalMap.put("key", "normal");
normalMap.put("name", "液位正常");
normalMap.put("value", normalList.size());
Map<String, Object> abNormalMap = new HashMap<>();
abNormalMap.put("key", "normal");
abNormalMap.put("name", "液位异常");
abNormalMap.put("value", normalList.size());
List<Map<String, Object>> res = new ArrayList<>();
res.add(normalMap);
res.add(abNormalMap);
return CommonResponseUtil.success(res);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/station/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取换流站水池信息", notes = "获取换流站水池信息")
public ResponseModel getStationWaterInfo( @RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoByBizOrgName(bizOrgCode);
List<Map<String, Object>> lt4000 = new ArrayList<>();
List<Map<String, Object>> gt4000 = new ArrayList<>();
if (!CollectionUtils.isEmpty(infoList)) {
for (Map<String, Object> m : infoList) {
if (4000 > Integer.valueOf(String.valueOf(m.get("allVolume")))) {
lt4000.add(m);
} else {
gt4000.add(m);
}
}
}
Map<String, Object> normalMap = new HashMap<>();
normalMap.put("key", "lt");
normalMap.put("name", "<4000m³换流站");
normalMap.put("value", lt4000.size());
Map<String, Object> abNormalMap = new HashMap<>();
abNormalMap.put("key", "gt");
abNormalMap.put("name", "≥4000m³换流站");
abNormalMap.put("value", gt4000.size());
List<Map<String, Object>> res = new ArrayList<>();
res.add(normalMap);
res.add(abNormalMap);
return CommonResponseUtil.success(res);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池信息", notes = "获取水池信息")
public ResponseModel getWaterInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String stationOrder, @RequestParam(required = false) String stateOrder) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getWaterInfoList(page, bizOrgCode, stationOrder, stateOrder);
List<Map<String, Object>> res = page1.getRecords();
if (!res.isEmpty()) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoByBizOrgName(bizOrgCode);
for (Map<String, Object> m : res) {
List<Map<String, Object>> list = infoList.stream().filter(x -> String.valueOf(x.get("bizOrgName")).equals(m.get("bizOrgName"))).collect(Collectors.toList());
String allVolume = String.valueOf(list.get(0).get("allVolume"));
m.put("eligibility", Integer.valueOf(allVolume) < 4000 ? "1" : "0");
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
if (IndexStatusEnum.LOW.getKey().equals(String.valueOf(transResult.get("status")))) {
m.put("status", 1);
} else if (IndexStatusEnum.HIGH.getKey().equals(String.valueOf(transResult.get("status")))) {
m.put("status", 1);
} else {
m.put("status", 0);
}
} else {
m.put("status", 0);
}
m.put("abs", transResult.get("abs"));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, RoundingMode.HALF_UP);
m.put("surplus", bigDecimal);
m.put("surplusPercent", transResult.get("abs") + "%");
} else if (String.valueOf(transResult.get("abs")).equals("100") && String.valueOf(transResult.get("status")).equals("1")) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume")));
m.put("surplus", bigDecimal);
m.put("surplusPercent", transResult.get("abs") + "%");
} else {
m.put("levelAbs", transResult.get("abs"));
}
}
if (StringUtils.isNotEmpty(stationOrder)) {
if ("1".equals(stationOrder)) {
res = res.stream().sorted((t1, t2) -> Integer.valueOf(String.valueOf(t2.get("value"))).compareTo(Integer.valueOf(String.valueOf(t1.get("value"))))).collect(Collectors.toList());
} else {
res = res.stream().sorted(Comparator.comparing(t -> Integer.valueOf(String.valueOf(t.get("value"))))).collect(Collectors.toList());
}
}
page1.setRecords(res);
}
return CommonResponseUtil.success(page1);
}
}
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.CommonPageable;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.ResponseUtils;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.typroject.tyboot.core.foundation.context.RequestContext.*;
/**
* @author keyong
* @title: CarStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/26 15:17
*/
@RestController
@Api(tags = "消防系统统计Api")
@RequestMapping(value = "/center/system", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Slf4j
public class SystemStatisticController extends AbstractBaseController {
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IotFeign iotFeign;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/status", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取系统状态统计信息", notes = "获取系统状态统计信息")
public ResponseModel getSystemInfo(@RequestParam(required = false) String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.getCenterEquipState(bizOrgCode);
BigDecimal normal = new BigDecimal(String.valueOf(map.get("normalNum")));
BigDecimal total = new BigDecimal(String.valueOf(map.get("total")));
map.put("abs", normal.divide(total,2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
return CommonResponseUtil.success(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/alarm/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取系统告警统计信息", notes = "获取系统告警统计信息")
public ResponseModel getAbnormalSystemInfo(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> list = fireFightingSystemMapper.getAbnormalSystemInfo(bizOrgCode);
return CommonResponseUtil.success(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池信息", notes = "获取水池信息")
public ResponseModel getWaterInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemType, @RequestParam(required = false) String systemState,
@RequestParam(required = false) String stateOrder, @RequestParam(required = false) String alarmEquips) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getSystemInfoPage(page, bizOrgCode, systemType, systemState, stateOrder, alarmEquips);
return CommonResponseUtil.success(page1);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/iot/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取物联信息", notes = "获取物联信息")
public ResponseModel getIotInfo(@RequestParam(required = false) String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.getIotInfo(bizOrgCode);
return CommonResponseUtil.success(map);
}
}
......@@ -44,4 +44,10 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
List<Map<String, String>> getTankAndFireCarNum(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, String>> carListByPage(@Param("page")Page<Car> page, @Param("dto") Car car);
Map<String, Object> getCarUsedInfo(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getCarTypeInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getCarTypeStatistic(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -351,6 +351,24 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getWaterInfoBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取水源信息
*
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getWaterInfoList(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("stationOrder") String stationOrder, @Param("stateOrder") String stateOrder);
/**
* 水源信息统计
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getWaterInfoBySuper(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getWaterInfoByBizOrgName(@Param("bizOrgCode") String bizOrgCode);
/**
* CAFS水箱和CAFS泡沫罐信息
* @param page
* @param bizOrgCode
......@@ -733,4 +751,17 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("equipmentCode") String equipmentCode);
Map<String, Object> getEquipStats(@Param("bizOrgCode") String bizOrgCode, @Param("list") List<String> list);
Map<String, Object> getCenterEquipState(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getAbnormalSystemInfo(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getSystemInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode,
@Param("systemType") String systemType,
@Param("systemState") String systemState,
@Param("stateOrder") String stateOrder,
@Param("alarmEquips") String alarmEquips);
Map<String, Object> getIotInfo(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -217,4 +217,10 @@ public interface ICarService extends IService<Car> {
List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode);
Page<Map<String, String>> carListByPage(Car car, Page<Car> objectPage);
List<Map<String, Object>> getCarUsedInfo(String bizOrgCode);
List<Map<String, Object>> getCarTypeInfo(String bizOrgCode);
List<Map<String, Object>> getCarTypeStatistic(String bizOrgCode);
}
......@@ -1850,6 +1850,46 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return carPropertyMapper.carListByPage(page, car);
}
@Override
public List<Map<String, Object>> getCarUsedInfo(String bizOrgCode) {
Map<String, Object> map = carPropertyMapper.getCarUsedInfo(bizOrgCode);
List<Map<String, Object>> res = new ArrayList<>();
Map<String, Object> m1 = new HashMap();
m1.put("name", "自购");
m1.put("value", map.get("zg"));
m1.put("key", "zg");
res.add(m1);
Map<String, Object> m2 = new HashMap();
m2.put("name", "租赁");
m2.put("value", map.get("zl"));
m2.put("key", "zl");
res.add(m2);
return res;
}
@Override
public List<Map<String, Object>> getCarTypeInfo(String bizOrgCode) {
Map<String, Object> map = carPropertyMapper.getCarTypeInfo(bizOrgCode);
List<Map<String, Object>> resList = new ArrayList<>();
Map<String, Object> m1 = new HashMap();
m1.put("name", "举高");
m1.put("value", map.get("jg"));
m1.put("key", "jg");
resList.add(m1);
Map<String, Object> m2 = new HashMap();
m2.put("name", "非举高");
m2.put("value", map.get("fjg"));
m2.put("key", "fjg");
resList.add(m2);
return resList;
}
@Override
public List<Map<String, Object>> getCarTypeStatistic(String bizOrgCode) {
List<Map<String, Object>> list = carPropertyMapper.getCarTypeStatistic(bizOrgCode);
return list;
}
class LossParams {
private Long carId;
......
package com.yeejoin;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.equipmanage.listener.CarIotListener;
import com.yeejoin.equipmanage.listener.CarIotNewListener;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -15,22 +14,18 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.util.Collections;
......
......@@ -174,4 +174,41 @@
ORDER BY wc.equip_status DESC
</where>
</select>
<select id="getCarUsedInfo" resultType="Map">
SELECT
( SELECT COUNT( 1 ) FROM wl_car WHERE use_type = '自购' ) AS zg,
( SELECT COUNT( 1 ) FROM wl_car WHERE use_type = '租赁' ) AS zl
</select>
<select id="getCarTypeInfo" resultType="Map">
SELECT
d.jg AS jg,
ABS(d.total - d.jg) AS fjg
FROM
(
SELECT
IFNULL( SUM( IF ( we.code LIKE CONCAT( '210102', '%' ), 1, 0 ) ), 0 ) AS jg,
count( 1 ) AS total
FROM
wl_car c
LEFT JOIN wl_equipment we ON we.id = c.equipment_id
) d
</select>
<select id="getCarTypeStatistic" resultType="Map">
SELECT
we.code AS `key`,
we.name AS `name`,
IF(COUNT(1) = 0, NULL, COUNT(1)) AS total
FROM
wl_car wc
LEFT JOIN wl_equipment we ON we.id = wc.equipment_id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wc.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
GROUP BY we.code
</select>
</mapper>
......@@ -4935,7 +4935,8 @@
r.resource_type,
r.sequence_nbr,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
......@@ -4966,7 +4967,8 @@
a.resource_type,
a.sequence_nbr,
a.code,
a.pumpDeviceId
a.pumpDeviceId,
a.bizOrgName
FROM
(
SELECT
......@@ -4996,7 +4998,8 @@
r.sequence_nbr,
rp.level_device_id,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
......@@ -5018,6 +5021,249 @@
status ASC
</select>
<select id="getWaterInfoList" resultType="java.util.Map">
select
*,
(
CASE
WHEN nowLevel IS NOT NULL
AND maxLevel IS NOT NULL
AND nowLevel - maxLevel > 0 THEN
'1'
WHEN nowLevel IS NOT NULL
AND minLevel IS NOT NULL
AND nowLevel != '--'
AND nowLevel - minLevel >= 0 THEN
'2'
WHEN nowLevel IS NOT NULL
AND minLevel IS NOT NULL AND nowLevel != '--'
AND minLevel - nowLevel > 0 THEN
'0' ELSE '4'
END
) AS `status`
from (
(SELECT
r.sequence_nbr AS id,
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
IFNULL((select
avg(IFNULL(ei.`value`, 0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0), '--') AS nowLevel,
IFNULL(CASE WHEN (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel') THEN ei.`unit` END,'--') AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.id,
a.`name`,
a.equipmentSpecificId,
a.minLevel,
a.maxLevel,
a.outputFlowRate,
IFNULL( a.nowLevel, '--' ) nowLevel,
a.`unit`,
a.volume,
a.image,
a.resource_type,
a.sequence_nbr,
a.code,
a.pumpDeviceId,
a.bizOrgName
FROM
(
SELECT
r.sequence_nbr AS id,
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
(select
avg(IFNULL(ei.`value`,0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
(select
ei.unit
from
wl_equipment_specific_index ei
where
-- or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' 此处由于单位会出现多个,所以无法确定选择哪一个,所以此处默认用一个指标的单位进行单位换算
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
<if test="stationOrder!=null and stationOrder!=''">
ORDER BY CONVERT(bizOrgName USING gbk) ASC
</if>
<if test="stationOrder = null OR stationOrder =''">
ORDER BY CONVERT(bizOrgName USING gbk) DESC
</if>
</select>
<select id="getWaterInfoByBizOrgName" resultType="java.util.Map">
select
*,
sum(volume) AS allVolume
from (
(SELECT
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
IFNULL((select
avg(IFNULL(ei.`value`, 0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0), '--') AS nowLevel,
IFNULL(CASE WHEN (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel') THEN ei.`unit` END,'--') AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.equipmentSpecificId,
a.minLevel,
a.maxLevel,
a.outputFlowRate,
IFNULL( a.nowLevel, '--' ) nowLevel,
a.`unit`,
a.volume,
a.image,
a.resource_type,
a.sequence_nbr,
a.code,
a.pumpDeviceId,
a.bizOrgName
FROM
(
SELECT
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
(select
avg(IFNULL(ei.`value`,0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
(select
ei.unit
from
wl_equipment_specific_index ei
where
-- or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' 此处由于单位会出现多个,所以无法确定选择哪一个,所以此处默认用一个指标的单位进行单位换算
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
GROUP BY bizOrgName
</select>
<select id="getCAFSWaterTankAndFormTank" resultType="java.util.Map">
SELECT
*,
......@@ -6630,4 +6876,128 @@
AND wed.equipment_name is not null
</where>
</select>
<select id="getCenterEquipState" resultType="Map">
SELECT
SUM(
IF
( d.VALUE > 0, 1, 0 )) AS alarmNum,
SUM(
IF
( d.VALUE = 0, 1, 0 )) AS normalNum,
count( d.id ) AS total
FROM
(
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
( SELECT count( 1 ) FROM `wl_equipment_specific_alarm_log` WHERE 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wl_equipment_specific_alarm_log`.`system_ids` ) ) AS `value`
FROM
`f_fire_fighting_system` `fs`
WHERE
fs.system_type_code IS NOT NULL
AND LENGTH(
trim( fs.system_type_code )) != 0
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND fs.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) d
</select>
<select id="getAbnormalSystemInfo" resultType="Map">
SELECT
d.id,
d.`name`,
SUM(IF( d.VALUE > 0, 1, 0 )) AS sysNum
FROM
(
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
fs.system_type_code,
( SELECT count( 1 ) FROM `wl_equipment_specific_alarm_log` WHERE 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wl_equipment_specific_alarm_log`.`system_ids` ) ) AS `value`
FROM
`f_fire_fighting_system` `fs`
WHERE
fs.system_type_code IS NOT NULL
AND LENGTH(
trim( fs.system_type_code )) != 0
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND fs.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) d
WHERE d.value != 0
GROUP BY d.system_type_code
</select>
<select id="getSystemInfoPage" resultType="Map">
SELECT
d.id,
d.`name`,
IF( d.VALUE > 0, '异常', '正常') AS sysState,
d.bizOrgName,
d.value AS `value`,
d.equips
FROM
(
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
fs.system_type_code,
fs.biz_org_name AS bizOrgName,
( SELECT count( 1 ) FROM `wl_equipment_specific_alarm_log` WHERE 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wl_equipment_specific_alarm_log`.`system_ids` ) ) AS `value`,
(SELECT COUNT(DISTINCT wesal.equipment_specific_id) FROM wl_equipment_specific_alarm_log wesal WHERE 0 <![CDATA[<>]]> find_in_set(`fs`.`id`, wesal.`system_ids`)) AS equips
FROM
`f_fire_fighting_system` `fs`
WHERE
fs.system_type_code IS NOT NULL
AND LENGTH(
trim( fs.system_type_code )) != 0
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND fs.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
<if test="systemType!=null and systemType!=''">
AND fs.system_type_code LIKE CONCAT(#{systemType},'%')
</if>
) d
<where>
<if test="systemState!=null and systemState!='' and systemState ='1'">
d.value <![CDATA[>]]> 0
</if>
<if test="systemState!=null and systemState!='' and systemState ='1'">
d.value <![CDATA[<]]> 0
</if>
</where>
<if test="stateOrder!=null and stateOrder!='' and stateOrder=1">
ORDER BY d.value DESC,
</if>
<if test="stateOrder!=null and stateOrder!='' and stateOrder=0">
ORDER BY d.value ASC,
</if>
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips=1">
d.equips DESC
</if>
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips=0">
d.equips ASC
</if>
</select>
<select id="getIotInfo" resultType="Map">
SELECT
*
FROM
(
(SELECT count( DISTINCT wei.name_key ) FROM wl_equipment_index wei WHERE wei.is_iot = 1) AS indexNum,
(SELECT count( 1 ) FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) AS equipNum,
(SELECT count(1) AS indexMonitorNum FROM wl_equipment_specific_index wesi LEFT JOIN wl_equipment_specific wes on wesi.equipment_specific_id = wes.id WHERE DATE_FORMAT(wesi.update_date, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND wes.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) AS indexMonitorNum
)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment