Commit 8a73eb42 authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

# Conflicts: # amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
parents 764ef792 09b26ec2
......@@ -10,6 +10,7 @@ public enum WaterResourceTypeEnum {
消防水鹤("crane", "消防水鹤"),
消防水池("pool", "消防水池"),
天然水源("natural", "天然水源"),
消防水箱("waterTank", "消防水箱"),
工业水池("industryPool", "工业水池");
private String code;
......
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author DELL
*/
@Data
@ApiModel(value = "FormGroupColumnDto对象", description = "分组Dto对象")
public class FormGroupColumnDto {
@ApiModelProperty(value = "字段名")
private String fieldName;
@ApiModelProperty(value = "中文名")
private String fieldLabel;
@ApiModelProperty(value = "值")
private String fieldValue;
@ApiModelProperty(value = "数据类型:文本,数字,枚举,日期")
private String dataType;
@ApiModelProperty(value = "查询策略;全等,模糊,区间")
private String queryStrategy;
@ApiModelProperty(value = "分组编号")
private String groupCode;
}
......@@ -137,6 +137,7 @@ public class WaterResourceController extends BaseController {
waterResourceNaturalService.createWithModel(waterResourceNaturalDto);
break;
case "pool":
case "waterTank":
case "industryPool":
// 新增基础信息
model.setIsIot(true);
......@@ -278,6 +279,7 @@ public class WaterResourceController extends BaseController {
waterResourceNaturalService.updateWithModel(waterResourceNaturalDto);
break;
case "industryPool":
case "waterTank":
case "pool":
WaterResourcePoolDto waterResourcePoolDto = new WaterResourcePoolDto();
WaterResourcePool waterResourcePool =
......@@ -285,6 +287,7 @@ public class WaterResourceController extends BaseController {
sequenceNbr));
BeanUtils.copyProperties(model, waterResourcePoolDto);
waterResourcePoolDto.setSequenceNbr(waterResourcePool.getSequenceNbr());
waterResourcePoolDto.setResourceId(waterResourcePool.getResourceId());
waterResourcePoolService.updateWithModel(waterResourcePoolDto);
break;
default:
......@@ -403,6 +406,7 @@ public class WaterResourceController extends BaseController {
BeanUtils.copyProperties(waterResourceNatural, waterResourceDto);
break;
case "industryPool":
case "waterTank":
case "pool":
WaterResourcePool waterResourcePool =
waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id",
......
......@@ -636,7 +636,7 @@ public class ConfigureController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/iotMonthReport")
@ApiOperation(httpMethod = "GET", value = "物联报表-月", notes = "物联报表-月")
public ResponseModel equipList(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
public ResponseModel iotMonthReport(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate) {
......
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.entity.FormGroupColumn;
import com.yeejoin.equipmanage.service.IFormGroupColumnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* 动态表单控制器
*
* @author gaojianqiang
* @date 2022-10-09
*/
@RestController
@Api(tags = "动态表单分组列Api")
@RequestMapping(value = "/form-group-column", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FormGroupColumnController extends AbstractBaseController {
@Autowired
IFormGroupColumnService formGroupColumnService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通过分组code查询列信息", notes = "通过分组code查询列信息")
@RequestMapping(value = "/queryByGroup", method = RequestMethod.GET)
public List<FormGroupColumn> queryByGroup(@RequestParam String groupCode) {
return formGroupColumnService.queryByGroup(groupCode);
}
}
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.entity.FormGroupColumn;
import com.yeejoin.equipmanage.common.entity.dto.FormGroupColumnDto;
import com.yeejoin.equipmanage.service.IFormGroupColumnService;
import com.yeejoin.equipmanage.service.IFormInstanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* 动态表单控制器
*
* @author gaojianqiang
* @date 2022-10-09
*/
@RestController
@Api(tags = "动态表单实例Api")
@RequestMapping(value = "/form-instance", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FormInstanceController extends AbstractBaseController {
@Autowired
private IFormInstanceService formInstanceService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通过分组code查询列及值信息", notes = "通过分组code查询列及值信息")
@RequestMapping(value = "/queryColumnAndValueByGroup", method = RequestMethod.GET)
public List<FormGroupColumnDto> queryColumnAndValueByGroup(@RequestParam String groupCode, @RequestParam(required = false) Long instanceId) {
return formInstanceService.queryColumnAndValueByGroup(groupCode, instanceId);
}
}
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.*;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@Api(tags = "监盘总览组态需求 -- API")
@RequestMapping(value = "/supervisionConfigure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class SupervisionConfigureController extends AbstractBaseController {
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@Autowired
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
private IotFeign iotFeign;
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览水源信息")
@GetMapping("/getWaterInfo")
public ResponseModel getWaterInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfoBySuper(page, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览泡沫罐和水箱信息(监盘概览)")
@GetMapping("/getFoamTankBySuper")
public ResponseModel getFoamTankBySuper(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getFoamTankBySuper(page, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览管网压力信息(监盘概览)")
@GetMapping("/getPipeNetworkBySuper")
public ResponseModel getPipeNetworkBySuper(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getPipeNetworkBySuper(page, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览水池装置进水流量信息(监盘概览)")
@GetMapping("/getInfluentFlowBySuper")
public ResponseModel getInfluentFlowBySuper(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getInfluentFlowBySuper(page, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取某站下装备数量、摄像头数量(监盘概览)")
@GetMapping("/statisticsBySuper")
public ResponseModel statisticsByStation(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
if (ObjectUtils.isEmpty(bizOrgCode)){
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(fireFightingSystemMapper.statisticsByStation(bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "【监盘总览-排油系统信息】获取系统设备状态(根据系统编码查询)")
@GetMapping("/getEquipmentStateBySuper")
public ResponseModel getEquipmentStateBySuper(@RequestParam(required = false) String systemCode, CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page result = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
} else {
throw new BadRequest("系统编码不能为空");
}
return CommonResponseUtil.success(iFireFightingSystemService.equipmentStateBySuper(result, hashMap));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "【监盘总览-排油系统信息】获取系统工作状态(根据系统编码查询)")
@GetMapping("/getSystemStatusBySuper")
public ResponseModel getSystemStatusBySuper(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
} else {
throw new BadRequest("系统编码不能为空");
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemStatusBySuper(hashMap));
}
@PersonIdentify
@RequestMapping(value = "/fireAlarmLogPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
public ResponseModel pageQuery(@RequestParam(required = false) String system, @RequestParam(required = false) String specificIndexKey, CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request7 = new CommonRequest();
request7.setName("system");
request7.setValue(StringUtil.isNotEmpty(system) ? StringUtils.trimToNull(system) : null);
queryRequests.add(request7);
CommonRequest request8 = new CommonRequest();
request8.setName("specificIndexKey");
request8.setValue(StringUtil.isNotEmpty(specificIndexKey) ? StringUtils.trimToNull(specificIndexKey) : null);
queryRequests.add(request8);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
queryRequests.add(request13);
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
return CommonResponseUtil.success(equipmentSpecificAlarmService.fireAlarmLogPage(param));
}
@PersonIdentify
@RequestMapping(value = "/alarmTrend", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势")
public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
if (StringUtils.isBlank(bizOrgCode)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览稳压泵信息")
@GetMapping("/getPressurePumpInfo")
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
List<Long> ids = new ArrayList();
pressurePumpInfo.getRecords().stream().map(item -> {
item.put("monthStartNum", 0);
item.put("halfHourStartNum", 0);
item.put("twoHourStartNum", 0);
item.put("fourHourStartNum", 0);
item.put("update_time", "--");
item.put("equipment_index_name", "--");
String prefix = null;
String suffix = null;
String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
String nowStrLong = DateUtils.getNowStrLong();
Date mounthDate = DateUtils.dateAddMonths(null, -1);
Date halfHour = DateUtils.dateAddMinutes(null, -30);
Date twoHour = DateUtils.dateAddHours(null, -2);
Date fourHour = DateUtils.dateAddHours(null, -3);
String startDateStr = DateUtils.convertDateToString(mounthDate, DateUtils.DATE_TIME_PATTERN);
String half = DateUtils.convertDateToString(halfHour, DateUtils.DATE_TIME_PATTERN);
String two = DateUtils.convertDateToString(twoHour, DateUtils.DATE_TIME_PATTERN);
String four = DateUtils.convertDateToString(fourHour, DateUtils.DATE_TIME_PATTERN);
ResponseModel mounthEntity = null;
ResponseModel halfHourEntity = null;
ResponseModel twoHourEntity = null;
ResponseModel fourHourEntity = null;
try {
mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, "FHS_PressurePump_Start");
halfHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), half, nowStrLong, prefix, suffix, "FHS_PressurePump_Start");
twoHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), two, nowStrLong, prefix, suffix, "FHS_PressurePump_Start");
fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, "FHS_PressurePump_Start");
} catch (Exception e) {
e.printStackTrace();
}
if (200 == mounthEntity.getStatus()) {
String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("FHS_PressurePump_Start") && t.get("FHS_PressurePump_Start").equals("true"))).collect(Collectors.toList());
int num = collect.size();
item.put("monthStartNum", num);
} else if (200 == halfHourEntity.getStatus()) {
String json1 = JSON.toJSONString(halfHourEntity.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("FHS_PressurePump_Start") && t.get("FHS_PressurePump_Start").equals("true"))).collect(Collectors.toList());
int num = collect.size();
item.put("halfHourStartNum", num);
}else if (200 == twoHourEntity.getStatus()) {
String json1 = JSON.toJSONString(twoHourEntity.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("FHS_PressurePump_Start") && t.get("FHS_PressurePump_Start").equals("true"))).collect(Collectors.toList());
int num = collect.size();
item.put("twoHourStartNum", num);
} else if (200 == fourHourEntity.getStatus()) {
String json1 = JSON.toJSONString(fourHourEntity.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("FHS_PressurePump_Start") && t.get("FHS_PressurePump_Start").equals("true"))).collect(Collectors.toList());
int num = collect.size();
item.put("fourHourStartNum", num);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long nowDateTime = new Date().getTime();//当前时间戳
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
ids.add((Long) item.get("id"));
boolean time = false;
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", String.valueOf(stateMap.get("update_date")).replaceAll("T", " "));
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
if ("启动".equals(stateMap.get("equipment_index_name"))) {
long update_time = 0L;
try {
update_time = sdf.parse(String.valueOf(stateMap.get("update_date")).replaceAll("T", " ")).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
long res = nowDateTime - update_time;
long diffMinute = res / 1000 / 60;
if (diffMinute <= 5) {
time = true;
}
}
}
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常");
return item;
}).collect(Collectors.toList());
List<Map<String, Object>> stateMap = fireFightingSystemMapper.queryStartAndStopBySpecificId(ids);
long diffMinute = 0L;
if(!ObjectUtils.isEmpty(stateMap)){
List<Map<String, Object>> map = fireFightingSystemMapper.queryStateBySpecificId((long) stateMap.get(0).get("equipment_specific_id"));
String startTime = map.get(0).get("update_date").toString();
String endTime = map.get(1).get("update_date").toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long start =0L;
long end =0L;
try {
start = sdf.parse(startTime.replaceAll("T", " ")).getTime();
end = sdf.parse(endTime.replaceAll("T", " ")).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
long res = start - end;
diffMinute= res / 1000 / 60;
}
long finalDiffMinute = diffMinute;
pressurePumpInfo.getRecords().stream(
).map(item -> {
item.put("startAndStopInterval", finalDiffMinute);
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(pressurePumpInfo);
}
}
......@@ -219,4 +219,8 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
Map<String, Object> inspectionMessage(@Param("orgCode") String orgCode
, @Param("startTime") String startTime
, @Param("endTime") String endTime);
Page<Map<String, Object>> fireAlarmLogPage(Page page, @Param("param") CommonPageInfoParam param);
List<Map<String, Object>> alarmTrend(String bizOrgCode);
}
......@@ -314,6 +314,40 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @return
*/
Page<Map<String, Object>> getWaterInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode);
/**
* 获取水源信息(监盘概览)
*
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getWaterInfoBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 监盘概览泡沫罐和水箱信息(监盘概览)
* @param page
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getFoamTankBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 监盘概览管网压力信息(监盘概览)
* @param page
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getPipeNetworkBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 监盘概览水池装置进水流量信息(监盘概览)
* @param page
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getInfluentFlowBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取系统今日告警信息
*
......@@ -330,6 +364,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFireSystemInfo(HashMap<String, Object> hashMap);
/**
* 获取系统状态 大于0异常 小于0正常
* @param hashMap
* @return
*/
Integer getSystemStatus(HashMap<String, Object> hashMap);
/**
* 获取系统近一月告警设备top5
*
* @param hashMap
......@@ -346,6 +387,14 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String equipmentId(HashMap<String, Object> hashMap);
/**
* 获取设备id
*
* @param hashMap
* @return
*/
String equipmentIdBySuper(HashMap<String, Object> hashMap);
/**
* 获取系统设备状态
*
* @param page
......@@ -355,6 +404,15 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> equipmentState(Page page, String id);
/**
* 获取系统设备状态
*
* @param page
* @param id
* @return
*/
Page<Map<String, Object>> equipmentStateBySuper(Page page, String id);
/**
* 稳压泵信息
*
* @param page
......@@ -534,4 +592,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> selectDayEchart(@Param("systemId") String systemId,
@Param("date") String date,
@Param("indicator") List<String> indicator);
List<Map<String, Object>> queryStartAndStopBySpecificId(@Param("ids")List<Long> ids);
List<Map<String, Object>> queryStateBySpecificId(@Param("id")long id);
}
......@@ -91,4 +91,8 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
List<Map<String, Object>> fireFacilitiesList(String bizOrgCode, String startTime, String endTime);
Map<String, Object> dailyMaintenance(String bizOrgCode,String orgCode, String startTime, String endTime);
Map<String, Object> inspectionMessage(String orgCode, String startTime, String endTime);
Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param);
List<Map<String, Object>> alarmTrend(String bizOrgCode);
}
......@@ -242,12 +242,16 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap);
Integer getSystemStatusBySuper(HashMap<String, Object> hashMap);
Map<String, Object> equipAlarmTOP(HashMap<String, Object> hashMap);
Page<Map<String, Object>> getSmallWaterInfo(Page page, HashMap<String, Object> hashMap);
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
Page<Map<String, Object>> equipmentStateBySuper(Page result, HashMap<String, Object> hashMap);
Map<String, Object> statisticsByStation(String bizOrgCode);
Map<String, Object> todayAlarmEquipment(String bizOrgCode);
......
......@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.FormInstance;
import com.yeejoin.equipmanage.common.entity.dto.BuildSearchDTO;
import com.yeejoin.equipmanage.common.entity.dto.FormGroupColumnDto;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.vo.AreaTreeVo;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import java.util.LinkedHashMap;
......@@ -172,4 +172,6 @@ public interface IFormInstanceService extends IService<FormInstance> {
* @return List<Map < String, Object>>
*/
List<Map<String, Object>> getSpecialChildrenListByName(String parentId, String bizOrgCode, String name);
List<FormGroupColumnDto> queryColumnAndValueByGroup(String groupCode, Long instanceId);
}
......@@ -728,4 +728,15 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
public Map<String, Object> inspectionMessage(String orgCode, String startTime, String endTime) {
return equipmentSpecificAlarmMapper.inspectionMessage(orgCode, startTime, endTime);
}
@Override
public Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize());
return this.baseMapper.fireAlarmLogPage(result, param);
}
@Override
public List<Map<String, Object>> alarmTrend(String bizOrgCode) {
return this.baseMapper.alarmTrend(bizOrgCode);
}
}
......@@ -7,10 +7,9 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.service.*;
import org.apache.catalina.util.IOTools;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -73,28 +72,6 @@ import com.yeejoin.equipmanage.common.exception.BaseException;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.QRCodeUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IEquPropertyService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSystemSourceStatisticsService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IStockBillDetailService;
import com.yeejoin.equipmanage.service.IStockBillService;
import com.yeejoin.equipmanage.service.IStockDetailService;
import com.yeejoin.equipmanage.service.IStockService;
import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.ISystemDicService;
import com.yeejoin.equipmanage.service.IUploadFileService;
import com.yeejoin.equipmanage.service.IVideoEquipmentSpecificService;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IWarehouseService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import com.yeejoin.equipmanage.utils.RelationRedisUtil;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -173,6 +150,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private IVideoEquipmentSpecificService videoEquipmentSpecificService;
@Autowired
private IFormInstanceService formInstanceService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -1023,7 +1003,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentDetailService.removeById(equipmentSpecific.getEquipmentDetailId());
}
if (res > 0) {
return true;
// 删除设备动态表单扩展属性
return formInstanceService.deleteInstanceById(id);
} else {
return false;
}
......
......@@ -1290,6 +1290,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Integer getSystemStatusBySuper(HashMap<String, Object> hashMap) {
Integer systemStatus = fireFightingSystemMapper.getSystemStatus(hashMap);
return systemStatus;
}
@Override
public Map<String, Object> getSystemName(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
......@@ -1332,6 +1338,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Page<Map<String, Object>> equipmentStateBySuper(Page res, HashMap<String, Object> hashMap) {
Page result = new Page<>(res.getCurrent(), res.getSize());
String id = fireFightingSystemMapper.equipmentIdBySuper(hashMap);
if (!StringUtil.isNotEmpty(id)) {
return null;
}
Page<Map<String, Object>> mapPage = fireFightingSystemMapper.equipmentStateBySuper(result, id);
return mapPage;
}
@Override
public Page<Map<String, Object>> getSmallWaterInfo(Page page, HashMap<String, Object> hashMap) {
String bizOrgCode = null;
String systemCode = null;
......
......@@ -13,6 +13,7 @@ import com.yeejoin.equipmanage.common.entity.FormGroupColumn;
import com.yeejoin.equipmanage.common.entity.FormInstance;
import com.yeejoin.equipmanage.common.entity.SourceFile;
import com.yeejoin.equipmanage.common.entity.dto.BuildSearchDTO;
import com.yeejoin.equipmanage.common.entity.dto.FormGroupColumnDto;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.enums.GroupCodeEnum;
import com.yeejoin.equipmanage.common.enums.GroupColumnDataType;
......@@ -23,6 +24,7 @@ import com.yeejoin.equipmanage.mapper.FormInstanceMapper;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -564,4 +566,22 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
public List<Map<String, Object>> getSpecialChildrenListByName(String parentId, String bizOrgCode, String name) {
return this.baseMapper.querySpecialChildrenListByName(parentId, bizOrgCode, name);
}
@Override
public List<FormGroupColumnDto> queryColumnAndValueByGroup(String groupCode, Long instanceId) {
List<FormGroupColumnDto> list = new ArrayList<>();
List<FormGroupColumn> columnList = iFormGroupColumnService.queryByGroup(groupCode);
if (!CollectionUtils.isEmpty(columnList)) {
Map<String, Object> map = queryForMap(instanceId);
columnList.forEach(x -> {
FormGroupColumnDto dto = new FormGroupColumnDto();
BeanUtils.copyProperties(x, dto);
if (!map.isEmpty()) {
dto.setFieldValue(map.get(dto.getFieldName()).toString());
}
list.add(dto);
});
}
return list;
}
}
......@@ -1326,4 +1326,161 @@
LEFT JOIN p_point_classify ppc on pci.point_classify_id = ppc.id
)AS missedCheck
</select>
<select id="fireAlarmLogPage" resultType="java.util.HashMap">
SELECT
equipment_specific_index_name,
equipment_specific_name,
DATE_FORMAT(`wlesal`.`create_date`,'%m-%d %H:%i:%s') alarm_time,
location,
emergency_level_color,
IF
( `wlesal`.`clean_time` IS NOT NULL, '已消除', '未消除' ) AS `cleanStatus`
FROM
`wl_equipment_specific_alarm_log` `wlesal`
LEFT JOIN `wl_equipment_specific` `wles` ON `wlesal`.`equipment_specific_id` = `wles`.`id`
<where>
<if test="param.system != null and param.system != ''">
find_in_set( #{param.system}, `wlesal`.`system_codes` )
</if>
<if test="param.fireEquipmentSpecificIndexKey != null and param.fireEquipmentSpecificIndexKey != ''">
AND wles.equipment_specific_index_key like concat (#{param.fireEquipmentSpecificIndexKey},'%')
</if>
<if test="param.bizOrgCode != null and param.bizOrgCode != ''">
AND wles.biz_org_code like concat (#{param.bizOrgCode},'%')
</if>
</where>
ORDER BY
`wlesal`.`create_date` DESC
</select>
<select id="alarmTrend" resultType="java.util.Map">
SELECT
`result`.`click_date` AS `click_date`,
`a`.`fireAlarmNum` AS `fireAlarmNum`,
`b`.`breakdownNum` AS `breakdownNum`,
`c`.`shieldNum` AS `shieldNum`,
`d`.`otherNum` AS `otherNum`
FROM
((((
`v_monitor_event_utils_week` `result`
LEFT JOIN (
SELECT
`weekUtil`.`click_date` AS `click_date`,
ifnull( count( `fireAlarm`.`id` ), 0 ) AS `fireAlarmNum`
FROM
(
`v_monitor_event_utils_week` `weekUtil`
LEFT JOIN (
SELECT
log.*
FROM
`wl_equipment_specific_alarm_log` `log`
LEFT JOIN wl_equipment_specific wes ON `log`.equipment_specific_id = wes.id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
) fireAlarm ON (((
date_format( `fireAlarm`.`create_date`, '%Y-%m-%d' ) = `weekUtil`.`click_date`
)
AND ( `fireAlarm`.`equipment_specific_index_name` = '火警' )
)))
GROUP BY
`weekUtil`.`click_date`
ORDER BY
`weekUtil`.`click_date`
) `a` ON ((
`a`.`click_date` = `result`.`click_date`
)))
LEFT JOIN (
SELECT
`weekUtil`.`click_date` AS `click_date`,
ifnull( count( `breakdown`.`id` ), 0 ) AS `breakdownNum`
FROM
(
`v_monitor_event_utils_week` `weekUtil`
LEFT JOIN (
SELECT
log.*
FROM
`wl_equipment_specific_alarm_log` `log`
LEFT JOIN wl_equipment_specific wes ON `log`.equipment_specific_id = wes.id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
) `breakdown` ON (((
`weekUtil`.`click_date` = date_format( `breakdown`.`create_date`, '%Y-%m-%d' ))
AND ( `breakdown`.`equipment_specific_index_name` = '故障' ))))
GROUP BY
`weekUtil`.`click_date`
ORDER BY
`weekUtil`.`click_date`
) `b` ON ((
`b`.`click_date` = `result`.`click_date`
)))
LEFT JOIN (
SELECT
`weekUtil`.`click_date` AS `click_date`,
ifnull( count( `shield`.`id` ), 0 ) AS `shieldNum`
FROM
(
`v_monitor_event_utils_week` `weekUtil`
LEFT JOIN (
SELECT
log.*
FROM
`wl_equipment_specific_alarm_log` `log`
LEFT JOIN wl_equipment_specific wes ON `log`.equipment_specific_id = wes.id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
) `shield` ON (((
date_format( `shield`.`create_date`, '%Y-%m-%d' ) = `weekUtil`.`click_date`
)
AND ( `shield`.`equipment_specific_index_name` = '屏蔽' ))))
GROUP BY
`weekUtil`.`click_date`
ORDER BY
`weekUtil`.`click_date`
) `c` ON ((
`c`.`click_date` = `result`.`click_date`
)))
LEFT JOIN (
SELECT
`weekUtil`.`click_date` AS `click_date`,
ifnull( count( `other`.`id` ), 0 ) AS `otherNum`
FROM
(
`v_monitor_event_utils_week` `weekUtil`
LEFT JOIN (
SELECT
log.*
FROM
`wl_equipment_specific_alarm_log` `log`
LEFT JOIN wl_equipment_specific wes ON `log`.equipment_specific_id = wes.id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
) `other` ON (((
date_format( `other`.`create_date`, '%Y-%m-%d' ) = `weekUtil`.`click_date`
)
AND (
`other`.`equipment_specific_index_name` NOT IN ( '火警', '故障', '屏蔽' )))))
GROUP BY
`weekUtil`.`click_date`
ORDER BY
`weekUtil`.`click_date`
) `d` ON ((
`d`.`click_date` = `result`.`click_date`
)))
ORDER BY
`result`.`click_date` DESC
</select>
</mapper>
\ No newline at end of file
......@@ -2574,6 +2574,17 @@
code = #{systemCode}
</select>
<select id="equipmentIdBySuper" resultType="String">
select
id
from
f_fire_fighting_system
where
code = #{systemCode}
and
biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<select id="equipmentState" resultType="java.util.Map">
<!-- SELECT-->
<!-- b.equipName,-->
......@@ -2640,6 +2651,43 @@
b.totalNum DESC
</select>
<select id="equipmentStateBySuper" resultType="java.util.Map">
SELECT
b.equipName,
( CASE WHEN b.totalAlarmNum > 0 THEN '异常' ELSE '正常' END ) `status`,
b.totalAlarmNum AS alarmNum,
b.`code` AS equipDetailCode,
b.totalNum
FROM
(
SELECT
a.equipName,
count( DISTINCT wesi.equipment_specific_id ) AS totalAlarmNum,
a.`code`,
count( DISTINCT a.id ) AS totalNum
FROM
(
SELECT
eq.`name` AS equipName,
eq.id AS equipmentId,
eq.`code` AS `code`,
wes.id
FROM
wl_equipment eq
LEFT JOIN wl_equipment_detail wed ON eq.id = wed.equipment_id
LEFT JOIN wl_equipment_specific wes ON wed.id = wes.equipment_detail_id
WHERE
FIND_IN_SET( #{id}, wes.system_id ) > 0
) a
LEFT JOIN wl_equipment_specific_index wesi ON wesi.equipment_specific_id = a.id
AND ((wesi.`is_alarm` = 1 and wesi.`value` = 'true') or (wesi.`is_alarm` = 0 and wesi.`value` = 'false'))
GROUP BY
a.equipmentId
) b
ORDER BY
b.totalNum DESC
</select>
<select id="getPressurePumpInfo" resultType="java.util.Map">
SELECT
ed.`name`,
......@@ -3621,7 +3669,7 @@
wesp.`code` AS num,
ifNull(ed.standard,"") AS type,
ifNull(mi.`name`,"") as manufacturer,
ifNull( wws.full_name,"") as address,
ifNull(concat(wws.full_name,'--',ed.area) ,"") as address,
ifNull(eq.`name`,"") AS equType,
wesp.biz_org_name AS bizOrgName,
wesp.id,
......@@ -4361,4 +4409,342 @@
wcp.create_date BETWEEN DATE_SUB(NOW(),INTERVAL 7 DAY) and now()
and equipment_index_key = 'FireCar_Start' and value = 'true' and car_id = #{carId}
</select>
<select id="getWaterInfoBySuper" resultType="java.util.Map">
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
fs.`code` AS systemCode
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific es ON es.id = rp.level_device_id
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
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
WHERE
r.resource_type IN ( 'pool', 'industryPool' )
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
ORDER BY
levelStatus DESC
</select>
<select id="getFoamTankBySuper" resultType="java.util.Map">
SELECT
a.`name`,
IFNULL(a.nowLevel, '--') AS nowLevel,
a.id,
IFNULL(a.image, '') AS image,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
'foamTank' AS type
FROM
(
SELECT
ed.`name`,
es.iot_code,
es.id,
ec.image,
max( CASE WHEN ei.equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' THEN ei.`value` END ) AS nowLevel,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) AS minLevel,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) AS maxLevel
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_specific_index ei ON es.id = ei.equipment_specific_id
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
LEFT JOIN wl_equipment_category ec ON e.category_id = ec.id
LEFT JOIN wl_form_instance fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92031900%'
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND es.iot_code IS NOT NULL
GROUP BY
es.id
) a UNION ALL
SELECT
a.`name`,
IFNULL(a.nowLevel, '--') as nowLevel,
a.id,
IFNULL(a.image, '') AS image,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.type AS type
FROM
(
SELECT
r.`name`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`value` END ) AS nowLevel,
ec.image,
r.resource_type AS type,
r.sequence_nbr AS id
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
WHERE
r.resource_type = 'waterTank'
AND r.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND r.is_delete = 1
GROUP BY
r.sequence_nbr
) a
</select>
<select id="getPipeNetworkBySuper" resultType="java.util.Map">
SELECT
a.`name`,
IFNULL(a.area, '') AS area,
a.id,
IFNULL(a.nowPressure, '--') AS nowPressure,
a.nowPressureDate,
(
CASE
WHEN nowPressure IS NOT NULL
AND minLevel IS NOT NULL
AND nowPressure >= minLevel THEN
'正常'
WHEN nowPressure IS NOT NULL
AND minLevel IS NOT NULL
AND minLevel > nowPressure THEN
'压力低' ELSE '--'
END
) AS `status`
FROM
(
SELECT
ed.`name`,
concat_ws( '-', ws.full_name, ed.area ) area,
es.id,
max( CASE WHEN ei.equipment_index_key = 'FHS_PipePressureDetector_PipePressure' THEN ei.`value` END ) AS nowPressure,
IF
((
max( CASE WHEN ei.equipment_index_key = 'FHS_PipePressureDetector_PipePressure' THEN ei.`value` END ) IS NOT NULL
),
max( CASE WHEN ei.equipment_index_key = 'FHS_PipePressureDetector_PipePressure' THEN DATE_FORMAT( ei.`update_date`, '%m-%d %H:%i:%S' ) END ),
'--'
) AS nowPressureDate,
max( CASE WHEN fi.field_name = 'lowLevel' THEN fi.field_value END ) AS minLevel,
max( CASE WHEN fi.field_name = 'highLevel' THEN fi.field_value END ) AS maxLevel
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment_specific_index ei ON es.id = ei.equipment_specific_id
LEFT JOIN wl_form_instance fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92011000%'
AND es.iot_code IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
es.id
) a
</select>
<select id="getInfluentFlowBySuper" resultType="java.util.Map">
SELECT
ed.`name`,
IFNULL(concat_ws( '-', ws.full_name, ed.area ), '') AS area,
es.id,
IFNULL( max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_InfluentFlow' THEN ei.`value` END ), '--' ) AS nowInfluentFlow,
IF
((
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_InfluentFlow' THEN ei.`value` END ) IS NOT NULL
),
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_InfluentFlow' THEN DATE_FORMAT( ei.`update_date`, '%m-%d %H:%i:%S' ) END ),
'--'
) AS nowInfluentFlowDate
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment_specific_index ei ON es.id = ei.equipment_specific_id
LEFT JOIN wl_form_instance fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92010700%'
AND es.iot_code IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
GROUP BY
es.id
</select>
<select id="getSystemStatus" resultType="java.lang.Integer">
SELECT
count( DISTINCT equipment_specific_id ) AS isAlarm
FROM
wl_equipment_specific_index
WHERE
equipment_specific_id IN ( SELECT id FROM wl_equipment_specific WHERE FIND_IN_SET( #{id}, system_id ) > 0 AND biz_org_code LIKE concat(#{bizOrgCode}, '%') )
AND ((
`is_alarm` = 1
AND `value` = 'true'
)
OR ( `is_alarm` = 0 AND `value` = 'false' ))
</select>
<select id="queryStartAndStopBySpecificId" resultType="java.util.Map">
SELECT
i.equipment_specific_id,
i.update_date,
i.equipment_index_name
FROM
wl_equipment_specific_index i
WHERE
<if test="ids != null and ids.size > 0">
i.equipment_specific_id IN
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
AND i.equipment_index_key in ('FHS_PressurePump_Start', 'FHS_PressurePump_Stop')
ORDER BY
i.update_date DESC
</select>
<select id="queryStateBySpecificId" resultType="java.util.Map">
SELECT
i.update_date,
i.equipment_index_name
FROM
wl_equipment_specific_index i
WHERE
i.equipment_specific_id = #{id,jdbcType=VARCHAR}
AND i.equipment_index_key in ('FHS_PressurePump_Start', 'FHS_PressurePump_Stop')
ORDER BY
i.update_date DESC
</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