Commit 8ba5d81b authored by 张森's avatar 张森

视频配置保存API

parent 5cad9df5
......@@ -2,7 +2,9 @@ package com.yeejoin.amos.fas.dao.dto;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Data
public class PlanStepJsonVO {
......@@ -51,4 +53,6 @@ public class PlanStepJsonVO {
* 是否自动执行;1自动,0非自动
*/
private Integer isAuto;
private List<Map<String, String>> videos = new ArrayList<>();
}
package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.util.StringUtil;
......@@ -338,4 +339,12 @@ public class PlanVisual3dController extends BaseController {
String roleNames = emergencyTaskService.getRolesNameByUserId(user.getUserId());
return CommonResponseUtil.successNew(planVisual3dService.updateTaskStatusById(id, runStatus, user.getRealName(), user.getUserId(), roleNames));
}
@Permission
@ApiOperation(httpMethod = "POST", value = "分页查询预案下处置动作列表", notes = "分页查询预案下处置动作列表")
@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")));
}
}
......@@ -35,4 +35,6 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
List<EmergencyTaskRole> selectListFilterEmptyTask();
String getPlanStepInfoByType(@Param("planType") String planType);
void updatePlanStepByPlanType(@Param("planType") String planType, @Param("planStepJson") String planStepJson);
}
......@@ -82,4 +82,15 @@ public class PlanStepServiceImpl implements IPlanStepService {
redisTemplate.delete("planTask");
// redisTemplate.opsForValue().set("planTask", "");
}
@Override
public void updatePlanStepByPlanType(String planStepJson) {
String planType = "";
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
if (StringUtils.isNotEmpty(planType)) {
emergencyTaskRoleMapper.updatePlanStepByPlanType(planType, planStepJson);
}
}
}
......@@ -284,6 +284,28 @@ 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)) {
ArrayList<Map<String, String>> videoList = new ArrayList<>();
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);
}
});
String planStepJson = JSON.toJSONString(res);
planStepService.updatePlanStepByPlanType(planStepJson);
redisTemplate.opsForValue().set("planStep", planStepJson);
return res;
}
@Override
public ToipResponse getPlaneRecordByBatchNo(String batchNo) {
// 根据批次号获取预案记录
List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecord(batchNo, "MESSAGE");
......
......@@ -31,4 +31,6 @@ public interface IPlanStepService {
void initPlanStep();
void initPlanTask();
void updatePlanStepByPlanType(String planStepJson);
}
package com.yeejoin.amos.fas.business.service.intfc;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.*;
......@@ -142,4 +144,6 @@ public interface IPlanVisual3dService {
ContingencyPlanInstance updateStatusByIdWeb(ContingencyPlanInstance contingencyPlanInstance, Boolean runStatus);
List<PlanStepJsonVO> getPlanStepList(String batchNo);
List<PlanStepJsonVO> updatePlanStepData(String stepCode, List<String> videos);
}
......@@ -91,4 +91,12 @@
WHERE
`obligationId` = #{roleId}
</delete>
<update id="updatePlanStepByPlanType">
UPDATE
c_plan_step_config
SET `data` = #{planStepJson}
WHERE
`type` = #{planType}
</update>
</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