Selaa lähdekoodia

解决协议被删除后,发票的开票明细查询不出数据的问题

lipf 3 kuukautta sitten
vanhempi
commit
016258191d

+ 21 - 0
commons/src/main/java/com/jzg/commons/util/BigDecimalUtil.java

@@ -1,7 +1,10 @@
 package com.jzg.commons.util;
 
+import cn.hutool.core.collection.CollUtil;
+
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.List;
 
 
 /**
@@ -29,6 +32,24 @@ public class BigDecimalUtil {
         return v1.add(v2);
     }
 
+    /**
+     * 将多个值进行相加
+     *
+     * @param items 要相加的值
+     * @author lipf
+     * @date 2026/6/6 10:22
+     */
+    public static BigDecimal add(List<BigDecimal> items){
+        if(CollUtil.isEmpty(items)) {
+            return BigDecimal.ZERO;
+        }
+        BigDecimal sum = BigDecimal.ZERO;
+        for (BigDecimal item : items) {
+            sum = sum.add(item);
+        }
+        return sum;
+    }
+
     /**
      * 提供精确的减法运算
      * @param v1 被减数

+ 5 - 5
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -657,7 +657,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         // 2. 数据库校验:是否已存在开票记录
         Integer count = baseMapper.invoicingCheck(invoicingVo);
         if (count > 0) {
-            log.info("数据库已存在开票记录,直接禁止");
+            log.info("数据库已存在开票记录,直接禁止开票");
             return false;
         }
 
@@ -830,7 +830,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             log.info("开票异常.invoicingVo=[{}]",JSONUtil.toJsonStr(invoicingVo), e);
             // 回滚事务
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return null;
+            throw new ServiceException(Objects.toString(e.getMessage(),"开票异常"));
         }
     }
 
@@ -844,9 +844,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         if(invoicingVo == null){
             throw new ServiceException("无法开票,开票参数为空");
         }
-        if(StrUtil.isEmpty(invoicingVo.getInvoiceNo())){
-            throw new ServiceException("发票号不能为空");
-        }
+//        if(StrUtil.isEmpty(invoicingVo.getInvoiceNo())){
+//            throw new ServiceException("发票号不能为空");
+//        }
     }
 
     @Override

+ 2 - 1
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -608,7 +608,7 @@
         AND ipii.is_delete = 0
         AND ipi.is_delete = 0
         AND io.is_delete = 0
-        AND agree.is_delete = 0
+<!--        AND agree.is_delete = 0 modify by lipf 2026年6月6日14:53:23   解决协议被删除后,相关的开票信息,结算信息查询不出来的问题 -->
         <if test="settlementQueryVo.settlementIds != null and settlementQueryVo.settlementIds != ''">
             AND ipiis.id IN
             <foreach collection="settlementQueryVo.settlementIds" item="settlementId" open="(" separator="," close=")">
@@ -1131,6 +1131,7 @@
         SELECT count(id) AS count
         FROM ins_ply_income_invoice_link
         <where>
+            is_delete = 0
             <if test="invoicingVo.incomeIds != null and invoicingVo.incomeIds.size > 0">
                 AND income_id IN
                 <foreach collection="invoicingVo.incomeIds"