|
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -20,10 +19,9 @@ import com.winhc.repal.cloud.vo.CompanyRiskNumVO;
|
|
import com.winhc.repal.cloud.vo.DiagnosisRecordVO;
|
|
import com.winhc.repal.cloud.vo.DiagnosisRecordVO;
|
|
import com.winhc.repal.cloud.vo.FinanceDynamicNumVO;
|
|
import com.winhc.repal.cloud.vo.FinanceDynamicNumVO;
|
|
import com.winhc.repal.entity.*;
|
|
import com.winhc.repal.entity.*;
|
|
-import com.winhc.repal.enums.CustPropertyEnum;
|
|
|
|
-import com.winhc.repal.enums.DeletedStatusEnum;
|
|
|
|
-import com.winhc.repal.enums.RefreshStatusEnum;
|
|
|
|
-import com.winhc.repal.enums.RepalBillStatusEnum;
|
|
|
|
|
|
+import com.winhc.repal.enums.*;
|
|
|
|
+import com.winhc.repal.model.bo.BillPageBO;
|
|
|
|
+import com.winhc.repal.model.bo.TotalMoneyBO;
|
|
import com.winhc.repal.model.dto.*;
|
|
import com.winhc.repal.model.dto.*;
|
|
import com.winhc.repal.model.vo.RepalBillDetailVO;
|
|
import com.winhc.repal.model.vo.RepalBillDetailVO;
|
|
import com.winhc.repal.model.vo.RepalBillInfoVO;
|
|
import com.winhc.repal.model.vo.RepalBillInfoVO;
|
|
@@ -41,8 +39,10 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.time.DayOfWeek;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -84,6 +84,15 @@ public class RepalBillServiceImpl extends ServiceImpl<RepalBillMapper, RepalBill
|
|
@Autowired
|
|
@Autowired
|
|
private RepalBookService repalBookService;
|
|
private RepalBookService repalBookService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RepalRolePermissionService repalRolePermissionService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ System.out.println(LocalDate.now().with(DayOfWeek.MONDAY));
|
|
|
|
+ System.out.println(LocalDate.now().with(DayOfWeek.SUNDAY));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -95,16 +104,50 @@ public class RepalBillServiceImpl extends ServiceImpl<RepalBillMapper, RepalBill
|
|
voPage.setPageSize(dto.getPageSize());
|
|
voPage.setPageSize(dto.getPageSize());
|
|
voPage.setPageNum(dto.getPageNum());
|
|
voPage.setPageNum(dto.getPageNum());
|
|
RepalBillInfoVO infoVO = new RepalBillInfoVO();
|
|
RepalBillInfoVO infoVO = new RepalBillInfoVO();
|
|
- //infoVO.setTotalOverdueCount();
|
|
|
|
- //infoVO.setTotalOverdueStr();
|
|
|
|
-
|
|
|
|
- //infoVO.setTotalReceivableCount();
|
|
|
|
- //infoVO.setTotalReceivableStr();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 管理员查看所有 todo
|
|
|
|
- LOGGER.info("角色:[]");
|
|
|
|
|
|
+ boolean allFlag = repalRolePermissionService.checkUserPermission(UserContextUtil.getUser().getUserId(),
|
|
|
|
+ RepalBillTypeEnum.RECEIVABLE.getCode().equals(dto.getRepalBillType()) ? PermissionEnum.QUERY_ALL_RECEIVABLE.getCode() : PermissionEnum.QUERY_ALL_RECEIPT.getCode());
|
|
|
|
+ TotalMoneyBO totalMoneyBO;
|
|
|
|
+ TotalMoneyBO overdueBO;
|
|
|
|
+ if (allFlag) {
|
|
|
|
+ totalMoneyBO = repalBillMapper.getTotalMoneyByGroup(dto.getRepalGroupId(), dto.getRepalBillType(), RepalBillStatusEnum.PROGRESSING.getCode(), dto.getRepalBookId());
|
|
|
|
+ overdueBO = repalBillMapper.getTotalMoneyByGroup(dto.getRepalGroupId(), dto.getRepalBillType(), RepalBillStatusEnum.OVERDUE.getCode(), dto.getRepalBookId());
|
|
|
|
+ } else {
|
|
|
|
+ // 只查询自己负责的
|
|
|
|
+ totalMoneyBO = repalBillMapper.getTotalMoneyByUser(UserContextUtil.getUser().getUserId(), dto.getRepalGroupId(), dto.getRepalBillType(), RepalBillStatusEnum.PROGRESSING.getCode(), dto.getRepalBookId());
|
|
|
|
+ overdueBO = repalBillMapper.getTotalMoneyByUser(UserContextUtil.getUser().getUserId(), dto.getRepalGroupId(), dto.getRepalBillType(), RepalBillStatusEnum.OVERDUE.getCode(), dto.getRepalBookId());
|
|
|
|
+ }
|
|
|
|
+ infoVO.setTotalBillStr(totalMoneyBO.getTotalMoney().stripTrailingZeros().toPlainString());
|
|
|
|
+ infoVO.setTotalBillCount(totalMoneyBO.getTotalCount());
|
|
|
|
+ infoVO.setTotalOverdueCount(overdueBO.getTotalCount());
|
|
|
|
+ infoVO.setTotalOverdueStr(overdueBO.getTotalMoney().stripTrailingZeros().toPlainString());
|
|
|
|
+ // 分页数据
|
|
Page<RepalBill> repalBillPage = new Page<>(dto.getPageNum(),dto.getPageSize());
|
|
Page<RepalBill> repalBillPage = new Page<>(dto.getPageNum(),dto.getPageSize());
|
|
|
|
+ BillPageBO billPageBO = new BillPageBO();
|
|
|
|
+ BeanUtils.copyProperties(dto, billPageBO);
|
|
|
|
+ billPageBO.setUserId(UserContextUtil.getUser().getUserId());
|
|
|
|
+ billPageBO.setAllFlag(allFlag);
|
|
|
|
+ // 对应1-4到期时间
|
|
|
|
+ if (Objects.nonNull(dto.getOverdueType())) {
|
|
|
|
+ switch (dto.getOverdueType()) {
|
|
|
|
+ case 1:
|
|
|
|
+ billPageBO.setStartDate(LocalDate.now());
|
|
|
|
+ billPageBO.setEndDate(billPageBO.getStartDate());
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ billPageBO.setStartDate(LocalDate.now().with(DayOfWeek.MONDAY));
|
|
|
|
+ billPageBO.setEndDate(LocalDate.now().with(DayOfWeek.SUNDAY));
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ billPageBO.setStartDate(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()));
|
|
|
|
+ billPageBO.setEndDate(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()));
|
|
|
|
+ case 4:
|
|
|
|
+ billPageBO.setStartDate(LocalDate.now().with(TemporalAdjusters.firstDayOfYear()));
|
|
|
|
+ billPageBO.setEndDate(LocalDate.now().with(TemporalAdjusters.lastDayOfYear()));
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
repalBillPage = repalBillMapper.getRepalBillPage(repalBillPage, dto);
|
|
repalBillPage = repalBillMapper.getRepalBillPage(repalBillPage, dto);
|
|
voPage.setTotalPage(Math.toIntExact(repalBillPage.getPages()));
|
|
voPage.setTotalPage(Math.toIntExact(repalBillPage.getPages()));
|
|
voPage.setTotalNum(repalBillPage.getTotal());
|
|
voPage.setTotalNum(repalBillPage.getTotal());
|