| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ApplyChange> monthTotalList(ApplyChange model){ |
| | | if(model.getApplyId() ==null || model.getYear() == null){ |
| | | return new ArrayList<>(); |
| | | } |
| | | MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper |
| | | .select("count(t.id)",ApplyChange::getCountNum) |
| | | .select("sum(t.fee)",ApplyChange::getFee) |
| | | .select("DATE_FORMAT(t.create_date, '%Y-%m')",ApplyChange::getMonth) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .eq(!Objects.isNull(model.getType()),ApplyChange::getType,model.getType()) |
| | | .eq(ApplyChange::getApplyId,model.getApplyId()) |
| | | .eq(!Objects.isNull(model.getStatus())&&!model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()),ApplyChange::getStatus,model.getStatus()) |
| | | .in(!Objects.isNull(model.getStatus())&&model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()), |
| | | ApplyChange::getStatus, |
| | | Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey(), |
| | | Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) |
| | | .eq(!Objects.isNull(model.getSolutionType()),Solutions::getType,model.getSolutionType()) |
| | | .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId()) |
| | | .like(StringUtils.isNotBlank(model.getSolutionsName()),Solutions::getName,model.getSolutionsName()) |
| | | .ge( ApplyChange::getCreateDate, model.getYear()+"-01-01 00:00:00" ) |
| | | .lt(ApplyChange::getCreateDate, (model.getYear()+1)+"-01-01 00:00:00") |
| | | .groupBy("month" ); |
| | | /* LoginUserInfo loginUserInfo =(LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | //企业人员查看本企业数据 |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); |
| | | }else if(loginUserInfo.getType().equals(Constants.TWO)){ |
| | | //如果是商户查看 |
| | | if(model.getSolutionType()!=null && model.getSolutionType() ==0){ |
| | | queryWrapper.exists("select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()); |
| | | }else if(model.getSolutionType()!=null && model.getSolutionType() ==1){ |
| | | queryWrapper.eq(Solutions::getShopId,loginUserInfo.getCompanyId()); |
| | | }else{ |
| | | queryWrapper.apply("((t2.type=0 and exists(select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()+")) or (" + |
| | | "t2.type=1 and t2.shop_id="+loginUserInfo.getCompanyId()+"))") ; |
| | | } |
| | | }else{ |
| | | if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){ |
| | | queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList()); |
| | | }else{ |
| | | queryWrapper.eq(InsuranceApply::getCompanyId, -1); |
| | | } |
| | | queryWrapper.eq(model.getCompanyId()!=null,InsuranceApply::getCompanyId, model.getCompanyId()); |
| | | }*/ |
| | | |
| | | List<ApplyChange> list =applyChangeJoinMapper.selectJoinList(ApplyChange.class,queryWrapper); |
| | | List<ApplyChange> result = new ArrayList<>(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | if(i<10){ |
| | | result.add(getMonthDayFromList(model.getYear() +"-0"+i,list)); |
| | | }else{ |
| | | result.add(getMonthDayFromList(model.getYear() +"-"+i,list)); |
| | | } |
| | | } |
| | | return result; |
| | | |
| | | } |
| | | |
| | | private ApplyChange getMonthDayFromList(String s, List<ApplyChange> list) { |
| | | for(ApplyChange d : list){ |
| | | if(StringUtils.equals(s,d.getMonth())){ |
| | | return d; |
| | | } |
| | | } |
| | | ApplyChange d = new ApplyChange(); |
| | | d.setMonth(s); |
| | | d.setFee(new BigDecimal(0)); |
| | | d.setCountNum(0); |
| | | return d; |
| | | } |
| | | |
| | | @Override |
| | | public List<ApplyChange> findListForCompany(ApplyChange model) { |
| | | MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper |