Browse Source

2023年1月11 17:41

wangzhuo 2 years ago
parent
commit
9332b14329

+ 1 - 19
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/excel/ChargeItemExcel.java

@@ -34,22 +34,10 @@ public class ChargeItemExcel {
 	/**
 	 * 应收金额
 	 */
-	@ExcelProperty(value = "应收金额")
+	@ExcelProperty(value = "金额")
 	private BigDecimal amount;
 
 	/**
-	 * 已收金额
-	 */
-	@ExcelProperty(value = "已收金额")
-	private BigDecimal settlementAmount;
-
-	/**
-	 * 余额
-	 */
-	@ExcelProperty(value = "余额")
-	private BigDecimal balance;
-
-	/**
 	 * 科目代码
 	 */
 	@ExcelProperty(value = "科目代码")
@@ -80,12 +68,6 @@ public class ChargeItemExcel {
 	private String overPayment;
 
 	/**
-	 * 使用返利
-	 */
-	@ExcelProperty(value = "使用返利")
-	private String usedProfit;
-
-	/**
 	 * 使用溢付款
 	 */
 	@ExcelProperty(value = "使用溢付款")

+ 2 - 14
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/excel/PayItemExcel.java

@@ -32,24 +32,12 @@ public class PayItemExcel {
 	private BigDecimal quantity;
 
 	/**
-	 * 应收金额
+	 * 金额
 	 */
-	@ExcelProperty(value = "应收金额")
+	@ExcelProperty(value = "金额")
 	private BigDecimal amount;
 
 	/**
-	 * 已收金额
-	 */
-	@ExcelProperty(value = "已收金额")
-	private BigDecimal settlementAmount;
-
-	/**
-	 * 余额
-	 */
-	@ExcelProperty(value = "余额")
-	private BigDecimal balance;
-
-	/**
 	 * 科目代码
 	 */
 	@ExcelProperty(value = "科目代码")

+ 48 - 0
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/vojo/Acc.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.finance.vojo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
@@ -488,4 +489,51 @@ public class Acc implements Serializable {
 	@TableField(exist = false)
 	private List<String> srcDateList;
 
+	/**
+	 * 科目代码
+	 */
+	@TableField(exist = false)
+	private String subjectNumber;
+
+	/**
+	 * 开户银行
+	 */
+	@TableField(exist = false)
+	private String accountBank;
+
+	/**
+	 * 银行户头
+	 */
+	@TableField(exist = false)
+	private String accountName;
+
+	/**
+	 * 银行账号
+	 */
+	@TableField(exist = false)
+	private String accountNo;
+
+	/**
+	 * 溢付款
+	 */
+	@TableField(exist = false)
+	private String overPayment;
+
+	/**
+	 * 使用返利
+	 */
+	@TableField(exist = false)
+	private String usedProfit;
+
+	/**
+	 * 使用溢付款
+	 */
+	@TableField(exist = false)
+	private String caseOverPayment;
+
+	/**
+	 * 应收或应付
+	 */
+	@TableField(exist = false)
+	private String chargePay;
 }

+ 2 - 1
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.java

@@ -88,7 +88,8 @@ public interface AccMapper extends BaseMapper<Acc> {
 
 	List<Acc> selBillBalance(IPage<Acc> page, @Param("acc") Acc acc);
 
-	List<Acc> SelAccItem(IPage<Acc> page, @Param("acc") Acc acc);
+	List<Acc> SelChargeItem(IPage<Acc> page, @Param("acc") Acc acc);
+	List<Acc> SelPayItem(IPage<Acc> page, @Param("acc") Acc acc);
 
 	Map<String, Object> SumBillBalance(@Param("acc") Acc acc);
 }

+ 54 - 17
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.xml

@@ -70,8 +70,7 @@
         LEFT JOIN (
             SELECT
                 FC.Corpid AS corpId,
-                SUM( FC.Amount ) AS amount,
-                SUM( FC.Settlement_Amount ) AS settlementAmount
+                SUM( FC.Amount ) AS amount
             FROM finance_acc FC
             <where>
                 FC.tenant_id = #{acc.tenantId}
@@ -124,28 +123,18 @@
         HAVING SUM(IFNULL( IFNULL( BC.amount, 0 ) - IFNULL( FS.settlementAmount, 0 ), 0 )) >= 100
     </select>
 
-    <select id="SelAccItem" resultType="org.springblade.finance.vojo.Acc">
-        SELECT DISTINCT
+    <select id="SelChargeItem" resultType="org.springblade.finance.vojo.Acc">
+        SELECT
             FA.AccSysNo AS accSysNo,
             FA.quantity AS quantity,
-            FA.Amount AS amount,
-            FA.Settlement_Amount AS settlementAmount,
-            IFNULL( IFNULL( FA.Amount, 0 ) - IFNULL( FA.Settlement_Amount, 0 ), 0 ) AS balance,
-            FS.subject_number as subjectNumber,
-            FS.ACCOUNT_bank AS accountBank,
-            FS.ACCOUNT_NAME AS accountName,
-            FS.ACCOUNT_no AS accountNo,
-            FS.over_payment AS overPayment,
-            0 as usedProfit,
-            FS.case_over_payment AS caseOverPayment
+            FA.Amount AS amount
         FROM finance_acc FA
-                 LEFT JOIN finance_settlement FS ON FS.Src_OrderNo = FA.AccSysNo
         <where>
             FA.tenant_id = #{acc.tenantId}
             AND FA.is_deleted = 0
-            and FC.bill_type = #{acc.billType}
+            and FA.bill_type = #{acc.billType}
             <if test="acc.corpId != null and acc.corpId != ''">
-                and FC.Corpid = #{acc.corpId}
+                and FA.Corpid = #{acc.corpId}
             </if>
             <if test="acc.accSysNo != null and acc.accSysNo != ''">
                 and FA.AccSysNo like concat('%', #{acc.accSysNo}, '%')
@@ -153,6 +142,54 @@
             <if test="acc.amount != null and acc.amount != ''">
                 and FA.Amount like concat('%', #{acc.amount}, '%')
             </if>
+            <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
+                and FA.create_time &gt;= #{acc.createDateList[0]}
+            </if>
+            <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
+                and FA.create_time &lt;= #{acc.createDateList[1]}
+            </if>
+        </where>
+    </select>
+
+    <select id="SelPayItem" resultType="org.springblade.finance.vojo.Acc">
+        SELECT
+            FI.src_orderNo AS accSysNo,
+            FI.quantity AS quantity,
+            FI.this_amount AS amount,
+            FS.subject_number AS subjectNumber,
+            FS.ACCOUNT_bank AS accountBank,
+            FS.ACCOUNT_NAME AS accountName,
+            FS.ACCOUNT_no AS accountNo,
+            FS.over_payment AS overPayment,
+            FS.case_over_payment AS caseOverPayment
+        FROM finance_settlement FS
+        LEFT JOIN finance_items FI ON FI.pid = FS.id
+        <where>
+            FS.tenant_id = #{acc.tenantId}
+            AND FS.is_deleted = 0n
+            AND FI.is_deleted = 0
+            AND FS.finance_status = '结算完成'
+            <if test='acc.billType != null and acc.billType != "" and acc.billType == "申请"'>
+                AND FS.bill_type = '付费'
+            </if>
+            <if test='acc.billType != null and acc.billType != "" and acc.billType == "收费"'>
+                AND FS.bill_type = #{acc.billType}
+            </if>
+            <if test="acc.corpId != null and acc.corpId != ''">
+                and FS.Corp_id = #{acc.corpId}
+            </if>
+            <if test="acc.accSysNo != null and acc.accSysNo != ''">
+                and FI.src_orderNo like concat('%', #{acc.accSysNo}, '%')
+            </if>
+            <if test="acc.amount != null and acc.amount != ''">
+                and FI.this_amount like concat('%', #{acc.amount}, '%')
+            </if>
+            <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
+                and FS.completion_time &gt;= #{acc.createDateList[0]}
+            </if>
+            <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
+                and FS.completion_time &lt;= #{acc.createDateList[1]}
+            </if>
         </where>
     </select>
 

+ 14 - 2
blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/AccServiceImpl.java

@@ -457,12 +457,24 @@ public class AccServiceImpl extends ServiceImpl<AccMapper, Acc> implements IAccS
 
 	@Override
 	public IPage<Acc> SelAccItem(IPage<Acc> iPage, Acc acc){
-		return iPage.setRecords(baseMapper.SelAccItem(iPage, acc));
+		List<Acc> accList = new ArrayList<>();
+		if ("YING".equals(acc.getChargePay())){
+			accList = baseMapper.SelChargeItem(iPage, acc);
+		}else if ("YI".equals(acc.getChargePay())){
+			accList = baseMapper.SelPayItem(iPage, acc);
+		}
+		return iPage.setRecords(accList);
 	}
 
 	@Override
 	public List<Acc> SelAccItemExport(Acc acc){
-		return baseMapper.SelAccItem(null, acc);
+		List<Acc> accList = new ArrayList<>();
+		if ("YING".equals(acc.getChargePay())){
+			accList = baseMapper.SelChargeItem(null, acc);
+		}else if ("YI".equals(acc.getChargePay())){
+			accList = baseMapper.SelPayItem(null, acc);
+		}
+		return accList;
 	}
 
 	@Override