From 2a45d42cebd76d0f0add392c0e06d2cbbb36c63f Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期日, 02 四月 2023 21:50:48 +0800
Subject: [PATCH] 退款重构

---
 phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java             |   99 ++++++++++++---
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordMapper.xml              |   14 +
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMethodMapper.xml    |   12 +
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordCardMapper.xml          |   18 +-
 phi_platform_user/src/main/java/com/hx/phip/tool/refund/PaymentCountTool.java              |    4 
 phi_platform_common/src/main/resources/mapper/platform/ConsumePayMapper.xml                |    4 
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemSourceMapper.xml    |   12 +
 phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java |   80 ++++++++-----
 phi_platform_common/src/main/java/com/hx/phip/dao/mapper/RefundMapper.java                 |    9 +
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordConsumePayMapper.xml    |   10 
 phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java                            |    7 
 phi_platform_common/src/main/resources/mapper/platform/RefundMapper.xml                    |   29 ++++
 phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemMapper.xml            |   10 
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMapper.xml          |   12 +
 phi_platform_common/src/main/resources/mapper/platform/RefundRecordMethodMapper.xml        |   10 
 phi_platform_common/src/main/java/com/hx/phip/vo/order/refund/RefundCarryVo.java           |    8 
 phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemSonMapper.xml         |   10 
 17 files changed, 237 insertions(+), 111 deletions(-)

diff --git a/phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java b/phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java
index 362c7a7..aa9b349 100644
--- a/phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java
+++ b/phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java
@@ -3,8 +3,11 @@
 
 import com.hx.auto.GeneratorUtil;
 import com.hx.auto.common.UrlData;
+import com.hx.phiappt.model.consume.ConsumePay;
+import com.hx.phiappt.model.consume.ConsumePayItem;
+import com.hx.phiappt.model.consume.ConsumePayItemSon;
 import com.hx.phiappt.model.project.ProjectShopPrice;
-import com.hx.phiappt.model.refund.RefundRecordCard;
+import com.hx.phiappt.model.refund.*;
 import com.hx.phiappt.model.user.UserProjectDirectRecord;
 import com.hx.phiappt.model.user.UserProjectItem;
 import com.hx.phiappt.model.user.UserProjectUsed;
@@ -36,7 +39,7 @@
 		urlData.serviceImplUrlData(controllerPackRoot,packageName + ".service.impl");
 		urlData.mapperUrlData(commonPackRootResourse, "mapper.platform");
 
-		Class<?> clas = RefundRecordCard.class;
+		Class<?> clas = RefundRecordItemMethod.class;
 		//dao
 		 GeneratorUtil.generatorDao(clas,urlData);
 		//mapper
diff --git a/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/RefundMapper.java b/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/RefundMapper.java
index 187fd6a..7b76ea5 100644
--- a/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/RefundMapper.java
+++ b/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/RefundMapper.java
@@ -1,6 +1,5 @@
 package com.hx.phip.dao.mapper;
 
-import com.hx.mybatisTool.SqlSentence;
 import com.hx.phip.vo.order.payment.PayMethodVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -8,9 +7,13 @@
 
 public interface RefundMapper {
     /**鎬绘敮浠樻柟寮忚褰曡繑鍥�-鏀粯缂栧彿姹傚拰*/
-    List<PayMethodVo> selectConsumePayList(@Param("orderId") String orderId);
+    List<PayMethodVo> getConsumePayGroupByNumberNo(@Param("orderId") String orderId);
     /**涓�绾ф敮浠樻柟寮忚褰曡繑鍥�-鏀粯缂栧彿姹傚拰*/
-    List<PayMethodVo> selectConsumePayOneList(@Param("typeId") String typeId);
+    List<PayMethodVo> getConsumePayOneGroupByNumberNo(@Param("typeId") String typeId);
     /**浜岀骇鏀粯鏂瑰紡璁板綍杩斿洖-鏀粯缂栧彿姹傚拰*/
+    List<PayMethodVo> getConsumePayTwoGroupByNumberNo(@Param("typeId") String typeId);
+    /**涓�绾ф敮浠樻柟寮忚褰曡繑鍥�*/
+    List<PayMethodVo> selectConsumePayOneList(@Param("typeId") String typeId);
+    /**浜岀骇鏀粯鏂瑰紡璁板綍杩斿洖*/
     List<PayMethodVo> selectConsumePayTwoList(@Param("typeId") String typeId);
 }
\ No newline at end of file
diff --git a/phi_platform_common/src/main/java/com/hx/phip/vo/order/refund/RefundCarryVo.java b/phi_platform_common/src/main/java/com/hx/phip/vo/order/refund/RefundCarryVo.java
index 2fa17b5..0fd2d03 100644
--- a/phi_platform_common/src/main/java/com/hx/phip/vo/order/refund/RefundCarryVo.java
+++ b/phi_platform_common/src/main/java/com/hx/phip/vo/order/refund/RefundCarryVo.java
@@ -17,11 +17,13 @@
     private List<RefundRecordMethod> refundRecordMethodList;
 
     //***************鍐呴儴鎼哄甫浣滅敤鍙傛暟锛屽叏绋嬪彉鍖栵紝娉ㄦ剰浣跨敤********************
-    /**鍒嗛厤鐨勯��娆炬柟寮忎笌鏀粯璁板綍鐨勫叧鑱旀暟鎹�*/
+    /**鍒嗛厤鐨勯��娆炬敮浠樻柟寮忎笌鏀粯璁板綍鐨勫叧鑱旀暟鎹�*/
     private List<RefundRecordConsumePay> refundConsumePayList;
-    /**鍒嗛厤鐨勫垝鎵i噾棰濇�诲拰*/
+    /**鍒嗛厤鐨勯��娆炬敮浠樻柟寮忓垝鎵i噾棰濇�诲拰*/
     private BigDecimal deductionTotal;
-    /**鍒嗛厤鐨勭幇閲戦噾棰濇�诲拰*/
+    /**鍒嗛厤鐨勯��娆炬敮浠樻柟寮忕幇閲戦噾棰濇�诲拰*/
     private BigDecimal cashTotal;
+    /**鍒嗛厤鐨勭敤鎴烽」鐩垝鎵i噾棰�*/
+    private BigDecimal deductionTotalUser;
 
 }
