k94314517
2024-04-01 d281d0d8bda64e2296f7fce8268cfc10bc5b23d0
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -2017,32 +2017,32 @@
        if(multifiles!=null && multifiles.size()>0){
            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
                    +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
                for(InsuranceApply model : list){
                    for(Multifile f : multifiles) {
                        if (StringUtils.isBlank(f.getFileurl())) {
                            continue;
                        }
                        f.setFileurlFull(path+f.getFileurl());
                        if(Constants.equalsInteger(f.getObjId(), model.getId()) ){
                            if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_APPLY_PDF.getKey())) {
                                //签署前的投保单
                                model.setToubaodanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_SIGNED_PDF.getKey())) {
                                //签署后的投保单
                                model.setToubaodanSignedFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_DONE_PDF.getKey())) {
                                //最終保险单
                                model.setBaoxiandanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.MEMBER_LIST_LATTER.getKey())) {
                                //申请单
                                model.setShenqingdanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.WTB_CONFIRMATION_LATTER.getKey())) {
                                //签署后确认书
                                model.setFanganFile(f);
                            }
            for(InsuranceApply model : list){
                for(Multifile f : multifiles) {
                    if (StringUtils.isBlank(f.getFileurl())) {
                        continue;
                    }
                    f.setFileurlFull(path+f.getFileurl());
                    if(Constants.equalsInteger(f.getObjId(), model.getId()) ){
                        if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_APPLY_PDF.getKey())) {
                            //签署前的投保单
                            model.setToubaodanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_SIGNED_PDF.getKey())) {
                            //签署后的投保单
                            model.setToubaodanSignedFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_DONE_PDF.getKey())) {
                            //最終保险单
                            model.setBaoxiandanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.MEMBER_LIST_LATTER.getKey())) {
                            //申请单
                            model.setShenqingdanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.WTB_CONFIRMATION_LATTER.getKey())) {
                            //签署后确认书
                            model.setFanganFile(f);
                        }
                    }
                }
            }
        }
    }
@@ -2330,11 +2330,12 @@
     * 更新保单实际金额
     */
    @Override
    @Transactional(rollbackFor = {Exception.class})
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void updateApplyCurrentFee(Integer id){
        List<InsuranceApply> insuranceApplyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>().lambda()
        List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>()
                .selectAll(InsuranceApply.class)
                .eq(InsuranceApply::getIsdeleted,Constants.ZERO)
                .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
                .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey())
                .eq(!Objects.isNull(id),InsuranceApply::getId,id)
                .le(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00")
                .ge(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59")
@@ -2342,20 +2343,23 @@
        if(CollectionUtils.isNotEmpty(insuranceApplyList)){
            for (InsuranceApply insuranceApply:insuranceApplyList) {
                Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
                if(Objects.isNull(solutions)){
                    continue;
                }
//                Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
//                if(Objects.isNull(solutions)){
//                    continue;
//                }
                BigDecimal sumAmount = BigDecimal.ZERO;
                List<ApplyDetail> applyDetailList = applyDetailMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId()));
                List<ApplyDetail> applyDetailList = applyDetailMapper
                        .selectList(new QueryWrapper<ApplyDetail>().lambda()
                                .eq(ApplyDetail::getApplyId,insuranceApply.getId()));
                if(CollectionUtils.isNotEmpty(applyDetailList)){
                    for (ApplyDetail applyDetail: applyDetailList) {
                        //2024-1-30 10:04:24 修改 根据实际天数进行计算 当前费用  总金额/总天数*实际天数
                        Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0);
//                        Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0);
                        BigDecimal fee = applyDetail.getFee();
                        if(applyDetail.getStartTime().compareTo(new Date()) <= 0 && applyDetail.getEndTime().compareTo(new Date()) >= 0 ){
                            Integer days =  DateUtil.calculateBetween(applyDetail.getStartTime(),new Date(),0);
                            applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days)));
                            applyDetail.setCurrentFee(new BigDecimal(days).multiply(applyDetail.getPrice()));
                            //applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days)));
                            applyDetailMapper.updateById(applyDetail);
                        }else if(applyDetail.getStartTime().compareTo(new Date()) <= 0&&applyDetail.getEndTime().compareTo(new Date()) <= 0){
                            applyDetail.setCurrentFee(fee);
@@ -2368,10 +2372,6 @@
                insuranceApplyMapper.updateById(insuranceApply);
            }
        }
//        if(1==1){
//            throw new BusinessException(ResponseStatus.NOT_ALLOWED);
//        }
    }