Commit 2e5862e3 authored by KeYong's avatar KeYong

预案筛选逻辑更新

parent 2ac83103
package com.yeejoin.amos.fas.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: ImportantEquipCodeEnum
* <pre>
* @description: TODO
* </pre>
* @date 2024/11/20 18:31
*/
@Getter
@AllArgsConstructor
public enum ImportantEquipCodeEnum {
HLB("换流变", "1850", "AutosysPlanTop_HLB"),
ZB("主变", "1851", "AutosysPlanTop_ZB"),
GK("高抗", "1852", "AutosysPlanTop_GK");
private String name;
private String code;
private String topic;
}
...@@ -38,13 +38,13 @@ public interface PlanDetailMapper { ...@@ -38,13 +38,13 @@ public interface PlanDetailMapper {
* 筛选预案获得总数 * 筛选预案获得总数
* @return * @return
*/ */
Integer filterCount(@Param("planName") String planName, @Param("classifyId") List<Long> classifyId, @Param("planRange") List<String> planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight, @Param("equipmentId") String equipmentId, @Param("category") String category); Integer filterCount(@Param("planName") String planName, @Param("classifyId") List<Long> classifyId, @Param("planRange") List<String> planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight, @Param("equipmentId") String equipmentId, @Param("categories") List<String> categories);
/** /**
* 筛选预案获得分页记录 * 筛选预案获得分页记录
* @return * @return
*/ */
List<PlanDetailVo> filterList(@Param("planName") String planName, @Param("classifyId") List<Long> classifyId, @Param("planRange") List<String> planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight, @Param("start") int start, @Param("size") int size, @Param("equipmentId") String equipmentId, @Param("category") String category); List<PlanDetailVo> filterList(@Param("planName") String planName, @Param("classifyId") List<Long> classifyId, @Param("planRange") List<String> planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight, @Param("start") int start, @Param("size") int size, @Param("equipmentId") String equipmentId, @Param("categories") List<String> categories);
List<String> getRuleIdByEquipment(@Param("id") Long id); List<String> getRuleIdByEquipment(@Param("id") Long id);
......
...@@ -702,7 +702,33 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -702,7 +702,33 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
allChildren.forEach(e -> classifyIdList.add(e.getId())); allChildren.forEach(e -> classifyIdList.add(e.getId()));
} }
} }
int total = planDetailMapper.filterCount(planName, classifyIdList, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, equipmentId, category); if (category.equals(ImportantEquipCodeEnum.ZB.getCode())) {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.ZB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.ZB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
} else if (category.equals(ImportantEquipCodeEnum.GK.getCode())) {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.GK.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.GK.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.HLB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.HLB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
}
String[] idArr = category.split(",");
List<String> idList = new ArrayList();
for (String id : idArr) {
if (id.trim().length() > 0) {
idList.add(id.trim());
}
}
int total = planDetailMapper.filterCount(planName, classifyIdList, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, equipmentId, idList);
page.setTotal(total); page.setTotal(total);
long start = (page.getCurrent() - 1) * page.getSize(); long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) { if (total == 0) {
...@@ -712,7 +738,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -712,7 +738,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
page.setCurrent(1); page.setCurrent(1);
start = 0; start = 0;
} }
List<PlanDetailVo> planList = planDetailMapper.filterList(planName, classifyIdList, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, (int) start, (int) page.getSize(), equipmentId, category); List<PlanDetailVo> planList = planDetailMapper.filterList(planName, classifyIdList, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, (int) start, (int) page.getSize(), equipmentId, idList);
// 查询并插入绑定数据的信息 // 查询并插入绑定数据的信息
fillBindingInfo(planList); fillBindingInfo(planList);
page.setRecords(planList); page.setRecords(planList);
......
...@@ -51,8 +51,11 @@ ...@@ -51,8 +51,11 @@
<if test="equipmentId != null and equipmentId != ''"> <if test="equipmentId != null and equipmentId != ''">
AND cpe.fire_equipment_id = #{equipmentId} AND cpe.fire_equipment_id = #{equipmentId}
</if> </if>
<if test="category != null and category != ''"> <if test="categories != null and categories.size > 0 ">
AND c.category = #{category} AND c.category in
<foreach collection="categories" item="category" open="(" close=")" separator=",">
#{category}
</foreach>
</if> </if>
AND cpd.is_delete = 0 AND cpd.is_delete = 0
</where> </where>
...@@ -114,8 +117,11 @@ ...@@ -114,8 +117,11 @@
<if test="equipmentId != null and equipmentId != ''"> <if test="equipmentId != null and equipmentId != ''">
AND cpe.fire_equipment_id = #{equipmentId} AND cpe.fire_equipment_id = #{equipmentId}
</if> </if>
<if test="category != null and category != ''"> <if test="categories != null and categories.size > 0 ">
AND c.category = #{category} AND c.category in
<foreach collection="categories" item="category" open="(" close=")" separator=",">
#{category}
</foreach>
</if> </if>
AND cpd.is_delete = 0 AND cpd.is_delete = 0
</where> </where>
......
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