lyh
4 天以前 0bc74278ff8130936bc7aed763e8901fedb4f3b0
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java
@@ -12,6 +12,7 @@
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
@@ -63,6 +64,10 @@
    private IEamRepairOrderService iEamRepairOrderService;
    @Autowired
    private ISysBusinessCodeRuleService businessCodeRuleService;
    @Autowired
    private IEamReportThreeNoSpareService eamReportThreeNoSpareService;
    @Autowired
    private IEamBaseHFCodeService hfCodeService;
    /**
     * 分页列表
     *
@@ -197,18 +202,45 @@
            EamReportProductHazards eamReportProductHazards=new EamReportProductHazards();
            eamReportProductHazards.setEquipmentId(eamReportRepair.getEquipmentId());
            eamReportProductHazards.setReportId(eamReportRepair.getId());
            eamReportProductHazards.setDelFlag(Integer.valueOf(CommonConstant.DEFAULT_0));
            eamReportProductHazards.setConfirmStatus(EamReportProductHazardsEnum.PENDING_SUBMIT.name());
            EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.REPORT_PRODUCT_HAZARDS.name());
            if (eamBaseHFCode == null) {
                throw new JeecgBootException("未配置产品安全隐患确认的HF编码,添加失败!");
            }
            eamReportProductHazards.setHfCode(eamBaseHFCode.getHfCode());
            iEamReportProductHazardsService.save(eamReportProductHazards);
        }
        if (StrUtil.isNotEmpty(eamReportRepair.getIsAccidentsRegister())&&("1").equals(eamReportRepair.getIsAccidentsRegister())) {
            //添加设备事故登记表
            EamReportAccidentsRegister eamReportAccidentsRegister = new EamReportAccidentsRegister();
            BeanUtils.copyProperties(eamReportRepairRequest, eamReportAccidentsRegister);
            eamReportAccidentsRegister.setId(null);
            eamReportAccidentsRegister.setReportId(eamReportRepair.getId());
            eamReportAccidentsRegister.setDelFlag(Integer.valueOf(CommonConstant.DEFAULT_0));
            eamReportAccidentsRegister.setRegisterStatus(EamReportAccidentsRegisterEnum.PENDING_SUBMIT.name());
            EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.REPORT_ACCIDENTS_REGISTER.name());
            if (eamBaseHFCode == null) {
                throw new JeecgBootException("未配置设备事故登记表的HF编码,添加失败!");
            }
            eamReportAccidentsRegister.setHfCode(eamBaseHFCode.getHfCode());
            iEamReportAccidentsRegisterService.save(eamReportAccidentsRegister);
            //生成三不原则
            EamReportThreeNoSpare eamReportThreeNoSpare = new EamReportThreeNoSpare();
            BeanUtils.copyProperties(eamReportRepairRequest, eamReportThreeNoSpare);
            eamReportThreeNoSpare.setId(null);
            eamReportThreeNoSpare.setReportId(eamReportRepair.getId());
            eamReportThreeNoSpare.setPreventionMeasures(eamReportAccidentsRegister.getTakeSteps());
            eamReportThreeNoSpare.setSubmitStatus(EamReportThreeNoSpareEnum.PENDING_SUBMIT.name());
            eamReportThreeNoSpare.setDelFlag(Integer.valueOf(CommonConstant.DEFAULT_0));
            EamBaseHFCode threeHfCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.REPORT_THREE_NO_SPARE.name());
            if (threeHfCode == null) {
                throw new JeecgBootException("未配置三不放过原则表的HF编码,添加失败!");
            }
            eamReportThreeNoSpare.setHfCode(threeHfCode.getHfCode());
            eamReportThreeNoSpareService.save(eamReportThreeNoSpare);
        }
        //生成维修工单,可能会有领取操作
        //生成维修工单
        EamRepairOrder eamRepairOrder=new EamRepairOrder();
        BeanUtils.copyProperties(eamReportRepairRequest, eamRepairOrder);
        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.REPAIR_ORDER_CODE_RULE);