Commit 7ef60dc7 authored by 李秀明's avatar 李秀明

Merge branch 'refs/heads/develop_dl' into develop_bugfix@dl

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/OrgUsrMapper.xml # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/UnitTransformUtil.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EmergencyController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/KeyWordsInfoController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/SupervisionConfigureController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EmergencyMapper.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemMapper.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java # amos-boot-system-equip/src/main/resources/mapper/EmergencyMapper.xml # amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml # amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
parents ce18026f b8c4d588
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.biz.common.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -462,4 +463,44 @@ public class DataDictionaryController extends BaseController {
List<Map<String,Object>> listMap = iDataDictionaryService.listUserJobStatistic(bizOrgCode);
return ResponseHelper.buildResponse(listMap);
}
/**
* 新增数据字典 - 存储默认展示视频
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/saveFireEquipConfig", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "存储消防器材配置数据", notes = "存储消防器材配置数据")
public ResponseModel saveFireEquipConfig(@RequestParam(value = "codes", required = false) String codes) {
String type = "ZYGL_XFQC";
LambdaUpdateWrapper<DataDictionary> lambda = new LambdaUpdateWrapper<>();
lambda.eq(DataDictionary::getType, type);
iDataDictionaryService.remove(lambda);
if (StringUtils.isNotEmpty(codes)) {
List<DataDictionary> insertList = new ArrayList<>();
String[] split = codes.split(",");
for (int i = 0; i < split.length; i++) {
DataDictionary dataDictionary = new DataDictionary();
dataDictionary.setName(split[i]);
dataDictionary.setCode(split[i]);
dataDictionary.setType(type);
dataDictionary.setSortNum(i + 1);
insertList.add(dataDictionary);
}
iDataDictionaryService.saveBatch(insertList);
}
return ResponseHelper.buildResponse(Boolean.TRUE);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getDictListByType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典")
public ResponseModel<List<DataDictionary>> getDictListByType(@RequestParam String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
List<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
}
......@@ -1217,11 +1217,31 @@
cfp.fire_management_post,
cft.type_code,
cf.certificate_number certificatesNumber,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personNumber' AND dfi.instance_id
= u.sequence_nbr ) AS employee_number,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id =
u.sequence_nbr ) AS telephone,
( CASE WHEN cfp.post_qualification IS NULL or cfp.post_qualification = '' THEN 0 ELSE 1 END ) AS is_certificate,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personNumber' AND dfi.instance_id = u.sequence_nbr ) AS employee_number,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id = u.sequence_nbr ) AS telephone,
CASE
WHEN ( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1602 THEN
(
IF
((
SELECT
concat( cfp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1427,1428,1429,1430,1431', ',', ',|' ), ',' )) > 0,
1,
0
)
)
WHEN ( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1601 THEN
(
IF
(
(
concat( cfp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1823,1824,1825,1826,1827', ',', ',|' ), ',' ) > 0
AND concat( cfp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425', ',', ',|' ), ',' ) > 0
),
1,
0
)) ELSE 0
END AS is_certificate,
IF
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id =
......
......@@ -47,6 +47,9 @@ public class Equipment extends BaseEntity {
@ApiModelProperty(value = "报废期限")
private Short expiryDate;
@ApiModelProperty(value = "四横八纵图片")
private String shbzImg;
private String remark;
@ApiModelProperty(value = "管理方式 单件还是批量管理模式,单件S,批量:P")
......
......@@ -14,6 +14,8 @@ import lombok.Data;
public class EquipCountBySystemVO {
@ApiModelProperty(value = "设备定义id")
private Long equipmentId;
@ApiModelProperty(value = "设备定义Code")
private String equipmentCode;
@ApiModelProperty(value = "设备名称")
private String equipmentName;
@ApiModelProperty(value = "设备分类名称")
......@@ -24,4 +26,6 @@ public class EquipCountBySystemVO {
private String unitName;
@ApiModelProperty(value = "图标")
private String img;
@ApiModelProperty(value = "排序字段")
private int sortNum;
}
package com.yeejoin.equipmanage.common.entity.vo;
import lombok.Data;
@Data
public class EquipTrendInfoVo {
private String id;
private String iotCode;
private String name;
private String maxNum;
private String minNum;
private String unit;
}
package com.yeejoin.equipmanage.common.entity.vo;
import lombok.Data;
import java.util.List;
public class EquipTrendResultVo {
private List<String> legends;
private String yAxisName;
private List<String> xAxisData;
private List<List<Object>> yAxisData;
private List<List<String>> threshold;
public List<String> getLegends() {
return legends;
}
public void setLegends(List<String> legends) {
this.legends = legends;
}
public String getyAxisName() {
return yAxisName;
}
public void setyAxisName(String yAxisName) {
this.yAxisName = yAxisName;
}
public List<String> getxAxisData() {
return xAxisData;
}
public void setxAxisData(List<String> xAxisData) {
this.xAxisData = xAxisData;
}
public List<List<Object>> getyAxisData() {
return yAxisData;
}
public void setyAxisData(List<List<Object>> yAxisData) {
this.yAxisData = yAxisData;
}
public List<List<String>> getThreshold() {
return threshold;
}
public void setThreshold(List<List<String>> threshold) {
this.threshold = threshold;
}
}
......@@ -10,7 +10,7 @@ public enum PressurePumpEnum {
ALONE_START_YXSC("FHS_PressurePump_Start_ALONE_START_YXSC", "", LocalDateTime.now().getSecond() + " " + (LocalDateTime.now().getMinute()) + "/5 * * * ?", "5",
PressurePumpValueEnum.PUMP_START_TIME.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ_YXSC.getCode(), "【5】分钟"),
ALONE_START_QT("FHS_PressurePump_Start_ALONE_START_QT", PressurePumpCheckEnum.LE.getCode(), "", "5",
ALONE_START_QT("FHS_PressurePump_Start_ALONE_START_QT", PressurePumpCheckEnum.BE.getCode(), "0.5", "5",
PressurePumpValueEnum.LAST_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ.getCode(), "【5】分钟"),
ALONE_START_QT_WJ("FHS_PressurePump_Start_ALONE_START_QT_WJ", PressurePumpCheckEnum.BE.getCode(), "5", "30",
......@@ -19,7 +19,7 @@ public enum PressurePumpEnum {
ALONE_START_QT_YZ("FHS_PressurePump_Start_ALONE_START_QT_YZ", PressurePumpCheckEnum.BE.getCode(), "30", "60",
PressurePumpValueEnum.LAST_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_YZ.getCode(), "【1】小时"),
ALL_START_QT_WJ("FHS_PressurePump_Start_ALL_START_QT_WJ", PressurePumpCheckEnum.LE.getCode(), "", "5",
ALL_START_QT_WJ("FHS_PressurePump_Start_ALL_START_QT_WJ", PressurePumpCheckEnum.BE.getCode(), "0.5", "5",
PressurePumpValueEnum.LATELY_START.getCode(), PressurePumpMessageEnum.MESSAGE_LEVEL_QT_WJ.getCode(), "【5】分钟"),
START_QT_WJ_ALL("FHS_PressurePump_Start_ALL_START_QT_YZ", PressurePumpCheckEnum.BE.getCode(), "5", "30",
......
......@@ -18,7 +18,8 @@ public enum UnitEnum {
M("m", "米", ""),
DM("dm", "分米", ""),
CM("cm", "厘米", ""),
MM("mm", "毫米", "");
MM("mm", "毫米", ""),
LFM("m³", "立方米", "");
private String key;
......
......@@ -154,6 +154,41 @@ public class UnitTransformUtil {
return map;
}
public static Map<String, Object> transformValuesLFM(String currentValue, String currentUnit, String minValue, String maxValue) {
Map<String, Object> map = new HashMap<>();
if (UnitEnum.LFM.getKey().equalsIgnoreCase(currentUnit) || UnitEnum.LFM.getName().equals(currentUnit)) {
BigDecimal nowVal = new BigDecimal(0);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)) {
nowVal = new BigDecimal(currentValue);
map.put("nowValue", nowVal.setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
map.put("nowValue", "--");
}
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(minValue) && !"--".equals(minValue) && StringUtil.isNotEmpty(maxValue)
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) > 0) { // 当前值大于最大值
map.put("status", "2");
map.put("abs", 100);
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 0) {
map.put("status", "1");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
}
map.put("unit", "m³");
return map;
}
private static BigDecimal getPercent(BigDecimal num1, BigDecimal num2) {
if (num2.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
......
......@@ -1108,6 +1108,36 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询公司bizOrgCode", notes = "查询公司bizOrgCode")
@GetMapping(value = "/getCompanyBiz")
public ResponseModel<Map<String, Object>> getCompanyBiz(@RequestParam("bizOrgCode") String bizOrgCode) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getBizOrgCode, bizOrgCode);
lambda.eq(OrgUsr::getIsDelete, false);
if(orgUsrMapper.selectList(lambda).size() > 0) {
Map map = new HashMap();
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
try {
OrgUsrFormDto orgUsrFormDto = iOrgUsrService.selectCompanyById(orgUsr.getSequenceNbr());
map.put("bizOrgCode", orgUsrFormDto.getBizOrgCode());
map.put("bizOrgName", orgUsrFormDto.getBizOrgName());
map.put("parentName", orgUsrFormDto.getParentName());
map.put("companyPhone", orgUsrFormDto.getDynamicFormAlert().stream().filter(e->e.getKey().equals("companyPhone")).findFirst().get().getValue());
map.put("code", orgUsrFormDto.getCode());
map.put("dwfz", orgUsrFormDto.getDwfz());
map.put("xfaq", orgUsrFormDto.getXfaq());
map.put("xfgl", orgUsrFormDto.getXfgl());
} catch (Exception e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(map);
} else {
return ResponseHelper.buildResponse(null);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询公司bizOrgCode", notes = "查询公司bizOrgCode")
@GetMapping(value = "/getCompany")
public ResponseModel<String> getBizByAmos(@RequestParam("bizOrgCode") String bizOrgCode) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
......
......@@ -137,6 +137,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired
private StationInfoMapper stationInfoMapper;
@Value("${jcs.company.topic.delete:jcs/company/topic/delete}")
private String airportDeleteTopic;
......@@ -1465,14 +1466,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<String, String> Dwfz = null;
List<OrgUsr> orgUsrs = getIdByOrgCode(orgUsr.getBizOrgCode(), id);
if(orgUsrs!=null){
List<Long> ids = orgUsrs.stream().map(x -> x.getSequenceNbr()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
Xfaq = orgUsrMapper.getManagePerson("消防安全负责人", ids);
Xfgl = orgUsrMapper.getManagePerson("消防安全管理人", ids);
Dwfz = orgUsrMapper.getManagePerson("法定代表人", ids);
}
}
List<Long> ids = orgUsrs.stream().map(x -> x.getSequenceNbr()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
Xfaq = orgUsrMapper.getManagePerson("消防安全负责人", ids);
Xfgl = orgUsrMapper.getManagePerson("消防安全管理人", ids);
Dwfz = orgUsrMapper.getManagePerson("法定代表人", ids);
}
}
orgUsrFormVo.setXfaq(Xfaq != null ? Xfaq.get("uname") : "");
orgUsrFormVo.setXfgl(Xfgl != null ? Xfgl.get("uname") : "");
orgUsrFormVo.setDwfz(Dwfz != null ? Dwfz.get("uname") : "");
......
......@@ -16,6 +16,7 @@ import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
......@@ -205,4 +206,20 @@ public class BigScreenController extends AbstractBaseController {
return CommonResponseUtil.success(iFireFightingSystemService.getEquipmentsBySystemInfo(page, systemCode, equipmentCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "设备平台卡片-运行数据接口")
@GetMapping("/system/iot/log")
public ResponseModel getEquipmentsBySystemInfo(CommonPageable commonPageable,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "systemCode",required = false)String systemCode,
@ApiParam(value = "设备名称", required = false) @RequestParam(required = false) String fireEquipmentName,
@ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startTime,
@ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String endTime) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(iFireFightingSystemService.getEquipmentRunLogBySysInfo(page, bizOrgCode, systemCode, fireEquipmentName, startTime, endTime));
}
}
......@@ -155,6 +155,21 @@ public class EmergencyController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("排油系统列表")
@GetMapping(value = "/selectOilDrainageNew")
public Page<Map<String, Object>> selectOilDrainageNew(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ,
@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "code") String code) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectOilDrainageNew(page, bizOrgCode, code);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("气体灭火系统")
@GetMapping(value = "/selectGasExtinguishing")
public Page<Map<String, Object>> selectGasExtinguishing(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ,
......@@ -725,10 +740,11 @@ public class EmergencyController extends AbstractBaseController {
}
String sortField = "", sortOrder = "";
if (org.springframework.util.StringUtils.hasText(sorter)) {
sortField = sorter.split("@")[0].equalsIgnoreCase("cleanStatus") ? "clean_time" : sorter.split("@")[0];
sortField = sorter.split("@")[0];
sortOrder = sorter.split("@")[1];
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate, sortField, sortOrder));
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels,
name, cleanStatus, handleStatus, createDate, startDate, endDate, sortField, sortOrder));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -13,11 +17,13 @@ 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.Map;
@Slf4j
@RestController
@Api(tags = "装备性能指标API")
@RequestMapping(value = "/equipSpecificIndex")
public class EquipmentSpecificIndexController {
public class EquipmentSpecificIndexController extends AbstractBaseController {
@Autowired
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexService;
......@@ -29,4 +35,24 @@ public class EquipmentSpecificIndexController {
return equipmentSpecificIndexService.getById(id);
}
@RequestMapping(value = "/page", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取性能指标", notes = "获取性能指标")
public IPage<Map<String, Object>> getPage(
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "systemId", required = false) String systemId,
@RequestParam(value = "equipName", required = false) String equipName,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
if (!StringUtils.hasText(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
}
Page<EquipmentSpecificIndex> page = new Page<>(pageNumber, pageSize);
return equipmentSpecificIndexService.getPage(page, bizOrgCode, systemId, equipName, startDate, endDate);
}
}
......@@ -130,18 +130,42 @@ public class FireFightingSystemController extends AbstractBaseController {
@RequestMapping(value = "/getEquipcountBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询分组设备数量")
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return fireFightingSystemService.getEquipCountBySystemId(systemId);
public List<EquipCountBySystemVO> getEquipCountBySystemId(
@RequestParam(value = "systemId", required = false) Long systemId,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode
) {
if (org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && org.apache.commons.lang3.StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
return fireFightingSystemService.getEquipCountBySystemId(systemId, bizOrgCode);
}
@RequestMapping(value = "/getEquipCountPageBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询分组设备数量")
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@RequestParam("systemId") Long systemId,
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(
@RequestParam(value = "systemId", required = false) Long systemId,
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode
) {
return fireFightingSystemService.getEquipCountPageBySystemId(systemId, pageNumber, pageSize);
if (org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && org.apache.commons.lang3.StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
return fireFightingSystemService.getEquipCountPageBySystemId(systemId, pageNumber, pageSize, bizOrgCode);
}
@RequestMapping(value = "/getFireEquipConfigInfo", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据字典查询相关信息")
public List<EquipCountBySystemVO> getFireEquipConfigInfo(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && org.apache.commons.lang3.StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
return fireFightingSystemService.getFireEquipConfigInfo(bizOrgCode);
}
@RequestMapping(value = "/getOneById", method = RequestMethod.GET)
......@@ -934,8 +958,14 @@ public class FireFightingSystemController extends AbstractBaseController {
@ApiOperation(value = "按照组态格式获取设备详情", notes = "按照组态格式获取设备详情")
@GetMapping(value = "/getSystemById")
public Map<String, Object> getSystemById(Long id) {
String bizOrgCode = "";
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
FireFightingSystemEntity fireFightingSystem = fireFightingSystemService.getById(id);
List<AlarmDataVO> list1 = fireFightingSystemService.getSystemById(id);
List<AlarmDataVO> list1 = fireFightingSystemService.getSystemById(id, bizOrgCode);
Map<String, Object> res = new LinkedHashMap<>();
Boolean status = Boolean.TRUE;
List<Object> ite = new ArrayList<>();
......
......@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
......@@ -74,4 +75,16 @@ public class FireResourceSupervisionController extends BaseController {
}};
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备平台消防资源-消防器材接口", notes = "设备平台消防资源-消防器材接口")
@RequestMapping(value = "/equip/statistic", method = RequestMethod.GET)
public ResponseModel<Object> equipStatistic(@RequestParam(value = "type", required = false) String type, @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
List<Map<String, Object>> fireEquipStats = iFireResourceSupervisionService.getFireEquipStatistic(type, bizOrgCode);
return ResponseHelper.buildResponse(fireEquipStats);
}
}
......@@ -41,4 +41,12 @@ public class KeyWordsInfoController extends AbstractBaseController {
return CommonResponseUtil.success(resultList);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "查询已绑定排油阀的换流变信息 - 根据分类分组", notes = "查询已绑定排油阀的换流变信息 - 根据分类分组")
@RequestMapping(value = "/getFEquipInfoListCategory", method = RequestMethod.GET)
public ResponseModel getFEquipInfoListCategory(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> resultList = iFireFightingSystemService.getFEquipInfoListCategory(bizOrgCode);
return CommonResponseUtil.success(resultList);
}
}
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.FormInstanceEquip;
import com.yeejoin.equipmanage.common.entity.vo.EquipTrendResultVo;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify;
......@@ -72,6 +73,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Autowired
private FormInstanceEquipMapper formInstanceEquipMapper;
@Autowired
private IEquipmentSpecificSerivce equipmentSpecificService;
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -216,7 +220,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
float outputFlowRate = Float.parseFloat(String.valueOf(m.get("outputFlowRate")));
if (levelAbsLiter.compareTo(new BigDecimal(0)) != 0 && outputFlowRate != 0) {
double availableSeconds = (levelAbsLiter.divide(new BigDecimal(Double.parseDouble(Float.toString(outputFlowRate))), 0, RoundingMode.HALF_UP).doubleValue());
double availableSeconds = (levelAbsLiter.divide(BigDecimal.valueOf(outputFlowRate), 0, RoundingMode.HALF_UP).doubleValue());
m.put("availableTime", String.format("%.1fh", availableSeconds / 3600.0));
} else {
m.put("availableTime", "--");
......@@ -245,7 +249,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
// m.put("nowLevel", transResult.get("nowValue"));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
......@@ -823,4 +827,73 @@ public class SupervisionConfigureController extends AbstractBaseController {
Map<String, Object> list = supervisionVideoService.getPressurePumpPage(bizOrgCode, id, startTime, endTime, pageNum, pageSize, timeSort, stateSort);
return CommonResponseUtil.success(list);
}
@PersonIdentify
@RequestMapping(value = "/operatingTrendIot", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备平台运行趋势 设备相关API", produces = "application/json;charset=UTF-8", notes = "设备平台运行趋势 设备相关API")
public ResponseModel operatingTrendIot(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "equipCode", required = false) String equipCode,
@RequestParam(value = "indexKey", required = false) String indexKey) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
EquipTrendResultVo equipTrendResultVo = equipmentSpecificService.operatingTrendIot(startTime, endTime, bizOrgCode, equipCode, indexKey);
return CommonResponseUtil.success(equipTrendResultVo);
}
@PersonIdentify
@RequestMapping(value = "/operatingTrendPressurePump", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备平台运行趋势 稳压泵启动频次趋势API", produces = "application/json;charset=UTF-8", notes = "设备平台运行趋势 稳压泵启动频次趋势API")
public ResponseModel operatingTrendPressurePump(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "equipCode", required = false) String equipCode,
@RequestParam(value = "indexKey", required = false) String indexKey) throws ParseException {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
EquipTrendResultVo equipTrendResultVo = equipmentSpecificService.operatingTrendPressurePump(startTime, endTime, bizOrgCode, equipCode, indexKey);
return CommonResponseUtil.success(equipTrendResultVo);
}
@PersonIdentify
@RequestMapping(value = "/operatingTrendWater", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备平台运行趋势 水池液位趋势API", produces = "application/json;charset=UTF-8", notes = "设备平台运行趋势 水池液位趋势API")
public ResponseModel operatingTrendWater(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "equipCode", required = false) String equipCode,
@RequestParam(value = "indexKey", required = false) String indexKey) throws ParseException {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
EquipTrendResultVo equipTrendResultVo = equipmentSpecificService.operatingTrendWater(startTime, endTime, bizOrgCode, equipCode, indexKey);
return CommonResponseUtil.success(equipTrendResultVo);
}
}
......@@ -14,8 +14,7 @@ import java.util.Map;
/**
* @author DELL
*/
//@FeignClient(name = "${iot.vehicle.track}", path = "iot", configuration = {FeignConfiguration.class})
@FeignClient(name = "AMOS-API-IOT", path = "iot", configuration = { FeignConfiguration.class })
@FeignClient(name = "${iot.vehicle.track}", path = "iot", configuration = {FeignConfiguration.class})
public interface IotFeign {
@RequestMapping(value = "/v1/livedata/list", method = RequestMethod.GET, consumes = "application/json")
......
......@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.fegin;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.equipmanage.common.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -204,4 +205,10 @@ public interface JcsFeign {
@GetMapping(value = "/org-usr/getCompany")
FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode);
@GetMapping(value = "/data-dictionary/dataDictionaryIdFillMenu")
FeignClientResult<List<DataDictionary>> dataDictionaryIdFillMenu(@RequestParam(value = "type") String type);
@GetMapping(value = "/data-dictionary/getDictListByType")
FeignClientResult<List<DataDictionary>> getDictListByType(@RequestParam(value = "type") String type);
}
......@@ -53,6 +53,14 @@ public interface EmergencyMapper extends BaseMapper{
*/
Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page , @Param("bizOrgCode") String bizOrgCode, @Param("code") String code);
/**
* 排油系统
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> selectOilDrainageNew(Page<Map<String, Object>> page , @Param("bizOrgCode") String bizOrgCode, @Param("code") String code);
/**
* 气体灭火系统
* @param bizOrgCode
......@@ -107,12 +115,7 @@ public interface EmergencyMapper extends BaseMapper{
* @param name 设备名称
* @return
*/
Page<Map<String, Object>> alarmList(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode,
@Param("systemCode") String systemCode, @Param("types") List<String> types,
@Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name,
@Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus,
@Param("createDate") String createDate , @Param("startDate") String startDate ,
@Param("endDate") String endDate, @Param("sortField") String sortField, @Param("sortOrder") String sortOrder);
Page<Map<String, Object>> alarmList(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("types") List<String> types, @Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name, @Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus , @Param("createDate") String createDate, @Param("startDate") String startDate , @Param("endDate") String endDate, @Param("sortField") String sortField , @Param("sortOrder") String sortOrder);
List<Map<String, Object>> alarmListNoPage( @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("types") List<String> types, @Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name, @Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus , @Param("createDate") String createDate , @Param("startDate") String startDate , @Param("endDate") String endDate);
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
......@@ -105,7 +107,7 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentIndexVO> getEquipIndexBySpecificIdIn(@Param("list") List<String> specificDetails);
List<EquipmentIndexVO> getEquipIndexByIdIn(@Param("list") List<Long> specificIndexIds);
List<Map<String, Object>> getEquipSpecificIndexByUpdateDateDesc();
List<EquipmentSpecificIndex> getEquipmentSpeIndexByIotCodeTrend(String iotCode, Integer isTrend, String fieldKey);
......@@ -119,4 +121,13 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex);
EquipmentSpecificIndex getEquipmentSpeIndexByAddress(String indexAddress, String eventAddress, String gatewayId);
IPage<Map<String, Object>> selectEquipIndexPage(
@Param("page") Page<EquipmentSpecificIndex> page,
@Param("bizOrgCode") String bizOrgCode,
@Param("systemId") String systemId,
@Param("equipName") String equipName,
@Param("startDate") String startDate,
@Param("endDate") String endDate
);
}
......@@ -30,6 +30,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
int getEquipmentSpeCount(Map<String, Object> map);
List<Map<String, Object>> getEquipmentCount(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Long>> getEquipmentCountBySystemId(@Param("bizOrgCode") String bizOrgCode, @Param("systemIds") List<Long> systemIds);
IPage<ComplementCodeVO> selectEquipmentSpecific(Page page, EquipmentSpecificDTO equipmentSpecificDTO);
......@@ -75,18 +76,20 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
/**
* 根据画布id获取画布绑定设备最新指标状态
*
* @param sceneId
* @return
*/
List<EquipmentSpecificIndex> getEquipLatestStatusBySceneId(String sceneId);
List<Map<String, Object>> getStatusAll(@Param("sceneId")String sceneId);
List<Map<String, Object>> getStatusAll(@Param("sceneId") String sceneId);
List<String> getEquipmentIotCodeLists();
List<HashMap<String, Object>> getEquipBySourceId(@Param("sourceIds") List<Long> sourceIds, @Param("categoryId") List<Long> categoryId, @Param("equipCode") String equipCode, @Param("equipName") String equipName,@Param("companyId") String companyId,@Param("current") Long current,@Param("size") Long size);
List<HashMap<String, Object>> getEquipBySourceId(@Param("sourceIds") List<Long> sourceIds, @Param("categoryId") List<Long> categoryId, @Param("equipCode") String equipCode, @Param("equipName") String equipName, @Param("companyId") String companyId, @Param("current") Long current, @Param("size") Long size);
int getEquipBySourceIdCount(@Param("sourceIds") List<Long> sourceIds, @Param("categoryId") List<Long> categoryId, @Param("equipCode") String equipCode, @Param("equipName") String equipName,@Param("companyId") String companyId);
int getEquipBySourceIdCount(@Param("sourceIds") List<Long> sourceIds, @Param("categoryId") List<Long> categoryId, @Param("equipCode") String equipCode, @Param("equipName") String equipName, @Param("companyId") String companyId);
List getMenuChildren(@Param("id") Long id);
......@@ -167,18 +170,19 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<MaintenanceResourceData> getSysEquipClassifyDataList();
IPage<MaintenanceResourceDataVo> getSysEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId,List<String> bandWbCompany);
IPage<MaintenanceResourceDataVo> getSysEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId, List<String> bandWbCompany);
IPage<MaintenanceResourceDataVo> getEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId,List<String> bandWbCompany);
IPage<MaintenanceResourceDataVo> getEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId, List<String> bandWbCompany);
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId);
Map<String, Double> getEquipLocationInfo(Long equipmentSpecificId);
Map<String, Object> getEquipSpeInfo(@Param("equipmentSpecificId") Long equipmentSpecificId);
/**
* 根据specificId删除装备相关数据
*
* @param specificId specificId
*/
// void deleteEquipDataBySpecificId(@Param("specificId") Long specificId, @Param("equipDetailId") Long equipDetailId);
......@@ -202,31 +206,36 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
/**
* 根据库存id删除装备相关库存数据
*
* @param stockDetailId 库存明细id
* @param specificId specificId
* @param specificId specificId
*/
void deleteEquipDataByStockDetailId(@Param("stockDetailId") Long stockDetailId, @Param("specificId") Long specificId);
/**
* 获取雨淋阀室指标详情
*
* @return 指标详情
*/
List<Map<String, String>> getRainRoomIndexDetails();
/**
* 消防管网指标详情
*
* @return 指标详情
*/
List<Map<String, String>> getTropicsIndexDetails();
/**
* 选择阀室指标详情
*
* @return 指标详情
*/
List<Map<String, String>> getChoiceRoomIndexDetails();
/**
* 消防炮伴热带指标详情
*
* @return 指标详情
*/
List<Map<String, String>> getBoxTropicsIndexDetails();
......@@ -234,6 +243,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
/**
* 统计数据
*
* @return
*/
List<Map<String, Object>> queryCompanyStaData();
......@@ -241,21 +251,21 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Equipment getEquipmentBySpecificId(@Param("specificId") Long specificId);
/**
*
* @param floorId 建筑id
* @param isIot 是否物联设备
* @param isIot 是否物联设备
* @return
*/
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId, Integer isIot);
List<Map<String,String>> getStationInfo();
List<Map<String, String>> getStationInfo();
List<Map<String, Object>> getFireMonitorInfo(@Param("equipmentId") Long fireEquipmentId, @Param("list") String[] strings);
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(@Param("list") String[] strings, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getListByEquipmentCode(@Param("list") String[] strings, @Param("bizOrgCode") String bizOrgCode);
......@@ -264,7 +274,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
Page<Map<String, Object>> normalIndexInfoListByPage(@Param("Page")Page<Map<String, Object>> page, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("systemCode") String systemCode, @Param("name") String name);
Page<Map<String, Object>> normalIndexInfoListByPage(@Param("Page") Page<Map<String, Object>> page, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("systemCode") String systemCode, @Param("name") String name);
Map<String, Object> getFireAutoSysInfo();
......@@ -280,11 +290,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map> getWater(@Param("id") Long id);
Map<String, Object> getStationCode(@Param("id")Long id);
Map<String, Object> getStationCode(@Param("id") Long id);
EquipmentSpecific getEquipSpecificEntityByCode(@Param("code") String code);
Integer updateEquipSpecificStatus(String status,String id);
Integer updateEquipSpecificStatus(String status, String id);
String getEquipStatusList(@Param("id") String id);
......@@ -298,15 +308,15 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
String updateEquipSpecificStatusByCheckInput(String id);
Page<Map<String,Object>> selectListByPatrolCheck(Page<Map<String,Object>> page, String id);
Page<Map<String, Object>> selectListByPatrolCheck(Page<Map<String, Object>> page, String id);
List<String> selectIdsByPatrolCheck(String id);
List<Map<String, Object>> queryCheckInputItemsByCheckId(@Param(value="checkId") String checkId);
List<Map<String, Object>> queryCheckInputItemsByCheckId(@Param(value = "checkId") String checkId);
Map<String, Object> getPointById(@Param(value = "pointId") Long id);
Map<String, Object> getPointById(@Param(value = "pointId") Long id);
Map<String, Object> getPatrolData(@Param(value = "checkId") Long checkId);
Map<String, Object> getPatrolData(@Param(value = "checkId") Long checkId);
List<Map<String, Object>> getListByIds(@Param("list") String[] list, @Param("bizOrgCode") String bizOrgCode);
......@@ -318,9 +328,9 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
@Param("useSource") String useSource
);
List<Map<String, Object >> getMonitoringCount(String bizOrgCode);
List<Map<String, Object>> getMonitoringCount(String bizOrgCode);
String getEquipIdByCheckInputId(@Param(value = "id") String id);
String getEquipIdByCheckInputId(@Param(value = "id") String id);
Map<String, Object> getMonitoringEquip(String id);
......@@ -328,7 +338,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
void updateEquipQrCode(List<String> ids, String status);
String selectEquipRealtimeSignal(@Param(value = "id") long id);
String selectEquipRealtimeSignal(@Param(value = "id") long id);
List<Map<String, Object>> getPatrolInfo(String bizOrgCode);
......@@ -346,4 +356,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Integer selectEquipmentCountBySystemId(@Param("systemId") Long systemId);
List<EquipTrendInfoVo> getEquipListByCode(@Param("code") String code, @Param("indexKey") String indexKey, @Param("bizOrgCode") String bizOrgCode);
List<EquipTrendInfoVo> getWaterList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, String>> getIndexKeyByIotCode(@Param("list") Set<String> list);
List<Map<String, String>> getIndexKeyByIotCodeWaterTank(@Param("list") Set<String> list);
}
......@@ -51,9 +51,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @param systemId
* @return
*/
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId, String bizOrgCode);
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@Param("page") Page<Object> page, @Param("systemId") Long systemId);
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@Param("page") Page<Object> page, @Param("systemId") Long systemId, @Param("bizOrgCode") String bizOrgCode);
/**
* 保存
......@@ -772,7 +772,18 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getSystemTypes(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect);
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFEquipInfoListCategory(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getEquipmentRunLogBySysInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode,
@Param("fireEquipmentName") String fireEquipmentName, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> getFireEquipStatistic(@Param("collect") List<String> collect, @Param("bizOrgCode")String bizOrgCode);
List<EquipCountBySystemVO> getFireEquipConfigInfo(@Param("codes") List<String> codes, @Param("bizOrgCode")String bizOrgCode);
}
......@@ -39,6 +39,8 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page, String bizOrgCode, String code);
Page<Map<String, Object>> selectOilDrainageNew(Page<Map<String, Object>> page, String bizOrgCode, String code);
Page<Map<String, Object>> selectGasExtinguishing(Page<Map<String, Object>> page, String bizOrgCode, String code);
Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode);
......
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.Video;
......@@ -77,4 +79,6 @@ public interface IEquipmentSpecificIndexSerivce extends IService<EquipmentSpecif
List<EquipmentIndexVO> getEquipIndexBySpecificIdIn(List<String> specificDetails);
List<EquipmentIndexVO> getEquipIndexByIdIn(List<Long> specificIndexIds);
IPage<Map<String, Object>> getPage(Page<EquipmentSpecificIndex> page, String bizOrgCode, String systemId, String equipName, String startDate, String endDate);
}
......@@ -20,6 +20,7 @@ import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -329,4 +330,10 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
Page<Map<String, Object>> getFireEquipListByDefineCode(String code, String equipStatus, String bizOrgCode, Page<Map<String, Object>> pageBean);
void updateCarStatus(String status, String carId);
EquipTrendResultVo operatingTrendIot(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey);
EquipTrendResultVo operatingTrendPressurePump(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey) throws ParseException;
EquipTrendResultVo operatingTrendWater(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey) throws ParseException;
}
......@@ -58,7 +58,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @param systemId
* @return
*/
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId, String bizOrgCode);
/**
* 根据系统id查询分组设备数量
......@@ -66,7 +66,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @param systemId
* @return
*/
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize);
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize, String bizOrgCode);
/**
* 保存
......@@ -129,7 +129,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @param id
* @return
*/
List<AlarmDataVO> getSystemById(Long id);
List<AlarmDataVO> getSystemById(Long id, String bizOrgCode);
IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(IPage<EquipmentAlarmBySystemIdOrSourceIdVO> page,Long sourceId,Long systemId,Integer confirmType,String createDate,String type, String equipmentId);
......@@ -312,6 +312,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, String companyCode, String systemCode);
Page<Map<String, Object>> getEquipmentRunLogBySysInfo(Page page, String bizOrgCode, String systemCode, String fireEquipmentName, String startTime, String endTime);
List<Map<String, Object>> getEquipExpiryStatistics(String bizOrgCode, Integer expiryDayNum);
Page<Map<String, String>> getEquipExpiryListByPage(String bizOrgCode, Integer expiryDayNum, Page page);
......@@ -359,7 +361,12 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<OrgMenuDto> getSystemEquipTree(String systemCode);
List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getFEquipInfoList(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode);
List<EquipCountBySystemVO> getFireEquipConfigInfo(String bizOrgCode);
List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate);
}
......@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import java.util.List;
import java.util.Map;
/**
* 消防资源监管
*/
......@@ -25,4 +28,6 @@ public interface IFireResourceSupervisionService {
FireResourceStatsDTO getFireCarStats(String bizOrgCode);
FireResourceStatsDTO getFireEquipStats(String bizOrgCode);
List<Map<String, Object>> getFireEquipStatistic(String type, String bizOrgCode);
}
......@@ -7,10 +7,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO;
import com.yeejoin.equipmanage.common.enums.EmergencyEquipTypeEnum;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.enums.PressurePumpAnalysisEnum;
import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.common.vo.IotDataVO;
......@@ -120,6 +117,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
for (Map<String, Object> m : list) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("value")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
if (UnitEnum.LFM.getKey().equalsIgnoreCase(String.valueOf(m.get("unit"))) || UnitEnum.LFM.getName().equals(String.valueOf(m.get("unit")))) {
transResult = UnitTransformUtil.transformValuesLFM(String.valueOf(m.get("value")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
}
m.put("value", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("statusDesc", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
......@@ -133,6 +134,11 @@ public class EmergencyServiceImpl implements IEmergencyService {
} else {
m.put("sxyl", transResult.get("abs"));
}
if (UnitEnum.LFM.getKey().equalsIgnoreCase(String.valueOf(m.get("unit"))) || UnitEnum.LFM.getName().equals(String.valueOf(m.get("unit")))) {
m.put("abs", transResult.get("abs") + "%");
}
m.put("unit", transResult.get("unit").toString());
}
}
return Optional.ofNullable(list).orElse(Lists.newArrayList());
......@@ -162,6 +168,12 @@ public class EmergencyServiceImpl implements IEmergencyService {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
// m.put("nowLevel", transResult.get("nowValue"));
if (UnitEnum.LFM.getKey().equalsIgnoreCase(String.valueOf(m.get("unit"))) || UnitEnum.LFM.getName().equals(String.valueOf(m.get("unit")))) {
transResult = UnitTransformUtil.transformValuesLFM(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
}
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("status", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
......@@ -174,6 +186,12 @@ public class EmergencyServiceImpl implements IEmergencyService {
} else {
m.put("abs", transResult.get("abs"));
}
if (UnitEnum.LFM.getKey().equalsIgnoreCase(String.valueOf(m.get("unit"))) || UnitEnum.LFM.getName().equals(String.valueOf(m.get("unit")))) {
m.put("abs", transResult.get("abs") + "%");
}
m.put("unit", transResult.get("unit").toString());
m.put("nowLevel", transResult.get("nowValue").toString());
}
}
return page1;
......@@ -185,6 +203,11 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public Page<Map<String, Object>> selectOilDrainageNew(Page<Map<String, Object>> page, String bizOrgCode, String code) {
return emergencyMapper.selectOilDrainageNew(page, bizOrgCode, code);
}
@Override
public Page<Map<String, Object>> selectGasExtinguishing(Page<Map<String, Object>> page, String bizOrgCode, String code) {
return emergencyMapper.selectGasExtinguishing(page, bizOrgCode, code);
}
......@@ -643,12 +666,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
@Override
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page, String bizOrgCode, String systemCode,
List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus,
Integer handleStatus,String createDate,String startDate,String endDate,
String sortField,String sortOrder) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus,
handleStatus, createDate, startDate, endDate, sortField, sortOrder);
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page, String bizOrgCode, String systemCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus,String createDate,String startDate,String endDate,String sortField,String sortOrder) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate, sortField, sortOrder);
}
//稳压泵定时向缓存中存昨日启动次数任务
......
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
......@@ -11,6 +13,8 @@ import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
......@@ -97,4 +101,15 @@ public class EquipmentSpecificIndexSerivceImpl extends ServiceImpl<EquipmentSpec
}
}
@Override
public IPage<Map<String, Object>> getPage(Page<EquipmentSpecificIndex> page, String bizOrgCode, String systemId, String equipName, String startDate, String endDate) {
IPage<Map<String, Object>> resultPage = this.baseMapper.selectEquipIndexPage(page, bizOrgCode, systemId, equipName, startDate, endDate);
resultPage.getRecords().forEach(record -> {
String updateDate = record.getOrDefault("updateDate", "").toString();
LocalDateTime dateTime = LocalDateTime.parse(updateDate);
String formattedDate = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
record.put("updateDate", formattedDate);
});
return resultPage;
}
}
package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
......@@ -29,11 +30,13 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.exception.BaseException;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
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.common.vo.*;
import com.yeejoin.equipmanage.fegin.IdxFeign;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
......@@ -62,12 +65,18 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static org.apache.poi.Version.getProduct;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getAppKey;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getToken;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
/**
......@@ -378,6 +387,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Autowired
IotFeign iotFeign;
private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StockBill stockBill = new StockBill();
......@@ -2306,4 +2318,419 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return pageBean;
}
@Override
public EquipTrendResultVo operatingTrendIot(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey) {
List<EquipTrendInfoVo> equipList = equipmentSpecificMapper.getEquipListByCode(equipCode, indexKey, bizOrgCode);
List<String> allTimeList = new ArrayList<>();
ResponseModel entity = null;
//返回数据组装定义
List<String> legends = new ArrayList<>();
List<List<String>> threshold = new ArrayList<>();
Map<String, Map<String, String>> dateValueMapInfo = new HashMap<>();
EquipTrendResultVo equipTrendResultVo = new EquipTrendResultVo();
for (EquipTrendInfoVo equipInfo : equipList) {
//返回数据组装
List<String> maxMinInfo = new ArrayList<>();
maxMinInfo.add(equipInfo.getMinNum());
maxMinInfo.add(equipInfo.getMaxNum());
threshold.add(maxMinInfo);
legends.add(equipInfo.getName());
equipTrendResultVo.setyAxisName(equipInfo.getUnit());
//iot数据查询组装
String prefix = null;
String suffix = null;
String iotCode = equipInfo.getIotCode();
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码不存在或编码错误,请确认!");
}
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startTime, endTime, prefix, suffix, indexKey);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
// 使用Stream API进行排序
List<Map<String, String>> sortedList = listObject.stream()
.sorted(Comparator.comparing(t -> t.get("time")))
.collect(Collectors.toList());
Map<String, String> timeAndValue = new HashMap<>();
for (Map<String, String> mapList : sortedList) {
if (mapList.containsKey(indexKey)) {
timeAndValue.put(mapList.get("time"), mapList.get(indexKey));
allTimeList.add(mapList.get("time"));
}
}
dateValueMapInfo.put(equipInfo.getId(), timeAndValue);
}
}
allTimeList = allTimeList.stream().distinct().collect(Collectors.toList());
equipTrendResultVo.setLegends(legends);
equipTrendResultVo.setThreshold(threshold);
List<List<Object>> yaxisList = new ArrayList<>();
for (EquipTrendInfoVo info : equipList) {
//key:时间 value:数值
Map<String, String> dateValueDataMap = dateValueMapInfo.get(info.getId());
List<Object> values = new ArrayList<>();
String lastValue = "0";
List<String> allTimeListNew = new ArrayList<>();
for (int i = 0; i < allTimeList.size(); i++) {
if (!ObjectUtils.isEmpty(dateValueDataMap) && dateValueDataMap.containsKey(allTimeList.get(i))) {
lastValue = dateValueDataMap.get(allTimeList.get(i));
}
values.add(lastValue);
try {
allTimeListNew.add(change(allTimeList.get(i)));
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
yaxisList.add(values);
equipTrendResultVo.setxAxisData(allTimeListNew);
}
equipTrendResultVo.setyAxisData(yaxisList);
return equipTrendResultVo;
}
@Override
public EquipTrendResultVo operatingTrendPressurePump(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey) throws ParseException {
// 定义一个DateTimeFormatter来匹配时间字符串的格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 使用parse方法将字符串解析为LocalDateTime对象
LocalDateTime startTimeLocal = LocalDateTime.parse(startTime, formatter);
LocalDateTime endTimeLocal = LocalDateTime.parse(endTime, formatter);
//横坐标数据
List<String> allTimeList = getHourlyTimes(startTimeLocal, endTimeLocal);
List<EquipTrendInfoVo> equipList = equipmentSpecificMapper.getEquipListByCode(equipCode, indexKey, bizOrgCode);
ResponseModel entity = null;
//返回数据组装定义
List<String> legends = new ArrayList<>();
List<List<String>> threshold = new ArrayList<>();
List<List<Object>> yaxisList = new ArrayList<>();
EquipTrendResultVo equipTrendResultVo = new EquipTrendResultVo();
//横坐标数据
List<String> allTimeListNew = new ArrayList<>();
for (EquipTrendInfoVo equipInfo : equipList) {
//返回数据组装
List<String> maxMinInfo = new ArrayList<>();
maxMinInfo.add(equipInfo.getMinNum());
maxMinInfo.add(equipInfo.getMaxNum());
threshold.add(maxMinInfo);
legends.add(equipInfo.getName());
equipTrendResultVo.setyAxisName(equipInfo.getUnit());
//iot数据查询组装
String prefix = null;
String suffix = null;
String iotCode = equipInfo.getIotCode();
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码不存在或编码错误,请确认!");
}
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startTime, endTime, prefix, suffix, indexKey);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
HashMap<String, Integer> stringIntegerHashMap = new HashMap<>();
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
List<String> values = new ArrayList<>();
for (Map<String, String> mapList : listObject) {
String time = change(mapList.get("time")).substring(0, 13);
if (stringIntegerHashMap.containsKey(time)) {
stringIntegerHashMap.put(time, stringIntegerHashMap.get(time) + 1);
} else {
stringIntegerHashMap.put(time, 1);
}
}
}
List<Object> values = new ArrayList<>();
for (int i = 0; i < allTimeList.size(); i++) {
values.add(stringIntegerHashMap.getOrDefault(allTimeList.get(i), 0).toString());
}
yaxisList.add(values);
}
List<String> collect = allTimeList.stream().map(item -> item + ":00").collect(Collectors.toList());
equipTrendResultVo.setxAxisData(collect);
equipTrendResultVo.setLegends(legends);
equipTrendResultVo.setThreshold(threshold);
equipTrendResultVo.setyAxisData(yaxisList);
return equipTrendResultVo;
}
@Override
public EquipTrendResultVo operatingTrendWater(String startTime, String endTime, String bizOrgCode, String equipCode, String indexKey) throws ParseException {
//横坐标数据
List<String> allTimeList = getTimePoints(startTime, endTime);
List<EquipTrendInfoVo> equipList = new ArrayList<>();
// iot服务查到的数据,存储为map key:iotCode value: iot查询的液位数据
HashMap<String, List<Map<String, String>>> iotDataInfoMap = new HashMap<>();
Map<String, String> iotCodeIndexKeyMap = new HashMap<>();
Set<String> strings = new HashSet<>();
if (StrUtil.isEmpty(equipCode)) {
equipList = equipmentSpecificMapper.getWaterList(bizOrgCode);
equipList.forEach(item -> {
String[] split = item.getIotCode().split(",");
strings.addAll(Arrays.asList(split));
});
List<Map<String, String>> indexKeyByIotCode = equipmentSpecificMapper.getIndexKeyByIotCode(strings);
iotCodeIndexKeyMap = indexKeyByIotCode.stream().collect(Collectors.toMap(t -> t.get("iotCode"), t -> t.get("indexKey")));
} else {
equipList = equipmentSpecificMapper.getEquipListByCode(equipCode, indexKey, bizOrgCode);
equipList.forEach(item -> {
String[] split = item.getIotCode().split(",");
strings.addAll(Arrays.asList(split));
});
List<Map<String, String>> indexKeyByIotCode = equipmentSpecificMapper.getIndexKeyByIotCodeWaterTank(strings);
iotCodeIndexKeyMap = indexKeyByIotCode.stream().collect(Collectors.toMap(t -> t.get("iotCode"), t -> t.get("indexKey")));
}
for (String iotCode : strings) {
//iot数据查询组装
String prefix = null;
String suffix = null;
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码不存在或编码错误,请确认!");
}
ResponseModel entity = null;
try {
if (iotCodeIndexKeyMap.containsKey(iotCode) && StringUtil.isNotEmpty(iotCodeIndexKeyMap.get(iotCode))) {
String[] split = iotCodeIndexKeyMap.get(iotCode).split(",");
for (String indexKeyNew : split) {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startTime, endTime, prefix, suffix, indexKeyNew);
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
if (!CollectionUtils.isEmpty(listObject)) {
if (iotDataInfoMap.containsKey(iotCode)) {
iotDataInfoMap.get(iotCode).addAll(listObject);
} else {
iotDataInfoMap.put(iotCode, listObject);
}
}
}
}
}
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
}
//返回数据组装定义
List<String> legends = new ArrayList<>();
List<List<String>> threshold = new ArrayList<>();
List<List<Object>> yaxisList = new ArrayList<>();
EquipTrendResultVo equipTrendResultVo = new EquipTrendResultVo();
for (EquipTrendInfoVo equipInfo : equipList) {
//返回数据组装
List<String> maxMinInfo = new ArrayList<>();
maxMinInfo.add(equipInfo.getMinNum());
maxMinInfo.add(equipInfo.getMaxNum());
threshold.add(maxMinInfo);
legends.add(equipInfo.getName());
equipTrendResultVo.setyAxisName(equipInfo.getUnit());
HashMap<String, List<BigDecimal>> stringIntegerHashMap = new HashMap<>();
String[] split = equipInfo.getIotCode().split(",");
for (String iotCode : split) {
String equipIndexKey = iotCodeIndexKeyMap.get(iotCode);
String[] equipIndexKeyNew = equipIndexKey.split(",");
if (!ObjectUtils.isEmpty(iotDataInfoMap) && iotDataInfoMap.containsKey(iotCode)) {
List<Map<String, String>> listObject = iotDataInfoMap.get(iotCode);
for (Map<String, String> mapList : listObject) {
String time = change(mapList.get("time"));
String dateX = roundToNextFiveMinutes(time);
if (stringIntegerHashMap.containsKey(dateX)){
for (String key : equipIndexKeyNew) {
if (mapList.containsKey(key) && !ObjectUtils.isEmpty(mapList.get(key))) {
stringIntegerHashMap.get(dateX).add(new BigDecimal(mapList.get(key)));
}
}
} else {
stringIntegerHashMap.put(dateX, new ArrayList<>());
}
}
}
}
List<Object> values = new ArrayList<>();
for (int i = 0; i < allTimeList.size(); i++) {
List<BigDecimal> orDefault = stringIntegerHashMap.getOrDefault(allTimeList.get(i), new ArrayList<>());
// 计算非空值的总和
BigDecimal sum = orDefault.stream()
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 计算非空值的数量
long count = orDefault.stream().filter(Objects::nonNull).count();
// 检查除数是否为0
BigDecimal divide;
if (count == 0) {
// 如果非空值数量为0,可以选择返回0或其他默认值
divide = BigDecimal.ZERO;
} else {
// 否则,进行除法运算
divide = sum.divide(new BigDecimal(count), 2, RoundingMode.HALF_UP);
}
values.add(divide);
}
yaxisList.add(values);
}
List<String> collect = allTimeList.stream().map(item -> item + ":00").collect(Collectors.toList());
equipTrendResultVo.setxAxisData(collect);
equipTrendResultVo.setLegends(legends);
equipTrendResultVo.setThreshold(threshold);
equipTrendResultVo.setyAxisData(yaxisList);
return equipTrendResultVo;
}
private String change(String time) throws ParseException {
Date date1 = null;
try {
String strDate = time.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
date1 = sdf.parse(strDate);
} catch (ParseException e) {
e.printStackTrace();
}
return DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
}
// 格式化器,用于输出时间
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH");
/**
* 获取给定时间段内每个整点的时间列表
*
* @param startTime 开始时间(包含)
* @param endTime 结束时间(不包含其下一个整点)
* @return 整点时间列表
*/
public static List<String> getHourlyTimes(LocalDateTime startTime, LocalDateTime endTime) {
List<String> hourlyTimes = new ArrayList<>();
// 将开始时间调整为当前小时的起始点
LocalDateTime currentTime = startTime.truncatedTo(java.time.temporal.ChronoUnit.HOURS);
// 循环直到超过结束时间(不包含结束时间的下一个整点)
while (!currentTime.isAfter(endTime)) {
hourlyTimes.add(currentTime.format(formatter));
currentTime = currentTime.plusHours(1);
}
return hourlyTimes;
}
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
/**
* 根据开始时间和结束时间,每隔五分钟获取一个时间点
*
* @param startTimeStr 开始时间字符串,格式为"yyyy-MM-dd HH:mm:ss"
* @param endTimeStr 结束时间字符串,格式为"yyyy-MM-dd HH:mm:ss"
* @return 时间点列表,每个时间点格式为"yyyy-MM-dd HH:mm"
*/
public static List<String> getTimePoints(String startTimeStr, String endTimeStr) {
List<String> timePoints = new ArrayList<>();
try {
// 将字符串时间转换为Date对象
// 注意:这里我们直接解析startTimeStr的完整格式,但只使用年和月日时分来计算下一个五分钟节点
Date startTime = sdf.parse(startTimeStr);
Date endTime = sdf.parse(endTimeStr);
// 计算起始时间的下一个五分钟节点
Calendar calendar = Calendar.getInstance();
calendar.setTime(startTime);
int minute = calendar.get(Calendar.MINUTE);
int nextFiveMinute = (minute / 5 + 1) * 5; // 计算下一个五分钟节点的分钟数
calendar.set(Calendar.MINUTE, nextFiveMinute);
calendar.set(Calendar.SECOND, 0); // 重置秒为0
calendar.set(Calendar.MILLISECOND, 0); // 重置毫秒为0
// 初始时间点为起始时间的下一个五分钟节点
Date currentTime = calendar.getTime();
// 循环直到当前时间超过结束时间
while (currentTime.before(endTime) || currentTime.equals(endTime)) {
// 格式化当前时间并添加到列表中
timePoints.add(sdf.format(currentTime));
// 计算下一个时间点(五分钟后的时间)
calendar.add(Calendar.MINUTE, 5);
currentTime = calendar.getTime();
}
} catch (Exception e) {
e.printStackTrace();
}
return timePoints;
}
// 定义一个DateTimeFormatter用于解析输入时间(包含秒)
// 注意:虽然在这个方法中我们不会直接使用它,但保留它以备将来需要
private static final DateTimeFormatter parserWithSeconds = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 定义一个DateTimeFormatter用于格式化输出时间(不包含秒)
private static final DateTimeFormatter formatterFive = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
/**
* 将给定的时间调整为下一个5分钟节点
*
* @param timeStr 输入的时间字符串,格式为"yyyy-MM-dd HH:mm:ss"
* @return 转换后的时间字符串,格式为"yyyy-MM-dd HH:mm"
*/
public static String roundToNextFiveMinutes(String timeStr) {
// 直接解析包含秒的时间字符串(虽然在这个方法中我们不需要秒)
LocalDateTime dateTime = LocalDateTime.parse(timeStr, parserWithSeconds);
// 获取分钟数
int minute = dateTime.getMinute();
// 计算到下一个5分钟节点的分钟数
int nextFiveMinutes = (minute / 5 + 1) * 5; // 总是向上调整到下一个5分钟倍数
// 计算需要增加的分钟数
int adjustment = nextFiveMinutes - minute;
// 加上差值以调整到下一个5分钟节点,并保留小时和日期部分,但重置秒为0
LocalDateTime roundedDateTime = dateTime.plusMinutes(adjustment).withSecond(0);
// 格式化并返回结果
return roundedDateTime.format(formatterFive);
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.equipmanage.common.entity.Equipment;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
......@@ -16,14 +17,17 @@ import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemGroupMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.FireFightingSystemGroupService;
import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.SystemEquipmentRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
@Slf4j
......@@ -39,6 +43,8 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private IFireFightingSystemService fireFightingSystemService;
@Autowired
private IEquipmentService equipmentService;
/**
* 获取消防系统列表
......@@ -230,6 +236,16 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
}
}
// 查询装备定义的图片 List to Map -> key: equipmentId, value: equipmentEntity
Set<Long> equipmentIds = systemEquipmentMap.values().stream().flatMap(list -> list.stream().map(SystemEquipmentRelationEntity::getEquipmentId)).collect(Collectors.toSet());
Map<Long, Equipment> equipmentImageMap = equipmentService.list(
Wrappers.<Equipment>lambdaQuery()
.select(Equipment::getId, Equipment::getShbzImg, Equipment::getImg)
.in(!equipmentIds.isEmpty(), Equipment::getId, equipmentIds)
).stream().map(equipmentEntity -> new HashMap<Long, Equipment>() {{
put(equipmentEntity.getId(), equipmentEntity);
}}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next()));
// List to Map -> key: systemId@equipmentId, value: 装备定义数量Map
List<Map<String, Object>> equipmentCountList = equipmentSpecificMapper.getEquipmentCount(bizOrgCode);
Map<String, Map<String, Object>> equipmentCountMap = new HashMap<>();
......@@ -241,11 +257,13 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
String uniqueKey = id + "@" + equipmentId;
if (equipmentCountMap.containsKey(uniqueKey)) {
Map<String, Object> objectMap = equipmentCountMap.get(uniqueKey);
objectMap.put("count", Long.parseLong(map.getOrDefault("count", "0").toString()) + Long.parseLong(objectMap.getOrDefault("count", 0).toString()));
long count = Long.parseLong(map.getOrDefault("count", "0").toString()) + Long.parseLong(objectMap.getOrDefault("count", 0).toString());
objectMap.put("count", count);
}
equipmentCountMap.put(uniqueKey, map);
}
}
List<Map<String, Long>> systemEquipCountMaps = equipmentSpecificMapper.getEquipmentCountBySystemId(bizOrgCode, systemIds);
// 构建分组对象
JSONArray groups = new JSONArray();
......@@ -279,17 +297,28 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
Long equipmentId = relationEntity.getEquipmentId();
if (equipmentCountMap.containsKey(systemId + "@" + equipmentId)) {
Map<String, Object> equipmentMap = equipmentCountMap.get(systemId + "@" + equipmentId);
Equipment imageEquipment = equipmentImageMap.get(equipmentId);
Map<String, Object> equipment = new HashMap<>();
equipment.put("id", equipmentMap.get("equipmentId"));
equipment.put("name", equipmentMap.get("equipmentName"));
equipment.put("num", Integer.valueOf(equipmentMap.getOrDefault("count", "0").toString()));
equipment.put("unit", equipmentMap.get("unit"));
if (Objects.nonNull(imageEquipment)) {
equipment.put("img", StringUtils.hasText(imageEquipment.getShbzImg()) ? imageEquipment.getShbzImg() : imageEquipment.getImg());
}
equipment.put("sort", relationEntity.getSort());
equipment.put("type", relationEntity.getType());
equipments.add(equipment);
}
}
system.put("equipments", equipments);
AtomicLong equipmentCount = new AtomicLong(0);
systemEquipCountMaps.forEach(map -> {
if (String.valueOf(map.get("systemId")).matches(".*" + systemId + ".*")) {
equipmentCount.addAndGet(Long.parseLong(map.getOrDefault("count", 0L).toString()));
}
});
system.put("equipmentCount", equipmentCount.get());
systems.add(system);
}
groups.add(group);
......
......@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -206,13 +207,13 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
private StockDetailMapper stockDetailMapper;
@Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId);
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId, String bizOrgCode) {
return this.baseMapper.getEquipCountBySystemId(systemId, bizOrgCode);
}
@Override
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize) {
return this.baseMapper.getEquipCountPageBySystemId(new Page(pageNumber, pageSize), systemId);
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize, String bizOrgCode) {
return this.baseMapper.getEquipCountPageBySystemId(new Page(pageNumber, pageSize), systemId, bizOrgCode);
}
......@@ -1232,22 +1233,24 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public List<AlarmDataVO> getSystemById(Long id) {
public List<AlarmDataVO> getSystemById(Long id, String bizOrgCode) {
List<AlarmDataVO> list = this.baseMapper.getSystemById(id);
// 部件总数
Integer equipmentCount = equipmentSpecificMapper.selectCount(
Wrappers.<EquipmentSpecific>lambdaQuery()
.eq(EquipmentSpecific::getSystemId, id)
.eq(EquipmentSpecific::getSingle, true)
.like(EquipmentSpecific::getSystemId, id)
.isNotNull(EquipmentSpecific::getEquipmentCode)
.likeRight(StringUtils.hasText(bizOrgCode), EquipmentSpecific::getBizOrgCode, bizOrgCode)
);
// 未复归设备
List<EquipmentSpecificAlarmLog> equipSpecIds = equipmentSpecificAlarmLogMapper.selectList(
Wrappers.<EquipmentSpecificAlarmLog>lambdaQuery()
.select(EquipmentSpecificAlarmLog::getEquipmentSpecificId)
.like(EquipmentSpecificAlarmLog::getSystemIds, id)
.eq(EquipmentSpecificAlarmLog::getStatus, "1")
List<EquipmentSpecificAlarm> equipSpecIds = equipmentSpecificAlarmMapper.selectList(
Wrappers.<EquipmentSpecificAlarm>lambdaQuery()
.select(EquipmentSpecificAlarm::getEquipmentSpecificId)
.like(EquipmentSpecificAlarm::getSystemIds, id)
.eq(EquipmentSpecificAlarm::getStatus, "1")
.likeRight(StringUtils.hasText(bizOrgCode), EquipmentSpecificAlarm::getBizOrgCode, bizOrgCode)
);
int count = (int) equipSpecIds.stream().map(EquipmentSpecificAlarmLog::getEquipmentSpecificId).distinct().count();
int count = (int) equipSpecIds.stream().map(EquipmentSpecificAlarm::getEquipmentSpecificId).distinct().count();
list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false));
list.add(new AlarmDataVO("未复归设备", count + " 个", false));
return list;
......@@ -2896,6 +2899,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getEquipmentsBySystemInfo(page, null, systemCode, equipmentCode);
}
@Override
public Page<Map<String, Object>> getEquipmentRunLogBySysInfo(Page page, String bizOrgCode, String systemCode, String fireEquipmentName, String startTime, String endTime) {
return fireFightingSystemMapper.getEquipmentRunLogBySysInfo(page, bizOrgCode, systemCode, fireEquipmentName, startTime, endTime);
}
public static List<OrgMenuDto> systemAndEquipmentTreeNew(List<Map<String,Object>> list) {
List<OrgMenuDto> menuList = list.stream()
.map(o -> new OrgMenuDto(Long.parseLong(o.get("id").toString()), o.get("name").toString(),
......@@ -2928,6 +2936,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return result;
}
@Override
public List<Map<String, Object>> getFEquipInfoList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoList(bizOrgCode);
......@@ -2978,4 +2987,75 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map<String, Object>> closeList = Collections.singletonList(closeMap);
return CollUtil.isNotEmpty(resultList) ? resultList : closeList;
}
@Override
public List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode) {
List<DataDictionary> zdsbfl = jcsFeignClient.dataDictionaryIdFillMenu("ZDSBFL").getResult();
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoListCategory(bizOrgCode);
ArrayList<String> strings = new ArrayList<>();
list.forEach(item -> {
String equipIds = item.get("equipIds").toString();
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> equipIndexList = this.baseMapper.getEquipIndexList(collect);
Map<String, Map<String, Object>> equipmentSpecificId = equipIndexList.stream().collect(Collectors.toMap(item -> item.get("equipmentSpecificId").toString(), item -> item));
List<Map<String, Object>> resultList = new ArrayList<>();
list.forEach(item -> {
int isOpen = 0;
Date updateDate = null;
String equipIds = item.get("equipIds").toString();
String[] equipIdList = equipIds.split(",");
for (String index : equipIdList) {
if (ObjectUtil.isNotEmpty(equipmentSpecificId)
&& equipmentSpecificId.containsKey(index)
&& equipmentSpecificId.get(index).containsKey("equipmentIndexKey")
&& equipmentSpecificId.get(index).get("equipmentIndexKey").toString().equals("ONL_DrainOilValve_Open")) {
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.NORM_DATETIME_PATTERN);
} else {
int comparisonResult = DateUtil.compare(updateDate, DateUtil.parse(map.get("updateDate").toString(), DatePattern.NORM_DATETIME_PATTERN));
updateDate = comparisonResult < 0 ? DateUtil.parse(map.get("updateDate").toString(), DatePattern.NORM_DATETIME_PATTERN) : updateDate;
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.get("id"));
resultMap.put("name", item.get("name"));
resultMap.put("time", updateDate);
resultMap.put("drainDuration", item.get("drainDuration"));
resultMap.put("category", item.get("category"));
if (isOpen == 1) {
resultMap.put("status", "start");
} else {
resultMap.put("status", "stop");
}
resultList.add(resultMap);
});
List<Map<String, Object>> listNew = new ArrayList<>();
Map<String, List<Map<String, Object>>> categoryMap = resultList.stream().collect(Collectors.groupingBy(t -> t.get("category").toString()));
zdsbfl.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("code", item.getTreeCode());
map.put("name", item.getName());
map.put("items", categoryMap.get(item.getTreeCode()));
listNew.add(map);
});
return listNew;
}
@Override
public List<EquipCountBySystemVO> getFireEquipConfigInfo(String bizOrgCode) {
List<DataDictionary> fireConfigInfoList = jcsFeignClient.getDictListByType("ZYGL_XFQC").getResult();
if (CollUtil.isEmpty(fireConfigInfoList)) {
return new ArrayList<>();
}
Map<String, Integer> collect = fireConfigInfoList.stream().collect(Collectors.toMap(DataDictionary::getCode, DataDictionary::getSortNum));
List<String> codes = fireConfigInfoList.stream().map(DataDictionary::getCode).collect(Collectors.toList());
List<EquipCountBySystemVO> fireEquipConfigInfo = this.baseMapper.getFireEquipConfigInfo(codes, bizOrgCode);
fireEquipConfigInfo.forEach(item -> item.setSortNum(collect.getOrDefault(item.getEquipmentCode(), 1)));
return fireEquipConfigInfo.stream().sorted(Comparator.comparingInt(EquipCountBySystemVO::getSortNum)).collect(Collectors.toList());
}
}
package com.yeejoin.equipmanage.service.impl;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import com.yeejoin.equipmanage.common.enums.EmergencyEquipTypeEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IFireResourceSupervisionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
......@@ -19,6 +26,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
JcsFeign jcsFeignClient;
/**
* 消防系统信息
*
......@@ -64,6 +74,19 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
return buildFireResourceStatsDTO(resultMap);
}
@Override
public List<Map<String, Object>> getFireEquipStatistic(String type, String bizOrgCode) {
List<DataDictionary> dictionaryList = jcsFeignClient.dataDictionaryIdFillMenu(StringUtil.isNotEmpty(type) ? type : "ZYGL_XFQC").getResult();
List<String> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(dictionaryList)) {
dictionaryList.forEach(x -> {
list.add(x.getTreeCode());
});
}
List<Map<String, Object>> resultMap = fireFightingSystemMapper.getFireEquipStatistic(list, bizOrgCode);
return resultMap;
}
private FireResourceStatsDTO buildFireResourceStatsDTO(Map<String, Object> resultMap) {
FireResourceStatsDTO fireResourceStats = new FireResourceStatsDTO();
fireResourceStats.setTotalCounts(Long.parseLong(resultMap.get("totalCount").toString()));
......
......@@ -526,6 +526,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
StringBuilder endIndex = new StringBuilder(iotCode).insert(8, '/');
String iotTopic = "influxdb/" + endIndex;
JSONObject msg = new JSONObject();
msg.put("traceId", equipmentSpeIndex.getId() + "");
msg.put(equipmentSpeIndex.getEquipmentIndexKey(), value);
mqttSendGateway.sendToMqtt(iotTopic, JSON.toJSONString(msg));
......@@ -586,7 +587,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
saveEquipmentAlarmReportDay(equipmentSpeIndex, alarmFlag);
// 指标告警处理
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm()) {
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm() && !equipmentSpeIndex.getEquipmentIndexKey().equals(pressurePumpStart)) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpeIndex, messageBodyMap));
}
// 遥测遥信数据推送云端kafka
......@@ -648,6 +649,16 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
iotDatalist.forEach(iotDataVO -> {
String indexKey = iotDataVO.getKey();
String indexValue = iotDataVO.getValue().toString();
// 稳压泵启停信号处理
if (indexKey.equals(pressurePumpStart)) {
pressurePump(indexKey, indexValue, iotDatalist, topicEntity);
}
});
equipmentSpecificAlarms.forEach(action -> {
if (AlarmStatusEnum.BJ.getCode() == action.getStatus()) {
alarmLogs.add(addEquipAlarmLogRecord(action));
......@@ -803,10 +814,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return;
}
String iotCode = equipmentSpecific.getIotCode();
topicEntity.setIotCode(iotCode);
StringBuilder endIndex = new StringBuilder(iotCode).insert(8, '/');
String iotTopic = "influxdb/" + endIndex;
JSONObject msg = new JSONObject();
msg.put(equipmentSpeIndex.getEquipmentIndexKey(), value);
msg.put("traceId", equipmentSpeIndex.getId() + "");
mqttSendGateway.sendToMqtt(iotTopic, JSON.toJSONString(msg));
List<EquipmentSpecificVo> eqIotCodeList = iEquipmentSpecificSerivce.getEquipAndCarIotcodeByIotcode(iotCode);
......@@ -865,7 +878,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
saveEquipmentAlarmReportDay(equipmentSpeIndex, alarmFlag);
// 指标告警处理
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm()) {
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm() && !equipmentSpeIndex.getEquipmentIndexKey().equals(pressurePumpStart)) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpeIndex, messageBodyMap));
}
// 遥测遥信数据推送云端kafka
......@@ -926,6 +939,16 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
iotDatalist.forEach(iotDataVO -> {
String indexKey = iotDataVO.getKey();
String indexValue = iotDataVO.getValue().toString();
// 稳压泵启停信号处理
if (indexKey.equals(pressurePumpStart)) {
pressurePump(indexKey, indexValue, iotDatalist, topicEntity);
}
});
equipmentSpecificAlarms.forEach(action -> {
if (AlarmStatusEnum.BJ.getCode() == action.getStatus()) {
alarmLogs.add(addEquipAlarmLogRecord(action));
......@@ -2721,6 +2744,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// }
private void pressurePump(String indexKey, String indexValue, List<IotDataVO> iotDatalist, TopicEntityVo topicEntity) {
log.info("开始处理稳压泵逻辑:{}值:{}", indexKey, indexValue);
List<String> listIndex = new ArrayList<>();
listIndex.add(pressurePumpStart);
// 获取全部启停泵信号
......@@ -2748,6 +2772,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
PressurePumpValueEnum valueEnum = PressurePumpValueEnum.getByCode(pressurePumpEnum.getCompareValue());
assert valueEnum != null;
EquipmentSpecificIndex data = getPressurePumpDateByType(indexKey, valueEnum, topicEntity, equipmentSpeIndexList, pressurePumpEnum);
log.info("稳压泵获取{}, 值为{}", valueEnum.getDescribe(), data);
Date newDate = new Date();
// 2. 校验
if (!ObjectUtils.isEmpty(data.getUpdateDate())) {
......@@ -2768,13 +2793,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
EquipmentSpecificIndex equipmentSpecificIndex = new EquipmentSpecificIndex();
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
if (!StringUtils.isEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
log.error("错误的物联编码是:", topicEntity.getIotCode());
throw new BadRequest("装备物联编码错误,请确认!");
}
switch (valueEnum) {
case LAST_STOP:
List<EquipmentSpecificIndex> lastStop = equipmentSpeIndexList.stream().filter(e ->
......@@ -2874,6 +2899,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
assert pumpCheckEnum != null;
String leftValue = pressurePumpEnum.getLeftValue();
String rightValue = pressurePumpEnum.getRightValue();
log.info("检验方式:{},大于:{},小于:{}, 间隔:{}", pumpCheckEnum.getDescribe(), leftValue, rightValue, diff);
switch (pumpCheckEnum) {
case LE:
if (StringUtil.isNotEmpty(rightValue)) {
......
......@@ -141,7 +141,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
String time = split.length > 0 ? (split[split.length - 1]) : "";
try {
Date date = DateUtils.convertStrToDate(time, DateUtils.DATE_PATTERN);
// 结束日期不包含今天,获取3天前数据
// 结束日期不包含今天,获取3天前数据 改为统计近三天 包含当天
if (DateUtils.dateCompare(date, startDate) >= 0 && DateUtils.dateCompare(endDate, date) >= 0) {
list.add(JSON.parseObject(redisUtils.get(x).toString(), PressurePumpCountVo.class));
}
......
......@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -40,6 +41,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.context.RequestContext.*;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
@Slf4j
......@@ -49,7 +51,7 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
@Autowired
SupervisionVideoMapper supervisionVideoMapper;
@Autowired
private IVideoService videoService;
@Autowired
......@@ -129,7 +131,7 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
// 近3天启动平均值,四合五入
AtomicInteger dayAvgFrequency = new AtomicInteger();
try {
Date startDate = com.yeejoin.amos.boot.biz.common.utils.DateUtils.dateAddDays(dateNow, Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue()));
Date startDate = com.yeejoin.amos.boot.biz.common.utils.DateUtils.dateAddDays(dateNow, Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue()) + 1);
String startTime = String.join(" ", com.yeejoin.amos.boot.biz.common.utils.DateUtils.dateFormat(startDate, com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_PATTERN), "00:00:00");
String endTime = String.join(" ", com.yeejoin.amos.boot.biz.common.utils.DateUtils.dateFormat(dateNow, com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_PATTERN), "23:59:59");
Map<String, List<PressurePumpCountVo>> dayAvgDataMap = pressurePumpService.getDateRangeCountList(pumpInfoList, startTime,endTime, PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), countRedisKey, equipmentCode, pressurePumpStart, countExpire, bizOrgCode);
......@@ -344,7 +346,11 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
Map<String, String> map = new HashMap<>();
map.put("id", UUID.randomUUID().toString());
map.put("name", String.valueOf(item.get("name")));
map.put("time", String.valueOf(x.get("time")).substring(0, 19).replace("T", " "));
try {
map.put("time", change(String.valueOf(x.get("time"))));
} catch (ParseException e) {
throw new RuntimeException(e);
}
map.put("value", String.valueOf(x.get(pressurePumpStart)));
finalResList.add(map);
});
......@@ -386,4 +392,17 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
public List<Map<String, Object>> selectAllPressureName(String bizOrgCode) {
return fireFightingSystemMapper.selectAllPressureName(bizOrgCode);
}
private String change(String time) throws ParseException {
Date date1 = null;
try {
String strDate = time.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
date1 = sdf.parse(strDate);
} catch (ParseException e) {
e.printStackTrace();
}
return DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
}
}
......@@ -4,6 +4,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import liquibase.util.StringUtil;
import java.util.HashSet;
import java.util.Set;
......@@ -33,6 +35,11 @@ public class BeanUtil {
public static boolean judgePropertyContainsChar(String sourceStr, String specialStr) {
boolean bool = Boolean.FALSE;
if(StringUtil.isEmpty(sourceStr) || StringUtil.isEmpty(specialStr)){
return bool;
}
specialStr = specialStr.trim();
sourceStr = sourceStr.trim();
String[] strings = specialStr.split(",");
for (String code : strings) {
if (sourceStr.contains(code)) {
......
......@@ -178,13 +178,13 @@ public class InputItemController extends AbstractBaseController {
// } else if (!StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(facilitiesTypeName)) {
// finalTypeName = facilitiesTypeName;
// }
if (inputItemVo.getCustomType().equals("1") && inputItemVo.getKeyPartsType().equals("1")) {
if ("1".equals(inputItemVo.getCustomType()) && "1".equals(inputItemVo.getKeyPartsType())) {
finalTypeName = "";
} else if (inputItemVo.getCustomType().equals("0") && inputItemVo.getKeyPartsType().equals("1")) {
} else if ("0".equals(inputItemVo.getCustomType()) && "1".equals(inputItemVo.getKeyPartsType())) {
finalTypeName = "自定义巡检点";
} else if (inputItemVo.getCustomType().equals("1") && inputItemVo.getKeyPartsType().equals("0")) {
} else if ("1".equals(inputItemVo.getCustomType()) && "0".equals(inputItemVo.getKeyPartsType())) {
finalTypeName = "重点部位类型";
} else if (inputItemVo.getCustomType().equals("0") && inputItemVo.getKeyPartsType().equals("0")) {
} else if ("0".equals(inputItemVo.getCustomType()) && "0".equals(inputItemVo.getKeyPartsType())) {
finalTypeName = "自定义巡检点" + "," + "重点部位类型";
}
inputItemVo.setTypeName(finalTypeName);
......
......@@ -8,7 +8,7 @@
</parent>
<artifactId>amos-boot-system-equip</artifactId>
<version>3.7.2.0</version>
<version>3.7.2.3</version>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
......
......@@ -1141,7 +1141,9 @@
<changeSet author="keyong" id="168623599">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_car" />
<not>
<columnExists tableName="wl_car" columnName="max_speed"/>
</not>
</preConditions>
<comment>新增属性数据</comment>
<sql>
......
......@@ -51,7 +51,7 @@
( 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wesa`.`system_ids` )
AND `wesa`.`status` = 1)) > 0
),
'异常',
'告警',
'正常'
) AS `status`
FROM
......@@ -246,38 +246,31 @@
wel.warehouse_structure_id ,wel.equipment_code
</select>
<select id="selectFireMonitor" resultType="java.util.Map">
SELECT temp.name, temp.alarm ,temp.id, temp.code,
IFNULL((SELECT wesi.value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_CAFSFireGun_FireGunPressure'
ORDER BY wesi.update_date desc LIMIT 1),0) AS value,
IFNULL((SELECT CASE WHEN wesi.value_label IS NULL OR trim( wesi.value_label ) = '' THEN (CASE
wesi.`value`
WHEN 'true' THEN
concat( wesi.equipment_index_name, '(是)' )
WHEN 'false' THEN
concat( wesi.equipment_index_name, '(否)' )
ELSE
wesi.equipment_index_name
END) ELSE wesi.value_label END FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wei on wesi.equipment_index_id = wei.id
WHERE wesi.equipment_specific_id = temp.id AND wei.is_trend = 0
AND wesi.value is NOT NULL AND wesi.value <![CDATA[<>]]> ''
ORDER BY wesi.update_date desc LIMIT 1),'--') AS status,
'0' AS flow
FROM(
SELECT
temp.name,
temp.alarm,
temp.id,
temp.code,
IFNULL((SELECT wesi.value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_CAFSFireGun_FireGunPressure'
ORDER BY wesi.update_date desc LIMIT 1), 0) AS value,
IFNULL((SELECT CASE WHEN wesi.`value` = 'true' THEN wesi.equipment_index_name ELSE '关到位' END FROM wl_equipment_specific_index wesi
WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_GunValve_Open' ORDER BY wesi.update_date DESC LIMIT 1),'关到位') AS status,
IFNULL((SELECT wesi.`value` FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_GunValve_Flow' ORDER BY wesi.update_date DESC LIMIT 1), 0) AS flow
FROM
(
SELECT wes.id,wes.name,wes.code,
CASE
WHEN ( SELECT is_alarm FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key ) = 1
AND wes.realtime_iot_index_value = 'true' THEN
1 ELSE 0
END AS alarm
CASE WHEN (SELECT is_alarm FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key ) = 1
AND wes.realtime_iot_index_value = 'true' THEN
1 ELSE 0
END AS alarm
FROM wl_equipment_specific wes
JOIN f_equipment_fire_equipment fire ON wes.id = fire.fire_equipment_id
WHERE
wes.equipment_code LIKE concat( '920322', '%' )
<if test="code != null and code!='' ">
AND fire.equipment_id = (SELECT id FROM f_equipment WHERE `code` = #{code})
</if>
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
wes.equipment_code LIKE concat( '920322', '%' )
<if test="code != null and code!='' ">
AND fire.equipment_id = (SELECT id FROM f_equipment WHERE `code` = #{code})
</if>
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) temp
</select>
<select id="selectFoamTank" resultType="java.util.Map">
......@@ -442,6 +435,102 @@
)
</select>
<select id="selectOilDrainageNew" resultType="java.util.Map">
SELECT
wes.id,
'3' AS type,
(
SELECT
IF
(
wesi.`value` = 'true'
AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open',
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Open' ),
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Close' ))
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS level,
wes.CODE AS code,
wes.name,
(
SELECT
IF
( wesi.`value` = 'true' AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open', '全开', '全关' )
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS status
FROM
wl_equipment_specific wes
JOIN f_equipment_fire_equipment fire ON wes.id = fire.fire_equipment_id
WHERE
wes.equipment_code LIKE concat( '921004', '%' )
<if test="code != null and code!='' ">
AND fire.equipment_id = (SELECT id FROM f_equipment WHERE `code` = #{code})
</if>
<if test="code != null and code!='' ">
UNION ALL
(
SELECT
wes.id,
'3' AS type,
(
SELECT
IF
(
wesi.`value` = 'true'
AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open',
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Open' ),
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Close' ))
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS level,
wes.CODE AS code,
wes.name,
(
SELECT
IF
( wesi.`value` = 'true' AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open', '全开', '全关' )
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS status
FROM
wl_equipment_specific wes
JOIN f_equipment_fire_equipment fire ON wes.id = fire.fire_equipment_id
WHERE
wes.equipment_code LIKE concat( '921004', '%' )
AND fire.equipment_id != (SELECT id FROM f_equipment WHERE `code` = #{code})
)
</if>
</select>
<select id="selectGasExtinguishing" resultType="java.util.Map">
SELECT
wes.id,
......@@ -1493,13 +1582,23 @@
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<if test="sortField != null and sortField != '' and sortField == 'createDate'">
<choose>
<when test="sortOrder == 'ascend'">
wlesal.create_date ASC
</when>
<otherwise>
wlesal.create_date DESC
</otherwise>
</choose>
</if>
<if test="sortField != null and sortField != '' and sortField == 'cleanStatus'">
<choose>
<when test="sortOrder == 'ascend'">
@SORT_FIELD ASC
wlesal.clean_time ASC
</when>
<otherwise>
@SORT_FIELD DESC
wlesal.clean_time DESC
</otherwise>
</choose>
</if>
......
......@@ -610,4 +610,35 @@
and biz_org_code = #{bizOrgCode}
GROUP BY plan_name
</select>
<select id="selectEquipIndexPage" resultType="java.util.Map">
SELECT wesi.id AS id,
wes.code AS equipmentSpecificCode,
wes.name AS equipmentSpecificName,
wesi.equipment_index_name AS equipmentIndexName,
wesi.value AS equipmentIndexValue,
wesi.unit AS equipmentIndexUnit,
wes.position AS location,
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
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="systemId != null and systemId != ''">
AND wes.system_id = #{systemId}
</if>
<if test="equipName != null and equipName != ''">
AND wes.name LIKE CONCAT('%', #{equipName}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND wesi.update_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND wesi.update_date &lt;= #{endDate}
</if>
</where>
ORDER BY wesi.update_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -118,8 +118,7 @@
u.name AS unit
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail wsd ON wesp.equipment_detail_id = wsd.id
LEFT JOIN wl_equipment we ON wsd.equipment_id = we.id
LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code
LEFT JOIN wl_unit u on u.id = we.unit_id
<where>
we.id IS NOT NULL AND wesp.system_id IS NOT NULL
......@@ -127,8 +126,29 @@
AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if>
</where>
GROUP BY
we.code, wesp.system_id
GROUP BY we.code
</select>
<select id="getEquipmentCountBySystemId" resultType="Map">
SELECT
wesp.system_id AS systemId,
count(1) AS count
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code
<where>
we.id IS NOT NULL AND wesp.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if>
<if test="systemIds != null and systemIds.size() > 0">
AND (
<foreach collection="systemIds" item="systemId" separator="OR">
wesp.system_id LIKE concat('%',#{systemId},'%')
</foreach>
)
</if>
</where>
GROUP BY wesp.system_id
</select>
<select id="selectEquipmentSpecific" resultMap="ComplementCode">
SELECT
......@@ -2999,4 +3019,104 @@
</if>
</select>
<select id="getEquipListByCode" resultType="com.yeejoin.equipmanage.common.entity.vo.EquipTrendInfoVo">
SELECT
a.id,
a.iot_code AS iotCode,
a.`name` AS `name`,
<if test="code == '92011000'">
max( CASE WHEN b.field_name = 'maxPressure' THEN b.field_value END ) AS maxNum,
max( CASE WHEN b.field_name = 'minPressure' THEN b.field_value END ) AS minNum,
concat('压力(', ifnull(c.unit, 'Mpa'), ')') as unit
</if>
<if test="(code == '92032000' and indexKey == 'CAFS_WaterTank_WaterTankLevel') or (code == '92031900')">
max( CASE WHEN b.field_name = 'maxLevel' THEN b.field_value END ) AS maxNum,
max( CASE WHEN b.field_name = 'minLevel' THEN b.field_value END ) AS minNum,
concat('液位(', ifnull(c.unit, 'M'), ')') as unit
</if>
<if test="code == '92032000' and indexKey == 'CAFS_WaterTank_EffluentFlow'">
max( CASE WHEN b.field_name = 'maxLevel' THEN b.field_value END ) AS maxNum,
max( CASE WHEN b.field_name = 'minLevel' THEN b.field_value END ) AS minNum,
concat('出口流量(', ifnull(c.unit, 'L/S'), ')') as unit
</if>
<if test="code == '92010800'">
'频次(次/小时)' as unit
</if>
FROM
`wl_equipment_specific` AS a
LEFT JOIN wl_form_instance_equip b ON a.id = b.instance_id
LEFT JOIN ( SELECT * FROM wl_equipment_specific_index WHERE equipment_index_key = #{indexKey} ) c ON a.id = c.equipment_specific_id
<where>
a.`equipment_code` LIKE concat(#{code}, '%')
AND a.iot_code is not null AND a.iot_code != ''
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code LIKE concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
</select>
<select id="getWaterList" resultType="com.yeejoin.equipmanage.common.entity.vo.EquipTrendInfoVo">
SELECT
a.sequence_nbr AS id,
a.`name` AS `name`,
GROUP_CONCAT( c.iot_code ) AS iotCode,
b.min_water_level AS minNum,
b.max_water_level AS maxNum,
'液位(M)' AS unit
FROM
`cb_water_resource` AS a
LEFT JOIN cb_water_resource_pool b ON a.sequence_nbr = b.resource_id
LEFT JOIN wl_equipment_specific c ON FIND_IN_SET( c.id, b.level_device_id )
WHERE
b.level_device_id IS NOT NULL
AND b.level_device_id != ''
AND a.resource_type IN ( 'pool', 'industryPool' )
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code LIKE concat(#{bizOrgCode}, '%')
</if>
GROUP BY
a.sequence_nbr
HAVING
iotCode IS NOT NULL
AND iotCode != ''
</select>
<select id="getIndexKeyByIotCode" resultType="java.util.Map">
SELECT
a.iot_code as iotCode,
max(case when b.type_code = 'LiquidLevel' then equipment_index_key end) as indexKey
FROM
wl_equipment_specific a
LEFT JOIN wl_equipment_specific_index b ON a.id = b.equipment_specific_id
WHERE
a.iot_code
IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
GROUP BY
a.iot_code
</select>
<select id="getIndexKeyByIotCodeWaterTank" resultType="java.util.Map">
SELECT
a.iot_code AS iotCode,
GROUP_CONCAT( b.equipment_index_key ) AS indexKey
FROM
wl_equipment_specific a
LEFT JOIN ( SELECT * FROM wl_equipment_specific_index WHERE type_code = 'LiquidLevel' ) b ON a.id = b.equipment_specific_id
WHERE
a.iot_code IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
GROUP BY
a.iot_code
HAVING
indexKey IS NOT NULL
AND indexKey != ''
</select>
</mapper>
\ No newline at end of file
......@@ -11,6 +11,7 @@
<resultMap id="EquipCountBySystemId" type="com.yeejoin.equipmanage.common.entity.vo.EquipCountBySystemVO">
<result property="equipmentId" column="equipment_id"></result>
<result property="equipmentCode" column="equipment_code"></result>
<result property="equipmentName" column="equipment_name"></result>
<result property="equipmentNum" column="num"></result>
<result property="unitName" column="unit_name"></result>
......@@ -103,31 +104,43 @@
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment AS wle ON wle.code = spe.equipment_code
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
where
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
<where>
wle.id is not null
and find_in_set(#{systemId},spe.system_id)
<if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
group by wle.code
</select>
<select id="getEquipCountPageBySystemId" resultMap="EquipCountBySystemId">
SELECT
wle.id equipment_id,
wle.code equipment_code,
wle.NAME equipment_name,
count(spe.id) num,
wle.`code` equip_code,
unit.name unit_name,
wle.shbz_img img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
where
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
LEFT JOIN wl_equipment AS wle ON wle.`code` = spe.equipment_code
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
<where>
wle.id is not null and spe.system_id is not null
<if test="systemId != null and systemId != ''">
AND find_in_set(#{systemId},spe.system_id)
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
group by wle.code
</select>
<insert id="save">
INSERT INTO
......@@ -6979,30 +6992,27 @@
SELECT
s.*
FROM
(
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN'), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type = 'FIREALARM'), 1, 0)), 0) AS alarmNum,
IFNULL(SUM(IF((r.type = 'SHIELD'), 1, 0)), 0) AS shieldNum,
DATE_FORMAT( r.create_date, '%Y-%m-%d') AS date
FROM
wl_equipment_specific_alarm_log r
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
<where>
fs.system_type_code IS NOT NULL
<if test="systemCode != null and systemCode != ''">
AND fs.`code` = #{systemCode}
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
LEFT ( r.create_date, 10 )
ORDER BY
r.create_date
) s
(
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type != 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
FROM
wl_equipment_specific_alarm r
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
<where>
r.update_date BETWEEN date_sub( now(), INTERVAL 6 MONTH ) AND now()
<if test="systemCode != null and systemCode != ''">
AND fs.`code` = #{systemCode}
</if>
</where>
GROUP BY
r.equipment_specific_id,
LEFT ( r.update_date, 10 )
ORDER BY
r.update_date
) s
) s2 ON s2.date = s1.date
GROUP BY
s1.date
......@@ -7035,10 +7045,10 @@
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type = 'FIREALARM' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
IFNULL(SUM(IF((r.type != 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
FROM
wl_equipment_specific_alarm_log r
wl_equipment_specific_alarm r
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
<where>
r.update_date BETWEEN date_sub( now(), INTERVAL 15 MONTH ) AND now()
......@@ -7047,6 +7057,7 @@
</if>
</where>
GROUP BY
r.equipment_specific_id,
LEFT ( r.update_date, 10 )
ORDER BY
r.update_date
......@@ -7175,6 +7186,239 @@
</where>
</select>
<select id="getFEquipInfoList" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
</select>
<select id="getEquipIndexList" resultType="java.util.Map">
SELECT
equipment_specific_id AS equipmentSpecificId,
concat(update_date, '') AS updateDate,
equipment_index_key AS equipmentIndexKey
FROM
(
SELECT
equipment_specific_id,
update_date,
equipment_index_key,
ROW_NUMBER() OVER ( PARTITION BY equipment_specific_id ORDER BY update_date DESC ) AS rn
FROM
wl_equipment_specific_index
WHERE
equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND `value` = 'true'
AND equipment_specific_id IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
) t
WHERE
t.rn = 1
GROUP BY
equipment_specific_id
ORDER BY
update_date DESC
</select>
<select id="getFEquipInfoListCategory" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds,
a.category
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
AND category IS NOT NULL AND category != ''
ORDER BY
a.create_date DESC
</select>
<select id="getEquipmentRunLogBySysInfo" resultType="Map">
SELECT
d.bizOrgName,
d.fireEquipmentCode,
d.fireEquipmentName,
d.eq_point_name,
d.e_value,
d.eq_point_unit,
d.source_name,
d.create_date
FROM
(
SELECT
spe.biz_org_name AS bizOrgName,
spe.biz_org_code AS bizOrgCode,
s.`system_type_code` AS systemTypeCode,
det.`name` as fireEquipmentName,
spe.`code` as fireEquipmentCode,
ein.name as eq_point_name,
CASE ind.value WHEN 'true' THEN '是'
WHEN 'false' THEN '否'
ELSE FORMAT(IFNULL(ind.value, 0), 2) END 'e_value',
ein.unit as eq_point_unit,
CONCAT(IFNULL(str.full_name,''),' ',IFNULL(sto.description,'')) as source_name,
DATE_FORMAT(ind.update_date, '%Y-%m-%d %H:%i:%S') as create_date
FROM
wl_equipment_specific_index as ind
left join wl_equipment_specific as spe on spe.id = ind.equipment_specific_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id, spe.system_id) > 0
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment_index as ein on ind.equipment_index_id = ein.id
left join wl_stock_detail as sto on sto.equipment_specific_id = spe.id
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
WHERE det.`name` IS NOT NULL AND ind.`value` IS NOT NULL AND ind.`value` != '' AND ein.is_iot = 1
) d
<where>
<if test="fireEquipmentName!=null">
d.fireEquipmentName LIKE '%${fireEquipmentName}%'
</if>
<if test="startTime != null and startTime != ''">
AND d.create_date &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND d.create_date &lt;= #{endTime}
</if>
<if test="systemCode != null and systemCode != ''">
AND d.systemTypeCode = #{systemCode}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND d.bizOrgCode like concat(#{bizOrgCode}, '%')
</if>
</where>
ORDER BY d.create_date desc
</select>
<select id="getFireEquipStatistic" resultType="Map">
SELECT
a.`name` AS `name`,
wes.equipment_code AS `code`,
COUNT(1) AS `value`,
IFNULL(wu.`name`, '') AS unit,
IFNULL(IF(a.shbz_img IS NOT NULL, a.shbz_img, a.img), '') AS icon
FROM
wl_equipment_specific wes
LEFT JOIN (SELECT
id,
`code`,
`name`,
img,
shbz_img,
unit_id
FROM
wl_equipment
<where>
<if test="collect != null and collect.size > 0">
code IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
) a ON a.`code` = wes.equipment_code
LEFT JOIN wl_unit wu ON wu.id = a.unit_id
WHERE
a.`name` IS NOT NULL AND wes.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
GROUP BY
wes.equipment_code
UNION ALL
SELECT
'其他' AS `name`,
'' AS `code`,
COUNT( 1 ) AS `value`,
'' AS unit,
'' AS icon
FROM
wl_equipment_specific wes
LEFT JOIN (
SELECT
id,
`code`,
`name`,
img,
shbz_img,
unit_id
FROM
wl_equipment
<where>
<if test="collect != null and collect.size > 0">
code NOT IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
) a ON a.`code` = wes.equipment_code
WHERE
a.`name` IS NOT NULL AND wes.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</select>
<select id="getFireEquipConfigInfo" resultMap="EquipCountBySystemId">
SELECT
wle.id equipment_id,
wle.code equipment_code,
wle.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.shbz_img img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
<where>
spe.system_id IS NOT NULL AND wle.code in
<foreach collection="codes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
AND spe.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
group by wle.id
</select>
<select id="getCenterEquipState" resultType="Map">
SELECT
SUM(
......
......@@ -9,7 +9,7 @@
<artifactId>amos-boot-system-jcs</artifactId>
<version>3.7.2.0</version>
<version>3.7.2.3</version>
<dependencies>
<dependency>
......
......@@ -8,7 +8,7 @@
</parent>
<artifactId>amos-boot-system-patrol</artifactId>
<version>3.7.2.0</version>
<version>3.7.2.3</version>
<dependencies>
<dependency>
......
......@@ -8,7 +8,7 @@
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-utils-message</artifactId>
<version>3.7.2.3</version>
<properties>
<tyboot.version>1.1.25-DL-SNAPSHOT</tyboot.version>
</properties>
......@@ -52,6 +52,17 @@
</exclusion>
</exclusions>
</dependency>
<!-- 读取excel文件 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies>
<build>
......
......@@ -5,20 +5,31 @@ import com.yeejoin.amos.message.utils.ClassToJsonUtil;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.io.Resource;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import static com.yeejoin.amos.message.kafka.Constant.*;
/**
* kafka 消费服务
......@@ -28,7 +39,7 @@ import static com.yeejoin.amos.message.kafka.Constant.*;
**/
@Slf4j
@Service
public class KafkaConsumerService {
public class KafkaConsumerService implements ApplicationRunner {
private static final String MQTT_TOPIC = "romaSite/data/transmit";
private static final String PROVINCE_MQTT_TOPIC = "province/data/transport";
......@@ -40,67 +51,20 @@ public class KafkaConsumerService {
@Value("classpath:/json/commonMessage.json")
private Resource commonMessage;
// /**
// * 批量消费kafka消息
// * Kafka消息转emq
// *
// * @param consumerRecords messages
// * @param ack ack
// */
// @KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}")
// public void listen1(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) {
// try {
// for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
// Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value());
// if (kafkaMessage.isPresent()) {
// JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get());
// if (messageObj.has(TOPIC)) {
// emqKeeper.getMqttClient().publish(messageObj.optString(TOPIC), messageObj.getJSONObject(DATA).toString()
// .getBytes(StandardCharsets.UTF_8), 0, false);
// }
// log.info("kafka消费zhTestGroup消息{}", messageObj);
// }
// }
// } catch (Exception e) {
// log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e);
// } finally {
// ack.acknowledge();
// }
// }
/**
* execl文件路径,读取excel
*/
// @Value("${filter.excel.path:F:\\filterExcel11.xlsx}")
@Value("${filter.excel.path:}")
private String filePath;
/**
* 批量消费kafka消息
* 监听数据表变化kafka数据转发emq
*
* @param consumerRecords messages
* @param ack ack
* 服务启动时,内存存储execl文档中需要的编码信息
*/
// @KafkaListener(id = "provinceMessage", groupId = "province", topics = "#{'${kafka.topics}'.split(',')}")
// public void listen(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) {
// try {
// if (isZxj) {
// for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
// Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value());
// if (kafkaMessage.isPresent()) {
// JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get());
// String type = messageObj.optString(TYPE);
// String table = messageObj.optString(TABLE);
// if (Arrays.asList(INSERT, UPDATE).contains(type) && DBTableTypeEnum.have(table) != null) {
// JSONObject data = (JSONObject) messageObj.getJSONArray(DATA).get(0);
// data.put(DB_TYPE, type);
// data.put(TABLE, table);
// emqKeeper.getMqttClient().publish(PROVINCE_MQTT_TOPIC, data.toString().getBytes(StandardCharsets.UTF_8), 0, false);
// log.info("kafka消费province消息{}", messageObj);
// }
// }
// }
// }
// } catch (Exception e) {
// log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e);
// } finally {
// ack.acknowledge();
// }
// }
private List<String> codeListInfo;
private static final String topic1 = "romaSite/data/transmit";
private static final String topic2 = "romaSite/data/eventAlarm";
/**
* 转发苏州,绍兴换流站Kafka数据对emq
......@@ -112,18 +76,14 @@ public class KafkaConsumerService {
public void kafkaListener(ConsumerRecord<?, String> record, Acknowledgment ack) {
try {
Optional<?> messages = Optional.ofNullable(record.value());
log.info("kafka上报数据:{}", record.toString());
if (messages.isPresent()) {
// JSONObject messageObj = JSONObject.fromObject(record.value());
// if (messageObj.getJSONObject(BODY).isEmpty()) {
// messageObj.put(DATA_TYPE, STATE);
// }
// JSONObject object = JSONObject.fromObject(record.value());
// String json = ClassToJsonUtil.class2json(object, commonMessage, MQTT_TOPIC);
// emqKeeper.getMqttClient().publish(MQTT_TOPIC, json.getBytes(StandardCharsets.UTF_8), 0, false);
JSONObject object = JSONObject.fromObject(record.value());
com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
if ((StringUtils.isEmpty(filePath)) || (CollectionUtils.isEmpty(codeListInfo)) || (!ObjectUtils.isEmpty(jsonObj) && Boolean.TRUE.equals(isSendEmq(jsonObj)))) {
log.info("kafka上报mqtt数据:{}", JSON.toJSONString(jsonObj));
emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
}
}
} catch (MqttException e) {
log.error("换流站转发Kafka消息失败" + e.getMessage(), e);
......@@ -134,116 +94,6 @@ public class KafkaConsumerService {
}
}
@KafkaListener(id = "kafkaConsumerEventAlarm", groupId = "kafkaConsumerGroupEventAlarm", topics = "#{'${queue.kafka.eventAlarm.topics}'.split(',')}", containerFactory = "kafkaRomaContainerFactory")
public void kafkaConsumerEventAlarm(ConsumerRecord<?, String> record, Acknowledgment ack) {
Optional<?> message = Optional.ofNullable(record.value());
if (message.isPresent()) {
try {
// JSONObject messageObj = JSONObject.fromObject(record.value());
// JSONArray dataArray = messageObj.getJSONArray("data");
// JSONArray jsonArray = new JSONArray();
// String timestamp = "";
// for (Object obj : dataArray) {
// JSONObject finallyObj = new JSONObject();
// com.alibaba.fastjson.JSONObject detail = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(obj));
// finallyObj.put("eventtextL1", detail.get("description"));
// finallyObj.put("pointId", detail.get("astId"));
// finallyObj.put("time", detail.get("dateTime"));
// jsonArray.add(finallyObj);
// timestamp = detail.get("dateTime").toString();
// }
// JSONObject jsonObjectMessage = new JSONObject();
// jsonObjectMessage.put("warns", jsonArray);
// jsonObjectMessage.put("timestamp", timestamp);
// JSONObject object = JSONObject.fromObject(record.value());
// String json = ClassToJsonUtil.class2json(object, commonMessage, MQTT_TOPIC_EVENT_ALARM);
// emqKeeper.getMqttClient().publish(MQTT_TOPIC_EVENT_ALARM, json.getBytes(StandardCharsets.UTF_8), 0, false);
JSONObject object = JSONObject.fromObject(record.value());
com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
ack.acknowledge();
} catch (MqttException e) {
log.error("解析数据失败,{}", e.getMessage());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
//
// /**
// * 韶山换流对接Kafka
// * @param record record
// * @param ack ack
// */
// @KafkaListener(id = "kafkaConsumer", groupId = "kafkaConsumerGroup", topics = "#{'${queue.kafka.shaoshan.topics}'.split(',')}", containerFactory = "kafkaRomaContainerFactory")
// public void kafkaConsumer(ConsumerRecord<?, String> record, Acknowledgment ack) {
// Optional<?> message = Optional.ofNullable(record.value());
// if (message.isPresent()) {
// try {
//// JSONObject messageObj = JSONObject.fromObject(record.value());
//// JSONObject data = messageObj.getJSONObject("body");
//// JSONObject object = JSONObject.fromObject(record.value());
//// String json = ClassToJsonUtil.class2json(object, commonMessage, MQTT_TOPIC_EVENT_ALARM);
//// emqKeeper.getMqttClient().publish(MQTT_TOPIC_EVENT_ALARM, json.getBytes(StandardCharsets.UTF_8), 0, false);
//
// JSONObject object = JSONObject.fromObject(record.value());
// com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
// emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
// ack.acknowledge();
// } catch (MqttException e) {
// log.error("解析数据失败,{}", e.getMessage());
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// }
// }
//
// /**
// * 事件告警对接Kafka
// * @param record record
// * @param ack ack
// * groupId = kafkaConsumerGroup
// * 该消息的消息格式为
// * {"data_class":"realdata","data_type":"alarm","op_type":"subscribe_emergency","condition":{"station_psr_id":"50edcb6c1b8a811030493c80a2014950ed9d4f59e8","station_name":"中州换流站","alarm_type":"yx_bw"},"data":[{"psrId":"D017020000000000000000999","astId":"D017020000000000000000999","equipType":"ASTType_0000111","eventType":"OtherSignal","alarmSource":"OWS","alarmLevel":"3","description":"2024-03-11 09:06:17::585 S2WCL12A E3.C01软水器再生结束信号 出现","dateTime":"2024-03-11 09:06:17.585"}]}
// */
//
// @KafkaListener(id = "kafkaConsumerEventAlarm", groupId = "kafkaConsumerGroupEventAlarm", topics = "#{'${queue.kafka.eventAlarm.topics}'.split(',')}", containerFactory = "kafkaRomaContainerFactory")
// public void kafkaConsumerEventAlarm(ConsumerRecord<?, String> record, Acknowledgment ack) {
// Optional<?> message = Optional.ofNullable(record.value());
// if (message.isPresent()) {
// try {
//// JSONObject messageObj = JSONObject.fromObject(record.value());
//// JSONArray dataArray = messageObj.getJSONArray("data");
//// JSONArray jsonArray = new JSONArray();
//// String timestamp = "";
//// for (Object obj : dataArray) {
//// JSONObject finallyObj = new JSONObject();
//// com.alibaba.fastjson.JSONObject detail = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(obj));
//// finallyObj.put("eventtextL1", detail.get("description"));
//// finallyObj.put("pointId", detail.get("astId"));
//// finallyObj.put("time", detail.get("dateTime"));
//// jsonArray.add(finallyObj);
//// timestamp = detail.get("dateTime").toString();
//// }
//// JSONObject jsonObjectMessage = new JSONObject();
//// jsonObjectMessage.put("warns", jsonArray);
//// jsonObjectMessage.put("timestamp", timestamp);
//
// JSONObject object = JSONObject.fromObject(record.value());
// com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
// emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
// ack.acknowledge();
// } catch (MqttException e) {
// log.error("解析数据失败,{}", e.getMessage());
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// }
// }
/**
* 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
*
......@@ -267,85 +117,75 @@ public class KafkaConsumerService {
}
}
@Override
public void run(ApplicationArguments args) {
codeListInfo = readExcelFile(filePath);
log.info("excel文件数据:{}", JSON.toJSONString(codeListInfo));
}
///**
// * 省级消息转发
// *
// * @param message 省级消息
// * @param ack ack
// */
//@KafkaListener(id = "provinceMessage", groupId = "province", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2")
//public void consumerSingle1(String message, Acknowledgment ack) {
// log.info("省级消息转发打印" + message);
// if(isZxj) {
// Optional<?> messages = Optional.ofNullable(message);
// if (messages.isPresent()) {
// try {
// JSONObject jsonObject = JSONObject.fromObject(message);
// String type = jsonObject.optString("type");
// String table = jsonObject.optString("table");
// if (Arrays.asList(Constant.INSERT, Constant.UPDATE).contains(type) && DBTableTypeEnum.have(table) != null) {
// if (Arrays.asList("INSERT", "UPDATE").contains(type)) {
// JSONArray array = jsonObject.getJSONArray("data");
// JSONObject data = (JSONObject)array.get(0);
// data.put("dbType", type);
// data.put("table", table);
// emqKeeper.getMqttClient().publish(PROVINCE_MQTT_TOPIC, data.toString().getBytes(StandardCharsets.UTF_8), 0, false);
// log.info("省级消息: {}", data);
// }
// }
// } catch (MqttException e) {
// log.error("消息转发失败" + e.getMessage(), e);
// }
// ack.acknowledge();
// }
// }
//}
/**
* 判断是否发送emq消息
* @return true 发送 false 不发送
*/
private Boolean isSendEmq(com.alibaba.fastjson.JSONObject res) {
String key = "";
if (!StringUtils.isEmpty(res.get("mqTopic")) && topic1.equals(res.get("mqTopic").toString())) {
key = res.getJSONObject("data").get("key").toString();
} else if (!StringUtils.isEmpty(res.get("mqTopic")) && topic2.equals(res.get("mqTopic").toString())) {
key = res.getJSONObject("data").getJSONArray("warns").getJSONObject(0).get("pointId").toString();
}
return !StringUtils.isEmpty(key) && codeListInfo.contains(key);
}
public static List<String> readExcelFile(String filePath) {
try (FileInputStream fis = new FileInputStream(new File(filePath));
Workbook workbook = new XSSFWorkbook(fis)) {
Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
List<String> list = getColumnData(sheet);
// 在这里处理list中的数据,例如打印、存储等操作
return list;
} catch (IOException e) {
e.printStackTrace();
}
return new ArrayList<>();
}
/* @KafkaListener(id = "consumerBatch", topicPartitions = {
@TopicPartition(topic = "hello-batch1", partitions = "0"),
@TopicPartition(topic = "hello-batch2", partitionOffsets = @PartitionOffset(partition = "2", initialOffset = "4"))
})*/
// /**
// * 批量消费消息
// * @param messages
// */
// @KafkaListener(id = "consumerBatch", topics = "test-batch")
// public void consumerBatch(List<ConsumerRecord<String, String>> messages) {
// log.info("consumerBatch =====> messageSize: {}", messages.size());
// log.info(messages.toString());
// }
private static List<String> getColumnData(Sheet sheet) {
List<String> list = new ArrayList<>();
Iterator<Row> rowIterator = sheet.iterator();
rowIterator.next(); // 跳过表头行
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
Cell cell = row.getCell(0);
if (cell != null) {
String cellValue = getCellValueAsString(cell);
list.add(cellValue);
}
}
return list;
}
// /**
// * 指定消费异常处理器
// * @param message
// */
// @KafkaListener(id = "consumerException", topics = "kafka-test-topic", errorHandler = "consumerAwareListenerErrorHandler")
// public void consumerException(String message) {
// throw new RuntimeException("consumer exception");
// }
//
// /**
// * 验证ConsumerInterceptor
// * @param message
// */
// @KafkaListener(id = "interceptor", topics = "consumer-interceptor")
// public void consumerInterceptor(String message) {
// log.info("consumerInterceptor ====> message: {}", message);
// }
//
//
//
//kafka的监听器,topic为"zhTest",消费者组为"zhTestGroup"
//@KafkaListener(topics = "test", groupId = "zhTestGroup")
//public void listenZhugeGroup(ConsumerRecord<String, String> record, Acknowledgment ack) {
// String value = record.value();
// System.out.println(value);
// System.out.println(record);
// //手动提交offset
// ack.acknowledge();
//}
private static String getCellValueAsString(Cell cell) {
if (cell == null) {
return "";
}
switch (cell.getCellType()) {
case STRING:
return cell.getStringCellValue();
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue().toString();
} else {
return Double.toString(cell.getNumericCellValue());
}
case BOOLEAN:
return Boolean.toString(cell.getBooleanCellValue());
case FORMULA:
return cell.getCellFormula();
default:
return "";
}
}
}
......@@ -109,10 +109,13 @@ system.zxj=false
##\u9700\u8981\u76D1\u542C\u5F97eqm\u6D88\u606F\u4E3B\u9898 \u6839\u636E\u662F\u5426\u662F\u4E2D\u5FC3\u6781\u548C\u7AD9\u7AEF\u9009\u62E9\u9700\u8981\u76D1\u542C\u5F97\u4E3B\u9898\u8FDB\u884C\u914D\u7F6E emq.iot.created,
#emq.topic=ccs-user-login-info,sync.execute,data/mcb/warning,emq.risk.qrcode.put,emq.risk.qrcode.clean
queue.kafka.topics=null
kafka.auto-startup=false
# 现场kafka消息 topic 遥测遥信告警都 配在这个配置中(英文逗号隔开即可)
# 原告警topic配置删除queue.kafka.eventAlarm.topics
queue.kafka.topics=T_DC_MQ_REALDATA,T_DC_MQ_STATUS
#浜嬩欢鍛婅瀵规帴Kafka涓婚
queue.kafka.eventAlarm.topics=JKXT2BP-GJ-Topic-site
kafka.auto-startup=false
kafka.station.groupId=shaoxing
#F:\\filterExcel11.xlsx 读取excel文件过滤kafka消息 如不需要将该配置置空,或者不添加该配置即可
filter.excel.path=F:\\filterExcel.xlsx
\ No newline at end of file
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