Commit c719da47 authored by 李秀明's avatar 李秀明

更新视频配置同时更新redis

parent 64ad9f28
......@@ -37,6 +37,8 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
String getPlanStepInfoByType(@Param("planType") String planType);
String getLastPlanStepInfo();
void updatePlanStepByPlanType(@Param("planType") String planType, @Param("planStepJson") String planStepJson);
Map<String, String> queryPlanStepByEquipCode(@Param("equipCode") String equipCode);
......
......@@ -60,8 +60,10 @@ public class PlanStepServiceImpl implements IPlanStepService {
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
String json = emergencyTaskRoleMapper.getPlanStepInfoByType(planType);
return json;
if (StringUtils.isNotBlank(planType)) {
return emergencyTaskRoleMapper.getPlanStepInfoByType(planType);
}
return emergencyTaskRoleMapper.getLastPlanStepInfo();
}
@Override
......
......@@ -299,13 +299,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override
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();
if (!org.springframework.util.StringUtils.hasText(equipCode)) {
throw new RuntimeException("设备编码不能为空");
}
Map<String, String> planStepMap = emergencyTaskRoleMapper.queryPlanStepByEquipCode(equipCode);
String planStep = planStepMap.get("data");
String planType = planStepMap.get("type");
List<PlanStepJsonVO> planStepJsonVOS = JSON.parseArray(planStep, PlanStepJsonVO.class);
for (PlanStepJsonVO planStepJsonVO : planStepJsonVOS) {
if (planStepJsonVO.getStepCode().equals(stepCode)) {
......@@ -323,7 +322,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
String planStepJson = JSON.toJSONString(planStepJsonVOS);
planStepService.updatePlanStepByPlanType(equipCode, planStepJson);
if (!org.springframework.util.StringUtils.hasText(equipCode)) {
if (redisTemplate.hasKey("planType") && Objects.equals(redisTemplate.boundValueOps("planType").get(0, -1), planType)) {
redisTemplate.opsForValue().set("planStep", planStepJson);
}
return planStepJsonVOS;
......
......@@ -85,6 +85,12 @@
limit 1
</select>
<select id="getLastPlanStepInfo" resultType="java.lang.String">
select `data` from c_plan_step_config
order by id DESC
limit 1
</select>
<delete id="deleteRelationByRoleId">
delete from
c_emergency_relation
......
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