From 94f76200c0ac4d87e73afa4895f6088bfb02b6b2 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Thu, 17 Feb 2022 22:33:18 +0800
Subject: [PATCH] fead:新增付款金额检测

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml                  |    7 ++
 zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java                 |  142 ++--------------------------------------------
 zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html   |    4 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |    4 +
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java   |    7 ++
 5 files changed, 29 insertions(+), 135 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java
index 8c8cc65..41b23ab 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java
@@ -1,7 +1,9 @@
 package com.matrix.system.hive.bean;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.matrix.core.anotations.Extend;
 import com.matrix.core.tools.DateUtil;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -11,6 +13,7 @@
  * @author wzy
  * @date 2021-01-07
  **/
+@Data
 public class SysOrderFlow implements Serializable {
     private static final long serialVersionUID = 7519131902836023680L;
 
@@ -53,6 +56,11 @@
     private Long vipId;
 
     private Long cardId;
+    /**
+     * 扩展字段-支付卡名称
+     */
+    @Extend
+    private String cardName;
 
     private String isGift;
 
@@ -62,139 +70,5 @@
 
     private Long companyId;
 
-    public String getOrderNo() {
-        return orderNo;
-    }
 
-    public void setOrderNo(String orderNo) {
-        this.orderNo = orderNo;
-    }
-
-    public Long getCardId() {
-        return cardId;
-    }
-
-    public void setCardId(Long cardId) {
-        this.cardId = cardId;
-    }
-
-    public String getIsGift() {
-        return isGift;
-    }
-
-    public void setIsGift(String isGift) {
-        this.isGift = isGift;
-    }
-
-    public String getCreateBy() {
-        return createBy;
-    }
-
-    public void setCreateBy(String createBy) {
-        this.createBy = createBy;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public String getUpdateBy() {
-        return updateBy;
-    }
-
-    public void setUpdateBy(String updateBy) {
-        this.updateBy = updateBy;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getFlowNo() {
-        return flowNo;
-    }
-
-    public void setFlowNo(String flowNo) {
-        this.flowNo = flowNo;
-    }
-
-    public Long getOrderId() {
-        return orderId;
-    }
-
-    public void setOrderId(Long orderId) {
-        this.orderId = orderId;
-    }
-
-    public String getFlowContent() {
-        return flowContent;
-    }
-
-    public void setFlowContent(String flowContent) {
-        this.flowContent = flowContent;
-    }
-
-    public String getFlowType() {
-        return flowType;
-    }
-
-    public void setFlowType(String flowType) {
-        this.flowType = flowType;
-    }
-
-    public BigDecimal getAmount() {
-        return amount;
-    }
-
-    public void setAmount(BigDecimal amount) {
-        this.amount = amount;
-    }
-
-    public String getPayMethod() {
-        return payMethod;
-    }
-
-    public void setPayMethod(String payMethod) {
-        this.payMethod = payMethod;
-    }
-
-    public Long getVipId() {
-        return vipId;
-    }
-
-    public void setVipId(Long vipId) {
-        this.vipId = vipId;
-    }
-
-    public Long getShopId() {
-        return shopId;
-    }
-
-    public void setShopId(Long shopId) {
-        this.shopId = shopId;
-    }
-
-    public Long getCompanyId() {
-        return companyId;
-    }
-
-    public void setCompanyId(Long companyId) {
-        this.companyId = companyId;
-    }
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 879b5ba..0c14697 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -535,6 +535,13 @@
         pageOrder.setCashPay(cashPayAmount.doubleValue());
         //欠款金额在流水处理中处理了
 
+        double sum = flows.stream().mapToDouble(item -> item.getAmount().doubleValue()).sum();
+
+        if(sum>0 && cardPayAmount.doubleValue()==0 && cashPayAmount.doubleValue()==0 ){
+            throw new GlobleException("订单更新失败,支付金额计算错误,请联系管理员");
+        }
+
+
         sysOrderDao.update(pageOrder);
     }
 
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml
index 5c56a95..55817bf 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml
@@ -16,6 +16,7 @@
         <result property="vipId" column="vip_id" />
         <result property="payMethod" column="pay_method" />
         <result property="cardId" column="card_id" />
+        <result property="cardName" column="card_name" />
         <result property="isGift" column="is_gift" />
 
 		<result property="orderNo" column="order_no" />
@@ -70,8 +71,9 @@
 	</delete>
 
     <select id="selectByOrderId" resultMap="SysOrderFlowMap">
-		select a.*, b.order_no from sys_order_flow a
+		select a.*, b.order_no,c.card_name from sys_order_flow a
 		left join sys_order b on a.order_id=b.id
+		left join money_card_use c on a.card_id=c.id
 		where order_id=#{orderId}
 	</select>
 
@@ -97,12 +99,15 @@
 		a.pay_method as payMethod,
 		a.flow_no as flowNo,
 		d.shop_short_name as shopName,
+		f.card_name as cardName,
 		e.su_name as staffName
 		from sys_order_flow a
 		LEFT JOIN sys_order b on a.order_id=b.ID
 		LEFT JOIN sys_vip_info c on a.vip_id=c.ID
 		LEFT JOIN sys_shop_info d on a.shop_id=d.ID
 		LEFT JOIN sys_users e on e.su_id=b.STAFF_ID
+		left join money_card_use f on a.card_id=f.id
+
 		<where>
 
 				and a.company_id=#{record.companyId}
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
index 021105c..70680aa 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
@@ -408,6 +408,10 @@
                                 label="支付方式">
                         </el-table-column>
                         <el-table-column
+                                prop="cardName"
+                                label="储值卡名称">
+                        </el-table-column>
+                        <el-table-column
                                 prop="flowNo"
                                 label="流水号">
                         </el-table-column>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
index 5ace9ce..2e3cc8b 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -421,6 +421,10 @@
                                 label="支付方式">
                         </el-table-column>
                         <el-table-column
+                                prop="cardName"
+                                label="储值卡名称">
+                        </el-table-column>
+                        <el-table-column
                                 prop="flowNo"
                                 label="流水号">
                         </el-table-column>

--
Gitblit v1.9.1