Commit e3d3fb78 authored by 田涛's avatar 田涛

预案代码合并

parent 5022aa0f
......@@ -666,7 +666,7 @@ public class ContingencyAction implements CustomerAction {
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if(optionalPlanDetail.get()!=null){
PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(Integer.parseInt(ContingencyPlanStatusEnum.AVAILABLE.getCode()));
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
planDetailDao.save(planDetail);
}
}
......
......@@ -164,8 +164,6 @@ public class ContingencyPlanController extends BaseController {
}
}
@Autowired
private ContingencyPlanService contingencyPlanService;
@ApiOperation(value = "启动")
@RequestMapping(value = "/start", method = RequestMethod.POST)
public ResponseModel start(@RequestBody ContingencyPlanParamVo vo) {
......
......@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository("iEquipmentFireEquipmentDao")
@Repository
public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipment, Long> {
/**
......
package com.yeejoin.amos.fas.business.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.dao.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.util.*;
import java.util.*;
......@@ -41,8 +30,7 @@ import java.util.*;
*/
@Service
public class ContingencyPlanServiceImpl implements ContingencyPlanService {
@Autowired
private IPlanDetailDao planDetailDao;
@Autowired
private IEquipmentService equipmentService;
@Autowired
......@@ -55,10 +43,35 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
@Qualifier("iEquipmentDao")
@Autowired
private IEquipmentDao equipmentDao;
private final PlanOperationRecordMapper planOperationRecordMapper;
private final IPlanDetailDao planDetailDao;
private final IPlanDocDao planDocDao;
private final IPlanEquipmentDao planEquipmentDao;
private final IPlanRuleDao planRuleDao;
private final IPlanClassifyTreeDao classifyTreeDao;
private final PlanDetailMapper planDetailMapper;
private final PlanEquipmentMapper planEquipmentMapper;
private final PlanRuleMapper planRuleMapper;
private final PlanDocMapper planDocMapper;
@Autowired
private IPlanEquipmentDao planEquipmentDao;
@Autowired
private PlanOperationRecordMapper planOperationRecordMapper;
public ContingencyPlanServiceImpl(IPlanDetailDao planDetailDao, IPlanDocDao planDocDao, IPlanEquipmentDao planEquipmentDao,
IPlanRuleDao planRuleDao, IPlanClassifyTreeDao classifyTreeDao, PlanDetailMapper planDetailMapper,
PlanEquipmentMapper planEquipmentMapper, PlanRuleMapper planRuleMapper, PlanDocMapper planDocMapper,
PlanOperationRecordMapper planOperationRecordMapper) {
this.planDetailDao = planDetailDao;
this.planDocDao = planDocDao;
this.planEquipmentDao = planEquipmentDao;
this.planRuleDao = planRuleDao;
this.classifyTreeDao = classifyTreeDao;
this.planDetailMapper = planDetailMapper;
this.planEquipmentMapper = planEquipmentMapper;
this.planRuleMapper = planRuleMapper;
this.planDocMapper = planDocMapper;
this.planOperationRecordMapper = planOperationRecordMapper;
}
@Override
public String planStart(ContingencyPlanParamVo vo){
ReserveEnum reserveEnum= null;
......@@ -87,16 +100,16 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
planOperationRecord.setPlanId(PlanDetailOp.get().getId());
planOperationRecord.setIsDelete(true);
planOperationRecord.setStartTime(new Date());
planOperationRecord.setPlanPattern(Integer.parseInt(vo.getStatus()));
planOperationRecord.setPlanPattern(vo.getStatus());
PlanOperationRecord result = planOperationRecordDao.save(planOperationRecord);
//预案启动
if(PlanDetailOp.get()!=null){
Equipment equipment = equipmentService.queryOne(PlanDetailOp.get().getId());
//预案启动
reserveEnum = riskSourceService.startEquipReserve(equipment.getId(),equipment.getCode(),result.getId());
if(ReserveEnum.RUN.getStatus() == reserveEnum.getStatus()){
PlanDetail planDetail = PlanDetailOp.get();
planDetail.setStatus(Integer.parseInt(ContingencyPlanStatusEnum.SIMULATION_START.getCode()));
if(ReserveEnum.RUN == reserveEnum){
PlanDetail planDetail = PlanDetailOp.get();
planDetail.setStatus(ContingencyPlanStatusEnum.SIMULATION_START.getCode());
planDetailDao.save(planDetail);
}
}
......@@ -108,9 +121,9 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
ContingencyPlanParamVo vo = null;
List<EquipmentFireEquipment> equipmentFireEquipmentList = equipmentFireEquipmentDao.findAllByEquipmentId(equipmentId);
if(equipmentFireEquipmentList.size()>0){
Optional<Equipment> equipmentOptional = equipmentDao.findById(equipmentFireEquipmentList.get(0).getEquipmentId());
if(equipmentOptional.get()!=null){
PlanEquipment planEquipment = planEquipmentDao.findByFireEquipmentId(equipmentOptional.get().getId());
Equipment equipment = equipmentDao.findById(equipmentFireEquipmentList.get(0).getEquipmentId()).orElse(null);
if(equipment!=null){
PlanEquipment planEquipment = planEquipmentDao.findByFireEquipmentId(equipment.getId());
if(planEquipment!=null){
vo =new ContingencyPlanParamVo();
vo.setPlanId(planEquipment.getPlanId().toString());
......@@ -138,31 +151,6 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
return page;
}
private final IPlanDetailDao planDetailDao;
private final IPlanDocDao planDocDao;
private final IPlanEquipmentDao planEquipmentDao;
private final IPlanRuleDao planRuleDao;
private final IPlanClassifyTreeDao classifyTreeDao;
private final PlanDetailMapper planDetailMapper;
PlanEquipmentMapper planEquipmentMapper;
PlanRuleMapper planRuleMapper;
PlanDocMapper planDocMapper;
@Autowired
public ContingencyPlanServiceImpl(IPlanDetailDao planDetailDao, IPlanDocDao planDocDao, IPlanEquipmentDao planEquipmentDao,
IPlanRuleDao planRuleDao, IPlanClassifyTreeDao classifyTreeDao, PlanDetailMapper planDetailMapper,
PlanEquipmentMapper planEquipmentMapper, PlanRuleMapper planRuleMapper, PlanDocMapper planDocMapper) {
this.planDetailDao = planDetailDao;
this.planDocDao = planDocDao;
this.planEquipmentDao = planEquipmentDao;
this.planRuleDao = planRuleDao;
this.classifyTreeDao = classifyTreeDao;
this.planDetailMapper = planDetailMapper;
this.planEquipmentMapper = planEquipmentMapper;
this.planRuleMapper = planRuleMapper;
this.planDocMapper = planDocMapper;
}
@Override
public PlanDetailVo createPlan(PlanDetailVo planDetail) {
PlanDoc planDoc = planDetail.getPlanDoc();
......
......@@ -6,7 +6,7 @@ public class ContingencyPlanParamVo {
public String planId;
public String status;
public Integer status;
public String getPlanId() {
return planId;
......@@ -16,11 +16,11 @@ public class ContingencyPlanParamVo {
this.planId = planId;
}
public String getStatus() {
public Integer getStatus() {
return status;
}
public void setStatus(String status) {
public void setStatus(Integer status) {
this.status = status;
}
}
......
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