From 633a003d232e37c79b7135ccda35eda1c69952c6 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期一, 25 五月 2026 17:28:01 +0800
Subject: [PATCH] feat:统计数据测试调整
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java | 66 +++++
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml | 154 ++++++++++++-
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractIncomeAnalysisVo.java | 2
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java | 40 +--
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/StatisticController.java | 9
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPaymentScheduleVo.java | 5
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java | 266 ++++++++++++------------
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java | 22 +
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java | 5
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java | 44 ++-
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java | 19
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java | 4
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/StatisticService.java | 2
13 files changed, 418 insertions(+), 220 deletions(-)
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
index 2f80b76..3fedad4 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
@@ -102,10 +102,10 @@
@Column(columnDefinition = "datetime comment '鏀舵鏃ユ湡'")
private Date paymentDate;
- @Schema(description = "鏀舵闃舵鐢熸晥鏃ユ湡锛堥殣鎬ц绱� - 灞ョ害鏃堕棿璧风偣锛屽嵆璇ヨ妭鐐瑰疄闄呰揪鎴愮殑鏃ユ湡锛�")
+ @Schema(description = "鏀舵闃舵鐢熸晥鏃ユ湡锛堜綔搴� 浠ユ埅姝㈡棩鏈熶负鍑嗭級")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
- @Column(columnDefinition = "date comment '鏀舵闃舵鐢熸晥鏃ユ湡锛堝饱绾﹁妭鐐瑰疄闄呰揪鎴愭棩鏈燂級'")
+ @Column(columnDefinition = "date comment '鏀舵闃舵鐢熸晥鏃ユ湡锛堝饱绾﹁妭鐐瑰疄闄呰揪鎴愭棩鏈燂級 浣滃簾 浠ユ埅姝㈡棩鏈熶负鍑�'")
private Date effectiveDate;
@Schema(description = "鏀舵闃舵鎴鏃ユ湡")
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractIncomeAnalysisVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractIncomeAnalysisVo.java
index 2acca1e..883f672 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractIncomeAnalysisVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractIncomeAnalysisVo.java
@@ -5,6 +5,8 @@
@Data
public class ContractIncomeAnalysisVo {
+ private String compId;
+
private String compName;
private String srMonth1;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPaymentScheduleVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPaymentScheduleVo.java
index 9382bad..5fabe53 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPaymentScheduleVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPaymentScheduleVo.java
@@ -2,13 +2,11 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.persistence.Column;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
-import java.util.List;
@Data
public class ContractPaymentScheduleVo {
@@ -18,6 +16,9 @@
@Schema(description = "鏀舵闃舵鍚嶇О锛堟樉鎬ц绱狅紝濡傦細鍚堝悓绛捐棰勪粯銆佸彂璐у墠浠樻銆佽揣鍒扮鏀朵粯娆俱�佽皟璇曞畬鎴愪粯娆俱�佽川淇濋噾锛�")
private String stageName;
+ @Schema(description = "鏀舵姣斾緥锛�%锛屽30琛ㄧず30%锛夛紙鏄炬�ц绱狅級")
+ private BigDecimal paymentRatio;
+
@Schema(description = "璁″垝鏀舵閲戦锛堟牴鎹悎鍚屾�婚噾棰�*姣斾緥鑷姩璁$畻锛�")
private BigDecimal plannedAmount;
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/StatisticController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/StatisticController.java
index b5f85aa..9129dd8 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/StatisticController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/StatisticController.java
@@ -111,4 +111,13 @@
public R contractAmountAnalysisByExportBus(@RequestBody AnalysisCommonDTO commonDTO) {
return statisticService.contractAmountAnalysisByExportBus(commonDTO);
}
+
+ /**
+ * 鍒嗛攢鍞ā寮忓悎鍚岄噾棰濈粺璁�
+ * @return R
+ */
+ @PostMapping("/contractAmountAnalysisBySaleModel")
+ public R contractAmountAnalysisBySaleModel(@RequestBody AnalysisCommonDTO commonDTO) {
+ return statisticService.contractAmountAnalysisBySaleModel(commonDTO);
+ }
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
index e095ba2..8aab02c 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
@@ -54,4 +54,9 @@
@Param("tfCompId") Long tfgs,@Param("ymjCompId") Long ymj);
List<ContractAmountAnalysisCompVo> contractAmountAnalysisByComp(@Param("queryDTO")AnalysisCommonDTO commonDTO,@Param("compId") Long compId);
+
+ List<ContractIncomeAnalysisAreaVo> contractAmountAnalysisBySaleModel(@Param("queryDTO")AnalysisCommonDTO commonDTO
+ ,@Param("compIds")List<Long> compIds,@Param("smjCompId") Long smj,
+ @Param("sgbCompId")Long sgb, @Param("jxcCompId")Long jxc,
+ @Param("tfCompId") Long tfgs,@Param("ymjCompId") Long ymj);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/StatisticService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/StatisticService.java
index 1928b7d..8312046 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/StatisticService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/StatisticService.java
@@ -21,4 +21,6 @@
R contractAmountAnalysisByExportBus(AnalysisCommonDTO commonDTO);
R contractAmountAnalysisByComp(AnalysisCommonDTO commonDTO);
+
+ R contractAmountAnalysisBySaleModel(AnalysisCommonDTO commonDTO);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
index f722306..378b775 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
@@ -81,17 +81,17 @@
//鏇存柊褰撳墠闃舵
if (ObjUtil.isNull(schedule.getEffectiveDate()) && ObjUtil.isNull(schedule.getEffectiveEndDate())) {
- schedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
+ schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
contractPaymentScheduleMapper.updateById(schedule);
}
- //鏌ヨ鏄惁鏈変箣鍓嶉樁娈�
- ContractPaymentSchedule beforeSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
- .lt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()).orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
- if (ObjUtil.isNotNull(beforeSchedule) && ObjUtil.isNull(beforeSchedule.getEffectiveEndDate())) {
- beforeSchedule.setEffectiveEndDate(schedule.getEffectiveDate());
- contractPaymentScheduleMapper.updateById(beforeSchedule);
- }
+// //鏌ヨ鏄惁鏈変箣鍓嶉樁娈�
+// ContractPaymentSchedule beforeSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
+// .lt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()).orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
+// if (ObjUtil.isNotNull(beforeSchedule) && ObjUtil.isNull(beforeSchedule.getEffectiveEndDate())) {
+// beforeSchedule.setEffectiveEndDate(schedule.getEffectiveDate());
+// contractPaymentScheduleMapper.updateById(beforeSchedule);
+// }
List<ContractOutBound> contractOutBoundList = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery().eq(ContractOutBound::getContractId, contract.getId())
.isNotNull(ContractOutBound::getArrivalTime));
@@ -186,13 +186,11 @@
//鏈�鍚庨樁娈电敓鏁堟椂闂�
ContractPaymentSchedule endSchedule = afterSchedule.get(0);
if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
- endSchedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
- endSchedule.setEffectiveEndDate(contract.getExpirationDate());
+ endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
contractPaymentScheduleMapper.updateById(endSchedule);
//褰撳墠闃舵鐢熸晥鏃堕棿
- schedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
- schedule.setEffectiveEndDate(endSchedule.getEffectiveDate());
- contractPaymentScheduleMapper.updateById(schedule);
+// schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(schedule);
//鏈�鍚庨樁娈靛簲鏀�
PaymentConfirm newConfim = new PaymentConfirm();
newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
@@ -228,8 +226,8 @@
contractMapper.updateById(contract);
}
if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
- schedule.setEffectiveEndDate(contract.getExpirationDate());
- contractPaymentScheduleMapper.updateById(schedule);
+// schedule.setEffectiveEndDate(contract.getExpirationDate());
+// contractPaymentScheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("鏃�");
contractMapper.updateById(contract);
@@ -277,12 +275,10 @@
//鏈�鍚庨樁娈电敓鏁堟椂闂�
ContractPaymentSchedule endSchedule = afterSchedule.get(0);
if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
- endSchedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
- endSchedule.setEffectiveEndDate(contract.getExpirationDate());
+ endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
contractPaymentScheduleMapper.updateById(endSchedule);
//褰撳墠闃舵鐢熸晥鏃堕棿
- schedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
- schedule.setEffectiveEndDate(endSchedule.getEffectiveDate());
+ schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
contractPaymentScheduleMapper.updateById(schedule);
//鏈�鍚庨樁娈靛簲鏀�
PaymentConfirm newConfim = new PaymentConfirm();
@@ -319,8 +315,8 @@
contractMapper.updateById(contract);
}
if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
- schedule.setEffectiveEndDate(contract.getExpirationDate());
- contractPaymentScheduleMapper.updateById(schedule);
+// schedule.setEffectiveEndDate(contract.getExpirationDate());
+// contractPaymentScheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("鏃�");
contractMapper.updateById(contract);
@@ -396,7 +392,7 @@
ContractPaymentSchedule::getPlannedAmount, ContractPaymentSchedule::getPlannedAmount,
ContractPaymentSchedule::getEffectiveEndDate, ContractPaymentSchedule::getPaymentDate,
ContractPaymentSchedule::getPaymentStatus, ContractPaymentSchedule::getActualAmount,
- ContractPaymentSchedule::getAgreedDays)
+ ContractPaymentSchedule::getAgreedDays,ContractPaymentSchedule::getPaymentRatio)
.select(ContractPaymentScheduleProcess::getProcessDate)
.leftJoin(ContractPaymentScheduleProcess.class, ContractPaymentScheduleProcess::getScheduleId, ContractPaymentSchedule::getId)
.eq(ContractPaymentSchedule::getContractId, id)
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
index 921a9dc..5d43f90 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
@@ -64,7 +64,7 @@
@Override
public R add(ContractAddDTO addDTO) {
- Contract contract = BeanUtil.copyProperties(addDTO,Contract.class);
+ Contract contract = BeanUtil.copyProperties(addDTO, Contract.class);
contract.setPartyBId(SecurityUtils.getUser().getCompId());
contract.setPartyB(SecurityUtils.getUser().getCompName());
contract.setContractNo(ContractNumberGenerator.generateContractNumber());
@@ -72,14 +72,14 @@
contract.setBillingStatus("0");
contract.setErpPushFlag("0");
List<Contract> contracts;
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,contract.getContractNo()));
- while (ArrayUtil.isNotEmpty(contracts.toArray())){
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, contract.getContractNo()));
+ while (ArrayUtil.isNotEmpty(contracts.toArray())) {
contract.setContractNo(ContractNumberGenerator.generateContractNumber());
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,contract.getContractNo()));
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, contract.getContractNo()));
}
baseMapper.insert(contract);
- if (ArrayUtil.isNotEmpty(addDTO.getContractSubjectMatter())){
+ if (ArrayUtil.isNotEmpty(addDTO.getContractSubjectMatter())) {
addDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
subjectMatter.setContractId(contract.getId());
@@ -91,13 +91,13 @@
});
}
- if (ArrayUtil.isNotEmpty(addDTO.getContractPaymentSchedule())){
+ if (ArrayUtil.isNotEmpty(addDTO.getContractPaymentSchedule())) {
AtomicInteger index = new AtomicInteger(1);
addDTO.getContractPaymentSchedule().stream().forEach(contractPaymentScheduleAddDTO -> {
int currentIndex = index.getAndIncrement();
ContractPaymentSchedule schedule = BeanUtil.copyProperties(contractPaymentScheduleAddDTO, ContractPaymentSchedule.class);
- if (contractPaymentScheduleAddDTO.getStageName().equals("鍚堝悓绛捐")){
- schedule.setEffectiveDate(DateUtil.offsetDay(contract.getSignDate(),contractPaymentScheduleAddDTO.getAgreedDays()));
+ if (contractPaymentScheduleAddDTO.getStageName().equals("鍚堝悓绛捐")) {
+ schedule.setEffectiveEndDate(DateUtil.offsetDay(contract.getSignDate(), contractPaymentScheduleAddDTO.getAgreedDays()));
}
if (ObjUtil.isNotNull(schedule.getEffectiveDate())) {
if (schedule.getEffectiveDate().before(DateUtil.date())) {
@@ -106,17 +106,21 @@
schedule.setFulfillmentStatus(0);
}
}
- schedule.setPaymentStatus(0);
+ if (contractPaymentScheduleAddDTO.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ schedule.setPaymentStatus(0);
+ }else {
+ schedule.setPaymentStatus(3);
+ }
schedule.setContractId(contract.getId());
schedule.setContractName(contract.getContractName());
schedule.setPlannedAmount(contract.getAmount().multiply(schedule.getPaymentRatio().divide(new BigDecimal("100"))));
schedule.setStageOrder(currentIndex);
contractPaymentScheduleMapper.insert(schedule);
- if (contractPaymentScheduleAddDTO.getStageName().equals("璐у埌绛炬敹")){
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璐у埌绛炬敹")) {
contract.setArrivalScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
- if (contractPaymentScheduleAddDTO.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")){
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")) {
contract.setAcceptScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
@@ -125,31 +129,30 @@
}
-
return R.ok();
}
@Override
public R edit(ContractUpdateDTO updateDTO) {
Contract entity = baseMapper.selectById(updateDTO.getId());
- if (!StrUtil.equals(entity.getContractStatus()+"","0")){
+ if (!StrUtil.equals(entity.getContractStatus() + "", "0")) {
return R.failed("褰撳墠鐘舵�佹棤娉曚慨鏀瑰悎鍚�");
}
- Contract contract = BeanUtil.copyProperties(updateDTO,Contract.class);
+ Contract contract = BeanUtil.copyProperties(updateDTO, Contract.class);
contract.setContractNo(ContractNumberGenerator.generateContractNumber());
contract.setBillingStatus("0");
contract.setErpPushFlag("0");
contract.setPaidAmount(new BigDecimal("0"));
List<Contract> contracts;
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,contract.getContractNo()));
- while (ArrayUtil.isNotEmpty(contracts.toArray())){
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, contract.getContractNo()));
+ while (ArrayUtil.isNotEmpty(contracts.toArray())) {
contract.setContractNo(ContractNumberGenerator.generateContractNumber());
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,contract.getContractNo()));
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, contract.getContractNo()));
}
baseMapper.updateById(contract);
- if (ArrayUtil.isNotEmpty(updateDTO.getContractSubjectMatter())){
- contractSubjectMatterMapper.delete(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId,contract.getId()));
+ if (ArrayUtil.isNotEmpty(updateDTO.getContractSubjectMatter())) {
+ contractSubjectMatterMapper.delete(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId, contract.getId()));
updateDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
@@ -161,8 +164,8 @@
});
}
- if (ArrayUtil.isNotEmpty(updateDTO.getContractPaymentSchedule())){
- contractPaymentScheduleMapper.delete(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId,contract.getId()));
+ if (ArrayUtil.isNotEmpty(updateDTO.getContractPaymentSchedule())) {
+ contractPaymentScheduleMapper.delete(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId()));
AtomicInteger index = new AtomicInteger(1);
updateDTO.getContractPaymentSchedule().stream().forEach(contractPaymentScheduleAddDTO -> {
@@ -172,12 +175,17 @@
schedule.setContractName(contract.getContractName());
schedule.setPlannedAmount(contract.getAmount().multiply(schedule.getPaymentRatio().divide(new BigDecimal("100"))));
schedule.setStageOrder(currentIndex);
+ if (contractPaymentScheduleAddDTO.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ schedule.setPaymentStatus(0);
+ }else {
+ schedule.setPaymentStatus(3);
+ }
contractPaymentScheduleMapper.insert(schedule);
- if (contractPaymentScheduleAddDTO.getStageName().equals("璐у埌绛炬敹")){
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璐у埌绛炬敹")) {
contract.setArrivalScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
- if (contractPaymentScheduleAddDTO.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")){
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")) {
contract.setAcceptScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
@@ -191,10 +199,10 @@
@Override
public ContractDetailVo detail(Long id) {
Contract contract = baseMapper.selectById(id);
- ContractDetailVo detailVo = BeanUtil.copyProperties(contract,ContractDetailVo.class);
- List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId,id));
+ ContractDetailVo detailVo = BeanUtil.copyProperties(contract, ContractDetailVo.class);
+ List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId, id));
detailVo.setContractSubjectMatter(subjectMatterList);
- List<ContractPaymentSchedule> paymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId,contract.getId()));
+ List<ContractPaymentSchedule> paymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId()));
detailVo.setContractPaymentSchedule(paymentScheduleList);
return detailVo;
}
@@ -220,11 +228,11 @@
Contract contract = baseMapper.selectById(id);
contract.setContractStatus(2);
baseMapper.updateById(contract);
- ContractPaymentSchedule fitstSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId,contract.getId())
+ ContractPaymentSchedule fitstSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId())
.orderByAsc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
- if (fitstSchedule.getStageName().equals("鍚堝悓绛捐")){
+ if (fitstSchedule.getStageName().equals("鍚堝悓绛捐")) {
//鏂板搴旀敹
- savePaymentConfirm(contract,fitstSchedule);
+ savePaymentConfirm(contract, fitstSchedule);
//鏂板鍚堝悓灞ョ害璁板綍
ContractPaymentScheduleProcess process = new ContractPaymentScheduleProcess();
@@ -242,42 +250,36 @@
// contract.setContractStatus(3);
// baseMapper.updateById(contract);
// }
- }else if (fitstSchedule.getStageName().equals("鍙戣揣鍓�")) {
+ } else if (fitstSchedule.getStageName().equals("鍙戣揣鍓�")) {
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("鏃�");
baseMapper.updateById(contract);
- }else if (fitstSchedule.getStageName().equals("璐у埌绛炬敹")) {
+ } else if (fitstSchedule.getStageName().equals("璐у埌绛炬敹")) {
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("璐у埌绛炬敹");
baseMapper.updateById(contract);
- }else if (fitstSchedule.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")) {
+ } else if (fitstSchedule.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")) {
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("璋冭瘯瀹屾垚鎴栭獙鏀�");
baseMapper.updateById(contract);
- }else {
+ } else {
//鏂板搴旀敹
- savePaymentConfirm(contract,fitstSchedule);
+ savePaymentConfirm(contract, fitstSchedule);
}
//鏌ヨ鏄惁鏈夊悗缁樁娈�
List<ContractPaymentSchedule> afterSchedule = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, fitstSchedule.getContractId())
.gt(ContractPaymentSchedule::getStageOrder, fitstSchedule.getStageOrder())
.orderByAsc(ContractPaymentSchedule::getCreateTime));
- if (ArrayUtil.isNotEmpty(afterSchedule.toArray())&&afterSchedule.size()==1){
+ if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() == 1) {
//鏈�鍚庨樁娈电敓鏁堟椂闂�
ContractPaymentSchedule endSchedule = afterSchedule.get(0);
- if (StrUtil.equals(endSchedule.getStageName(),"璐ㄤ繚閲�")){
- endSchedule.setEffectiveDate(DateUtil.offsetDay(new Date(),endSchedule.getAgreedDays()));
- endSchedule.setEffectiveEndDate(contract.getExpirationDate());
- contractPaymentScheduleMapper.updateById(endSchedule);
- //绗竴闃舵鐢熸晥鏃堕棿
- fitstSchedule.setEffectiveDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
- fitstSchedule.setEffectiveEndDate(endSchedule.getEffectiveDate());
- contractPaymentScheduleMapper.updateById(fitstSchedule);
-
+ if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
+// endSchedule.setEffectiveEndDate(DateUtil.offsetDay(new Date(),endSchedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(endSchedule);
//鏈�鍚庨樁娈靛簲鏀�
PaymentConfirm newConfim = new PaymentConfirm();
- newConfim.setBusinessType(endSchedule.getStageName()+"搴旀敹");
+ newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
newConfim.setBusGuestId(contract.getPartyAId());
newConfim.setBusGuestName(contract.getPartyA());
newConfim.setContractId(contract.getId());
@@ -288,14 +290,14 @@
newConfim.setConfirmTime(new Date());
newConfim.setTransationAmount(endSchedule.getPlannedAmount());
newConfim.setReceivableAmount(endSchedule.getPlannedAmount());
- PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,contract.getId())
+ PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
BigDecimal lastNewTotal = new BigDecimal("0");
- if(ObjUtil.isNotNull(lastNewConfirm)){
+ if (ObjUtil.isNotNull(lastNewConfirm)) {
lastNewTotal = lastNewConfirm.getTotalAmount();
}
newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
- if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0"))>0) {
+ if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
paymentConfirmMapper.insert(newConfim);
}
}
@@ -303,25 +305,24 @@
contract.setNextScheduleName(endSchedule.getStageName());
baseMapper.updateById(contract);
}
- if(ArrayUtil.isNotEmpty(afterSchedule.toArray())&&afterSchedule.size()>1){
+ if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() > 1) {
//绗竴闃舵鐢熸晥鏃堕棿
- fitstSchedule.setEffectiveDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
- contractPaymentScheduleMapper.updateById(fitstSchedule);
+// fitstSchedule.setEffectiveEndDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(fitstSchedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName(afterSchedule.get(0).getStageName());
baseMapper.updateById(contract);
}
//鍙湁褰撳墠鍚堝悓绛惧瓧闃舵
- if(ArrayUtil.isEmpty(afterSchedule.toArray())){
- fitstSchedule.setEffectiveDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
- fitstSchedule.setEffectiveEndDate(contract.getExpirationDate());
- contractPaymentScheduleMapper.updateById(fitstSchedule);
- }
+// if(ArrayUtil.isEmpty(afterSchedule.toArray())){
+// fitstSchedule.setEffectiveEndDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(fitstSchedule);
+// }
}
private void savePaymentConfirm(Contract contract, ContractPaymentSchedule schedule) {
PaymentConfirm paymentConfirm = new PaymentConfirm();
- paymentConfirm.setBusinessType(schedule.getStageName()+"搴旀敹");
+ paymentConfirm.setBusinessType(schedule.getStageName() + "搴旀敹");
paymentConfirm.setBusGuestId(contract.getPartyAId());
paymentConfirm.setBusGuestName(contract.getPartyA());
paymentConfirm.setContractId(contract.getId());
@@ -333,30 +334,30 @@
paymentConfirm.setTransationAmount(schedule.getPlannedAmount());
paymentConfirm.setReceivableAmount(schedule.getPlannedAmount());
paymentConfirm.setTotalAmount(schedule.getPlannedAmount().multiply(new BigDecimal("-1")));
- PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,contract.getId())
+ PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
BigDecimal lastNewTotal = new BigDecimal("0");
- if(ObjUtil.isNotNull(lastNewConfirm)){
+ if (ObjUtil.isNotNull(lastNewConfirm)) {
lastNewTotal = lastNewConfirm.getTotalAmount();
}
paymentConfirm.setTotalAmount(lastNewTotal.subtract(paymentConfirm.getReceivableAmount()));
- if (schedule.getPaymentRatio().compareTo(new BigDecimal("0"))>0){
+ if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
paymentConfirmMapper.insert(paymentConfirm);
}
//瀹㈡埛浠樻瀹屾垚鍚堝悓
List<Contract> customerCompleteContractList = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, contract.getPartyAId())
- .eq(Contract::getPartyBId,SecurityUtils.getUser().getCompId()).apply(" amount = paid_amount"));
- if (ArrayUtil.isNotEmpty(customerCompleteContractList)){
+ .eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).apply(" amount = paid_amount"));
+ if (ArrayUtil.isNotEmpty(customerCompleteContractList)) {
List<BigDecimal> outAmountList = new ArrayList<>();
- for (Contract completeContract:customerCompleteContractList
- ) {
- PaymentConfirm contractLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,completeContract.getId())
+ for (Contract completeContract : customerCompleteContractList
+ ) {
+ PaymentConfirm contractLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, completeContract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
//鏌ヨ瀹㈡埛浠樻瀹屾垚鍚堝悓涓渶鍚庢槑缁嗛噾棰� 鏈夐鏀惰浆鍏ュ綋鍓嶅悎鍚�
- if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0){
+ if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
//鏂板瀹屾垚浠樻鍚堝悓 璧勯噾杞嚭
- PaymentConfirm outConfirm = BeanUtil.copyProperties(contractLastConfirm,PaymentConfirm.class,"id","transationAmount",
- "advanceAmount","receivableAmount","overdueAmount","totalAmount");
+ PaymentConfirm outConfirm = BeanUtil.copyProperties(contractLastConfirm, PaymentConfirm.class, "id", "transationAmount",
+ "advanceAmount", "receivableAmount", "overdueAmount", "totalAmount");
outConfirm.setBusinessType("璧勯噾杞嚭");
outConfirm.setConfirmTime(new Date());
outConfirm.setTransationAmount(contractLastConfirm.getTotalAmount());
@@ -365,21 +366,21 @@
outAmountList.add(outConfirm.getTransationAmount());
}
}
- if (ArrayUtil.isNotEmpty(outAmountList.toArray())){
+ if (ArrayUtil.isNotEmpty(outAmountList.toArray())) {
BigDecimal currentSum = new BigDecimal("0");
- for (BigDecimal currentAmount:outAmountList
- ) {
- currentSum=currentSum.add(currentAmount);
+ for (BigDecimal currentAmount : outAmountList
+ ) {
+ currentSum = currentSum.add(currentAmount);
//鏂板褰撳墠鍚堝悓 璧勯噾杞叆
- PaymentConfirm inConfirm = BeanUtil.copyProperties(paymentConfirm,PaymentConfirm.class,"id","transationAmount",
- "advanceAmount","receivableAmount","overdueAmount","totalAmount");
+ PaymentConfirm inConfirm = BeanUtil.copyProperties(paymentConfirm, PaymentConfirm.class, "id", "transationAmount",
+ "advanceAmount", "receivableAmount", "overdueAmount", "totalAmount");
inConfirm.setBusinessType("璧勯噾杞叆");
inConfirm.setConfirmTime(new Date());
inConfirm.setTransationAmount(currentSum.subtract(currentAmount));
inConfirm.setTotalAmount(paymentConfirm.getTotalAmount().add(currentSum));
- if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0){
+ if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
inConfirm.setAdvanceAmount(inConfirm.getTotalAmount());
- }else if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0"))<0){
+ } else if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0")) < 0) {
inConfirm.setReceivableAmount(inConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
}
paymentConfirmMapper.insert(inConfirm);
@@ -393,8 +394,9 @@
public R genCurrentOverdue() {
List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.lt(ContractPaymentSchedule::getEffectiveEndDate, DateUtil.today())
- .ne(ContractPaymentSchedule::getPaymentStatus,"2"));
- if (ArrayUtil.isNotEmpty(scheduleList.toArray())){
+ .ne(ContractPaymentSchedule::getPaymentStatus, "2")
+ .ne(ContractPaymentSchedule::getPaymentStatus,3));
+ if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
scheduleList.stream().forEach(contractPaymentSchedule -> {
Contract contract = baseMapper.selectById(contractPaymentSchedule.getContractId());
//搴旀敹瓒呮湡
@@ -408,10 +410,10 @@
overdueConfirm.setConfirmTime(new Date());
overdueConfirm.setScheduleId(contractPaymentSchedule.getId());
overdueConfirm.setScheduleName(contractPaymentSchedule.getStageName());
- PaymentConfirm newLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,contract.getId())
+ PaymentConfirm newLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- overdueConfirm.setTransationAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus()+"","0")?
- contractPaymentSchedule.getPlannedAmount():
+ overdueConfirm.setTransationAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
+ contractPaymentSchedule.getPlannedAmount() :
contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
overdueConfirm.setReceivableAmount(newLastConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
overdueConfirm.setOverdueAmount(overdueConfirm.getTransationAmount());
@@ -420,7 +422,7 @@
//鍒ゆ柇褰撳墠闃舵鏄惁宸茬敓鎴愪笂闃舵搴旀敹瓒呮湡
PaymentConfirm oiverdueConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getScheduleId, contractPaymentSchedule.getId())
.eq(PaymentConfirm::getBusinessType, "搴旀敹瓒呮湡"));
- if (ObjUtil.isNull(oiverdueConfirm)&&overdueConfirm.getTransationAmount().compareTo(new BigDecimal("0"))>0) {
+ if (ObjUtil.isNull(oiverdueConfirm) && overdueConfirm.getTransationAmount().compareTo(new BigDecimal("0")) > 0) {
overdueConfirm.setCompId(contractPaymentSchedule.getCompId());
paymentConfirmMapper.insert(overdueConfirm);
}
@@ -434,18 +436,18 @@
currentOverdue.setScheduleName(contractPaymentSchedule.getStageName());
currentOverdue.setCompId(contract.getCompId());
currentOverdue.setContractExpirTime(contractPaymentSchedule.getEffectiveEndDate());
- currentOverdue.setReceivableAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus()+"","0")?
- contractPaymentSchedule.getPlannedAmount():contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
- currentOverdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(),new Date(),true)));
- CurrentOverdue overdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getContractId,currentOverdue.getContractId())
- .eq(CurrentOverdue::getScheduleId,currentOverdue.getScheduleId()).last("limit 1"));
- if (ObjUtil.isNull(overdue)){
+ currentOverdue.setReceivableAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
+ contractPaymentSchedule.getPlannedAmount() : contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
+ currentOverdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
+ CurrentOverdue overdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getContractId, currentOverdue.getContractId())
+ .eq(CurrentOverdue::getScheduleId, currentOverdue.getScheduleId()).last("limit 1"));
+ if (ObjUtil.isNull(overdue)) {
currentOverdue.setCompId(contractPaymentSchedule.getCompId());
- if (currentOverdue.getReceivableAmount().compareTo(new BigDecimal("0"))>0){
+ if (currentOverdue.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) {
currentOverdueMapper.insert(currentOverdue);
}
- }else {
- overdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(),new Date(),true)));
+ } else {
+ overdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
currentOverdueMapper.updateById(overdue);
}
});
@@ -464,31 +466,31 @@
@Override
public R copyNewContract(Long id) {
Contract oldContract = baseMapper.selectById(id);
- Contract newContract = BeanUtil.copyProperties(oldContract,Contract.class,"id","createTime");
+ Contract newContract = BeanUtil.copyProperties(oldContract, Contract.class, "id", "createTime");
newContract.setContractNo(ContractNumberGenerator.generateContractNumber());
newContract.setPaidAmount(new BigDecimal("0"));
newContract.setBillingStatus("0");
newContract.setErpPushFlag("0");
newContract.setContractStatus(0);
List<Contract> contracts;
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,newContract.getContractNo()));
- while (ArrayUtil.isNotEmpty(contracts.toArray())){
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, newContract.getContractNo()));
+ while (ArrayUtil.isNotEmpty(contracts.toArray())) {
newContract.setContractNo(ContractNumberGenerator.generateContractNumber());
- contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo,newContract.getContractNo()));
+ contracts = baseMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, newContract.getContractNo()));
}
baseMapper.insert(newContract);
- List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId,id));
+ List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId, id));
subjectMatterList.stream().forEach(contractSubjectMatter -> {
- ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatter,ContractSubjectMatter.class,"id","createTime");
+ ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatter, ContractSubjectMatter.class, "id", "createTime");
subjectMatter.setContractId(newContract.getId());
subjectMatter.setDeliveryStatus(0);
subjectMatter.setDeliveredQuantity(new BigDecimal("0"));
subjectMatter.setRemainingQuantity(new BigDecimal("0"));
contractSubjectMatterMapper.insert(subjectMatter);
});
- List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId,id));
+ List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, id));
scheduleList.stream().forEach(contractPaymentSchedule -> {
- ContractPaymentSchedule schedule = BeanUtil.copyProperties(contractPaymentSchedule,ContractPaymentSchedule.class,"id","createTime");
+ ContractPaymentSchedule schedule = BeanUtil.copyProperties(contractPaymentSchedule, ContractPaymentSchedule.class, "id", "createTime");
schedule.setContractId(newContract.getId());
schedule.setPaymentStatus(0);
schedule.setActualAmount(new BigDecimal("0"));
@@ -503,53 +505,53 @@
public void exportContractYMJJGCLWord(Long id, HttpServletResponse response) {
Contract contract = baseMapper.selectById(id);
List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
- .eq(ContractSubjectMatter::getContractId,id).orderByAsc(ContractSubjectMatter::getCreateTime));
- Map<String,Object> map = new HashMap<>();
+ .eq(ContractSubjectMatter::getContractId, id).orderByAsc(ContractSubjectMatter::getCreateTime));
+ Map<String, Object> map = new HashMap<>();
//鍚堝悓鍩烘湰淇℃伅
- map.put("partyA",contract.getPartyA());
- map.put("partyB",contract.getPartyB());
- map.put("contractNo",contract.getContractNo());
- map.put("signPlace",contract.getSignPlace());
- map.put("signDate",DateUtil.formatDate(contract.getSignDate()));
- map.put("signDateYMD",DateUtil.format(contract.getSignDate(), DatePattern.CHINESE_DATE_PATTERN));
+ map.put("partyA", contract.getPartyA());
+ map.put("partyB", contract.getPartyB());
+ map.put("contractNo", contract.getContractNo());
+ map.put("signPlace", contract.getSignPlace());
+ map.put("signDate", DateUtil.formatDate(contract.getSignDate()));
+ map.put("signDateYMD", DateUtil.format(contract.getSignDate(), DatePattern.CHINESE_DATE_PATTERN));
map.put("total", contract.getAmount());
map.put("amountWords", Convert.digitToChinese(contract.getAmount()));
//鏍囩殑鐗�
- List<Map<String,Object>> items = new ArrayList<>();
+ List<Map<String, Object>> items = new ArrayList<>();
List<RowRenderData> dataList = new ArrayList<>();
AtomicReference<Integer> no = new AtomicReference<>(0);
subjectMatterList.stream().forEach(contractSubjectMatter -> {
- Map<String,Object> item = new HashMap<>();
- item.put("no",no);
- item.put("materialName",contractSubjectMatter.getMaterialName());
- item.put("guige","");
- item.put("unit","");
- item.put("quantity",contractSubjectMatter.getQuantity());
- item.put("danzhong","");
- item.put("zongzhong","");
- item.put("unitPrice",contractSubjectMatter.getUnitPrice());
- item.put("price",contractSubjectMatter.getTotalAmount());
+ Map<String, Object> item = new HashMap<>();
+ item.put("no", no);
+ item.put("materialName", contractSubjectMatter.getMaterialName());
+ item.put("guige", "");
+ item.put("unit", "");
+ item.put("quantity", contractSubjectMatter.getQuantity());
+ item.put("danzhong", "");
+ item.put("zongzhong", "");
+ item.put("unitPrice", contractSubjectMatter.getUnitPrice());
+ item.put("price", contractSubjectMatter.getTotalAmount());
items.add(item);
no.updateAndGet(v -> v + 1);
});
- map.put("items",items);
+ map.put("items", items);
//瀹氬埗鏂�
BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
- map.put("companyName",customer.getCompanyName());
- map.put("legalPerson",customer.getLegalPerson());
- map.put("contactPhone",customer.getContactPhone());
- map.put("bankName",customer.getBankName());
- map.put("bankAccount",customer.getBankAccount());
+ map.put("companyName", customer.getCompanyName());
+ map.put("legalPerson", customer.getLegalPerson());
+ map.put("contactPhone", customer.getContactPhone());
+ map.put("bankName", customer.getBankName());
+ map.put("bankAccount", customer.getBankAccount());
//鎵挎徑鏂�
R<SysDept> r = remoteDeptService.getById(contract.getPartyBId());
SysDept dept = r.getData();
- map.put("companyName",dept.getOrgName());
- map.put("legalPerson1",StrUtil.isNotEmpty(dept.getLegalPerson())?dept.getLegalPerson():"");
- map.put("entrustedAgent",StrUtil.isNotEmpty(dept.getLegalPerson())?"":dept.getEntrustedAgent());
- map.put("orgContact",dept.getOrgContact());
- map.put("orgBank",dept.getOrgBank());
- map.put("orgBankAccount",dept.getOrgBankAccount());
+ map.put("companyName", dept.getOrgName());
+ map.put("legalPerson1", StrUtil.isNotEmpty(dept.getLegalPerson()) ? dept.getLegalPerson() : "");
+ map.put("entrustedAgent", StrUtil.isNotEmpty(dept.getLegalPerson()) ? "" : dept.getEntrustedAgent());
+ map.put("orgContact", dept.getOrgContact());
+ map.put("orgBank", dept.getOrgBank());
+ map.put("orgBankAccount", dept.getOrgBankAccount());
//鐢熸垚鏂囦欢鍚�
Long time = new Date().getTime();
@@ -567,7 +569,7 @@
.bind("items", new LoopRowTableRenderPolicy()) // 灏� items 缁戝畾鍒拌寰幆绛栫暐
.build();
// 2. 缂栬瘧骞舵覆鏌撴暟鎹�
- XWPFTemplate xwpfTemplate = XWPFTemplate.compile(resource.getInputStream(),config).render(map);
+ XWPFTemplate xwpfTemplate = XWPFTemplate.compile(resource.getInputStream(), config).render(map);
// 3. 璁剧疆鍝嶅簲澶�
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
@@ -580,7 +582,7 @@
out.flush();
out.close();
xwpfTemplate.close(); // 閲嶈锛氬叧闂ā鐗堥噴鏀捐祫婧�
- }catch (IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
index ba953e1..9507420 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
@@ -269,21 +269,21 @@
//鏇存柊鍙戣揣鍓嶆敹娆剧敓鏁堟椂闂�
if (ObjUtil.isNull(schedule.getEffectiveDate())) {
- schedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
+ schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
//鏌ヨ鏄惁鏈夊悗缁樁娈�
- List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contractId)
- .gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
- if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
- schedule.setEffectiveEndDate(contract.getExpirationDate());
- }
+// List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contractId)
+// .gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
+// if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
+// schedule.setEffectiveEndDate(contract.getExpirationDate());
+// }
scheduleMapper.updateById(schedule);
//鏌ヨ鏄惁鏈変箣鍓嶉樁娈�
- ContractPaymentSchedule beforeSchedule = scheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
- .lt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()).orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
- if (ObjUtil.isNotNull(beforeSchedule)) {
- beforeSchedule.setEffectiveEndDate(schedule.getEffectiveDate());
- scheduleMapper.updateById(beforeSchedule);
- }
+// ContractPaymentSchedule beforeSchedule = scheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
+// .lt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()).orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
+// if (ObjUtil.isNotNull(beforeSchedule)) {
+// beforeSchedule.setEffectiveEndDate(schedule.getEffectiveDate());
+// scheduleMapper.updateById(beforeSchedule);
+// }
//鏇存柊灞ョ害
ContractPaymentScheduleProcess contractPaymentScheduleProcess = new ContractPaymentScheduleProcess();
contractPaymentScheduleProcess.setContractId(schedule.getContractId());
@@ -291,7 +291,11 @@
contractPaymentScheduleProcess.setScheduleId(schedule.getId());
contractPaymentScheduleProcess.setScheduleName(schedule.getStageName());
contractPaymentScheduleProcess.setProcessDate(addDTO.getOutBoundTime());
- scheduleProcessMapper.insert(contractPaymentScheduleProcess);
+ ContractPaymentScheduleProcess lastProcess = scheduleProcessMapper.selectOne(Wrappers.<ContractPaymentScheduleProcess>lambdaQuery().eq(ContractPaymentScheduleProcess::getContractId, schedule.getContractId())
+ .eq(ContractPaymentScheduleProcess::getScheduleId, schedule.getId()).last("limit 1"));
+ if (ObjUtil.isNull(lastProcess)) {
+ scheduleProcessMapper.insert(contractPaymentScheduleProcess);
+ }
}
//鏌ヨ鏄惁鏈夊悗缁樁娈�
@@ -303,13 +307,11 @@
//鏈�鍚庨樁娈电敓鏁堟椂闂�
ContractPaymentSchedule endSchedule = afterSchedule.get(0);
if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
- endSchedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), endSchedule.getAgreedDays()));
- endSchedule.setEffectiveEndDate(contract.getExpirationDate());
- scheduleMapper.updateById(endSchedule);
+// endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), endSchedule.getAgreedDays()));
+// scheduleMapper.updateById(endSchedule);
//褰撳墠闃舵鐢熸晥鏃堕棿
- schedule.setEffectiveDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
- schedule.setEffectiveEndDate(endSchedule.getEffectiveDate());
- scheduleMapper.updateById(schedule);
+// schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
+// scheduleMapper.updateById(schedule);
//鏈�鍚庨樁娈靛簲鏀�
PaymentConfirm newConfim = new PaymentConfirm();
newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
@@ -344,8 +346,8 @@
contractMapper.updateById(contract);
}
if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
- schedule.setEffectiveEndDate(contract.getExpirationDate());
- scheduleMapper.updateById(schedule);
+// schedule.setEffectiveEndDate(contract.getExpirationDate());
+// scheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("鏃�");
contractMapper.updateById(contract);
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
index 8bf75cf..851c239 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -120,7 +120,7 @@
}
//鏇存柊浠樻闃舵浠樻
List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+ .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
.orderByAsc(ContractPaymentSchedule::getCreateTime));
if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
BigDecimal remain = addDTO.getTransationAmount();
@@ -295,7 +295,8 @@
break;
} else {
entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
- entity.setTotalAmount(transtionAmount);
+ entity.setReceivableAmount(transtionRemainAmount.multiply(new BigDecimal("-1")));
+ entity.setTotalAmount(transtionRemainAmount);
entity.setConfirmTime(payDate);
baseMapper.insert(entity);
payContractList.add(contract);
@@ -307,6 +308,7 @@
//鏇存柊浠樻闃舵浠樻
List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+ .ne(ContractPaymentSchedule::getPaymentStatus, 3)
.orderByAsc(ContractPaymentSchedule::getCreateTime));
if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
BigDecimal remain = transtionAmount;
@@ -361,16 +363,18 @@
//鍚堝悓鎵�鏈変粯娆鹃樁娈�
List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
- );
+ .ne(ContractPaymentSchedule::getPaymentStatus, 3));
if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
- BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
+ BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "2") ? item.getPlannedAmount() :
item.getActualAmount()).reduce(BigDecimal.ZERO,BigDecimal::add);
contract.setPaidAmount(payTotal);
- if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
- contract.setContractStatus(3);
- }
+// if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
+// contract.setContractStatus(3);
+// }
contractService.updateById(contract);
if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
+ contract.setBillingStatus("2");
+ contract.setContractStatus(3);
payCompleteContractList.add(contract);
}
//浠樻 涓� 浠樻鏈叏浠�
@@ -619,7 +623,7 @@
payContractList.stream().forEach(contract -> {
//鏇存柊浠樻闃舵浠樻
List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+ .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
.orderByAsc(ContractPaymentSchedule::getCreateTime));
if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
BigDecimal remain = transtionAmount;
@@ -673,7 +677,7 @@
}
//鍚堝悓鎵�鏈変粯娆鹃樁娈�
List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
+ .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0).ne(ContractPaymentSchedule::getPaymentStatus,3)
);
if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
index fcc0580..30ff48c 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
@@ -77,7 +77,7 @@
//鏇存柊浠樻闃舵浠樻
List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId,contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus,2)
- .orderByAsc(ContractPaymentSchedule::getCreateTime));
+ .ne(ContractPaymentSchedule::getPaymentStatus,3).orderByAsc(ContractPaymentSchedule::getCreateTime));
if (ArrayUtil.isNotEmpty(scheduleList.toArray())){
BigDecimal remain = paymentOffset.getOffsetAmount();
for (ContractPaymentSchedule schedule:scheduleList) {
@@ -135,17 +135,18 @@
}
paid = paid.add(paymentOffset.getOffsetAmount());
contract.setPaidAmount(paid);
- if (paid.compareTo(contract.getAmount())>0){
- contract.setPaidAmount(contract.getAmount());
+ if (paid.compareTo(contract.getAmount())==0){
+ contract.setBillingStatus("2");
+ contract.setContractStatus(3);
}
contractService.updateById(contract);
// 鏌ヨ鎵�鏈変粯娆鹃樁娈垫槸鍚﹂兘浠樻瀹屾垚
- if (ArrayUtil.isNotEmpty(scheduleList.toArray())){
- if (scheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))){
- contract.setContractStatus(3);
- contractService.updateById(contract);
- };
- }
+// if (ArrayUtil.isNotEmpty(scheduleList.toArray())){
+// if (scheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))){
+// contract.setContractStatus(3);
+// contractService.updateById(contract);
+// };
+// }
return R.ok();
}
}
\ No newline at end of file
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 dfecfbd..6899e89 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,9 +1,7 @@
package com.by4cloud.platformx.business.service.impl;
-import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
-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;
@@ -14,16 +12,12 @@
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
@Service
@RequiredArgsConstructor
@@ -75,6 +69,25 @@
compIds.add(Long.valueOf(ymj));
compIds.add(Long.valueOf(jxc));
List<ContractIncomeAnalysisVo> contractIncomeAnalysisVoList = contractMapper.contractIncomeAnalysis(commonDTO,compIds);
+ if (ArrayUtil.isNotEmpty(contractIncomeAnalysisVoList.toArray())){
+ contractIncomeAnalysisVoList.stream().forEach(contractIncomeAnalysisVo -> {
+ if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),sgb)){
+ contractIncomeAnalysisVo.setCompName("鐭冲伐娉�");
+ }
+ if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),smj)){
+ contractIncomeAnalysisVo.setCompName("鐭崇叅鏈�");
+ }
+ if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),ymj)){
+ contractIncomeAnalysisVo.setCompName("涓�鐓ゆ満");
+ }
+ if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),tfgs)){
+ contractIncomeAnalysisVo.setCompName("閫氭柟鍏徃");
+ }
+ if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),jxc)){
+ contractIncomeAnalysisVo.setCompName("鏈烘鍘�");
+ }
+ });
+ }
return R.ok(contractIncomeAnalysisVoList);
}
@@ -284,4 +297,45 @@
return R.ok(contractIncomeAnalysisVoList);
}
+
+ @Override
+ public R contractAmountAnalysisBySaleModel(AnalysisCommonDTO commonDTO) {
+ R<List<SysDictItem>> r = remoteDictService.getDictByType("sales_model");
+ List<SysDictItem> items = r.getData();
+ if (ArrayUtil.isEmpty(items.toArray())){
+ return R.failed("鍖哄煙瀛楁鑾峰彇寮傚父");
+ }
+ 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));
+ List<ContractIncomeAnalysisAreaVo> contractIncomeAnalysisVoList = items.stream().map(item -> {
+ ContractIncomeAnalysisAreaVo analysisAreaVo = new ContractIncomeAnalysisAreaVo();
+ analysisAreaVo.setAreaId(item.getItemValue());
+ analysisAreaVo.setAreaName(item.getLabel());
+ return analysisAreaVo;
+ }).collect(Collectors.toList());
+ contractMapper.setSession();
+ List<ContractIncomeAnalysisAreaVo> statisticList = contractMapper.contractAmountAnalysisBySaleModel(commonDTO
+ ,compIds,Long.valueOf(smj),Long.valueOf(sgb),Long.valueOf(jxc),Long.valueOf(tfgs),Long.valueOf(ymj));
+ contractIncomeAnalysisVoList.stream().forEach(vo1->{
+ statisticList.stream().forEach(vo2->{
+ if (StrUtil.equals(vo1.getAreaId(),vo2.getAreaId())){
+ vo1.setJxczb(vo2.getJxczb());
+ vo1.setJxcze(vo2.getJxcze());
+ vo1.setSgbzb(vo2.getSgbzb());
+ vo1.setSgbze(vo2.getSgbze());
+ vo1.setSmjzb(vo2.getSmjzb());
+ vo1.setSmjze(vo2.getSmjze());
+ vo1.setTfzb(vo2.getTfzb());
+ vo1.setTfze(vo2.getTfze());
+ vo1.setYmjzb(vo2.getYmjzb());
+ vo1.setYmjze(vo2.getYmjze());
+ }
+ });
+ });
+ return R.ok(contractIncomeAnalysisVoList);
+ }
}
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
index 0aea4e5..765f216 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -184,7 +184,7 @@
<select id="contractIncomeAnalysis"
resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisVo">
SELECT
- compName,
+ compId,
SUM(CASE WHEN month_num = 1 THEN total_amount ELSE 0 END) AS 'srMonth1',
SUM(CASE WHEN month_num = 1 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth1',
SUM(CASE WHEN month_num = 1 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth1',
@@ -202,9 +202,9 @@
SUM(CASE WHEN month_num = 4 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth4',
SUM(CASE WHEN month_num = 4 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth4',
SUM(CASE WHEN month_num = 5 THEN total_amount ELSE 0 END) AS 'srMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 0 THEN total_amount ELSE 0 END) AS 'xhMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'cdMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'qtMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth5',
SUM(CASE WHEN month_num = 6 THEN total_amount ELSE 0 END) AS 'srMonth6',
SUM(CASE WHEN month_num = 6 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth6',
SUM(CASE WHEN month_num = 6 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth6',
@@ -235,7 +235,7 @@
SUM(CASE WHEN month_num = 12 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth12'
FROM (
SELECT
- COALESCE(pc.payee_comp_id, '鏈煡鍗曚綅') AS compName,
+ COALESCE(pc.payee_comp_id, '鏈煡鍗曚綅') AS compId,
MONTH(payment_time) AS month_num,
pay_type,
COALESCE(payment_amount, 0) AS total_amount
@@ -250,7 +250,7 @@
#{id}
</foreach>
) AS source_data
- GROUP BY compName
+ GROUP BY compId
</select>
<select id="contractIncomeAnalysisByComp"
@@ -746,9 +746,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -761,9 +763,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -776,9 +780,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -791,9 +797,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -806,9 +814,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -818,7 +828,8 @@
FROM
contract c
WHERE
- c.supply_attribute IS NOT NULL
+ c.del_flag = '0'
+ and c.supply_attribute IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
c.supply_attribute
@@ -888,4 +899,113 @@
ORDER BY m.month_num
</select>
+ <select id="contractAmountAnalysisBySaleModel"
+ resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisAreaVo">
+ SELECT
+ b.sales_model area_id,
+ SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) AS sgbze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS sgbzb,
+ SUM( CASE WHEN c.party_b_id = #{jxcCompId} THEN c.amount ELSE 0 END ) AS jxcze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{jxcCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS jxczb ,
+ SUM( CASE WHEN c.party_b_id = #{smjCompId} THEN c.amount ELSE 0 END ) AS smjze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{smjCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS smjzb ,
+ SUM( CASE WHEN c.party_b_id = #{ymjCompId} THEN c.amount ELSE 0 END ) AS ymjze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{ymjCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS ymjzb ,
+ SUM( CASE WHEN c.party_b_id = #{tfCompId} THEN c.amount ELSE 0 END ) AS tfze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{tfCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS tfzb
+ FROM
+ contract c
+ JOIN business_customer b ON c.party_a_id = b.id
+ WHERE
+ b.sales_model IS NOT NULL
+ AND YEAR ( sign_date ) = #{queryDTO.year}
+ GROUP BY
+ b.sales_model
+
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1