From 8de09297dcc5393cc8542f29318b17f5696d4f8d Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期五, 17 七月 2026 09:28:46 +0800
Subject: [PATCH] feat:单点登录 首页及首页跳转
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java | 378 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 374 insertions(+), 4 deletions(-)
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
index f6e8736..0956a6f 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
@@ -1,28 +1,34 @@
package com.by4cloud.platformx.business.service.impl;
import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.by4cloud.platformx.admin.api.entity.SysDept;
import com.by4cloud.platformx.admin.api.entity.SysDictItem;
import com.by4cloud.platformx.admin.api.feign.RemoteDeptService;
import com.by4cloud.platformx.admin.api.feign.RemoteDictService;
import com.by4cloud.platformx.business.dto.AgingQueryDTO;
import com.by4cloud.platformx.business.dto.AnalysisCommonDTO;
-import com.by4cloud.platformx.business.entity.BusinessCustomer;
-import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
-import com.by4cloud.platformx.business.mapper.ContractMapper;
-import com.by4cloud.platformx.business.mapper.ContractPaymentScheduleMapper;
+import com.by4cloud.platformx.business.dto.HomeQueryDTO;
+import com.by4cloud.platformx.business.entity.*;
+import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.StatisticService;
import com.by4cloud.platformx.business.vo.*;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -35,6 +41,11 @@
private final ContractMapper contractMapper;
private final ContractPaymentScheduleMapper contractPaymentScheduleMapper;
private final BusinessCustomerMapper businessCustomerMapper;
+ private final PaymentSlipMapper paymentSlipMapper;
+ private final ContractOutBoundMapper contractOutBoundMapper;
+ private final ContractInvoiceMapper contractInvoiceMapper;
+ private final CurrentOverdueMapper currentOverdueMapper;
+ private final HistoryOverdueMapper historyOverdueMapper;
private final RemoteDeptService remoteDeptService;
private final RemoteDictService remoteDictService;
@@ -890,4 +901,363 @@
result.add(agingAnalysisVo);
return R.ok(result);
}
+
+ @Override
+ public R homeZbjt() {
+ List<HomeZbjtVo> homeZbjtVoList = new ArrayList<>();
+ //鍚堝悓绛捐 sgb smj jxc tfgs ymj
+ HomeZbjtVo htqd = contractMapper.homeZbjt();
+ homeZbjtVoList.add(htqd);
+ //鍥炴
+ HomeZbjtVo hk = paymentSlipMapper.homeZbjt();
+ homeZbjtVoList.add(hk);
+ //鍑鸿揣
+ HomeZbjtVo ch = contractOutBoundMapper.homeZbjt();
+ homeZbjtVoList.add(ch);
+ //寮�绁�
+ HomeZbjtVo kp = contractInvoiceMapper.homeZbjt();
+ homeZbjtVoList.add(kp);
+ //璧婇攢浜х敓鍊� 浠婂ぉ鍙戣揣鍔犱粖澶╁紑绁ㄩ
+// if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
+// HomeZbjtVo sxsy = ch.add(kp);
+// homeZbjtVoList.add(sxsy);
+// }else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
+ homeZbjtVoList.add(ch);
+// }else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
+// homeZbjtVoList.add(kp);
+// }else {
+// homeZbjtVoList.add(new HomeZbjtVo());
+// }
+ //璧婇攢绱鍓╀綑鍊� 浠婃棩鍙戣揣涓旀病寮�绁ㄧ殑鍑鸿揣
+ HomeZbjtVo sx = contractOutBoundMapper.homeZbjtSX();
+ homeZbjtVoList.add(sx);
+ HomeZbjtVo yq = currentOverdueMapper.homeZbjt();
+ //閫炬湡绱鍓╀綑 浠婃棩浜х敓閫炬湡 鍚巻鍙�
+ HomeZbjtVo ls = historyOverdueMapper.homeZbjt();
+ if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
+ homeZbjtVoList.add(yq.add(ls));
+ }else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
+ homeZbjtVoList.add(ls);
+ }else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
+ homeZbjtVoList.add(yq);
+ }else {
+ homeZbjtVoList.add(new HomeZbjtVo());
+ }
+ //閫炬湡浜х敓鍊� 浠婂ぉ浜х敓-浠婂ぉ宸蹭粯
+
+ homeZbjtVoList.add(yq);
+ return R.ok(homeZbjtVoList);
+ }
+
+ @Override
+ public R homeZgs() {
+ List<HomeZgsVo> homeZbjtVoList = new ArrayList<>();
+ //鍚堝悓绛捐 鍗庡寳 瑗垮寳 涓滃寳 娴峰
+ HomeZgsVo htqd = contractMapper.homeZgs(SecurityUtils.getUser().getCompId());
+ homeZbjtVoList.add(htqd);
+ //鍥炴
+ HomeZgsVo hk = paymentSlipMapper.homeZgs(SecurityUtils.getUser().getCompId());
+ homeZbjtVoList.add(hk);
+ //鍑鸿揣
+ HomeZgsVo ch = contractOutBoundMapper.homeZgs(SecurityUtils.getUser().getCompId());
+ homeZbjtVoList.add(ch);
+ //寮�绁�
+ HomeZgsVo kp = contractInvoiceMapper.homeZgs(SecurityUtils.getUser().getCompId());
+ homeZbjtVoList.add(kp);
+ //璧婇攢浜х敓鍊�
+// if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
+// HomeZgsVo sxsy = ch.add(kp);
+// homeZbjtVoList.add(sxsy);
+// }else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
+ homeZbjtVoList.add(ch);
+// }else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
+// homeZbjtVoList.add(kp);
+// }else {
+// homeZbjtVoList.add(new HomeZgsVo());
+// }
+ //璧婇攢绱鍓╀綑鍊�
+ HomeZgsVo sx = contractOutBoundMapper.homeZgsSX(SecurityUtils.getUser().getCompId());
+ homeZbjtVoList.add(sx);
+
+ HomeZgsVo yq = currentOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
+
+ //閫炬湡浜х敓鍊�
+ HomeZgsVo ls = historyOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
+ if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
+ homeZbjtVoList.add(yq.add(ls));
+ }else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
+ homeZbjtVoList.add(ls);
+ }else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
+ homeZbjtVoList.add(yq);
+ }else {
+ homeZbjtVoList.add(new HomeZgsVo());
+ }
+ //閫炬湡绱鍓╀綑
+ homeZbjtVoList.add(yq);
+ return R.ok(homeZbjtVoList);
+ }
+
+ @Override
+ public R homeZbjtFlag() {
+ Long userId = SecurityUtils.getUser().getCompId();
+ List<Long> compIds = new ArrayList<>();
+ compIds.add(Long.valueOf(sgb));
+ compIds.add(Long.valueOf(smj));
+ compIds.add(Long.valueOf(tfgs));
+ compIds.add(Long.valueOf(ymj));
+ compIds.add(Long.valueOf(jxc));
+ if (compIds.contains(userId)){
+ return R.ok(false);
+ };
+ return R.ok(true);
+ }
+
+ @Override
+ public R homeContract(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+
+ MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<Contract>()
+ .selectAll(Contract.class)
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),Contract::getSignDate,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),Contract::getSignDate,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),Contract::getSignDate,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),Contract::getSignDate,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),Contract::getSignDate,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),Contract::getSignDate,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(Contract::getCreateTime)
+ ;
+ return R.ok(contractMapper.selectList(wrapper));
+ }
+
+ @Override
+ public R homePaymentSlip(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+ MPJLambdaWrapper<PaymentSlip> wrapper = new MPJLambdaWrapper<PaymentSlip>()
+ .selectAll(PaymentSlip.class)
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,PaymentSlip::getBusGuestId)
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),PaymentSlip::getPaymentTime,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),PaymentSlip::getPaymentTime,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),PaymentSlip::getPaymentTime,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),PaymentSlip::getPaymentTime,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),PaymentSlip::getPaymentTime,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),PaymentSlip::getPaymentTime,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(PaymentSlip::getCreateTime)
+ ;
+ return R.ok(paymentSlipMapper.selectList(wrapper));
+ }
+
+ @Override
+ public R homeOutBound(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+ MPJLambdaWrapper<ContractOutBound> wrapper = new MPJLambdaWrapper<ContractOutBound>()
+ .selectAll(ContractOutBound.class)
+ .select(Contract::getContractNo)
+ .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
+ .select(ContractSubjectMatter::getUnitPrice)
+ .leftJoin(Contract.class,Contract::getId,ContractOutBound::getContractId)
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,ContractOutBound::getBusGuestId)
+ .leftJoin(ContractSubjectMatter.class, on->
+ on.eq(ContractSubjectMatter::getContractId,ContractOutBound::getContractId)
+ .eq(ContractSubjectMatter::getMaterialCode,ContractOutBound::getSubjectMatterCode)
+ )
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(ContractOutBound::getCreateTime)
+ ;
+ return R.ok(contractOutBoundMapper.selectJoinList(HomeOutBoundVo.class,wrapper));
+ }
+
+ @Override
+ public R homeInvoice(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+ MPJLambdaWrapper<ContractInvoice> wrapper = new MPJLambdaWrapper<ContractInvoice>()
+ .selectAll(ContractInvoice.class)
+ .select(Contract::getContractNo)
+ .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
+ .leftJoin(Contract.class,Contract::getId,ContractInvoice::getContractId)
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractInvoice::getInvoiceTime,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractInvoice::getInvoiceTime,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractInvoice::getInvoiceTime,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractInvoice::getInvoiceTime,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractInvoice::getInvoiceTime,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractInvoice::getInvoiceTime,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(ContractInvoice::getCreateTime)
+ ;
+ return R.ok(contractInvoiceMapper.selectJoinList(HomeInvoiceVo.class,wrapper));
+ }
+
+ @Override
+ public R homeCreditSale(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+ MPJLambdaWrapper<ContractOutBound> wrapper = new MPJLambdaWrapper<ContractOutBound>()
+ .selectAll(ContractOutBound.class)
+ .select(Contract::getContractNo)
+ .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
+ .select(ContractSubjectMatter::getUnitPrice)
+ .leftJoin(Contract.class,Contract::getId,ContractOutBound::getContractId)
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
+ .leftJoin(ContractSubjectMatter.class, on->
+ on.eq(ContractSubjectMatter::getContractId,ContractOutBound::getContractId)
+ .eq(ContractSubjectMatter::getMaterialCode,ContractOutBound::getSubjectMatterCode)
+ )
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(ContractOutBound::getCreateTime)
+ ;
+ return R.ok(contractOutBoundMapper.selectJoinList(HomeCreditSaleVo.class,wrapper));
+ }
+
+ @Override
+ public R homeOverdue(HomeQueryDTO queryDTO) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDate today = now.toLocalDate();
+ // 寮�濮嬫椂闂达細浠婂ぉ 00:00:00
+ LocalDateTime startOfDay = today.atStartOfDay();
+ // 缁撴潫鏃堕棿锛氫粖澶� 23:59:59.999999999 (鎴栬�呬娇鐢� nextDay 00:00:00 閰嶅悎 lt)
+ LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
+ // --- 鍦烘櫙浜岋細鏌ヨ褰撴湀鏁版嵁 ---
+ // 寮�濮嬫椂闂达細褰撴湀1鍙� 00:00:00
+ LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋鏈堟渶鍚庝竴澶� 23:59:59
+ LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
+
+ // 寮�濮嬫椂闂达細褰撳勾1鏈�1鍙� 00:00:00
+ LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
+ // 缁撴潫鏃堕棿锛氬綋骞�12鏈�31鍙� 23:59:59
+ LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
+ MPJLambdaWrapper<CurrentOverdue> wrapper = new MPJLambdaWrapper<CurrentOverdue>()
+ .selectAll(CurrentOverdue.class)
+ .select(Contract::getContractNo)
+ .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
+ .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,CurrentOverdue::getBusGuestId)
+ .leftJoin(Contract.class,Contract::getId,CurrentOverdue::getContractId)
+ .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),CurrentOverdue::getContractExpirTime,startOfDay)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),CurrentOverdue::getContractExpirTime,endOfDay)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),CurrentOverdue::getContractExpirTime,startOfMonth)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),CurrentOverdue::getContractExpirTime,endOfMonth)
+ .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),CurrentOverdue::getContractExpirTime,startOfYear)
+ .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),CurrentOverdue::getContractExpirTime,endOfYear)
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
+ .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
+ .orderByDesc(CurrentOverdue::getCreateTime)
+ ;
+ return R.ok(currentOverdueMapper.selectJoinList(HomeOverdueVo.class,wrapper));
+ }
+
+ @Override
+ public R homeOverdueHis(HomeQueryDTO queryDTO) {
+ List<HomeOverdueStaVo> homeOverdueVos = new ArrayList<>();
+ HomeOverdueStaVo current = currentOverdueMapper.selectCurrentOverdue(queryDTO);
+ if (ObjUtil.isNotNull(current)){
+ current.setOverdueType("褰撳墠");
+ homeOverdueVos.add(current);
+ }
+ HomeOverdueStaVo history = historyOverdueMapper.selectHistoryOverdue(queryDTO);
+ if (ObjUtil.isNotNull(history)){
+ history.setOverdueType("鍘嗗彶");
+ homeOverdueVos.add(history);
+ }
+ return R.ok(homeOverdueVos);
+ }
}
--
Gitblit v1.9.1