Commit 04cff5bc authored by 张森's avatar 张森

查询已绑定排油阀的换流变信息

parent 54db3921
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);
}
}
...@@ -771,4 +771,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -771,4 +771,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getSystemAlarmNum(@Param("bizOrgCode") String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> getSystemAlarmNum(@Param("bizOrgCode") String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getSystemTypes(String bizOrgCode); List<Map<String, Object>> getSystemTypes(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect);
} }
...@@ -360,4 +360,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -360,4 +360,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<OrgMenuDto> getSystemEquipTree(String systemCode); List<OrgMenuDto> getSystemEquipTree(String systemCode);
List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getFEquipInfoList(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;
...@@ -2924,4 +2927,52 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2924,4 +2927,52 @@ 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;
}
} }
...@@ -7243,4 +7243,47 @@ ...@@ -7243,4 +7243,47 @@
GROUP BY GROUP BY
t1.system_type_code t1.system_type_code
</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
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>
GROUP BY
equipment_specific_id
ORDER BY
update_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