| | |
| | | import com.example.jz.enums.CauseEnums; |
| | | import com.example.jz.exception.BusinessException; |
| | | import com.example.jz.modle.PageParam; |
| | | import com.example.jz.modle.dto.AddReportDto; |
| | | import com.example.jz.modle.dto.AddReportLoadDto; |
| | | import com.example.jz.modle.dto.CauseDto; |
| | | import com.example.jz.modle.dto.CauseLoadDto; |
| | | import com.example.jz.modle.dto.*; |
| | | import com.example.jz.modle.entity.*; |
| | | import com.example.jz.modle.vo.CauseReportVo; |
| | | import com.example.jz.modle.vo.CauseVo; |
| | |
| | | |
| | | List<Integer> list = reports.stream() |
| | | .map(item -> item.getCauseId()) |
| | | .distinct() |
| | | .filter(integer -> integer != null) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | List<Cause> causes = causeDao.selectList(new LambdaQueryWrapper<Cause>().notIn(Cause::getId, list)); |
| | | List<NewCauseVo> res = causes.stream() |
| | | .map(item -> { |
| | | NewCauseVo newCauseVo = new NewCauseVo(); |
| | | newCauseVo.setName(item.getName()); |
| | | newCauseVo.setId(item.getId()); |
| | | return newCauseVo; |
| | | }).collect(Collectors.toList()); |
| | | List<NewCauseVo> res; |
| | | if (!Objects.isNull(list) && list.size()!= 0){ |
| | | List<Cause> causes = causeDao.selectList(new LambdaQueryWrapper<Cause>().notIn(Cause::getId, list)); |
| | | res = causes.stream() |
| | | .map(item -> { |
| | | NewCauseVo newCauseVo = new NewCauseVo(); |
| | | newCauseVo.setName(item.getName()); |
| | | newCauseVo.setId(item.getId()); |
| | | return newCauseVo; |
| | | }).collect(Collectors.toList()); |
| | | }else { |
| | | List<Cause> causes = causeDao.selectList(null); |
| | | res = causes.stream() |
| | | .map(item -> { |
| | | NewCauseVo newCauseVo = new NewCauseVo(); |
| | | newCauseVo.setName(item.getName()); |
| | | newCauseVo.setId(item.getId()); |
| | | return newCauseVo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | |
| | | causeReportVoPageParam.setRecords(causeReportVos); |
| | | } |
| | | return causeReportVoPageParam; |
| | | } |
| | | |
| | | @Override |
| | | public List<CauseReportExpDto> getExpList(Integer causeId) { |
| | | List<Report> reports = reportDao.selectList(Wrappers.<Report>lambdaQuery().eq(Report::getCauseId, causeId)); |
| | | List<Integer> userIds = reports.stream().map(report -> report.getUserId()).collect(Collectors.toList()); |
| | | List<User> users = userDao.selectList(Wrappers.<User>lambdaQuery().in(User::getId, userIds)); |
| | | List<CauseReportExpDto> res = users.stream().map(new Function<User, CauseReportExpDto>() { |
| | | @Override |
| | | public CauseReportExpDto apply(User user) { |
| | | Double amountInvolved = reportDao.selectOne(Wrappers.<Report>lambdaQuery().eq(Report::getCauseId, causeId).eq(Report::getUserId, user.getId())).getAmountInvolved(); |
| | | CauseReportExpDto build = CauseReportExpDto.builder() |
| | | .realName(user.getRealName()) |
| | | .userMobile(user.getUserMobile()) |
| | | .userIdcard(user.getUserMobile()) |
| | | .userIdcard(user.getUserIdcard()) |
| | | .sex(user.getSex()) |
| | | .location(user.getLocation()) |
| | | .workingLocation(user.getWorkingLocation()) |
| | | .amountInvolved(amountInvolved) |
| | | .ctime(user.getCtime()) |
| | | .userMemo(user.getUserMemo()) |
| | | .build(); |
| | | return build; |
| | | } |
| | | }).collect(Collectors.toList()); |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<Map<String, String>> getCauseIdAndName() { |
| | | ArrayList<Map<String, String>> maps = new ArrayList<>(); |
| | | causeDao.selectList(new QueryWrapper<Cause>().eq("status", 0).or().eq("status", 2)).stream().forEach(a -> { |
| | | causeDao.selectList(null).stream().forEach(a -> { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("id", a.getId().toString()); |
| | | map.put("name", a.getName()); |