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

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

parent 601836e7
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.dao.dto;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -54,5 +55,5 @@ public class PlanStepJsonVO {
*/
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 {
}
@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 = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/step/tree")
public ResponseModel getPlanStepTree(@RequestParam(value = "batchNo", required = false) String batchNo) {
......@@ -345,6 +352,9 @@ public class PlanVisual3dController extends BaseController {
@PostMapping(value = "/updatePlanStepData")
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;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
......@@ -37,4 +38,6 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
String getPlanStepInfoByType(@Param("planType") String planType);
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;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
......@@ -84,10 +85,15 @@ public class PlanStepServiceImpl implements IPlanStepService {
}
@Override
public void updatePlanStepByPlanType(String planStepJson) {
public void updatePlanStepByPlanType(String equipCode, String planStepJson) {
String planType = "";
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
if (org.springframework.util.StringUtils.hasText(equipCode)) {
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)) {
emergencyTaskRoleMapper.updatePlanStepByPlanType(planType, planStepJson);
......
......@@ -126,6 +126,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Lazy
@Autowired
private IEmergencyTaskService emergencyTaskService;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Override
public void uploadTextPlan(String appId, Map<String, String> pathNameMap) {
......@@ -275,6 +277,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
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
public List<PlanStepJsonVO> getPlanStepList(String batchNo) {
String json = planStepService.getPlanStep();
......@@ -283,25 +298,35 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
@Override
public List<PlanStepJsonVO> updatePlanStepData(String stepCode, List<String> videos) {
String json = planStepService.getPlanStep();
List<PlanStepJsonVO> res = JSON.parseArray(json, PlanStepJsonVO.class);
res.forEach(item -> {
if (item.getStepCode().equals(stepCode)) {
public List<PlanStepJsonVO> updatePlanStepData(String stepCode, String equipCode, List<String> videos) {
String planStep = "";
if (org.springframework.util.StringUtils.hasText(equipCode)) {
Map<String, String> planStepMap = emergencyTaskRoleMapper.queryPlanStepByEquipCode(equipCode);
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<>();
Map<String, List<Map<String, String>>> videosMap = planStepJsonVO.getVideos();
videos.forEach(t -> {
Map<String, String> hashMap = new HashMap<>();
hashMap.put("code", t.split("@")[0]);
hashMap.put("name", t.split("@")[1]);
videoList.add(hashMap);
});
item.setVideos(videoList);
videosMap.put(equipCode, videoList);
planStepJsonVO.setVideos(videosMap);
}
});
String planStepJson = JSON.toJSONString(res);
planStepService.updatePlanStepByPlanType(planStepJson);
redisTemplate.opsForValue().set("planStep", planStepJson);
return res;
}
String planStepJson = JSON.toJSONString(planStepJsonVOS);
planStepService.updatePlanStepByPlanType(equipCode, planStepJson);
if (!org.springframework.util.StringUtils.hasText(equipCode)) {
redisTemplate.opsForValue().set("planStep", planStepJson);
}
return planStepJsonVOS;
}
@Override
......
......@@ -32,5 +32,5 @@ public interface IPlanStepService {
void initPlanTask();
void updatePlanStepByPlanType(String planStepJson);
void updatePlanStepByPlanType(String equipCode, String planStepJson);
}
......@@ -48,7 +48,7 @@ public interface IPlanVisual3dService {
* @return
*/
String getNewestBatchNo();
/**
* 查最新的批次号
......@@ -64,6 +64,13 @@ public interface IPlanVisual3dService {
* @return 预案步骤
*/
ToipResponse getPlanStepByBatchNo(String batchNo);
/**
* 根据电力装备Code获取
*
* @param equipCode 电力装备Code
* @return 预案步骤
*/
JSONArray getPlanStepByEquipCode(String equipCode);
/**
* 根据批次号获取预案记录
......@@ -145,5 +152,5 @@ public interface IPlanVisual3dService {
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 @@
WHERE
`type` = #{planType}
</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>
\ 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