diff --git a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemMapper.xml
index 4f2186a..7c50f3c 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,numberNo = #{numberNo},name = #{name},actualTotal = #{actualTotal},refundTotal = #{refundTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},paymentMethodId = #{paymentMethodId},type = #{type},typeId = #{typeId},orderId = #{orderId},reConsumeId = #{reConsumeId},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,numberNo = #{numberNo},name = #{name},actualTotal = #{actualTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},paymentMethodId = #{paymentMethodId},type = #{type},typeId = #{typeId},orderId = #{orderId},reConsumeId = #{reConsumeId},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into consume_pay_item (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{reConsumeId},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into consume_pay_item (id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{reConsumeId},#{consumePayId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.consume.ConsumePayItem">
-        insert into consume_pay_item (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{reConsumeId},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into consume_pay_item (id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{reConsumeId},#{consumePayId},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.consume.ConsumePayItem" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.consume.ConsumePayItem" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime
 		from consume_pay_item
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.consume.ConsumePayItem" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,reConsumeId,consumePayId,isDel,createTime,editTime
 		from consume_pay_item
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemSonMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemSonMapper.xml
index eb6df14..65d7dce 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemSonMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayItemSonMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,numberNo = #{numberNo},name = #{name},actualTotal = #{actualTotal},refundTotal = #{refundTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},paymentMethodId = #{paymentMethodId},type = #{type},typeId = #{typeId},orderId = #{orderId},orderItemId = #{orderItemId},reConsumeId = #{reConsumeId},consumePayItemId = #{consumePayItemId},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,numberNo = #{numberNo},name = #{name},actualTotal = #{actualTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},paymentMethodId = #{paymentMethodId},type = #{type},typeId = #{typeId},orderId = #{orderId},orderItemId = #{orderItemId},reConsumeId = #{reConsumeId},consumePayItemId = #{consumePayItemId},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into consume_pay_item_son (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{orderItemId},#{reConsumeId},#{consumePayItemId},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into consume_pay_item_son (id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{orderItemId},#{reConsumeId},#{consumePayItemId},#{consumePayId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.consume.ConsumePayItemSon">
-        insert into consume_pay_item_son (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{orderItemId},#{reConsumeId},#{consumePayItemId},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into consume_pay_item_son (id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{typeId},#{orderId},#{orderItemId},#{reConsumeId},#{consumePayItemId},#{consumePayId},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.consume.ConsumePayItemSon" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.consume.ConsumePayItemSon" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime
 		from consume_pay_item_son
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.consume.ConsumePayItemSon" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,actualTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,typeId,orderId,orderItemId,reConsumeId,consumePayItemId,consumePayId,isDel,createTime,editTime
 		from consume_pay_item_son
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayMapper.xml
index bf7e1fd..6225729 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/ConsumePayMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/ConsumePayMapper.xml
@@ -22,6 +22,10 @@
         insert into consume_pay (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,orderId,reConsumeId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{orderId},#{reConsumeId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
+	<insert id="insertById" parameterType="com.hx.phiappt.model.consume.ConsumePay">
+        insert into consume_pay (id,numberNo,name,actualTotal,refundTotal,isMoneyPay,isExecute,isPay,paymentMethodId,type,orderId,reConsumeId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{actualTotal},#{refundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{paymentMethodId},#{type},#{orderId},#{reConsumeId},#{isDel},#{createTime},#{editTime})
+    </insert>
+
 	<select id="selectList" resultType="com.hx.phiappt.model.consume.ConsumePay" parameterType="com.hx.mybatisTool.SqlSentence" >
 		${sqlSentence}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundMapper.xml
index 380550c..e8c2617 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundMapper.xml
@@ -6,36 +6,57 @@
 <mapper namespace="com.hx.phip.dao.mapper.RefundMapper">
 
 	<!--涓�绾ф敮浠樻柟寮忚褰曡繑鍥�-鏀粯缂栧彿姹傚拰-->
-	<select id="selectConsumePayList" resultType="com.hx.phip.vo.order.payment.PayMethodVo">
+	<select id="getConsumePayGroupByNumberNo" resultType="com.hx.phip.vo.order.payment.PayMethodVo">
 		SELECT ANY_VALUE(name) AS name
 			 ,numberNo
 			 ,ROUND(SUM(actualTotal-refundTotal),2) AS surplusTotal
 			 ,ROUND(SUM(actualTotal),2) AS payTotal
 			 ,ROUND(SUM(refundTotal),2) AS refundTotal
+			 ,ANY_VALUE(isMoneyPay) AS IsMoneyPay
+			 ,ANY_VALUE(isExecute) AS isExecute
 		FROM consume_pay
 		WHERE isDel = 0 AND orderId = #{orderId} GROUP BY numberNo
 	</select>
 
-
 	<!--涓�绾ф敮浠樻柟寮忚褰曡繑鍥�-鏀粯缂栧彿姹傚拰-->
-	<select id="selectConsumePayOneList" resultType="com.hx.phip.vo.order.payment.PayMethodVo">
+	<select id="getConsumePayOneGroupByNumberNo" resultType="com.hx.phip.vo.order.payment.PayMethodVo">
 		SELECT ANY_VALUE(name) AS name
 		     ,numberNo
 		     ,ROUND(SUM(actualTotal),2) AS surplusTotal
 		     ,ROUND(SUM(actualTotal),2) AS payTotal
+			 ,ANY_VALUE(isMoneyPay) AS IsMoneyPay
+			 ,ANY_VALUE(isExecute) AS isExecute
 		FROM consume_pay_item
         WHERE isDel = 0 AND typeId = #{typeId} GROUP BY numberNo
 	</select>
 
 	<!--浜岀骇鏀粯鏂瑰紡璁板綍杩斿洖-鏀粯缂栧彿姹傚拰-->
-	<select id="selectConsumePayTwoList" resultType="com.hx.phip.vo.order.payment.PayMethodVo" >
+	<select id="getConsumePayTwoGroupByNumberNo" resultType="com.hx.phip.vo.order.payment.PayMethodVo" >
 		SELECT ANY_VALUE(name) AS name
 		     ,numberNo
 		     ,ROUND(SUM(actualTotal),2) AS surplusTotal
 			 ,ROUND(SUM(actualTotal),2) AS payTotal
+			 ,ANY_VALUE(isMoneyPay) AS IsMoneyPay
+			 ,ANY_VALUE(isExecute) AS isExecute
 		FROM consume_pay_item_son
 		WHERE isDel = 0 AND typeId = #{typeId} GROUP BY numberNo
 	</select>
 
+	<!--涓�绾ф敮浠樻柟寮忚褰曡繑鍥�-->
+	<select id="selectConsumePayOneList" resultType="com.hx.phiappt.model.consume.ConsumePayItem">
+		SELECT
+			*
+		FROM consume_pay_item
+		WHERE isDel = 0 AND typeId = #{typeId}
+	</select>
+
+	<!--浜岀骇鏀粯鏂瑰紡璁板綍杩斿洖-->
+	<select id="selectConsumePayTwoList" resultType="com.hx.phiappt.model.consume.ConsumePayItemSon" >
+		SELECT
+			*
+		FROM consume_pay_item_son
+		WHERE isDel = 0 AND typeId = #{typeId}
+	</select>
+
 
 </mapper>
\ No newline at end of file
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordCardMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordCardMapper.xml
index cc7b872..e049674 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordCardMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordCardMapper.xml
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_Card (id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{userCardId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_card (id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{userCardId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordCard">
-        insert into refund_record_Card (id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{userCardId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_card (id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{userCardId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordCard" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -45,7 +45,7 @@
 	<select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
     		select
     			COUNT(*)
-    		from refund_record_Card
+    		from refund_record_card
     			WHERE ${sqlSentence}
     </select>
 
@@ -56,35 +56,35 @@
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordCard" parameterType="java.lang.Object" >
 		select 
 			id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime
-		from refund_record_Card
+		from refund_record_card
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordCard" parameterType="java.lang.Object" >
 		select 
 			id,userCardId,refundRecordItemId,refundRecordId,isDel,createTime,editTime
-		from refund_record_Card
+		from refund_record_card
 		WHERE id = #{value}
 	</select>
 
 	<update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
 		update
-		    refund_record_Card
+		    refund_record_card
         SET ${sqlSentence}
 	</update>
 
 	<update id="updateAll" parameterType="com.hx.phiappt.model.refund.RefundRecordCard">
-		update refund_record_Card
+		update refund_record_card
 			SET <include refid="Update_Column_All"/>
 		WHERE id = #{id}
 	</update>
 
 	<delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
-		delete from refund_record_Card WHERE ${sqlSentence}
+		delete from refund_record_card WHERE ${sqlSentence}
 	</delete>
 
 	<delete id="deleteById"  parameterType="java.lang.Object">
-		delete from refund_record_Card WHERE id = #{value}
+		delete from refund_record_card WHERE id = #{value}
 	</delete>
 	
 </mapper>
\ No newline at end of file
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordConsumePayMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordConsumePayMapper.xml
index ef979ef..e1c9ca1 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordConsumePayMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordConsumePayMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,refundTotal = #{refundTotal},consumePayId = #{consumePayId},refundMethodId = #{refundMethodId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,refundTotal = #{refundTotal},numberNo = #{numberNo},name = #{name},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},consumePayId = #{consumePayId},refundMethodId = #{refundMethodId},refundRecordItemId = #{refundRecordItemId},refundRecordId = #{refundRecordId},commonType = #{commonType},commonId = #{commonId},orderId = #{orderId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_consume_pay (id,refundTotal,consumePayId,refundMethodId,isDel,createTime,editTime)  values (#{id},#{refundTotal},#{consumePayId},#{refundMethodId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_consume_pay (id,refundTotal,numberNo,name,isMoneyPay,isExecute,consumePayId,refundMethodId,refundRecordItemId,refundRecordId,commonType,commonId,orderId,isDel,createTime,editTime)  values (#{id},#{refundTotal},#{numberNo},#{name},#{isMoneyPay},#{isExecute},#{consumePayId},#{refundMethodId},#{refundRecordItemId},#{refundRecordId},#{commonType},#{commonId},#{orderId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordConsumePay">
-        insert into refund_record_consume_pay (id,refundTotal,consumePayId,refundMethodId,isDel,createTime,editTime)  values (#{id},#{refundTotal},#{consumePayId},#{refundMethodId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_consume_pay (id,refundTotal,numberNo,name,isMoneyPay,isExecute,consumePayId,refundMethodId,refundRecordItemId,refundRecordId,commonType,commonId,orderId,isDel,createTime,editTime)  values (#{id},#{refundTotal},#{numberNo},#{name},#{isMoneyPay},#{isExecute},#{consumePayId},#{refundMethodId},#{refundRecordItemId},#{refundRecordId},#{commonType},#{commonId},#{orderId},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordConsumePay" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordConsumePay" parameterType="java.lang.Object" >
 		select 
-			id,refundTotal,consumePayId,refundMethodId,isDel,createTime,editTime
+			id,refundTotal,numberNo,name,isMoneyPay,isExecute,consumePayId,refundMethodId,refundRecordItemId,refundRecordId,commonType,commonId,orderId,isDel,createTime,editTime
 		from refund_record_consume_pay
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordConsumePay" parameterType="java.lang.Object" >
 		select 
-			id,refundTotal,consumePayId,refundMethodId,isDel,createTime,editTime
+			id,refundTotal,numberNo,name,isMoneyPay,isExecute,consumePayId,refundMethodId,refundRecordItemId,refundRecordId,commonType,commonId,orderId,isDel,createTime,editTime
 		from refund_record_consume_pay
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMapper.xml
index 3deffff..705e29e 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,type = #{type},goodsNo = #{goodsNo},goodsName = #{goodsName},specs = #{specs},commonId = #{commonId},headPrice = #{headPrice},tailPrice = #{tailPrice},refundNum = #{refundNum},refundMoney = #{refundMoney},refundIntegral = #{refundIntegral},realRefundNum = #{realRefundNum},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},refundRecordId = #{refundRecordId},orderItemId = #{orderItemId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,type = #{type},goodsNo = #{goodsNo},goodsName = #{goodsName},specs = #{specs},commonId = #{commonId},deductionTotal = #{deductionTotal},cashTotal = #{cashTotal},deductionTotalUser = #{deductionTotalUser},refundNum = #{refundNum},refundMoney = #{refundMoney},refundIntegral = #{refundIntegral},realRefundNum = #{realRefundNum},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},occupyRefundTotal = #{occupyRefundTotal},refundRecordId = #{refundRecordId},orderItemId = #{orderItemId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,8 +19,12 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_item (id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,orderItemId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{headPrice},#{tailPrice},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{refundRecordId},#{orderItemId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_item (id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,orderItemId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{deductionTotal},#{cashTotal},#{deductionTotalUser},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{occupyRefundTotal},#{refundRecordId},#{orderItemId},#{isDel},#{createTime},#{editTime})
 	</insert>
+
+	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordItem">
+        insert into refund_record_item (id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,orderItemId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{deductionTotal},#{cashTotal},#{deductionTotalUser},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{occupyRefundTotal},#{refundRecordId},#{orderItemId},#{isDel},#{createTime},#{editTime})
+    </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordItem" parameterType="com.hx.mybatisTool.SqlSentence" >
 		${sqlSentence}
@@ -51,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordItem" parameterType="java.lang.Object" >
 		select 
-			id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,orderItemId,isDel,createTime,editTime
+			id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,orderItemId,isDel,createTime,editTime
 		from refund_record_item
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordItem" parameterType="java.lang.Object" >
 		select 
-			id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,orderItemId,isDel,createTime,editTime
+			id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,orderItemId,isDel,createTime,editTime
 		from refund_record_item
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMethodMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMethodMapper.xml
index 3f8fd54..666a574 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMethodMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemMethodMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,numberNo = #{numberNo},refundNumberNo = #{refundNumberNo},name = #{name},paymentMethodId = #{paymentMethodId},headPrice = #{headPrice},tailPrice = #{tailPrice},actualTotal = #{actualTotal},realRefundTotal = #{realRefundTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},commonType = #{commonType},commonId = #{commonId},orderId = #{orderId},refundRecordItemId = #{refundRecordItemId},refundRecordId = #{refundRecordId},refundMethodId = #{refundMethodId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,numberNo = #{numberNo},name = #{name},paymentMethodId = #{paymentMethodId},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},refundNumberNo = #{refundNumberNo},refundName = #{refundName},refundMethodId = #{refundMethodId},isMoneyPayRefund = #{isMoneyPayRefund},isExecuteRefund = #{isExecuteRefund},actualTotal = #{actualTotal},realRefundTotal = #{realRefundTotal},commonType = #{commonType},commonId = #{commonId},orderId = #{orderId},refundRecordItemId = #{refundRecordItemId},refundRecordId = #{refundRecordId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,8 +19,12 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_item_method (id,numberNo,refundNumberNo,name,paymentMethodId,headPrice,tailPrice,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,commonType,commonId,orderId,refundRecordItemId,refundRecordId,refundMethodId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{refundNumberNo},#{name},#{paymentMethodId},#{headPrice},#{tailPrice},#{actualTotal},#{realRefundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{commonType},#{commonId},#{orderId},#{refundRecordItemId},#{refundRecordId},#{refundMethodId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_item_method (id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,actualTotal,realRefundTotal,commonType,commonId,orderId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{isMoneyPay},#{isExecute},#{isPay},#{refundNumberNo},#{refundName},#{refundMethodId},#{isMoneyPayRefund},#{isExecuteRefund},#{actualTotal},#{realRefundTotal},#{commonType},#{commonId},#{orderId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
 	</insert>
+
+	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordItemMethod">
+        insert into refund_record_item_method (id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,actualTotal,realRefundTotal,commonType,commonId,orderId,refundRecordItemId,refundRecordId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{isMoneyPay},#{isExecute},#{isPay},#{refundNumberNo},#{refundName},#{refundMethodId},#{isMoneyPayRefund},#{isExecuteRefund},#{actualTotal},#{realRefundTotal},#{commonType},#{commonId},#{orderId},#{refundRecordItemId},#{refundRecordId},#{isDel},#{createTime},#{editTime})
+    </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordItemMethod" parameterType="com.hx.mybatisTool.SqlSentence" >
 		${sqlSentence}
@@ -51,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordItemMethod" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,refundNumberNo,name,paymentMethodId,headPrice,tailPrice,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,commonType,commonId,orderId,refundRecordItemId,refundRecordId,refundMethodId,isDel,createTime,editTime
+			id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,actualTotal,realRefundTotal,commonType,commonId,orderId,refundRecordItemId,refundRecordId,isDel,createTime,editTime
 		from refund_record_item_method
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordItemMethod" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,refundNumberNo,name,paymentMethodId,headPrice,tailPrice,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,commonType,commonId,orderId,refundRecordItemId,refundRecordId,refundMethodId,isDel,createTime,editTime
+			id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,actualTotal,realRefundTotal,commonType,commonId,orderId,refundRecordItemId,refundRecordId,isDel,createTime,editTime
 		from refund_record_item_method
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemSourceMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemSourceMapper.xml
index 1d0d85c..4058021 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemSourceMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordItemSourceMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,type = #{type},goodsNo = #{goodsNo},goodsName = #{goodsName},specs = #{specs},commonId = #{commonId},headPrice = #{headPrice},tailPrice = #{tailPrice},refundNum = #{refundNum},refundMoney = #{refundMoney},refundIntegral = #{refundIntegral},realRefundNum = #{realRefundNum},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},refundRecordId = #{refundRecordId},refundRecordItemId = #{refundRecordItemId},orderItemSonId = #{orderItemSonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,type = #{type},goodsNo = #{goodsNo},goodsName = #{goodsName},specs = #{specs},commonId = #{commonId},deductionTotal = #{deductionTotal},cashTotal = #{cashTotal},deductionTotalUser = #{deductionTotalUser},refundNum = #{refundNum},refundMoney = #{refundMoney},refundIntegral = #{refundIntegral},realRefundNum = #{realRefundNum},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},occupyRefundTotal = #{occupyRefundTotal},refundRecordId = #{refundRecordId},refundRecordItemId = #{refundRecordItemId},orderItemSonId = #{orderItemSonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,8 +19,12 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_item_source (id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{headPrice},#{tailPrice},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{refundRecordId},#{refundRecordItemId},#{orderItemSonId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_item_source (id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{deductionTotal},#{cashTotal},#{deductionTotalUser},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{occupyRefundTotal},#{refundRecordId},#{refundRecordItemId},#{orderItemSonId},#{isDel},#{createTime},#{editTime})
 	</insert>
+
+	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordItemSource">
+        insert into refund_record_item_source (id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime)  values (#{id},#{type},#{goodsNo},#{goodsName},#{specs},#{commonId},#{deductionTotal},#{cashTotal},#{deductionTotalUser},#{refundNum},#{refundMoney},#{refundIntegral},#{realRefundNum},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{occupyRefundTotal},#{refundRecordId},#{refundRecordItemId},#{orderItemSonId},#{isDel},#{createTime},#{editTime})
+    </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordItemSource" parameterType="com.hx.mybatisTool.SqlSentence" >
 		${sqlSentence}
@@ -51,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordItemSource" parameterType="java.lang.Object" >
 		select 
-			id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime
+			id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime
 		from refund_record_item_source
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordItemSource" parameterType="java.lang.Object" >
 		select 
-			id,type,goodsNo,goodsName,specs,commonId,headPrice,tailPrice,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime
+			id,type,goodsNo,goodsName,specs,commonId,deductionTotal,cashTotal,deductionTotalUser,refundNum,refundMoney,refundIntegral,realRefundNum,realRefundTotal,realRefundIntegral,refundReason,remarks,occupyRefundTotal,refundRecordId,refundRecordItemId,orderItemSonId,isDel,createTime,editTime
 		from refund_record_item_source
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMapper.xml
index 245e02d..9efa365 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,code = #{code},refundOperationType = #{refundOperationType},refundType = #{refundType},refundStatus = #{refundStatus},refundShopId = #{refundShopId},refundShopName = #{refundShopName},refundTotal = #{refundTotal},refundIntegral = #{refundIntegral},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},sourceType = #{sourceType},orderId = #{orderId},userId = #{userId},operatorType = #{operatorType},operatorId = #{operatorId},operatorName = #{operatorName},addTime = #{addTime},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,code = #{code},refundOperationType = #{refundOperationType},refundType = #{refundType},refundStatus = #{refundStatus},refundShopId = #{refundShopId},refundShopNo = #{refundShopNo},refundShopName = #{refundShopName},refundTotal = #{refundTotal},refundIntegral = #{refundIntegral},realRefundTotal = #{realRefundTotal},realRefundIntegral = #{realRefundIntegral},refundReason = #{refundReason},remarks = #{remarks},sourceType = #{sourceType},orderId = #{orderId},userId = #{userId},operatorType = #{operatorType},operatorId = #{operatorId},operatorNo = #{operatorNo},operatorName = #{operatorName},operatorAppId = #{operatorAppId},operatorAppCode = #{operatorAppCode},operatorAppName = #{operatorAppName},addTime = #{addTime},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,8 +19,12 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record (id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorName,addTime,isDel,createTime,editTime)  values (#{id},#{code},#{refundOperationType},#{refundType},#{refundStatus},#{refundShopId},#{refundShopName},#{refundTotal},#{refundIntegral},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{sourceType},#{orderId},#{userId},#{operatorType},#{operatorId},#{operatorName},#{addTime},#{isDel},#{createTime},#{editTime})
+        insert into refund_record (id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopNo,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorNo,operatorName,operatorAppId,operatorAppCode,operatorAppName,addTime,isDel,createTime,editTime)  values (#{id},#{code},#{refundOperationType},#{refundType},#{refundStatus},#{refundShopId},#{refundShopNo},#{refundShopName},#{refundTotal},#{refundIntegral},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{sourceType},#{orderId},#{userId},#{operatorType},#{operatorId},#{operatorNo},#{operatorName},#{operatorAppId},#{operatorAppCode},#{operatorAppName},#{addTime},#{isDel},#{createTime},#{editTime})
 	</insert>
+
+	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecord">
+        insert into refund_record (id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopNo,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorNo,operatorName,operatorAppId,operatorAppCode,operatorAppName,addTime,isDel,createTime,editTime)  values (#{id},#{code},#{refundOperationType},#{refundType},#{refundStatus},#{refundShopId},#{refundShopNo},#{refundShopName},#{refundTotal},#{refundIntegral},#{realRefundTotal},#{realRefundIntegral},#{refundReason},#{remarks},#{sourceType},#{orderId},#{userId},#{operatorType},#{operatorId},#{operatorNo},#{operatorName},#{operatorAppId},#{operatorAppCode},#{operatorAppName},#{addTime},#{isDel},#{createTime},#{editTime})
+    </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecord" parameterType="com.hx.mybatisTool.SqlSentence" >
 		${sqlSentence}
@@ -51,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecord" parameterType="java.lang.Object" >
 		select 
-			id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorName,addTime,isDel,createTime,editTime
+			id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopNo,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorNo,operatorName,operatorAppId,operatorAppCode,operatorAppName,addTime,isDel,createTime,editTime
 		from refund_record
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecord" parameterType="java.lang.Object" >
 		select 
-			id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorName,addTime,isDel,createTime,editTime
+			id,code,refundOperationType,refundType,refundStatus,refundShopId,refundShopNo,refundShopName,refundTotal,refundIntegral,realRefundTotal,realRefundIntegral,refundReason,remarks,sourceType,orderId,userId,operatorType,operatorId,operatorNo,operatorName,operatorAppId,operatorAppCode,operatorAppName,addTime,isDel,createTime,editTime
 		from refund_record
 		WHERE id = #{value}
 	</select>
@@ -87,10 +91,12 @@
 	
 	
 	
+	
     
 	
 	
 	
+	
 	<select id="selectOrderId" resultType="com.hx.phiappt.model.refund.RefundRecord">
 		select refundStatus,id from refund_record where orderId=#{id} and isDel=0 and refundStatus=0
 	</select>
diff --git a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMethodMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMethodMapper.xml
index a6180c4..0c3b9dd 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMethodMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/RefundRecordMethodMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,numberNo = #{numberNo},name = #{name},paymentMethodId = #{paymentMethodId},refundNumberNo = #{refundNumberNo},refundName = #{refundName},refundMethodId = #{refundMethodId},actualTotal = #{actualTotal},realRefundTotal = #{realRefundTotal},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},isMoneyPayRefund = #{isMoneyPayRefund},isExecuteRefund = #{isExecuteRefund},isPayRefund = #{isPayRefund},type = #{type},orderId = #{orderId},refundRecordId = #{refundRecordId},refundMethodTransId = #{refundMethodTransId},payee = #{payee},openBank = #{openBank},openBranch = #{openBranch},account = #{account},remarks = #{remarks},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,numberNo = #{numberNo},name = #{name},paymentMethodId = #{paymentMethodId},isMoneyPay = #{isMoneyPay},isExecute = #{isExecute},isPay = #{isPay},refundNumberNo = #{refundNumberNo},refundName = #{refundName},refundMethodId = #{refundMethodId},isMoneyPayRefund = #{isMoneyPayRefund},isExecuteRefund = #{isExecuteRefund},isPayRefund = #{isPayRefund},actualTotal = #{actualTotal},realRefundTotal = #{realRefundTotal},type = #{type},orderId = #{orderId},refundRecordId = #{refundRecordId},payee = #{payee},openBank = #{openBank},openBranch = #{openBranch},account = #{account},remarks = #{remarks},consumePayId = #{consumePayId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into refund_record_method (id,numberNo,name,paymentMethodId,refundNumberNo,refundName,refundMethodId,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,isMoneyPayRefund,isExecuteRefund,isPayRefund,type,orderId,refundRecordId,refundMethodTransId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{refundNumberNo},#{refundName},#{refundMethodId},#{actualTotal},#{realRefundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{isMoneyPayRefund},#{isExecuteRefund},#{isPayRefund},#{type},#{orderId},#{refundRecordId},#{refundMethodTransId},#{payee},#{openBank},#{openBranch},#{account},#{remarks},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_method (id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,isPayRefund,actualTotal,realRefundTotal,type,orderId,refundRecordId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{isMoneyPay},#{isExecute},#{isPay},#{refundNumberNo},#{refundName},#{refundMethodId},#{isMoneyPayRefund},#{isExecuteRefund},#{isPayRefund},#{actualTotal},#{realRefundTotal},#{type},#{orderId},#{refundRecordId},#{payee},#{openBank},#{openBranch},#{account},#{remarks},#{consumePayId},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.refund.RefundRecordMethod">
-        insert into refund_record_method (id,numberNo,name,paymentMethodId,refundNumberNo,refundName,refundMethodId,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,isMoneyPayRefund,isExecuteRefund,isPayRefund,type,orderId,refundRecordId,refundMethodTransId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{refundNumberNo},#{refundName},#{refundMethodId},#{actualTotal},#{realRefundTotal},#{isMoneyPay},#{isExecute},#{isPay},#{isMoneyPayRefund},#{isExecuteRefund},#{isPayRefund},#{type},#{orderId},#{refundRecordId},#{refundMethodTransId},#{payee},#{openBank},#{openBranch},#{account},#{remarks},#{consumePayId},#{isDel},#{createTime},#{editTime})
+        insert into refund_record_method (id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,isPayRefund,actualTotal,realRefundTotal,type,orderId,refundRecordId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime)  values (#{id},#{numberNo},#{name},#{paymentMethodId},#{isMoneyPay},#{isExecute},#{isPay},#{refundNumberNo},#{refundName},#{refundMethodId},#{isMoneyPayRefund},#{isExecuteRefund},#{isPayRefund},#{actualTotal},#{realRefundTotal},#{type},#{orderId},#{refundRecordId},#{payee},#{openBank},#{openBranch},#{account},#{remarks},#{consumePayId},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.refund.RefundRecordMethod" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.refund.RefundRecordMethod" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,paymentMethodId,refundNumberNo,refundName,refundMethodId,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,isMoneyPayRefund,isExecuteRefund,isPayRefund,type,orderId,refundRecordId,refundMethodTransId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,isPayRefund,actualTotal,realRefundTotal,type,orderId,refundRecordId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime
 		from refund_record_method
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.refund.RefundRecordMethod" parameterType="java.lang.Object" >
 		select 
-			id,numberNo,name,paymentMethodId,refundNumberNo,refundName,refundMethodId,actualTotal,realRefundTotal,isMoneyPay,isExecute,isPay,isMoneyPayRefund,isExecuteRefund,isPayRefund,type,orderId,refundRecordId,refundMethodTransId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime
+			id,numberNo,name,paymentMethodId,isMoneyPay,isExecute,isPay,refundNumberNo,refundName,refundMethodId,isMoneyPayRefund,isExecuteRefund,isPayRefund,actualTotal,realRefundTotal,type,orderId,refundRecordId,payee,openBank,openBranch,account,remarks,consumePayId,isDel,createTime,editTime
 		from refund_record_method
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
index 7b82e24..a014adf 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
@@ -384,6 +384,7 @@
                 if(!orderItem.getOrderId().equals(ordersTotal.getId())){
                     throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒伴��娆鹃」[012]");
                 }
+
                 //鍒ゆ柇杩欎釜椤圭洰鑳戒笉鑳芥樉绀哄鐞�
                 switch (orderItem.getType()) {
                     case OrderItemConstants.TYPE_PROJECT:
@@ -440,7 +441,7 @@
     public List<OrderPayMethodDto> rechargeRefundWay(OrdersTotal ordersTotal,BigDecimal totalAmount){
 
         //鑾峰彇鎬绘敮浠樻柟寮�
-        List<PayMethodVo> payMethodVoList = refundMapper.selectConsumePayList(ordersTotal.getId());
+        List<PayMethodVo> payMethodVoList = refundMapper.getConsumePayGroupByNumberNo(ordersTotal.getId());
 
         List<OrderPayMethodDto> consumeList = new ArrayList<>();
         OrderPayMethodDto orderPayMethodDto;
@@ -541,7 +542,7 @@
         }
 
         //鑾峰彇璇ュ瓙鍗曠殑鏀粯鏂瑰紡锛岀浉鍚岀殑鏀粯鏂瑰紡姹傚拰杩斿洖
-        List<PayMethodVo> payMethodVoList = refundMapper.selectConsumePayOneList(orderItem.getId());
+        List<PayMethodVo> payMethodVoList = refundMapper.getConsumePayOneGroupByNumberNo(orderItem.getId());
 
         //鑾峰彇宸查��娆剧殑閲戦
         sqlMap.clear();
@@ -613,7 +614,7 @@
         }
 
         //鑾峰彇璇ュ瓙鍗曠殑鏀粯鏂瑰紡锛岀浉鍚岀殑鏀粯鏂瑰紡绠楀拰杩斿洖
-        List<PayMethodVo> payMethodVoList = refundMapper.selectConsumePayTwoList(orderItemSon.getId());
+        List<PayMethodVo> payMethodVoList = refundMapper.getConsumePayTwoGroupByNumberNo(orderItemSon.getId());
 
         //鑾峰彇宸查��娆剧殑閲戦
         sqlMap.clear();
@@ -764,6 +765,10 @@
      * 鏍¢獙鍙傛暟锛屾嫾鎺ュ弬鏁�
      */
     public OrderRefundDto  parameterVerification(OrdersTotal ordersTotal,OrderRefundDto orderRefundDto){
+
+        if(orderRefundDto.getRefundPayMethod() == null){
+            throw new TipsException("閫�娆炬柟寮忕粨鏋勪笉鑳界┖");
+        }
 
         //鎬曡鑾峰彇鍒伴」鐩俊鎭敹鍒拌鏀逛簡椤圭洰浠锋牸锛岄噸鏂板幓鑾峰彇涓�涓嬮」鐩环鏍�
         orderRefundDto =  nextStep(ordersTotal,orderRefundDto);
@@ -1078,23 +1083,20 @@
         //璁板綍鍙栨秷鏃ュ織
         CancelOrder cancelOrder=new CancelOrder();
         cancelOrder.setOrderId(ordersTotal.getId());
-        Employee employee = commonService.selectOneByKey(EmployeeMapper.class,orderRefundDto.getOperatorId());
-        if(employee==null){
-            cancelOrder.setOperatorId(orderRefundDto.getOperatorId());
-            cancelOrder.setOperatorName("鎵句笉鍒板搴斿憳宸�");
-        }else {
+        if(StringUtils.noNull(orderRefundDto.getOperatorId())){
+            Employee employee = commonService.selectOneByKey(EmployeeMapper.class,orderRefundDto.getOperatorId());
+            if(employee==null){
+                throw new TipsException("鎿嶄綔浜烘爣璇嗛敊璇紒");
+            }
             cancelOrder.setOperatorId(employee.getId());
             cancelOrder.setOperatorName(employee.getCnName());
         }
 
-        EmployeeRole employeeRole=commonService.selectOneByKey(EmployeeRoleMapper.class,orderRefundDto.getRoleId());
-        if(employeeRole==null){
-            cancelOrder.setRoleId(orderRefundDto.getRoleId());
-            cancelOrder.setRoleStr("鎵句笉鍒板搴旇鑹�");
-            cancelOrder.setShopId(employeeRole.getShopId());
-            cancelOrder.setShopName("鎵句笉鍒板搴旂殑闂ㄥ簵");
-        }else {
-
+        if(StringUtils.noNull(orderRefundDto.getRoleId())){
+            EmployeeRole employeeRole=commonService.selectOneByKey(EmployeeRoleMapper.class,orderRefundDto.getRoleId());
+            if(employeeRole==null){
+                throw new TipsException("鎿嶄綔瑙掕壊鏍囪瘑閿欒锛�");
+            }
             cancelOrder.setRoleId(employeeRole.getRoleTypeId());
             cancelOrder.setRoleStr(employeeRole.getRoleUniqueStr());
             Shop shop=commonService.selectOneByKey(ShopMapper.class,employeeRole.getShopId());
@@ -1105,8 +1107,8 @@
                 cancelOrder.setShopId(shop.getId());
                 cancelOrder.setShopName(shop.getName());
             }
-
         }
+
         cancelOrder.setIsApproval(orderRefundDto.getIsApproval());
         cancelOrder.setIsRefund(orderRefundDto.getIsRefund());
         cancelOrder.setPlatformSource(orderRefundDto.getPlatformSource());
@@ -1122,7 +1124,7 @@
         orderNodeBuilder.append("-璁板綍閫�娆炬柟寮忥細");
 
         //鑾峰彇璁㈠崟鍙��娆炬柟寮忥紝灏辨槸鏀粯鏂瑰紡鎬昏〃鐨勪俊鎭紝宸茬粡鏀粯缂栧彿姹傚拰
-        List<PayMethodVo> payMethodVoList = refundMapper.selectConsumePayList(ordersTotal.getId());
+        List<PayMethodVo> payMethodVoList = refundMapper.getConsumePayGroupByNumberNo(ordersTotal.getId());
 
         //鐢╩ap瑁呰浇锛屽悗闈㈡牴鎹敮浠樼紪鍙风洿鎺ヨ幏鍙栦究鍙�
         Map<String, PayMethodVo> payMethodVoMap = payMethodVoList.stream().collect(Collectors.toMap(PayMethodVo::getNumberNo,(a) -> a));
@@ -1171,10 +1173,10 @@
             refundRecordMethod.setRefundName(refundMethod.getName());
             refundRecordMethod.setRefundMethodId(refundMethod.getId());
 
-            refundRecordMethod.setRefundMethodId(refundMethod.getId());
             refundRecordMethod.setIsMoneyPayRefund(refundMethod.getIsMoneyPay());
             refundRecordMethod.setIsExecuteRefund(refundMethod.getIsExecute());
-
+            refundRecordMethod.setRefundRecordId(refundRecord.getId());
+            refundRecordMethod.setOrderId(ordersTotal.getId());
             //refundRecordMethod.setRemarks(orderPayMethodDto.getRemarks());
 
             refundRecordMethodService.insert(refundRecordMethod);
@@ -1221,10 +1223,14 @@
             refundRecordItem = new RefundRecordItem();
             refundRecordItem.setType(orderItem.getType());
             refundRecordItem.setGoodsNo(orderItem.getGoodsNo());
+            refundRecordItem.setGoodsName(orderItem.getGoodsName());
             refundRecordItem.setSpecs(orderItem.getSpecs());
             refundRecordItem.setCommonId(orderItem.getCommonId());
-            refundRecordItem.setHeadPrice(orderItem.getCurPrice());
-            refundRecordItem.setRefundNum(orderItemRefundDto.getRefundNum());
+            if(PartialRefundUtil.CONTAIN_SON_TYPE_SET.contains(orderItem.getType())){
+                refundRecordItem.setRefundNum(0);
+            }else{
+                refundRecordItem.setRefundNum(orderItemRefundDto.getRefundNum());
+            }
             refundRecordItem.setRefundRecordId(refundRecord.getId());
             refundRecordItem.setOrderItemId(orderItem.getId());
             refundRecordItem.setOccupyRefundTotal(orderItemRefundDto.getApproveRefundTotal());
@@ -1233,7 +1239,7 @@
                 orderItemRefundDto.setRemarks(refundRecord.getRemarks());
             }
             if(StringUtils.isEmpty(orderItemRefundDto.getRefundReason())){
-                orderItemRefundDto.setRemarks(refundRecord.getRefundReason());
+                orderItemRefundDto.setRefundReason(orderItemRefundDto.getRefundReason());
             }
             refundRecordItem.setRemarks(orderItemRefundDto.getRemarks());
             refundRecordItem.setRefundReason(orderItemRefundDto.getRefundReason());
@@ -1251,11 +1257,17 @@
             if(refundRecordItem.getRefundMoney().compareTo(refundTotal) > 0){
                 refundRecordItem.setRefundMoney(refundTotal);
             }
+
+            refundRecordItem.setRealRefundNum(refundRecordItem.getRefundNum());
+            refundRecordItem.setRealRefundTotal(refundRecordItem.getRealRefundTotal());
+
             refundRecordItemService.insert(refundRecordItem);
             //鍑忓幓宸茬粡鍒嗛厤鐨勯��娆鹃噾棰�
             refundTotal = refundTotal.subtract(refundRecordItem.getRefundMoney()).setScale(2,RoundingMode.HALF_UP);
-            //瀛愬崟瀛愰」澶勭悊
-            insertRefundRecordItemTwo(refundRecordItem,refundRecord,orderItemRefundDto.getOrderItemSourceRefundDtos());
+            if(PartialRefundUtil.CONTAIN_SON_TYPE_SET.contains(orderItem.getType())){
+                //瀛愬崟瀛愰」澶勭悊
+                insertRefundRecordItemTwo(refundRecordItem,refundRecord,orderItemRefundDto.getOrderItemSourceRefundDtos());
+            }
         }
 
         if(refundTotal.compareTo(BigDecimal.ZERO) > 0){
@@ -1300,19 +1312,20 @@
             refundRecordItemSource = new RefundRecordItemSource();
             refundRecordItemSource.setType(orderItemSon.getType());
             refundRecordItemSource.setGoodsNo(orderItemSon.getGoodsNo());
+            refundRecordItemSource.setGoodsName(orderItemSon.getGoodsName());
             refundRecordItemSource.setSpecs(orderItemSon.getSpecs());
             refundRecordItemSource.setCommonId(orderItemSon.getGoodsId());
-            refundRecordItemSource.setHeadPrice(orderItemSon.getCurPrice());
             refundRecordItemSource.setRefundNum(orderItemSourceRefundDto.getRefundNum());
-            refundRecordItemSource.setRefundRecordId(orderItemSon.getId());
+            refundRecordItemSource.setRefundRecordId(refundRecord.getId());
             refundRecordItemSource.setOrderItemSonId(orderItemSon.getId());
             refundRecordItemSource.setOccupyRefundTotal(orderItemSourceRefundDto.getApproveRefundTotal());
+            refundRecordItemSource.setRefundRecordItemId(recordItem.getId());
             ////閫�娆惧娉�
             if(StringUtils.isEmpty(orderItemSourceRefundDto.getRemarks())){
                 orderItemSourceRefundDto.setRemarks(refundRecord.getRemarks());
             }
             if(StringUtils.isEmpty(orderItemSourceRefundDto.getRefundReason())){
-                orderItemSourceRefundDto.setRemarks(refundRecord.getRefundReason());
+                orderItemSourceRefundDto.setRefundReason(refundRecord.getRefundReason());
             }
             refundRecordItemSource.setRemarks(orderItemSourceRefundDto.getRemarks());
             refundRecordItemSource.setRefundReason(orderItemSourceRefundDto.getRefundReason());
@@ -1329,11 +1342,16 @@
             if(refundRecordItemSource.getRefundMoney().compareTo(refundTotal) > 0){
                 refundRecordItemSource.setRefundMoney(refundTotal);
             }
+
+            refundRecordItemSource.setRealRefundNum(refundRecordItemSource.getRefundNum());
+            refundRecordItemSource.setRealRefundTotal(refundRecordItemSource.getRefundMoney());
+
             refundRecordItemSourceMapper.insert(refundRecordItemSource);
             //鍑忓幓宸茬粡鍒嗛厤閫�娆鹃噾棰�
             refundTotal = refundTotal.subtract(refundRecordItemSource.getRefundMoney()).setScale(2,RoundingMode.HALF_UP);
+            System.out.println("refundRecordItemSource.getRefundMoney():"+refundRecordItemSource.getRefundMoney());
         }
-
+        System.out.println("refundTotal:"+refundTotal);
         if(refundTotal.compareTo(BigDecimal.ZERO) > 0){
             throw new TipsException("閫�娆鹃噾棰濆垎閰嶉敊璇痆02]锛�");
         }
@@ -1396,12 +1414,12 @@
         BigDecimal total=new BigDecimal(String.valueOf(totalMap.get("total"))) ;
         if(BigDecimal.ZERO.compareTo(total) < 0){
             try {
-                orderNodeBuilder.append("-寮�濮嬪鐞嗙敤鎴峰崌闄嶇骇锛岄噾棰�:"+total.negate());
+                orderNodeBuilder.append("-寮�濮嬪鐞嗙敤鎴峰崌闄嶇骇锛岄噾棰�:").append(total.negate());
                 UserLevelUtil.refund(ordersTotal.getUserId(),ordersTotal.getId(),total.negate(),ordersTotal.getAppIdCode());
                 orderNodeBuilder.append("-澶勭悊鐢ㄦ埛鍗囬檷绾ф垚鍔�");
             }catch (Exception e){
                 String snapshot="澶勭悊鐢ㄦ埛鍗囬檷绾уけ璐�";
-                orderNodeBuilder.append("-澶勭悊鐢ㄦ埛鍗囬檷绾уけ璐�,寮傚父鍘熷洜:"+e.getMessage());
+                orderNodeBuilder.append("-澶勭悊鐢ㄦ埛鍗囬檷绾уけ璐�,寮傚父鍘熷洜:").append(e.getMessage());
                 logger.error("澶勭悊鐢ㄦ埛鍗囬檷绾уけ璐ワ細" + e.getMessage());
                 //鍙戦�佷紒涓氬井淇¢�氱煡缁欏伐浣滀汉鍛�
                 SendNoticeUtil.failOrderSendNotice(ordersTotal,e.getMessage(),snapshot,commonService,customParameter);
diff --git a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
index 36b52b0..0e8f7fa 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
@@ -14,6 +14,7 @@
 import com.hx.phiappt.model.cardItem.CardItemInfo;
 import com.hx.phiappt.model.consume.ConsumePay;
 import com.hx.phiappt.model.consume.ConsumePayItem;
+import com.hx.phiappt.model.consume.ConsumePayItemSon;
 import com.hx.phiappt.model.coupon.CouponNumber;
 import com.hx.phiappt.model.coupon.CouponOrderDiscountLog;
 import com.hx.phiappt.model.order.*;
@@ -30,6 +31,7 @@
 import com.hx.util.StringUtils;
 import com.platform.exception.PlatTipsException;
 import com.platform.resultTool.PlatformCode;
+import org.springframework.beans.BeanUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -41,8 +43,17 @@
  */
 public class PartialRefundUtil {
 
+    /**鏈夊瓙椤归��娆剧殑绫诲瀷*/
+    public static Set<String> CONTAIN_SON_TYPE_SET;
+
     /**棰嗗缓浼樻儬鍒告爣璇�*/
     public static final String HIS_COUPON_CODE = "his_coupon_code";
+
+    static {
+        CONTAIN_SON_TYPE_SET = new HashSet<>();
+        CONTAIN_SON_TYPE_SET.add(OrderItemConstants.TYPE_PROMOTION);
+        CONTAIN_SON_TYPE_SET.add(OrderItemConstants.CARD_BAG);
+    }
 
     /**
      * 閫�娆炬�绘祦绋嬪伐鍏�
@@ -64,9 +75,10 @@
         //閫�娆炬�昏鍗曠姸鎬佸彉鏇�
         values.put("refundStatus", RefundStatus.STATUS_SUCC_REFUND);
         values.put("oldRefundStatus", RefundStatus.STATUS_APPLY_REFUND);
+        values.put("refundTotal", refundRecord.getRefundTotal());
         values.put("isDel", BaseEntity.NO);
         values.put("id",refundRecord.getId());
-        sqlSentence.sqlSentence(" refundStatus=#{m.refundStatus} WHERE id = #{m.refundId} AND isDel=#{m.isDel} AND refundStatus = #{m.oldRefundStatus}",values);
+        sqlSentence.sqlSentence(" refundTotal = #{m.refundTotal},refundStatus=#{m.refundStatus} WHERE id = #{m.id} AND isDel=#{m.isDel} AND refundStatus = #{m.oldRefundStatus}",values);
         if(commonService.updateWhere(RefundRecordMapper.class,sqlSentence) != 1){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鎿嶄綔澶辫触锛岄��娆惧崟鐘舵�佸凡鏀瑰彉锛�");
         }
@@ -161,8 +173,9 @@
 
         //鑾峰彇鎬婚��娆炬柟寮�
         List<RefundRecordMethod> refundRecordMethodList = refundCarryVo.getRefundRecordMethodList();
-
+        //閫�娆剧殑鏀粯鏂瑰紡璁板綍鏁版嵁
         List<RefundRecordConsumePay> refundConsumePayList = refundCarryVo.getRefundConsumePayList();
+        //閫氳繃鏀粯缂栧彿锛岃杞藉垎缁勫ソ鏀粯鏂瑰紡璁板綍锛宬ey鍊硷細鏀粯鏂瑰紡缂栧彿锛寁alue锛氭敮浠樻柟寮忚褰曢泦鍚�
         Map<String,List<RefundRecordConsumePay>> refundConsumePayMap= new HashMap<>();
         List<RefundRecordConsumePay> refundRecordConsumePays;
         for(RefundRecordConsumePay refundRecordConsumePay:refundConsumePayList){
@@ -174,6 +187,7 @@
         RefundRecordConsumePay refundRecordConsumePay1;
 
         for(RefundRecordMethod refundRecordMethod:refundRecordMethodList){
+            //鍒ゆ柇鏄惁宸茬粡琚垎閰嶅畬
             if(refundRecordMethod.getpTotal().compareTo(BigDecimal.ZERO) > 0){
                 throw new TipsException("閫�娆鹃敊璇痆20]锛�");
             }
@@ -193,7 +207,7 @@
 
                 //鐢熸垚鍏宠仈璁板綍
                 refundRecordConsumePay1 = insertRefundRecordConsumePay(refundRecordConsumePay.getRefundTotal(),null,null,refundRecord.getOrderId(),refundRecordConsumePay.getNumberNo()
-                        ,refundRecordConsumePay.getName(),refundRecordConsumePay.getConsumePayId(),refundRecordMethod.getId(),null,refundRecord.getId(),commonService);
+                        ,refundRecordConsumePay.getName(),refundRecordConsumePay.getIsMoneyPay(),refundRecordConsumePay.getIsExecute(),refundRecordConsumePay.getConsumePayId(),refundRecordMethod.getId(),null,refundRecord.getId(),commonService);
                 refundRecordConsumePayList.add(refundRecordConsumePay1);
             }
             //淇敼瀹為檯閫�娆鹃噾棰�
@@ -353,20 +367,34 @@
         refundCarryVo = insertRefundItemMothed(refundRecordItem.getId(),refundRecordItem.getRefundMoney(),payMothedPercentage,OrderSourceConstans.TYPE_PROJECT
                 ,refundRecordItem.getOrderItemId(),refundCarryVo,refundRecord,commonService);
 
+        //鏇存柊閫�娆惧瓙鍗�
+        updateRefundItem(refundCarryVo.getDeductionTotal(),refundCarryVo.getCashTotal(),deductionTotalUser
+                ,refundRecordItem.getId(),commonService);
+
+        return refundCarryVo;
+    }
+
+    /**鏇存柊閫�娆句竴绾у瓙鍗曠殑淇℃伅
+     * @param deductionTotal 閫�娆炬柟寮忕殑鍒掓墸閲戦
+     * @param cashTotal 閫�娆炬柟寮忕殑鐜伴噾閲戦
+     * @param deductionTotalUser 鐢ㄦ埛椤圭洰鐨勫垝鎵i噾棰�
+     * @param refundItemId 閫�娆捐褰曚竴绾у瓙鍗曟爣璇�
+     * @param commonService 鏄犲皠
+     */
+    public static void updateRefundItem(BigDecimal deductionTotal,BigDecimal cashTotal,BigDecimal deductionTotalUser
+            ,String refundItemId,CommonService commonService){
         SqlSentence sqlSentence = new SqlSentence();
         Map<String,Object> values = new HashMap<>();
 
         //鏇存柊閫�娆惧瓙鍗曠殑淇℃伅锛屾洿鏂扮幇閲戝拰鍒掓墸閲戦淇濆瓨
-        values.put("deductionTotal",refundCarryVo.getDeductionTotal());
+        values.put("deductionTotal",deductionTotal);
         values.put("deductionTotalUser",deductionTotalUser==null?BigDecimal.ZERO:deductionTotalUser);
-        values.put("cashTotal",refundCarryVo.getCashTotal());
-        values.put("id",refundRecordItem.getId());
+        values.put("cashTotal",cashTotal);
+        values.put("id",refundItemId);
         sqlSentence.sqlUpdate("deductionTotal = #{m.deductionTotal},deductionTotalUser = #{m.deductionTotalUser},cashTotal = #{m.cashTotal} WHERE id = #{m.id}",values);
         if(commonService.updateWhere(RefundRecordItemMapper.class,sqlSentence) != 1){
             throw new TipsException("鏇存柊閫�娆惧瓙椤逛俊鎭け璐ワ紒");
         }
-
-        return refundCarryVo;
     }
 
     /**澶勭悊浜岀骇瀛愰��娆炬柟寮忔暟鎹�
@@ -530,6 +558,7 @@
                 refundRecordItemMethod.setActualTotal(surplusTotal);
             }
 
+            refundRecordItemMethod.setRealRefundTotal(refundRecordItemMethod.getActualTotal());
             refundRecordItemMethod.setCommonType(orderItemType);
             refundRecordItemMethod.setCommonId(orderItemId);
             refundRecordItemMethod.setOrderId(refundRecordMethod.getOrderId());
@@ -564,16 +593,16 @@
 
                 //鍒掓墸閲戦
                 if(consumePayItem.getIsMoneyPay().equals(ConsumePayItem.YES)){
-                    deductionTotal = deductionTotal.add(mothedCutTotal).setScale(2,RoundingMode.HALF_UP);
+                    cashTotal = cashTotal.add(mothedCutTotal).setScale(2,RoundingMode.HALF_UP);
                 }
                 //鐜伴噾閲戦
                 if(consumePayItem.getIsExecute().equals(ConsumePayItem.YES)){
-                    cashTotal = cashTotal.add(mothedCutTotal).setScale(2,RoundingMode.HALF_UP);
+                    deductionTotal = deductionTotal.add(mothedCutTotal).setScale(2,RoundingMode.HALF_UP);
                 }
 
                 //鐢熸垚鍏宠仈璁板綍
                 refundRecordConsumePay = insertRefundRecordConsumePay(mothedCutTotal,refundRecordItemMethod.getCommonType(),refundRecordItemMethod.getCommonId(),refundRecord.getOrderId(),consumePayItem.getNumberNo()
-                        ,consumePayItem.getName(),consumePayItem.getConsumePayId(),refundRecordItemMethod.getId(),refundItemId,refundRecord.getId(),commonService);
+                        ,consumePayItem.getName(),consumePayItem.getIsMoneyPay(),consumePayItem.getIsExecute(),consumePayItem.getConsumePayId(),refundRecordItemMethod.getId(),refundItemId,refundRecord.getId(),commonService);
                 refundConsumePayList.add(refundRecordConsumePay);
 
                 //鏀粯鏂瑰紡璁板綍鍑忔帀宸茬粡鍒嗛厤閫�娆炬柟寮忛噾棰�
@@ -720,6 +749,7 @@
             refundCarryVo.setRefundConsumePayList(new ArrayList<>());
             refundCarryVo.setDeductionTotal(BigDecimal.ZERO);
             refundCarryVo.setCashTotal(BigDecimal.ZERO);
+            refundCarryVo.setDeductionTotalUser(BigDecimal.ZERO);
             //鍟嗗搧绫诲瀷鍒ゆ柇
             switch (refundRecordItem.getType()){
                 case OrderItemConstants.TYPE_RETAIL:
@@ -745,7 +775,7 @@
 
             //閬嶅巻鍙犲姞鏀粯鏂瑰紡璁板綍鐨勯��娆鹃噾棰�
             for(RefundRecordConsumePay re:refundCarryVo.getRefundConsumePayList()){
-                refundRecordConsumePay = refundRecordConsumePayMap.computeIfAbsent(re.getConsumePayId(),k->new RefundRecordConsumePay(BigDecimal.ZERO,re.getNumberNo(),re.getConsumePayId()));
+                refundRecordConsumePay = refundRecordConsumePayMap.computeIfAbsent(re.getConsumePayId(),k->new RefundRecordConsumePay(BigDecimal.ZERO,re.getNumberNo(),re.getName(),re.getIsMoneyPay(),re.getIsExecute(),re.getConsumePayId()));
                 refundRecordConsumePay.setRefundTotal(refundRecordConsumePay.getRefundTotal().add(re.getRefundTotal()));
             }
         }
@@ -834,6 +864,8 @@
         //鐢ㄦ埛椤圭洰鎿嶄綔
         UserProjectDeductionVo  userProjectDeductionVo = UserProjectTool.userProjectDeduction(userProjectItem,UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_DEDUCTION,null
                 ,refundRecordItem.getId(),refundRecordItem.getRefundNum(),refundRecord.getOperatorAppId(),refundRecord.getOperatorAppName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getRemarks()+"|鐢ㄦ埛澶囨敞锛�"+refundRecord.getRefundReason(),commonService);
+
+        refundCarryVo.setDeductionTotalUser(userProjectDeductionVo.getDeductionTotal());
 
         //璁$畻瀛愬崟鏄惁杩樻湁鍓╀綑鐨勫彲鎵g枟绋嬫暟
         int surplusNum = orderItem.getUsedTotal()-orderItem.getHasReNum();
@@ -1023,6 +1055,8 @@
             throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒拌鍗″寘鐨勭粍鍚堥」");
         }
 
+        System.out.println("cardItemInfo.getCardEquityId():"+cardItemInfo.getCardEquityId());
+
         //鑾峰彇鏉冪泭绫诲瀷
         CardEquity cardEquity = commonService.selectOneByKey(CardEquityMapper.class,cardItemInfo.getCardEquityId());
         if(cardEquity == null){
@@ -1090,12 +1124,15 @@
         BigDecimal deductionTotal = BigDecimal.ZERO;
         //璁$畻鏈閫�娆炬柟寮忕殑鐜伴噾閲戦
         BigDecimal cashTotal = BigDecimal.ZERO;
+        //鍒嗛厤鐨勭敤鎴烽」鐩垝鎵i噾棰�
+        BigDecimal deductionTotalUser = BigDecimal.ZERO;
 
         for (RefundRecordItemSource son : sons) {
             //鍒濆鍖栨�荤粨鏋勬惡甯﹀弬鏁�
             refundCarryVo.setRefundConsumePayList(new ArrayList<>());
             refundCarryVo.setDeductionTotal(BigDecimal.ZERO);
             refundCarryVo.setCashTotal(BigDecimal.ZERO);
+            refundCarryVo.setDeductionTotalUser(BigDecimal.ZERO);
             switch (GroupTypeEnum.getCode(son.getType())){
                 case PROJECT:
                     refundCarryVo = handRefundNoSonExecution(refundRecord,refundRecordItem,son,refundCarryVo,commonService);
@@ -1127,9 +1164,10 @@
             }
             deductionTotal = deductionTotal.add(refundCarryVo.getDeductionTotal());
             cashTotal = cashTotal.add(refundCarryVo.getCashTotal());
+            deductionTotalUser = deductionTotalUser.add(refundCarryVo.getDeductionTotalUser());
             //閬嶅巻鍙犲姞鏀粯鏂瑰紡璁板綍鐨勯��娆鹃噾棰�
             for(RefundRecordConsumePay re:refundCarryVo.getRefundConsumePayList()){
-                refundRecordConsumePay = refundRecordConsumePayMap.computeIfAbsent(re.getConsumePayId(),k->new RefundRecordConsumePay(BigDecimal.ZERO,re.getNumberNo(),re.getConsumePayId()));
+                refundRecordConsumePay = refundRecordConsumePayMap.computeIfAbsent(re.getConsumePayId(),k->new RefundRecordConsumePay(BigDecimal.ZERO,re.getNumberNo(),re.getName(),re.getIsMoneyPay(),re.getIsExecute(),re.getConsumePayId()));
                 refundRecordConsumePay.setRefundTotal(refundRecordConsumePay.getRefundTotal().add(re.getRefundTotal()));
             }
         }
@@ -1141,7 +1179,12 @@
         }
         refundCarryVo.setCashTotal(cashTotal);
         refundCarryVo.setDeductionTotal(deductionTotal);
+        refundCarryVo.setDeductionTotalUser(deductionTotalUser);
         refundCarryVo.setRefundConsumePayList(refundRecordConsumePayList);
+
+        //鏇存柊閫�娆惧瓙鍗�
+        updateRefundItem(refundCarryVo.getDeductionTotal(),refundCarryVo.getCashTotal(),refundCarryVo.getDeductionTotalUser()
+                ,refundRecordItem.getId(),commonService);
 
         //鑾峰彇鍏跺瓙椤�
         map.put("orderItemId",orderItem.getId());
@@ -1205,6 +1248,8 @@
         //澶勭悊鐢ㄦ埛椤圭洰锛屽噺鍘荤敤鎴烽」鐩暟閲�
         UserProjectDeductionVo userProjectDeductionVo= UserProjectTool.userProjectDeduction(userProjectItem,UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_DEDUCTION,null
                 ,refundRecordItemSource.getId(),refundRecordItemSource.getRefundNum(),refundRecord.getOperatorAppId(),refundRecord.getOperatorAppName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getRemarks()+"|鐢ㄦ埛澶囨敞锛�"+refundRecord.getRefundReason(),commonService);
+
+        refundCarryVo.setDeductionTotalUser(userProjectDeductionVo.getDeductionTotal());
 
         int refundStatus;
         if(surplusNum == refundRecordItemSource.getRefundNum()){
@@ -1331,7 +1376,7 @@
         //鑾峰彇瀛愬崟鐨勬敮浠樻柟寮忥紝涓�绾у瓙鍗曟敮浠樿褰曪紝璁$畻鍙��娆鹃噾棰�
         values.put("typeId",orderItemId);
         sqlSentence.sqlSentence("SELECT * FROM consume_pay_item WHERE isDel = 0 AND typeId = #{m.typeId}",values);
-        return commonService.selectList(ConsumePayMapper.class,sqlSentence);
+        return commonService.selectList(ConsumePayItemMapper.class,sqlSentence);
     }
 
     /**鑾峰彇璁㈠崟浜岀骇瀛愬崟鐨勬敮浠樻柟寮忚褰�
@@ -1347,12 +1392,20 @@
         //鑾峰彇瀛愬崟鐨勬敮浠樻柟寮忥紝涓�绾у瓙鍗曟敮浠樿褰曪紝璁$畻鍙��娆鹃噾棰�
         values.put("typeId",orderItemId);
         sqlSentence.sqlSentence("SELECT * FROM consume_pay_item_son WHERE isDel = 0 AND typeId = #{m.typeId}",values);
-        return commonService.selectList(ConsumePayMapper.class,sqlSentence);
+        List<ConsumePayItemSon> consumePayItemSonList = commonService.selectList(ConsumePayItemSonMapper.class,sqlSentence);
+        List<ConsumePayItem> consumePayItemList = new ArrayList<>();
+        ConsumePayItem consumePayItem;
+        for(ConsumePayItemSon consumePayItemSon:consumePayItemSonList){
+            consumePayItem = new ConsumePayItem();
+            BeanUtils.copyProperties(consumePayItemSon,consumePayItem);
+            consumePayItemList.add(consumePayItem);
+        }
+        return consumePayItemList;
     }
 
     /**鑾峰彇宸查��娆炬柟寮忛噾棰濓紝鏍规嵁鏀粯鏂瑰紡缂栧彿姹傚拰杩斿洖
      * 娉ㄦ剰锛歡roupByONumberNo鍜実roupByConsumePayId涓嶈兘鍚屾椂浣跨敤
-     * @param itemId 瀛愬崟鏍囪瘑
+     * @param itemId 璁㈠崟瀛愬崟鏍囪瘑
      * @param refundRecordItemId 閫�娆惧瓙鍗曟爣璇�
      * @param groupByONumberNo 鏍规嵁鏀粯鏂瑰紡缂栧彿姹傚拰
      * @param groupByConsumePayId 鏍规嵁鏀粯鏂瑰紡璁板綍鏍囪瘑姹傚拰
@@ -1367,13 +1420,13 @@
 
         sql.append("SELECT");
         if(groupByONumberNo){
-            sql.append(" numberNo,");
+            sql.append(" a.numberNo,");
         }
         if(groupByConsumePayId){
-            sql.append(" consumePayId,");
+            sql.append(" a.consumePayId,");
         }
-        sql.append("SUM(refundTotal) AS refundTotal FROM refund_record_consume_pay a");
-        sql.append(" JOIN refund_record rr ON rr.isDel = 0 AND rr.status = #{status}");
+        sql.append("SUM(a.refundTotal) AS refundTotal FROM refund_record_consume_pay a");
+        sql.append(" JOIN refund_record rr ON rr.id = a.refundRecordId AND rr.isDel = 0 AND rr.refundStatus = #{m.refundStatus}");
         sql.append("  WHERE a.isDel = 0");
         if(StringUtils.noNull(itemId)){
             sql.append("  AND a.commonId = #{m.commonId}");
@@ -1389,7 +1442,7 @@
         }
         //鑾峰彇宸查��娆剧殑鏀粯鏂瑰紡
         values.put("commonId",itemId);
-        values.put("status", RefundStatus.STATUS_SUCC_REFUND);
+        values.put("refundStatus", RefundStatus.STATUS_SUCC_REFUND);
         sqlSentence.sqlSentence(sql.toString(),values);
         return commonService.selectList(RefundRecordConsumePayMapper.class,sqlSentence);
     }
@@ -1409,7 +1462,7 @@
      * @return 杩斿洖鍏宠仈璁板綍
      */
     public static RefundRecordConsumePay insertRefundRecordConsumePay(BigDecimal refundTotal, String commonType, String commonId, String orderId
-            , String numberNo,String name, String consumePayId, String refundMethodId,String refundRecordItemId,String refundRecordId,CommonService commonService){
+            , String numberNo,String name,Integer isMoneyPay,Integer isExecute, String consumePayId, String refundMethodId,String refundRecordItemId,String refundRecordId,CommonService commonService){
         //鐢熸垚鍏宠仈璁板綍
         RefundRecordConsumePay refundRecordConsumePay = new RefundRecordConsumePay();
         refundRecordConsumePay.setRefundTotal(refundTotal);
@@ -1418,6 +1471,8 @@
         refundRecordConsumePay.setOrderId(orderId);
         refundRecordConsumePay.setName(name);
         refundRecordConsumePay.setNumberNo(numberNo);
+        refundRecordConsumePay.setIsMoneyPay(isMoneyPay);
+        refundRecordConsumePay.setIsExecute(isExecute);
         refundRecordConsumePay.setConsumePayId(consumePayId);
         refundRecordConsumePay.setRefundMethodId(refundMethodId);
         refundRecordConsumePay.setRefundRecordItemId(refundRecordItemId);
diff --git a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PaymentCountTool.java b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PaymentCountTool.java
index fe26528..567f0c1 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PaymentCountTool.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PaymentCountTool.java
@@ -48,6 +48,8 @@
         BigDecimal scale = BigDecimal.valueOf(refundNum).divide(BigDecimal.valueOf(sum),15, RoundingMode.HALF_UP);
         //鍓╀綑鍙��娆鹃噾棰�
         BigDecimal surplusTotal = total.subtract(realRefundTotal).setScale(2,RoundingMode.HALF_UP);
+        System.out.println("realRefundTotal:"+realRefundTotal);
+        System.out.println("surplusTotal:"+surplusTotal);
         //绠楀嚭鏈瑕侀��娆鹃噾棰�
         if(refundTotal == null){
             if(surplusNum.equals(refundNum)) {
@@ -61,7 +63,7 @@
                 }
             }
         }
-
+        System.out.println("refundTotal:"+refundTotal);
         //杞浇鍒嗛厤濂界殑鏀粯鏂瑰紡鍜岄噾棰�
         List<DistributionRedundMethodVo> distributionPayList = new ArrayList<>();
         if(payMethodVoList != null && payMethodVoList.size() > 0){

--
Gitblit v1.8.0