MrShi
2025-04-11 3a45da15c947c2d478a44a51bd0f926647b1b841
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -399,10 +399,17 @@
                    || saveUnionChangeDTO.getAddValidDate().getTime()> unionApply.getEndTime().getTime()){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单加保生效期错误");
            }
            if(saveUnionChangeDTO.getDelValidDate().getTime()<unionApply.getStartTime().getTime()
                    || saveUnionChangeDTO.getDelValidDate().getTime()> unionApply.getEndTime().getTime()){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单减保生效期错误");
            }
            //加入 查询是否存在减保的数据  如果存在减保数据 进行该日期的判断 2024年7月30日16:38:18
            if(applyChagneDetailJoinMapper.selectCount(new QueryWrapper<ApplyChagneDetail>().lambda()
                            .eq(ApplyChagneDetail::getType,Constants.ONE)
                    .in(ApplyChagneDetail::getApplyChangeId,saveUnionChangeDTO.getApplyIds()))>Constants.ZERO){
                if(saveUnionChangeDTO.getDelValidDate().getTime()<unionApply.getStartTime().getTime()
                        || saveUnionChangeDTO.getDelValidDate().getTime()> unionApply.getEndTime().getTime()){
                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单减保生效期错误");
                }
            };
        }else{
            if(saveUnionChangeDTO.getApplyDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime()
                    || saveUnionChangeDTO.getApplyDate().getTime()> unionApply.getEndTime().getTime()){
@@ -410,7 +417,6 @@
            }
            saveUnionChangeDTO.setAddValidDate(saveUnionChangeDTO.getApplyDate());
        }
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,
                new MPJLambdaWrapper<ApplyChange>()
@@ -421,7 +427,7 @@
                        .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.CHECHED_PASSED.getKey())
                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey())
                        .eq(ApplyChange::getType,saveUnionChangeDTO.getBusinessType())
                        .le(ApplyChange::getApplyStartTime,DateUtil.getCurrDateTime())
//                        .le(InsuranceApply::getStartTime,DateUtil.getCurrDateTime())
                        .in(ApplyChange::getId,saveUnionChangeDTO.getApplyIds())
                        .isNull(ApplyChange::getUnionChangeId)
        );
@@ -456,6 +462,8 @@
        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
@@ -789,6 +797,7 @@
                                .selectAs(DispatchUnit::getName, ApplyChagneDetail::getDuName)
                                .selectAs(Member::getName, ApplyChagneDetail::getMemberName)
                                .selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName)
                                .selectAs(Solutions::getId,ApplyChagneDetail::getSolutionId)
                                .selectAs(InsuranceApply::getCode,ApplyChagneDetail::getApplyCode)
                                .selectAs(InsuranceApply::getServerCost,ApplyChagneDetail::getServerCost)
                                .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId)
@@ -845,6 +854,7 @@
        List<ApplyChagneDetail> reduceList = applyChagneDetailList.stream().filter(f->Constants.equalsInteger(f.getType(),Constants.ONE)).collect(Collectors.toList());
        List<ApplyChagneDetail> changeList = applyChagneDetailList.stream().filter(f->Constants.equalsInteger(f.getType(),Constants.TWO)).collect(Collectors.toList());
        for (ApplyChagneDetail detail:reduceList) {
            solutions = solutionsMapper.selectById(detail.getSolutionId());
            Member member = memberMapper.selectById(detail.getMemberId());
            if(Objects.isNull(member)){
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到员工数据");
@@ -858,6 +868,7 @@
            if(Objects.isNull(member)){
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到员工数据");
            }
            solutions = solutionsMapper.selectById(detail.getSolutionId());
            this.addChangeDetailData(applyChange,detail,insuranceApply,solutions,bigDecimalVO,reduceList,i);
        }