From d6ef95a56915bd2c04a5956f632e5833afe627e1 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期五, 15 八月 2025 15:38:56 +0800
Subject: [PATCH] 修改关联
---
service/src/main/resources/mapper/cwgl/EstimatedReceivableBillLogMapper.xml | 5 ++
service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBill.java | 6 +-
service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java | 6 +-
service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java | 11 +++--
service/src/main/java/com/ruoyi/cwgl/domain/vo/CreateBillVo.java | 4 +
service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableBillServiceImpl.java | 16 ++++---
service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java | 21 +++++-----
service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java | 2
service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBillLog.java | 5 ++
9 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
index 122b176..b890a00 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
@@ -75,7 +75,7 @@
@Excel(name = "棰勪及璐圭敤閲戦")
@TableField("estimated_amount")
- private Long estimatedAmount;
+ private BigDecimal estimatedAmount;
/** 甯佸埗 */
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBill.java b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBill.java
index 663653b..8a184b1 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBill.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBill.java
@@ -54,20 +54,20 @@
@Excel(name = "搴旂粨绠楅噾棰�")
@TableField("total_amount")
- private Long totalAmount;
+ private BigDecimal totalAmount;
/** 宸茬粨绠楅噾棰� */
@Excel(name = "宸茬粨绠楅噾棰�")
@TableField("settled_amount")
- private Long settledAmount;
+ private BigDecimal settledAmount;
/**
* 鏈缁撶畻閲戦
*/
@TableField(exist = false)
- private Long settlementAmount;
+ private BigDecimal settlementAmount;
/** 寮�绁ㄧ姸鎬� */
@Excel(name = "寮�绁ㄧ姸鎬�")
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBillLog.java b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBillLog.java
index 7c729bd..3ca37fb 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBillLog.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivableBillLog.java
@@ -44,5 +44,10 @@
@TableField("operation")
private String operation;
+ /**
+ * 闄勪欢鍚嶇О
+ */
+ @TableField("file_name")
+ private String fileName;
}
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java b/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
index 35c804f..914308c 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
@@ -167,21 +167,21 @@
@Excel(name = "棰勪及鎬绘敹鍏�")
@TableField("estimated_total_income")
- private Long estimatedTotalIncome;
+ private BigDecimal estimatedTotalIncome;
/** 棰勪及鎬绘垚鏈� */
@Excel(name = "棰勪及鎬绘垚鏈�")
@TableField("estimated_total_cost")
- private Long estimatedTotalCost;
+ private BigDecimal estimatedTotalCost;
/** 棰勪及鍒╂鼎 */
@Excel(name = "棰勪及鍒╂鼎")
@TableField("estimated_profit")
- private Long estimatedProfit;
+ private BigDecimal estimatedProfit;
/** 鐢靛瓙閿� */
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/vo/CreateBillVo.java b/service/src/main/java/com/ruoyi/cwgl/domain/vo/CreateBillVo.java
index 5637e5c..ad32829 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/vo/CreateBillVo.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/vo/CreateBillVo.java
@@ -3,6 +3,8 @@
import lombok.Data;
+import java.math.BigDecimal;
+
/**
* 鍒涘缓璐﹀崟vo
*/
@@ -28,5 +30,5 @@
/**
* 缁撶畻閲戦
*/
- private Long price;
+ private BigDecimal price;
}
diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableBillServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableBillServiceImpl.java
index b0718c1..2b0ab09 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableBillServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableBillServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.cwgl.service.impl;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -215,11 +216,11 @@
Integer id = estimatedReceivableBill.getId();
EstimatedReceivableBill oldData = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(id);
//搴旂粨绠楅噾棰�
- Long totalAmount = oldData.getTotalAmount()==null?0L:oldData.getTotalAmount();
+ BigDecimal totalAmount = oldData.getTotalAmount()==null?BigDecimal.ZERO:oldData.getTotalAmount();
//宸茬粨绠楅噾棰�
- Long settledAmount = oldData.getSettledAmount()==null?0L:oldData.getSettledAmount();
+ BigDecimal settledAmount = oldData.getSettledAmount()==null?BigDecimal.ZERO:oldData.getSettledAmount();
//褰撳墠鎻愪氦閲戦
- Long settlementAmount = estimatedReceivableBill.getSettlementAmount();
+ BigDecimal settlementAmount = estimatedReceivableBill.getSettlementAmount();
EstimatedReceivableBillLog estimatedReceivableBillLog = new EstimatedReceivableBillLog();
estimatedReceivableBill.setSettledAmount(settlementAmount);
@@ -227,10 +228,11 @@
estimatedReceivableBillLog.setBillId(estimatedReceivableBill.getId());
estimatedReceivableBillLog.setCreateBy(SecurityUtils.getUsername());
estimatedReceivableBillLog.setOperation("鏈鎻愪氦閲戦"+ settlementAmount);
+ estimatedReceivableBillLog.setFileName(estimatedReceivableBill.getAttachment());
logService.insertEstimatedReceivableBillLog(estimatedReceivableBillLog);
- settledAmount = settledAmount+settlementAmount;
+ settledAmount = settledAmount.add(settlementAmount);
List<String>dispatchNos =pendingSettlementBusinessMapper.selectPendingSettlementBusinessDispatchNos(estimatedReceivableBill.getId());
- if (settledAmount>totalAmount){
+ if (settledAmount.compareTo(totalAmount) > 0){
//宸茬粨绠楀ぇ浜庡簲璁$畻閲戦涓哄凡缁撶畻
estimatedReceivableBill.setStatus(2);
estimatedReceivableMapper.updateEstimatedReceivableBillStatus(dispatchNos,3);
@@ -252,8 +254,8 @@
EstimatedReceivableBill estimatedReceivableBill = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(billId);
estimatedReceivableBill.setDispatchCount(estimatedReceivableBill.getDispatchCount()-1);
//搴旂粨绠楅噾棰濅慨鏀�
- Long totalAmount = estimatedReceivableBill.getTotalAmount();
- estimatedReceivableBill.setTotalAmount(totalAmount-pendingSettlementBusiness.getEstimatedTotalIncome());
+ BigDecimal totalAmount = estimatedReceivableBill.getTotalAmount();
+ estimatedReceivableBill.setTotalAmount(totalAmount.subtract(pendingSettlementBusiness.getEstimatedTotalIncome()));
EstimatedReceivableBillLog estimatedReceivableBillLog = new EstimatedReceivableBillLog();
estimatedReceivableBillLog.setCreateTime(new Date());
estimatedReceivableBillLog.setBillId(billId);
diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java
index 6fcc699..02aef7d 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.cwgl.service.impl;
+import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -158,19 +159,19 @@
throw new ServiceException("缁撶畻涓垨宸茬粨绠楁棤娉曚慨鏀�");
}
//鍘熸湰閲戦
- Long oldAmount = estimatedReceivable1.getEstimatedAmount();
+ BigDecimal oldAmount = estimatedReceivable1.getEstimatedAmount();
//鏂伴噾棰�
- Long newAmount = estimatedReceivable.getEstimatedAmount();
+ BigDecimal newAmount = estimatedReceivable.getEstimatedAmount();
if (!oldAmount.equals(newAmount)) {
PendingSettlementBusiness pendingSettlementBusiness = pendingSettlementBusinessMapper.selectPendingSettlementBusinessByNo(estimatedReceivable.getDispatchNo());
if (pendingSettlementBusiness!=null) {
- Long estimatedTotalIncome = pendingSettlementBusiness.getEstimatedTotalIncome();
- pendingSettlementBusiness.setEstimatedTotalIncome(estimatedTotalIncome-oldAmount+newAmount);
+ BigDecimal estimatedTotalIncome = pendingSettlementBusiness.getEstimatedTotalIncome();
+ pendingSettlementBusiness.setEstimatedTotalIncome(estimatedTotalIncome.subtract(oldAmount).add(newAmount));
pendingSettlementBusinessMapper.updatePendingSettlementBusiness(pendingSettlementBusiness);
if (pendingSettlementBusiness.getBillId() != null) {
EstimatedReceivableBill estimatedReceivableBill = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(pendingSettlementBusiness.getBillId());
- estimatedReceivableBill.setTotalAmount(estimatedReceivableBill.getTotalAmount() -oldAmount + newAmount);
+ estimatedReceivableBill.setTotalAmount(estimatedReceivableBill.getTotalAmount().subtract( oldAmount).add( newAmount));
estimatedReceivableBillMapper.updateEstimatedReceivableBill(estimatedReceivableBill);
}
}
diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
index 1a37949..e942a58 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.cwgl.service.impl;
+import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@@ -248,7 +249,7 @@
String customerName = pendingSettlementBusinesses.get(0).getCustomerName();
createBillVo.setCustomerName(customerName);
createBillVo.setCount(pendingSettlementBusinesses.size());
- long priceTotal = 0L;
+ BigDecimal priceTotal = BigDecimal.ZERO;
for (PendingSettlementBusiness pendingSettlementBusiness : pendingSettlementBusinesses) {
if (pendingSettlementBusiness.getIsCreate().equals(1)){
throw new ServiceException(pendingSettlementBusiness.getDispatchNo()+"宸插叆璐�");
@@ -258,7 +259,7 @@
throw new ServiceException("鍙兘閫夋嫨鐩稿悓瀹㈡埛鍚嶇О鐨勬暟鎹�");
}
- priceTotal += pendingSettlementBusiness.getEstimatedTotalIncome()==null?0L:pendingSettlementBusiness.getEstimatedTotalIncome();
+ priceTotal =priceTotal.add( pendingSettlementBusiness.getEstimatedTotalIncome()==null?BigDecimal.ZERO:pendingSettlementBusiness.getEstimatedTotalIncome());
}
createBillVo.setPrice(priceTotal);
return createBillVo;
@@ -272,9 +273,9 @@
}
pendingSettlementBusiness.setIsCreate(0);
List<PendingSettlementBusiness> pendingSettlementBusinesses = pendingSettlementBusinessMapper.selectPendingSettlementBusinessList(pendingSettlementBusiness);
- long priceTotal = pendingSettlementBusinesses.stream()
- .mapToLong(b -> Optional.ofNullable(b.getEstimatedTotalIncome()).orElse(0L))
- .sum();
+ BigDecimal priceTotal = pendingSettlementBusinesses.stream()
+ .map(b -> Optional.ofNullable(b.getEstimatedTotalIncome()).orElse(BigDecimal.ZERO))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
CreateBillVo createBillVo = new CreateBillVo();
createBillVo.setCustomerName(customerName);
createBillVo.setCount(pendingSettlementBusinesses.size());
@@ -313,7 +314,7 @@
estimatedReceivableBill.setCustomerName(createBillVo.getCustomerName());
estimatedReceivableBill.setDispatchCount(createBillVo.getCount());
estimatedReceivableBill.setTotalAmount(createBillVo.getPrice());
- estimatedReceivableBill.setSettledAmount(0L);
+ estimatedReceivableBill.setSettledAmount(BigDecimal.ZERO);
estimatedReceivableBill.setInvoiceStatus(0);
estimatedReceivableBill.setStatus(0);
estimatedReceivableBill.setCreateBy(username);
@@ -347,9 +348,9 @@
Date date = new Date();
String datePart = dateFormat.format(date);
- long priceTotal = pendingSettlementBusinesses.stream()
- .mapToLong(b -> Optional.ofNullable(b.getEstimatedTotalIncome()).orElse(0L))
- .sum();
+ BigDecimal priceTotal = pendingSettlementBusinesses.stream()
+ .map(b -> Optional.ofNullable(b.getEstimatedTotalIncome()).orElse(BigDecimal.ZERO))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
//璋冨害鍗曢泦鍚�
List<String> collect = pendingSettlementBusinesses.stream().map(PendingSettlementBusiness::getDispatchNo).collect(Collectors.toList());
EstimatedReceivableBill estimatedReceivableBill = new EstimatedReceivableBill();
@@ -359,7 +360,7 @@
estimatedReceivableBill.setCustomerName(customerName);
estimatedReceivableBill.setDispatchCount(pendingSettlementBusinesses.size());
estimatedReceivableBill.setTotalAmount(priceTotal);
- estimatedReceivableBill.setSettledAmount(0L);
+ estimatedReceivableBill.setSettledAmount(BigDecimal.ZERO);
estimatedReceivableBill.setInvoiceStatus(0);
estimatedReceivableBill.setStatus(0);
estimatedReceivableBill.setCreateBy(username);
diff --git a/service/src/main/resources/mapper/cwgl/EstimatedReceivableBillLogMapper.xml b/service/src/main/resources/mapper/cwgl/EstimatedReceivableBillLogMapper.xml
index e53c414..0220992 100644
--- a/service/src/main/resources/mapper/cwgl/EstimatedReceivableBillLogMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/EstimatedReceivableBillLogMapper.xml
@@ -10,10 +10,11 @@
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="operation" column="operation" />
+ <result property="fileName" column="file_name" />
</resultMap>
<sql id="selectEstimatedReceivableBillLogVo">
- select thisTab.id, thisTab.bill_id, thisTab.create_by, thisTab.create_time, thisTab.operation from estimated_receivable_bill_log AS thisTab
+ select thisTab.id, thisTab.bill_id, thisTab.create_by, thisTab.create_time, thisTab.operation, thisTab.file_name from estimated_receivable_bill_log AS thisTab
</sql>
<sql id="selectEstimatedReceivableBillLogVoCount">
select count(0) from estimated_receivable_bill_log as thisTab
@@ -53,12 +54,14 @@
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="operation != null">operation,</if>
+ <if test="fileName != null">file_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billId != null">#{billId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="operation != null">#{operation},</if>
+ <if test="fileName != null">#{fileName},</if>
</trim>
</insert>
--
Gitblit v1.8.0