Commit 6afe3aa7 authored by 张森's avatar 张森

30545 换流变事故排油相关接口手动合并到dl分支

parent 237ca311
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: AlarmStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/31 19:33
*/
@RestController
@Api(tags = "关键数据相关API")
@RequestMapping(value = "/keyWordsInfo", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class KeyWordsInfoController extends AbstractBaseController {
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "查询已绑定排油阀的换流变信息", notes = "查询已绑定排油阀的换流变信息")
@RequestMapping(value = "/getFEquipInfoList", method = RequestMethod.GET)
public ResponseModel getFEquipInfoList(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> resultList = iFireFightingSystemService.getFEquipInfoList(bizOrgCode);
return CommonResponseUtil.success(resultList);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "查询已绑定排油阀的换流变信息 - 根据分类分组", notes = "查询已绑定排油阀的换流变信息 - 根据分类分组")
@RequestMapping(value = "/getFEquipInfoListCategory", method = RequestMethod.GET)
public ResponseModel getFEquipInfoListCategory(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> resultList = iFireFightingSystemService.getFEquipInfoListCategory(bizOrgCode);
return CommonResponseUtil.success(resultList);
}
}
...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.fegin; ...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.fegin;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.equipmanage.common.dto.*; import com.yeejoin.equipmanage.common.dto.*;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -204,4 +205,8 @@ public interface JcsFeign { ...@@ -204,4 +205,8 @@ public interface JcsFeign {
@GetMapping(value = "/org-usr/getCompany") @GetMapping(value = "/org-usr/getCompany")
FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode); FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode);
@GetMapping(value = "/data-dictionary/dataDictionaryIdFillMenu")
FeignClientResult<List<DataDictionary>> dataDictionaryIdFillMenu(@RequestParam(value = "type") String type);
} }
...@@ -733,4 +733,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -733,4 +733,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("equipmentCode") String equipmentCode); Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("equipmentCode") String equipmentCode);
Map<String, Object> getEquipStats(@Param("bizOrgCode") String bizOrgCode, @Param("list") List<String> list); Map<String, Object> getEquipStats(@Param("bizOrgCode") String bizOrgCode, @Param("list") List<String> list);
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);
} }
...@@ -353,4 +353,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -353,4 +353,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getSystemAlarmTrendForSbpt(String systemCode, String updateTime); Map<String, Object> getSystemAlarmTrendForSbpt(String systemCode, String updateTime);
List<OrgMenuDto> getSystemEquipTree(String systemCode); List<OrgMenuDto> getSystemEquipTree(String systemCode);
List<Map<String, Object>> getFEquipInfoList(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode);
} }
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -13,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -13,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
...@@ -2873,4 +2877,111 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2873,4 +2877,111 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}); });
return result; return result;
} }
@Override
public List<Map<String, Object>> getFEquipInfoList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoList(bizOrgCode);
ArrayList<String> strings = new ArrayList<>();
list.forEach(item -> {
String equipIds = item.get("equipIds").toString();
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> equipIndexList = this.baseMapper.getEquipIndexList(collect);
Map<String, Map<String, Object>> equipmentSpecificId = equipIndexList.stream().collect(Collectors.toMap(item -> item.get("equipmentSpecificId").toString(), item -> item));
List<Map<String, Object>> resultList = new ArrayList<>();
list.forEach(item -> {
int isOpen = 0;
Date updateDate = null;
String equipIds = item.get("equipIds").toString();
String[] equipIdList = equipIds.split(",");
for (String index : equipIdList) {
if (ObjectUtil.isNotEmpty(equipmentSpecificId)
&& equipmentSpecificId.containsKey(index)
&& equipmentSpecificId.get(index).containsKey("equipmentIndexKey")
&& equipmentSpecificId.get(index).get("equipmentIndexKey").toString().equals("ONL_DrainOilValve_Open")) {
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_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;
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
if (isOpen == 1) {
resultMap.put("startStatus", item.get("name").toString() + "开启");
resultMap.put("drainDuration", item.get("drainDuration"));
resultMap.put("updateDate", updateDate);
resultList.add(resultMap);
}
});
HashMap<String, Object> closeMap = new HashMap<>();
closeMap.put("startStatus", "关闭");
closeMap.put("updateDate", "--");
closeMap.put("drainDuration", "");
List<Map<String, Object>> closeList = Collections.singletonList(closeMap);
return CollUtil.isNotEmpty(resultList) ? resultList : closeList;
}
@Override
public List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode) {
List<DataDictionary> zdsbfl = jcsFeignClient.dataDictionaryIdFillMenu("ZDSBFL").getResult();
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoListCategory(bizOrgCode);
ArrayList<String> strings = new ArrayList<>();
list.forEach(item -> {
String equipIds = item.get("equipIds").toString();
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> equipIndexList = this.baseMapper.getEquipIndexList(collect);
Map<String, Map<String, Object>> equipmentSpecificId = equipIndexList.stream().collect(Collectors.toMap(item -> item.get("equipmentSpecificId").toString(), item -> item));
List<Map<String, Object>> resultList = new ArrayList<>();
list.forEach(item -> {
int isOpen = 0;
Date updateDate = null;
String equipIds = item.get("equipIds").toString();
String[] equipIdList = equipIds.split(",");
for (String index : equipIdList) {
if (ObjectUtil.isNotEmpty(equipmentSpecificId)
&& equipmentSpecificId.containsKey(index)
&& equipmentSpecificId.get(index).containsKey("equipmentIndexKey")
&& equipmentSpecificId.get(index).get("equipmentIndexKey").toString().equals("ONL_DrainOilValve_Open")) {
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_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;
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.get("id"));
resultMap.put("name", item.get("name"));
resultMap.put("time", updateDate);
resultMap.put("drainDuration", item.get("drainDuration"));
resultMap.put("category", item.get("category"));
if (isOpen == 1) {
resultMap.put("status", "start");
} else {
resultMap.put("status", "stop");
}
resultList.add(resultMap);
});
List<Map<String, Object>> listNew = new ArrayList<>();
Map<String, List<Map<String, Object>>> categoryMap = resultList.stream().collect(Collectors.groupingBy(t -> t.get("category").toString()));
zdsbfl.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("code", item.getTreeCode());
map.put("name", item.getName());
map.put("items", categoryMap.get(item.getTreeCode()));
listNew.add(map);
});
return listNew;
}
} }
...@@ -6632,4 +6632,84 @@ ...@@ -6632,4 +6632,84 @@
AND wed.equipment_name is not null AND wed.equipment_name is not null
</where> </where>
</select> </select>
<select id="getFEquipInfoList" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
</select>
<select id="getEquipIndexList" resultType="java.util.Map">
SELECT
equipment_specific_id AS equipmentSpecificId,
update_date AS updateDate,
equipment_index_key AS equipmentIndexKey
FROM
(
SELECT
equipment_specific_id,
update_date,
equipment_index_key,
ROW_NUMBER() OVER ( PARTITION BY equipment_specific_id ORDER BY update_date DESC ) AS rn
FROM
wl_equipment_specific_index
WHERE
equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND `value` = 'true'
AND equipment_specific_id IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
) t
WHERE
t.rn = 1
GROUP BY
equipment_specific_id
ORDER BY
update_date DESC
</select>
<select id="getFEquipInfoListCategory" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds,
a.category
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
AND category IS NOT NULL AND category != ''
ORDER BY
a.create_date DESC
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment