songhuangfeng123
2022-09-15 1341b18605bcb800eba683eda18640520a6508a5
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
@@ -11,6 +11,7 @@
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.entity.*;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.enums.WorkInjuryTypeEnum;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.req.WorkInjuryDeclarationFileReqDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.req.WorkInjuryDeclarationReqDTO;
@@ -232,41 +233,48 @@
    }
    /**
     * 验证必填项
     *
     * @return
     */
    private void checkRequired(WorkInjuryDeclarationReqDTO WorkInjuryDeclarationReqDTO) {
    private void checkRequired(WorkInjuryDeclarationReqDTO workInjuryDeclarationReqDTO) {
        //申报人姓名
        if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getDeclareUserName())) {
        if (StringUtils.isBlank(workInjuryDeclarationReqDTO.getDeclareUserName())) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NULL);
        }
        //事故性别
        if (WorkInjuryDeclarationReqDTO.getDeclareUserGender() == null ) {
        if (workInjuryDeclarationReqDTO.getDeclareUserGender() == null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_GENDER_NULL);
        }
        //申报人部门
        if (WorkInjuryDeclarationReqDTO.getDeclareDepartmentId()==null) {
        if (workInjuryDeclarationReqDTO.getDeclareDepartmentId() == null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NOT_EXIST);
        }
        //事故名称
        if (WorkInjuryDeclarationReqDTO.getAccidentExpressId() == null ) {
        if (workInjuryDeclarationReqDTO.getAccidentExpressId() == null) {
            throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
        }
        AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(WorkInjuryDeclarationReqDTO.getAccidentExpressId());
        AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(workInjuryDeclarationReqDTO.getAccidentExpressId());
        if (accidentExpressInfo == null) {
            throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
        }
        //工伤类型
        if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getWorkInjuryType())) {
        if (workInjuryDeclarationReqDTO.getWorkInjuryType() == null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_TYPE_NULL);
        }
        //申报日期
        if (WorkInjuryDeclarationReqDTO.getDeclareDate()==null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_Date_NULL);
        if (workInjuryDeclarationReqDTO.getDeclareDate() == null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_DATA_NULL);
        }
    }
    /**
     * 枚举验证
     */
    private void checkEnum(WorkInjuryDeclarationReqDTO workInjuryDeclarationReqDTO) {
        if (WorkInjuryTypeEnum.getByCode(workInjuryDeclarationReqDTO.getWorkInjuryType()) == null) {
            throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_ENUMS_TYPE_NOT_EXIST);
        }
    }
}