Commit 91cb2a0f authored by 李秀明's avatar 李秀明

Merge branch 'refs/heads/develop_dl' into develop_dl_4.0

# Conflicts: # amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/controller/DataDictionaryController.java # 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-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/fegin/JcsFeign.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.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/FireFightingSystemGroupServiceImpl.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-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
parents e57b16a9 e7552b13
......@@ -243,6 +243,19 @@ public class DataDictionaryController extends BaseController {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/dataDictionaryIdFillMenuHasSort", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典,id为SequenceNbr", notes = "根据字典类型查询字典,id为SequenceNbr")
public ResponseModel<Object> getDictionaryWithTreeFillIdHasSort(@RequestParam String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getSortTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName",
"getParent", "getSortNum", null,"getCode");
return ResponseHelper.buildResponse(menus);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
......@@ -468,6 +481,46 @@ public class DataDictionaryController extends BaseController {
* @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);
}
/**
* 新增数据字典 - 存储默认展示视频
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/saveDefaultVideo", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "存储默认展示视频", notes = "存储默认展示视频")
public boolean saveDefaultVideo(@RequestBody Map<String, Object> map) {
......
......@@ -17,6 +17,7 @@ public class Menu {
public Boolean isRoot;
public List<Menu> children;
public String treeCode;
public Integer sortNum;
public int num;
public int getNum() {
return num;
......@@ -24,6 +25,13 @@ public class Menu {
public void setNum(int num) {
this.num = num;
}
public Integer getSortNum() {
return sortNum;
}
public void setSortNum(Integer sortNum) {
this.sortNum = sortNum;
}
public Menu(Long id, String name, Long parentId2,int num) {
super();
this.id = id;
......@@ -31,6 +39,16 @@ public class Menu {
this.parentId = parentId2;
this.num = num;
}
public Menu(Long id, String name, Long parentId2,int num, Integer sortNum) {
super();
this.id = id;
this.name = name;
this.parentId = parentId2;
this.num = num;
this.sortNum = sortNum;
}
public Menu(Long id, String name, Long parentId2,int num,String treeCode) {
super();
this.id = id;
......@@ -39,6 +57,16 @@ public class Menu {
this.num = num;
this.treeCode = treeCode;
}
public Menu(Long id, String name, Long parentId2,int num,String treeCode, Integer sortNum) {
super();
this.id = id;
this.name = name;
this.parentId = parentId2;
this.num = num;
this.treeCode = treeCode;
this.sortNum = sortNum;
}
public Menu(Long id, String name, Long parentId, List<Menu> children,int num) {
super();
this.id = id;
......@@ -56,7 +84,6 @@ public class Menu {
this.children = children;
this.num = num;
}
public Long getId() {
return id;
}
......
......@@ -104,6 +104,75 @@ public class TreeParser {
return resultList;
}
@SuppressWarnings("unchecked")
public static List<Menu> getSortTree(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String SORTMethodName, List<FirefightersTreeDto> list, String treeCode) throws Exception {
List<Menu> resultList = new ArrayList<>();
@SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL);
Method IDMethodNameme = null;
switch (IDHierarchy) {
case 1:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
case 2:
IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName);
break;
case 3:
IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName);
break;
default:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
}
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method SORTMethodNamee = clazz.getDeclaredMethod(SORTMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method treeCodeName =null;
if(treeCode!=null){
treeCodeName = clazz.getDeclaredMethod(treeCode);
}
//获取顶层元素集合
Long parentId;
for (Object ob : entityList) {
Object entity = clazz.cast(ob);
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null || parentId.equals(topId) ) {//陈浩2021-12-01修改 topId == parentId 的判断
String codeString = String.valueOf(IDMethodNameme.invoke(entity));
Integer num = 0;
if (list != null && list.size() > 0) {
for (FirefightersTreeDto map : list) {
if (null != map.getJobTitleCode() && map.getJobTitleCode().equals(codeString)) {
num = Integer.valueOf((String) map.getNum());
break;
}
}
;
}
Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat, Integer.valueOf(String.valueOf(SORTMethodNamee.invoke(entity))));
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num, Integer.valueOf(String.valueOf(SORTMethodNamee.invoke(entity))));
}
resultList.add(menu);
}
}
//获取每个顶层元素的子数据集合
for (Menu entity : resultList) {
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list,treeCode));
}
return resultList;
}
public static List<Menu> getTreeTeam(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list,String treeCode) throws Exception {
List<Menu> resultList = new ArrayList<>();
@SuppressWarnings("rawtypes")
......
......@@ -15,11 +15,11 @@
<artifactId>amos-boot-module-jcs-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-tzs-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-tzs-api</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>-->
<!-- spring-cloud网关-->
<dependency>
<groupId>org.springframework.cloud</groupId>
......
......@@ -94,6 +94,8 @@ public class OrgUsrFormDto implements Serializable {
private String dwfz;
@ApiModelProperty(value = "消防安全负责人")
private String xfaq;
@ApiModelProperty(value = "换流站类型")
private String stationType;
@ApiModelProperty(value = "公司消防信息")
@TableField(exist = false)
......
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("bizOrgCode") String bizOrgCode, @Param("stationType") String stationType);
Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectStationInfoList();
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.StationInfoMapper">
<select id="count" resultType="long">
SELECT
COUNT(1)
FROM idx_biz_station_info t
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="stationType != null and stationType != ''">
AND t.STATION_TYPE = #{stationType}
</if>
</where>
</select>
<select id="selectStationInfo" resultType="java.util.Map">
SELECT
*
FROM
idx_biz_station_info t
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE = #{bizOrgCode}
</if>
</where>
LIMIT 1
</select>
<select id="selectStationInfoList" resultType="java.util.Map">
SELECT
*
FROM
idx_biz_station_info
</select>
</mapper>
......@@ -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;
}
}
......@@ -152,6 +152,7 @@ public class UnitTransformUtil {
map.put("unit", "M");
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)) {
......
......@@ -19,15 +19,15 @@
<module>amos-boot-module-common-api</module>
<module>amos-boot-module-command-api</module>
<module>amos-boot-module-patrol-api</module>
<module>amos-boot-module-fas-api</module>
<module>amos-boot-module-maintenance-api</module>
<module>amos-boot-module-supervision-api</module>
<!-- <module>amos-boot-module-fas-api</module>-->
<!-- <module>amos-boot-module-maintenance-api</module>-->
<!-- <module>amos-boot-module-supervision-api</module>-->
<module>amos-boot-module-knowledgebase-api</module>
<module>amos-boot-module-equip-api</module>
<module>amos-boot-module-latentdanger-api</module>
<module>amos-boot-module-ccs-api</module>
<module>amos-boot-module-avic-api</module>
<module>amos-boot-module-precontrol-api</module>
<module>amos-boot-module-kgd-api</module>
<!-- <module>amos-boot-module-latentdanger-api</module>-->
<!-- <module>amos-boot-module-ccs-api</module>-->
<!-- <module>amos-boot-module-avic-api</module>-->
<!-- <module>amos-boot-module-precontrol-api</module>-->
<!-- <module>amos-boot-module-kgd-api</module>-->
</modules>
</project>
\ No newline at end of file
......@@ -1067,6 +1067,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();
......
......@@ -28,10 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.AmosTrainingFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.IdxFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersJacketMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.*;
import com.yeejoin.amos.boot.module.common.api.service.IDataSyncService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
......@@ -126,6 +123,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
private StationInfoMapper stationInfoMapper;
@Value("${jcs.company.topic.delete:jcs/company/topic/delete}")
private String airportDeleteTopic;
......@@ -1394,12 +1394,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<String, String> Xfgl = null;
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);
}
}
orgUsrFormVo.setXfaq(Xfaq != null ? Xfaq.get("uname") : "");
orgUsrFormVo.setXfgl(Xfgl != null ? Xfgl.get("uname") : "");
orgUsrFormVo.setDwfz(Dwfz != null ? Dwfz.get("uname") : "");
......@@ -1408,6 +1410,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
CompanyInfo info = fireCompanyInfoServiceImpl.getOne(new QueryWrapper<CompanyInfo>().eq("instance_id", id).eq("is_delete", 0));
orgUsrFormVo.setCompanyInfo(info);
// 获取换流站类型
Map<String, String> stationInfo = stationInfoMapper.selectStationInfo(orgUsr.getBizOrgCode());
if (Objects.nonNull(stationInfo)) {
orgUsrFormVo.setStationType(stationInfo.getOrDefault("station_type", ""));
}
return orgUsrFormVo;
}
......
......@@ -15,6 +15,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;
......@@ -198,4 +199,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));
}
}
......@@ -749,7 +749,8 @@ public class EmergencyController extends AbstractBaseController {
@RequestParam(required = false) String systemCode,
@RequestParam(required = false) String createDate,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate
@RequestParam(required = false) String endDate,
@RequestParam(required = false) String sorter
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (StringUtils.isEmpty(bizOrgCode)) {
......@@ -762,7 +763,13 @@ public class EmergencyController extends AbstractBaseController {
}
}
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate));
String sortField = "", sortOrder = "";
if (org.springframework.util.StringUtils.hasText(sorter)) {
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));
}
@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,57 @@ 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,
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 = "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 = "/getEquipCountPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防器材查询设备数量列表")
public Page<EquipCountBySystemVO> getEquipCountPage(
@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) {
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.getEquipCountPage(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 +973,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,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Slf4j
......@@ -74,4 +76,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<LinkedHashMap<String, Object>> fireEquipStats = iFireResourceSupervisionService.getFireEquipStatistic(type, bizOrgCode);
return ResponseHelper.buildResponse(fireEquipStats);
}
}
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.IEmergencyService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......
......@@ -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.enums.UnitEnum;
import com.yeejoin.equipmanage.common.utils.*;
......@@ -73,6 +74,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Autowired
private FormInstanceEquipMapper formInstanceEquipMapper;
@Autowired
private IEquipmentSpecificSerivce equipmentSpecificService;
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -287,7 +291,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 {
......@@ -865,4 +869,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")
......
......@@ -206,6 +206,9 @@ public interface JcsFeign {
@GetMapping(value = "/org-usr/getCompany")
FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode);
@GetMapping(value = "/data-dictionary/dataDictionaryIdFillMenu")
@GetMapping(value = "/data-dictionary/dataDictionaryIdFillMenuHasSort")
FeignClientResult<List<DataDictionary>> dataDictionaryIdFillMenu(@RequestParam(value = "type") String type);
@GetMapping(value = "/data-dictionary/getDictListByType")
FeignClientResult<List<DataDictionary>> getDictListByType(@RequestParam(value = "type") String type);
}
......@@ -116,7 +116,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);
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;
......@@ -117,4 +119,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,6 +206,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
/**
* 根据库存id删除装备相关库存数据
*
* @param stockDetailId 库存明细id
* @param specificId specificId
*/
......@@ -209,24 +214,28 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
/**
* 获取雨淋阀室指标详情
*
* @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,7 +251,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Equipment getEquipmentBySpecificId(@Param("specificId") Long specificId);
/**
*
* @param floorId 建筑id
* @param isIot 是否物联设备
* @return
......@@ -249,14 +258,16 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
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>> getFirePumpInfoCSZZ(@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>> 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);
......@@ -265,7 +276,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();
......@@ -281,11 +292,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);
......@@ -299,11 +310,11 @@ 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);
......@@ -319,7 +330,7 @@ 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);
......@@ -347,4 +358,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);
}
......@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -51,9 +52,11 @@ 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);
Page<EquipCountBySystemVO> getEquipCountPage(@Param("page") Page<Object> page, @Param("systemId") Long systemId, @Param("bizOrgCode") String bizOrgCode);
/**
* 保存
......@@ -736,10 +739,19 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFireCannonInfo(@Param("bizOrgCode") String bizOrgCode, @Param("list") String[] strings);
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect);
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<LinkedHashMap<String, Object>> getFireEquipStatistic(@Param("collect") List<String> collect, @Param("bizOrgCode")String bizOrgCode);
List<LinkedHashMap<String, Object>> getOtherFireEquipStatistic(@Param("collect") List<String> collect, @Param("bizOrgCode")String bizOrgCode);
List<EquipCountBySystemVO> getFireEquipConfigInfo(@Param("codes") List<String> codes, @Param("bizOrgCode")String bizOrgCode);
}
......@@ -73,7 +73,9 @@ public interface IEmergencyService {
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String bizOrgCode);
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);
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);
Map<String, List<PressurePumpCountVo>> getPressurePumpDay();
......
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;
......@@ -331,4 +332,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;
}
......@@ -57,7 +57,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @param systemId
* @return
*/
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId, String bizOrgCode);
/**
* 根据系统id查询分组设备数量
......@@ -65,7 +65,15 @@ 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);
/**
* 消防器材查询设备数量列表
*
* @param systemId
* @return
*/
Page<EquipCountBySystemVO> getEquipCountPage(Long systemId, Integer pageNumber, Integer pageSize, String bizOrgCode);
/**
* 保存
......@@ -128,7 +136,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);
......@@ -311,6 +319,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,4 +369,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getFEquipInfoList(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode);
List<EquipCountBySystemVO> getFireEquipConfigInfo(String bizOrgCode);
}
......@@ -2,6 +2,10 @@ package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 消防资源监管
*/
......@@ -25,4 +29,6 @@ public interface IFireResourceSupervisionService {
FireResourceStatsDTO getFireCarStats(String bizOrgCode);
FireResourceStatsDTO getFireEquipStats(String bizOrgCode);
List<LinkedHashMap<String, Object>> getFireEquipStatistic(String type, String bizOrgCode);
}
......@@ -664,8 +664,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) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate);
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -27,11 +28,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;
......@@ -60,12 +63,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;
/**
......@@ -374,6 +383,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();
stockBill.setCreatorId(Long.valueOf(agencyUserModel.getUserId()));
......@@ -2260,4 +2272,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);
}
}
......@@ -27,6 +27,7 @@ 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
......@@ -235,12 +236,12 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
}
}
// 查询装备定义的图片 List to Map -> key: systemId@equipmentId, value: 装备定义数量Map
// 查询装备定义的图片 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(Equipment::getId, equipmentIds)
.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()));
......@@ -256,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();
......@@ -309,6 +312,13 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
}
}
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);
......
......@@ -202,15 +202,19 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
private DataDictionaryServiceImpl dataDictionaryService;
@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);
}
@Override
public Page<EquipCountBySystemVO> getEquipCountPage(Long systemId, Integer pageNumber, Integer pageSize, String bizOrgCode) {
return this.baseMapper.getEquipCountPage(new Page(pageNumber, pageSize), systemId, bizOrgCode);
}
@Override
public List<EquiplistSpecificBySystemVO>
......@@ -1227,13 +1231,14 @@ 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<EquipmentSpecificAlarm> equipSpecIds = equipmentSpecificAlarmMapper.selectList(
......@@ -1241,6 +1246,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
.select(EquipmentSpecificAlarm::getEquipmentSpecificId)
.like(EquipmentSpecificAlarm::getSystemIds, id)
.eq(EquipmentSpecificAlarm::getStatus, "1")
.likeRight(StringUtils.hasText(bizOrgCode), EquipmentSpecificAlarm::getBizOrgCode, bizOrgCode)
);
int count = (int) equipSpecIds.stream().map(EquipmentSpecificAlarm::getEquipmentSpecificId).distinct().count();
list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false));
......@@ -2852,6 +2858,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(),
......@@ -2891,6 +2902,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return Optional.ofNullable(list).orElse(org.apache.commons.compress.utils.Lists.newArrayList());
}
@Override
public List<Map<String, Object>> getFEquipInfoList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoList(bizOrgCode);
......@@ -2939,7 +2951,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return CollUtil.isNotEmpty(resultList) ? resultList : closeList;
}
@Override
public List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode) {
List<DataDictionary> zdsbfl = jcsFeignClient.dataDictionaryIdFillMenu("ZDSBFL").getResult();
......@@ -2950,9 +2961,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
if (CollUtil.isEmpty(collect)) {
return Collections.emptyList();
}
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<>();
......@@ -2969,10 +2977,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN);
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.NORM_DATETIME_PATTERN);
} else {
int comparisonResult = DateUtil.compare(updateDate, DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN));
updateDate = comparisonResult < 0 ? DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN) : updateDate;
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;
}
}
}
......@@ -3000,4 +3008,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
});
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 liquibase.pro.packaged.X;
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.List;
import java.util.Map;
import java.util.*;
@Slf4j
@Service
......@@ -19,6 +24,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
JcsFeign jcsFeignClient;
/**
* 消防系统信息
*
......@@ -64,6 +72,38 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
return buildFireResourceStatsDTO(resultMap);
}
@Override
public List<LinkedHashMap<String, Object>> getFireEquipStatistic(String type, String bizOrgCode) {
List<DataDictionary> dictionaryList = jcsFeignClient.dataDictionaryIdFillMenu(StringUtil.isNotEmpty(type) ? type : "ZYGL_XFQC").getResult();
List<String> list = new ArrayList<>();
Map<Integer, String> sortMap = new TreeMap<>(new Comparator<Integer>(){
@Override
public int compare(Integer o1, Integer o2) {
return o1-o2; //按照key顺序排列,o2-o1是逆序, o1-o2是正序
}
});
if (!CollectionUtils.isEmpty(dictionaryList)) {
dictionaryList.forEach(x -> {
list.add(x.getTreeCode());
sortMap.put(x.getSortNum(), x.getTreeCode());
});
}
List<LinkedHashMap<String, Object>> resultMap = fireFightingSystemMapper.getFireEquipStatistic(list, bizOrgCode);
List<LinkedHashMap<String, Object>> resp = new ArrayList<>();
if (!sortMap.isEmpty()) {
sortMap.entrySet().forEach(x -> {
resultMap.forEach(y -> {
if (x.getValue().equalsIgnoreCase(String.valueOf(y.get("code")))) {
resp.add(y);
}
});
});
}
List<LinkedHashMap<String, Object>> otherMapData = fireFightingSystemMapper.getOtherFireEquipStatistic(list, bizOrgCode);
resp.addAll(otherMapData);
return resp;
}
private FireResourceStatsDTO buildFireResourceStatsDTO(Map<String, Object> resultMap) {
FireResourceStatsDTO fireResourceStats = new FireResourceStatsDTO();
fireResourceStats.setTotalCounts(Long.parseLong(resultMap.get("totalCount").toString()));
......
......@@ -788,6 +788,7 @@ 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();
......@@ -2535,6 +2536,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
log.error("错误的物联编码是:", topicEntity.getIotCode());
throw new BadRequest("装备物联编码错误,请确认!");
}
switch (valueEnum) {
......
......@@ -53,14 +53,14 @@
<module>amos-boot-module-command-biz</module>
<module>amos-boot-module-knowledgebase-biz</module>
<module>amos-boot-module-patrol-biz</module>
<module>amos-boot-module-fas-biz</module>
<module>amos-boot-module-maintenance-biz</module>
<module>amos-boot-module-supervision-biz</module>
<module>amos-boot-module-latentdanger-biz</module>
<!-- <module>amos-boot-module-fas-biz</module>-->
<!-- <module>amos-boot-module-maintenance-biz</module>-->
<!-- <module>amos-boot-module-supervision-biz</module>-->
<!-- <module>amos-boot-module-latentdanger-biz</module>-->
<module>amos-boot-module-equip-biz</module>
<module>amos-boot-module-ccs-biz</module>
<module>amos-boot-module-avic-biz</module>
<module>amos-boot-module-precontrol-biz</module>
<module>amos-boot-module-kgd-biz</module>
<!-- <module>amos-boot-module-ccs-biz</module>-->
<!-- <module>amos-boot-module-avic-biz</module>-->
<!-- <module>amos-boot-module-precontrol-biz</module>-->
<!-- <module>amos-boot-module-kgd-biz</module>-->
</modules>
</project>
\ No newline at end of file
......@@ -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>
......
......@@ -1735,7 +1735,29 @@
</if>
</where>
ORDER BY
<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'">
wlesal.clean_time ASC
</when>
<otherwise>
wlesal.clean_time DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
wlesal.create_date DESC
</if>
</select>
<select id="alarmListNoPage" resultType="java.util.Map">
......
......@@ -596,4 +596,35 @@
</if>
</where>
</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
......@@ -3033,4 +3053,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,32 +104,72 @@
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 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 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>
<select id="getEquipCountPage" 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 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
<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
f_fire_fighting_system
......@@ -6681,7 +6722,7 @@
<select id="getEquipIndexList" resultType="java.util.Map">
SELECT
equipment_specific_id AS equipmentSpecificId,
update_date AS updateDate,
concat(update_date, '') AS updateDate,
equipment_index_key AS equipmentIndexKey
FROM
(
......@@ -6734,4 +6775,158 @@
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="java.util.LinkedHashMap">
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
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
GROUP BY
wes.equipment_code
</select>
<select id="getOtherFireEquipStatistic" resultType="java.util.LinkedHashMap">
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
<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>
wle.code in
<foreach collection="codes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
group by wle.id
</select>
</mapper>
......@@ -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.23-SNAPSHOT</tyboot.version>
</properties>
......
......@@ -333,23 +333,23 @@
<modules>
<module>amos-boot-module</module>
<module>amos-boot-biz-common</module>
<module>amos-boot-system-tzs</module>
<!-- <module>amos-boot-system-tzs</module>-->
<module>amos-boot-system-jcs</module>
<module>amos-boot-system-knowledgebase</module>
<module>amos-boot-system-fas</module>
<!-- <module>amos-boot-system-fas</module>-->
<module>amos-boot-system-patrol</module>
<module>amos-boot-system-maintenance</module>
<module>amos-boot-system-supervision</module>
<!-- <module>amos-boot-system-maintenance</module>-->
<!-- <module>amos-boot-system-supervision</module>-->
<module>amos-boot-system-equip</module>
<module>amos-boot-core</module>
<!-- <module>amos-boot-core</module>-->
<module>amos-boot-utils</module>
<module>amos-boot-system-latentdanger</module>
<module>amos-boot-system-ccs</module>
<module>amos-boot-data</module>
<module>amos-boot-system-precontrol</module>
<module>amos-boot-system-cas</module>
<module>amos-boot-system-tdc</module>
<module>amos-boot-system-kgd</module>
<!-- <module>amos-boot-system-latentdanger</module>-->
<!-- <module>amos-boot-system-ccs</module>-->
<!-- <module>amos-boot-data</module>-->
<!-- <module>amos-boot-system-precontrol</module>-->
<!-- <module>amos-boot-system-cas</module>-->
<!-- <module>amos-boot-system-tdc</module>-->
<!-- <module>amos-boot-system-kgd</module>-->
</modules>
<build>
......
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