Commit f263bbc1 authored by maoying's avatar maoying

合并应急4.0版本代码

parents 3522a916 2ac83103
package com.yeejoin.amos.fas.common.enums;
/**
* 模板分类
*
* @author DELL
*/
public enum WordTemplateTypeEum {
StationDrilReport("应急演练报告", "StationDrilReport.ftl");
private String label;
private String templateFile;
WordTemplateTypeEum(String label, String templateFile) {
this.label = label;
this.templateFile = templateFile;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getTemplateFile() {
return templateFile;
}
public void setTemplateFile(String templateFile) {
this.templateFile = templateFile;
}
}
package com.yeejoin.amos.fas.dao.dto;
import lombok.Data;
/**
* @author keyong
* @title: ConditionVO
* <pre>
* @description: TODO
* </pre>
* @date 2023/3/8 16:12
*/
@Data
public class ConditionDTO {
private String equipName;
private String equipCode;
private String equipSpeName;
private String equipSpeCode;
private String equipSpeIndexKey;
private String standardValue;
private String inAndOr;
}
......@@ -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,8 @@ public class PlanStepJsonVO {
*/
private Integer isAuto;
private List<Map<String, String>> videos = new ArrayList<>();
private Map<String, List<Map<String, String>>> videos = new HashMap<>();
private List<ConditionDTO> condition;
}
package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("c_plan_report")
public class PlanReport extends BaseEntity {
@TableField("batch_no")
private String batchNo;
@TableField("report_url")
private String reportUrl;
@TableField("title")
private String title;
@TableField(value = "drill_date")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private Date drillDate;
@TableField("address")
private String address;
@TableField("compere")
private String compere;
@TableField("attend_person")
private String attendPerson;
@TableField("drill_topic")
private String drillTopic;
@TableField("handle_process")
private String handleProcess;
@TableField("drill_summary")
private String drillSummary;
@TableField("examine_result")
private String examineResult;
@TableField("biz_org_name")
private String bizOrgName;
@TableField("biz_org_code")
private String bizOrgCode;
@TableField("drill_type")
private String drillType;
@TableField("drill_equip")
private String drillEquip;
@TableField("drill_equip_id")
private String drillEquipId;
@TableField(exist = false)
private Integer pageNumber;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
@TableField(exist = false)
private String equipName;
@TableField(exist = false)
private String sortField;
@TableField(exist = false)
private String sortOrder;
}
......@@ -141,6 +141,12 @@
<artifactId>amos-component-security</artifactId>
<version>1.7.13-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -51,7 +51,6 @@ import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
......@@ -62,8 +61,8 @@ import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanReportService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanStepService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.JSONUtil;
......@@ -119,15 +118,9 @@ public class ContingencyAction implements CustomerAction {
private IContingencyInstance contingencyInstance;
@Autowired
private PlanOperationRecordMapper planOperationRecordMapper;
@Autowired
private PlanDetailMapper planDetailMapper;
@Autowired
private IPlanVisual3dService planVisual3dService;
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Autowired
......@@ -162,14 +155,16 @@ public class ContingencyAction implements CustomerAction {
private IPlanDetailDao planDetailDao;
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Autowired
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
@Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@Autowired
private IPlanStepService iPlanStepService;
@Autowired
IPlanReportService planReportService;
/**
* @param stepCode 当前步骤编号
* @param stepName 当前步骤名称
......@@ -226,9 +221,9 @@ public class ContingencyAction implements CustomerAction {
toipResponse.setMsgContext(result.toJson());
toipResponse.setContingency(contingency);
toipResponse.setPlanRuleNo(contingency.getPlanRuleNo());
log.info("===============sendcmdT==contingency=,{}",JSONObject.toJSONString(contingency));
// log.info("===============sendcmdT==contingency=,{}",JSONObject.toJSONString(contingency));
String topic = String.format("/%s/%s/%s", serviceName, stationName, ("1".equals(contingency.getPlanRuleNo())?"plan":"secPlan"));
log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
webMqttComponent.publish(topic, toipResponse.toJsonStr());
}
......@@ -767,12 +762,12 @@ public class ContingencyAction implements CustomerAction {
}
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord PlanOperationRecord = planOperationRecordDao.findByBatchNo(batchNo);
if (PlanOperationRecord != null && PlanOperationRecord.getStatus() == PlanRecordStatusEnum.OPERATION.getCode()) {
PlanOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode());
PlanOperationRecord.setEndTime(new Date());
PlanOperationRecord record = planOperationRecordDao.save(PlanOperationRecord);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(PlanOperationRecord.getPlanId());
PlanOperationRecord planOperationRecord = planOperationRecordDao.findByBatchNo(batchNo);
if (planOperationRecord != null && planOperationRecord.getStatus() == PlanRecordStatusEnum.OPERATION.getCode()) {
planOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode());
planOperationRecord.setEndTime(new Date());
PlanOperationRecord record = planOperationRecordDao.save(planOperationRecord);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if (optionalPlanDetail.get() != null) {
PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
......@@ -785,6 +780,9 @@ public class ContingencyAction implements CustomerAction {
// 结束预案,更新预案信息表结束时间
contingencyInstanceInfoService.updateEndTimeById(batchNo);
// 生成演练报告
planReportService.createReport(batchNo);
this.sendcmd("message", paramObj, result);
redisTemplate.delete("contingencyRo");
// 预案结束清空redis
......
......@@ -324,4 +324,10 @@ public class ContingencyPlanController extends BaseController {
return CommonResponseUtil2.success(contingencyPlanService.selectTaskActionPage(current, size, batchNo, runState, updateDate, list, steps));
}
@ApiOperation(value = "获取当前登录人待处置任务及预案信息")
@GetMapping(value = "/getPlanInfo")
public ResponseModel getPlanInfo(@RequestParam(value = "planId") Long planId ) {
return CommonResponseUtil2.success(contingencyPlanService.getPlanInfo(planId));
}
}
package com.yeejoin.amos.fas.business.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper;
import com.yeejoin.amos.fas.business.service.intfc.IPlanReportService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
@RestController
@RequestMapping(value = "/planReport")
@Api(tags = "演练报告API")
public class PlanReportController extends BaseController {
@Autowired
PlanReportMapper planReportMapper;
@Autowired
IPlanReportService iPlanReportService;
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "保存API", notes = "保存API")
@PostMapping(value = "/save")
public CommonResponse saveStation(@RequestBody PlanReport planReport) {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getCompany().getOrgCode();
String bizOrgName = reginParams.getCompany().getCompanyName();
planReport.setBizOrgCode(bizOrgCode);
planReport.setBizOrgName(bizOrgName);
planReport.setCreateDate(new Date());
planReport.setDrillDate(new Date());
planReportMapper.saveInfo(planReport);
return CommonResponseUtil.success(planReport);
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "删除API", notes = "删除API")
@PostMapping(value = "/deleteById")
public CommonResponse deleteById(@RequestParam(value = "id") Long id) {
planReportMapper.deleteById(id);
return CommonResponseUtil.success();
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "详情API", notes = "详情API")
@GetMapping(value = "/getById")
public CommonResponse getById(@RequestParam(value = "id") Long id) {
PlanReport planReport = planReportMapper.getById(id);
return CommonResponseUtil.success(planReport);
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "分页查询", notes = "分页查询")
@PostMapping(value = "/getByPage")
public CommonResponse getByPage(@RequestBody PlanReport planReport) {
Page<PlanReport> resultPage = iPlanReportService.getByPage(planReport);
return CommonResponseUtil.success(resultPage);
}
@Permission
@ApiOperation(value = "更新", notes = "更新")
@PutMapping(value = "/update", produces = "application/json;charset=UTF-8")
public CommonResponse updateReport(@RequestBody PlanReport planReport) {
PlanReport report = iPlanReportService.updateReport(planReport);
return CommonResponseUtil.success(report);
}
@Permission
@ApiOperation(value = "下载报告", notes = "下载报告")
@GetMapping(value = "/download")
public void download(HttpServletRequest request, HttpServletResponse response,
@ApiParam(value = "id", required = true) @RequestParam String id) {
iPlanReportService.download(request, response, id);
}
@Permission
@ApiOperation(value = "预览报告", notes = "预览报告")
@GetMapping(value = "/preview")
public CommonResponse preview(
@ApiParam(value = "id", required = true) @RequestParam String id) {
PlanReport report = planReportMapper.getById(Long.valueOf(id));
return CommonResponseUtil.success(iPlanReportService.preview(report));
}
}
......@@ -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> {
......@@ -36,5 +37,9 @@ 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);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.yeejoin.amos.fas.dao.entity.PlanEquipment;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -23,4 +24,6 @@ public interface PlanEquipmentMapper {
int updateIsDeleteByPlanIdList(@Param("planIdList") List<Long> idList, @Param("isDelete") Boolean isDelete);
int logicDeleteByEquipIdList(@Param("equipIdList") List<Long> idList);
PlanEquipment getOneByPlanId(@Param("planId") Long planId);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PlanReportMapper extends BaseMapper<PlanReport> {
void saveInfo(PlanReport dto);
void deleteById(@Param("id") Long id);
Integer getByCount(PlanReport planReport);
List<PlanReport> getByPage(PlanReport planReport);
PlanReport getById(@Param("id") Long id);
PlanReport getByBatchNo(@Param("batchNo") String batchNo);
void updateReportById(PlanReport report);
}
......@@ -88,4 +88,14 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
@Query(value = "SELECT id FROM `contingency_plan_instance` WHERE batch_no = ?1 AND record_type = ?2 ORDER BY sort DESC LIMIT 1", nativeQuery = true)
String findByBatchNoAndRecordType(String batchNo, String recordType);
@Query(value = "SELECT " +
" *" +
" FROM " +
" contingency_plan_instance t" +
" WHERE" +
" t.batch_no = ?" +
" AND (t.record_type = 'MESSAGE' OR ( t.record_type = 'TASKOPERATE' AND t.runstate = true)) " +
" ORDER BY" +
" t.create_date ASC", nativeQuery = true)
List<ContingencyPlanInstance> queryForExecuteInfo(String batch_no);
}
......@@ -201,6 +201,11 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return categorys;
}
public List<ContingencyPlanInstance> queryForExecuteInfo(String batchNo) {
List<ContingencyPlanInstance> instances = repository.queryForExecuteInfo(batchNo);
return instances;
}
@Transactional
public Optional<Equipment> fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState
, String stepStateOnbutton) throws Exception {
......
package com.yeejoin.amos.fas.business.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IPlanReportService;
import com.yeejoin.amos.fas.business.util.MyByteArrayMultipartFile;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.util.WordTemplateUtils;
import com.yeejoin.amos.fas.common.enums.WordTemplateTypeEum;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class PlanReportServiceImpl extends ServiceImpl<PlanReportMapper, PlanReport> implements IPlanReportService {
private static String firstContent = "";
@Autowired
PlanReportMapper planReportMapper;
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Autowired
private IContingencyInstance iContingencyInstance;
@Override
public void download(HttpServletRequest request, HttpServletResponse response, String id) {
PlanReport report = planReportMapper.getById(Long.valueOf(id));
WordTemplateUtils instance = WordTemplateUtils.getInstance();
Map<String, Object> map = getWordMap(report);
try {
instance.exportMillCertificateWord(request, response, map, (String) map.get("document_name"),
WordTemplateTypeEum.StationDrilReport.getTemplateFile());
} catch (IOException e) {
throw new BadRequest("下载应急演练报告失败!");
}
}
@Override
public String preview(PlanReport report) {
Map<String, Object> map = getWordMap(report);
SimpleDateFormat dateStat = new SimpleDateFormat("yyyy年MM月dd日");
String documentNameTime = dateStat.format(new Date());
WordTemplateUtils instance = WordTemplateUtils.getInstance();
String urlString = "";
File filepdf = null;
try {
filepdf = instance.getWordFileItem(map, "应急演练报告" + documentNameTime, WordTemplateTypeEum.StationDrilReport.getTemplateFile(), "pdf");
filepdf.getAbsolutePath();
MultipartFile multipartFile = new MyByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(filepdf));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
if (result != null) {
Iterator<String> it = result.getResult().keySet().iterator();
while (it.hasNext()) {
urlString = it.next();
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (filepdf != null) {
filepdf.delete();
}
}
return urlString;
}
@Override
public void createReport(String batchNo) {
Assert.notNull(batchNo, "batchNo 不能为空!");
PlanReport report = planReportMapper.getByBatchNo(batchNo);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
List<ContingencyPlanInstance> list = null;
try {
list = iContingencyInstance.queryForExecuteInfo(batchNo);
firstContent = list.get(0).getContent();
list.remove(0);
} catch (Exception e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(list)) {
StringBuilder builder = new StringBuilder();
list.forEach(instance -> {
if ("MESSAGE".equalsIgnoreCase(instance.getRecordType())){
builder.append(sdf.format(instance.getCreateDate())).append(" ").append(instance.getStartUserName())
.append(":").append(instance.getContent()).append("\n");
} else {
builder.append(sdf.format(instance.getUpdateDate())).append(" ").append(instance.getStartUserName())
.append(":").append(instance.getCategory()).append("\n");
}
});
String str = builder.toString();
str = str.substring(0, str.length() - 1);
report.setHandleProcess(str);
}
String url = preview(report);
report.setReportUrl(url);
planReportMapper.updateReportById(report);
}
@Override
public PlanReport updateReport(PlanReport report) {
String url = preview(report);
report.setReportUrl(url);
planReportMapper.updateReportById(report);
return report;
}
@Override
public Page<PlanReport> getByPage(PlanReport planReport) {
Page<PlanReport> objectPage = new Page<>(planReport.getPageNumber(), planReport.getPageSize());
planReport.setPageNumber((planReport.getPageNumber() - 1) * planReport.getPageSize());
Integer count = this.baseMapper.getByCount(planReport);
if (count > 0) {
objectPage.setRecords(this.baseMapper.getByPage(planReport));
objectPage.setTotal(count);
}
return objectPage;
}
private Map<String, Object> getWordMap(PlanReport report) {
Map<String, Object> map = new HashMap<String, Object>();
PlanOperationRecord operationRecord = planOperationRecordDao.findByBatchNo(report.getBatchNo());
SimpleDateFormat dateStat = new SimpleDateFormat("HH:mm");
SimpleDateFormat drillDateFormat = new SimpleDateFormat("yyyy-MM-dd");
// 活动主题
map.put("drill_title", report.getTitle());
// 演练时间
map.put("drill_date", ObjectUtils.isEmpty(report.getDrillDate()) ? "" : drillDateFormat.format(report.getDrillDate()));
// 主持人
map.put("compere", report.getCompere());
// 演练地点
map.put("drill_address", report.getAddress());
// 参与人员
map.put("attend_person", report.getAttendPerson());
// 演习题目
map.put("drill_topic", report.getDrillTopic());
// 处理过程
map.put("handle_process", StringUtil.isNotEmpty(report.getHandleProcess()) ? report.getHandleProcess()
.replaceAll("\n", "<w:br/>") : "");
// 预案开始时间
map.put("start_time", dateStat.format(operationRecord.getStartTime()));
map.put("first_content", firstContent);
// 预案结束时间
map.put("end_time", dateStat.format(operationRecord.getEndTime()));
// 演习总结
map.put("drill_summary", report.getDrillSummary());
// 审核
map.put("examine_result", report.getExamineResult());
return map;
}
public static byte[] file2byte(File file) {
try (FileInputStream in = new FileInputStream(file);) {
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
......@@ -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
......@@ -59,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
......@@ -84,11 +87,16 @@ public class PlanStepServiceImpl implements IPlanStepService {
}
@Override
public void updatePlanStepByPlanType(String planStepJson) {
public void updatePlanStepByPlanType(String equipCode, String planStepJson) {
String planType = "";
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);
}
......
......@@ -36,6 +36,7 @@ import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyInstanceInfoMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper;
import com.yeejoin.amos.fas.business.dao.mapper.DictMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper;
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.repository.IContingencyOriginalDataDao;
......@@ -159,6 +160,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) {
......@@ -311,6 +314,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();
......@@ -319,25 +335,34 @@ 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) {
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)) {
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);
}
String planStepJson = JSON.toJSONString(planStepJsonVOS);
planStepService.updatePlanStepByPlanType(equipCode, planStepJson);
if (redisTemplate.hasKey("planType") && Objects.equals(redisTemplate.boundValueOps("planType").get(0, -1), planType)) {
redisTemplate.opsForValue().set("planStep", planStepJson);
return res;
}
return planStepJsonVOS;
}
@Override
......
......@@ -14,6 +14,8 @@ public interface IContingencyInstance {
List<ContingencyPlanInstance> queryForTimeLine(String instanceNo,String recordType) throws Exception;
List<ContingencyPlanInstance> queryForExecuteInfo(String batchNo);
void setButtonExecuted(String batchNo,String contingencyPlanId,String code,String buttonState, String user) throws Exception;
void setButtonWait(String batchNo,String contingencyPlanId,String buttonState) throws Exception;
......
......@@ -146,4 +146,6 @@ public interface IContingencyPlanService {
String getPlanBatchNo();
Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList, List<String> steps);
Map<String, Object> getPlanInfo(Long planId);
}
package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface IPlanReportService extends IService<PlanReport> {
Page<PlanReport> getByPage(PlanReport planReport);
void download(HttpServletRequest request, HttpServletResponse response, String id);
String preview(PlanReport report);
void createReport(String batchNo);
PlanReport updateReport(PlanReport report);
}
......@@ -32,5 +32,5 @@ public interface IPlanStepService {
void initPlanTask();
void updatePlanStepByPlanType(String planStepJson);
void updatePlanStepByPlanType(String equipCode, String planStepJson);
}
......@@ -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);
}
package com.yeejoin.amos.fas.business.util;
import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
public class MyByteArrayMultipartFile implements MultipartFile {
private String name;
private String originalFilename;
private String contentType;
public MyByteArrayMultipartFile(String name, String originalFilename, String contentType, @NonNull byte[] bytes) {
super();
this.name = name;
this.originalFilename = originalFilename;
this.contentType = contentType;
this.bytes = bytes;
}
public MyByteArrayMultipartFile() {
super();
// TODO Auto-generated constructor stub
}
public String getName() {
return name;
}
public String getOriginalFilename() {
return originalFilename;
}
public String getContentType() {
return contentType;
}
public byte[] getBytes() {
return bytes;
}
@NonNull
byte[] bytes;
@Override
public boolean isEmpty() {
return bytes.length == 0;
}
@Override
public long getSize() {
return bytes.length;
}
@Override
public InputStream getInputStream() {
return new ByteArrayInputStream(bytes);
}
@Override
public void transferTo(File destination) throws IOException {
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(destination);
outputStream.write(bytes);
} finally {
if (outputStream != null) {
outputStream.close();
}
}
}
}
package com.yeejoin.amos.fas.business.util;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import sun.misc.BASE64Encoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
public class WordTemplateUtils {
private static String fileUploadDir;
private Configuration configuration;
private static WordTemplateUtils wordTemplateUtils;
private WordTemplateUtils() {
configuration = new Configuration();
configuration.setDefaultEncoding("utf-8");
}
public static synchronized WordTemplateUtils getInstance() {
if (wordTemplateUtils == null) {
//添加你的内容
Properties props;
try {
props = PropertiesLoaderUtils.loadAllProperties("application-dev.properties");
fileUploadDir = (String) props.get("file.uploadUrl");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wordTemplateUtils = new WordTemplateUtils();
}
return wordTemplateUtils;
}
public void exportMillCertificateWord(HttpServletRequest request, HttpServletResponse response, Map map,
String title, String ftlFile) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null;
InputStream fin = null;
ServletOutputStream out = null;
try {
// 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
response.setCharacterEncoding("utf-8");
response.setContentType("application/msword");
// 设置浏览器以下载的方式处理该文件名
String fileName = (StringUtils.isNotEmpty(title) ? title : getUUID()) + ".doc";
response.setHeader("Content-Disposition",
"attachment;filename=".concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
out = response.getOutputStream();
// 缓冲区
byte[] buffer = new byte[512];
int bytesToRead = -1;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = fin.read(buffer)) != -1) {
out.write(buffer, 0, bytesToRead);
}
} finally {
if (fin != null) {
fin.close();
}
if (out != null) {
out.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
}
}
/**
* 生成文件名
*
* @param * @param
* @return
*/
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "");
}
public File getWordFileItem(Map map, String title, String ftlFile,String type) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File filepdf = new File("sellPlan.pdf");
File file = createDoc(map, freemarkerTemplate);
try (
// 调用工具类的createDoc方法生成Word文档
InputStream fin = new FileInputStream(file);
OutputStream os = new FileOutputStream(filepdf);
) {
wordTopdfByAspose(fin, os,type);
return filepdf;
} finally {
if (file != null) {
file.delete();
}// 删除临时文件
}
}
private static File createDoc(Map<?, ?> dataMap, Template template) {
String name = "sellPlan.doc";
File f = new File(name);
Template t = template;
try {
// 这个地方不能使用FileWriter因为需要指定编码类型否则生成的Word文档会因为有无法识别的编码而无法打开
Writer w = new OutputStreamWriter(new FileOutputStream(f), "utf-8");
t.process(dataMap, w);
w.close();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
return f;
}
public boolean wordTopdfByAspose(InputStream inputStream, OutputStream outputStream,String type) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getLicense()) {
return false;
}
try {
// 将源文件保存在com.aspose.words.Document中,具体的转换格式依靠里面的save方法
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
if("pdf".equals(type)){
doc.save(outputStream, SaveFormat.PDF);
}else {
doc.save(outputStream, SaveFormat.DOCX);
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return true;
}
// 官方文档的要求 无需理会
public static boolean getLicense() {
boolean result = false;
try {
String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 获得图片的base64码
*
* @param src 图片路径
* @return String
*/
@SuppressWarnings("deprecation")
public String getImageBase(String src) {
if (StringUtils.isEmpty(src)) {
return "";
}
src = src.replaceAll("\\.\\.", "");
String fileName = fileUploadDir + src;
File file = new File(fileName);
if (!file.exists()) {
return "";
}
byte[] data = null;
try (InputStream in = new FileInputStream(file);) {
data = new byte[in.available()];
} catch (IOException e1) {
e1.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
}
......@@ -10,6 +10,7 @@ import lombok.Data;
public class ContingencyPlanParamVo {
public Long fireEquipmentId;
public String fireEquipmentName;
public String planId;
......@@ -26,5 +27,7 @@ public class ContingencyPlanParamVo {
public String planRuleNo = "1";
}
......@@ -1138,6 +1138,37 @@
</sql>
</changeSet>
<changeSet author="keyong" id="1723705299-2">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="c_plan_report" />
</not>
</preConditions>
<comment>create table c_plan_report</comment>
<sql>
CREATE TABLE `c_plan_report` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`batch_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '预案实例编号',
`report_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报告地址',
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '活动主题',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`drill_date` datetime DEFAULT NULL COMMENT '演练时间',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '活动地点',
`compere` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '主持人',
`attend_person` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '参加人员',
`drill_topic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '演习题目',
`handle_process` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '处理过程',
`drill_summary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '演习总结',
`examine_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '审核',
`biz_org_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司名称',
`biz_org_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司编码',
`drill_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '演练类型',
`drill_equip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '演练设备',
`drill_equip_id` varchar(255) DEFAULT NULL COMMENT '演练设备Id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
</sql>
</changeSet>
<changeSet author="zs" id="20240903-1">
<preConditions onFail="MARK_RAN">
......
......@@ -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
......@@ -99,4 +105,32 @@
WHERE
`type` = #{planType}
</update>
<select id="queryPlanStepByEquipCode" resultType="java.util.Map">
SELECT
*
FROM
c_plan_step_config
WHERE
type = (
SELECT
CONVERT(plan_type USING utf8mb4)
FROM
c_plan_classify_tree
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
......@@ -16,4 +16,8 @@
</foreach>
</update>
<select id="getOneByPlanId" resultType="com.yeejoin.amos.fas.dao.entity.PlanEquipment">
SELECT * FROM c_plan_equipment WHERE plan_id = #{planId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper">
<insert id="saveInfo">
INSERT INTO `c_plan_report` (
`id`,
`batch_no`,
`report_url`,
`title`,
`create_date`,
`drill_date`,
`address`,
`compere`,
`attend_person`,
`drill_topic`,
`handle_process`,
`drill_summary`,
`examine_result`,
`biz_org_name`,
`biz_org_code`,
`drill_type`,
`drill_equip`,
`drill_equip_id`
)
VALUES
(
#{id},#{batchNo},#{reportUrl},#{title},#{createDate},#{drillDate},#{address},#{compere},#{attendPerson},#{drillTopic},#{handleProcess},#{drillSummary},#{examineResult},#{bizOrgName}, #{bizOrgCode}, #{drillType},#{drillEquip}, #{drillEquipId}
)
</insert>
<delete id="deleteById">
delete from c_plan_report where id = #{id}
</delete>
<select id="getByCount" resultType="java.lang.Integer">
SELECT
count( 1 )
FROM
c_plan_report a
<where>
<if test="drillEquipId != null and drillEquipId != ''">
a.drill_equip_id = #{drillEquipId}
</if>
<if test="drillType != null and drillType != ''">
AND a.drill_type = #{drillType}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND a.drill_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND #{endDate} >= a.drill_date
</if>
</where>
</select>
<select id="getByPage" resultType="com.yeejoin.amos.fas.dao.entity.PlanReport">
SELECT
a.*
FROM
c_plan_report a
<where>
<if test="drillEquipId != null and drillEquipId != ''">
a.drill_equip_id = #{drillEquipId}
</if>
<if test="drillType != null and drillType != ''">
AND a.drill_type = #{drillType}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND a.drill_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND #{endDate} >= a.drill_date
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != '' and sortOrder != null and sortOrder != ''">
<choose>
<when test="sortOrder == 'ascend'">
a.${sortField} ASC
</when>
<otherwise>
a.${sortField} DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
a.create_date DESC
</if>
LIMIT
#{pageNumber},#{pageSize}
</select>
<select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.PlanReport">
select * from c_plan_report where id = #{id}
</select>
<select id="getByBatchNo" resultType="com.yeejoin.amos.fas.dao.entity.PlanReport">
select * from c_plan_report where batch_no = #{batchNo}
</select>
<update id="updateReportById">
UPDATE
`c_plan_report`
SET `batch_no` = #{batchNo},
`report_url` = #{reportUrl},
`title` = #{title},
`create_date` = #{createDate},
`drill_date` = #{drillDate},
`address` = #{address},
`compere` = #{compere},
`attend_person` = #{attendPerson},
`drill_topic` = #{drillTopic},
`handle_process` = #{handleProcess},
`drill_summary` = #{drillSummary},
`examine_result` = #{examineResult},
`biz_org_name` = #{bizOrgName},
`biz_org_code` = #{bizOrgCode},
`drill_type` = #{drillType},
`drill_equip` = #{drillEquip},
`drill_equip_id` = #{drillEquipId}
WHERE `id` = #{id};
</update>
</mapper>
\ No newline at end of file
......@@ -142,7 +142,7 @@
<choose>
<when test = "outAndOr != null and outAndOr != '' and outAndOr == 'and'">
<if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="and">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode}
</foreach>
</if>
......@@ -180,7 +180,7 @@
<choose>
<when test = "outAndOr != null and outAndOr != '' and outAndOr == 'and'">
<if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="and">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode} and esi.`value` = #{item.standardValue}
</foreach>
</if>
......
[
{
"stepCode": "0",
"stepName": "确认火情",
"stepStatus": "0",
"buttonCode": "FIRE_CONFIRM",
"checkYesOrNo": "",
"index": 0,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 0,
"checkYesOrNo": ""
"showLine": false,
"stepCode": "0",
"stepName": "确认火情",
"stepStatus": "0",
"time": "",
"videos": {
"011020000000000005037148": [
{
"code": "02160558348620370101#ab53af9ab7a143f6961559c403a4b5cc",
"name": "主控楼3楼平台-东-25#枪机"
},
{
"code": "02160558348620370102#ab53af9ab7a143f6961559c403a4b5cc",
"name": "主控楼楼顶-北-26#枪机"
},
{
"code": "02160558348620370103#ab53af9ab7a143f6961559c403a4b5cc",
"name": "主控楼3楼平台-南-27#枪机"
}
],
"011020000000000005037216": [
{
"code": "02160558348620370101#ab53af9ab7a143f6961559c403a4b5cc",
"name": "主控楼3楼平台-东-25#枪机"
}
]
}
},
{
"stepCode": "1",
"stepName": "汇报,通知,报警",
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"checkYesOrNo": "",
"index": 1,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 1,
"checkYesOrNo": ""
"showLine": false,
"stepCode": "1",
"stepName": "汇报,通知,报警",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"stepCode": "2",
"stepName": "确认开关跳闸",
"stepStatus": "0",
"buttonCode": "OPEN_THREE_SIDE_SWITCHES",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"checkYesOrNo": "",
"index": 2,
"isAuto": 0,
"checkYesOrNo": ""
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"showLine": false,
"stepCode": "2",
"stepName": "确认开关跳闸",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"stepCode": "3",
"stepName": "检查固定喷雾灭火设施启动",
"stepStatus": "0",
"buttonCode": "OPEN_SPRAYINGSYSTEM",
"checkYesOrNo": "",
"index": 3,
"isAuto": 0,
"isParallel": "0",
"outAndOr": "and",
"roleCode": "Digital_Responsing_Plan_A",
"index": 3,
"condition": [
"showLine": false,
"stepCode": "3",
"stepName": "检查固定喷雾灭火设施启动",
"stepStatus": "0",
"time": "",
"videos": {
"011020000000000005037148": [
{
"equipName": "主机",
"equipCode": "92030100TGX44",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "CAFS_CompAirFoamHost_Outfire",
"standardValue": "true",
"inAndOr": "and"
"code": "02160558346497790101#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-综合楼4楼走廊-北侧-1#球机"
},
{
"code": "02160558346497790102#ab53af9ab7a143f6961559c403a4b5cc",
"name": "800kV绍兴变-综合楼4楼走廊南侧2"
}
]
}
],
"outAndOr": "and",
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "4",
"stepName": "启动CAFS消防系统",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM",
"checkYesOrNo": "",
"index": 4,
"isAuto": 0,
"isParallel": "0",
"outAndOr": "and",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4,
"checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"standardValue": "true",
"inAndOr": "and"
"showLine": false,
"stepCode": "4",
"stepName": "启动CAFS消防系统",
"stepStatus": "0",
"time": "",
"videos": {
}
],
"outAndOr": "and",
"isAuto": 0
},
{
"buttonCode": "DRAIN_OIL_CONFIRM",
"checkYesOrNo": "",
"index": 5,
"isAuto": 0,
"isParallel": "0",
"outAndOr": "and",
"roleCode": "Digital_Responsing_Plan_A",
"showLine": false,
"stepCode": "5",
"stepName": "启动CAFS举高灭火机器人",
"stepName": "启动应急排油",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "START_TURBOFAN_ROBOT",
"checkYesOrNo": "",
"index": 6,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 5,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "6",
"stepName": "申请调检修",
"stepName": "启动CAFS举高灭火机器人",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "APPLY_FOR_OVERHAUL",
"checkYesOrNo": "",
"index": 7,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 6,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "7",
"stepName": "断开交、直流电源",
"stepName": "申请调检修",
"stepStatus": "0",
"time": "",
"videos": {
"011020000000000005037148": [
{
"code": "02160558346973140133#ab53af9ab7a143f6961559c403a4b5cc",
"name": "极2高400KV穿墙套管区域_A18可见光"
},
{
"code": "02160558346973140134#ab53af9ab7a143f6961559c403a4b5cc",
"name": "极2高400KV穿墙套管区域_A18热成像"
},
{
"code": "02160558346497790127#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高蓄电池室1-西北角-27#球机"
},
{
"code": "02160558346497790128#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高阀冷设备室-东北角-28#球机"
},
{
"code": "02160558346497790131#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高阀冷设备室-西南角-31#球机"
},
{
"code": "02160558346497790133#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高阀冷控制室-东南角-33#球机"
},
{
"code": "02160558346497790134#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高控保辅助设备-东南角-34#球机"
},
{
"code": "02160558346497790135#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高蓄电池室3-西北角-35#球机"
},
{
"code": "02160558346497790136#ab53af9ab7a143f6961559c403a4b5cc",
"name": "绍兴变-极2高蓄电池室2-西南角-36#球机"
}
]
}
},
{
"buttonCode": "OFF_POWER",
"checkYesOrNo": "",
"index": 8,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 7,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "8",
"stepName": "执行转检修操作",
"stepName": "断开交、直流电源",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"checkYesOrNo": "",
"index": 9,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 8,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "9",
"stepName": "电缆沟封堵",
"stepName": "执行转检修操作",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "PLUG_CABLETRENCH",
"checkYesOrNo": "",
"index": 10,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 9,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "10",
"stepName": "政府消防队指挥权交接",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "HANDOVER_FIGTHHING",
"checkYesOrNo": "",
"index": 11,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 10,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "11",
"stepName": "确认明火扑灭,确认着火设备温度降为环境温度",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "FIRE_EXTINCT",
"checkYesOrNo": "",
"index": 12,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 11,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "12",
"stepName": "检查现场情况,汇报调度",
"stepName": "确认明火扑灭,确认着火设备温度降为环境温度",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "ACCIDENT_REPORT",
"checkYesOrNo": "",
"index": 13,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 12,
"checkYesOrNo": ""
},
{
"showLine": false,
"stepCode": "13",
"stepName": "退出预案",
"stepName": "检查现场情况,汇报调度",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "END_EMERGENCY",
"checkYesOrNo": "",
"index": 14,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"index": 13,
"checkYesOrNo": ""
"showLine": false,
"stepCode": "14",
"stepName": "退出预案",
"stepStatus": "0",
"time": "",
"videos": {
}
}
]
\ 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