jiangping
2024-05-08 be0301e67768fb183df7e29f411a7e54dbf15c40
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -352,7 +352,8 @@
        }
        if(Objects.isNull(saveUnionChangeDTO)
                || Objects.isNull(saveUnionChangeDTO.getApplyIds())
                || Objects.isNull(saveUnionChangeDTO.getApplyDate())
                || Objects.isNull(saveUnionChangeDTO.getAddValidDate())
                || Objects.isNull(saveUnionChangeDTO.getDelValidDate())
                || Objects.isNull(saveUnionChangeDTO.getUnionApplyId())
                || Objects.isNull(saveUnionChangeDTO.getBusinessType())
        ){
@@ -365,9 +366,13 @@
        }
        //判断批单日期 合并单的批单生效期在为 保单起期的次日 到保单止期
        //获取开始日期次日
        if(saveUnionChangeDTO.getApplyDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
        || saveUnionChangeDTO.getApplyDate().getTime()> unionApply.getEndTime().getTime()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单生效期错误");
        if(saveUnionChangeDTO.getAddValidDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
        || saveUnionChangeDTO.getAddValidDate().getTime()> unionApply.getEndTime().getTime()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单加保生效期错误");
        }
        if(saveUnionChangeDTO.getDelValidDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
                || saveUnionChangeDTO.getDelValidDate().getTime()> unionApply.getEndTime().getTime()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单加保生效期错误");
        }
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,
@@ -395,7 +400,8 @@
        unionChange.setShopId(user.getCompanyId());
        unionChange.setIsdeleted(Constants.ZERO);
        unionChange.setUnionApplyId(saveUnionChangeDTO.getUnionApplyId());
        unionChange.setApplyStartTime(DateUtil.getMontageDate(saveUnionChangeDTO.getApplyDate(),1));
        unionChange.setApplyStartTime(DateUtil.getMontageDate(saveUnionChangeDTO.getAddValidDate(),1));
        unionChange.setDelValidTime(DateUtil.getMontageDate(saveUnionChangeDTO.getDelValidDate(),1));
        unionChange.setType(saveUnionChangeDTO.getBusinessType());
        unionChange.setStatus(Constants.UnionChangeStatus.MERGE.getKey());
        unionChangeMapper.insert(unionChange);
@@ -411,7 +417,6 @@
        applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
                .set(ApplyChagneDetail::getUnionChangeId,unionChange.getId())
                .in(ApplyChagneDetail::getApplyChangeId,saveUnionChangeDTO.getApplyIds()));
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD;
        ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), null
@@ -552,14 +557,14 @@
    public  String getSignLink(SmsCheckDTO smsCheckDTO) {
        if(Objects.isNull(smsCheckDTO)
                || Objects.isNull(smsCheckDTO.getBusinessId())
                || StringUtils.isBlank(smsCheckDTO.getCode())
//                || StringUtils.isBlank(smsCheckDTO.getCode())
        ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        //验证 验证码
        if(!debugModel){
            smsEmailService.validateCode(smsCheckDTO.getCode());
        }
//        if(!debugModel){
//            smsEmailService.validateCode(smsCheckDTO.getCode());
//        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        UnionChange unionChange = this.unionChangeDetail(smsCheckDTO.getBusinessId());
        unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus()));
@@ -654,8 +659,13 @@
        //获取开始日期次日
        if(unionChangeBXDDTO.getApplyDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
                || unionChangeBXDDTO.getApplyDate().getTime()> unionApply.getEndTime().getTime()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单生效期错误");
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单加保生效期错误");
        }
        if(unionChangeBXDDTO.getDelValidTime().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
                || unionChangeBXDDTO.getDelValidTime().getTime()> unionApply.getEndTime().getTime()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单减保生效期错误");
        }
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,
                new MPJLambdaWrapper<ApplyChange>()
@@ -712,7 +722,8 @@
            for (ApplyChange applyChange:applyChangeList) {
                ApplyChange oldModel = applyChange;
                applyChange.setApplyStartTime(unionChangeBXDDTO.getApplyDate());
                applyChange.setValidTime(unionChangeBXDDTO.getApplyDate());
                applyChange.setDelValidTime(unionChangeBXDDTO.getDelValidTime());
//                applyChange.setValidTime(unionChangeBXDDTO.getApplyDate());
                applyChange.setEditDate(new Date());
                applyChange.setEditor(user.getId());
                applyChange.setStatus(Constants.ApplyChangeStatus.APPROVE.getKey());
@@ -836,6 +847,9 @@
        ApplyDetail add = new ApplyDetail();
        if(new Date().compareTo(DateUtil.getMontageDate(applyChange.getApplyStartTime(), 2))>=0){
            Integer days =  DateUtil.calculateBetween(applyChange.getApplyStartTime(),DateUtil.getMontageDate(new Date(), 2),0);
            //如果已已产生费用,计算已已产生费用
            add.setCurrentFee(new BigDecimal(days).multiply(detail.getPrice()));
        }else{