Commit 6e011ed4 authored by zhangsen's avatar zhangsen

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

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/WaterResourceController.java
parents 5f05594b 9d67bc0e
......@@ -382,7 +382,7 @@ public class WaterResourceDto extends BaseDto {
@ExcelIgnore
@ApiModelProperty("水池液位显示装置id")
private Long levelDeviceId;
private List<String> levelDeviceId;
@ApiModelProperty("水池液位显示装置名称")
@ExcelProperty(value = "水池液位显示装置", index = 45)
......
......@@ -69,7 +69,7 @@ public class WaterResourcePoolDto extends BaseDto {
private float maxWaterLevel;
@ApiModelProperty("水池液位显示装置id")
private Long levelDeviceId;
private String levelDeviceId;
@ApiModelProperty("水池液位显示装置名称")
private String levelDeviceName;
......
......@@ -104,7 +104,7 @@ public class WaterResourcePool extends BaseEntity {
* 水池液位显示装置id
*/
@TableField("level_device_id")
private Long levelDeviceId;
private String levelDeviceId;
/**
* 水池液位显示装置名称
......
......@@ -10,6 +10,7 @@ public enum WaterResourceTypeEnum {
消防水鹤("crane", "消防水鹤"),
消防水池("pool", "消防水池"),
天然水源("natural", "天然水源"),
消防水箱("waterTank", "消防水箱"),
工业水池("industryPool", "工业水池");
private String code;
......
......@@ -38,12 +38,15 @@ public class Equipment extends BaseEntity {
@ApiModelProperty(value = "国别")
private String country;
@ApiModelProperty(value = "保养周期")
@ApiModelProperty(value = "维保周期")
private Short maintenanceCycle;
@ApiModelProperty(value = "检查周期(天)")
private Short checkCycle;
@ApiModelProperty(value = "报废期限")
private Short expiryDate;
private String remark;
@ApiModelProperty(value = "管理方式 单件还是批量管理模式,单件S,批量:P")
......
......@@ -179,4 +179,10 @@ public class EquipmentDetail extends BaseEntity {
@TableField(value = "latitude")
private Double latitude;
@TableField(exist = false)
private List<UploadFile> quality;
@TableField(exist = false)
private List<UploadFile> operation;
}
......@@ -4,6 +4,7 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
......@@ -159,4 +160,13 @@ public class EquipmentSpecific extends BaseEntity {
@ApiModelProperty(value = "设备值说明")
@TableField("value_label")
private String valueLabel;
@ApiModelProperty(value = "质保信息")
@TableField("warranty_info")
private String warrantyInfo;
@ApiModelProperty(value = "质保周期")
@TableField("warranty_period")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date warrantyPeriod;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@TableName("wl_supervision_video")
@ApiModel(value = "Video对象", description = "")
public class SupervisionVideo extends BaseEntity {
private String bizOrgCode;
private String cameraId;
}
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;
}
......@@ -2,7 +2,8 @@ package com.yeejoin.equipmanage.common.enums;
public enum FileTypeEnum {
image("图片"),video("视频"),instruction("说明"),certificate("资质"),face("平面图");
image("图片"),video("视频"),instruction("说明"),certificate("资质"),
face("平面图"),quality("合格证"),operation("操作说明");
String describe;
......
......@@ -24,7 +24,10 @@ public enum GroupCodeEnum {
R_RAIN_ROOM("雨淋阀间","r_rainRoom","YLFJ"),
R_FIRE_FOAM_ROOM("消防泡沫间","r_fireFoamRoom","PMJ"),
R_FIRE_CONTROL_ROOM("消防控制室","r_fireControlRoom","XKS"),
FLOOR("楼层","floor","LC");
FLOOR("楼层","floor","LC"),
PMYG("泡沫液罐","92031900","PMYG"),
GWYLTCQ("管网压力探测器","92011000","GWYLTCQ"),
XFSCZZ("消防水池装置","92010700","XFSCZZ");
private String groupName;
private String groupCode;
......
......@@ -5,5 +5,5 @@ package com.yeejoin.equipmanage.common.enums;
* @author DELL
*/
public enum GroupColumnDataType {
String, Integer,datetime, Enum,Double,Date,Boolean,Array,File,InstanceId
String, Integer,datetime, Enum,Double,Date,Boolean,Array,File,InstanceId,inputNumber
}
package com.yeejoin.equipmanage.common.enums;
public enum PressurePumpCheckEnum {
LE("le", "小于等于"),
GE("ge", "大于等于"),
BE("be", "在两者之间");
private String code;
private String describe;
private PressurePumpCheckEnum(String code, String describe) {
this.code = code;
this.describe = describe;
}
public String getCode() {
return code;
}
public String getDescribe() {
return describe;
}
public static PressurePumpCheckEnum getByCode(String code) {
for (PressurePumpCheckEnum l : PressurePumpCheckEnum.values()) {
if (code.equals(l.getCode())) {
return l;
}
}
return null;
}
}
package com.yeejoin.equipmanage.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum PressurePumpEnum {
// ALONE_START_YXSC("FHS_PressurePump_Start_ALONE_START_YXSC", "ge", "5", "", "aaa", "bbb", "last"),
ALONE_START_QT("FHS_PressurePump_Start_ALONE_START_QT", PressurePumpCheckEnum.LE.getCode(), "", "5",
PressurePumpValueEnum.LAST_STOP.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ.getCode()),
ALONE_STOP_QT("FHS_PressurePump_Stop_ALONE_STOP_QT", PressurePumpCheckEnum.GE.getCode(), "5", "",
PressurePumpValueEnum.LAST_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ_YXSC.getCode()),
ALL_START_QT_WJ("FHS_PressurePump_Start_ALL_START_QT_WJ", PressurePumpCheckEnum.LE.getCode(), "", "30",
PressurePumpValueEnum.LATELY_STOP.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ.getCode()),
ALL_START_QT_YZ("FHS_PressurePump_Start_ALL_START_QT_YZ", PressurePumpCheckEnum.BE.getCode(), "30", "60",
PressurePumpValueEnum.LATELY_STOP.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_YZ.getCode()),
ALL_START_QT_YB("FHS_PressurePump_Start_ALL_START_QT_YB", PressurePumpCheckEnum.BE.getCode(), "60", "240",
PressurePumpValueEnum.LATELY_STOP.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_YB.getCode()),
ALL_STOP_QT_WJ("FHS_PressurePump_Stop_ALL_STOP_QT_WJ", PressurePumpCheckEnum.LE.getCode(), "", "30",
PressurePumpValueEnum.LATELY_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ.getCode()),
ALL_STOP_QT_YZ("FHS_PressurePump_Stop_ALL_STOP_QT_YZ", PressurePumpCheckEnum.BE.getCode(), "30", "60",
PressurePumpValueEnum.LATELY_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_YZ.getCode()),
ALL_STOP_QT_YB("FHS_PressurePump_Stop_ALL_STOP_QT_YB", PressurePumpCheckEnum.BE.getCode(), "60", "240",
PressurePumpValueEnum.LATELY_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_YB.getCode());
private String code;
private String operator;
private String leftValue;
private String rightValue;
private String compareValue;
private String level;
private PressurePumpEnum(String code, String operator, String leftValue, String rightValue, String compareValue, String level) {
this.code = code;
this.operator = operator;
this.leftValue = leftValue;
this.rightValue = rightValue;
this.compareValue = compareValue;
this.level = level;
}
public static List<PressurePumpEnum> getEnumListByCode(String code) {
List<PressurePumpEnum> list = new ArrayList<>();
for(PressurePumpEnum e : PressurePumpEnum.values()) {
if (e.getCode().startsWith(code)) {
list.add(e);
}
}
return list;
}
public String getCode() {
return code;
}
public String getOperator() {
return operator;
}
public String getLeftValue() {
return leftValue;
}
public String getRightValue() {
return rightValue;
}
public String getCompareValue() { return compareValue; }
public String getLevel() { return level; }
}
package com.yeejoin.equipmanage.common.enums;
public enum PressurePumpMessageEnum {
MESSAGE_LEVEL_YB("YB", "【%s】分钟内,启停间隔较小", "","名称:稳压泵启停异常提醒;时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,请及时查看处理"),
MESSAGE_LEVEL_YZ("YZ", "【%s】分钟内,启停间隔较小", "", "名称:稳压泵启停异常提醒;时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,请及时查看处理"),
MESSAGE_LEVEL_QT_WJ("QT_WJ", "【%s】分钟内,设备启停频繁", "", "名称:漏水提醒; 时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,可能存在漏水,请及时查看处理"),
MESSAGE_LEVEL_QT_WJ_YXSC("WJ_YXSC", "运行时长超过【%s】分钟,存在漏水可能", "", "名称:漏水提醒; 时间:%s;内容:【%s】- 【%s】 - 运行时长超过【%s】分钟,存在漏水可能,请及时查看处理");
private String code;
private String allMessage;
private String marqueeMessage;
private String recordMessage;
private PressurePumpMessageEnum(String code, String allMessage, String marqueeMessage,String recordMessage) {
this.code = code;
this.allMessage = allMessage;
this.marqueeMessage = marqueeMessage;
this.recordMessage = recordMessage;
}
public String getCode() {
return code;
}
public String getAllMessage() {
return allMessage;
}
public String getMarqueeMessage() {
return marqueeMessage;
}
public String getRecordMessage() {
return recordMessage;
}
public static PressurePumpMessageEnum getByCode(String code) {
for (PressurePumpMessageEnum l : PressurePumpMessageEnum.values()) {
if (code.equals(l.getCode())) {
return l;
}
}
return null;
}
}
package com.yeejoin.equipmanage.common.enums;
public enum PressurePumpValueEnum {
LAST_STOP("lastStop", "上次停泵时间"),
LAST_START("lastStart", "上次启泵时间"),
LATELY_STOP("latelyStop", "所有泵最近一次停泵时间"),
LATELY_START("latelyStart", "所有泵最近一次启泵时间");
private String code;
private String describe;
private PressurePumpValueEnum(String code, String describe) {
this.code = code;
this.describe = describe;
}
public String getCode() {
return code;
}
public String getDescribe() {
return describe;
}
public static PressurePumpValueEnum getByCode(String code) {
for (PressurePumpValueEnum l : PressurePumpValueEnum.values()) {
if (code.equals(l.getCode())) {
return l;
}
}
return null;
}
}
......@@ -216,7 +216,7 @@ public class OrgUsrController extends BaseController {
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUnit/{code}", method = RequestMethod.GET)
@RequestMapping(value = "/getUnitByCode/{code}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取单位详情", notes = "获取单位详情")
public ResponseModel<OrgUsrFormDto> selectByCode(HttpServletRequest request, @PathVariable String code) throws Exception {
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>();
......
......@@ -138,12 +138,14 @@ public class WaterResourceController extends BaseController {
waterResourceNaturalService.createWithModel(waterResourceNaturalDto);
break;
case "pool":
case "waterTank":
case "industryPool":
// 新增基础信息
model.setIsIot(true);
waterResourceServiceImpl.createWithModel(model);
WaterResourcePoolDto waterResourcePoolDto = new WaterResourcePoolDto();
BeanUtils.copyProperties(model, waterResourcePoolDto);
BeanUtils.copyProperties(model, waterResourcePoolDto, "levelDeviceId");
waterResourcePoolDto.setLevelDeviceId(String.join(",", model.getLevelDeviceId()));
waterResourcePoolDto.setSequenceNbr(null);
waterResourcePoolDto.setResourceId(model.getSequenceNbr());
waterResourcePoolService.createWithModel(waterResourcePoolDto);
......@@ -282,6 +284,7 @@ public class WaterResourceController extends BaseController {
waterResourceNaturalService.updateWithModel(waterResourceNaturalDto);
break;
case "industryPool":
case "waterTank":
case "pool":
WaterResourcePoolDto waterResourcePoolDto = new WaterResourcePoolDto();
WaterResourcePool waterResourcePool =
......@@ -408,11 +411,13 @@ 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",
sequenceNbr));
BeanUtils.copyProperties(waterResourcePool, waterResourceDto);
BeanUtils.copyProperties(waterResourcePool, waterResourceDto, "levelDeviceId");
waterResourceDto.setLevelDeviceId(Arrays.asList(waterResourcePool.getLevelDeviceId().split(",")));
break;
default:
break;
......
......@@ -167,9 +167,10 @@ public class BuildingController extends AbstractBaseController {
@ApiOperation(value = "通用保存")
public Object save(
@RequestParam(value = "groupCode") String groupCode,
@RequestParam(value = "instanceId", required = false) String instanceId,
@RequestBody Map<String, Object> map) {
String orgCode = getOrgCode();
return buildService.saveForm(groupCode, orgCode, map);
return buildService.saveForm(groupCode, orgCode, map, instanceId);
}
@GetMapping(value = "/pointTree")
......
......@@ -188,6 +188,10 @@ public class ConfigureController extends AbstractBaseController {
if (!CollectionUtils.isEmpty(fireCarInfoByWL.getRecords())) {
List<Map<String, Object>> records = fireCarInfoByWL.getRecords();
records.forEach(item -> {
String carId = item.get("id").toString();
Map<String, Object> fireCaStartBySeven = fireFightingSystemMapper.getFireCaStartBySeven(carId);
Object count = fireCaStartBySeven.get("count");
item.put("count",count.toString());
if (item.containsKey("carStateDate") && !ObjectUtils.isEmpty(item.get("carStateDate"))) {
try {
Date carStateDate = DateUtils.dateParse(item.get("carStateDate").toString(), "yyyy-MM-dd'T'HH:mm:ss");
......@@ -632,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.*;
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 com.yeejoin.equipmanage.service.ISupervisionVideoService;
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.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;
@Autowired
private ISupervisionVideoService supervisionVideoService;
@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);
}
@PersonIdentify
@RequestMapping(value = "/addVideo", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "添加视频", produces = "application/json;charset=UTF-8", notes = "添加视频")
public ResponseModel addVideo(@RequestParam String ids, @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(supervisionVideoService.addVide(ids, bizOrgCode));
}
@PersonIdentify
@RequestMapping(value = "/queryVideoList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询视频列表", produces = "application/json;charset=UTF-8", notes = "查询视频列表")
public ResponseModel queryVideoList(@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(supervisionVideoService.queryVideoList(bizOrgCode));
}
@PersonIdentify
@RequestMapping(value = "/delVideo", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "删除视频", produces = "application/json;charset=UTF-8", notes = "删除视频")
public ResponseModel delVideo(String id) {
return CommonResponseUtil.success(supervisionVideoService.deleteVideo(id));
}
@PersonIdentify
@RequestMapping(value = "/queryVideoAllId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询对应站下所有视频id", produces = "application/json;charset=UTF-8", notes = "根据id查询视频")
public ResponseModel queryVideoAllId(@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(supervisionVideoService.queryVideoAllId(bizOrgCode));
}
}
......@@ -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);
}
......@@ -110,4 +110,7 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndex> getEquipmentSpeIndexByIotCodeTrend(String iotCode, Integer isTrend, String fieldKey);
List<Map<String, Object>> getEquipSpecificScrap();
List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex);
}
......@@ -300,12 +300,54 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getFireCarInfoByWL(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 物联监控页面消防车辆信息
*
* @param carId
* @return
*/
Map<String, Object> getFireCaStartBySeven(@Param("carId") String carId);
/**
* 获取水源信息
*
* @param bizOrgCode
* @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);
/**
* 获取系统今日告警信息
*
......@@ -322,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
......@@ -338,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
......@@ -347,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
......@@ -387,18 +453,25 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getSystemAlarmInfoNum(@Param("bizOrgCode") String bizOrgCode);
/**
* 消防水池或者工业水池信息
* 工业水池信息
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getWaterPoolInfoNum(@Param("bizOrgCode") String bizOrgCode, @Param("poolType") String poolType);
List<Map<String, Object>> getWaterIndustryPoolInfoNum(@Param("bizOrgCode") String bizOrgCode);
/**
* 消防水源总量统计
* @param companyCode
* 消防水池信息
* @param bizOrgCode
* @return
*/
Map<String, Object> getWaterPoolVolumeInfo(@Param("companyCode") String companyCode);
List<Map<String, Object>> getWaterPoolInfoNum(@Param("bizOrgCode") String bizOrgCode);
// /**
// * 消防水源总量统计
// * @param companyCode
// * @return
// */
// Map<String, Object> getWaterPoolVolumeInfo(@Param("companyCode") String companyCode);
/**
* 获取车辆总数
......@@ -526,4 +599,14 @@ 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);
Map<String, Object> getFoamTankLevel(@Param("equipSpeId") Long equipSpeId);
Map<String, Object> getPipeNetwork(@Param("equipSpeId") Long equipSpeId);
}
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface SupervisionVideoMapper extends BaseMapper<SupervisionVideo> {
List<Map<String, Object>> getVideoByCompany(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> queryVideoAllId(@Param("bizOrgCode")String bizOrgCode);
}
......@@ -53,7 +53,7 @@ public enum SyncRiskOperator {
newMap.put("parentId", item.get("parentId"));
RiskSource riskSource1 = new RiskSource();
Map<String, Object> createMap = formInstanceService.createByMap(String.valueOf(item.get("groupCode")),
String.valueOf(map.get("companyCode")), newMap);
String.valueOf(map.get("companyCode")), newMap, null);
riskSource1.setParentId(Long.parseLong(String.valueOf(map.get("riskPointId"))));
riskSource1.setName(String.valueOf(item.get("buildName")));
riskSource1.setId(Long.parseLong(String.valueOf(createMap.get("instanceId"))));
......
......@@ -98,7 +98,7 @@ public interface IBuilldService extends IService<Building> {
* @param map form
* @return Object
*/
Object saveForm(String groupCode, String companyCode, Map<String, Object> map);
Object saveForm(String groupCode, String companyCode, Map<String, Object> map, String caseId);
/**
* 通用表单更新
......
......@@ -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);
}
......@@ -27,4 +27,11 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif
* @Date 2020/11/3 17:58
*/
List<EquipmentSpecificIndex> getEquipmentSpeIndexBySpeIotCode(String iotCode);
/**
* 根据指标key查询列表
* @param listIndex keys
* @return 列表
*/
List<EquipmentSpecificIndex> getEquipmentSpeIndexByIndex(List<String> listIndex);
}
......@@ -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;
......@@ -35,7 +35,7 @@ public interface IFormInstanceService extends IService<FormInstance> {
* @param map 字段值对象
* @return Map<String, Object>
*/
Map<String, Object> createByMap(String groupCode, String companyCode, Map<String, Object> map);
Map<String, Object> createByMap(String groupCode, String companyCode, Map<String, Object> map, String caseId);
/**
* 更新
......@@ -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);
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import java.util.List;
import java.util.Map;
/**
* @author ZeHua Li
* @date 2020/11/23 15:28
* @since v2.0
*/
public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List queryVideoList(String bizOrgCode);
int deleteVideo(String id);
boolean addVide(String ids,String bizOrgCode);
List<Map<String,Object>> queryVideoAllId(String bizOrgCode);
}
......@@ -299,7 +299,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
@Override
public Object saveForm(String groupCode, String companyCode, Map<String, Object> map) {
public Object saveForm(String groupCode, String companyCode, Map<String, Object> map, String caseId) {
final String instanceId = "instanceId";
//1.保存表单数据
//前端的address中携带了经纬度,后台切割保存
......@@ -325,7 +325,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
// }
}
Map<String, Object> formKeyMap = iFormInstanceService.createByMap(groupCode, companyCode, map);
Map<String, Object> formKeyMap = iFormInstanceService.createByMap(groupCode, companyCode, map, caseId);
if (formKeyMap.get(instanceId) != null) {
//2.保存图片
this.saveFiles(Long.parseLong(formKeyMap.get("instanceId").toString()), map);
......
......@@ -143,6 +143,8 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
equipmentDetail.setVideo(getEquipFileList(id, FileTypeEnum.video.toString()));
equipmentDetail.setCertification(getEquipFileList(id, FileTypeEnum.certificate.toString()));
equipmentDetail.setInstruction(getEquipFileList(id, FileTypeEnum.instruction.toString()));
equipmentDetail.setQuality(getEquipFileList(id, FileTypeEnum.quality.toString()));
equipmentDetail.setOperation(getEquipFileList(id, FileTypeEnum.operation.toString()));
if (equipmentDetail.getCountry() != null) {
equipmentDetail.setCountryName(
iSystemDicService.getOne(new QueryWrapper<SystemDic>().eq("id", equipmentDetail.getCountry())).getName());
......@@ -225,6 +227,8 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
fileList.addAll(fillFileList(equipmentDetail.getVideo(), equipmentDetail.getId(), FileTypeEnum.video.toString()));
fileList.addAll(fillFileList(equipmentDetail.getCertification(), equipmentDetail.getId(), FileTypeEnum.certificate.toString()));
fileList.addAll(fillFileList(equipmentDetail.getInstruction(), equipmentDetail.getId(), FileTypeEnum.instruction.toString()));
fileList.addAll(fillFileList(equipmentDetail.getQuality(), equipmentDetail.getId(), FileTypeEnum.quality.toString()));
fileList.addAll(fillFileList(equipmentDetail.getOperation(), equipmentDetail.getId(), FileTypeEnum.operation.toString()));
iUploadFileService.saveBatch(fileList);
}
......
......@@ -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);
}
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificIndexMapper;
......@@ -23,4 +24,9 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec
public List<EquipmentSpecificIndex> getEquipmentSpeIndexBySpeIotCode(String iotCode) {
return this.baseMapper.getEquipmentSpeIndexBySpeIotCode(iotCode);
}
@Override
public List<EquipmentSpecificIndex> getEquipmentSpeIndexByIndex(List<String> listIndex) {
return this.baseMapper.getEquipIndexInIndex(listIndex);
}
}
......@@ -6,11 +6,12 @@ import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
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;
......@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -73,28 +75,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 +153,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private IVideoEquipmentSpecificService videoEquipmentSpecificService;
@Autowired
private IFormInstanceService formInstanceService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -182,6 +165,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${equipment.type}")
String equipmentCategoryLeftTypeCode;
@Value("${equipment.scrap.day}")
String equipmentScrapDay;
@Autowired
private ISyncDataService syncDataService;
......@@ -447,6 +433,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
fileList.addAll(fillFileList(equipmentDetail.getVideo(), equipmentDetail.getId(), FileTypeEnum.video.toString()));
fileList.addAll(fillFileList(equipmentDetail.getCertification(), equipmentDetail.getId(), FileTypeEnum.certificate.toString()));
fileList.addAll(fillFileList(equipmentDetail.getInstruction(), equipmentDetail.getId(), FileTypeEnum.instruction.toString()));
fileList.addAll(fillFileList(equipmentDetail.getQuality(), equipmentDetail.getId(), FileTypeEnum.quality.toString()));
fileList.addAll(fillFileList(equipmentDetail.getOperation(), equipmentDetail.getId(), FileTypeEnum.operation.toString()));
iUploadFileService.saveBatch(fileList);
}
equipmentDetailService.saveOrUpdateBatch(equipmentDetails);
......@@ -1023,7 +1011,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentDetailService.removeById(equipmentSpecific.getEquipmentDetailId());
}
if (res > 0) {
return true;
// 删除设备动态表单扩展属性
return formInstanceService.deleteInstanceById(id);
} else {
return false;
}
......@@ -1877,4 +1866,73 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return infoVoList;
}
/**
* 在设备报废前30日 每日9点执行 系统推送提醒。设备报废后停止消息推送提醒。。
*
* @throws Exception
*/
@Scheduled(cron = "${equipment.scrap.cron}")
@Transactional(rollbackFor = Exception.class)
public void equipmentScrap() throws Exception {
List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap();
equipSpecificScrap.forEach(e->{
try {
int year = e.get("weExpiry") != null ? Integer.parseInt(e.get("weExpiry").toString()) : Integer.parseInt(e.get("wesExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(),DateUtils.DATE_TIME_PATTERN);
Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate);
calendar.add(Calendar.YEAR, year);
Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime());
int i = 0;
while (now.after(calendar.getTime())) {
calendar.add(Calendar.DAY_OF_MONTH,1);
i++;
}
if(i < Integer.parseInt(equipmentScrapDay) && i > -1) {
syncSystemctlMsg(e, scrapTime,i);
}
} catch (ParseException parseException) {
parseException.printStackTrace();
}
});
}
void syncSystemctlMsg(Map<String, Object> map,String scrapTime, int i) {
try {
MessageModel model = new MessageModel();
model.setTitle("报废到期提醒");
String equipName = map.get("name").toString();
String location = map.get("sName").toString() + map.get("position").toString() ;
String body = String.format("%s-%s于%s报废,请提前更换处理", equipName, location, scrapTime);
String join = String.format("设备还剩%s天报废,请提前更换", i);
model.setBody(body);
model.setMsgType("scrapWarning");
model.setSendTime(new Date());
model.setIsSendApp(false);
model.setTerminal("WEB");
model.setIsSendWeb(true);
model.setRelationId(map.get("id").toString());
model.setCategory(1);
List<String> receive = new ArrayList<>();
receive.add("system");
Map<String, String> ext = new HashMap<>();
ext.put("content", join);
ext.put("type", "报废到期");
ext.put("name", map.get("name").toString());
ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()));
model.setExtras(ext);
model.setRecivers(receive);
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -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;
......@@ -1442,8 +1459,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map<String, Object>> carInfo = fireFightingSystemMapper.getCarInfo(bizOrgCode);
bigScreenVo.setCarNumInfo(carInfo);
List<Map<String, Object>> systemAlarmInfoNum = fireFightingSystemMapper.getSystemAlarmInfoNum(bizOrgCode);
List<Map<String, Object>> pool = fireFightingSystemMapper.getWaterPoolInfoNum(bizOrgCode, "pool");
List<Map<String, Object>> industryPool = fireFightingSystemMapper.getWaterPoolInfoNum(bizOrgCode, "industryPool");
List<Map<String, Object>> pool = fireFightingSystemMapper.getWaterPoolInfoNum(bizOrgCode);
List<Map<String, Object>> industryPool = fireFightingSystemMapper.getWaterIndustryPoolInfoNum(bizOrgCode);
bigScreenVo.setSystemAlarmInfoNum(systemAlarmInfoNum);
bigScreenVo.setIndustryPool(industryPool);
bigScreenVo.setPool(pool);
......
......@@ -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;
......@@ -81,12 +83,14 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
private final String ORGCODE = "orgCode";
final static String[] list = {"92031900", "92011000", "92010700"};
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Override
@Transactional(rollbackFor = {BaseException.class, Exception.class})
public Map<String, Object> createByMap(String groupCode, String companyCode, Map<String, Object> map) {
public Map<String, Object> createByMap(String groupCode, String companyCode, Map<String, Object> map, String caseId) {
//1.查询分组表数据,数据准备用
Map<String, Object> returnMap = new HashMap<>();
FormGroup formGroup = iFormGroupService.getByUniqueKey(groupCode);
......@@ -96,6 +100,10 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
return returnMap;
}
Long instanceId = sequence.nextId();
if (!ValidationUtil.isEmpty(Arrays.stream(list).filter(x -> x.equals(groupCode)).collect(Collectors.toList()))) {
instanceId = Long.valueOf(caseId);
returnMap.put("code", sequence.nextId());
}
String groupType = formGroup.getGroupType();
List<FormInstance> entities = new ArrayList<>();
//3.以数据库现在配置的动态表单字段为准,进行数据插入的准备
......@@ -564,4 +572,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;
}
}
......@@ -27,6 +27,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
......@@ -35,8 +36,13 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
......@@ -85,6 +91,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
/**
* 泡沫罐KEY
*/
private final static String CAFS_FoamTank_FoamTankLevel = "CAFS_FoamTank_FoamTankLevel";
/**
* 泡沫罐KEY
*/
private final static String FHS_PipePressureDetector_PipePressure = "FHS_PipePressureDetector_PipePressure";
/**
* 水池信息
*/
private final static String FHS_FirePoolDevice_WaterLevel = "FHS_FirePoolDevice_WaterLevel";
static EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper){
......@@ -179,6 +201,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
MqttReceiveServiceImpl.jcsSwitch = jcsSwitch;
}
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
private static Boolean bool = Boolean.FALSE;
@Override
......@@ -281,6 +310,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 存储温度数据至内存中(火眼)
iotDataListToCacheMap(iotDatalist);
iotDatalist.forEach(iotDataVO -> {
String indexKey = iotDataVO.getKey();
// 稳压泵启停信号处理
if (indexKey.equals(pressurePumpStart) || indexKey.equals(pressurePumpStop)) {
pressurePump(indexKey, iotDatalist, topicEntity);
}
for (EquipmentSpecificIndex equipmentSpecificIndex : indexList) {
if (!ObjectUtils.isEmpty(equipmentSpecificIndex.getNameKey())
&& equipmentSpecificIndex.getNameKey().toLowerCase().equals(iotDataVO.getKey().toLowerCase())) {
......@@ -311,6 +345,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex));
}
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase())
) {
doFoamTankLevel(iotDataVO, equipmentSpecificIndex);
}
}
}
});
......@@ -363,6 +403,78 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
});
}
/**
* 泡沫罐 或 者管网压力 消息发送
* @param iotDataVO iotDataVO
* @param equipmentSpecificIndex equipmentSpecificIndex
*/
private void doFoamTankLevel(IotDataVO iotDataVO, EquipmentSpecificIndex equipmentSpecificIndex) {
MessageModel model = new MessageModel();
Map<String, Object> map = new HashMap<>();
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase())) {
map = fireFightingSystemMapper.getFoamTankLevel(equipmentSpecificIndex.getEquipmentSpecificId());
} else {
map = fireFightingSystemMapper.getPipeNetwork(equipmentSpecificIndex.getEquipmentSpecificId());
}
BigDecimal minValue = getBigDecimal(map.get("minValues"));
BigDecimal maxValue = getBigDecimal(map.get("maxValues"));
BigDecimal nowValue = getBigDecimal(iotDataVO.getValue());
if (nowValue.compareTo(minValue) < 0 || nowValue.compareTo(maxValue) > 0) {
String body = "";
if (nowValue.compareTo(minValue) < 0) {
body = "当前数值 " + nowValue + " 低于最低报警阈值 " + minValue;
} else if (nowValue.compareTo(maxValue) > 0) {
body = "当前数值 " + nowValue + " 超过最高报警阈值 " + maxValue;
}
String bodyMain = String.format("名称:模拟量提醒,时间:%s,内容:%s,- 当前数值%s,%s ,请及时查看处理。",
new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()),
equipmentSpecificIndex.getEquipmentSpecificName() + "-" + equipmentSpecificIndex.getLocation(),
nowValue,
nowValue.compareTo(minValue) < 0 ? "低于最低报警阈值" + minValue : "超过最高报警阈值" + maxValue
);
model.setTitle(equipmentSpecificIndex.getEquipmentSpecificName());
model.setBody(bodyMain);
model.setMsgType("FoamTankOrPipeNetwork");
model.setSendTime(new Date());
model.setIsSendWeb(true);
model.setCategory(1);
model.setRelationId(equipmentSpecificIndex.getEquipmentSpecificId().toString());
model.setIsSendApp(false);
model.setTerminal("WEB");
model.setRecivers(Arrays.asList("system"));
Map<String, String> ext = new HashMap<>();
ext.put("content", body);
ext.put("type", "模拟量超阈值提醒");
ext.put("name", equipmentSpecificIndex.getEquipmentSpecificName());
ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()));
model.setExtras(ext);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
}
}
private BigDecimal getBigDecimal( Object value ) {
BigDecimal val = null;
if( value != null ) {
if( value instanceof BigDecimal ) {
val = (BigDecimal) value;
} else if( value instanceof String ) {
val = new BigDecimal( (String) value );
} else if( value instanceof BigInteger) {
val = new BigDecimal( (BigInteger) value );
} else if( value instanceof Number ) {
val = new BigDecimal( ((Number)value).doubleValue() );
} else {
throw new ClassCastException("Not possible to coerce ["+value+"] from class "+value.getClass()+" into a BigDecimal.");
}
}
return val;
}
public void carRealTimeDate(List<IotDataVO> iotDatalist, List<CarProperty> carProperties) {
List<CarProperty> carIndexsList = new ArrayList<>();
iotDatalist.forEach(iotDataVO -> {
......@@ -1143,4 +1255,167 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
private void pressurePump(String indexKey, List<IotDataVO> iotDatalist, TopicEntityVo topicEntity) {
List<String> listIndex = new ArrayList<>();
listIndex.add(pressurePumpStart);
listIndex.add(pressurePumpStop);
// 获取全部启停泵信号
List<EquipmentSpecificIndex> equipmentSpeIndexList = equipmentSpecificIndexService.getEquipmentSpeIndexByIndex(listIndex);
List<PressurePumpEnum> enumListByCode = PressurePumpEnum.getEnumListByCode(indexKey);
if (!CollectionUtils.isEmpty(enumListByCode)) {
enumListByCode.forEach(pressurePumpEnum -> {
// 1. 获取需要校验的值
PressurePumpValueEnum valueEnum = PressurePumpValueEnum.getByCode(pressurePumpEnum.getCompareValue());
assert valueEnum != null;
EquipmentSpecificIndex data = getPressurePumpDateByType(valueEnum, topicEntity, equipmentSpeIndexList);
Date newDate = new Date();
// 2. 校验
if (!ObjectUtils.isEmpty(data)) {
checkValueByDate(data, newDate, pressurePumpEnum);
}
});
}
}
private EquipmentSpecificIndex getPressurePumpDateByType(PressurePumpValueEnum valueEnum, TopicEntityVo topicEntity, List<EquipmentSpecificIndex> equipmentSpeIndexList) {
String iotCode = topicEntity.getIotCode();
EquipmentSpecificIndex equipmentSpecificIndex = null;
switch (valueEnum) {
case LAST_STOP:
List<EquipmentSpecificIndex> lastStop = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && e.getIotCode().equals(iotCode) && pressurePumpStop.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(lastStop)) {
equipmentSpecificIndex = lastStop.get(0);
}
break;
case LAST_START:
List<EquipmentSpecificIndex> lastStart = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && e.getIotCode().equals(iotCode) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(lastStart)) {
equipmentSpecificIndex = lastStart.get(0);
}
break;
case LATELY_STOP:
List<EquipmentSpecificIndex> latelyStop = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && pressurePumpStop.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(latelyStop)) {
equipmentSpecificIndex = latelyStop.get(0);
}
break;
case LATELY_START:
List<EquipmentSpecificIndex> latelyStart = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(latelyStart)) {
equipmentSpecificIndex = latelyStart.get(0);
}
break;
default:
break;
}
return equipmentSpecificIndex;
}
private void checkValueByDate(EquipmentSpecificIndex data, Date newDate, PressurePumpEnum pressurePumpEnum) {
String operator = pressurePumpEnum.getOperator();
PressurePumpCheckEnum pumpCheckEnum = PressurePumpCheckEnum.getByCode(operator);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long diff = 0;
try {
long d1 = df.parse(df.format(data.getUpdateDate())).getTime();
long d2 = df.parse(df.format(newDate)).getTime();
diff = (d2-d1)/1000/60;
} catch (Exception e) {
log.error("时间转换失败" + e.getMessage());
return;
}
assert pumpCheckEnum != null;
String leftValue = pressurePumpEnum.getLeftValue();
String rightValue = pressurePumpEnum.getRightValue();
switch (pumpCheckEnum) {
case LE:
if (StringUtil.isNotEmpty(rightValue)) {
long value = Long.parseLong(rightValue);
if (diff <= value) {
sendMessagePressure(pressurePumpEnum, data);
}
}
break;
case GE:
if (StringUtil.isNotEmpty(leftValue)) {
long value = Long.parseLong(leftValue);
if (diff >= value) {
sendMessagePressure(pressurePumpEnum, data);
}
}
break;
case BE:
if (StringUtil.isNotEmpty(leftValue) && StringUtil.isNotEmpty(rightValue)) {
long lvalue = Long.parseLong(leftValue);
long rvalue = Long.parseLong(rightValue);
if (diff >= lvalue && diff <= rvalue) {
sendMessagePressure(pressurePumpEnum, data);
}
}
break;
default:
break;
}
}
private void sendMessagePressure(PressurePumpEnum pressurePumpEnum, EquipmentSpecificIndex data) {
String level = pressurePumpEnum.getLevel();
PressurePumpMessageEnum pumpMessageEnum = PressurePumpMessageEnum.getByCode(level);
assert pumpMessageEnum != null;
String time = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date());
MessageModel model = new MessageModel();
String allMessage = pumpMessageEnum.getAllMessage();
String body = "";
Map<String, String> map = new HashMap<>(4);
if (StringUtil.isNotEmpty(allMessage)) {
String value = StringUtil.isNotEmpty(pressurePumpEnum.getLeftValue()) ? pressurePumpEnum.getLeftValue() : pressurePumpEnum.getRightValue();
String content = String.format(allMessage, value);
map.put("content", content);
map.put("name", data.getEquipmentSpecificName());
map.put("time", time);
}
String recordMessage = pumpMessageEnum.getRecordMessage();
if (StringUtil.isNotEmpty(recordMessage)) {
String value = StringUtil.isNotEmpty(pressurePumpEnum.getLeftValue()) ? pressurePumpEnum.getLeftValue() : pressurePumpEnum.getRightValue();
body = String.format(recordMessage,time, data.getEquipmentSpecificName(), data.getLocation(), value);
}
String marqueeMessage = pumpMessageEnum.getMarqueeMessage();
if (StringUtil.isNotEmpty(marqueeMessage)) {
// body = String.format(marqueeMessage);
}
switch (pumpMessageEnum) {
case MESSAGE_LEVEL_YB:
case MESSAGE_LEVEL_YZ:
map.put("type", "稳压泵启停异常提醒");
break;
case MESSAGE_LEVEL_QT_WJ:
case MESSAGE_LEVEL_QT_WJ_YXSC:
map.put("type", "漏水提醒");
break;
default:
break;
}
model.setBody(body);
model.setExtras(map);
model.setMsgType("pressurePump");
model.setSendTime(new Date());
model.setIsSendApp(false);
model.setTerminal("WEB");
model.setIsSendWeb(true);
model.setCategory(1);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
}
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import com.yeejoin.equipmanage.mapper.SupervisionVideoMapper;
import com.yeejoin.equipmanage.service.ISupervisionVideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Slf4j
@Service
//@EnableAsync
public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMapper, SupervisionVideo> implements ISupervisionVideoService {
@Autowired
SupervisionVideoMapper supervisionVideoMapper;
@Override
public List<List<Map<String, Object>>> queryVideoList(String bizOrgCode) {
List<List<Map<String, Object>>> resList = new ArrayList<>();
List<Map<String, Object>> list = supervisionVideoMapper.getVideoByCompany(bizOrgCode);
List<Map<String, Object>> mapList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.size() > 1 && (i / 2) - 1 != 0 && i != 0) {
mapList.add(list.get(i));
resList.add(mapList);
mapList = new ArrayList<>();
} else {
mapList.add(list.get(i));
if (i == list.size() - 1) {
resList.add(mapList);
}
}
}
return resList;
}
@Override
public int deleteVideo(String id) {
return supervisionVideoMapper.delete(new QueryWrapper<SupervisionVideo>().eq("camera_id", id));
}
@Override
public boolean addVide(String ids, String bizOrgCode) {
List<SupervisionVideo> list = new ArrayList<>();
for (String s : ids.split(",")) {
SupervisionVideo supervisionVideo = new SupervisionVideo();
supervisionVideo.setCameraId(s);
supervisionVideo.setBizOrgCode(bizOrgCode);
supervisionVideo.setId(Long.valueOf(String.valueOf(UUID.randomUUID().getLeastSignificantBits()).replace("-", "")));
list.add(supervisionVideo);
}
return saveBatch(list);
}
@Override
public List<Map<String, Object>> queryVideoAllId(String bizOrgCode) {
return supervisionVideoMapper.queryVideoAllId(bizOrgCode);
}
}
......@@ -1340,7 +1340,7 @@ public class ExcelServiceImpl {
if (item.getLevelDeviceName() != null) {
String[] type = item.getLevelDeviceName().split("@");
item.setLevelDeviceName(type[0]);
item.setLevelDeviceId(Long.valueOf(type[1]));
item.setLevelDeviceId(Arrays.asList(type[1]));
}
// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
if (item.getEquipCategoryName() != null) {
......
......@@ -101,3 +101,12 @@ iot.code.prefix.have.used=
#是否向iot推送消息
isSendIot=false
#报废前30日 发起提醒
equipment.scrap.day=30
#提醒时间
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵停止信号
equipment.pressurepump.stop=FHS_PressurePump_Stop
......@@ -3013,4 +3013,21 @@
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_date`;
</sql>
</changeSet>
<changeSet author="tianyiming" id="20221011tianyiming" runAlways="true">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_supervision_video"/>
</not>
</preConditions>
<comment>add wl_supervision_video</comment>
<sql>
CREATE TABLE `wl_supervision_video` (
`id` bigint(20) NOT NULL,
`biz_org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所属公司',
`camera_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '摄像头id',
`create_date` datetime DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -193,4 +193,62 @@
INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000319', 'address', '地址', 'String', '132828674817', 'eq', b'0', 'r_fireControlRoom', '2581805', '2022-03-01 12:01:04');
</sql>
</changeSet>
<changeSet author="zs" id="202210101651">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_water_resource_pool"/>
</preConditions>
<comment>修改液位显示装置字段类型->需求2022 一个水池可选多个 装置</comment>
<sql>
ALTER TABLE `cb_water_resource_pool` MODIFY COLUMN `level_device_id` varchar(255) NULL DEFAULT NULL COMMENT '水池液位显示装置id';
</sql>
</changeSet>
<changeSet author="ltw" id="202210111354-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific" columnName="warranty_info"/>
</not>
</preConditions>
<comment>新增字段 warranty_info,warranty_period</comment>
<sql>
alter table `wl_equipment_specific` add column `warranty_info` varchar(500) DEFAULT NULL COMMENT '质保信息';
alter table `wl_equipment_specific` add column `warranty_period` datetime DEFAULT NULL COMMENT '质保周期';
</sql>
</changeSet>
<changeSet author="ltw" id="202210111354-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment" columnName="expiry_date"/>
</not>
</preConditions>
<comment>新增字段 expiry_date 报废期限</comment>
<sql>
alter table `wl_equipment` add column `expiry_date` decimal(12,0) DEFAULT NULL COMMENT '报废期限';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221011-1729-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_category"/>
</preConditions>
<comment>消防水箱分类扩展 wl_equipment_category</comment>
<sql>
REPLACE INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`, `image`) VALUES (1547790305762250754, '1438771726480601090', '93060600', '消防水箱', 0, NULL, NULL, '2022-07-15 11:49:00', '2', 'upload/equipment_category_icon/industryPool.png');
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221011-1729-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_form_group_column"/>
</preConditions>
<comment>物联设备增加模拟量阈值 wl_form_group_column</comment>
<sql>
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000350, 'minLevel', '最低报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:35');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000351, 'maxLevel', '最高报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:36');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000352, 'volume', '泡沫液罐容积(m³)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:37');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000353, 'minPressure', '最低报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:38');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000354, 'maxPressure', '最高报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:39');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000355, 'minFlow', '最低报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:39');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000356, 'maxFlow', '最高报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:40');
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -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
......@@ -25,19 +25,18 @@
<result property="equipDetailId" column="equip_detail_id"></result>
</resultMap>
<update id="updateIndexValueBatch">
<foreach collection="list" item="item" index="index" separator=";">
update wl_equipment_specific_index set
value = #{item.value}
where equipment_specific_id = #{item.equipmentSpecificId}
and equipment_index_id = #{item.equipmentIndexId}
</foreach>
<foreach collection="list" item="item" index="index" separator=";">
update wl_equipment_specific_index set
value = #{item.value}
where equipment_specific_id = #{item.equipmentSpecificId}
and equipment_index_id = #{item.equipmentIndexId}
</foreach>
</update>
<select id="getEquipmentSpeIndexBySpeIotCode"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
SELECT wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_name AS equipmentIndexName,
......@@ -65,21 +64,22 @@
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
sd.warehouse_structure_id AS buildId
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wes.id
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wes.id
WHERE
wes.iot_code = #{iotCode} and wei.is_iot = true
wes.iot_code = #{iotCode}
and wei.is_iot = true
</select>
<select id="getEquipmentSpeIndexByIotCode"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
SELECT wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
......@@ -90,18 +90,19 @@
wei.unit AS indexUnitName,
wesi.update_date AS updateDate
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
wes.iot_code = #{iotCode}
</select>
<select id="getEquipmentSpeIndexByIotCodeAndTrend" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wei.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
<select id="getEquipmentSpeIndexByIotCodeAndTrend"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT wei.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
......@@ -112,159 +113,142 @@
wei.unit AS indexUnitName,
wesi.update_date AS updateDate
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
AND
wei.is_trend = 1
wes.iot_code = #{iotCode}
AND
wei.is_trend = 1
</select>
<select id="getEquipmentSpeIndexDataByIotCode"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wesi.id AS id,
wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value',
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.iot_code AS iotCode,
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.value_enum AS valueEnum
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
SELECT wesi.id AS id,
wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value',
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.iot_code AS iotCode,
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.value_enum AS valueEnum
FROM wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE wes.iot_code = #{iotCode}
</select>
<select id="getEquipmentSpeIndexByEquipmentSecificId"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wesi.id,
wesi.equipment_specific_id,
wesi.VALUE,
wesi.create_date,
wesi.equipment_index_id,
wli.`name` nameKey
FROM
wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
where wesi.equipment_specific_id=#{id}
SELECT wesi.id,
wesi.equipment_specific_id,
wesi.VALUE,
wesi.create_date,
wesi.equipment_index_id,
wli.`name` nameKey
FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
where wesi.equipment_specific_id = #{id}
</select>
<select id="getVideoByEquipmentSecificId" resultType="com.yeejoin.equipmanage.common.entity.Video">
SELECT
ip,
`port`,
url,
`name`,
token,
`code`,
preset_position
FROM
wl_video wlv
LEFT JOIN wl_video_equipment_specific wlves ON wlv.id = wlves.video_id
WHERE
wlves.equipment_specific_id = #{id}
SELECT ip,
`port`,
url,
`name`,
token,
`code`,
preset_position
FROM wl_video wlv
LEFT JOIN wl_video_equipment_specific wlves ON wlv.id = wlves.video_id
WHERE wlves.equipment_specific_id = #{id}
</select>
<select id="getEquipmentDetailBySecificId" resultMap="EquipmentDetail">
SELECT
wled.NAME equipment_name,
wle.id equip_id,
wled.id equip_detail_id,
wles.qr_code,
wles. CODE,
(
select
GROUP_CONCAT(fs.name)
from
f_fire_fighting_system fs
where
FIND_IN_SET(fs.id,wles.system_id)
) as System_name,
wlec. NAME category_name,
wlws.full_name warehouse_name,
wled.standard,
sd.`name` country,
wled.remark,
wled.maintenance_cycle,
wled.is_import,
wled.brand,
wlun.`name` unit_name,
wlmi.`name` manufacturer_name,
wlmi.service_tel,
wlmi.sales_tel,
wlmi.address,
wlmi.img,
wleias.`value` STATUS
FROM
wl_equipment_specific wles
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN (
SELECT
wlei.equipment_id,
wlesi.`value`
FROM
wl_equipment_index wlei
LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id
WHERE
wlei.name_key = 'runState'
) wleias ON wle.id = wleias.equipment_id
WHERE wles.id=#{id}
SELECT wled.NAME equipment_name,
wle.id equip_id,
wled.id equip_detail_id,
wles.qr_code,
wles.CODE,
(
select GROUP_CONCAT(fs.name)
from f_fire_fighting_system fs
where FIND_IN_SET(fs.id, wles.system_id)
) as System_name,
wlec.NAME category_name,
wlws.full_name warehouse_name,
wled.standard,
sd.`name` country,
wled.remark,
wled.maintenance_cycle,
wled.is_import,
wled.brand,
wlun.`name` unit_name,
wlmi.`name` manufacturer_name,
wlmi.service_tel,
wlmi.sales_tel,
wlmi.address,
wlmi.img,
wleias.`value` STATUS
FROM wl_equipment_specific wles
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN (
SELECT wlei.equipment_id,
wlesi.`value`
FROM wl_equipment_index wlei
LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id
WHERE wlei.name_key = 'runState'
) wleias ON wle.id = wleias.equipment_id
WHERE wles.id = #{id}
</select>
<select id="selectEquProperty" resultType="java.util.HashMap">
SELECT
wlei. NAME,
wlesi.`value`
FROM
wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_specific wleqs ON wleqs.id = wlesi.equipment_specific_id
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
where wleqs.id=#{id}
SELECT wlei.NAME,
wlesi.`value`
FROM wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_specific wleqs ON wleqs.id = wlesi.equipment_specific_id
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
where wleqs.id = #{id}
</select>
<select id="selectEquList" resultType="java.util.HashMap">
SELECT
SELECT
de.id,
de.name,
a.image,
de.standard,
(case wsd.`status`
de.standard,
(case wsd.`status`
when '1' then '在位'
when '2' then '执勤'
when '3' then '维修'
when '3' then '维修'
when '6' then '退役'
when '7' then '报废'
when '7' then '报废'
when '10' then '车载'
when '11' then '损耗'
when '11' then '损耗'
else '未入库' END) statusName,
(case LEFT(ca.`code`,1)
(case LEFT(ca.`code`,1)
when '4' then '04#'
else '01#' END) typen,
IFNULL(wsd.amount,0)amount,
info.name manufacturerName,
dic.name country,
wesp.qr_code qrcode
IFNULL(wsd.amount,0)amount,
info.name manufacturerName,
dic.name country,
wesp.qr_code qrcode
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
......@@ -272,29 +256,29 @@ WHERE wles.id=#{id}
FROM wl_upload_file
GROUP BY object_id) a on a.object_id=de.id
LEFT JOIN wl_stock_detail wsd ON wsd.qr_code = wesp.qr_code
<if test="name!= null and name!=''">
AND de.name like CONCAT('%',#{name},'%')
<if test="name!= null and name!=''">
AND de.name like CONCAT('%',#{name},'%')
</if>
<if test="standard!= null and standard!='' ">
<if test="standard!= null and standard!='' ">
AND de.standard like CONCAT('%',#{standard},'%')
</if>
<if test="manufacturerName != null and manufacturerName!='' ">
<if test="manufacturerName != null and manufacturerName!='' ">
AND info.name like CONCAT('%',#{manufacturerName},'%')
</if>
LIMIT #{pageNum},#{pageSize}
</select>
LIMIT #{pageNum},#{pageSize}
</select>
<select id="selectEquListcount" resultType="java.util.HashMap">
SELECT
de.name
de.name
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
......@@ -306,32 +290,29 @@ WHERE wles.id=#{id}
LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id
LEFT JOIN wl_warehouse_structure wws1 ON wws.parent_id = wws1.id
<if test="name!= null and name!='' ">
AND de.name like CONCAT('%',#{name},'%')
AND de.name like CONCAT('%',#{name},'%')
</if>
<if test="standard!= null and standard!='' ">
<if test="standard!= null and standard!='' ">
AND de.standard like CONCAT('%',#{standard},'%')
</if>
<if test="manufacturerName != null and manufacturerName!='' ">
<if test="manufacturerName != null and manufacturerName!='' ">
AND info.name like CONCAT('%',#{manufacturerName},'%')
</if>
</select>
</select>
<select id="getEquipmentSpeIndexList" resultType="hashmap">
SELECT
wles.equipment_specific_id AS speId,
wles.`value` AS speIndexValue,
wlei.type_name AS typeName,
wlei.type_code AS typeCode,
wlei.name_key AS nameKey,
wlei.`name` as indexName
FROM
wl_equipment_specific_index wles
JOIN wl_equipment_index wlei ON wlei.id = wles.equipment_index_id
WHERE
wlei.is_iot = 1
AND (
wlei.type_code IN ( 'BREAKDOWN', 'SHIELD' ))
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1 )
SELECT wles.equipment_specific_id AS speId,
wles.`value` AS speIndexValue,
wlei.type_name AS typeName,
wlei.type_code AS typeCode,
wlei.name_key AS nameKey,
wlei.`name` as indexName
FROM wl_equipment_specific_index wles
JOIN wl_equipment_index wlei ON wlei.id = wles.equipment_index_id
WHERE wlei.is_iot = 1
AND (
wlei.type_code IN ('BREAKDOWN', 'SHIELD'))
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1)
</select>
<select id="getEquipSpecificIndexList" resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO">
SELECT
......@@ -379,7 +360,7 @@ WHERE wles.id=#{id}
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<if test="list != null and list.size > 0 and type = 'id'">
si.equipment_specific_id IN
si.equipment_specific_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
......@@ -390,17 +371,18 @@ WHERE wles.id=#{id}
SELECT
si.id,
si.equipment_specific_id AS equipmentId,
(case when si.value_label is null or trim(si.value_label) ='' then si.`value` else si.value_label end )AS 'value',
(case when si.value_label is null or trim(si.value_label) ='' then si.`value` else si.value_label end )AS
'value',
si.create_date,
si.update_date
FROM
wl_equipment_specific_index si
<where>
<if test="id != null">
si.equipment_index_id = #{id}
si.equipment_index_id = #{id}
</if>
<if test="equipmentSpecificId!= null">
AND si.equipment_specific_id = #{equipmentSpecificId}
AND si.equipment_specific_id = #{equipmentSpecificId}
</if>
</where>
</select>
......@@ -426,38 +408,34 @@ WHERE wles.id=#{id}
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<if test="list != null and list.size > 0 and type = 'id'">
si.id IN
si.id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getEquipSpecificIndexByUpdateDateDesc" resultType="java.util.HashMap">
SELECT
esi.id,
es.`name` AS equipmentSpecificName,
esi.equipment_index_name AS equipmentSpecificIndexName,
IF (
esi.value_label = ''
OR esi.value_label IS NULL,
esi.`value`,
esi.value_label
) AS valueLabel,
es.position AS location,
esi.update_date AS createDate
FROM
`wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON es.id = esi.equipment_specific_id
WHERE
esi.`value` IS NOT NULL
ORDER BY
esi.update_date DESC
LIMIT 50
</select>
<select id="getEquipSpecificIndexByUpdateDateDesc" resultType="java.util.HashMap">
SELECT esi.id,
es.`name` AS equipmentSpecificName,
esi.equipment_index_name AS equipmentSpecificIndexName,
<select id="getEquipmentSpeIndexByIotCodeTrend" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
IF(
esi.value_label = ''
OR esi.value_label IS NULL,
esi.`value`,
esi.value_label
) AS valueLabel,
es.position AS location,
esi.update_date AS createDate
FROM `wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON es.id = esi.equipment_specific_id
WHERE esi.`value` IS NOT NULL
ORDER BY esi.update_date DESC LIMIT 50
</select>
<select id="getEquipmentSpeIndexByIotCodeTrend"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wei.id AS id,
wei.name_key AS nameKey,
......@@ -487,4 +465,44 @@ WHERE wles.id=#{id}
AND wei.name_key = #{fieldKey}
</if>
</select>
<select id="getEquipSpecificScrap" resultType="java.util.Map">
select wes.id,
str.name as sname,
wlsd.status,
wes.position,
wes.name,
we.expiry_date as weExpiry,
wed.expiry_date as wesExpiry,
wed.production_date as product
from wl_equipment_specific wes
left join wl_equipment_detail wed on wes.equipment_detail_id = wed.id
left join wl_equipment we on wed.equipment_id = we.id
left join wl_warehouse_structure str on str.id = wes.warehouse_structure_id
left join wl_stock_detail wlsd on wes.id = wlsd.equipment_specific_id
where wed.production_date is not null
and wlsd.status != 7
</select>
<select id="getEquipIndexInIndex" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
si.equipment_specific_id AS equipmentId,
si.id,
si.`value`,
si.create_date,
si.update_date,
si.equipment_index_key,
si.equipment_specific_name,
es.position location,
es.`iot_code` AS iotCode
FROM
wl_equipment_specific_index si
LEFT JOIN wl_equipment_specific es ON si.equipment_specific_id = es.id
<where>
<if test="list != null and list.size > 0 and type = 'id'">
si.equipment_index_key IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -2362,7 +2362,8 @@
</select>
<select id="getWaterInfo" resultType="java.util.Map">
SELECT
select * from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
......@@ -2418,13 +2419,97 @@
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' )
r.resource_type = '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>
<if test="systemCode!=null and systemCode!=''">
AND fs.code = #{systemCode,jdbcType=VARCHAR}
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
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,
a.nowLevel,
(
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.volume,
a.image,
a.resource_type,
a.sequence_nbr,
a.`code` AS systemCode
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
avg( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN IFNULL( ei.`value`, 0 ) END ) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
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_index ei ON FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id ) > 0
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 = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
......@@ -2435,8 +2520,10 @@
</if>
GROUP BY
r.sequence_nbr
) a
)) b
ORDER BY
levelStatus DESC
levelStatus DESC,sequence_nbr DESC
</select>
<select id="getFireSystemInfo" resultType="java.util.Map">
......@@ -2574,6 +2661,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 +2738,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`,
......@@ -2819,93 +2954,122 @@
<select id="getWaterPoolInfoNum" resultType="java.util.Map">
SELECT
count( 1 ) AS totalNum,
count( a.nowLevel &lt; a.minLevel OR NULL ) AS abnomalNum,
count( a.nowLevel &gt;= a.minLevel OR NULL ) AS nomalNum,
count( a.minLevel > a.nowLevel OR NULL ) AS abnomalNum,
count( a.nowLevel >= a.minLevel OR NULL ) AS nomalNum,
(
FORMAT (
abs(((
count( a.nowLevel &gt;= a.minLevel OR NULL )) /
count( a.nowLevel >= a.minLevel OR NULL )) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) ))) * 100, 2)
(( count( 1 ) = 0 ), 1, count( 1 ) ))) * 100,
2
)
) AS normalAbs
FROM
(
SELECT
ifnull( `rp`.`min_water_level`, 0 ) AS `minLevel`,
ifnull( `rp`.`max_water_level`, 0 ) AS `maxLevel`,
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) AS `nowLevel`
IFNULL(avg( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN IFNULL( ei.`value`, 0 ) END ),0) AS nowLevel
FROM
`cb_water_resource` `r`
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_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
LEFT JOIN `wl_equipment_specific_index` `ei` ON FIND_IN_SET(`ei`.`equipment_specific_id`,`rp`.`level_device_id`)
WHERE
`r`.`is_delete` = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
AND r.`biz_org_code` like concat(#{bizOrgCode}, '%')
</if>
AND `r`.`resource_type` = #{poolType}
AND `r`.`resource_type` = 'pool'
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<select id="getWaterPoolVolumeInfo" resultType="java.util.Map">
<select id="getWaterIndustryPoolInfoNum" resultType="java.util.Map">
SELECT
IFNULL( sum( a.margin ), 0 ) AS margin,
IFNULL( sum( volume ), 0 ) AS volume
count( 1 ) AS totalNum,
count( a.minLevel > a.nowLevel OR NULL ) AS abnomalNum,
count( a.nowLevel >= a.minLevel OR NULL ) AS nomalNum,
(
FORMAT (
abs(((
count( a.nowLevel >= a.minLevel OR NULL )) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) ))) * 100,
2
)
) AS normalAbs
FROM
(
SELECT
`ou`.`code` AS `code`,
ifnull((
abs((
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) /
IF
((
ifnull( `rp`.`max_water_level`, 0 ) = 0
),
1,
ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),
0
) AS `margin`,
ifnull( `rp`.`volume`, 0 ) AS `volume`
FROM
`cb_water_resource` `r`
LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`
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_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
WHERE
`r`.`resource_type` IN ( 'pool', 'industryPool' )
AND `r`.`is_delete` = 1
AND `ou`.`code` IS NOT NULL
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
GROUP BY
`r`.`sequence_nbr`
) a
(
SELECT
ifnull( `rp`.`min_water_level`, 0 ) AS `minLevel`,
ifnull( `rp`.`max_water_level`, 0 ) AS `maxLevel`,
ifnull(MAX( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN IFNULL( ei.`value`, 0 ) END ), 0) AS nowLevel
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`
WHERE
`r`.`is_delete` = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
AND r.`biz_org_code` like concat(#{bizOrgCode}, '%')
</if>
AND `r`.`resource_type` = 'industryPool'
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<!-- <select id="getWaterPoolVolumeInfo" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- IFNULL( sum( a.margin ), 0 ) AS margin,-->
<!-- IFNULL( sum( volume ), 0 ) AS volume-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- `ou`.`code` AS `code`,-->
<!-- ifnull((-->
<!-- abs((-->
<!-- ifnull(-->
<!-- max((-->
<!-- CASE-->
<!-- WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN-->
<!-- `ei`.`perf_value`-->
<!-- END-->
<!-- )),-->
<!-- ifnull( `rp`.`min_water_level`, 0 )) /-->
<!-- IF-->
<!-- ((-->
<!-- ifnull( `rp`.`max_water_level`, 0 ) = 0-->
<!-- ),-->
<!-- 1,-->
<!-- ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),-->
<!-- 0-->
<!-- ) AS `margin`,-->
<!-- ifnull( `rp`.`volume`, 0 ) AS `volume`-->
<!-- FROM-->
<!-- `cb_water_resource` `r`-->
<!-- LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`-->
<!-- 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_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`-->
<!-- WHERE-->
<!-- `r`.`resource_type` IN ( 'pool', 'industryPool' )-->
<!-- AND `r`.`is_delete` = 1-->
<!-- AND `ou`.`code` IS NOT NULL-->
<!-- <if test="companyCode != null and companyCode != ''">-->
<!-- AND ou.`code` = #{companyCode}-->
<!-- </if>-->
<!-- GROUP BY-->
<!-- `r`.`sequence_nbr`-->
<!-- ) a-->
<!-- </select>-->
<select id="getCarNum" resultType="java.lang.Integer">
SELECT
count( wc.id ) as carNum
......@@ -3621,7 +3785,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,
......@@ -4356,4 +4520,471 @@
temp.notReturnd DESC
</select>
<select id="getFireCaStartBySeven" resultType="java.util.Map">
select count(1) as count from wl_car_property wcp where
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 * from (
(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_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 = '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) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
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,
a.nowLevel,
(
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.volume,
a.image,
a.resource_type,
a.sequence_nbr,
a.`code` AS systemCode
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
avg( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN IFNULL( ei.`value`, 0 ) END ) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
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_index ei ON FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id ) > 0
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 = 'pool'
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
) a
)) b
ORDER BY
levelStatus DESC,sequence_nbr 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>
<select id="getFoamTankLevel" resultType="java.util.Map">
SELECT
IF
(
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END )) AS minValues,
IF
(
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues
FROM
wl_form_instance fi
WHERE
fi.instance_id = #{equipSpeId}
</select>
<select id="getPipeNetwork" resultType="java.util.Map">
SELECT
IF
(
max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END )) AS minValues,
IF
(
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues
FROM
wl_form_instance fi
WHERE
fi.instance_id = #{equipSpeId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.SupervisionVideoMapper">
<select id="getVideoByCompany" resultType="java.util.Map">
select wv.*
from wl_supervision_video wsv left join wl_video wv on wsv.camera_id = wv.id
where wsv.biz_org_code = #{bizOrgCode}
</select>
<select id="queryVideoAllId" resultType="java.util.Map">
select wsv.camera_id
from wl_supervision_video wsv
where wsv.biz_org_code = #{bizOrgCode}
</select>
</mapper>
......@@ -3596,5 +3596,15 @@
CHANGE COLUMN `user_name` `usr_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名' AFTER `sequence_nbr`
</sql>
</changeSet>
<changeSet author="zs" id="202210101353">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_water_resource_pool"/>
</preConditions>
<comment>修改液位显示装置字段类型->需求2022 一个水池可选多个 装置</comment>
<sql>
ALTER TABLE `cb_water_resource_pool` MODIFY COLUMN `level_device_id` varchar(255) NULL DEFAULT NULL COMMENT '水池液位显示装置id';
</sql>
</changeSet>
</databaseChangeLog>
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