k94314517
2024-04-09 02bc3bfe47e3d5311a0bb041c94e70a34b1ca73c
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -1096,6 +1096,8 @@
            if (applyChange.getValidTime().compareTo(applyDetail.getEndTime()) > 0) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】保单保障日期至:【" + applyDetail.getEndTime() + "】无法通过本次申请");
            }
            applyChagneDetail.setPrice(applyDetail.getPrice());
            applyChagneDetail.setCreateDate(new Date());
            applyChagneDetail.setCreator(loginUserInfo.getId());
            applyChagneDetail.setIsdeleted(Constants.ZERO);
@@ -1149,6 +1151,13 @@
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,加保人员【" + applyChagneDetail.getMemberName() + "】存在日期冲突的数据");
            }
            ApplyDetail applyDetail = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>()
                            .lambda()
                            .eq(ApplyDetail::getApplyId,applyChange.getApplyId()).last("limit 1"));
            if(Objects.isNull(applyDetail)){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "保单中未存在明细记录");
            }
            applyChagneDetail.setPrice(applyDetail.getPrice());
            applyChagneDetail.setCreateDate(new Date());
            applyChagneDetail.setCreator(loginUserInfo.getId());
            applyChagneDetail.setIsdeleted(Constants.ZERO);
@@ -1318,6 +1327,7 @@
            && applyChagneDetail.getOldWorktypeId().equals(applyChagneDetail.getWorktypeId())){
                throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】换厂数据相同!");
            }
            applyChagneDetail.setPrice(applyDetail.getPrice());
            applyChagneDetail.setCreateDate(new Date());
            applyChagneDetail.setCreator(loginUserInfo.getId());
            applyChagneDetail.setIsdeleted(Constants.ZERO);
@@ -1517,6 +1527,9 @@
        queryWrapper
                .selectAll(ApplyChange.class)
                .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
                .selectAs(InsuranceApply::getStartTime,ApplyChange::getStartTime)
                .selectAs(InsuranceApply::getCode,ApplyChange::getValidCode)
                .selectAs(InsuranceApply::getEndTime,ApplyChange::getEndTime)
                .selectAs(Solutions::getName,ApplyChange::getSolutionsName)
                .selectAs(Solutions::getType,ApplyChange::getSolutionType)
                .selectAs(Company::getName,ApplyChange::getCompanyName)
@@ -1537,6 +1550,7 @@
//                .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId())
                .eq(!Objects.isNull(model.getSolutionType()),Solutions::getType,model.getSolutionType())
                .eq(!Objects.isNull(model.getApplyId()),ApplyChange::getApplyId,model.getApplyId())
                .eq(!Objects.isNull(model.getUnionChangeId()),ApplyChange::getUnionChangeId,model.getUnionChangeId())
                .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId())
                .like(StringUtils.isNotBlank(model.getSolutionsName()),Solutions::getName,model.getSolutionsName())
                .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" )
@@ -1567,7 +1581,46 @@
        }
        queryWrapper.orderByDesc(ApplyDetail::getCreateDate);
        return applyChangeJoinMapper.selectJoinList(ApplyChange.class,queryWrapper);
        List<ApplyChange> list =applyChangeJoinMapper.selectJoinList(ApplyChange.class,queryWrapper);
        if(Constants.equalsObject(model.getGetFiles(),Constants.ONE)){
            //如果是合并单,需要查询附件信息
            initFileForList(list);
        }
        return list;
    }
    private void initFileForList(List<ApplyChange> list) {
        List<Integer> objList =  new ArrayList<>();
        if(list!=null && list.size()>0){
            for(ApplyChange param : list){
                objList.add(param.getId());
            }
        }else{
            return;
        }
        List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
                .in(Multifile::getObjId,objList)
                .in(Multifile::getObjType,Arrays.asList(new Integer[]{Constants.MultiFile.CA_PD_PDF.getKey()}))
                .eq(Multifile::getIsdeleted,Constants.ZERO)
                .orderByAsc(Multifile::getId));
        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(ApplyChange 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.CA_PD_PDF.getKey())) {
                            //签署前的投保单
                            model.setPidanFile(f);
                        }
                    }
                }
            }
        }
    }
@@ -1727,9 +1780,9 @@
        List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
                .eq(Multifile::getObjId, applyChange.getId() )
                .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.CA_APPLY_JIAJIAN_SIGN.getKey()
                        ,Constants.MultiFile.CA_PD_PDF.getKey()
                        ,Constants.MultiFile.CA_APPLY_CHANGEUNIT_SIGN.getKey()}))
//                .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.CA_APPLY_JIAJIAN_SIGN.getKey()
//                        ,Constants.MultiFile.CA_PD_PDF.getKey()
//                        ,Constants.MultiFile.CA_APPLY_CHANGEUNIT_SIGN.getKey()}))
                .eq(Multifile::getIsdeleted,Constants.ZERO));
        if(multifiles!=null){
            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
@@ -1952,6 +2005,10 @@
        if(Objects.isNull(solutions)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询方案信息");
        }
        ApplyDetail applyDetail = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getIsdeleted,Constants.ZERO).eq(ApplyDetail::getApplyId,insuranceApply.getId()).last("limit 1"));
        if(Objects.isNull(applyDetail)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保单明细记录");
        }
        //根据批单日期 和 结束日期 计算金额
        //验证批单日期是否在当前日期后 且 在保单结束日期前 申请时间必须处于保单的时间范围内
        if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChangeCyclePriceDTO.getValidTime()) >= Constants.ZERO
@@ -1968,7 +2025,8 @@
        BigDecimal sumPrice = countCyclePriceVO.getCyclePrice();
        CountCyclePriceVO returnCountCyclePriceVO = new CountCyclePriceVO();
        //加减保金额
        returnCountCyclePriceVO.setCyclePrice(sumPrice.multiply(new BigDecimal(optDays)).divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP));
//        returnCountCyclePriceVO.setCyclePrice(sumPrice.multiply(new BigDecimal(optDays)).divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP));
        returnCountCyclePriceVO.setCyclePrice(applyDetail.getPrice().multiply(new BigDecimal(optDays)));
        return returnCountCyclePriceVO;
    }