|
|
@@ -0,0 +1,756 @@
|
|
|
+package com.loan.system.service.Impl;
|
|
|
+
|
|
|
+import com.loan.system.config.FileUploadConfig;
|
|
|
+import com.loan.system.domain.dto.DetailDTO;
|
|
|
+import com.loan.system.domain.entity.*;
|
|
|
+import com.loan.system.domain.enums.DecisionEnum;
|
|
|
+import com.loan.system.domain.enums.StepEnum;
|
|
|
+import com.loan.system.domain.enums.StepPropertyEnum;
|
|
|
+import com.loan.system.domain.pojo.Result;
|
|
|
+import com.loan.system.domain.vo.*;
|
|
|
+import com.loan.system.service.*;
|
|
|
+import com.loan.system.utils.ResultUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+@Service
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class DetailServiceImpl implements DetailService {
|
|
|
+ private final LoanService loanService;
|
|
|
+ private final RepaymentService repaymentService;
|
|
|
+ private final RepaymentRecordService repaymentRecordService;
|
|
|
+ private final FileUploadConfig fileUploadConfig;
|
|
|
+ private final ContractService contractService;
|
|
|
+ private final ContractRepaymentService contractRepaymentService;
|
|
|
+ private final CustomerService customerService;
|
|
|
+ private final CustomerOtherService customerOtherService;
|
|
|
+ private final RecommenderService recommenderService;
|
|
|
+ private final StepService stepService;
|
|
|
+ private final UserService userService;
|
|
|
+ private final DisbursementService disbursementService;
|
|
|
+ private final CollateralService collateralService;
|
|
|
+ private final ContractAndCollateralService contractAndCollateralService;
|
|
|
+ private final CollateralPlanService collateralPlanService;
|
|
|
+ private final LocationDatumService locationDatumService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getArrangeReport(LocalDate begin) {
|
|
|
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String endTime = begin.atTime(23, 59, 59).format(fmt);
|
|
|
+
|
|
|
+ List<LoanCaseStatistic> loanCaseStatistics = new ArrayList<>();
|
|
|
+
|
|
|
+ //指派人员只需要显示进行中的业务
|
|
|
+ List<LoanCaseSimpleVO> loanCases = loanService.findLoanCaseSimpleByIsComplete(DecisionEnum.PROCESS.getMsg());
|
|
|
+ for (LoanCaseSimpleVO loanCase : loanCases){
|
|
|
+ LoanCaseStatistic loanCaseStatistic = new LoanCaseStatistic();
|
|
|
+ List<StepVO> steps = stepService.getChildStepByCaseIdBeforeTime(loanCase.getId(), endTime);
|
|
|
+ //仅显示派单环节的信息
|
|
|
+ for (StepVO step : steps){
|
|
|
+ if (step.getStatus().equals(StepEnum.UNSTART.getMsg()) || step.getUserId1() == null)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (!step.getCode().equals(StepPropertyEnum.EVIDENCE_CONFIRMATION.getCode()) && !step.getCode().equals(StepPropertyEnum.DELIVERY_CONFIRMATION.getCode())
|
|
|
+ &&!step.getCode().equals(StepPropertyEnum.DISBURSE_START.getCode()) && !step.getCode().equals(StepPropertyEnum.BALANCE_REPAY.getCode()))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ loanCaseStatistic.setWeekSeq(calculateWeekSequence(LocalDate.parse(step.getBeginTime(), fmt)));
|
|
|
+ loanCaseStatistic.setDisburseDate(getDateAndPlace( step ,loanCase.getId()).get(0));//2.
|
|
|
+ loanCaseStatistic.setCustomerName(customerService.findByCustomerIdAndIsDelete(loanCase.getCustomerId(), false).getName());//3.
|
|
|
+ loanCaseStatistic.setBusinessType(loanCase.getBusinessType());//4.
|
|
|
+ loanCaseStatistic.setAmount(loanCase.getTotalLoanAmount());//5.
|
|
|
+
|
|
|
+ loanCaseStatistic.setStepName(step.getStepName());//6.
|
|
|
+
|
|
|
+ if (step.getCode().equals(StepPropertyEnum.BALANCE_REPAY.getCode())||step.getCode().equals(StepPropertyEnum.DISBURSE_START.getCode())){
|
|
|
+ List<String> data = getDateAndPlace(step, loanCase.getId());
|
|
|
+ if (data.size()>=3)
|
|
|
+ loanCaseStatistic.setUserName1(data.get(2));
|
|
|
+ if (data.size()==4)
|
|
|
+ loanCaseStatistic.setUserName2(data.get(3));
|
|
|
+ }else {
|
|
|
+ String[] ids = new String[]{};
|
|
|
+ if (step.getUserIds() != null)
|
|
|
+ ids = step.getUserIds().split(",");
|
|
|
+ String userName1 = "";
|
|
|
+ if (ids.length > 0)
|
|
|
+ userName1 = userService.findByIdAndIsDelete(Long.parseLong(ids[0])).getRealName();
|
|
|
+ loanCaseStatistic.setUserName1(userName1);//7.
|
|
|
+
|
|
|
+ String userName2 = "";
|
|
|
+ Stream<String> distinct = Arrays.stream(ids).distinct();
|
|
|
+ List<Long> userIds = distinct.map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ if(userIds.size() > 1){
|
|
|
+ List<User> users = userService.findByIdsAndIsDelete(userIds.subList(1, userIds.size()));//保证了第一个不会出现在后面
|
|
|
+ userName2 = users.stream().map(User::getRealName).collect(Collectors.toList()).toString();
|
|
|
+ }
|
|
|
+ loanCaseStatistic.setUserName2(userName2);//8.
|
|
|
+ }
|
|
|
+
|
|
|
+ loanCaseStatistic.setStartDate(step.getBeginTime());//9.
|
|
|
+ loanCaseStatistic.setPlace(getDateAndPlace( step ,loanCase.getId()).get(1));//10.
|
|
|
+ loanCaseStatistic.setEndDate(step.getStatus().equals(StepEnum.COMPLETED.getMsg()) ? step.getUpdateTime() : step.getStatus());//11.
|
|
|
+
|
|
|
+ loanCaseStatistics.add(loanCaseStatistic);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 对 loanCaseStatistics 进行排序
|
|
|
+ loanCaseStatistics.sort(Comparator
|
|
|
+ .comparing(LoanCaseStatistic::getStartDate)
|
|
|
+ .thenComparing(LoanCaseStatistic::getUserName1));
|
|
|
+
|
|
|
+
|
|
|
+ return ResultUtil.success("success",loanCaseStatistics);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getLoanCaseReport(LocalDate begin, LocalDate end) {
|
|
|
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String beginTime = begin.atStartOfDay().format(fmt);
|
|
|
+ String endTime = end.atTime(23, 59, 59).format(fmt);
|
|
|
+
|
|
|
+ List<LoanCaseStatistic> loanCaseStatistics = new ArrayList<>();
|
|
|
+
|
|
|
+ List<LoanCaseSimpleVO> loanCases = loanService.findLoanCaseBetweenRange(beginTime, endTime);
|
|
|
+
|
|
|
+ // 批量获取所有相关的客户ID
|
|
|
+ Set<Long> customerIds = loanCases.stream()
|
|
|
+ .map(LoanCaseSimpleVO::getCustomerId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 批量获取客户信息
|
|
|
+ Map<Long, CustomerVO> customerMap = new HashMap<>();
|
|
|
+ if (!customerIds.isEmpty()) {
|
|
|
+ List<CustomerVO> customers = customerService.findByIdsInAndIsDelete(customerIds, false);
|
|
|
+ customerMap = customers.stream().collect(Collectors.toMap(CustomerVO::getId, customer -> customer));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 遍历loanCases并收集所有相关的步骤
|
|
|
+ Map<Long, List<StepVO>> caseStepsMap = new HashMap<>();
|
|
|
+ for (LoanCaseSimpleVO loanCase : loanCases) {
|
|
|
+ List<StepVO> steps = stepService.getChildStepByCaseIdBetweenRange(loanCase.getId(), beginTime, endTime);
|
|
|
+ caseStepsMap.put(loanCase.getId(), steps);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 收集所有需要的用户ID用于批量查询
|
|
|
+ Set<Long> userIds = new HashSet<>();
|
|
|
+ for (LoanCaseSimpleVO loanCase : loanCases) {
|
|
|
+ List<StepVO> steps = caseStepsMap.get(loanCase.getId());
|
|
|
+ for (StepVO step : steps) {
|
|
|
+ if (step.getStatus().equals(StepEnum.UNSTART.getMsg()) || step.getUserId1() == null)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ // 添加主要用户ID
|
|
|
+ if (step.getUserId1() != null) {
|
|
|
+ userIds.add(step.getUserId1());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加其他用户ID
|
|
|
+ if (step.getUserIds() != null) {
|
|
|
+ String[] ids = step.getUserIds().split(",");
|
|
|
+ for (String idStr : ids) {
|
|
|
+ try {
|
|
|
+ Long userId = Long.parseLong(idStr.trim());
|
|
|
+ userIds.add(userId);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ // 忽略无效的ID
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量获取用户信息
|
|
|
+ Map<Long, User> userMap = new HashMap<>();
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
+ List<User> users = userService.findByIdsAndIsDelete(new ArrayList<>(userIds));
|
|
|
+ userMap = users.stream().collect(Collectors.toMap(User::getId, user -> user));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理数据
|
|
|
+ for (LoanCaseSimpleVO loanCase : loanCases){
|
|
|
+ List<StepVO> steps = caseStepsMap.get(loanCase.getId());
|
|
|
+ for (StepVO step : steps){
|
|
|
+ if (step.getStatus().equals(StepEnum.UNSTART.getMsg()) || step.getUserId1() == null)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ LoanCaseStatistic loanCaseStatistic = new LoanCaseStatistic();
|
|
|
+ loanCaseStatistic.setWeekSeq(calculateWeekSequence(LocalDate.parse(step.getBeginTime(), fmt)));
|
|
|
+ List<String> dateAndPlace = getDateAndPlace(step, loanCase.getId());
|
|
|
+ if(!dateAndPlace.isEmpty())
|
|
|
+ loanCaseStatistic.setDisburseDate(dateAndPlace.get(0));//2.
|
|
|
+
|
|
|
+ // 使用缓存的客户信息
|
|
|
+ CustomerVO customer = customerMap.get(loanCase.getCustomerId());
|
|
|
+ if (customer != null) {
|
|
|
+ loanCaseStatistic.setCustomerName(customer.getName());//3.
|
|
|
+ }
|
|
|
+
|
|
|
+ loanCaseStatistic.setBusinessType(loanCase.getBusinessType());//4.
|
|
|
+ loanCaseStatistic.setAmount(loanCase.getTotalLoanAmount());//5.
|
|
|
+
|
|
|
+ loanCaseStatistic.setStepName(step.getStepName());//6.
|
|
|
+
|
|
|
+ if (step.getCode().equals(StepPropertyEnum.BALANCE_REPAY.getCode())||step.getCode().equals(StepPropertyEnum.DISBURSE_START.getCode())){
|
|
|
+ List<String> data = getDateAndPlace(step, loanCase.getId());
|
|
|
+ if (data.size()>=3)
|
|
|
+ loanCaseStatistic.setUserName1(data.get(2));
|
|
|
+ if (data.size()==4)
|
|
|
+ loanCaseStatistic.setUserName2(data.get(3));
|
|
|
+ }else {
|
|
|
+ String[] ids = new String[]{};
|
|
|
+ if (step.getUserIds() != null)
|
|
|
+ ids = step.getUserIds().split(",");
|
|
|
+ String userName1 = "";
|
|
|
+ if (ids.length > 0) {
|
|
|
+ Long userId = Long.parseLong(ids[0]);
|
|
|
+ User user = userMap.get(userId);
|
|
|
+ if (user != null) {
|
|
|
+ userName1 = user.getRealName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loanCaseStatistic.setUserName1(userName1);//7.
|
|
|
+
|
|
|
+ String userName2 = "";
|
|
|
+ Stream<String> distinct = Arrays.stream(ids).distinct();
|
|
|
+ List<Long> userIdsList = distinct.map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ if(userIdsList.size() > 1){
|
|
|
+ List<User> userList = new ArrayList<>();
|
|
|
+ for (int i = 1; i < userIdsList.size(); i++) {
|
|
|
+ User user = userMap.get(userIdsList.get(i));
|
|
|
+ if (user != null) {
|
|
|
+ userList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ userName2 = userList.stream().map(User::getRealName).collect(Collectors.toList()).toString();
|
|
|
+ }
|
|
|
+ loanCaseStatistic.setUserName2(userName2);//8.
|
|
|
+ }
|
|
|
+
|
|
|
+ loanCaseStatistic.setStartDate(step.getBeginTime());//9.
|
|
|
+ if(dateAndPlace.size()>1)
|
|
|
+ loanCaseStatistic.setPlace(dateAndPlace.get(1));//10.
|
|
|
+ loanCaseStatistic.setEndDate(step.getStatus().equals(StepEnum.COMPLETED.getMsg()) ? step.getUpdateTime() : step.getStatus());//11.
|
|
|
+
|
|
|
+ loanCaseStatistics.add(loanCaseStatistic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 对 loanCaseStatistics 进行排序
|
|
|
+ loanCaseStatistics.sort(Comparator
|
|
|
+ .comparing(LoanCaseStatistic::getStartDate)
|
|
|
+ .thenComparing(LoanCaseStatistic::getUserName1));
|
|
|
+
|
|
|
+ return ResultUtil.success("success",loanCaseStatistics);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportLoanCaseReport(DetailDTO<LoanCaseStatistic> detailDTO, LocalDate begin, LocalDate end, HttpServletResponse response) {
|
|
|
+ List<LoanCaseStatistic> loanCaseStatistics = detailDTO.getData();
|
|
|
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String beginTime = begin.atStartOfDay().format(fmt);
|
|
|
+ String endTime = end.atTime(23, 59, 59).format(fmt);
|
|
|
+
|
|
|
+ List<LoanCaseStatistic> loanCaseStatisticList = new ArrayList<>();
|
|
|
+ for (LoanCaseStatistic loanCaseStatistic : loanCaseStatistics){
|
|
|
+ if (loanCaseStatistic.getEndDate() != null && !loanCaseStatistic.getEndDate().equals("进行中")){
|
|
|
+ LocalDateTime endDate = LocalDateTime.parse(loanCaseStatistic.getEndDate(), fmt);
|
|
|
+ LocalDateTime begin1 = LocalDateTime.parse(beginTime, fmt);
|
|
|
+ LocalDateTime end1 = LocalDateTime.parse(endTime, fmt);
|
|
|
+ if (endDate.isAfter(begin1) && endDate.isBefore(end1))
|
|
|
+ loanCaseStatisticList.add(loanCaseStatistic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(loanCaseStatisticList);
|
|
|
+ //查询概览运营数据,提供给Excel模板文件
|
|
|
+ InputStream inputStream = getClass().getClassLoader().getResourceAsStream("file_store/template/loanStatistics.xlsx");
|
|
|
+
|
|
|
+ if (inputStream == null) {
|
|
|
+ throw new RuntimeException("无法找到Excel模板文件: " + fileUploadConfig.getUploadDir() + "template/" + "loanStatistics.xlsx");
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ //基于提供好的模板文件创建一个新的Excel表格对象
|
|
|
+ XSSFWorkbook excel = new XSSFWorkbook(inputStream);
|
|
|
+
|
|
|
+ //获得Excel文件中的一个Sheet页
|
|
|
+ XSSFSheet sheet = excel.getSheet("Sheet1");
|
|
|
+ //TODO:row(从0开始)行,cell(从0开始)获取单元格
|
|
|
+ //获得第1行
|
|
|
+ XSSFRow row = sheet.getRow(0);
|
|
|
+ row.getCell(1).setCellValue(begin.format(DateTimeFormatter.ofPattern("yyyy年M月")));
|
|
|
+
|
|
|
+ //获取单元格
|
|
|
+ for (int i = 0; i < loanCaseStatisticList.size(); i++) {
|
|
|
+ LoanCaseStatistic loanCaseStatistic = loanCaseStatisticList.get(i);
|
|
|
+ int rowIdx = i + 4;
|
|
|
+ row = sheet.getRow(rowIdx);
|
|
|
+ if (row == null) {
|
|
|
+ row = sheet.createRow(rowIdx);
|
|
|
+ }
|
|
|
+ System.out.println(row);
|
|
|
+ row.getCell(0).setCellValue(loanCaseStatistic.getWeekSeq());
|
|
|
+ row.getCell(1).setCellValue(loanCaseStatistic.getStartDate());
|
|
|
+ row.getCell(2).setCellValue(loanCaseStatistic.getCustomerName());
|
|
|
+ row.getCell(3).setCellValue(loanCaseStatistic.getBusinessType());
|
|
|
+ row.getCell(4).setCellValue(loanCaseStatistic.getAmount());
|
|
|
+ row.getCell(5).setCellValue(loanCaseStatistic.getStepName());
|
|
|
+ row.getCell(6).setCellValue(loanCaseStatistic.getUserName1());
|
|
|
+ row.getCell(7).setCellValue(loanCaseStatistic.getUserName2());
|
|
|
+ row.getCell(8).setCellValue(loanCaseStatistic.getStartDate());
|
|
|
+ row.getCell(9).setCellValue(loanCaseStatistic.getPlace());
|
|
|
+ row.getCell(10).setCellValue(loanCaseStatistic.getEndDate());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过输出流将文件下载到客户端浏览器中
|
|
|
+ ServletOutputStream out = response.getOutputStream();
|
|
|
+ excel.write(out);
|
|
|
+
|
|
|
+ //关闭资源
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ excel.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getAccountReport(Long caseId, Integer pageNum, Integer pageSize) {
|
|
|
+ int begin = pageNum * pageSize;
|
|
|
+ List<LoanCaseDetails> loanCaseDetails = new ArrayList<>();
|
|
|
+ //获取业务信息
|
|
|
+ LoanCaseSimpleVO loanCase = loanService.findLoanCaseSimpleByIdAndIsDelete(caseId, false);
|
|
|
+
|
|
|
+ //获取客户与其它客户信息
|
|
|
+ Customer customer = customerService.findByIdAndIsDelete(loanCase.getCustomerId());
|
|
|
+ List<CustomersOtherVO> customersOtherVOS = customerOtherService.findByCaseId(caseId);
|
|
|
+
|
|
|
+ //获取回款记录信息(核心)
|
|
|
+ List<RepaymentRecord> repaymentRecords = repaymentRecordService.findByRepaymentIdAndIsInterestAndIsDelete(repaymentService.findByCaseIdAndIsDelete(caseId, false).getId(), false);
|
|
|
+ List<Long> recordIds = repaymentRecords.stream().map(RepaymentRecord::getId).collect(Collectors.toList());
|
|
|
+ List<ContractRepayment> contractRepayments = contractRepaymentService.findByRepaymentRecordIdsAndIsDelete(recordIds);
|
|
|
+
|
|
|
+ List<Long> contractIds = contractRepayments.stream().map(ContractRepayment::getContractId).collect(Collectors.toList());
|
|
|
+ for (Long contractId : contractIds) {
|
|
|
+ double amount = 0.0;//累计回款
|
|
|
+ Contract contract = contractService.findContractById(contractId);
|
|
|
+ for (ContractRepayment contractRepayment : contractRepayments) {
|
|
|
+ if (contractRepayment.getContractId().equals(contractId)) {
|
|
|
+ LoanCaseDetails loanCaseDetail = new LoanCaseDetails();
|
|
|
+
|
|
|
+ loanCaseDetail.setContractNo(contract.getContractNo());//1
|
|
|
+// PawnTicketInfo pawnTicketInfo = pawnTicketService.findByContractIdAndIsDelete(contractId);
|
|
|
+// if(pawnTicketInfo!=null){
|
|
|
+// loanCaseDetail.setPawnTicketNo(pawnTicketInfo.getPawnTicketNo());//2.
|
|
|
+// loanCaseDetail.setRedeemTime(pawnTicketInfo.getEndTime());//16.
|
|
|
+// loanCaseDetail.setRedeemTicketNo(pawnTicketInfo.getRedeemTicketNo());//17.
|
|
|
+// }
|
|
|
+ loanCaseDetail.setLoanTime(disbursementService.getLoanTime(caseId));//3.
|
|
|
+ loanCaseDetail.setCustomerName(customer.getName());//4.
|
|
|
+ loanCaseDetail.setCustomerName2(customersOtherVOS.get(0).getName());//5.
|
|
|
+ loanCaseDetail.setPhoneNumber(customer.getMobile());//6.
|
|
|
+ loanCaseDetail.setPawnAmount(loanCase.getTotalLoanAmount());//7.
|
|
|
+ List<String> attributes = new ArrayList<>();
|
|
|
+ List<String> locations = new ArrayList<>();
|
|
|
+ List<ContractAndCollateral> contractAndCollaterals = contractAndCollateralService.listByContractId(contractId);
|
|
|
+ for (ContractAndCollateral contractAndCollateral : contractAndCollaterals) {
|
|
|
+ if (contractAndCollateral.getContractId().equals(contractId)){
|
|
|
+ Collateral collateral = collateralService.findCollateralById(contractAndCollateral.getCollateralId());
|
|
|
+ attributes.add(contract.getBusinessAttr());
|
|
|
+ locations.add(collateral.getAddress());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loanCaseDetail.setLocations( locations);
|
|
|
+ loanCaseDetail.setAttributes(attributes);
|
|
|
+
|
|
|
+ loanCaseDetail.setChannelName(loanCase.getChannelName());//9.
|
|
|
+ List<String> userNames=new ArrayList<>();
|
|
|
+ StepVO stepVO = stepService.findByStepCodeAndCaseId(StepPropertyEnum.BUSINESS_ACCEPT.getCode(), caseId);
|
|
|
+ StepVO stepVO1 = stepService.findByStepCodeAndCaseId(StepPropertyEnum.PRE_TRIAL.getCode(), caseId);
|
|
|
+ if(stepVO!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ if(stepVO1!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO1.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ loanCaseDetail.setUserName(userNames);//10.
|
|
|
+
|
|
|
+ amount += contractRepayment.getAmount();
|
|
|
+ loanCaseDetail.setRepayTime(contractRepayment.getCreateTime());//11.
|
|
|
+ loanCaseDetail.setRepayTotalAmount(amount);//12
|
|
|
+ loanCaseDetail.setLastRepayAmount(contractRepayment.getAmount());//13.
|
|
|
+ loanCaseDetail.setBalance(loanCase.getTotalLoanAmount() - amount);//14.
|
|
|
+ if(Math.abs(loanCase.getTotalLoanAmount() - amount)<Double.MIN_VALUE)
|
|
|
+ loanCaseDetail.setInterestAmount(contract.getInterestAmount());//15.
|
|
|
+
|
|
|
+ loanCaseDetails.add(loanCaseDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultUtil.success("success", loanCaseDetails.stream().skip( begin).limit(pageSize).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportAccountReport(List<LoanCaseDetails> loanCaseDetails, Integer begin, Integer end, HttpServletResponse response) {
|
|
|
+ //查询概览运营数据,提供给Excel模板文件
|
|
|
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileUploadConfig.getUploadDir() + "业务台账.xlsx");
|
|
|
+ try {
|
|
|
+ //基于提供好的模板文件创建一个新的Excel表格对象
|
|
|
+ XSSFWorkbook excel = new XSSFWorkbook(inputStream);
|
|
|
+
|
|
|
+ //获得Excel文件中的一个Sheet页
|
|
|
+ XSSFSheet sheet = excel.getSheet("Sheet1");
|
|
|
+ //TODO:row(从0开始)行,cell(从0开始)获取单元格
|
|
|
+ //获得第1行
|
|
|
+ XSSFRow row = sheet.getRow(1);
|
|
|
+ //获取单元格
|
|
|
+ for (int i = begin; i < end; i++) {
|
|
|
+ LoanCaseDetails loanCaseDetail = loanCaseDetails.get(i);
|
|
|
+ row = sheet.getRow(i);
|
|
|
+ row.getCell(0).setCellValue(loanCaseDetail.getContractNo());
|
|
|
+ row.getCell(1).setCellValue(loanCaseDetail.getPawnTicketNo());
|
|
|
+ row.getCell(2).setCellValue(loanCaseDetail.getLoanTime());
|
|
|
+ row.getCell(3).setCellValue(loanCaseDetail.getCustomerName());
|
|
|
+ row.getCell(4).setCellValue(loanCaseDetail.getCustomerName2());
|
|
|
+ row.getCell(5).setCellValue(loanCaseDetail.getPhoneNumber());
|
|
|
+ row.getCell(6).setCellValue(loanCaseDetail.getPawnAmount());
|
|
|
+ row.getCell(7).setCellValue(loanCaseDetail.getLocations().toString());
|
|
|
+ row.getCell(8).setCellValue(loanCaseDetail.getAttributes().toString());
|
|
|
+ row.getCell(9).setCellValue(loanCaseDetail.getChannelName());
|
|
|
+ row.getCell(10).setCellValue(loanCaseDetail.getUserName().toString());
|
|
|
+ row.getCell(11).setCellValue(loanCaseDetail.getRepayTime());
|
|
|
+ row.getCell(12).setCellValue(loanCaseDetail.getRepayTotalAmount());
|
|
|
+ row.getCell(13).setCellValue(loanCaseDetail.getLastRepayAmount());
|
|
|
+ row.getCell(14).setCellValue(loanCaseDetail.getBalance());
|
|
|
+ row.getCell(15).setCellValue(loanCaseDetail.getInterestAmount());
|
|
|
+ row.getCell(16).setCellValue(loanCaseDetail.getRedeemTime());
|
|
|
+ row.getCell(17).setCellValue(loanCaseDetail.getRedeemTicketNo());
|
|
|
+ row.getCell(18).setCellValue(loanCaseDetail.getComment());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过输出流将文件下载到客户端浏览器中
|
|
|
+ ServletOutputStream out = response.getOutputStream();
|
|
|
+ excel.write(out);
|
|
|
+
|
|
|
+ //关闭资源
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ excel.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getDisbursementReport(Long caseId, Integer pageNum, Integer pageSize) {
|
|
|
+ int begin = pageNum * pageSize;
|
|
|
+ List<DisbursementDetails> disbursementDetails = new ArrayList<>();
|
|
|
+
|
|
|
+ //获取业务信息
|
|
|
+ LoanCaseSimpleVO loanCase = loanService.findLoanCaseSimpleByIdAndIsDelete(caseId, false);
|
|
|
+ //获取合同信息
|
|
|
+ List<ContractVO> contractVOS = contractService.findContractByCaseId(caseId);
|
|
|
+ for(ContractVO contractVO : contractVOS){
|
|
|
+ DisbursementDetails disbursementDetail = new DisbursementDetails();
|
|
|
+
|
|
|
+ disbursementDetail.setContractNo(contractVO.getContractNo());//1.
|
|
|
+// PawnTicketInfo pawnTicketInfo = pawnTicketService.findByContractIdAndIsDelete(contractVO.getId());
|
|
|
+// if(pawnTicketInfo!=null){
|
|
|
+// disbursementDetail.setPawnTicketNo(pawnTicketInfo.getPawnTicketNo());//2.
|
|
|
+// disbursementDetail.setRedeemTime(pawnTicketInfo.getEndTime());//9.
|
|
|
+// disbursementDetail.setRedeemTicketNo(pawnTicketInfo.getRedeemTicketNo());//10.
|
|
|
+// }
|
|
|
+// disbursementDetail.setLoanTime(disbursementService.getLoanTime(caseId));//3.
|
|
|
+
|
|
|
+ disbursementDetail.setCustomerName(customerService.findByCustomerIdAndIsDelete(loanCase.getCustomerId(), false).getName());//4.
|
|
|
+ disbursementDetail.setPawnAmount(contractVO.getContractAmount());//5.
|
|
|
+ List<String> userNames=new ArrayList<>();
|
|
|
+ StepVO stepVO = stepService.findByStepCodeAndCaseId(StepPropertyEnum.BUSINESS_ACCEPT.getCode(), caseId);
|
|
|
+ StepVO stepVO1 = stepService.findByStepCodeAndCaseId(StepPropertyEnum.PRE_TRIAL.getCode(), caseId);
|
|
|
+ if(stepVO!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ if(stepVO1!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO1.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ disbursementDetail.setUserName(userNames);//6.
|
|
|
+ disbursementDetail.setRecommenderName(recommenderService.getRecommenderById(loanCase.getRecommenderId()).getRecommenderName());//7.
|
|
|
+ disbursementDetail.setChannelName(loanCase.getChannelName());//8.
|
|
|
+
|
|
|
+ disbursementDetails.add(disbursementDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取当票
|
|
|
+ return ResultUtil.success("success", disbursementDetails.stream().skip( begin).limit(pageSize).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportDisbursementReport(List<DisbursementDetails> disbursementDetails, Integer begin, Integer end, HttpServletResponse response) {
|
|
|
+ //查询概览运营数据,提供给Excel模板文件
|
|
|
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileUploadConfig.getUploadDir() + "出账明细.xlsx");
|
|
|
+ try {
|
|
|
+ //基于提供好的模板文件创建一个新的Excel表格对象
|
|
|
+ XSSFWorkbook excel = new XSSFWorkbook(inputStream);
|
|
|
+
|
|
|
+ //获得Excel文件中的一个Sheet页
|
|
|
+ XSSFSheet sheet = excel.getSheet("Sheet1");
|
|
|
+ //TODO:row(从0开始)行,cell(从0开始)获取单元格
|
|
|
+ //获得第1行
|
|
|
+ XSSFRow row = sheet.getRow(1);
|
|
|
+ //获取单元格
|
|
|
+ for (int i = begin; i < end; i++) {
|
|
|
+ DisbursementDetails disbursementDetail = disbursementDetails.get(i);
|
|
|
+ row = sheet.getRow(i);
|
|
|
+ row.getCell(0).setCellValue(disbursementDetail.getContractNo());
|
|
|
+ row.getCell(1).setCellValue(disbursementDetail.getLoanTime());
|
|
|
+ row.getCell(2).setCellValue(disbursementDetail.getPawnTicketNo());
|
|
|
+ row.getCell(3).setCellValue(disbursementDetail.getCustomerName());
|
|
|
+ row.getCell(4).setCellValue(disbursementDetail.getPawnAmount());
|
|
|
+ row.getCell(5).setCellValue(disbursementDetail.getUserName().toString());
|
|
|
+ row.getCell(6).setCellValue(disbursementDetail.getRecommenderName());
|
|
|
+ row.getCell(7).setCellValue(disbursementDetail.getChannelName());
|
|
|
+ row.getCell(8).setCellValue(disbursementDetail.getRedeemTime());
|
|
|
+ row.getCell(9).setCellValue(disbursementDetail.getRedeemTicketNo());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过输出流将文件下载到客户端浏览器中
|
|
|
+ ServletOutputStream out = response.getOutputStream();
|
|
|
+ excel.write(out);
|
|
|
+
|
|
|
+ //关闭资源
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ excel.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result repaymentReport(Long caseId, int begin, Integer pageSize) {
|
|
|
+ List<RepaymentDetails> repaymentDetails = new ArrayList<>();
|
|
|
+ //获取当票信息
|
|
|
+
|
|
|
+ //获取业务信息
|
|
|
+ LoanCaseSimpleVO loanCase = loanService.findLoanCaseSimpleByIdAndIsDelete(caseId, false);
|
|
|
+
|
|
|
+ //获取客户与其它客户信息
|
|
|
+ Customer customer = customerService.findByIdAndIsDelete(loanCase.getCustomerId());
|
|
|
+
|
|
|
+ //获取回款记录信息(核心)
|
|
|
+ List<RepaymentRecord> repaymentRecords = repaymentRecordService.findByRepaymentIdAndIsInterestAndIsDelete(repaymentService.findByCaseIdAndIsDelete(caseId, false).getId(), false);
|
|
|
+ List<Long> recordIds = repaymentRecords.stream().map(RepaymentRecord::getId).collect(Collectors.toList());
|
|
|
+ List<ContractRepayment> contractRepayments = contractRepaymentService.findByRepaymentRecordIdsAndIsDelete(recordIds);
|
|
|
+
|
|
|
+ List<Long> contractIds = contractRepayments.stream().map(ContractRepayment::getContractId).collect(Collectors.toList());
|
|
|
+ for (Long contractId : contractIds) {
|
|
|
+ double amount = 0.0;//累计回款
|
|
|
+ Contract contract = contractService.findContractById(contractId);
|
|
|
+ for (ContractRepayment contractRepayment : contractRepayments) {
|
|
|
+ if (contractRepayment.getContractId().equals(contractId)) {
|
|
|
+ RepaymentDetails repaymentDetail = new RepaymentDetails();
|
|
|
+
|
|
|
+ repaymentDetail.setContractNo(contract.getContractNo());//1
|
|
|
+// PawnTicketInfo pawnTicketInfo = pawnTicketService.findByContractIdAndIsDelete(contractId);
|
|
|
+// if(pawnTicketInfo!=null){
|
|
|
+// repaymentDetail.setPawnTicketNo(pawnTicketInfo.getPawnTicketNo());//2.
|
|
|
+// repaymentDetail.setRedeemTicketNo(pawnTicketInfo.getRedeemTicketNo());//10.
|
|
|
+// }
|
|
|
+ repaymentDetail.setLoanTime(disbursementService.getLoanTime(caseId));//3.
|
|
|
+ repaymentDetail.setCustomerName(customer.getName());//4.
|
|
|
+ repaymentDetail.setPawnAmount(loanCase.getTotalLoanAmount());//5.
|
|
|
+ repaymentDetail.setRepayTime(contractRepayment.getCreateTime());//6.
|
|
|
+ repaymentDetail.setRepayAmount(contractRepayment.getAmount());//7.
|
|
|
+ amount += contractRepayment.getAmount();
|
|
|
+ repaymentDetail.setBalance(loanCase.getTotalLoanAmount() - amount);//8.
|
|
|
+ if(Math.abs(loanCase.getTotalLoanAmount() - amount)<Double.MIN_VALUE)
|
|
|
+ repaymentDetail.setInterestAmount(contract.getInterestAmount());//9.
|
|
|
+ List<String> userNames=new ArrayList<>();
|
|
|
+ StepVO stepVO = stepService.findByStepCodeAndCaseId(StepPropertyEnum.BUSINESS_ACCEPT.getCode(), caseId);
|
|
|
+ StepVO stepVO1 = stepService.findByStepCodeAndCaseId(StepPropertyEnum.PRE_TRIAL.getCode(), caseId);
|
|
|
+ if(stepVO!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ if(stepVO1!=null){
|
|
|
+ userNames.add(userService.findByIdAndIsDelete(stepVO1.getUserId1()).getRealName());
|
|
|
+ }
|
|
|
+ repaymentDetail.setUserName(userNames);//11.
|
|
|
+ repaymentDetail.setRecommenderName(recommenderService.getRecommenderById(loanCase.getRecommenderId()).getRecommenderName());//12.
|
|
|
+ repaymentDetail.setChannelName(loanCase.getChannelName());//13.
|
|
|
+
|
|
|
+ repaymentDetails.add(repaymentDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultUtil.success("success", repaymentDetails.stream().skip( begin).limit(pageSize).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportRepaymentReport(List<RepaymentDetails> repaymentDetails, Integer begin, Integer end, HttpServletResponse response) {
|
|
|
+ //查询概览运营数据,提供给Excel模板文件
|
|
|
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileUploadConfig.getUploadDir() + "出账明细.xlsx");
|
|
|
+ try {
|
|
|
+ //基于提供好的模板文件创建一个新的Excel表格对象
|
|
|
+ XSSFWorkbook excel = new XSSFWorkbook(inputStream);
|
|
|
+
|
|
|
+ //获得Excel文件中的一个Sheet页
|
|
|
+ XSSFSheet sheet = excel.getSheet("Sheet1");
|
|
|
+ //TODO:row(从0开始)行,cell(从0开始)获取单元格
|
|
|
+ //获得第1行
|
|
|
+ XSSFRow row = sheet.getRow(1);
|
|
|
+ int index=1;
|
|
|
+ //获取单元格
|
|
|
+ for (int i = begin; i < end; i++) {
|
|
|
+ RepaymentDetails repaymentDetail = repaymentDetails.get(i);
|
|
|
+ row = sheet.getRow(index);
|
|
|
+ row.getCell(0).setCellValue(repaymentDetail.getContractNo());
|
|
|
+ row.getCell(1).setCellValue(repaymentDetail.getPawnTicketNo());
|
|
|
+ row.getCell(2).setCellValue(repaymentDetail.getLoanTime());
|
|
|
+ row.getCell(3).setCellValue(repaymentDetail.getCustomerName());
|
|
|
+ row.getCell(4).setCellValue(repaymentDetail.getPawnAmount());
|
|
|
+ row.getCell(5).setCellValue(repaymentDetail.getRepayTime());
|
|
|
+ row.getCell(6).setCellValue(repaymentDetail.getRepayAmount());
|
|
|
+ row.getCell(7).setCellValue(repaymentDetail.getBalance());
|
|
|
+ row.getCell(8).setCellValue(repaymentDetail.getInterestAmount());
|
|
|
+ row.getCell(9).setCellValue(repaymentDetail.getRedeemTicketNo());
|
|
|
+ row.getCell(10).setCellValue(repaymentDetail.getUserName().toString());
|
|
|
+ row.getCell(11).setCellValue(repaymentDetail.getRecommenderName());
|
|
|
+ row.getCell(12).setCellValue(repaymentDetail.getChannelName());
|
|
|
+ row.getCell(13).setCellValue(repaymentDetail.getComment());
|
|
|
+
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过输出流将文件下载到客户端浏览器中
|
|
|
+ ServletOutputStream out = response.getOutputStream();
|
|
|
+ excel.write(out);
|
|
|
+
|
|
|
+ //关闭资源
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ excel.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String calculateWeekSequence(LocalDate date) {
|
|
|
+ // 获取月份的第一天
|
|
|
+ LocalDate firstDayOfMonth = date.withDayOfMonth(1);
|
|
|
+
|
|
|
+ // 获取第一天是星期几(1=Monday, 7=Sunday)
|
|
|
+ int firstDayOfWeek = firstDayOfMonth.getDayOfWeek().getValue();
|
|
|
+
|
|
|
+ // 计算指定日期是当月第几天
|
|
|
+ int dayOfMonth = date.getDayOfMonth();
|
|
|
+
|
|
|
+ // 计算是第几周 (W1, W2, W3...)TODO:取余计算需要从0开始
|
|
|
+ // 例如:如果1号是周三,那么1-3号属于第一周,4-10号属于第二周...
|
|
|
+ int weekSequence = ((dayOfMonth + firstDayOfWeek - 2) / 7) + 1;
|
|
|
+
|
|
|
+ return "W" + weekSequence;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<String > getDateAndPlace(StepVO step , Long caseId){
|
|
|
+ List<String> list = new ArrayList<>();//有两个,第一个是date,第二个是place
|
|
|
+ String date = "";
|
|
|
+ String place = "";
|
|
|
+ String mainUSerName="";
|
|
|
+ String assistUserName="";
|
|
|
+ if (step.getCode().equals(StepPropertyEnum.EVIDENCE_CONFIRMATION.getCode())){
|
|
|
+ List<CollateralPlan> collateralPlans = collateralPlanService.findByCaseIdAndIsDelete(caseId, false);
|
|
|
+
|
|
|
+ for (CollateralPlan plan : collateralPlans){
|
|
|
+ if (plan.getTime()== null || plan.getPlace()== null)
|
|
|
+ continue;
|
|
|
+ if (plan.getFlag().equals(DecisionEnum.ENTER_WAREHOUSE.getMsg())){
|
|
|
+ date = date.isEmpty() ? plan.getTime() :date.concat("、").concat(plan.getTime());
|
|
|
+ place = place.isEmpty() ? plan.getPlace() :place.concat("、").concat(plan.getPlace());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(date);
|
|
|
+ list.add(place);
|
|
|
+ }else if (step.getCode().equals(StepPropertyEnum.DELIVERY_CONFIRMATION.getCode())){
|
|
|
+ List<CollateralPlan> collateralPlans = collateralPlanService.findByCaseIdAndIsDelete(caseId, false);
|
|
|
+
|
|
|
+ for (CollateralPlan plan : collateralPlans){
|
|
|
+ if (plan.getTime()== null || plan.getPlace()== null)
|
|
|
+ continue;
|
|
|
+ if (plan.getFlag().equals(DecisionEnum.OUT_WAREHOUSE.getMsg())){
|
|
|
+ date = date.isEmpty() ? plan.getTime() :date.concat("、").concat(plan.getTime());
|
|
|
+ place = place.isEmpty() ? plan.getPlace() :place.concat("、").concat(plan.getPlace());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(date);
|
|
|
+ list.add(place);
|
|
|
+ }else if (step.getCode().equals(StepPropertyEnum.DISBURSE_START.getCode())) {
|
|
|
+ List<Disbursement> disbursements = disbursementService.getDisbursementByCaseId(caseId);
|
|
|
+ for (Disbursement disbursement : disbursements){
|
|
|
+ if(disbursement.getPlannedTime()!=null)
|
|
|
+ date = date.isEmpty() ? disbursement.getPlannedTime() :date.concat("、").concat(disbursement.getPlannedTime());
|
|
|
+ if(disbursement.getLocationId()!=null){
|
|
|
+ LocationDatum locationDatum = locationDatumService.findById(disbursement.getLocationId());
|
|
|
+ place = place.isEmpty() ? locationDatum.getSimpleAddress() :place.concat("、").concat(locationDatum.getSimpleAddress());
|
|
|
+ }
|
|
|
+ User user = userService.findByIdAndIsDelete(disbursement.getMainUserId());
|
|
|
+ if (user !=null)
|
|
|
+ mainUSerName = mainUSerName.isEmpty() ? user.getRealName() :mainUSerName.concat("、").concat(user.getRealName());
|
|
|
+ User user1 = userService.findByIdAndIsDelete(disbursement.getAssistUserId());
|
|
|
+ if (user1 !=null)
|
|
|
+ assistUserName = assistUserName.isEmpty() ? user1.getRealName() :assistUserName.concat( "、").concat(user1.getRealName());
|
|
|
+ }
|
|
|
+
|
|
|
+ list.add( date);
|
|
|
+ list.add(place);
|
|
|
+ list.add(mainUSerName);
|
|
|
+ list.add(assistUserName);
|
|
|
+ }else if(step.getCode().equals(StepPropertyEnum.BALANCE_REPAY.getCode())){
|
|
|
+ Repayment repayment = repaymentService.findByCaseIdAndIsDelete(caseId, false);
|
|
|
+ if (repayment!=null){
|
|
|
+ List<RepaymentRecord> records = repaymentRecordService.findByRepaymentIdAndIsInterestAndIsDelete(repayment.getId(), false);
|
|
|
+ for (RepaymentRecord record : records){
|
|
|
+ if (record.getRepayTime()!= null || record.getRepayLocation()== null)
|
|
|
+ date = date.isEmpty() ? record.getRepayTime() :date.concat("、").concat(record.getRepayTime());
|
|
|
+ if(record.getRepayLocation()!=null)
|
|
|
+ place = place.isEmpty() ? record.getRepayLocation() :place.concat("、").concat(record.getRepayLocation());
|
|
|
+
|
|
|
+ User user = userService.findByIdAndIsDelete(record.getMainUser());
|
|
|
+ if (user !=null)
|
|
|
+ mainUSerName = mainUSerName.isEmpty() ? user.getRealName() :mainUSerName.concat("、").concat(user.getRealName());
|
|
|
+ User user1 = userService.findByIdAndIsDelete(record.getAssistUser());
|
|
|
+ if (user1 !=null)
|
|
|
+ assistUserName = assistUserName.isEmpty() ? user1.getRealName() :assistUserName.concat( "、").concat(user1.getRealName());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add( date);
|
|
|
+ list.add(place);
|
|
|
+ list.add(mainUSerName);
|
|
|
+ list.add(assistUserName);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|