Commit 69ae6245 authored by zhangsen's avatar zhangsen

预案智能辅助等API提交

parent 236b3034
......@@ -150,23 +150,38 @@ public class PlanVisual3dController extends BaseController {
@Permission
@ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/getPlanStep/{batchNo}")
public ResponseModel getPlanStep(@PathVariable("batchNo") String batchNo) {
String newestBatchNo = planVisual3dService.getNewestBatchNo();
if (!StringUtil.isNotEmpty(newestBatchNo)) {
@GetMapping(value = "/plan/getPlanStep")
public ResponseModel getPlanStep(@RequestParam("batchNo") String batchNo) {
if (!StringUtil.isNotEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo();
}
if (!StringUtil.isNotEmpty(batchNo)) {
return CommonResponseUtil.successNew(null);
}
return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByBatchNo(newestBatchNo));
return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByBatchNo(batchNo));
}
@Permission
@ApiOperation(value = "根据批次号获取预案的记录", notes = "根据R批次号获取预案的记录")
@GetMapping(value = "/plan/getPlaneRecord/{batchNo}")
public ResponseModel getPlaneRecord(@PathVariable("batchNo") String batchNo) {
@GetMapping(value = "/plan/getPlaneRecord")
public ResponseModel getPlaneRecord(@RequestParam("batchNo") String batchNo) {
if (!StringUtil.isNotEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo();
}
if (!StringUtil.isNotEmpty(batchNo)) {
return CommonResponseUtil.successNew(null);
}
return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordByBatchNo(batchNo));
}
@Permission
@ApiOperation(value = "预案智能辅助", notes = "预案智能辅助")
@GetMapping(value = "/plan/getPlaneRecordOne")
public ResponseModel getPlaneRecordOne() {
String newestBatchNo = planVisual3dService.getNewestBatchNo();
if (!StringUtil.isNotEmpty(newestBatchNo)) {
return CommonResponseUtil.successNew(null);
}
return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordByBatchNo(newestBatchNo));
return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordOneByBatchNo(newestBatchNo));
}
}
......@@ -70,4 +70,15 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" ORDER BY" +
" t.create_date ASC", nativeQuery = true)
List<Map<String, Object>> queryRecord(String batchNo, String recordType);
@Query(value = "SELECT " +
" t.content stepName, t.create_date time" +
" FROM " +
" contingency_plan_instance t" +
" WHERE" +
" t.batch_no = ?" +
" AND t.record_type = ?" +
" ORDER BY" +
" t.create_date DESC limit 1", nativeQuery = true)
List<Map<String, Object>> queryRecordOne(String batchNo, String recordType);
}
......@@ -287,4 +287,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
return toipResponse;
}
@Override
public ToipResponse getPlaneRecordOneByBatchNo(String batchNo) {
// 根据批次号获取预案记录
List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecordOne(batchNo, "MESSAGE");
ToipResponse toipResponse = new ToipResponse();
if (!ObjectUtils.isEmpty(instancesList)) {
Map<String, Object> msgContext = new HashMap<>(1);
msgContext.put("content", instancesList);
ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo);
toipResponse.setMsgType("recordarea");
toipResponse.setMsgContext(msgContext);
toipResponse.setContingency(contingencyOriginalData);
}
return toipResponse;
}
}
......@@ -61,4 +61,11 @@ public interface IPlanVisual3dService {
* @return 预案记录
*/
ToipResponse getPlaneRecordByBatchNo(String batchNo);
/**
* 根据批次号获取预案记录
* @param batchNo 批次号
* @return 预案记录
*/
ToipResponse getPlaneRecordOneByBatchNo(String batchNo);
}
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