Parcourir la source

Merge remote-tracking branch 'remotes/origin/developer' into developerA

# Conflicts:
#	src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java
#	src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java
#	src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java
#	src/main/java/com/caimei/modules/order/entity/NewOrder.java
#	src/main/java/com/caimei/modules/product/web/ProductNewController.java
#	src/main/resources/config/dev/caimei.properties
#	src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml
#	src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
Aslee il y a 3 ans
Parent
commit
349af44c19
100 fichiers modifiés avec 9401 ajouts et 1323 suppressions
  1. 22 1
      pom.xml
  2. 8 2
      src/main/java/com/caimei/modules/archive/utils/OssArchiveUtil.java
  3. 16 0
      src/main/java/com/caimei/modules/bulkpurchase/dao/CommissionsDao.java
  4. 80 0
      src/main/java/com/caimei/modules/bulkpurchase/entity/Commissions.java
  5. 37 0
      src/main/java/com/caimei/modules/bulkpurchase/service/CommissionsService.java
  6. 12 102
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  7. 70 0
      src/main/java/com/caimei/modules/bulkpurchase/web/CommissionsController.java
  8. 9 0
      src/main/java/com/caimei/modules/cibe/entity/Shop.java
  9. 2 0
      src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java
  10. 2 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java
  11. 2 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheCollageProductDao.java
  12. 5 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheCouponDao.java
  13. 4 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java
  14. 9 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java
  15. 1 1
      src/main/java/com/caimei/modules/hehe/service/CmHeheCollageService.java
  16. 17 0
      src/main/java/com/caimei/modules/newhome/dao/AnnouncementDao.java
  17. 77 0
      src/main/java/com/caimei/modules/newhome/entity/Announcementmanagement.java
  18. 58 0
      src/main/java/com/caimei/modules/newhome/service/AnnouncementService.java
  19. 101 0
      src/main/java/com/caimei/modules/newhome/web/AnnouncementController.java
  20. 2 12
      src/main/java/com/caimei/modules/order/dao/CmDiscernReceiptDao.java
  21. 5 8
      src/main/java/com/caimei/modules/order/dao/CmReceiptOrderRelationDao.java
  22. 3 1
      src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java
  23. 46 3
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  24. 9 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  25. 197 0
      src/main/java/com/caimei/modules/order/entity/AccountPayOrder.java
  26. 28 0
      src/main/java/com/caimei/modules/order/entity/AccountPayOrderType.java
  27. 125 0
      src/main/java/com/caimei/modules/order/entity/AppPayRefundOrderResponseVo.java
  28. 109 0
      src/main/java/com/caimei/modules/order/entity/AppPayRefundOrderVo.java
  29. 426 0
      src/main/java/com/caimei/modules/order/entity/CartItemVo.java
  30. 0 61
      src/main/java/com/caimei/modules/order/entity/CmOnlineRefundVo.java
  31. 12 0
      src/main/java/com/caimei/modules/order/entity/CmReceiptOrderRelation.java
  32. 2 12
      src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java
  33. 53 0
      src/main/java/com/caimei/modules/order/entity/Constant.java
  34. 124 0
      src/main/java/com/caimei/modules/order/entity/LadderPriceVo.java
  35. 186 0
      src/main/java/com/caimei/modules/order/entity/LogisticsRecordVo.java
  36. 10 19
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  37. 9 0
      src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java
  38. 64 1
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  39. 95 0
      src/main/java/com/caimei/modules/order/entity/OnlineRefundData.java
  40. 85 0
      src/main/java/com/caimei/modules/order/entity/OnlineRefundVo.java
  41. 88 0
      src/main/java/com/caimei/modules/order/entity/OnlineVo.java
  42. 709 0
      src/main/java/com/caimei/modules/order/entity/OrderProductVo.java
  43. 212 0
      src/main/java/com/caimei/modules/order/entity/OrderReceiptRelationPo.java
  44. 185 0
      src/main/java/com/caimei/modules/order/entity/OrderUserinfoVo.java
  45. 920 0
      src/main/java/com/caimei/modules/order/entity/OrderVo.java
  46. 256 0
      src/main/java/com/caimei/modules/order/entity/PayParamBo.java
  47. 310 0
      src/main/java/com/caimei/modules/order/entity/PayShopPo.java
  48. 145 0
      src/main/java/com/caimei/modules/order/entity/PayShopRecordPo.java
  49. 21 0
      src/main/java/com/caimei/modules/order/entity/ProductType.java
  50. 78 0
      src/main/java/com/caimei/modules/order/entity/PromotionPriceVo.java
  51. 239 0
      src/main/java/com/caimei/modules/order/entity/PromotionsVo.java
  52. 18 0
      src/main/java/com/caimei/modules/order/entity/ReceiptOrderInfoVo.java
  53. 1 18
      src/main/java/com/caimei/modules/order/entity/ReceiptRecordVo.java
  54. 45 0
      src/main/java/com/caimei/modules/order/entity/ShopOrderReturned.java
  55. 560 0
      src/main/java/com/caimei/modules/order/entity/ShopOrderVo.java
  56. 221 0
      src/main/java/com/caimei/modules/order/entity/SplitAccountPo.java
  57. 10 14
      src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java
  58. 1 0
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  59. 197 216
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  60. 288 105
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  61. 18 4
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  62. 672 0
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  63. 98 0
      src/main/java/com/caimei/modules/order/service/WeChatService.java
  64. 77 0
      src/main/java/com/caimei/modules/order/utils/Disguiser.java
  65. 127 0
      src/main/java/com/caimei/modules/order/utils/HttpClientService.java
  66. 110 0
      src/main/java/com/caimei/modules/order/utils/MyBeanUtils.java
  67. 18 10
      src/main/java/com/caimei/modules/order/utils/OrderUtil.java
  68. 135 0
      src/main/java/com/caimei/modules/order/utils/PayUtil.java
  69. 8 0
      src/main/java/com/caimei/modules/order/web/CmShopOrderController.java
  70. 16 40
      src/main/java/com/caimei/modules/order/web/NewOrderController.java
  71. 63 0
      src/main/java/com/caimei/modules/order/web/SplitAccountController.java
  72. 14 0
      src/main/java/com/caimei/modules/product/dao/CmSecondHandDetailDao.java
  73. 8 0
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  74. 6 0
      src/main/java/com/caimei/modules/product/dao/ProductNewDao.java
  75. 54 9
      src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java
  76. 12 1
      src/main/java/com/caimei/modules/product/entity/CmShop.java
  77. 42 0
      src/main/java/com/caimei/modules/product/entity/CmSplitCode.java
  78. 108 490
      src/main/java/com/caimei/modules/product/entity/Product.java
  79. 96 53
      src/main/java/com/caimei/modules/product/service/CmSecondHandDetailService.java
  80. 123 4
      src/main/java/com/caimei/modules/product/service/ProductNewService.java
  81. 101 6
      src/main/java/com/caimei/modules/product/service/ProductService.java
  82. 83 89
      src/main/java/com/caimei/modules/product/service/RepeatPurchasePriceService.java
  83. 42 15
      src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java
  84. 189 1
      src/main/java/com/caimei/modules/product/web/ProductNewController.java
  85. 19 0
      src/main/java/com/caimei/modules/user/aop/OperationLogAnnotation.java
  86. 203 0
      src/main/java/com/caimei/modules/user/aop/OperationLogAspect.java
  87. 134 0
      src/main/java/com/caimei/modules/user/aop/OperationLogCmShop.java
  88. 18 0
      src/main/java/com/caimei/modules/user/aop/OperationLogShop.java
  89. 2 1
      src/main/java/com/caimei/modules/user/dao/CmClubinfoDao.java
  90. 15 0
      src/main/java/com/caimei/modules/user/dao/CmOperationsDao.java
  91. 0 6
      src/main/java/com/caimei/modules/user/dao/CmUserDao.java
  92. 3 1
      src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java
  93. 6 0
      src/main/java/com/caimei/modules/user/dao/NewCmShopDao.java
  94. 32 0
      src/main/java/com/caimei/modules/user/dao/OperationsDao.java
  95. 1 2
      src/main/java/com/caimei/modules/user/entity/CmClubinfo.java
  96. 84 0
      src/main/java/com/caimei/modules/user/entity/CmOperationalLogs.java
  97. 1 10
      src/main/java/com/caimei/modules/user/entity/CmUser.java
  98. 1 1
      src/main/java/com/caimei/modules/user/entity/CmUserBalanceRecord.java
  99. 0 2
      src/main/java/com/caimei/modules/user/entity/NewCmClub.java
  100. 36 2
      src/main/java/com/caimei/modules/user/entity/NewCmShop.java

+ 22 - 1
pom.xml

@@ -105,7 +105,16 @@
 	</pluginRepositories>
 	<!-- 依赖项定义 -->
 	<dependencies>
-
+		<dependency>
+			<groupId>commons-httpclient</groupId>
+			<artifactId>commons-httpclient</artifactId>
+			<version>3.1</version>
+		</dependency>
+		<dependency>
+			<groupId>com.squareup.okhttp3</groupId>
+			<artifactId>okhttp</artifactId>
+			<version>3.8.1</version>
+		</dependency>
 		<!-- SPRING begin -->
 		<dependency>
 			<groupId>org.springframework</groupId>
@@ -733,6 +742,18 @@
 			<version>3.6</version>
 		</dependency>
 
+		<!--spring AOP的包-->
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aspects</artifactId>
+			<version>4.3.7.RELEASE</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aop</artifactId>
+			<version>4.3.7.RELEASE</version>
+		</dependency>
 		<!--
         Optional dependency. Needed only if you deploy `ImageIO` plugins as part of a web app.
         Make sure you add the `IIOProviderContextListener` to your `web.xml`, see above.

+ 8 - 2
src/main/java/com/caimei/modules/archive/utils/OssArchiveUtil.java

@@ -92,12 +92,18 @@ public class OssArchiveUtil {
         if (".vsd".equalsIgnoreCase(fileExtension)) {
             return "application/vnd.visio";
         }
-        if (".ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) {
+        if (".ppt".equalsIgnoreCase(fileExtension)  ) {
             return "application/vnd.ms-powerpoint";
         }
-        if (".doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) {
+        if (".pptx".equalsIgnoreCase(fileExtension)) {
+            return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
+        }
+        if (".doc".equalsIgnoreCase(fileExtension) ) {
             return "application/msword";
         }
+        if ("docx".equalsIgnoreCase(fileExtension)) {
+            return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+        }
         if (".xml".equalsIgnoreCase(fileExtension)) {
             return "text/xml";
         }

+ 16 - 0
src/main/java/com/caimei/modules/bulkpurchase/dao/CommissionsDao.java

@@ -0,0 +1,16 @@
+package com.caimei.modules.bulkpurchase.dao;
+
+import com.caimei.modules.bulkpurchase.entity.Commissions;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/3/25
+ */
+@MyBatisDao
+public interface CommissionsDao extends CrudDao<Commissions> {
+
+}

+ 80 - 0
src/main/java/com/caimei/modules/bulkpurchase/entity/Commissions.java

@@ -0,0 +1,80 @@
+package com.caimei.modules.bulkpurchase.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/3/25
+ */
+public class Commissions extends DataEntity<Commissions> {
+    private String id;
+    //订单表id
+    private String orderId;
+    //记录人
+    private String name;
+    //创建时间
+    private Date addTime;
+    //提成情况
+    private String sales;
+    //备注
+    private String script;
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+
+    public String getSales() {
+        return sales;
+    }
+
+    public void setSales(String sales) {
+        this.sales = sales;
+    }
+
+    public String getScript() {
+        return script;
+    }
+
+    public void setScript(String script) {
+        this.script = script;
+    }
+
+    public String getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(String orderId) {
+        this.orderId = orderId;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+}

+ 37 - 0
src/main/java/com/caimei/modules/bulkpurchase/service/CommissionsService.java

@@ -0,0 +1,37 @@
+package com.caimei.modules.bulkpurchase.service;
+
+import com.caimei.modules.bulkpurchase.dao.CommissionsDao;
+import com.caimei.modules.bulkpurchase.entity.Commissions;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/3/25
+ */
+@Service
+@Transactional(readOnly = true)
+public class CommissionsService extends CrudService<CommissionsDao,Commissions> {
+
+    @Autowired
+    CommissionsDao commissionsDao;
+
+
+   public List<Commissions> findList(Commissions commissions){
+
+        return commissionsDao.findList(commissions);
+    }
+
+    @Transactional(readOnly = false)
+    public int insert(Commissions commissions){
+       return commissionsDao.insert(commissions);
+    }
+
+}

+ 12 - 102
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -161,6 +161,7 @@ public class CmRefundsProductController extends BaseController {
                 cmReturnedPurchase = cmReturnedPurchaseDao.get(cmReturnedPurchase.getId());//编辑重置数据
             }
             NewOrder newOrder = newOrderService.getNewOrder(cmReturnedPurchase);
+
             //统计订单已支付金额
             Double yizhifu = 0d;
             Double totalDiscount = 0d;
@@ -267,12 +268,12 @@ public class CmRefundsProductController extends BaseController {
             BpClause bpClause = new BpClause();
             bpClause.setEnabledStatus("1");
             List<BpClause> bpClauses = bpClauseService.findList(bpClause);
-
             CmDiscernReceipt cmDiscernReceipt = cmDiscernReceiptDao.findPayType(newOrder.getOrderID().toString());
+
             //是否可以线上退回
             boolean returnOnline = false;
             if (cmDiscernReceipt != null && "1".equals(cmDiscernReceipt.getPayWay())) {
-                Date splitTime = cmDiscernReceiptDao.findSplitTime(newOrder.getOrderID());
+                /*Date splitTime = cmDiscernReceiptDao.findSplitTime(newOrder.getOrderID());
                 if (splitTime != null) {
                     Calendar calendar = Calendar.getInstance();
                     calendar.setTime(splitTime);
@@ -283,71 +284,8 @@ public class CmRefundsProductController extends BaseController {
                     }
                 } else {
                     returnOnline = true;
-                }
-            }
-            //订单支付线上余额
-            Double onlineMoney = cmDiscernReceiptDao.findOnlineMoney(newOrder.getOrderID().toString());
-            //线上只能全退,理论不用考虑线上退款
-//            Double refundOnlineMoney = cmDiscernReceiptDao.findRefundOnlineMoney(newOrder.getOrderID().toString());
-            //订单支付线下余额
-            Double userMoney = cmDiscernReceiptDao.findUserMoney(newOrder.getOrderID().toString());
-            Double refundUserMoney = cmDiscernReceiptDao.findRefundUserMoney(newOrder.getOrderID().toString());
-            refundUserMoney = null == refundUserMoney ? 0 : refundUserMoney;
-//            refundOnlineMoney = null == refundOnlineMoney ? 0 : refundOnlineMoney;
-            onlineMoney = null == onlineMoney ? 0 : onlineMoney;
-            userMoney = null == userMoney ? 0 : userMoney;
-            //线上线下余额-退款
-//            onlineMoney -= refundOnlineMoney;
-            userMoney -= refundUserMoney;
-            //退线上/线下
-            if (cmDiscernReceipt != null && "3".equals(cmDiscernReceipt.getPayWay())) {
-                Date splitTime = cmDiscernReceiptDao.findSplitTime(newOrder.getOrderID());
-                if (splitTime != null) {
-                    Calendar calendar = Calendar.getInstance();
-                    calendar.setTime(splitTime);
-                    calendar.set(Calendar.HOUR_OF_DAY, 23);
-                    calendar.set(Calendar.MINUTE, 20);
-                    //分帐后,如果在当天时间的11.20之前
-                    if (calendar.getTime().compareTo(new Date()) > 0) {
-                        //余额全付
-                        //如果当前单线上余额>0,无线下,全付,退线上
-                        if (onlineMoney > 0 && userMoney == 0 && "31".equals(newOrder.getStatus())) {
-                            //1. 当订单全部被线上余额抵扣掉时,订单直接支付成功,无需再支付,但这抵扣掉的线上余额需要参与分账
-                            //此种订单的退款方式有:线上退回,账户余额(两者只能选一个),只能全部退款
-                            returnOnline = true;
-                        }
-                        if (onlineMoney > 0 && userMoney == 0 && "21".equals(newOrder.getStatus())) {
-                            //2. 当线上余额只抵扣了部分订单金额,该订单只能走线上支付
-                            //此种订单的退款方式有:线上退回,账户余额(两者只能选一个),只能全部退款
-                            returnOnline = true;
-                        }
-//                        if (userMoney > 0 && onlineMoney > 0 && newOrder.getPayableAmount() == 0 && "31".equals(newOrder.getStatus())) {
-//                            //5. 当线上余额和线下余额两者都抵扣了且将订单金额全部抵扣完了,订单直接支付成功,无需再支付,但这抵扣掉的线上余额需要参与分账
-//                            //此种订单的退款方式有:线下转账,账户余额(两者只能选一个),只能全部退款
-//                            returnOnline = false;
-//                        }
-//                        if (onlineMoney > 0 && userMoney > 0 && "21".equals(newOrder.getStatus())) {
-//                            //6. 当线上余额和线下余额两者都抵扣了但只抵扣了部分订单金额,订单只能走线下支付,点击提交订单,跳转到线下支付页面
-//                            //此种订单的退款方式有:线下转账,账户余额(两者只能选一个),只能全部退款
-//                            //7. 当订单多次付款,前笔款已经分账,后笔款暂未分账,此时申请退款
-//                            //此种订单的退款方式有:线下转账,账户余额(两者只能选一个),只能全部退款,而且是都退到线下余额
-//                            returnOnline = false;
-//                        }
-                    }
-                }
-                //未分账
-                else {
-                    if (onlineMoney > 0 && userMoney == 0 && "31".equals(newOrder.getStatus())) {
-                        //1. 当订单全部被线上余额抵扣掉时,订单直接支付成功,无需再支付,但这抵扣掉的线上余额需要参与分账
-                        //此种订单的退款方式有:线上退回,账户余额(两者只能选一个),只能全部退款
-                        returnOnline = true;
-                    }
-                    if (onlineMoney > 0 && userMoney == 0 && "21".equals(newOrder.getStatus())) {
-                        //2. 当线上余额只抵扣了部分订单金额,该订单只能走线上支付
-                        //此种订单的退款方式有:线上退回,账户余额(两者只能选一个),只能全部退款
-                        returnOnline = true;
-                    }
-                }
+                }*/
+                returnOnline = true;
             }
             Integer lastReceiptDetailId = cmDiscernReceiptDao.findOrderLastReceiptDetailId(newOrder.getOrderID().toString());
             model.addAttribute("lastReceiptDetailId", lastReceiptDetailId);
@@ -479,51 +417,23 @@ public class CmRefundsProductController extends BaseController {
             }
             //线上退款
             if ("2".equals(cmReturnedPurchase.getReturnedWay())) {
-                Double balancePayFee = newOrder.getBalancePayFee();
-                Double onlineMoney = cmDiscernReceiptDao.findOnlineMoney(newOrder.getOrderID().toString());
-//线上退款是全退,暂不考虑已退
-                //                Double refundOnlineMoney = cmDiscernReceiptDao.findRefundOnlineMoney(newOrder.getOrderID().toString());
-//                refundOnlineMoney = null == refundOnlineMoney ? 0 : refundOnlineMoney;
-                onlineMoney = null == onlineMoney ? 0 : onlineMoney;
-//                //线上线下余额-退款
-//                onlineMoney -= refundOnlineMoney;
-                //线上余额算正常金额退,线上退回=总金额-(余额抵扣-线上)
-                double refundOnlineFee = refundFee - MathUtil.sub(newOrder.getBalancePayFee(),onlineMoney).doubleValue();
-                //总余额减掉退回的线上退回去
-                balancePayFee = MathUtil.sub(balancePayFee, onlineMoney).doubleValue();
+                double refundOnlineFee = refundFee - newOrder.getBalancePayFee();
                 cmReturnedPurchase.setRefundOnlineFee(refundOnlineFee);
-                cmReturnedPurchase.setRefundBalanceFee(balancePayFee);
+                cmReturnedPurchase.setRefundBalanceFee(newOrder.getBalancePayFee());
             } else if ("1".equals(cmReturnedPurchase.getReturnedWay()) && cmReturnedPurchase.getRefundBalanceFee() == 0d) {
-                //可以线上退款的时候选择退余额进这里
-                //退线下余额
-                Double refundBalanceFee = newOrder.getUserMoney();
-                //退线上余额
-                Double refundOnlineBalanceFee = newOrder.getOnlineMoney();
-                //退线上余额加线上付款金额
-                Double onlinePay=cmDiscernReceiptDao.findOnlinePay(newOrder.getOrderID());
-                refundOnlineBalanceFee=MathUtil.add(refundOnlineBalanceFee,onlinePay).doubleValue();
-                //减已退线下
-                Double refundUserMoney = cmDiscernReceiptDao.findRefundUserMoney(newOrder.getOrderID().toString());
-                refundUserMoney = null == refundUserMoney ? 0 : refundUserMoney;
-                refundBalanceFee = MathUtil.sub(refundBalanceFee, refundUserMoney).doubleValue();
-                //暂不考虑线下支付会进这
                 //线上支付,全部退余额
-                cmReturnedPurchase.setRefundBalanceFee(refundBalanceFee);
-                //本次支付剩余退到线上余额(线上余额支付+线上支付)
-                cmReturnedPurchase.setRefundOnlineBalanceFee(refundOnlineBalanceFee);
+                cmReturnedPurchase.setRefundBalanceFee(refundFee);
             }
             //统计填写的拆分金额
-            Double refundBanlace = null == cmReturnedPurchase.getRefundBalanceFee() ? 0 : cmReturnedPurchase.getRefundBalanceFee();
-            Double refundOnline = null == cmReturnedPurchase.getRefundOnlineFee() ? 0 : cmReturnedPurchase.getRefundOnlineFee();
-            Double refundOffline = null == cmReturnedPurchase.getRefundOfflineFee() ? 0 : cmReturnedPurchase.getRefundOfflineFee();
-            Double refundOnlineBalance = null == cmReturnedPurchase.getRefundOnlineBalanceFee() ? 0 : cmReturnedPurchase.getRefundOnlineBalanceFee();
-            Double totalRefundFee = refundBanlace + refundOnline + refundOffline + refundOnlineBalance;
+            Double totalRefundFee = cmReturnedPurchase.getRefundBalanceFee() + cmReturnedPurchase.getRefundOnlineFee() + cmReturnedPurchase.getRefundOfflineFee();
+
             if (rechargeGoods) {
                 CmUser user = cmUserDao.get(newOrder.getUserID().toString());
                 if (user != null && user.getAbleUserMoney() != null && user.getAbleUserMoney() < refundFee) {
                     refundFee = user.getAbleUserMoney();
                 }
             }
+
             //判断退款金额和打款金额是否一致
             double v = totalRefundFee - refundFee;
             if (v > 0.1 || v < -0.1) {
@@ -565,7 +475,7 @@ public class CmRefundsProductController extends BaseController {
                 return fee;
             } else if (newOrder.getReceiptStatus().equals("2")) {//部分收款(全退部分收款的金额)--运费可以选择退或不退
                 Double freight = newOrder.getFreight();/** 默认不退*/
-                if (freightNum > 0) {/**退运费*/
+                if (freightNum >= 0) {/**退运费*/
                     freight = 0d;
                 }
                 //获取部分支付金额

+ 70 - 0
src/main/java/com/caimei/modules/bulkpurchase/web/CommissionsController.java

@@ -0,0 +1,70 @@
+package com.caimei.modules.bulkpurchase.web;
+
+import com.caimei.modules.bulkpurchase.entity.Commissions;
+import com.caimei.modules.bulkpurchase.service.CommissionsService;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.web.BaseController;
+
+import com.thinkgem.jeesite.modules.sys.security.SystemAuthorizingRealm;
+import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/3/25
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/bulkpurchase/commissions")
+public class CommissionsController extends BaseController {
+
+    @Autowired
+    CommissionsService commissionsService;
+
+
+
+    @RequestMapping(value = {""})
+    public String list(Commissions commissions, HttpServletRequest request, HttpServletResponse response, Model model) {
+        List<Commissions> list=commissionsService.findList(commissions);
+        model.addAttribute("list",list);
+        model.addAttribute("orderId",commissions.getOrderId());
+        return "/modules/bulkpurchase/cmCommissionsForm";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(Commissions commissions, Model model,HttpServletRequest request, HttpServletResponse response) {
+        String orderId=request.getParameter("orderId");
+        model.addAttribute("OrderId",orderId);
+
+        return "modules/bulkpurchase/addCommissionsForm";
+    }
+
+
+
+    @RequestMapping(value = "save")
+    public String save(Commissions commissions, Model model,HttpServletRequest request) {
+
+        Date date = new Date();
+        SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
+        commissions.setAddTime(date);
+        commissions.setName( principal.getName());
+        String orderId=request.getParameter("orderId");
+        commissions.setOrderId(orderId);
+            int i = commissionsService.insert(commissions);
+
+        model.addAttribute("commissions",commissions);
+        return "redirect:" + Global.getAdminPath() + "/bulkpurchase/commissions?orderId="+orderId;
+        }
+
+    }
+

+ 9 - 0
src/main/java/com/caimei/modules/cibe/entity/Shop.java

@@ -11,6 +11,7 @@ import java.util.List;
 public class Shop extends DataEntity<Shop> {
 
 	private static final long serialVersionUID = 1L;
+	private String cardNumber;
 	private Integer shopID; //
 	private Integer userID; //
 	private String name; //
@@ -94,6 +95,14 @@ public class Shop extends DataEntity<Shop> {
 		this.shopID = shopID;
 	}
 
+	public String getCardNumber() {
+		return cardNumber;
+	}
+
+	public void setCardNumber(String cardNumber) {
+		this.cardNumber = cardNumber;
+	}
+
 	public Integer getUserID() {
 		return userID;
 	}

+ 2 - 0
src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java

@@ -352,6 +352,7 @@ public class CmCoupon extends DataEntity<CmCoupon> {
         this.usePeriod = usePeriod;
     }
 
+    @JsonFormat(pattern = "yyyy-MM-dd")
     public Date getReceiveDate() {
         return receiveDate;
     }
@@ -360,6 +361,7 @@ public class CmCoupon extends DataEntity<CmCoupon> {
         this.receiveDate = receiveDate;
     }
 
+    @JsonFormat(pattern = "yyyy-MM-dd")
     public Date getUseEndDate() {
         return useEndDate;
     }

+ 2 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java

@@ -64,4 +64,6 @@ public interface CmHeheActivityProductDao extends CrudDao<CmHeheActivityProduct>
      * @param productId
      */
     void deleteUserActivity(Integer productId);
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
 }

+ 2 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheCollageProductDao.java

@@ -18,4 +18,6 @@ public interface CmHeheCollageProductDao extends CrudDao<CmHeheCollageProduct> {
     void updateStatus(@Param("id") Integer id,@Param("status") Integer status);
 
     Integer getProductId(Integer heheProductId);
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
 }

+ 5 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheCouponDao.java

@@ -7,6 +7,7 @@ import com.caimei.modules.user.entity.CmUser;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.CmHeheCoupon;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -45,4 +46,8 @@ public interface CmHeheCouponDao extends CrudDao<CmHeheCoupon> {
     List<CmHeheCoupon> receiveCouponList(CmHeheCoupon cmHeheCoupon);
 
     void deleteCoupon(String cmHeheCoupon);
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
+
+    List<Integer> findAllProductIds();
 }

+ 4 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -53,6 +53,10 @@ public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
 
     void addFloorProduct(@Param("productId") String productId, @Param("floorId") String floorId);
 
+    void updateProductId(@Param("oldProductId") Integer oldProductId, @Param("newProductId") Integer newProductId);
+
+    Integer getNewProductId(Integer oldProductId);
+
     List<Integer> findHeHeFloorProductIds();
 
     List<Product> findAllHeheProduct(Product product);

+ 9 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java

@@ -27,6 +27,7 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
     private String costType;        // 成本价类型:1固定成本 2比例成本
     private BigDecimal costPrice;        // 成本价
     private BigDecimal costProportional;        // 比例成本百分比
+    private Integer oldProductId;   //旧商品id
     private Date addTime;        // 添加时间
     private String name;         //商品名称
     private String mainImage;       //商品图片
@@ -187,6 +188,14 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
         this.floorIds = floorIds;
     }
 
+    public Integer getOldProductId() {
+        return oldProductId;
+    }
+
+    public void setOldProductId(Integer oldProductId) {
+        this.oldProductId = oldProductId;
+    }
+
     public Integer getBigTypeId() {
         return bigTypeId;
     }

+ 1 - 1
src/main/java/com/caimei/modules/hehe/service/CmHeheCollageService.java

@@ -69,7 +69,7 @@ public class CmHeheCollageService extends CrudService<CmHeheCollageDao, CmHeheCo
 		// 已支付订单手机号
 		List<String> mobileList = cmHeheCollageDao.getMobilesByCollageId(collageId);
 		// 拼团成功短信推送
-		mobileList.forEach(mobile-> SMSUtils.sendSms(mobile, "您的商品已拼团成功,请赶紧登录呵呵商城小程序查看订单吧。"));
+		mobileList.forEach(mobile-> SMSUtils.sendSms(mobile, "您的商品已拼团成功,请赶紧登录颜选美学小程序查看订单吧。"));
 		// 关闭其它未支付拼团订单
 		List<Integer> orderIdList = cmHeheCollageDao.findNoPayCollageOrderIds(collageId);
 		orderIdList.forEach(noPayOrderId->{

+ 17 - 0
src/main/java/com/caimei/modules/newhome/dao/AnnouncementDao.java

@@ -0,0 +1,17 @@
+package com.caimei.modules.newhome.dao;
+
+import com.caimei.modules.newhome.entity.Announcementmanagement;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+@MyBatisDao
+public interface AnnouncementDao extends CrudDao<Announcementmanagement> {
+    Announcementmanagement announlist(Announcementmanagement announcementmanagement);
+
+    int online(Announcementmanagement announcementmanagement);
+
+    int line(Announcementmanagement announcementmanagement);
+
+    int deletes(Announcementmanagement announcementmanagement);
+
+}

+ 77 - 0
src/main/java/com/caimei/modules/newhome/entity/Announcementmanagement.java

@@ -0,0 +1,77 @@
+package com.caimei.modules.newhome.entity;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+
+public class Announcementmanagement extends DataEntity<Announcementmanagement> {
+    private String id;
+    private String title;                      //标题
+    private String capacity;                  //类容
+    private String state;                    //状态1为上线2为下线
+    private Date creationtime;              //创建时间
+    private Date  livetime;                 //上线时间
+    private Date  offlinetime;             //下线时间
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getCapacity() {
+        return capacity;
+    }
+
+    public void setCapacity(String capacity) {
+        this.capacity = capacity;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getCreationtime() {
+        return creationtime;
+    }
+
+    public void setCreationtime(Date creationtime) {
+        this.creationtime = creationtime;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getLivetime() {
+        return livetime;
+    }
+
+    public void setLivetime(Date livetime) {
+        this.livetime = livetime;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getOfflinetime() {
+        return offlinetime;
+    }
+
+    public void setOfflinetime(Date offlinetime) {
+        this.offlinetime = offlinetime;
+    }
+}

+ 58 - 0
src/main/java/com/caimei/modules/newhome/service/AnnouncementService.java

@@ -0,0 +1,58 @@
+package com.caimei.modules.newhome.service;
+
+import com.caimei.modules.newhome.dao.AnnouncementDao;
+import com.caimei.modules.newhome.entity.Announcementmanagement;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class AnnouncementService extends CrudService<AnnouncementDao, Announcementmanagement> {
+
+    @Autowired
+    AnnouncementDao announcementDao;
+
+    @Transactional(readOnly = false)
+    public List<Announcementmanagement> findList(Announcementmanagement announcementmanagement) {
+        return announcementDao.findList(announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public Page<Announcementmanagement> findPage(Page<Announcementmanagement> page, Announcementmanagement announcementmanagement) {
+        return super.findPage(page, announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public int insert(Announcementmanagement announcementmanagement) {
+        return announcementDao.insert(announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public Announcementmanagement announlist(Announcementmanagement announcementmanagement){
+        return announcementDao.announlist(announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public int update(Announcementmanagement announcementmanagement) {
+        return announcementDao.update(announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public int online(Announcementmanagement announcementmanagement) {
+        return announcementDao.online(announcementmanagement);
+    }
+
+    @Transactional(readOnly = false)
+    public int line(Announcementmanagement announcementmanagement) {
+        return announcementDao.line(announcementmanagement);
+    }
+    @Transactional(readOnly = false)
+    public int deteles(Announcementmanagement announcementmanagement) {
+        return announcementDao.deletes(announcementmanagement);
+    }
+}

+ 101 - 0
src/main/java/com/caimei/modules/newhome/web/AnnouncementController.java

@@ -0,0 +1,101 @@
+package com.caimei.modules.newhome.web;
+
+import com.caimei.modules.newhome.entity.Announcementmanagement;
+import com.caimei.modules.newhome.service.AnnouncementService;
+import com.caimei.modules.user.entity.ClubTemporary;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.swing.*;
+import java.io.PrintWriter;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+@Controller
+@RequestMapping(value = "${adminPath}/newhome/Announcement")
+public class AnnouncementController extends BaseController {
+
+    @Autowired
+    AnnouncementService announcementService;
+
+
+    @RequestMapping(value = {""})
+    public String list(Announcementmanagement announcementmanagement, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<Announcementmanagement> page = announcementService.findPage(new Page<Announcementmanagement>(request, response), announcementmanagement);
+        model.addAttribute("page", page);
+        return "modules/newhome/announcementList";
+    }
+
+
+    @RequestMapping(value = "form")
+    public String form(Announcementmanagement announcementmanagement, Model model) {
+        if (!announcementmanagement.getId().equals(null) || !announcementmanagement.getId().equals("")) {
+            announcementmanagement = announcementService.announlist(announcementmanagement);
+            announcementmanagement.getId();
+            model.addAttribute("Announcementmanagement", announcementmanagement);
+        }
+        return "modules/newhome/announcementForm";
+    }
+
+
+    @RequestMapping(value = "forms")
+    public String forms(Announcementmanagement announcementmanagement, Model model) {
+
+        return "modules/newhome/announcementForm";
+    }
+
+
+
+    @RequestMapping(value = "save")
+    public String save(Announcementmanagement announcementmanagement, Model model) {
+        System.out.println("*************用户id"+announcementmanagement.getId());
+        if (!"".equals(announcementmanagement.getId()) ) {
+            announcementService.update(announcementmanagement);
+        } else {
+            Date date = new Date();
+            announcementmanagement.setCreationtime(date);
+            announcementmanagement.setLivetime(date);
+            announcementmanagement.setState("1");
+            int i = announcementService.insert(announcementmanagement);
+        }
+        return "redirect:" + Global.getAdminPath() + "/newhome/Announcement/";
+    }
+
+
+    @RequestMapping(value = "line")
+    public String line(Announcementmanagement announcementmanagement, Model model, HttpServletRequest request, HttpServletResponse response) {
+            Date date = new Date();
+            announcementmanagement.setOfflinetime(date);
+            announcementmanagement.setState("2");
+            announcementService.line(announcementmanagement);
+        return "redirect:" + Global.getAdminPath() + "/newhome/Announcement/";
+    }
+
+
+    @RequestMapping(value = "online")
+    public String online(Announcementmanagement announcementmanagement, Model model) {
+            Date date = new Date();
+            announcementmanagement.setLivetime(date);
+            announcementmanagement.setState("1");
+            announcementService.online(announcementmanagement);
+        return "redirect:" + Global.getAdminPath() + "/newhome/Announcement/";
+    }
+
+
+    @RequestMapping(value = "detele")
+    public String detele(Announcementmanagement announcementmanagement, Model model) {
+            announcementService.deteles(announcementmanagement);
+        return "redirect:" + Global.getAdminPath() + "/newhome/Announcement/";
+    }
+
+}

+ 2 - 12
src/main/java/com/caimei/modules/order/dao/CmDiscernReceiptDao.java

@@ -96,17 +96,7 @@ public interface CmDiscernReceiptDao extends CrudDao<CmDiscernReceipt> {
 
     List<CmMainReceiptExport> secondReceipt(CmDiscernReceipt cmDiscernReceipt);
 
-    Double findUserMoney(String orderID);
-
-    Double findOnlineMoney(String orderID);
-
-    Double findRefundOnlineMoney(String orderID);
-
-    String findType(String id);
-
-    Double findRefundUserMoney(String orderID);
-
-    Double findOnlinePay(Integer orderID);
-
     ReceipCouponInfoVo getCouponInfo(String receiptID);
+
+    List<NewShopOrder> getShopOrderInfos(@Param("shopOrderId") String shopOrderId,@Param("orderId") String orderId);
 }

+ 5 - 8
src/main/java/com/caimei/modules/order/dao/CmReceiptOrderRelationDao.java

@@ -1,12 +1,11 @@
 package com.caimei.modules.order.dao;
 
-import com.caimei.modules.order.entity.CmOnlineRefundVo;
+import com.caimei.modules.order.entity.OnlineRefundVo;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.order.entity.CmReceiptOrderRelation;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -34,13 +33,11 @@ public interface CmReceiptOrderRelationDao extends CrudDao<CmReceiptOrderRelatio
 
     Date findOnlinePayment(Integer orderID);
 
-    Double findOnlineMoneyPay(Integer orderId);
+    String findPayType(Integer orderId);
 
-    List<String> findMborderId(Integer userId);
+    String findUserId(Integer orderId);
 
-    Integer findUserId(Integer orderId);
+    void insertOnlineRefund(OnlineRefundVo onlineRefundVo);
 
-    Double findMoney(String mbOrderId);
-
-    void insertOnlineRefund(CmOnlineRefundVo cmOnlineRefundVo);
+    List<CmReceiptOrderRelation> findByShopOrderIds(@Param("shopOrderIds")List<Integer> shopOrderIds);
 }

+ 3 - 1
src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java

@@ -27,5 +27,7 @@ public interface CmReturnedPurchaseDao extends CrudDao<CmReturnedPurchase> {
 
     Double refundTotalMoney(Integer orderID);
 
-    String findPayType(Integer orderID);
+    List<Integer> findReturnedShopOrder(Integer orderID);
+
+    String findSplitCode(Integer shopOrderId);
 }

+ 46 - 3
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -2,15 +2,14 @@ package com.caimei.modules.order.dao;
 
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
-import com.caimei.modules.order.entity.CmFile;
-import com.caimei.modules.order.entity.NewOrder;
-import com.caimei.modules.order.entity.NewOrderProduct;
+import com.caimei.modules.order.entity.*;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.user.entity.NewCmSp;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Set;
 
@@ -197,4 +196,48 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
      * @param id
      */
     void deleteCouponOrderRecord(Integer id);
+
+    List<OrderReceiptRelationPo> getUndividedPaidReceipt(String currentTime);
+
+    List<OrderReceiptRelationPo> getOnlineBalance(String currentTime);
+
+    List<OrderProductVo> getOrderProductByOrderId(Integer orderId);
+
+    Double getOrderProductPaidAmount(Integer orderProductId);
+
+    ShopOrderVo getShopOrderListByOrderId(Integer shopOrderId);
+
+    List<ShopOrderVo> getShopOrderByOrderId(Integer orderId);
+
+    Double getPaidShipping(Integer orderId, Integer shopId);
+
+    String getShopCommercialCode(Integer shopId);
+
+    OrderVo getOrderByOrderId(Integer orderId);
+
+    void insertSplitAccount(SplitAccountPo splitAccount);
+
+    Date findSplitTime();
+
+    void updateOnlinePayFlag(@Param("onlinePayFlag") Integer onlinePayFlag,@Param("orderId") Integer orderId);
+
+    Integer findSupport(Integer shopOrderId);
+
+    List<OrderProductVo> getOrderProductByShopOrderId(Integer shopOrderId);
+
+    List<SplitAccountPo> getSplitAccountList(String mbOrderId);
+
+    Double getPaidShopAmount(Integer shopOrderId);
+
+    void updateShopOrderByPayStatus(@Param("shopOrderId")Integer shopOrderId,@Param("paidShop") Double paidShop,@Param("payStatus") Integer payStatus);
+
+    void insertPayShop(PayShopPo payShop);
+
+    void insertPayShopRecord(PayShopRecordPo shopRecord);
+
+    void updateOrderByPayStatus(@Param("orderId")Integer orderId, @Param("payStatus")Integer payStatus);
+
+    void updateBySplitStatus(String mbOrderId);
+
+    Integer findOnlinePay(Integer orderID);
 }

+ 9 - 0
src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.dao;
 
+import com.caimei.modules.order.entity.CmPayShop;
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
@@ -16,12 +17,18 @@ import java.util.List;
 @MyBatisDao
 public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
+    List<String> getProductOrder(Integer orderid);
+
+    List<String> getOpenidListByPermission(@Param("unionid") String unionid);
+
     int deleteByOrderID(@Param("orderID") Integer orderID);
 
     NewShopOrder findByShopOrderID(@Param("shopOrderID") Integer shopOrderID);
 
     List<NewShopOrder> findListByOrderID(@Param("orderID") Integer orderID);
 
+    String FromUnionId(Integer orderId);
+
     int updateByShopOrderNo(NewShopOrder newShopOrder);
 
     int updateStatusByOrderID(@Param("orderID") Integer orderID, @Param("status") Integer status);
@@ -73,4 +80,6 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
     List<String> findShopOrderNos(Integer orderID);
 
     Double findIncome(Integer orderID);
+
+    List<NewShopOrder> findSplitList(NewShopOrder shopOrder);
 }

+ 197 - 0
src/main/java/com/caimei/modules/order/entity/AccountPayOrder.java

@@ -0,0 +1,197 @@
+package com.caimei.modules.order.entity;
+
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+public class AccountPayOrder {
+
+    private String P1_bizType;
+    private String P2_signType;
+    private String P3_timestamp;
+    private String P4_orderId;
+    private String P5_customerNumber;
+    private String P6_ext;
+
+    public String getP1_bizType() {
+        return P1_bizType;
+    }
+
+    public void setP1_bizType(String p1_bizType) {
+        P1_bizType = p1_bizType;
+    }
+
+    public String getP2_signType() {
+        return P2_signType;
+    }
+
+    public void setP2_signType(String p2_signType) {
+        P2_signType = p2_signType;
+    }
+
+    public String getP3_timestamp() {
+        return P3_timestamp;
+    }
+
+    public void setP3_timestamp(String p3_timestamp) {
+        P3_timestamp = p3_timestamp;
+    }
+
+    public String getP4_orderId() {
+        return P4_orderId;
+    }
+
+    public void setP4_orderId(String p4_orderId) {
+        P4_orderId = p4_orderId;
+    }
+
+    public String getP5_customerNumber() {
+        return P5_customerNumber;
+    }
+
+    public void setP5_customerNumber(String p5_customerNumber) {
+        P5_customerNumber = p5_customerNumber;
+    }
+
+
+    public String getP6_ext() {
+        return P6_ext;
+    }
+
+    public void setP6_ext(String p6_ext) {
+        P6_ext = p6_ext;
+    }
+
+    public static class AccountPayOrderExt {
+        // 订单类型
+        private AccountPayOrderType orderType;
+        // 收款商编
+        private String inMerchantNo;
+        // 金额
+        private BigDecimal amount;
+        // 回调地址
+        private String serverCallbackUrl;
+        // 商品名称
+        private String goodsName;
+        // 商品描述(可选)
+        private String orderDesc;
+        /**
+         * 以下两项在补贴场景下必填
+         **/
+        private ProductType productType;
+        // 原收单订单号
+        private String associatedOrderNo;
+        // 分账规则串 - 仅支持资金划拨类订单
+        private List<SplitBillRule> splitBillRules;
+        // 是否为担保交易
+        private boolean inEscrow = false;
+
+
+        public AccountPayOrderType getOrderType() {
+            return orderType;
+        }
+
+        public void setOrderType(AccountPayOrderType orderType) {
+            this.orderType = orderType;
+        }
+
+        public BigDecimal getAmount() {
+            return amount;
+        }
+
+        public void setAmount(BigDecimal amount) {
+            this.amount = amount;
+        }
+
+        public String getServerCallbackUrl() {
+            return serverCallbackUrl;
+        }
+
+        public void setServerCallbackUrl(String serverCallbackUrl) {
+            this.serverCallbackUrl = StringUtils.isEmpty(serverCallbackUrl) ? null : serverCallbackUrl;
+        }
+
+        public String getGoodsName() {
+            return goodsName;
+        }
+
+        public void setGoodsName(String goodsName) {
+            this.goodsName = goodsName;
+        }
+
+        public String getOrderDesc() {
+            return orderDesc;
+        }
+
+        public void setOrderDesc(String orderDesc) {
+            this.orderDesc = orderDesc;
+        }
+
+        public ProductType getProductType() {
+            return productType;
+        }
+
+        public void setProductType(ProductType productType) {
+            this.productType = productType;
+        }
+
+        public String getAssociatedOrderNo() {
+            return associatedOrderNo;
+        }
+
+        public void setAssociatedOrderNo(String associatedOrderNo) {
+            this.associatedOrderNo = associatedOrderNo;
+        }
+
+        public String getInMerchantNo() {
+            return inMerchantNo;
+        }
+
+        public void setInMerchantNo(String inMerchantNo) {
+            this.inMerchantNo = inMerchantNo;
+        }
+
+        public List<SplitBillRule> getSplitBillRules() {
+            return splitBillRules;
+        }
+
+        public void setSplitBillRules(List<SplitBillRule> splitBillRules) {
+            this.splitBillRules = splitBillRules;
+        }
+
+        public boolean isInEscrow() {
+            return inEscrow;
+        }
+
+        public void setInEscrow(boolean inEscrow) {
+            this.inEscrow = inEscrow;
+        }
+
+        public static class SplitBillRule {
+            private String splitBillMerchantNo; // 收账商编
+            private BigDecimal splitBillAmount; // 分账金额
+
+            public String getSplitBillMerchantNo() {
+                return splitBillMerchantNo;
+            }
+
+            public void setSplitBillMerchantNo(String splitBillMerchantNo) {
+                this.splitBillMerchantNo = splitBillMerchantNo;
+            }
+
+            public BigDecimal getSplitBillAmount() {
+                return splitBillAmount;
+            }
+
+            public void setSplitBillAmount(BigDecimal splitBillAmount) {
+                this.splitBillAmount = splitBillAmount;
+            }
+        }
+
+
+    }
+
+}

+ 28 - 0
src/main/java/com/caimei/modules/order/entity/AccountPayOrderType.java

@@ -0,0 +1,28 @@
+package com.caimei.modules.order.entity;
+
+public enum AccountPayOrderType {
+
+    ALLOWANCE("活动补贴", 1),
+
+    TRANSFER("资金划拨", 2),
+
+
+    ;
+
+    private final String desc;
+    private final Integer index;
+
+
+    AccountPayOrderType(String desc, Integer index) {
+        this.desc = desc;
+        this.index = index;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public Integer getIndex() {
+        return index;
+    }
+}

+ 125 - 0
src/main/java/com/caimei/modules/order/entity/AppPayRefundOrderResponseVo.java

@@ -0,0 +1,125 @@
+package com.caimei.modules.order.entity;
+
+import com.google.common.collect.ImmutableSet;
+
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class AppPayRefundOrderResponseVo implements Serializable {
+
+
+    private String rt1_bizType;
+    private String rt2_retCode;
+    private String rt3_retMsg;
+    private String rt4_customerNumber;
+    private String rt5_orderId;
+    private String rt6_refundOrderNum;
+    private String rt7_serialNumber;
+    private String rt8_amount;
+    private String rt9_currency;
+    private String sign;
+
+    /**
+     * 需要加签的属性参数,要求加签的参数空值也签名
+     * 看接口文档
+     */
+    public static final Set<String> NEED_SIGN_PARAMS = ImmutableSet.of("rt1_bizType", "rt2_retCode", "rt4_customerNumber",
+            "rt5_orderId", "rt6_refundOrderNum", "rt7_serialNumber", "rt8_amount", "rt9_currency");
+
+    public AppPayRefundOrderResponseVo() {
+    }
+
+    public AppPayRefundOrderResponseVo(String rt1_bizType, String rt2_retCode, String rt3_retMsg, String rt4_customerNumber, String rt5_orderId, String rt6_refundOrderNum, String rt7_serialNumber, String rt8_amount, String rt9_currency, String sign) {
+        this.rt1_bizType = rt1_bizType;
+        this.rt2_retCode = rt2_retCode;
+        this.rt3_retMsg = rt3_retMsg;
+        this.rt4_customerNumber = rt4_customerNumber;
+        this.rt5_orderId = rt5_orderId;
+        this.rt6_refundOrderNum = rt6_refundOrderNum;
+        this.rt7_serialNumber = rt7_serialNumber;
+        this.rt8_amount = rt8_amount;
+        this.rt9_currency = rt9_currency;
+        this.sign = sign;
+    }
+
+    public String getRt1_bizType() {
+        return rt1_bizType;
+    }
+
+    public void setRt1_bizType(String rt1_bizType) {
+        this.rt1_bizType = rt1_bizType;
+    }
+
+    public String getRt2_retCode() {
+        return rt2_retCode;
+    }
+
+    public void setRt2_retCode(String rt2_retCode) {
+        this.rt2_retCode = rt2_retCode;
+    }
+
+    public String getRt3_retMsg() {
+        return rt3_retMsg;
+    }
+
+    public void setRt3_retMsg(String rt3_retMsg) {
+        this.rt3_retMsg = rt3_retMsg;
+    }
+
+    public String getRt4_customerNumber() {
+        return rt4_customerNumber;
+    }
+
+    public void setRt4_customerNumber(String rt4_customerNumber) {
+        this.rt4_customerNumber = rt4_customerNumber;
+    }
+
+    public String getRt5_orderId() {
+        return rt5_orderId;
+    }
+
+    public void setRt5_orderId(String rt5_orderId) {
+        this.rt5_orderId = rt5_orderId;
+    }
+
+    public String getRt6_refundOrderNum() {
+        return rt6_refundOrderNum;
+    }
+
+    public void setRt6_refundOrderNum(String rt6_refundOrderNum) {
+        this.rt6_refundOrderNum = rt6_refundOrderNum;
+    }
+
+    public String getRt7_serialNumber() {
+        return rt7_serialNumber;
+    }
+
+    public void setRt7_serialNumber(String rt7_serialNumber) {
+        this.rt7_serialNumber = rt7_serialNumber;
+    }
+
+    public String getRt8_amount() {
+        return rt8_amount;
+    }
+
+    public void setRt8_amount(String rt8_amount) {
+        this.rt8_amount = rt8_amount;
+    }
+
+    public String getRt9_currency() {
+        return rt9_currency;
+    }
+
+    public void setRt9_currency(String rt9_currency) {
+        this.rt9_currency = rt9_currency;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 109 - 0
src/main/java/com/caimei/modules/order/entity/AppPayRefundOrderVo.java

@@ -0,0 +1,109 @@
+package com.caimei.modules.order.entity;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class AppPayRefundOrderVo implements Serializable {
+
+
+    private String P1_bizType;
+    private String P2_orderId;
+    private String P3_customerNumber;
+    private String P4_refundOrderId;
+    private String P5_amount;
+    private String P6_callbackUrl;
+    private String P7_desc;
+    private String P8_orderSerialNumber;
+    /**排除签名*/
+    private String acqAddnData;
+    private String sign;
+
+    /**
+     * 需要加签的属性参数,要求加签的参数空值也签名
+     * 看接口文档
+     */
+    public static final Set<String> NEED_SIGN_PARAMS = ImmutableSet.of("P1_bizType", "P2_orderId",
+            "P3_customerNumber", "P4_refundOrderId", "P5_amount", "P6_callbackUrl");
+
+    public String getP1_bizType() {
+        return P1_bizType;
+    }
+
+    public void setP1_bizType(String p1_bizType) {
+        P1_bizType = p1_bizType;
+    }
+
+    public String getP2_orderId() {
+        return P2_orderId;
+    }
+
+    public void setP2_orderId(String p2_orderId) {
+        P2_orderId = p2_orderId;
+    }
+
+    public String getP3_customerNumber() {
+        return P3_customerNumber;
+    }
+
+    public void setP3_customerNumber(String p3_customerNumber) {
+        P3_customerNumber = p3_customerNumber;
+    }
+
+    public String getP4_refundOrderId() {
+        return P4_refundOrderId;
+    }
+
+    public void setP4_refundOrderId(String p4_refundOrderId) {
+        P4_refundOrderId = p4_refundOrderId;
+    }
+
+    public String getP5_amount() {
+        return P5_amount;
+    }
+
+    public void setP5_amount(String p5_amount) {
+        P5_amount = p5_amount;
+    }
+
+    public String getP6_callbackUrl() {
+        return P6_callbackUrl;
+    }
+
+    public void setP6_callbackUrl(String p6_callbackUrl) {
+        P6_callbackUrl = p6_callbackUrl;
+    }
+
+    public String getP7_desc() {
+        return P7_desc;
+    }
+
+    public void setP7_desc(String p7_desc) {
+        P7_desc = p7_desc;
+    }
+
+    public String getP8_orderSerialNumber() {
+        return P8_orderSerialNumber;
+    }
+
+    public void setP8_orderSerialNumber(String p8_orderSerialNumber) {
+        P8_orderSerialNumber = p8_orderSerialNumber;
+    }
+
+    public String getAcqAddnData() {
+        return acqAddnData;
+    }
+
+    public void setAcqAddnData(String acqAddnData) {
+        this.acqAddnData = acqAddnData;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 426 - 0
src/main/java/com/caimei/modules/order/entity/CartItemVo.java

@@ -0,0 +1,426 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 购物车商品列表
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+public class CartItemVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 购物车Id
+     */
+    private Integer id;
+    /**
+     * 购买数量
+     */
+    private Integer number;
+    /**
+     * 购物商品效状态:0有效,1后台删除的,2冻结的,3下架,4售罄 >7库存不足,5价格仅会员可见,6未公开价格, 8价格仅医美机构可见
+     */
+    private Integer status;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 主图
+     */
+    private String image;
+    /**
+     * 商品Code
+     */
+    private String productCode;
+    /**
+     * 价格
+     */
+    private Double price;
+    /**
+     * 划线价
+     */
+    private Double originalPrice;
+    /**
+     * 单位/规格
+     */
+    private String unit;
+    /**
+     * 库存
+     */
+    private Integer stock;
+    /**
+     * 起订量
+     */
+    private Integer min;
+    /**
+     * 增量
+     */
+    private Integer step;
+    /**
+     * 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
+     */
+    private Integer priceFlag;
+    /**
+     * 启用阶梯价格标识:1是,0否
+     */
+    private Integer ladderFlag;
+    /**
+     * 是否含税 0不含税,1含税,2未知
+     */
+    private Integer includedTax;
+    /**
+     * 机构税率
+     */
+    private Double taxRate;
+    /**
+     * 发票类型(基于是否含税基础) 1增值税票,2普通票, 3不能开票
+     */
+    private Integer invoiceType;
+    /**
+     * 是否是赠品 2是,其他否
+     */
+    private Integer productType;
+    /**
+     * 商品是否处于活动状态 1是 0否
+     */
+    private Integer actStatus;
+    /**
+     * 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+     */
+    private Integer visibility;
+    /**
+     * 商品上架状态:0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
+     */
+    private Integer validFlag;
+    /**
+     * 商品的类别:1正常商品(默认),2二手商品
+     */
+    private Integer productCategory;
+    /**
+     * 商品促销活动
+     */
+    private PromotionsVo promotions;
+    /**
+     * 阶梯价列表
+     */
+    private List<LadderPriceVo> ladderPrices;
+    /**
+     * 前端商品勾选状态
+     */
+    private Boolean isChecked;
+    /**
+     * 商品属性:1产品,2仪器
+     */
+    private Integer commodityType;
+    /**
+     * 超级会员优惠商品标识:0不是,1是
+     */
+    private Integer svipProductFlag;
+    /**
+     * 超级会员优惠价类型:1折扣价,2直接优惠价
+     */
+    private Integer svipPriceType;
+    /**
+     * 超级会员折扣
+     */
+    private Double svipDiscount;
+    /**
+     * 超级会员优惠价
+     */
+    private Double svipDiscountPrice;
+    /**
+     * 超级会员价格标签
+     */
+    private String svipPriceTag;
+    /**
+     * 购物车该商品总优惠金额
+     */
+    private Double svipTotalReducedPrice;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public String getProductCode() {
+        return productCode;
+    }
+
+    public void setProductCode(String productCode) {
+        this.productCode = productCode;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public Double getOriginalPrice() {
+        return originalPrice;
+    }
+
+    public void setOriginalPrice(Double originalPrice) {
+        this.originalPrice = originalPrice;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public Integer getStock() {
+        return stock;
+    }
+
+    public void setStock(Integer stock) {
+        this.stock = stock;
+    }
+
+    public Integer getMin() {
+        return min;
+    }
+
+    public void setMin(Integer min) {
+        this.min = min;
+    }
+
+    public Integer getStep() {
+        return step;
+    }
+
+    public void setStep(Integer step) {
+        this.step = step;
+    }
+
+    public Integer getPriceFlag() {
+        return priceFlag;
+    }
+
+    public void setPriceFlag(Integer priceFlag) {
+        this.priceFlag = priceFlag;
+    }
+
+    public Integer getLadderFlag() {
+        return ladderFlag;
+    }
+
+    public void setLadderFlag(Integer ladderFlag) {
+        this.ladderFlag = ladderFlag;
+    }
+
+    public Integer getIncludedTax() {
+        return includedTax;
+    }
+
+    public void setIncludedTax(Integer includedTax) {
+        this.includedTax = includedTax;
+    }
+
+    public Double getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(Double taxRate) {
+        this.taxRate = taxRate;
+    }
+
+    public Integer getInvoiceType() {
+        return invoiceType;
+    }
+
+    public void setInvoiceType(Integer invoiceType) {
+        this.invoiceType = invoiceType;
+    }
+
+    public Integer getProductType() {
+        return productType;
+    }
+
+    public void setProductType(Integer productType) {
+        this.productType = productType;
+    }
+
+    public Integer getActStatus() {
+        return actStatus;
+    }
+
+    public void setActStatus(Integer actStatus) {
+        this.actStatus = actStatus;
+    }
+
+    public Integer getVisibility() {
+        return visibility;
+    }
+
+    public void setVisibility(Integer visibility) {
+        this.visibility = visibility;
+    }
+
+    public Integer getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(Integer validFlag) {
+        this.validFlag = validFlag;
+    }
+
+    public Integer getProductCategory() {
+        return productCategory;
+    }
+
+    public void setProductCategory(Integer productCategory) {
+        this.productCategory = productCategory;
+    }
+
+    public PromotionsVo getPromotions() {
+        return promotions;
+    }
+
+    public void setPromotions(PromotionsVo promotions) {
+        this.promotions = promotions;
+    }
+
+    public List<LadderPriceVo> getLadderPrices() {
+        return ladderPrices;
+    }
+
+    public void setLadderPrices(List<LadderPriceVo> ladderPrices) {
+        this.ladderPrices = ladderPrices;
+    }
+
+    public Boolean getChecked() {
+        return isChecked;
+    }
+
+    public void setChecked(Boolean checked) {
+        isChecked = checked;
+    }
+
+    public Integer getCommodityType() {
+        return commodityType;
+    }
+
+    public void setCommodityType(Integer commodityType) {
+        this.commodityType = commodityType;
+    }
+
+    public Integer getSvipProductFlag() {
+        return svipProductFlag;
+    }
+
+    public void setSvipProductFlag(Integer svipProductFlag) {
+        this.svipProductFlag = svipProductFlag;
+    }
+
+    public Integer getSvipPriceType() {
+        return svipPriceType;
+    }
+
+    public void setSvipPriceType(Integer svipPriceType) {
+        this.svipPriceType = svipPriceType;
+    }
+
+    public Double getSvipDiscount() {
+        return svipDiscount;
+    }
+
+    public void setSvipDiscount(Double svipDiscount) {
+        this.svipDiscount = svipDiscount;
+    }
+
+    public Double getSvipDiscountPrice() {
+        return svipDiscountPrice;
+    }
+
+    public void setSvipDiscountPrice(Double svipDiscountPrice) {
+        this.svipDiscountPrice = svipDiscountPrice;
+    }
+
+    public String getSvipPriceTag() {
+        return svipPriceTag;
+    }
+
+    public void setSvipPriceTag(String svipPriceTag) {
+        this.svipPriceTag = svipPriceTag;
+    }
+
+    public Double getSvipTotalReducedPrice() {
+        return svipTotalReducedPrice;
+    }
+
+    public void setSvipTotalReducedPrice(Double svipTotalReducedPrice) {
+        this.svipTotalReducedPrice = svipTotalReducedPrice;
+    }
+}

+ 0 - 61
src/main/java/com/caimei/modules/order/entity/CmOnlineRefundVo.java

@@ -1,61 +0,0 @@
-package com.caimei.modules.order.entity;
-
-import com.thinkgem.jeesite.common.persistence.DataEntity;
-
-public class CmOnlineRefundVo extends DataEntity<CmOnlineRefundVo> {
-    private static final long serialVersionUID = 1L;
-    private Integer userId;
-    private String mborderId;
-    private String orderRequestNo;
-    private String orderId;
-    private String amount;
-    private String refundType;//退款方式 1线上支付原路退回 ,2线上余额退现金
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public String getMborderId() {
-        return mborderId;
-    }
-
-    public void setMborderId(String mborderId) {
-        this.mborderId = mborderId;
-    }
-
-    public String getOrderRequestNo() {
-        return orderRequestNo;
-    }
-
-    public void setOrderRequestNo(String orderRequestNo) {
-        this.orderRequestNo = orderRequestNo;
-    }
-
-    public String getOrderId() {
-        return orderId;
-    }
-
-    public void setOrderId(String orderId) {
-        this.orderId = orderId;
-    }
-
-    public String getAmount() {
-        return amount;
-    }
-
-    public void setAmount(String amount) {
-        this.amount = amount;
-    }
-
-    public String getRefundType() {
-        return refundType;
-    }
-
-    public void setRefundType(String refundType) {
-        this.refundType = refundType;
-    }
-}

+ 12 - 0
src/main/java/com/caimei/modules/order/entity/CmReceiptOrderRelation.java

@@ -27,6 +27,10 @@ public class CmReceiptOrderRelation extends DataEntity<CmReceiptOrderRelation> {
      * 抹平备注(目前适用后台直接抹平账户操作)
      */
     private String balanceAccountsRemark;
+    /**
+     * 子订单Id
+     */
+    private Integer shopOrderId;
 
     /**
      * 米花科技平台唯一流水号
@@ -75,6 +79,14 @@ public class CmReceiptOrderRelation extends DataEntity<CmReceiptOrderRelation> {
         this.balanceAccountsRemark = balanceAccountsRemark;
     }
 
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
     public CmReceiptOrderRelation() {
         super();
     }

+ 2 - 12
src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java

@@ -51,7 +51,6 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
 
     private Date beginConfirmReturnTime;
     private Date endConfirmReturnTime;
-
     private List<List<CmReturnedPurchaseProduct>> cmReturnedPurchaseProductList;    //退款退货商品列表(用于前端接收)
     private List<ShopOrderReturned> shopOrderReturnedList;    //退款退货商品列表
     private List<CmReturnedPurchaseProduct> productList;    //退款退货商品列表
@@ -60,8 +59,7 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String bankAccountNo;//开户银行账户
     private String openBank;//开户银行
     private String bankAccountType;//账户类型:1公账,2私账
-    private Double refundBalanceFee;//退账户线下余额
-    private Double refundOnlineBalanceFee;//退账户线上余额
+    private Double refundBalanceFee;//退账户余额
     private Double refundOnlineFee;//退线上退回
     private Double refundOfflineFee;//退线下转账
     private Integer applicationUserID;//申请人ID
@@ -75,14 +73,6 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String beginTime;     //时间开始 查询条件 申请时间
     private String endTime;        //时间结束  查询条件 申请时间
 
-    public Double getRefundOnlineBalanceFee() {
-        return refundOnlineBalanceFee;
-    }
-
-    public void setRefundOnlineBalanceFee(Double refundOnlineBalanceFee) {
-        this.refundOnlineBalanceFee = refundOnlineBalanceFee;
-    }
-
     public String getName() {
         return name;
     }
@@ -490,4 +480,4 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
-}
+}

+ 53 - 0
src/main/java/com/caimei/modules/order/entity/Constant.java

@@ -0,0 +1,53 @@
+package com.caimei.modules.order.entity;
+
+
+/**
+ * 常量类
+ *
+ * @author Administrator
+ */
+public class Constant {
+
+    public static final String prodSplit = "https://core.caimei365.com/order/pay/delay/split/callback";
+
+    public static final String betaSplit = "https://core-b.caimei365.com/order/pay/delay/split/callback";
+
+    //专票 信息 测试佣金暂入信息  308785626@qq.com vip/二手暂入信息
+    public static final String CUSTOMERNUM = "E1807059160";
+    //信息的邮箱
+    public static final String XX_MAIL = "308785626@qq.com";
+
+    //收款商编 网络   xun.zhang@caimei365.com
+    public static final String CUSTOMERNUM2 = "E1807062884";
+    //网络的邮箱
+    public static final String WL_MAIL = "xun.zhang@caimei365.com";
+
+    //普票 奥泰 测试私账暂进奥泰   caimei365@yeah.net
+    public static final String CUSTOMERNUM3 = "E1807085606";
+
+    public static final String AT_MAIL = "caimei365@yeah.net";
+
+    public static final String SPLIT = "&";
+
+    public static final String DOMAIN_NAME = "http://pay.trx.helipay.com/";
+    //网银地址http://pay.trx.helipay.com/trx/online/interface.action
+    public static final String YL = "http://pay.trx.helipay.com/trx/online/interface.action";
+    //分账地址
+    public static final String FZ = "http://pay.trx.helipay.com/trx/accountPay/interface.action";
+
+    //微信/支付宝扫码/小程序公众号支付
+    public static final String SAOMA = "1iHnZaalUNAVcfcbKdh6n86Z0yUHtM6f";
+    //网银
+    public static final String WANGYIN = "CZiCbGrgFYQMldVkQnzbFQeQkn6mp25w";
+    //虚拟账户支付
+    public static final String XUNI = "8VmdRSXMIOfUo7aEq1iYs2XEWgGZpBQc";
+    //分账
+    public static final String FENZHANG = "2hATS0A4IoxdudGxNkGRNOt6aFSdOd8Q";
+    //公共产品
+    public static final String GONG="wrED4jYgKLQVsEwtgZ2eQmXrRgo7VHy4";
+    /**
+     * 扫码接口地址
+     */
+    public static final String REQUEST_URL = DOMAIN_NAME + "trx/app/interface.action";
+
+}

+ 124 - 0
src/main/java/com/caimei/modules/order/entity/LadderPriceVo.java

@@ -0,0 +1,124 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/28
+ */
+public class LadderPriceVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 第几阶梯
+     */
+    private Integer ladderNum;
+    /**
+     * 购买数量
+     */
+    private Integer buyNum;
+    /**
+     * 购买价格
+     */
+    private Double buyPrice;
+    /**
+     * 下一阶数量
+     */
+    private Integer maxNum;
+    /**
+     * 显示数量 如:1~3
+     */
+    private String numRange;
+    /**
+     * 订单商品Id(保存订单用)
+     */
+    private Integer orderProductId;
+    /**
+     * 创建时间(保存订单用)
+     */
+    private Date createDate;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getLadderNum() {
+        return ladderNum;
+    }
+
+    public void setLadderNum(Integer ladderNum) {
+        this.ladderNum = ladderNum;
+    }
+
+    public Integer getBuyNum() {
+        return buyNum;
+    }
+
+    public void setBuyNum(Integer buyNum) {
+        this.buyNum = buyNum;
+    }
+
+    public Double getBuyPrice() {
+        return buyPrice;
+    }
+
+    public void setBuyPrice(Double buyPrice) {
+        this.buyPrice = buyPrice;
+    }
+
+    public Integer getMaxNum() {
+        return maxNum;
+    }
+
+    public void setMaxNum(Integer maxNum) {
+        this.maxNum = maxNum;
+    }
+
+    public String getNumRange() {
+        return numRange;
+    }
+
+    public void setNumRange(String numRange) {
+        this.numRange = numRange;
+    }
+
+    public Integer getOrderProductId() {
+        return orderProductId;
+    }
+
+    public void setOrderProductId(Integer orderProductId) {
+        this.orderProductId = orderProductId;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+}

+ 186 - 0
src/main/java/com/caimei/modules/order/entity/LogisticsRecordVo.java

@@ -0,0 +1,186 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/22
+ */
+public class LogisticsRecordVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 发货物流批次Id
+     */
+    private Integer logisticsBatchId;
+    /**
+     * 子订单Id
+     */
+    private Integer shopOrderId;
+    /**
+     * 主订单Id
+     */
+    private Integer orderId;
+    /**
+     * 订单商品Id
+     */
+    private Integer orderProductId;
+    /**
+     * 商品购买数量
+     */
+    private Integer buyNum;
+    /**
+     * 此次发货数量
+     */
+    private Integer num;
+    /**
+     * 包装规格
+     */
+    private String unit;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 商品图片
+     */
+    private String image;
+    /**
+     * 已发货数量
+     */
+    private Integer shipmentsNum;
+    /**
+     * 已退货数量
+     */
+    private Integer returnedNum;
+    /**
+     * 未发货数量
+     */
+    private Integer notShippedNum;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getLogisticsBatchId() {
+        return logisticsBatchId;
+    }
+
+    public void setLogisticsBatchId(Integer logisticsBatchId) {
+        this.logisticsBatchId = logisticsBatchId;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getOrderProductId() {
+        return orderProductId;
+    }
+
+    public void setOrderProductId(Integer orderProductId) {
+        this.orderProductId = orderProductId;
+    }
+
+    public Integer getBuyNum() {
+        return buyNum;
+    }
+
+    public void setBuyNum(Integer buyNum) {
+        this.buyNum = buyNum;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public Integer getShipmentsNum() {
+        return shipmentsNum;
+    }
+
+    public void setShipmentsNum(Integer shipmentsNum) {
+        this.shipmentsNum = shipmentsNum;
+    }
+
+    public Integer getReturnedNum() {
+        return returnedNum;
+    }
+
+    public void setReturnedNum(Integer returnedNum) {
+        this.returnedNum = returnedNum;
+    }
+
+    public Integer getNotShippedNum() {
+        return notShippedNum;
+    }
+
+    public void setNotShippedNum(Integer notShippedNum) {
+        this.notShippedNum = notShippedNum;
+    }
+}

+ 10 - 19
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -54,7 +54,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private String clauseName;          // varchar(50) comment '条款名称',
     private String freePostFlag;        // char(1) comment 免邮标志 运费:-1到付,0包邮,1需要运费
     private Double freight;             // decimal(20,0) comment '运费' v5.0版本已废弃,运费已使用商品形式存储,
-    //    private Integer freePostageTicketID; // bigint(11) comment '包邮券ID',
+    //    private Integer freePostageTicketID; // bigint(11) comment '包邮券ID',newShopOrders
     private Integer buyUserID;//            下单人
     private String orderType;//    订单类型 0协销订单、 1普通订单、 2呵呵订单
     private List<NewShopOrder> newShopOrders;
@@ -70,6 +70,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private String splitFlag; // 订单能否拆分 1 为可拆分, 0为不可拆分
     private String closeReason; //订单取消原因
     private String invoiceFlag;      //是否开发票 0 不开 1 开发票
+    private Double discountAmount;  // 优惠金额:经理折扣+促销优惠+优惠券抵扣金额
     // ---------------- v5.0.0 新加
     private String receiptStatus; //(收款买家)收款状态:1待收款、2部分收款、3已收款
     private String payStatus; //(付款供应商)付款状态:1待付款、2部分付款、3已付款
@@ -136,8 +137,6 @@ public class NewOrder extends DataEntity<NewOrder> {
     private String associationType;//订单关联方式: 1手动 2自动
     private Double ableUserMoney; //当前下单用户可用余额
     private String organizeStoreName;//组织门店名称
-    private Double userMoney;  //当前订单使用线下余额
-    private Double onlineMoney;//当前订单使用线上余额
     /**
      * 优惠券机构关联ID
      */
@@ -157,22 +156,6 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer receiveCouponId;
     private CmHeheCouponOrderRecord heheCouponRecord;   //优惠券信息
 
-    public Double getUserMoney() {
-        return userMoney;
-    }
-
-    public void setUserMoney(Double userMoney) {
-        this.userMoney = userMoney;
-    }
-
-    public Double getOnlineMoney() {
-        return onlineMoney;
-    }
-
-    public void setOnlineMoney(Double onlineMoney) {
-        this.onlineMoney = onlineMoney;
-    }
-
     public Integer getOrderSeen() {
         return orderSeen;
     }
@@ -1149,6 +1132,14 @@ public class NewOrder extends DataEntity<NewOrder> {
         this.reductionTouchPrice = reductionTouchPrice;
     }
 
+    public Double getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(Double discountAmount) {
+        this.discountAmount = discountAmount;
+    }
+
     public List<NewOrderProduct> getNewOrderProducts() {
         return newOrderProducts;
     }

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java

@@ -118,6 +118,7 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private String commodityType;//商品属性:1产品,2仪器
     private Double svipReduction;//超级会员优惠
     private Double svipTaxReduction;//超级会员税费优惠
+    private String splitCode;// 商品分账号
 
     public Integer getLadderPriceFlag() {
         return ladderPriceFlag;
@@ -1007,4 +1008,12 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     public void setSvipTaxReduction(Double svipTaxReduction) {
         this.svipTaxReduction = svipTaxReduction;
     }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
 }

+ 64 - 1
src/main/java/com/caimei/modules/order/entity/NewShopOrder.java

@@ -14,6 +14,7 @@ import java.util.List;
  * @description 子订单表
  */
 public class NewShopOrder extends DataEntity<NewShopOrder> {
+    private Integer onlineFlag;    //是否线上支付过1是,0否
     private Double couponAmount;   //母订单使用优惠券金额
     private Integer shopOrderID;//        int(11) not null auto_increment comment '子订单ID',
     private Integer organizeID;//        组织Id
@@ -44,7 +45,13 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Integer status;//     int(11) comment '订单状态:见表c_orderstatus或枚举OrderStatus'   v5.0版本已废弃只有主订单状态,
     private Integer refundStatus;//    int(11),
     private BigInteger deliveryTimeMills;//   bigint(20) comment '发货时间(时间戳)',
-    private Double needPayAmount;//   decimal(20,2) comment '实付金额',
+    private Double needPayAmount;//   decimal(20,2) comment '实付金额(未减去优惠金额)',
+    private Double realPay;     // 实际支付金额
+    private Double eachDiscount;        // 分摊优惠金额
+    private Double receiptAmount;       // 已付金额
+    private Double restAmount;      // 待付金额
+    private Integer shopReceiptStatus;      // 子订单收款状态:1待收款,2部分收款,3已收款
+    private String splitCode;   // 分账号
     private Double canRefundAmount;//   float comment '退款金额',
     private Double refundAmount;//   float,
     private Integer clubID;//  int(11),
@@ -153,6 +160,14 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
         this.income = income;
     }
 
+    public Integer getOnlineFlag() {
+        return onlineFlag;
+    }
+
+    public void setOnlineFlag(Integer onlineFlag) {
+        this.onlineFlag = onlineFlag;
+    }
+
     public List<String> getShopOrderNos() {
         return shopOrderNos;
     }
@@ -1147,4 +1162,52 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     public void setSvipShopReduction(Double svipShopReduction) {
         this.svipShopReduction = svipShopReduction;
     }
+
+    public Double getRealPay() {
+        return realPay;
+    }
+
+    public void setRealPay(Double realPay) {
+        this.realPay = realPay;
+    }
+
+    public Double getEachDiscount() {
+        return eachDiscount;
+    }
+
+    public void setEachDiscount(Double eachDiscount) {
+        this.eachDiscount = eachDiscount;
+    }
+
+    public Double getReceiptAmount() {
+        return receiptAmount;
+    }
+
+    public void setReceiptAmount(Double receiptAmount) {
+        this.receiptAmount = receiptAmount;
+    }
+
+    public Double getRestAmount() {
+        return restAmount;
+    }
+
+    public void setRestAmount(Double restAmount) {
+        this.restAmount = restAmount;
+    }
+
+    public Integer getShopReceiptStatus() {
+        return shopReceiptStatus;
+    }
+
+    public void setShopReceiptStatus(Integer shopReceiptStatus) {
+        this.shopReceiptStatus = shopReceiptStatus;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
 }

+ 95 - 0
src/main/java/com/caimei/modules/order/entity/OnlineRefundData.java

@@ -0,0 +1,95 @@
+package com.caimei.modules.order.entity;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class OnlineRefundData  implements Serializable {
+    private String rt1_bizType;
+    private String rt2_retCode;
+    private String rt3_retMsg;
+    private String rt4_customerNumber;
+    private String rt5_orderId;
+    private String rt6_refundOrderId;
+    private String rt7_amount;
+    private String rt8_orderStatus;
+    private String sign;
+    public static final Set<String> NEED_SIGN_PARAMS = ImmutableSet.of("rt1_bizType", "rt2_retCode","rt3_retMsg", "rt4_customerNumber",
+            "rt5_orderId", "rt6_refundOrderNum", "rt7_amount", "rt8_orderStatus");
+
+    public OnlineRefundData() {
+    }
+
+    public String getRt1_bizType() {
+        return rt1_bizType;
+    }
+
+    public void setRt1_bizType(String rt1_bizType) {
+        this.rt1_bizType = rt1_bizType;
+    }
+
+    public String getRt2_retCode() {
+        return rt2_retCode;
+    }
+
+    public void setRt2_retCode(String rt2_retCode) {
+        this.rt2_retCode = rt2_retCode;
+    }
+
+    public String getRt3_retMsg() {
+        return rt3_retMsg;
+    }
+
+    public void setRt3_retMsg(String rt3_retMsg) {
+        this.rt3_retMsg = rt3_retMsg;
+    }
+
+    public String getRt4_customerNumber() {
+        return rt4_customerNumber;
+    }
+
+    public void setRt4_customerNumber(String rt4_customerNumber) {
+        this.rt4_customerNumber = rt4_customerNumber;
+    }
+
+    public String getRt5_orderId() {
+        return rt5_orderId;
+    }
+
+    public void setRt5_orderId(String rt5_orderId) {
+        this.rt5_orderId = rt5_orderId;
+    }
+
+    public String getRt6_refundOrderId() {
+        return rt6_refundOrderId;
+    }
+
+    public void setRt6_refundOrderId(String rt6_refundOrderId) {
+        this.rt6_refundOrderId = rt6_refundOrderId;
+    }
+
+    public String getRt7_amount() {
+        return rt7_amount;
+    }
+
+    public void setRt7_amount(String rt7_amount) {
+        this.rt7_amount = rt7_amount;
+    }
+
+    public String getRt8_orderStatus() {
+        return rt8_orderStatus;
+    }
+
+    public void setRt8_orderStatus(String rt8_orderStatus) {
+        this.rt8_orderStatus = rt8_orderStatus;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 85 - 0
src/main/java/com/caimei/modules/order/entity/OnlineRefundVo.java

@@ -0,0 +1,85 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+
+public class OnlineRefundVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String id;
+    private String userId;
+    //发起退款商户唯一订单请求号
+    private String orderRequestNo;
+    private String orderId;
+    private String amount;
+    //退款方式 1线上支付原路退回 ,2线上余额退现金
+    private String refundType;
+    private String delFlag;
+
+    public OnlineRefundVo() {
+    }
+
+    public OnlineRefundVo(String id, String userId, String orderRequestNo, String orderId, String amount, String balanceRefundOrderId, String refundType, String delFlag) {
+        this.id = id;
+        this.userId = userId;
+        this.orderRequestNo = orderRequestNo;
+        this.orderId = orderId;
+        this.amount = amount;
+        this.refundType = refundType;
+        this.delFlag = delFlag;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getOrderRequestNo() {
+        return orderRequestNo;
+    }
+
+    public void setOrderRequestNo(String orderRequestNo) {
+        this.orderRequestNo = orderRequestNo;
+    }
+
+    public String getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(String orderId) {
+        this.orderId = orderId;
+    }
+
+    public String getAmount() {
+        return amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
+
+    public String getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(String refundType) {
+        this.refundType = refundType;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+}

+ 88 - 0
src/main/java/com/caimei/modules/order/entity/OnlineVo.java

@@ -0,0 +1,88 @@
+package com.caimei.modules.order.entity;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class OnlineVo implements Serializable {
+    private String P1_bizType;
+    private String P2_orderId;
+    private String P3_customerNumber;
+    private String P4_refundAmount;
+    private String P5_refundOrderId;
+    private String P6_desc;
+    private String P7_serverCallbackUrl;
+    /**排除签名*/
+    private String sign;
+
+    public OnlineVo() {
+    }
+
+    public String getP1_bizType() {
+        return P1_bizType;
+    }
+
+    public void setP1_bizType(String p1_bizType) {
+        P1_bizType = p1_bizType;
+    }
+
+    public String getP2_orderId() {
+        return P2_orderId;
+    }
+
+    public void setP2_orderId(String p2_orderId) {
+        P2_orderId = p2_orderId;
+    }
+
+    public String getP3_customerNumber() {
+        return P3_customerNumber;
+    }
+
+    public void setP3_customerNumber(String p3_customerNumber) {
+        P3_customerNumber = p3_customerNumber;
+    }
+
+    public String getP4_refundAmount() {
+        return P4_refundAmount;
+    }
+
+    public void setP4_refundAmount(String p4_refundAmount) {
+        P4_refundAmount = p4_refundAmount;
+    }
+
+    public String getP5_refundOrderId() {
+        return P5_refundOrderId;
+    }
+
+    public void setP5_refundOrderId(String p5_refundOrderId) {
+        P5_refundOrderId = p5_refundOrderId;
+    }
+
+    public String getP6_desc() {
+        return P6_desc;
+    }
+
+    public void setP6_desc(String p6_desc) {
+        P6_desc = p6_desc;
+    }
+
+    public String getP7_serverCallbackUrl() {
+        return P7_serverCallbackUrl;
+    }
+
+    public void setP7_serverCallbackUrl(String p7_serverCallbackUrl) {
+        P7_serverCallbackUrl = p7_serverCallbackUrl;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public static final Set<String> NEED_SIGN_PARAMS = ImmutableSet.of("P1_bizType", "P2_orderId",
+            "P3_customerNumber", "P4_refundAmount", "P5_refundOrderId", "P6_desc","P7_serverCallbackUrl");
+}

+ 709 - 0
src/main/java/com/caimei/modules/order/entity/OrderProductVo.java

@@ -0,0 +1,709 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/21
+ */
+public class OrderProductVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 商品分账商户号
+     */
+    private String splitCode;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 主图
+     */
+    private String image;
+    /**
+     * 价格
+     */
+    private Double price;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 商品的类别:1正常商品(默认),2二手商品
+     */
+    private Integer productCategory;
+    /**
+     * 成本价选中标志:1固定成本 2比例成
+     */
+    private Integer costCheckFlag;
+    /**
+     * 成本价
+     */
+    private Double costPrice;
+    /**
+     * 市场价 = 商品表市场价
+     */
+    private Double normalPrice;
+    /**
+     * 比例成本百分比
+     */
+    private Double costProportional;
+    /**
+     * 启用阶梯价标志 0否 1是
+     */
+    private Integer ladderPriceFlag;
+    /**
+     * 折后单价
+     */
+    private Double discountPrice;
+    /**
+     * 折扣比例
+     */
+    private Double discount;
+    /**
+     * 总价  = price X num
+     */
+    private Double totalAmount;
+    /**
+     * 折后总价  = discountPrice X num + totalAddedValueTax
+     */
+    private Double totalFee;
+    /**
+     * 应付金额 = totalFee - discountFee(经理折扣,仅后台下单有经理折扣)
+     */
+    private Double shouldPayFee;
+    /**
+     * 包装规格
+     */
+    private String productUnit;
+    /**
+     * 购买数量
+     */
+    private Integer num;
+    /**
+     * 赠送数量
+     */
+    private Integer presentNum;
+    /**
+     * 协销订单:经理折扣(平摊到每个商品上,按照每种商品的总价占订单总价的比例来均分);普通订单 无
+     */
+    private Double discountFee;
+    /**
+     * 是否含税 0不含税,1含税,2未知
+     */
+    private Integer includedTax;
+    /**
+     * 发票类型(基于是否含税基础) 1增值税票,2普通票, 3不能开票
+     */
+    private Integer invoiceType;
+    /**
+     * 机构 税率
+     */
+    private Double taxRate;
+    /**
+     * 机构 单个税费=税率X折后单价
+     */
+    private Double addedValueTax;
+    /**
+     * 机构 总税费=单个税费X购买数量
+     */
+    private Double totalAddedValueTax;
+    /**
+     * 供应商 税率
+     */
+    private Double shopTaxRate;
+    /**
+     * 供应商 单个付供应商税费=税率X成本
+     */
+    private Double singleShouldPayTotalTax;
+    /**
+     * 供应商 总税费(应付税费)=单个税费X购买数量
+     */
+    private Double shouldPayTotalTax;
+    /**
+     * 供应商 商品费=成本价*(购买数量  + 赠品数量)
+     */
+    private Double shopProductAmount;
+    /**
+     * 后台设置的单个应付供应商金额
+     */
+    private Double singleShopFee;
+    /**
+     * 该商品总的应付供应商金额
+     */
+    private Double shopFee;
+    /**
+     * 后台设置单个应付第三方金额
+     */
+    private Double singleOtherFee;
+    /**
+     * 该商品总的应付第三方金额
+     */
+    private Double otherFee;
+    /**
+     * 后台计算的单个应付采美金额
+     */
+    private Double singleCmFee;
+    /**
+     * 该商品总的应付采美金额 (受赠品影响)
+     */
+    private Double cmFee;
+    /**
+     * 支付状态 0 未进账 1 待财务审核 2 已进账(适用协销的单笔线下进账和自助订单线下或异常进账)
+     */
+    private Integer payStatus;
+    /**
+     * 订单商品再次购买标识 0否 1是
+     */
+    private Integer buyAgainFlag;
+    /**
+     * 未出库数量
+     */
+    private Integer notOutStore;
+    /**
+     * 下单时商品购买价格类型快照 0 机构价,1活动价 ,2阶梯价
+     */
+    private Integer actProduct;
+    /**
+     * 商品类型(0正常商品,1协商赠品,2促销赠品)
+     */
+    private Integer productType;
+//    /**
+//     * 阶梯价列表(临时用,保存订单阶梯价格)
+//     */
+//    private List<LadderPriceVo> ladderPrices;
+    /**
+     * 订单号(保存订单用)
+     */
+    private Integer orderId;
+    /**
+     * 订单编号(保存订单用)
+     */
+    private String orderNo;
+    /**
+     * 子订单ID(保存订单用)
+     */
+    private Integer shopOrderId;
+    /**
+     * 子订单编号(保存订单用)
+     */
+    private String shopOrderNo;
+    /**
+     * 订单商品Id(保存订单用)
+     */
+    private Integer orderProductId;
+    /**
+     * 订单促销id
+     */
+    private Integer orderPromotionsId;
+    /**
+     * 商品促销活动
+     */
+    private PromotionsVo productPromotion;
+    /**
+     * 已发货数量
+     */
+    private Integer shipmentsNum;
+
+    /**
+     * 已退货数量
+     */
+    private Integer returnedNum;
+
+    /**
+     * 已取消发货数量
+     */
+    private Integer actualCancelNum;
+    /**
+     * 商品前台展示单价是否含税,1不含税,2含税,3其他
+     */
+    private Integer includedTaxFlag;
+    /**
+     * 超级会员优惠价格标识:0不是,1是
+     */
+    private Integer svipPriceFlag;
+    /**
+     * 超级会员优惠价类型:1折扣价,2直接优惠价
+     */
+    private Integer svipPriceType;
+    /**
+     * 超级会员折扣
+     */
+    private Double svipDiscount;
+    /**
+     * 超级会员价格标签
+     */
+    private String svipPriceTag;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public Integer getProductCategory() {
+        return productCategory;
+    }
+
+    public void setProductCategory(Integer productCategory) {
+        this.productCategory = productCategory;
+    }
+
+    public Integer getCostCheckFlag() {
+        return costCheckFlag;
+    }
+
+    public void setCostCheckFlag(Integer costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
+
+    public Double getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(Double costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public Double getNormalPrice() {
+        return normalPrice;
+    }
+
+    public void setNormalPrice(Double normalPrice) {
+        this.normalPrice = normalPrice;
+    }
+
+    public Double getCostProportional() {
+        return costProportional;
+    }
+
+    public void setCostProportional(Double costProportional) {
+        this.costProportional = costProportional;
+    }
+
+    public Integer getLadderPriceFlag() {
+        return ladderPriceFlag;
+    }
+
+    public void setLadderPriceFlag(Integer ladderPriceFlag) {
+        this.ladderPriceFlag = ladderPriceFlag;
+    }
+
+    public Double getDiscountPrice() {
+        return discountPrice;
+    }
+
+    public void setDiscountPrice(Double discountPrice) {
+        this.discountPrice = discountPrice;
+    }
+
+    public Double getDiscount() {
+        return discount;
+    }
+
+    public void setDiscount(Double discount) {
+        this.discount = discount;
+    }
+
+    public Double getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(Double totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public Double getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(Double totalFee) {
+        this.totalFee = totalFee;
+    }
+
+    public Double getShouldPayFee() {
+        return shouldPayFee;
+    }
+
+    public void setShouldPayFee(Double shouldPayFee) {
+        this.shouldPayFee = shouldPayFee;
+    }
+
+    public String getProductUnit() {
+        return productUnit;
+    }
+
+    public void setProductUnit(String productUnit) {
+        this.productUnit = productUnit;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    public Integer getPresentNum() {
+        return presentNum;
+    }
+
+    public void setPresentNum(Integer presentNum) {
+        this.presentNum = presentNum;
+    }
+
+    public Double getDiscountFee() {
+        return discountFee;
+    }
+
+    public void setDiscountFee(Double discountFee) {
+        this.discountFee = discountFee;
+    }
+
+    public Integer getIncludedTax() {
+        return includedTax;
+    }
+
+    public void setIncludedTax(Integer includedTax) {
+        this.includedTax = includedTax;
+    }
+
+    public Integer getInvoiceType() {
+        return invoiceType;
+    }
+
+    public void setInvoiceType(Integer invoiceType) {
+        this.invoiceType = invoiceType;
+    }
+
+    public Double getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(Double taxRate) {
+        this.taxRate = taxRate;
+    }
+
+    public Double getAddedValueTax() {
+        return addedValueTax;
+    }
+
+    public void setAddedValueTax(Double addedValueTax) {
+        this.addedValueTax = addedValueTax;
+    }
+
+    public Double getTotalAddedValueTax() {
+        return totalAddedValueTax;
+    }
+
+    public void setTotalAddedValueTax(Double totalAddedValueTax) {
+        this.totalAddedValueTax = totalAddedValueTax;
+    }
+
+    public Double getShopTaxRate() {
+        return shopTaxRate;
+    }
+
+    public void setShopTaxRate(Double shopTaxRate) {
+        this.shopTaxRate = shopTaxRate;
+    }
+
+    public Double getSingleShouldPayTotalTax() {
+        return singleShouldPayTotalTax;
+    }
+
+    public void setSingleShouldPayTotalTax(Double singleShouldPayTotalTax) {
+        this.singleShouldPayTotalTax = singleShouldPayTotalTax;
+    }
+
+    public Double getShouldPayTotalTax() {
+        return shouldPayTotalTax;
+    }
+
+    public void setShouldPayTotalTax(Double shouldPayTotalTax) {
+        this.shouldPayTotalTax = shouldPayTotalTax;
+    }
+
+    public Double getShopProductAmount() {
+        return shopProductAmount;
+    }
+
+    public void setShopProductAmount(Double shopProductAmount) {
+        this.shopProductAmount = shopProductAmount;
+    }
+
+    public Double getSingleShopFee() {
+        return singleShopFee;
+    }
+
+    public void setSingleShopFee(Double singleShopFee) {
+        this.singleShopFee = singleShopFee;
+    }
+
+    public Double getShopFee() {
+        return shopFee;
+    }
+
+    public void setShopFee(Double shopFee) {
+        this.shopFee = shopFee;
+    }
+
+    public Double getSingleOtherFee() {
+        return singleOtherFee;
+    }
+
+    public void setSingleOtherFee(Double singleOtherFee) {
+        this.singleOtherFee = singleOtherFee;
+    }
+
+    public Double getOtherFee() {
+        return otherFee;
+    }
+
+    public void setOtherFee(Double otherFee) {
+        this.otherFee = otherFee;
+    }
+
+    public Double getSingleCmFee() {
+        return singleCmFee;
+    }
+
+    public void setSingleCmFee(Double singleCmFee) {
+        this.singleCmFee = singleCmFee;
+    }
+
+    public Double getCmFee() {
+        return cmFee;
+    }
+
+    public void setCmFee(Double cmFee) {
+        this.cmFee = cmFee;
+    }
+
+    public Integer getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(Integer payStatus) {
+        this.payStatus = payStatus;
+    }
+
+    public Integer getBuyAgainFlag() {
+        return buyAgainFlag;
+    }
+
+    public void setBuyAgainFlag(Integer buyAgainFlag) {
+        this.buyAgainFlag = buyAgainFlag;
+    }
+
+    public Integer getNotOutStore() {
+        return notOutStore;
+    }
+
+    public void setNotOutStore(Integer notOutStore) {
+        this.notOutStore = notOutStore;
+    }
+
+    public Integer getActProduct() {
+        return actProduct;
+    }
+
+    public void setActProduct(Integer actProduct) {
+        this.actProduct = actProduct;
+    }
+
+    public Integer getProductType() {
+        return productType;
+    }
+
+    public void setProductType(Integer productType) {
+        this.productType = productType;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public String getShopOrderNo() {
+        return shopOrderNo;
+    }
+
+    public void setShopOrderNo(String shopOrderNo) {
+        this.shopOrderNo = shopOrderNo;
+    }
+
+    public Integer getOrderProductId() {
+        return orderProductId;
+    }
+
+    public void setOrderProductId(Integer orderProductId) {
+        this.orderProductId = orderProductId;
+    }
+
+    public Integer getOrderPromotionsId() {
+        return orderPromotionsId;
+    }
+
+    public void setOrderPromotionsId(Integer orderPromotionsId) {
+        this.orderPromotionsId = orderPromotionsId;
+    }
+
+    public PromotionsVo getProductPromotion() {
+        return productPromotion;
+    }
+
+    public void setProductPromotion(PromotionsVo productPromotion) {
+        this.productPromotion = productPromotion;
+    }
+
+    public Integer getShipmentsNum() {
+        return shipmentsNum;
+    }
+
+    public void setShipmentsNum(Integer shipmentsNum) {
+        this.shipmentsNum = shipmentsNum;
+    }
+
+    public Integer getReturnedNum() {
+        return returnedNum;
+    }
+
+    public void setReturnedNum(Integer returnedNum) {
+        this.returnedNum = returnedNum;
+    }
+
+    public Integer getActualCancelNum() {
+        return actualCancelNum;
+    }
+
+    public void setActualCancelNum(Integer actualCancelNum) {
+        this.actualCancelNum = actualCancelNum;
+    }
+
+    public Integer getIncludedTaxFlag() {
+        return includedTaxFlag;
+    }
+
+    public void setIncludedTaxFlag(Integer includedTaxFlag) {
+        this.includedTaxFlag = includedTaxFlag;
+    }
+
+    public Integer getSvipPriceFlag() {
+        return svipPriceFlag;
+    }
+
+    public void setSvipPriceFlag(Integer svipPriceFlag) {
+        this.svipPriceFlag = svipPriceFlag;
+    }
+
+    public Integer getSvipPriceType() {
+        return svipPriceType;
+    }
+
+    public void setSvipPriceType(Integer svipPriceType) {
+        this.svipPriceType = svipPriceType;
+    }
+
+    public Double getSvipDiscount() {
+        return svipDiscount;
+    }
+
+    public void setSvipDiscount(Double svipDiscount) {
+        this.svipDiscount = svipDiscount;
+    }
+
+    public String getSvipPriceTag() {
+        return svipPriceTag;
+    }
+
+    public void setSvipPriceTag(String svipPriceTag) {
+        this.svipPriceTag = svipPriceTag;
+    }
+}

+ 212 - 0
src/main/java/com/caimei/modules/order/entity/OrderReceiptRelationPo.java

@@ -0,0 +1,212 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+
+/**
+ * 收款项和订单关系表
+ *
+ * @author : Charles
+ * @date : 2021/7/14
+ */
+
+public class OrderReceiptRelationPo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 收款项和订单关系表id
+     */
+    private Integer id;
+    /**
+     * 关系类型:1返佣订单(返佣款)、2非返佣订单(订单款或者非订单款)、3超级会员款、4二手商品上架费,5认证通会员款
+     */
+    private Integer relationType;
+    /**
+     * 识别款项Id(对应cm_discern_receipt表)
+     */
+    private Integer receiptId;
+    /**
+     * 关联金额:1普通收款(线下):收款具体对该应母订单的收金额、2线上支付:付款金额就等于该金额、3返佣收款:默认为0
+     */
+    private Double associateAmount;
+    /**
+     * 关联方式: 1手动 2自动
+     */
+    private Integer associationType;
+    /**
+     * 订单Id(relationType值为1是为子订单ID,为2时为主订单ID)
+     */
+    private Integer orderId;
+    /**
+     * 子订单id
+     */
+    private Integer shopOrderId;
+    /**
+     *  超级会员购买记录Id
+     */
+    private Integer vipRecordId;
+    /**
+     * 优惠券购买记录id
+     */
+    private Integer couponRecordId;
+    /**
+     *  认证通会员购买记录Id
+     */
+    private Integer authVipRecordId;
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private Integer delFlag;
+    /**
+     * 米花科技平台唯一流水号
+     */
+    private String mbOrderId;
+    /**
+     * 商户唯一订单请求号(订单编号#随机时间戳)
+     */
+    private String orderRequestNo;
+    /**
+     * 分账状态:0待分账,1已分账(只针对线上支付)
+     */
+    private Integer splitStatus;
+    /**
+     * 付款类型:1建设银行7297、2广发银行0115、3中信银行7172、4中信银行0897、5中信银行0897-财付通、6中信银行0897-支付宝、
+     * 7线上-支付宝、8线上-微信支付、9线上-快钱支付、10口头返佣、11广发银行5461、12PC-B2B网银、13PC-微信支付、14PC-支付宝、
+     * 15小程序-微信支付、16余额抵扣、20建设银行3346
+     */
+    private Integer payType;
+    /**
+     * 二手商品上架费用对应的二手商品id
+     */
+    private Integer productId;
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getRelationType() {
+        return relationType;
+    }
+
+    public void setRelationType(Integer relationType) {
+        this.relationType = relationType;
+    }
+
+    public Integer getReceiptId() {
+        return receiptId;
+    }
+
+    public void setReceiptId(Integer receiptId) {
+        this.receiptId = receiptId;
+    }
+
+    public Double getAssociateAmount() {
+        return associateAmount;
+    }
+
+    public void setAssociateAmount(Double associateAmount) {
+        this.associateAmount = associateAmount;
+    }
+
+    public Integer getAssociationType() {
+        return associationType;
+    }
+
+    public void setAssociationType(Integer associationType) {
+        this.associationType = associationType;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getVipRecordId() {
+        return vipRecordId;
+    }
+
+    public void setVipRecordId(Integer vipRecordId) {
+        this.vipRecordId = vipRecordId;
+    }
+
+    public Integer getCouponRecordId() {
+        return couponRecordId;
+    }
+
+    public void setCouponRecordId(Integer couponRecordId) {
+        this.couponRecordId = couponRecordId;
+    }
+
+    public Integer getAuthVipRecordId() {
+        return authVipRecordId;
+    }
+
+    public void setAuthVipRecordId(Integer authVipRecordId) {
+        this.authVipRecordId = authVipRecordId;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public String getMbOrderId() {
+        return mbOrderId;
+    }
+
+    public void setMbOrderId(String mbOrderId) {
+        this.mbOrderId = mbOrderId;
+    }
+
+    public String getOrderRequestNo() {
+        return orderRequestNo;
+    }
+
+    public void setOrderRequestNo(String orderRequestNo) {
+        this.orderRequestNo = orderRequestNo;
+    }
+
+    public Integer getSplitStatus() {
+        return splitStatus;
+    }
+
+    public void setSplitStatus(Integer splitStatus) {
+        this.splitStatus = splitStatus;
+    }
+
+    public Integer getPayType() {
+        return payType;
+    }
+
+    public void setPayType(Integer payType) {
+        this.payType = payType;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+}

+ 185 - 0
src/main/java/com/caimei/modules/order/entity/OrderUserinfoVo.java

@@ -0,0 +1,185 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/22
+ */
+public class OrderUserinfoVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 订单用户信息表Id
+     */
+    private Integer id;
+    /**
+     * 订单ID
+     */
+    private Integer orderId;
+    /**
+     * 机构ID
+     */
+    private Integer clubId;
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+    /**
+     * 买家(name)
+     */
+    private String name;
+    /**
+     * 收货人(shouHuoRen)
+     */
+    private String receiver;
+    /**
+     * 手机
+     */
+    private String mobile;
+    /**
+     * 电话
+     */
+    private String phone;
+    /**
+     * 邮编
+     */
+    private String postalCode;
+    /**
+     * 县区ID
+     */
+    private Integer townId;
+    /**
+     * 省、直辖市
+     */
+    private String province;
+    /**
+     * 市
+     */
+    private String city;
+    /**
+     * 县、区
+     */
+    private String town;
+    /**
+     * 收货地址
+     */
+    private String address;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getClubId() {
+        return clubId;
+    }
+
+    public void setClubId(Integer clubId) {
+        this.clubId = clubId;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getReceiver() {
+        return receiver;
+    }
+
+    public void setReceiver(String receiver) {
+        this.receiver = receiver;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getPostalCode() {
+        return postalCode;
+    }
+
+    public void setPostalCode(String postalCode) {
+        this.postalCode = postalCode;
+    }
+
+    public Integer getTownId() {
+        return townId;
+    }
+
+    public void setTownId(Integer townId) {
+        this.townId = townId;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getTown() {
+        return town;
+    }
+
+    public void setTown(String town) {
+        this.town = town;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+}

+ 920 - 0
src/main/java/com/caimei/modules/order/entity/OrderVo.java

@@ -0,0 +1,920 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/20
+ */
+public class OrderVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * orderSeen:订单对机构可见度,1可见,2不可见
+     */
+    private Integer orderSeen;
+    /**
+     * 订单号
+     */
+    private Integer orderId;
+    /**
+     * 订单来源:1WWW、2CRM、4客服[适用后台下单]、5外单[适用后台下单]、6小程序[采美,星范]、7呵呵商城小程序、8维沙小程序
+     */
+    private Integer orderSource;
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+    /**
+     * 用户Id
+     */
+    private Integer userId;
+    /**
+     * 机构Id
+     */
+    private Integer clubId;
+    /**
+     * 组织Id
+     */
+    private Integer organizeId;
+    /**
+     * 用户身份:1协销 2会员机构 3供应商 4普通机构
+     */
+    private Integer userIdentity;
+    /**
+     * 机构名称(协销订单列表用)
+     */
+    private String clubName;
+    /**
+     * 超级会员标识,1是,不是
+     */
+    private Integer svipUserFlag;
+    /**
+     * 下单人Id(协销Id,或运营人Id,或用户Id)
+     */
+    private Integer buyUserId;
+    /**
+     * 订单提交时间
+     */
+    private String orderTime;
+    /**
+     * 更新时间
+     */
+    private String updateDate;
+    /**
+     * 订单状态 0 有效  其它无效
+     */
+    private Integer delFlag;
+    /**
+     * 采美豆抵扣运费的抵扣数量
+     */
+    private Integer userBeans;
+    /**
+     * 订单类型 协销订单 0, 普通订单 1
+     */
+    private Integer orderType;
+    /**
+     * 订单提交类型 0:个人自己下单 1:企业自己下单 2:员工帮会所下单 3:协销帮会所下单  4:后台下单 5:采美豆订单
+     */
+    private Integer orderSubmitType;
+    /**
+     * 订单确认标志,0否,1后台确认,2买家确认(适用协销订单并且1或2都算已确认订单,主动订单默认1为确认)
+     */
+    private Integer confirmFlag;
+    /**
+     * 是否能走线上支付 0可以 1不可以 只能线下
+     */
+    private Integer onlinePayFlag;
+    /**
+     * 订单是否可拆分   1可拆分 0不可拆分
+     */
+    private Integer splitFlag;
+    /**
+     * 是否已支付 未支付0 已支付1
+     */
+    private Integer payFlag;
+    /**
+     * (向买家)收款状态:1待收款、2部分收款、3已收款
+     */
+    private Integer receiptStatus;
+    /**
+     * (向供应商)付款状态:1待付款、2部分付款、3已付款
+     */
+    private Integer payStatus;
+    /**
+     * 订单0成本标识:0订单有成本,1订单无成本(订单中所有商品成本为0)
+     */
+    private Integer zeroCostFlag;
+    /**
+     * 发货状态:1待发货、2部分发货、3已发货
+     */
+    private Integer sendOutStatus;
+    /**
+     * 退货退款类型:0未发生退款、1部分退、2全部退
+     */
+    private Integer refundType;
+    /**
+     * 确认付款供应商标识 0未确认,1已确认
+     */
+    private Integer affirmPaymentFlag;
+    /**
+     * 购买总数
+     */
+    private Integer productCount;
+
+    /**
+     * 赠送总数  不计算价格
+     */
+    private Integer presentCount;
+    /**
+     * 促销赠品总数
+     */
+    private Integer promotionalGiftsCount;
+    /**
+     * 是否包含活动商品(受订单未支付自动关闭时间影响)  0 否 1 是
+     */
+    private Integer hasActProduct;
+    /**
+     * 促销满减优惠
+     */
+    private Double promotionFullReduction;
+    /**
+     * 超级会员优惠
+     */
+    private Double svipFullReduction;
+    /**
+     * 二手商品订单标识  0非二手商品订单、 1二手商品订单
+     */
+    private Integer secondHandOrderFlag;
+    /**
+     * 是否开发票 没开发票 0 开个人发票 1 开企业发票2
+     */
+    private Integer invoiceFlag;
+    /**
+     * 免邮标志  运费:-1到付,0包邮,1需要运费,-2仪器到付其它包邮
+     */
+    private Integer postageFlag;
+    /**
+     * -1到付,0包邮,大于0具体金额,-2仪器到付其它包邮(且运费已使用商品形式存储)
+     */
+    private Double postage;
+    /**
+     * 商品总金额 (商品单价乘以数量,再加上税费)
+     */
+    private Double productTotalFee;
+    /**
+     * 小计金额 (商品折后单价乘以数量,再加上税费)
+     */
+    private Double orderTotalFee;
+    /**
+     * 经理折扣
+     */
+    private Double discountFee;
+    /**
+     * 使用优惠券金额
+     */
+    private Double couponAmount;
+    /**
+     * 订单总额(小计金额减去经理折扣后,再加上运费)
+     */
+    private Double payTotalFee;
+    /**
+     * 真实支付金额(订单总额减去抵扣的账户余额)
+     */
+    private Double payableAmount;
+    /**
+     * 余额支付金额
+     */
+    private Double balancePayFee;
+    /**
+     * 0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退
+     */
+    private Integer status;
+    /**
+     * 订单确认时间
+     */
+    private String confirmTime;
+    /**
+     * 订单支付时间
+     */
+    private String payTime;
+    /**
+     * 返佣订单标识 0非返佣订单,1返佣订单
+     */
+    private Integer rebateFlag;
+    /**
+     * 条款ID
+     */
+    private Integer clauseId;
+    /**
+     * 条款名称
+     */
+    private String clauseName;
+    /**
+     * 子订单ID
+     */
+    private String shopOrderIds;
+    /**
+     * 订单取消原因
+     */
+    private String closeReason;
+    /**
+     * 订单取消时间
+     */
+    private String closeTime;
+    /**
+     * 订单备注
+     */
+    private String note;
+    /**
+     * 已支付成功次数统计(适用线上多笔付款用来确认当前是哪一笔)
+     */
+    private Integer paySuccessCounter;
+    /**
+     * 子订单信息
+     */
+    private List<ShopOrderVo> shopOrderList;
+    /**
+     * 支付按钮是否消失,true消失
+     */
+    private boolean payButton = false;
+    /**
+     * 待付总金额
+     */
+    private Double pendingPayments;
+    /**
+     * 付款总金额
+     */
+    private Double receiptAmount;
+    /**
+     * 订单标识:#订单号#
+     */
+    private String orderMark;
+    /**
+     * 是否包含充值商品
+     */
+    private boolean rechargeGoods = false;
+    /**
+     * 总税费
+     */
+    private Double expensesOfTaxation;
+    /**
+     * 退款总金额
+     */
+    private Double returnedPurchaseFee;
+    /**
+     * 是否有商品发票属性的限制,为true时只能线下支付
+     */
+    private boolean invoiceStatus = false;
+    /**
+     * 客户名称
+     */
+    private String userName;
+    /**
+     * 收款详情是否可以查看
+     */
+    private Boolean authority = false;
+    /**
+     * 存在退款中的记录 (0:否,1:是)
+     */
+    private String haveReturning;
+    /**
+     * 存在收款中的记录 (0:否,1:是)
+     */
+    private String haveReceipting;
+    /**
+     * 剩余应收金额
+     */
+    private Double surplusAmount;
+    /**
+     * 已支付金额
+     */
+    private Double paidAmount;
+    /**
+     * 待审金额
+     */
+    private Double unCheckAmount;
+    /**
+     * 退货退款价值(抵扣经理折扣后)
+     */
+    private Double returnValue;
+    /**
+     * 退款总额(给买家)
+     */
+    private Double refundFee;
+    /**
+     * 订单状态备注
+     */
+    private String statusName;
+    /**
+     * 总税费
+     */
+    private Double totalAddedValueTax;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getOrderSeen() {
+        return orderSeen;
+    }
+
+    public void setOrderSeen(Integer orderSeen) {
+        this.orderSeen = orderSeen;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getOrderSource() {
+        return orderSource;
+    }
+
+    public void setOrderSource(Integer orderSource) {
+        this.orderSource = orderSource;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getClubId() {
+        return clubId;
+    }
+
+    public void setClubId(Integer clubId) {
+        this.clubId = clubId;
+    }
+
+    public Integer getOrganizeId() {
+        return organizeId;
+    }
+
+    public void setOrganizeId(Integer organizeId) {
+        this.organizeId = organizeId;
+    }
+
+    public Integer getUserIdentity() {
+        return userIdentity;
+    }
+
+    public void setUserIdentity(Integer userIdentity) {
+        this.userIdentity = userIdentity;
+    }
+
+    public String getClubName() {
+        return clubName;
+    }
+
+    public void setClubName(String clubName) {
+        this.clubName = clubName;
+    }
+
+    public Integer getSvipUserFlag() {
+        return svipUserFlag;
+    }
+
+    public void setSvipUserFlag(Integer svipUserFlag) {
+        this.svipUserFlag = svipUserFlag;
+    }
+
+    public Integer getBuyUserId() {
+        return buyUserId;
+    }
+
+    public void setBuyUserId(Integer buyUserId) {
+        this.buyUserId = buyUserId;
+    }
+
+    public String getOrderTime() {
+        return orderTime;
+    }
+
+    public void setOrderTime(String orderTime) {
+        this.orderTime = orderTime;
+    }
+
+    public String getUpdateDate() {
+        return updateDate;
+    }
+
+    public void setUpdateDate(String updateDate) {
+        this.updateDate = updateDate;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Integer getUserBeans() {
+        return userBeans;
+    }
+
+    public void setUserBeans(Integer userBeans) {
+        this.userBeans = userBeans;
+    }
+
+    public Integer getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(Integer orderType) {
+        this.orderType = orderType;
+    }
+
+    public Integer getOrderSubmitType() {
+        return orderSubmitType;
+    }
+
+    public void setOrderSubmitType(Integer orderSubmitType) {
+        this.orderSubmitType = orderSubmitType;
+    }
+
+    public Integer getConfirmFlag() {
+        return confirmFlag;
+    }
+
+    public void setConfirmFlag(Integer confirmFlag) {
+        this.confirmFlag = confirmFlag;
+    }
+
+    public Integer getOnlinePayFlag() {
+        return onlinePayFlag;
+    }
+
+    public void setOnlinePayFlag(Integer onlinePayFlag) {
+        this.onlinePayFlag = onlinePayFlag;
+    }
+
+    public Integer getSplitFlag() {
+        return splitFlag;
+    }
+
+    public void setSplitFlag(Integer splitFlag) {
+        this.splitFlag = splitFlag;
+    }
+
+    public Integer getPayFlag() {
+        return payFlag;
+    }
+
+    public void setPayFlag(Integer payFlag) {
+        this.payFlag = payFlag;
+    }
+
+    public Integer getReceiptStatus() {
+        return receiptStatus;
+    }
+
+    public void setReceiptStatus(Integer receiptStatus) {
+        this.receiptStatus = receiptStatus;
+    }
+
+    public Integer getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(Integer payStatus) {
+        this.payStatus = payStatus;
+    }
+
+    public Integer getZeroCostFlag() {
+        return zeroCostFlag;
+    }
+
+    public void setZeroCostFlag(Integer zeroCostFlag) {
+        this.zeroCostFlag = zeroCostFlag;
+    }
+
+    public Integer getSendOutStatus() {
+        return sendOutStatus;
+    }
+
+    public void setSendOutStatus(Integer sendOutStatus) {
+        this.sendOutStatus = sendOutStatus;
+    }
+
+    public Integer getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(Integer refundType) {
+        this.refundType = refundType;
+    }
+
+    public Integer getAffirmPaymentFlag() {
+        return affirmPaymentFlag;
+    }
+
+    public void setAffirmPaymentFlag(Integer affirmPaymentFlag) {
+        this.affirmPaymentFlag = affirmPaymentFlag;
+    }
+
+    public Integer getProductCount() {
+        return productCount;
+    }
+
+    public void setProductCount(Integer productCount) {
+        this.productCount = productCount;
+    }
+
+    public Integer getPresentCount() {
+        return presentCount;
+    }
+
+    public void setPresentCount(Integer presentCount) {
+        this.presentCount = presentCount;
+    }
+
+    public Integer getPromotionalGiftsCount() {
+        return promotionalGiftsCount;
+    }
+
+    public void setPromotionalGiftsCount(Integer promotionalGiftsCount) {
+        this.promotionalGiftsCount = promotionalGiftsCount;
+    }
+
+    public Integer getHasActProduct() {
+        return hasActProduct;
+    }
+
+    public void setHasActProduct(Integer hasActProduct) {
+        this.hasActProduct = hasActProduct;
+    }
+
+    public Double getPromotionFullReduction() {
+        return promotionFullReduction;
+    }
+
+    public void setPromotionFullReduction(Double promotionFullReduction) {
+        this.promotionFullReduction = promotionFullReduction;
+    }
+
+    public Double getSvipFullReduction() {
+        return svipFullReduction;
+    }
+
+    public void setSvipFullReduction(Double svipFullReduction) {
+        this.svipFullReduction = svipFullReduction;
+    }
+
+    public Integer getSecondHandOrderFlag() {
+        return secondHandOrderFlag;
+    }
+
+    public void setSecondHandOrderFlag(Integer secondHandOrderFlag) {
+        this.secondHandOrderFlag = secondHandOrderFlag;
+    }
+
+    public Integer getInvoiceFlag() {
+        return invoiceFlag;
+    }
+
+    public void setInvoiceFlag(Integer invoiceFlag) {
+        this.invoiceFlag = invoiceFlag;
+    }
+
+    public Integer getPostageFlag() {
+        return postageFlag;
+    }
+
+    public void setPostageFlag(Integer postageFlag) {
+        this.postageFlag = postageFlag;
+    }
+
+    public Double getPostage() {
+        return postage;
+    }
+
+    public void setPostage(Double postage) {
+        this.postage = postage;
+    }
+
+    public Double getProductTotalFee() {
+        return productTotalFee;
+    }
+
+    public void setProductTotalFee(Double productTotalFee) {
+        this.productTotalFee = productTotalFee;
+    }
+
+    public Double getOrderTotalFee() {
+        return orderTotalFee;
+    }
+
+    public void setOrderTotalFee(Double orderTotalFee) {
+        this.orderTotalFee = orderTotalFee;
+    }
+
+    public Double getDiscountFee() {
+        return discountFee;
+    }
+
+    public void setDiscountFee(Double discountFee) {
+        this.discountFee = discountFee;
+    }
+
+    public Double getCouponAmount() {
+        return couponAmount;
+    }
+
+    public void setCouponAmount(Double couponAmount) {
+        this.couponAmount = couponAmount;
+    }
+
+    public Double getPayTotalFee() {
+        return payTotalFee;
+    }
+
+    public void setPayTotalFee(Double payTotalFee) {
+        this.payTotalFee = payTotalFee;
+    }
+
+    public Double getPayableAmount() {
+        return payableAmount;
+    }
+
+    public void setPayableAmount(Double payableAmount) {
+        this.payableAmount = payableAmount;
+    }
+
+    public Double getBalancePayFee() {
+        return balancePayFee;
+    }
+
+    public void setBalancePayFee(Double balancePayFee) {
+        this.balancePayFee = balancePayFee;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getConfirmTime() {
+        return confirmTime;
+    }
+
+    public void setConfirmTime(String confirmTime) {
+        this.confirmTime = confirmTime;
+    }
+
+    public String getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(String payTime) {
+        this.payTime = payTime;
+    }
+
+    public Integer getRebateFlag() {
+        return rebateFlag;
+    }
+
+    public void setRebateFlag(Integer rebateFlag) {
+        this.rebateFlag = rebateFlag;
+    }
+
+    public Integer getClauseId() {
+        return clauseId;
+    }
+
+    public void setClauseId(Integer clauseId) {
+        this.clauseId = clauseId;
+    }
+
+    public String getClauseName() {
+        return clauseName;
+    }
+
+    public void setClauseName(String clauseName) {
+        this.clauseName = clauseName;
+    }
+
+    public String getShopOrderIds() {
+        return shopOrderIds;
+    }
+
+    public void setShopOrderIds(String shopOrderIds) {
+        this.shopOrderIds = shopOrderIds;
+    }
+
+    public String getCloseReason() {
+        return closeReason;
+    }
+
+    public void setCloseReason(String closeReason) {
+        this.closeReason = closeReason;
+    }
+
+    public String getCloseTime() {
+        return closeTime;
+    }
+
+    public void setCloseTime(String closeTime) {
+        this.closeTime = closeTime;
+    }
+
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+
+    public Integer getPaySuccessCounter() {
+        return paySuccessCounter;
+    }
+
+    public void setPaySuccessCounter(Integer paySuccessCounter) {
+        this.paySuccessCounter = paySuccessCounter;
+    }
+
+    public List<ShopOrderVo> getShopOrderList() {
+        return shopOrderList;
+    }
+
+    public void setShopOrderList(List<ShopOrderVo> shopOrderList) {
+        this.shopOrderList = shopOrderList;
+    }
+
+    public boolean isPayButton() {
+        return payButton;
+    }
+
+    public void setPayButton(boolean payButton) {
+        this.payButton = payButton;
+    }
+
+    public Double getPendingPayments() {
+        return pendingPayments;
+    }
+
+    public void setPendingPayments(Double pendingPayments) {
+        this.pendingPayments = pendingPayments;
+    }
+
+    public Double getReceiptAmount() {
+        return receiptAmount;
+    }
+
+    public void setReceiptAmount(Double receiptAmount) {
+        this.receiptAmount = receiptAmount;
+    }
+
+    public String getOrderMark() {
+        return orderMark;
+    }
+
+    public void setOrderMark(String orderMark) {
+        this.orderMark = orderMark;
+    }
+
+    public boolean isRechargeGoods() {
+        return rechargeGoods;
+    }
+
+    public void setRechargeGoods(boolean rechargeGoods) {
+        this.rechargeGoods = rechargeGoods;
+    }
+
+    public Double getExpensesOfTaxation() {
+        return expensesOfTaxation;
+    }
+
+    public void setExpensesOfTaxation(Double expensesOfTaxation) {
+        this.expensesOfTaxation = expensesOfTaxation;
+    }
+
+    public Double getReturnedPurchaseFee() {
+        return returnedPurchaseFee;
+    }
+
+    public void setReturnedPurchaseFee(Double returnedPurchaseFee) {
+        this.returnedPurchaseFee = returnedPurchaseFee;
+    }
+
+    public boolean isInvoiceStatus() {
+        return invoiceStatus;
+    }
+
+    public void setInvoiceStatus(boolean invoiceStatus) {
+        this.invoiceStatus = invoiceStatus;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public Boolean getAuthority() {
+        return authority;
+    }
+
+    public void setAuthority(Boolean authority) {
+        this.authority = authority;
+    }
+
+    public String getHaveReturning() {
+        return haveReturning;
+    }
+
+    public void setHaveReturning(String haveReturning) {
+        this.haveReturning = haveReturning;
+    }
+
+    public String getHaveReceipting() {
+        return haveReceipting;
+    }
+
+    public void setHaveReceipting(String haveReceipting) {
+        this.haveReceipting = haveReceipting;
+    }
+
+    public Double getSurplusAmount() {
+        return surplusAmount;
+    }
+
+    public void setSurplusAmount(Double surplusAmount) {
+        this.surplusAmount = surplusAmount;
+    }
+
+    public Double getPaidAmount() {
+        return paidAmount;
+    }
+
+    public void setPaidAmount(Double paidAmount) {
+        this.paidAmount = paidAmount;
+    }
+
+    public Double getUnCheckAmount() {
+        return unCheckAmount;
+    }
+
+    public void setUnCheckAmount(Double unCheckAmount) {
+        this.unCheckAmount = unCheckAmount;
+    }
+
+    public Double getReturnValue() {
+        return returnValue;
+    }
+
+    public void setReturnValue(Double returnValue) {
+        this.returnValue = returnValue;
+    }
+
+    public Double getRefundFee() {
+        return refundFee;
+    }
+
+    public void setRefundFee(Double refundFee) {
+        this.refundFee = refundFee;
+    }
+
+    public String getStatusName() {
+        return statusName;
+    }
+
+    public void setStatusName(String statusName) {
+        this.statusName = statusName;
+    }
+
+    public Double getTotalAddedValueTax() {
+        return totalAddedValueTax;
+    }
+
+    public void setTotalAddedValueTax(Double totalAddedValueTax) {
+        this.totalAddedValueTax = totalAddedValueTax;
+    }
+}

+ 256 - 0
src/main/java/com/caimei/modules/order/entity/PayParamBo.java

@@ -0,0 +1,256 @@
+package com.caimei.modules.order.entity;
+
+
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/30
+ */
+
+public class PayParamBo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 用户Id
+     */
+    private Integer userId;
+    /**
+     * 订单Id
+     */
+    private Integer orderId;
+    /**
+     * 二手发布商品id
+     */
+    private Integer productId;
+    /**
+     * 会员购买记录Id
+     */
+    private Integer vipRecordId;
+    /**
+     * 优惠券购买记录id
+     */
+    private Integer couponRecordId;
+    /**
+     * 会员套餐id
+     */
+    private Integer vipId;
+    /**
+     * 支付金额,单位分,必须大于2
+     */
+    private Integer payAmount;
+    /**
+     * double支付金额,单位元
+     */
+    private Double AllPay;
+    /**
+     * 支付方式,
+     * 银联:UNIONPAY,
+     * 微信:WEIXIN,
+     * 支付宝:ALIPAY,
+     * 银联转账:TRANSFER
+     */
+    private String payWay;
+    /**
+     * 支付类型(现阶段主要是区分微信支付)
+     * 微信小程序支付: MINIAPP_WEIXIN
+     * 微信公众号支付: JSAPI_WEIXIN
+     */
+    private String payType;
+    /**
+     * 微信小程序code,微信小程序支付使用
+     */
+    private String code;
+    /**
+     * 微信公众号state参数
+     */
+    private String state;
+    /**
+     * 页面回调地址
+     */
+    private String returnUrl;
+    /**
+     * 微信openId
+     */
+    private String openId;
+    /**
+     * 异步通知回调
+     */
+    private String notifyUrl;
+    /**
+     * 银行编码(银联支付使用)
+     */
+    private String bankCode;
+    /**
+     * 用户类型(银联支付使用)
+     * 企业:ENTERPRISE
+     * 个人:USER
+     */
+    private String userType;
+    /**
+     * 购买优惠券id
+     */
+    private Integer couponId;
+    /**
+     *  1小程序 2网站
+     */
+    private Integer source;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Double getAllPay() {
+        return AllPay;
+    }
+
+    public void setAllPay(Double allPay) {
+        AllPay = allPay;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getVipRecordId() {
+        return vipRecordId;
+    }
+
+    public void setVipRecordId(Integer vipRecordId) {
+        this.vipRecordId = vipRecordId;
+    }
+
+    public Integer getCouponRecordId() {
+        return couponRecordId;
+    }
+
+    public void setCouponRecordId(Integer couponRecordId) {
+        this.couponRecordId = couponRecordId;
+    }
+
+    public Integer getVipId() {
+        return vipId;
+    }
+
+    public void setVipId(Integer vipId) {
+        this.vipId = vipId;
+    }
+
+    public Integer getPayAmount() {
+        return payAmount;
+    }
+
+    public void setPayAmount(Integer payAmount) {
+        this.payAmount = payAmount;
+    }
+
+    public String getPayWay() {
+        return payWay;
+    }
+
+    public void setPayWay(String payWay) {
+        this.payWay = payWay;
+    }
+
+    public String getPayType() {
+        return payType;
+    }
+
+    public void setPayType(String payType) {
+        this.payType = payType;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getReturnUrl() {
+        return returnUrl;
+    }
+
+    public void setReturnUrl(String returnUrl) {
+        this.returnUrl = returnUrl;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getBankCode() {
+        return bankCode;
+    }
+
+    public void setBankCode(String bankCode) {
+        this.bankCode = bankCode;
+    }
+
+    public String getUserType() {
+        return userType;
+    }
+
+    public void setUserType(String userType) {
+        this.userType = userType;
+    }
+
+    public Integer getCouponId() {
+        return couponId;
+    }
+
+    public void setCouponId(Integer couponId) {
+        this.couponId = couponId;
+    }
+
+    public Integer getSource() {
+        return source;
+    }
+
+    public void setSource(Integer source) {
+        this.source = source;
+    }
+}

+ 310 - 0
src/main/java/com/caimei/modules/order/entity/PayShopPo.java

@@ -0,0 +1,310 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/8/3
+ */
+
+public class PayShopPo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+
+    /**
+     * 付款单名称
+     */
+    private String name;
+
+    /**
+     * 付款账号的户名
+     */
+    private String bankAccountName;
+
+    /**
+     * 付款账号
+     */
+    private String bankAccount;
+
+    /**
+     * 付款账号的开户行
+     */
+    private String bankName;
+
+    /**
+     *  付款账号的类型 0公账, 1私账
+     */
+    private Integer type;
+
+    /**
+     * 付供应商总金额
+     */
+    private Double totalAmount;
+
+    /**
+     * 余额支付
+     */
+    private Double balancePayFee;
+
+    /**
+     * 转账支付
+     */
+    private Double transferPayFee;
+
+    /**
+     * 付款方式 1建设银行7297, 2中信银行0897, 3中信银行7172, 4广发银行0115, 5广发银行5461,6线上分账
+     */
+    private Integer payType;
+
+    /**
+     * 付款抹平金额(总)
+     */
+    private Double wipePayment;
+
+    /**
+     * 付款抹平备注(文字)
+     */
+    private String wipeRemarks;
+
+    /**
+     * 付款抹平备注(图片),以"##"隔开
+     */
+    private String wipeRemarkImages;
+
+    /**
+     * 抹平申请时间
+     */
+    private String wipeTime;
+
+    /**
+     * 申请人ID
+     */
+    private Integer applicant;
+
+    /**
+     * 申请时间
+     */
+    private String applyTime;
+
+    /**
+     * 审核人ID
+     */
+    private Integer reviewer;
+
+    /**
+     * 审核时间
+     */
+    private String reviewTime;
+
+    /**
+     * 付款时间
+     */
+    private String payTime;
+
+    /**
+     * 审核状态  0待审核,  1审核通过  2审核不通过
+     */
+    private Integer status;
+
+    /**
+     * 审核不通过原因
+     */
+    private String reason;
+
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private Integer delFlag;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getBankAccountName() {
+        return bankAccountName;
+    }
+
+    public void setBankAccountName(String bankAccountName) {
+        this.bankAccountName = bankAccountName;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Double getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(Double totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public Double getBalancePayFee() {
+        return balancePayFee;
+    }
+
+    public void setBalancePayFee(Double balancePayFee) {
+        this.balancePayFee = balancePayFee;
+    }
+
+    public Double getTransferPayFee() {
+        return transferPayFee;
+    }
+
+    public void setTransferPayFee(Double transferPayFee) {
+        this.transferPayFee = transferPayFee;
+    }
+
+    public Integer getPayType() {
+        return payType;
+    }
+
+    public void setPayType(Integer payType) {
+        this.payType = payType;
+    }
+
+    public Double getWipePayment() {
+        return wipePayment;
+    }
+
+    public void setWipePayment(Double wipePayment) {
+        this.wipePayment = wipePayment;
+    }
+
+    public String getWipeRemarks() {
+        return wipeRemarks;
+    }
+
+    public void setWipeRemarks(String wipeRemarks) {
+        this.wipeRemarks = wipeRemarks;
+    }
+
+    public String getWipeRemarkImages() {
+        return wipeRemarkImages;
+    }
+
+    public void setWipeRemarkImages(String wipeRemarkImages) {
+        this.wipeRemarkImages = wipeRemarkImages;
+    }
+
+    public String getWipeTime() {
+        return wipeTime;
+    }
+
+    public void setWipeTime(String wipeTime) {
+        this.wipeTime = wipeTime;
+    }
+
+    public Integer getApplicant() {
+        return applicant;
+    }
+
+    public void setApplicant(Integer applicant) {
+        this.applicant = applicant;
+    }
+
+    public String getApplyTime() {
+        return applyTime;
+    }
+
+    public void setApplyTime(String applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    public Integer getReviewer() {
+        return reviewer;
+    }
+
+    public void setReviewer(Integer reviewer) {
+        this.reviewer = reviewer;
+    }
+
+    public String getReviewTime() {
+        return reviewTime;
+    }
+
+    public void setReviewTime(String reviewTime) {
+        this.reviewTime = reviewTime;
+    }
+
+    public String getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(String payTime) {
+        this.payTime = payTime;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+}

+ 145 - 0
src/main/java/com/caimei/modules/order/entity/PayShopRecordPo.java

@@ -0,0 +1,145 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/8/3
+ */
+
+public class PayShopRecordPo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 子订单ID
+     */
+    private Integer shopOrderId;
+    /**
+     * 子订单编号
+     */
+    private String shopOrderNo;
+    /**
+     * 付款金额
+     */
+    private Double payAmount;
+    /**
+     * 付款抹平金额
+     */
+    private Double wipePayment;
+    /**
+     * 付款方式 1建设银行7297, 2中信银行0897, 3中信银行7172, 4广发银行0115, 5广发银行5461,6线上分账
+     */
+    private Integer payType;
+    /**
+     * 付款时间
+     */
+    private String payTime;
+    /**
+     * 付款单表id
+     */
+    private Integer payShopId;
+    /**
+     * 0待审核, 1审核通过, 2审核不通过
+     */
+    private Integer status;
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private Integer delFlag;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public String getShopOrderNo() {
+        return shopOrderNo;
+    }
+
+    public void setShopOrderNo(String shopOrderNo) {
+        this.shopOrderNo = shopOrderNo;
+    }
+
+    public Double getPayAmount() {
+        return payAmount;
+    }
+
+    public void setPayAmount(Double payAmount) {
+        this.payAmount = payAmount;
+    }
+
+    public Double getWipePayment() {
+        return wipePayment;
+    }
+
+    public void setWipePayment(Double wipePayment) {
+        this.wipePayment = wipePayment;
+    }
+
+    public Integer getPayType() {
+        return payType;
+    }
+
+    public void setPayType(Integer payType) {
+        this.payType = payType;
+    }
+
+    public String getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(String payTime) {
+        this.payTime = payTime;
+    }
+
+    public Integer getPayShopId() {
+        return payShopId;
+    }
+
+    public void setPayShopId(Integer payShopId) {
+        this.payShopId = payShopId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+}

+ 21 - 0
src/main/java/com/caimei/modules/order/entity/ProductType.java

@@ -0,0 +1,21 @@
+package com.caimei.modules.order.entity;
+
+public enum ProductType {
+
+    APPPAY("扫码"),
+    ONLINE("网银"),
+    QUICKPAY("快捷"),
+
+
+
+    ;
+    private final String desc;
+
+    ProductType(String desc) {
+        this.desc = desc;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 78 - 0
src/main/java/com/caimei/modules/order/entity/PromotionPriceVo.java

@@ -0,0 +1,78 @@
+package com.caimei.modules.order.entity;
+
+import java.io.Serializable;
+
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+public class PromotionPriceVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 促销Id
+     */
+    private Integer promotionsId;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 购买数量
+     */
+    private Integer number;
+    /**
+     * 价格
+     */
+    private Double price;
+    /**
+     * 划线价
+     */
+    private Double originalPrice;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getPromotionsId() {
+        return promotionsId;
+    }
+
+    public void setPromotionsId(Integer promotionsId) {
+        this.promotionsId = promotionsId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public Double getOriginalPrice() {
+        return originalPrice;
+    }
+
+    public void setOriginalPrice(Double originalPrice) {
+        this.originalPrice = originalPrice;
+    }
+}

+ 239 - 0
src/main/java/com/caimei/modules/order/entity/PromotionsVo.java

@@ -0,0 +1,239 @@
+package com.caimei.modules.order.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+public class PromotionsVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 活动可见度, 1所有人,2仅对机构
+     */
+    private Integer seen;
+    /**
+     * 是否支持叠加优惠,1支持,2不支持
+     */
+    private Integer discount;
+    /**
+     * 促销id
+     */
+    private Integer id;
+    /**
+     * 促销名称
+     */
+    private String name;
+    /**
+     * 促销描述
+     */
+    private String description;
+    /**
+     * 分类: 1单品促销,2凑单促销,3店铺促销
+     */
+    private Integer type;
+    /**
+     * 促销方式:1优惠,2满减,3满赠
+     */
+    private Integer mode;
+    /**
+     * 优惠价/满减/满赠的设定价格(如满999赠商品)
+     */
+    private Double touchPrice;
+    /**
+     * 减免价格
+     */
+    private Double reducedPrice;
+    /**
+     * 时效:1永久,2区间过期,其它无效
+     */
+    private Integer status;
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 店铺id(店铺促销时供应商ID)
+     */
+    private Integer shopId;
+    /**
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date beginTime;
+    /**
+     * 截止时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+    /**
+     * 该优惠下(该购物车商品)价格列表
+     */
+    private List<PromotionPriceVo> productList;
+    /**
+     * 该优惠下赠品
+     */
+    private List<CartItemVo> giftList;
+    /**
+     * 主订单id(保存订单促销用)
+     */
+    private Integer orderId;
+    /**
+     * 促销id(保存订单促销用)
+     */
+    private Integer promotionsId;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getSeen() {
+        return seen;
+    }
+
+    public void setSeen(Integer seen) {
+        this.seen = seen;
+    }
+
+    public Integer getDiscount() {
+        return discount;
+    }
+
+    public void setDiscount(Integer discount) {
+        this.discount = discount;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getMode() {
+        return mode;
+    }
+
+    public void setMode(Integer mode) {
+        this.mode = mode;
+    }
+
+    public Double getTouchPrice() {
+        return touchPrice;
+    }
+
+    public void setTouchPrice(Double touchPrice) {
+        this.touchPrice = touchPrice;
+    }
+
+    public Double getReducedPrice() {
+        return reducedPrice;
+    }
+
+    public void setReducedPrice(Double reducedPrice) {
+        this.reducedPrice = reducedPrice;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Date getBeginTime() {
+        return beginTime;
+    }
+
+    public void setBeginTime(Date beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public List<PromotionPriceVo> getProductList() {
+        return productList;
+    }
+
+    public void setProductList(List<PromotionPriceVo> productList) {
+        this.productList = productList;
+    }
+
+    public List<CartItemVo> getGiftList() {
+        return giftList;
+    }
+
+    public void setGiftList(List<CartItemVo> giftList) {
+        this.giftList = giftList;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getPromotionsId() {
+        return promotionsId;
+    }
+
+    public void setPromotionsId(Integer promotionsId) {
+        this.promotionsId = promotionsId;
+    }
+}

+ 18 - 0
src/main/java/com/caimei/modules/order/entity/ReceiptOrderInfoVo.java

@@ -18,6 +18,8 @@ public class ReceiptOrderInfoVo {
     private String orderTime;//下单时间
     private String relationType;        // 关系类型:1返佣订单(返佣款或供应商退款)、2非返佣订单(订单款或者非订单款)、3超级会员款
     private Integer userID;     //订单用户id
+    private Integer onlinePayFlag;      // 是否能走线上支付:0可以,1不可以
+    private List<NewShopOrder> shopOrderInfos;  // 子订单信息
 
     //----------------返佣款项   是根据子订单再去关联的主订单
     private String shopOrderNo;
@@ -199,4 +201,20 @@ public class ReceiptOrderInfoVo {
     public void setRefundsAmount(Double refundsAmount) {
         this.refundsAmount = refundsAmount;
     }
+
+    public Integer getOnlinePayFlag() {
+        return onlinePayFlag;
+    }
+
+    public void setOnlinePayFlag(Integer onlinePayFlag) {
+        this.onlinePayFlag = onlinePayFlag;
+    }
+
+    public List<NewShopOrder> getShopOrderInfos() {
+        return shopOrderInfos;
+    }
+
+    public void setShopOrderInfos(List<NewShopOrder> shopOrderInfos) {
+        this.shopOrderInfos = shopOrderInfos;
+    }
 }

+ 1 - 18
src/main/java/com/caimei/modules/order/entity/ReceiptRecordVo.java

@@ -34,29 +34,12 @@ public class ReceiptRecordVo {
     private Double orderReceivedAmount;//订单已收金额(此收款只计算线上线下收款记录表金额)
     private Double returnBalanceAmount;// 退款余额金额
     private String associationType;//订单关联方式: 1手动 2自动
-    private Double userMoney;
-    private Double onlineMoney;
+
     /**
      * 米花科技平台唯一流水号
      */
     private String mbOrderId;
 
-    public Double getUserMoney() {
-        return userMoney;
-    }
-
-    public void setUserMoney(Double userMoney) {
-        this.userMoney = userMoney;
-    }
-
-    public Double getOnlineMoney() {
-        return onlineMoney;
-    }
-
-    public void setOnlineMoney(Double onlineMoney) {
-        this.onlineMoney = onlineMoney;
-    }
-
     public String getMbOrderId() {
         return mbOrderId;
     }

+ 45 - 0
src/main/java/com/caimei/modules/order/entity/ShopOrderReturned.java

@@ -15,6 +15,11 @@ public class ShopOrderReturned {
     private Double productAmount;//总金额 = 订单商品totalAmount
     private String commercialCode;      //分账方,子商户商编
     private List<CmReturnedPurchaseProduct> cmReturnedPurchaseProductList;
+    private Integer shopReceiptStatus;      // 子订单收款状态:1待收款,2部分收款,3已收款
+    private Double eachDiscount;        // 分摊优惠金额
+    private Double receiptAmount;       // 已付金额
+    private Double restAmount;      // 待付金额
+    private Double realPay;     // 实际支付金额
 
     public String getShopName() {
         return shopName;
@@ -111,4 +116,44 @@ public class ShopOrderReturned {
     public void setCommercialCode(String commercialCode) {
         this.commercialCode = commercialCode;
     }
+
+    public Integer getShopReceiptStatus() {
+        return shopReceiptStatus;
+    }
+
+    public void setShopReceiptStatus(Integer shopReceiptStatus) {
+        this.shopReceiptStatus = shopReceiptStatus;
+    }
+
+    public Double getEachDiscount() {
+        return eachDiscount;
+    }
+
+    public void setEachDiscount(Double eachDiscount) {
+        this.eachDiscount = eachDiscount;
+    }
+
+    public Double getReceiptAmount() {
+        return receiptAmount;
+    }
+
+    public void setReceiptAmount(Double receiptAmount) {
+        this.receiptAmount = receiptAmount;
+    }
+
+    public Double getRestAmount() {
+        return restAmount;
+    }
+
+    public void setRestAmount(Double restAmount) {
+        this.restAmount = restAmount;
+    }
+
+    public Double getRealPay() {
+        return realPay;
+    }
+
+    public void setRealPay(Double realPay) {
+        this.realPay = realPay;
+    }
 }

+ 560 - 0
src/main/java/com/caimei/modules/order/entity/ShopOrderVo.java

@@ -0,0 +1,560 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/20
+ */
+public class ShopOrderVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 子订单ID
+     */
+    private Integer shopOrderId;
+    /**
+     * 子订单编号
+     */
+    private String shopOrderNo;
+    /**
+     * 订单号
+     */
+    private Integer orderId;
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 供应商logo
+     */
+    private String shopLogo;
+    /**
+     * 子订单备注信息
+     */
+    private String note;
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+    /**
+     * 购买机构Id
+     */
+    private Integer clubId;
+    /**
+     * 协销Id
+     */
+    private Integer spId;
+    /**
+     * 订单促销id(店铺促销)
+     */
+    private Integer orderPromotionsId;
+    /**
+     * 促销满减优惠(店铺促销)
+     */
+    private Double promotionFullReduction;
+    /**
+     * 超级会员优惠
+     */
+    private Double svipShopReduction;
+    /**
+     * (付款供应商)付款状态:1待付款、2部分付款、3已付款
+     */
+    private Integer payStatus;
+    /**
+     * 已付款金额
+     */
+    private Double payedShopAmount;
+    /**
+     * 佣金 =  应付采美
+     */
+    private Double brokerage;
+    /**
+     * 可退款金额 = 余额抵扣金额
+     */
+    private Double canRefundAmount;
+    /**
+     * 购买数量
+     */
+    private Integer itemCount;
+    /**
+     * 总价 = totalFee
+     */
+    private Double totalAmount;
+    /**
+     * 总金额 = 订单商品totalAmount
+     */
+    private Double productAmount;
+    /**
+     * 需要支付金额 shouldPayFee +运费
+     */
+    private Double needPayAmount;
+    /**
+     * 付供应商 商品费=成本价*(购买数量  + 赠品数量)
+     */
+    private Double shopProductAmount;
+    /**
+     * 付供应商 运费
+     */
+    private Double shopPostFee;
+    /**
+     * 付供应商税费
+     */
+    private Double shopTaxFee;
+    /**
+     * 付供应商 = 商品费 + 运费 + 税费
+     */
+    private Double shouldPayShopAmount;
+    /**
+     * 已经发货的商品数量
+     */
+    private Integer outStoreNum;
+    /**
+     * 子订单发货批次 默认值 = 0 即没过发货
+     */
+    private Integer outStoreTimes;
+    /**
+     * 发货状态:1待发货、2部分发货、3已发货
+     */
+    private Integer sendOutStatus;
+    /**
+     * 赠品数
+     */
+    private Integer presentNum;
+    /**
+     * 订单提交时间
+     */
+    private String orderTime;
+    /**
+     * 0:个人自己下单 1:企业自己下单 2:员工帮会所下单 3:协销帮会所下单  4:后台下单 5:采美豆订单
+     */
+    private Integer orderSubmitType;
+    /**
+     * 订单能否拆分 1 为可拆分, 0为不可拆分
+     */
+    private Integer splitFlag;
+    /**
+     * 付第三方
+     */
+    private Double shopOtherFee;
+    /**
+     * 子订单店铺促销活动
+     */
+    private PromotionsVo shopPromotion;
+    /**
+     * 订单商品信息
+     */
+    private List<OrderProductVo> orderProductList;
+    /**
+     * 发货物流记录
+     */
+    private List<LogisticsRecordVo> logisticsRecordList;
+    /**
+     * 收货地址
+     */
+    private OrderUserinfoVo userInfo;
+    /**
+     * (收款买家)收款状态:1待收款、2部分收款、3已收款
+     */
+    private Integer receiptStatus;
+    /**
+     * 供应商已退金额
+     */
+    private BigDecimal shopRefundAmount;
+    /**
+     * 存在退款中的记录 (0:否,1:是)
+     */
+    private String haveReturning;
+    /**
+     * 子订单返佣标识
+     */
+    private Integer receiptedFlag;
+    /**
+     * 返佣类型 10口头返佣   1或者其他值都是返佣
+     */
+    private Integer receiptedType;
+    /**
+     * 返佣订单关联页面展示用
+     */
+    private OrderVo mainOrder;
+    /**
+     * 子订单绑定的付款商户号
+     */
+    private String splitCode;
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public String getShopOrderNo() {
+        return shopOrderNo;
+    }
+
+    public void setShopOrderNo(String shopOrderNo) {
+        this.shopOrderNo = shopOrderNo;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public String getShopLogo() {
+        return shopLogo;
+    }
+
+    public void setShopLogo(String shopLogo) {
+        this.shopLogo = shopLogo;
+    }
+
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getClubId() {
+        return clubId;
+    }
+
+    public void setClubId(Integer clubId) {
+        this.clubId = clubId;
+    }
+
+    public Integer getSpId() {
+        return spId;
+    }
+
+    public void setSpId(Integer spId) {
+        this.spId = spId;
+    }
+
+    public Integer getOrderPromotionsId() {
+        return orderPromotionsId;
+    }
+
+    public void setOrderPromotionsId(Integer orderPromotionsId) {
+        this.orderPromotionsId = orderPromotionsId;
+    }
+
+    public Double getPromotionFullReduction() {
+        return promotionFullReduction;
+    }
+
+    public void setPromotionFullReduction(Double promotionFullReduction) {
+        this.promotionFullReduction = promotionFullReduction;
+    }
+
+    public Double getSvipShopReduction() {
+        return svipShopReduction;
+    }
+
+    public void setSvipShopReduction(Double svipShopReduction) {
+        this.svipShopReduction = svipShopReduction;
+    }
+
+    public Integer getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(Integer payStatus) {
+        this.payStatus = payStatus;
+    }
+
+    public Double getPayedShopAmount() {
+        return payedShopAmount;
+    }
+
+    public void setPayedShopAmount(Double payedShopAmount) {
+        this.payedShopAmount = payedShopAmount;
+    }
+
+    public Double getBrokerage() {
+        return brokerage;
+    }
+
+    public void setBrokerage(Double brokerage) {
+        this.brokerage = brokerage;
+    }
+
+    public Double getCanRefundAmount() {
+        return canRefundAmount;
+    }
+
+    public void setCanRefundAmount(Double canRefundAmount) {
+        this.canRefundAmount = canRefundAmount;
+    }
+
+    public Integer getItemCount() {
+        return itemCount;
+    }
+
+    public void setItemCount(Integer itemCount) {
+        this.itemCount = itemCount;
+    }
+
+    public Double getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(Double totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public Double getProductAmount() {
+        return productAmount;
+    }
+
+    public void setProductAmount(Double productAmount) {
+        this.productAmount = productAmount;
+    }
+
+    public Double getNeedPayAmount() {
+        return needPayAmount;
+    }
+
+    public void setNeedPayAmount(Double needPayAmount) {
+        this.needPayAmount = needPayAmount;
+    }
+
+    public Double getShopProductAmount() {
+        return shopProductAmount;
+    }
+
+    public void setShopProductAmount(Double shopProductAmount) {
+        this.shopProductAmount = shopProductAmount;
+    }
+
+    public Double getShopPostFee() {
+        return shopPostFee;
+    }
+
+    public void setShopPostFee(Double shopPostFee) {
+        this.shopPostFee = shopPostFee;
+    }
+
+    public Double getShopTaxFee() {
+        return shopTaxFee;
+    }
+
+    public void setShopTaxFee(Double shopTaxFee) {
+        this.shopTaxFee = shopTaxFee;
+    }
+
+    public Double getShouldPayShopAmount() {
+        return shouldPayShopAmount;
+    }
+
+    public void setShouldPayShopAmount(Double shouldPayShopAmount) {
+        this.shouldPayShopAmount = shouldPayShopAmount;
+    }
+
+    public Integer getOutStoreNum() {
+        return outStoreNum;
+    }
+
+    public void setOutStoreNum(Integer outStoreNum) {
+        this.outStoreNum = outStoreNum;
+    }
+
+    public Integer getOutStoreTimes() {
+        return outStoreTimes;
+    }
+
+    public void setOutStoreTimes(Integer outStoreTimes) {
+        this.outStoreTimes = outStoreTimes;
+    }
+
+    public Integer getSendOutStatus() {
+        return sendOutStatus;
+    }
+
+    public void setSendOutStatus(Integer sendOutStatus) {
+        this.sendOutStatus = sendOutStatus;
+    }
+
+    public Integer getPresentNum() {
+        return presentNum;
+    }
+
+    public void setPresentNum(Integer presentNum) {
+        this.presentNum = presentNum;
+    }
+
+    public String getOrderTime() {
+        return orderTime;
+    }
+
+    public void setOrderTime(String orderTime) {
+        this.orderTime = orderTime;
+    }
+
+    public Integer getOrderSubmitType() {
+        return orderSubmitType;
+    }
+
+    public void setOrderSubmitType(Integer orderSubmitType) {
+        this.orderSubmitType = orderSubmitType;
+    }
+
+    public Integer getSplitFlag() {
+        return splitFlag;
+    }
+
+    public void setSplitFlag(Integer splitFlag) {
+        this.splitFlag = splitFlag;
+    }
+
+    public Double getShopOtherFee() {
+        return shopOtherFee;
+    }
+
+    public void setShopOtherFee(Double shopOtherFee) {
+        this.shopOtherFee = shopOtherFee;
+    }
+
+    public PromotionsVo getShopPromotion() {
+        return shopPromotion;
+    }
+
+    public void setShopPromotion(PromotionsVo shopPromotion) {
+        this.shopPromotion = shopPromotion;
+    }
+
+    public List<OrderProductVo> getOrderProductList() {
+        return orderProductList;
+    }
+
+    public void setOrderProductList(List<OrderProductVo> orderProductList) {
+        this.orderProductList = orderProductList;
+    }
+
+    public List<LogisticsRecordVo> getLogisticsRecordList() {
+        return logisticsRecordList;
+    }
+
+    public void setLogisticsRecordList(List<LogisticsRecordVo> logisticsRecordList) {
+        this.logisticsRecordList = logisticsRecordList;
+    }
+
+    public OrderUserinfoVo getUserInfo() {
+        return userInfo;
+    }
+
+    public void setUserInfo(OrderUserinfoVo userInfo) {
+        this.userInfo = userInfo;
+    }
+
+    public Integer getReceiptStatus() {
+        return receiptStatus;
+    }
+
+    public void setReceiptStatus(Integer receiptStatus) {
+        this.receiptStatus = receiptStatus;
+    }
+
+    public BigDecimal getShopRefundAmount() {
+        return shopRefundAmount;
+    }
+
+    public void setShopRefundAmount(BigDecimal shopRefundAmount) {
+        this.shopRefundAmount = shopRefundAmount;
+    }
+
+    public String getHaveReturning() {
+        return haveReturning;
+    }
+
+    public void setHaveReturning(String haveReturning) {
+        this.haveReturning = haveReturning;
+    }
+
+    public Integer getReceiptedFlag() {
+        return receiptedFlag;
+    }
+
+    public void setReceiptedFlag(Integer receiptedFlag) {
+        this.receiptedFlag = receiptedFlag;
+    }
+
+    public Integer getReceiptedType() {
+        return receiptedType;
+    }
+
+    public void setReceiptedType(Integer receiptedType) {
+        this.receiptedType = receiptedType;
+    }
+
+    public OrderVo getMainOrder() {
+        return mainOrder;
+    }
+
+    public void setMainOrder(OrderVo mainOrder) {
+        this.mainOrder = mainOrder;
+    }
+}

+ 221 - 0
src/main/java/com/caimei/modules/order/entity/SplitAccountPo.java

@@ -0,0 +1,221 @@
+package com.caimei.modules.order.entity;
+
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/8/3
+ */
+public class SplitAccountPo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+    /**
+     * 主订单id
+     */
+    private Integer orderId;
+    /**
+     * 子订单Id
+     */
+    private Integer shopOrderId;
+    /**
+     * 商品id,仅对二手发布商品
+     */
+    private Integer productId;
+    /**
+     * 订单商品id
+     */
+    private Integer orderProductId;
+    /**
+     * 供应商id
+     */
+    private Integer shopId;
+    /**
+     * 超级会员套餐id
+     */
+    private Integer vipRecordId;
+    /**
+     * 优惠券购买记录id
+     */
+    private Integer couponRecordId;
+    /**
+     * 认证通会员购买记录id
+     */
+    private Integer authVipRecordId;
+    /**
+     * 分账类型:1公账-专票,2私账-无票,3公账-普票,4供应商子商户,5佣金账户
+     */
+    private Integer type;
+    /**
+     * 子商户商编
+     */
+    private String subUserNo;
+    /**
+     * 分账金额
+     */
+    private Double splitAccount;
+    /**
+     * 米花科技平台唯一流水号
+     */
+    private String mbOrderId;
+    /**
+     * 商户唯一订单请求号(订单编号#随机时间戳)
+     */
+    private String orderRequestNo;
+    /**
+     * 付款状态,0待付,1付款成功
+     */
+    private Integer payStatus;
+    /**
+     * 商品类型:1商品成本,2供应商运费,3佣金,4二手发布
+     */
+    private Integer productType;
+    /**
+     * 分账时间
+     */
+    private Date splitTime;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getOrderProductId() {
+        return orderProductId;
+    }
+
+    public void setOrderProductId(Integer orderProductId) {
+        this.orderProductId = orderProductId;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Integer getVipRecordId() {
+        return vipRecordId;
+    }
+
+    public void setVipRecordId(Integer vipRecordId) {
+        this.vipRecordId = vipRecordId;
+    }
+
+    public Integer getCouponRecordId() {
+        return couponRecordId;
+    }
+
+    public void setCouponRecordId(Integer couponRecordId) {
+        this.couponRecordId = couponRecordId;
+    }
+
+    public Integer getAuthVipRecordId() {
+        return authVipRecordId;
+    }
+
+    public void setAuthVipRecordId(Integer authVipRecordId) {
+        this.authVipRecordId = authVipRecordId;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getSubUserNo() {
+        return subUserNo;
+    }
+
+    public void setSubUserNo(String subUserNo) {
+        this.subUserNo = subUserNo;
+    }
+
+    public Double getSplitAccount() {
+        return splitAccount;
+    }
+
+    public void setSplitAccount(Double splitAccount) {
+        this.splitAccount = splitAccount;
+    }
+
+    public String getMbOrderId() {
+        return mbOrderId;
+    }
+
+    public void setMbOrderId(String mbOrderId) {
+        this.mbOrderId = mbOrderId;
+    }
+
+    public String getOrderRequestNo() {
+        return orderRequestNo;
+    }
+
+    public void setOrderRequestNo(String orderRequestNo) {
+        this.orderRequestNo = orderRequestNo;
+    }
+
+    public Integer getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(Integer payStatus) {
+        this.payStatus = payStatus;
+    }
+
+    public Integer getProductType() {
+        return productType;
+    }
+
+    public void setProductType(Integer productType) {
+        this.productType = productType;
+    }
+
+    public Date getSplitTime() {
+        return splitTime;
+    }
+
+    public void setSplitTime(Date splitTime) {
+        this.splitTime = splitTime;
+    }
+}

+ 10 - 14
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -156,12 +156,22 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
                         BigDecimal refundsAmount = MathUtil.add(roi.getRefundsAmount(), shopRefundAmount);
                         roi.setRefundsAmount(refundsAmount.doubleValue());*/
                     }
+                    if (0 == roi.getOnlinePayFlag()) {
+                        // 可以线上支付,查询子订单信息
+                        List<NewShopOrder> shopOrderInfos = cmDiscernReceiptDao.getShopOrderInfos(relation.getOrderID(), null);
+                        roi.setShopOrderInfos(shopOrderInfos);
+                    }
                 }
             }
             if ("2".equals(relation.getRelationType())) { // relation.orderID 指的是主订单id
                 roi = cmDiscernReceiptDao.getOrderInfoByOrderID(relation.getOrderID());
                 if (null != roi) {
                     roi.setRelationType("2");
+                    if (0 == roi.getOnlinePayFlag()) {
+                        // 可以线上支付,查询子订单信息
+                        List<NewShopOrder> shopOrderInfos = cmDiscernReceiptDao.getShopOrderInfos(null, relation.getOrderID());
+                        roi.setShopOrderInfos(shopOrderInfos);
+                    }
                 }
             }
             if (null != roi) {
@@ -177,20 +187,6 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
                         //统计当前已收
                         double associateAmount = cmDiscernReceiptDao.getAssociateAmount(String.valueOf(roi.getOrderID()));
                         v.setOrderReceivedAmount(associateAmount);
-                        if ("16".equals(cmDiscernReceiptDao.findType(relation.getReceiptID()))) {
-                            Double userMoney = cmDiscernReceiptDao.findUserMoney(roi.getOrderID());
-                            Double onlineMoney = cmDiscernReceiptDao.findOnlineMoney(roi.getOrderID());
-                            if (null == onlineMoney) {
-                                v.setOnlineMoney(0d);
-                            } else {
-                                v.setOnlineMoney(onlineMoney);
-                            }
-                            if (null == userMoney) {
-                                v.setUserMoney(0d);
-                            } else {
-                                v.setUserMoney(userMoney);
-                            }
-                        }
                     }
                 }
                 //一个订单又包含了多个收款记录

+ 1 - 0
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -64,6 +64,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
     @Resource
     private CmRefundShopDao cmRefundShopDao;
 
+
     public List<CmPayShop> exports(Page<CmPayShop> cmPayShopPage, CmPayShop cmPayShop) {
         Page<CmPayShop> result = super.findPage(cmPayShopPage, cmPayShop);
         List<CmPayShop> list = result.getList();

+ 197 - 216
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.service;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.modules.coupon.dao.CmCouponClubDao;
 import com.caimei.modules.coupon.entity.CmCouponClub;
@@ -7,8 +8,7 @@ import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
 import com.caimei.modules.miniprogram.utils.DateUtils;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
-import com.caimei.modules.order.utils.NewOrderStatus;
-import com.caimei.modules.order.utils.PayUtils;
+import com.caimei.modules.order.utils.*;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.CmSecondHandDetailDao;
 import com.caimei.modules.product.entity.CmPromotion;
@@ -22,23 +22,32 @@ import com.caimei.modules.user.entity.UserBeansHistory;
 import com.caimei.modules.user.service.CmUserBalanceRecordService;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
+import com.google.common.util.concurrent.AtomicDouble;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
+import org.apache.commons.httpclient.HttpStatus;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 import static com.caimei.modules.miniprogram.utils.UploadPicUtils.saveImageToServer;
 
@@ -52,6 +61,11 @@ import static com.caimei.modules.miniprogram.utils.UploadPicUtils.saveImageToSer
 @Transactional(readOnly = true)
 public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao, CmReturnedPurchase> {
 
+    public static OkHttpClient client = new OkHttpClient.Builder()
+            .connectTimeout(3, TimeUnit.SECONDS)
+            .readTimeout(20, TimeUnit.SECONDS)
+            .build();
+
     @Resource
     private CmReturnedPurchaseDao cmReturnedPurchaseDao;
     @Resource
@@ -264,7 +278,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 return fee;
             } else if (newOrder.getReceiptStatus().equals("2")) {//部分收款(全退部分收款的金额)--运费可以选择退或不退
                 Double freight = newOrder.getFreight();/** 默认不退*/
-                if (freightNum > 0) {/**退运费*/
+                if (freightNum >= 0) {/**退运费*/
                     freight = 0d;
                 }
                 //获取部分支付金额
@@ -335,7 +349,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                     CmReturnedPurchaseProduct purchaseProduct = new CmReturnedPurchaseProduct();
                     purchaseProduct.setShopOrderID(item.getShopOrderID());
 //                    purchaseProduct.setOrderProductID(item.getOrderProductID());
-                    purchaseProduct.setOrderProductID(item.getOrderProductID());
+                    purchaseProduct.setProductID(item.getProductID());
                     List<CmReturnedPurchaseProduct> cmReturnedPurchaseProductList = cmReturnedPurchaseProductDao.getCmReturnedPurchaseProductList(purchaseProduct);
                     if (CollectionUtils.isNotEmpty(cmReturnedPurchaseProductList)) {
                         for (CmReturnedPurchaseProduct c : cmReturnedPurchaseProductList) {
@@ -389,6 +403,12 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                             shopOrderReturned.setPayStatus(shopOrder.getPayStatus());
                             shopOrderReturned.setSendOutStatus(shopOrder.getSendOutStatus());
                             shopOrderReturned.setShopOrderNo(shopOrder.getShopOrderNo());
+                            shopOrderReturned.setShopReceiptStatus(shopOrder.getShopReceiptStatus());
+                            shopOrderReturned.setNeedPayAmount(shopOrder.getNeedPayAmount());
+                            shopOrderReturned.setEachDiscount(shopOrder.getEachDiscount());
+                            shopOrderReturned.setRealPay(shopOrder.getRealPay());
+                            shopOrderReturned.setReceiptAmount(shopOrder.getReceiptAmount());
+                            shopOrderReturned.setRestAmount(shopOrder.getRestAmount());
                         }
                     }
                     shopOrderReturnedList.add(shopOrderReturned);
@@ -450,7 +470,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
         return newOrder;
     }
 
-    @Transactional(readOnly = false)
+    @Transactional(readOnly = false, rollbackFor = Exception.class)
     public void confirmApply(CmReturnedPurchase cmReturnedPurchase, HttpServletRequest request) throws Exception {
         CmReturnedPurchase returnedPurchase = cmReturnedPurchaseDao.get(cmReturnedPurchase);
         if (returnedPurchase == null) {
@@ -543,86 +563,54 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
             }
             newOrderService.update(newOrder);
             //判断是否选择退回余额
-            //returnway=1,退线下余额>0或退线上余额>0  是定金订单???
-            //退账户线下余额
-            Double refundBalanceFee = null == returnedPurchase.getRefundBalanceFee() ? 0 : returnedPurchase.getRefundBalanceFee();
-            //退账户线上余额
-            Double refundOnlineBalanceFee = null == returnedPurchase.getRefundOnlineBalanceFee() ? 0 : returnedPurchase.getRefundOnlineBalanceFee();
-            if ((returnedPurchase.getReturnedWay().equals("1") && refundBalanceFee > 0d) || null != newOrder.getRechargeGoods() || refundOnlineBalanceFee > 0) {
+            if ((returnedPurchase.getReturnedWay().equals("1") && returnedPurchase.getRefundBalanceFee() > 0d) || newOrder.getRechargeGoods() != null) {
                 Double userMoney = user.getUserMoney();
                 Double ableUserMoney = user.getAbleUserMoney();
+                Double refundBalanceFee = returnedPurchase.getRefundBalanceFee();
                 Double refundFee = returnedPurchase.getRefundFee();
-                Double onlineMoney = user.getOnlineMoney();
-                userMoney = userMoney == null ? 0 : userMoney;
-                ableUserMoney = ableUserMoney == null ? 0 : ableUserMoney;
-                onlineMoney = onlineMoney == null ? 0 : onlineMoney;
+                if (userMoney == null) userMoney = 0d;
+                if (ableUserMoney == null) ableUserMoney = 0d;
+                if (refundBalanceFee == null) refundBalanceFee = 0d;
                 user.setUserID(newOrder.getUserID());
 
+                //添加余额收支记录
                 CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
-                cmUserBalanceRecord.setOrderId(newOrder.getOrderID());
-                cmUserBalanceRecord.setAddDate(new Date());
                 cmUserBalanceRecord.setUserId(newOrder.getUserID());
-                cmUserBalanceRecord.setDelFlag("0");
+                cmUserBalanceRecord.setType("1");
+                cmUserBalanceRecord.setBalanceType("3");
+                cmUserBalanceRecord.setAddDate(new Date());
+                //设置余额支付
+                cmUserBalanceRecord.setAmount(String.valueOf(returnedPurchase.getRefundBalanceFee()));
+                cmUserBalanceRecord.setOrderId(newOrder.getOrderID());
                 cmUserBalanceRecord.setReturnedId(Integer.parseInt(returnedPurchase.getId()));
-                //充值订金或者充值余额>0
-                //线上退回/线下退回扣减余额
+                cmUserBalanceRecord.setDelFlag("0");
+
                 if (newOrder.getRechargeGoods() != null) {
-                    String payType = cmReturnedPurchaseDao.findPayType(newOrder.getOrderID());
-                    //1线上2线下
-                    if ("1".equals(payType)) {
-                        user.setUserMoney(onlineMoney - refundFee);
-//                        user.setAbleUserMoney(ableUserMoney - refundFee);
-                        cmUserBalanceRecord.setAmount(String.valueOf(refundFee));
-                        cmUserBalanceRecord.setType("2");
-                        if (newOrder.getRechargeGoods() == 1) {
-                            cmUserBalanceRecord.setBalanceType("18");
-                        } else if (newOrder.getRechargeGoods() == 2) {
-                            cmUserBalanceRecord.setBalanceType("19");
-                        }
-                        cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                        cmUserDao.updateMoney(user);
-                    } else {
-                        user.setUserMoney(userMoney - refundFee);
-//                        user.setAbleUserMoney(ableUserMoney - refundFee);
-                        cmUserBalanceRecord.setAmount(String.valueOf(refundFee));
-                        cmUserBalanceRecord.setType("2");
-                        if (newOrder.getRechargeGoods() == 1) {
-                            cmUserBalanceRecord.setBalanceType("8");
-                        } else if (newOrder.getRechargeGoods() == 2) {
-                            cmUserBalanceRecord.setBalanceType("9");
-                        }
-                        cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                        cmUserDao.updateMoney(user);
+                    user.setUserMoney(userMoney - refundFee);
+                    cmUserBalanceRecord.setAmount(String.valueOf(refundFee));
+                    cmUserBalanceRecord.setType("2");
+                    if (newOrder.getRechargeGoods() == 1) {
+                        cmUserBalanceRecord.setBalanceType("8");
+                    } else if (newOrder.getRechargeGoods() == 2) {
+                        cmUserBalanceRecord.setBalanceType("9");
                     }
                 } else {
-                    cmUserBalanceRecord.setType("1");
                     user.setUserMoney(userMoney + refundBalanceFee);
-                    user.setOnlineMoney(onlineMoney + refundOnlineBalanceFee);
-                    user.setAbleUserMoney(ableUserMoney + refundBalanceFee + refundOnlineBalanceFee);
-                    if (refundBalanceFee > 0) {
-                        //添加线下余额收支记录
-                        cmUserBalanceRecord.setBalanceType("3");
-                        //设置余额支付
-                        cmUserBalanceRecord.setAmount(refundBalanceFee.toString());
-
-                        cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                    }
-                    if (refundOnlineBalanceFee > 0) {
-                        //添加线上余额收支记录
-                        cmUserBalanceRecord.setBalanceType("13");
-                        //设置余额支付
-                        cmUserBalanceRecord.setAmount(refundOnlineBalanceFee.toString());
-                        cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                    }
-                    cmUserDao.updateMoney(user);
+                    user.setAbleUserMoney(ableUserMoney + refundBalanceFee);
                 }
+                cmUserDao.updateMoney(user);
+                cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
             }
             //修改子订单信息
             updateShopOrderAmount(newOrder.getOrderID());
 
             //判断是否有线上退款
             if (returnedPurchase.getReturnedWay().equals("1") && returnedPurchase.getRefundOnlineFee() > 0) {
-                theOnlineRefund(returnedPurchase.getOrderID());
+                List<Integer> shopOrderIds = cmReturnedPurchaseDao.findReturnedShopOrder(returnedPurchase.getOrderID());
+                if (null == shopOrderIds || 0 == shopOrderIds.size()) {
+                    throw new Exception("退款子订单信息错误!");
+                }
+                theOnlineRefund(shopOrderIds);
             }
 
             //二手订单交易全退,标记未售
@@ -762,170 +750,163 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
     /**
      * 第三方线上退款
      *
-     * @param orderId
+     * @param shopOrderIds
      */
-    public void theOnlineRefund(Integer orderId) throws Exception {
-        //商户标识
-        String merAccount = "aa9aee6a148843a6a9e4ea117df4454b";
-        //私钥,商户密钥
-        String merKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAM0qCTZFdi1I59/Jeis+8KVhzSNhsRrKiOlHazIVyxNLzUQvFpWN5PlfVKlnJToorURTStfjAv01HD0Z4ZvMauuHhDT0bptiDln928Ld6SzX889X2nsCxl0Q+WzrkFsnT6gotvGnTeQGUgbBV3SQD3IUOwRwxoWYbrZqxtqHFxqRAgMBAAECgYEAvsHx9MMbAToDVmEXtXP8/lh0Cwy/RgDA0d30voni2pslTNtXbVCUcIUBy8y6oVvG1nt3YEmTsuiZy/nvehPT6GV1Gqj8T6lqWQ8KQKsDGlubvh23tzNM90me2TLZEPdNqC5CPRrwYrjght4BXgzu7s2+5FpeYCob1gVNi+w0Jz0CQQD0dXb9Oez+Ybnxb3rCghGWM6cxi8fsqk6MuKaleg53qfXrkgAVH78faeWzRaeSbVOh5+Z9kX5HUeynfM7E/f4nAkEA1tmnvJp4JQaouO1Trzbnkhowjea5daK/tDE8K0hIMHUjAw+c1QTteGOVGBFBHWPkUwkSCd2HKmk4URkp/snMhwJAO32+qF+Jclq8EqqLmHxo5UHKxX7793d2yD5Dp++tR6fgBiUwyfNA4tc1pEwmPLdIbBVwfUyEC70/N39jHoOlbwI/dX6SPJI9IgKCQp+HJEriWQP5iaCjy7E1JVXHkeP1lop4mzPukJAhTbUn1AGbmncGZmKPetWrFYZ1ReR9EtlJAkEA2kBmARWyOTt8fbikImuHr65M+BDgD+2fkuDb5+tqJljNmSqAIRRwcXj1Je6vkzlDJuSw3wlG6iliFtwe0cq7+w==";
-
-        //维沙商户标识
-        String wsMerAccount = "f8248975517a4feab79cac9d7d453663";
-        //维沙私钥,商户密钥
-        String wsMerKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAI4Rb9HBUbjzEsfCOWUsogq8pOoxcSGcL1WFQfqHY1Ul2UwVO5daQtS1pxyM8gKPvvcxNsxz5+wdzb7/cX+SewdF8GbTO2LQIMsOAvtQszsMW8+Hg3J3QFPCHUGh+Q//JXWTFu/GaIlBrpmc7qnB+OMmP315taf5vAmAxC7OzohlAgMBAAECgYBgDiwTn2j46uicxZZ28MmTBt9eNRWvyuE6KoJkuJuR26hjR8vl1rJvDW8y351V3AkbK1xIumlp/PC6ng4IWmrxgu9zuGu+qpb4BdcarS1RMcnpjynCKYO0BnMZBcFrKzWiD6IyZIlLIlJHIDC0mXI/x5V9zG9rL4Tkm4mQPRhzlQJBAPUPledDZXTp2ovvMdL7baI+QVs+tfBqdIdcCgSoEhFh2T/dNVMpBVIjH2D6jTwL94tvWRchMwjXNUSWTRYMH2sCQQCUaOjFeLhSI/gK+f/yXNX/wP6WjXFE9/vuNEaxuaYja2Ia8OwLYoFAYQvKrxLGoHkiI9qKGfqv2h91nF/w/ftvAkBCZA2NkNG8wdpGjO/no9xI1yrnqG6sCns1bLb+GfaDJQoxZiGbPQLHBOLsaBS5Ttiquujc/k6QN5Wj1kBeF7yvAkEAgvWcSfz/8YPJ8q2u3EhtknTUcze29xw5FHbO1y+yWlj8xjdIo7c1xQCd7inVUK70lVq8Etdf7mN1FUx7IOaOQwJAaAl8RFO8zXKy9CdiSsC+2N2qUGLDVOiOJL70Ulh1WxnbLPbwZWCifUu3/UU798dNiZ5Gd06XYinL7lonWpOiEg==";
-
-        //呵呵商户标识
-        String heHeMerAccount = "150a5459416b4046b9153c1cd442e397";
-        //呵呵 私钥,商户密钥
-        String heHeMerKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIggpVq2S1JLH0szxurEgVTz4JTpoyO6/YreVP3xl2bcVj8ekVU+GBwLXNhokxOavgY116XxScinFPa/VoWhaVzyLTbvKz5B6yytuRc3OkSqdDj83jCk+mpmJ5UuCRQ3jesaZAxRpPLzLc99sPtD7xnzEd9UWG8Hlnm6ATmmEQhDAgMBAAECgYBPX+nLGRyWYaNfsFM+tVJMfN/pNMqhnPkWLkoUwPhtS/EmYOaRc+GPCLkcnu2Tstk2udKCuk0xqOs6bZs/1DygxzifYUltWFpqQ2gfmDMoOL4GOflXEHIpoSzSinXz8rjjlQU0wgkbNn6wV6Ao4Jxm5Rzmr9mvTKrAwsnY2eZnYQJBAP+Gj3rrJ7s5778jCramS7yLei2ljkHa/7P0MQsJ+B02/V5CFCh6qKZ2aaAQdk6Z7og5f641TrKX76QetDItSgsCQQCIYVdOdkC3+P6r7WYKXEJ8fdIrf2xyhcCAt9I4q+rcID+ZQ+UqzPoBuib/xpgBZVukDpj9BbIyObyStkvQsNWpAkBd6ADQ5pz6ZKdkMiecym6pAwVKwz4Nm8M/Si2/5dEGQ5BH1Lb9zV4vlvLofURNTKrp61+uES8z2TybryEAE77TAkAD8YSbwTGX4DxE7mVf8VD+1oiIN3QET7fEQQx0FQyCdvA/10W+GhU0jZRpGu30RGEE+mMUFeEUMLUyLNE+ZI6ZAkEA2t0rz4UpljOPms3yfxvzFnShBdshFZOy8kZRG/+OL9entaSOJ0gDmfeFBE9oWXwTj8aVasgbrBV1HjNfyb8WfA==";
-
-        NewOrder order = newOrderService.findByOrderID(orderId);
-        if (order != null && order.getOrganizeID() >= 2) {
-            //维沙订单退款
-            merAccount = wsMerAccount;
-            merKey = wsMerKey;
-        }
-        if (order != null && "2".equals(order.getOrderType())) {
-            //呵呵商城退款
-            merAccount = heHeMerAccount;
-            merKey = heHeMerKey;
-        }
-        List<CmReceiptOrderRelation> relationList = cmReceiptOrderRelationDao.findByOrderID(orderId.toString());
+    public void theOnlineRefund(List<Integer> shopOrderIds) {
+        List<CmReceiptOrderRelation> relationList = cmReceiptOrderRelationDao.findByShopOrderIds(shopOrderIds);
+//        AtomicDouble allRefund = new AtomicDouble(0);
+//        relationList.forEach(r -> allRefund.getAndSet(Double.parseDouble(r.getAssociateAmount())));
         if (null != relationList && relationList.size() > 0) {
-            Integer userId = cmReceiptOrderRelationDao.findUserId(orderId);
             for (CmReceiptOrderRelation orderRelation : relationList) {
-                JSONObject json = new JSONObject();
-                json.put("merAccount", merAccount);
-                //线上收款
+                //cdr表payway为1纯线上收款
                 if ("1".equals(orderRelation.getPayWay())) {
-                    // 当前时间戳
-                    long time = System.currentTimeMillis() / 1000;
-                    json.put("time", time);
-                    //商户退款流水号,由商户自行生成,必须唯一
-                    String merchantRefundNo = orderId + "##" + orderRelation.getId();
-                    json.put("merchantRefundNo", merchantRefundNo);
-                    //退款金额,单位分,必须大于0
-                    int refundAmt = (int) (Double.parseDouble(orderRelation.getAssociateAmount()) * 100);
-                    json.put("refundAmt", refundAmt);
-                    //退款原因
-                    String refundCause = "用户主动退款";
-                    json.put("refundCause", refundCause);
-                    //平台交易订单号
-                    json.put("mbOrderId", orderRelation.getMbOrderId());
-                    String sign = PayUtils.buildSign(json, merKey);
-                    json.put("sign", sign);
-                    String data = PayUtils.buildDataPrivate(json, merKey);
-                    JSONObject result = PayUtils.httpPost("https://platform.mhxxkj.com/paygateway/mbrefund/orderRefund/v1", merAccount, data);
-                    String code = result.getString("code");
-                    logger.info("返回结果-------------------------》"+result.toString());
-                    if (!"000000".equals(code)) {
-                        String msg = result.getString("msg");
-                        logger.info("第三方退款失败>>>>>>>msg:" + msg);
-                        throw new Exception("第三方退款失败!");
+                    //不同产品区分
+                    if ("12".equals(orderRelation.getPayType()) || "17".equals(orderRelation.getPayType())) {
+                        //网银
+                        unionRefund(orderRelation.getOrderRequestNo(), orderRelation.getAssociateAmount(), orderRelation.getShopOrderId());
                     } else {
-                        //存cm_online_refund
-                        CmOnlineRefundVo cmOnlineRefundVo = new CmOnlineRefundVo();
-                        cmOnlineRefundVo.setUserId(userId);
-                        cmOnlineRefundVo.setOrderId(orderId.toString());
-                        cmOnlineRefundVo.setAmount(orderRelation.getAssociateAmount().toString());
-                        cmOnlineRefundVo.setRefundType("1");
-                        cmOnlineRefundVo.setMborderId(orderRelation.getMbOrderId());
-                        cmOnlineRefundVo.setOrderRequestNo(merchantRefundNo);
-                        cmReceiptOrderRelationDao.insertOnlineRefund(cmOnlineRefundVo);
+                        //扫码
+                        onlinePay(orderRelation.getOrderRequestNo(), orderRelation.getAssociateAmount(), orderRelation.getShopOrderId());
                     }
                 }
-                //cdr表payway为3余额支付,查是否有线上余额支付
-                if ("3".equals(orderRelation.getPayWay())) {
-                    //查当前单线上余额支付总金额
-                    Double onlineMoneyPay = cmReceiptOrderRelationDao.findOnlineMoneyPay(orderId);
-                    if (null != onlineMoneyPay && onlineMoneyPay >= 0.01) {
-                        logger.info("线上余额退现金==============orderId==>" + orderId);
-                        //根据userid查产生线上余额的唯一请求单号,发起退款请求
-                        //用户名下未分帐的线上余额订单mborderid
-                        List<String> mborderIds = cmReceiptOrderRelationDao.findMborderId(userId);
-                        //用户名下线上退款回线上余额的原mborderid
-                        if (mborderIds != null && mborderIds.size() > 0) {
-                            for (String s : mborderIds) {
-                                if (onlineMoneyPay > 0) {
-                                    //该单线上余额
-                                    Double money = cmReceiptOrderRelationDao.findMoney(s);
-                                    //实际退款=待支付总线上余额>该笔退款金额,则退全额,否则退待支付
-                                    Double refundMoney = MathUtil.compare(onlineMoneyPay, money) > 0 ? money : onlineMoneyPay;
-                                    //退款
-                                    // 当前时间戳
-                                    long time = System.currentTimeMillis() / 1000;
-                                    json.put("time", time);
-                                    //商户退款流水号,由商户自行生成,必须唯一  orderid+余额退现+orid
-                                    String merchantRefundNo = orderId + "YETX" + orderRelation.getId();
-                                    json.put("merchantRefundNo", merchantRefundNo);
-                                    //退款金额,单位分,必须大于0
-                                    int refundAmt = (int) (refundMoney * 100);
-                                    json.put("refundAmt", refundAmt);
-                                    //退款原因
-                                    String refundCause = "用户主动退款";
-                                    json.put("refundCause", refundCause);
-                                    //平台交易订单号
-                                    json.put("mbOrderId", s);
-                                    String sign = PayUtils.buildSign(json, merKey);
-                                    json.put("sign", sign);
-                                    String data = PayUtils.buildDataPrivate(json, merKey);
-                                    JSONObject result = PayUtils.httpPost("https://platform.mhxxkj.com/paygateway/mbrefund/orderRefund/v1", merAccount, data);
-                                    String code = result.getString("code");
-                                    if (!"000000".equals(code)) {
-                                        String msg = result.getString("msg");
-                                        logger.info("余额退现失败>>>>>>>msg:" + msg);
-                                        throw new Exception("第三方退款失败!");
-                                    } else {
-                                        //存cm_online_refund
-                                        CmOnlineRefundVo cmOnlineRefundVo = new CmOnlineRefundVo();
-                                        cmOnlineRefundVo.setUserId(userId);
-                                        cmOnlineRefundVo.setOrderId(orderId.toString());
-                                        cmOnlineRefundVo.setAmount(refundMoney.toString());
-                                        cmOnlineRefundVo.setRefundType("2");
-                                        cmOnlineRefundVo.setMborderId(s);
-                                        cmOnlineRefundVo.setOrderRequestNo(merchantRefundNo);
-                                        cmReceiptOrderRelationDao.insertOnlineRefund(cmOnlineRefundVo);
-                                    }
-                                    //应付减已退
-                                    onlineMoneyPay = MathUtil.sub(onlineMoneyPay, money).doubleValue();
-                                }
-                                if (onlineMoneyPay <= 0) {
-                                    break;
-                                }
-                            }
-                        }
-                        if (onlineMoneyPay <= 0) {
-                            CmUser user = cmUserDao.get(userId.toString());
-                            //线上余额退完,user表减余额,cubr表统计余额减少
-                            CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
-                            cmUserBalanceRecord.setBalanceType("19");
-                            cmUserBalanceRecord.setType("2");
-                            cmUserBalanceRecord.setUserId(user.getUserID());
-                            cmUserBalanceRecord.setAddDate(new Date());
-                            cmUserBalanceRecord.setAmount(user.getOnlineMoney().toString());
-                            cmUserBalanceRecord.setOrderId(orderId);
-                            cmUserBalanceRecord.setDelFlag("0");
-                            cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                            //user表减余额
-                            double v = MathUtil.sub(user.getAbleUserMoney(), user.getOnlineMoney()).doubleValue();
-                            user.setOnlineMoney(0d);
-                            user.setAbleUserMoney(v);
-                            cmUserDao.updateMoney(user);
-                        }
-                        if (onlineMoneyPay > 0) {
-                            logger.info("订单不足退线上余额,请检查订单");
-                            throw new RuntimeException ("订单不足退线上余额,请检查订单!");
-                        }
+            }
+        }
+    }
+
+    public void onlinePay(String orderRequestNo, String money, Integer shopOrderId) {
+        AppPayRefundOrderVo orderVo = new AppPayRefundOrderVo();
+        orderVo.setP1_bizType("AppPayRefund");
+        String splitCode = cmReturnedPurchaseDao.findSplitCode(shopOrderId);
+        orderVo.setP3_customerNumber(splitCode);
+        //退款原单号
+        orderVo.setP2_orderId(orderRequestNo);
+        //自定义退款单号
+        String tk = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
+        orderVo.setP4_refundOrderId("TK" + tk + orderRequestNo);
+        //退款金额
+        orderVo.setP5_amount(money);
+        try {
+            Map<String, String> map = MyBeanUtils.convertBean(orderVo, new LinkedHashMap());
+            String oriMessage = MyBeanUtils.getSignedByPresetParameter(map, AppPayRefundOrderVo.NEED_SIGN_PARAMS);
+            oriMessage += Constant.SAOMA;
+            String sign = Disguiser.disguiseMD5(oriMessage.trim());
+            logger.info("签名串:" + sign);
+            map.put("sign", sign);
+            logger.info("发送参数:" + map);
+            Map<String, Object> resultMap = HttpClientService.getHttpResp(map, Constant.REQUEST_URL);
+            logger.info("响应结果:" + resultMap);
+            if ((Integer) resultMap.get("statusCode") == HttpStatus.SC_OK) {
+                String resultMsg = (String) resultMap.get("response");
+                AppPayRefundOrderResponseVo orderResponseVo = JSONObject.parseObject(resultMsg, AppPayRefundOrderResponseVo.class);
+                String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(orderResponseVo, AppPayRefundOrderResponseVo.NEED_SIGN_PARAMS);
+                assemblyRespOriSign += Constant.SAOMA;
+                logger.info("组装返回结果签名串:" + assemblyRespOriSign);
+                String responseSign = orderResponseVo.getSign();
+                logger.info("响应签名:" + responseSign);
+                String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
+                if (checkSign.equals(responseSign)) {
+                    if ("0001".equals(orderResponseVo.getRt2_retCode())) {
+                        logger.info("第三方退款成功>>>>>>>shopOrderId>>>" + shopOrderId);
                     } else {
-                        logger.info("线上余额过小或无线上余额支付退款=========orderId==> " + orderId);
+                        logger.error("退款失败========================" + orderResponseVo.getRt5_orderId() + "-" + orderResponseVo.getRt3_retMsg());
+                        throw new Exception("第三方退款失败!");
                     }
+                } else {
+                    logger.error("退款验签失败");
+                    throw new Exception("第三方退款验签失败!");
+                }
+            } else {
+                logger.error("退款请求失败");
+                throw new Exception("第三方退款请求失败!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //todo 网银退款不退手续费,
+    //1.本方法内转账手续费等待到账再发起退款请求
+    //2.异步
+    //3.回调
+    void unionRefund(String orderRequestNo, String money, Integer shopOrderId) {
+        Map<String, String> sPara = new HashMap<String, String>();
+        sPara.put("P1_bizType", "OnlineRefund");
+        sPara.put("P2_orderId", orderRequestNo);
+        String splitCode = cmReturnedPurchaseDao.findSplitCode(shopOrderId);
+        sPara.put("P3_customerNumber", splitCode);
+        sPara.put("P4_refundAmount", money);
+        sPara.put("P5_refundOrderId", "TK" + orderRequestNo);
+        sPara.put("P6_desc", "无");
+        sPara.put("P7_serverCallbackUrl", "");
+        StringBuffer sb = new StringBuffer();
+        sb.append("&").append("OnlineRefund").append("&").append(orderRequestNo).append("&").append(splitCode).append("&").
+                append(money).append("&").append("TK" + orderRequestNo).append("&").append("无").append("&").append("&").append(Constant.WANGYIN);
+        String sign = Disguiser.disguiseMD5(sb.toString());
+        sPara.put("sign", sign);
+        try {
+            OnlineRefundData on = postForm(sPara, Constant.YL, sign, OnlineRefundData.class);
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(on), JSONObject.class);
+            if (!"0000".equals(on.getRt2_retCode())) {
+                logger.info("退款失败:" + on.toString());
+                throw new Exception("退款失败");
+            } else {
+                String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(on, OnlineRefundData.NEED_SIGN_PARAMS);
+                logger.info("组装返回结果签名串:" + assemblyRespOriSign);
+                assemblyRespOriSign += Constant.SPLIT + Constant.WANGYIN;
+                String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
+                if (!checkSign.equals(on.getSign())) {
+                    logger.error("验签失败========================" + on.getRt3_retMsg());
+                    throw new Exception("第三方退款失败!");
+                } else {
+                    logger.info("第三方退款成功");
                 }
             }
-            logger.info("第三方退款成功>>>>>>>orderId>>>" + orderId);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
     }
 
+    public  <T> T postForm(Map<String, String> params, String url, String sign, Class<T> clazz) {
+        FormBody.Builder builder = new FormBody.Builder();
+        for (Map.Entry<String, String> entry : params.entrySet()) {
+            builder.add(entry.getKey(), entry.getValue());
+        }
+        builder.add("sign", sign);
+
+        Request request = new Request.Builder() // okHttp post
+                .url(url)
+                .post(builder.build())
+                .build();
+
+        Response response = null;
+        try {
+            response = client.newCall(request).execute();
+        } catch (IOException e) {
+            throw new IllegalStateException("请求出错", e);
+        }
+        if (!response.isSuccessful()) {
+            try {
+                logger.info(response.body().string());
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            throw new RuntimeException("请求失败了: http response code: " + response.code());
+        }
+
+        okhttp3.ResponseBody body = response.body();
+        String content = null;
+        try {
+            content = body.string();
+        } catch (IOException e) {
+            throw new IllegalStateException("IO异常", e);
+        }
+        JSONObject res = JSON.parseObject(content);
+        if ("0000".equals(res.getString("rt2_retCode"))) {
+            logger.info("退款申请发起成功------->" + res.toString());
+        }
+        /** rt4_success 为 true,需验签  **/
+        return res.toJavaObject(clazz);
+    }
 
     @Transactional(readOnly = false)
     public void revokeApply(CmReturnedPurchase cmReturnedPurchase, HttpServletRequest request) {

+ 288 - 105
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -40,6 +40,7 @@ import com.caimei.modules.user.utils.UserUtils;
 import com.caimei.po.ProductLadderPrice;
 import com.caimei.po.neworder.CmShopOrder;
 import com.caimei.utils.*;
+import com.google.common.util.concurrent.AtomicDouble;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
@@ -47,6 +48,7 @@ import com.thinkgem.jeesite.common.utils.DateUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
 import org.apache.commons.collections.CollectionUtils;
+import org.h2.util.New;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -124,6 +126,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     private CmCouponClubDao cmCouponClubDao;
     @Autowired
     private HeHeNewOrderDao heHeNewOrderDao;
+    @Autowired
+    private WeChatService weChatService;
 
     @Transactional(readOnly = false)
     public void updateClauseContent(NewOrder newOrder) {
@@ -136,6 +140,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         synchronized (NewOrderService.class) {
             NewOrder dbOrder = newOrderDao.findByOrderID(newOrder.getOrderID());
             boolean flag = false;// 是否新增标志
+            boolean onlinePay = true;   // 能否线上支付
             if (newOrder.getOrderID() == null) {
                 flag = true;
                 newOrder.setOrderNo(OrderUtil.geneAdminOrderNo());
@@ -172,6 +177,14 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             if (newOrder.getAffirmPaymentFlag() == null) {
                 newOrder.setAffirmPaymentFlag("0");
             }
+            // 有赠品不能线上支付
+            if (newOrder.getPresentCount() > 0 || newOrder.getPromotionalGiftsCount() > 0) {
+                onlinePay = false;
+            }
+            // 用余额不能线上支付
+            if (newOrder.getBalancePayFee() != null && newOrder.getBalancePayFee() > 0) {
+                onlinePay = false;
+            }
             // 协销订单设置会所信息
             if (newOrder.getBpOrderUserinfo() != null && newOrder.getBpOrderUserinfo().getClubId() != null) {
                 newOrder.setClubID(newOrder.getBpOrderUserinfo().getClubId().intValue());
@@ -199,6 +212,12 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
 
             //采购中选中保存的订单商品
             List<NewOrderProduct> orderProducts = newOrder.getOrderProduct();
+            for (NewOrderProduct orderProduct : orderProducts) {
+                if (StringUtils.isEmpty(orderProduct.getSplitCode())) {
+                    onlinePay = false;
+                    break;
+                }
+            }
             double preferential = 0d;
             double discountFee = 0d;
             double productTotalFee = 0D;
@@ -343,53 +362,20 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 isUpdateUserMoney = true;
             }
             if (newOrder.getBalancePayFee() != null && newOrder.getBalancePayFee() > 0) {
-                //线上余额>0优先抵扣
-                Double onlineMoney = cmUserDao.findOnlineMoney(newOrder.getUserID());
-                Double userMoney = cmUserDao.findUserMoney(newOrder.getUserID());
-                //线上使用余额
-                Double onlineUseMoney = 0d;
-                //线下使用余额
-                Double userUseMoney = 0d;
-                //可用余额
-                Double ableUserMoney = cmUserDao.findAbleUserMoney(newOrder.getUserID());
-                if (onlineMoney > newOrder.getBalancePayFee()) {
-                    onlineUseMoney = newOrder.getBalancePayFee();
-                } else {
-                    userUseMoney = newOrder.getBalancePayFee() - onlineMoney;
-                    onlineUseMoney = onlineMoney;
-                }
-//                ableUserMoney = MathUtil.sub(ableUserMoney, MathUtil.add(onlineUseMoney, userUseMoney)).doubleValue();
-//                onlineMoney = MathUtil.sub(onlineMoney, onlineUseMoney).doubleValue();
-//                userMoney = MathUtil.sub(userMoney, userUseMoney).doubleValue();
                 if (!isUpdateUserMoney) {
-                    // 更新用户可用余额,不从user表减线上/线下余额
+                    // 更新用户余额
                     cmUserDao.updateAbleUserMoney(newOrder.getBpOrderUserinfo());
                 }
-                Date date = new Date();
-                if (onlineUseMoney > 0) {
-                    //添加余额收支记录
-                    CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
-                    cmUserBalanceRecord.setUserId(newOrder.getUserID());
-                    cmUserBalanceRecord.setType("2");
-                    cmUserBalanceRecord.setBalanceType("10");
-                    cmUserBalanceRecord.setAddDate(date);
-                    cmUserBalanceRecord.setAmount(String.valueOf(onlineUseMoney));
-                    cmUserBalanceRecord.setOrderId(newOrder.getOrderID());
-                    cmUserBalanceRecord.setDelFlag("0");
-                    cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                }
-                if (userUseMoney > 0) {
-                    //添加余额收支记录
-                    CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
-                    cmUserBalanceRecord.setUserId(newOrder.getUserID());
-                    cmUserBalanceRecord.setType("2");
-                    cmUserBalanceRecord.setBalanceType("1");
-                    cmUserBalanceRecord.setAddDate(date);
-                    cmUserBalanceRecord.setAmount(String.valueOf(userUseMoney));
-                    cmUserBalanceRecord.setOrderId(newOrder.getOrderID());
-                    cmUserBalanceRecord.setDelFlag("0");
-                    cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
-                }
+                //添加余额收支记录
+                CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
+                cmUserBalanceRecord.setUserId(newOrder.getUserID());
+                cmUserBalanceRecord.setType("2");
+                cmUserBalanceRecord.setBalanceType("1");
+                cmUserBalanceRecord.setAddDate(new Date());
+                cmUserBalanceRecord.setAmount(String.valueOf(newOrder.getBalancePayFee()));
+                cmUserBalanceRecord.setOrderId(newOrder.getOrderID());
+                cmUserBalanceRecord.setDelFlag("0");
+                cmUserBalanceRecordService.insertUserBalanceRecord(cmUserBalanceRecord);
             }
 
             //订单客户
@@ -439,7 +425,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 //新增加的订单,那么删除原有的子订单 和订单商品信息
                 newOrderProductDao.deleteByOrderID(newOrder.getOrderID());
                 newShopOrderDao.deleteByOrderID(newOrder.getOrderID());
-                OrderUtil.orderSplit(newOrder);
+                OrderUtil.orderSplit(newOrder, onlinePay);
                 // 重新生成这些子订单 和订单商品信息
                 for (NewShopOrder shopOrder : newOrder.getNewShopOrders()) {
                     shopOrder.setOrderID(newOrder.getOrderID());
@@ -456,7 +442,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     for (NewOrderProduct orderProduct : shopOrder.getNewOrderProducts()) {
                         productName.append(orderProduct.getName());
                         // 没有折扣时促销才生效
-                        if (orderProduct.getDiscount() >= 100d) {
+                        if (orderProduct.getDiscount() >= 100d && !onlinePay) {
                             if (null != promotionsList && promotionsList.size() > 0) {
                                 for (CmPromotion promotion : promotionsList) {
                                     if ("3".equals(promotion.getType())) {
@@ -512,19 +498,87 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     shopOrder.setShouldPayShopAmount(shopProductAmount + shopTaxFee);
                     shopOrder.setPayedShopAmount(0D);
                     shopOrder.setShopOtherFee(0D);
+                }
+                if (onlinePay) {
+                    //线上支付分摊优惠总和到子订单
+                    //经理折扣+优惠券+满减
+                    double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()), newOrder.getDiscountFee()).doubleValue();
+                    // 分摊优惠前总佣金
+                    AtomicDouble oldBrokerage = new AtomicDouble(0);
+                    List<NewShopOrder> shopOrderList = newOrder.getNewShopOrders();
+                    shopOrderList.forEach(shopOrder -> {
+                        oldBrokerage.set(MathUtil.add(oldBrokerage.get(), shopOrder.getBrokerage()).doubleValue());
+                    });
+                    // 按分摊前的佣金排序
+                    shopOrderList.sort((o1, o2) -> o2.getBrokerage().compareTo(o1.getBrokerage()));
+                    // 前面子订单的分摊优惠总和
+                    AtomicDouble allReduction = new AtomicDouble(0);
+                    if (allDiscount > 0) {
+                        for (int i = 0; i < shopOrderList.size(); i++) {
+                            NewShopOrder shopOrder = shopOrderList.get(i);
+                            if (i < shopOrderList.size() - 1) {
+                                //最终支付金额=分摊前支付金额oldprice-折扣*(分摊前佣金/分摊前总佣金)
+                                //优惠分摊金额
+                                double v = MathUtil.mul(allDiscount, MathUtil.div(shopOrder.getBrokerage(), oldBrokerage.get()), 2).doubleValue();
+                                shopOrder.setEachDiscount(v);
+                                //子订单真实支付金额
+                                double realPay = MathUtil.round(MathUtil.sub(shopOrder.getNeedPayAmount(), v), 2).doubleValue();
+                                shopOrder.setRealPay(realPay);
+                                allReduction.set(MathUtil.add(v, allReduction.get()).doubleValue());
+                            }
+                            if (i == shopOrderList.size() - 1) {
+                                //最后一个子订单的分摊优惠金额=全优惠allDiscount-已分摊
+                                double v = MathUtil.sub(allDiscount, allReduction.get()).doubleValue();
+                                shopOrder.setEachDiscount(v);
+                                shopOrder.setRealPay(MathUtil.round(MathUtil.sub(shopOrder.getNeedPayAmount(), v), 2).doubleValue());
+                            }
+                            //有优惠金额,最高手续费=支付金额*0.65%>10取0.65,不大于取10(合利宝最高0.65%)
+                            double realPay = shopOrder.getRealPay();
+                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+                            //佣金>最高手续费可以线上,否则线下
+                            double bro = MathUtil.sub(realPay, shopOrder.getShouldPayShopAmount()).doubleValue();
+                            if (bro < charge) {
+                                onlinePay = false;
+                            }
+                        }
+                    } else {
+                        //无优惠金额
+                        for (int i = 0; i < shopOrderList.size(); i++) {
+                            NewShopOrder shopOrder = shopOrderList.get(i);
+                            double realPay = shopOrder.getNeedPayAmount();
+                            shopOrder.setRealPay(realPay);
+                            shopOrder.setEachDiscount(0d);
+                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+                            double bro = shopOrder.getBrokerage();
+                            shopOrder.setRealPay(realPay);
+                            shopOrder.setEachDiscount(0d);
+                            if (bro < charge) {
+                                onlinePay = false;
+                            }
+                        }
+                    }
+                }
+                /**
+                 * 更新主订单线上支付按钮
+                 * onlinePayFlag:0可以 1不可以
+                 */
+                Integer onlinePayFlag = onlinePay ? 0 : 1;
+                newOrder.setOnlinePayFlag(onlinePayFlag.toString());
+                // 更新子订单信息
+                for (NewShopOrder shopOrder : newOrder.getNewShopOrders()) {
                     newShopOrderDao.update(shopOrder);
                 }
             } else {
                 // 重新保存逻辑
                 //把从页面上传过来的orderProduct   根据 shopID 来分组
-                Map<Integer, List<NewOrderProduct>> orderProductMap = new HashMap<>();
+                Map<String, List<NewOrderProduct>> orderProductMap = new HashMap<>();
                 for (NewOrderProduct op : newOrder.getOrderProduct()) {
-                    if (orderProductMap.containsKey(op.getShopID())) {
-                        orderProductMap.get(op.getShopID()).add(op);
+                    if (orderProductMap.containsKey(onlinePay ? op.getSplitCode() + "-" + op.getShopID() : op.getShopID().toString())) {
+                        orderProductMap.get(onlinePay ? op.getSplitCode() + "-" + op.getShopID() : op.getShopID().toString()).add(op);
                     } else {
                         List<NewOrderProduct> l = new ArrayList<>();
                         l.add(op);
-                        orderProductMap.put(op.getShopID(), l);
+                        orderProductMap.put(onlinePay ? op.getSplitCode() + "-" + op.getShopID() : op.getShopID().toString(), l);
                     }
                 }
                 // orderProduct 分组完成
@@ -534,7 +588,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 //删除多余的shopOrder记录
                 for (NewShopOrder s : dbShopOrders) {
                     // 说明这个重新选择的orderProduct已经不包含这个供应商shopID的商品了
-                    if (!orderProductMap.containsKey(s.getShopID())) {
+                    if (!orderProductMap.containsKey(onlinePay ? s.getSplitCode() + "-" + s.getShopID() : s.getShopID().toString())) {
                         newShopOrderDao.delete(s);
                     }
                     s.setSendOutStatus("1");
@@ -542,17 +596,18 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     shopOrderNoIndex = shopOrderNoIndex < shopOrderIndex ? shopOrderIndex : shopOrderNoIndex;
                 }
                 //更新其余的shopOrder的信息
+                List<NewShopOrder> newShopOrderList = new ArrayList<>();
                 A:
-                for (Map.Entry<Integer, List<NewOrderProduct>> entry : orderProductMap.entrySet()) {
+                for (Map.Entry<String, List<NewOrderProduct>> entry : orderProductMap.entrySet()) {
                     for (NewShopOrder s : dbShopOrders) {
-                        if (s.getShopID().intValue() == entry.getKey().intValue()) {
-                            OrderUtil.updateShopOrderInfo(s, entry.getValue(), newOrder.getPromotions());
-                            newShopOrderDao.update(s);
+                        if ((onlinePay ? s.getSplitCode() + "-" + s.getShopID() : s.getShopID().toString()).equals(entry.getKey())) {
+                            OrderUtil.updateShopOrderInfo(s, entry.getValue(), newOrder.getPromotions(), onlinePay);
+                            newShopOrderList.add(s);
                             continue A;
                         }
                     }
                     NewShopOrder newShopOrder = new NewShopOrder();
-                    OrderUtil.updateShopOrderInfo(newShopOrder, entry.getValue(), newOrder.getPromotions());
+                    OrderUtil.updateShopOrderInfo(newShopOrder, entry.getValue(), newOrder.getPromotions(), onlinePay);
                     newShopOrder.setShopOrderNo(OrderUtil.getshopOrderNo(newOrder.getOrderNo(), ++shopOrderNoIndex));
                     newShopOrder.setSendOutStatus("1");
                     newShopOrder.setOrderNo(newOrder.getOrderNo());
@@ -586,12 +641,93 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     newShopOrder.setDelFlag("0");
                     newShopOrder.setPayFlag("0");
                     newShopOrder.setSplitFlag("1");// 订单默认可拆分
-                    newShopOrderDao.insert(newShopOrder);
-                    for (NewOrderProduct product : orderProducts) {
-                        if (product.getShopID().intValue() == newShopOrder.getShopID().intValue()) {
-                            product.setShopOrderID(newShopOrder.getShopOrderID());
-                            product.setShopOrderNo(newShopOrder.getShopOrderNo());
-                            product.setOrderPromotionsId(product.getOrderPromotionsId());
+                    newShopOrder.setShopReceiptStatus("3".equals(newOrder.getReceiptStatus()) ? 3 : 1);
+                    newShopOrder.setRealPay(0d);
+                    newShopOrder.setEachDiscount(0d);
+                    newShopOrder.setReceiptAmount(0d);
+                    NewOrderProduct orderProduct = orderProducts.get(0);
+                    if (null != orderProduct) {
+                        newShopOrder.setSplitCode(orderProduct.getSplitCode());
+                    }
+                    newShopOrderList.add(newShopOrder);
+
+                }
+                if (onlinePay) {
+                    //线上支付分摊优惠总和到子订单
+                    //经理折扣+优惠券+满减
+                    double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()), newOrder.getDiscountFee()).doubleValue();
+                    // 分摊优惠前总佣金
+                    AtomicDouble oldBrokerage = new AtomicDouble(0);
+                    newShopOrderList.forEach(shopOrder -> {
+                        oldBrokerage.set(MathUtil.add(oldBrokerage.get(), shopOrder.getBrokerage()).doubleValue());
+                    });
+                    // 按分摊前的佣金排序
+                    newShopOrderList.sort((o1, o2) -> o2.getBrokerage().compareTo(o1.getBrokerage()));
+                    // 前面子订单的分摊优惠总和
+                    AtomicDouble allReduction = new AtomicDouble(0);
+                    if (allDiscount > 0) {
+                        for (int i = 0; i < newShopOrderList.size(); i++) {
+                            NewShopOrder shopOrder = newShopOrderList.get(i);
+                            if (i < newShopOrderList.size() - 1) {
+                                //最终支付金额=分摊前支付金额oldprice-折扣*(分摊前佣金/分摊前总佣金)
+                                //优惠分摊金额
+                                double v = MathUtil.mul(allDiscount, MathUtil.div(shopOrder.getBrokerage(), oldBrokerage.get()), 2).doubleValue();
+                                shopOrder.setEachDiscount(v);
+                                //子订单真实支付金额
+                                double realPay = MathUtil.round(MathUtil.sub(shopOrder.getNeedPayAmount(), v), 2).doubleValue();
+                                shopOrder.setRealPay(realPay);
+                                allReduction.set(MathUtil.add(v, allReduction.get()).doubleValue());
+                            }
+                            if (i == newShopOrderList.size() - 1) {
+                                //最后一个子订单的分摊优惠金额=全优惠allDiscount-已分摊
+                                double v = MathUtil.sub(allDiscount, allReduction.get()).doubleValue();
+                                shopOrder.setEachDiscount(v);
+                                shopOrder.setRealPay(MathUtil.round(MathUtil.sub(shopOrder.getNeedPayAmount(), v), 2).doubleValue());
+                            }
+                            //有优惠金额,最高手续费=支付金额*0.65%>10取0.65,不大于取10(合利宝最高0.65%)
+                            double realPay = shopOrder.getRealPay();
+                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+                            //佣金>最高手续费可以线上,否则线下
+                            double bro = MathUtil.sub(realPay, shopOrder.getShouldPayShopAmount()).doubleValue();
+                            if (bro < charge) {
+                                onlinePay = false;
+                            }
+                        }
+                    } else {
+                        //无优惠金额
+                        for (int i = 0; i < newShopOrderList.size(); i++) {
+                            NewShopOrder shopOrder = newShopOrderList.get(i);
+                            double realPay = shopOrder.getNeedPayAmount();
+                            shopOrder.setRealPay(realPay);
+                            shopOrder.setEachDiscount(0d);
+                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+                            double bro = shopOrder.getBrokerage();
+                            shopOrder.setRealPay(realPay);
+                            shopOrder.setEachDiscount(0d);
+                            if (bro < charge) {
+                                onlinePay = false;
+                            }
+                        }
+                    }
+                }
+                /**
+                 * 更新主订单线上支付按钮
+                 * onlinePayFlag:0可以 1不可以
+                 */
+                Integer onlinePayFlag = onlinePay ? 0 : 1;
+                newOrder.setOnlinePayFlag(onlinePayFlag.toString());
+                // 保存子订单
+                for (NewShopOrder newShopOrder : newShopOrderList) {
+                    if (null != newShopOrder.getShopOrderID()) {
+                        newShopOrderDao.update(newShopOrder);
+                    } else {
+                        newShopOrderDao.insert(newShopOrder);
+                        for (NewOrderProduct product : orderProducts) {
+                            if (product.getShopID().intValue() == newShopOrder.getShopID().intValue() && (onlinePay && product.getSplitCode().equals(newShopOrder.getSplitCode()))) {
+                                product.setShopOrderID(newShopOrder.getShopOrderID());
+                                product.setShopOrderNo(newShopOrder.getShopOrderNo());
+                                product.setOrderPromotionsId(product.getOrderPromotionsId());
+                            }
                         }
                     }
                 }
@@ -715,7 +851,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 newShopOrderDao.delete(freightShopOrder);
                 newOrderProductDao.delete(freightOrderProduct);
             }
-            if (newOrder.getFreePostFlag() != null && newOrder.getFreePostFlag().equals("1")) {
+            if (newOrder.getFreePostFlag() != null && "1".equals(newOrder.getFreePostFlag())) {
                 setFreightShopOrder(newOrder);
             }
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
@@ -955,6 +1091,11 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         newShopOrder.setTotalAmount(newOrder.getFreight());
         newShopOrder.setNeedPayAmount(newOrder.getFreight());
         newShopOrder.setDiscountAmount(0D);
+        newShopOrder.setEachDiscount(0D);
+        newShopOrder.setRealPay(newOrder.getFreight());
+        newShopOrder.setReceiptAmount(0D);
+        newShopOrder.setSplitCode(product.getSplitCode());
+        newShopOrder.setReceiptStatus("1");
         if ("1".equals(pOrder.getPostageOrderFlag())) {
             newShopOrder.setPayFlag("1");
             newShopOrder.setPayStatus("3");
@@ -1171,19 +1312,6 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 newOrder.setOrderInvoice(orderInvoice);
             }
         }
-        //线上/下余额赋值
-        Double userMoney = cmDiscernReceiptDao.findUserMoney(id);
-        Double onlineMoney = cmDiscernReceiptDao.findOnlineMoney(id);
-        if(null==userMoney){
-            newOrder.setUserMoney(0d);
-        }else{
-            newOrder.setUserMoney(userMoney);
-        }
-        if(null == onlineMoney){
-            newOrder.setOnlineMoney(0d);
-        }else{
-            newOrder.setOnlineMoney(onlineMoney);
-        }
         return newOrder;
     }
 
@@ -1227,6 +1355,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 }
             }
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(cmReturnedPurchase.getOrderID());
+            logger.info("shopOrders》》》》》" + shopOrders.toString());
             if (CollectionUtils.isNotEmpty(shopOrders)) {
                 for (NewShopOrder shopOrder : shopOrders) {
                     //获取退货退款记录
@@ -1531,6 +1660,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
             int num = entry.getValue().stream().mapToInt(NewOrderProduct::getThisTimePostNum).sum();
             if (outStoreNum + num > (shopOrder.getItemCount() + shopOrder.getPresentNum())) {
+
                 throw new Exception("发货数量异常");
             }
             shopOrder.setOutStoreNum(outStoreNum + num);//更新子订单总的出库数量
@@ -1549,6 +1679,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 } else {
                     autoCloseTimeMills += cfg.getValue() * 60 * 1000;
                 }
+
                 shopOrder.setAutoReceiveTimeMills(autoCloseTimeMills);
             }
             shopOrder.setSplitFlag("0");//发货以后拆单标识订单无法拆分
@@ -1560,13 +1691,63 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         NewOrder order = newOrderDao.findByOrderID(orderID);
         String sendOutStatus = order.getSendOutStatus();
         List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(order.getOrderID());
-
+        Integer count = 0;
         String statusSuffix = "";
         if (shopOrders.stream().allMatch(s -> "3".equals(s.getSendOutStatus()))) {
+            //推送次数多次发货不推送(只推送一次)
+            Date date = new Date();
+            logger.info("****************************发货微信消息推送************************************");
+            if ("1".equals(order.getSendOutStatus())) {
+                if ("0".equals(order.getSecondHandOrderFlag()) && "0".equals(order.getRebateFlag()) && !"6060".equals(newShopOrderDao.getProductOrder(order.getOrderID())) && !"0".equals(order.getOrderType())) {
+                    try {
+
+                        Integer orderId = order.getOrderID();
+                        String unionid = newShopOrderDao.FromUnionId(orderId);
+                        List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                        logger.info("userid>>>>>>>>>>>>>>>" + orderId + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
+                        String accessToken = weChatService.getAccessToken();
+                        String orderNo = order.getOrderNo();
+                        String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                        String company = StringUtils.strip(logisticsInfo.keySet().toString(), "[]");
+                        String companyno = StringUtils.strip(logisticsInfo.values().toString(), "[]");
+                        String pagePath = "pages/user/order/order-details?type=share&orderId=" + order.getOrderID();
+                        for (String openid : openidList) {
+                            weChatService.sendTemplateMsgy(accessToken, openid, orderNo, time, company, companyno, pagePath);
+                        }
+                    } catch (Exception e) {
+                        logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
+                    }
+                }
+            }
             //所有的子订单都已经完成发货了
             statusSuffix = "3";
             order.setSendOutStatus("3");
+            count++;
         } else {
+            //推送次数多次发货不推送(只推送一次)
+            Date date = new Date();
+            logger.info("**************************发货微信消息推送************************************");
+            if ("0".equals(order.getSecondHandOrderFlag()) && "0".equals(order.getRebateFlag()) && !newShopOrderDao.getProductOrder(order.getOrderID()).contains(6060) && !"0".equals(order.getOrderType())) {
+                try {
+
+                    Integer orderId = order.getOrderID();
+                    String unionid = newShopOrderDao.FromUnionId(orderId);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    System.out.println("userid>>>>>>>>>>>>>>>" + orderId + "unionid》》》》》》》》》》" + newShopOrderDao.getOpenidListByPermission(unionid) + "openid》》》》》》》》》" + openidList);
+                    String accessToken = weChatService.getAccessToken();
+                    String orderNo = order.getOrderNo();
+                    String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    String company = StringUtils.strip(logisticsInfo.keySet().toString(), "[]");
+                    String companyno = StringUtils.strip(logisticsInfo.values().toString(), "[]");
+                    String pagePath = "pages/user/order/order-details?orderId=" + order.getOrderID();
+                    for (String openid : openidList) {
+                        weChatService.sendTemplateMsgy(accessToken, openid, orderNo, time, company, companyno, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
+                }
+            }
+
             //代码走到这里订单肯定是有发货了  整个订单里面的商品没有全部发完  那就是部分发货了
             statusSuffix = "2";
             order.setSendOutStatus("2");
@@ -1633,32 +1814,34 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
         }
 
-        /*try {
-            //发货短信推送(取消推送)
-            CmUser user = cmUserDao.get(order.getUserID().toString());
-            if (user != null && StringUtils.isNotBlank(user.getBindMobile()) && "0".equals(order.getRebateFlag())) {
-                String wwwServer = Global.getConfig("wwwServer");
-                boolean sendSms = false;
-                if ("2".equals(order.getSendOutStatus()) && "1".equals(sendOutStatus)) {
-                    //部分发货
-                    String shortLink = getShortLink(8, 7, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
-                    String content = "您的订单(订单编号:" + order.getOrderNo() + ")已部分发货。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
-                            "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
-                    sendSms = getSendSms(7, user.getBindMobile(), content);
-                } else if ("3".equals(order.getSendOutStatus())) {
-                    //已发货
-                    String shortLink = getShortLink(8, 8, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
-                    String content = "您的订单(订单编号:" + order.getOrderNo() + ")已发货完毕。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
-                            "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
-                    sendSms = getSendSms(8, user.getBindMobile(), content);
-                }
-                if (!sendSms) {
-                    logger.info("发货短信推送失败,订单id>>>>" + order.getOrderID());
+        if (count == 1) {
+            try {
+                //发货短信推送(取消推送)
+                CmUser user = cmUserDao.get(order.getUserID().toString());
+                if (user != null && StringUtils.isNotBlank(user.getBindMobile()) && "0".equals(order.getRebateFlag())) {
+                    String wwwServer = Global.getConfig("wwwServer");
+                    boolean sendSms = false;
+                    if ("2".equals(order.getSendOutStatus()) && "1".equals(sendOutStatus)) {
+                        //部分发货
+                        String shortLink = getShortLink(8, 7, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
+                        String content = "您的订单(订单编号:" + order.getOrderNo() + ")已部分发货。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
+                                "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
+                        sendSms = getSendSms(7, user.getBindMobile(), content);
+                    } else if ("3".equals(order.getSendOutStatus())) {
+                        //已发货
+                        String shortLink = getShortLink(8, 8, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
+                        String content = "您的订单(订单编号:" + order.getOrderNo() + ")已发货完毕。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
+                                "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
+                        sendSms = getSendSms(8, user.getBindMobile(), content);
+                    }
+                    if (!sendSms) {
+                        logger.info("发货短信推送失败,订单id>>>>" + order.getOrderID());
+                    }
                 }
+            } catch (Exception e) {
+                e.printStackTrace();
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }*/
+        }
         return lb.getId();
     }
 
@@ -1692,9 +1875,9 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         }
         dbShopOrder.setSplitFlag("0");// 拆分后订单无法再次拆分
         newShopOrder.setSplitFlag("0");
-        OrderUtil.updateShopOrderInfo(dbShopOrder, oldOrderProductList, null); // 根据拆分后的订单商品重新统计子订单信息
+        OrderUtil.updateShopOrderInfo(dbShopOrder, oldOrderProductList, null, true); // 根据拆分后的订单商品重新统计子订单信息
         newShopOrderDao.updateByShopOrderID(dbShopOrder);// 更新原来的子订单
-        OrderUtil.updateShopOrderInfo(newShopOrder, newOrderProductList, null);
+        OrderUtil.updateShopOrderInfo(newShopOrder, newOrderProductList, null, true);
         newShopOrder.setShopOrderNo(OrderUtil.getshopOrderNo(dbShopOrder.getOrderNo(), ++bigNum));
         newShopOrderDao.insert(newShopOrder);// 插入新增的拆分订单
         String orderProductIDs = "";
@@ -1789,13 +1972,13 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         for (Map.Entry<Integer, List<NewOrderProduct>> entry : orderProductMap.entrySet()) {
             for (NewShopOrder s : dbShopOrders) {
                 if (s.getShopID().intValue() == entry.getKey().intValue()) {
-                    OrderUtil.updateShopOrderInfo(s, entry.getValue(), null);
+                    OrderUtil.updateShopOrderInfo(s, entry.getValue(), null, true);
                     newShopOrderDao.update(s);
                     continue A;
                 }
             }
             NewShopOrder newShopOrder = new NewShopOrder();
-            OrderUtil.updateShopOrderInfo(newShopOrder, entry.getValue(), null);
+            OrderUtil.updateShopOrderInfo(newShopOrder, entry.getValue(), null, true);
             newShopOrder.setShopOrderNo(OrderUtil.getshopOrderNo(newOrder.getOrderNo(), ++shopOrderNoIndex));
             newShopOrder.setOrderNo(newOrder.getOrderNo());
             newShopOrder.setOrderID(newOrder.getOrderID());

+ 18 - 4
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -10,8 +10,6 @@ import com.caimei.modules.order.utils.ProductType;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.CmPromotion;
-import com.caimei.utils.MathUtil;
-import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.StringUtils;
@@ -208,6 +206,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             liv.setLogisticsInformationList(lis);
             liv.setLogisticsRecordList(lrs);
             result.add(liv);
+
         }
         return result;
     }
@@ -272,7 +271,14 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         }
         List<NewShopOrder> payOrderList = newShopOrderDao.findPayOrderList(shopOrder);
         page.setList(payOrderList);
+        setValue(payOrderList);
+        return page;
+    }
+
+    public void setValue(List<NewShopOrder> payOrderList){
         for (NewShopOrder so : payOrderList) {
+            Integer onlineFlag=newOrderDao.findOnlinePay(so.getOrderID())>0?1:0;
+            so.setOnlineFlag(onlineFlag);
             //统计该子订单的主的收款金额和收款状态
             NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
             if (null != newOrder) {
@@ -347,7 +353,6 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             BigDecimal refundsAmount = MathUtil.add(so.getRefundsAmount(), shopRefundAmount);
             so.setRefundsAmount(refundsAmount.doubleValue());*/
         }
-        return page;
     }
 
     public Double getOrderReturnedPurchaseFee(NewShopOrder so) {
@@ -413,7 +418,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             shopOrder.setDiscountTotalFee(newOrder.getDiscountFee());
             //机构运费
             shopOrder.setFreight(newOrder.getFreight());
-            if("0".equals(newOrder.getFreePostFlag())||"-1".equals(newOrder.getFreePostFlag())||"-2".equals(newOrder.getFreePostFlag())){
+            if ("0".equals(newOrder.getFreePostFlag()) || "-1".equals(newOrder.getFreePostFlag()) || "-2".equals(newOrder.getFreePostFlag())) {
                 shopOrder.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
             }
             //机构运费是否已退
@@ -654,4 +659,13 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
     public List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId) {
         return cmPayShopDao.getDiscernReceipts(shopOrderId);
     }
+
+    @Transactional(readOnly = false)
+    public Page<NewShopOrder> findSplitList(Page<NewShopOrder> page, NewShopOrder shopOrder) {
+        shopOrder.setPage(page);
+        List<NewShopOrder> payOrderList = newShopOrderDao.findSplitList(shopOrder);
+        setValue(payOrderList);
+        page.setList(payOrderList);
+        return page;
+    }
 }

+ 672 - 0
src/main/java/com/caimei/modules/order/service/SplitAccountService.java

@@ -0,0 +1,672 @@
+package com.caimei.modules.order.service;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.order.dao.NewOrderDao;
+import com.caimei.modules.order.entity.*;
+import com.caimei.modules.order.utils.Disguiser;
+import com.caimei.redis.RedisService;
+import com.caimei.utils.MathUtil;
+import com.thinkgem.jeesite.common.service.BaseService;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+
+@Service
+@Transactional(readOnly = true)
+public class SplitAccountService extends BaseService {
+
+    public static OkHttpClient client = new OkHttpClient.Builder()
+            .connectTimeout(3, TimeUnit.SECONDS)
+            .readTimeout(20, TimeUnit.SECONDS)
+            .build();
+
+    @Resource
+    private NewOrderDao newOrderDao;
+    @Resource
+    private RedisService redisService;
+
+    @Transactional(readOnly = false)
+    public void SplitAccount() {
+        logger.info("【手动分账开始】>>>>>>>>>>手动分账");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String currentTime = format.format(calendar.getTime());
+        // 查询未分账已支付收款
+        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+        if (null != orderRelations && orderRelations.size() > 0) {
+            for (OrderReceiptRelationPo orderRelation : orderRelations) {
+                logger.info("【分账】>>>>>>>>>>子订单id:" + orderRelation.getShopOrderId() + "进入分账");
+                // 收款对应的订单信息
+                ShopOrderVo shopOrder = newOrderDao.getShopOrderListByOrderId(orderRelation.getShopOrderId());
+                PayParamBo payParam = new PayParamBo();
+                //支付金额
+                payParam.setAllPay(orderRelation.getAssociateAmount());
+                if (12 == orderRelation.getPayType()) {
+                    // 网银支付
+                    payParam.setPayWay("UNIONPAY");
+                }
+                if (17 == orderRelation.getPayType()) {
+                    //b2c网银
+                    payParam.setPayWay("B2C");
+                }
+                //微信0.65%手续费
+                if (8 == orderRelation.getPayType() || 13 == orderRelation.getPayType() || 15 == orderRelation.getPayType()) {
+                    payParam.setPayWay("WX");
+                }
+                List<SplitAccountPo> splitBillDetail = setSplitAccountDetail(shopOrder, payParam);
+                HashMap<String, BigDecimal> sbm = new HashMap<>();
+                for (SplitAccountPo splitAccountPo : splitBillDetail) {
+                    String subUserNo = splitAccountPo.getSubUserNo();
+                    if (sbm.containsKey(subUserNo)) {
+                        BigDecimal v = MathUtil.add(sbm.get(subUserNo), splitAccountPo.getSplitAccount());
+                        sbm.put(subUserNo, v);
+                    } else {
+                        sbm.put(subUserNo, BigDecimal.valueOf(splitAccountPo.getSplitAccount()));
+                    }
+                    // splitcode相同的收款的时候已经是成本已分帐
+                    if (subUserNo.equals(shopOrder.getSplitCode())) {
+                        splitAccountPo.setMbOrderId(orderRelation.getMbOrderId());
+                        splitAccountPo.setOrderRequestNo(orderRelation.getOrderRequestNo());
+                        splitAccountPo.setPayStatus(1);
+                        // 保存分账详情
+                        newOrderDao.insertSplitAccount(splitAccountPo);
+                    }
+                }
+                ArrayList<AccountPayOrder.AccountPayOrderExt.SplitBillRule> splitBillRules = new ArrayList<>();
+                sbm.forEach((key, value) -> {
+                    // 不是自己的splitcode分走,是自己的不动
+                    if (!key.equals(shopOrder.getSplitCode())) {
+                        //佣金
+                        AccountPayOrder.AccountPayOrderExt.SplitBillRule splitBillRule = new AccountPayOrder.AccountPayOrderExt.SplitBillRule();
+                        splitBillRule.setSplitBillAmount(value);
+                        splitBillRule.setSplitBillMerchantNo(key);
+                        splitBillRules.add(splitBillRule);
+                    }else{
+                        // 成本分账处理
+                        // 子订单的splitcode和分账对象的splitcode一样的是留在账户里的钱,实际在付款完成后,付款状态就为已付款,分账状态就为已分账
+                        // 为维持业务完整性,保持原来的分账流程不变
+                        List<SplitAccountPo> splitAccountList = newOrderDao.getSplitAccountList(orderRelation.getMbOrderId());
+                        if (splitAccountList != null && splitAccountList.size() > 0) {
+                            Integer orderId = splitAccountList.get(0).getOrderId();
+                            List<ShopOrderVo> shopOrderList = newOrderDao.getShopOrderByOrderId(orderId);
+                            Integer shopOrderId = null;
+                            String shopOrderNo = "";
+                            for (SplitAccountPo account : splitAccountList) {
+                                // 本次付供应商金额(分账金额)
+                                Double splitAmount = account.getSplitAccount();
+                                orderId = account.getOrderId();
+                                Integer shopId = account.getShopId();
+                                for (ShopOrderVo shop : shopOrderList) {
+                                    if (shopId.equals(shop.getShopId())) {
+                                        shopOrderId = shop.getShopOrderId();
+                                        shopOrderNo = shop.getShopOrderNo();
+                                        // 已付供应商金额
+                                        Double paidAmount = newOrderDao.getPaidShopAmount(shopOrderId);
+                                        Double paidShop = MathUtil.add(paidAmount, splitAmount).doubleValue();
+                                        shopOrder.setPayedShopAmount(paidShop);
+                                        if (MathUtil.compare(shopOrder.getShouldPayShopAmount(), paidShop) == 0) {
+                                            shopOrder.setPayStatus(3);
+                                        } else {
+                                            shopOrder.setPayStatus(2);
+                                        }
+                                        // 修改子订单付款状态及付款金额
+                                        newOrderDao.updateShopOrderByPayStatus(shopOrderId, paidShop, shopOrder.getPayStatus());
+                                    }
+                                }
+                                SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                String currentTime2 = format2.format(new Date());
+                                // 保存付款单表
+                                PayShopPo payShop = new PayShopPo();
+                                payShop.setShopId(shopId);
+                                payShop.setName("线上支付分账");
+                                payShop.setTotalAmount(splitAmount);
+                                payShop.setWipePayment(0d);
+                                payShop.setPayType(6);
+                                payShop.setStatus(1);
+                                payShop.setDelFlag(0);
+                                payShop.setApplyTime(currentTime2);
+                                payShop.setReviewTime(currentTime2);
+                                payShop.setPayTime(currentTime2);
+                                newOrderDao.insertPayShop(payShop);
+                                // 保存 付供应商记录
+                                PayShopRecordPo shopRecord = new PayShopRecordPo();
+                                shopRecord.setShopId(shopId);
+                                shopRecord.setShopOrderId(shopOrderId);
+                                shopRecord.setShopOrderNo(shopOrderNo);
+                                shopRecord.setPayAmount(splitAmount);
+                                shopRecord.setWipePayment(0d);
+                                shopRecord.setPayType(6);
+                                shopRecord.setPayTime(currentTime2);
+                                shopRecord.setPayShopId(payShop.getId());
+                                shopRecord.setStatus(1);
+                                shopRecord.setDelFlag(0);
+                                newOrderDao.insertPayShopRecord(shopRecord);
+                            }
+                            // 子订单是否全部付款
+                            boolean isPay = true;
+                            for (ShopOrderVo shops : shopOrderList) {
+                                if (3 != shops.getPayStatus()) {
+                                    isPay = false;
+                                    break;
+                                }
+                            }
+                            // 修改主订单付款状态
+                            if (isPay) {
+                                newOrderDao.updateOrderByPayStatus(orderId, 3);
+                            } else {
+                                newOrderDao.updateOrderByPayStatus(orderId, 2);
+                            }
+                        }
+                    }
+                });
+                splitBillDetail.removeIf(s -> s.getSubUserNo().equals(shopOrder.getSplitCode()));
+                if (null != splitBillRules && splitBillRules.size() > 0) {
+                    //第三方分账接口
+                    try {
+                        AccountPayOrder accountPayOrder = new AccountPayOrder();
+                        accountPayOrder.setP1_bizType("AccountPaySub");
+                        accountPayOrder.setP2_signType("MD5");
+                        String format1 = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
+                        accountPayOrder.setP3_timestamp(format1);
+                        String substring = format1.substring(20);
+                        // fz+当前微秒时间+原唯一订单号
+                        accountPayOrder.setP4_orderId("FZ" + substring + orderRelation.getOrderRequestNo());
+                        //付款账户子订单绑定商户号
+                        accountPayOrder.setP5_customerNumber(shopOrder.getSplitCode());
+                        AccountPayOrder.AccountPayOrderExt accountPayOrderExt = new AccountPayOrder.AccountPayOrderExt();
+                        //收款账户商编  填写splitBillRules时候不填写MerchantNo,Amount并且即使填写这两个参数不生效!!
+//                    accountPayOrderExt.setInMerchantNo(splitMoneyVo.getName());
+                        accountPayOrderExt.setOrderType(AccountPayOrderType.TRANSFER);
+//                    accountPayOrderExt.setAmount(splitMoneyVo.getSplitMoney());
+                        accountPayOrderExt.setServerCallbackUrl(Constant.prodSplit);
+                        accountPayOrderExt.setGoodsName("分账");
+                        if (null != splitBillRules && splitBillRules.size() > 0) {
+                            accountPayOrderExt.setSplitBillRules(splitBillRules);
+                        }
+                        String ext = JSON.toJSONString(accountPayOrderExt);
+                        logger.info("分账规则串json串:" + ext);
+                        accountPayOrder.setP6_ext(ext);
+                        // 生成签名
+                        StringBuilder builder = new StringBuilder();
+                        builder.append(Constant.SPLIT)
+                                .append(accountPayOrder.getP1_bizType()).append(Constant.SPLIT)
+                                .append(accountPayOrder.getP2_signType()).append(Constant.SPLIT)
+                                .append(accountPayOrder.getP3_timestamp()).append(Constant.SPLIT)
+                                .append(accountPayOrder.getP4_orderId()).append(Constant.SPLIT)
+                                .append(accountPayOrder.getP5_customerNumber()).append(Constant.SPLIT)
+                                .append(accountPayOrder.getP6_ext()).append(Constant.SPLIT)
+                                .append(Constant.XUNI);
+                        String sign = Disguiser.disguiseMD5(builder.toString().trim());
+                        Map<String, String> bean = convertBean(accountPayOrder);
+                        logger.info("--------------------> 发送分账参数:  " + bean);
+                        Map<String, String> map = postForm(bean, Constant.FZ, sign, Map.class);
+                        logger.info("----------------分账返回数据: " + map.toString());
+                        if (map != null) {
+                            String code = map.get("rt5_retCode");
+                            if (!"0000".equals(code)) {
+                                String msg = map.get("rt6_retMsg");
+                                logger.info("【手动分账】>>>>>>>>>>手动分账失败>>>>>>>msg:" + msg);
+                            } else {
+                                for (SplitAccountPo splitAccount : splitBillDetail) {
+                                    splitAccount.setMbOrderId(orderRelation.getMbOrderId());
+                                    splitAccount.setOrderRequestNo(substring + orderRelation.getOrderRequestNo());
+                                    splitAccount.setPayStatus(1);
+                                    // 保存分账详情
+                                    newOrderDao.insertSplitAccount(splitAccount);
+                                }
+                                redisService.remove("XSFZMDS");
+                                logger.info("【手动分账】>>>>>>>>>>此订单分账结束");
+                            }
+                        }
+                    } catch (Exception e) {
+                        logger.error("【手动分账】>>>>>>>>>>错误信息", e);
+                    }
+                } else {
+                    // 没有佣金分账,全是成本,本笔交易已分帐
+                    newOrderDao.updateBySplitStatus(orderRelation.getMbOrderId());
+                    //没有佣金分账也解锁
+                    redisService.remove("XSFZMDS");
+                }
+            }
+        }
+    }
+
+
+    private List<SplitAccountPo> setSplitAccountDetail(ShopOrderVo shopOrder, PayParamBo payParam) {
+        List<SplitAccountPo> list = new ArrayList<>();
+        // 本次支付金额,单位/元
+        double payAmount = payParam.getAllPay();
+        // 待分账总金额
+        double splitAmount = payAmount;
+        // 总手续费
+        double procedureFee;
+        if ("UNIONPAY".equals(payParam.getPayWay())) {
+            procedureFee = 10.00;
+        } else if ("B2C".equals(payParam.getPayWay())) {
+            //b2c 0.2%
+            procedureFee = MathUtil.mul(payAmount, 0.002, 2).doubleValue();
+            //b2c最低手续费0.1
+            if (procedureFee < 0.1) {
+                procedureFee = 0.1;
+            }
+        } else if ("WX".equals(payParam.getPayWay())) {
+            //微信0.65%
+            procedureFee = MathUtil.mul(payAmount, 0.0065, 2).doubleValue();
+        } else {
+            //手续费 其他0.25%
+            procedureFee = MathUtil.mul(payAmount, 0.0025, 2).doubleValue();
+        }
+        if (MathUtil.compare(procedureFee, 0.01) <= 0) {
+            procedureFee = 0.01;
+        }
+        //手续费承担方 线上支付手续费:默认1采美承担,2供应商承担
+        Integer supportFlag = newOrderDao.findSupport(shopOrder.getShopOrderId());
+        //减去收款手续费
+        splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
+
+        // 商品数据
+        List<OrderProductVo> orderProductList = newOrderDao.getOrderProductByShopOrderId(shopOrder.getShopOrderId());
+
+        for (OrderProductVo orderProduct : orderProductList) {
+            //成本价*数量
+            double costPrice = MathUtil.mul(orderProduct.getCostPrice(), orderProduct.getNum()).doubleValue();
+            if (2 == supportFlag) {
+                //供应商自己承担手续费
+                costPrice = MathUtil.sub(costPrice, procedureFee).doubleValue();
+            }
+            // 不含税能开发票
+            if (Integer.valueOf(0).equals(orderProduct.getIncludedTax()) && !Integer.valueOf(3).equals(orderProduct.getInvoiceType())) {
+                //应付总税费
+                Double payableTax = MathUtil.mul(orderProduct.getSingleShouldPayTotalTax(), orderProduct.getNum()).doubleValue();
+                //成本+税费
+                costPrice = MathUtil.add(costPrice, payableTax).doubleValue();
+            }
+            // 判断是否支付过
+            Double paidAmount = newOrderDao.getOrderProductPaidAmount(orderProduct.getOrderProductId());
+            // 支付过金额大于0
+            //有已付
+            if (null != paidAmount && MathUtil.compare(paidAmount, 0) > 0) {
+                //已付>0,成本-已付
+                costPrice = MathUtil.sub(costPrice, paidAmount).doubleValue();
+            }
+            // 待分账金额>成本
+            if (MathUtil.compare(splitAmount, costPrice) > 0) {
+                // 待分账金额-成本
+                splitAmount = MathUtil.sub(splitAmount, costPrice).doubleValue();
+            } else {
+                costPrice = splitAmount;
+                splitAmount = 0.00;
+            }
+            if (costPrice > 0) {
+                SplitAccountPo splitAccount = new SplitAccountPo();
+                splitAccount.setShopOrderId(shopOrder.getShopOrderId());
+                splitAccount.setOrderId(shopOrder.getOrderId());
+                splitAccount.setOrderProductId(orderProduct.getOrderProductId());
+                splitAccount.setShopId(orderProduct.getShopId());
+                splitAccount.setSplitAccount(costPrice);
+                splitAccount.setProductType(1);
+                // 该商品设置了商户号
+                splitAccount.setType(4);
+                splitAccount.setSubUserNo(shopOrder.getSplitCode());
+                logger.info("成本分账参数------------->" + splitAccount.toString());
+                list.add(splitAccount);
+            }
+            if (MathUtil.compare(splitAmount, 0) == 0) {
+                break;
+            }
+        }
+        // 还有钱就付供应商运费
+        // 付供应商运费,是以供应商为单位的
+        if (MathUtil.compare(splitAmount, 0) > 0) {
+            // 运费
+            Double shopPostFee = shopOrder.getShopPostFee();
+            if (MathUtil.compare(shopPostFee, 0) > 0) {
+                // 查询已支付运费
+                Double shipping = newOrderDao.getPaidShipping(shopOrder.getOrderId(), shopOrder.getShopId());
+                shopPostFee = MathUtil.sub(shopPostFee, shipping).doubleValue();
+                if (MathUtil.compare(splitAmount, shopPostFee) > -1) {
+                    splitAmount = MathUtil.sub(splitAmount, shopPostFee).doubleValue();
+                } else {
+                    shopPostFee = splitAmount;
+                    splitAmount = 0.00;
+                }
+                SplitAccountPo splitAccount = new SplitAccountPo();
+                splitAccount.setOrderId(shopOrder.getOrderId());
+                splitAccount.setShopId(shopOrder.getShopId());
+                splitAccount.setSplitAccount(shopPostFee);
+                splitAccount.setProductType(2);
+                //供应商拥有子商户号
+                splitAccount.setType(4);
+                splitAccount.setSubUserNo(shopOrder.getSplitCode());
+                logger.info("付供应商运费分账参数------------->" + splitAccount);
+                list.add(splitAccount);
+            }
+        }
+        // 如果还有钱则为佣金,分到信息
+        if (MathUtil.compare(splitAmount, 0) > 0) {
+            //分账手续费0.1%采美承担,佣金扣除0.1%
+            Double amount = Math.max(MathUtil.mul(splitAmount, 0.001, 2).doubleValue(), 0.01);
+            splitAmount = MathUtil.sub(splitAmount, amount).doubleValue();
+            SplitAccountPo splitAccount = new SplitAccountPo();
+            splitAccount.setOrderId(shopOrder.getOrderId());
+            splitAccount.setShopOrderId(shopOrder.getShopOrderId());
+            splitAccount.setSplitAccount(splitAmount);
+            splitAccount.setProductType(3);
+            splitAccount.setType(5);
+            splitAccount.setSubUserNo(Constant.CUSTOMERNUM2);
+            logger.info("佣金分账参数------------->" + splitAccount);
+            list.add(splitAccount);
+        }
+        return list;
+    }
+
+    public <T> T postForm(Map<String, String> params, String url, String sign, Class<T> clazz) {
+        FormBody.Builder builder = new FormBody.Builder();
+        for (Map.Entry<String, String> entry : params.entrySet()) {
+            builder.add(entry.getKey(), entry.getValue());
+        }
+        builder.add("sign", sign);
+
+        Request request = new Request.Builder() // okHttp post
+                .url(url)
+                .post(builder.build())
+                .build();
+
+        Response response = null;
+        try {
+            response = client.newCall(request).execute();
+        } catch (IOException e) {
+            throw new IllegalStateException("请求出错", e);
+        }
+        if (!response.isSuccessful()) {
+            try {
+                logger.info(response.body().string());
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            throw new RuntimeException("请求失败了: http response code: " + response.code());
+        }
+
+        ResponseBody body = response.body();
+        String content = null;
+        try {
+            content = body.string();
+        } catch (IOException e) {
+            throw new IllegalStateException("IO异常", e);
+        }
+        JSONObject res = JSON.parseObject(content);
+        if (!res.getBooleanValue("rt4_success")) {
+            logger.error("error: " + res.getString("rt6_retMsg"));
+        }
+        /** rt4_success 为 true,需验签  **/
+        return res.toJavaObject(clazz);
+    }
+
+    public Map<String, String> convertBean(Object bean) {
+        Class clazz = bean.getClass();
+        Field[] fields = clazz.getDeclaredFields();
+        for (Field f : fields) {
+            f.setAccessible(true);
+        }
+        try {
+            Map<String, String> retMap = new LinkedHashMap<>();
+            for (Field f : fields) {
+                String key = f.toString().substring(f.toString().lastIndexOf(".") + 1);
+                Object value = f.get(bean);
+                if (value == null) {
+                    value = "";
+                }
+                retMap.put(key, (String) value);
+            }
+            return retMap;
+        } catch (Exception e) {
+            logger.info("分账", e);
+            throw new IllegalStateException("分账异常", e);
+        }
+    }
+}
+
+//    //正式
+////    public static final String callUrl = "https://core.caimei365.com/order/pay/delay/split/callback";
+//    //测试
+//    public static final String callUrl = "https://core-b.caimei365.com/order/pay/delay/split/callback";
+
+//    @Transactional(readOnly = false)
+//    public void SplitAccount() {
+//        logger.info("【手动分账开始】>>>>>>>>>>手动分账");
+//        Calendar calendar = Calendar.getInstance();
+//        calendar.setTime(new Date());
+//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String currentTime = format.format(calendar.getTime());
+//        // 查询未分账已支付收款
+//        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+//        if (null != orderRelations && orderRelations.size() > 0) {
+//            for (OrderReceiptRelationPo orderRelation : orderRelations) {
+//                logger.info("【手动分账】>>>>>>>>>>订单id:" + orderRelation.getOrderId() + ",进入手动分账");
+//                // 收款对应的订单信息
+//                OrderVo order = newOrderDao.getOrderByOrderId(orderRelation.getOrderId());
+//                PayParamBo payParam = new PayParamBo();
+//                payParam.setPayAmount(MathUtil.mul(orderRelation.getAssociateAmount(), 100).intValue());
+//                if (12 == orderRelation.getPayType()) {
+//                    // 网银支付
+//                    payParam.setPayWay("UNIONPAY");
+//                }
+//                if (20 == orderRelation.getPayType()) {
+//                    payParam.setPayWay("TRANSFER");
+//                }
+//                List<SplitAccountPo> splitBillDetail = setSplitAccountDetail(order, payParam);
+//                List<Map<String, String>> maps = new ArrayList<>();
+//                //供应商子商户金额
+//                for (SplitAccountPo account : splitBillDetail) {
+//                    if (null != account.getType() && 4 == account.getType()) {
+//                        //每个有供应商子商户的分账给对应供应商子商户
+//                        addMaps(maps, account.getSplitAccount(), account.getSubUserNo());
+//                    }
+//                }
+//                //公账-专票总金额,私账-无票总金额,公账-普票总金额
+//                //佣金进网络
+//                double totalAmount1 = 0.00;
+//                double totalAmount2 = 0.00;
+//                double totalAmount3 = 0.00;
+//                double totalAmount4 = 0.00;
+//                for (SplitAccountPo account : splitBillDetail) {
+//                    if (1 == account.getType()) {
+//                        totalAmount1 = MathUtil.add(totalAmount1, account.getSplitAccount()).doubleValue();
+//                    } else if (2 == account.getType()) {
+//                        totalAmount2 = MathUtil.add(totalAmount2, account.getSplitAccount()).doubleValue();
+//                    } else if (3 == account.getType()) {
+//                        totalAmount3 = MathUtil.add(totalAmount3, account.getSplitAccount()).doubleValue();
+//                    } else if (5 == account.getType()) {
+//                        totalAmount4 = MathUtil.add(totalAmount4, account.getSplitAccount()).doubleValue();
+//                    }
+//                }
+//                addMaps(maps, totalAmount1, PayUtil.publicAccountNo);
+//                addMaps(maps, totalAmount2, PayUtil.privateAccountNo);
+//                addMaps(maps, totalAmount3, PayUtil.commonInvoiceNo);
+//                // 网络
+//                addMaps(maps, totalAmount4, PayUtil.brokerage);
+////                addMaps(maps, totalAmount4, PayUtil.publicAccountNo);
+//                String parameters = JSON.toJSONString(maps);
+//                logger.info("【手动分账】>>>>>>>>>>分账参数: " + parameters);
+//
+//                //第三方分账接口
+//                JSONObject result = null;
+//                try {
+//                    // 时间戳
+//                    long time = System.currentTimeMillis() / 1000;
+//                    JSONObject json = new JSONObject();
+//                    json.put("merAccount", PayUtil.merAccount);
+//                    json.put("orderId", orderRelation.getOrderRequestNo());
+//                    json.put("requestNo", orderRelation.getOrderRequestNo());
+//                    json.put("mbOrderId", orderRelation.getMbOrderId());
+//                    json.put("time", time);
+//                    json.put("splitBillDetail", parameters);
+//                    json.put("notifyUrl", callUrl);
+//                    logger.info("回调接口>>>" + callUrl);
+//                    String sign = PayUtil.getPaySign(json, PayUtil.merKey);
+//                    json.put("sign", sign);
+//                    logger.info("发送参数json----->" + json);
+//                    String data = PayUtil.privateKeyEncrypt(json, PayUtil.merKey);
+//                    result = PayUtil.httpGet("https://platform.mhxxkj.com/paygateway/mbpay/splitOrder/v1", PayUtil.merAccount, data);
+//                } catch (Exception e) {
+//                    logger.error("【手动分账】>>>>>>>>>>错误信息", e);
+//                }
+//                if (result != null) {
+//                    String code = result.getString("code");
+//                    if (!"000000".equals(code)) {
+//                        String msg = result.getString("msg");
+//                        logger.info("【手动分账】>>>>>>>>>>第三方延迟分账失败>>>>>>>msg:" + msg);
+//                    } else {
+//                        for (SplitAccountPo splitAccount : splitBillDetail) {
+//                            splitAccount.setMbOrderId(orderRelation.getMbOrderId());
+//                            splitAccount.setOrderRequestNo(orderRelation.getOrderRequestNo());
+//                            splitAccount.setPayStatus(1);
+//                            // 保存分账详情
+//                            newOrderDao.insertSplitAccount(splitAccount);
+//                            redisService.remove("XSFZMDS");
+//                        }
+//                        logger.info("【手动分账】>>>>>>>>>>此订单分账结束");
+//                    }
+//                }
+//            }
+//        }
+//    }
+//
+//
+//    /**
+//     * 分账参数添加
+//     */
+//    private void addMaps(List<Map<String, String>> maps, Double shopTotalAmount, String subUserNo) {
+//        if (MathUtil.compare(shopTotalAmount, 0) > 0) {
+//            Map<String, String> map = new HashMap<>(3);
+//            map.put("subUserNo", subUserNo);
+//            map.put("splitBillType", "2");
+//            map.put("splitBillValue", MathUtil.mul(shopTotalAmount, 100).toString());
+//            maps.add(map);
+//        }
+//    }
+//
+//    /**
+//     * 分账详情
+//     */
+//    private List<SplitAccountPo> setSplitAccountDetail(OrderVo order, PayParamBo payParam) {
+//        List<SplitAccountPo> list = new ArrayList<>();
+//        // 本次支付金额,单位/元
+//        double payAmount = MathUtil.div(payParam.getPayAmount(), 100).doubleValue();
+//        // 待分账总金额
+//        double splitAmount = payAmount;
+//        // 总手续费
+//        double procedureFee;
+//        if ("UNIONPAY".equals(payParam.getPayWay())) {
+//            procedureFee = 8.00;
+//        } else {
+//            //手续费
+//            procedureFee = MathUtil.mul(payAmount, 0.0038, 2).doubleValue();
+//            if (MathUtil.compare(procedureFee, 0) == 0) {
+//                procedureFee = 0.01;
+//            }
+//        }
+//        splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
+//        // 商品数据
+//        List<OrderProductVo> orderProductList = newOrderDao.getOrderProductByOrderId(order.getOrderId());
+//        for (OrderProductVo orderProduct : orderProductList) {
+//            double costPrice = MathUtil.mul(orderProduct.getCostPrice(), orderProduct.getNum()).doubleValue();
+//            // 不含税能开发票
+//            if (Integer.valueOf(0).equals(orderProduct.getIncludedTax()) && !Integer.valueOf(3).equals(orderProduct.getInvoiceType())) {
+//                //应付总税费
+//                Double payableTax = MathUtil.mul(orderProduct.getSingleShouldPayTotalTax(), orderProduct.getNum()).doubleValue();
+//                costPrice = MathUtil.add(costPrice, payableTax).doubleValue();
+//            }
+//            // 判断是否支付过
+//            Double paidAmount = newOrderDao.getOrderProductPaidAmount(orderProduct.getOrderProductId());
+//            //有已付
+//            if (null != paidAmount  && MathUtil.compare(paidAmount, 0) > 0) {
+//                //已付>0,成本-已付
+//                costPrice = MathUtil.sub(costPrice, paidAmount).doubleValue();
+//            }
+//            // 待分账金额>成本
+//            if (MathUtil.compare(splitAmount, costPrice) > 0) {
+//                // 待分账金额-成本
+//                splitAmount = MathUtil.sub(splitAmount, costPrice).doubleValue();
+//            } else {
+//                costPrice = splitAmount;
+//                splitAmount = 0.00;
+//            }
+//            if (costPrice > 0) {
+//                SplitAccountPo splitAccount = new SplitAccountPo();
+//                splitAccount.setOrderId(order.getOrderId());
+//                splitAccount.setOrderProductId(orderProduct.getOrderProductId());
+//                splitAccount.setShopId(orderProduct.getShopId());
+//                splitAccount.setSplitAccount(costPrice);
+//                splitAccount.setProductType(1);
+//                if (StringUtils.isNotBlank(orderProduct.getSplitCode())) {
+//                    // 该商品设置了商户号
+//                    splitAccount.setType(4);
+//                    splitAccount.setSubUserNo(orderProduct.getSplitCode());
+//                }
+//                logger.info("成本分账参数------------->" + splitAccount.toString());
+//                list.add(splitAccount);
+//            }
+//            if (MathUtil.compare(splitAmount, 0) == 0) {
+//                break;
+//            }
+//        }
+//        // 付供应商运费,是以供应商为单位的
+//        if (MathUtil.compare(splitAmount, 0) > 0) {
+//            List<ShopOrderVo> shopOrderList = newOrderDao.getShopOrderListByOrderId(order.getOrderId());
+//            for (ShopOrderVo shopOrder : shopOrderList) {
+//                // 运费
+//                Double shopPostFee = shopOrder.getShopPostFee();
+//                if (MathUtil.compare(shopPostFee, 0) > 0) {
+//                    // 查询已支付运费
+//                    Double shipping = newOrderDao.getPaidShipping(order.getOrderId(), shopOrder.getShopId());
+//                    shopPostFee = MathUtil.sub(shopPostFee, shipping).doubleValue();
+//                    if (MathUtil.compare(splitAmount, shopPostFee) > -1) {
+//                        splitAmount = MathUtil.sub(splitAmount, shopPostFee).doubleValue();
+//                    } else {
+//                        shopPostFee = splitAmount;
+//                        splitAmount = 0.00;
+//                    }
+//                    String commercialCode = newOrderDao.getShopCommercialCode(shopOrder.getShopId());
+//                    SplitAccountPo splitAccount = new SplitAccountPo();
+//                    splitAccount.setOrderId(order.getOrderId());
+//                    splitAccount.setShopId(shopOrder.getShopId());
+//                    splitAccount.setSplitAccount(shopPostFee);
+//                    splitAccount.setProductType(2);
+//                    if (StringUtils.isNotBlank(commercialCode)) {
+//                        //供应商拥有子商户号
+//                        splitAccount.setType(4);
+//                        splitAccount.setSubUserNo(commercialCode);
+//                    }
+//                    logger.info("付供应商运费分账参数------------->" + splitAccount);
+//                    list.add(splitAccount);
+//                }
+//            }
+//        }
+//        //佣金,公账
+//        if (MathUtil.compare(splitAmount, 0) > 0) {
+//            SplitAccountPo splitAccount = new SplitAccountPo();
+//            splitAccount.setOrderId(order.getOrderId());
+//            splitAccount.setSplitAccount(splitAmount);
+//            splitAccount.setProductType(3);
+//            splitAccount.setType(5);
+//            //佣金进采美网络
+//            splitAccount.setSubUserNo(PayUtil.brokerage);
+//            logger.info("佣金分账参数------------->" + splitAccount);
+//            list.add(splitAccount);
+//        }
+//        return list;
+//    }
+

+ 98 - 0
src/main/java/com/caimei/modules/order/service/WeChatService.java

@@ -0,0 +1,98 @@
+package com.caimei.modules.order.service;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.utils.RequestUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/4/12
+ */
+@Service
+public class WeChatService {
+    @Value("${wx.crm-app-id}")
+    private String crmAppId;
+    @Value("${wx.crm-app-secret}")
+    private String crmAppSecret;
+
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+
+    /**
+     * 微信公众号获取access_token
+     *
+     * @return access_token
+     */
+    public String getAccessToken() throws Exception {
+        String link = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+        link = link.replace("APPID", "wx91c4152b60ca91a3");
+        link = link.replace("APPSECRET", "a563dd2c07c9c815a4e697c8b6cb73dc");
+        String result = RequestUtil.sendGet(link);
+        logger.info("微信公众号获取access_token>>>" + result);
+        Map<String, Object> map = JSONObject.parseObject(result, Map.class);
+        String access_token = (String) map.get("access_token");
+
+        return access_token;
+    }
+
+    /**
+     * 发货消息推送
+     * @param accessToken
+     * @param openid
+     * @param orderno 订单编号
+     * @param time 发货时间
+     * @param company 快递名称
+     * @param companyno 快递编号
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMsgy(String accessToken, String openid, String orderno,String time, String company, String companyno, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "尊敬的采美客户,您购买的订单已经发货啦~");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", orderno);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", time);
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", company);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", companyno);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "收到货后请记得确认收货哟~");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "_Zc6WiUp3hM4yBgT30HkTyA-SmcCN-sjnGpIa6n3rKI");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+}

+ 77 - 0
src/main/java/com/caimei/modules/order/utils/Disguiser.java

@@ -0,0 +1,77 @@
+package com.caimei.modules.order.utils;
+
+import com.caimei.modules.order.utils.ConvertUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+
+/**
+ * 
+ * @ClassName: Disguiser
+ * @Description: 哈希算法的工具类,提供SHA MD5 HMAC等算法
+ *
+ */
+public class Disguiser {
+
+	public static final String ENCODE = "UTF-8";
+	private static final String KEY = "8data998mnwepxugnk03-2zirb";
+
+	public static String disguiseMD5(String message) {
+
+		if (null == message) {
+			return null;
+		}
+		return disguiseMD5(message, ENCODE);
+	}
+	
+	public static String disguise(String message){
+    	return disguise(message+KEY,ENCODE);
+    	
+    }
+	public static String disguise(String message,String encoding){
+    	message = message.trim();
+        byte value[];
+        try{
+            value = message.getBytes(encoding);
+        }
+        catch(UnsupportedEncodingException e){
+            value = message.getBytes();
+        }
+        MessageDigest md = null;
+        try{
+            md = MessageDigest.getInstance("SHA");
+        }catch(NoSuchAlgorithmException e){
+        	e.printStackTrace();
+            return null;
+        }
+        return ConvertUtils.toHex(md.digest(value));
+    }
+
+	public static String disguiseMD5(String message, String encoding) {
+
+		if (null == message || null == encoding) {
+
+			return null;
+		}
+
+		message = message.trim();
+		byte value[];
+		try {
+			value = message.getBytes(encoding);
+		} catch (UnsupportedEncodingException e) {
+			value = message.getBytes();
+		}
+		MessageDigest md = null;
+		try {
+			md = MessageDigest.getInstance("MD5");
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+			return null;
+		}
+		return ConvertUtils.toHex(md.digest(value));
+	}
+
+
+}

+ 127 - 0
src/main/java/com/caimei/modules/order/utils/HttpClientService.java

@@ -0,0 +1,127 @@
+package com.caimei.modules.order.utils;
+
+import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.*;
+
+public class HttpClientService {
+
+    private static final Log LOG = LogFactory.getLog(HttpClientService.class);
+
+    public static Map<String, Object> getHttpResp(Map<String, String> reqMap, String httpUrl) {
+        HttpClient client = new HttpClient();
+        PostMethod method = new PostMethod(httpUrl);
+        method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");
+        method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler());
+        method.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, new Integer(300000));
+        String response = "";
+
+
+        Map<String, Object> mp = new HashMap<String, Object>();
+
+        try {
+            NameValuePair[] nvps = getNameValuePair(reqMap);
+            method.setRequestBody(nvps);
+            int rescode = client.executeMethod(method);
+            mp.put("statusCode", rescode);
+
+            LOG.info("http rescode:" + rescode);
+            if (rescode == HttpStatus.SC_OK) {
+                BufferedReader reader = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream(), "UTF-8"));
+                String curline = "";
+                while ((curline = reader.readLine()) != null) {
+                    response += curline;
+                }
+                LOG.info("http response:" + response);
+                mp.put("response", response);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            method.releaseConnection();
+        }
+        return mp;
+    }
+
+    /**
+     *
+     * HTTP协议POST请求方法
+     */
+    public static String httpMethodPost(String url, String params, String gb) {
+        if (null == gb || "".equals(gb)) {
+            gb = "UTF-8";
+        }
+        StringBuffer sb = new StringBuffer();
+        URL urls;
+        HttpURLConnection uc = null;
+        BufferedReader in = null;
+        DataOutputStream out = null;
+        try {
+            urls = new URL(url);
+            uc = (HttpURLConnection) urls.openConnection();
+            uc.setRequestMethod("POST");
+            uc.setDoOutput(true);
+            uc.setDoInput(true);
+            uc.setUseCaches(false);
+            uc.setRequestProperty("Connection", "keep-alive");
+            uc.setRequestProperty("Keep-Alive", "timeout=1, max=100");
+            uc.setRequestProperty("Content-Length", params.length() + "");
+            uc.setRequestProperty("Content-Type","application/json");
+            uc.setConnectTimeout(7000);
+            uc.setReadTimeout(10000);
+            uc.connect();
+            out = new DataOutputStream(uc.getOutputStream());
+            out.write(params.getBytes(gb));
+            out.flush();
+            out.close();
+            in = new BufferedReader(new InputStreamReader(uc.getInputStream(),
+                    gb));
+            String readLine = "";
+            while ((readLine = in.readLine()) != null) {
+                sb.append(readLine);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null){
+                    out.close();
+                }
+                if (in != null){
+                    in.close();
+                }
+                if (uc != null) {
+                    uc.disconnect();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return sb.toString();
+    }
+
+    public static NameValuePair[] getNameValuePair(Map<String, String> bean) {
+        List<NameValuePair> x = new ArrayList<NameValuePair>();
+        for (Iterator<String> iterator = bean.keySet().iterator(); iterator.hasNext(); ) {
+            String type = (String) iterator.next();
+            x.add(new NameValuePair(type, String.valueOf(bean.get(type))));
+        }
+        Object[] y = x.toArray();
+        NameValuePair[] n = new NameValuePair[y.length];
+        System.arraycopy(y, 0, n, 0, y.length);
+        return n;
+    }
+}

+ 110 - 0
src/main/java/com/caimei/modules/order/utils/MyBeanUtils.java

@@ -0,0 +1,110 @@
+package com.caimei.modules.order.utils;
+
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.IntrospectionException;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ */
+public class MyBeanUtils extends BeanUtils{
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(MyBeanUtils.class);
+
+    private MyBeanUtils(){ }
+
+    public static Map convertBean(Object bean, Map retMap)
+            throws IntrospectionException, IllegalAccessException, InvocationTargetException {
+        Class clazz = bean.getClass();
+        Field[] fields = clazz.getDeclaredFields();
+        for (Field f : fields) {
+            f.setAccessible(true);
+        }
+        for (Field f : fields) {
+            String key = f.toString().substring(f.toString().lastIndexOf(".") + 1);
+            if (StringUtils.equalsIgnoreCase("NEED_SIGN_PARAMS", key)) {
+                continue;
+            }
+            Object value = f.get(bean);
+            if (value == null)
+                value = "";
+            retMap.put(key, value);
+        }
+        return retMap;
+    }
+
+    public static String getSigned(Map<String, String> map, String[] excludes){
+        StringBuffer sb = new StringBuffer();
+        Set<String> excludeSet = new HashSet<String>();
+        excludeSet.add("sign");
+        if(excludes != null){
+            for(String exclude : excludes){
+                excludeSet.add(exclude);
+            }
+        }
+        for(String key : map.keySet()){
+            if(!excludeSet.contains(key)){
+                String value = map.get(key);
+                value = (value == null ? "" : value);
+                sb.append("&");
+                sb.append(value);
+            }
+        }
+        sb.append("&");
+        return sb.toString();
+    }
+
+    public static String getSigned(Object bean, String[] excludes) throws IllegalAccessException, IntrospectionException, InvocationTargetException {
+        Map map  = convertBean(bean, new LinkedHashMap());
+        String signedStr = getSigned(map, excludes);
+        return signedStr;
+    }
+
+    /**
+     * new style
+     *
+     * @param bean
+     * @param needSignParams
+     */
+    public static String getSignedByPresetParameter(Object bean, Set<String> needSignParams) throws IllegalAccessException,
+            IntrospectionException, InvocationTargetException {
+        Map map = convertBean(bean, new LinkedHashMap<>());
+        return getSignedByPresetParameter(map, needSignParams);
+    }
+
+    /**
+     * new style
+     *
+     * @param map
+     * @param needSignParams
+     * @return
+     */
+    public static String getSignedByPresetParameter(Map<String, String> map, Set<String> needSignParams) {
+        StringBuffer sb = new StringBuffer();
+        if (needSignParams == null || needSignParams.isEmpty()) {
+            throw new RuntimeException("needSignParams is required");
+        }
+        for (String key : map.keySet()) {
+            if (needSignParams.contains(key)) {
+                // do sign
+                String value = map.get(key);
+                value = (value == null ? "" : value);
+                sb.append("&");
+                sb.append(value);
+            }
+        }
+        sb.append("&");
+        return sb.toString();
+    }
+
+}

+ 18 - 10
src/main/java/com/caimei/modules/order/utils/OrderUtil.java

@@ -34,18 +34,18 @@ public class OrderUtil {
      *
      * @param order
      */
-    public static void orderSplit(NewOrder order) {
+    public static void orderSplit(NewOrder order,boolean payOnline) {
         int shopOrderNoIndex = 0;
         List<NewOrderProduct> orderProducts = order.getOrderProduct();
         // 促销
         List<CmPromotion> promotionsList = order.getPromotions();
         List<NewShopOrder> newShopOrders = new ArrayList<>();
-        Map<Integer, NewShopOrder> map = new HashMap<>();
+        Map<String, NewShopOrder> map = new HashMap<>();
         // 把订单中的商品根据供应商不同进行分组,生成子订单
         for (NewOrderProduct o : orderProducts) {
             //子订单存在了 追加orderProduct 到 shopOrder
-            if (map.containsKey(o.getShopID())) {
-                NewShopOrder shopOrder = map.get(o.getShopID());
+            if (map.containsKey(payOnline ? o.getSplitCode() + "-" + o.getShopID() : o.getShopID().toString())) {
+                NewShopOrder shopOrder = map.get(payOnline ? o.getSplitCode() + "-" + o.getShopID() : o.getShopID().toString());
                 shopOrder.getNewOrderProducts().add(o);
                 shopOrder.setItemCount(o.getNum() + shopOrder.getItemCount()); // 子订单下商品数量统计 购买数量
                 shopOrder.setPresentNum(o.getPresentNum() + shopOrder.getPresentNum());
@@ -55,7 +55,7 @@ public class OrderUtil {
                 shopOrder.setTotalAmount(shopOrder.getTotalAmount() + o.getTotalFee());
                 shopOrder.setNeedPayAmount(shopOrder.getNeedPayAmount() + o.getShouldPayFee());
                 shopOrder.setTotalAddedValueTax(shopOrder.getTotalAddedValueTax() + o.getTotalAddedValueTax()); //税费
-                shopOrder.setBrokerage(shopOrder.getBrokerage() + o.getCmFee()); //佣金 =  应付采美
+                shopOrder.setBrokerage(shopOrder.getBrokerage() + o.getCmFee() + o.getTotalAddedValueTax() - o.getShouldPayTotalTax()); //佣金 =  应付采美
                 // 计算超级会员优惠
                 if (null != o.getSvipPriceFlag() && 1 == o.getSvipPriceFlag()) {
                     BigDecimal productTotalReduction = MathUtil.mul(o.getSvipReduction(), o.getNum(), 2);
@@ -83,7 +83,7 @@ public class OrderUtil {
                 shopOrder.setOrderSubmitType(4);
                 shopOrder.setFee(null);
                 // 赠品单独列出了
-                shopOrder.setPresentNum(0);
+                shopOrder.setPresentNum(o.getPresentNum());
                 shopOrder.setProductAmount(o.getTotalAmount());
                 shopOrder.setDiscountFee(o.getDiscountFee());
                 shopOrder.setTotalAmount(o.getTotalFee());
@@ -92,12 +92,17 @@ public class OrderUtil {
                 List<NewOrderProduct> newOrderProducts = new ArrayList<>(); // 实例化订单商品集合
                 newOrderProducts.add(o);
                 shopOrder.setNewOrderProducts(newOrderProducts);
-                shopOrder.setBrokerage(o.getCmFee());
+                shopOrder.setBrokerage(o.getCmFee() + o.getTotalAddedValueTax() - o.getShouldPayTotalTax());
 
                 shopOrder.setDiscountAmount((o.getPrice() - o.getDiscountPrice()) * o.getNum());
                 shopOrder.setTotalAmount(o.getTotalFee());
                 shopOrder.setNeedPayAmount(o.getShouldPayFee());
                 shopOrder.setOutStoreNum(0);
+                shopOrder.setShopReceiptStatus("3".equals(order.getReceiptStatus()) ? 3 : 1);
+                shopOrder.setRealPay(0d);
+                shopOrder.setEachDiscount(0d);
+                shopOrder.setReceiptAmount(0d);
+                shopOrder.setSplitCode(o.getSplitCode());
                 // 计算超级会员优惠
                 if (null != o.getSvipPriceFlag() && 1 == o.getSvipPriceFlag()) {
                     BigDecimal productTotalReduction = MathUtil.mul(o.getSvipReduction(), o.getNum(), 2);
@@ -105,7 +110,7 @@ public class OrderUtil {
                 } else {
                     shopOrder.setSvipShopReduction(0d);
                 }
-                map.put(o.getShopID(), shopOrder);
+                map.put(payOnline ? o.getSplitCode() + "-" + o.getShopID() : o.getShopID().toString(), shopOrder);
                 newShopOrders.add(shopOrder); //在主订单中保存子订单的引用
             }
         }
@@ -116,7 +121,7 @@ public class OrderUtil {
     /**
      * 根据 orderProducts里面的orderProduct 信息重新统计 shopOrder
      */
-    public static void updateShopOrderInfo(NewShopOrder shopOrder, List<NewOrderProduct> orderProducts, List<CmPromotion> promotionsList) {
+    public static void updateShopOrderInfo(NewShopOrder shopOrder, List<NewOrderProduct> orderProducts, List<CmPromotion> promotionsList, boolean onlinePay) {
         if (orderProducts == null || orderProducts.size() == 0) return;
         int itemCount = 0; //商品数量统计 (不含赠品)
         double productAmount = 0D;// 商品总金额 = 总价
@@ -141,7 +146,7 @@ public class OrderUtil {
         double svipShopReduction = 0d;
         for (NewOrderProduct o : orderProducts) {
             // 没有折扣时促销才生效
-            if (o.getDiscount() == 100d) {
+            if (o.getDiscount() == 100d && !onlinePay) {
                 for (CmPromotion promotion : promotionsList) {
                     if ("3".equals(promotion.getType())) {
                         shopOrder.setOrderPromotionsId(o.getOrderPromotionsId());
@@ -330,6 +335,9 @@ public class OrderUtil {
         if ("19".equals(payType)) {
             return "建设银行6256";
         }
+        if ("20".equals(payType)) {
+            return "建设银行3346";
+        }
         return "";
     }
 

+ 135 - 0
src/main/java/com/caimei/modules/order/utils/PayUtil.java

@@ -0,0 +1,135 @@
+package com.caimei.modules.order.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.order.utils.HashUtil;
+import com.caimei.modules.order.utils.HttpClient4Utils;
+import com.caimei.modules.order.utils.RSAUtil;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/30
+ */
+public class PayUtil {
+    /**
+     * 商户标识
+     */
+    public static final String merAccount = "aa9aee6a148843a6a9e4ea117df4454b";
+    /**
+     * 私钥,商户密钥
+     */
+    public static final String merKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAM0qCTZFdi1I59/Jeis+8KVhzSNhsRrKiOlHazIVyxNLzUQvFpWN5PlfVKlnJToorURTStfjAv01HD0Z4ZvMauuHhDT0bptiDln928Ld6SzX889X2nsCxl0Q+WzrkFsnT6gotvGnTeQGUgbBV3SQD3IUOwRwxoWYbrZqxtqHFxqRAgMBAAECgYEAvsHx9MMbAToDVmEXtXP8/lh0Cwy/RgDA0d30voni2pslTNtXbVCUcIUBy8y6oVvG1nt3YEmTsuiZy/nvehPT6GV1Gqj8T6lqWQ8KQKsDGlubvh23tzNM90me2TLZEPdNqC5CPRrwYrjght4BXgzu7s2+5FpeYCob1gVNi+w0Jz0CQQD0dXb9Oez+Ybnxb3rCghGWM6cxi8fsqk6MuKaleg53qfXrkgAVH78faeWzRaeSbVOh5+Z9kX5HUeynfM7E/f4nAkEA1tmnvJp4JQaouO1Trzbnkhowjea5daK/tDE8K0hIMHUjAw+c1QTteGOVGBFBHWPkUwkSCd2HKmk4URkp/snMhwJAO32+qF+Jclq8EqqLmHxo5UHKxX7793d2yD5Dp++tR6fgBiUwyfNA4tc1pEwmPLdIbBVwfUyEC70/N39jHoOlbwI/dX6SPJI9IgKCQp+HJEriWQP5iaCjy7E1JVXHkeP1lop4mzPukJAhTbUn1AGbmncGZmKPetWrFYZ1ReR9EtlJAkEA2kBmARWyOTt8fbikImuHr65M+BDgD+2fkuDb5+tqJljNmSqAIRRwcXj1Je6vkzlDJuSw3wlG6iliFtwe0cq7+w==";
+    /**
+     * 公钥
+     */
+    public static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNKgk2RXYtSOffyXorPvClYc0jYbEayojpR2syFcsTS81ELxaVjeT5X1SpZyU6KK1EU0rX4wL9NRw9GeGbzGrrh4Q09G6bYg5Z/dvC3eks1/PPV9p7AsZdEPls65BbJ0+oKLbxp03kBlIGwVd0kA9yFDsEcMaFmG62asbahxcakQIDAQAB";
+    /**
+     * 用户编号
+     */
+    public static final String merNo = "10001720";
+    /**
+     * 公账-专票,子商户商编
+     */
+    public static final String publicAccountNo = "20001793";
+    /**
+     * 公账-普票,子商户商编
+     */
+    public static final String commonInvoiceNo = "20001754";
+    /**
+     * 私账-无票,子商户商编
+     */
+    public static final String privateAccountNo = "20001924";
+    /**
+     * 彩美网络,佣金账户
+     */
+    public static final String brokerage="20004104";
+
+    /**
+     * 支付状态转换
+     */
+    public static String getPayTypeId(String payType, String userType) {
+        if ("ALIPAY_H5".equals(payType)) {
+            //支付宝H5
+            return "14";
+        } else if ("JSAPI_WEIXIN".equals(payType)) {
+            //微信公众号支付
+            return "13";
+        } else if ("MINIAPP_WEIXIN".equals(payType)) {
+            //微信小程序支付
+            return "15";
+        } else if ("GATEWAY_UNIONPAY".equals(payType) && "ENTERPRISE".equals(userType)) {
+            //企业网银
+            return "12";
+        } else if ("GATEWAY_UNIONPAY".equals(payType) && "USER".equals(userType)){
+            //个人网银
+            return "17";
+        }else{
+            //银联转账
+            return "20";
+        }
+    }
+
+    /**
+     * 生成RSA签名:sign
+     */
+    public static String getPaySign(JSONObject json, String merKey) {
+        StringBuffer buffer		= new StringBuffer();
+        TreeMap<String, Object> treeMap = new TreeMap<String, Object>();
+        for (Map.Entry<String, Object> entry : json.entrySet()) {
+            if (entry.getValue() != null) {
+                treeMap.put(entry.getKey(), entry.getValue());
+            }
+        }
+        for (Map.Entry<String, Object> entry : treeMap.entrySet()) {
+            if (entry.getValue() != null) {
+                buffer.append(entry.getValue());
+            }
+        }
+        buffer.append(merKey.replaceAll("(\r\n|\r|\n|\n\r)", ""));
+        System.out.println(buffer.toString());
+        return HashUtil.md5(buffer.toString()).toUpperCase();
+    }
+
+    //get请求
+    public static JSONObject httpGet(String url, String merAccount, String data) {
+        //请求参数为如下:merAccount、data
+        Map<String, String> paramMap	= new HashMap<String, String>();
+        paramMap.put("data", data);
+        paramMap.put("merAccount", merAccount);
+        String responseBody	= HttpClient4Utils.sendHttpRequest(url, paramMap, "UTF-8", false);
+        return JSON.parseObject(responseBody);
+    }
+    //post请求
+    public static JSONObject httpPost(String url, String merAccount, String data) {
+        //请求参数为如下:merAccount、data
+        Map<String, String> paramMap	= new HashMap<String, String>();
+        paramMap.put("data", data);
+        paramMap.put("merAccount", merAccount);
+        String responseBody	= HttpClient4Utils.sendHttpRequest(url, paramMap, "UTF-8", true);
+        return JSON.parseObject(responseBody);
+    }
+    /**
+     * 公钥解密
+     */
+    public static JSONObject publicKeyDecrypt(String data, String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+        JSONObject result	= null;
+        String jsonStr = RSAUtil.publicDecrypt(data.trim(), publicKey);
+        result = JSON.parseObject(jsonStr);
+        return result;
+    }
+
+    /**
+     * 私钥加密
+     */
+    public static String privateKeyEncrypt(JSONObject json, String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+        return RSAUtil.privateEncrypt(json.toJSONString(), privateKey);
+    }
+}

+ 8 - 0
src/main/java/com/caimei/modules/order/web/CmShopOrderController.java

@@ -104,6 +104,14 @@ public class CmShopOrderController extends BaseController {
         return "modules/order/cmRefundRecordList";
     }
 
+    @RequestMapping("splitList")
+    public String SplitAccount(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model){
+        //1. 展示付款状态为待付款和部分付款状态的线上支付的子订单;
+        //2. 子订单按下单时间降序排列
+        Page<NewShopOrder> page = newShopOrderService.findSplitList(new Page<>(request, response),newShopOrder);
+        model.addAttribute("page", page);
+        return "modules/order/cmSplitAccountList";
+    }
 
     @RequestMapping("payShopRemark")
     public String payShopRemark(CmChangePayShopRecond cmChangePayShopRecond, HttpServletRequest request, HttpServletResponse response, Model model) {

+ 16 - 40
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -36,7 +36,6 @@ import com.caimei.modules.user.service.CmUserService;
 import com.caimei.modules.user.service.NewCmShopService;
 import com.caimei.modules.user.utils.UserType;
 import com.caimei.po.ProductLadderPrice;
-import com.caimei.utils.AppKeys;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.StringUtil;
@@ -381,6 +380,7 @@ public class NewOrderController extends BaseController {
                     if (ladderPriceFlag != null && !"".equals(ladderPriceFlag)) {
                         o.setLadderPriceFlag(Integer.valueOf(ladderPriceFlag));
                     }
+                    o.setSplitCode(productDao.getSplitCodeByProductId(o.getProductID())) ;
                     if ("0".equals(productType)) {
                         o.setPreferential((o.getPrice() - o.getDiscountPrice()) * o.getNum());//折扣
                         o.setDiscountFee(BigDecimal.valueOf(o.getTotalFee()).subtract(BigDecimal.valueOf(o.getShouldPayFee())).doubleValue());//经理折扣
@@ -548,7 +548,7 @@ public class NewOrderController extends BaseController {
     @RequestMapping("confirmOrder")
     public String confirmOrder(Integer orderID, Model model, RedirectAttributes redirectAttributes) {
         NewOrder order = newOrderService.get(orderID + "");
-        if (StringUtils.isNotEmpty(order.getStatus()) && Integer.parseInt(order.getStatus()) > 0) {
+        if (StringUtils.isNotEmpty(order.getStatus()) && Integer.parseInt(order.getStatus())>0){
             addMessage(redirectAttributes, "订单状态异常,请刷新后重试!");
             return "redirect:" + Global.getAdminPath() + "/order/detail/?id=" + orderID;
         }
@@ -578,7 +578,7 @@ public class NewOrderController extends BaseController {
                 Integer svipPriceFlag = op.getSvipPriceFlag();
                 Integer ladderPriceFlag = op.getLadderPriceFlag();
                 //活动商品和阶梯商品和超级会员价不写入价格库
-                if (StringUtil.equals("0", isActProduct) && 0 == svipPriceFlag && 0 == ladderPriceFlag) {
+                if (StringUtil.equals("0", isActProduct) && 0 == svipPriceFlag && 0==ladderPriceFlag) {
                     String buyAgainFlag = op.getBuyAgainFlag();
                     //对于可以复购的商品添加买家商品价格,提供再次购买商品使用(如果不存在没有改买家商品价格则不能购买该商品)
                     if (StringUtils.isNotEmpty(buyAgainFlag) && StringUtils.equals("1", buyAgainFlag)) {
@@ -699,27 +699,11 @@ public class NewOrderController extends BaseController {
         Double balancePayFee = order.getBalancePayFee();
         CmUser u = cmUserService.get(userID + "");
         if (null != u && null != balancePayFee) {
-            Double userMoney = null == u.getUserMoney() ? 0 : u.getUserMoney();
-            Double onlineMoney = null == u.getOnlineMoney() ? 0 : u.getOnlineMoney();
-            //线上使用余额
-            Double onlineUseMoney = 0d;
-            //线下使用余额
-            Double userUseMoney = 0d;
-            //可用余额
-            Double ableUserMoney = u.getAbleUserMoney();
-            if (onlineMoney > order.getBalancePayFee()) {
-                onlineUseMoney = order.getBalancePayFee();
-            } else {
-                userUseMoney = order.getBalancePayFee() - onlineMoney;
-                onlineUseMoney = onlineMoney;
+            Double userMoney = u.getUserMoney();
+            if (null != userMoney) {
+                u.setUserMoney(userMoney - balancePayFee);
+                cmUserDao.updateMoney(u);
             }
-            ableUserMoney = MathUtil.sub(ableUserMoney, MathUtil.add(onlineUseMoney, userUseMoney)).doubleValue();
-            onlineMoney = MathUtil.sub(onlineMoney, onlineUseMoney).doubleValue();
-            userMoney = MathUtil.sub(userMoney, userUseMoney).doubleValue();
-            u.setAbleUserMoney(ableUserMoney);
-            u.setOnlineMoney(onlineMoney);
-            u.setUserMoney(userMoney);
-            cmUserDao.update(u);
         }
         addMessage(redirectAttributes, "确认订单成功");
         return "redirect:" + Global.getAdminPath() + "/order/detail/?id=" + orderID;
@@ -740,6 +724,7 @@ public class NewOrderController extends BaseController {
     }
 
 
+
     /**
      * 确认收货
      *
@@ -756,6 +741,8 @@ public class NewOrderController extends BaseController {
     }
 
 
+
+
     /**
      * 去子订单orderProduct页面
      *
@@ -799,7 +786,6 @@ public class NewOrderController extends BaseController {
         r.put("data", orderProductList);
         return r;
     }
-
     @RequestMapping("toShipLogistic")
     public String toShipLogistic(Integer orderID, Model model) {
         model.addAttribute("orderID", orderID);
@@ -902,6 +888,7 @@ public class NewOrderController extends BaseController {
             result.put("msg", e.getMessage());
             return result;
         }
+
         result.put("success", true);
         result.put("logisticsBatchId", logisticsBatchId);
         return result;
@@ -1264,19 +1251,7 @@ public class NewOrderController extends BaseController {
             String organizeStoreName = cmUserDao.getOrganizeStoreName(order.getOrganizeStoreId());
             order.setOrganizeStoreName(organizeStoreName);
         }
-        //线上/下余额赋值
-        Double userMoney = cmDiscernReceiptDao.findUserMoney(order.getId());
-        Double onlineMoney = cmDiscernReceiptDao.findOnlineMoney(order.getId());
-        if (null == userMoney) {
-            order.setUserMoney(0d);
-        } else {
-            order.setUserMoney(userMoney);
-        }
-        if (null == onlineMoney) {
-            order.setOnlineMoney(0d);
-        } else {
-            order.setOnlineMoney(onlineMoney);
-        }
+
         model.addAttribute("order", order);
         if ("0".equals(order.getStatus())) {
             try {
@@ -1315,7 +1290,7 @@ public class NewOrderController extends BaseController {
         }
         //订单已收金额
         Double brokerage = cmUtilsDao.selectPayTotalFees(order.getOrderID());
-        model.addAttribute("brokerage", brokerage);
+        model.addAttribute("brokerage",brokerage);
         Double receiptAmount = cmDiscernReceiptService.findOrderReceipt(order.getOrderID());
         model.addAttribute("returnValue", returnValue);
         model.addAttribute("receiptAmount", receiptAmount == null ? 0 : receiptAmount);
@@ -1406,6 +1381,7 @@ public class NewOrderController extends BaseController {
     public String logisticsDetails(Integer orderID, String logisticsBatchID, Model model, Integer orderType) {
         List<LogisticsInfoVo> logisticsInfoVos = new ArrayList<>();
         logisticsInfoVos = newShopOrderService.logisticsDetails(orderID, logisticsBatchID);
+
         model.addAttribute("orderID", orderID);
         model.addAttribute("orderType", orderType);
         model.addAttribute("logisticsInfoVos", logisticsInfoVos);
@@ -1437,17 +1413,17 @@ public class NewOrderController extends BaseController {
 
     /**
      * 置为已收款已付款
-     *
      * @param orderId
      * @return
      */
     @RequestMapping("toChangePay")
-    public String changePay(Integer orderId) {
+    public String changePay(Integer orderId){
         newOrderService.changePay(orderId);
         return "redirect:" + Global.getAdminPath() + "/order/orderList";
     }
 
 
+
     @RequestMapping(value = "saveClause")
     public String saveClause(NewOrder order, RedirectAttributes redirectAttributes, HttpServletRequest request) {
         String clauseContent = request.getParameter("clauseContent");

+ 63 - 0
src/main/java/com/caimei/modules/order/web/SplitAccountController.java

@@ -0,0 +1,63 @@
+package com.caimei.modules.order.web;
+
+import com.caimei.modules.order.dao.NewOrderDao;
+import com.caimei.modules.order.entity.OrderReceiptRelationPo;
+import com.caimei.modules.order.service.SplitAccountService;
+import com.caimei.redis.RedisService;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Controller
+@RequestMapping(value = "${adminPath}/splitAccount/")
+public class SplitAccountController extends BaseController {
+
+    @Resource
+    private SplitAccountService splitAccountService;
+
+    @Resource
+    private NewOrderDao newOrderDao;
+
+    @Resource
+    private RedisService redisService;
+
+    @RequestMapping("split")
+    public String SplitAccount(RedirectAttributes redirectAttributes) {
+        Integer xsfzmds = (Integer) redisService.get("XSFZMDS");
+        //验锁
+        if (null != xsfzmds && xsfzmds > 0) {
+            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
+            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+        }
+        //设置分账间隔,2-3分钟,禁止重复分账
+        Date splitTime = newOrderDao.findSplitTime();
+        if (null != splitTime) {
+            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
+            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+        }
+        //查询是否有账单可分账,没有return
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String currentTime = format.format(calendar.getTime());
+        // 查询未分账已支付收款
+        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+        if (null != orderRelations && orderRelations.size() > 0) {
+            //设锁
+            redisService.set("XSFZMDS", 1, 120L);
+            splitAccountService.SplitAccount();
+            addMessage(redirectAttributes, "分账成功!");
+        } else {
+            addMessage(redirectAttributes, "暂无收款金额可进行分账!");
+        }
+        return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+    }
+}

+ 14 - 0
src/main/java/com/caimei/modules/product/dao/CmSecondHandDetailDao.java

@@ -1,11 +1,13 @@
 package com.caimei.modules.product.dao;
 
+import com.caimei.modules.cibe.entity.Shop;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.product.entity.CmSecondHandDetail;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 二手商品DAO接口
@@ -22,4 +24,16 @@ public interface CmSecondHandDetailDao extends CrudDao<CmSecondHandDetail> {
     void updatSecondHnadproductSold(Integer productID);
 
     void updatSecondHnadBySold(Integer productID);
+
+    void deleteFileType(Integer productId);
+
+    void insertFileType(@Param("productId")Integer productId,@Param("secondId")String secondId, @Param("fileType")String fileType);
+
+    CmSecondHandDetail findValue(Integer productID);
+
+    List<Integer> findFlieTypes(Integer productID);
+
+    Integer findShopId(String cardNumber);
+
+    Integer insertShop(Shop shopVo);
 }

+ 8 - 0
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.product.dao;
 import com.caimei.modules.brand.entity.BrandAndProductType;
 import com.caimei.modules.product.entity.*;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -179,4 +180,11 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<Integer> getProductIdByBrandId(String brandId);
 
+    List<CmShop> findSepcialShopList();
+
+    void updateMainImage(Product product);
+
+    String getSplitCodeByProductId(Integer productID);
+
+    List<CmSplitCode> findSplitCodesByShopId(Integer shopID);
 }

+ 6 - 0
src/main/java/com/caimei/modules/product/dao/ProductNewDao.java

@@ -61,4 +61,10 @@ public interface ProductNewDao extends CrudDao<Product> {
     List<SplitCode> findSplitCode(Integer shopID);
 
     String findSplitCodeByProduct(Integer productID);
+
+    Integer getShopIdByName(String shopName);
+
+    List<SplitCode> findSecondSplitCode(String id);
+
+    void addProductData(@Param("productId") Integer productId,@Param("costPrice") String costPrice,@Param("costProportional") String costProportional,@Param("taxPoint") String taxPoint,@Param("supplierTaxPoint") String supplierTaxPoint);
 }

+ 54 - 9
src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java

@@ -31,7 +31,8 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String provinceCityDistrict;        // 省市区(地址前部分)
     private String address;        // 详细联系地址
     private String productQuality;        // 商品成色
-    private String payStatus;        // 付款状态1:待支付、2已付款
+//    private String payStatus;        // 付款状态1:待支付、2已付款
+    private String publishIdentity;     //发布身份1.个人身份,2公司身份
     private Double payAmount;        // 支付金额
     private String payFormData;        // 线上支付回调返回数据存档
     private String payType;        // 付款方式 0后台付款、1:支付宝、2微信 、12PC-B2B网银、13PC-微信支付、14PC-支付宝、15小程序-微信支付
@@ -45,10 +46,15 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String productDetails;//商品详情
     private String publisher;//后台二手商品发布人员名称
     private String authenticationImage;//身份验证照片
+    private String authenticationBackImage;//身份证背面照片
+    private String licenseImage;//营业执照照片
     private String fileName;//出让承诺函文件名称
     private String ossName;//对应oss存储名
     private String commitmentImage;//出让承诺函图片
     private String url; //文件预览url
+    private List<Integer> fileTypes;
+    private String splitCode;//商品分账号
+    private String cardNumber; //银行卡号
 
     private String validFlag;//商品状态,见表c_productstatus或枚举ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
     private String productCategory;// 商品的类别:1正常商品(默认),2二手商品
@@ -93,6 +99,13 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String editFlag;//编辑标记,1是编辑,其他都不是
     private String visibility;     //商品可见度:(3:所有人可见,2:普通机构可见,1:会员机构可见)
 
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
 
     public CmSecondHandDetail() {
         super();
@@ -102,6 +115,46 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
         super(id);
     }
 
+    public String getCardNumber() {
+        return cardNumber;
+    }
+
+    public void setCardNumber(String cardNumber) {
+        this.cardNumber = cardNumber;
+    }
+
+    public List<Integer> getFileTypes() {
+        return fileTypes;
+    }
+
+    public void setFileTypes(List<Integer> fileTypes) {
+        this.fileTypes = fileTypes;
+    }
+
+    public String getLicenseImage() {
+        return licenseImage;
+    }
+
+    public void setLicenseImage(String licenseImage) {
+        this.licenseImage = licenseImage;
+    }
+
+    public String getPublishIdentity() {
+        return publishIdentity;
+    }
+
+    public String getAuthenticationBackImage() {
+        return authenticationBackImage;
+    }
+
+    public void setAuthenticationBackImage(String authenticationBackImage) {
+        this.authenticationBackImage = authenticationBackImage;
+    }
+
+    public void setPublishIdentity(String publishIdentity) {
+        this.publishIdentity = publishIdentity;
+    }
+
     private List<String> imageList;
 
     public Integer getProductID() {
@@ -240,14 +293,6 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
         this.productQuality = productQuality;
     }
 
-    public String getPayStatus() {
-        return payStatus;
-    }
-
-    public void setPayStatus(String payStatus) {
-        this.payStatus = payStatus;
-    }
-
     public Double getPayAmount() {
         return payAmount;
     }

+ 12 - 1
src/main/java/com/caimei/modules/product/entity/CmShop.java

@@ -3,6 +3,7 @@ package com.caimei.modules.product.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * shop
@@ -12,7 +13,10 @@ import java.math.BigDecimal;
 
 public class CmShop implements Serializable {
     private Integer shopID;
-
+    /**
+     * 虚拟字段,页面使用
+     */
+    private List<CmSplitCode> splitCodes;
     /**
      * 对应的userId
      */
@@ -361,6 +365,13 @@ public class CmShop implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    public List<CmSplitCode> getSplitCodes() {
+        return splitCodes;
+    }
+
+    public void setSplitCodes(List<CmSplitCode> splitCodes) {
+        this.splitCodes = splitCodes;
+    }
 
     public Integer getShopID() {
         return shopID;

+ 42 - 0
src/main/java/com/caimei/modules/product/entity/CmSplitCode.java

@@ -0,0 +1,42 @@
+package com.caimei.modules.product.entity;
+
+import java.io.Serializable;
+
+public class CmSplitCode implements Serializable {
+    private Integer shopId;
+    private String splitCode;
+    private String codeName;
+    private String email;
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public String getCodeName() {
+        return codeName;
+    }
+
+    public void setCodeName(String codeName) {
+        this.codeName = codeName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}

+ 108 - 490
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -69,7 +69,9 @@ public class Product extends DataEntity<Product> {
     private Date downlineTime;        // 下架时间
     private String freePostFlag;        // 是否包邮 0包邮 1不包邮
     private String costPrice;        // 成本价
+    private Double SqlCostPrice;
     private String costProportional;        // 比例成本百分比
+    private Double sqlCostProportional;     //入数据库字段
     private String costCheckFlag;        // 成本价选中标志:1固定成本 2比例成
     private String precisehKey;        // 精确关键字
     private String giftFlag;//是否可以参加赠送(0:无法参加,1:可以参加赠送,2:已参加过赠送)
@@ -84,6 +86,7 @@ public class Product extends DataEntity<Product> {
     private String productDetail; //普通机构商品详情1同资质机构商品详情,2用普通机构商品详情
     private String splitCode; //  该商品分账商户号
     //-----------------  虚拟字段 ----
+    private Integer shopType; //供应商类别,普通1,新品供应商2,二手供应商3
     private boolean customClass = false;  //是否有自定义分类
     private String brandName;//品牌名称
     private String otherBrandName;//其他手填品牌名称
@@ -106,7 +109,9 @@ public class Product extends DataEntity<Product> {
     private String includedTax;//是否含税   0不含税,1含税
     private String invoiceType;//发票类型(基于是否含税基础)   1增值税票,2普通票, 3不能开票
     private String taxPoint;//机构开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
+    private Double sqlTaxPoint;
     private String supplierTaxPoint;//供应商开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
+    private Double sqlSupplierTaxPoint;//供应商开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
     private Integer giftNumber;//赠品数量
     private BigDecimal reducedPrice;//优惠价格
     private String promotionType;//促销类型
@@ -127,6 +132,13 @@ public class Product extends DataEntity<Product> {
     private Integer trainingType; //售价是否包含:1售价未包含,2售价已包含
     private BigDecimal trainingFee; //培训费用(售价未包含)
     private Integer svipFlag;	//超级会员商品标识:1是,2不是
+    private Integer publishIdentity; //发布者身份 1,个人,2.公司
+    private String companyName; //公司名称
+    private String image1;
+    private String image2;
+    private String image3;
+    private String image4;
+    private String image5;
 
     //以下参数是搜索回显参数
     private String searchName;
@@ -212,6 +224,94 @@ public class Product extends DataEntity<Product> {
      */
     private Integer searchType;
 
+    public Double getSqlCostProportional() {
+        return sqlCostProportional;
+    }
+
+    public void setSqlCostProportional(Double sqlCostProportional) {
+        this.sqlCostProportional = sqlCostProportional;
+    }
+
+    public Double getSqlTaxPoint() {
+        return sqlTaxPoint;
+    }
+
+    public void setSqlTaxPoint(Double sqlTaxPoint) {
+        this.sqlTaxPoint = sqlTaxPoint;
+    }
+
+    public Double getSqlCostPrice() {
+        return SqlCostPrice;
+    }
+
+    public void setSqlCostPrice(Double sqlCostPrice) {
+        SqlCostPrice = sqlCostPrice;
+    }
+
+    public Integer getShopType() {
+        return shopType;
+    }
+
+    public void setShopType(Integer shopType) {
+        this.shopType = shopType;
+    }
+
+    public Double getSqlSupplierTaxPoint() {
+        return sqlSupplierTaxPoint;
+    }
+
+    public void setSqlSupplierTaxPoint(Double sqlSupplierTaxPoint) {
+        this.sqlSupplierTaxPoint = sqlSupplierTaxPoint;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getImage1() {
+        return image1;
+    }
+
+    public void setImage1(String image1) {
+        this.image1 = image1;
+    }
+
+    public String getImage2() {
+        return image2;
+    }
+
+    public void setImage2(String image2) {
+        this.image2 = image2;
+    }
+
+    public String getImage3() {
+        return image3;
+    }
+
+    public void setImage3(String image3) {
+        this.image3 = image3;
+    }
+
+    public String getImage4() {
+        return image4;
+    }
+
+    public void setImage4(String image4) {
+        this.image4 = image4;
+    }
+
+    public String getImage5() {
+        return image5;
+    }
+
+    public void setImage5(String image5) {
+        this.image5 = image5;
+    }
+
     public String getSplitCode() {
         return splitCode;
     }
@@ -220,6 +320,14 @@ public class Product extends DataEntity<Product> {
         this.splitCode = splitCode;
     }
 
+    public Integer getPublishIdentity() {
+        return publishIdentity;
+    }
+
+    public void setPublishIdentity(Integer publishIdentity) {
+        this.publishIdentity = publishIdentity;
+    }
+
     public String getProductDescribe() {
         return productDescribe;
     }
@@ -349,22 +457,6 @@ public class Product extends DataEntity<Product> {
         this.displayOnCRMFlag = displayOnCRMFlag;
     }
 
-//    public Integer getCrmBigTypeId() {
-//        return crmBigTypeId;
-//    }
-//
-//    public void setCrmBigTypeId(Integer crmBigTypeId) {
-//        this.crmBigTypeId = crmBigTypeId;
-//    }
-//
-//    public Integer getCrmSmallTypeId() {
-//        return crmSmallTypeId;
-//    }
-//
-//    public void setCrmSmallTypeId(Integer crmSmallTypeId) {
-//        this.crmSmallTypeId = crmSmallTypeId;
-//    }
-
     public Integer getProductID() {
         return productID;
     }
@@ -413,54 +505,6 @@ public class Product extends DataEntity<Product> {
         this.searchKey = searchKey;
     }
 
-//    public String getLowestUserLevelID() {
-//        return lowestUserLevelID;
-//    }
-//
-//    public void setLowestUserLevelID(String lowestUserLevelID) {
-//        this.lowestUserLevelID = lowestUserLevelID;
-//    }
-//
-//    public BigDecimal getPrice0() {
-//        return price0;
-//    }
-//
-//    public void setPrice0(BigDecimal price0) {
-//        this.price0 = price0;
-//    }
-//
-//    public String getPrice0Text() {
-//        return price0Text;
-//    }
-//
-//    public void setPrice0Text(String price0Text) {
-//        this.price0Text = price0Text;
-//    }
-//
-//    public String getPrice0TextFlag() {
-//        return price0TextFlag;
-//    }
-//
-//    public void setPrice0TextFlag(String price0TextFlag) {
-//        this.price0TextFlag = price0TextFlag;
-//    }
-//
-//    public BigDecimal getPrice1() {
-//        return price1;
-//    }
-//
-//    public void setPrice1(BigDecimal price1) {
-//        this.price1 = price1;
-//    }
-//
-//    public String getPrice1Text() {
-//        return price1Text;
-//    }
-//
-//    public void setPrice1Text(String price1Text) {
-//        this.price1Text = price1Text;
-//    }
-
     public String getPriceFlag() {
         return priceFlag;
     }
@@ -469,14 +513,6 @@ public class Product extends DataEntity<Product> {
         this.priceFlag = priceFlag;
     }
 
-//    public BigDecimal getPrice8() {
-//        return price8;
-//    }
-//
-//    public void setPrice8(BigDecimal price8) {
-//        this.price8 = price8;
-//    }
-
     public String getbeautyActFlag() {
         return beautyActFlag;
     }
@@ -485,14 +521,6 @@ public class Product extends DataEntity<Product> {
         this.beautyActFlag = beautyActFlag;
     }
 
-//    public String getbeautyActFlagFlag() {
-//        return beautyActFlagFlag;
-//    }
-//
-//    public void setbeautyActFlagFlag(String beautyActFlagFlag) {
-//        this.beautyActFlagFlag = beautyActFlagFlag;
-//    }
-
     public String getLadderPriceFlag() {
         return ladderPriceFlag;
     }
@@ -501,62 +529,6 @@ public class Product extends DataEntity<Product> {
         this.ladderPriceFlag = ladderPriceFlag;
     }
 
-//    public BigDecimal getPrice2() {
-//        return price2;
-//    }
-//
-//    public void setPrice2(BigDecimal price2) {
-//        this.price2 = price2;
-//    }
-//
-//    public BigDecimal getPrice3() {
-//        return price3;
-//    }
-//
-//    public void setPrice3(BigDecimal price3) {
-//        this.price3 = price3;
-//    }
-//
-//    public BigDecimal getPrice4() {
-//        return price4;
-//    }
-//
-//    public void setPrice4(BigDecimal price4) {
-//        this.price4 = price4;
-//    }
-//
-//    public BigDecimal getPrice5() {
-//        return price5;
-//    }
-//
-//    public void setPrice5(BigDecimal price5) {
-//        this.price5 = price5;
-//    }
-//
-//    public BigDecimal getPrice6() {
-//        return price6;
-//    }
-//
-//    public void setPrice6(BigDecimal price6) {
-//        this.price6 = price6;
-//    }
-//
-//    public BigDecimal getPrice7() {
-//        return price7;
-//    }
-//
-//    public void setPrice7(BigDecimal price7) {
-//        this.price7 = price7;
-//    }
-//
-//    public String getFee() {
-//        return fee;
-//    }
-//
-//    public void setFee(String fee) {
-//        this.fee = fee;
-//    }
-
     public String getStock() {
         return stock;
     }
@@ -701,22 +673,6 @@ public class Product extends DataEntity<Product> {
         this.productCode = productCode;
     }
 
-//    public String getRate1() {
-//        return rate1;
-//    }
-//
-//    public void setRate1(String rate1) {
-//        this.rate1 = rate1;
-//    }
-//
-//    public String getRate2() {
-//        return rate2;
-//    }
-//
-//    public void setRate2(String rate2) {
-//        this.rate2 = rate2;
-//    }
-
     public String getUnit() {
         return unit;
     }
@@ -765,14 +721,6 @@ public class Product extends DataEntity<Product> {
         this.maxBuyNumber = maxBuyNumber;
     }
 
-//    public String getVirtualFlag() {
-//        return virtualFlag;
-//    }
-//
-//    public void setVirtualFlag(String virtualFlag) {
-//        this.virtualFlag = virtualFlag;
-//    }
-
     public String getMinBuyNumber() {
         return minBuyNumber;
     }
@@ -837,127 +785,6 @@ public class Product extends DataEntity<Product> {
         this.step = step;
     }
 
-//    public String getSpeCommisionFlag() {
-//        return speCommisionFlag;
-//    }
-//
-//    public void setSpeCommisionFlag(String speCommisionFlag) {
-//        this.speCommisionFlag = speCommisionFlag;
-//    }
-//
-//    public String getSpeCommision() {
-//        return speCommision;
-//    }
-//
-//    public void setSpeCommision(String speCommision) {
-//        this.speCommision = speCommision;
-//    }
-//
-//    public String getVideourl() {
-//        return videourl;
-//    }
-//
-//    public void setVideourl(String videourl) {
-//        this.videourl = videourl;
-//    }
-//
-//    public String getProps() {
-//        return props;
-//    }
-//
-//    public void setProps(String props) {
-//        this.props = props;
-//    }
-//
-//    public String getProviders() {
-//        return providers;
-//    }
-//
-//    public void setProviders(String providers) {
-//        this.providers = providers;
-//    }
-//
-//    public String getServiceCommissionRatio() {
-//        return serviceCommissionRatio;
-//    }
-//
-//    public void setServiceCommissionRatio(String serviceCommissionRatio) {
-//        this.serviceCommissionRatio = serviceCommissionRatio;
-//    }
-//
-//    public String getReCommissionRatio() {
-//        return reCommissionRatio;
-//    }
-//
-//    public void setReCommissionRatio(String reCommissionRatio) {
-//        this.reCommissionRatio = reCommissionRatio;
-//    }
-//
-//    public String getPushToERPName() {
-//        return pushToERPName;
-//    }
-//
-//    public void setPushToERPName(String pushToERPName) {
-//        this.pushToERPName = pushToERPName;
-//    }
-//
-//    public String getProdBeans() {
-//        return prodBeans;
-//    }
-//
-//    public void setProdBeans(String prodBeans) {
-//        this.prodBeans = prodBeans;
-//    }
-//
-//    public String getUseBeansFlag() {
-//        return useBeansFlag;
-//    }
-//
-//    public void setUseBeansFlag(String useBeansFlag) {
-//        this.useBeansFlag = useBeansFlag;
-//    }
-//
-//    public String getPrivateFlag() {
-//        return privateFlag;
-//    }
-//
-//    public void setPrivateFlag(String privateFlag) {
-//        this.privateFlag = privateFlag;
-//    }
-//
-//    public String getInvisibleServiceProviderIDs() {
-//        return invisibleServiceProviderIDs;
-//    }
-//
-//    public void setInvisibleServiceProviderIDs(String invisibleServiceProviderIDs) {
-//        this.invisibleServiceProviderIDs = invisibleServiceProviderIDs;
-//    }
-//
-//    public String getNeedServiceFlag() {
-//        return needServiceFlag;
-//    }
-//
-//    public void setNeedServiceFlag(String needServiceFlag) {
-//        this.needServiceFlag = needServiceFlag;
-//    }
-//
-//
-//    public Date getBeginTime() {
-//        return beginTime;
-//    }
-//
-//    public void setBeginTime(Date beginTime) {
-//        this.beginTime = beginTime;
-//    }
-//
-//    public Date getEndTime() {
-//        return endTime;
-//    }
-//
-//    public void setEndTime(Date endTime) {
-//        this.endTime = endTime;
-//    }
-
     public String getActFlag() {
         return actFlag;
     }
@@ -990,14 +817,6 @@ public class Product extends DataEntity<Product> {
         this.downlineTime = downlineTime;
     }
 
-//    public String getShopIndexModuleID() {
-//        return shopIndexModuleID;
-//    }
-//
-//    public void setShopIndexModuleID(String shopIndexModuleID) {
-//        this.shopIndexModuleID = shopIndexModuleID;
-//    }
-
     public String getFreePostFlag() {
         return freePostFlag;
     }
@@ -1038,39 +857,6 @@ public class Product extends DataEntity<Product> {
         this.precisehKey = precisehKey;
     }
 
-//    public String getDocBoost() {
-//        return docBoost;
-//    }
-//
-//    public void setDocBoost(String docBoost) {
-//        this.docBoost = docBoost;
-//    }
-//
-//    public String getCmbeanFlag() {
-//        return cmbeanFlag;
-//    }
-//
-//    public void setCmbeanFlag(String cmbeanFlag) {
-//        this.cmbeanFlag = cmbeanFlag;
-//    }
-//
-//    public String getCmbeanPrice() {
-//        return cmbeanPrice;
-//    }
-//
-//    public void setCmbeanPrice(String cmbeanPrice) {
-//        this.cmbeanPrice = cmbeanPrice;
-//    }
-//
-//    public String getCmbeanSort() {
-//        return cmbeanSort;
-//    }
-//
-//    public void setCmbeanSort(String cmbeanSort) {
-//        this.cmbeanSort = cmbeanSort;
-//    }
-
-
     public String getShopName() {
         return shopName;
     }
@@ -1087,102 +873,6 @@ public class Product extends DataEntity<Product> {
         this.giftFlag = giftFlag;
     }
 
-//    public Float getActFullReduceAmount() {
-//        return actFullReduceAmount;
-//    }
-//
-//    public void setActFullReduceAmount(Float actFullReduceAmount) {
-//        this.actFullReduceAmount = actFullReduceAmount;
-//    }
-//
-//    public Float getActReduceAmount() {
-//        return actReduceAmount;
-//    }
-//
-//    public void setActReduceAmount(Float actReduceAmount) {
-//        this.actReduceAmount = actReduceAmount;
-//    }
-//
-//    public Float getActFullGiftAmount() {
-//        return actFullGiftAmount;
-//    }
-//
-//    public void setActFullGiftAmount(Float actFullGiftAmount) {
-//        this.actFullGiftAmount = actFullGiftAmount;
-//    }
-//
-//    public Integer getActBuyGiftNum() {
-//        return actBuyGiftNum;
-//    }
-//
-//    public void setActBuyGiftNum(Integer actBuyGiftNum) {
-//        this.actBuyGiftNum = actBuyGiftNum;
-//    }
-//
-//    public Float getActPrice0() {
-//        return actPrice0;
-//    }
-//
-//    public void setActPrice0(Float actPrice0) {
-//        this.actPrice0 = actPrice0;
-//    }
-//
-//    public Float getActPrice1() {
-//        return actPrice1;
-//    }
-//
-//    public void setActPrice1(Float actPrice1) {
-//        this.actPrice1 = actPrice1;
-//    }
-//
-//    public Float getActPrice2() {
-//        return actPrice2;
-//    }
-//
-//    public void setActPrice2(Float actPrice2) {
-//        this.actPrice2 = actPrice2;
-//    }
-//
-//    public Float getActPrice3() {
-//        return actPrice3;
-//    }
-//
-//    public void setActPrice3(Float actPrice3) {
-//        this.actPrice3 = actPrice3;
-//    }
-//
-//    public Float getActPrice4() {
-//        return actPrice4;
-//    }
-//
-//    public void setActPrice4(Float actPrice4) {
-//        this.actPrice4 = actPrice4;
-//    }
-//
-//    public Float getActPrice5() {
-//        return actPrice5;
-//    }
-//
-//    public void setActPrice5(Float actPrice5) {
-//        this.actPrice5 = actPrice5;
-//    }
-//
-//    public Float getActPrice6() {
-//        return actPrice6;
-//    }
-//
-//    public void setActPrice6(Float actPrice6) {
-//        this.actPrice6 = actPrice6;
-//    }
-//
-//    public Float getActPrice7() {
-//        return actPrice7;
-//    }
-//
-//    public void setActPrice7(Float actPrice7) {
-//        this.actPrice7 = actPrice7;
-//    }
-
     public Double getNormalPrice() {
         return normalPrice;
     }
@@ -1199,22 +889,6 @@ public class Product extends DataEntity<Product> {
         this.price = price;
     }
 
-//    public Float getHighestUserLevelPrice() {
-//        return highestUserLevelPrice;
-//    }
-//
-//    public void setHighestUserLevelPrice(Float highestUserLevelPrice) {
-//        this.highestUserLevelPrice = highestUserLevelPrice;
-//    }
-//
-//    public Float getLowestUserLevelPrice() {
-//        return lowestUserLevelPrice;
-//    }
-//
-//    public void setLowestUserLevelPrice(Float lowestUserLevelPrice) {
-//        this.lowestUserLevelPrice = lowestUserLevelPrice;
-//    }
-
     public String getBeginTimeStr() {
         return beginTimeStr;
     }
@@ -1380,30 +1054,6 @@ public class Product extends DataEntity<Product> {
         this.aliasName = aliasName;
     }
 
-//    public String getPrice0Grade() {
-//        return price0Grade;
-//    }
-//
-//    public void setPrice0Grade(String price0Grade) {
-//        this.price0Grade = price0Grade;
-//    }
-//
-//    public String getPrice1Grade() {
-//        return price1Grade;
-//    }
-//
-//    public void setPrice1Grade(String price1Grade) {
-//        this.price1Grade = price1Grade;
-//    }
-//
-//    public String getPrice8Grade() {
-//        return price8Grade;
-//    }
-//
-//    public void setPrice8Grade(String price8Grade) {
-//        this.price8Grade = price8Grade;
-//    }
-
     public String getVisibility() {
         return visibility;
     }
@@ -1412,22 +1062,6 @@ public class Product extends DataEntity<Product> {
         this.visibility = visibility;
     }
 
-//    public String getSurplusTime() {
-//        return surplusTime;
-//    }
-//
-//    public void setSurplusTime(String surplusTime) {
-//        this.surplusTime = surplusTime;
-//    }
-//
-//    public String getPriceType() {
-//        return priceType;
-//    }
-//
-//    public void setPriceType(String priceType) {
-//        this.priceType = priceType;
-//    }
-
     public String getTags() {
         return tags;
     }
@@ -1444,22 +1078,6 @@ public class Product extends DataEntity<Product> {
         this.machineType = machineType;
     }
 
-//    public Integer getClassifyId() {
-//        return classifyId;
-//    }
-//
-//    public void setClassifyId(Integer classifyId) {
-//        this.classifyId = classifyId;
-//    }
-//
-//    public Date getClassifyAddTime() {
-//        return classifyAddTime;
-//    }
-//
-//    public void setClassifyAddTime(Date classifyAddTime) {
-//        this.classifyAddTime = classifyAddTime;
-//    }
-
     public Integer getCombinationID() {
         return combinationID;
     }

+ 96 - 53
src/main/java/com/caimei/modules/product/service/CmSecondHandDetailService.java

@@ -3,8 +3,10 @@ package com.caimei.modules.product.service;
 import java.util.Date;
 import java.util.List;
 
+import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.utils.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -17,6 +19,7 @@ import javax.annotation.Resource;
 
 /**
  * 二手商品Service
+ *
  * @author admin
  * @version 2020-07-15
  */
@@ -24,57 +27,97 @@ import javax.annotation.Resource;
 @Transactional(readOnly = true)
 public class CmSecondHandDetailService extends CrudService<CmSecondHandDetailDao, CmSecondHandDetail> {
 
-@Resource
-private CmSecondHandDetailDao cmSecondHandDetailDao;
-@Resource
-private ProductDao productDao;
-
-	public CmSecondHandDetail get(String id) {
-		return super.get(id);
-	}
-
-	public List<CmSecondHandDetail> findList(CmSecondHandDetail cmSecondHandDetail) {
-		return super.findList(cmSecondHandDetail);
-	}
-
-	public Page<CmSecondHandDetail> findPage(Page<CmSecondHandDetail> page, CmSecondHandDetail cmSecondHandDetail) {
-		return super.findPage(page, cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void save(CmSecondHandDetail cmSecondHandDetail) {
-		super.save(cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void delete(CmSecondHandDetail cmSecondHandDetail) {
-		super.delete(cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void updateRevieweInfo(Date reviewedDate, Date onLineDate,Integer productID){
-		cmSecondHandDetailDao.updateRevieweInfo(reviewedDate,onLineDate,productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void updateOnLineDate(Date date,Integer productID) {
-		cmSecondHandDetailDao.updateOnLineDate(date,productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void saveProduct(Product product) {
-		Integer productID = product.getProductID();
-		if(null != productID){
-			// 更新
-			productDao.updateByPrimaryKeySelective(product);
-		}else{
-		    // 插入
-		    productDao.insertProduct(product);
-		}
-	}
-
-	@Transactional(readOnly = false)
-	public void updatSecondHnadproductSold(Integer productID) {
-		cmSecondHandDetailDao.updatSecondHnadproductSold(productID);
-	}
+    @Resource
+    private CmSecondHandDetailDao cmSecondHandDetailDao;
+    @Resource
+    private ProductDao productDao;
+
+    public CmSecondHandDetail get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmSecondHandDetail> findList(CmSecondHandDetail cmSecondHandDetail) {
+        return super.findList(cmSecondHandDetail);
+    }
+
+    public Page<CmSecondHandDetail> findPage(Page<CmSecondHandDetail> page, CmSecondHandDetail cmSecondHandDetail) {
+        return super.findPage(page, cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmSecondHandDetail cmSecondHandDetail) {
+        super.save(cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmSecondHandDetail cmSecondHandDetail) {
+        super.delete(cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateRevieweInfo(Date reviewedDate, Date onLineDate, Integer productID) {
+        cmSecondHandDetailDao.updateRevieweInfo(reviewedDate, onLineDate, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateOnLineDate(Date date, Integer productID) {
+        cmSecondHandDetailDao.updateOnLineDate(date, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveProduct(Product product) {
+        Integer productID = product.getProductID();
+        if (null != productID) {
+            // 更新
+            productDao.updateByPrimaryKeySelective(product);
+        } else {
+            // 插入
+            productDao.insertProduct(product);
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void updatSecondHnadproductSold(Integer productID) {
+        cmSecondHandDetailDao.updatSecondHnadproductSold(productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveFileType(Integer productId, String secondId, List<String> fileTypes) {
+        cmSecondHandDetailDao.deleteFileType(productId);
+        for (String fileType : fileTypes) {
+            cmSecondHandDetailDao.insertFileType(productId, secondId, fileType);
+        }
+    }
+
+    public void setValue(CmSecondHandDetail cmSecondHandDetail) {
+        Integer productID = cmSecondHandDetail.getProductID();
+        CmSecondHandDetail value = cmSecondHandDetailDao.findValue(productID);
+        if (null != value) {
+            if (StringUtils.isNoneBlank(value.getAuthenticationBackImage())) {
+                cmSecondHandDetail.setAuthenticationBackImage(value.getAuthenticationBackImage());
+            }
+            if (null != value.getPublishIdentity()) {
+                cmSecondHandDetail.setPublishIdentity(value.getPublishIdentity());
+            }
+            if (StringUtils.isNotBlank(value.getLicenseImage())) {
+                cmSecondHandDetail.setLicenseImage(value.getLicenseImage());
+            }
+            List<Integer> flieTypes = cmSecondHandDetailDao.findFlieTypes(productID);
+            if (null != flieTypes && flieTypes.size() > 0) {
+                cmSecondHandDetail.setFileTypes(flieTypes);
+            }
+            if (null != value.getCardNumber()) {
+                cmSecondHandDetail.setCardNumber(value.getCardNumber());
+            }
+        }
+    }
+
+    public Integer findSecondShop(String cardNumber) {
+        return cmSecondHandDetailDao.findShopId(cardNumber);
+    }
+
+    @Transactional(readOnly = false)
+    public void insertShop(Shop shopVo) {
+        cmSecondHandDetailDao.insertShop(shopVo);
+    }
 }

+ 123 - 4
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -3,14 +3,19 @@ package com.caimei.modules.product.service;
 
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.hehe.dao.*;
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheCollageProduct;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
 import com.caimei.modules.product.dao.CmPromotionDao;
+import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.dao.ProductNewDao;
-import com.caimei.modules.product.entity.CmPromotion;
-import com.caimei.modules.product.entity.Product;
-import com.caimei.modules.product.entity.ProductParameters;
-import com.caimei.modules.product.entity.ProductStatusRecord;
+import com.caimei.modules.product.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.po.ProductImage;
+import com.caimei.po.ProductLadderPrice;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
@@ -40,7 +45,21 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     @Autowired
     ProductNewDao productNewDao;
     @Autowired
+    ProductDao productDao;
+    @Autowired
     private CmPromotionDao cmPromotionDao;
+    @Autowired
+    private CmHeheProductDao cmHeheProductDao;
+    @Autowired
+    private CmHeheActivityProductDao cmHeheActivityProductDao;
+    @Autowired
+    private CmHeheCollageProductDao cmHeheCollageProductDao;
+    @Autowired
+    private CmHeheCouponDao cmHeheCouponDao;
+    @Autowired
+    private CmHeheFloorProductDao cmHeheFloorProductDao;
+    @Autowired
+    private ProductService productService;
 
     @Override
     public Product get(String id) {
@@ -264,4 +283,104 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         }
         return recordList;
     }
+
+    public void moveHeheProducts() {
+        Integer shopId = productNewDao.getShopIdByName("采美奥泰");
+        if (null != shopId) {
+            List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
+            heheProductList.forEach(heheProduct->{
+                Integer heheProductId = Integer.parseInt(heheProduct.getId());
+                Integer oldProductId = heheProduct.getProductId();
+                // 采美商品id
+                Integer productId = heheProduct.getProductId();
+                // 查询商品
+                Product product = productNewDao.get(productId.toString());
+                product.setId(null);
+                product.setSplitCode("E1807059160");
+                product.setShopID(shopId);
+                // 置为冻结状态
+                product.setValidFlag("10");
+                // 添加商品到奥泰特殊供应商下
+                productDao.insert(product);
+                Integer newProductId = product.getProductID();
+                // 查询商品详情信息
+                ProductDetailInfo productDetailInfo = productService.getProductDetailInfo(productId);
+                productDetailInfo.setProductID(newProductId);
+                productDao.insertProductDetailInfo(productDetailInfo);
+                // 查询阶梯列表
+                List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(productId);
+                ladderPriceList.forEach(ladder->{
+                    ladder.setProductId(newProductId);
+                    productDao.insertLadderPrice(ladder);
+                });
+                // 查询商品图片
+                List<ProductImage> imageList = productNewDao.getImageList(productId);
+                imageList.forEach(image->{
+                    image.setProductID(newProductId);
+                    productNewDao.insertProductImage(image);
+                });
+                // 查询相关参数
+                List<ProductParameters> productParams = getProductParams(productId);
+                productParams.forEach(productParam->{
+                    productParam.setProductId(newProductId);
+                    productNewDao.insertParameters(productParam);
+                });
+                // 将呵呵商品关联到新商品上
+                cmHeheProductDao.updateProductId(oldProductId, newProductId);
+            });
+            // 更新活动商品
+            List<CmHeheActivityProduct> activityProductList = cmHeheActivityProductDao.findAllList(new CmHeheActivityProduct());
+            activityProductList.forEach(activityProduct->{
+                Integer oldProductId = activityProduct.getProductId();
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheActivityProductDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+            // 更新拼团商品
+            List<CmHeheCollageProduct> collageProductList = cmHeheCollageProductDao.findAllList(new CmHeheCollageProduct());
+            collageProductList.forEach(collageProduct->{
+                Integer oldProductId = collageProduct.getProductId();
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheCollageProductDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+            // 更新优惠券商品
+            List<Integer> productIds = cmHeheCouponDao.findAllProductIds();
+            productIds.forEach(oldProductId->{
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheCouponDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+        }
+    }
+
+    public void backHeheProducts() {
+        List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
+        heheProductList.forEach(heheProduct -> {
+            Product product = new Product();
+            product.setName(heheProduct.getName());
+            List<Product> list = productNewDao.findList(product);
+            Product preProduct = list.get(1);
+            // 将呵呵商品关联到新商品上
+            cmHeheProductDao.updateProductId(Integer.parseInt(heheProduct.getId()), preProduct.getProductID());
+        });
+
+    }
+
+    public void addProductData() {
+        List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
+        heheProductList.forEach(heheProduct->{
+            Product cmProduct = productNewDao.get(heheProduct.getOldProductId().toString());
+            if (null != cmProduct) {
+                String costPrice = cmProduct.getCostPrice();
+                String costProportional = cmProduct.getCostProportional();
+                String taxPoint = cmProduct.getTaxPoint();
+                String supplierTaxPoint = cmProduct.getSupplierTaxPoint();
+                productNewDao.addProductData(heheProduct.getProductId(), costPrice, costProportional, taxPoint, supplierTaxPoint);
+            }
+        });
+    }
 }

+ 101 - 6
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -4,13 +4,13 @@ import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.brand.dao.CmBrandDao;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.common.utils.UploadUtils;
-import com.caimei.modules.product.dao.CmBigtypeDao;
-import com.caimei.modules.product.dao.CmSmalltypeDao;
-import com.caimei.modules.product.dao.CmTinytypeDao;
-import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.dao.*;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.user.entity.SplitCode;
+import com.caimei.po.ProductImage;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.caimei.utils.AppUtils;
 import com.caimei.vo.JsonModel;
 import com.thinkgem.jeesite.common.config.Global;
@@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Service
@@ -41,7 +43,8 @@ public class ProductService extends CrudService<ProductDao, Product> {
     private CmSmalltypeDao cmSmalltypeDao;
     @Autowired
     private CmTinytypeDao cmTinytypeDao;
-
+    @Resource
+    private ProductNewDao productNewDao;
 
     @Override
     public Product get(String id) {
@@ -388,7 +391,53 @@ public class ProductService extends CrudService<ProductDao, Product> {
 //        if(StringUtils.isNotBlank(product.getSplitCode())&&"0".equals(product.getSplitCode())){
 //            product.setSplitCode(null);
 //        }
-        productDao.updateByPrimaryKeySelective(product);
+        if (null != product.getShopType() && 2 == product.getShopType()) {
+            product.setValidFlag("2");
+            if(StringUtils.isNotBlank(product.getCostPrice())){
+                product.setSqlCostPrice(Double.valueOf(product.getCostPrice()));
+            }
+            if(StringUtils.isNotBlank(product.getTaxPoint())){
+                product.setSqlTaxPoint(Double.valueOf(product.getTaxPoint()));
+            }
+            if(StringUtils.isNotBlank(product.getSupplierTaxPoint())){
+                product.setSqlSupplierTaxPoint(Double.valueOf(product.getSupplierTaxPoint()));
+            }
+            if(StringUtils.isNotBlank(product.getCostProportional())){
+                product.setSqlCostProportional(Double.valueOf(product.getCostProportional()));
+            }
+            productDao.insert(product);
+            productDetailInfo.setProductID(product.getProductID());
+            // 保存商品图片
+            String image1 = product.getImage1();
+            if (StringUtils.isNotEmpty(image1)) {
+                String imageUrl = getImageUrl(image1);
+                product.setMainImage(imageUrl);
+                addProductImage(imageUrl, "1", product.getProductID(), product.getShopID());
+            }
+            String image2 = product.getImage2();
+            if (StringUtils.isNotEmpty(image2)) {
+                String imageUrl = getImageUrl(image2);
+                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+            }
+            String image3 = product.getImage3();
+            if (StringUtils.isNotEmpty(image3)) {
+                String imageUrl = getImageUrl(image3);
+                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+            }
+            String image4 = product.getImage4();
+            if (StringUtils.isNotEmpty(image4)) {
+                String imageUrl = getImageUrl(image4);
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
+            }
+            String image5 = product.getImage5();
+            if (StringUtils.isNotEmpty(image5)) {
+                String imageUrl = getImageUrl(image5);
+                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+            }
+            productDao.updateMainImage(product);
+        }else{
+            productDao.updateByPrimaryKeySelective(product);
+        }
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         if (queryProductDetailInfo != null) {
             productDao.updateproductDetailInfo(productDetailInfo);
@@ -426,6 +475,44 @@ public class ProductService extends CrudService<ProductDao, Product> {
         }
     }
 
+    public void addProductImage(String image, String mainFlag, Integer productID, Integer shopID) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateStr = simpleDateFormat.format(new Date());
+        ProductImage productimage = new ProductImage();
+        productimage.setImage(image);
+        productimage.setProductID(productID);
+        productimage.setShopID(shopID);
+        productimage.setAddTime(dateStr);
+        productimage.setMainFlag(mainFlag);
+        productimage.setSortIndex(null);
+        productNewDao.insertProductImage(productimage);
+    }
+
+
+    /**
+     * 获取商品图片服务器全路径
+     *
+     * @param imageUrl
+     * @return
+     */
+    public String getImageUrl(String imageUrl) {
+        String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+        ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+        if (StringUtils.isNotBlank(imageUrl) && !imageUrl.startsWith("http:") && !imageUrl.startsWith("https:")) {
+            imageUrl = Encodes.urlDecode(imageUrl);
+            String realPath = UploadImageUtils.getAbsolutePath(imageUrl);
+            int pointerIndex = realPath.lastIndexOf(".");
+            try {
+                saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                imageUrl = photoServer + saveImageSerivce.getSource();
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        return imageUrl;
+    }
+
+
     /**
      * 获取未添加推荐的商品分页
      *
@@ -470,4 +557,12 @@ public class ProductService extends CrudService<ProductDao, Product> {
     public String findProductDescribe(Integer productID) {
         return productDao.findProductDescribe(productID);
     }
+
+    public List<CmShop> findSepcialShopList() {
+        return productDao.findSepcialShopList();
+    }
+
+    public List<CmSplitCode> getCodes(Integer shopId) {
+        return productDao.findSplitCodesByShopId(shopId);
+    }
 }

+ 83 - 89
src/main/java/com/caimei/modules/product/service/RepeatPurchasePriceService.java

@@ -23,99 +23,93 @@ import com.caimei.modules.product.dao.RepeatPurchasePriceDao;
 @Service
 @Transactional(readOnly = true)
 public class RepeatPurchasePriceService extends CrudService<RepeatPurchasePriceDao, RepeatPurchasePrice> {
-	@Autowired
-	private RepeatPurchasePriceDao repeatPurchasePriceDao;
+    @Autowired
+    private RepeatPurchasePriceDao repeatPurchasePriceDao;
 
-	@Autowired
-	private RepeatPurchasePriceHistoryDao repeatPurchasePriceHistoryDao;
+    @Autowired
+    private RepeatPurchasePriceHistoryDao repeatPurchasePriceHistoryDao;
 
 //	public RepeatPurchasePrice get(String id) {
 //		return super.get(id);
 //	}
-	
-	public List<RepeatPurchasePrice> findList(RepeatPurchasePrice repeatPurchasePrice) {
-		return super.findList(repeatPurchasePrice);
-	}
-	
-	public Page<RepeatPurchasePrice> findPage(Page<RepeatPurchasePrice> page, RepeatPurchasePrice repeatPurchasePrice) {
-		try{
+
+    public List<RepeatPurchasePrice> findList(RepeatPurchasePrice repeatPurchasePrice) {
+        return super.findList(repeatPurchasePrice);
+    }
+
+    public Page<RepeatPurchasePrice> findPage(Page<RepeatPurchasePrice> page, RepeatPurchasePrice repeatPurchasePrice) {
+        repeatPurchasePrice.setPage(page);
+        List<RepeatPurchasePrice> list = repeatPurchasePriceDao.findList(repeatPurchasePrice);
+        if (null != list && list.size() > 0) {
+            for (RepeatPurchasePrice bean : list) {
+                //设置用户类型
+                String type = UserType.UserType(Integer.parseInt(bean.getType()));
+                if (UserType.isClub(Integer.parseInt(bean.getType()))) {
+                    if (null != bean.getBindMobile()) bean.setMobile(bean.getBindMobile());
+                }
+                bean.setType(type);
+            }
+        }
+        page.setList(list);
+        return page;
+    }
+
+    @Transactional(readOnly = false)
+    public void save(RepeatPurchasePrice repeatPurchasePrice) {
+        super.save(repeatPurchasePrice);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(RepeatPurchasePrice repeatPurchasePrice, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
+        repeatPurchasePrice.setDelFlag("1");
+        repeatPurchasePriceDao.delete(repeatPurchasePrice);
+        List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
+        for (RepeatPurchasePriceHistory purchasePriceHistory : list) {
+            purchasePriceHistory.setDelFlag("1");
+            repeatPurchasePriceHistoryDao.delete(purchasePriceHistory);
+        }
+
+    }
+
+
+    public Page<RepeatPurchasePriceHistory> findHistoryPricePage(Page<RepeatPurchasePriceHistory> page, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
+        try {
             page.setOrderBy("createTime");
-			repeatPurchasePrice.setPage(page);
-			List<RepeatPurchasePrice> list = repeatPurchasePriceDao.findList(repeatPurchasePrice);
-			if(null != list && list.size() > 0){
-				for(RepeatPurchasePrice bean:list){
-					//设置用户类型
-					String type = UserType.UserType(Integer.parseInt(bean.getType()));
-
-					if(UserType.isClub(Integer.parseInt(bean.getType()))){
-					    if(null != bean.getBindMobile()) bean.setMobile(bean.getBindMobile());
-                    }
-                    bean.setType(type);
-				}
-			}
-			page.setList(list);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return page;
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(RepeatPurchasePrice repeatPurchasePrice) {
-		super.save(repeatPurchasePrice);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(RepeatPurchasePrice repeatPurchasePrice,RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
-		repeatPurchasePrice.setDelFlag("1");
-		repeatPurchasePriceDao.delete(repeatPurchasePrice);
-		List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
-		for (RepeatPurchasePriceHistory purchasePriceHistory : list) {
-			purchasePriceHistory.setDelFlag("1");
-			repeatPurchasePriceHistoryDao.delete(purchasePriceHistory);
-		}
-
-	}
-
-
-	public Page<RepeatPurchasePriceHistory> findHistoryPricePage(Page<RepeatPurchasePriceHistory> page, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
-		try{
-			page.setOrderBy("createTime");
-			repeatPurchasePriceHistory.setPage(page);
-			List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
-			page.setList(list);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return page;
-	}
-
-	public RepeatPurchasePrice getRepeatPurchasePrice(Integer repeatPurchasePriceId) {
-		RepeatPurchasePrice bean = new RepeatPurchasePrice();
-		try{
-			bean =  repeatPurchasePriceDao.getRepeatPurchasePrice(repeatPurchasePriceId);
-
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return bean;
-	}
-
-	public RepeatPurchasePrice getLastBuyPrice(Integer clubID, Integer uID, Integer productID) {
-		return repeatPurchasePriceDao.getLastBuyPrice(clubID, uID, productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void insert(RepeatPurchasePrice p) {
-		repeatPurchasePriceDao.insert(p);
-	}
-
-	@Transactional(readOnly = false)
-	public void update(RepeatPurchasePrice p) {
-		repeatPurchasePriceDao.update(p);
-	}
-
-	public String findPriceProductList(Integer userId){
-		return repeatPurchasePriceDao.findPriceProductList(userId);
-	}
+            repeatPurchasePriceHistory.setPage(page);
+            List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
+            page.setList(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return page;
+    }
+
+    public RepeatPurchasePrice getRepeatPurchasePrice(Integer repeatPurchasePriceId) {
+        RepeatPurchasePrice bean = new RepeatPurchasePrice();
+        try {
+            bean = repeatPurchasePriceDao.getRepeatPurchasePrice(repeatPurchasePriceId);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return bean;
+    }
+
+    public RepeatPurchasePrice getLastBuyPrice(Integer clubID, Integer uID, Integer productID) {
+        return repeatPurchasePriceDao.getLastBuyPrice(clubID, uID, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void insert(RepeatPurchasePrice p) {
+        repeatPurchasePriceDao.insert(p);
+    }
+
+    @Transactional(readOnly = false)
+    public void update(RepeatPurchasePrice p) {
+        repeatPurchasePriceDao.update(p);
+    }
+
+    public String findPriceProductList(Integer userId) {
+        return repeatPurchasePriceDao.findPriceProductList(userId);
+    }
 }

+ 42 - 15
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -4,6 +4,7 @@ import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.basesetting.entity.Address;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.brand.service.CmBrandService;
+import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.oss.utils.OSSUtils;
@@ -15,6 +16,7 @@ import com.caimei.modules.product.service.CmSecondHandDetailService;
 import com.caimei.modules.product.service.CmSecondHandTransactionService;
 import com.caimei.modules.product.service.ProductNewService;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.user.entity.SplitCode;
 import com.caimei.po.ProductImage;
 import com.caimei.redis.RedisService;
 import com.thinkgem.jeesite.common.config.Global;
@@ -37,10 +39,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 二手商品Controller
@@ -188,17 +187,41 @@ public class CmSecondHandDetailController extends BaseController {
             cmSecondHandDetail.setUrl(ossUrl);
         }
 
-
+        cmSecondHandDetailService.setValue(cmSecondHandDetail);
+        List<SplitCode> splitCodeList = productNewDao.findSecondSplitCode(cmSecondHandDetail.getId());
+        model.addAttribute("splitCodeList",splitCodeList);
         model.addAttribute("cmSecondHandDetail", cmSecondHandDetail);
         return "modules/product/cmSecondHandDetailForm";
     }
 
     @RequiresPermissions("product:cmSecondHandDetail:edit")
     @RequestMapping(value = "save")
-    public String save(CmSecondHandDetail cmSecondHandDetail, Model model, RedirectAttributes redirectAttributes) {
+    public String save(CmSecondHandDetail cmSecondHandDetail, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
         if (!beanValidator(model, cmSecondHandDetail)) {
             return form(cmSecondHandDetail, model);
         }
+        String cardNumber = cmSecondHandDetail.getCardNumber();
+        if(StringUtils.isBlank(cardNumber)){
+            addMessage(redirectAttributes,"请填写收款卡号");
+            model.addAttribute("cmSecondHandDetail",cmSecondHandDetail);
+            return "redirect:" + Global.getAdminPath() + "/product/new/list?searchProductCategory=2";
+        }
+        //根据银行卡判断是否注册过特殊二手供应商,有则挂在之前的供应商名下,否则注册新供应商
+        Integer shopId = cmSecondHandDetailService.findSecondShop(cmSecondHandDetail.getCardNumber());
+        if (null == shopId) {
+            //保存为特殊二手供应商
+            Shop shopVo = new Shop();
+            //1个人,2公司
+            String name = "1".equals(cmSecondHandDetail.getPublishIdentity()) ? cmSecondHandDetail.getContactName() : cmSecondHandDetail.getCompanyName();
+            shopVo.setName(name);
+            shopVo.setLinkMan(cmSecondHandDetail.getContactName());
+            shopVo.setContractMobile(cmSecondHandDetail.getContactMobile());
+            shopVo.setCardNumber(cmSecondHandDetail.getCardNumber());
+            cmSecondHandDetailService.insertShop(shopVo);
+            shopId = shopVo.getShopID();
+        }
+        String[] ids = request.getParameterValues("ids");
+        List<String> fileTypes = Arrays.asList(ids);
         String validFlag = cmSecondHandDetail.getValidFlag();
         Date date = new Date();
         String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
@@ -210,7 +233,7 @@ public class CmSecondHandDetailController extends BaseController {
         product.setProductCategory("2");
         product.setPreferredFlag(0);
         // 默认发布到二手供应商
-        product.setShopID(1252);
+        product.setShopID(shopId);
         product.setName(cmSecondHandDetail.getName());
         product.setAliasName(cmSecondHandDetail.getName());
         product.setVisibility(cmSecondHandDetail.getVisibility());
@@ -242,6 +265,7 @@ public class CmSecondHandDetailController extends BaseController {
             product.setAddTime(dateStr);
 
         }
+        product.setSplitCode(cmSecondHandDetail.getSplitCode());
         product.setLadderPriceFlag("0");
         product.setSortIndex("1");
         product.setFeaturedFlag("0");
@@ -275,15 +299,8 @@ public class CmSecondHandDetailController extends BaseController {
             product.setMainImage(imageUrl);
         }
         cmSecondHandDetailService.saveProduct(product);
-
-        String payStatus = cmSecondHandDetail.getPayStatus();
         String payType = cmSecondHandDetail.getPayType();
-        if (StringUtils.equals("2", payStatus) && StringUtils.isEmpty(payType)) {
-            //后台是已付款且之前从未付款当做是后台直接付款
-            cmSecondHandDetail.setPayType("0");
-        }
         cmSecondHandDetail.setProductID(product.getProductID());
-
         // 地址优化
         Integer townId = cmSecondHandDetail.getTownId();
         String provinceCityDistrict = "";
@@ -328,9 +345,19 @@ public class CmSecondHandDetailController extends BaseController {
             String imageUrl = getImageUrl(commitmentImage);
             cmSecondHandDetail.setCommitmentImage(imageUrl);
         }
-
+        String authenticationBackImage = cmSecondHandDetail.getAuthenticationBackImage();
+        if (StringUtils.isNotEmpty(authenticationBackImage)) {
+            String imageUrl = getImageUrl(authenticationBackImage);
+            cmSecondHandDetail.setAuthenticationBackImage(imageUrl);
+        }
+        String licenseImage = cmSecondHandDetail.getLicenseImage();
+        if (StringUtils.isNotEmpty(licenseImage)) {
+            String imageUrl = getImageUrl(licenseImage);
+            cmSecondHandDetail.setLicenseImage(imageUrl);
+        }
         // 保存二手详细信息
         cmSecondHandDetailService.save(cmSecondHandDetail);
+        cmSecondHandDetailService.saveFileType(product.getProductID(), cmSecondHandDetail.getId(), fileTypes);
         if (null != product.getProductID()) {
             //删除之前图片再添加
             productNewService.deleteImageByProductId(product.getProductID());

+ 189 - 1
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -1,26 +1,31 @@
 package com.caimei.modules.product.web;
 
+import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.brand.service.CmBrandService;
 import com.caimei.modules.common.entity.Province;
 import com.caimei.modules.common.service.AreaService;
+import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.opensearch.CoreServiceUitls;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.product.dao.ProductNewDao;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.service.*;
+import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.entity.CmPageModules;
 import com.caimei.modules.user.entity.CmUserOrganize;
 import com.caimei.modules.user.entity.SplitCode;
 import com.caimei.modules.user.service.CmUserOrganizeService;
 import com.caimei.po.ProductImage;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.caimei.redis.RedisService;
 import com.caimei.utils.AppUtils;
 import com.caimei.vo.JsonModel;
 import com.google.common.collect.Maps;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.Encodes;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
 import org.apache.commons.collections.CollectionUtils;
@@ -159,7 +164,6 @@ public class ProductNewController extends BaseController {
         }
         product.setInstrumentType(StringUtils.isNotEmpty(product.getInstrumentType()) ? product.getInstrumentType() : null);
         product.setSold(StringUtils.isNotEmpty(product.getSold()) ? product.getSold() : null);
-        product.setPayStatus(StringUtils.isNotEmpty(product.getPayStatus()) ? product.getPayStatus() : null);
         product.setBrandID(product.getBrandID() != null && product.getBrandID() != 0 ? product.getBrandID() : null);
         String searchProductCategory = product.getSearchProductCategory();
         if (StringUtils.isNotBlank(searchProductCategory)) {
@@ -244,6 +248,48 @@ public class ProductNewController extends BaseController {
         }
     }
 
+    @RequestMapping(value = "productAdd")
+    public String addProduct(Product product, Model model) {
+        List<CmBrand> brandList = productService.findBrandList();
+        List<CmShop> shopList = productService.findSepcialShopList();
+        //解析商品搜索关键字(搜索关键词目前最多只能5个)
+        String searchKey = product.getSearchKey();
+        List<String> searchKeyList = new ArrayList<String>(5);
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        if (StringUtils.isNotEmpty(searchKey)) {
+            boolean contains = searchKey.contains("##");
+            boolean contains1 = searchKey.contains(",");
+            if (contains) {
+                String[] split = searchKey.split("##");
+                for (int i = 0; (i < split.length && i < 5); i++) {
+                    searchKeyList.set(i, split[i]);
+                }
+            } else if (contains1) {
+                String[] split = searchKey.split(",");
+                for (int i = 0; (i < split.length && i < 5); i++) {
+                    searchKeyList.set(i, split[i]);
+                }
+            } else {
+                searchKeyList.set(0, searchKey);
+            }
+        }
+        product.setSearchKeyList(searchKeyList);
+        model.addAttribute("brandList", brandList);
+        model.addAttribute("shopList", shopList);
+        model.addAttribute("product", product);
+        return "modules/product-new/cmNewProductForm";
+    }
+
+    @RequestMapping(value = "getCodes")
+    @ResponseBody
+    public List<CmSplitCode> getCodes(Integer shopId) {
+        return productService.getCodes(shopId);
+    }
+
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = "productEdit")
     public String editProduct(Product product, Model model) {
@@ -259,9 +305,24 @@ public class ProductNewController extends BaseController {
             product.setProductDescribe(productService.findProductDescribe(product.getProductID()));
             product.setLadderPriceList(ladderPriceList);
             product.setProductDetail(productService.findProductDetail(product.getProductID()));
+        } else {
+            //发布特殊商品给默认值
+            product.setIncludedTax("2");
+            product.setInvoiceType("3");
+            product.setStep("1");
+            product.setAllAreaFlag("1");
+            product.setLadderPriceFlag("0");
+            product.setPrice(0d);
+            product.setSvipFlag(2);
+            product.setCommodityType("1");
+            product.setBigTypeID(0);
+            product.setSmallTypeID(0);
+            product.setTinyTypeID(0);
+            product.setShopType(2);
         }
         product.setCommodityType(StringUtils.isEmpty(product.getCommodityType()) ? "0" : product.getCommodityType());
         List<CmBrand> brandList = productService.findBrandList();
+        List<CmShop> shopList = productService.findSepcialShopList();
         Map<String, Object> classify = productService.findClassify(1);
         List<Province> provinceList = areaService.loadProvince();
         List<CmProductCombination> combinationList = cmProductCombinationService.findProductCombinationList();
@@ -304,12 +365,72 @@ public class ProductNewController extends BaseController {
         model.addAttribute("splitCodeList",splitCodeList);
         model.addAttribute("combinationList", combinationList);
         model.addAttribute("brandList", brandList);
+        model.addAttribute("shopList", shopList);
         model.addAttribute("classify", classify);
         model.addAttribute("provinceList", provinceList);
         model.addAttribute("product", product);
         return "modules/product-new/productEdit";
     }
 
+    @RequestMapping(value = "productNewSave")
+    public String productNewSave(Product product, RedirectAttributes redirectAttributes) {
+        // 组合搜索关键词
+        List<String> searchKeyList = product.getSearchKeyList();
+        String searchKeyStr = "";
+        for (int j = 0; j < searchKeyList.size(); j++) {
+            searchKeyStr += searchKeyList.get(j);
+            if (j != 5) {
+                searchKeyStr += "##";
+            }
+        }
+        product.setSearchKey(searchKeyStr);
+        product.setValidFlag("2");
+        productService.save(product);
+
+        // 保存商品图片
+        String image1 = product.getImage1();
+        if (StringUtils.isNotEmpty(image1)) {
+            String imageUrl = getImageUrl(image1);
+            addProductImage(imageUrl, "1", Integer.valueOf(product.getId()), product.getShopID());
+        }
+        String image2 = product.getImage2();
+        if (StringUtils.isNotEmpty(image2)) {
+            String imageUrl = getImageUrl(image2);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()), product.getShopID());
+        }
+        String image3 = product.getImage3();
+        if (StringUtils.isNotEmpty(image3)) {
+            String imageUrl = getImageUrl(image3);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()), product.getShopID());
+        }
+        String image4 = product.getImage4();
+        if (StringUtils.isNotEmpty(image4)) {
+            String imageUrl = getImageUrl(image4);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()), product.getShopID());
+        }
+        String image5 = product.getImage5();
+        if (StringUtils.isNotEmpty(image5)) {
+            String imageUrl = getImageUrl(image5);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()), product.getShopID());
+        }
+        // 保存商品相关参数
+        List<ProductParameters> productParametersList = product.getProductParametersList();
+        if (CollectionUtils.isNotEmpty(productParametersList) && productParametersList.size() > 0) {
+            for (ProductParameters p : productParametersList) {
+                if (null != p && StringUtils.isNotEmpty(p.getParamsName()) && StringUtils.isNotEmpty(p.getParamsContent())) {
+                    p.setProductId(product.getProductID());
+                    p.setDelFlag("0");
+                    productNewService.insertParameters(p);
+                }
+            }
+        }
+        // 有数据变动时需要清除缓存
+        cleanRedisCache();
+        // 更新索引
+        coreServiceUitls.updateProductIndex(product.getProductID());
+        return "redirect:" + Global.getAdminPath() + "/product/new/list/";
+    }
+
     @RequiresPermissions("product:product:edit")
     @RequestMapping(value = "productSave")
     public String productSave(Product product, ProductDetailInfo productDetailInfo, RedirectAttributes redirectAttributes) {
@@ -362,6 +483,42 @@ public class ProductNewController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/product/new/list/";
     }
 
+    public void addProductImage(String image, String mainFlag, Integer productID, Integer shopID) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateStr = simpleDateFormat.format(new Date());
+        ProductImage productimage = new ProductImage();
+        productimage.setImage(image);
+        productimage.setProductID(productID);
+        productimage.setShopID(shopID);
+        productimage.setAddTime(dateStr);
+        productimage.setMainFlag(mainFlag);
+        productimage.setSortIndex(null);
+        productNewDao.insertProductImage(productimage);
+    }
+
+    /**
+     * 获取商品图片服务器全路径
+     *
+     * @param imageUrl
+     * @return
+     */
+    public String getImageUrl(String imageUrl) {
+        String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+        ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+        if (StringUtils.isNotBlank(imageUrl) && !imageUrl.startsWith("http:") && !imageUrl.startsWith("https:")) {
+            imageUrl = Encodes.urlDecode(imageUrl);
+            String realPath = UploadImageUtils.getAbsolutePath(imageUrl);
+            int pointerIndex = realPath.lastIndexOf(".");
+            try {
+                saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                imageUrl = photoServer + saveImageSerivce.getSource();
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        return imageUrl;
+    }
+
     @ResponseBody
     @RequestMapping(value = {"/addPreferred"})
     public Map<String, Object> addPreferred(Integer productId, Integer preferredFlag) {
@@ -927,5 +1084,36 @@ public class ProductNewController extends BaseController {
         model.addAttribute("productId", productId);
         return "modules/product-new/statusRemarksList";
     }
+
+    /**
+     * 迁移呵呵对应的采美商品到采美奥泰特殊供应商中,并将呵呵商品关联到迁移后的商品
+     */
+    @RequestMapping("/hehe/move")
+    @ResponseBody
+    public String moveHeheProducts(){
+        productNewService.moveHeheProducts();
+        return "success";
+    }
+
+    /**
+     * 补充数据
+     * @return
+     */
+    @RequestMapping("/hehe/data/add")
+    @ResponseBody
+    public String addProductData(){
+        productNewService.addProductData();
+        return "success";
+    }
+
+    /**
+     * 恢复呵呵商品原来对应的采美商品id
+     */
+    @RequestMapping("/hehe/back")
+    @ResponseBody
+    public String backHeheProducts(){
+        productNewService.backHeheProducts();
+        return "success";
+    }
 }
 

+ 19 - 0
src/main/java/com/caimei/modules/user/aop/OperationLogAnnotation.java

@@ -0,0 +1,19 @@
+package com.caimei.modules.user.aop;
+
+
+import com.caimei.modules.user.entity.CmClubinfo;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.METHOD)//注解放置的目标位置即方法级别
+@Retention(RetentionPolicy.RUNTIME)//注解在哪个阶段执行
+@Documented
+public @interface OperationLogAnnotation {
+
+    String operModul() default ""; // 操作
+
+    String operType() default "";  // 操作类型
+
+    String oper() default "";  // 特殊标识
+
+}

+ 203 - 0
src/main/java/com/caimei/modules/user/aop/OperationLogAspect.java

@@ -0,0 +1,203 @@
+package com.caimei.modules.user.aop;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.caimei.modules.user.entity.*;
+import com.caimei.modules.user.service.*;
+import com.caimei.modules.user.utils.HttpContextUtils;
+import com.caimei.modules.user.web.ClubTemporaryController;
+import com.caimei.modules.user.web.newUser.AgencyController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.modules.sys.security.SystemAuthorizingRealm;
+import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
+import com.yeepay.g3.sdk.yop.utils.JsonUtils;
+import net.sf.json.util.JSONUtils;
+import net.sf.jsqlparser.statement.select.Join;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.DefaultParameterNameDiscoverer;
+import org.springframework.core.ParameterNameDiscoverer;
+import org.springframework.stereotype.Component;
+import com.thinkgem.jeesite.modules.sys.security.SystemAuthorizingRealm.Principal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.ui.Model;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.util.*;
+
+@Aspect
+@Component
+public class OperationLogAspect {
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private SysLogService sysLogService;
+
+    @Autowired
+    private ClubTemporaryService clubTemporaryService;
+
+    //定义切点 @Pointcut
+    //在注解的位置切入代码
+    @Pointcut("@annotation(com.caimei.modules.user.aop.OperationLogAnnotation)")
+    public void logPointCut() {
+
+    }
+
+    private HashMap paramToMap(JoinPoint joinPoint) {
+
+        HashMap map = new HashMap<>();
+
+        //获取参数对象
+        Object[] args = joinPoint.getArgs();
+
+        //参数列表
+        Signature signature = joinPoint.getSignature();
+        MethodSignature methodSignature = (MethodSignature) signature;
+        String[] parameterNames = methodSignature.getParameterNames();
+        int index = 0;
+        for(String str : parameterNames) {
+            map.put(str,args[index++]);
+        }
+        return map;
+    }
+
+
+    @AfterReturning("logPointCut()")
+    @JsonIgnore
+    public void saveSysLog(JoinPoint joinPoint) throws IOException {
+        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+        //保存日志
+        OperationalLogs sysLog = new OperationalLogs();
+
+        //从切面织入点处通过反射机制获取织入点处的方法
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+        //获取切入点所在的方法
+        Method method = signature.getMethod();
+        sysLog.setActioncontent(null);
+        Object[] args = joinPoint.getArgs();
+        HashMap map = new HashMap<>();
+        for (Object arg : args) {
+            System.out.println("aop获取的参数>>>>>>>"+arg.toString());
+        }
+        map = paramToMap(joinPoint);
+        Set<String> keySet=map.keySet();
+
+
+
+
+        //获取操作类型
+        OperationLogAnnotation myLog = method.getAnnotation(OperationLogAnnotation.class);
+
+        if (myLog != null) {
+            String value = myLog.operType();
+            sysLog.setOperationtype(value);//保存获取的操作类型
+
+        }
+        //获取请求的类名
+        String className = joinPoint.getTarget().getClass().getName();
+
+        //获取请求操作类型
+        String operType = myLog.operType();
+        sysLog.setOperationtype(operType);
+
+        //获取请求操作内容
+        AgencyController A = new AgencyController();
+        ClubTemporaryController B = new ClubTemporaryController();
+        String email = request.getParameter("contractEmail");//修改后邮箱
+        String bindm = request.getParameter("bindMobile");//修改后手机电话
+        String jgname = request.getParameter("name");//修改后机构名字
+        String sname = request.getParameter("sname");//修改后机构简称
+        String uname = request.getParameter("userName");//修改后的联系人
+        String linkMan = request.getParameter("linkMan");//修改后的联系人
+        String Identity = request.getParameter("linkManIdentity");//联系人身份
+        String address = request.getParameter("address");//详细地址
+        String socialCreditCode = request.getParameter("socialCreditCode");//营业执照编号
+        String headpic = request.getParameter("headpic");//门头照
+        String businessLicenseImage = request.getParameter("businessLicenseImage");//营业执照
+        String ClubType = request.getParameter("firstClubType");//机构类型
+        String mainpro = request.getParameter("mainpro");//主营业务
+        String contractPhone = request.getParameter("contractPhone");//固定电话
+        String fax = request.getParameter("fax");//传真
+        String empnum = request.getParameter("empnum");//公司人数
+        String info = request.getParameter("info");//公司简介
+        String area = request.getParameter("area");//机构面积
+        String bedNums = request.getParameter("bedNums");//美容院床位
+        String beauticians = request.getParameter("beauticians");//美容师数
+        String monthAchievement = request.getParameter("monthAchievement");//月业绩
+        String promotionAchievement = request.getParameter("promotionAchievement");//促销业绩
+        String yearAchievement = request.getParameter("yearAchievement");//年业绩
+        String cateA = request.getParameter("cateA");//A类会员
+        String consumeA = request.getParameter("consumeA");//A类会员消费金额
+        String cateB = request.getParameter("empnum");//B类会员
+        String consumeB = request.getParameter("consumeB");//B类会员消费金额
+        String cateC = request.getParameter("cateC");//C类会员
+        String consumeC = request.getParameter("consumeC");//C类会员消费金额
+        String highestAchievement = request.getParameter("highestAchievement");//最高业绩
+        String reachPepole = request.getParameter("reachPepole");//到店人数
+        String clinchPepole = request.getParameter("clinchPepole");//成交人数
+        String shortName = request.getParameter("shortName");//成交人数
+        String methodName = myLog.operModul();
+        ArrayList<String> list = new ArrayList();
+
+
+        //获取机构名称和联系人
+        String id = request.getParameter("id");
+        sysLog.setOperationtime(new Date());
+        sysLog.setActioncontent(myLog.operModul());
+        sysLog.setOperationtype(myLog.operType());
+
+        
+
+
+
+
+
+        if ("修改密码".equals(myLog.operType())) {
+            System.out.println(Integer.parseInt(map.get("id").toString())+">>>>>>>>"+Integer.parseInt(map.get("id").toString()));
+            String Inst = sysLogService.passName(Integer.parseInt(map.get("id").toString()));
+            String Contact = sysLogService.PasslinkMan(Integer.parseInt(map.get("id").toString()));
+            sysLog.setOperationtype(myLog.operModul());
+            sysLog.setOperationtype(myLog.operType());
+            sysLog.setContact(Contact);
+            sysLog.setInstitutionName(Inst);
+        }
+
+        if ("确认注册".equals(myLog.operType())) {
+            sysLog.setActioncontent(myLog.operModul());
+            ClubTemporary club = clubTemporaryService.get(id);
+            if (club != null) {
+                String  Contact= club.getLinkMan();
+                String Inst = club.getName();
+                sysLog.setContact(Contact);
+                sysLog.setInstitutionName(Inst);
+                System.out.println("contact=" + sysLog.getContact());
+            }
+        }
+
+        SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
+        System.out.println("操作员" + principal.getName());
+        String username = principal.getName();
+        sysLog.setOperator(username);
+        sysLog.setOperationtype(myLog.operType());
+        //调用service保存SysLog实体类到数据库
+        if (!"".equals(sysLog.getActioncontent())) {
+            if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
+                int i = sysLogService.insert(sysLog);
+                list.removeAll(list);
+            }
+        }
+//    }
+    }
+}

+ 134 - 0
src/main/java/com/caimei/modules/user/aop/OperationLogCmShop.java

@@ -0,0 +1,134 @@
+//package com.caimei.modules.user.aop;
+//
+//import com.caimei.modules.user.entity.CmOperationalLogs;
+//import com.caimei.modules.user.entity.CmUser;
+//import com.caimei.modules.user.service.CmOperationUserService;
+//import com.caimei.modules.user.service.CmOperationalLogService;
+//import com.caimei.modules.user.service.CmUserService;
+//import com.caimei.modules.user.service.SysLogService;
+//import com.caimei.modules.user.utils.HttpContextUtils;
+//import com.caimei.modules.user.web.NewCmShopController;
+//import com.thinkgem.jeesite.common.utils.StringUtils;
+//import com.thinkgem.jeesite.modules.sys.security.SystemAuthorizingRealm;
+//import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
+//import org.aspectj.lang.JoinPoint;
+//import org.aspectj.lang.annotation.AfterReturning;
+//import org.aspectj.lang.annotation.Aspect;
+//import org.aspectj.lang.annotation.Pointcut;
+//import org.aspectj.lang.reflect.MethodSignature;
+//import org.slf4j.ILoggerFactory;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import javax.servlet.http.HttpServletRequest;
+//import java.io.IOException;
+//import java.lang.reflect.Method;
+//import java.util.ArrayList;
+//import java.util.Date;
+//
+//@Aspect
+//@Component
+//public class OperationLogCmShop {
+//
+//    protected Logger logger = LoggerFactory.getLogger(getClass());
+//    @Autowired
+//    private CmOperationalLogService sysLogService;
+//
+//    @Autowired
+//    private CmUserService cmUserService;
+//
+//    @Pointcut("@annotation(com.caimei.modules.user.aop.OperationLogShop)")
+//    public void logPointCut() {
+//
+//    }
+//
+//    @AfterReturning("logPointCut()")
+//    public void saveSysLog(JoinPoint joinPoint) throws IOException {
+//        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+//
+//        CmOperationalLogs sysLog = new CmOperationalLogs();
+//
+//        //从切面织入点处通过反射机制获取织入点处的方法
+//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+//        //获取切入点所在的方法
+//        Method method = signature.getMethod();
+//        //获取操作类型
+//        OperationLogShop oper = method.getAnnotation(OperationLogShop.class);
+//
+//        NewCmShopController A = new NewCmShopController();
+//
+//        ArrayList<String> list = new ArrayList();
+//
+//        String maintenanceFee = request.getParameter("maintenanceFee");//线上分账商户号
+//        String name = request.getParameter("name");//公司名称
+//        String sname = request.getParameter("sname");//公司简称
+//        String address = request.getParameter("address");//公司地址
+//        String linkMan = request.getParameter("linkMan");//修改后的联系人
+//        String contractMobile = request.getParameter("contractMobile");//手机号
+//        String email = request.getParameter("email");//邮箱
+//        String contractPhone = request.getParameter("contractPhone");//固定电话
+//        String fax = request.getParameter("fax");//传真
+//        String legalPerson = request.getParameter("legalPerson");//法人代表:
+//        String registeredCapital = request.getParameter("registeredCapital");//注册资本
+//        String nature = request.getParameter("nature");//公司性质
+//        String turnover = request.getParameter("turnover");//年营业额
+//        String firstShopType = request.getParameter("firstShopType");//公司类型
+//        String secondShopType = request.getParameter("secondShopType");//医疗类型
+//        String mainpro = request.getParameter("mainpro");//主营内容
+//        String businessScope = request.getParameter("businessScope");//经营范围
+//        String website = request.getParameter("website");//官网地址
+//        String wxOfficialAccount = request.getParameter("wxOfficialAccount");//微信公众号
+//        String wxApplets = request.getParameter("wxApplets");//微信小程序
+//        String socialCreditCode = request.getParameter("socialCreditCode");//营业执照编号
+//        String businessLicenseImage = request.getParameter("businessLicenseImage");//营业执照图片
+//        String logo = request.getParameter("logo");//公司logo
+//
+//
+//
+//
+//        sysLog.setInstitutionName(name);
+//        sysLog.setContact(linkMan);
+//
+//
+//        sysLog.setOperationtime(new Date());
+//        sysLog.setOperationtype(oper.operType());
+//
+//        SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
+//        System.out.println("操作员" + principal.getName());
+//        String username = principal.getName();
+//        sysLog.setOperator(username);
+//
+////        if (oper.operType().equals("更改状态")) {
+////            sysLog.setOperationtime(new Date());
+////            sysLog.setOperationtype(oper.operType());
+////            CmUser cmUser = cmUserService.get(String.valueOf(A.id));
+////            sysLog.setInstitutionName(cmUser.getName());
+////            sysLog.setActioncontent(oper.operModul());
+////            sysLog.setContact(cmUser.getUserName());
+////        }
+//
+////        if (oper.operType().equals("修改密码")) {
+////            sysLog.setOperationtime(new Date());
+////            sysLog.setOperationtype(oper.operType());
+////            sysLog.setInstitutionName(A.cmus.getName());
+////            sysLog.setActioncontent(oper.operModul());
+////            sysLog.setContact(A.cmus.getUserName());
+////            if (!"".equals(sysLog.getActioncontent())) {
+////                int i = sysLogService.insert(sysLog);
+////                list.removeAll(list);
+////            }
+////        }
+//        if (oper.operType().equals("审核")) {
+//
+//        }
+//
+//
+//        System.out.println(sysLog.getInstitutionName());
+//        if (!"".equals(sysLog.getActioncontent())) {
+//                int i = sysLogService.insert(sysLog);
+//                list.removeAll(list);
+//        }
+//    }
+//}

+ 18 - 0
src/main/java/com/caimei/modules/user/aop/OperationLogShop.java

@@ -0,0 +1,18 @@
+package com.caimei.modules.user.aop;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.METHOD)//注解放置的目标位置即方法级别
+@Retention(RetentionPolicy.RUNTIME)//注解在哪个阶段执行
+@Documented
+public @interface OperationLogShop {
+
+
+    String operModul() default ""; // 操作
+
+    String operType() default "";  // 操作类型
+
+    String oper() default "";  // 特殊标识
+
+}
+

+ 2 - 1
src/main/java/com/caimei/modules/user/dao/CmClubinfoDao.java

@@ -15,4 +15,5 @@ public interface CmClubinfoDao extends CrudDao<CmClubinfo> {
 
     CmClubinfo getClubInfoByClubID(@Param("clubID") Integer clubID);
 
-}
+     int insert(CmClubinfo cmClubinfo);
+}

+ 15 - 0
src/main/java/com/caimei/modules/user/dao/CmOperationsDao.java

@@ -0,0 +1,15 @@
+package com.caimei.modules.user.dao;
+
+import com.caimei.modules.user.entity.CmOperationalLogs;
+
+import com.caimei.modules.user.entity.NewCmShop;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+@MyBatisDao
+public interface CmOperationsDao extends CrudDao<CmOperationalLogs> {
+    NewCmShop shoplist(Integer shopID);
+
+    NewCmShop userlist(Integer userID);
+
+}

+ 0 - 6
src/main/java/com/caimei/modules/user/dao/CmUserDao.java

@@ -82,10 +82,4 @@ public interface CmUserDao extends CrudDao<CmUser> {
     Date findByConfirmTime(Integer userId);
 
     Integer findUserBeans(Integer userId);
-
-    Double findOnlineMoney(Integer userID);
-
-    Double findUserMoney(Integer userID);
-
-    Double findAbleUserMoney(Integer userID);
 }

+ 3 - 1
src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java

@@ -45,4 +45,6 @@ public interface NewCmClubDao extends CrudDao<NewCmClub> {
     List<ServiceProviderModel> findGroup(Integer leaderId);
 
     String findClassName(String string);
-}
+
+
+}

+ 6 - 0
src/main/java/com/caimei/modules/user/dao/NewCmShopDao.java

@@ -37,4 +37,10 @@ public interface NewCmShopDao extends CrudDao<NewCmShop> {
     void insertSplitCode(SplitCode splitCode);
 
     List<SplitCode> findSplitCode(Integer shopID);
+
+    void insertSepcial(NewCmShop newCmShop);
+
+    void offline(NewCmShop newCmShop);
+
+    void online(NewCmShop newCmShop);
 }

+ 32 - 0
src/main/java/com/caimei/modules/user/dao/OperationsDao.java

@@ -0,0 +1,32 @@
+package com.caimei.modules.user.dao;
+
+import com.caimei.modules.user.entity.*;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+@MyBatisDao
+public interface OperationsDao extends CrudDao<OperationalLogs> {
+
+   String ClubName(Integer clubChangeSpRecordID);
+
+   String ClubsName(Integer clubChangeSpRecordID);
+
+   String JgName(Integer clubChangeSpRecordID);
+
+   String linkMan(Integer clubChangeSpRecordID);
+
+   String passName(Integer userID);
+
+   String PasslinkMan(Integer userID);
+
+   String auditName(Integer clubID);
+
+   String auditlinkMan(Integer clubID);
+
+   NewCmClub newCmClub(Integer clubId);
+
+   CmClubinfo cmclubinfo(Integer clubId);
+
+   ClubTemporary temPorary(String Id);
+}
+

+ 1 - 2
src/main/java/com/caimei/modules/user/entity/CmClubinfo.java

@@ -44,7 +44,7 @@ public class CmClubinfo extends DataEntity<CmClubinfo> {
     private Integer clinchPepole;        // 成交人数
     private Date createTime;        // 创建时间
     private Date updateTime;        // 修改时间
-
+    private Integer empnum; // 员工数
     /**
      * 非持久化字段
      */
@@ -57,7 +57,6 @@ public class CmClubinfo extends DataEntity<CmClubinfo> {
     private String address;        // 详细地址
     private String contractPhone;        // 联系电话
     private String fax;        // 传真
-    private Integer empnum;        // 员工数
     private String info;        // 公司简介
     private String firstClubType;  //一级分类为医美=1和生美=2
     private String secondClubType;  //医美的二级分类为诊所=1、门诊=2、医院=3。 生美没有二级分类

+ 84 - 0
src/main/java/com/caimei/modules/user/entity/CmOperationalLogs.java

@@ -0,0 +1,84 @@
+package com.caimei.modules.user.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.util.Date;
+
+public class CmOperationalLogs extends DataEntity<CmOperationalLogs> {
+    private String institutionName;
+    private String Contact;
+    private String operationtype;
+    private String Actioncontent;
+    private String Operator;
+    private Date Operationtime;
+    private String startTime;     //添加时间开始 查询条件
+    private String endTime;        //添加时间结束  查询条件
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getInstitutionName() {
+        return institutionName;
+    }
+
+    public void setInstitutionName(String institutionName) {
+        this.institutionName = institutionName;
+    }
+
+
+    public String getContact() {
+        return Contact;
+    }
+
+    public void setContact(String contact) {
+        this.Contact = contact;
+    }
+
+
+    public String getOperationtype() {
+        return operationtype;
+    }
+
+    public void setOperationtype(String operationtype) {
+        this.operationtype = operationtype;
+    }
+
+
+    public String getActioncontent() {
+        return Actioncontent;
+    }
+
+    public void setActioncontent(String actioncontent) {
+        Actioncontent = actioncontent;
+    }
+
+    public String getOperator() {
+        return Operator;
+    }
+
+    public void setOperator(String operator) {
+        Operator = operator;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getOperationtime() {
+        return Operationtime;
+    }
+
+    public void setOperationtime(Date operationtime) {
+        Operationtime = operationtime;
+    }
+}

+ 1 - 10
src/main/java/com/caimei/modules/user/entity/CmUser.java

@@ -56,8 +56,7 @@ public class CmUser extends DataEntity<CmUser> {
     private String serviceProviderID;        // 创客Id
 //    private String masterStatus;        // masterStatus
 //    private String masterID;        // masterID
-    private Double userMoney;        // 线下余额
-    private Double onlineMoney;        // 线上余额
+    private Double userMoney;        // 账户余额
     private Double ableUserMoney;        //账户可用余额
 //    private String point;        // point
 //    private String shopERPFlag;        // shopERPFlag
@@ -120,14 +119,6 @@ public class CmUser extends DataEntity<CmUser> {
         super(id);
     }
 
-    public Double getOnlineMoney() {
-        return onlineMoney;
-    }
-
-    public void setOnlineMoney(Double onlineMoney) {
-        this.onlineMoney = onlineMoney;
-    }
-
     @NotNull(message = "userID不能为空")
     public Integer getUserID() {
         return userID;

+ 1 - 1
src/main/java/com/caimei/modules/user/entity/CmUserBalanceRecord.java

@@ -17,7 +17,7 @@ public class CmUserBalanceRecord extends DataEntity<CmUserBalanceRecord> {
     private static final long serialVersionUID = 1L;
     private Integer userId;        // 用户ID
     private String type;        // 收支类型:1收入,2支出
-    private String balanceType;        // 余额类型:1线下余额抵扣,2多收退款到余额,3申请退款,4余额充值,5余额提现,6订金订单充值,7余额订单充值,8订金订单退款,9余额订单退款,10线上余额抵扣
+    private String balanceType;        // 余额类型:1余额抵扣,2多收退款到余额,3申请退款,4余额充值,5余额提现,6订金订单充值,7余额订单充值,8订金订单退款,9余额订单退款
     private Date addDate;        // 添加时间
     private String amount;        // 金额
     private Integer orderId;        // 主订单ID(适用余额类型1,3[类型为3多次退款存在相同记录ID则需通过退款ID唯一区分])

+ 0 - 2
src/main/java/com/caimei/modules/user/entity/NewCmClub.java

@@ -89,11 +89,9 @@ public class NewCmClub extends DataEntity<NewCmClub> {
     private String endTime;        //注册时间结束  查询条件
     private String userIdentity;  //用户身份
     private Integer svipUserFlag;   //超级会员用户标识,1是,2不是
-
     public String getCheckMan() {
         return checkMan;
     }
-
     public void setCheckMan(String checkMan) {
         this.checkMan = checkMan;
     }

+ 36 - 2
src/main/java/com/caimei/modules/user/entity/NewCmShop.java

@@ -78,8 +78,11 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private String sanitationPermit;//卫生许可
     private String taxPermit;//税务许可
     private List<SplitCode> splitCodes; //分账方,子商户商编
+    private String splitCode;  //列表页回显
     private String socialCreditCode; //统一社会信用代码
-
+    private Integer shopType;//供应商类别,普通1,新品供应商2,二手供应商3
+    private String cardNumber; //收款卡号
+    private Integer chargeSupport;//线上支付手续费:默认1采美承担,2供应商承担
     /**
      * 非持久化字段
      **/
@@ -93,7 +96,6 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private String editStatus;//1编辑,2审核
     private String source; //注册来源: 0网站 1小程序
 
-
     public NewCmShop() {
         super();
     }
@@ -110,6 +112,30 @@ public class NewCmShop extends DataEntity<NewCmShop> {
         this.checkMan = checkMan;
     }
 
+    public String getCardNumber() {
+        return cardNumber;
+    }
+
+    public void setCardNumber(String cardNumber) {
+        this.cardNumber = cardNumber;
+    }
+
+    public Integer getShopType() {
+        return shopType;
+    }
+
+    public void setShopType(Integer shopType) {
+        this.shopType = shopType;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
     @Length(min = 0, max = 50, message = "联系人1邮箱长度必须介于 0 和 50 之间")
     public String getContractEmail() {
         return contractEmail;
@@ -1029,4 +1055,12 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     public void setWxApplets(String wxApplets) {
         this.wxApplets = wxApplets;
     }
+
+    public Integer getChargeSupport() {
+        return chargeSupport;
+    }
+
+    public void setChargeSupport(Integer chargeSupport) {
+        this.chargeSupport = chargeSupport;
+    }
 }

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff