| | |
| | | MPJLambdaWrapper<UnionApply> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.selectAll(UnionApply.class); |
| | | queryWrapper.selectAs(Solutions::getName,UnionApply::getSolutionName); |
| | | queryWrapper.select("(select count(b.id) from apply_detail b where b.isdeleted=0 and b.union_apply_id=t.id) as insureNum "); |
| | | queryWrapper.leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId); |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user.getType().equals(Constants.TWO)){ |
| | | queryWrapper.eq(UnionApply::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | if(Constants.equalsInteger(user.getType(),Constants.TWO)){ |
| | | queryWrapper.eq(UnionApply::getCompanyId, user.getCompanyId()); |
| | | } |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.eq(UnionApply::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getSolutionId() != null) { |
| | | queryWrapper.eq(UnionApply::getSolutionId, pageWrap.getModel().getSolutionId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.eq(UnionApply::getCreator, pageWrap.getModel().getCreator()); |
| | |
| | | } |
| | | if (pageWrap.getModel().getSignApplyNo() != null) { |
| | | queryWrapper.eq(UnionApply::getSignApplyNo, pageWrap.getModel().getSignApplyNo()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | }if(pageWrap.getSorts().size() == 0){ |
| | | queryWrapper.orderByDesc(UnionApply::getCreateDate ); |
| | | }else { |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | PageData<UnionApply> pageData = PageData.from(unionApplyJoinMapper.selectJoinPage(page,UnionApply.class, queryWrapper)); |
| | | return pageData; |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor ={BusinessException.class,Exception.class} ) |
| | | public Integer merge(SaveUnionApplyDTO saveUnionApplyDTO){ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!user.getType().equals(Constants.TWO)){ |
| | |
| | | } |
| | | if(Objects.isNull(saveUnionApplyDTO) |
| | | || Objects.isNull(saveUnionApplyDTO.getApplyIds()) |
| | | || saveUnionApplyDTO.getApplyIds().size() == 0 |
| | | || Objects.isNull(saveUnionApplyDTO.getStartDate()) |
| | | || Objects.isNull(saveUnionApplyDTO.getEndDate()) |
| | | || saveUnionApplyDTO.getStartDate().getTime()>saveUnionApplyDTO.getEndDate().getTime() |
| | | || Objects.isNull(saveUnionApplyDTO.getBaseSolutionId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda(). |
| | | eq(Solutions::getType,Constants.ONE) |
| | | .eq(Solutions::getIsdeleted,Constants.ZERO) |
| | | .eq(Solutions::getDataType,Constants.ZERO) |
| | | .eq(Solutions::getBaseId,saveUnionApplyDTO.getBaseSolutionId())); |
| | | //查询方案数据 |
| | | if(solutions == null){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,方案信息有误,请刷新页面重试"); |
| | | } |
| | | List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(InsuranceApply::getSolutionBaseId,Solutions::getBaseId) |
| | | .selectAs(Solutions::getBaseId,InsuranceApply::getSolutionBaseId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .eq(InsuranceApply::getIsdeleted, Constants.ZERO) |
| | | .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_BUSINESS_CHECK_PASS.getKey()) |
| | |
| | | unionApply.setStatus(Constants.UnionApplyStatus.MERGE.getKey()); |
| | | unionApply.setCheckUserId(user.getId()); |
| | | unionApply.setCurrentFee(BigDecimal.ZERO); |
| | | unionApply.setIsdeleted(Constants.ZERO); |
| | | unionApply.setSolutionId(solutions.getId()); |
| | | |
| | | Integer maxDays = DateUtil.calculateBetween(saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate(),0); |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getPrice) |
| | | .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds())); |
| | | unionApply.setFee(applyDetailList.stream().map(i->i.getPrice().multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getId,ApplyDetail::getPrice) |
| | | .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds()) |
| | | .eq(ApplyDetail::getIsdeleted,Constants.ZERO)); |
| | | if(applyDetailList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,存在委托投保申请记录信息有误,请返回查看申请人员是否为空!"); |
| | | } |
| | | unionApply.setFee(applyDetailList.stream().map(i->Constants.formatBigdecimal(i.getPrice()).multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | |
| | | unionApplyMapper.insert(unionApply); |
| | | |
| | | insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | |
| | | multifile.setFileurl(uploadMultifileDTO.getFileurl()); |
| | | multifile.setName(uploadMultifileDTO.getName()); |
| | | multifileMapper.insert(multifile); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 合并单 - 投保申请签署 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |