Commit 64ad9f28 authored by 李秀明's avatar 李秀明

应急处置流程视频配置增加绑定换流变逻辑

parent 601836e7
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.dao.dto; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.dao.dto;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,5 +55,5 @@ public class PlanStepJsonVO { ...@@ -54,5 +55,5 @@ public class PlanStepJsonVO {
*/ */
private Integer isAuto; private Integer isAuto;
private List<Map<String, String>> videos = new ArrayList<>(); private Map<String, List<Map<String, String>>> videos = new HashMap<>();
} }
...@@ -169,6 +169,13 @@ public class PlanVisual3dController extends BaseController { ...@@ -169,6 +169,13 @@ public class PlanVisual3dController extends BaseController {
} }
@Permission @Permission
@ApiOperation(value = "根据电力装备Code获取", notes = "根据电力装备Code获取")
@GetMapping(value = "/getPlanStepByEquipCode")
public ResponseModel getPlanStepByEquipCode(@RequestParam(value = "equipCode") String equipCode) {
return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByEquipCode(equipCode));
}
@Permission
@ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤") @ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/step/tree") @GetMapping(value = "/plan/step/tree")
public ResponseModel getPlanStepTree(@RequestParam(value = "batchNo", required = false) String batchNo) { public ResponseModel getPlanStepTree(@RequestParam(value = "batchNo", required = false) String batchNo) {
...@@ -345,6 +352,9 @@ public class PlanVisual3dController extends BaseController { ...@@ -345,6 +352,9 @@ public class PlanVisual3dController extends BaseController {
@PostMapping(value = "/updatePlanStepData") @PostMapping(value = "/updatePlanStepData")
public ResponseModel updatePlanStepData(@RequestBody Map<String, Object> map public ResponseModel updatePlanStepData(@RequestBody Map<String, Object> map
) { ) {
return CommonResponseUtil2.success(planVisual3dService.updatePlanStepData(map.get("stepCode").toString(), (List<String>) map.get("videos"))); String stepCode = map.get("stepCode").toString();
String equipCode = map.get("equipCode").toString();
List<String> videos = (List<String>) map.get("videos");
return CommonResponseUtil2.success(planVisual3dService.updatePlanStepData(stepCode, equipCode, videos));
} }
} }
...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> { public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
...@@ -37,4 +38,6 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> { ...@@ -37,4 +38,6 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
String getPlanStepInfoByType(@Param("planType") String planType); String getPlanStepInfoByType(@Param("planType") String planType);
void updatePlanStepByPlanType(@Param("planType") String planType, @Param("planStepJson") String planStepJson); void updatePlanStepByPlanType(@Param("planType") String planType, @Param("planStepJson") String planStepJson);
Map<String, String> queryPlanStepByEquipCode(@Param("equipCode") String equipCode);
} }
...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -84,10 +85,15 @@ public class PlanStepServiceImpl implements IPlanStepService { ...@@ -84,10 +85,15 @@ public class PlanStepServiceImpl implements IPlanStepService {
} }
@Override @Override
public void updatePlanStepByPlanType(String planStepJson) { public void updatePlanStepByPlanType(String equipCode, String planStepJson) {
String planType = ""; String planType = "";
if (redisTemplate.hasKey("planType")) { if (org.springframework.util.StringUtils.hasText(equipCode)) {
planType = redisTemplate.boundValueOps("planType").get(0, -1); Map<String, String> planStepMap = emergencyTaskRoleMapper.queryPlanStepByEquipCode(equipCode);
planType = planStepMap.get("type");
} else {
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
} }
if (StringUtils.isNotEmpty(planType)) { if (StringUtils.isNotEmpty(planType)) {
emergencyTaskRoleMapper.updatePlanStepByPlanType(planType, planStepJson); emergencyTaskRoleMapper.updatePlanStepByPlanType(planType, planStepJson);
......
...@@ -126,6 +126,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -126,6 +126,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Lazy @Lazy
@Autowired @Autowired
private IEmergencyTaskService emergencyTaskService; private IEmergencyTaskService emergencyTaskService;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Override @Override
public void uploadTextPlan(String appId, Map<String, String> pathNameMap) { public void uploadTextPlan(String appId, Map<String, String> pathNameMap) {
...@@ -275,6 +277,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -275,6 +277,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return toipResponse; return toipResponse;
} }
/**
* 根据电力装备Code获取
*
* @param equipCode 电力装备Code
* @return 预案步骤
*/
@Override
public JSONArray getPlanStepByEquipCode(String equipCode) {
Map<String, String> planStepMap = emergencyTaskRoleMapper.queryPlanStepByEquipCode(equipCode);
String planStep = planStepMap.get("data");
return JSON.parseArray(planStep);
}
@Override @Override
public List<PlanStepJsonVO> getPlanStepList(String batchNo) { public List<PlanStepJsonVO> getPlanStepList(String batchNo) {
String json = planStepService.getPlanStep(); String json = planStepService.getPlanStep();
...@@ -283,25 +298,35 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -283,25 +298,35 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public List<PlanStepJsonVO> updatePlanStepData(String stepCode, List<String> videos) { public List<PlanStepJsonVO> updatePlanStepData(String stepCode, String equipCode, List<String> videos) {
String json = planStepService.getPlanStep(); String planStep = "";
List<PlanStepJsonVO> res = JSON.parseArray(json, PlanStepJsonVO.class); if (org.springframework.util.StringUtils.hasText(equipCode)) {
res.forEach(item -> { Map<String, String> planStepMap = emergencyTaskRoleMapper.queryPlanStepByEquipCode(equipCode);
if (item.getStepCode().equals(stepCode)) { planStep = planStepMap.get("data");
} else {
planStep = planStepService.getPlanStep();
}
List<PlanStepJsonVO> planStepJsonVOS = JSON.parseArray(planStep, PlanStepJsonVO.class);
for (PlanStepJsonVO planStepJsonVO : planStepJsonVOS) {
if (planStepJsonVO.getStepCode().equals(stepCode)) {
ArrayList<Map<String, String>> videoList = new ArrayList<>(); ArrayList<Map<String, String>> videoList = new ArrayList<>();
Map<String, List<Map<String, String>>> videosMap = planStepJsonVO.getVideos();
videos.forEach(t -> { videos.forEach(t -> {
Map<String, String> hashMap = new HashMap<>(); Map<String, String> hashMap = new HashMap<>();
hashMap.put("code", t.split("@")[0]); hashMap.put("code", t.split("@")[0]);
hashMap.put("name", t.split("@")[1]); hashMap.put("name", t.split("@")[1]);
videoList.add(hashMap); videoList.add(hashMap);
}); });
item.setVideos(videoList); videosMap.put(equipCode, videoList);
planStepJsonVO.setVideos(videosMap);
} }
}); }
String planStepJson = JSON.toJSONString(res); String planStepJson = JSON.toJSONString(planStepJsonVOS);
planStepService.updatePlanStepByPlanType(planStepJson); planStepService.updatePlanStepByPlanType(equipCode, planStepJson);
redisTemplate.opsForValue().set("planStep", planStepJson); if (!org.springframework.util.StringUtils.hasText(equipCode)) {
return res; redisTemplate.opsForValue().set("planStep", planStepJson);
}
return planStepJsonVOS;
} }
@Override @Override
......
...@@ -32,5 +32,5 @@ public interface IPlanStepService { ...@@ -32,5 +32,5 @@ public interface IPlanStepService {
void initPlanTask(); void initPlanTask();
void updatePlanStepByPlanType(String planStepJson); void updatePlanStepByPlanType(String equipCode, String planStepJson);
} }
...@@ -48,7 +48,7 @@ public interface IPlanVisual3dService { ...@@ -48,7 +48,7 @@ public interface IPlanVisual3dService {
* @return * @return
*/ */
String getNewestBatchNo(); String getNewestBatchNo();
/** /**
* 查最新的批次号 * 查最新的批次号
...@@ -64,6 +64,13 @@ public interface IPlanVisual3dService { ...@@ -64,6 +64,13 @@ public interface IPlanVisual3dService {
* @return 预案步骤 * @return 预案步骤
*/ */
ToipResponse getPlanStepByBatchNo(String batchNo); ToipResponse getPlanStepByBatchNo(String batchNo);
/**
* 根据电力装备Code获取
*
* @param equipCode 电力装备Code
* @return 预案步骤
*/
JSONArray getPlanStepByEquipCode(String equipCode);
/** /**
* 根据批次号获取预案记录 * 根据批次号获取预案记录
...@@ -145,5 +152,5 @@ public interface IPlanVisual3dService { ...@@ -145,5 +152,5 @@ public interface IPlanVisual3dService {
List<PlanStepJsonVO> getPlanStepList(String batchNo); List<PlanStepJsonVO> getPlanStepList(String batchNo);
List<PlanStepJsonVO> updatePlanStepData(String stepCode, List<String> videos); List<PlanStepJsonVO> updatePlanStepData(String stepCode, String equipCode, List<String> videos);
} }
...@@ -99,4 +99,24 @@ ...@@ -99,4 +99,24 @@
WHERE WHERE
`type` = #{planType} `type` = #{planType}
</update> </update>
<select id="queryPlanStepByEquipCode" resultType="java.util.Map">
SELECT
*
FROM
c_plan_step_config
WHERE
id = (
SELECT DISTINCT
( t3.classify_id )
FROM
f_equipment t1
LEFT JOIN c_plan_equipment t2 ON t2.fire_equipment_id = t1.id
LEFT JOIN c_plan_detail t3 ON t3.id = t2.plan_id
WHERE
t1.code = #{equipCode}
ORDER BY t1.create_date desc
LIMIT 1
)
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment