From 27e4ff33760c5ff07cf844311505344b06343396 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Mon, 08 Mar 2021 10:51:00 +0800
Subject: [PATCH] 优化订单业绩

---
 zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java                     |   30 +++++++++++++++---------------
 zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java               |    3 +--
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |    4 +++-
 zq-erp/src/test/java/com/matrix/SourceFlowTests.java                               |    4 +---
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
index 191f430..dfbe3d2 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
@@ -85,24 +85,24 @@
 	/**
 	 * 订单总价
 	 */
-	private double total;
+	private Double total;
 	/**
 	 * 折后价
 	 */
-	private double zkTotal;
+	private Double zkTotal;
 
 	/**
 	 * 现金支付金额
 	 */
-	private double cashPay;
+	private Double cashPay;
 	/**
 	 * 现金支付金额
 	 */
-	private double cardPay;
+	private Double cardPay;
 	/**
 	 * 欠款金额
 	 */
-	private double arrears;
+	private Double arrears;
 
 	/**
 	 * 店铺id
@@ -265,19 +265,19 @@
 		this.searchShop = searchShop;
 	}
 
-	public double getArrears() {
+	public Double getArrears() {
 		return arrears;
 	}
 
-	public void setArrears(double arrears) {
+	public void setArrears(Double arrears) {
 		this.arrears = arrears;
 	}
 
-	public double getCardPay() {
+	public Double getCardPay() {
 		return cardPay;
 	}
 
-	public void setCardPay(double cardPay) {
+	public void setCardPay(Double cardPay) {
 		this.cardPay = cardPay;
 	}
 
@@ -304,11 +304,11 @@
 	public void setEndTimeVo(Date endTimeVo) {
 		this.endTimeVo = endTimeVo;
 	}
-	public double getCashPay() {
+	public Double getCashPay() {
 		return cashPay;
 	}
 
-	public void setCashPay(double cashPay) {
+	public void setCashPay(Double cashPay) {
 		this.cashPay = cashPay;
 	}
 	
@@ -414,11 +414,11 @@
 		this.activity = activity;
 	}
 
-	public double getTotal() {
+	public Double getTotal() {
 		return total;
 	}
 
-	public void setTotal(double total) {
+	public void setTotal(Double total) {
 		this.total = total;
 	}
 
@@ -443,11 +443,11 @@
 		this.changeId = changeId;
 	}
 
-	public double getZkTotal() {
+	public Double getZkTotal() {
 		return zkTotal;
 	}
 
-	public void setZkTotal(double zkTotal) {
+	public void setZkTotal(Double zkTotal) {
 		this.zkTotal = zkTotal;
 	}
 
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
index 88aab2e..25caa4d 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
@@ -26,7 +26,6 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -107,7 +106,7 @@
         order.setTotal(orderDto.getOrderMoney().doubleValue());
         order.setZkTotal(orderDto.getOrderMoney().doubleValue());
         order.setPayTime(new Date());
-        order.setArrears(0);
+        order.setArrears(0D);
         int i = sysOrderDao.insert(order);
         // 创建订单明细,并计算总价与折扣总价
         // 总价
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 03c03f0..be177b0 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
@@ -108,7 +108,8 @@
                         </el-col>
                         <el-col :span="14" style="text-align: right;">
                             <label>¥ {{order.total}}</label>
-                            <label>¥ {{(order.zkTotal - order.total).toFixed(2)}}</label>
+                            <!-- 退款订单不能显示为负数 -->
+                            <label>¥ {{(order.zkTotal - order.total>0?order.zkTotal - order.total:0).toFixed(2)}}</label>
                             <label>¥ {{order.zkTotal}}</label>
                             <label>¥ {{order.arrears}}</label>
                             <label>¥ {{order.repay}}</label>
@@ -725,6 +726,7 @@
                 let _this = this;
                 let items = this.orderItems;
                 _this.refundMoney = 0;
+                _this.total = 0;
 
                 for(var i = 0; i < items.length; i++) {
                     let item = items[i]
diff --git a/zq-erp/src/test/java/com/matrix/SourceFlowTests.java b/zq-erp/src/test/java/com/matrix/SourceFlowTests.java
index 6cc43c8..a68ba3e 100644
--- a/zq-erp/src/test/java/com/matrix/SourceFlowTests.java
+++ b/zq-erp/src/test/java/com/matrix/SourceFlowTests.java
@@ -1,11 +1,9 @@
 package com.matrix;
 
 import com.matrix.core.tools.StringUtils;
-import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.*;
 import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.service.CodeService;
-import com.matrix.system.hive.service.SysOrderService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -124,7 +122,7 @@
 
 		for (SysOrder sysOrder : sysOrders) {
 			sysOrder.setCashPay(sysOrder.getZkTotal());
-			sysOrder.setCardPay(0);
+			sysOrder.setCardPay(0D);
 			sysOrderDao.update(sysOrder);
 
 			List<SysOrderItem> items = sysOrderItemDao.selectByOrderId(sysOrder.getId());

--
Gitblit v1.9.1