Commit b2908f6a authored by xixinzhao's avatar xixinzhao

新增处置步骤,处置日志

parent 531c9d59
package com.yeejoin.amos.fas.dao.entity; package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -48,5 +51,11 @@ public class PlanRule extends BasicEntity { ...@@ -48,5 +51,11 @@ public class PlanRule extends BasicEntity {
@Column(name="pic_url") @Column(name="pic_url")
private String picUrl; private String picUrl;
/**
* 当前预案步骤
*/
@Column(name="plan_step")
private String planStep;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; ...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.config.Permission; import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -146,5 +147,17 @@ public class PlanVisual3dController extends BaseController { ...@@ -146,5 +147,17 @@ public class PlanVisual3dController extends BaseController {
} }
} }
@Permission
@ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/getPlanStep/{batchNo}")
public ResponseModel getPlanStep(@PathVariable("batchNo") String batchNo) {
return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByBatchNo(batchNo));
}
@Permission
@ApiOperation(value = "根据批次号获取预案的记录", notes = "根据R批次号获取预案的记录")
@GetMapping(value = "/plan/getPlaneRecord/{batchNo}")
public ResponseModel getPlaneRecord(@PathVariable("batchNo") String batchNo) {
return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordByBatchNo(batchNo));
}
} }
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.google.gson.JsonObject;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -20,4 +21,11 @@ public interface PlanOperationRecordMapper { ...@@ -20,4 +21,11 @@ public interface PlanOperationRecordMapper {
List<Map<String, Object>> filterList(Map<String, Object> params); List<Map<String, Object>> filterList(Map<String, Object> params);
List<PlanOperationRecordSyncBo> getPlanOperationRecordSyncBoList(Map<String, Object> map); List<PlanOperationRecordSyncBo> getPlanOperationRecordSyncBoList(Map<String, Object> map);
/**
* 根据批次号查询预案步骤
* @param batchNo 批次号
* @return 步骤
*/
String getPlanStepByBatchNo(String batchNo);
} }
...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.Query; ...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -58,4 +59,15 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP ...@@ -58,4 +59,15 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" ORDER BY" + " ORDER BY" +
" t.create_date DESC", nativeQuery = true) " t.create_date DESC", nativeQuery = true)
List<ContingencyPlanInstance> queryForCategoryOrderByCreateDate(String batch_no,String recordType); List<ContingencyPlanInstance> queryForCategoryOrderByCreateDate(String batch_no,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 ASC", nativeQuery = true)
List<Map<String, Object>> queryRecord(String batchNo, String recordType);
} }
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.DictMapper; import com.yeejoin.amos.fas.business.dao.mapper.DictMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao; import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.service.intfc.IDictService; import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Dict; import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -38,6 +49,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -38,6 +49,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
private DictMapper dictMapper; private DictMapper dictMapper;
@Autowired
PlanOperationRecordMapper planOperationRecordMapper;
@Autowired
IContingencyOriginalDataDao contingencyOriginalDataDao;
@Autowired
private IContingencyPlanInstanceRepository contingencyPlanInstanceRepository;
@Override @Override
public List<TreeSubjectVo> getPlanTree() { public List<TreeSubjectVo> getPlanTree() {
...@@ -227,5 +247,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -227,5 +247,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
iTextPlanDao.deleteById(id); iTextPlanDao.deleteById(id);
} }
@Override
public ToipResponse getPlanStepByBatchNo(String batchNo) {
ToipResponse toipResponse = new ToipResponse();
// 根据批次号查询预案步骤
String planStep = planOperationRecordMapper.getPlanStepByBatchNo(batchNo);
if (StringUtil.isNotEmpty(planStep)) {
JSONArray objects = JSON.parseArray(planStep);
// 查询当前步骤
ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo);
String step = contingencyOriginalData.getStep();
Map<String, Object> msgContext = new HashMap<>(2);
msgContext.put("step", objects);
msgContext.put("currentStep", step);
toipResponse.setMsgType("steparea");
toipResponse.setMsgContext(msgContext);
toipResponse.setContingency(contingencyOriginalData);
}
return toipResponse;
}
@Override
public ToipResponse getPlaneRecordByBatchNo(String batchNo) {
// 根据批次号获取预案记录
List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecord(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;
}
} }
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
...@@ -40,4 +41,18 @@ public interface IPlanVisual3dService { ...@@ -40,4 +41,18 @@ public interface IPlanVisual3dService {
List<TreeSubjectVo> getTextPlanBySubjectId(String appId); List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
void deleteTextPlanFile(Long id); void deleteTextPlanFile(Long id);
/**
* 根据批次号获取预案步骤
* @param batchNo 批次号
* @return 预案步骤
*/
ToipResponse getPlanStepByBatchNo(String batchNo);
/**
* 根据批次号获取预案记录
* @param batchNo 批次号
* @return 预案记录
*/
ToipResponse getPlaneRecordByBatchNo(String batchNo);
} }
package com.yeejoin.amos.fas.core.util; package com.yeejoin.amos.fas.core.util;
import org.springframework.http.HttpStatus;
public class CommonResponseUtil public class CommonResponseUtil
{ {
...@@ -52,4 +52,13 @@ public class CommonResponseUtil ...@@ -52,4 +52,13 @@ public class CommonResponseUtil
response.setMessage(message); response.setMessage(message);
return response; return response;
} }
public static ResponseModel successNew(Object obj)
{
ResponseModel res = new ResponseModel();
res.setResult(obj);
res.setDevMessage(Constants.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value());
return res;
}
} }
package com.yeejoin.amos.fas.core.util;
import java.io.Serializable;
/**
*
* <pre>
* Tyrest
* File: ResponseModel.java
*
* Tyrest, Inc.
* Copyright (C): 2016
*
* Description:
* TODO
*
* Notes:
* $Id: ResponseModel.java Tyrest\magintrursh $
*
* Revision History
* &lt;Date&gt;, &lt;Who&gt;, &lt;What&gt;
* 2016年11月1日 magintrursh Initial.
*
* </pre>
*/
public class ResponseModel<T> implements Serializable
{
/**
* Comment for &lt;code&gt;serialVersionUID&lt;/code&gt;
*/
private static final long serialVersionUID = -1241360949457314497L;
private int status;
private T result ;
private String traceId;
private String devMessage = "";
private String message = "";
private String path;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getDevMessage() {
return devMessage;
}
public void setDevMessage(String devMessage) {
this.devMessage = devMessage;
}
public String getTraceId()
{
return traceId;
}
public void setTraceId(String traceId)
{
this.traceId = traceId;
}
public int getStatus()
{
return status;
}
public void setStatus(int status)
{
this.status = status;
}
public T getResult()
{
return result;
}
public void setResult(T result)
{
this.result = result;
}
@Override
public String toString()
{
return "ResponseModel [status=" + status + ", result=" + result + ", traceId=" + traceId + ", message="
+ devMessage + "]";
}
}
/*
*$Log: av-env.bat,v $
*/
\ No newline at end of file
...@@ -726,4 +726,15 @@ ...@@ -726,4 +726,15 @@
MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ; MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="xixinzhao" id="xxz-2022-07-07-01">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="c_plan_rule" columnName="plan_step"/>
</not>
</preConditions>
<comment>c_plan_rule add column plan_step</comment>
<sql>
alter table `c_plan_rule` add column `plan_step` json DEFAULT NULL COMMENT '预案步骤';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -106,4 +106,13 @@ ...@@ -106,4 +106,13 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getPlanStepByBatchNo" resultType="java.lang.String">
SELECT
cpr.plan_step
FROM
c_plan_rule cpr
LEFT JOIN c_plan_operation_record cpor ON cpor.plan_id = cpr.plan_id
WHERE
cpor.batch_no = #{batchNo}
</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