Browse Source

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

# Conflicts:
#	src/main/java/com/caimei/modules/info/dao/InfoDao.java
Aslee 2 years ago
parent
commit
681845e8c3
100 changed files with 8016 additions and 1498 deletions
  1. 2 2
      src/main/java/com/caimei/modules/brand/web/CmBrandController.java
  2. 97 28
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  3. 47 0
      src/main/java/com/caimei/modules/coupon/redis/RedisLearn.java
  4. 266 5
      src/main/java/com/caimei/modules/coupon/web/CmCouponController.java
  5. 6 6
      src/main/java/com/caimei/modules/hehe/service/CmHeheCollageService.java
  6. 2 0
      src/main/java/com/caimei/modules/info/dao/InfoDao.java
  7. 4 3
      src/main/java/com/caimei/modules/info/service/InfoService.java
  8. 15 1
      src/main/java/com/caimei/modules/newhome/dao/NewPageFloorDao.java
  9. 5 0
      src/main/java/com/caimei/modules/newhome/dao/NewPageHomeimageDao.java
  10. 19 10
      src/main/java/com/caimei/modules/newhome/entity/NewPageFloor.java
  11. 8 8
      src/main/java/com/caimei/modules/newhome/service/CmInstrumentMaintenanceService.java
  12. 32 1
      src/main/java/com/caimei/modules/newhome/service/NewPageFloorService.java
  13. 76 55
      src/main/java/com/caimei/modules/newhome/service/NewPageHomeimageService.java
  14. 127 4
      src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java
  15. 11 0
      src/main/java/com/caimei/modules/newhome/web/NewPageHomeimageController.java
  16. 4 0
      src/main/java/com/caimei/modules/order/dao/CmDiscernReceiptDao.java
  17. 21 0
      src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java
  18. 2 0
      src/main/java/com/caimei/modules/order/dao/CmUtilsDao.java
  19. 22 0
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  20. 2 0
      src/main/java/com/caimei/modules/order/dao/NewOrderProductDao.java
  21. 12 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  22. 16 0
      src/main/java/com/caimei/modules/order/entity/ChangePayShopDifference.java
  23. 146 0
      src/main/java/com/caimei/modules/order/entity/CmDiscernReceipt.java
  24. 9 0
      src/main/java/com/caimei/modules/order/entity/CmPayShop.java
  25. 20 1
      src/main/java/com/caimei/modules/order/entity/CmReceiptOrderRelation.java
  26. 36 0
      src/main/java/com/caimei/modules/order/entity/CmRefundRecord.java
  27. 34 0
      src/main/java/com/caimei/modules/order/entity/CmRefundTransfer.java
  28. 27 1
      src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java
  29. 62 14
      src/main/java/com/caimei/modules/order/entity/Constant.java
  30. 56 1
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  31. 28 0
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  32. 9 0
      src/main/java/com/caimei/modules/order/entity/ReceiptDetailVo.java
  33. 59 0
      src/main/java/com/caimei/modules/order/entity/SettleRecord.java
  34. 81 0
      src/main/java/com/caimei/modules/order/entity/SettleResult.java
  35. 4 5
      src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java
  36. 224 7
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  37. 274 93
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  38. 129 34
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  39. 30 1
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  40. 1 1
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  41. 259 0
      src/main/java/com/caimei/modules/order/service/WeChatService.java
  42. 7 1
      src/main/java/com/caimei/modules/order/utils/OrderUtil.java
  43. 404 0
      src/main/java/com/caimei/modules/order/utils/RSA.java
  44. 69 0
      src/main/java/com/caimei/modules/order/utils/SettlePostFormUtil.java
  45. 18 2
      src/main/java/com/caimei/modules/order/web/CmDiscernReceiptController.java
  46. 76 2
      src/main/java/com/caimei/modules/order/web/CmPayShopController.java
  47. 22 0
      src/main/java/com/caimei/modules/order/web/CmShopOrderController.java
  48. 98 14
      src/main/java/com/caimei/modules/order/web/NewOrderController.java
  49. 7 0
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  50. 4 0
      src/main/java/com/caimei/modules/product/dao/ProductNewDao.java
  51. 12 0
      src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java
  52. 191 9
      src/main/java/com/caimei/modules/product/entity/Product.java
  53. 68 2
      src/main/java/com/caimei/modules/product/service/ProductNewService.java
  54. 56 0
      src/main/java/com/caimei/modules/product/service/ProductService.java
  55. 110 4
      src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java
  56. 102 7
      src/main/java/com/caimei/modules/product/web/ProductNewController.java
  57. 30 2
      src/main/java/com/caimei/modules/supervip/service/CmSvipGiveService.java
  58. 8 1
      src/main/java/com/caimei/modules/supervip/web/CmSvipGiveController.java
  59. 43 0
      src/main/java/com/caimei/modules/sys/dao/NotificationDao.java
  60. 126 0
      src/main/java/com/caimei/modules/sys/entity/Notification.java
  61. 32 0
      src/main/java/com/caimei/modules/sys/service/NotificationService.java
  62. 38 4
      src/main/java/com/caimei/modules/sys/utils/SMSUtils.java
  63. 737 0
      src/main/java/com/caimei/modules/sys/web/NotificationController.java
  64. 50 0
      src/main/java/com/caimei/modules/user/dao/MessageCenterDao.java
  65. 17 0
      src/main/java/com/caimei/modules/user/dao/NewCmShopDao.java
  66. 253 0
      src/main/java/com/caimei/modules/user/entity/MessageCenter.java
  67. 3 3
      src/main/java/com/caimei/modules/user/entity/NewCmShop.java
  68. 41 0
      src/main/java/com/caimei/modules/user/service/NewCmShopService.java
  69. 2 2
      src/main/java/com/caimei/modules/user/web/CmOperationUserController.java
  70. 2 2
      src/main/java/com/caimei/modules/user/web/NewCmClubController.java
  71. 214 21
      src/main/java/com/caimei/modules/user/web/NewCmShopController.java
  72. 65 4
      src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java
  73. 3 3
      src/main/java/com/caimei/modules/weisha/service/CmOrganizeBuyerService.java
  74. 23 19
      src/main/java/com/thinkgem/jeesite/modules/sys/web/LoginController.java
  75. 2 1
      src/main/resources/mappings/modules/common/AreaMapper.xml
  76. 4 1
      src/main/resources/mappings/modules/info/InfoMapper.xml
  77. 98 17
      src/main/resources/mappings/modules/newhome/NewPageFloorMapper.xml
  78. 9 8
      src/main/resources/mappings/modules/newhome/NewPageHomeimageMapper.xml
  79. 89 2
      src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml
  80. 23 14
      src/main/resources/mappings/modules/order/CmReceiptOrderRelationMapper.xml
  81. 66 5
      src/main/resources/mappings/modules/order/CmReturnedPurchaseMapper.xml
  82. 3 0
      src/main/resources/mappings/modules/order/CmUtilsMapper.xml
  83. 80 2
      src/main/resources/mappings/modules/order/OrderMapper.xml
  84. 176 1
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  85. 2 0
      src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml
  86. 278 157
      src/main/resources/mappings/modules/product/ProductMapper.xml
  87. 208 138
      src/main/resources/mappings/modules/product/ProductNewMapper.xml
  88. 75 0
      src/main/resources/mappings/modules/sys/Notification.xml
  89. 14 3
      src/main/resources/mappings/modules/user/CmUserMapper.xml
  90. 69 0
      src/main/resources/mappings/modules/user/MessageCenter.xml
  91. 446 358
      src/main/resources/mappings/modules/user/NewCmShopMapper.xml
  92. 2 3
      src/main/webapp/WEB-INF/views/modules/archive/cmOrderArchiveForm.jsp
  93. 455 220
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp
  94. 8 2
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp
  95. 233 133
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReturnRecord.jsp
  96. 3 2
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp
  97. 3 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/organizeOrderReturnRecord.jsp
  98. 122 36
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/refundRecord.jsp
  99. 331 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/settlementRecord.jsp
  100. 2 12
      src/main/webapp/WEB-INF/views/modules/coupon/MoneyCouponForm.jsp

+ 2 - 2
src/main/java/com/caimei/modules/brand/web/CmBrandController.java

@@ -129,7 +129,7 @@ public class CmBrandController extends BaseController {
                     if (StringUtils.equals("1", status)) {
                         String mobile = cmBrand.getShopMobile();
                         if (StringUtils.isNotEmpty(mobile)) {
-                            SMSUtils.sendSms(mobile, "您提交的[" + cmBrand.getName() + "]品牌申请,已审核成功");
+                            SMSUtils.sendSms(0,mobile, "您提交的[" + cmBrand.getName() + "]品牌申请,已审核成功");
                         }
                     }
                     if (StringUtils.equals("2", status)) {
@@ -140,7 +140,7 @@ public class CmBrandController extends BaseController {
                         }
                         String mobile = cmBrand.getShopMobile();
                         if (StringUtils.isNotEmpty(mobile)) {
-                            SMSUtils.sendSms(mobile, "抱歉,您提交的[" + cmBrand.getName() + "]品牌申请,由于" + cmBrand.getAuditNote() + "审核失败,请重新修改提交!");
+                            SMSUtils.sendSms(0,mobile, "抱歉,您提交的[" + cmBrand.getName() + "]品牌申请,由于" + cmBrand.getAuditNote() + "审核失败,请重新修改提交!");
                         }
                     }
                 } else {

+ 97 - 28
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -10,10 +10,7 @@ import com.caimei.modules.order.dao.CmDiscernReceiptDao;
 import com.caimei.modules.order.dao.CmReturnedPurchaseDao;
 import com.caimei.modules.order.dao.NewOrderProductDao;
 import com.caimei.modules.order.entity.*;
-import com.caimei.modules.order.service.CmReceiptOrderRelationService;
-import com.caimei.modules.order.service.CmReturnedPurchaseService;
-import com.caimei.modules.order.service.NewOrderProductService;
-import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.*;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.user.dao.CmUserDao;
@@ -29,6 +26,7 @@ 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.util.Assert;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,9 +38,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 退款信息列表Controller
@@ -61,6 +58,8 @@ public class CmRefundsProductController extends BaseController {
     @Resource
     private CmReturnedPurchaseDao cmReturnedPurchaseDao;
     @Resource
+    private NewShopOrderService newShopOrderService;
+    @Resource
     private NewOrderService newOrderService;
     @Resource
     private CmReturnedPurchaseService cmReturnedPurchaseService;
@@ -160,6 +159,9 @@ public class CmRefundsProductController extends BaseController {
             if (StringUtils.isNotEmpty(cmReturnedPurchase.getId())) {
                 cmReturnedPurchase = cmReturnedPurchaseDao.get(cmReturnedPurchase.getId());//编辑重置数据
             }
+            if (2 == cmReturnedPurchase.getRefundType()) {
+                cmReturnedPurchase.setFreeRefundFee(cmReturnedPurchase.getRefundFee());
+            }
             NewOrder newOrder = newOrderService.getNewOrder(cmReturnedPurchase);
 
             //统计订单已支付金额
@@ -272,19 +274,18 @@ public class CmRefundsProductController extends BaseController {
 
             //是否可以线上退回
             boolean returnOnline = false;
-            if (cmDiscernReceipt != null && "1".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);
-                    if (calendar.getTime().compareTo(new Date()) > 0) {
-                        returnOnline = true;
-                    }
-                } else {
-                    returnOnline = true;
-                }*/
+            String status = "";
+            if (null != cmReturnedPurchase.getOnlineShopOrderId()) {
+                //1未结算2部分结算3已结算
+                status = cmReturnedPurchaseDao.findShopOrderSettleStatus(cmReturnedPurchase.getOnlineShopOrderId());
+                cmReturnedPurchase.setRefundFee(newOrder.getNewShopOrders().get(0).getReceiptAmount());
+                cmReturnedPurchase.setRefundOnlineFee(cmReturnedPurchase.getFreeRefundFee());
+            }
+            Integer count = cmReturnedPurchaseDao.findRefundType(cmReturnedPurchase.getOrderID());
+            if (count > 0) {
+                cmReturnedPurchase.setRefundType(3);
+            }
+            if (cmDiscernReceipt != null && "1".equals(cmDiscernReceipt.getPayWay()) && "1".equals(status)) {
                 returnOnline = true;
             }
             Integer lastReceiptDetailId = cmDiscernReceiptDao.findOrderLastReceiptDetailId(newOrder.getOrderID().toString());
@@ -321,6 +322,16 @@ public class CmRefundsProductController extends BaseController {
             if (!StringUtils.equals("1", receiptStatus)) {//代收款状态不需要支付方式0元
                 //判断退款方式(1有支付有退款(退款方式可多选具体参考以上金额)、4未支付无退款(未支付发起退款))
                 String returnedWay = cmReturnedPurchase.getReturnedWay();//1:账户余额/2:线上退回/3:线下转账
+                if (null != cmReturnedPurchase.getRefundBalanceFee() && cmReturnedPurchase.getRefundBalanceFee() > 0) {
+                    returnedWay = "1";
+                }
+                if (null != cmReturnedPurchase.getRefundOfflineFee() && cmReturnedPurchase.getRefundOfflineFee() > 0) {
+                    returnedWay = "3";
+                }
+                if (null != cmReturnedPurchase.getRefundBalanceFee() && null != cmReturnedPurchase.getRefundOfflineFee() && cmReturnedPurchase.getRefundBalanceFee() > 0 && cmReturnedPurchase.getRefundOfflineFee() > 0) {
+                    returnedWay = "1,3";
+                }
+                cmReturnedPurchase.setReturnedWay(returnedWay);
                 if (StringUtils.isNotEmpty(returnedWay)) {
                     boolean contains = returnedWay.contains(",");
                     if (!returnedWay.contains("1")) {
@@ -357,8 +368,10 @@ public class CmRefundsProductController extends BaseController {
             Integer freightNum = 0;
             //是否是订金充值订单
             boolean rechargeGoods = false;
+            Integer shopOrderId = 0;
             if (cmReturnedPurchase.getCmReturnedPurchaseProductList() != null && cmReturnedPurchase.getCmReturnedPurchaseProductList().size() > 0) {
                 for (List<CmReturnedPurchaseProduct> item : cmReturnedPurchase.getCmReturnedPurchaseProductList()) {
+                    shopOrderId = item.get(0).getShopOrderID();
                     if (item != null && item.size() > 0) {
                         for (CmReturnedPurchaseProduct bean : item) {
                             if (bean.getProductID().equals(999)) {
@@ -415,11 +428,23 @@ public class CmRefundsProductController extends BaseController {
             if (cmReturnedPurchase.getRefundOfflineFee() == null) {
                 cmReturnedPurchase.setRefundOfflineFee(0d);
             }
+
             //线上退款
             if ("2".equals(cmReturnedPurchase.getReturnedWay())) {
-                double refundOnlineFee = refundFee - newOrder.getBalancePayFee();
-                cmReturnedPurchase.setRefundOnlineFee(refundOnlineFee);
-                cmReturnedPurchase.setRefundBalanceFee(newOrder.getBalancePayFee());
+                Double paid = cmReturnedPurchaseDao.findShopOrderPaid(shopOrderId);
+                cmReturnedPurchase.setRefundFee(paid);
+                cmReturnedPurchase.setRefundOnlineFee(paid);
+                if (2 == cmReturnedPurchase.getRefundType()) {
+                    //查找线上订单已支付金额,申请退款金额不能大于此金额
+                    Double onlinePay = null == cmReturnedPurchaseDao.findOnlinePay(shopOrderId) ? 0d : cmReturnedPurchaseDao.findOnlinePay(shopOrderId);
+                    cmReturnedPurchase.setRefundFee(cmReturnedPurchase.getFreeRefundFee());
+                    cmReturnedPurchase.setRefundOnlineFee(cmReturnedPurchase.getFreeRefundFee());
+                    if (cmReturnedPurchase.getFreeRefundFee() > onlinePay) {
+                        model.addAttribute("errorMsg", "退款金额不能大于已付金额");
+                        cmReturnedPurchase.setOnlineShopOrderId(shopOrderId);
+                        return applyRefound(cmReturnedPurchase, request, response, model);
+                    }
+                }
             } else if ("1".equals(cmReturnedPurchase.getReturnedWay()) && cmReturnedPurchase.getRefundBalanceFee() == 0d) {
                 //线上支付,全部退余额
                 cmReturnedPurchase.setRefundBalanceFee(refundFee);
@@ -435,13 +460,25 @@ public class CmRefundsProductController extends BaseController {
             }
 
             //判断退款金额和打款金额是否一致
-            double v = totalRefundFee - refundFee;
-            if (v > 0.1 || v < -0.1) {
-                model.addAttribute("errorMsg", "各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请");
-                return applyRefound(cmReturnedPurchase, request, response, model);
+            if (1 == cmReturnedPurchase.getRefundType() && !"2".equals(cmReturnedPurchase.getReturnedWay())) {
+                double v = totalRefundFee - refundFee;
+                if (v > 0.1 || v < -0.1) {
+                    model.addAttribute("errorMsg", "各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请");
+                    return applyRefound(cmReturnedPurchase, request, response, model);
+                }
+            } else if (2 == cmReturnedPurchase.getRefundType()) {
+                if (!(cmReturnedPurchase.getReturnedWay()).contains("2")) {
+                    double v = totalRefundFee - cmReturnedPurchase.getFreeRefundFee();
+                    if (v > 0.1 || v < -0.1) {
+                        model.addAttribute("errorMsg", "各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请");
+                        return applyRefound(cmReturnedPurchase, request, response, model);
+                    }
+                }
             }
 
-            cmReturnedPurchase.setRefundFee(refundFee);
+            if (!"2".equals(cmReturnedPurchase.getReturnedWay())) {
+                cmReturnedPurchase.setRefundFee(refundFee);
+            }
             String saveInfo = cmReturnedPurchaseService.save(cmReturnedPurchase, freightNum, request, response, model);
             if (StringUtils.isNotEmpty(saveInfo)) {
                 model.addAttribute("errorMsg", saveInfo);
@@ -715,6 +752,13 @@ public class CmRefundsProductController extends BaseController {
                     refundFee += bean.getRefundFee();
                 }
             }
+            List<Integer> shopOrderIDs = newShopOrderService.findIDsByOrderID(cmReturnedPurchase.getOrderID());
+            List<CmPayShopRecord> pr = new ArrayList<>();
+            for (Integer shopOrderID : shopOrderIDs) {
+                List<CmPayShopRecord> payShopRecordList = newShopOrderService.getPayedRecords(shopOrderID.toString());
+                pr.addAll(payShopRecordList);
+            }
+            model.addAttribute("pr", pr);
             model.addAttribute("cmReturnedPurchaseList", dataList);
             model.addAttribute("order", newOrder);
             model.addAttribute("receipt", listRelation);
@@ -727,6 +771,31 @@ public class CmRefundsProductController extends BaseController {
         return "modules/bulkpurchase/refundRecord";
     }
 
+    @RequestMapping(value = "toSettleRecord")
+    public String toSettleRecord(CmReturnedPurchase cmReturnedPurchase, String from, HttpServletRequest request, HttpServletResponse response, Model model) {
+        try {
+            NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderID().toString());
+            List<CmReceiptOrderRelation> listRelation = cmReceiptOrderRelationService.findByOrderID(newOrder.getOrderID().toString());
+            List<CmReturnedPurchase> dataList = cmReturnedPurchaseService.getReturnedPurchaseList(cmReturnedPurchase);
+            Double refundFee = 0D;  //退款总额
+            for (CmReturnedPurchase bean : dataList) {
+                if (!bean.getStatus().equals("3")) {
+                    refundFee += bean.getRefundFee();
+                }
+            }
+            List<SettleRecord> settleRecord = newOrderService.findSettleRecord(cmReturnedPurchase.getOrderID());
+            model.addAttribute("settleRecord", settleRecord);
+            model.addAttribute("order", newOrder);
+            model.addAttribute("receipt", listRelation);
+            model.addAttribute("refundFee", refundFee);
+            model.addAttribute("from", from);
+            model.addAttribute("orderID", cmReturnedPurchase.getOrderID().toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "modules/bulkpurchase/settlementRecord";
+    }
+
     /**
      * @return
      * @Author ye.qin

+ 47 - 0
src/main/java/com/caimei/modules/coupon/redis/RedisLearn.java

@@ -0,0 +1,47 @@
+package com.caimei.modules.coupon.redis;
+
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.user.dao.MessageCenterDao;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.MessageCenter;
+import com.cmme.modules.product.entity.CmmeProductImage;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import redis.clients.jedis.Jedis;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/14
+ */
+public class RedisLearn {
+
+
+    public static void producer( List<Integer> clubIds) {
+
+        clubIds.forEach(clubId -> {
+            Jedis jedis=null;
+            String constraint="";
+
+                jedis=new Jedis("172.31.165.27", 6379);
+                jedis.auth("6#xsI%b4o@5c3RoE");
+
+//                jedis=new Jedis("192.168.2.100", 6379);
+
+//                jedis=new Jedis("172.31.165.23", 6379);
+
+            // 记录机构ID
+            jedis.lpush("mess"+clubId.toString(),clubId.toString());
+        });
+    }
+
+}
+

+ 266 - 5
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -3,32 +3,51 @@ package com.caimei.modules.coupon.web;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCouponAssociate;
 import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
+import com.caimei.modules.coupon.redis.RedisLearn;
 import com.caimei.modules.coupon.service.CmCouponService;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.product.service.ProductService;
+import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.dao.NewCmClubDao;
 import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.NewCmClub;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.utils.AppUtils;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.JedisUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+import redis.clients.jedis.Jedis;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
 
 /**
  * 优惠券管理Controller
@@ -48,6 +67,16 @@ public class CmCouponController extends BaseController {
     private NewCmClubDao newCmClubDao;
     @Autowired
     private ProductService productService;
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+    @Autowired
+    private NewOrderService newOrderService;
+    @Autowired
+    private NewShopOrderDao newShopOrderDao;
+    @Autowired
+    private WeChatService weChatService;
+    @Value("${wwwServer}")
+    private String domain;
 
     @ModelAttribute
     public CmCoupon get(@RequestParam(required = false) String id) {
@@ -62,6 +91,8 @@ public class CmCouponController extends BaseController {
     }
 
 
+
+
     @RequiresPermissions("coupon:cmCoupon:view")
     @RequestMapping(value = {"list", ""})
     public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
@@ -69,6 +100,7 @@ public class CmCouponController extends BaseController {
         if (null == cmCoupon.getMoneyCouponFlag()) {
             cmCoupon.setMoneyCouponFlag(2);
         }
+
         Page<CmCoupon> page = cmCouponService.findPage(new Page<CmCoupon>(request, response), cmCoupon);
         model.addAttribute("page", page);
         if (0 == cmCoupon.getCouponType()) {
@@ -79,9 +111,11 @@ public class CmCouponController extends BaseController {
             return "modules/coupon/couponCategoryList";
         } else if (2 == cmCoupon.getCouponType()) {
             //用户专享券
+
             return "modules/coupon/couponUserExclusiveList";
         } else if (3 == cmCoupon.getCouponType()) {
             //店铺券
+
             return "modules/coupon/couponShopList";
         } else if (4 == cmCoupon.getCouponType()) {
             //新用户券
@@ -122,11 +156,238 @@ public class CmCouponController extends BaseController {
         }
     }
 
+
+
+
+
+    //优惠券站内消息推送
+    private void consumer(CmCoupon cmCoupon, List<Integer> clubIds) {
+        // 消费消息
+            clubIds.forEach(clubIdb -> {
+                        Jedis jedis = null;
+                        String constraint = "";
+                        if (domain.contains("-b")) {
+                            jedis = new Jedis("172.31.165.27", 6379);
+                            jedis.auth("6#xsI%b4o@5c3RoE");
+                        } else if (domain.contains("localhost")) {
+                            jedis = new Jedis("192.168.2.100", 6379);
+                        } else {
+                            jedis = new Jedis("172.31.165.23", 6379);
+                        }
+                        // 获取消息
+                        String clubIdc = jedis.rpop("mess" + clubIdb.toString());
+                        Integer clubId = clubIdb;
+                        if (clubId != null) {
+                            Date date = new Date();
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                            CmUser user = messageCenterDao.clubList(clubId);
+                            int coumt = 0;//计数五种消息只推送一条
+                            String catego = "";
+                            Integer ts = (date.compareTo(cmCoupon.getStartDate()));
+                            if (ts >= 0) {
+                                if ("90".equals(user.getClubStatus()) && 0 == cmCoupon.getCouponType()) {
+                                    CmCoupon coupon = messageCenterDao.CouponList(0);//查询活动优惠券信息
+                                    if (coupon != null) {
+                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                        MessageCenter messageCenter = new MessageCenter();
+                                        messageCenter.setShopId(null);
+                                        messageCenter.setClubId(clubIdb);
+                                        messageCenter.setUserType(1);
+                                        messageCenter.setMessageType(4);
+                                        messageCenter.setContent(null);
+                                        messageCenter.setTime(curDateStr);
+                                        messageCenter.setCouponType(0);
+                                        messageCenter.setCouponMessageType(1);
+                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
+                                        messageCenterDao.addMessageCenter(messageCenter);
+                                        String content = "采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                        boolean sendSms = false;
+                                        try {
+                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
+                                        } catch (Exception e) {
+                                            e.printStackTrace();
+                                        }
+                                        if (sendSms) {
+                                            logger.info(">>>>>>>发送成功");
+                                        }
+                                        jedis.del("mess" + clubIdc);
+                                        coumt++;
+                                    }
+                                }
+                                if ("90".equals(user.getClubStatus()) && coumt == 0 && 1 == cmCoupon.getCouponType()) {
+                                    CmCoupon coupon = messageCenterDao.CouponList(1);//查询品类优惠券信息
+                                    if (coupon != null) {
+                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                        MessageCenter messageCenter = new MessageCenter();
+                                        messageCenter.setShopId(null);
+                                        messageCenter.setClubId(clubIdb);
+                                        messageCenter.setUserType(1);
+                                        messageCenter.setMessageType(4);
+                                        if (cmCoupon != null && "1".equals(cmCoupon.getCategoryType())) {
+                                            catego = "产品";
+                                        }
+                                        if (cmCoupon != null && "2".equals(cmCoupon.getCategoryType())) {
+                                            catego = "仪器";
+                                        }
+                                        messageCenter.setContent(catego);
+                                        messageCenter.setTime(curDateStr);
+                                        messageCenter.setCouponType(1);
+                                        messageCenter.setCouponMessageType(1);
+                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
+                                        messageCenterDao.addMessageCenter(messageCenter);
+                                        String content = "采美平台" + catego + "类商品大优惠,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                        boolean sendSms = false;
+                                        try {
+                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
+                                        } catch (Exception e) {
+                                            e.printStackTrace();
+                                        }
+                                        if (sendSms) {
+                                            logger.info(">>>>>>>发送成功");
+                                        }
+
+                                        jedis.del("mess" + clubIdc);
+                                        coumt++;
+                                    }
+                                }
+                                if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
+                                    CmCoupon coupon = messageCenterDao.CouponList(2);//查询用户专享优惠券信息
+                                    if (coupon != null && cmCoupon.getUserId() != null) {
+                                        if (coupon.getUserId().equals(cmCoupon.getUserId())) {
+                                            Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
+                                            String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+
+
+                                            jedis.del("mess" + clubIdc);
+                                            coumt++;
+                                        }
+                                    }
+                                }
+                                if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
+                                    CmCoupon coupon = messageCenterDao.CouponList(3);//查询店铺优惠券信息
+                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                        String shopName = messageCenterDao.shopName(cmCoupon.getShopId());
+                                        Integer userID = messageCenterDao.userID(cmCoupon.getShopId());
+                                        Integer clubID = messageCenterDao.clubIdCule(userID);
+                                        MessageCenter messageCenter = new MessageCenter();
+                                        messageCenter.setShopId(null);
+                                        messageCenter.setClubId(clubIdb);
+                                        messageCenter.setUserType(1);
+                                        messageCenter.setMessageType(4);
+                                        messageCenter.setContent(shopName);
+                                        messageCenter.setTime(curDateStr);
+                                        messageCenter.setCouponType(3);
+                                        messageCenter.setCouponMessageType(1);
+                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
+                                        messageCenterDao.addMessageCenter(messageCenter);
+                                        String content = "采美平台为了回馈客户,赠送您" + cmCoupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                        boolean sendSms = false;
+                                        try {
+                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
+                                        } catch (Exception e) {
+                                            e.printStackTrace();
+                                        }
+                                        if (sendSms) {
+                                            logger.info(">>>>>>>发送成功");
+                                        }
+                                    jedis.del("mess" + clubIdc);
+                                    coumt++;
+                                }
+                            if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
+                                CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
+                                if (coupon != null) {
+                                    String startDate = sdf.format(coupon.getStartDate());
+                                    Calendar calendars = Calendar.getInstance();
+                                    Date receiptime = new Date();
+                                    try {
+                                        receiptime = sdf.parse(user.getRegisterTime());
+                                    } catch (ParseException e) {
+                                        e.printStackTrace();
+                                    }
+                                    calendars.setTime(receiptime);
+                                    calendars.add(Calendar.HOUR, -6);
+                                    String hTimes=sdf.format(calendars.getTime());
+                                    int num = startDate.compareTo(hTimes);
+                                    if (num >= 0) {
+                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                        MessageCenter messageCenter = new MessageCenter();
+                                        if (coupon != null && coupon.getUserId() != null) {
+                                            messageCenter.setShopId(null);
+                                            messageCenter.setClubId(clubIdb);
+                                            messageCenter.setUserType(1);
+                                            messageCenter.setMessageType(4);
+                                            messageCenter.setContent(null);
+                                            messageCenter.setTime(curDateStr);
+                                            messageCenter.setCouponType(4);
+                                            messageCenter.setCouponMessageType(1);
+                                            messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
+                                            messageCenterDao.addMessageCenter(messageCenter);
+
+                                            String content = "恭喜成功注册采美平台。采美平台赠送您" + cmCoupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                            boolean sendSms = false;
+                                            try {
+                                                sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
+                                            } catch (Exception e) {
+                                                e.printStackTrace();
+                                            }
+                                            if (sendSms) {
+                                                logger.info(">>>>>>>发送成功");
+                                            }
+                                            jedis.del("mess" + clubIdc);
+                                            coumt++;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                jedis.del("mess" + clubIdc);
+                System.out.println(jedis.rpop("mess" + clubIdc));
+            });
+
+        }
+
     @RequestMapping(value = "save")
-    public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) {
+    public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) throws ParseException {
         if (!beanValidator(model, cmCoupon)) {
             return form(cmCoupon, model);
         }
+        Date date=new Date();
+        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+//        ExecutorService pool = Executors.newFixedThreadPool(3);
+        List<Integer> clubIds = messageCenterDao.ClubIds();
+
+//        new Thread(() -> consumer(cmCoupon, clubIds)).start();
+        consumer(cmCoupon, clubIds);
+
+        RedisLearn.producer(clubIds);
+        MessageCenter messageCenter = new MessageCenter();
+        if (cmCoupon.getUserId() != null) {
+            Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
+            CmUser user = messageCenterDao.clubList(clubc);
+            messageCenter.setShopId(null);
+            messageCenter.setClubId(clubc);
+            messageCenter.setUserType(1);
+            messageCenter.setMessageType(4);
+            messageCenter.setContent(null);
+            messageCenter.setTime(curDateStr);
+            messageCenter.setCouponType(2);
+            messageCenter.setCouponMessageType(1);
+            messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
+            messageCenterDao.addMessageCenter(messageCenter);
+            String content = "为了答谢您对采美平台的支持,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+            boolean sendSms = false;
+            try {
+                sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
+//                sendSms =  SMSUtils.sendSms( user.getBindMobile(), content);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if (sendSms) {
+                logger.info(">>>>>>>发送成功");
+            }
+        }
+
         cmCouponService.save(cmCoupon);
         addMessage(redirectAttributes, "保存优惠券成功");
         return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
@@ -139,7 +400,7 @@ public class CmCouponController extends BaseController {
         if ("1".equals(cmCoupon.getCouponsMode())) {
             return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/codeCouponList";
         }
-        if(null!=cmCoupon.getMoneyCouponFlag()&&1==(cmCoupon.getMoneyCouponFlag())){
+        if (null != cmCoupon.getMoneyCouponFlag() && 1 == (cmCoupon.getMoneyCouponFlag())) {
             return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?moneyCouponFlag=1&&couponType=5";
         }
         return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
@@ -307,15 +568,15 @@ public class CmCouponController extends BaseController {
         String wwwServer = Global.getConfig("wwwServer");
         product.setMainImage(AppUtils.getImageURL("product", product.getMainImage(), 0, wwwServer));
         //展示全部可用普通优惠券,不包含已领取兑换优惠券
-        List<CmCoupon> ordinaryCoupons = cmCouponService.findClubCouponList(product, userId,2);
+        List<CmCoupon> ordinaryCoupons = cmCouponService.findClubCouponList(product, userId, 2);
         //展示全部可用兑换优惠券
         List<CmCoupon> redeemCoupons = cmCouponService.findNotRedeemedCoupon(product);
         //展示全部可用价值优惠券
-        List<CmCoupon> moneyCoupons = cmCouponService.findClubCouponList(product, userId,1);
+        List<CmCoupon> moneyCoupons = cmCouponService.findClubCouponList(product, userId, 1);
         model.addAttribute("product", product);
         model.addAttribute("ordinaryCoupons", ordinaryCoupons);
         model.addAttribute("redeemCoupons", redeemCoupons);
         model.addAttribute("moneyCoupons", moneyCoupons);
         return "/modules/coupon/productCouponDetails";
     }
-}
+}

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

@@ -29,11 +29,11 @@ public class CmHeheCollageService extends CrudService<CmHeheCollageDao, CmHeheCo
 	public CmHeheCollage get(String id) {
 		return super.get(id);
 	}
-	
+
 	public List<CmHeheCollage> findList(CmHeheCollage cmHeheCollage) {
 		return super.findList(cmHeheCollage);
 	}
-	
+
 	public Page<CmHeheCollage> findPage(Page<CmHeheCollage> page, CmHeheCollage cmHeheCollage) {
 		Page<CmHeheCollage> collagePage = super.findPage(page, cmHeheCollage);
 		List<CmHeheCollage> collageList = collagePage.getList();
@@ -44,12 +44,12 @@ public class CmHeheCollageService extends CrudService<CmHeheCollageDao, CmHeheCo
 		});
 		return collagePage;
 	}
-	
+
 	@Transactional(readOnly = false)
 	public void save(CmHeheCollage cmHeheCollage) {
 		super.save(cmHeheCollage);
 	}
-	
+
 	@Transactional(readOnly = false)
 	public void delete(CmHeheCollage cmHeheCollage) {
 		super.delete(cmHeheCollage);
@@ -69,11 +69,11 @@ public class CmHeheCollageService extends CrudService<CmHeheCollageDao, CmHeheCo
 		// 已支付订单手机号
 		List<String> mobileList = cmHeheCollageDao.getMobilesByCollageId(collageId);
 		// 拼团成功短信推送
-		mobileList.forEach(mobile-> SMSUtils.sendSms(mobile, "您的商品已拼团成功,请赶紧登录颜选美学小程序查看订单吧。"));
+		mobileList.forEach(mobile-> SMSUtils.sendSms(0,mobile, "您的商品已拼团成功,请赶紧登录颜选美学小程序查看订单吧。"));
 		// 关闭其它未支付拼团订单
 		List<Integer> orderIdList = cmHeheCollageDao.findNoPayCollageOrderIds(collageId);
 		orderIdList.forEach(noPayOrderId->{
 			cmHeheCollageDao.cancelOrder(noPayOrderId, "拼团自动完成关闭其它未支付拼团订单");
 		});
     }
-}
+}

+ 2 - 0
src/main/java/com/caimei/modules/info/dao/InfoDao.java

@@ -37,4 +37,6 @@ public interface InfoDao extends CrudDao<Info> {
     void offlineInfo(Integer id);
 
     String getSensitiveWords(@Param("checkPoint") Integer checkPoint);
+
+    void deleteInfo(String id);
 }

+ 4 - 3
src/main/java/com/caimei/modules/info/service/InfoService.java

@@ -185,9 +185,10 @@ public class InfoService extends CrudService<InfoDao, Info> {
 
 	@Transactional(readOnly = false)
 	public void delete(Info info) {
-		super.delete(info);
-		infoDao.deleteInfoPraise(info.getId());//删除点赞
-		infoDao.deleteInfoPageByInfoId(info.getId());//删除信息分页
+//		super.delete(info);
+		infoDao.deleteInfo(info.getId());
+		//infoDao.deleteInfoPraise(info.getId());//删除点赞
+		//infoDao.deleteInfoPageByInfoId(info.getId());//删除信息分页
 	}
 
 	@Transactional(readOnly = false)

+ 15 - 1
src/main/java/com/caimei/modules/newhome/dao/NewPageFloorDao.java

@@ -3,7 +3,9 @@ package com.caimei.modules.newhome.dao;
 import com.caimei.modules.newhome.entity.NewPageFloor;
 import com.caimei.modules.newhome.entity.NewPageFloorContent;
 import com.caimei.modules.newhome.entity.NewPageFloorImage;
+import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
 
@@ -20,6 +22,16 @@ public interface NewPageFloorDao extends CrudDao<NewPageFloor> {
 
     void saveSort(@Param("sort") String sort, @Param("id") String id);
 
+    void savesortIndex(@Param("sortIndex") String sortIndex, @Param("productID") String productID);
+
+    void updateshowTime(Product product);
+
+    void updatshowFlag(Product product);
+
+    void updatrecommend(Product product);
+
+    Integer countrecommend();
+
     NewPageFloorContent findFloorContentByfloorId(Integer floorId);
 
     List<NewPageFloorImage> findFloorImage(Integer floorId);
@@ -31,4 +43,6 @@ public interface NewPageFloorDao extends CrudDao<NewPageFloor> {
     void deleteFloorImage(@Param("floorId") Integer floorId,@Param("status") Integer status);
 
     void insertFloorImage(NewPageFloorImage floorImage);
-}
+
+    List<NewPageFloor> floorFindList( NewPageFloor newPageFloor);
+}

+ 5 - 0
src/main/java/com/caimei/modules/newhome/dao/NewPageHomeimageDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.newhome.dao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.newhome.entity.NewPageHomeimage;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 新首页轮播图DAO接口
@@ -13,4 +14,8 @@ import com.caimei.modules.newhome.entity.NewPageHomeimage;
 public interface NewPageHomeimageDao extends CrudDao<NewPageHomeimage> {
 
     void updateStatusByIds(NewPageHomeimage newPageHomeimage);
+
+    void updateSort(@Param("id") String id, @Param("sort") String sort);
+
+    String findBigSort();
 }

+ 19 - 10
src/main/java/com/caimei/modules/newhome/entity/NewPageFloor.java

@@ -10,15 +10,24 @@ import com.thinkgem.jeesite.common.persistence.DataEntity;
  * @version 2019-03-14
  */
 public class NewPageFloor extends DataEntity<NewPageFloor> {
-	
+
 	private static final long serialVersionUID = 1L;
 	private String floorTitle;		// 楼层标题
 	private String floorDetail;		// 楼层描述
 	private String type;		// 楼层类型:1:推荐专区、2:团购促销、3:优质供应商、4:商品专题、5:小专题、6:大专题
 	private String sort;		// 排序
 	private String wwwEnabledStatus;		// Pc端状态 0停用 1启用
-	private String crmEnabledStatus;		// CRM端状态 0停用 1启用
-	
+	private String crmEnabledStatus;// CRM端状态 0停用 1启用
+	private Integer floorType;//楼层类别 1,新品楼层
+
+	public Integer getFloorType() {
+		return floorType;
+	}
+
+	public void setFloorType(Integer floorType) {
+		this.floorType = floorType;
+	}
+
 	public NewPageFloor() {
 		super();
 	}
@@ -35,7 +44,7 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setFloorTitle(String floorTitle) {
 		this.floorTitle = floorTitle;
 	}
-	
+
 	@Length(min=0, max=255, message="楼层描述长度必须介于 0 和 255 之间")
 	public String getFloorDetail() {
 		return floorDetail;
@@ -44,7 +53,7 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setFloorDetail(String floorDetail) {
 		this.floorDetail = floorDetail;
 	}
-	
+
 	@Length(min=0, max=1, message="楼层类型:1:推荐专区、2:团购促销、3:优质供应商、4:商品专题、5:小专题、6:大专题长度必须介于 0 和 1 之间")
 	public String getType() {
 		return type;
@@ -53,7 +62,7 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setType(String type) {
 		this.type = type;
 	}
-	
+
 	@Length(min=0, max=11, message="排序长度必须介于 0 和 11 之间")
 	public String getSort() {
 		return sort;
@@ -62,7 +71,7 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setSort(String sort) {
 		this.sort = sort;
 	}
-	
+
 	@Length(min=0, max=1, message="Pc端状态 0停用 1启用长度必须介于 0 和 1 之间")
 	public String getWwwEnabledStatus() {
 		return wwwEnabledStatus;
@@ -71,7 +80,7 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setWwwEnabledStatus(String wwwEnabledStatus) {
 		this.wwwEnabledStatus = wwwEnabledStatus;
 	}
-	
+
 	@Length(min=0, max=1, message="CRM端状态 0停用 1启用长度必须介于 0 和 1 之间")
 	public String getCrmEnabledStatus() {
 		return crmEnabledStatus;
@@ -80,5 +89,5 @@ public class NewPageFloor extends DataEntity<NewPageFloor> {
 	public void setCrmEnabledStatus(String crmEnabledStatus) {
 		this.crmEnabledStatus = crmEnabledStatus;
 	}
-	
-}
+
+}

+ 8 - 8
src/main/java/com/caimei/modules/newhome/service/CmInstrumentMaintenanceService.java

@@ -123,15 +123,15 @@ public class CmInstrumentMaintenanceService extends CrudService<CmInstrumentMain
                             ",已为您对接到维修用户" + cmInstrumentMaintenance.getUserContact() +
                             ",联系电话" + cmInstrumentMaintenance.getUserMobile() + ",点击"+ msgLink.replace("$", repairerLink.getLinkCode()) +",查看维修详情,请注意保存此短信,方便后续查看进展,采美客服0755-22907771";
 
-                    SMSUtils.sendSms(cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
-                    SMSUtils.sendSms(cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
+                    SMSUtils.sendSms(0,cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
+                    SMSUtils.sendSms(0,cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
                     cmInstrumentMaintenance.setStatus("2");
                     cmInstrumentMaintenance.setDockingDate(new Date());
                 } else if (isFirstConfirm && cmInstrumentMaintenance.getMaintainerMobile() == null) { //只是核实了信息 没有填写供应商信息
                     String msgCustomer = cmInstrumentMaintenance.getUserContact() +
                             ",您的维修申请已确认,我们将在1-2个工作日为您安排维修服务,点击" + msgLink.replace("$", customerLink) + ",查看后续维修进展,采美客服0755-22907771"; //发送核实短信
 
-                    SMSUtils.sendSms(cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
+                    SMSUtils.sendSms(0,cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
                 } else if ("1".equals(dbbean.getAuthenticity()) && isFirstConnRepairer) { //已经核实信息了, 现在新加了维修商信息
                     CmInstrumentMaintenanceLinks repairerLink = new CmInstrumentMaintenanceLinks();
                     repairerLink.setType("3");
@@ -149,8 +149,8 @@ public class CmInstrumentMaintenanceService extends CrudService<CmInstrumentMain
                             ",点击" + msgLink.replace("$", repairerLink.getLinkCode()) +",查看维修详情,请注意保存此短信,方便后续查看进展,采美客服0755-22907771";
                     cmInstrumentMaintenance.setStatus("2");
                     cmInstrumentMaintenance.setDockingDate(new Date());
-                    SMSUtils.sendSms(cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
-                    SMSUtils.sendSms(cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
+                    SMSUtils.sendSms(0,cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
+                    SMSUtils.sendSms(0,cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
                 }
             }
         }
@@ -171,8 +171,8 @@ public class CmInstrumentMaintenanceService extends CrudService<CmInstrumentMain
                         ",已为您对接到维修用户" + cmInstrumentMaintenance.getUserContact() +
                         ",联系电话" + cmInstrumentMaintenance.getUserMobile() +
                         ",点击" + msgLink.replace("$", str) +",查看维修详情,请注意保存此短信,方便后续查看进展,采美客服0755-22907771";
-                SMSUtils.sendSms(cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
-                SMSUtils.sendSms(cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
+                SMSUtils.sendSms(0,cmInstrumentMaintenance.getUserMobile().toString(), msgCustomer);
+                SMSUtils.sendSms(0,cmInstrumentMaintenance.getMaintainerMobile().toString(), msgRepairer);
             }
         }
         cmInstrumentMaintenanceDao.update(cmInstrumentMaintenance);
@@ -186,4 +186,4 @@ public class CmInstrumentMaintenanceService extends CrudService<CmInstrumentMain
     public CmInstrumentMaintenanceLinks getShareLinkCode(String id, String type) {
         return cmInstrumentMaintenanceLinksDao.getShareLinkCode(id, type);
     }
-}
+}

+ 32 - 1
src/main/java/com/caimei/modules/newhome/service/NewPageFloorService.java

@@ -6,6 +6,7 @@ import com.caimei.modules.newhome.dao.NewPageFloorDao;
 import com.caimei.modules.newhome.entity.NewPageFloor;
 import com.caimei.modules.newhome.entity.NewPageFloorContent;
 import com.caimei.modules.newhome.entity.NewPageFloorImage;
+import com.caimei.modules.product.entity.Product;
 import com.caimei.utils.AppUtils;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
@@ -43,6 +44,14 @@ public class NewPageFloorService extends CrudService<NewPageFloorDao, NewPageFlo
         return super.findPage(page, newPageFloor);
     }
 
+    public Page<NewPageFloor> floorFindList(Page<NewPageFloor> page, NewPageFloor newPageFloor) {
+        page.setOrderBy("-sort desc,createDate desc");
+        newPageFloor.setPage(page);
+        List<NewPageFloor> payOrderList = newPageFloorDao.floorFindList(newPageFloor);
+        page.setList(payOrderList);
+        return page;
+    }
+
     @Transactional(readOnly = false)
     public void save(NewPageFloor newPageFloor) {
         super.save(newPageFloor);
@@ -58,6 +67,28 @@ public class NewPageFloorService extends CrudService<NewPageFloorDao, NewPageFlo
         newPageFloorDao.saveSort(sort, id);
     }
 
+    @Transactional(readOnly = false)
+    public void savesortIndex(String sortIndex, String productID) {
+        newPageFloorDao.savesortIndex(sortIndex, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateshowTime(Product product) {
+        newPageFloorDao.updateshowTime(product);
+    }
+    @Transactional(readOnly = false)
+    public void updatshowFlag(Product product) {
+        newPageFloorDao.updatshowFlag(product);
+    }
+    @Transactional(readOnly = false)
+    public void updatrecommend(Product product) {
+        newPageFloorDao.updatrecommend(product);
+    }
+
+    public Integer countrecommend(){
+       return newPageFloorDao.countrecommend();
+    }
+
     public NewPageFloorContent findFloorContent(Integer floorId) {
         NewPageFloorContent floorContent = newPageFloorDao.findFloorContentByfloorId(floorId);
         List<NewPageFloorImage> floorImageList = newPageFloorDao.findFloorImage(floorId);
@@ -172,4 +203,4 @@ public class NewPageFloorService extends CrudService<NewPageFloorDao, NewPageFlo
             }
         }
     }
-}
+}

+ 76 - 55
src/main/java/com/caimei/modules/newhome/service/NewPageHomeimageService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.consult.entity.type.CmConsulttype;
 import com.caimei.modules.miniprogram.entity.CmWxArticle;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.thinkgem.jeesite.common.config.Global;
@@ -22,71 +23,91 @@ import javax.servlet.http.HttpServletRequest;
 
 /**
  * 新首页轮播图Service
+ *
  * @author ye.qin
  * @version 2019-03-13
  */
 @Service
 @Transactional(readOnly = true)
 public class NewPageHomeimageService extends CrudService<NewPageHomeimageDao, NewPageHomeimage> {
-	@Autowired
-	private NewPageHomeimageDao newPageHomeimageDao;
+    @Autowired
+    private NewPageHomeimageDao newPageHomeimageDao;
 
-	public NewPageHomeimage get(String id) {
-		return super.get(id);
-	}
-	
-	public List<NewPageHomeimage> findList(NewPageHomeimage newPageHomeimage) {
-		return super.findList(newPageHomeimage);
-	}
-	
-	public Page<NewPageHomeimage> findPage(Page<NewPageHomeimage> page, NewPageHomeimage newPageHomeimage) {
-		page.setOrderBy("sort");
-		return super.findPage(page, newPageHomeimage);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(NewPageHomeimage newPageHomeimage,HttpServletRequest request) {
-		if(null != newPageHomeimage.getImage() && !"".equals(newPageHomeimage.getImage())){
-			String img = saveImageToServer(newPageHomeimage.getImage(),request);
-			newPageHomeimage.setImage(img);
-		}
-		if(null != newPageHomeimage.getCrmImage() && !"".equals(newPageHomeimage.getCrmImage())){
-			String img = saveImageToServer(newPageHomeimage.getCrmImage(),request);
-			newPageHomeimage.setCrmImage(img);
-		}
-		super.save(newPageHomeimage);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(NewPageHomeimage newPageHomeimage) {
-		super.delete(newPageHomeimage);
-	}
+    public NewPageHomeimage get(String id) {
+        return super.get(id);
+    }
 
+    public List<NewPageHomeimage> findList(NewPageHomeimage newPageHomeimage) {
+        return super.findList(newPageHomeimage);
+    }
 
-	public String saveImageToServer(String imagesHead, HttpServletRequest request){
-		String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
-		String res = "";
-		ImageUploadInfo saveImageSerivce=new ImageUploadInfo();
-		if(StringUtils.isNotBlank(imagesHead) && !imagesHead.startsWith("http:") && !imagesHead.startsWith("https:")){
-			imagesHead= Encodes.urlDecode(imagesHead);
+    public Page<NewPageHomeimage> findPage(Page<NewPageHomeimage> page, NewPageHomeimage newPageHomeimage) {
+        page.setOrderBy("sort");
+        return super.findPage(page, newPageHomeimage);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(NewPageHomeimage newPageHomeimage, HttpServletRequest request) {
+        if (null != newPageHomeimage.getImage() && !"".equals(newPageHomeimage.getImage())) {
+            String img = saveImageToServer(newPageHomeimage.getImage(), request);
+            newPageHomeimage.setImage(img);
+        }
+        if (null != newPageHomeimage.getCrmImage() && !"".equals(newPageHomeimage.getCrmImage())) {
+            String img = saveImageToServer(newPageHomeimage.getCrmImage(), request);
+            newPageHomeimage.setCrmImage(img);
+        }
+        super.save(newPageHomeimage);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(NewPageHomeimage newPageHomeimage) {
+        super.delete(newPageHomeimage);
+    }
+
+
+    public String saveImageToServer(String imagesHead, HttpServletRequest request) {
+        String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+        String res = "";
+        ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+        if (StringUtils.isNotBlank(imagesHead) && !imagesHead.startsWith("http:") && !imagesHead.startsWith("https:")) {
+            imagesHead = Encodes.urlDecode(imagesHead);
 //			String realPath = request.getSession().getServletContext().getRealPath(imagesHead);
             String realPath = UploadImageUtils.getAbsolutePath(imagesHead);
-			//			realPath=Encodes.urlDecode(realPath);
-			int pointerIndex = realPath.lastIndexOf(".");
-			try {
-				saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex,realPath);
-				res = photoServer+saveImageSerivce.getSource();
-			} catch (Exception e) {
-				logger.error("图片上传错误:"+e.toString(),e);
-			}
-		}else{
-			res = imagesHead;
-		}
-		return res;
-	}
+            //			realPath=Encodes.urlDecode(realPath);
+            int pointerIndex = realPath.lastIndexOf(".");
+            try {
+                saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                res = photoServer + saveImageSerivce.getSource();
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        } else {
+            res = imagesHead;
+        }
+        return res;
+    }
+
+    @Transactional(readOnly = false)
+    public void updateStatusByIds(NewPageHomeimage newPageHomeimage) {
+        newPageHomeimageDao.updateStatusByIds(newPageHomeimage);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateSorts(String sortNums) {
+        if (sortNums.contains(",")) {
+            String[] sortNum = sortNums.split(",");
+            for (String s : sortNum) {
+                String[] s1 = s.split("_");
+                if (2 == s1.length) {
+                    String id=s1[0];
+                    String sort=s1[1];
+                    newPageHomeimageDao.updateSort(id,sort);
+                }
+            }
+        }
+    }
 
-	@Transactional(readOnly = false)
-	public void updateStatusByIds(NewPageHomeimage newPageHomeimage) {
-		newPageHomeimageDao.updateStatusByIds(newPageHomeimage);
-	}
+    public String findBigSort() {
+        return newPageHomeimageDao.findBigSort();
+    }
 }

+ 127 - 4
src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java

@@ -28,6 +28,10 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
@@ -77,6 +81,14 @@ public class NewPageFloorController extends BaseController {
         return "modules/newhome/newPageFloorList";
     }
 
+
+    @RequestMapping(value = {"lists"})
+    public String lists(NewPageFloor newPageFloor, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<NewPageFloor> page = newPageFloorService.floorFindList(new Page<NewPageFloor>(request, response), newPageFloor);
+        model.addAttribute("page", page);
+        return "modules/newhome/newPageFloorLists";
+    }
+
     @RequiresPermissions("newhome:newPageFloor:view")
     @RequestMapping(value = "form")
     public String form(NewPageFloor newPageFloor, Model model) {
@@ -86,23 +98,32 @@ public class NewPageFloorController extends BaseController {
 
     @RequiresPermissions("newhome:newPageFloor:edit")
     @RequestMapping(value = "save")
-    public String save(NewPageFloor newPageFloor, Model model, RedirectAttributes redirectAttributes) {
+    public String save(Integer floor,NewPageFloor newPageFloor, Model model, RedirectAttributes redirectAttributes) {
         if (!beanValidator(model, newPageFloor)) {
             return form(newPageFloor, model);
         }
         newPageFloorService.save(newPageFloor);
         cleanRedisCache();
         addMessage(redirectAttributes, "保存楼层管理成功");
-        return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/?repage";
+        if(floor!=null){
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/lists";
+        }else {
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor";
+        }
+
     }
 
     @RequiresPermissions("newhome:newPageFloor:delete")
     @RequestMapping(value = "delete")
-    public String delete(NewPageFloor newPageFloor, RedirectAttributes redirectAttributes) {
+    public String delete(Integer floor,NewPageFloor newPageFloor, RedirectAttributes redirectAttributes) {
         newPageFloorService.delete(newPageFloor);
         cleanRedisCache();
         addMessage(redirectAttributes, "删除楼层管理成功");
-        return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/?repage";
+        if(floor!=null){
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/lists";
+        }else {
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/?repage";
+        }
     }
 
     @RequiresPermissions("newhome:newPageHomeimage:edit")
@@ -148,6 +169,18 @@ public class NewPageFloorController extends BaseController {
         return "modules/newhome/newPageFloorContentForm";
     }
 
+    @RequestMapping(value = "ContentPage")
+    public String ContentPage(NewPageFloor newPageFloor,Product product, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception{
+        Page<Product> list =productService.newfindProductImage(new Page<Product>(request, response),product);
+        Integer count= newPageFloorService.countrecommend();
+        model.addAttribute("count",count);
+        model.addAttribute("page", list);
+        model.addAttribute("date", new Date());
+        model.addAttribute("newPageFloor",newPageFloor);
+        model.addAttribute("Product",product);
+        return "modules/newhome/newFloorcontentForm";
+    }
+
     /**
      * 批量更新排序值
      */
@@ -191,6 +224,48 @@ public class NewPageFloorController extends BaseController {
         }
     }
 
+
+    @RequestMapping(value = "batchSavesortIndex")
+    @ResponseBody
+    public Map<String, Object> batchSavesortIndex(String sortList) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = sortList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    String id = split[0];
+                    String sortIndex = null;
+                    newPageFloorService.savesortIndex(sortIndex, id);
+                } else {
+                    String id = split[0];
+                    String sortIndex = split[1];
+                    if (isInteger(sortIndex)) {
+                        if (StringUtils.equals("0", sortIndex)) {
+                            map.put("success", false);
+                            map.put("msg", "排序值只能填写大于等于1的整数");
+                            return map;
+                        }
+                        newPageFloorService.savesortIndex(sortIndex, id);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }
+            }
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+
     /**
      * 添加商品
      */
@@ -359,4 +434,52 @@ public class NewPageFloorController extends BaseController {
         generateUtils.generateHome();
 
     }
+
+    @RequestMapping(value = "updatshowFlag")
+    public String updatshowFlag(Product product,String floorTitle,Integer floorType, Model model) {
+        model.addAttribute("floorTitle",floorTitle);
+        model.addAttribute("floorType",floorType);
+
+        newPageFloorService.updatshowFlag(product);
+
+       return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/ContentPage";
+    }
+
+    @RequestMapping(value = "updateshowTime")
+    public String updateshowTime(Product product,String floorTitle,Integer floorType, Model model) {
+
+        /**
+         * 判断时间更改展示状态
+         */
+        newPageFloorService.updateshowTime(product);
+        int num=0;
+        int nums=0;
+        if(product.getNewshowTime() !=null && product.getNewshowTime()!=""){
+            num= product.getShowTime().compareTo(product.getNewshowTime());
+            if(num>0){
+                product.setShowFlag(1);
+            }else {product.setShowFlag(2);}
+        }else if (product.getAddTime()!=null && product.getAddTime()!=""){
+            nums= product.getShowTime().compareTo(product.getAddTime());
+            if ( nums>0){
+                product.setShowFlag(1);
+            }else {
+                product.setShowFlag(2);
+            }
+        }
+        newPageFloorService.updatshowFlag(product);
+        model.addAttribute("floorTitle",floorTitle);
+        model.addAttribute("floorType",floorType);
+    return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/ContentPage";
+    }
+
+    @RequestMapping("/addrecommend")
+    public String addrecommend(Product product,String floorTitle,Integer floorType, Model model) {
+        model.addAttribute("floorTitle",floorTitle);
+        model.addAttribute("floorType",floorType);
+            newPageFloorService.updatrecommend(product);
+
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/ContentPage";
+    }
+
 }

+ 11 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageHomeimageController.java

@@ -5,6 +5,7 @@ import com.caimei.modules.newhome.entity.NewPageHomeimage;
 import com.caimei.modules.newhome.service.NewPageHomeimageService;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.redis.RedisService;
+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;
@@ -62,10 +63,20 @@ public class NewPageHomeimageController extends BaseController {
 
     @RequestMapping(value = "form")
     public String form(NewPageHomeimage newPageHomeimage, Model model) {
+        String sort=newPageHomeimageService.findBigSort();
+        model.addAttribute("sort",sort);
         model.addAttribute("newPageHomeimage", newPageHomeimage);
         return "modules/newhome/newPageHomeimageForm";
     }
 
+    @RequestMapping(value = "updateSort")
+    @ResponseBody
+    public JsonModel updateSort(String sortNums) {
+        JsonModel jsonMode = JsonModel.newInstance();
+        newPageHomeimageService.updateSorts(sortNums);
+        return jsonMode.success("批量更新排序成功");
+    }
+
     @RequiresPermissions("newhome:newPageHomeimage:edit")
     @RequestMapping(value = "save")
     public String save(NewPageHomeimage newPageHomeimage, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {

+ 4 - 0
src/main/java/com/caimei/modules/order/dao/CmDiscernReceiptDao.java

@@ -99,4 +99,8 @@ public interface CmDiscernReceiptDao extends CrudDao<CmDiscernReceipt> {
     ReceipCouponInfoVo getCouponInfo(String receiptID);
 
     List<NewShopOrder> getShopOrderInfos(@Param("shopOrderId") String shopOrderId,@Param("orderId") String orderId);
+
+    CmDiscernReceipt orderlist(CmDiscernReceipt cmDiscernReceipt);
+
+
 }

+ 21 - 0
src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.dao;
 
+import com.caimei.modules.order.entity.CmRefundRecord;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.order.entity.CmReturnedPurchase;
@@ -30,4 +31,24 @@ public interface CmReturnedPurchaseDao extends CrudDao<CmReturnedPurchase> {
     List<Integer> findReturnedShopOrder(Integer orderID);
 
     String findSplitCode(Integer shopOrderId);
+
+    List<Integer> getReturnShopOrder(String id);
+
+    void insertCmRefundRecord(CmRefundRecord cmRefundRecord);
+
+    Double findBrokerage(String orderRequestNo);
+
+    Double findRefundTransfer(String orderRequestNo);
+
+    Double findRefundCharge(String orderRequestNo);
+
+    Double findPayAmount(String orderRequestNo);
+
+    Double findOnlinePay(Integer shopOrderId);
+
+    String findShopOrderSettleStatus(Integer onlineShopOrderId);
+
+    Integer findRefundType(Integer orderID);
+
+    Double findShopOrderPaid(Integer shopOrderID);
 }

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/CmUtilsDao.java

@@ -24,4 +24,6 @@ public interface CmUtilsDao {
      * @return
      */
     Double selectPayTotalFees(Integer orderID);
+
+    Integer findOrderIsSecond(Integer orderId);
 }

+ 22 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -221,6 +221,8 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
 
     void updateOnlinePayFlag(@Param("onlinePayFlag") Integer onlinePayFlag,@Param("orderId") Integer orderId);
 
+    void updateBrokerage(@Param("shopOrderID")Integer shopOrderID ,@Param("brokerage")Double brokerage);
+
     Integer findSupport(Integer shopOrderId);
 
     List<OrderProductVo> getOrderProductByShopOrderId(Integer shopOrderId);
@@ -240,4 +242,24 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     void updateBySplitStatus(String mbOrderId);
 
     Integer findOnlinePay(Integer orderID);
+
+    String findSplitCode(String shopOrderId);
+
+    Double findPayAmount(String shopOrderId);
+
+    Double findShouldPayShopAmount(String shopOrderId);
+
+    void updateSettleStatus(@Param("shopOrderId")String shopOrderId,@Param("productType") Integer productType);
+
+    void updateShopOrderSettleStatus(@Param("shopOrderId")String shopOrderId, @Param("settleStatus")Integer settleStatus);
+
+    void insertSettleRecord(SettleRecord settleRecord);
+
+    Double findSettleSum(String shopOrderId);
+
+    List<SettleRecord> findSettleRecord(Integer orderID);
+
+    Double findSettleAmount(Integer orderID);
+
+    Integer findShopOrderSize(Integer orderID);
 }

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderProductDao.java

@@ -103,4 +103,6 @@ public interface NewOrderProductDao extends CrudDao<NewOrderProduct> {
      * @param shopOrderID
      */
     Integer countReturnedFreightProduct(Integer shopOrderID);
+
+
 }

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

@@ -2,6 +2,7 @@ package com.caimei.modules.order.dao;
 
 import com.caimei.modules.order.entity.CmPayShop;
 import com.caimei.modules.order.entity.NewShopOrder;
+import com.caimei.modules.order.entity.SettleRecord;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -29,6 +30,8 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
     String FromUnionId(Integer orderId);
 
+    String UnionId(Integer userID);
+
     int updateByShopOrderNo(NewShopOrder newShopOrder);
 
     int updateStatusByOrderID(@Param("orderID") Integer orderID, @Param("status") Integer status);
@@ -82,4 +85,13 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
     Double findIncome(Integer orderID);
 
     List<NewShopOrder> findSplitList(NewShopOrder shopOrder);
+
+    List<NewShopOrder> findSettlementList(NewShopOrder shopOrder);
+
+    List<SettleRecord> findSettleRecord(String shopOrderID);
+
+    List<NewShopOrder> findListByShopOrderId(Integer onlineShopOrderId);
+
+    //查询子订单是 线上 还是 线上
+    List<Integer> payWay(Integer shopOrderID);
 }

+ 16 - 0
src/main/java/com/caimei/modules/order/entity/ChangePayShopDifference.java

@@ -144,6 +144,14 @@ public class ChangePayShopDifference implements Serializable {
      */
     private CmRefundShop refundShop;
 
+    /**
+     * 子订单收款状态  1待收款、2部分收款、3已收款
+     * @return
+     */
+    private  Integer shopReceiptStatus;
+
+
+
     public Integer getId() {
         return id;
     }
@@ -367,4 +375,12 @@ public class ChangePayShopDifference implements Serializable {
     public void setPayStatus(String payStatus) {
         this.payStatus = payStatus;
     }
+
+    public Integer getShopReceiptStatus() {
+        return shopReceiptStatus;
+    }
+
+    public void setShopReceiptStatus(Integer shopReceiptStatus) {
+        this.shopReceiptStatus = shopReceiptStatus;
+    }
 }

+ 146 - 0
src/main/java/com/caimei/modules/order/entity/CmDiscernReceipt.java

@@ -68,6 +68,97 @@ public class CmDiscernReceipt extends DataEntity<CmDiscernReceipt> {
 
     private Double orderReceivedAmount;//订单已收金额(此收款只计算线上线下收款记录表金额)
     private Double returnBalanceAmount;// 退款余额金额
+    private Integer newReceiptType;//收款款项二级类别1.上架费2.订单返佣3.认证通会员4.认证通企划
+    private String shopOrderNo;
+    private Integer shopOrderId;//子订单id
+    private Double productAmount;//订单总金额
+    private Double needPayAmount;//应收金额
+    private String shopName;//关联供应商名称
+    private String checkMan;
+    private String  shopOrderNos;
+    private String jgName;//机构名称
+    private String paYee;//收款方(虚拟字段)
+    private Integer shopID;//收款方关联供应商id
+
+    private String  validityDate;//生效时间期
+    private String expirationDate;//到期时间
+    private Integer receStatct;//免除上架费标识0,正常1,免除
+    private String receiptID;//收款id
+    private String linkMan;
+
+
+
+    public String getPaYee() {
+        return paYee;
+    }
+
+    public void setPaYee(String paYee) {
+        this.paYee = paYee;
+    }
+
+    public String getJgName() {
+        return jgName;
+    }
+
+    public void setJgName(String jgName) {
+        this.jgName = jgName;
+    }
+
+    public Double getNeedPayAmount() {
+        return needPayAmount;
+    }
+
+    public void setNeedPayAmount(Double needPayAmount) {
+        this.needPayAmount = needPayAmount;
+    }
+
+    public Double getProductAmount() {
+        return productAmount;
+    }
+
+    public void setProductAmount(Double productAmount) {
+        this.productAmount = productAmount;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public String getShopOrderNos() {
+        return shopOrderNos;
+    }
+
+    public void setShopOrderNos(String shopOrderNos) {
+        this.shopOrderNos = shopOrderNos;
+    }
+
+    public String getCheckMan() {
+        return checkMan;
+    }
+
+    public void setCheckMan(String checkMan) {
+        this.checkMan = checkMan;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public String getShopOrderNo() {
+        return shopOrderNo;
+    }
+
+    public void setShopOrderNo(String shopOrderNo) {
+        this.shopOrderNo = shopOrderNo;
+    }
 
     public String getBalanceAccountsRemark() {
         return balanceAccountsRemark;
@@ -77,6 +168,13 @@ public class CmDiscernReceipt extends DataEntity<CmDiscernReceipt> {
         this.balanceAccountsRemark = balanceAccountsRemark;
     }
 
+    public Integer getNewReceiptType() {
+        return newReceiptType;
+    }
+
+    public void setNewReceiptType(Integer newReceiptType) {
+        this.newReceiptType = newReceiptType;
+    }
 
     public String getBackName() {
         return backName;
@@ -473,4 +571,52 @@ public class CmDiscernReceipt extends DataEntity<CmDiscernReceipt> {
     public void setAssociationType(String associationType) {
         this.associationType = associationType;
     }
+
+    public Integer getShopID() {
+        return shopID;
+    }
+
+    public void setShopID(Integer shopID) {
+        this.shopID = shopID;
+    }
+
+    public String getValidityDate() {
+        return validityDate;
+    }
+
+    public void setValidityDate(String validityDate) {
+        this.validityDate = validityDate;
+    }
+
+    public String getExpirationDate() {
+        return expirationDate;
+    }
+
+    public void setExpirationDate(String expirationDate) {
+        this.expirationDate = expirationDate;
+    }
+
+    public Integer getReceStatct() {
+        return receStatct;
+    }
+
+    public void setReceStatct(Integer receStatct) {
+        this.receStatct = receStatct;
+    }
+
+    public String getReceiptID() {
+        return receiptID;
+    }
+
+    public void setReceiptID(String receiptID) {
+        this.receiptID = receiptID;
+    }
+
+    public String getLinkMan() {
+        return linkMan;
+    }
+
+    public void setLinkMan(String linkMan) {
+        this.linkMan = linkMan;
+    }
 }

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

@@ -43,6 +43,7 @@ public class CmPayShop extends DataEntity<CmPayShop> {
     private String status;        // 审核状态  0待审核,  1审核通过 2 审核不通过
     private String reason;        // 审核不通过原因
     private Integer paymentType; //付款类型: 1子订单付款 2供应商差价 3付第三方
+    private String rebateFee; // 返佣服务费
 
     private String startTime;
     private String endTime;
@@ -67,6 +68,14 @@ public class CmPayShop extends DataEntity<CmPayShop> {
     //  付款账号的类型 0公账, 1私账
     private String typeStr;
 
+    public String getRebateFee() {
+        return rebateFee;
+    }
+
+    public void setRebateFee(String rebateFee) {
+        this.rebateFee = rebateFee;
+    }
+
     public String getPayBank() {
         return payBank;
     }

+ 20 - 1
src/main/java/com/caimei/modules/order/entity/CmReceiptOrderRelation.java

@@ -23,6 +23,7 @@ public class CmReceiptOrderRelation extends DataEntity<CmReceiptOrderRelation> {
     private String receiptDate;    //收款时间
     private String confirmType;        //确认订单类型
 
+    private Integer splitStatus;   //分账状态:0待分账,1已分账(只针对线上支付)
     /**
      * 抹平备注(目前适用后台直接抹平账户操作)
      */
@@ -47,6 +48,24 @@ public class CmReceiptOrderRelation extends DataEntity<CmReceiptOrderRelation> {
      */
     private String payWay;
 
+    private Integer newReceiptType;
+
+    public Integer getNewReceiptType() {
+        return newReceiptType;
+    }
+
+    public void setNewReceiptType(Integer newReceiptType) {
+        this.newReceiptType = newReceiptType;
+    }
+
+    public Integer getSplitStatus() {
+        return splitStatus;
+    }
+
+    public void setSplitStatus(Integer splitStatus) {
+        this.splitStatus = splitStatus;
+    }
+
     public String getPayWay() {
         return payWay;
     }
@@ -156,4 +175,4 @@ public class CmReceiptOrderRelation extends DataEntity<CmReceiptOrderRelation> {
     public void setConfirmType(String confirmType) {
         this.confirmType = confirmType;
     }
-}
+}

+ 36 - 0
src/main/java/com/caimei/modules/order/entity/CmRefundRecord.java

@@ -0,0 +1,36 @@
+package com.caimei.modules.order.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+public class CmRefundRecord extends DataEntity<CmRefundRecord> {
+
+    private static final long serialVersionUID = 1L;
+
+    private Double refundAmount;
+    private String orderRequestNo;
+    private Integer shopOrderId;
+
+    public Double getRefundAmount() {
+        return refundAmount;
+    }
+
+    public void setRefundAmount(Double refundAmount) {
+        this.refundAmount = refundAmount;
+    }
+
+    public String getOrderRequestNo() {
+        return orderRequestNo;
+    }
+
+    public void setOrderRequestNo(String orderRequestNo) {
+        this.orderRequestNo = orderRequestNo;
+    }
+
+    public Integer getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(Integer shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+}

+ 34 - 0
src/main/java/com/caimei/modules/order/entity/CmRefundTransfer.java

@@ -0,0 +1,34 @@
+package com.caimei.modules.order.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+public class CmRefundTransfer extends DataEntity<CmRefundTransfer> {
+    private static final long serialVersionUID = 1L;
+    private Integer transferType;//转账类型,1网银手续费2佣金
+    private Double transferAmount;//转账金额
+    private String orderRequestNo;
+
+    public Integer getTransferType() {
+        return transferType;
+    }
+
+    public void setTransferType(Integer transferType) {
+        this.transferType = transferType;
+    }
+
+    public Double getTransferAmount() {
+        return transferAmount;
+    }
+
+    public void setTransferAmount(Double transferAmount) {
+        this.transferAmount = transferAmount;
+    }
+
+    public String getOrderRequestNo() {
+        return orderRequestNo;
+    }
+
+    public void setOrderRequestNo(String orderRequestNo) {
+        this.orderRequestNo = orderRequestNo;
+    }
+}

+ 27 - 1
src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java

@@ -30,6 +30,7 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String operatingOrderStatus;    //发起该操作时订单状态快照:0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退
     private Double returnedPurchaseFee;        // 退款(退货)总金额
     private Double refundFee;        // 退款总额(给买家)
+    private Double freeRefundFee;   //自定义退款总额
     private String image1;        // 凭证图片1
     private String image2;        // 凭证图片2
     private String image3;        // 凭证图片3
@@ -69,9 +70,26 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String reviewUserName;//审核人
     private String name; //机构名
     private Integer orderType; //订单类型 0协销订单、 1普通订单、 2呵呵订单
-
+    private Integer refundType;  //退款模式 1按商品金额退款  2 自定义金额退款
     private String beginTime;     //时间开始 查询条件 申请时间
     private String endTime;        //时间结束  查询条件 申请时间
+    private Integer onlineShopOrderId; //子订单id
+
+    public Integer getOnlineShopOrderId() {
+        return onlineShopOrderId;
+    }
+
+    public void setOnlineShopOrderId(Integer onlineShopOrderId) {
+        this.onlineShopOrderId = onlineShopOrderId;
+    }
+
+    public Double getFreeRefundFee() {
+        return freeRefundFee;
+    }
+
+    public void setFreeRefundFee(Double freeRefundFee) {
+        this.freeRefundFee = freeRefundFee;
+    }
 
     public String getName() {
         return name;
@@ -123,6 +141,14 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
 //		this.shopOrderID = shopOrderID;
 //	}
 
+    public Integer getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(Integer refundType) {
+        this.refundType = refundType;
+    }
+
     public Integer getUserID() {
         return userID;
     }

+ 62 - 14
src/main/java/com/caimei/modules/order/entity/Constant.java

@@ -12,17 +12,26 @@ public class Constant {
 
     public static final String betaSplit = "https://core-b.caimei365.com/order/pay/delay/split/callback";
 
-    //专票 信息 测试佣金暂入信息  308785626@qq.com vip/二手暂入信息
+    /**
+     * 专票 信息 测试佣金暂入信息  308785626@qq.com vip/二手暂入信息
+     */
     public static final String CUSTOMERNUM = "E1807059160";
-    //信息的邮箱
+    /**
+     * 信息的邮箱
+     */
     public static final String XX_MAIL = "308785626@qq.com";
 
-    //收款商编 网络   xun.zhang@caimei365.com
+    /**
+     * 收款商编 网络   xun.zhang@caimei365.com
+     */
     public static final String CUSTOMERNUM2 = "E1807062884";
-    //网络的邮箱
+    /**
+     * 网络的邮箱
+     */
     public static final String WL_MAIL = "xun.zhang@caimei365.com";
-
-    //普票 奥泰 测试私账暂进奥泰   caimei365@yeah.net
+    /**
+     * 普票 奥泰 测试私账暂进奥泰   caimei365@yeah.net
+     */
     public static final String CUSTOMERNUM3 = "E1807085606";
 
     public static final String AT_MAIL = "caimei365@yeah.net";
@@ -30,24 +39,63 @@ public class Constant {
     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
+    /**
+     * 网银地址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 JS = "http://transfer.trx.helipay.com/trx/transfer/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 JIESUAN="fiweQU8igfuhBTcXLLDAQ3DScwIPEy2s";
+
     /**
      * 扫码接口地址
      */
     public static final String REQUEST_URL = DOMAIN_NAME + "trx/app/interface.action";
-
+    /**
+     *     结算私钥
+     */
+    public static final String signKey_setttlement = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAK8T2luDwK3jKwLp\n" +
+            "AVNRr8+1qHGUkCIe6ZicK6Oc33xB4vA+2Hyz9I9343DgcYbuq6/t7lxzb5+fRvjd\n" +
+            "B63YM4bFDh0nyDeoNwoKCWUlHV1iuqJC5rHr/C96IR+l0Aiu619lZI+mmkFgX8xd\n" +
+            "g2gX4Up1sqZlwy0qv25mm9skyK01AgMBAAECgYEAn75YjQmhA8fzlbsuF2zAIqAY\n" +
+            "alHoVQmpkDJmaumWzJR9UUG2W8oCiekU4AgZ7cjVZDePNlGpdpZotmdOO2O6VmkF\n" +
+            "x9mOcgcM87t9PmkkRcVjpvkSixFyNFRpcYECm+YXOE/d/1rS5zvOubU3L8XzvP9O\n" +
+            "SQQhQ8xtVl9SFoAMB70CQQDkQv7mtsoMrwqxwC4/tXzSoOclEOSWXqtNEAxMlq5D\n" +
+            "ZAPeOSfImwTlb7s5lX1MkrbdOvf2EWoW5cNaLyIdo3jDAkEAxFpZUvUu0oS4EOtX\n" +
+            "kXZaJicuRaovY9TzGjEr9pTgRGlOcK3pUS4nNEKqT8cBfgNJ1veBsk25g8fHMKQq\n" +
+            "GMkipwJBAMl0+6XCM+cn4gdpNyhRVD5NdlO3ahfwq71S6Zf68QhXUDakOSGK97JL\n" +
+            "f3FeJ30ai7wLXGdXjUtyM4z3xmNkMKMCQFC5ECXx1JkJpR6Xkj2kGXW7/+L2D1uM\n" +
+            "jZEEDB3ooLafUHc0mEoenlF24su/ddaXhYDR6kkieRU7SaGuq/vanNsCQQC8fuH0\n" +
+            "APa0grLrsMdNTLlHNCnf/s+mjeMt3rV3SbPZ5pbnEPWILYvxN8NnOVZmxQw6E7+R\n" +
+            "CBcHmGCo7zF53o4t";
 }

+ 56 - 1
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -84,6 +84,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     // -----------------  v5.0.0 end
 
     //-------------        虚拟字段   ----------------------------
+    private Integer settleRecordNum;   //佣金结算数量
     private String shopName;            //供应商
     private String receiver;//收货人
     private String buyer;//买家
@@ -108,6 +109,8 @@ public class NewOrder extends DataEntity<NewOrder> {
     private String applyReturnedPurchaseFlag;//0不可以申请,1可以申请(此标记只用于是否存在审核中或者审核不通过记录,存在记录则不可以申请)
     private String spName;
     private Integer serviceProviderId;  //协销Id
+    private Integer settleStatus;    //结算状态   1未结算2部分结算3已结算
+    private Double settleAmount;   // 已结算金额
 
     private String productName;     //商品名称(根据商品名称筛选订单)
     private List<NewOrderProduct> orderProduct;// 订单内的商品集合
@@ -133,7 +136,8 @@ public class NewOrder extends DataEntity<NewOrder> {
     private boolean receiptOrderFlag;// 判断订单中抹平的订单是否是和多个订单一起支付的,
     private Integer rechargeGoods; //1,缴纳订金;2,充值余额
     private String affirmPaymentFlag;// 二手订单确认付款供应商标识 0未确认,1已确认
-    private String rebateFlag;//返佣订单标识,0非返佣订单,1返佣订单
+    private String rebateFlag;//返佣订单标识,0非返佣订单,1返佣订单,2普通订单有返佣服务费
+    private String rebateFee; // 返佣服务费
     private String associationType;//订单关联方式: 1手动 2自动
     private Double ableUserMoney; //当前下单用户可用余额
     private String organizeStoreName;//组织门店名称
@@ -148,6 +152,9 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer collageStatus;  // 拼团状态:1拼团中,2已拼成
     private Double reductionAmount;    //分享减免金额
     private Double reductionTouchPrice; //分享减免条件
+    private Integer onlinfePayFlag;  //线上支付标记
+
+    private Integer productCategory;//商品订单状态 1.普通订单 2.二手订单
 
 
     /**
@@ -156,6 +163,46 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer receiveCouponId;
     private CmHeheCouponOrderRecord heheCouponRecord;   //优惠券信息
 
+    public String getRebateFee() {
+        return rebateFee;
+    }
+
+    public void setRebateFee(String rebateFee) {
+        this.rebateFee = rebateFee;
+    }
+
+    public Integer getProductCategory() {
+        return productCategory;
+    }
+
+    public void setProductCategory(Integer productCategory) {
+        this.productCategory = productCategory;
+    }
+
+    public Double getSettleAmount() {
+        return settleAmount;
+    }
+
+    public void setSettleAmount(Double settleAmount) {
+        this.settleAmount = settleAmount;
+    }
+
+    public Integer getSettleRecordNum() {
+        return settleRecordNum;
+    }
+
+    public void setSettleRecordNum(Integer settleRecordNum) {
+        this.settleRecordNum = settleRecordNum;
+    }
+
+    public Integer getOnlinfePayFlag() {
+        return onlinfePayFlag;
+    }
+
+    public void setOnlinfePayFlag(Integer onlinfePayFlag) {
+        this.onlinfePayFlag = onlinfePayFlag;
+    }
+
     public Integer getOrderSeen() {
         return orderSeen;
     }
@@ -180,6 +227,14 @@ public class NewOrder extends DataEntity<NewOrder> {
         this.promotions = promotions;
     }
 
+    public Integer getSettleStatus() {
+        return settleStatus;
+    }
+
+    public void setSettleStatus(Integer settleStatus) {
+        this.settleStatus = settleStatus;
+    }
+
     public Double getPromotionFullReduction() {
         return promotionFullReduction;
     }

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

@@ -95,6 +95,8 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private BigDecimal differencePrice;  //补差价金额
     private Integer userBeans; //订单采美豆数量
     private Double svipShopReduction;   //超级会员优惠
+    private Integer settleStatus;    //结算状态   1未结算2部分结算3已结算
+    private Integer payWay; //线上支付状态 1线上 2线下 3余额抵扣
     //-------------        虚拟字段   ----------------------------
     private Double income;       //主订单总佣金
     private List<String> shopOrderNos;      //主订单下所有子订单
@@ -135,6 +137,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Double payed;//已付金额
     private String clubName; //会所名称
     private Integer orderArchiveId; //订单资料id
+    private String rebateFee; //主订单返佣服务费
 
     // 备注图片
     private String remarkImage1;
@@ -152,6 +155,31 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
 
     private boolean payShopOtherFee = true; //是否可以付第三方申请
 
+    public String getRebateFee() {
+        return rebateFee;
+    }
+
+    public void setRebateFee(String rebateFee) {
+        this.rebateFee = rebateFee;
+    }
+
+    public Integer getSettleStatus() {
+        return settleStatus;
+    }
+
+    public void setSettleStatus(Integer settleStatus) {
+        this.settleStatus = settleStatus;
+    }
+
+
+    public Integer getPayWay() {
+        return payWay;
+    }
+
+    public void setPayWay(Integer payWay) {
+        this.payWay = payWay;
+    }
+
     public Double getIncome() {
         return income;
     }

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

@@ -32,6 +32,15 @@ public class ReceiptDetailVo {
     private ReceiptVipInfoVo vipInfo;// 一个收款关联一个会员记录
     private ReceipCouponInfoVo couponInfo;//优惠券购买记录
     private boolean receiptOrderFlag;// 判断订单中抹平的订单是否是和多个订单一起支付的,
+    private String shopName;
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
 
     public ReceiptVipInfoVo getVipInfo() {
         return vipInfo;

+ 59 - 0
src/main/java/com/caimei/modules/order/entity/SettleRecord.java

@@ -0,0 +1,59 @@
+package com.caimei.modules.order.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class SettleRecord implements Serializable {
+
+    private Double settleAmount;
+    /**
+     * 结算类型 1供应商成本,2佣金
+     */
+    private Integer settleType;
+    private String shopOrderId;
+    private String splitCode;
+    private Date settleTime;
+
+    public Double getSettleAmount() {
+        return settleAmount;
+    }
+
+    public void setSettleAmount(Double settleAmount) {
+        this.settleAmount = settleAmount;
+    }
+
+    public Integer getSettleType() {
+        return settleType;
+    }
+
+    public void setSettleType(Integer settleType) {
+        this.settleType = settleType;
+    }
+
+    public String getShopOrderId() {
+        return shopOrderId;
+    }
+
+    public void setShopOrderId(String shopOrderId) {
+        this.shopOrderId = shopOrderId;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getSettleTime() {
+        return settleTime;
+    }
+
+    public void setSettleTime(Date settleTime) {
+        this.settleTime = settleTime;
+    }
+}

+ 81 - 0
src/main/java/com/caimei/modules/order/entity/SettleResult.java

@@ -0,0 +1,81 @@
+package com.caimei.modules.order.entity;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class SettleResult implements Serializable{
+    private String rt1_bizType;
+    private String rt2_retCode;
+    private String rt3_retMsg;
+    private String rt4_customerNumber;
+    private String rt5_orderId;
+    private String sign;
+
+    /**
+     * 需要加签的属性参数
+     * 看接口文档
+     */
+    public static final Set<String> NEED_SIGN_PARAMS = ImmutableSet.of("rt1_bizType", "rt2_retCode", "rt4_customerNumber", "rt5_orderId");
+
+    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 getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    @Override
+    public String toString() {
+        return "SettleResult{" +
+                "rt1_bizType='" + rt1_bizType + '\'' +
+                ", rt2_retCode='" + rt2_retCode + '\'' +
+                ", rt3_retMsg='" + rt3_retMsg + '\'' +
+                ", rt4_customerNumber='" + rt4_customerNumber + '\'' +
+                ", rt5_orderId='" + rt5_orderId + '\'' +
+                ", sign='" + sign + '\'' +
+                '}';
+    }
+}

+ 4 - 5
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -59,6 +59,10 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
         return super.get(id);
     }
 
+    public CmDiscernReceipt orderlist(CmDiscernReceipt cmDiscernReceipt) {
+        return cmDiscernReceiptDao.orderlist(cmDiscernReceipt);
+    }
+
     public List<CmDiscernReceipt> findList(CmDiscernReceipt cmDiscernReceipt) {
         return super.findList(cmDiscernReceipt);
     }
@@ -156,11 +160,6 @@ 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

+ 224 - 7
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -1,16 +1,23 @@
 package com.caimei.modules.order.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.hehe.dao.HeHeNewOrderDao;
 import com.caimei.modules.miniprogram.utils.UploadPicUtils;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
+import com.caimei.modules.order.utils.Disguiser;
+import com.caimei.modules.order.utils.MyBeanUtils;
+import com.caimei.modules.order.utils.RSA;
+import com.caimei.modules.order.utils.SettlePostFormUtil;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.entity.NewCmShop;
+import com.caimei.redis.RedisService;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.StringUtil;
+import com.opensymphony.module.sitemesh.html.CustomTag;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
@@ -23,10 +30,11 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 
@@ -63,6 +71,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
     private HeHeNewOrderDao heHeNewOrderDao;
     @Resource
     private CmRefundShopDao cmRefundShopDao;
+    @Resource
+    private RedisService redisService;
 
 
     public List<CmPayShop> exports(Page<CmPayShop> cmPayShopPage, CmPayShop cmPayShop) {
@@ -91,6 +101,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 if (l.getPayType().equals("6")) {
                     l.setPayBank("线上分账");
                 }
+                if (l.getPayType().equals("7")) {
+                    l.setPayBank("华夏银行2400");
+                }
             }
             //付款类型: 1子订单付款 2供应商差价 3付第三方
             if (l.getPaymentType() == 1) {
@@ -252,7 +265,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 so.setDiscountTotalFee(newOrder.getDiscountFee());
                 //机构运费
                 so.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())) {
                     so.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
                 }
                 //机构运费是否已退
@@ -265,6 +278,25 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 //主订单总佣金
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 so.setIncome(income);
+                //若成本下降太多导致部分收款的钱,已经大于成本重新计算佣金
+                if ("0".equals(newOrder.getOnlinePayFlag()) && so.getShopReceiptStatus() == 2) {
+                    double mum = so.getProductAmount();
+                    System.out.println(so.getReceiptTotalFee());
+                    System.out.println(so.getShouldPayShopAmount());
+                    BigDecimal getShouldPayShopAmount = MathUtil.sub(so.getShouldPayShopAmount(), so.getDifferencePrice());
+                    if (so.getReceiptTotalFee() > Double.valueOf(getShouldPayShopAmount.toString())) {
+                        //子订单佣金
+
+                        mum -= so.getShopOtherFee() + Double.valueOf(getShouldPayShopAmount.toString());
+                        so.setBrokerage(mum);
+                    } else {
+                        so.setBrokerage(null);
+                    }
+                } else {
+                    so.setBrokerage(null);
+                }
+                //要是不大于成本默认显示
+
             }
             cmPayShop.setTotalAmount(totalAmount);
             cmPayShop.setBalancePayFee(0D);
@@ -296,8 +328,15 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     collect = records.stream().collect(Collectors.summingDouble(CmRefundShopRecord::getRefundAmount));
                 }
                 so.setRefundAmount(collect);
+                so.setWaitPayShop((so.getShouldPayShopAmount() == null ? 0D : so.getShouldPayShopAmount()) - (so.getPayedShopAmount() == null ? 0D : so.getPayedShopAmount()));
                 if ("1".equals(cmPayShopRecord.getStatus())) {
-                    so.setWaitPayShop(so.getShouldPayShopAmount() - (so.getPayedShopAmount() == null ? 0D : (so.getPayedShopAmount() - collect)));
+                    if (so.getDifferenceType() != null && so.getDifferenceType() == 1) {
+                        BigDecimal waitPayShop = MathUtil.add(so.getWaitPayShop(), so.getDifferencePrice());
+                        so.setWaitPayShop(waitPayShop.doubleValue());
+                    } else if (so.getDifferenceType() != null && so.getDifferenceType() == 2) {
+                        BigDecimal waitPayShop = MathUtil.sub(so.getWaitPayShop(), so.getDifferencePrice());
+                        so.setWaitPayShop(waitPayShop.doubleValue());
+                    }
                 } else {
                     so.setWaitPayShop(cmPayShopRecord.getPayAmount());
                 }
@@ -338,7 +377,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 so.setDiscountTotalFee(newOrder.getDiscountFee());
                 //机构运费
                 so.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())) {
                     so.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
                 }
                 //机构运费是否已退
@@ -352,6 +391,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 so.setIncome(income);
             }
+
             cmPayShop.setShopOrders(csos);
         }
     }
@@ -918,7 +958,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         BigDecimal waitPayShop = BigDecimal.ZERO;
         if (shopOrder != null) {
             payShopDifference.setPayStatus(shopOrder.getPayStatus());
-            waitPayShop = MathUtil.sub(shopOrder.getShouldPayShopAmount(), shopOrder.getPayedShopAmount());
+            waitPayShop = MathUtil.sub(shopOrder.getShouldPayShopAmount(), shopOrder.getDifferencePrice());
             NewCmShop shop = newCmShopDao.get(shopOrder.getShopID().toString());
             payShopDifference.setBankAccount(shop.getBankAccount());
             payShopDifference.setBankAccountName(shop.getBankAccountName());
@@ -929,6 +969,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
             payShopDifference.setRebateAmount(BigDecimal.valueOf(rebateAmount));
             payShopDifference.setType(shopOrder.getDifferenceType());
             payShopDifference.setDifferencePrice(shopOrder.getDifferencePrice());
+            payShopDifference.setShopReceiptStatus(shopOrder.getShopReceiptStatus());
         }
         payShopDifference.setWaitPayShop(waitPayShop);
         return payShopDifference;
@@ -1012,6 +1053,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
 
         //待付供应商金额
         BigDecimal waitPayShop = MathUtil.sub(shopOrder.getShouldPayShopAmount(), shopOrder.getPayedShopAmount());
+//       List<Integer> payWay= newShopOrderDao.payWay(shopOrderId);
+//       if(payWay==1 && shopOrder.getShopReceiptStatus()==2) {
         if (payShopDifference.getType() == 2 && MathUtil.compare(differencePrice, waitPayShop) > 0) {
             //多付且差价大于待付金额,会发生供应商退款操作
             BigDecimal waitRefund = MathUtil.sub(differencePrice, waitPayShop);
@@ -1070,6 +1113,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 throw new Exception("退款金额异常");
             }
         }
+//       }
         payShopDifference.setModifyUserId(Integer.parseInt(UserUtils.getUser().getId()));
         cmPayShopRecordDao.insertDifference(payShopDifference);
         if (!("3".equals(shopOrder.getPayStatus()) && 1 == payShopDifference.getType())) {
@@ -1096,4 +1140,177 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         payShopOther.setPayShopId(payShopId);
         return payShopOther;
     }
+
+    public void settleEdit(CmPayShop cmPayShop, String[] shopOrderIDs) {
+        if (shopOrderIDs != null && shopOrderIDs.length >= 1) {  //新建
+            List<NewShopOrder> payOrderList = newShopOrderDao.findPayOrderListByIDs(shopOrderIDs);
+            List<Integer> shopIDs = payOrderList.stream().map(NewShopOrder::getShopID).distinct().collect(Collectors.toList());
+            Integer shopID = shopIDs.get(0);
+            NewCmShop shop = newCmShopDao.get(shopID + "");
+            cmPayShop.setShopID(shop.getShopID().toString());
+            cmPayShop.setShopName(shop.getName());
+            cmPayShop.setBankAccount(shop.getBankAccount());
+            cmPayShop.setBankAccountName(shop.getBankAccountName());
+            cmPayShop.setBankName(shop.getBankName());
+            cmPayShop.setAbleRebateAmount(shop.getAbleRebateAmount() == null ? 0D : shop.getAbleRebateAmount());
+            cmPayShop.setRebateAmount(shop.getRebateAmount() == null ? 0D : shop.getRebateAmount());
+            //付款单待付供应商总金额
+            double totalAmount = 0D;
+            for (NewShopOrder so : payOrderList) {
+                totalAmount += ((so.getShouldPayShopAmount() == null ? 0D : so.getShouldPayShopAmount()) -
+                        (so.getPayedShopAmount() == null ? 0D : so.getPayedShopAmount()));
+                if (so.getDifferenceType() != null && so.getDifferenceType() == 1) {
+                    totalAmount = MathUtil.add(totalAmount, so.getDifferencePrice()).doubleValue();
+                } else if (so.getDifferenceType() != null && so.getDifferenceType() == 2) {
+                    totalAmount = MathUtil.sub(totalAmount, so.getDifferencePrice()).doubleValue();
+                }
+                List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
+                /*
+                 1. 若发生退货,数量要减去已退货和已取消的数量
+                 2. 有赠品的商品只能全退
+                 */
+                for (NewOrderProduct p : orderProductList) {
+                    Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
+                    returnNum = returnNum == null ? 0 : returnNum;
+                    p.setReturnedNum(returnNum);
+                }
+                so.setNewOrderProducts(orderProductList);
+                so.setWaitPayShop((so.getShouldPayShopAmount() == null ? 0D : so.getShouldPayShopAmount()) - (so.getPayedShopAmount() == null ? 0D : so.getPayedShopAmount()));
+                if (so.getDifferenceType() != null && so.getDifferenceType() == 1) {
+                    BigDecimal waitPayShop = MathUtil.add(so.getWaitPayShop(), so.getDifferencePrice());
+                    so.setWaitPayShop(waitPayShop.doubleValue());
+                } else if (so.getDifferenceType() != null && so.getDifferenceType() == 2) {
+                    BigDecimal waitPayShop = MathUtil.sub(so.getWaitPayShop(), so.getDifferencePrice());
+                    so.setWaitPayShop(waitPayShop.doubleValue());
+                }
+                // 设置线上单的已付为已经结算的金额
+                so.setPayedShopAmount(newOrderDao.findSettleSum(so.getShopOrderID().toString()));
+                //统计该子订单的主的收款金额和收款状态
+                NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
+                if (null != newOrder) {
+                    so.setReceiptStatus(newOrder.getReceiptStatus());
+                    if ("2".equals(newOrder.getOrderType())) {
+                        //呵呵商城订单
+                        so.setOrderType(2);
+                        String name = heHeNewOrderDao.findHeUser(newOrder.getUserID());
+                        so.setClubName(name);
+                    }
+                } else {
+                    so.setReceiptStatus("1");
+                }
+                Double receiptTotalFee = cmReceiptOrderRelationDao.findPayFeeByOrderID(so.getOrderID().toString());
+                so.setReceiptTotalFee(receiptTotalFee);
+                //主订单退款(退货)总金额
+                so.setReturnedPurchaseTotalFee(newShopOrderService.getOrderReturnedPurchaseFee(so));
+                //经理折扣
+                so.setDiscountTotalFee(newOrder.getDiscountFee());
+                //机构运费
+                so.setFreight(newOrder.getFreight());
+                if ("0".equals(newOrder.getFreePostFlag()) || "-1".equals(newOrder.getFreePostFlag()) || "-2".equals(newOrder.getFreePostFlag())) {
+                    so.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
+                }
+                //机构运费是否已退
+                Integer returnedFreightNum = newOrderProductDao.countReturnedFreightProduct(so.getOrderID());
+                Boolean returnedFreightFlag = returnedFreightNum == null ? false : returnedFreightNum > 0 ? true : false;
+                so.setReturnedFreightFlag(returnedFreightFlag);
+                //所有子订单号
+                List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
+                so.setShopOrderNos(strings);
+                //主订单总佣金
+                Double income = newShopOrderDao.findIncome(so.getOrderID());
+                so.setIncome(income);
+            }
+            cmPayShop.setTotalAmount(totalAmount);
+            cmPayShop.setBalancePayFee(0D);
+            cmPayShop.setTransferPayFee(totalAmount);
+            User currentUser = UserUtils.getUser();
+            cmPayShop.setApplicant(currentUser.getId());
+            cmPayShop.setApplicantName(currentUser.getName());
+            cmPayShop.setStatus("0");
+            cmPayShop.setShopOrders(payOrderList);
+        } else {
+            applyDetail(cmPayShop);
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void settlement(String shopOrderId, Double settleAmount) throws Exception {
+        // 结算付供应商
+        String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
+        String substring = format.substring(20);
+        String P3_customerNumber = newOrderDao.findSplitCode(shopOrderId);
+        redisService.set("SDJSS", 1, 120L);
+        settleOrder("JSCB" + shopOrderId + substring, settleAmount, P3_customerNumber, shopOrderId, 1);
+        // 结算佣金 佣金目前分到网络
+        Double payAmount = newOrderDao.findPayAmount(shopOrderId);
+        if (null != payAmount && payAmount > 0) {
+            settleOrder("JSYJ" + shopOrderId + substring, payAmount, Constant.CUSTOMERNUM2, shopOrderId, 2);
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void settleOrder(String P2_orderId, Double settleAmount, String P3_customerNumber, String shopOrderId, Integer settleFlag) throws Exception {
+        //子订单id,结算金额
+        Map<String, String> sPara = new HashMap<String, String>();
+        sPara.put("P1_bizType", "MerchantSettlement");
+        sPara.put("P2_orderId", P2_orderId);
+        sPara.put("P3_customerNumber", P3_customerNumber);
+        sPara.put("P4_amount", settleAmount.toString());
+        sPara.put("P5_summary", "订单结算");
+        sPara.put("signType", "RSA");
+        StringBuffer sb = new StringBuffer();
+        sb.append(Constant.SPLIT).append("MerchantSettlement").append(Constant.SPLIT).append(P2_orderId).append(Constant.SPLIT)
+                .append(P3_customerNumber).append(Constant.SPLIT).append(settleAmount).append(Constant.SPLIT).append("订单结算")
+                .append(Constant.SPLIT).append("RSA");
+        String sign = RSA.sign(sb.toString(), RSA.getPrivateKey(Constant.signKey_setttlement));
+        sPara.put("sign", sign);
+        SettleResult settleResult = SettlePostFormUtil.postForm(sPara, Constant.JS, sign, SettleResult.class);
+        if (!"0000".equals(settleResult.getRt2_retCode())) {
+            logger.info("settleResult----------------->" + settleResult.toString());
+            throw new Exception("结算失败!");
+        } else {
+            String assemblyRespOriSign = "";
+            assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(settleResult, SettleResult.NEED_SIGN_PARAMS);
+            assemblyRespOriSign += Constant.JIESUAN;
+            String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
+            if (!checkSign.equals(settleResult.getSign())) {
+                logger.info("settleResult----------------->" + settleResult.toString());
+                throw new Exception("结算验签失败!");
+            } else {
+                SettleRecord settleRecord = new SettleRecord();
+                //存结算表,改子订单结算状态
+                if (1 == settleFlag) {
+                    //成本结算
+                    settleRecord.setSettleType(settleFlag);
+                    settleRecord.setSettleAmount(settleAmount);
+                    settleRecord.setSplitCode(P3_customerNumber);
+                    settleRecord.setShopOrderId(shopOrderId);
+                    newOrderDao.insertSettleRecord(settleRecord);
+                    // 修改cm_split_account settlestatus
+                    newOrderDao.updateSettleStatus(shopOrderId, 1);
+                    //计算供应商成本,结算金额,修改结算状态
+                    Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
+                    Double settleSum = newOrderDao.findSettleSum(shopOrderId);
+                    if (shouldPayShopAmount > settleSum) {
+                        //成本>结算金额,部分结算
+                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
+                    } else {
+                        //成本=结算金额 全部结算
+                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
+                    }
+                } else {
+                    //佣金结算
+                    settleRecord.setSettleType(settleFlag);
+                    settleRecord.setSettleAmount(settleAmount);
+                    settleRecord.setSplitCode(P3_customerNumber);
+                    settleRecord.setShopOrderId(shopOrderId);
+                    newOrderDao.insertSettleRecord(settleRecord);
+                    // 修改cm_split_account settlestatus
+                    newOrderDao.updateSettleStatus(shopOrderId, 3);
+                }
+                //解锁
+                redisService.remove("SDJSS");
+            }
+        }
+    }
 }

+ 274 - 93
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -12,12 +12,10 @@ 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;
-import com.caimei.modules.user.dao.CmUserBalanceRecordDao;
-import com.caimei.modules.user.dao.CmUserDao;
-import com.caimei.modules.user.dao.CmUserbeanshistoryDao;
-import com.caimei.modules.user.dao.NewCmClubDao;
+import com.caimei.modules.user.dao.*;
 import com.caimei.modules.user.entity.CmUser;
 import com.caimei.modules.user.entity.CmUserBalanceRecord;
+import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.UserBeansHistory;
 import com.caimei.modules.user.service.CmUserBalanceRecordService;
 import com.caimei.utils.AppUtils;
@@ -44,6 +42,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -102,6 +101,9 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
     private CmUserbeanshistoryDao cmUserbeanshistoryDao;
     @Autowired
     private CmCouponClubDao cmCouponClubDao;
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+
 
 
     public CmReturnedPurchase get(String id) {
@@ -125,6 +127,10 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
             model.addAttribute("errorMsg", "待确认,待收待发订单 不能申请退款");
             return "待确认,待收待发订单 不能申请退款";
         }
+        Integer changeFlag = 0;
+        if ("2".equals(cmReturnedPurchase.getReturnedWay())) {
+            changeFlag = 1;
+        }
         cmReturnedPurchase.setReturnedWay("1");
         if (NewOrderStatus.isNotPay(newOrder.getStatus())) {
             //未支付订单无退款
@@ -176,6 +182,9 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
         if (num <= 0) {
             return "请填写退货/取消数量";
         }
+        if(null!=cmReturnedPurchase.getRefundType()&&2==cmReturnedPurchase.getRefundType()){
+            cmReturnedPurchase.setRefundFee(cmReturnedPurchase.getFreeRefundFee());
+        }
         String id = cmReturnedPurchase.getId();//存在Id则是重申或者再次申请
         if (StringUtils.isEmpty(id)) {
             //正常插入数据流程---新申请
@@ -229,30 +238,32 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 }
             }
         }
-        if (newOrder.getPromotionFullReduction() != null) {
-            //减去促销满减金额
-            returnedPurchaseFee = returnedPurchaseFee - newOrder.getPromotionFullReduction();
-        }
-        if (newOrder.getCouponAmount() > 0) {
-            //减去优惠券金额
-            returnedPurchaseFee = MathUtil.sub(returnedPurchaseFee, newOrder.getCouponAmount()).doubleValue();
-        }
-        cmReturnedPurchase.setReturnedPurchaseFee(returnedPurchaseFee);
-        refundFee += getRefundFee(newOrder, cmReturnedPurchase, freightNum);
-        //充值或缴纳订金订单
-        if (rechargeGoods) {
-            CmUser user = cmUserDao.get(newOrder.getUserID().toString());
-            if (user != null && user.getAbleUserMoney() != null && user.getAbleUserMoney() < refundFee) {
-                refundFee = user.getAbleUserMoney();
+        if (1 == cmReturnedPurchase.getRefundType() && 0 == changeFlag) {
+            if (newOrder.getPromotionFullReduction() != null) {
+                //减去促销满减金额
+                returnedPurchaseFee = returnedPurchaseFee - newOrder.getPromotionFullReduction();
             }
-            cmReturnedPurchase.setReturnedPurchaseFee(refundFee);
-            if (user != null) {
-                //冻结余额
-                user.setAbleUserMoney(user.getAbleUserMoney() - refundFee);
-                cmUserDao.updateMoney(user);
+            if (newOrder.getCouponAmount() > 0) {
+                //减去优惠券金额
+                returnedPurchaseFee = MathUtil.sub(returnedPurchaseFee, newOrder.getCouponAmount()).doubleValue();
             }
+            cmReturnedPurchase.setReturnedPurchaseFee(returnedPurchaseFee);
+            refundFee += getRefundFee(newOrder, cmReturnedPurchase, freightNum);
+            //充值或缴纳订金订单
+            if (rechargeGoods) {
+                CmUser user = cmUserDao.get(newOrder.getUserID().toString());
+                if (user != null && user.getAbleUserMoney() != null && user.getAbleUserMoney() < refundFee) {
+                    refundFee = user.getAbleUserMoney();
+                }
+                cmReturnedPurchase.setReturnedPurchaseFee(refundFee);
+                if (user != null) {
+                    //冻结余额
+                    user.setAbleUserMoney(user.getAbleUserMoney() - refundFee);
+                    cmUserDao.updateMoney(user);
+                }
+            }
+            cmReturnedPurchase.setRefundFee(refundFee);
         }
-        cmReturnedPurchase.setRefundFee(refundFee);
         cmReturnedPurchaseDao.update(cmReturnedPurchase);
         return null;
     }
@@ -563,7 +574,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
             }
             newOrderService.update(newOrder);
             //判断是否选择退回余额
-            if ((returnedPurchase.getReturnedWay().equals("1") && returnedPurchase.getRefundBalanceFee() > 0d) || newOrder.getRechargeGoods() != null) {
+            if ((StringUtils.isNotBlank(returnedPurchase.getReturnedWay())&&"1".equals(returnedPurchase.getReturnedWay()) && returnedPurchase.getRefundBalanceFee() > 0d) || (null!=newOrder.getRechargeGoods()&&(1 == newOrder.getRechargeGoods() || 2 == newOrder.getRechargeGoods()))) {
                 Double userMoney = user.getUserMoney();
                 Double ableUserMoney = user.getAbleUserMoney();
                 Double refundBalanceFee = returnedPurchase.getRefundBalanceFee();
@@ -572,7 +583,6 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 if (ableUserMoney == null) ableUserMoney = 0d;
                 if (refundBalanceFee == null) refundBalanceFee = 0d;
                 user.setUserID(newOrder.getUserID());
-
                 //添加余额收支记录
                 CmUserBalanceRecord cmUserBalanceRecord = new CmUserBalanceRecord();
                 cmUserBalanceRecord.setUserId(newOrder.getUserID());
@@ -585,7 +595,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 cmUserBalanceRecord.setReturnedId(Integer.parseInt(returnedPurchase.getId()));
                 cmUserBalanceRecord.setDelFlag("0");
 
-                if (newOrder.getRechargeGoods() != null) {
+                if (null != newOrder.getRechargeGoods() && (1 == newOrder.getRechargeGoods() || 2 == newOrder.getRechargeGoods())) {
                     user.setUserMoney(userMoney - refundFee);
                     cmUserBalanceRecord.setAmount(String.valueOf(refundFee));
                     cmUserBalanceRecord.setType("2");
@@ -605,12 +615,13 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
             updateShopOrderAmount(newOrder.getOrderID());
 
             //判断是否有线上退款
-            if (returnedPurchase.getReturnedWay().equals("1") && returnedPurchase.getRefundOnlineFee() > 0) {
-                List<Integer> shopOrderIds = cmReturnedPurchaseDao.findReturnedShopOrder(returnedPurchase.getOrderID());
+            if ("1".equals(returnedPurchase.getReturnedWay()) && returnedPurchase.getRefundOnlineFee() > 0) {
+                List<Integer> shopOrderIds = cmReturnedPurchaseDao.getReturnShopOrder(returnedPurchase.getId());
                 if (null == shopOrderIds || 0 == shopOrderIds.size()) {
                     throw new Exception("退款子订单信息错误!");
                 }
-                theOnlineRefund(shopOrderIds);
+                Double refundOnlineFee = returnedPurchase.getRefundOnlineFee();
+                theOnlineRefund(shopOrderIds, refundOnlineFee);
             }
 
             //二手订单交易全退,标记未售
@@ -689,16 +700,53 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                     String wwwServer = Global.getConfig("wwwServer");
                     boolean sendSms = false;
                     if ("1".equals(newOrder.getRefundType())) {
+                        Date date = new Date();
+                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                        //推送信息中心-交易物流
+                       Integer clubId= messageCenterDao.clubIdCule(newOrder.getUserID());
+                        MessageCenter messageCenter=new MessageCenter();
+                        messageCenter.setShopId(null);
+                        messageCenter.setClubId(clubId);
+                        messageCenter.setUserType(1);
+                        messageCenter.setMessageType(1);
+                        messageCenter.setOrderMessageType(3);
+                        messageCenter.setOrderId(newOrder.getOrderID());
+                        messageCenter.setContent(returnedPurchase.getRefundFee().toString());
+                        messageCenter.setTime(curDateStr);
+                        messageCenterDao.addMessageCenter(messageCenter);
                         //部分退
+                        String name=newOrder.getProductName();
+                        if (name.length() > 10) {
+                            name = StringUtils.strip(name.substring(0, 11));
+                            name += "...";
+                        }
                         String shortLink = newOrderService.getShortLink(8, 9, wwwServer + "user/order/detail.html?orderId=" + newOrder.getOrderID());
-                        String content = "订单(订单编号:" + newOrder.getOrderNo() + ")已部分退款成功,本次退款金额¥" + returnedPurchase.getRefundFee() + "。您可关注采美公众号或者访问采美微信小程序和网站查看订单。" +
-                                "平台公众号:微信搜索“采美365网”; 微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
+                        String content = "【采美365】订单("+name+"等"+productCount+"件商品)已全部退款成功,退款金额¥"+returnedPurchase.getRefundFee()+"。您可点击采美网址www.caimei.com 或使用微信小程序“采美采购商城”查看订单。";
                         sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
                     } else if ("2".equals(newOrder.getRefundType())) {
+
+                        Date date = new Date();
+                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                        //推送信息中心-交易物流
+                        Integer clubId= messageCenterDao.clubIdCule(newOrder.getUserID());
+                        MessageCenter messageCenter=new MessageCenter();
+                        messageCenter.setShopId(null);
+                        messageCenter.setClubId(clubId);
+                        messageCenter.setUserType(1);
+                        messageCenter.setMessageType(1);
+                        messageCenter.setOrderMessageType(3);
+                        messageCenter.setOrderId(newOrder.getOrderID());
+                        messageCenter.setContent(returnedPurchase.getRefundFee().toString());
+                        messageCenter.setTime(curDateStr);
+                        messageCenterDao.addMessageCenter(messageCenter);
                         //全部退
+                        String name=newOrder.getProductName();
+                        if (name.length() > 10) {
+                            name = StringUtils.strip(name.substring(0, 11));
+                            name += "...";
+                        }
                         String shortLink = newOrderService.getShortLink(8, 10, wwwServer + "user/order/detail.html?orderId=" + newOrder.getOrderID());
-                        String content = "订单(订单编号:" + newOrder.getOrderNo() + ")已全部退款成功,退款金额¥" + returnedPurchase.getRefundFee() + "。您可关注采美公众号或者访问采美微信小程序和网站查看订单。" +
-                                "平台公众号:微信搜索“采美365网”; 微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
+                        String content = "【采美365】订单("+name+"等"+productCount+"件商品)已部份退款成功,退款金额¥"+returnedPurchase.getRefundFee()+"。您可点击采美网址www.caimei.com 或使用微信小程序“采美采购商城”查看订单。";
                         sendSms = newOrderService.getSendSms(10, user.getBindMobile(), content);
                     }
                     if (!sendSms) {
@@ -752,28 +800,158 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
      *
      * @param shopOrderIds
      */
-    public void theOnlineRefund(List<Integer> shopOrderIds) {
+    public void theOnlineRefund(List<Integer> shopOrderIds, Double refundOnlineFee) throws Exception {
         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) {
             for (CmReceiptOrderRelation orderRelation : relationList) {
                 //cdr表payway为1纯线上收款
                 if ("1".equals(orderRelation.getPayWay())) {
+                    String value = "";
+                    double chargeFee = MathUtil.sub(refundOnlineFee, Double.parseDouble(orderRelation.getAssociateAmount())).doubleValue();
+                    if (chargeFee > 0) {
+                        //要退的钱大于本次交易金额
+                        value = orderRelation.getAssociateAmount();
+                    } else {
+                        value = refundOnlineFee.toString();
+                    }
                     //不同产品区分
                     if ("12".equals(orderRelation.getPayType()) || "17".equals(orderRelation.getPayType())) {
+                        if (1 == orderRelation.getSplitStatus()) {
+                            //已分帐应该先转回佣金
+                            //如果已转回则不再转。
+                            Double refundTransfer = cmReturnedPurchaseDao.findRefundTransfer(orderRelation.getOrderRequestNo());
+                            if (0 == refundTransfer) {
+                                Double brokerage = cmReturnedPurchaseDao.findBrokerage(orderRelation.getOrderRequestNo());
+                                if (brokerage > 0) {
+                                    //0.1%手续费,转回金额*99.9%=brokerage
+                                    Double v = MathUtil.div(brokerage, 0.999, 2).doubleValue();
+                                    transferMoney(v, orderRelation.getShopOrderId(), orderRelation.getOrderRequestNo(), 2);
+                                }
+                            }
+                        }
+                        //手续费转给供应商
+                        Double refundTransfer = cmReturnedPurchaseDao.findRefundCharge(orderRelation.getOrderRequestNo());
+                        if (0 == refundTransfer) {
+                            //计算手续费
+                            Double payAmount = cmReturnedPurchaseDao.findPayAmount(orderRelation.getOrderRequestNo());
+                            Double charge = 0d;
+                            //个人0.2%企业10
+                            if ("12".equals(orderRelation.getPayType())) {
+                                charge = MathUtil.mul(payAmount, 0.002, 2).doubleValue();
+                            } else {
+                                charge = 10d;
+                            }
+                            //0.1%手续费,转回金额*99.9%=payAmount
+                            Double v = MathUtil.div(charge, 0.999, 2).doubleValue();
+                            transferMoney(v, orderRelation.getShopOrderId(), orderRelation.getOrderRequestNo(), 1);
+                        }
                         //网银
-                        unionRefund(orderRelation.getOrderRequestNo(), orderRelation.getAssociateAmount(), orderRelation.getShopOrderId());
+                        unionRefund(orderRelation.getOrderRequestNo(), value, orderRelation.getShopOrderId());
                     } else {
+                        // 已分帐应该先转回佣金
+                        if (1 == orderRelation.getSplitStatus()) {
+                            //已分帐应该先转回佣金
+                            //如果已转回则不再转。
+                            Double refundTransfer = cmReturnedPurchaseDao.findRefundTransfer(orderRelation.getOrderRequestNo());
+                            if (0 == refundTransfer) {
+                                Double brokerage = cmReturnedPurchaseDao.findBrokerage(orderRelation.getOrderRequestNo());
+                                if (brokerage > 0) {
+                                    //0.1%手续费,转回金额*99.9%=brokerage
+                                    Double v = MathUtil.div(brokerage, 0.999, 2).doubleValue();
+                                    transferMoney(v, orderRelation.getShopOrderId(), orderRelation.getOrderRequestNo(), 2);
+                                }
+                            }
+                        }
                         //扫码
-                        onlinePay(orderRelation.getOrderRequestNo(), orderRelation.getAssociateAmount(), orderRelation.getShopOrderId());
+                        onlinePay(orderRelation.getOrderRequestNo(), value, orderRelation.getShopOrderId());
+                    }
+
+                    if (0 == refundOnlineFee) {
+                        break;
                     }
                 }
             }
         }
     }
 
-    public void onlinePay(String orderRequestNo, String money, Integer shopOrderId) {
+    public void transferMoney(Double v, Integer shopOrderId, String orderRequestNo, Integer flag) {
+        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 + orderRequestNo);
+            //付款账户子订单绑定商户号(这里从佣金转出)
+            accountPayOrder.setP5_customerNumber(Constant.CUSTOMERNUM2);
+            AccountPayOrder.AccountPayOrderExt accountPayOrderExt = new AccountPayOrder.AccountPayOrderExt();
+            //收款账户商编  填写splitBillRules时候不填写MerchantNo,Amount并且即使填写这两个参数不生效!!
+            accountPayOrderExt.setInMerchantNo(cmReturnedPurchaseDao.findSplitCode(shopOrderId));
+            accountPayOrderExt.setOrderType(AccountPayOrderType.TRANSFER);
+            accountPayOrderExt.setAmount(BigDecimal.valueOf(v));
+            accountPayOrderExt.setServerCallbackUrl("");
+            accountPayOrderExt.setGoodsName("退款转账");
+            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 {
+                    CmRefundTransfer cmRefundTransfer = new CmRefundTransfer();
+                    cmRefundTransfer.setTransferType(flag);
+                    cmRefundTransfer.setTransferAmount(v);
+                    cmRefundTransfer.setOrderRequestNo(orderRequestNo);
+                }
+            }
+        } catch (Exception e) {
+            logger.error("【退款转账】>>>>>>>>>>错误信息", e);
+        }
+    }
+
+    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 void onlinePay(String orderRequestNo, String money, Integer shopOrderId) throws Exception {
         AppPayRefundOrderVo orderVo = new AppPayRefundOrderVo();
         orderVo.setP1_bizType("AppPayRefund");
         String splitCode = cmReturnedPurchaseDao.findSplitCode(shopOrderId);
@@ -785,42 +963,43 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
         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.error("退款失败========================" + orderResponseVo.getRt5_orderId() + "-" + orderResponseVo.getRt3_retMsg());
-                        throw new Exception("第三方退款失败!");
-                    }
+        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())) {
+                    CmRefundRecord cmRefundRecord = new CmRefundRecord();
+                    cmRefundRecord.setRefundAmount(Double.parseDouble(money));
+                    cmRefundRecord.setOrderRequestNo(orderRequestNo);
+                    cmRefundRecord.setShopOrderId(shopOrderId);
+                    cmReturnedPurchaseDao.insertCmRefundRecord(cmRefundRecord);
+                    logger.info("第三方退款成功>>>>>>>shopOrderId>>>" + shopOrderId);
                 } else {
-                    logger.error("退款验签失败");
-                    throw new Exception("第三方退款验签失败!");
+                    logger.error("退款失败========================" + orderResponseVo.getRt5_orderId() + "-" + orderResponseVo.getRt3_retMsg());
+                    throw new Exception("第三方退款失败!");
                 }
             } else {
-                logger.error("退款请求失败");
-                throw new Exception("第三方退款请求失败!");
+                logger.error("退款验签失败");
+                throw new Exception("第三方退款验签失败!");
             }
-        } catch (Exception e) {
-            e.printStackTrace();
+        } else {
+            logger.error("退款请求失败");
+            throw new Exception("第三方退款请求失败!");
         }
     }
 
@@ -828,7 +1007,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
     //1.本方法内转账手续费等待到账再发起退款请求
     //2.异步
     //3.回调
-    void unionRefund(String orderRequestNo, String money, Integer shopOrderId) {
+    void unionRefund(String orderRequestNo, String money, Integer shopOrderId) throws Exception {
         Map<String, String> sPara = new HashMap<String, String>();
         sPara.put("P1_bizType", "OnlineRefund");
         sPara.put("P2_orderId", orderRequestNo);
@@ -843,30 +1022,32 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 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("退款失败");
+        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 {
-                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("第三方退款成功");
-                }
+                CmRefundRecord cmRefundRecord = new CmRefundRecord();
+                cmRefundRecord.setRefundAmount(Double.parseDouble(money));
+                cmRefundRecord.setOrderRequestNo(orderRequestNo);
+                cmRefundRecord.setShopOrderId(shopOrderId);
+                cmReturnedPurchaseDao.insertCmRefundRecord(cmRefundRecord);
+                logger.info("第三方退款成功");
             }
-        } catch (Exception e) {
-            e.printStackTrace();
         }
     }
 
-    public  <T> T postForm(Map<String, String> params, String url, String sign, Class<T> clazz) {
+
+    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());

+ 129 - 34
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -30,6 +30,7 @@ import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.product.entity.OrderProductLadderPrice;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.dao.NewCmClubDao;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.entity.*;
@@ -128,6 +129,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     private HeHeNewOrderDao heHeNewOrderDao;
     @Autowired
     private WeChatService weChatService;
+    @Autowired
+    private MessageCenterDao messageCenterDao;
 
     @Transactional(readOnly = false)
     public void updateClauseContent(NewOrder newOrder) {
@@ -141,6 +144,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             NewOrder dbOrder = newOrderDao.findByOrderID(newOrder.getOrderID());
             boolean flag = false;// 是否新增标志
             boolean onlinePay = true;   // 能否线上支付
+            String dbOnlinePayFlag = newOrder.getOnlinePayFlag();
             if (newOrder.getOrderID() == null) {
                 flag = true;
                 newOrder.setOrderNo(OrderUtil.geneAdminOrderNo());
@@ -168,7 +172,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             if (newOrder.getHasActProduct() == null) {
                 newOrder.setHasActProduct("0");
             }
-            if (newOrder.getOnlinePayFlag() == null) {
+            if (StringUtils.isEmpty(newOrder.getOnlinePayFlag())) {
                 newOrder.setOnlinePayFlag("0");
             }
             if (!StringUtils.equals("1", newOrder.getConfirmFlag())) {
@@ -177,10 +181,13 @@ 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.getPromotionalGiftsCount() !=null ){
+                // 有赠品不能线上支付
+                if (newOrder.getPresentCount() > 0 || newOrder.getPromotionalGiftsCount() > 0) {
+                    onlinePay = false;
+                }
             }
+
             // 用余额不能线上支付
             if (newOrder.getBalancePayFee() != null && newOrder.getBalancePayFee() > 0) {
                 onlinePay = false;
@@ -269,6 +276,9 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 newOrderDao.insert(newOrder);
             } else {
                 // 修改
+                if ("0".equals(newOrder.getOnlinePayFlag())) {
+                    logger.info("【修改订单可线上支付】>>>>>>>>>>>>>>>>>原onlinePayFlag:" + dbOnlinePayFlag + ",orderId:" + newOrder.getOrderID() + ",行数:" + 274);
+                }
                 newOrderDao.update(newOrder);
             }
             //优惠券相关
@@ -864,6 +874,9 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 }
             }
             newOrder.setShopOrderIDs(shopOrderIDs);
+            if ("0".equals(newOrder.getOnlinePayFlag())) {
+                logger.info("【修改订单可线上支付】>>>>>>>>>>>>>>>>>原onlinePayFlag:" + dbOnlinePayFlag + ",orderId:" + newOrder.getOrderID() + ",行数:" + 872);
+            }
             newOrderDao.update(newOrder);
 
             //下单短信推送
@@ -913,6 +926,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         list.add("15814011616");
         list.add("13100721916");
         list.add("15113936829");
+        list.add("18175515644");
+        list.add("18476937515");
         if (config.equals("product") || list.contains(mobile)) {
             if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
                 String regex = "^(1[3-9]\\d{9}$)";
@@ -1225,7 +1240,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             //获取订单商品
             List<NewOrderProduct> list = new ArrayList<>();
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
-            if (shopOrders.size() > 1) {
+            Integer count=newOrderDao.findShopOrderSize(newOrder.getOrderID());
+            if (count > 1) {
                 newOrder.setRechargeGoods(3);
             }
             if (CollectionUtils.isNotEmpty(shopOrders)) {
@@ -1361,7 +1377,9 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 }
             }
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(cmReturnedPurchase.getOrderID());
-            logger.info("shopOrders》》》》》" + shopOrders.toString());
+            if(null!=cmReturnedPurchase.getOnlineShopOrderId()&&0<cmReturnedPurchase.getOnlineShopOrderId()){
+                 shopOrders = newShopOrderDao.findListByShopOrderId(cmReturnedPurchase.getOnlineShopOrderId());
+            }
             if (CollectionUtils.isNotEmpty(shopOrders)) {
                 for (NewShopOrder shopOrder : shopOrders) {
                     //获取退货退款记录
@@ -1566,6 +1584,19 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 cmUserDao.updateUserBeans(order.getUserID(), beans);
             }
         }
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String current = dateFormat.format(new Date());
+        MessageCenter messageCenter = new MessageCenter();
+        messageCenter.setShopId(null);
+        messageCenter.setClubId(order.getClubID());
+        messageCenter.setUserType(1);
+        messageCenter.setMessageType(1);
+        messageCenter.setOrderMessageType(4);
+        messageCenter.setContent("您的订单已成功取消!");
+        messageCenter.setOrderId(orderID);
+        messageCenter.setTime(current);
+        messageCenterDao.addMessageCenter(messageCenter);
+
 
         //取消订单短信推送(取消订单推送)
         /*try {
@@ -1685,6 +1716,28 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 } else {
                     autoCloseTimeMills += cfg.getValue() * 60 * 1000;
                 }
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //24小时制
+
+                Date dat = new Date();
+                Date d=new Date();
+                dat.setTime(autoCloseTimeMills);
+                System.out.println("时间戳转日期格式:" + simpleDateFormat.format(dat));
+                Long s=(d.getTime()-dat.getTime())/24/60/60/1000;
+                if(s>cfg.getValue()){
+                    //推送信息中心-交易物流
+                    String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(dat);
+                    MessageCenter messageCenter=new MessageCenter();
+                    messageCenter.setShopId(null);
+                    messageCenter.setClubId(shopOrder.getClubID());
+                    messageCenter.setUserType(1);
+                    messageCenter.setMessageType(1);
+                    messageCenter.setOrderMessageType(5);
+                    messageCenter.setOrderId(shopOrder.getOrderID());
+                    messageCenter.setContent(null);
+                    messageCenter.setTime(curDateStr);
+                    messageCenterDao.addMessageCenter(messageCenter);
+                }
+
 
                 shopOrder.setAutoReceiveTimeMills(autoCloseTimeMills);
             }
@@ -1723,6 +1776,18 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     } catch (Exception e) {
                         logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
                     }
+                    String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    //推送信息中心-交易物流
+                    MessageCenter messageCenter=new MessageCenter();
+                    messageCenter.setShopId(null);
+                    messageCenter.setClubId(order.getClubID());
+                    messageCenter.setUserType(1);
+                    messageCenter.setMessageType(1);
+                    messageCenter.setOrderMessageType(5);
+                    messageCenter.setOrderId(order.getOrderID());
+                    messageCenter.setContent(null);
+                    messageCenter.setTime(curDateStr);
+                    messageCenterDao.addMessageCenter(messageCenter);
                 }
             }
             //所有的子订单都已经完成发货了
@@ -1752,6 +1817,20 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 } catch (Exception e) {
                     logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
                 }
+
+                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                //推送信息中心-交易物流
+                MessageCenter messageCenter=new MessageCenter();
+                messageCenter.setShopId(null);
+                messageCenter.setClubId(order.getClubID());
+                messageCenter.setUserType(1);
+                messageCenter.setMessageType(1);
+                messageCenter.setOrderMessageType(5);
+                messageCenter.setOrderId(order.getOrderID());
+                messageCenter.setContent(null);
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+
             }
 
             //代码走到这里订单肯定是有发货了  整个订单里面的商品没有全部发完  那就是部分发货了
@@ -1820,34 +1899,34 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
         }
 
-        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();
-            }
-        }
+//        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();
+//            }
+//        }
         return lb.getId();
     }
 
@@ -2593,4 +2672,20 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         newOrderDao.updatePayAndReceipt(orderId);
         newOrderDao.updatePayStatusSon(orderId);
     }
+
+    public List<SettleRecord> findSettleRecord(Integer orderID) {
+        return newOrderDao.findSettleRecord(orderID);
+    }
+
+    public NewOrder editRebateFee(NewOrder newOrder) {
+        NewOrder order = newOrderDao.get(String.valueOf(newOrder.getOrderID()));
+        return order;
+    }
+
+    @Transactional(readOnly = false)
+    public void saveRebateFee(NewOrder newOrder) {
+        newOrder.setRebateFee(newOrder.getRebateFee());
+        newOrder.setRebateFlag("2");
+        newOrderDao.update(newOrder);
+    }
 }

+ 30 - 1
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -292,7 +292,8 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             } else {
                 so.setReceiptStatus("1");
             }
-            Double receiptTotalFee = cmReceiptOrderRelationDao.findPayFeeByOrderID(so.getOrderID().toString());
+            double receiptTotalFee = cmReceiptOrderRelationDao.findPayFeeByOrderID(so.getOrderID().toString());
+
             so.setReceiptTotalFee(receiptTotalFee);
 
             //第一次收款收款时间
@@ -433,6 +434,9 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
 
     public Page<NewOrder> findPaymentOrderList(Page<NewOrder> page, NewOrder newOrder) {
         newOrder.setPage(page);
+        List<SettleRecord> settleRecord = newOrderDao.findSettleRecord(newOrder.getOrderID());
+        Integer num=null==settleRecord?0:settleRecord.size();
+        newOrder.setSettleRecordNum(num);
         if (newOrder.getPayStatus() != null && newOrder.getPayStatus() != "") {
             String[] split = newOrder.getPayStatus().split(",");
             newOrder.setPs(split);
@@ -447,6 +451,9 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             orderIds = cmDiscernReceiptDao.findRebateOrderID(orderList.stream().map(NewOrder::getOrderID).collect(Collectors.toList()));
         }
         for (NewOrder order : orderList) {
+            if("0".equals(order.getOnlinePayFlag())){
+                order.setSettleAmount(newOrderDao.findSettleAmount(order.getOrderID()));
+            }
             if (orderIds != null && orderIds.contains(order.getOrderID())) {
                 order.setRebateOrder("1");
                 order.setReceiptStatus("4");
@@ -668,4 +675,26 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         page.setList(payOrderList);
         return page;
     }
+
+    @Transactional(readOnly = false)
+    public Page<NewShopOrder> findSettlementList(Page<NewShopOrder> page, NewShopOrder shopOrder) {
+        shopOrder.setPage(page);
+        if (StringUtils.isNotBlank(shopOrder.getPayStatus())) {
+            String[] split = shopOrder.getPayStatus().split(",");
+            shopOrder.setPs(split);
+        }
+        // 已分帐,子订单未结算/部分结算,有未结算付款
+        List<NewShopOrder> payOrderList = newShopOrderDao.findSettlementList(shopOrder);
+        setValue(payOrderList);
+        page.setList(payOrderList);
+        return page;
+    }
+
+    public List<SettleRecord> getSettleRecord(String shopOrderID) {
+        return newShopOrderDao.findSettleRecord(shopOrderID);
+    }
+
+    public List<Integer> payWay(Integer shoprderID){
+        return newShopOrderDao.payWay(shoprderID);
+    }
 }

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

@@ -221,7 +221,7 @@ public class SplitAccountService extends BaseService {
                             } else {
                                 for (SplitAccountPo splitAccount : splitBillDetail) {
                                     splitAccount.setMbOrderId(orderRelation.getMbOrderId());
-                                    splitAccount.setOrderRequestNo(substring + orderRelation.getOrderRequestNo());
+                                    splitAccount.setOrderRequestNo(orderRelation.getOrderRequestNo());
                                     splitAccount.setPayStatus(1);
                                     // 保存分账详情
                                     newOrderDao.insertSplitAccount(splitAccount);

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

@@ -95,4 +95,263 @@ public class WeChatService {
             logger.info(">>>>>>>>>推送微信模板消息失败:",e);
         }
     }
+
+    /**
+     * 资质机构认证成功消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMsg(String accessToken, String openid ,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "认证成功通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "恭喜您成功成为采美资质机构");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "资质机构");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", "审核通过");
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        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", "kfzhVTJ6sNOJSgwk8x7Z9_m8S2LRzDfAGtiUgGyO8Zk");
+        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);
+        }
+    }
+
+    /**
+     * 资质机构认证失败消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMessg(String accessToken, String openid, String auditResult,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "认证失败通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "您升级采美资质机构认证失败");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "资质机构");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", "审核未通过");
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject keyword5 = new JSONObject();
+        keyword5.put("value", auditResult);
+        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("keyword5", keyword5);
+        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", "btBvh1LIzTPMIpZNPNIupQnMcMw8_ziyQ6CGV68eN7s");
+        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);
+        }
+    }
+
+    /**
+     * 供应商审核失败消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplate(String accessToken, String openid,String shopName,String auditNote,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "您提交的供应商账号注册申请审核失败。");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", shopName);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "账号注册");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", auditNote);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        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", "QogD0Mu5zvNo51hqJXXNYiVByuDmYLxg2kxHUMqlyCI");
+        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);
+        }
+    }
+
+    /**
+     * 商品审核未通过消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemp(String accessToken, String openid,String name,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "商品审核未通过通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "抱歉,您发布的商品未通过审核");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "审核未通过");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", auditTime);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", name);
+        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", "oGiOHlJgx0L8rWmq6wqXHUIZjIzuPkiRu2xbqTE26Tg");
+        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);
+        }
+    }
+
+    /**
+     * 商品审核未通过消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void messteme(String accessToken, String openid,String name,String qualificationNo,String auditTime,String proName, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "您好,您有商品资质证书即将到期。");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", name);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "医疗器械注册证");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", qualificationNo);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject remark = new JSONObject();
+        remark.put("value", proName);
+
+        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", "gpD9TqBpkgaw3YSM_JPk4WSTwKZY0hxrBCH0SjzNKY4");
+        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);
+        }
+    }
+
 }

+ 7 - 1
src/main/java/com/caimei/modules/order/utils/OrderUtil.java

@@ -34,7 +34,7 @@ public class OrderUtil {
      *
      * @param order
      */
-    public static void orderSplit(NewOrder order,boolean payOnline) {
+    public static void orderSplit(NewOrder order, boolean payOnline) {
         int shopOrderNoIndex = 0;
         List<NewOrderProduct> orderProducts = order.getOrderProduct();
         // 促销
@@ -338,6 +338,12 @@ public class OrderUtil {
         if ("20".equals(payType)) {
             return "建设银行3346";
         }
+        if ("21".equals(payType)) {
+            return "中国银行9139";
+        }
+        if ("22".equals(payType)) {
+            return "华夏银行2400";
+        }
         return "";
     }
 

+ 404 - 0
src/main/java/com/caimei/modules/order/utils/RSA.java

@@ -0,0 +1,404 @@
+package com.caimei.modules.order.utils;
+
+import org.apache.commons.lang.ArrayUtils;
+import sun.misc.BASE64Encoder;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.KeyPair;
+import java.security.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Arrays;
+import java.util.Enumeration;
+
+/**
+ * 私钥签名,私钥签名(只有私钥能签),公钥验证签名,确认发起人是私钥持有人
+ * 公钥加密,公钥加密只有私钥能解密
+ * @author datou
+ *
+ */
+public class RSA {
+	
+	 /** 
+     * String to hold name of the encryption padding. 
+     */  
+    public static final String NOPADDING = "RSA/NONE/NoPadding";
+    
+    public static final String RSANONEPKCS1PADDING = "RSA/NONE/PKCS1Padding";
+    
+    public static final String RSAECBPKCS1PADDING = "RSA/ECB/PKCS1Padding";
+	
+	public static final String PROVIDER = "BC";
+	
+	static{
+		Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
+	}
+	
+	/**
+	 * 验证签名
+	 * 
+	 * @param data
+	 *            数据
+	 * @param sign
+	 *            签名
+	 * @param pubicKey
+	 *            公钥
+	 * @return
+	 */
+	public static boolean verifySign(byte[] data, byte[] sign,
+			PublicKey publicKey) {
+		try {
+			Signature signature = Signature
+					.getInstance("MD5withRSA");
+			signature.initVerify(publicKey);
+			signature.update(data);
+			boolean result = signature.verify(sign);
+			return result;
+		} catch (Exception e) {
+
+			throw new RuntimeException("verifySign fail!", e);
+		}
+	}
+
+	/**
+	 * 验证签名
+	 * 
+	 * @param data
+	 *            数据
+	 * @param sign
+	 *            签名
+	 * @param pubicKey
+	 *            公钥
+	 * @return
+	 */
+	public static boolean verifySign(String data, String sign,
+			PublicKey pubicKey) {
+		try {
+			byte[] dataByte = data
+					.getBytes("UTF-8");
+			byte[] signByte = Base64.decode(sign
+					.getBytes("UTF-8"));
+			return verifySign(dataByte, signByte, pubicKey);
+		} catch (UnsupportedEncodingException e) {
+
+			throw new RuntimeException("verifySign fail! data["+data+"] sign["+sign+"]", e);
+		}
+	}
+
+	/**
+	 * 签名
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static byte[] sign(byte[] data, PrivateKey key) {
+		try {
+			Signature signature = Signature
+					.getInstance("MD5withRSA");
+			signature.initSign(key);
+			signature.update(data);
+			return signature.sign();
+		} catch (Exception e) {
+			throw new RuntimeException("sign fail!", e);
+		}
+	}
+
+	/**
+	 * 签名
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static String sign(String data, PrivateKey key) {
+		System.out.println("原文:" + data);
+		try {
+			byte[] dataByte = data.getBytes("UTF-8");
+			return new String(Base64.encode(sign(dataByte, key)));
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("sign fail!", e);
+		}
+	}
+
+	/**
+	 * 加密
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static byte[] encrypt(byte[] data, Key key,String padding) {
+		try {
+            final Cipher cipher = Cipher.getInstance(padding, PROVIDER);
+			cipher.init(Cipher.ENCRYPT_MODE, key);
+			return cipher.doFinal(data);
+		} catch (Exception e) {
+
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+	
+	/**
+	 * 加密
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static String encryptToBase64(String data, Key key,String padding) {
+		try {
+			return new String(Base64.encode(encrypt(
+					data.getBytes("UTF-8"),
+					key,padding)));
+		} catch (Exception e) {
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+
+	/**
+	 * 解密
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static byte[] decrypt(byte[] data, Key key,String padding) {
+		try {
+            final Cipher cipher = Cipher.getInstance(padding, PROVIDER); 
+			cipher.init(Cipher.DECRYPT_MODE, key);
+			return cipher.doFinal(data);
+		} catch (Exception e) {
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+
+	/**
+	 * 解密
+	 * 
+	 * @param data
+	 * @param key
+	 * @return
+	 */
+	public static String decryptFromBase64(String data, Key key,String padding) {
+		try {
+			return new String(decrypt(Base64.decode(data.getBytes()), key,padding),
+					"UTF-8");
+		} catch (Exception e) {
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+	
+	public static void createKeyPairs(int size) throws Exception {  
+	    // create the keys  
+	    KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", PROVIDER);  
+	    generator.initialize(size, new SecureRandom());  
+	    KeyPair pair = generator.generateKeyPair();  
+	    PublicKey pubKey = pair.getPublic();  
+	    PrivateKey privKey = pair.getPrivate();  
+	    byte[] pk = pubKey.getEncoded();  
+	    byte[] privk = privKey.getEncoded();  
+	    String strpk = new String(Base64.encodeBase64(pk));  
+	    String strprivk = new String(Base64.encodeBase64(privk));  
+	    System.out.println("公钥:" + Arrays.toString(pk));  
+	    System.out.println("私钥:" + Arrays.toString(privk));  
+	    System.out.println("公钥Base64编码:" + strpk);  
+	    System.out.println("私钥Base64编码:" + strprivk);  
+	  }
+	
+	public static PublicKey getPublicKey(String base64EncodePublicKey) throws Exception{
+		 KeyFactory keyf = KeyFactory.getInstance("RSA", PROVIDER);  
+		 X509EncodedKeySpec pubX509 = new X509EncodedKeySpec(Base64.decodeBase64(base64EncodePublicKey.getBytes()));
+		 PublicKey pubkey = keyf.generatePublic(pubX509);  
+		 return pubkey;
+	}
+	
+	public static PrivateKey getPrivateKey(String base64EncodePrivateKey)throws Exception{
+		KeyFactory keyf = KeyFactory.getInstance("RSA", PROVIDER);  
+		 PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decodeBase64(base64EncodePrivateKey.getBytes()));
+		 PrivateKey privkey = keyf.generatePrivate(priPKCS8);
+		 return privkey;
+	}
+	
+	
+	 public static byte[] encode(String encodeString, Key key,String padding) throws Exception {
+		 final Cipher cipher = Cipher.getInstance(padding, PROVIDER);
+		  cipher.init(Cipher.ENCRYPT_MODE, key);
+		  byte[] bytes = encodeString.getBytes("UTF-8");
+		  byte[] encodedByteArray = new byte[] {};
+		  for (int i = 0; i < bytes.length; i += 117) {
+		   byte[] subarray = ArrayUtils.subarray(bytes, i, i + 117);
+		   byte[] doFinal = cipher.doFinal(subarray);
+		   encodedByteArray = ArrayUtils.addAll(encodedByteArray, doFinal);
+		  }
+		  return encodedByteArray;
+	}
+	 
+	 /**
+		 * 加密
+		 * 
+		 * @param data
+		 * @param key
+		 * @return
+		 */
+		public static String encodeToBase64(String data, Key key,String padding) {
+			try {
+				return new String(Base64.encode(encode(	data,
+						key,padding)));
+			} catch (Exception e) {
+				throw new RuntimeException("encrypt fail!", e);
+			}
+		}
+	 
+	 public static String decode(byte[] decodeByteArray, Key key,String padding) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException, NoSuchProviderException {
+		 final Cipher cipher = Cipher.getInstance(padding, PROVIDER);
+		  cipher.init(Cipher.DECRYPT_MODE, key);
+		  StringBuilder sb = new StringBuilder();
+		  for (int i = 0; i < decodeByteArray.length; i += 128) {
+		   byte[] doFinal = cipher.doFinal(ArrayUtils.subarray(decodeByteArray, i, i + 128));
+		   sb.append(new String(doFinal));
+		  }
+		  return sb.toString();
+		 }
+	 
+	 /**
+		 * 解密
+		 * 
+		 * @param data
+		 * @param key
+		 * @return
+		 */
+		public static String decodeFromBase64(String data, Key key,String padding) {
+			try {
+				return new String(decode(Base64.decode(data.getBytes()), key,padding).getBytes(),
+						"UTF-8");
+			} catch (Exception e) {
+				throw new RuntimeException("encrypt fail!", e);
+			}
+		}
+		
+		/**
+		 * 得到密钥字符串(经过base64编码)
+		 * 
+		 * @return
+		 */
+		public static String getKeyString(Key key) throws Exception {
+			byte[] keyBytes = key.getEncoded();
+			String s = (new BASE64Encoder()).encode(keyBytes);
+			return s;
+		}
+		
+		public static String getKeyStringByCer(String path) throws Exception{
+			CertificateFactory cff = CertificateFactory.getInstance("X.509");
+			FileInputStream fis1 = new FileInputStream(path);
+			Certificate cf = cff.generateCertificate(fis1);
+			PublicKey pk1 = cf.getPublicKey();
+			String key = getKeyString(pk1);
+			System.out.println("public:\n" + key);
+			return key;
+		}
+		
+		public static String getKeyStringByPfx(String strPfx, String strPassword){  
+	        try {  
+	            KeyStore ks = KeyStore.getInstance("PKCS12");  
+	            FileInputStream fis = new FileInputStream(strPfx);  
+	            // If the keystore password is empty(""), then we have to set  
+	            // to null, otherwise it won't work!!!  
+	            char[] nPassword = null;  
+	            if ((strPassword == null) || strPassword.trim().equals("")){  
+	                nPassword = null;  
+	            }  
+	            else  
+	            {  
+	                nPassword = strPassword.toCharArray();  
+	            }  
+	            ks.load(fis, nPassword);  
+	            fis.close();  
+	            System.out.println("keystore type=" + ks.getType());  
+	            // Now we loop all the aliases, we need the alias to get keys.  
+	            // It seems that this value is the "Friendly name" field in the  
+	            // detals tab <-- Certificate window <-- view <-- Certificate  
+	            // Button <-- Content tab <-- Internet Options <-- Tools menu   
+	            // In MS IE 6.  
+	            Enumeration enumas = ks.aliases();  
+	            String keyAlias = null;  
+	            if (enumas.hasMoreElements())// we are readin just one certificate.  
+	            {  
+	                keyAlias = (String)enumas.nextElement();   
+	                System.out.println("alias=[" + keyAlias + "]");  
+	            }  
+	            // Now once we know the alias, we could get the keys.  
+	            System.out.println("is key entry=" + ks.isKeyEntry(keyAlias));  
+	            PrivateKey prikey = (PrivateKey) ks.getKey(keyAlias, nPassword);  
+	            Certificate cert = ks.getCertificate(keyAlias);  
+	            PublicKey pubkey = cert.getPublicKey();  
+	            
+	            String basePrikey = RSA.getKeyString(prikey);
+	            System.out.println("cert class = " + cert.getClass().getName());  
+	            System.out.println("cert = " + cert);  
+	            System.out.println("public key = " + pubkey);  
+	            System.out.println("private key = " + prikey); 
+	            System.out.println("pubkey key = " + RSA.getKeyString(pubkey));
+	            System.out.println("prikey key = " + RSA.getKeyString(prikey));
+	            System.out.println("pubkey key length = " + RSA.getKeyString(pubkey).length());
+	            System.out.println("prikey key length = " + RSA.getKeyString(prikey).length());
+	            return basePrikey;  
+	        }  
+	        catch (Exception e)  
+	        {  
+	            e.printStackTrace();  
+	        }  
+	        return null;  
+	    } 
+
+	/**
+	 * 512位PKCS#8
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		//getKeyStringByCer("/usr/local/cjpayProductServerCertExpiryDate20170509.cer");
+		//String privatekey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDYNb+tFTFM+V4kzeeubf5iUPgKl50kxXuEJ57qrFJ0iC0eHpOlw3axqD+zjnWQ+/R1yWUl77SOqgvowmtbKz1qLgXyB57G2lAveL48tp0yyd+tfQMQkW1duT27lGp1bAj/lhwVulvUSzJPqlc4mBt0F+/jEGQ4VZRmR0NxhMbutj7pu61rawZDqS/FSrcnt872uHaUsF+b7c2JcOl7qyB3ySLcMjkJ6rAonYohMCfy0ZT9KruRJQMXtVAbuDLxS+BASDYeE1aOqbg+KPQRfCPdM6t0FX4Y0o6y6cwhd6GQ2OcM6o4lUoKIV6ggeZWG/CHwm85mQ5dbhb7JhMj80CMzAgMBAAECggEBANRC0E7IQ4JiPr67NvzUF63F9/3OIwR6rGxtyWJykvC80C6FrkZKwzhfCUrqTRltge4xLhA0aHq3DsIQPP1gUgbv7/5Q5NwscBRq4bkRPvshnWrhFCUr4MbmmWiSqIFm8t6ZLDFYp9afjGERxldVXX54EZZF/V4hBnPy+o9z3ylyC8skTpX91xTlx523UCGRPWG9cLID5OHrhnWfRybeO7ekGzTFSD7pMIZvQ24mrC6eTJZK6QmAMTB6UxEfyQ+scETO5RhwKOl1KngfQ7rjNSr8tfPcj7u5jdu9VbWYgrg/SKzQTkZCzoLeubwVmTdhMvKmN0KZx771sqVfCa21maECgYEA8+nUHAhJpP/iDJUyh0zksBRBlakI4/UR4/LoVzKQ2eQybXmKDFPSGRXse/YQUvFNirtWHYtxruRWmKxUOlbI8ByWo2sSEZZkQ/5/RLLa7GeH46B7iw19fE8kVv6m9uXHSP+DZqPZ+oyMGI1h9CFO9hnGuzR6ZMBtWBuPwAIX/z0CgYEA4ux8wKGMkPPUxmMLSb7nTjy1q9g8K2YdBWNDTed82H9wwTkVdkWRcDmS64PQEglaK3BCBdI5nN4xQ4p/xEaVVicKChl+1kFpErrHIRO0PEHj/X2+UVurGr19ayEimSBbkqP9s8Ilm867zVjgUbBPb5eEGwF2ZWvBzHp62x+90y8CgYB6gmakEdGTi2ZpdYKkjI2Mlw/98KHjhVMQEBB8w4wXtNNTQymAWZV8PhPCi2vVjReqZ7+wJTrbYhrQojXH+5D/cQyEViIELWp88FXSFpd5B+MsBI4o4IS3rDSPcWZBOlYnJxdDtWalvnQbXN/nM9eqKnYzzv7unewNxgIkqaiN7QKBgA3H5tub8/lplWZm5WyZF1r8/NtuylioXuLQ4Gl+wWo0cxiI6vC/0NFL7cw3uQ8fWkaBDsFjvvPz2nILmy7ESpVs0YNDgRxp5IOqrCUqGSv/pGTkmgY+1ulM0K0M2hkKigUhyGp+Q+Jub6FM4HKVjn1sai1prVMDdEWCuqtMBi8pAoGBAMAZp5m+dUkgG9nUk4Hek+zGhBTUe56NdgTRRX1m8LofW4G4wIG34nLNxEvGmklQjmgGfg1s/XhBQ+BrNUhD4fP+d5Q78qdNqQGzBamXHgjw3fGwUZJJqnatdTeQlf2hSwOSps6cwECezdB0jdxN8oiWCYFc22wP076jHOiMgU+J";
+		String publickey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDonLTXehZeFwmsg+zs8AHrsgGPkGXLS7Lhf2RMOHmAHC/MsvnrfHfu0GD0FcX7NuXKBJK7KsA0MWlEkHezuoRkZS2xZ79qQzImSVE3POO4g1ZVTsW2Bl9LNN2mkTAsum6ik/vodYzftbS0tT73SvgHk54mAm8cWdiQOEVmdX0yhQIDAQAB";
+//		System.err.println("-----------"+getKeyStringByCer("/usr/local/businessgate.cer"));
+//		String padding = RSAECBPKCS1PADDING;
+		//createKeyPairs(1024);
+//		String publickey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCN7fVkqM5hzcPg+xTKEOCsMQ2WQyqgaVbMd3atYN9zngW/biNqkt9vo5EWvoZ/WEByXPvanZRKWMPRFU39fxmtAxdl5TBoh+f4utd8TqdQ2c/uMRUzOecNXlvEZZNXN3Pgu/LLr1ss/H2ma+Lwkoq1WBkWzpY5BJqqhBKpQfWPRwIDAQAB";
+//		System.out.println(publickey.length());
+//		String privatekey = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAI3t9WSozmHNw+D7FMoQ4KwxDZZDKqBpVsx3dq1g33OeBb9uI2qS32+jkRa+hn9YQHJc+9qdlEpYw9EVTf1/Ga0DF2XlMGiH5/i613xOp1DZz+4xFTM55w1eW8Rlk1c3c+C78suvWyz8faZr4vCSirVYGRbOljkEmqqEEqlB9Y9HAgMBAAECgYBREHDwpVn7ksMmZUJih3FL6FiSUpquNHxXHIS0UnhOWRt/UzD3Vhw4b3wXOYsogQeOSn2vSAHC1SBC86AwAcBvqXmKrmuCPoZX0MQkO4tVqfONgE4sq1jbuWHobwP14iZTGqdY69a13Vx6C4PFaOElOkzJbyDA4YkjTBvuR5IvAQJBAPCzgT4uhA73WMsntlI/YhKL7NteA/epUPJbL2UnY6Tf3vqSsvskU9ulgmJLUt1GBG7NFNYXQ6a6I/3GqOPdz7ECQQCW81Iv6Rpns5Ovz1zwpU/bZDwR2Mx+ARDv/DFPH3wJ4J+KJ1XLzEGn9+DLujAkSjrfb1OTNUK2723QOAPYX0R3AkAZwrxkUUok5+gC5h8nMk1mur8Aw1EdYmudZJDv/IU3khYlLyokosCu00nfBzy5HdM/oIdIWnkNEQLlGCvfJ1AhAkBcW2+zxKnVPThlXzh8PIkJsOBYAw/LIJfeXa1FvfvEh1zVyI9j7AtX2//8ZmTCL3Cp+JFoBjRVfVTxCvS/VDqtAkBSU/x90zjwVYDTYPUxyyLz9jYLVu3vHavaTRUTmMn4D4qHSmq3WahYOrrOpI80+Cwrf+bc08hKB+DgNBHpnE0E";
+//		System.err.println(publickey.length());
+//		System.err.println(privatekey.length());
+		PublicKey publicKey = RSA.getPublicKey(publickey);
+		//PrivateKey privateKey = RSA.getPrivateKey(privatekey);
+		System.out.println("1");
+//		String sign = sign("1234",privateKey);
+//		System.out.println(sign);
+		System.out.println(verifySign("#TransferSingle#M800029658#20161108105547054321#20161108105547054321#10#ICBC#6212261001064813709#test#B2C#PAYER#true", "RSRECZmnN4f1giR8EnUSaUY9dRf0RAVLWFAoL+IDenMd0QXU9YckvfrS5Xg/EhBPt8W11ee5cqmcIsjAshsV18gF4RcuHint4woMOBiA32tKCE7e4rkjD5/R2x4MRTUv+2eLSyjzOh4nNvFY184WcN7tJdo4tj0o6QVkUJRFqfo=", publicKey));
+//		String tmp = "104AE7ACA503EF4347DEA3EEFB5DB979747815526A0DD54168BB4B7197F776064CD6724542AFBFDA7B4B6F849B6130407E3709C280AF736CAF324D1D52010BD852BBCC1F5B9C668C1533BB747C1258761B80CA74AB0F2BA7E518A8A4BC7F407B531E7B8EFC877385503D4BE888DF5A113B1C6DC27EB94EFA16E112F23046B4ECE87B30EA62463A9CB0D94805A36D6239B9E587F95FF3E8F540132FE5FA590F52FEC9EC4FBB35C2108CA06F1F51AD6680199B51F85641EBDE5A7DC6127ED12237A86B5E025E0648217B7B8426F23348AF47DEA3EEFB5DB979AE85F4D79480DA150EE81C08064A010DBB900498D56FD7B432046000D768C2297CC3DD0AD15040DFD4EFC9FFCD7728984A4FADD66C8023FC0CF3780EA41D4080A8BC59E35FACBC20598B60BD0DE0C5414F0F380AECE38A98707A545C29D0D88E49A080904EF26202871D4BC06A49F1CEA977C5BC4DBB02786892E78AC3851EA233EE8D325757D64204EB1F637D5A609BC38E3BA2442BEFDE4DB0FD720BBC2F44BE9E0451A4425007C3706E9BF85A1F3F498DC6FFDD3EC2126C7F0EC61787ECF427A085AC5E3AD59E7E3C204BE6B0E89B31131043C210BC0947B51CE07CB37714048DDE18516F7D293969D714523D1F8096E59114409341897AB95064FA860C1E97A316D3D6CCADC2B8FA844541C58F457BCFEAFA022DA453BBB3142AF113CDCD125D1DF096E77244B47C150F3EE5BCDE5931C58C38D9C53C2222C08B0EA5C136EA1A4F2E512FF283430901D4F4212E3EA86B5E025E064821D4A1AE4629EEDDAD6000CD2CBAAE5B630712D23618975E838F620A31B788672896CEAF520A39CAEF37986D3F3CB1352DFDB75D2AAEF197D9F0142CF0FDE71082048F6024013895F461EB07B8A4C4897F7C32F38140BC42309D4E41D2F8F8DA277540506387A01118914B7C6D87ED185BC23CCC73C83B58C477579A1ADB3832678F2611BC14D24876";
+//		String s3 = RSA.decodeFromBase64(tmp, publicKey, padding);
+//		System.out.println(s3+"=====s3=====");
+//		System.out.println(s3.length()+"=====s3=====");
+//		String plain = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567";
+//		System.out.println(plain.getBytes().length);
+//		byte[] encryptByte = RSA.encode(plain, privateKey,padding);
+//		System.err.println(encryptByte.length+"=====encryptByte=====");
+//		byte[] sign = RSA.sign(encryptByte, privateKey);
+//		System.out.println(RSA.verifySign(encryptByte,sign,publicKey));
+//		String s2 = RSA.decode(encryptByte, publicKey,padding);
+//		System.out.println(s2+"=====s2=====");
+//		System.out.println(s2.length()+"=====s2=====");
+//		String encryptString = RSA.encodeToBase64(plain, privateKey, padding);
+//		System.err.println(encryptString.length()+"=====encryptString====="+encryptString);
+		
+		
+	}
+}

+ 69 - 0
src/main/java/com/caimei/modules/order/utils/SettlePostFormUtil.java

@@ -0,0 +1,69 @@
+package com.caimei.modules.order.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author zzj
+ */
+
+
+public class SettlePostFormUtil {
+
+    public static OkHttpClient client = new OkHttpClient.Builder()
+            .connectTimeout(3, TimeUnit.SECONDS)
+            .readTimeout(20, TimeUnit.SECONDS)
+            .build();
+
+    public static <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 {
+                System.out.println(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);
+        //结算response
+        if (!"接收成功".equals(res.getString("rt3_retMsg"))) {
+            System.out.println("结算失败响应------->"+res.toString());
+        }
+        /** rt4_success 为 true,需验签  **/
+        return res.toJavaObject(clazz);
+    }
+
+}

+ 18 - 2
src/main/java/com/caimei/modules/order/web/CmDiscernReceiptController.java

@@ -99,11 +99,23 @@ public class CmDiscernReceiptController extends BaseController {
             model.addAttribute("endTime", cmDiscernReceipt.getEndTime());
             cmDiscernReceipt.setEndTime(cmDiscernReceipt.getEndTime().trim() + " 23:59:59");
         }
+//        String list=cmDiscernReceiptService.discern(cmDiscernReceipt.getId());
+//        logger.info("+++++++++++++++++"+cmDiscernReceipt.getId());
         Page<CmDiscernReceipt> page = cmDiscernReceiptService.findPage(new Page<CmDiscernReceipt>(request, response), cmDiscernReceipt);
+        page.getList().forEach(p ->{
+            String date=p.getReceiptDate();
+            if(date!=null){
+            if(!date.contains(":")){
+                date+=" 00:00:01";
+            }
+            p.setReceiptDate(date);
+            }
+        });
         //获取组织列表
         List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
+
         model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
-        //
+//        model.addAttribute("list", list);
         model.addAttribute("page", page);
         return "modules/order/cmDiscernReceiptList";
     }
@@ -140,7 +152,11 @@ public class CmDiscernReceiptController extends BaseController {
     @RequestMapping(value = "detail")
     public String detail(CmDiscernReceipt cmDiscernReceipt, Model model) {
         ReceiptDetailVo vo = cmDiscernReceiptService.detail(cmDiscernReceipt);
+        CmDiscernReceipt op=cmDiscernReceiptService.orderlist(cmDiscernReceipt);
         model.addAttribute("vo", vo);
+        model.addAttribute("op", op);
+        model.addAttribute("checkMan",cmDiscernReceipt.getCheckMan());
+
         return "modules/order/cmDiscernReceiptForm";
     }
 
@@ -1368,4 +1384,4 @@ public class CmDiscernReceiptController extends BaseController {
         }
         return Double.parseDouble(data);
     }
-}
+}

+ 76 - 2
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -4,6 +4,7 @@ import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.ExcelUtil;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.order.dao.CmPayShopRecordDao;
+import com.caimei.modules.order.dao.NewOrderDao;
 import com.caimei.modules.order.dao.NewOrderProductDao;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.service.*;
@@ -11,6 +12,7 @@ import com.caimei.modules.order.utils.OrderUtil;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.entity.CmUserOrganize;
 import com.caimei.modules.user.service.CmUserOrganizeService;
+import com.caimei.redis.RedisService;
 import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
@@ -47,6 +49,9 @@ import java.util.concurrent.atomic.AtomicReference;
 @RequestMapping(value = "${adminPath}/order/cmPayShop")
 public class CmPayShopController extends BaseController {
 
+
+    @Resource
+    private RedisService redisService;
     @Autowired
     private CmPayShopService cmPayShopService;
     @Resource
@@ -67,6 +72,8 @@ public class CmPayShopController extends BaseController {
     private CmPayShopRecordDao cmPayShopRecordDao;
     @Resource
     private NewOrderProductDao newOrderProductDao;
+    @Resource
+    private NewOrderDao newOrderDao;
 
     @ModelAttribute
     public CmPayShop get(@RequestParam(required = false) String id) {
@@ -385,8 +392,9 @@ public class CmPayShopController extends BaseController {
         shopOrder.setPayStatus(soZeroCostFlag ? "3" : "1");
         shopOrder.setZeroCostFlag(soZeroCostFlag ? 1 : 0);
         //当子订单0成本时,若主订单中其他子订单(除了运费子订单)都为0成本,设主订单为已付款,否则设为部分付款
+         NewOrder newOrder = newOrderService.get(shopOrder.getOrderID().toString());
         if (soZeroCostFlag) {
-            NewOrder newOrder = newOrderService.get(shopOrder.getOrderID().toString());
+
             AtomicReference<Boolean> zeroCostFlag = new AtomicReference<>(true);
             AtomicReference<Boolean> freightFlag = new AtomicReference<>(false);
 
@@ -418,19 +426,46 @@ public class CmPayShopController extends BaseController {
             }
             newOrderService.updatePayStatus(newOrder);
         }
+
+
+
         shopOrder.setShopPostFee(freight); //运费
         shopOrder.setShopOtherFee(thirdPartyFee); //付第三方
         shopOrder.setCostType(costType);
         shopOrder.setModifyShouldPayNote(modifyShouldPayNote);  //备注
         shopOrder.setModifyShouldPayUserID(UserUtils.getUser().getId());  //修改人的用户id
         shopOrder.setModifyShouldPayDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));  //修改时间
-
         double shouldPayShopAmount = shopOrder.getShopProductAmount() + shopOrder.getShopPostFee() + shopOrder.getShopTaxFee();
         if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount == shopOrder.getPayedShopAmount())
             shopOrder.setPayStatus("3");
         shopOrder.setShouldPayShopAmount(shouldPayShopAmount);
         newShopOrderService.modifyPayShopAmount(shopOrder, orderProducts);
 
+        /*if(shopOrder.getShopReceiptStatus()==1){
+            System.out.println(shopOrder.getShopReceiptStatus());
+            logger.info("未付款子订单进了成本修改"+shopOrder.getShouldPayShopAmount()+"-----"+shopOrder.getShopOtherFee());
+            double mum= newShopOrder.getProductAmount();
+            mum-= shopOrder.getShopOtherFee()+shopOrder.getShouldPayShopAmount();
+            //因为成本上升,子订单佣金下降。当成本上升到子订单佣金不大于线上支付最大手续费时不能进行线上支付所以减了第三方
+            System.out.println(">>>>>>>>子订单佣金"+mum+"----"+shopOrder.getBrokerage());
+            double fee=0.0;
+            if(shopOrder.getShopOtherFee()>=1000.01){
+                //手续费 =子订单金额*默认代理费率
+                 fee=shopOrder.getProductAmount()*0.0065;
+                if(mum<fee){
+                    newOrderDao.updateOnlinePayFlag(1,shopOrder.getOrderID());
+                }
+            }else if(shopOrder.getShopOtherFee()<=1000.01){
+                 fee=shopOrder.getProductAmount()*0.0025;
+                if(mum<fee){
+                    newOrderDao.updateOnlinePayFlag(1,shopOrder.getOrderID());
+                }
+            }
+            if(mum>fee){
+                newOrderDao.updateOnlinePayFlag(0,shopOrder.getOrderID());
+            }
+        }*/
+
         return "redirect:" + Global.getAdminPath() + "/shopOrder/payOrderList";
     }
 
@@ -595,6 +630,21 @@ public class CmPayShopController extends BaseController {
         return "modules/order/cmPayShopForm";
     }
 
+    /**
+     * 发起结算申请  去结算单页面
+     *
+     * @param cmPayShop
+     * @param shopOrderIDs
+     * @param model
+     * @return
+     */
+    @RequestMapping("settleEdit")
+    public String settleEdit(CmPayShop cmPayShop, String[] shopOrderIDs, Model model) {
+        cmPayShopService.settleEdit(cmPayShop, shopOrderIDs);
+        model.addAttribute("cmPayShop", cmPayShop);
+        return "modules/order/cmSettlementForm";
+    }
+
     /**
      * 去编辑页面 信息回显
      */
@@ -720,6 +770,30 @@ public class CmPayShopController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/applyDetail?id=" + cmPayShop.getId();
     }
 
+    /**
+     * 付款单 发起结算申请
+     *
+     * @return
+     */
+    @RequestMapping("settlement")
+    public String settlement(Double settleAmount, String shopOrderId,RedirectAttributes redirectAttributes) throws Exception {
+        Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
+        Double settleSum = newOrderDao.findSettleSum(shopOrderId);
+        if(settleSum>=shouldPayShopAmount){
+            addMessage(redirectAttributes, "此订单已结算完毕!");
+            return "redirect:" + Global.getAdminPath() + "/shopOrder/settlement";
+        }
+        if(settleSum>=shouldPayShopAmount){}
+        Integer SDJSS = (Integer) redisService.get("SDJSS");
+        //验锁
+        if (null != SDJSS && SDJSS > 0) {
+            addMessage(redirectAttributes, "请勿短时间内重复结算,等待支付公司返回结算结果!");
+            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+        }
+        cmPayShopService.settlement(shopOrderId, settleAmount);
+        return "redirect:" + Global.getAdminPath() + "/shopOrder/settlement";
+    }
+
 
     ////applyPayWipe
     @RequiresPermissions("order:cmPayShop:edit")

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

@@ -7,6 +7,7 @@ import com.caimei.modules.order.service.CmChangePayShopRecondService;
 import com.caimei.modules.order.service.NewShopOrderService;
 import com.caimei.modules.user.entity.CmUserOrganize;
 import com.caimei.modules.user.service.CmUserOrganizeService;
+import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
@@ -72,11 +73,13 @@ public class CmShopOrderController extends BaseController {
             newShopOrder.setEndTime(newShopOrder.getEndTime().trim() + " 23:59:59");
         }
         Page<NewShopOrder> page = newShopOrderService.findPayOrderList(new Page<>(request, response), newShopOrder);
+
         //获取组织列表
         List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
         model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
         model.addAttribute("page", page);
         model.addAttribute("operatingMode", newShopOrder.getOperatingMode());
+
         if ("3".equals(newShopOrder.getOperatingMode())) {
             //已付款子订单页面
             return "modules/order/paidShopOrderList";
@@ -109,11 +112,21 @@ public class CmShopOrderController extends BaseController {
     public String SplitAccount(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model){
         //1. 展示付款状态为待付款和部分付款状态的线上支付的子订单;
         //2. 子订单按下单时间降序排列
+        //3. 手动分账页面需要只控制显示已收款的子订单
         Page<NewShopOrder> page = newShopOrderService.findSplitList(new Page<>(request, response),newShopOrder);
         model.addAttribute("page", page);
         return "modules/order/cmSplitAccountList";
     }
 
+    @RequestMapping("settlement")
+    public String Settlement(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model){
+        //1. 展示已分帐的线上子订单
+        //2. 子订单按下单时间降序排列
+        Page<NewShopOrder> page = newShopOrderService.findSettlementList(new Page<>(request, response),newShopOrder);
+        model.addAttribute("page", page);
+        return "modules/order/cmSettlementList";
+    }
+
     @RequestMapping("payShopRemark")
     public String payShopRemark(CmChangePayShopRecond cmChangePayShopRecond, HttpServletRequest request, HttpServletResponse response, Model model) {
         Integer shopOrderId = cmChangePayShopRecond.getShopOrderId();
@@ -185,6 +198,15 @@ public class CmShopOrderController extends BaseController {
         return "modules/order/payedAndRefundRecordList";
     }
 
+    @RequestMapping("settleRecord")
+    public String settleRecord(String shopOrderID, HttpServletRequest request, HttpServletResponse response, Model model) {
+        List<SettleRecord> pr = newShopOrderService.getSettleRecord(shopOrderID);
+        NewShopOrder shopOrder = newShopOrderService.getShopOrderInfo(shopOrderID);
+        model.addAttribute("pr", pr);
+        model.addAttribute("s", shopOrder);
+        return "modules/order/settleRecordList";
+    }
+
     @RequiresPermissions("order:cmPayShop:view")
     @RequestMapping("checkPaymentOrder")
     public String checkPaymentOrder(NewOrder newOrder, HttpServletRequest request, HttpServletResponse response, Model model) {

+ 98 - 14
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -197,7 +197,55 @@ public class NewOrderController extends BaseController {
         return "modules/order/newOrderList";
     }
 
-    @RequiresPermissions("order:order:edit")
+    @RequiresPermissions("order:order:secondhandOrder")
+    @RequestMapping("secondhandOrderList")
+    public String secondhandOrderList(NewOrder order, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null != order.getStartTime() && !"".equals(order.getStartTime()) && !order.getStartTime().endsWith("00:00:00")) {
+            model.addAttribute("startTime", order.getStartTime());
+            order.setStartTime(order.getStartTime().trim() + " 00:00:00");
+        }
+        if (null != order.getEndTime() && !"".equals(order.getEndTime()) && !order.getEndTime().endsWith("23:59:59")) {
+            model.addAttribute("endTime", order.getEndTime());
+            order.setEndTime(order.getEndTime().trim() + " 23:59:59");
+        }
+        if (null != order.getStartConfirmTime() && !"".equals(order.getStartConfirmTime()) && !order.getStartConfirmTime().endsWith("00:00:00")) {
+            model.addAttribute("startConfirmTime", order.getStartConfirmTime());
+            order.setStartConfirmTime(order.getStartConfirmTime().trim() + " 00:00:00");
+        }
+        if (null != order.getEndConfirmTime() && !"".equals(order.getEndConfirmTime()) && !order.getEndConfirmTime().endsWith("23:59:59")) {
+            model.addAttribute("endConfirmTime", order.getEndConfirmTime());
+            order.setEndConfirmTime(order.getEndConfirmTime().trim() + " 23:59:59");
+        }
+        if (null != order.getStartRefundTime() && !"".equals(order.getStartRefundTime()) && !order.getStartRefundTime().endsWith("00:00:00")) {
+            model.addAttribute("startRefundTime", order.getStartRefundTime());
+            order.setStartRefundTime(order.getStartRefundTime().trim() + " 00:00:00");
+        }
+        if (null != order.getEndRefundTime() && !"".equals(order.getEndRefundTime()) && !order.getEndRefundTime().endsWith("23:59:59")) {
+            model.addAttribute("endRefundTime", order.getEndRefundTime());
+            order.setEndRefundTime(order.getEndRefundTime().trim() + " 23:59:59");
+        }
+        model.addAttribute("orderRefundType", order.getOrderRefundType());
+        if (null != order.getBuyer()) {
+            order.setBuyer(order.getBuyer().trim());
+        }
+        if (null != order.getReceiver()) {
+            order.setReceiver(order.getReceiver().trim());
+        }
+        order.setProductCategory(2);
+        //查询内部处理了已收,未付统计(包含运费)
+        Page<NewOrder> page = newOrderService.findPage(new Page<>(request, response, 20), order);
+        //获取组织列表
+        List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
+        model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
+        //获取上线协销人员,排除采美默认协销经理
+        List<NewCmSp> serviceProviderList = newOrderService.findServiceProviderList();
+        model.addAttribute("serviceProviderList", serviceProviderList);
+        model.addAttribute("page", page);
+        return "modules/order/secondhandOrderList";
+    }
+
+
+    @RequiresPermissions("order:order:form")
     @RequestMapping(value = "form")
     public String form(NewOrder newOrder, Model model, HttpServletRequest request) {
         BpClause bpClause = new BpClause();
@@ -286,7 +334,7 @@ public class NewOrderController extends BaseController {
         return "modules/order/orderForm";
     }
 
-    @RequiresPermissions("order:order:edit")
+    @RequiresPermissions("order:order:secondeProductOrderForm")
     @RequestMapping(value = "secondeProductOrderForm")
     public String secondeProductOrderForm(NewOrder newOrder, Model model, HttpServletRequest request) {
         BpClause bpClause = new BpClause();
@@ -380,7 +428,7 @@ public class NewOrderController extends BaseController {
                     if (ladderPriceFlag != null && !"".equals(ladderPriceFlag)) {
                         o.setLadderPriceFlag(Integer.valueOf(ladderPriceFlag));
                     }
-                    o.setSplitCode(productDao.getSplitCodeByProductId(o.getProductID())) ;
+                    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());//经理折扣
@@ -416,7 +464,6 @@ public class NewOrderController extends BaseController {
                     String productCategory = o.getProductCategory();
                     if (StringUtils.equals(productCategory, "2")) {
                         isSecondHandOrder = true;
-                        newOrder.setRebateFlag("0");
                     }
                 }
             }
@@ -482,7 +529,11 @@ public class NewOrderController extends BaseController {
             newOrderProductService.updateShopConfigFlag(newOrder.getOrderID());
         }
         addMessage(redirectAttributes, "保存订单成功");
-        return "redirect:" + Global.getAdminPath() + "/order/orderList";
+        if ("1".equals(newOrder.getSecondHandOrderFlag())) {
+            return "redirect:" + Global.getAdminPath() + "/order/secondhandOrderList";
+        } else {
+            return "redirect:" + Global.getAdminPath() + "/order/orderList";
+        }
     }
 
     @RequiresPermissions("order:order:edit")
@@ -548,7 +599,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 +629,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)) {
@@ -724,7 +775,6 @@ public class NewOrderController extends BaseController {
     }
 
 
-
     /**
      * 确认收货
      *
@@ -741,8 +791,6 @@ public class NewOrderController extends BaseController {
     }
 
 
-
-
     /**
      * 去子订单orderProduct页面
      *
@@ -786,6 +834,7 @@ public class NewOrderController extends BaseController {
         r.put("data", orderProductList);
         return r;
     }
+
     @RequestMapping("toShipLogistic")
     public String toShipLogistic(Integer orderID, Model model) {
         model.addAttribute("orderID", orderID);
@@ -1290,7 +1339,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);
@@ -1413,17 +1462,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");
@@ -2006,7 +2055,7 @@ public class NewOrderController extends BaseController {
     /**
      * @return
      */
-    @RequiresPermissions("order:order:edit")
+    @RequiresPermissions("order:order:postageOrderForm")
     @RequestMapping(value = "postageOrderForm")
     public String postageOrderForm(NewOrder newOrder, Model model) {
         newOrder.setFreight(10D);
@@ -2037,6 +2086,36 @@ public class NewOrderController extends BaseController {
         return "modules/order/newOrderEdit";
     }
 
+    /**
+     * 编辑返佣服务费
+     */
+    @RequiresPermissions("order:order:edit")
+    @RequestMapping(value = "RebateFee")
+    public String editRebateFee(NewOrder newOrder, Model model, RedirectAttributes redirectAttributes) {
+        NewOrder order = newOrderService.editRebateFee(newOrder);
+        model.addAttribute("order", order);
+        return "modules/order/rebateFeeEdit";
+    }
+
+    /**
+     * 保存返佣服务费
+     */
+    @RequiresPermissions("order:order:edit")
+    @ResponseBody
+    @RequestMapping(value = "saveRebateFee")
+    public Map<String, Object> saveRebateFee(NewOrder newOrder) {
+        Map<String, Object> map = new HashMap();
+        try {
+            newOrderService.saveRebateFee(newOrder);
+            map.put("success", true);
+            map.put("msg", "修改返佣服务费成功");
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "修改返佣服务费失败");
+        }
+        return map;
+    }
+
     /**
      * 保存经理折扣
      */
@@ -2110,6 +2189,11 @@ public class NewOrderController extends BaseController {
     @RequestMapping("modifyRebate")
     public String modifyRebate(Integer orderId) {
         newOrderService.modifyRebate(orderId);
+        //1二手 0非二手
+        Integer secondHandOrderFlag = cmUtilsDao.findOrderIsSecond(orderId);
+        if (1 == secondHandOrderFlag) {
+            return "redirect:" + Global.getAdminPath() + "/order/secondhandOrderList";
+        }
         return "redirect:" + Global.getAdminPath() + "/order/orderList";
     }
 

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

@@ -17,6 +17,7 @@ public interface ProductDao extends CrudDao<Product> {
     List<ActType> getAllActType();
 
 
+
     int saveSort(@Param("sort") String sort, @Param("id") String id);
 
     int findLadderPriceByNum(@Param("productID") String productID);
@@ -150,6 +151,8 @@ public interface ProductDao extends CrudDao<Product> {
 
     ProductDetailInfo queryProductDetailInfo(@Param("productID") Integer productID);
 
+    Product qualification(@Param("productID") Integer productID);
+
     List<ProductLadderPrice> findProductLadderPrice(@Param("productId") Integer productId, @Param("userType") Integer userType);
 
     void updateByPrimaryKeySelective(Product product);
@@ -172,6 +175,10 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<Product> findProductImage(Product product);
 
+    List<Product> newfindProductImage(Product product);
+
+    Product productList(Product product);
+
     void insertProductDetailInfo(ProductDetailInfo productDetailInfo);
 
     String findProductDetail(Integer productID);

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

@@ -30,6 +30,8 @@ public interface ProductNewDao extends CrudDao<Product> {
 
     void updateByPrimaryKeySelective(Product product);
 
+    Integer newFloorId();
+
     List<ProductImage> getImageList(@Param("productId") Integer productId);
 
     void updateImageSort(@Param("productImageID") Integer productImageID, @Param("sortIndex")  Integer sortIndex);
@@ -67,4 +69,6 @@ public interface ProductNewDao extends CrudDao<Product> {
     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);
+
+    Product validIList(Integer productID);
 }

+ 12 - 0
src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java

@@ -98,6 +98,18 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String image5;
     private String editFlag;//编辑标记,1是编辑,其他都不是
     private String visibility;     //商品可见度:(3:所有人可见,2:普通机构可见,1:会员机构可见)
+    /*
+     *发布类型1.二手预成交商品 2.二手估价商品
+     */
+    private Integer announType;
+
+    public Integer getAnnounType() {
+        return announType;
+    }
+
+    public void setAnnounType(Integer announType) {
+        this.announType = announType;
+    }
 
     public String getSplitCode() {
         return splitCode;

+ 191 - 9
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -7,6 +7,7 @@ import com.thinkgem.jeesite.common.persistence.DataEntity;
 
 import java.beans.Transient;
 import java.math.BigDecimal;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -14,6 +15,7 @@ public class Product extends DataEntity<Product> {
     private String name;
     private String shopName;//供应商名称
     private String validFlag; //0暂存中 1待审核 2已上架 3已下架 8 审核不通过 9已冻结
+    private String[] validFlagString; //0暂存中 1待审核 2已上架 3已下架 8 审核不通过 9已冻结
     private Integer preferredFlag; //新品上线(001) 优惠商品(010) 常用商品(100),三者同时存在111
     private String displayOnCRMFlag; //是否在crm可以被搜索到 1是 0否
     private Integer productID;        // productIDprice1
@@ -131,15 +133,17 @@ public class Product extends DataEntity<Product> {
     private Integer trainingMethod; //仪器培训方式:1线上培训,2线下培训
     private Integer trainingType; //售价是否包含:1售价未包含,2售价已包含
     private BigDecimal trainingFee; //培训费用(售价未包含)
-    private Integer svipFlag;	//超级会员商品标识:1是,2不是
+    private Integer svipFlag;    //超级会员商品标识:1是,2不是
     private Integer publishIdentity; //发布者身份 1,个人,2.公司
     private String companyName; //公司名称
+    private String mobile;//联系方式主要用与信息推送
+    private Integer userId;//用户id主要用与信息推送
     private String image1;
     private String image2;
     private String image3;
     private String image4;
     private String image5;
-
+    private String receiptID;//上架费关联id
     //以下参数是搜索回显参数
     private String searchName;
     private String searchShopName;
@@ -224,6 +228,166 @@ public class Product extends DataEntity<Product> {
      */
     private Integer searchType;
 
+    /*
+     *发布类型1.二手预成交商品 2.二手估价商品
+     */
+    private Integer announType;
+
+    /**
+     * 新品商品状态  1.已审核  2.未参与   3.审核未通过
+     */
+    private Integer newvalidFlag;
+    /**
+     * 新品展示状态
+     */
+    private Integer showFlag;
+    /**
+     * 展示结束时间
+     */
+    private String showTime;
+    /**
+     * 展示开始时间
+     */
+    private String newshowTime;
+
+    //1.重点推荐
+    private Integer recommend;
+
+
+    /**
+     * 新品参与状态1.参与 2.未参与
+     */
+    private Integer newProductType;
+
+    /**
+     * 证书编号
+     *
+     * @return
+     */
+    public String qualificationNo;
+
+    /**
+     * 产品名称
+     */
+    public String productName;
+    /*
+     *证书有效日期
+     */
+    public String qualificationTime;
+
+    /**
+     * 证书有效链接
+     */
+    public String qualificationLink;
+
+    public String[] getValidFlagString() {
+        return validFlagString;
+    }
+
+    public void setValidFlagString(String[] validFlagString) {
+        this.validFlagString = validFlagString;
+    }
+
+    public String getQualificationNo() {
+        return qualificationNo;
+    }
+
+    public void setQualificationNo(String qualificationNo) {
+        this.qualificationNo = qualificationNo;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public String getQualificationTime() {
+        return qualificationTime;
+    }
+
+    public void setQualificationTime(String qualificationTime) {
+        this.qualificationTime = qualificationTime;
+    }
+
+    public String getQualificationLink() {
+        return qualificationLink;
+    }
+
+    public void setQualificationLink(String qualificationLink) {
+        this.qualificationLink = qualificationLink;
+    }
+
+    public Integer getNewProductType() {
+        return newProductType;
+    }
+
+    public void setNewProductType(Integer newProductType) {
+        this.newProductType = newProductType;
+    }
+
+    public Integer getShowFlag() {
+        return showFlag;
+    }
+
+    public void setShowFlag(Integer showFlag) {
+        this.showFlag = showFlag;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public String getShowTime() {
+        return showTime;
+    }
+
+    public void setShowTime(String showTime) {
+        this.showTime = showTime;
+    }
+
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public String getNewshowTime() {
+        return newshowTime;
+    }
+
+    public void setNewshowTime(String newshowTime) {
+        this.newshowTime = newshowTime;
+    }
+
+    public Integer getRecommend() {
+        return recommend;
+    }
+
+    public void setRecommend(Integer recommend) {
+        this.recommend = recommend;
+    }
+
+    public Integer getNewvalidFlag() {
+        return newvalidFlag;
+    }
+
+    public void setNewvalidFlag(Integer newvalidFlag) {
+        this.newvalidFlag = newvalidFlag;
+    }
+
+    public String getBeautyActFlag() {
+        return beautyActFlag;
+    }
+
+    public void setBeautyActFlag(String beautyActFlag) {
+        this.beautyActFlag = beautyActFlag;
+    }
+
+    public Integer getAnnounType() {
+        return announType;
+    }
+
+    public void setAnnounType(Integer announType) {
+        this.announType = announType;
+    }
+
     public Double getSqlCostProportional() {
         return sqlCostProportional;
     }
@@ -399,6 +563,7 @@ public class Product extends DataEntity<Product> {
     public void setIds(List<Integer> ids) {
         this.ids = ids;
     }
+
     private static final long serialVersionUID = 1L;
 
     public String getDetailInfo() {
@@ -513,13 +678,6 @@ public class Product extends DataEntity<Product> {
         this.priceFlag = priceFlag;
     }
 
-    public String getbeautyActFlag() {
-        return beautyActFlag;
-    }
-
-    public void setbeautyActFlag(String beautyActFlag) {
-        this.beautyActFlag = beautyActFlag;
-    }
 
     public String getLadderPriceFlag() {
         return ladderPriceFlag;
@@ -1501,4 +1659,28 @@ public class Product extends DataEntity<Product> {
     public void setSearchType(Integer searchType) {
         this.searchType = searchType;
     }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getReceiptID() {
+        return receiptID;
+    }
+
+    public void setReceiptID(String receiptID) {
+        this.receiptID = receiptID;
+    }
 }

+ 68 - 2
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -8,6 +8,12 @@ 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.newhome.dao.NewPageFloorDao;
+import com.caimei.modules.newhome.entity.NewPageFloorImage;
+import com.caimei.modules.opensearch.GenerateUtils;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.dao.ProductNewDao;
@@ -16,6 +22,7 @@ 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.caimei.redis.RedisService;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
@@ -24,6 +31,7 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.modules.sys.entity.User;
 import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -45,6 +53,10 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     @Autowired
     ProductNewDao productNewDao;
     @Autowired
+    RedisService redisService;
+    @Autowired
+    GenerateUtils generateUtils;
+    @Autowired
     ProductDao productDao;
     @Autowired
     private CmPromotionDao cmPromotionDao;
@@ -59,8 +71,17 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     @Autowired
     private CmHeheFloorProductDao cmHeheFloorProductDao;
     @Autowired
+    private NewPageFloorDao newPageFloorDao;
+    @Autowired
     private ProductService productService;
-
+    @Autowired
+    private NewOrderService newOrderService;
+    @Autowired
+    private NewShopOrderDao newShopOrderDao;
+    @Autowired
+    private WeChatService weChatService;
+    @Value("${wwwServer}")
+    private String domain;
     @Override
     public Product get(String id) {
         return super.get(id);
@@ -201,12 +222,57 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         }
     }
 
-    public void auditProduct(String validFlag, String beforeValidFlag, Integer productID) {
+    public void auditProduct(String validFlag,Integer newvalidFlag,String showtime, String beforeValidFlag, Integer productID) throws Exception{
         Product product = new Product();
         product.setProductID(productID);
         product.setValidFlag(validFlag);
         product.setBeforeValidFlag(beforeValidFlag);
+        product.setNewvalidFlag(newvalidFlag);
+        product.setShowTime(showtime);
+        SimpleDateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String createDates = formatters.format(new Date());
+        product.setNewshowTime(createDates);
+        NewPageFloorImage floorImage=new NewPageFloorImage();
+        floorImage.setFloorId(productNewDao.newFloorId());
+        floorImage.setImage(product.getMainImage());
+        floorImage.setProductId(productID);
+        floorImage.setShopName(product.getShopName());
+        String link="";
+
+        if(domain.contains("-b")){
+            link="https://www-b.caimei365.com/product-"+productID+".html";
+        }else if(domain.contains("localhost")){
+           link="http://localhost:8081/product-"+productID+".html";
+        }else {
+            link="https://www.caimei365.com/product-"+productID+".html";
+        }
+        floorImage.setLink(link);
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String createDate = formatter.format(new Date());
+        floorImage.setCreateDate(createDate);
+        floorImage.setName(product.getName());
+        newPageFloorDao.insertFloorImage(floorImage);
+        product.setFloorId( productNewDao.newFloorId());
         productNewDao.updateByPrimaryKeySelective(product);
+        cleanRedisCache();
+
+    }
+    public void cleanRedisCache() {
+        //清除活动专题缓存
+        redisService.removePattern("getPageFloorData*");
+        //清除活动专题缓存
+        redisService.removePattern("activityData*");
+        //清除产品仪器缓存
+        redisService.removePattern("instrumentData*");
+        redisService.removePattern("insCommodityData*");
+        //首页缓存
+        String homeData = "getHomeData*";
+        redisService.removePattern(homeData);
+        redisService.removePattern("getHomeCommodityData*");
+        // 重新生成静态首页
+
+        generateUtils.generateHome();
+
     }
 
     public Map<String, Object> findPromotionStatus(String validFlag, Integer productId) {

+ 56 - 0
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -4,6 +4,7 @@ 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.newhome.dao.NewPageFloorDao;
 import com.caimei.modules.product.dao.*;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
@@ -45,6 +46,8 @@ public class ProductService extends CrudService<ProductDao, Product> {
     private CmTinytypeDao cmTinytypeDao;
     @Resource
     private ProductNewDao productNewDao;
+    @Autowired
+    NewPageFloorDao newPageFloorDao;
 
     @Override
     public Product get(String id) {
@@ -343,6 +346,10 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.queryProductDetailInfo(productID);
     }
 
+    public Product qualification(Integer productID){
+        return productDao.qualification(productID);
+    }
+
     public List<ProductLadderPrice> findLadderPrice(Integer productID) {
         // userType用户类型,1游客,2普通用户,3会员用户
         return productDao.findProductLadderPrice(productID, 3);
@@ -388,6 +395,14 @@ public class ProductService extends CrudService<ProductDao, Product> {
             }
         }
         product.setQualificationImg(res);
+        if(product.getNewProductType()==1){
+            product.setShowFlag(1);
+        }else if(product.getNewProductType()==2){
+            product.setShowFlag(3);
+        }
+        if(product.getVisibility()==null){
+            product.setVisibility("3");
+        }
 //        if(StringUtils.isNotBlank(product.getSplitCode())&&"0".equals(product.getSplitCode())){
 //            product.setSplitCode(null);
 //        }
@@ -405,6 +420,10 @@ public class ProductService extends CrudService<ProductDao, Product> {
             if(StringUtils.isNotBlank(product.getCostProportional())){
                 product.setSqlCostProportional(Double.valueOf(product.getCostProportional()));
             }
+
+
+logger.info("+++++++++++++++++++++++"+product);
+            //保存商品信息
             productDao.insert(product);
             productDetailInfo.setProductID(product.getProductID());
             // 保存商品图片
@@ -550,6 +569,43 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productPage;
     }
 
+    public Page<Product> newfindProductImage(Page<Product> page, Product product) {
+        product.setPage(page);
+        List<Product> productList = productDao.newfindProductImage(product);
+        int num=0;
+
+        for (int i=0;i<productList.size();i++){
+            Date currentTime = new Date();
+                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String dateString = formatter.format(currentTime);
+            /**
+             *如果有设置展示开始时间就当前时间判断,如果没有就用商品创建时间判断当前时间;
+             */
+                if(productList.get(i).getShowTime()!=null){
+                    num=productList.get(i).getShowTime().compareTo(dateString);
+                }else if(productList.get(i).getAddTime()!=null) {
+                    num=productList.get(i).getAddTime().compareTo(dateString);
+                }
+            if(num<0){
+              product.setShowFlag(2);
+                product.setRecommend(0);
+                product.setProductID(productList.get(i).getProductID());
+                newPageFloorDao.updatshowFlag(product);
+                //这里主要是解决页面上加载数据冲突问题没有调用get方法不会空指针异常?
+                product.setProductID(null);
+                product.setShowFlag(null);
+            }
+
+        }
+        page.setList(productList);
+        return page;
+   }
+
+    public Product productList(Product product){
+
+        return productDao.productList(product);
+    }
+
     public String findProductDetail(Integer productID) {
         return productDao.findProductDetail(productID);
     }

+ 110 - 4
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -29,6 +29,7 @@ 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.InitBinder;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -193,6 +194,100 @@ public class CmSecondHandDetailController extends BaseController {
         model.addAttribute("cmSecondHandDetail", cmSecondHandDetail);
         return "modules/product/cmSecondHandDetailForm";
     }
+    @RequestMapping(value = "cmSecondDetailForm")
+    public String cmSecondDetailForm(CmSecondHandDetail cmSecondHandDetail,HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        // 解析二手商品小分类
+        List<BigType> bigTypeList = new ArrayList<>();
+        String instrumentType = cmSecondHandDetail.getInstrumentType();
+        if (StringUtils.isNoneEmpty(instrumentType)) {
+            String[] split = instrumentType.split(",");
+            int length = split.length;
+            bigTypeList = initList(bigTypeList, length, split);
+        }
+        cmSecondHandDetail.setBigTypeList(bigTypeList);
+
+        // 初始化品牌
+        List<CmBrand> brandList = cmBrandService.getList();
+        model.addAttribute("brandList", brandList);
+
+        // 构造类型
+        List<BigType> typeList = new ArrayList<>();
+        BigType bigType = new BigType();
+        /*BigType bigType1 = new BigType();
+        BigType bigType2 = new BigType();*/
+        bigType.setId("1");
+        bigType.setName("美容仪器");
+/*        bigType1.setId("2");
+        bigType1.setName("重光电");
+        bigType2.setId("3");
+        bigType2.setName("耗材配件");*/
+        typeList.add(bigType);
+        /*typeList.add(bigType1);
+        typeList.add(bigType2);*/
+        model.addAttribute("typeList", typeList);
+
+        //初始化城市信息
+        Integer townId = cmSecondHandDetail.getTownId();
+        if (null != townId) {
+            Address addByTownId = cmSecondHandTransactionService.getAddByTownId(townId);
+            if (null != addByTownId) {
+                String province = addByTownId.getProvince();
+                String city = addByTownId.getCity();
+                String town = addByTownId.getTown();
+                cmSecondHandDetail.setProvince(province);
+                cmSecondHandDetail.setCity(city);
+                cmSecondHandDetail.setTown(town);
+            }
+        }
+
+        // 初始化到期时间
+        Date onLineDate = cmSecondHandDetail.getOnLineDate();
+        if (null != onLineDate) {
+            // 计算是否还在180天内有效
+            Calendar ca = Calendar.getInstance();
+            ca.setTime(onLineDate);
+            //设置为day月前
+            ca.add(Calendar.MONTH, 3);
+            onLineDate = ca.getTime();
+            cmSecondHandDetail.setOnLineDate(onLineDate);
+        }
+
+        // 初始化商品图片
+        List<String> imaglist = new ArrayList<String>();
+        List<ProductImage> imageList = productNewService.getImageList(cmSecondHandDetail.getProductID());
+        if (CollectionUtils.isNotEmpty(imageList) && imageList.size() > 0) {
+            for (int i = 1; i <= imageList.size(); i++) {
+                if (i == 1) {
+                    cmSecondHandDetail.setImage1(imageList.get(i - 1).getImage());
+                }
+                if (i == 2) {
+                    cmSecondHandDetail.setImage2(imageList.get(i - 1).getImage());
+                }
+                if (i == 3) {
+                    cmSecondHandDetail.setImage3(imageList.get(i - 1).getImage());
+                }
+                if (i == 4) {
+                    cmSecondHandDetail.setImage4(imageList.get(i - 1).getImage());
+                }
+                if (i == 5) {
+                    cmSecondHandDetail.setImage5(imageList.get(i - 1).getImage());
+                }
+                imaglist.add(imageList.get(i - 1).getImage());
+            }
+        }
+        cmSecondHandDetail.setImageList(imaglist);
+
+        if (StringUtils.isNotBlank(cmSecondHandDetail.getOssName()) && StringUtils.isNotBlank(cmSecondHandDetail.getFileName())) {
+            String ossUrl = OSSUtils.getOssUrl(cmSecondHandDetail.getOssName());
+            cmSecondHandDetail.setUrl(ossUrl);
+        }
+
+        cmSecondHandDetailService.setValue(cmSecondHandDetail);
+        List<SplitCode> splitCodeList = productNewDao.findSecondSplitCode(cmSecondHandDetail.getId());
+        model.addAttribute("splitCodeList",splitCodeList);
+        model.addAttribute("cmSecondHandDetail", cmSecondHandDetail);
+        return "modules/product/cmSecondDetailForm";
+    }
 
     @RequiresPermissions("product:cmSecondHandDetail:edit")
     @RequestMapping(value = "save")
@@ -201,7 +296,7 @@ public class CmSecondHandDetailController extends BaseController {
             return form(cmSecondHandDetail, model);
         }
         String cardNumber = cmSecondHandDetail.getCardNumber();
-        if(StringUtils.isBlank(cardNumber)){
+        if(StringUtils.isBlank(cardNumber) && cmSecondHandDetail.getAnnounType()!=null && cmSecondHandDetail.getAnnounType()!=2){
             addMessage(redirectAttributes,"请填写收款卡号");
             model.addAttribute("cmSecondHandDetail",cmSecondHandDetail);
             return "redirect:" + Global.getAdminPath() + "/product/new/list?searchProductCategory=2";
@@ -220,13 +315,21 @@ public class CmSecondHandDetailController extends BaseController {
             cmSecondHandDetailService.insertShop(shopVo);
             shopId = shopVo.getShopID();
         }
-        String[] ids = request.getParameterValues("ids");
-        List<String> fileTypes = Arrays.asList(ids);
+        String[] ids=null;
+        List<String> fileTypes =null;
+        if(cmSecondHandDetail.getAnnounType()!=null && cmSecondHandDetail.getAnnounType()!=2){
+         ids = request.getParameterValues("ids");
+         fileTypes = Arrays.asList(ids);
+        }
+
         String validFlag = cmSecondHandDetail.getValidFlag();
         Date date = new Date();
         String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
         // 保存二手商品关键信息
         Product product = new Product();
+        System.out.println(cmSecondHandDetail.getAnnounType());
+        product.setAnnounType(cmSecondHandDetail.getAnnounType());
+
         product.setProductID(cmSecondHandDetail.getProductID());
         product.setBrandID(cmSecondHandDetail.getBrandID());
         // 二手商品类型
@@ -355,9 +458,12 @@ public class CmSecondHandDetailController extends BaseController {
             String imageUrl = getImageUrl(licenseImage);
             cmSecondHandDetail.setLicenseImage(imageUrl);
         }
+        cmSecondHandDetail.setAnnounType(2);
         // 保存二手详细信息
         cmSecondHandDetailService.save(cmSecondHandDetail);
-        cmSecondHandDetailService.saveFileType(product.getProductID(), cmSecondHandDetail.getId(), fileTypes);
+        if(cmSecondHandDetail.getAnnounType()!=null && cmSecondHandDetail.getAnnounType()!=2) {
+            cmSecondHandDetailService.saveFileType(product.getProductID(), cmSecondHandDetail.getId(), fileTypes);
+        }
         if (null != product.getProductID()) {
             //删除之前图片再添加
             productNewService.deleteImageByProductId(product.getProductID());

+ 102 - 7
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -8,12 +8,17 @@ 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.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
 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.dao.MessageCenterDao;
 import com.caimei.modules.user.entity.CmPageModules;
 import com.caimei.modules.user.entity.CmUserOrganize;
+import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.SplitCode;
 import com.caimei.modules.user.service.CmUserOrganizeService;
 import com.caimei.po.ProductImage;
@@ -84,6 +89,15 @@ public class ProductNewController extends BaseController {
     private GenerateUtils generateUtils;
     @Resource
     private ProductNewDao productNewDao;
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+    @Autowired
+    private NewOrderService newOrderService;
+    @Autowired
+    private WeChatService weChatService;
+    @Autowired
+    private NewShopOrderDao newShopOrderDao;
+
 
     @ModelAttribute
     public Product get(@RequestParam(required = false) String id) {
@@ -100,6 +114,7 @@ public class ProductNewController extends BaseController {
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = {"list", ""})
     public String list(Product product, HttpServletRequest request, HttpServletResponse response, Model model) {
+      Product pro=product;
         String id = product.getId();
         if (StringUtils.isEmpty(id)) {
             String shopName = product.getSearchShopName();
@@ -135,8 +150,12 @@ public class ProductNewController extends BaseController {
             if (null != searchTinyTypeID) {
                 product.setTinyTypeID(searchTinyTypeID);
             }
-            if (StringUtils.isNotEmpty(searchValidFlag)) {
-                product.setValidFlag(searchValidFlag);
+            if (StringUtils.isNotEmpty(searchValidFlag) && !"on".equals(searchValidFlag)) {
+                if(searchValidFlag.contains("7")){
+                    searchValidFlag=searchValidFlag.replace("7","10");
+                }
+                String[] split = searchValidFlag.split(",");
+                product.setValidFlagString(split);
             }
             if (StringUtils.isNotEmpty(searchActStatus)) {
                 product.setActStatus(searchActStatus);
@@ -231,21 +250,28 @@ public class ProductNewController extends BaseController {
         model.addAttribute("searchBigTypeID", product.getBigTypeID());
         model.addAttribute("searchSmallTypeID", product.getSmallTypeID());
         model.addAttribute("searchTinyTypeID", product.getTinyTypeID());
-        model.addAttribute("searchValidFlag", product.getValidFlag());
         model.addAttribute("searchActStatus", product.getActStatus());
         model.addAttribute("searchProductType", product.getProductType());
         model.addAttribute("searchBrandID", product.getBrandID());
         model.addAttribute("searchPreferredFlag", product.getPreferredFlag());
         model.addAttribute("searchProductCategory", product.getProductCategory());
+        model.addAttribute("searchValidFlag", product.getSearchValidFlag());
         if (StringUtils.isNotEmpty(id)) {
             // 单个商品搜索
             model.addAttribute("editFlag", "1");
         }
+        /**
+         * 初始化回显字段
+         */
+        product.setNewProductType(null);
+        product.setNewvalidFlag(null);
         if ("1".equals(product.getProductCategory())) {
+
             return "modules/product-new/productList";
         } else {
             return "modules/product-new/secondHand";
         }
+
     }
 
     @RequestMapping(value = "productAdd")
@@ -295,6 +321,15 @@ public class ProductNewController extends BaseController {
     public String editProduct(Product product, Model model) {
         if (null != product.getProductID()) {
             ProductDetailInfo productDetailInfo = productService.getProductDetailInfo(product.getProductID());
+//            Product produ=productService.qualification(product.getProductID());
+//            if(null != produ){
+//                product.setQualificationLink(produ.getQualificationLink());
+//                product.setQualificationNo(produ.getQualificationNo());
+//                product.setQualificationTime(produ.getQualificationTime());
+//                product.setProductName(produ.getProductName());
+//            }
+
+
             List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(product.getProductID());
             if (null != productDetailInfo) {
                 product.setDetailInfo(productDetailInfo.getDetailInfo());
@@ -434,6 +469,11 @@ public class ProductNewController extends BaseController {
     @RequiresPermissions("product:product:edit")
     @RequestMapping(value = "productSave")
     public String productSave(Product product, ProductDetailInfo productDetailInfo, RedirectAttributes redirectAttributes) {
+
+       if("2".equals(product.getProductType())){
+           product.setVisibility("3");
+           product.setPriceFlag("3");
+       }
         // 组合搜索关键词
         List<String> searchKeyList = product.getSearchKeyList();
         String searchKeyStr = "";
@@ -831,7 +871,7 @@ public class ProductNewController extends BaseController {
 
     @RequestMapping("auditProduct")
     @ResponseBody
-    public Map<String, Object> auditProduct(String validFlag, Integer productID, String remarks) {
+    public Map<String, Object> auditProduct(String validFlag,Integer newvalidFlag,String showtime, Integer productID, String remarks) {
         Map<String, Object> map = Maps.newLinkedHashMap();
         try {
             if (StringUtils.isBlank(validFlag) || null == productID) {
@@ -863,7 +903,62 @@ public class ProductNewController extends BaseController {
                     validFlag = "2";
                 }
             }
-            productNewService.auditProduct(validFlag, beforeValidFlag, productID);
+
+            productNewService.auditProduct(validFlag,newvalidFlag,showtime, beforeValidFlag, productID);
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String current = dateFormat.format(new Date());
+            MessageCenter messageCenter = new MessageCenter();
+           Integer shopid= messageCenterDao.shopID(productID);
+           if("8".equals(validFlag)){
+               messageCenter.setShopId(shopid);
+               messageCenter.setClubId(null);
+               messageCenter.setUserType(2);
+               messageCenter.setMessageType(2);
+               messageCenter.setShopMessType(3);
+               messageCenter.setContent(null);
+               messageCenter.setProductId(productID);
+               messageCenter.setTime(current);
+               messageCenterDao.addMessageCenter(messageCenter);
+               Product pro=new Product();
+               pro=productNewDao.validIList(productID);
+                   String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
+                   boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
+                   if(sendSms){
+                       logger.info(">>>>>>>发送成功");
+                   }
+               try {
+                   logger.info("********供应商审核失败微信公众号推送********");
+                   String unionid = newShopOrderDao.UnionId(pro.getUserId());
+                   logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
+                   List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+
+                   String accessToken = weChatService.getAccessToken();
+                   Date date=new Date();
+                   String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+
+                   String pagePath = "/pages/login/apply-supplier";
+                   for (String openid : openidList) {
+                       weChatService.sendTemp(accessToken, openid,pro.getName(),auditTime, pagePath);
+                   }
+               } catch (Exception e) {
+                   logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
+               }
+           }
+            if(newvalidFlag!=null){
+                if(newvalidFlag ==2) {
+                    messageCenter.setShopId(shopid);
+                    messageCenter.setClubId(null);
+                    messageCenter.setUserType(2);
+                    messageCenter.setMessageType(2);
+                    messageCenter.setShopMessType(4);
+                    messageCenter.setContent(null);
+                    messageCenter.setProductId(productID);
+                    messageCenter.setTime(current);
+                    messageCenterDao.addMessageCenter(messageCenter);
+                }
+            }
+
+
             map.put("success", true);
             map.put("msg", "操作成功");
             int valid = new Integer(validFlag);
@@ -898,7 +993,7 @@ public class ProductNewController extends BaseController {
             if (null == validFlag || "".equals(validFlag) || null == productID) {
                 throw new Exception("参数错误!");
             }
-            productNewService.auditProduct(validFlag, null, productID);
+            productNewService.auditProduct(validFlag,null,null,null, productID);
             map.put("success", true);
             map.put("msg", "操作成功");
             // 更新二手商品上架信息
@@ -956,7 +1051,7 @@ public class ProductNewController extends BaseController {
 
             }
             // 更新商品库上下架状态
-            productNewService.auditProduct(validFlag, null, productId);
+            productNewService.auditProduct(validFlag,null, null,null, productId);
             map.put("success", true);
             cleanRedisCache();
         } catch (Exception e) {

+ 30 - 2
src/main/java/com/caimei/modules/supervip/service/CmSvipGiveService.java

@@ -1,13 +1,18 @@
 package com.caimei.modules.supervip.service;
 
+import com.caimei.modules.order.service.NewOrderService;
 import com.caimei.modules.supervip.dao.CmSvipHistoryDao;
 import com.caimei.modules.supervip.entity.CmSvipGive;
 import com.caimei.modules.supervip.entity.CmSvipHistory;
+import com.caimei.modules.user.dao.MessageCenterDao;
+import com.caimei.modules.user.entity.MessageCenter;
 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 javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -17,9 +22,12 @@ public class CmSvipGiveService extends CrudService<CmSvipHistoryDao, CmSvipHisto
 
     @Autowired
     private CmSvipHistoryDao svipDao;
-
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+    @Resource
+    private NewOrderService newOrderService;
     @Transactional(readOnly = false)
-    public void saveGive(CmSvipGive cmSvipGive) {
+    public void saveGive(CmSvipGive cmSvipGive) throws Exception {
         //cm_svip_user加用户,cm_svip_history插入一条记录
         CmSvipHistory cmSvipHistory = new CmSvipHistory();
         Date now = new Date();
@@ -34,6 +42,26 @@ public class CmSvipGiveService extends CrudService<CmSvipHistoryDao, CmSvipHisto
         cmSvipHistory.setPayWay("5");
         cmSvipHistory.setPayTime(now);
         CmSvipHistory user = svipDao.findVipUser(cmSvipGive.getUserId());
+Integer clubID=messageCenterDao.clubIdCule(Integer.parseInt(cmSvipGive.getUserId()));
+        Date date=new Date();
+        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+        MessageCenter messageCenter = new MessageCenter();
+        messageCenter.setShopId(null);
+        messageCenter.setClubId(clubID);
+        messageCenter.setUserType(1);
+        messageCenter.setMessageType(2);
+        messageCenter.setAccountType(4);
+        messageCenter.setContent(cmSvipGive.getMonth().toString()+"个月");
+        messageCenter.setTime(curDateStr);
+        messageCenterDao.addMessageCenter(messageCenter);
+
+       String bindMobile= messageCenterDao.contractMobile(cmSvipGive.getUserId());
+
+        String content = "【采美365】您已获得采美平台赠送的"+cmSvipGive.getMonth()+"个月超级会员服务,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美网”可获取更多优惠和精彩资讯。";
+       boolean sendSms = newOrderService.getSendSms(9, bindMobile, content);
+      if(sendSms){
+          logger.info(">>>>>>>获得采美平台赠送的超级会员短信推送成功");
+      }
         if (null != user) {
             //不为空update
             CmSvipHistory endTimeFlag = svipDao.findEndTime(Long.valueOf(cmSvipGive.getUserId()));

+ 8 - 1
src/main/java/com/caimei/modules/supervip/web/CmSvipGiveController.java

@@ -2,6 +2,8 @@ package com.caimei.modules.supervip.web;
 
 import com.caimei.modules.supervip.entity.CmSvipGive;
 import com.caimei.modules.supervip.service.CmSvipGiveService;
+import com.caimei.modules.user.dao.MessageCenterDao;
+import com.caimei.modules.user.entity.MessageCenter;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
@@ -14,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 @Controller
 @RequestMapping(value = "${adminPath}/svip/cmSvipGive")
@@ -22,6 +26,9 @@ public class CmSvipGiveController extends BaseController {
     @Autowired
     private CmSvipGiveService svipService;
 
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+
     @ModelAttribute
     public CmSvipGive get(@RequestParam(required = false) String id) {
         CmSvipGive entity = new CmSvipGive();
@@ -35,7 +42,7 @@ public class CmSvipGiveController extends BaseController {
     }
 
     @RequestMapping(value = "save")
-    public String save(CmSvipGive cmSvipGive, HttpServletRequest request, HttpServletResponse response, Model model) {
+    public String save(CmSvipGive cmSvipGive, HttpServletRequest request, HttpServletResponse response, Model model)throws Exception {
         if (StringUtils.isBlank(cmSvipGive.getUserId()) || null == cmSvipGive.getMonth()) {
             model.addAttribute("message", "参数错误或缺少参数");
             return "modules/super/cmSvipGiveForm";

+ 43 - 0
src/main/java/com/caimei/modules/sys/dao/NotificationDao.java

@@ -0,0 +1,43 @@
+package com.caimei.modules.sys.dao;
+
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.sys.entity.Notification;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/20
+ */
+@MyBatisDao
+public interface NotificationDao extends CrudDao<Notification> {
+
+    //查询几月后过期
+    List<Product> productTypeCount(Integer yat);
+    //查询几日后过期
+    List<Product> productTypeCount1(Integer yat);
+   //查询上架费几月后过期
+    List<Product> productTypeCount2(Integer yat);
+    //查询上架费几日后过期
+    List<Product> productTypeCount3(Integer yat);
+
+    List<Notification>notification(Notification notification);
+
+    String notificationId(Notification notification);
+
+    void Upnotification(Notification notification);
+
+    void hide(@Param("hide")Integer hide, @Param("Id") Integer Id);
+
+    void hides();
+
+    void addNotification(Notification notification);
+
+    Integer count();
+
+}

+ 126 - 0
src/main/java/com/caimei/modules/sys/entity/Notification.java

@@ -0,0 +1,126 @@
+package com.caimei.modules.sys.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/20
+ */
+public class Notification extends DataEntity<Notification> {
+
+    private String Id;
+
+    private String theme;
+
+    private String newTime;
+
+    private String shopContent;
+
+    private String porductID;
+
+    private String shopID;
+
+    private String[] contents;
+
+    private String[] porductIDs;
+
+    private String[] shopIDs;
+
+    private Integer hide;
+
+    public Integer getHide() {
+        return hide;
+    }
+
+    public void setHide(Integer hide) {
+        this.hide = hide;
+    }
+
+    public String getShopID() {
+        return shopID;
+    }
+
+    public void setShopID(String shopID) {
+        this.shopID = shopID;
+    }
+
+    public String[] getShopIDs() {
+        return shopIDs;
+    }
+
+    public void setShopIDs(String[] shopIDs) {
+        this.shopIDs = shopIDs;
+    }
+
+    public String[] getPorductIDs() {
+        return porductIDs;
+    }
+
+    public void setPorductIDs(String[] porductIDs) {
+        this.porductIDs = porductIDs;
+    }
+
+    public String getPorductID() {
+        return porductID;
+    }
+
+    public void setPorductID(String porductID) {
+        this.porductID = porductID;
+    }
+
+    public String getShopContent() {
+        return shopContent;
+    }
+
+    @Override
+    public String getId() {
+        return Id;
+    }
+
+    @Override
+    public void setId(String id) {
+        Id = id;
+    }
+
+    public void setShopContent(String shopContent) {
+        this.shopContent = shopContent;
+    }
+
+    public Integer getSaved() {
+        return saved;
+    }
+
+    public void setSaved(Integer saved) {
+        this.saved = saved;
+    }
+
+    private Integer saved;
+
+
+
+    public String getTheme() {
+        return theme;
+    }
+
+    public void setTheme(String theme) {
+        this.theme = theme;
+    }
+
+    public String getNewTime() {
+        return newTime;
+    }
+
+    public void setNewTime(String newTime) {
+        this.newTime = newTime;
+    }
+
+    public String[] getContents() {
+        return contents;
+    }
+
+    public void setContents(String[] contents) {
+        this.contents = contents;
+    }
+}

+ 32 - 0
src/main/java/com/caimei/modules/sys/service/NotificationService.java

@@ -0,0 +1,32 @@
+package com.caimei.modules.sys.service;
+
+import com.caimei.modules.sys.dao.NotificationDao;
+import com.caimei.modules.sys.entity.Notification;
+import com.thinkgem.jeesite.common.persistence.Page;
+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/7/20
+ */
+@Service
+@Transactional(readOnly = true)
+public class NotificationService {
+
+    @Autowired
+    NotificationDao notificationDao;
+
+    public Page<Notification> notificationPagen(Page<Notification> page, Notification notification) {
+        notification.setPage(page);
+       List<Notification> list= notificationDao.notification(notification);
+        page.setList(list);
+        return page;
+    }
+
+}

+ 38 - 4
src/main/java/com/caimei/modules/sys/utils/SMSUtils.java

@@ -7,22 +7,55 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 public class SMSUtils {
+
+	/** key */
+	private static final String ACCOUNT = "account";
+	private static final String PASSWORD = "password";
+	/** 通知短信 账户 */
+	private static final String ACCOUNT_NOTICE = "N2532063";
+	private static final String PASSWORD_NOTICE = "jzVvYmuP4D7f1b";
+	/** 验证码短信 账户 */
+	private static final String ACCOUNT_YZM = "YZM6372171";
+	private static final String PASSWORD_YZM = "1L8ZaIEW7fa3ca";
+	/** 营销短信 账户 */
+	private static final String ACCOUNT_ADS = "M1666161";
+	private static final String PASSWORD_ADS = "TO3xSGvEUk6ddc";
+	/** 请求地址 */
+	private static final String SMS_URL = "http://smssh1.253.com/msg/send/json";
+
+
 //	private static String url = "http://47.96.109.82:9999/sms.aspx";
 //	private static String userid = "321";
 //	private static String account = "0755cmxx";
 //	private static String password = "CaimeiSMS999";
-	
-	public static boolean sendSms(String mobile, String content){
+
+	public static boolean sendSms(Integer type,String mobile, String content){
 
 //		String res = SmsClientSend.sendSms(url, userid, account, password, mobile, content);
 //		return res.indexOf("Success") != -1;
 
+//		JSONObject params = new JSONObject();
+//		if (null != type && 2 == type) {
+//			// 验证码短信
+//			params.put(ACCOUNT, ACCOUNT_YZM);
+//			params.put(PASSWORD, PASSWORD_YZM);
+//		} else if (null != type && 3 == type) {
+//			// 营销短信
+//			params.put(ACCOUNT, ACCOUNT_ADS);
+//			params.put(PASSWORD, PASSWORD_ADS);
+//		} else {
+//			// 通知短信
+//			params.put(ACCOUNT, ACCOUNT_NOTICE);
+//			params.put(PASSWORD, PASSWORD_NOTICE);
+//		}
+
 		// 获取core服务器地址
 		String coreServer = Global.getConfig("caimei.core");
 		RestTemplate restTemplate = new RestTemplate();
 		String uri = coreServer + "/tools/sms/send";
 		// 发起Post请求
 		MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
+		paramMap.add("type", type.toString());
 		paramMap.add("mobile", mobile);
 		paramMap.add("content", content);
 		String result = restTemplate.postForObject(uri, paramMap, String.class);
@@ -36,7 +69,8 @@ public class SMSUtils {
 	}
 
 	public static void main(String[] args) {
-		//System.out.println(sendSms("13631650502", "您登录亲朋棋牌的手机短 信验证码是:7895,祝您游戏愉快!请确认账号是由本人操作"));
-		// System.out.println(sendSms("15814011616", "您短信验证码是:7895"));
+//		String e="abc";
+//		System.out.println(sendSms(3,"1817515644", "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + e + "”资质证书将于3个月后失效,请及时登录采美网站上传新证书。"));
+//		 System.out.println(sendSms("18175515644", "您短信验证码是:7895"));
 	}
 }

+ 737 - 0
src/main/java/com/caimei/modules/sys/web/NotificationController.java

@@ -0,0 +1,737 @@
+package com.caimei.modules.sys.web;
+
+import com.caimei.modules.basesetting.entity.Province;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.entity.NewShopOrder;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.sys.dao.NotificationDao;
+import com.caimei.modules.sys.entity.Notification;
+import com.caimei.modules.sys.service.NotificationService;
+import com.caimei.modules.sys.utils.SMSUtils;
+import com.caimei.modules.user.dao.MessageCenterDao;
+import com.caimei.modules.user.entity.MessageCenter;
+import com.caimei.utils.StringUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import redis.clients.jedis.Jedis;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.soap.Addressing;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/20
+ */
+//@Controller
+@Configuration
+@EnableScheduling
+@RequestMapping(value = "${adminPath}/sys/Notification")
+public class NotificationController extends BaseController {
+
+    @Autowired
+    NotificationDao notificationDao;
+    @Autowired
+    NotificationService notificationService;
+    @Autowired
+    MessageCenterDao messageCenterDao;
+    @Autowired
+    NewOrderService newOrderService;
+    @Autowired
+    NewShopOrderDao newShopOrderDao;
+    @Autowired
+    WeChatService weChatService;
+    @Value("${wwwServer}")
+    private String domain;
+    @RequestMapping(value = {"list", ""})
+    public String list( Notification notifi,HttpServletRequest request, HttpServletResponse response, Model model) {
+
+
+//        //械字号资质证书3个月后过期
+//        Integer count=0;
+//        String name="";
+//        String productID="";
+//        String shopID="";
+//        Date date=new Date();
+//        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+//        //资质证书
+//       List<Product>pro=notificationDao.productTypeCount(3);
+//        List<Product>pro1=notificationDao.productTypeCount(1);
+//        List<Product>pro2=notificationDao.productTypeCount1(7);
+//        List<Product>pro3=notificationDao.productTypeCount1(1);
+//        //上架费
+//        List<Product>product=notificationDao.productTypeCount2(3);
+//        List<Product>product1=notificationDao.productTypeCount2(1);
+//        List<Product>product2=notificationDao.productTypeCount3(7);
+//        List<Product>product3=notificationDao.productTypeCount3(1);
+////
+//        Jedis jedis=null;
+//        String constraint="";
+//        if(domain.contains("-b")){
+//             jedis=new Jedis("172.31.165.27", 6379);
+//             jedis.auth("6#xsI%b4o@5c3RoE");
+//        }else if(domain.contains("localhost")){
+//             jedis=new Jedis("192.168.2.100", 6379);
+//        }else {
+//            jedis=new Jedis("172.31.165.23", 6379);
+//        }
+//
+//        if(!"1".equals(jedis.rpop("constraint"))){
+//            jedis.lpush("constraint","0");
+//
+//        }
+//        constraint=jedis.rpop("constraint");
+//        System.out.println(jedis.rpop("constraint"));
+//      if("0".equals(constraint)){
+//       for (int i=0;i<pro.size();i++){
+//           MessageCenter messageCenter = new MessageCenter();
+//           messageCenter.setShopId(pro.get(i).getShopID());
+//           messageCenter.setClubId(null);
+//           messageCenter.setUserType(2);
+//           messageCenter.setMessageType(2);
+//           messageCenter.setShopMessType(5);
+//           messageCenter.setContent("该商品的资质证书将于3个月后失效,请及时登录采美网站上传新证书。");
+//           messageCenter.setTime(curDateStr);
+//           messageCenterDao.addMessageCenter(messageCenter);
+//
+//           if(i!=0){
+//               name+=",";
+//               productID+=",";
+//           }
+//          name +="("+pro.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//           productID+=pro.get(i).getProductID().toString();
+//    }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于3个月后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+//        //械字号资质证书1个月后过期
+//        for (int i=0;i<pro1.size();i++){
+//
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro1.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro1.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro1.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于1个月后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+////械字号资质证书7日后过期
+//        for (int i=0;i<pro2.size();i++){
+//
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro2.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro2.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro2.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于7天后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+////械字号资质证书今日后过期
+//        for (int i=0;i<pro3.size();i++){
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro3.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro3.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro3.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于今天后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+//        //上架费
+//        for (int i=0;i<product.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product.get(i).getShopName();
+//            shopID+=product.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于3个月后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+//        //上架费1个月后过期
+//        for (int i=0;i<product1.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product1.get(i).getShopName();
+//            shopID+=product1.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于1个月后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+////上架费7日后过期
+//        for (int i=0;i<product2.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product2.get(i).getShopName();
+//            shopID+=product2.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于7天后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+////上架费今日后过期
+//        for (int i=0;i<product3.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product3.get(i).getShopName();
+//            shopID+=product3.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于今天后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+//      }
+//        jedis.lpush("constraint","1");
+      List<String> content=new ArrayList<>();
+        Page<Notification> page = notificationService.notificationPagen(new Page<Notification>(request, response), notifi);
+
+            String[] IdArr=null;
+            String[] porductIDs=null;
+            String[] shopIDs=null;
+             for (int i = 0; i < page.getList().size(); i++) {
+                IdArr =page.getList().get(i).getShopContent().split(",");
+                if(page.getList().get(i).getPorductID()!=null){porductIDs=page.getList().get(i).getPorductID().split(",");}
+                 if(page.getList().get(i).getShopID()!=null){shopIDs=page.getList().get(i).getShopID().split(",");}
+
+                page.getList().get(i).setContents(IdArr);
+                page.getList().get(i).setPorductIDs(porductIDs);
+                 page.getList().get(i).setShopIDs(shopIDs);
+            }
+        notificationDao.hides();
+        model.addAttribute("Notification", notifi);
+        model.addAttribute("page", page);
+        return "modules/sys/Notification";
+    }
+
+
+    /**
+     *constraint加入缓存
+     */
+    @Scheduled(cron = "0 0 23 * * ?")
+    public void Open() {
+//        Jedis jedis=new Jedis("172.31.165.27", 6379);
+//        jedis.auth("6#xsI%b4o@5c3RoE");
+        Jedis jedis=new Jedis("192.168.2.100", 6379);
+        jedis.lpush("constraint","0");
+    }
+
+    @Scheduled(cron = "0 0 11 * * ?")
+//@Scheduled(cron = "0 0/10 * * * ?")
+    public void mess() throws Exception {
+        Date date=new Date();
+        String name="";
+        Integer count=0;
+        List<Product>pro=notificationDao.productTypeCount(3);
+        List<Product>pro1=notificationDao.productTypeCount(1);
+        List<Product>pro2=notificationDao.productTypeCount1(7);
+        List<Product>pro3=notificationDao.productTypeCount1(1);
+        for (int i=0;i<pro.size();i++){
+            name=pro.get(i).getName();
+            if (name.length() > 10) {
+                name = StringUtils.strip(name.substring(0, 11));
+                name += "...";
+            }
+
+            logger.info("**************************质证书失效消息推送************************************");
+                try {
+                    Integer userID = messageCenterDao.userID(pro.get(i).getShopID());
+                   String shopName= messageCenterDao.shopName(pro.get(i).getShopID());
+                    String unionid = newShopOrderDao.UnionId(userID);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    String accessToken = weChatService.getAccessToken();
+                    String qualificationNo = pro.get(i).getQualificationNo();
+                    String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    String pagePath = "";
+                    for (String openid : openidList) {
+                        weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
+                        count++;
+                    }
+                } catch (Exception e) {
+                    logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
+                }
+            if(count<=0) {
+                String bindMobile = messageCenterDao.Mobile(pro.get(i).getShopID());
+                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于3个月后失效,请及时登录采美网站上传新证书。";
+                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
+                if (sendSms) {
+                    logger.info(">>>>>>>资质证书将于3个月后失效短信推送成功");
+                }
+            }
+        }
+
+        for (int i=0;i<pro1.size();i++){
+            name=pro1.get(i).getName();
+            if (name.length() > 10) {
+                name = StringUtils.strip(name.substring(0, 11));
+                name += "...";
+            }
+
+            logger.info("**************************质证书失效消息推送************************************");
+            try {
+                Integer userID = messageCenterDao.userID(pro1.get(i).getShopID());
+                String shopName= messageCenterDao.shopName(pro1.get(i).getShopID());
+                String unionid = newShopOrderDao.UnionId(userID);
+                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                String accessToken = weChatService.getAccessToken();
+                String qualificationNo = pro1.get(i).getQualificationNo();
+                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                String pagePath = "";
+                for (String openid : openidList) {
+                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
+                    count++;
+                }
+            } catch (Exception e) {
+                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
+            }
+            if(count<=0) {
+                String bindMobile = messageCenterDao.Mobile(pro1.get(i).getShopID());
+                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于1个月后失效,请及时登录采美网站上传新证书。";
+                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
+                if (sendSms) {
+                    logger.info(">>>>>>>资质证书将于1个月后失效短信推送成功");
+                }
+            }
+        }
+
+        for (int i=0;i<pro2.size();i++){
+            name=pro2.get(i).getName();
+            if (name.length() > 10) {
+                name = StringUtils.strip(name.substring(0, 11));
+                name += "...";
+            }
+
+            logger.info("**************************质证书失效消息推送************************************");
+            try {
+                Integer userID = messageCenterDao.userID(pro2.get(i).getShopID());
+                String shopName= messageCenterDao.shopName(pro2.get(i).getShopID());
+                String unionid = newShopOrderDao.UnionId(userID);
+                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                String accessToken = weChatService.getAccessToken();
+                String qualificationNo = pro2.get(i).getQualificationNo();
+                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                String pagePath = "";
+                for (String openid : openidList) {
+                    weChatService.messteme(accessToken, openid,shopName, qualificationNo, time, name, pagePath);
+                    count++;
+                }
+            } catch (Exception e) {
+                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
+            }
+            if(count<=0) {
+                String bindMobile = messageCenterDao.Mobile(pro2.get(i).getShopID());
+                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于7天后失效,请及时登录采美网站上传新证书。";
+                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
+                if (sendSms) {
+                    logger.info(">>>>>>>资质证书将于7天后失效短信推送成功");
+                }
+            }
+        }
+
+        for (int i=0;i<pro3.size();i++){
+            name=pro3.get(i).getName();
+            if (name.length() > 10) {
+                name = StringUtils.strip(name.substring(0, 11));
+                name += "...";
+            }
+
+            logger.info("**************************质证书失效消息推送************************************");
+            try {
+                Integer userID = messageCenterDao.userID(pro3.get(i).getShopID());
+                String shopName= messageCenterDao.shopName(pro3.get(i).getShopID());
+                String unionid = newShopOrderDao.UnionId(userID);
+                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                String accessToken = weChatService.getAccessToken();
+                String qualificationNo = pro3.get(i).getQualificationNo();
+                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                String pagePath = "";
+                for (String openid : openidList) {
+                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
+                    count++;
+                }
+            } catch (Exception e) {
+                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
+            }
+if(count<=0){
+            String bindMobile= messageCenterDao.Mobile(pro3.get(i).getShopID());
+            String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“"+name+"”资质证书将于今天后失效,请及时登录采美网站上传新证书。";
+            boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
+            if(sendSms){
+                logger.info(">>>>>>>资质证书将于今天后后失效短信推送成功");
+            }
+        }
+        }
+
+    }
+
+
+    @RequestMapping(value = {"update"})
+    public String update( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model) {
+        notificationDao.Upnotification(notification);
+        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+    }
+
+    @RequestMapping(value = {"updates"})
+    public void updates( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model) {
+        notificationDao.Upnotification(notification);
+    }
+
+    @RequestMapping(value = {"Idques"})
+    public String Idques( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
+         String c= notificationDao.notificationId(notification);
+
+        model.addAttribute("shopContent", c);
+        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list?shopContent="+c;
+    }
+
+    @RequestMapping(value = {"hide"})
+    public String hide( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
+        Integer hide=null;
+        if(notification.getHide() == 0){
+            hide=1;
+        }else{
+            hide=0;
+        }
+        notificationDao.hide(hide,Integer.parseInt(notification.getId()));
+        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+    }
+
+    @RequestMapping(value = {"hides"})
+    public String hides( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
+
+        notificationDao.hides();
+        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+    }
+    @Scheduled(cron = "0 0 11 * * ?")
+//@Scheduled(cron = "0 0/3 * * * ?")
+    public void time(){
+        logger.info("》》》》》》》》》》》开始检测商品资质证书和上架费是否过期");
+
+        //械字号资质证书3个月后过期
+        Integer count=0;
+        String name="";
+        String productID="";
+        String shopID="";
+        Date date=new Date();
+        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+        //资质证书
+        List<Product>pro=notificationDao.productTypeCount(3);
+        List<Product>pro1=notificationDao.productTypeCount(1);
+        List<Product>pro2=notificationDao.productTypeCount1(7);
+        List<Product>pro3=notificationDao.productTypeCount1(1);
+        //上架费
+        List<Product>product=notificationDao.productTypeCount2(3);
+        List<Product>product1=notificationDao.productTypeCount2(1);
+        List<Product>product2=notificationDao.productTypeCount3(7);
+        List<Product>product3=notificationDao.productTypeCount3(1);
+//
+        Jedis jedis=null;
+        String constraint="";
+        if(domain.contains("-b")){
+            jedis=new Jedis("172.31.165.27", 6379);
+            jedis.auth("6#xsI%b4o@5c3RoE");
+        }else if(domain.contains("localhost")){
+            jedis=new Jedis("192.168.2.100", 6379);
+        }else {
+            jedis=new Jedis("172.31.165.23", 6379);
+        }
+
+        if(!"1".equals(jedis.rpop("constraint"))){
+            jedis.lpush("constraint","0");
+
+        }
+        constraint=jedis.rpop("constraint");
+        System.out.println(jedis.rpop("constraint"));
+//        if("0".equals(constraint)){
+            for (int i=0;i<pro.size();i++){
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(pro.get(i).getShopID());
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(5);
+                messageCenter.setProductId(pro.get(i).getProductID());
+                messageCenter.setContent("该商品的资质证书将于3个月后失效,请及时登录采美网站上传新证书。");
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+
+                if(i!=0){
+                    name+=",";
+                    productID+=",";
+                }
+                name +="("+pro.get(i).getProductID().toString()+")"+pro.get(i).getName();
+                productID+=pro.get(i).getProductID().toString();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下械字号商品的资质证书将于3个月后失效,请及时提醒供应商更换证书。");
+                notification.setShopContent(name);
+                notification.setPorductID(productID);
+                notificationDao.addNotification(notification);
+                name="";
+                productID="";
+            }
+            //械字号资质证书1个月后过期
+            for (int i=0;i<pro1.size();i++){
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(pro1.get(i).getShopID());
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(5);
+                messageCenter.setProductId(pro1.get(i).getProductID());
+                messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+                if(i!=0){
+                    name+=",";
+                    productID+=",";
+                }
+                name +="("+pro1.get(i).getProductID().toString()+")"+pro1.get(i).getName();
+                productID+=pro1.get(i).getProductID().toString();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下械字号商品的资质证书将于1个月后失效,请及时提醒供应商更换证书。");
+                notification.setShopContent(name);
+                notification.setPorductID(productID);
+                notificationDao.addNotification(notification);
+                name="";
+                productID="";
+            }
+//械字号资质证书7日后过期
+            for (int i=0;i<pro2.size();i++){
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(pro2.get(i).getShopID());
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(5);
+                messageCenter.setProductId(pro2.get(i).getProductID());
+                messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+                if(i!=0){
+                    name+=",";
+                    productID+=",";
+                }
+                name +="("+pro2.get(i).getProductID().toString()+")"+pro2.get(i).getName();
+                productID+=pro2.get(i).getProductID().toString();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下械字号商品的资质证书将于7天后失效,请及时提醒供应商更换证书。");
+                notification.setShopContent(name);
+                notification.setPorductID(productID);
+                notificationDao.addNotification(notification);
+                name="";
+                productID="";
+            }
+//械字号资质证书今日后过期
+            for (int i=0;i<pro3.size();i++){
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(pro3.get(i).getShopID());
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(5);
+                messageCenter.setProductId(pro3.get(i).getProductID());
+                messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+                if(i!=0){
+                    name+=",";
+                    productID+=",";
+                }
+                name +="("+pro3.get(i).getProductID().toString()+")"+pro3.get(i).getName();
+                productID+=pro3.get(i).getProductID().toString();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下械字号商品的资质证书将于今天后失效,请及时提醒供应商更换证书。");
+                notification.setShopContent(name);
+                notification.setPorductID(productID);
+                notificationDao.addNotification(notification);
+                name="";
+                productID="";
+            }
+            //上架费
+            for (int i=0;i<product.size();i++){
+                if(i!=0){
+                    name+=",";
+                    shopID+=",";
+                }
+                name +=product.get(i).getShopName();
+                shopID+=product.get(i).getShopID();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下供应商的上架费将于3个月后到期,请及时提醒供应商续费。");
+                notification.setShopContent(name);
+                notification.setShopID(shopID);
+                notificationDao.addNotification(notification);
+                name="";
+                shopID="";
+            }
+            //上架费1个月后过期
+            for (int i=0;i<product1.size();i++){
+                if(i!=0){
+                    name+=",";
+                    shopID+=",";
+                }
+                name +=product1.get(i).getShopName();
+                shopID+=product1.get(i).getShopID();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下供应商的上架费将于1个月后到期,请及时提醒供应商续费。");
+                notification.setShopContent(name);
+                notification.setShopID(shopID);
+                notificationDao.addNotification(notification);
+                name="";
+                shopID="";
+            }
+//上架费7日后过期
+            for (int i=0;i<product2.size();i++){
+                if(i!=0){
+                    name+=",";
+                    shopID+=",";
+                }
+                name +=product2.get(i).getShopName();
+                shopID+=product2.get(i).getShopID();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下供应商的上架费将于7天后到期,请及时提醒供应商续费。");
+                notification.setShopContent(name);
+                notification.setShopID(shopID);
+                notificationDao.addNotification(notification);
+                name="";
+                shopID="";
+            }
+//上架费今日后过期
+            for (int i=0;i<product3.size();i++){
+                if(i!=0){
+                    name+=",";
+                    shopID+=",";
+                }
+                name +=product3.get(i).getShopName();
+                shopID+=product3.get(i).getShopID();
+            }
+            if(!"".equals(name)){
+                Notification notification=new Notification();
+                notification.setTheme("以下供应商的上架费将于今天后到期,请及时提醒供应商续费。");
+                notification.setShopContent(name);
+                notification.setShopID(shopID);
+                notificationDao.addNotification(notification);
+                name="";
+                shopID="";
+            }
+//        }
+        jedis.lpush("constraint","1");
+        }
+
+    }
+

+ 50 - 0
src/main/java/com/caimei/modules/user/dao/MessageCenterDao.java

@@ -0,0 +1,50 @@
+package com.caimei.modules.user.dao;
+
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.user.entity.ClubChangeSp;
+import com.caimei.modules.user.entity.ClubTemporary;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.MessageCenter;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.thinkgem.jeesite.modules.sys.entity.User;
+import com.caimei.modules.user.entity.MessageCenter;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/7
+ */
+@MyBatisDao
+public interface MessageCenterDao extends CrudDao<MessageCenter> {
+
+
+    void addMessageCenter(MessageCenter messageCenter);
+
+    Integer shopID(Integer productID);
+
+    Integer clubIdCule(Integer userId);
+
+    CmUser clubList(Integer userId);
+
+    List<Integer> ClubIds();
+
+    CmCoupon CouponList(Integer couponType);
+
+    String contractMobile(String userID);
+    String Mobile(Integer shopID);
+
+    Integer userID(Integer shopID);
+
+    String shopName(Integer shopID);
+
+    List<CmCoupon> couponTime();
+
+    Integer count();
+
+}

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

@@ -1,6 +1,7 @@
 package com.caimei.modules.user.dao;
 
 import com.caimei.modules.cibe.entity.ShopCert;
+import com.caimei.modules.order.entity.CmDiscernReceipt;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.modules.user.entity.SplitCode;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
@@ -43,4 +44,20 @@ public interface NewCmShopDao extends CrudDao<NewCmShop> {
     void offline(NewCmShop newCmShop);
 
     void online(NewCmShop newCmShop);
+
+    List<CmDiscernReceipt> maintenanceList(CmDiscernReceipt cmDiscernReceipt);
+
+    void Removethelastfee(CmDiscernReceipt cmDiscernReceipt);
+
+    void Removethelast(CmDiscernReceipt cmDiscernReceipt);
+
+    void addthelast(CmDiscernReceipt cmDiscernReceipt);
+
+    void cmreceipt(CmDiscernReceipt cmDiscernReceipt);
+
+    CmDiscernReceipt cmrectiptlist(Integer shopID);
+
+    Integer cmrectCount(Integer shopID);
+
+    Integer therectip();
 }

+ 253 - 0
src/main/java/com/caimei/modules/user/entity/MessageCenter.java

@@ -0,0 +1,253 @@
+package com.caimei.modules.user.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+
+public class MessageCenter extends DataEntity<MessageCenter> {
+
+
+    /**
+     *消息id
+     */
+    private String id;
+    /**
+     供应商id
+     */
+    private Integer shopId;
+    /**
+     机构id
+     */
+    private Integer clubId;
+    /**
+     * 订单ID
+     */
+    private Integer orderId;
+    /**
+     用户类型1.机构2.供应商
+     */
+    private Integer userType;
+    /**
+     消息类型1.交易物流2.账户通知3.服务通知4.优惠促销
+     */
+    private Integer messageType;
+    /**
+     * 消息内容
+     */
+    private String content;
+    /**
+     * 操作完成时间
+     */
+    private String time;
+    /**
+     *账户通知类型 1.注册成功通知 2.购买超级会员成功 3.超级会员到期提醒 4.超级会员到期提醒 5.升级资质机构成功 6.升级资质机构失败 7.成为机构运营人员通知
+     */
+    private Integer accountType;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponType;
+    /**
+     * 优惠券金额
+     */
+    private Double couponFee;
+    /**
+     * 主图
+     */
+    private String mainImage;
+    /**
+     * 是否能走线上支付 0可以 1不可以 只能线下
+     */
+    private Integer onlinePayFlag;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     *供应商消息类型 1,账号审核通知,2.成为公司运营人员通知,3.商品上架审核通知,4.新品展示审核通知,5.上架费到期通知 6.商品资质到期通知
+     */
+    private Integer shopMessType;
+    /**
+     *供应商服务消息类型 1.上架费
+     */
+    private Integer shopTieredType;
+    /**
+     * 交易物流1.下单成功通知  2.订单支付完成 3.退款/货成功通知 4.订单取消通知 5.订单发货通知 6.自动收货通知
+     */
+    private Integer orderMessageType;
+    /**
+     * 0.未读 , 1.已读
+     */
+    private Integer saved;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponMessageType;
+
+    /**
+     *商品ID
+     */
+    private Integer productId;
+
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Integer getClubId() {
+        return clubId;
+    }
+
+    public void setClubId(Integer clubId) {
+        this.clubId = clubId;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getCouponType() {
+        return couponType;
+    }
+
+    public void setCouponType(Integer couponType) {
+        this.couponType = couponType;
+    }
+
+    public Double getCouponFee() {
+        return couponFee;
+    }
+
+    public void setCouponFee(Double couponFee) {
+        this.couponFee = couponFee;
+    }
+
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    public void setMainImage(String mainImage) {
+        this.mainImage = mainImage;
+    }
+
+    public Integer getOnlinePayFlag() {
+        return onlinePayFlag;
+    }
+
+    public void setOnlinePayFlag(Integer onlinePayFlag) {
+        this.onlinePayFlag = onlinePayFlag;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public Integer getShopTieredType() {
+        return shopTieredType;
+    }
+
+    public void setShopTieredType(Integer shopTieredType) {
+        this.shopTieredType = shopTieredType;
+    }
+
+    public Integer getSaved() {
+        return saved;
+    }
+
+    public void setSaved(Integer saved) {
+        this.saved = saved;
+    }
+
+    public Integer getCouponMessageType() {
+        return couponMessageType;
+    }
+
+    public void setCouponMessageType(Integer couponMessageType) {
+        this.couponMessageType = couponMessageType;
+    }
+
+    public Integer getUserType() {
+        return userType;
+    }
+
+    public void setUserType(Integer userType) {
+        this.userType = userType;
+    }
+
+    public Integer getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(Integer messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public Integer getAccountType() {
+        return accountType;
+    }
+
+    public void setAccountType(Integer accountType) {
+        this.accountType = accountType;
+    }
+
+    public Integer getShopMessType() {
+        return shopMessType;
+    }
+
+    public void setShopMessType(Integer shopMessType) {
+        this.shopMessType = shopMessType;
+    }
+
+    public Integer getOrderMessageType() {
+        return orderMessageType;
+    }
+
+    public void setOrderMessageType(Integer orderMessageType) {
+        this.orderMessageType = orderMessageType;
+    }
+}

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

@@ -32,7 +32,7 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private Integer provinceID;
     private Integer cityID;
     private String address;        // 地址
-    private Double registeredCapital;        // 注册资本
+    private String registeredCapital;        // 注册资本
     private String nature;        // 公司性质
     private String turnover;        // 年营业额
     private String linkMan;        // 联系人
@@ -293,11 +293,11 @@ public class NewCmShop extends DataEntity<NewCmShop> {
         this.address = address;
     }
 
-    public Double getRegisteredCapital() {
+    public String getRegisteredCapital() {
         return registeredCapital;
     }
 
-    public void setRegisteredCapital(Double registeredCapital) {
+    public void setRegisteredCapital(String registeredCapital) {
         this.registeredCapital = registeredCapital;
     }
 

+ 41 - 0
src/main/java/com/caimei/modules/user/service/NewCmShopService.java

@@ -7,6 +7,7 @@ import java.util.Objects;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.cibe.entity.ShopCert;
 import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.order.entity.CmDiscernReceipt;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.dao.CmUserDao;
 import com.caimei.modules.user.entity.SplitCode;
@@ -342,4 +343,44 @@ public class NewCmShopService extends CrudService<NewCmShopDao, NewCmShop> {
     public void online(NewCmShop newCmShop) {
         newCmShopDao.online(newCmShop);
     }
+
+    public Page<CmDiscernReceipt>maintenanceList(Page<CmDiscernReceipt> page,CmDiscernReceipt cmDiscernReceipt){
+        cmDiscernReceipt.setPage(page);
+        page.setList(newCmShopDao.maintenanceList(cmDiscernReceipt));
+        return page;
+    }
+    @Transactional(readOnly = false)
+    public void Removethelastfee(CmDiscernReceipt cmDiscernReceipt) {
+        newCmShopDao.Removethelastfee(cmDiscernReceipt);
+    }
+
+    @Transactional(readOnly = false)
+    public void Removethelast(CmDiscernReceipt cmDiscernReceipt) {
+        newCmShopDao.Removethelast(cmDiscernReceipt);
+    }
+
+    @Transactional(readOnly = false)
+    public void addthelast(CmDiscernReceipt cmDiscernReceipt) {
+        newCmShopDao.addthelast(cmDiscernReceipt);
+    }
+
+    @Transactional(readOnly = false)
+    public void cmreceipt(CmDiscernReceipt cmDiscernReceipt) {
+        newCmShopDao.cmreceipt(cmDiscernReceipt);
+    }
+
+    @Transactional(readOnly = false)
+    public CmDiscernReceipt cmrectiptlist(Integer shopID) {
+        return newCmShopDao.cmrectiptlist(shopID);
+    }
+    @Transactional(readOnly = false)
+    public Integer cmrectCount(Integer shopID) {
+        return newCmShopDao.cmrectCount(shopID);
+    }
+
+    @Transactional(readOnly = false)
+    public Integer therectip() {
+        return newCmShopDao.therectip();
+    }
+
 }

+ 2 - 2
src/main/java/com/caimei/modules/user/web/CmOperationUserController.java

@@ -99,7 +99,7 @@ public class CmOperationUserController extends BaseController {
 			}
 			String mobile = cmOperationUser.getMobile();
 			if (StringUtils.isNotEmpty(mobile)) {
-				SMSUtils.sendSms(mobile, "欢迎加入"+clubName+",您的邀请码为:"+flag+",您可在微信搜索“星范采购商城”小程序,输入邀请码进行登录。");
+				SMSUtils.sendSms(0,mobile, "欢迎加入"+clubName+",您的邀请码为:"+flag+",您可在微信搜索“星范采购商城”小程序,输入邀请码进行登录。");
 			}
 			cmOperationUserService.save(cmOperationUser);
 		}
@@ -223,7 +223,7 @@ public class CmOperationUserController extends BaseController {
 			}
 			String mobile = cmOperationUser.getMobile();
 			if (StringUtils.isNotEmpty(mobile)) {
-				SMSUtils.sendSms(mobile, "欢迎加入"+clubName+",您的邀请码为:"+flag+",您可在微信搜索“星范采购商城”小程序,输入邀请码进行登录。");
+				SMSUtils.sendSms(0,mobile, "欢迎加入"+clubName+",您的邀请码为:"+flag+",您可在微信搜索“星范采购商城”小程序,输入邀请码进行登录。");
 			}
 		}
 		if(StringUtils.isEmpty(cmOperationUser.getId())){//新增

+ 2 - 2
src/main/java/com/caimei/modules/user/web/NewCmClubController.java

@@ -212,7 +212,7 @@ public class NewCmClubController extends BaseController {
                 cmUser.setBindMobile(mobile);
                 cmUserService.update(cmUser);
                 String content = "会所企业账号绑定手机号已修改成功,可使用当前手机号进行密码修改等操作。";
-                SMSUtils.sendSms(mobile, content);
+                SMSUtils.sendSms(0,mobile, content);
 
                 map.put("success", true);
                 map.put("msg", "修改成功");
@@ -657,4 +657,4 @@ public class NewCmClubController extends BaseController {
         return jsonModel.success(Global.getAdminPath() + "/user/newCmClub/?repage");
     }
 
-}
+}

+ 214 - 21
src/main/java/com/caimei/modules/user/web/NewCmShopController.java

@@ -2,9 +2,14 @@ package com.caimei.modules.user.web;
 
 import com.caimei.constants.ShopStatus;
 import com.caimei.modules.opensearch.CoreServiceUitls;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.entity.CmDiscernReceipt;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.sys.utils.CmMsgUtils;
 import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.entity.*;
 import com.caimei.modules.user.service.*;
@@ -33,6 +38,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -62,7 +68,16 @@ public class NewCmShopController extends BaseController {
     private NewCmShopDao newCmShopDao;
     @Autowired
     CmOperationalLogService cmOperationalLogService;
-
+    @Autowired
+    private SysLogService sysLogService;
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+    @Autowired
+    NewOrderService newOrderService;
+    @Autowired
+    NewShopOrderDao newShopOrderDao;
+    @Autowired
+    WeChatService weChatService;
 
     @ModelAttribute
     public NewCmShop get(@RequestParam(required = false) String id) {
@@ -172,6 +187,151 @@ public class NewCmShopController extends BaseController {
         return "modules/user/newCmShopForm";
     }
 
+
+    @RequestMapping(value = "maintenanceList")
+    public String maintenanceList(CmDiscernReceipt cmDiscernReceipt, HttpServletRequest request, HttpServletResponse response, Model model) throws ParseException {
+        //获取供应商证书信息
+        Page<CmDiscernReceipt>discernReceipt = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20),cmDiscernReceipt);
+        String date="";
+        int num=0;
+
+
+        Date currentTime = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar calendar = Calendar.getInstance();
+        Calendar calendars = Calendar.getInstance();
+        //当前时间
+        String dateString = formatter.format(currentTime);
+        //到期时间
+        String dateStrings ="";
+        //生效时间
+        String validityDate="";
+        for(int i=0;i<discernReceipt.getList().size();i++){
+            CmDiscernReceipt cmDiscern=  newCmShopService.cmrectiptlist(discernReceipt.getList().get(i).getShopID());
+            //缴纳时间
+            String receiptDate=discernReceipt.getList().get(i).getReceiptDate();
+            if(!receiptDate.contains(":")){
+                receiptDate+=" 00:00:01";
+            }
+            Date receipttime = formatter.parse(receiptDate);
+//如果没有缴费记录
+            if(null==cmDiscern){
+                //缴纳时间加一年==到期时间
+                calendar.setTime(receipttime);
+                calendar.add(Calendar.YEAR, 1);
+                dateStrings= formatter.format(calendar.getTime());
+                calendars.setTime(receipttime);
+                calendars.add(Calendar.DATE, 1);
+                validityDate= formatter.format(calendars.getTime());
+                cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
+                logger.info("getReceiptID>>>>>"+discernReceipt.getList().get(i).getReceiptID());
+                cmDiscernReceipt.setValidityDate(receiptDate);
+                logger.info("receiptDate>>>>>"+receiptDate);
+                cmDiscernReceipt.setExpirationDate(dateStrings);
+                logger.info("dateStrings>>>>>"+dateStrings);
+                newCmShopService.cmreceipt(cmDiscernReceipt);
+            }
+            if(null!=cmDiscern && cmDiscern.getReceStatct()!=2 && cmDiscern.getReceStatct()!=1) {
+                Integer count=newCmShopService.cmrectCount(discernReceipt.getList().get(i).getShopID());
+                System.out.println("count>>"+count+"size>>"+discernReceipt.getList().size());
+                String receipt=cmDiscern.getExpirationDate();
+                if(!receipt.contains(":")){
+                    receipt+=" 00:00:01";
+                }
+                calendars.setTime(receipttime);
+                calendars.add(Calendar.DATE, -1);
+                String letdele= formatter.format(calendars.getTime());
+                Date rece = formatter.parse(receipt);
+                calendar.setTime(rece);
+                calendar.add(Calendar.YEAR, 1);
+                dateStrings= formatter.format(calendar.getTime());
+                if(!cmDiscern.getReceiptID().equals(discernReceipt.getList().get(i).getReceiptID())){
+                    if(count != discernReceipt.getList().size()){
+                        num = receipt.compareTo(dateString);
+                        logger.info(">>>>>>"+num);
+                        if(num>0){
+                            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
+                            cmDiscernReceipt.setValidityDate(cmDiscern.getExpirationDate());
+                            cmDiscernReceipt.setExpirationDate(dateStrings);
+                            newCmShopService.cmreceipt(cmDiscernReceipt);
+                        } else {
+                            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
+                            cmDiscernReceipt.setValidityDate(validityDate);
+                            cmDiscernReceipt.setExpirationDate(dateStrings);
+                            newCmShopService.cmreceipt(cmDiscernReceipt);
+                        }
+                    }
+                }
+            }
+
+            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
+            cmDiscernReceipt.setLinkMan(discernReceipt.getList().get(i).getLinkMan());
+            System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+num);
+            System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+"1:"+date+"2:"+dateStrings+"3:"+dateString);
+        }
+        Page<CmDiscernReceipt>discernReceip = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20),cmDiscernReceipt);
+        model.addAttribute("CmDiscernReceipt", cmDiscernReceipt);
+        model.addAttribute("discernReceipt", discernReceip);
+        return "modules/user/maintenanceList";
+    }
+
+    @RequestMapping(value = "Removethelastfee")
+    public String Removethelastfee(CmDiscernReceipt cmDiscernReceipt,Model model) {
+        CmOperationalLogs sysLog = new CmOperationalLogs();
+        Date currentTime = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        //当前时间
+        String dateString = formatter.format(currentTime);
+
+        //获取操作时间
+        sysLog.setOperationtime(new Date());
+        newCmShopService.addthelast(cmDiscernReceipt);
+        cmDiscernReceipt.setReceiptID(newCmShopService.therectip().toString());
+        newCmShopService.cmreceipt(cmDiscernReceipt);
+        //获取操作员
+        SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
+        System.out.println("操作员" + principal.getName());
+        String username = principal.getName();
+        sysLog.setOperator(username);
+        sysLog.setActioncontent("免除上架费");
+        sysLog.setContact(cmDiscernReceipt.getLinkMan());
+        sysLog.setInstitutionName(cmDiscernReceipt.getShopName());
+        sysLog.setOperationtype("编辑");
+        if (!"".equals(sysLog.getActioncontent())) {
+            if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
+                int i = cmOperationalLogService.insert(sysLog);
+            }
+
+        }
+        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID="+cmDiscernReceipt.getShopID()+"&shopName"+cmDiscernReceipt.getShopName();
+    }
+    @RequestMapping(value = "Removethelast")
+    public String Removethelast(CmDiscernReceipt cmDiscernReceipt,Model model)
+    {
+        CmOperationalLogs sysLog = new CmOperationalLogs();
+        newCmShopService.Removethelast(cmDiscernReceipt);
+        //获取操作时间
+        sysLog.setOperationtime(new Date());
+
+        //获取操作员
+        SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
+        System.out.println("操作员" + principal.getName());
+        sysLog.setActioncontent("取消免除上架费");
+        String username = principal.getName();
+        sysLog.setOperator(username);
+        sysLog.setContact(cmDiscernReceipt.getLinkMan());
+        sysLog.setInstitutionName(cmDiscernReceipt.getShopName());
+        sysLog.setOperationtype("编辑");
+        if (!"".equals(sysLog.getActioncontent())) {
+            if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
+                int i = cmOperationalLogService.insert(sysLog);
+            }
+
+        }
+
+        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID="+cmDiscernReceipt.getShopID()+"&shopName"+cmDiscernReceipt.getShopName();
+    }
+
     /**
      * 供应商审核
      *
@@ -214,7 +374,19 @@ public class NewCmShopController extends BaseController {
                     }
                 }
                 manufacturerStatus = "90";
-                smsMessage = "恭喜您成功通过资料审核,您可以使用账号" + mobile + "在采美登录您的企业账号,开始愉快的采购之旅。";
+                smsMessage = "您提供的资料已审核通过,恭喜您成为采美平台供应商用户。您可通过申请时填写的手机号和密码登录采美平台管理您的账户。";
+                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(shopId);
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(1);
+                messageCenter.setContent(null);
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+
+
             }
             if (StringUtils.equals("2", auditStatus)) {
                 //获取操作时间
@@ -228,14 +400,32 @@ public class NewCmShopController extends BaseController {
                 sysLog.setContact(newCmShops.getLinkMan());
                 sysLog.setInstitutionName(newCmShops.getName());
                 sysLog.setOperationtype("审核");
-                    sysLog.setActioncontent("审核失败");
+                sysLog.setActioncontent("审核失败");
                 if (!"".equals(sysLog.getActioncontent())) {
                     if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
                         int i = cmOperationalLogService.insert(sysLog);
                     }
                 }
                 manufacturerStatus = "92";
-                smsMessage = "很遗憾,您的资料信息有误,未通过审核,请登录采美修改资料信息。";
+                smsMessage = "您提供的资料未通过审核,申请采美平台供应商账户失败。请使用申请时填写的手机号和密码登录采美平台进行信息修改后,重新提交审核。";
+                try {
+                    logger.info("********供应商审核失败微信公众号推送********");
+                    String unionid = newShopOrderDao.UnionId(userId);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    logger.info("userid>>>>>>>>>>>>>>>" + userId + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
+                    String accessToken = weChatService.getAccessToken();
+                    String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+
+                    String pagePath = "/pages/login/apply-supplier";
+                    for (String openid : openidList) {
+                        weChatService.sendTemplate(accessToken, openid,newCmShops.getName(),auditNote,auditTime, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
+                }
+
+
+
             }
             // 更新用户信息
             newCmShopService.updateUserAudit(auditStatus, auditNote, format, manufacturerStatus, userId, "1");
@@ -245,11 +435,13 @@ public class NewCmShopController extends BaseController {
             newCmShopService.updateShopAudit(auditStatus, auditNote, format, name, manufacturerStatus, shopId);
             map.put("success", true);
             map.put("msg", "审核成功");
-
-
-
             if (StringUtils.isNotEmpty(mobile)) {
-                SMSUtils.sendSms(mobile, smsMessage);
+                boolean sendSms = newOrderService.getSendSms(9, mobile, smsMessage);
+                if(sendSms){
+                    logger.info(">>>>>>>获得供应商账户审核短信推送成功");
+                }else {
+                    SMSUtils.sendSms(0,mobile, smsMessage);
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -479,7 +671,7 @@ public class NewCmShopController extends BaseController {
                 cmUser.setBindMobile(mobile);
                 cmUserService.update(cmUser);
                 String content = "供应商企业账号绑定手机号已修改成功,可使用当前手机号进行密码修改等操作。";
-                SMSUtils.sendSms(mobile, content);
+                SMSUtils.sendSms(0,mobile, content);
 
                 map.put("success", true);
                 map.put("msg", "修改成功");
@@ -577,14 +769,15 @@ public class NewCmShopController extends BaseController {
 
         CmOperationalLogs sysLog = new CmOperationalLogs();
 
-        if (newCmShops.getMaintenanceFee() == "0") {
-            if (!newCmShop.getMaintenanceFee().equals("0")) {
-                list.add("新增了线上分账商户号");
-            }
-        } else if (!newCmShop.getMaintenanceFee().equals(newCmShops.getMaintenanceFee())) {
-            list.add("修改了线上分账商户号");
-        }
-
+//        if (newCmShops.getMaintenanceFee() == "0") {
+//            if (!newCmShop.getMaintenanceFee().equals("0")) {
+//                list.add("新增了线上分账商户号");
+//            }
+//        }  else {
+//            if (!newCmShop.getMaintenanceFee().equals(newCmShops.getMaintenanceFee())) {
+//                list.add("修改了线上分账商户号");
+//            }
+//        }
         if (newCmShops.getName() == null) {
             if (!newCmShop.getName().equals("")) {
                 list.add("新增了公司名称");
@@ -658,7 +851,7 @@ public class NewCmShopController extends BaseController {
         }
 
         if (newCmShops.getRegisteredCapital() == null) {
-            if (newCmShop.getRegisteredCapital()!=null) {
+            if (newCmShop.getRegisteredCapital().equals("")) {
                 list.add("新增了注册资本");
             }
         }
@@ -713,7 +906,7 @@ public class NewCmShopController extends BaseController {
             }
         }
 
-         if (!newCmShop.getBusinessScope().equals(newCmShops.getBusinessScope())) {
+        if (!newCmShop.getBusinessScope().equals(newCmShops.getBusinessScope())) {
             list.add("修改了医疗类型");
         }
 
@@ -730,7 +923,7 @@ public class NewCmShopController extends BaseController {
                 list.add("新增了微信公众号");
             }
         }
-            if (!newCmShop.getWxOfficialAccount().equals(newCmShops.getWxOfficialAccount())) {
+        if (!newCmShop.getWxOfficialAccount().equals(newCmShops.getWxOfficialAccount())) {
             list.add("修改了微信公众号");
         }
 
@@ -747,7 +940,7 @@ public class NewCmShopController extends BaseController {
                 list.add("新增了营业执照编号");
             }
         }
-      if (!newCmShop.getSocialCreditCode().equals(newCmShops.getSocialCreditCode())) {
+        if (!newCmShop.getSocialCreditCode().equals(newCmShops.getSocialCreditCode())) {
             list.add("修改了营业执照编号");
         }
 

+ 65 - 4
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -3,12 +3,15 @@ package com.caimei.modules.user.web.newUser;
 import com.caimei.constants.ClubStatus;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.product.service.CmShoporderService;
 import com.caimei.modules.project.model.ServiceProviderModel;
 import com.caimei.modules.sys.utils.CmMsgUtils;
 import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.aop.OperationLogAnnotation;
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.entity.*;
 import com.caimei.modules.user.service.*;
 import com.caimei.utils.AppKeys;
@@ -80,7 +83,12 @@ public class AgencyController extends BaseController {
     private CmOperationUserService cmOperationUserService;
     @Autowired
     private SysLogService sysLogService;
-
+    @Autowired
+    private MessageCenterDao messageCenterDao;
+    @Autowired
+    private NewShopOrderDao newShopOrderDao;
+    @Autowired
+    private WeChatService weChatService;
     @ModelAttribute
     public NewCmClub get(@RequestParam(required = false) String id) {
         NewCmClub entity = null;
@@ -845,14 +853,40 @@ public class AgencyController extends BaseController {
                         int i = sysLogService.insert(sysLog);
                     }
                 }
-
-
+                Date date = new Date();
+                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                MessageCenter messageCenter=new MessageCenter();
+                messageCenter.setShopId(null);
+                messageCenter.setClubId(newCmClub.getClubID());
+                messageCenter.setUserType(1);
+                messageCenter.setMessageType(2);
+                messageCenter.setContent(null);
+                messageCenter.setTime(curDateStr);
+                messageCenter.setAccountType(5);
+                messageCenterDao.addMessageCenter(messageCenter);
 
                 userPermission = 2;
                 status = "90";
                 auditStatus = "1";
                 companyUser.setRegisterUserTypeID("3");
                 companyUser.setUserPermission(userPermission);
+
+                try {
+                    logger.info("********资质机构审核成功微信公众号推送********");
+                    Integer userID = companyUserID;
+                    String unionid = newShopOrderDao.UnionId(userID);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    logger.info("userid>>>>>>>>>>>>>>>" + userID + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
+                    String accessToken = weChatService.getAccessToken();
+                    String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+
+                    String pagePath = "https://www.caimei365.com/";
+                    for (String openid : openidList) {
+                        weChatService.sendTemplateMsg(accessToken, openid,auditTime, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【资质机构审核成功通知】获取微信公众号access_token异常!", e);
+                }
                 //审核通过升级为会员机构
                 companyUser.setUserIdentity(2);
                 smsMessage = "恭喜您成功升级为资质机构用户!快戳采美网站链接www.caimei365.com或微信搜索“采美采购商城”小程序登录采美平台享受更多更好的服务吧。" +
@@ -860,6 +894,33 @@ public class AgencyController extends BaseController {
                 int userBeans = companyUser.getUserBeans() == null ? 0 : companyUser.getUserBeans();
                 companyUser.setUserBeans(userBeans + 500);
             } else {
+                Date date = new Date();
+                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                MessageCenter messageCenter=new MessageCenter();
+                messageCenter.setShopId(null);
+                messageCenter.setClubId(newCmClub.getClubID());
+                messageCenter.setUserType(1);
+                messageCenter.setMessageType(2);
+                messageCenter.setAccountType(6);
+                messageCenter.setContent(null);
+                messageCenter.setTime(curDateStr);
+                messageCenterDao.addMessageCenter(messageCenter);
+                try {
+                    logger.info("********资质机构审核失败微信公众号推送********");
+                    Integer userID = companyUserID;
+                    String unionid = newShopOrderDao.UnionId(userID);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    logger.info("userid>>>>>>>>>>>>>>>" + userID + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
+                    String accessToken = weChatService.getAccessToken();
+                    String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    String auditResult=auditNote;
+                    String pagePath = "https://www.caimei365.com/";
+                    for (String openid : openidList) {
+                        weChatService.sendTemplateMessg(accessToken, openid,auditResult,auditTime, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【资质机构审核失败通知】获取微信公众号access_token异常!", e);
+                }
                 //审核未通过,普通机构权限
                 userPermission = 5;
                 companyUser.setUserPermission(userPermission);
@@ -924,7 +985,7 @@ public class AgencyController extends BaseController {
             sendMessage("1", companyUser.getUserID(), title, messageContent);
             /**发送短信*/
             if (StringUtils.isNotEmpty(mobile)) {
-                SMSUtils.sendSms(mobile, smsMessage);
+                SMSUtils.sendSms(0,mobile, smsMessage);
             }
             map.put("success", true);
             map.put("msg", "操作成功");

+ 3 - 3
src/main/java/com/caimei/modules/weisha/service/CmOrganizeBuyerService.java

@@ -72,7 +72,7 @@ public class CmOrganizeBuyerService extends CrudService<CmOrganizeBuyerDao, CmOr
             //发送短信
             String mobile = cmOrganizeBuyer.getMobile();
             if (StringUtils.isNotEmpty(mobile)) {
-                SMSUtils.sendSms(mobile, "您的邀请码为:" + flag + ",在微信搜索“维沙采购商城”小程序,使用邀请码进行登录后,即可开始采购。");
+                SMSUtils.sendSms(0,mobile, "您的邀请码为:" + flag + ",在微信搜索“维沙采购商城”小程序,使用邀请码进行登录后,即可开始采购。");
             }
         }
         cmOrganizeBuyer.setUpdateTime(date);
@@ -117,7 +117,7 @@ public class CmOrganizeBuyerService extends CrudService<CmOrganizeBuyerDao, CmOr
             //发送短信
             String mobile = cmOrganizeBuyer.getMobile();
             if (StringUtils.isNotEmpty(mobile)) {
-                SMSUtils.sendSms(mobile, "您的邀请码为:" + flag + ",在微信搜索“维沙采购商城”小程序,使用邀请码进行登录后,即可开始采购。");
+                SMSUtils.sendSms(0,mobile, "您的邀请码为:" + flag + ",在微信搜索“维沙采购商城”小程序,使用邀请码进行登录后,即可开始采购。");
             }
             cmOrganizeBuyer.setUpdateTime(date);
             organizeBuyerDao.update(cmOrganizeBuyer);
@@ -129,4 +129,4 @@ public class CmOrganizeBuyerService extends CrudService<CmOrganizeBuyerDao, CmOr
         cmOrganizeBuyer.setDelFlag("1");
         organizeBuyerDao.update(cmOrganizeBuyer);
     }
-}
+}

+ 23 - 19
src/main/java/com/thinkgem/jeesite/modules/sys/web/LoginController.java

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.redis.RedisService;
 import org.apache.shiro.authz.UnauthorizedException;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -46,7 +47,8 @@ public class LoginController extends BaseController{
 	private RedisService redisService;
 	@Autowired
 	private SessionDAO sessionDAO;
-	
+	@Autowired
+	MessageCenterDao messageCenterDao;
 	/**
 	 * 管理登录
 	 */
@@ -59,16 +61,16 @@ public class LoginController extends BaseController{
 //		if (tabmode == null){
 //			CookieUtils.setCookie(response, "tabmode", "1");
 //		}
-		
+
 		if (logger.isDebugEnabled()){
 			logger.debug("login, active session size: {}", sessionDAO.getActiveSessions(false).size());
 		}
-		
+
 		// 如果已登录,再次访问主页,则退出原账号。
 		if (Global.TRUE.equals(Global.getConfig("notAllowRefreshIndex"))){
 			CookieUtils.setCookie(response, "LOGINED", "false");
 		}
-		
+
 		// 如果已经登录,则跳转到管理首页
 		if(principal != null && !principal.isMobileLogin()){
 			return "redirect:" + adminPath;
@@ -88,7 +90,7 @@ public class LoginController extends BaseController{
 	@RequestMapping(value = "${adminPath}/login", method = RequestMethod.POST)
 	public String loginFail(HttpServletRequest request, HttpServletResponse response, Model model) {
 		Principal principal = UserUtils.getPrincipal();
-		
+
 		// 如果已经登录,则跳转到管理首页
 		if(principal != null){
 			return "redirect:" + adminPath;
@@ -99,7 +101,7 @@ public class LoginController extends BaseController{
 		boolean mobile = WebUtils.isTrue(request, FormAuthenticationFilter.DEFAULT_MOBILE_PARAM);
 		String exception = (String)request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
 		String message = (String)request.getAttribute(FormAuthenticationFilter.DEFAULT_MESSAGE_PARAM);
-		
+
 		if (StringUtils.isBlank(message) || StringUtils.equals(message, "null")){
 			message = "用户或密码错误, 请重试.";
 		}
@@ -109,25 +111,25 @@ public class LoginController extends BaseController{
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_MOBILE_PARAM, mobile);
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, exception);
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_MESSAGE_PARAM, message);
-		
+
 		if (logger.isDebugEnabled()){
-			logger.debug("login fail, active session size: {}, message: {}, exception: {}", 
+			logger.debug("login fail, active session size: {}, message: {}, exception: {}",
 					sessionDAO.getActiveSessions(false).size(), message, exception);
 		}
-		
+
 		// 非授权异常,登录失败,验证码加1。
 		if (!UnauthorizedException.class.getName().equals(exception)){
 			model.addAttribute("isValidateCodeLogin", isValidateCodeLogin(username, true, false));
 		}
-		
+
 		// 验证失败清空验证码
 		request.getSession().setAttribute(ValidateCodeServlet.VALIDATE_CODE, IdGen.uuid());
-		
+
 		// 如果是手机登录,则返回JSON字符串
 		if (mobile){
 	        return renderString(response, model);
 		}
-		
+
 		return "modules/sys/sysLogin";
 	}
 
@@ -136,17 +138,19 @@ public class LoginController extends BaseController{
 	 */
 	@RequiresPermissions("user")
 	@RequestMapping(value = "${adminPath}")
-	public String index(HttpServletRequest request, HttpServletResponse response) {
+	public String index(HttpServletRequest request, HttpServletResponse response,Model model) {
 		redisService.set("onLineFlag","online",36000l);//设置10小时有效(提供老admin系统免登入)
 		Principal principal = UserUtils.getPrincipal();
+		Integer count=messageCenterDao.count();
+		model.addAttribute("count",count);
 
 		// 登录成功后,验证码计算器清零
 		isValidateCodeLogin(principal.getLoginName(), false, true);
-		
+
 		if (logger.isDebugEnabled()){
 			logger.debug("show index, active session size: {}", sessionDAO.getActiveSessions(false).size());
 		}
-		
+
 		// 如果已登录,再次访问主页,则退出原账号。
 		if (Global.TRUE.equals(Global.getConfig("notAllowRefreshIndex"))){
 			String logined = CookieUtils.getCookie(request, "LOGINED");
@@ -157,7 +161,7 @@ public class LoginController extends BaseController{
 				return "redirect:" + adminPath + "/login";
 			}
 		}
-		
+
 		// 如果是手机登录,则返回JSON字符串
 		if (principal.isMobileLogin()){
 			if (request.getParameter("login") != null){
@@ -168,7 +172,7 @@ public class LoginController extends BaseController{
 			}
 			return "redirect:" + adminPath + "/login";
 		}
-		
+
 //		// 登录成功后,获取上次登录的当前站点ID
 //		UserUtils.putCache("siteId", StringUtils.toLong(CookieUtils.getCookie(request, "siteId")));
 
@@ -188,7 +192,7 @@ public class LoginController extends BaseController{
 //		System.out.println("==========================b");
 		return "modules/sys/sysIndex";
 	}
-	
+
 	/**
 	 * 获取主题方案
 	 */
@@ -201,7 +205,7 @@ public class LoginController extends BaseController{
 		}
 		return "redirect:"+request.getParameter("url");
 	}
-	
+
 	/**
 	 * 是否是验证码登录
 	 * @param useruame 用户名

+ 2 - 1
src/main/resources/mappings/modules/common/AreaMapper.xml

@@ -28,7 +28,8 @@
 		,c.townId as "townID"
 		FROM province a
 			RIGHT JOIN city b ON a.provinceId = b.provinceId
-			RIGHT JOIN town c ON b.cityId = c.cityId WHERE c.townId = #{townId}
+			RIGHT JOIN town c ON b.cityId = c.cityId WHERE  c.townId = #{townId}
+
 	</select>
 
 	<select id="loadCityById" resultType="com.caimei.modules.common.entity.City">

+ 4 - 1
src/main/resources/mappings/modules/info/InfoMapper.xml

@@ -65,7 +65,7 @@
 		FROM info a
 		<include refid="infoJoins"/>
 		<where>
-
+			delFlag = 0
 			<if test="id != null and id != ''">
 				AND a.id = #{id}
 			</if>
@@ -260,6 +260,9 @@
 		DELETE FROM info_page
 		WHERE infoId = #{param1}
 	</delete>
+	<update id="deleteInfo">
+		update info set enabledStatus = 0, delFlag = 1 where id = #{id};
+	</update>
 
 	<update id="updateEnabledStatusByIds">
 		UPDATE info a SET a.enabledStatus = #{param1}

+ 98 - 17
src/main/resources/mappings/modules/newhome/NewPageFloorMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.newhome.dao.NewPageFloorDao">
-    
+
 	<sql id="newPageFloorColumns">
 		a.id AS "id",
 		a.floorTitle AS "floorTitle",
@@ -14,26 +14,49 @@
 		a.createDate AS "createDate",
 		a.updateBy AS "updateBy.id",
 		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag"
+		a.delFlag AS "delFlag",
+        a.floorType AS "floorType"
 	</sql>
-	
+
 	<sql id="newPageFloorJoins">
 	</sql>
-    
+
 	<select id="get" resultType="NewPageFloor">
-		SELECT 
+		SELECT
 			<include refid="newPageFloorColumns"/>
 		FROM new_page_floor a
 		<include refid="newPageFloorJoins"/>
 		WHERE a.id = #{id}
 	</select>
-	
+
 	<select id="findList" resultType="NewPageFloor">
-		SELECT 
+		SELECT
 			<include refid="newPageFloorColumns"/>
 		FROM new_page_floor a
 		<include refid="newPageFloorJoins"/>
 		<where>
+			and floorType IS NULL
+			AND delFlag = 0
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+
+
+	<select id="floorFindList" resultType="NewPageFloor">
+		SELECT
+		<include refid="newPageFloorColumns"/>
+		FROM new_page_floor a
+		<include refid="newPageFloorJoins"/>
+
+		<where>
+			and floorType
+
 			AND delFlag = 0
 		</where>
 		<choose>
@@ -44,15 +67,17 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
+
+
 	<select id="findAllList" resultType="NewPageFloor">
-		SELECT 
+		SELECT
 			<include refid="newPageFloorColumns"/>
 		FROM new_page_floor a
 		<include refid="newPageFloorJoins"/>
 		<where>
-			
-		</where>		
+
+		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
@@ -61,7 +86,7 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<insert id="insert" parameterType="NewPageFloor"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO new_page_floor(
 			floorTitle,
@@ -70,6 +95,9 @@
 			<if test="sort != null and sort != ''" >
 				sort,
 			</if>
+		<if test="floorType != null and floorType != ''" >
+			floorType,
+		</if>
 			wwwEnabledStatus,
 			crmEnabledStatus,
 			createBy,
@@ -84,6 +112,9 @@
 			<if test="sort != null and sort != ''" >
 				#{sort},
 			</if>
+		<if test="floorType != null and floorType != ''" >
+			#{floorType},
+		</if>
 			#{wwwEnabledStatus},
 			#{crmEnabledStatus},
 			#{createBy.id},
@@ -93,13 +124,14 @@
 			#{delFlag}
 		)
 	</insert>
-	
+
 	<update id="update">
-		UPDATE new_page_floor SET 	
+		UPDATE new_page_floor SET
 			floorTitle = #{floorTitle},
 			floorDetail = #{floorDetail},
 			type = #{type},
 			sort = #{sort},
+			floorType=#{floorType},
 			wwwEnabledStatus = #{wwwEnabledStatus},
 			crmEnabledStatus = #{crmEnabledStatus},
 			createBy = #{createBy.id},
@@ -109,7 +141,7 @@
 			delFlag = #{delFlag}
 		WHERE id = #{id}
 	</update>
-	
+
 	<delete id="delete">
 		UPDATE new_page_floor SET delFlag = 1
 		WHERE id = #{id}
@@ -136,6 +168,41 @@
 		WHERE id = #{id}
 	</update>
 
+	<update id="savesortIndex">
+		UPDATE product SET
+			sortIndex = #{sortIndex}
+		WHERE productID = #{productID}
+	</update>
+	<update id="updateshowTime">
+		UPDATE product SET
+			newshowTime=#{newshowTime},
+			showTime = #{showTime}
+		WHERE productID = #{productID}
+	</update>
+	<update id="updatshowFlag">
+		UPDATE product SET
+		showFlag=#{showFlag},
+		recommend=#{recommend}
+		WHERE productID = #{productID}
+	</update>
+
+	<update id="updatrecommend">
+		UPDATE product SET
+			recommend=#{recommend},
+		<if test="recommend==1">
+			sortIndex=1000
+		</if>
+		<if test="recommend==0">
+			sortIndex=1
+		</if>
+		WHERE productID = #{productID}
+	</update>
+
+	<select id="countrecommend" resultType="java.lang.Integer">
+		SELECT COUNT(recommend) FROM product
+		WHERE recommend=1
+	</select>
+
 	<select id="findFloorContentByfloorId" resultType="com.caimei.modules.newhome.entity.NewPageFloorContent">
 		SELECT
 		  npfc.*,
@@ -147,6 +214,20 @@
 		  npf.id = #{floorId}
 	</select>
 
+<!--	<select id="findFloorContentById" resultType="com.caimei.modules.newhome.entity.NewPageFloorContent">-->
+<!--		SELECT-->
+<!--			npfc.*,-->
+<!--			npf.floorTitle AS floorTitle-->
+<!--		FROM product pro-->
+<!--		    LEFT JOIN new_page_floor_content npfc ON npfc.productId=pro.productID-->
+<!--			LEFT join new_page_floor npf ON npfc.floorId = npf.id-->
+
+<!--		WHERE-->
+<!--			npf.id = #{floorId}-->
+<!--	</select>-->
+
+
+
 	<select id="findFloorImage" resultType="com.caimei.modules.newhome.entity.NewPageFloorImage">
 		SELECT
 		  a.id,
@@ -258,5 +339,5 @@
 			#{sort}, #{createDate}, #{centreId}, #{displaySort}
 		  )
 	</insert>
-	
-</mapper>
+
+</mapper>

+ 9 - 8
src/main/resources/mappings/modules/newhome/NewPageHomeimageMapper.xml

@@ -52,13 +52,7 @@
 				AND a.crmEnabledStatus = 	#{crmEnabledStatus}
 			</if>
 		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy},a.createDate desc
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
+			ORDER BY a.sort desc,a.createDate desc
 	</select>
 	
 	<select id="findAllList" resultType="NewPageHomeimage">
@@ -77,7 +71,10 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+	<select id="findBigSort" resultType="java.lang.String">
+		SELECT sort FROM new_page_homeimage ORDER BY sort DESC LIMIT 1
+	</select>
+
 	<insert id="insert" parameterType="NewPageHomeimage"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO new_page_homeimage(
 			title,
@@ -152,4 +149,8 @@
 			#{id}
 		</foreach>
 	</update>
+	<update id="updateSort">
+		update new_page_homeimage set sort=#{sort}
+		where id= #{id}
+	</update>
 </mapper>

+ 89 - 2
src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml

@@ -33,7 +33,8 @@
 		a.reviewDate AS "reviewDate",
 		a.cancelDate AS "cancelDate",
 		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag"
+		a.delFlag AS "delFlag",
+        a.newReceiptType
 	</sql>
 
     <sql id="cmDiscernReceiptJoins">
@@ -59,10 +60,63 @@
         select  IFNULL(sum(amount),0) from cm_user_balance_record where balanceType = 2 and  receiptId = #{receiptId} and delFlag = 0;
     </select>
 
+    <select id="discern" resultType="String">
+        SELECT
+            u.userID,
+            csp.id AS receiptID,
+            cms.orderID,
+            cms.shopOrderID,
+            cms.shopOrderNo,
+            cms.orderType as orderType,
+            s.name AS shopName,
+            cms.productAmount,
+            cmo.orderNo,
+            u.userName,
+            u.name AS jgName,
+            cmo.confirmTime,
+            cms.receiptAmount,
+            cms.needPayAmount
+        FROM cm_shop_order cms
+                 LEFT JOIN shop s ON s.shopID = cms.shopID
+                 LEFT JOIN cm_order cmo ON cmo.orderID = cms.orderID
+                 LEFT JOIN `user` u ON u.userID = cms.userID
+                 LEFT JOIN cm_discern_receipt csp ON csp.shopOrderID = cms.shopOrderID
+    </select>
+
+    <select id="orderlist" resultType="CmDiscernReceipt">
+        SELECT
+            u.userID,
+            csp.id AS receiptID,
+            cms.orderID,
+            cms.shopOrderID,
+            cms.shopOrderNo,
+            cms.orderType as orderType,
+            s.name AS shopName,
+            cms.productAmount,
+            cmo.orderNo,
+            u.userName,
+               u.name AS jgName,
+            cmo.confirmTime,
+            cms.receiptAmount,
+            cms.needPayAmount
+        FROM cm_shop_order cms
+                 LEFT JOIN shop s ON s.shopID = cms.shopID
+                 LEFT JOIN cm_order cmo ON cmo.orderID = cms.orderID
+                 LEFT JOIN `user` u ON u.userID = cms.userID
+                 LEFT JOIN cm_discern_receipt csp ON csp.shopOrderID = cms.shopOrderID
+                   where csp.id=#{id}
+    </select>
+
+
     <select id="findList" resultType="CmDiscernReceipt">
         -- 	relationType值为1是为子订单ID,为2时为主订单ID)
         SELECT
         <include refid="cmDiscernReceiptColumns"/>,
+        cso_s.orderID AS orderID,
+        cso_s.shopOrderNo as shopOrderNos,
+        cso.shopOrderId as shopOrderId,
+        s.checkMan,
+        IF(crr.relationType = '1', s.name,IFNULL(s_a.name,'')) AS shopName,
         (case when crr.relationType = '1' then u_cr.userName else u.userName
         end) AS "userName",
         (case when crr.relationType = '1' then u_cr.name else u.name
@@ -79,6 +133,11 @@
         left join cm_shop_order cso on cso.shopOrderID = crr.orderID
         left join cm_order cso_cr on cso.orderID = cso_cr.orderID
         LEFT JOIN USER u_cr ON u_cr.userID = cso_cr.userID
+            -- 供应商
+        LEFT JOIN shop s ON s.shopID = cso.shopID
+        LEFT JOIN cm_shop_order cso_s ON cso_s.shopOrderID = a.shopOrderID
+        LEFT JOIN cm_shop_order cso_a ON cso_a.shopOrderID = crr.shopOrderID
+        LEFT JOIN shop s_a ON s_a.shopID = cso_a.shopID
         <where>
             <if test="id != null and id != '' and id != 0 ">
                 AND a.id = #{id}
@@ -102,8 +161,24 @@
                 AND a.payType = #{payType}
             </if>
             <if test="receiptType != null and receiptType != ''">
+                <if test="receiptType==2 and newReceiptType==3">
+                    and (a.receiptType = 9)
+            or a.receiptType = #{receiptType}
+                </if>
+                <if test="receiptType!=2">
+                    AND a.receiptType = #{receiptType}
+                </if>
                 AND a.receiptType = #{receiptType}
             </if>
+        <if test="newReceiptType !=null">
+            <if test="newReceiptType==3">
+              and a.newReceiptType =3
+            </if>
+            <if test="newReceiptType != 3">
+                and a.newReceiptType=#{newReceiptType}
+            </if>
+        </if>
+
             <if test="receiptStatus != null and receiptStatus != ''">
                 AND a.receiptStatus = #{receiptStatus}
             </if>
@@ -138,6 +213,17 @@
                     and (select count(1) from cm_receipt_order_relation where receiptID = a.id and delFlag = '0')
                     <![CDATA[ > ]]> 1
                 </if>
+            </if>
+            <if test="paYee !=null and paYee != ''">
+                <if test="paYee == '采美'">
+                   and a.payWay = 3
+                    OR a.payWay = 2
+                    AND a.newReceiptType != 3 AND a.payWay = 2
+                </if>
+            <if test="payWay==1">
+               and s.name=#{paYee}
+            </if>
+
             </if>
             and a.delFlag = '0' group by a.id
         </where>
@@ -548,7 +634,8 @@
 	    cdr.cancelReason AS cancelReason,
 	    cdr.payWay AS payWay,
 	    rup.name AS confirmer,
-	    cdr.rebateRemarks AS rebateRemarks
+	    cdr.rebateRemarks AS rebateRemarks,
+        cdr.shopName as shopName
 	    from
 		cm_discern_receipt cdr
 		left join receipt_user_permission rup on cdr.confirmUserPermissionID = rup.id

+ 23 - 14
src/main/resources/mappings/modules/order/CmReceiptOrderRelationMapper.xml

@@ -93,8 +93,10 @@
 
 	<select id="findByReceiptID" resultType="CmReceiptOrderRelation">
 		select
-		<include refid="cmReceiptOrderRelationColumns"/>
+		<include refid="cmReceiptOrderRelationColumns"/>,
+		b.newReceiptType
 		from  cm_receipt_order_relation a
+		left join cm_discern_receipt b on a.receiptID = b.id
 		where a.receiptID = #{receiptID}
 		and a.delFlag = 0
 	</select>
@@ -216,23 +218,30 @@
 		select userId from cm_order where orderId=#{orderId}
 	</select>
 	<select id="findByShopOrderIds" resultType="com.caimei.modules.order.entity.CmReceiptOrderRelation">
-		select
-			a.*,
-			b.payType as "payType",
-			b.receiptDate as "receiptDate",
-			b.confirmType as "confirmType",
-			b.balanceAccountsRemark as "balanceAccountsRemark",
-			b.payWay as "payWay"
-		from  cm_receipt_order_relation a
-		left join cm_discern_receipt b on a.receiptID = b.id
-		where a.shopOrderId in
-		<foreach collection="shopOrderIds" open="(" close=")" item="shopOrderId" separator=",">
-			#{shopOrderId}
+		SELECT
+			a.relationType,
+			a.receiptID,
+			a.shopOrderId,
+			a.orderID,
+			a.mbOrderId,
+			a.orderRequestNo,
+			a.splitStatus,
+			a.associateAmount-IFNULL((SELECT SUM(refundAmount) FROM cm_refundmoney_record WHERE orderRequestNo=a.orderRequestNo),0) AS associateAmount,
+			b.payType AS "payType",
+			b.receiptDate AS "receiptDate",
+			b.confirmType AS "confirmType",
+			b.balanceAccountsRemark AS "balanceAccountsRemark",
+			b.payWay AS "payWay"
+		FROM  cm_receipt_order_relation a
+		LEFT JOIN cm_discern_receipt b ON a.receiptID = b.id
+		WHERE a.shopOrderId IN
+		<foreach collection="shopOrderIds" separator="," item="shopOrderID" open="(" close=")">
+			#{shopOrderID}
 		</foreach>
 		  AND b.receiptType = '1'
 		  AND b.receiptStatus = '3'
 		  AND a.delFlag = '0'
 		  AND b.delFlag = '0'
-		order by b.receiptDate desc
+		ORDER BY a.associateAmount DESC
 	</select>
 </mapper>

+ 66 - 5
src/main/resources/mappings/modules/order/CmReturnedPurchaseMapper.xml

@@ -11,7 +11,7 @@
 		a.returnedWay AS "returnedWay",
 		a.payType AS "payType",
 		a.operatingOrderStatus AS "operatingOrderStatus",
-		a.returnedPurchaseFee AS "returnedPurchaseFee",
+		ifnull(a.returnedPurchaseFee,0) AS "returnedPurchaseFee",
 		a.refundFee AS "refundFee",
 		a.image1 AS "image1",
 		a.image2 AS "image2",
@@ -28,7 +28,7 @@
 		a.returnTime AS "returnTime",
 		a.applicationUserID AS "applicationUserID",
 		a.reviewUserID AS "reviewUserID",
-		a.refundBalanceFee AS "refundBalanceFee",
+		ifnull(a.refundBalanceFee,0) AS "refundBalanceFee",
 		a.refundOnlineFee AS "refundOnlineFee",
 		a.refundOfflineFee AS "refundOfflineFee",
 		a.bankAccountName AS "bankAccountName",
@@ -40,7 +40,8 @@
 		b.orderType as "orderType",
 		c.userName as "userName",
 		c.name as "name",
-		c.userOrganizeID as "userOrganizeId"
+		c.userOrganizeID as "userOrganizeId",
+		ifnull(a.refundType,1) as "refundType"
 	</sql>
 
 	<sql id="cmReturnedPurchaseJoins">
@@ -211,7 +212,8 @@
 			applicationUserID,
 			returnTime,
 			reviewUserID,
-			confirmReturnTime
+			confirmReturnTime,
+            refundType
 		) VALUES (
 			#{returnedNo},
 			#{orderID},
@@ -239,9 +241,15 @@
 			#{applicationUserID},
 			#{returnTime},
 			#{reviewUserID},
-			#{confirmReturnTime}
+			#{confirmReturnTime},
+		    #{refundType}
 		)
 	</insert>
+	<insert id="insertCmRefundRecord">
+		insert into cm_refundmoney_record
+		(refundAmount,orderRequestNo,shopOrderId)
+		values(#{refundAmount},#{orderRequestNo},#{shopOrderId})
+	</insert>
 
 	<update id="updateRevokeApply">
 		UPDATE cm_returned_purchase
@@ -363,6 +371,9 @@
 			<if test="delFlag != null and delFlag != ''" >
 				delFlag = #{delFlag},
 			</if>
+		    <if test="refundType != null">
+				refundType = #{refundType},
+			</if>
         </set>
 
 		WHERE id = #{id}
@@ -406,4 +417,54 @@
     <select id="findSplitCode" resultType="java.lang.String">
 		select splitCode from cm_shop_order where shopOrderID = #{shopOrderId}
 	</select>
+	<select id="getReturnShopOrder" resultType="java.lang.Integer">
+		SELECT shopOrderId FROM cm_returned_purchase_product crpp
+		LEFT JOIN cm_returned_purchase crp ON crp.id=crpp.returnedID
+		WHERE crp.id=#{id}
+		  AND crp.status=2
+		  AND crp.returnedWay =1
+		  AND crp.delflag=0
+	</select>
+	<select id="findBrokerage" resultType="java.lang.Double">
+		SELECT SUM(splitAccount)
+		FROM cm_split_account
+		WHERE productType = 3
+		  AND TYPE=5
+		  AND orderRequestNo= #{orderRequestNo}
+	</select>
+	<select id="findRefundTransfer" resultType="java.lang.Double">
+		SELECT SUM(transferAmount) FROM cm_refund_transfer
+		WHERE transferType=2
+		  AND orderRequestNo=#{orderRequestNo}
+	</select>
+	<select id="findRefundCharge" resultType="java.lang.Double">
+		SELECT SUM(transferAmount) FROM cm_refund_transfer
+		WHERE transferType=1
+		  AND orderRequestNo=#{orderRequestNo}
+	</select>
+	<select id="findPayAmount" resultType="java.lang.Double">
+		select associateAmount from cm_receipt_order_relation
+		where orderRequestNo = #{orderRequestNo}
+	</select>
+	<select id="findOnlinePay" resultType="java.lang.Double">
+		SELECT SUM(receiptAmount) FROM
+		cm_discern_receipt cdr
+		LEFT JOIN cm_receipt_order_relation cror ON cror.receiptID=cdr.Id
+		WHERE shopOrderId=#{shopOrderId}
+	</select>
+	<select id="findShopOrderSettleStatus" resultType="java.lang.String">
+		select settleStatus from cm_shop_order where shopOrderID = #{onlineShopOrderId}
+	</select>
+	<select id="findRefundType" resultType="java.lang.Integer">
+		SELECT COUNT(*) FROM cm_returned_purchase
+		WHERE orderId=#{orderID}
+		  AND delflag = 0
+		  AND refundtype=2
+	</select>
+	<select id="findShopOrderPaid" resultType="java.lang.Double">
+		SELECT SUM(associateAmount)
+		FROM cm_receipt_order_relation
+		WHERE shopOrderId=#{shopOrderID}
+		AND delflag=0
+	</select>
 </mapper>

+ 3 - 0
src/main/resources/mappings/modules/order/CmUtilsMapper.xml

@@ -56,6 +56,9 @@
         from cm_order co
         where orderID = #{orderID}
     </select>
+    <select id="findOrderIsSecond" resultType="java.lang.Integer">
+        select secondHandOrderFlag from cm_order where orderId= #{orderId}
+    </select>
 
 
 </mapper>

+ 80 - 2
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -39,7 +39,7 @@
 		a.freight AS freight,
 		a.userBeans AS userBeans,
 		a.delFlag AS delFlag,
-		a.onlinePayFlag AS onlinePayFlag,
+		ifnull(a.onlinePayFlag,1) AS onlinePayFlag,
 		a.payTime AS payTime,
 		a.splitFlag AS splitFlag,
 		(select sum(cop.totalAddedValueTax) from cm_order_product cop where cop.orderID = a.orderID) AS totalAddedValueTax,
@@ -59,6 +59,7 @@
 		a.couponAmount as couponAmount,
         a.svipFullReduction as svipFullReduction,
         (a.discountFee + a.promotionFullReduction + a.couponAmount) as discountAmount,
+        a.rebateFee,
         if(chcm.id is not null,1,0) as collageFlag,
         chc.status as collageStatus
     </sql>
@@ -126,7 +127,8 @@
         else
         ''
         end) AS spName,
-        co.rebateFlag AS rebateFlag
+        co.rebateFlag AS rebateFlag,
+        co.rebateFee AS rebateFee
         FROM cm_order co
         LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderID
         LEFT JOIN user u ON u.userID = co.userID
@@ -134,11 +136,15 @@
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID and sp.status = 90
         LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
         LEFT JOIN product p ON cop.productID = p.productID
+        left join cm_shop_order cso on co.orderid=cso.orderID
         <where>
             co.orderType != 2
             <if test="orderID != null and orderID != ''">
                 AND co.orderID = #{orderID}
             </if>
+            <if test="settleStatus != null">
+                AND cso.settleStatus = #{settleStatus}
+            </if>
             <if test="orderNo != null and orderNo != ''">
                 AND co.orderNo = #{orderNo}
             </if>
@@ -275,6 +281,12 @@
             <if test="productName != null and productName != ''">
                 and p.name like CONCAT('%',#{productName},'%')
             </if>
+            <if test="productCategory == 2">
+                and p.productCategory=2
+            </if>
+            <if test="productCategory == null || productCategory == 1">
+                and p.productCategory=1
+            </if>
             AND co.delFlag = 0
         </where>
         <choose>
@@ -384,6 +396,7 @@
                              promotionalGiftsCount,
                              affirmPaymentFlag,
                              rebateFlag,
+                             rebateFee,
                              payStatus,
                              zeroCostFlag,
                              couponAmount,
@@ -432,6 +445,7 @@
                 #{promotionalGiftsCount},
                 #{affirmPaymentFlag},
                 #{rebateFlag},
+                #{rebateFee},
                 #{payStatus},
                 #{zeroCostFlag},
                 #{couponAmount},
@@ -591,6 +605,9 @@
             <if test="rebateFlag != null">
                 rebateFlag = #{rebateFlag},
             </if>
+            <if test="rebateFee != null">
+                rebateFee = #{rebateFee},
+            </if>
             <if test="zeroCostFlag != null">
                 zeroCostFlag = #{zeroCostFlag},
             </if>
@@ -974,6 +991,16 @@
     <update id="updateBySplitStatus">
         UPDATE cm_receipt_order_relation SET splitStatus = 1 WHERE mbOrderId = #{mbOrderId}
     </update>
+    <update id="updateSettleStatus">
+        update cm_split_account
+        set settleStatus = 1
+        where shopOrderId = #{shopOrderId}
+        and productType = #{productType}
+    </update>
+    <update id="updateShopOrderSettleStatus">
+        update cm_shop_order set settleStatus = #{settleStatus}
+        where shopOrderId = #{shopOrderId}
+    </update>
     <delete id="deleteCouponOrderRecord">
         DELETE
         FROM cm_coupon_order_record
@@ -996,6 +1023,7 @@
         LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
         LEFT JOIN cm_order co ON cror.orderID = co.orderID
         WHERE cror.relationType = 2
+          AND a.receiptStatus=3
           AND cror.delFlag = 0
           AND cror.mbOrderId IS NOT NULL
           AND cror.splitStatus = 0
@@ -1325,6 +1353,45 @@
           AND co.orderType != 2
           AND cror.orderID=#{orderID}
     </select>
+    <select id="findSplitCode" resultType="java.lang.String">
+        select splitCode from cm_shop_order where shopOrderID = #{shopOrderId}
+    </select>
+    <select id="findPayAmount" resultType="java.lang.Double">
+        SELECT SUM(splitAccount) FROM cm_split_account csa
+        LEFT JOIN cm_receipt_order_relation cror ON csa.shopOrderId=cror.shopOrderId
+        WHERE csa.shopOrderId = #{shopOrderId}
+          AND csa.type=5
+          AND csa.settleStatus = 0
+          AND csa.productType = 3
+          AND cror.splitStatus =1
+          AND cror.delflag=0
+    </select>
+    <select id="findShouldPayShopAmount" resultType="java.lang.Double">
+        select shouldPayShopAmount from cm_shop_order where shopOrderID = #{shopOrderId}
+    </select>
+    <select id="findSettleSum" resultType="java.lang.Double">
+        SELECT IFNULL(SUM(settleAmount),0) FROM cm_settle_record
+        WHERE settleType = 1
+          AND shopOrderId = 24665
+    </select>
+    <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
+        select distinct
+        csr.settleAmount,csr.shopOrderId,csr.settleTime from cm_settle_record csr
+        left join cm_shop_order cso on csr.shopOrderId = cso.shopOrderID
+        where cso.orderID=#{orderID}
+        and settleType = 2
+    </select>
+    <select id="findSettleAmount" resultType="java.lang.Double">
+        SELECT ifnull(SUM(settleAmount),0)
+        FROM cm_settle_record csr
+        LEFT JOIN cm_shop_order cso ON csr.shopOrderId = cso.shopOrderId
+        WHERE settleType=1
+          AND cso.orderId=#{orderID}
+    </select>
+    <select id="findShopOrderSize" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM cm_shop_order WHERE orderId=#{orderID}
+                                             AND shopId!=998
+    </select>
     <insert id="insertSplitAccount">
         INSERT INTO cm_split_account (orderId, productId, orderProductId, shopId, couponRecordId, vipRecordId,
                                       authVipRecordId, type, subUserNo, splitAccount,
@@ -1345,4 +1412,15 @@
         INSERT INTO cm_pay_shop_record (shopID, shopOrderID, shopOrderNo, payAmount, wipePayment, payType, payTime, payShopID, status, delFlag)
         VALUES (#{shopId}, #{shopOrderId}, #{shopOrderNo}, #{payAmount}, #{wipePayment}, #{payType}, #{payTime}, #{payShopId}, #{status}, #{delFlag})
     </insert>
+    <insert id="insertSettleRecord">
+        INSERT INTO cm_settle_record(settleamount, settletype, shoporderid, splitcode, settletime)
+        VALUES (#{settleAmount},#{settleType},#{shopOrderId},#{splitCode},now())
+    </insert>
+
+    <update id="updateBrokerage">
+        UPDATE cm_shop_order SET
+            brokerage = #{brokerage}
+        WHERE shopOrderID = #{shopOrderID}
+    </update>
+
 </mapper>

+ 176 - 1
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -3,6 +3,7 @@
 <mapper namespace="com.caimei.modules.order.dao.NewShopOrderDao">
 
     <sql id="shopOrderColumns">
+        co.rebateFee as rebateFee,
         co.couponAmount as couponAmount,
 			co.userBeans as userBeans,
 			a.shopOrderID AS shopOrderID,
@@ -71,6 +72,7 @@
     		a.shopOtherFee AS shopOtherFee,
     		a.paying AS paying,
     		a.costType AS costType,
+            a.settleStatus AS settleStatus,
     		a.modifyShouldPayNote AS modifyShouldPayNote,
     		a.orderPromotionsId AS orderPromotionsId,
     		a.differenceType AS differenceType,
@@ -765,11 +767,14 @@
         co.status AS status,
         bou.name AS buyer,
         s.name AS shopName,
-        c.name AS clubName
+        c.name AS clubName,
+        cdr.payWay AS payWay
         from cm_shop_order a
         left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
         left join bp_order_userinfo bou on bou.orderId = a.orderID
         left join cm_order co on co.orderID = a.orderID
+        LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
+        LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
         left join shop s on s.shopID = a.shopID
         LEFT JOIN club c ON c.userID = a.userID
         <where>
@@ -823,6 +828,7 @@
                 and a.payStatus = 3 and co.status NOT IN (6,7)
             </if>
             and co.delFlag = 0
+            and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
             and a.delFlag = 0
             and a.shopID != 998
             and co.orderID not in (
@@ -966,6 +972,7 @@
         select payStatus
         from cm_shop_order
         where orderID = #{orderID}
+          AND shopID != 998
     </select>
 
     <select id="getPayingStatus" resultType="string">
@@ -1021,6 +1028,7 @@
                                                                          WHERE cso.orderID = co.orderID)
                                                 AND cpsr.delFlag = 0
                                                 AND (cpsr.`status` = 1 OR cpsr.`status` = 0)), 0)
+                                    +IFNULL(co.rebateFee,0)
                                 ), 0), 2) AS "采美总佣金"
         FROM cm_order co
         WHERE co.orderID = #{orderID}
@@ -1133,6 +1141,7 @@
           AND cror.delFlag = 0
           AND cror.mbOrderId IS NOT NULL
           AND cror.splitStatus = 0
+          AND a.receiptStatus=3
           AND co.orderID NOT IN (
             SELECT orderID
             FROM cm_order_product
@@ -1152,10 +1161,176 @@
     <select id="FromUnionId" resultType="java.lang.String">
         SELECT unionID FROM `cm_order` WHERE orderID=#{orderId}
     </select>
+
+    <select id="UnionId" resultType="java.lang.String">
+        SELECT unionID FROM `cm_order` WHERE userID=#{userID}
+        ORDER BY orderID DESC
+        LIMIT 1
+    </select>
+
     <select id="getProductOrder" resultType="java.lang.String">
         SELECT productID
         FROM `cm_order_product`
         WHERE orderID = #{orderid}
     </select>
 
+    <select id="payWay" resultType="java.lang.Integer">
+        SELECT  cdr.payWay
+        FROM cm_shop_order a
+                 LEFT JOIN cm_order co ON co.orderID = a.orderID
+                 LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
+                 LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
+        WHERE a.shopOrderID =  #{shopOrderID}
+    </select>
+
+
+    <select id="findSettlementList" resultType="com.caimei.modules.order.entity.NewShopOrder">
+        SELECT co.couponAmount            AS couponAmount,
+               co.userBeans               AS userBeans,
+               a.shopOrderID              AS shopOrderID,
+               a.orderID                  AS orderID,
+               a.organizeID               AS organizeID,
+               a.shopOrderNo              AS shopOrderNo,
+               a.orderNo                  AS orderNo,
+               a.userID                   AS userID,
+               a.shopID                   AS shopID,
+               a.itemCount                AS itemCount,
+               a.townID                   AS townID,
+               a.productAmount            AS productAmount,
+               a.discountAmount           AS discountAmount,
+               a.accountAmount            AS accountAmount,
+               a.totalAmount              AS totalAmount,
+               a.payFlag                  AS payFlag,
+               a.payTime                  AS payTime,
+               a.finishTime               AS finishTime,
+               a.refundStatus             AS refundStatus,
+               a.needPayAmount            AS needPayAmount,
+               a.canRefundAmount          AS canRefundAmount,
+               a.refundAmount             AS refundAmount,
+               a.clubID                   AS clubID,
+               a.spID                     AS spID,
+               a.mainSpID                 AS mainSpID,
+               a.orderBeanAmount          AS orderBeanAmount,
+               a.useBeanAmount            AS useBeanAmount,
+               a.useBeanFlag              AS useBeanFlag,
+               a.canRefundFlag            AS canRefundFlag,
+               a.useBalanceFlag           AS useBalanceFlag,
+               a.canRefundBeans           AS canRefundBeans,
+               a.freePostageFee           AS freePostageFee,
+               a.freePostageTicketID      AS freePostageTicketID,
+               a.brokerage                AS brokerage,
+               a.delFlag                  AS delFlag,
+               a.refundsAmount            AS refundsAmount,
+               a.orderStatusFlag          AS orderStatusFlag,
+               a.buyStatus                AS buyStatus,
+               a.orderSubmitType          AS orderSubmitType,
+               a.orderType                AS orderType,
+               a.orderTime                AS orderTime,
+               a.deliveryTimeMills        AS deliveryTimeMills,
+               a.presentNum               AS presentNum,
+               a.preferential             AS preferential,
+               a.outStoreNum              AS outStoreNum,
+               IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
+               a.splitFlag                AS splitFlag,
+               a.autoReceiveTimeMills     AS autoReceiveTimeMills,
+               a.autoOverTimeMills        AS autoOverTimeMills,
+               a.receiveGoodsTime         AS receiveGoodsTime,
+               a.totalAddedValueTax       AS totalAddedValueTax,
+               a.note                     AS note,
+               a.payStatus                AS payStatus,
+               a.sendOutStatus            AS sendOutStatus,
+               a.shopProductAmount        AS shopProductAmount,
+               a.shopPostFee              AS shopPostFee,
+               a.shopTaxFee               AS shopTaxFee,
+               a.shouldPayShopAmount      AS shouldPayShopAmount,
+               a.payedShopAmount          AS payedShopAmount,
+               a.shopOtherFee             AS shopOtherFee,
+               a.paying                   AS paying,
+               a.costType                 AS costType,
+               a.modifyShouldPayNote      AS modifyShouldPayNote,
+               a.orderPromotionsId        AS orderPromotionsId,
+               a.differenceType           AS differenceType,
+               a.differencePrice          AS differencePrice,
+               a.proportional             AS proportional,
+               a.promotionFullReduction   AS promotionFullReduction,
+               a.zeroCostFlag             AS zeroCostFlag,
+               a.settleStatus             AS settleStatus,
+               co.payTotalFee             AS payTotalFee,
+               co.status                  AS STATUS,
+               bou.name                   AS buyer,
+               s.name                     AS shopName,
+               c.name                     AS clubName
+        FROM cm_shop_order a
+        LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
+        LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
+        LEFT JOIN cm_order co ON co.orderID = a.orderID
+        LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
+        LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
+        LEFT JOIN cm_split_account csa on csa.shopOrderId = a.shopOrderID
+        LEFT JOIN shop s ON s.shopID = a.shopID
+        LEFT JOIN club c ON c.userID = a.userID
+        WHERE co.organizeID = 0
+          AND co.refundType != 2
+          AND co.delFlag = 0
+          AND co.orderType != 2
+          AND co.receiptStatus = 3
+          AND a.delFlag = 0
+          AND a.shopID != 998
+          AND cdr.payWay = 1
+          AND cror.relationType = 2
+          AND a.settleStatus in (1,2)
+          AND csa.settleStatus = 0
+          AND cror.delFlag = 0
+          AND cror.mbOrderId IS NOT NULL
+          AND cror.splitStatus = 1
+        <if test="startTime != null and startTime != ''">
+            AND (a.orderTime &gt; #{startTime} OR a.orderTime = #{startTime})
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
+        </if>
+        <if test="orderID != null and orderID != ''">
+            AND a.orderID = #{orderID}
+        </if>
+        <if test="orderNo != null and orderNo != ''">
+            AND a.orderNo like concat('%', #{orderNo} ,'%')
+        </if>
+        <if test="ps != null and ps.length>0 ">
+            AND a.settleStatus in
+            <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="clubName != null and clubName != ''">
+            AND c.name like concat('%', #{clubName} ,'%')
+        </if>
+        <if test="shopOrderID != null and shopOrderID != ''">
+            AND a.shopOrderID = #{shopOrderID}
+        </if>
+        <if test="shopOrderNo != null and shopOrderNo != ''">
+            AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
+        </if>
+        GROUP BY a.shopOrderID
+        ORDER BY a.shopOrderID DESC
+    </select>
+    <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
+        select settleAmount,settleType,settleTime
+        from cm_settle_record
+        where shopOrderId = #{shopOrderID}
+    </select>
+    <select id="findListByShopOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
+        SELECT<include refid="shopOrderColumns"/>,
+        b.name as shopName,
+        oa.id as orderArchiveId,
+        co.receiptStatus
+        FROM cm_shop_order a
+        left join shop b on a.shopID = b.shopID
+        left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
+        left join cm_order co on co.orderID = a.orderID
+        WHERE a.shopOrderId = #{onlineShopOrderId}
+        ORDER BY a.shopOrderNo DESC
+    </select>
 </mapper>

+ 2 - 0
src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml

@@ -249,6 +249,8 @@
 			fileName = #{fileName},
 			ossName = #{ossName},
 			commitmentImage = #{commitmentImage}
+
+
 		WHERE productID = #{productID}
 	</update>
 

+ 278 - 157
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -85,8 +85,20 @@
 		a.trainingType as "trainingType",
 		a.trainingFee as "trainingFee",
 		a.commodityType as "commodityType",
-		a.splitCode
-	</sql>
+		a.splitCode,
+        a.announType,
+        ifnull(a.newvalidFlag,0),
+         ifnull(a.newProductType,2),
+        a.showFlag,
+        a.showTime,
+        a.newshowTime,
+        a.recommend,
+		a.qualificationNo,
+		a.productName,
+		a.qualificationTime,
+		a.qualificationLink
+
+    </sql>
 
 	<sql id="productJoins">
 		LEFT JOIN shop s on s.shopID = a.shopID
@@ -323,157 +335,188 @@
 		</choose>
 	</select>
 
-	<insert id="insert" parameterType="Product"  keyProperty="productID"  keyColumn="productID" useGeneratedKeys="true">
-		INSERT INTO product(
-			brandID,
-			bigTypeID,
-			smallTypeID,
-			tinyTypeID,
-			selfTypeID,
-			shopID,
-			aliasName,
-			name,
-			searchKey,
-			normalPrice,
-			price,
-			priceFlag,
-			beautyActFlag,
-			ladderPriceFlag,
-			stock,
-			hasSkuFlag,
-			mainImage,
-			propertiesInfo,
-			addTime,
-			updateTime,
-			weekSellNumber,
-			beforeValidFlag,
-			validFlag,
-			favoriteTimes,
-			commentScore,
-			commentTimes,
-			selfRecommendFlag,
-			sysRecommendFlag,
-			sortIndex,
-			featuredFlag,
-			featuredSortIndex,
-			productCode,
-			unit,
-			synToERPFlag,
-			allAreaFlag,
-			provinceIDs,
-			serviceNumber,
-			maxBuyNumber,
-			minBuyNumber,
-			packageCount,
-			byFlag,
-			normalProductFlag,
-			wholeSaleProductFlag,
-			promotionProductFlag,
-			groupBuyProductFlag,
-			step,
-			actFlag,
-			actType,
-			actSort,
-			onlineTime,
-			downlineTime,
-			freePostFlag,
-			costPrice,
-			costProportional,
-			costCheckFlag,
-			precisehKey,
-			visibility,
-			productType,
-			qualificationImg,
-			invoiceType,
-			taxPoint,
-			supplierTaxPoint,
-			tags,
-			recommendType,
-			machineType,
-			includedTax,
-			commodityType,
-			trainingMethod,
-			trainingType,
-			trainingFee,
-			productDescribe,
-			splitCode,
-			productDetail
-		) VALUES (
-					 #{brandID},
-					 #{bigTypeID},
-					 #{smallTypeID},
-					 #{tinyTypeID},
-					 #{selfTypeID},
-					 #{shopID},
-		          	 #{aliasName},
-					 #{name},
-					 #{searchKey},
-					 #{normalPrice},
-					 #{price},
-					 #{priceFlag},
-					 #{beautyActFlag},
-					 #{ladderPriceFlag},
-					 #{stock},
-					 #{hasSkuFlag},
-					 #{mainImage},
-					 #{propertiesInfo},
-					 #{addTime},
-					 #{updateTime},
-					 #{weekSellNumber},
-					 #{beforeValidFlag},
-					 #{validFlag},
-					 #{favoriteTimes},
-					 #{commentScore},
-					 #{commentTimes},
-					 #{selfRecommendFlag},
-					 #{sysRecommendFlag},
-					 #{sortIndex},
-					 #{featuredFlag},
-					 #{featuredSortIndex},
-					 #{productCode},
-					 #{unit},
-					 #{synToERPFlag},
-					 #{allAreaFlag},
-					 #{provinceIDs},
-					 #{serviceNumber},
-					 #{maxBuyNumber},
-					 #{minBuyNumber},
-					 #{packageCount},
-					 #{byFlag},
-					 #{normalProductFlag},
-					 #{wholeSaleProductFlag},
-					 #{promotionProductFlag},
-					 #{groupBuyProductFlag},
-					 #{step},
-					 #{actFlag},
-					 #{actType},
-		          	 #{actSort},
-					 #{onlineTime},
-					 #{downlineTime},
-					 #{freePostFlag},
-					 #{SqlCostPrice},
-					 #{sqlCostProportional},
-					 #{costCheckFlag},
-					 #{precisehKey},
-		         	 #{visibility},
-		         	 #{productType},
-					 #{qualificationImg},
-					 #{invoiceType},
-					 #{sqlTaxPoint},
-					 #{sqlSupplierTaxPoint},
-					 #{tags},
-					 #{recommendType},
-					 #{machineType},
-					 #{includedTax},
-					 #{commodityType},
-					 #{trainingMethod},
-					 #{trainingType},
-					 #{trainingFee},
-		          	 #{productDescribe},
-					 #{splitCode},
-					 #{productDetail}
-						 )
-	</insert>
+    <insert id="insert" parameterType="Product" keyProperty="productID" keyColumn="productID" useGeneratedKeys="true">
+        INSERT INTO product(brandID,
+                            bigTypeID,
+                            smallTypeID,
+                            tinyTypeID,
+                            selfTypeID,
+                            shopID,
+                            aliasName,
+                            name,
+                            searchKey,
+                            normalPrice,
+                            price,
+                            priceFlag,
+                            beautyActFlag,
+                            ladderPriceFlag,
+                             <if test="stock !=''">
+	                        	stock,
+                            </if>
+                            hasSkuFlag,
+                            mainImage,
+                            propertiesInfo,
+                            addTime,
+                            updateTime,
+                            weekSellNumber,
+                            beforeValidFlag,
+                            validFlag,
+                            favoriteTimes,
+                            commentScore,
+                            commentTimes,
+                            selfRecommendFlag,
+                            sysRecommendFlag,
+                            sortIndex,
+                            featuredFlag,
+                            featuredSortIndex,
+                            productCode,
+                            unit,
+                            synToERPFlag,
+                            allAreaFlag,
+                            provinceIDs,
+                            serviceNumber,
+                            maxBuyNumber,
+                            minBuyNumber,
+                            packageCount,
+                            byFlag,
+                            normalProductFlag,
+                            wholeSaleProductFlag,
+                            promotionProductFlag,
+                            groupBuyProductFlag,
+                            step,
+                            actFlag,
+                            actType,
+                            actSort,
+                            onlineTime,
+                            downlineTime,
+                            freePostFlag,
+                            costPrice,
+                            costProportional,
+                            costCheckFlag,
+                            precisehKey,
+                            visibility,
+                            productType,
+                            qualificationImg,
+                            invoiceType,
+                            taxPoint,
+                            supplierTaxPoint,
+                            tags,
+                            recommendType,
+                            machineType,
+                            includedTax,
+                            commodityType,
+                            trainingMethod,
+                            trainingType,
+                            trainingFee,
+                            productDescribe,
+                            splitCode,
+                            productDetail,
+                            announType,
+							newProductType,
+		<if test="qualificationNo != null and  qualificationNo != ''">
+			qualificationNo,
+		</if>
+		<if test="productName != null and  productName != ''">
+			productName,
+		</if>
+		<if test="qualificationTime != null and  qualificationTime != ''">
+			qualificationTime,
+		</if>
+		<if test="qualificationLink != null and  qualificationLink != ''">
+			qualificationLink,
+		</if>
+		showFlag)
+        VALUES (#{brandID},
+        #{bigTypeID},
+        #{smallTypeID},
+        #{tinyTypeID},
+        #{selfTypeID},
+        #{shopID},
+        #{aliasName},
+        #{name},
+        #{searchKey},
+        #{normalPrice},
+        #{price},
+        #{priceFlag},
+        #{beautyActFlag},
+        #{ladderPriceFlag},
+		<if test="stock !=''">
+			#{stock},
+		</if>
+        #{hasSkuFlag},
+        #{mainImage},
+        #{propertiesInfo},
+        #{addTime},
+        #{updateTime},
+        #{weekSellNumber},
+        #{beforeValidFlag},
+        #{validFlag},
+        #{favoriteTimes},
+        #{commentScore},
+        #{commentTimes},
+        #{selfRecommendFlag},
+        #{sysRecommendFlag},
+        #{sortIndex},
+        #{featuredFlag},
+        #{featuredSortIndex},
+        #{productCode},
+        #{unit},
+        #{synToERPFlag},
+        #{allAreaFlag},
+        #{provinceIDs},
+        #{serviceNumber},
+        #{maxBuyNumber},
+        #{minBuyNumber},
+        #{packageCount},
+        #{byFlag},
+        #{normalProductFlag},
+        #{wholeSaleProductFlag},
+        #{promotionProductFlag},
+        #{groupBuyProductFlag},
+        #{step},
+        #{actFlag},
+        #{actType},
+        #{actSort},
+        #{onlineTime},
+        #{downlineTime},
+        #{freePostFlag},
+        #{SqlCostPrice},
+        #{sqlCostProportional},
+        #{costCheckFlag},
+        #{precisehKey},
+        #{visibility},
+        #{productType},
+        #{qualificationImg},
+        #{invoiceType},
+        #{sqlTaxPoint},
+        #{sqlSupplierTaxPoint},
+        #{tags},
+        #{recommendType},
+        #{machineType},
+        #{includedTax},
+        #{commodityType},
+        #{trainingMethod},
+        #{trainingType},
+        #{trainingFee},
+        #{productDescribe},
+        #{splitCode},
+        #{productDetail},
+        #{announType},
+        #{newProductType},
+        <if test="qualificationNo != null and  qualificationNo != ''">
+            #{qualificationNo},
+        </if>
+        <if test="productName != null and  productName != ''">
+            #{productName},
+        </if>
+        <if test="qualificationTime != null and  qualificationTime != ''">
+            #{qualificationTime},
+        </if>
+        <if test="qualificationLink != null and  qualificationLink != ''">
+            #{qualificationLink},
+        </if>
+        #{showFlag})
+    </insert>
 
 	<update id="update">
 		UPDATE product SET
@@ -531,10 +574,66 @@
 						   costProportional = #{costProportional},
 						   costCheckFlag = #{costCheckFlag},
 						   precisehKey = #{precisehKey},
-						   actSort = #{actSort}
+						   actSort = #{actSort},
+						   newProductType=#{newProductType}
+
 		WHERE productID = #{id}
 	</update>
+	<select id="productList" resultType="com.caimei.modules.product.entity.Product">
+		SELECT
+		*
+		FROM product a
+		<where>
+			a.newvalidFlag=1
+			<if test="productID !=null and productID !=''">
+				and a.productID=#{productID}
+			</if>
+		</where>
+	</select>
+	<select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
+		SELECT
+		<include refid="productColumns"/>
+		FROM product a
+		<include refid="productJoins"/>
+		<where>
+			<if test="productID !=null">
+				AND a.productID=#{productID}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE concat('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE concat('%',#{shopName},'%')
+			</if>
+			<if test="showFlag !=null and showFlag !=''">
+				AND a.showFlag=#{showFlag}
+			</if>
+			<if test="ids != null and ids.size() > 0">
+				AND a.productID NOT IN
+				<foreach collection="ids" close=")" separator="," open="(" item="id">
+					#{id}
+				</foreach>
+			</if>
+			AND p.newvalidFlag = 1
+			AND p.newProductType=1
+			AND p.validFlag = 2
+			AND p.showFlag!=2
+
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+		</choose>
+# 		在设置重点关注时给排序值1000为了让重点关注始终在列表前端
+		<if test="sortIndex==1000">
+			ORDER BY a.newshowTime DESC
+		</if>
+		<if test="sortIndex!=1000">
+			order by a.sortIndex desc
+		</if>
 
+	</select>
 	<update id="updateActive">
 		UPDATE product
 		<set>
@@ -927,7 +1026,8 @@
 		`invoiceType`,
 		`recommendType`,
 		`combinationID`,
-		`combinationSort`
+		`combinationSort`,
+		announType
 		)
 		VALUES
 		(
@@ -1003,7 +1103,8 @@
 		#{invoiceType},
 		#{recommendType},
 		#{combinationID},
-		#{combinationSort}
+		#{combinationSort},
+		#{announType}
 		)
 	</insert>
 
@@ -1649,7 +1750,23 @@
 			<if test="trainingFee != null">
 				trainingFee = #{trainingFee},
 			</if>
-				splitCode = #{splitCode}
+		    <if test="qualificationNo !=null and qualificationNo != ''">
+				qualificationNo=#{qualificationNo},
+			</if>
+			<if test="productName !=null and productName !=''">
+				productName=#{productName},
+			</if>
+			<if test="qualificationTime !=null and qualificationTime!=''">
+				qualificationTime=#{qualificationTime},
+			</if>
+			<if test="qualificationLink !=null and qualificationLink!=''">
+				qualificationLink=#{qualificationLink},
+			</if>
+
+			newProductType=#{newProductType},
+			showFlag=#{showFlag},
+			announType=#{announType},
+			splitCode = #{splitCode}
 		</set>
 		where productID = #{productID}
 	</update>
@@ -1769,6 +1886,10 @@
 			productdetailinfo
 		where productID = #{productID}
 	</select>
+	<select id="qualification" resultType="com.caimei.modules.product.entity.Product">
+		SELECT qualificationNo,productName,qualificationTime,qualificationLink FROM product
+		where productID = #{productID}
+	</select>
 	<select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
 		SELECT *
 		FROM product_ladder_price

+ 208 - 138
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -6,6 +6,10 @@
         <result property="name" column="name"/>
     </resultMap>
     <sql id="productColumns">
+
+        a.newvalidFlag,
+      ifnull(a.newProductType,2) as newProductType,
+        ifnull(a.announType,1) as announType,
         a.productID AS "id",
         a.productID AS "productID",
         a.brandID AS "brandID",
@@ -103,7 +107,11 @@
         cb.name as "brandName",
         if(csp.id is not null,1,0) as "svipFlag",
         cshd.companyName as "companyName",
-        cshd.publishIdentity as "publishIdentity"
+        cshd.publishIdentity as "publishIdentity",
+        a.qualificationNo,
+        a.productName,
+        a.qualificationTime,
+        a.qualificationLink
     </sql>
 
     <sql id="productJoins">
@@ -118,7 +126,7 @@
         INNER JOIN smalltype AS c ON b.`smallTypeID` = c.`smallTypeID`
         INNER JOIN bigtype AS d ON c.`bigTypeID` = d.`bigTypeID`
     </sql>
-	<select id="get" resultType="Product">
+    <select id="get" resultType="Product">
         SELECT
         <include refid="productColumns"/>
         FROM product a
@@ -127,7 +135,11 @@
     </select>
 
     <select id="getProductParams" resultType="com.caimei.modules.product.entity.ProductParameters">
-        select * from cm_product_related_parameters where productId =  #{productId}  and delFlag = 0 LIMIT 50
+        select *
+        from cm_product_related_parameters
+        where productId = #{productId}
+          and delFlag = 0
+        LIMIT 50
     </select>
 
     <select id="findList" resultType="Product">
@@ -137,6 +149,7 @@
         <include refid="productJoins"/>
         LEFT JOIN cm_product_activity cp on cp.productId = a.productID
         <where>
+
             <if test="id !=null and id !=''">
                 AND a.productID=#{id}
             </if>
@@ -152,6 +165,7 @@
             <if test="tinyTypeID != null and tinyTypeID != 0">
                 AND a.tinyTypeID = #{tinyTypeID}
             </if>
+
             <if test="productCategory != null and productCategory != ''">
                 AND a.productCategory = #{productCategory}
                 <if test="productCategory == 2">
@@ -193,8 +207,11 @@
                 <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
                 <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
             </if>
-            <if test="validFlag !=null and validFlag !=''">
-                AND a.validFlag=#{validFlag}
+            <if test="validFlagString !=null and validFlagString !=''">
+                AND a.validFlag in
+                <foreach collection="validFlagString" separator="," item="valid" open="(" close=")">
+                    #{valid}
+                </foreach>
             </if>
             <if test="actFlag !=null and actFlag !=''">
                 AND a.actFlag=#{actFlag}
@@ -217,8 +234,18 @@
             <if test="publishIdentity != null and publishIdentity !=''">
                 AND cshd.publishIdentity = #{publishIdentity}
             </if>
+            <if test="announType !=null and announType!= '' and productCategory == 2">
+                AND a.announType=#{announType}
+            </if>
+            <if test="newvalidFlag !=null and newvalidFlag!= ''">
+                AND a.newvalidFlag=#{newvalidFlag}
+            </if>
+            <if test="newProductType !=null and productCategory == 1">
+                AND a.newProductType=#{newProductType}
+            </if>
             <if test="contactName !=null and contactName !=''">
-                AND (cshd.contactName LIKE concat('%',#{contactName},'%') or cshd.companyName LIKE concat('%',#{contactName},'%'))
+                AND (cshd.contactName LIKE concat('%',#{contactName},'%') or cshd.companyName LIKE
+                concat('%',#{contactName},'%'))
             </if>
             <if test="sqlMap !=null and sqlMap !=''">
                 ${sqlMap.dsf}
@@ -259,7 +286,7 @@
         select *
         from productimage
         where productID = #{productId}
-        ORDER BY mainFlag DESC ,sortIndex is null,sortIndex  ASC
+        ORDER BY mainFlag DESC, sortIndex is null, sortIndex ASC
     </select>
     <select id="getImageById" resultType="com.caimei.po.ProductImage">
         select *
@@ -267,10 +294,14 @@
         where productImageID = #{productImageID}
     </select>
     <select id="getValidFlagByProductId" resultType="java.lang.String">
-        select validFlag from product where productID = #{productID}
+        select validFlag
+        from product
+        where productID = #{productID}
     </select>
     <select id="getBeforeValidFlagByProductId" resultType="java.lang.String">
-        select beforeValidFlag from product where productID = #{productID}
+        select beforeValidFlag
+        from product
+        where productID = #{productID}
     </select>
 
     <insert id="insert" parameterType="Product" keyProperty="id" useGeneratedKeys="true">
@@ -387,68 +418,68 @@
     </insert>
     <update id="update">
         UPDATE product
-        SET productID                   = #{id},
-            brandID                     = #{brandID},
-            tinyTypeID                  = #{tinyTypeID},
-            productCategory             = #{productCategory},
-            selfTypeID                  = #{selfTypeID},
-            shopID                      = #{shopID},
-            name                        = #{name},
-            searchKey                   = #{searchKey},
-            normalPrice                 = #{normalPrice},
-            price                       = #{price},
-            priceFlag                   = #{priceFlag},
-            beautyActFlag               = #{beautyActFlag},
-            ladderPriceFlag             = #{ladderPriceFlag},
-            stock                       = #{stock},
-            hasSkuFlag                  = #{hasSkuFlag},
-            mainImage                   = #{mainImage},
-            propertiesInfo              = #{propertiesInfo},
-            addTime                     = #{addTime},
-            updateTime                  = #{updateTime},
-            sellNumber                  = #{sellNumber},
-            weekSellNumber              = #{weekSellNumber},
-            beforeValidFlag             = #{beforeValidFlag},
-            validFlag                   = #{validFlag},
-            favoriteTimes               = #{favoriteTimes},
-            commentScore                = #{commentScore},
-            commentTimes                = #{commentTimes},
-            selfRecommendFlag           = #{selfRecommendFlag},
-            sysRecommendFlag            = #{sysRecommendFlag},
-            sortIndex                   = #{sortIndex},
-            featuredFlag                = #{featuredFlag},
-            featuredSortIndex           = #{featuredSortIndex},
-            productCode                 = #{productCode},
-            unit                        = #{unit},
-            synToERPFlag                = #{synToERPFlag},
-            allAreaFlag                 = #{allAreaFlag},
-            provinceIDs                 = #{provinceIDs},
-            serviceNumber               = #{serviceNumber},
-            maxBuyNumber                = #{maxBuyNumber},
-            minBuyNumber                = #{minBuyNumber},
-            packageCount                = #{packageCount},
-            byFlag                      = #{byFlag},
-            normalProductFlag           = #{normalProductFlag},
-            wholeSaleProductFlag        = #{wholeSaleProductFlag},
-            promotionProductFlag        = #{promotionProductFlag},
-            groupBuyProductFlag         = #{groupBuyProductFlag},
-            step                        = #{step},
-            actFlag                     = #{actFlag},
-            actType                     = #{actType},
-            onlineTime                  = #{onlineTime},
-            downlineTime                = #{downlineTime},
-            freePostFlag                = #{freePostFlag},
-            costPrice                   = #{costPrice},
-            costProportional            = #{costProportional},
-            costCheckFlag               = #{costCheckFlag},
-            precisehKey                 = #{precisehKey},
-            actSort                     = #{actSort},
-            productType                 = #{productType},
-            qualificationImg            = #{qualificationImg},
-            includedTax                 = #{includedTax},
-            invoiceType                 = #{invoiceType},
-            taxPoint                    = #{taxPoint},
-            supplierTaxPoint            = #{supplierTaxPoint}
+        SET productID            = #{id},
+            brandID              = #{brandID},
+            tinyTypeID           = #{tinyTypeID},
+            productCategory      = #{productCategory},
+            selfTypeID           = #{selfTypeID},
+            shopID               = #{shopID},
+            name                 = #{name},
+            searchKey            = #{searchKey},
+            normalPrice          = #{normalPrice},
+            price                = #{price},
+            priceFlag            = #{priceFlag},
+            beautyActFlag        = #{beautyActFlag},
+            ladderPriceFlag      = #{ladderPriceFlag},
+            stock                = #{stock},
+            hasSkuFlag           = #{hasSkuFlag},
+            mainImage            = #{mainImage},
+            propertiesInfo       = #{propertiesInfo},
+            addTime              = #{addTime},
+            updateTime           = #{updateTime},
+            sellNumber           = #{sellNumber},
+            weekSellNumber       = #{weekSellNumber},
+            beforeValidFlag      = #{beforeValidFlag},
+            validFlag            = #{validFlag},
+            favoriteTimes        = #{favoriteTimes},
+            commentScore         = #{commentScore},
+            commentTimes         = #{commentTimes},
+            selfRecommendFlag    = #{selfRecommendFlag},
+            sysRecommendFlag     = #{sysRecommendFlag},
+            sortIndex            = #{sortIndex},
+            featuredFlag         = #{featuredFlag},
+            featuredSortIndex    = #{featuredSortIndex},
+            productCode          = #{productCode},
+            unit                 = #{unit},
+            synToERPFlag         = #{synToERPFlag},
+            allAreaFlag          = #{allAreaFlag},
+            provinceIDs          = #{provinceIDs},
+            serviceNumber        = #{serviceNumber},
+            maxBuyNumber         = #{maxBuyNumber},
+            minBuyNumber         = #{minBuyNumber},
+            packageCount         = #{packageCount},
+            byFlag               = #{byFlag},
+            normalProductFlag    = #{normalProductFlag},
+            wholeSaleProductFlag = #{wholeSaleProductFlag},
+            promotionProductFlag = #{promotionProductFlag},
+            groupBuyProductFlag  = #{groupBuyProductFlag},
+            step                 = #{step},
+            actFlag              = #{actFlag},
+            actType              = #{actType},
+            onlineTime           = #{onlineTime},
+            downlineTime         = #{downlineTime},
+            freePostFlag         = #{freePostFlag},
+            costPrice            = #{costPrice},
+            costProportional     = #{costProportional},
+            costCheckFlag        = #{costCheckFlag},
+            precisehKey          = #{precisehKey},
+            actSort              = #{actSort},
+            productType          = #{productType},
+            qualificationImg     = #{qualificationImg},
+            includedTax          = #{includedTax},
+            invoiceType          = #{invoiceType},
+            taxPoint             = #{taxPoint},
+            supplierTaxPoint     = #{supplierTaxPoint}
         WHERE productID = #{id}
     </update>
 
@@ -464,9 +495,24 @@
         insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
         values (#{productID}, #{shopID}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex});
     </insert>
+
+    <select id="newFloorId" resultType="java.lang.Integer">
+        select id
+        from new_page_floor
+        where floorType = 1
+        limit 1
+    </select>
+
     <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
         update product
         <set>
+            <if test="floorId != null and floorId != ''">
+                floorId=#{floorId},
+            </if>
+            <if test="newvalidFlag != null and newvalidFlag != '' ">
+                newvalidFlag=#{newvalidFlag},
+            </if>
+
             <if test="brandID != null and brandID != ''">
                 brandID = #{brandID},
             </if>
@@ -659,78 +705,92 @@
                 machineType = #{machineType},
             </if>
             <if test="commodityType != null and commodityType != ''">
-                commodityType = #{commodityType}
+                commodityType = #{commodityType},
+            </if>
+            <if test="showTime!= '' and showTime!=null">
+                showTime=#{showTime},
+            </if>
+            <if test="newshowTime !=null">
+                newshowTime=#{newshowTime},
+            </if>
+            <if test="newvalidFlag == 1">
+                showFlag=1
+            </if>
+            <if test="newvalidFlag == 2">
+                showFlag=4
             </if>
         </set>
         where productID = #{productID}
     </update>
     <update id="updateImageSort">
-		update productimage set sortIndex = #{sortIndex}
-		where productImageID = #{productImageID}
+        update productimage
+        set sortIndex = #{sortIndex}
+        where productImageID = #{productImageID}
+    </update>
+    <update id="cancelImageMainFlag">
+        update productimage
+        set mainFlag = 0
+        where productID = #{productID}
+          and mainFlag = 1
+    </update>
+    <update id="setImageMainFlag">
+        update productimage
+        set mainFlag = 1
+        where productImageID = #{productImageID}
     </update>
-	<update id="cancelImageMainFlag">
-		update productimage set mainFlag = 0
-		where productID = #{productID}
-		and mainFlag = 1
-	</update>
-	<update id="setImageMainFlag">
-		update productimage set mainFlag = 1
-		where productImageID = #{productImageID}
-	</update>
     <update id="setProductImage">
-        UPDATE product SET mainImage = #{mainImage}
+        UPDATE product
+        SET mainImage = #{mainImage}
         WHERE productID = #{productID}
     </update>
     <delete id="deleteImage">
-		DELETE FROM productimage
-		WHERE productImageID = #{productImageID}
-	</delete>
+        DELETE
+        FROM productimage
+        WHERE productImageID = #{productImageID}
+    </delete>
     <delete id="mulDeleteImage">
-		DELETE FROM productimage
-		WHERE productImageID IN
-		<foreach collection="idList" item="productImageID" index="index" open="(" separator="," close=")">
+        DELETE FROM productimage
+        WHERE productImageID IN
+        <foreach collection="idList" item="productImageID" index="index" open="(" separator="," close=")">
             #{productImageID}
         </foreach>
     </delete>
 
     <delete id="deleteParameters">
-        DELETE FROM cm_product_related_parameters WHERE productId = #{productId}
+        DELETE
+        FROM cm_product_related_parameters
+        WHERE productId = #{productId}
     </delete>
 
     <delete id="deleteImageByProductId">
-        DELETE FROM productimage WHERE productID = #{productID}
+        DELETE
+        FROM productimage
+        WHERE productID = #{productID}
     </delete>
 
-    <insert id="insertParameters"  parameterType="com.caimei.modules.product.entity.ProductParameters">
-        insert into
-        cm_product_related_parameters
+    <insert id="insertParameters" parameterType="com.caimei.modules.product.entity.ProductParameters">
+        insert into cm_product_related_parameters
         (productId,
-        paramsName,
-        paramsContent,
-        delFlag)
-       values
-       (#{productId},
-        #{paramsName},
-        #{paramsContent},
-        #{delFlag})
+         paramsName,
+         paramsContent,
+         delFlag)
+        values (#{productId},
+                #{paramsName},
+                #{paramsContent},
+                #{delFlag})
     </insert>
 
     <insert id="insertStatusRecord">
-        INSERT INTO `product_status_record` (
-          `productId`,
-          `modifyUserId`,
-          `validFlag`,
-          `remarks`,
-          `addTime`
-        )
-        VALUES
-          (
-            #{productId},
-            #{modifyUserId},
-            #{validFlag},
-            #{remarks},
-            #{addTime}
-          )
+        INSERT INTO `product_status_record` (`productId`,
+                                             `modifyUserId`,
+                                             `validFlag`,
+                                             `remarks`,
+                                             `addTime`)
+        VALUES (#{productId},
+                #{modifyUserId},
+                #{validFlag},
+                #{remarks},
+                #{addTime})
     </insert>
     <insert id="addProductData">
         update product
@@ -742,36 +802,46 @@
     </insert>
 
     <select id="findAllStatusRemarks" resultType="com.caimei.modules.product.entity.ProductStatusRecord">
-        SELECT
-          id,
-          `productId`,
-          `modifyUserId`,
-          `validFlag`,
-          `remarks`,
-          `addTime`
-        FROM
-          `product_status_record`
-        WHERE
-          productId = #{productId}
-        ORDER BY
-          addTime DESC
+        SELECT id,
+               `productId`,
+               `modifyUserId`,
+               `validFlag`,
+               `remarks`,
+               `addTime`
+        FROM `product_status_record`
+        WHERE productId = #{productId}
+        ORDER BY addTime DESC
     </select>
     <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-        select shopId,commercialCode as splitCode,codeDetail as codeRemark
+        select shopId, commercialCode as splitCode, codeDetail as codeRemark
         from cm_shop_splitcode
-        where shopId=#{shopID}
+        where shopId = #{shopID}
     </select>
     <select id="findSplitCodeByProduct" resultType="java.lang.String">
-        select splitCode from product where productID = #{productID}
+        select splitCode
+        from product
+        where productID = #{productID}
     </select>
     <select id="getShopIdByName" resultType="java.lang.Integer">
-        select shopID from shop where name like concat('%',#{shopName},'%') order by shopID desc limit 1
+        select shopID
+        from shop
+        where name like concat('%', #{shopName}, '%')
+        order by shopID desc
+        limit 1
     </select>
     <select id="findSecondSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-        select css.shopId,css.commercialCode as splitCode,css.codeDetail as codeRemark
+        select css.shopId, css.commercialCode as splitCode, css.codeDetail as codeRemark
         from cm_shop_splitcode css
-        left join product p on p.shopID = css.shopId
-        where p.productID=#{id}
+                 left join product p on p.shopID = css.shopId
+        where p.productID = #{id}
+    </select>
+
+    <select id="validIList" resultType="com.caimei.modules.product.entity.Product">
+        select p.*,s.contractMobile as mobile,s.userID as userId,s.name as shopName
+        from product p
+        left join shop s on p.shopID = s.shopId
+        where p.productID = #{productID}
     </select>
+
 </mapper>
 

+ 75 - 0
src/main/resources/mappings/modules/sys/Notification.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.sys.dao.NotificationDao">
+
+	<select id="productTypeCount" resultType="com.caimei.modules.product.entity.Product">
+		SELECT * FROM `product` WHERE productType=2 AND  DATE_ADD(NOW(), INTERVAL #{yat} MONTH) > qualificationTime AND qualificationTime > NOW()
+	</select>
+
+	<select id="productTypeCount1" resultType="com.caimei.modules.product.entity.Product">
+		SELECT * FROM `product` WHERE productType=2 AND  DATE_ADD(NOW(), INTERVAL #{yat} DAY) > qualificationTime AND qualificationTime > NOW()
+	</select>
+
+	<select id="productTypeCount2" resultType="com.caimei.modules.product.entity.Product">
+		SELECT * FROM `cm_discern_receipt` a
+						  LEFT JOIN cm_receipt s ON s.receiptID = a.id
+						  LEFT JOIN shop c ON a.shopID = c.`shopID`
+		WHERE a.newReceiptType=1 AND DATE_ADD(NOW(), INTERVAL #{yat} MONTH)>s.dateStrings  AND  s.dateStrings > NOW() AND a.receStatct=0
+	</select>
+
+	<select id="productTypeCount3" resultType="com.caimei.modules.product.entity.Product">
+		SELECT * FROM `cm_discern_receipt` a
+		LEFT JOIN cm_receipt s ON s.receiptID = a.id
+		LEFT JOIN shop c ON a.shopID = c.`shopID`
+		WHERE a.newReceiptType=1 AND DATE_ADD(NOW(), INTERVAL #{yat} DAY)>s.dateStrings  AND  s.dateStrings > NOW() AND a.receStatct=0
+	</select>
+
+	<select id="notification" resultType="com.caimei.modules.sys.entity.Notification">
+		SELECT * FROM `notification`
+		<where>
+			<if test="theme!=null and theme!=''">
+				and theme LIKE CONCAT('%',#{theme},'%')
+			</if>
+		</where>
+		ORDER BY newTime desc
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	<select id="notificationId" resultType="java.lang.String">
+		SELECT shopContent FROM `notification`
+		where id=#{id}
+	</select>
+
+	<update id="Upnotification">
+		UPDATE notification SET saved=1
+		<where>
+		    <if test="id!=null">
+		and	id=#{id}
+            </if>
+	   </where>
+	</update>
+
+	<update id="hide">
+		UPDATE notification SET hide=#{hide},saved=1
+		where id=#{Id}
+
+	</update>
+
+	<update id="hides">
+		UPDATE notification SET hide=0
+	</update>
+
+	<insert id="addNotification">
+		INSERT INTO notification(theme,newTime,shopContent,porductID,shopID) VALUES (#{theme},NOW(),#{shopContent},#{porductID},#{shopID})
+	</insert>
+
+	<select id="count" resultType="java.lang.Integer">
+		select count(*) from notification where saved=1
+	</select>
+
+</mapper>

+ 14 - 3
src/main/resources/mappings/modules/user/CmUserMapper.xml

@@ -556,9 +556,20 @@
     <select id="selectByMobileOrEmail" resultType="com.caimei.modules.user.entity.CmUser">
 		select u.*,cu.mobile as operatorMobile from user u
 		left join cm_mall_operation_user cu on cu.userID = u.userID
-		where (u.bindMobile = #{mobileOrEmail}
-		or u.email = #{mobileOrEmail}
-		or (cu.mobile = #{mobileOrEmail} and cu.delFlag != 1))
+		where (u.bindMobile = #{mobileOrEmail} or u.email = #{mobileOrEmail})
+		AND u.userIdentity IN (1,2,3,4)
+		AND u.userOrganizeID = 0
+		<if test="source == 'www'">
+			AND u.registerUserTypeID IN (1,3,4)
+		</if>
+		<if test="source == 'crm'">
+			AND u.registerUserTypeID IN (1,2,3,32,4)
+		</if>
+		UNION
+		select u.*,cu.mobile as operatorMobile from user u
+		left join cm_mall_operation_user cu on cu.userID = u.userID
+		where cu.mobile = #{mobileOrEmail}
+		AND cu.delFlag != 1
 		AND u.userIdentity IN (1,2,3,4)
 		AND u.userOrganizeID = 0
 		<if test="source == 'www'">

+ 69 - 0
src/main/resources/mappings/modules/user/MessageCenter.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.user.dao.MessageCenterDao">
+<!--    <insert id="addMessageCenter">-->
+<!--        INSERT INTO message_center (shopID, clubID, userType, messageType,content,time,accountType,orderID,orderMessageType,shopMessType)-->
+<!--        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType},#{content},#{time},#{accountType},#{orderID},#{orderMessageType},#{shopMessType})-->
+<!--    </insert>-->
+    <insert id="addMessageCenter">
+        INSERT INTO message_center (shopID, clubID, userType, messageType, content,time,accountType,couponType,couponFee,couponMessageType,orderID,orderMessageType,shopMessType,productId)
+        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content},#{time},#{accountType},#{couponType},#{couponFee},#{couponMessageType},#{orderId},#{orderMessageType},#{shopMessType},#{productId})
+    </insert>
+
+    <select id="clubIdCule" resultType="java.lang.Integer">
+        SELECT clubID FROM `club` WHERE userId=#{userId}
+    </select>
+
+    <select id="contractMobile" resultType="java.lang.String">
+        SELECT contractMobile FROM club WHERE userID=#{UserID}
+    </select>
+
+    <select id="Mobile" resultType="java.lang.String">
+        SELECT contractMobile FROM shop WHERE shopID=#{shopID}
+    </select>
+
+
+    <select id="clubList" resultType="com.caimei.modules.user.entity.CmUser">
+        SELECT * FROM `user` WHERE clubId=#{clubId}  LIMIT 1
+    </select>
+    <select id="shopID" resultType="java.lang.Integer">
+        SELECT shopID FROM `product` WHERE productID=#{productID}
+    </select>
+
+    <select id="shopName" resultType="java.lang.String">
+        SELECT name FROM shop where shopID=#{shopID}
+    </select>
+
+    <select id="ClubIds" resultType="java.lang.Integer">
+        SELECT DISTINCT clubID FROM `user` WHERE YEAR(loginTime)>YEAR(NOW())-3 AND clubID IS NOT NULL
+        ORDER BY clubID DESC
+    </select>
+
+    <select id="userID" resultType="java.lang.Integer">
+        select userID from shop where shopID=#{shopID}
+    </select>
+
+    <select id="CouponList" resultType="com.caimei.modules.coupon.entity.CmCoupon">
+        SELECT * FROM cm_coupon WHERE couponType=#{couponType}
+                                  AND NOW() >= startDate
+                                  AND endDate >= NOW()
+                                  AND status=1
+                                  AND delFlag=0
+        ORDER BY id DESC
+        LIMIT 1
+    </select>
+
+    <select id="couponTime" resultType="com.caimei.modules.coupon.entity.CmCoupon">
+        SELECT * FROM `cm_coupon` WHERE
+            NOW() >= startDate
+            AND endDate >= NOW()
+            AND STATUS = 1
+            AND delFlag=0
+    </select>
+
+    <select id="count" resultType="integer">
+        SELECT COUNT(*) FROM `notification` WHERE saved=0
+    </select>
+
+
+</mapper>

+ 446 - 358
src/main/resources/mappings/modules/user/NewCmShopMapper.xml

@@ -2,8 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.user.dao.NewCmShopDao">
 
-	<sql id="newCmShopColumns">
-		a.shopID AS "shopID",
+    <sql id="newCmShopColumns">
+        a.shopID AS "shopID",
 		a.checkMan as "checkMan",
 		a.userID AS "userID",
 		a.name AS "name",
@@ -61,377 +61,465 @@
 		a.cardNumber AS "cardNumber",
 		a.chargeSupport AS "chargeSupport",
 		d.name AS "province",c.name AS "city",b.name AS "town"
-	</sql>
+    </sql>
 
-	<sql id="newCmShopJoins">
-		LEFT JOIN user u ON u.userID = a.userID
+    <sql id="newCmShopJoins">
+        LEFT JOIN user u ON u.userID = a.userID
 		LEFT JOIN town b ON b.townID=a.townID
 		LEFT JOIN city c ON c.cityID=b.cityID
 		LEFT JOIN province d ON d.provinceID=c.provinceID
-	</sql>
+    </sql>
 
-	<select id="get" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		WHERE a.shopID = #{id}
-	</select>
+    <select id="get" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        WHERE a.shopID = #{id}
+    </select>
 
-	<select id="getShopcert" resultType="com.caimei.modules.cibe.entity.ShopCert">
-		SELECT
-			*
-		FROM shopcert s
-		WHERE s.shopID = #{shopId}
-		and s.shopCertTypeID = #{type}
-	</select>
+    <select id="getShopcert" resultType="com.caimei.modules.cibe.entity.ShopCert">
+        SELECT *
+        FROM shopcert s
+        WHERE s.shopID = #{shopId}
+          and s.shopCertTypeID = #{type}
+    </select>
 
-	<select id="findList" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		<where>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="status != null and status != ''">
-				AND a.status = #{status}
-			</if>
-			<if test="contractMobile != null and contractMobile != ''">
-				AND a.contractMobile = #{contractMobile}
-			</if>
-			<if test="linkMan != null and linkMan != ''">
-				AND a.linkMan LIKE concat('%',#{linkMan},'%')
-			</if>
-			<if test="shopType !=null">
-				AND a.shopType = #{shopType}
-			</if>
-			<if test="startTime != null and startTime != ''">
-				AND (u.registerTime &gt; #{startTime} OR  u.registerTime = #{startTime})
-			</if>
-			<if test="endTime != null and endTime != ''">
-				AND (u.registerTime &lt; #{endTime} OR  u.registerTime = #{endTime})
-			</if>
-			<if test="email != null and email != ''">
-				AND u.email = #{email}
-			</if>
-			<if test="source != null and source != ''">
-				AND u.source = #{source}
-			</if>
-			<if test="shopID != null and shopID>0">
-				AND a.shopID = #{shopID}
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY case when a.status = 91 then 0 else 1 end desc, a.shopID DESC
-			</otherwise>
-		</choose>
-	</select>
+    <select id="findList" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        <where>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="status != null and status != ''">
+                AND a.status = #{status}
+            </if>
+            <if test="contractMobile != null and contractMobile != ''">
+                AND a.contractMobile = #{contractMobile}
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                AND a.linkMan LIKE concat('%',#{linkMan},'%')
+            </if>
+            <if test="shopType !=null">
+                AND a.shopType = #{shopType}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND (u.registerTime &gt; #{startTime} OR u.registerTime = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
+            </if>
+            <if test="email != null and email != ''">
+                AND u.email = #{email}
+            </if>
+            <if test="source != null and source != ''">
+                AND u.source = #{source}
+            </if>
+            <if test="shopID != null and shopID>0">
+                AND a.shopID = #{shopID}
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY case when a.status = 91 then 0 else 1 end desc, a.shopID DESC
+            </otherwise>
+        </choose>
+    </select>
 
-	<select id="findAllList" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		<where>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-		select shopId,commercialCode as splitCode,codeDetail as codeRemark,email as email,weChatFlag
-		from cm_shop_splitcode
-		where shopId = #{shopID}
-	</select>
+    <select id="findAllList" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        <where>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
+        select shopId, commercialCode as splitCode, codeDetail as codeRemark, email as email, weChatFlag
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </select>
 
-	<insert id="saveShopcert" parameterType="com.caimei.modules.cibe.entity.ShopCert" keyProperty="shopCertID" useGeneratedKeys="true">
-        INSERT INTO `shopcert` (
-        `shopID`,
-        `shopCertTypeID`,
-        `name`,
-        `image`,
-        `organization`,
-        `effectDate`,
-        `loseEfficacyDate`
-        )
-        VALUES(
-        #{shopID},
-        #{shopCertTypeID},
-        #{name},
-        #{image},
-        #{organization},
-        #{effectDate},
-        #{loseEfficacyDate}
-        )
+    <insert id="saveShopcert" parameterType="com.caimei.modules.cibe.entity.ShopCert" keyProperty="shopCertID"
+            useGeneratedKeys="true">
+        INSERT INTO `shopcert` (`shopID`,
+                                `shopCertTypeID`,
+                                `name`,
+                                `image`,
+                                `organization`,
+                                `effectDate`,
+                                `loseEfficacyDate`)
+        VALUES (#{shopID},
+                #{shopCertTypeID},
+                #{name},
+                #{image},
+                #{organization},
+                #{effectDate},
+                #{loseEfficacyDate})
     </insert>
 
 
-	<insert id="insert" parameterType="NewCmShop"  keyProperty="shopID" useGeneratedKeys="true">
-		INSERT INTO shop(
-			userID,
-			name,
-			sname,
-			logo,
-			legalPerson,
-			businessLicense,
-			businessLicenseImage,
-			taxCertificate,
-			taxCertificateImage,
-			provinceID,
-			cityID,
-			townID,
-			address,
-			registeredCapital,
-			nature,
-			turnover,
-			linkMan,
-			contractPhone,
-			contractMobile,
-			contractEmail,
-			fax,
-			zipCode,
-			info,
-			productDesc,
-			addTime,
-			auditStatus,
-			auditTime,
-			auditNote,
-			validFlag,
-			status,
-			maintenanceFee,
-			maintenanceDate,
-			businessScope,
-			firstShopType,
-			secondShopType,
-			medicalPracticeLicenseImg1,
-			medicalPracticeLicenseImg2,
-			medicalPracticeLicenseImg3,
-			mainpro,
-			socialCreditCode,
-		    shopType
-		) VALUES (
-			#{userID},
-			#{name},
-			#{sname},
-			#{logo},
-			#{legalPerson},
-			#{businessLicense},
-			#{businessLicenseImage},
-			#{taxCertificate},
-			#{taxCertificateImage},
-			#{provinceID},
-			#{cityID},
-			#{townID},
-			#{address},
-			#{registeredCapital},
-			#{nature},
-			#{turnover},
-			#{linkMan},
-			#{contractPhone},
-			#{contractMobile},
-		    #{contractEmail},
-			#{fax},
-			#{zipCode},
-			#{info},
-			#{productDesc},
-			#{addTime},
-			#{auditStatus},
-			#{auditTime},
-			#{auditNote},
-			#{validFlag},
-			#{status},
-			#{maintenanceFee},
-			#{maintenanceDate},
-			#{businessScope},
-			#{firstShopType},
-			#{secondShopType},
-			#{medicalPracticeLicenseImg1},
-			#{medicalPracticeLicenseImg2},
-			#{medicalPracticeLicenseImg3},
-			#{mainpro},
-			#{socialCreditCode},
-		    #{shopType}
-		)
-	</insert>
-	<insert id="insertSplitCode">
-		insert into cm_shop_splitcode
-		(shopId, commercialCode, codeDetail,email,weChatFlag)
-		values (#{shopId},#{splitCode},#{codeRemark},#{email},#{weChatFlag})
-	</insert>
-	<insert id="insertSepcial" parameterType="NewCmShop"  keyProperty="shopID" useGeneratedKeys="true">
-		insert into shop(name,linkMan,contractMobile,status,addTime,shopType)
-		VALUES (#{name},#{linkMan},#{contractMobile},#{status},now(),2)
-	</insert>
-	<update id="update">
-		UPDATE shop
-		<set>
-			<if test="name != null and name != ''" >
-			name = #{name},
-			</if>
-		    website = #{website},
-			wxOfficialAccount = #{wxOfficialAccount},
-			wxApplets = #{wxApplets},
-			<if test="chargeSupport != null" >
-				chargeSupport=#{chargeSupport},
-			</if>
-			<if test="sname != null and sname != ''" >
-				sname = #{sname},
-			</if>
-			<if test="logo != null and logo != ''" >
-				logo = #{logo},
-			</if>
-			<if test="legalPerson != null and legalPerson != ''" >
-				legalPerson = #{legalPerson},
-			</if>
-			<if test="businessLicense != null and businessLicense != ''" >
-				businessLicense = #{businessLicense},
-			</if>
-			<if test="businessLicenseImage != null and businessLicenseImage != ''" >
-				businessLicenseImage = #{businessLicenseImage},
-			</if>
-			<if test="taxCertificate != null and taxCertificate != ''" >
-				taxCertificate = #{taxCertificate},
-			</if>
-			<if test="taxCertificateImage != null and taxCertificateImage != ''" >
-				taxCertificateImage = #{taxCertificateImage},
-			</if>
-			<if test="address != null and address != ''" >
-				address = #{address},
-			</if>
-			<if test="registeredCapital != null and registeredCapital != ''" >
-				registeredCapital = #{registeredCapital},
-			</if>
-			<if test="nature != null and nature != ''" >
-				nature = #{nature},
-			</if>
-			<if test="turnover != null and turnover != ''" >
-				turnover = #{turnover},
-			</if>
-			<if test="linkMan != null and linkMan != ''" >
-				linkMan = #{linkMan},
-			</if>
-			<if test="contractPhone != null and contractPhone != ''" >
-				contractPhone = #{contractPhone},
-			</if>
-			<if test="contractMobile != null and contractMobile != ''" >
-				contractMobile = #{contractMobile},
-			</if>
-			<if test="contractEmail != null and contractEmail != ''" >
-				contractEmail = #{contractEmail},
-			</if>
-			<if test="fax != null and fax != ''" >
-				fax = #{fax},
-			</if>
-			<if test="zipCode != null and zipCode != ''" >
-				zipCode = #{zipCode},
-			</if>
-			<if test="info != null and info != ''" >
-				info = #{info},
-			</if>
-			<if test="productDesc != null and productDesc != ''" >
-				productDesc = #{productDesc},
-			</if>
-			<if test="status != null and status != ''" >
-				status = #{status},
-			</if>
-			<if test="provinceID != null and provinceID != ''" >
-				provinceID = #{provinceID},
-			</if>
-			<if test="cityID != null and cityID != ''" >
-				cityID = #{cityID},
-			</if>
-			<if test="townID != null and townID != ''" >
-				townID = #{townID},
-			</if>
-			<if test="maintenanceFee != null and maintenanceFee != ''" >
-				maintenanceFee = #{maintenanceFee},
-			</if>
-			<if test="maintenanceDate != null and maintenanceDate != ''" >
-				maintenanceDate = #{maintenanceDate},
-			</if>
-			<if test="businessScope != null and businessScope != ''" >
-				businessScope = #{businessScope},
-			</if>
-			<if test="firstShopType != null and firstShopType != ''" >
-				firstShopType=#{firstShopType},
-			</if>
-			<if test="secondShopType != null and secondShopType != ''" >
-				secondShopType=#{secondShopType},
-			</if>
-			<if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''" >
-				medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
-			</if>
-			<if test="medicalPracticeLicenseImg2 != null and medicalPracticeLicenseImg2 != ''" >
-				medicalPracticeLicenseImg2=#{medicalPracticeLicenseImg2},
-			</if>
-			<if test="medicalPracticeLicenseImg3 != null and medicalPracticeLicenseImg3 != ''" >
-				medicalPracticeLicenseImg3=#{medicalPracticeLicenseImg3},
-			</if>
-			<if test="mainpro != null and mainpro != ''">
-				mainpro=#{mainpro},
-			</if>
-			<if test="ableRebateAmount != null">
-				ableRebateAmount=#{ableRebateAmount},
-			</if>
-			<if test="rebateAmount != null">
-				rebateAmount=#{rebateAmount},
-			</if>
-			<if test="bankAccount != null">
-				bankAccount=#{bankAccount},
-			</if>
-			<if test="bankAccountName != null">
-				bankAccountName=#{bankAccountName},
-			</if>
-			<if test="bankName != null">
-				bankName=#{bankName},
-			</if>
-			<if test="socialCreditCode != null">
-				socialCreditCode = #{socialCreditCode}
-			</if>
-		</set>
-		WHERE shopID = #{shopID}
-	</update>
+    <insert id="insert" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
+        INSERT INTO shop(userID,
+                         name,
+                         sname,
+                         logo,
+                         legalPerson,
+                         businessLicense,
+                         businessLicenseImage,
+                         taxCertificate,
+                         taxCertificateImage,
+                         provinceID,
+                         cityID,
+                         townID,
+                         address,
+                         registeredCapital,
+                         nature,
+                         turnover,
+                         linkMan,
+                         contractPhone,
+                         contractMobile,
+                         contractEmail,
+                         fax,
+                         zipCode,
+                         info,
+                         productDesc,
+                         addTime,
+                         auditStatus,
+                         auditTime,
+                         auditNote,
+                         validFlag,
+                         status,
+                         maintenanceFee,
+                         maintenanceDate,
+                         businessScope,
+                         firstShopType,
+                         secondShopType,
+                         medicalPracticeLicenseImg1,
+                         medicalPracticeLicenseImg2,
+                         medicalPracticeLicenseImg3,
+                         mainpro,
+                         socialCreditCode,
+                         shopType)
+        VALUES (#{userID},
+                #{name},
+                #{sname},
+                #{logo},
+                #{legalPerson},
+                #{businessLicense},
+                #{businessLicenseImage},
+                #{taxCertificate},
+                #{taxCertificateImage},
+                #{provinceID},
+                #{cityID},
+                #{townID},
+                #{address},
+                #{registeredCapital},
+                #{nature},
+                #{turnover},
+                #{linkMan},
+                #{contractPhone},
+                #{contractMobile},
+                #{contractEmail},
+                #{fax},
+                #{zipCode},
+                #{info},
+                #{productDesc},
+                #{addTime},
+                #{auditStatus},
+                #{auditTime},
+                #{auditNote},
+                #{validFlag},
+                #{status},
+                #{maintenanceFee},
+                #{maintenanceDate},
+                #{businessScope},
+                #{firstShopType},
+                #{secondShopType},
+                #{medicalPracticeLicenseImg1},
+                #{medicalPracticeLicenseImg2},
+                #{medicalPracticeLicenseImg3},
+                #{mainpro},
+                #{socialCreditCode},
+                #{shopType})
+    </insert>
+    <insert id="insertSplitCode">
+        insert into cm_shop_splitcode
+            (shopId, commercialCode, codeDetail, email, weChatFlag)
+        values (#{shopId}, #{splitCode}, #{codeRemark}, #{email}, #{weChatFlag})
+    </insert>
+    <insert id="insertSepcial" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
+        insert into shop(name, linkMan, contractMobile, status, addTime, shopType)
+        VALUES (#{name}, #{linkMan}, #{contractMobile}, #{status}, now(), 2)
+    </insert>
+    <update id="update">
+        UPDATE shop
+        <set>
+            <if test="name != null and name != ''">
+                name = #{name},
+            </if>
+            website = #{website},
+            wxOfficialAccount = #{wxOfficialAccount},
+            wxApplets = #{wxApplets},
+            <if test="chargeSupport != null">
+                chargeSupport=#{chargeSupport},
+            </if>
+            <if test="sname != null and sname != ''">
+                sname = #{sname},
+            </if>
+            <if test="logo != null and logo != ''">
+                logo = #{logo},
+            </if>
+            <if test="legalPerson != null and legalPerson != ''">
+                legalPerson = #{legalPerson},
+            </if>
+            <if test="businessLicense != null and businessLicense != ''">
+                businessLicense = #{businessLicense},
+            </if>
+            <if test="businessLicenseImage != null and businessLicenseImage != ''">
+                businessLicenseImage = #{businessLicenseImage},
+            </if>
+            <if test="taxCertificate != null and taxCertificate != ''">
+                taxCertificate = #{taxCertificate},
+            </if>
+            <if test="taxCertificateImage != null and taxCertificateImage != ''">
+                taxCertificateImage = #{taxCertificateImage},
+            </if>
+            <if test="address != null and address != ''">
+                address = #{address},
+            </if>
+            <if test="registeredCapital != null and registeredCapital != ''">
+                registeredCapital = #{registeredCapital},
+            </if>
+            <if test="nature != null and nature != ''">
+                nature = #{nature},
+            </if>
+            <if test="turnover != null and turnover != ''">
+                turnover = #{turnover},
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                linkMan = #{linkMan},
+            </if>
+            <if test="contractPhone != null and contractPhone != ''">
+                contractPhone = #{contractPhone},
+            </if>
+            <if test="contractMobile != null and contractMobile != ''">
+                contractMobile = #{contractMobile},
+            </if>
+            <if test="contractEmail != null and contractEmail != ''">
+                contractEmail = #{contractEmail},
+            </if>
+            <if test="fax != null and fax != ''">
+                fax = #{fax},
+            </if>
+            <if test="zipCode != null and zipCode != ''">
+                zipCode = #{zipCode},
+            </if>
+            <if test="info != null and info != ''">
+                info = #{info},
+            </if>
+            <if test="productDesc != null and productDesc != ''">
+                productDesc = #{productDesc},
+            </if>
+            <if test="status != null and status != ''">
+                status = #{status},
+            </if>
+            <if test="provinceID != null and provinceID != ''">
+                provinceID = #{provinceID},
+            </if>
+            <if test="cityID != null and cityID != ''">
+                cityID = #{cityID},
+            </if>
+            <if test="townID != null and townID != ''">
+                townID = #{townID},
+            </if>
+            <if test="maintenanceFee != null and maintenanceFee != ''">
+                maintenanceFee = #{maintenanceFee},
+            </if>
+            <if test="maintenanceDate != null and maintenanceDate != ''">
+                maintenanceDate = #{maintenanceDate},
+            </if>
+            <if test="businessScope != null and businessScope != ''">
+                businessScope = #{businessScope},
+            </if>
+            <if test="firstShopType != null and firstShopType != ''">
+                firstShopType=#{firstShopType},
+            </if>
+            <if test="secondShopType != null and secondShopType != ''">
+                secondShopType=#{secondShopType},
+            </if>
+            <if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''">
+                medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
+            </if>
+            <if test="medicalPracticeLicenseImg2 != null and medicalPracticeLicenseImg2 != ''">
+                medicalPracticeLicenseImg2=#{medicalPracticeLicenseImg2},
+            </if>
+            <if test="medicalPracticeLicenseImg3 != null and medicalPracticeLicenseImg3 != ''">
+                medicalPracticeLicenseImg3=#{medicalPracticeLicenseImg3},
+            </if>
+            <if test="mainpro != null and mainpro != ''">
+                mainpro=#{mainpro},
+            </if>
+            <if test="ableRebateAmount != null">
+                ableRebateAmount=#{ableRebateAmount},
+            </if>
+            <if test="rebateAmount != null">
+                rebateAmount=#{rebateAmount},
+            </if>
+            <if test="bankAccount != null">
+                bankAccount=#{bankAccount},
+            </if>
+            <if test="bankAccountName != null">
+                bankAccountName=#{bankAccountName},
+            </if>
+            <if test="bankName != null">
+                bankName=#{bankName},
+            </if>
+            <if test="socialCreditCode != null">
+                socialCreditCode = #{socialCreditCode}
+            </if>
+        </set>
+        WHERE shopID = #{shopID}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM shop
+        WHERE shopID = #{id}
+    </delete>
+
+    <delete id="deleteCert">
+        DELETE
+        FROM shopcert
+        WHERE shopID = #{shopID}
+    </delete>
+    <delete id="deleteSplitCode">
+        delete
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </delete>
 
-	<delete id="delete">
-		DELETE FROM shop
-		WHERE shopID = #{id}
-	</delete>
+    <update id="updateAbleRebateAmount" parameterType="NewCmShop">
+        update shop
+        set ableRebateAmount = #{ableRebateAmount}
+        where shopID = #{shopID}
+    </update>
+
+    <update id="backAbleRebateAmount" parameterType="NewCmShop">
+        update shop
+        set ableRebateAmount = (ableRebateAmount + #{balancePayFee})
+        where shopID = #{shopID}
+    </update>
+
+    <update id="updateRebateAmount">
+        update shop
+        set rebateAmount = (rebateAmount - #{balancePayFee})
+        where shopID = #{shopID}
+    </update>
+    <update id="offline">
+        update shop
+        set status = 91
+        where shopID = #{shopID}
+    </update>
+    <update id="online">
+        update shop
+        set status = 90
+        where shopID = #{shopID}
+    </update>
+
+    <select id="maintenanceList" resultType="CmDiscernReceipt">
+        SELECT
+        c.validityDate as validityDate, c.dateStrings as expirationDate,a.id as receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
+        FROM cm_discern_receipt a
+        LEFT JOIN shop s ON s.shopID = a.shopID
+        LEFT JOIN cm_receipt c ON c.receiptID = a.id
+        <where>
+            AND a.shopID=#{shopID}
+            AND a.newReceiptType=1
+            <if test="startTime != null and startTime != ''">
+                AND (a.receiptDate &gt; #{startTime} OR a.receiptDate = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (a.receiptDate &lt; #{endTime} OR a.receiptDate = #{endTime})
+            </if>
+            and a.receiptDate is not null
+            ORDER BY a.receiptDate DESC
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+        </choose>
+    </select>
+    <insert id="Removethelastfee">
+        insert into cm_discern_receipt
+            (shopID, receStatct, receiptDate, delFlag, newReceiptType)
+        values (#{shopID}, #{receStatct}, #{receiptDate}, 1, 1)
+    </insert>
 
-	<delete id="deleteCert">
-		DELETE FROM shopcert
-		WHERE shopID = #{shopID}
-	</delete>
-	<delete id="deleteSplitCode">
-		delete from cm_shop_splitcode
-		where shopId = #{shopID}
-	</delete>
+    <select id="therectip" resultType="Integer">
+        SELECT id FROM cm_discern_receipt WHERE receStatct=2
+        ORDER BY id DESC
+        LIMIT 1
+    </select>
 
-	<update id="updateAbleRebateAmount" parameterType="NewCmShop">
-		update shop set ableRebateAmount = #{ableRebateAmount} where shopID = #{shopID}
-	</update>
 
-	<update id="backAbleRebateAmount" parameterType="NewCmShop">
-		update shop set ableRebateAmount = (ableRebateAmount + #{balancePayFee}) where shopID = #{shopID}
-	</update>
+    <update id="Removethelast">
+        update cm_discern_receipt
+        set newReceiptType=1,
+            receStatct    = 1
+        where id = #{receiptID}
+    </update>
+
+    <insert id="addthelast">
+        insert cm_discern_receipt
+       (receiptDate,newReceiptType,
+            receStatct,delFlag,shopID)
+            value (now(),1,2,1,#{shopID})
+    </insert>
+
+    <insert id="cmreceipt">
+        insert into cm_receipt
+            (validityDate, dateStrings, receiptID)
+        values (#{validityDate}, #{expirationDate}, #{receiptID})
+    </insert>
+
+    <select id="cmrectiptlist" resultType="com.caimei.modules.order.entity.CmDiscernReceipt">
+        SELECT r.receiptID as receiptID,r.dateStrings  as expirationDate,
+               r.validityDate as validityDate,c.receStatct as receStatct
+        FROM cm_receipt r
+                 LEFT JOIN cm_discern_receipt c ON c.id = r.receiptID
+                 LEFT JOIN shop s ON s.shopID = c.shopID
+        WHERE c.shopID = #{shopID}
+          AND c.newReceiptType = 1
+        ORDER BY r.id DESC
+        LIMIT 1
+    </select>
+    <select id="cmrectCount" resultType="java.lang.Integer">
+        SELECT count(*)
+        FROM cm_receipt r
+                 LEFT JOIN cm_discern_receipt c ON c.id = r.receiptID
+                 LEFT JOIN shop s ON s.shopID = c.shopID
+        WHERE c.shopID = #{shopID}
+          AND c.newReceiptType = 1
+        ORDER BY r.id DESC
+        LIMIT 1
+    </select>
 
-	<update id="updateRebateAmount">
-		update shop set rebateAmount = (rebateAmount - #{balancePayFee})
-		where shopID = #{shopID}
-	</update>
-	<update id="offline">
-		update shop set status = 91 where shopID = #{shopID}
-	</update>
-	<update id="online">
-		update shop set status = 90 where shopID= #{shopID}
-	</update>
 </mapper>
+
+
+

+ 2 - 3
src/main/webapp/WEB-INF/views/modules/archive/cmOrderArchiveForm.jsp

@@ -42,11 +42,10 @@
          * jquery控制input只能输入数字
          */
         function onlynum(obj) {
-            debugger
             obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
 			var orderArchiveId = $("#id").val();
 			var shopOrderId = $("#shopOrderId").val();
-			if (shopOrderId.length >= 3) {
+			if (shopOrderId.length > 0) {
 				$.post("${ctx}/archive/cmOrderArchive/checkShopOrderId",{"id":orderArchiveId,"shopOrderId":shopOrderId},function (result) {
 					if (result.code == 0) {
 						$("#clubName").val(result.clubName);
@@ -217,7 +216,7 @@
 		<div class="control-group">
 			<label class="control-label"><font color="red">*</font>子订单ID:</label>
 			<div class="controls">
-                <form:input path="shopOrderId" htmlEscape="false" maxlength="8" class="input-xlarge required" onkeyup="onlynum(this)"/>
+                <form:input path="shopOrderId" htmlEscape="false" maxlength="8" class="input-xlarge required" onblur="onlynum(this)"/>
             </div>
 		</div>
 		<div class="control-group">

+ 455 - 220
src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp

@@ -6,7 +6,7 @@
     <title>申请退款退货</title>
     <meta name="decorator" content="default"/>
     <style>
-         .form-horizontal .controls{margin-left:0}
+        .form-horizontal .controls{margin-left:0}
         #increase,#decrease,.lineNum{width:30px;height:30px}
         .lineNum{text-align:center}
         .dateInput input{width:150px}
@@ -26,7 +26,7 @@
         .upload-content .conList ol li{width:114px;min-height:80px;text-align:center;background:#fff;position:relative;top:120px}
         .hide-pic{display:none !important}
         .upload-tips{margin:10px 0}
-         .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -36,7 +36,7 @@
                     //线下转账
                     if (${!returnOnline}){
                         //判断退款金额是否和填写金额总和一致
-                        var obj = document.getElementsByName("returnedWay");
+                        var obj = document.getElementsByClassName("check-item-review");
                         var checked0 = obj[0].checked;
                         var checked1 = obj[1].checked;
                         if(!checked1 && !checked0){
@@ -69,7 +69,6 @@
                                 return;
                             }
                         }
-
                         if(checked1){
                             var refundBalanceFee = $('#refundBalanceFee').val();
                             if( refundBalanceFee == null || refundBalanceFee == ""){
@@ -85,10 +84,22 @@
                             refundFee = 0;
                         }
                         refundFee = parseFloat(refundFee);
-                        var  number = refundFee - totalFee;
-                        if(number > 0.1 || number < -0.1){
-                            alertx("各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请");
-                            return;
+                        var refundType = $("#refundType").val();
+                        console.log("refundType------------>"+refundType);
+                        if(1==refundType){
+                            var  number = refundFee - totalFee;
+                            if(number > 0.1 || number < -0.1){
+                                alertx("各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请");
+                                return;
+                            }
+                        }else{
+                            var refundFee = $("#freeRefundFee").val();
+                            console.log("自定义退款金额------------》"+refundFee);
+                            if(refundFee == "" || refundFee == null){
+                                refundFee = 0;
+                                alertx("请填写自定义退款金额!");
+                                return;
+                            }
                         }
 
                         if (${cmDiscernReceipt.payWay eq 1}) {
@@ -107,10 +118,10 @@
                             }
                         }
                     }else if (${returnOnline}){
-                        var obj = document.getElementsByName("returnedWay");
+                        var obj = document.getElementsByClassName("check-item-review");
                         var checked0 = obj[0].checked;
-                        var checked1 = obj[1].checked;
-                        if(!checked1 && !checked0){
+                        // var checked1 = obj[1].checked;
+                        if(!checked0){
                             alertx("请选择退款方式");
                             return;
                         }
@@ -162,8 +173,8 @@
         }
 
         function showBankInfo() {
-                if (${!returnOnline}){
-                var obj = document.getElementsByName("returnedWay"),
+            if (${!returnOnline}){
+                var obj = document.getElementsByClassName("refundOfflineFee"),
                     blockEle = $('.refund-details-block');
                 if(obj){
                     if(obj[0].checked){
@@ -255,14 +266,42 @@
     <table id="contentTable" class="table table-striped table-bordered table-condensed">
         <tr>
             <td><b>退款编号:</b>
-                ${empty returnedNo?'':(returnedNo)}
+                    ${empty returnedNo?'':(returnedNo)}
             </td>
+            <c:if test="${cmReturnedPurchase.refundType eq 1 or cmReturnedPurchase.refundType eq 2}">
+                <td><b>退款模式:</b>
+                    <form:select path="refundType" class="input-medium" id="refundType" onchange="changeType()">
+                        <form:option value="1">按商品金额退款</form:option>
+                        <form:option value="2">自定义金额退款</form:option>
+                    </form:select>
+                </td>
+            </c:if>
+            <c:if test="${cmReturnedPurchase.refundType eq 3}">
+                <td><b>退款模式:</b>
+                    <form:select path="refundType" class="input-medium" id="refundType" onchange="changeType()">
+                        <form:option value="2">自定义金额退款</form:option>
+                    </form:select>
+                </td>
+            </c:if>
             <td><b>申请时间:</b>
                     ${returnTime}
             </td>
-            <td><b>申请金额:</b>
-                <span class="refundFee"><fmt:formatNumber value="${empty cmReturnedPurchase.refundFee?'0.00':(cmReturnedPurchase.refundFee)}" pattern="#0.00"/></span>元
-            </td>
+            <c:if test="${cmReturnedPurchase.refundType eq 1}">
+                <td id="spt"><b>申请金额:</b>
+                    <span class="refundFee"><fmt:formatNumber value="${empty cmReturnedPurchase.refundFee?'0.00':(cmReturnedPurchase.refundFee)}" pattern="#0.00"/></span>元
+                </td>
+                <td id="zdy" hidden><b>申请金额:</b>
+                    <from:input id="freeRefundFee" path="freeRefundFee" onkeyup="num(this)"   placeholder="¥0.00" value="${empty cmReturnedPurchase.freeRefundFee?'':(cmReturnedPurchase.freeRefundFee)}"></from:input>
+                </td>
+            </c:if>
+            <c:if test="${cmReturnedPurchase.refundType eq 2 or cmReturnedPurchase.refundType eq 3}">
+                <td id="spt" hidden><b>申请金额:</b>
+                    <span class="refundFee"><fmt:formatNumber value="${empty cmReturnedPurchase.refundFee?'0.00':(cmReturnedPurchase.refundFee)}" pattern="#0.00"/></span>元
+                </td>
+                <td id="zdy"><b>申请金额:</b>
+                    <from:input id="freeRefundFee" path="freeRefundFee" onkeyup="num(this)"   placeholder="¥0.00" value="${empty cmReturnedPurchase.freeRefundFee?'':(cmReturnedPurchase.freeRefundFee)}"></from:input>
+                </td>
+            </c:if>
             <td><b>退款状态:</b>
                 <c:if test="${empty status}">
                     待申请
@@ -290,11 +329,21 @@
                         线上退回
                     </c:if>
                     <c:if test="${!returnOnline}">
-                        <input class="check-item-review refundOfflineFee" type="checkbox"   name="returnedWay" value='3' onclick="showBankInfo()"/>
+                        <c:if test="${cmReturnedPurchase.refundOfflineFee>0}">
+                            <input class="check-item-review refundOfflineFee" checked type="checkbox" onclick="showBankInfo()"/>
+                        </c:if>
+                        <c:if test="${empty cmReturnedPurchase.refundOfflineFee or cmReturnedPurchase.refundOfflineFee eq 0}">
+                            <input class="check-item-review refundOfflineFee" type="checkbox" onclick="showBankInfo()"/>
+                        </c:if>
                         线下转账
                         <from:input path="refundOfflineFee" onkeyup="num(this)"   placeholder="¥0.00" value="${empty cmReturnedPurchase.refundOfflineFee?'':(cmReturnedPurchase.refundOfflineFee)}"></from:input>
-                        <c:if test="${empty order.rechargeGoods}">
-                            <input class="check-item-review refundBalanceFee" type="checkbox"  name="returnedWay" value='1'/>
+                        <c:if test="${order.rechargeGoods ne 1 && order.rechargeGoods ne 2}">
+                            <c:if test="${cmReturnedPurchase.refundBalanceFee>0}">
+                                <input class="check-item-review refundBalanceFee" checked type="checkbox"/>
+                            </c:if>
+                            <c:if test="${empty cmReturnedPurchase.refundBalanceFee or cmReturnedPurchase.refundBalanceFee eq 0}">
+                                <input class="check-item-review refundBalanceFee" type="checkbox"/>
+                            </c:if>
                             账户余额
                             <from:input path="refundBalanceFee" onkeyup="num(this)" placeholder="¥0.00" value="${empty cmReturnedPurchase.refundBalanceFee?'':(cmReturnedPurchase.refundBalanceFee)}"></from:input>
                         </c:if>
@@ -306,7 +355,7 @@
                         <from:input path="bankAccountName"  value="${empty cmReturnedPurchase.bankAccountName?'':(cmReturnedPurchase.bankAccountName)}"></from:input>
                         <font color="red">*</font>账号:
                         <from:input path="bankAccountNo"  value="${empty cmReturnedPurchase.bankAccountNo?'':(cmReturnedPurchase.bankAccountNo)}"></from:input>
-                        <%--<br>&nbsp;&nbsp;&nbsp;&nbsp;--%>
+                            <%--<br>&nbsp;&nbsp;&nbsp;&nbsp;--%>
                         <font color="red">*</font>开户行:
                         <from:input path="openBank"  value="${empty cmReturnedPurchase.openBank?'':(cmReturnedPurchase.openBank)}"></from:input>
                         <font color="red">*</font>账户类型:
@@ -457,210 +506,332 @@
                     <font>无退款</font>
                 </c:if>
                 <c:if test="${order.refundType == 1}">
-                    <font color="#ff8c00">部分退款</font>
+                    <font>部分退款</font>
                 </c:if>
                 <c:if test="${order.refundType == 2}">
-                    <font color="green">已退款</font>
+                    <font>已退款</font>
                 </c:if></td>
             </td>
         </tr>
         <tr>
             <td>
-            机构:${order.buyer}<c:if test="${order.organizeID == 3}"></c:if>
+                机构:${order.buyer}<c:if test="${order.organizeID == 3}"></c:if>
             </td>
             <td>
-            收货人:${order.bpOrderUserinfo.shouHuoRen}(${order.bpOrderUserinfo.mobile})
+                收货人:${order.bpOrderUserinfo.shouHuoRen}(${order.bpOrderUserinfo.mobile})
             </td>
             <td  colspan="2">
-            地址:${order.bpOrderUserinfo.province}${order.bpOrderUserinfo.city}${order.bpOrderUserinfo.town}${order.bpOrderUserinfo.address}
+                地址:${order.bpOrderUserinfo.province}${order.bpOrderUserinfo.city}${order.bpOrderUserinfo.town}${order.bpOrderUserinfo.address}
             </td>
         </tr>
     </table>
-        <c:forEach items="${order.newShopOrders}" var="shopOrder" varStatus="status">
-            <c:if test="${!shopOrder.defaultStatus}">
-                <table id="shopOrderTable${status.index}" class="table shopOrderTable table-striped table-bordered table-condensed">
-                    <thead></thead>
+    <c:forEach items="${order.newShopOrders}" var="shopOrder" varStatus="status">
+        <c:if test="${!shopOrder.defaultStatus}">
+            <table id="shopOrderTable${status.index}" class="table shopOrderTable table-striped table-bordered table-condensed">
+                <thead></thead>
+                <tr>
+                    <td style="width: 300px;">
+                        子订单号(ID):${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})
+                    </td>
+                    <td  style="width: 275px;">
+                        子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00" maxFractionDigits="2" />
+                    </td>
+                    <td>
+                        收款状态:${fns:getDictLabel(shopOrder.shopReceiptStatus,'receiptStatus' ,'' )}
+                    </td>
+                    <td>
+                        发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
+                    </td>
+                    <td>
+                        付款状态:${fns:getDictLabel(shopOrder.payStatus,'payStatus' ,'' )}
+                    </td>
+                    <td>
+                        供应商:${shopOrder.shopName} &nbsp;&nbsp;
+                        <c:if test="${not empty shopOrder.commercialCode}">
+                            <font color="red" class="businessNumber">(商户号:&nbsp;&nbsp;${shopOrder.commercialCode})</font>
+                        </c:if>
+                    </td>
+                </tr>
+                <c:if test="${order.onlinePayFlag eq 0}">
                     <tr>
-                        <td style="width: 300px;">
-                            子订单号(ID):${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})
-                        </td>
-                        <td  style="width: 275px;">
-                            子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
                         <td>
-                            收款状态:${fns:getDictLabel(shopOrder.shopReceiptStatus,'receiptStatus' ,'' )}
+                            商品总额:¥<fmt:formatNumber type="number" value="${shopOrder.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
                         </td>
                         <td>
-                            发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
+                            优惠:¥<fmt:formatNumber type="number" value="${shopOrder.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
                         </td>
                         <td>
-                            付款状态:${fns:getDictLabel(shopOrder.payStatus,'payStatus' ,'' )}
+                            应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.realPay}" pattern="0.00" maxFractionDigits="2" />
                         </td>
                         <td>
-                            供应商:${shopOrder.shopName} &nbsp;&nbsp;
-                            <c:if test="${not empty shopOrder.commercialCode}">
-                                <font color="red" class="businessNumber">(商户号:&nbsp;&nbsp;${shopOrder.commercialCode})</font>
-                            </c:if>
+                            已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
+                        </td>
+                        <td colspan="2">
+                            待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.restAmount}" pattern="0.00" maxFractionDigits="2" />
                         </td>
                     </tr>
-                    <c:if test="${order.onlinePayFlag eq 0}">
-                        <tr>
-                            <td>
-                                商品总额:¥<fmt:formatNumber type="number" value="${shopOrder.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                            <td>
-                                优惠:¥<fmt:formatNumber type="number" value="${shopOrder.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                            <td>
-                                应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.realPay}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                            <td>
-                                已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                            <td colspan="2">
-                                待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.restAmount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                        </tr>
-                    </c:if>
-                        <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
+                </c:if>
+                <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
                     <tr>
-                            <td colspan="5">
-                                <table id="newOrderProductTable" class="table table-striped table-bordered table-condensed">
-                                    <tr>
-                                        <td rowspan="4" style="width: 295px;height: 125px">
-                                            <img style="width: 100px;height: 100px" src="${newOrderProduct.image}">
-                                            <font title="${newOrderProduct.name}">${fns:abbr(newOrderProduct.name,30)}</font>
-                                        </td>
-                                        <td style="width: 275px;">
-                                            单价:¥<fmt:formatNumber type="number" value="${newOrderProduct.price}"  pattern="0.00" maxFractionDigits="2" />
-                                            <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
-                                        </td>
-                                        <td >
-                                            折扣 :${newOrderProduct.discount}%
-                                        </td>
-                                        <td >
-                                            折后单价 :¥<span class="discountPrice"><fmt:formatNumber type="number" value="${newOrderProduct.discountPrice}" pattern="0.00" maxFractionDigits="2" /></span>
-                                        </td>
-                                        <td >
-                                            数量(赠品):${newOrderProduct.num}(${newOrderProduct.presentNum})
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <td style="width: 275px;">
-                                            税率:${newOrderProduct.taxRate}%
-                                        </td>
-                                        <td>
-                                            税费:¥<span class="addedValueTax"><fmt:formatNumber type="number" value="${newOrderProduct.addedValueTax}" pattern="0.00" maxFractionDigits="2" /></span>
-                                        </td>
-                                        <td colspan="2">
-                                            总额:¥<fmt:formatNumber type="number" value="${newOrderProduct.shouldPayFee}"  pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                    </tr>
-                                    <tr>
+                        <td colspan="5">
+                            <table id="newOrderProductTable" class="table table-striped table-bordered table-condensed">
+                                <tr>
+                                    <td rowspan="4" style="width: 295px;height: 125px">
+                                        <img style="width: 100px;height: 100px" src="${newOrderProduct.image}">
+                                        <font title="${newOrderProduct.name}">${fns:abbr(newOrderProduct.name,30)}</font>
+                                    </td>
+                                    <td style="width: 275px;">
+                                        单价:¥<fmt:formatNumber type="number" value="${newOrderProduct.price}"  pattern="0.00" maxFractionDigits="2" />
+                                        <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
+                                    </td>
+                                    <td >
+                                        折扣 :${newOrderProduct.discount}%
+                                    </td>
+                                    <td >
+                                        折后单价 :¥<span class="discountPrice"><fmt:formatNumber type="number" value="${newOrderProduct.discountPrice}" pattern="0.00" maxFractionDigits="2" /></span>
+                                    </td>
+                                    <td >
+                                        数量(赠品):${newOrderProduct.num}(${newOrderProduct.presentNum})
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td style="width: 275px;">
+                                        税率:${newOrderProduct.taxRate}%
+                                    </td>
+                                    <td>
+                                        税费:¥<span class="addedValueTax"><fmt:formatNumber type="number" value="${newOrderProduct.addedValueTax}" pattern="0.00" maxFractionDigits="2" /></span>
+                                    </td>
+                                    <td colspan="2">
+                                        总额:¥<fmt:formatNumber type="number" value="${newOrderProduct.shouldPayFee}"  pattern="0.00" maxFractionDigits="2" />
+                                    </td>
+                                </tr>
+                                <tr>
                                         <%--已发货=商品数量-未出库数量--%>
-                                        <td><font color="red">已发货:<span id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font></td>
-                                        <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
+                                    <td><font color="red">已发货:<span id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font></td>
+                                    <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
                                         <%--已退货=所有退货数量总和--%>
-                                        <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore -newOrderProduct.returnedPurchaseProductNum) }" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
-                                    </tr>
-                                    <tr>
+                                    <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
+                                    <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore -newOrderProduct.returnedPurchaseProductNum) }" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
+                                </tr>
+                                <tr>
                                         <%--待发货=未出库数量-取消数量--%>
-                                        <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
+                                    <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
                                         <%--已取消数量=所有已取消数量总和--%>
-                                        <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopID" value="${newOrderProduct.shopID}"/>
-                                    </tr>
-                                </table>
-                            </td>
+                                    <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
+                                    <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopID" value="${newOrderProduct.shopID}"/>
+                                </tr>
+                            </table>
+                        </td>
                     </tr>
-                        </c:forEach>
+                </c:forEach>
 
 
-                </table>
-            </c:if>
-            <%--默认状态代码--%>
-            <c:if test="${shopOrder.defaultStatus}">
-                <table id="shopOrderTable${status.index}" class="table shopOrderTable table-striped table-bordered table-condensed">
-                    <thead></thead>
+            </table>
+        </c:if>
+        <%--默认状态代码--%>
+        <c:if test="${shopOrder.defaultStatus}">
+            <table id="shopOrderTable${status.index}" class="table shopOrderTable table-striped table-bordered table-condensed">
+                <thead></thead>
+                <tr>
+                    <td style="width: 300px;">
+                        子订单号(ID):${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})
+                    </td>
+                    <td  style="width: 275px;">
+                        子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00" maxFractionDigits="2" />
+                    </td>
+                    <td>
+                        发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
+                    </td>
+                    <td>
+                        付款状态:${fns:getDictLabel(shopOrder.payStatus,'payStatus' ,'' )}
+                    </td>
+                    <td>
+                        供应商:${shopOrder.shopName}
+                    </td>
+                </tr>
+                <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
                     <tr>
-                        <td style="width: 300px;">
-                            子订单号(ID):${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})
-                        </td>
-                        <td  style="width: 275px;">
-                            子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <td>
-                            发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
-                        </td>
-                        <td>
-                            付款状态:${fns:getDictLabel(shopOrder.payStatus,'payStatus' ,'' )}
+                        <td colspan="5">
+                            <table id="newOrderProductTable" class="table table-striped table-bordered table-condensed">
+                                <tr>
+                                    <td rowspan="4" style="width: 295px;height: 125px">
+                                        <img style="width: 100px;height: 100px" src="${newOrderProduct.image}">
+                                        <font title="${newOrderProduct.name}">${fns:abbr(newOrderProduct.name,30)}</font>
+                                    </td>
+                                    <td style="width: 275px;">
+                                        单价:¥<fmt:formatNumber type="number" value="${newOrderProduct.price}"  pattern="0.00" maxFractionDigits="2" />
+                                    </td>
+                                    <td>
+                                        折扣 :${newOrderProduct.discount}%
+                                    </td>
+                                    <td>
+                                        折后单价 :¥<span class="discountPrice"><fmt:formatNumber type="number" value="${newOrderProduct.discountPrice}" pattern="0.00" maxFractionDigits="2" /></span>
+                                    </td>
+                                    <td>
+                                        数量(赠品):${newOrderProduct.num}(${newOrderProduct.presentNum})
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td style="width: 275px;">
+                                        税率:${newOrderProduct.taxRate}%
+                                    </td>
+                                    <td>
+                                        税费:¥<span class="addedValueTax"><fmt:formatNumber type="number" value="${newOrderProduct.addedValueTax}" pattern="0.00" maxFractionDigits="2" /></span>
+                                    </td>
+                                    <td colspan="2">
+                                        总额:¥<fmt:formatNumber type="number" value="${newOrderProduct.shouldPayFee}"  pattern="0.00" maxFractionDigits="2" />
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td><font color="red">已发货:<span id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font></td>
+                                    <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
+                                    <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
+                                    <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput1 shopOrderInput1 refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore - newOrderProduct.returnedPurchaseProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
+                                </tr>
+                                <tr>
+                                    <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
+                                    <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
+                                    <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or (order.onlinfePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
+                                    <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopID" value="${newOrderProduct.shopID}"/>
+                                </tr>
+                            </table>
                         </td>
-                        <td>
-                            供应商:${shopOrder.shopName}
+                    </tr>
+                </c:forEach>
+            </table>
+        </c:if>
+        </table>
+        <%--默认状态代码--%>
+        <c:if test="${shopOrder.defaultStatus}">
+            <table id="shopOrderTable${status.index}"
+                   class="table shopOrderTable table-striped table-bordered table-condensed">
+                <thead></thead>
+                <tr>
+                    <td style="width: 300px;">
+                        子订单号(ID):${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})
+                    </td>
+                    <td style="width: 275px;">
+                        子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00"
+                                                 maxFractionDigits="2"/>
+                    </td>
+                    <td>
+                        发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
+                    </td>
+                    <td>
+                        付款状态:${fns:getDictLabel(shopOrder.payStatus,'payStatus' ,'' )}
+                    </td>
+                    <td>
+                        供应商:${shopOrder.shopName}
+                    </td>
+                </tr>
+                <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
+                    <tr>
+                        <td colspan="5">
+                            <table id="newOrderProductTable" class="table table-striped table-bordered table-condensed">
+                                <tr>
+                                    <td rowspan="4" style="width: 295px;height: 125px">
+                                        <img style="width: 100px;height: 100px" src="${newOrderProduct.image}">
+                                        <font title="${newOrderProduct.name}">${fns:abbr(newOrderProduct.name,30)}</font>
+                                    </td>
+                                    <td style="width: 275px;">
+                                        单价:¥<fmt:formatNumber type="number" value="${newOrderProduct.price}"
+                                                              pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                    <td>
+                                        折扣 :${newOrderProduct.discount}%
+                                    </td>
+                                    <td>
+                                        折后单价 :¥<span class="discountPrice"><fmt:formatNumber type="number"
+                                                                                             value="${newOrderProduct.discountPrice}"
+                                                                                             pattern="0.00"
+                                                                                             maxFractionDigits="2"/></span>
+                                    </td>
+                                    <td>
+                                        数量(赠品):${newOrderProduct.num}(${newOrderProduct.presentNum})
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td style="width: 275px;">
+                                        税率:${newOrderProduct.taxRate}%
+                                    </td>
+                                    <td>
+                                        税费:¥<span class="addedValueTax"><fmt:formatNumber type="number"
+                                                                                          value="${newOrderProduct.addedValueTax}"
+                                                                                          pattern="0.00"
+                                                                                          maxFractionDigits="2"/></span>
+                                    </td>
+                                    <td colspan="2">
+                                        总额:¥<fmt:formatNumber type="number" value="${newOrderProduct.shouldPayFee}"
+                                                              pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td><font color="red">已发货:<span
+                                            id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font>
+                                    </td>
+                                    <input type="hidden" id="returning${status.index}${productStatus.index}"
+                                           value="${newOrderProduct.returningPurchaseProductNum}"/>
+                                    <td><font color="red"><span>已退货:<span
+                                            id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font>
+                                    </td>
+                                    <td colspan="4"><font
+                                            color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""}
+                                            presentNum="${newOrderProduct.presentNum}"
+                                            id="applicationReturnedNum${status.index}${productStatus.index}"
+                                            class="refundGoodsInput1 shopOrderInput1 refundGoodsInput shopOrderInput"
+                                            name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum"
+                                            value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore - newOrderProduct.returnedPurchaseProductNum)}"
+                                            oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)"
+                                            class="input tuihuo" type="text"
+                                            onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td><font color="red">待发货:<span
+                                            id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font>
+                                    </td>
+                                    <td><font color="red">已取消:<span
+                                            id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font>
+                                    </td>
+                                    <td colspan="4"><font
+                                            color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""}
+                                            id="applicationCancelNum${status.index}${productStatus.index}"
+                                            class="cancelGoodsInput shopOrderInput"
+                                            name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum"
+                                            value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}"
+                                            oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)"
+                                            class="input cancel" type="text"
+                                            onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font>
+                                    </td>
+                                    <form:hidden
+                                            path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID"
+                                            value="${newOrderProduct.shopOrderID}"/>
+                                    <form:hidden
+                                            path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID"
+                                            value="${newOrderProduct.productID}"/>
+                                    <form:hidden
+                                            path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID"
+                                            value="${newOrderProduct.orderProductID}"/>
+                                    <form:hidden
+                                            path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopID"
+                                            value="${newOrderProduct.shopID}"/>
+                                </tr>
+                            </table>
                         </td>
                     </tr>
-                    <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
-                        <tr>
-                            <td colspan="5">
-                                <table id="newOrderProductTable" class="table table-striped table-bordered table-condensed">
-                                    <tr>
-                                        <td rowspan="4" style="width: 295px;height: 125px">
-                                            <img style="width: 100px;height: 100px" src="${newOrderProduct.image}">
-                                            <font title="${newOrderProduct.name}">${fns:abbr(newOrderProduct.name,30)}</font>
-                                        </td>
-                                        <td style="width: 275px;">
-                                            单价:¥<fmt:formatNumber type="number" value="${newOrderProduct.price}"  pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                        <td>
-                                            折扣 :${newOrderProduct.discount}%
-                                        </td>
-                                        <td>
-                                            折后单价 :¥<span class="discountPrice"><fmt:formatNumber type="number" value="${newOrderProduct.discountPrice}" pattern="0.00" maxFractionDigits="2" /></span>
-                                        </td>
-                                        <td>
-                                            数量(赠品):${newOrderProduct.num}(${newOrderProduct.presentNum})
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <td style="width: 275px;">
-                                            税率:${newOrderProduct.taxRate}%
-                                        </td>
-                                        <td>
-                                            税费:¥<span class="addedValueTax"><fmt:formatNumber type="number" value="${newOrderProduct.addedValueTax}" pattern="0.00" maxFractionDigits="2" /></span>
-                                        </td>
-                                        <td colspan="2">
-                                            总额:¥<fmt:formatNumber type="number" value="${newOrderProduct.shouldPayFee}"  pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <td><font color="red">已发货:<span id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font></td>
-                                        <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
-                                        <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput1 shopOrderInput1 refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore - newOrderProduct.returnedPurchaseProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
-                                    </tr>
-                                    <tr>
-                                        <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
-                                        <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or (order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${(order.onlinePayFlag eq 0 and shopOrder.shopID eq 998)?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
-                                        <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopID" value="${newOrderProduct.shopID}"/>
-                                    </tr>
-                                </table>
-                            </td>
-                        </tr>
-                    </c:forEach>
-                </table>
-            </c:if>
-        </c:forEach>
+                </c:forEach>
+            </table>
+        </c:if>
+    </c:forEach>
     <div class="form-actions">
-                <input id="btnSubmit" class="btn btn-primary" type="submit" value="申 请"/>&nbsp;
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="申 请"/>&nbsp;
 
         <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
     </div>
@@ -670,10 +841,65 @@
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/orderForm.js"></script>
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/stages.js"></script>
 <script>
+
+    function changeType(){
+        var refundType =  $("#refundType").val();
+        if(1==refundType){
+            var orderStatus = $("#orderStatus").val();
+            var isBuFenFaHuo = $("#isBuFenFaHuo").val();
+            if(isBuFenFaHuo == "true"){
+                $(".shopOrderInput").attr("readonly",true);
+                /*$(".shopOrderInput1").attr("readonly",false);*///设置邮费的可修改
+            };
+
+            //有促销商品订单不可修改
+            if (${isPromotions}){
+                $(".shopOrderInput").attr("readonly",true);
+            }
+
+            //线上全部付款订单不可修改
+            if (${order.receiptStatus == 3 && cmDiscernReceipt.payWay eq 1}){
+                $(".shopOrderInput").attr("readonly",true);
+            }
+
+            // 有优惠不可修改,只能全退
+            if (${order.discountAmount > 0 and order.onlinePayFlag eq 0}){
+                $(".shopOrderInput").attr("readonly",true);
+            }
+
+            //充值订单不可修改
+            if (${order.rechargeGoods != null && (order.rechargeGoods eq 1 || order.rechargeGoods eq 2)}){
+                $(".shopOrderInput").attr("readonly",true);
+            }
+            $("#zdy").hide();
+            $("#spt").show();
+        }
+        if(2==refundType || 3==refundType) {
+            $("input[readonly='readonly']").removeProp("readonly");
+            $("#spt").hide();
+            $("#zdy").show();
+        }
+    }
+
+    function showBankInfo() {
+        if (${!returnOnline}){
+            var obj = document.getElementsByClassName("refundOfflineFee"),
+                blockEle = $('.refund-details-block');
+            if(obj){
+                if(obj[0].checked){
+                    //显示银行信息
+                    blockEle.show();
+                } else {
+                    blockEle.hide();
+                }
+            }
+        }
+    }
+
     $(function () {
         var orderStatus = $("#orderStatus").val();
         var isBuFenFaHuo = $("#isBuFenFaHuo").val();
-        debugger
+        var refundType =  $("#refundType").val();
         if(isBuFenFaHuo == "true"){
             $(".shopOrderInput").attr("readonly",true);
             /*$(".shopOrderInput1").attr("readonly",false);*///设置邮费的可修改
@@ -704,6 +930,10 @@
             $(".shopOrderInput").attr("readonly",true);
         }
 
+        if(2==refundType || 3==refundType){
+            $("input[readonly='readonly']").removeProp("readonly");
+        }
+
         if (${order.rechargeGoods != null && order.rechargeGoods eq 1 && ableUserMoney eq 0}){
             alertx("本订单为缴纳订金订单,机构的余额为¥0.00,不能进行退款", function(){
                 window.location.href = "${ctx}/order/orderList";
@@ -760,23 +990,23 @@
             }
             wrapper.parent().append(wrapper.clone());
             wrapper.remove();
-			$(".conList").each(function(i,ele){
-				if($(ele).find("input.input-xlarge").val()){
-					$(ele).next().removeClass("hide-pic")
-				}
-			})
+            $(".conList").each(function(i,ele){
+                if($(ele).find("input.input-xlarge").val()){
+                    $(ele).next().removeClass("hide-pic")
+                }
+            })
+        });
+        $(window).on("load", function(){
+            setTimeout(function(){
+                $("#remarkImageBox").find("input.input-xlarge").each(function(i,ele){
+                    if($(ele).val()){
+                        $(ele).next().find("li").css("z-index","99");
+                        $(ele).parents(".conList").find(".cancel-upload").show();
+                        $(ele).parents(".conList").next().removeClass("hide-pic")
+                    }
+                })
+            },500);
         });
-		$(window).on("load", function(){
-			setTimeout(function(){
-				$("#remarkImageBox").find("input.input-xlarge").each(function(i,ele){
-					if($(ele).val()){
-						$(ele).next().find("li").css("z-index","99");
-						$(ele).parents(".conList").find(".cancel-upload").show();
-						$(ele).parents(".conList").next().removeClass("hide-pic")
-					}
-				})
-			},500);
-		});
 
         //初始化支付方式选中
         blockEle = $('.refund-details-block');
@@ -915,28 +1145,33 @@
     }
 
     function setApplicationReturnedNum(a,b){
+        var refundType =  $("#refundType").val();
         var num = $("#applicationReturnedNum"+a+b).val();
         var max = Number($("#shipped"+a+b).html()  - $("#returning"+a+b).html() - $("#returned"+a+b).html());
-        if(num > max){
-            alertx("退货数量不能大于已发货数量(之前已退不算)!");
-            $("#applicationReturnedNum"+a+b).val(0)
-        }
-        if (num !== max && ${returnOnline}){
-            alertx("退货数量只能等于已发货数量(之前已退不算)!");
-            $("#applicationReturnedNum"+a+b).val(0)
+        if(1==refundType){
+            if(num > max){
+                alertx("退货数量不能大于已发货数量(之前已退不算)!");
+                $("#applicationReturnedNum"+a+b).val(0)
+            }
+            if (num !== max && ${returnOnline}){
+                alertx("退货数量只能等于已发货数量(之前已退不算)!");
+                $("#applicationReturnedNum"+a+b).val(0)
+            }
         }
-
     };
     function setApplicationCancelNum(a,b){
+        var refundType =  $("#refundType").val();
         var num = $("#applicationCancelNum"+a+b).val();
         var max = Number($("#toBeShipped"+a+b).html());
-        if(num > max){
-            alertx("取消数量不能大于待发数量,请重新填写!");
-            $("#applicationCancelNum"+a+b).val(0)
-        }
-        if (num !== max && ${returnOnline}){
-            alertx("取消数量只能等于待发数量,请重新填写!");
-            $("#applicationCancelNum"+a+b).val(0)
+        if(1==refundType){
+            if(num > max){
+                alertx("取消数量不能大于待发数量,请重新填写!");
+                $("#applicationCancelNum"+a+b).val(0)
+            }
+            if (num !== max && ${returnOnline}){
+                alertx("取消数量只能等于待发数量,请重新填写!");
+                $("#applicationCancelNum"+a+b).val(0)
+            }
         }
     };
 </script>

+ 8 - 2
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp

@@ -140,6 +140,9 @@
             <td><b>退款编号:</b>
                     ${empty cmReturnedPurchase.returnedNo?'':(cmReturnedPurchase.returnedNo)}
             </td>
+            <td><b>退款模式:</b>
+                    ${cmReturnedPurchase.refundType eq 1?'按商品退回':'自定义金额退款'}
+            </td>
             <td><b>申请时间:</b>
                     ${cmReturnedPurchase.returnTime}
             </td>
@@ -204,6 +207,9 @@
                         <c:if test="${cmReturnedPurchase.payType == '6'}">
                             虚拟银行0000
                         </c:if>
+                        <c:if test="${cmReturnedPurchase.payType == '7'}">
+                            华夏银行2400
+                        </c:if>
                     </c:if>
                     <c:if test="${empty cmReturnedPurchase.refundFee or cmReturnedPurchase.refundFee eq 0}">
                         暂无支付方式
@@ -353,10 +359,10 @@
                 <font>无退款</font>
             </c:if>
             <c:if test="${order.refundType == 1}">
-                <font color="#ff8c00">部分退款</font>
+                <font>部分退款</font>
             </c:if>
             <c:if test="${order.refundType == 2}">
-                <font color="green">已退款</font>
+                <font>已退款</font>
             </c:if></td>
         </td>
     </tr>

+ 233 - 133
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReturnRecord.jsp

@@ -7,7 +7,10 @@
     <title>退款退货记录</title>
     <meta name="decorator" content="default"/>
     <style media="print">
-        @page { size: landscape; }
+        @page {
+            size: landscape;
+        }
+
         .refund-btn-top, .nav {
             display: none;
         }
@@ -43,47 +46,64 @@
             text-align: center;
             white-space: nowrap;
         }
-        .controls{
+
+        .controls {
             font-size: 0;
         }
-        .controls .conList{
+
+        .controls .conList {
             display: inline-block;
             margin-right: 15px;
         }
-        .conList .btn:nth-of-type(1){
+
+        .conList .btn:nth-of-type(1) {
             margin-left: 25px;
         }
+
         .refund-btn-top {
             float: right;
             margin-top: -18px;
             margin-right: 10px;
             height: 40px;
         }
+
         #enlarge-box {
             position: fixed;
             /*width: 325px;*/
             top: 50%;
             left: 50%;
-            transform: translate(-50%,-50%);
+            transform: translate(-50%, -50%);
             border: 2px solid #eee;
             background: #fff;
             display: none;
         }
-        .zeroCost .message{
-            display:none;
-            position:absolute;
-            background:#FFF;
-            white-space:nowrap;
-            border:1px solid black;
+
+        .zeroCost .message {
+            display: none;
+            position: absolute;
+            background: #FFF;
+            white-space: nowrap;
+            border: 1px solid black;
 
         }
-        .zeroCost:hover .message{
+
+        .zeroCost:hover .message {
             display: inline-block;
             color: black;
             padding: 5px;
             margin-left: 10px;
         }
-        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+
+        .weishaIcon {
+            background: darkorange;
+            color: white;
+            margin: 0 0px;
+            padding: 0 3px;
+            font-style: normal;
+            font-size: 12px;
+            display: inline-block;
+            border-radius: 2px
+        }
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -107,18 +127,16 @@
         });
 
 
-
-
         function openClauseInfo(index) {
-            var content=$("#clauseContent"+index).val();
+            var content = $("#clauseContent" + index).val();
             if (content == '') {
                 return false;
             }
             $.jBox(content, {
-                title: $("#clauseName"+index).val(),
+                title: $("#clauseName" + index).val(),
                 width: $(top.document).width() - 440,
-                height: $(top.document).height()-240,
-                buttons: { '关闭': true }
+                height: $(top.document).height() - 240,
+                buttons: {'关闭': true}
             });
         }
     </script>
@@ -130,19 +148,24 @@
     <c:if test="${from eq '3'}">
         <li><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>
     </c:if>
-    <li class="active"><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款退货详情</a></li>
+    <li class="active"><a
+            href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款退货详情</a>
+    </li>
 </ul>
 <br/>
 <div class="refund-btn-top">
     <c:if test="${from ne '3'}">
-    <input type="button" class="btn btn-primary" onclick="window.location.href='${ctx}${cmReturnedPurchase.orderType eq 2?'/hehe/new/order/orderList':'/order/orderList'}'"  value="返回">
+        <input type="button" class="btn btn-primary"
+               onclick="window.location.href='${ctx}${cmReturnedPurchase.orderType eq 2?'/hehe/new/order/orderList':'/order/orderList'}'"
+               value="返回">
     </c:if>
 </div>
 <c:forEach items="${cmReturnedPurchaseList}" var="cmReturnedPurchase" varStatus="cmReturnedPurchaseStatus">
-    <form:form id="inputForm${cmReturnedPurchaseStatus.index}" modelAttribute="cmReturnedPurchase" action="${ctx}/bulkpurchase/cmRefundsProduct/saveRefound" method="post"
+    <form:form id="inputForm${cmReturnedPurchaseStatus.index}" modelAttribute="cmReturnedPurchase"
+               action="${ctx}/bulkpurchase/cmRefundsProduct/saveRefound" method="post"
                class="form-horizontal">
         <c:if test="${cmReturnedPurchaseStatus.index ne 0}">
-            <hr style="height:5px;border:none;border-top:5px ridge green;" />
+            <hr style="height:5px;border:none;border-top:5px ridge green;"/>
         </c:if>
         <%--审核模块--%>
         <c:if test="${not empty cmReturnedPurchase.confirmReturnTime}">
@@ -168,19 +191,24 @@
                         <c:if test="${not empty cmReturnedPurchase.reviewImage1 || not empty cmReturnedPurchase.reviewImage2  || not empty cmReturnedPurchase.reviewImage3  || not empty cmReturnedPurchase.reviewImage4  || not empty cmReturnedPurchase.reviewImage5}">
                             审核凭证:
                             <c:if test="${not empty cmReturnedPurchase.reviewImage1}">
-                                <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.reviewImage1}">
+                                <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                     src="${cmReturnedPurchase.reviewImage1}">
                             </c:if>
                             <c:if test="${not empty cmReturnedPurchase.reviewImage2}">
-                                <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.reviewImage2}">
+                                <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                     src="${cmReturnedPurchase.reviewImage2}">
                             </c:if>
                             <c:if test="${not empty cmReturnedPurchase.reviewImage3}">
-                                <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.reviewImage3}">
+                                <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                     src="${cmReturnedPurchase.reviewImage3}">
                             </c:if>
                             <c:if test="${not empty cmReturnedPurchase.reviewImage4}">
-                                <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.reviewImage4}">
+                                <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                     src="${cmReturnedPurchase.reviewImage4}">
                             </c:if>
                             <c:if test="${not empty cmReturnedPurchase.reviewImage5}">
-                                <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.reviewImage5}">
+                                <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                     src="${cmReturnedPurchase.reviewImage5}">
                             </c:if>
                         </c:if>
                     </td>
@@ -211,22 +239,28 @@
                     <c:if test="${not empty cmReturnedPurchase.image1 || not empty cmReturnedPurchase.image2 || not empty cmReturnedPurchase.image3 || not empty cmReturnedPurchase.image4 || not empty cmReturnedPurchase.image5}">
                         申请凭证:
                         <c:if test="${not empty cmReturnedPurchase.image1}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image1}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image1}">
                         </c:if>
                         <c:if test="${not empty cmReturnedPurchase.image2}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image2}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image2}">
                         </c:if>
                         <c:if test="${empty cmReturnedPurchase.image3}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image3}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image3}">
                         </c:if>
                         <c:if test="${not empty cmReturnedPurchase.image3}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image3}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image3}">
                         </c:if>
                         <c:if test="${not empty cmReturnedPurchase.image4}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image4}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image4}">
                         </c:if>
                         <c:if test="${not empty cmReturnedPurchase.image5}">
-                            <img class="enlarge-pic" style="height: 70px;width: 65px" src="${cmReturnedPurchase.image5}">
+                            <img class="enlarge-pic" style="height: 70px;width: 65px"
+                                 src="${cmReturnedPurchase.image5}">
                         </c:if>
                     </c:if>
                 </td>
@@ -246,7 +280,9 @@
                         ${cmReturnedPurchase.returnTime}
                 </td>
                 <td><b>申请金额:</b>
-                    <span class="refundFee"><fmt:formatNumber value="${empty cmReturnedPurchase.refundFee?'0.00':(cmReturnedPurchase.refundFee)}" pattern="#0.00"/></span>元&nbsp;&nbsp;&nbsp;(账户余额抵扣:${order.balancePayFee})
+                    <span class="refundFee"><fmt:formatNumber
+                            value="${empty cmReturnedPurchase.refundFee?'0.00':(cmReturnedPurchase.refundFee)}"
+                            pattern="#0.00"/></span>元&nbsp;&nbsp;&nbsp;(账户余额抵扣:${order.balancePayFee})
                 </td>
                 <td><b>退款审核状态:</b>
                     <c:if test="${empty cmReturnedPurchase.status}">
@@ -266,7 +302,7 @@
                 </td>
             </tr>
             <tr>
-                <td  colspan="4" >
+                <td colspan="4">
                     <b>退款方式:</b>
                     <c:if test="${cmReturnedPurchase.returnedWay eq 4}">
                         未支付无退款
@@ -274,20 +310,20 @@
                     <c:if test="${cmReturnedPurchase.returnedWay eq 1}">
                         <c:if test="${not empty cmReturnedPurchase.refundBalanceFee && cmReturnedPurchase.refundBalanceFee ne 0 }">
                             余额账户:<fmt:formatNumber type="number" pattern="#,##0.00"
-                                                   value="${cmReturnedPurchase.refundBalanceFee}" />元&nbsp;&nbsp;&nbsp;&nbsp;
+                                                   value="${cmReturnedPurchase.refundBalanceFee}"/>元&nbsp;&nbsp;&nbsp;&nbsp;
                         </c:if>
                         <c:if test="${not empty cmReturnedPurchase.refundOnlineFee && cmReturnedPurchase.refundOnlineFee ne 0 }">
                             线上退回:<fmt:formatNumber type="number" pattern="#,##0.00"
-                                                   value="${cmReturnedPurchase.refundOnlineFee}" />元&nbsp;&nbsp;&nbsp;&nbsp;
+                                                   value="${cmReturnedPurchase.refundOnlineFee}"/>元&nbsp;&nbsp;&nbsp;&nbsp;
                         </c:if>
                         <br>
                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                         <c:if test="${not empty cmReturnedPurchase.refundOfflineFee && cmReturnedPurchase.refundOfflineFee ne 0 }">
                             线下转账:<fmt:formatNumber type="number" pattern="#,##0.00"
-                                                   value="${cmReturnedPurchase.refundOfflineFee}" />元&nbsp;&nbsp;&nbsp;&nbsp;
+                                                   value="${cmReturnedPurchase.refundOfflineFee}"/>元&nbsp;&nbsp;&nbsp;&nbsp;
                             采美退款银行:
                             <c:if test="${cmReturnedPurchase.payType == '1'}">
-                               建设银行7297
+                                建设银行7297
                             </c:if>
                             <c:if test="${cmReturnedPurchase.payType == '2'}">
                                 中信银行0897
@@ -304,6 +340,9 @@
                             <c:if test="${cmReturnedPurchase.payType == '6'}">
                                 虚拟银行0000
                             </c:if>
+                            <c:if test="${cmReturnedPurchase.payType == '7'}">
+                                华夏银行2400
+                            </c:if>
                         </c:if>
                         <c:if test="${empty cmReturnedPurchase.refundFee or cmReturnedPurchase.refundFee eq 0}">
                             暂无支付方式
@@ -359,7 +398,8 @@
             </tr>
             <tr>
                 <td>
-                    订单金额:¥<fmt:formatNumber type="number" value="${order.payTotalFee}" pattern="0.00" maxFractionDigits="2" />
+                    订单金额:¥<fmt:formatNumber type="number" value="${order.payTotalFee}" pattern="0.00"
+                                            maxFractionDigits="2"/>
                     <c:if test="${not empty order.couponOrderRecord}">
                         <c:if test="${order.couponOrderRecord.couponType eq 0}">
                             <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(活动券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
@@ -389,11 +429,14 @@
                     </c:if>
                 </td>
                 <td>
-                    应收总额:¥<fmt:formatNumber type="number" value="${order.payableAmount}" pattern="0.00" maxFractionDigits="2" />(账户余额抵扣:${order.balancePayFee})
-                    <a href="${ctx}/order/cmDiscernReceipt/detail?id=${lastReceiptDetailId}" style="text-decoration: underline;margin-left: 20px">查看订单收款情况</a>
+                    应收总额:¥<fmt:formatNumber type="number" value="${order.payableAmount}" pattern="0.00"
+                                            maxFractionDigits="2"/>(账户余额抵扣:${order.balancePayFee})
+                    <a href="${ctx}/order/cmDiscernReceipt/detail?id=${lastReceiptDetailId}"
+                       style="text-decoration: underline;margin-left: 20px">查看订单收款情况</a>
                 </td>
                 <td>
-                    经理折扣:¥<fmt:formatNumber type="number" value="${order.discountFee}" pattern="0.00" maxFractionDigits="2" />
+                    经理折扣:¥<fmt:formatNumber type="number" value="${order.discountFee}" pattern="0.00"
+                                            maxFractionDigits="2"/>
                 </td>
                 <td>
                     机构运费:
@@ -466,7 +509,8 @@
                     <c:if test="${order.payStatus == 3}">
                         <font color="green">已付款</font>
                         <c:if test="${order.zeroCostFlag eq 1}">
-                            <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg" style="width: 15px;margin-bottom: 4px"></span>
+                            <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg"
+                                                                               style="width: 15px;margin-bottom: 4px"></span>
                                 <div class="message">
                                     <span>商品成本为0,直接置为已付款,无需付款供应商</span>
                                 </div>
@@ -480,21 +524,22 @@
                         <font>无退款</font>
                     </c:if>
                     <c:if test="${order.refundType == 1}">
-                        <font color="#ff8c00">部分退款</font>
+                        <font>部分退款</font>
                     </c:if>
                     <c:if test="${order.refundType == 2}">
-                        <font color="green">已退款</font>
+                        <font>已退款</font>
                     </c:if></td>
                 </td>
             </tr>
             <tr>
                 <td>
-                    机构:${order.buyer}<c:if test="${order.organizeID == 3}"></c:if>
+                    机构:${order.buyer}
+                    <c:if test="${order.organizeID == 3}"></c:if>
                 </td>
                 <td>
                     收货人:${order.bpOrderUserinfo.shouHuoRen}(${order.bpOrderUserinfo.mobile})
                 </td>
-                <td  colspan="2">
+                <td colspan="2">
                     地址:${order.bpOrderUserinfo.province}${order.bpOrderUserinfo.city}${order.bpOrderUserinfo.town}${order.bpOrderUserinfo.address}
                 </td>
             </tr>
@@ -503,88 +548,140 @@
         <%--单次退款商品信息汇总--%>
 
         <table id="cmReturnedPurchaseTable" class="table table-striped table-bordered table-condensed">
-                <c:forEach items="${cmReturnedPurchase.shopOrderReturnedList}" var="shopOrderReturneds" varStatus="shopOrderReturnedStatus">
-                    <tr>
-                        <td colspan="7">
-                            <table id="shopOrderReturnedTable${shopOrderReturnedStatus.index}" class="table table-striped table-bordered table-condensed">
+            <c:forEach items="${cmReturnedPurchase.shopOrderReturnedList}" var="shopOrderReturneds"
+                       varStatus="shopOrderReturnedStatus">
+                <tr>
+                    <td colspan="7">
+                        <table id="shopOrderReturnedTable${shopOrderReturnedStatus.index}"
+                               class="table table-striped table-bordered table-condensed">
+                            <tr>
+                                <td style="width: 300px;">
+                                    子订单编号(ID):${shopOrderReturneds.shopOrderNo}(${shopOrderReturneds.shopOrderID})
+                                </td>
+                                <td style="width: 250px;">子订单金额:${shopOrderReturneds.productAmount}</td>
+                                <td>
+                                        <%--                                        收款状态:${fns:getDictLabel(shopOrderReturneds.shopReceiptStatus,'receiptStatus' ,'' )}--%>
+                                    <c:if test="${shopOrderReturneds.shopReceiptStatus == 1}">
+                                        <font color="red">待收款</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.shopReceiptStatus == 2}">
+                                        <font color="#ff8c00">部分收款</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.shopReceiptStatus == 3}">
+                                        <font color="green">已收款</font>
+                                    </c:if>
+                                </td>
+                                <td>发货状态:
+                                        <%--                                            ${fns:getDictLabel(shopOrderReturneds.sendOutStatus,'sendOutStatus' ,'' )}--%>
+                                    <c:if test="${shopOrderReturneds.sendOutStatus == 1}">
+                                        <font color="red">待发货</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.sendOutStatus == 2}">
+                                        <font color="#ff8c00">部分发货</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.sendOutStatus == 3}">
+                                        <font color="green">已发货</font>
+                                    </c:if>
+                                </td>
+                                <td>付款状态:
+                                        <%--                                            ${fns:getDictLabel(shopOrderReturneds.payStatus,'payStatus' ,'' )}--%>
+                                    <c:if test="${shopOrderReturneds.payStatus == 1}">
+                                        <font color="red">待付款</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.payStatus == 2}">
+                                        <font color="#ff8c00">部分付款</font>
+                                    </c:if>
+                                    <c:if test="${shopOrderReturneds.payStatus == 3}">
+                                        <font color="green">已付款</font>
+                                    </c:if>
+                                </td>
+                                <td>供应商:${shopOrderReturneds.shopName}</td>
+                            </tr>
+                            <c:if test="${order.onlinePayFlag eq 0}">
+                                <tr>
+                                    <td>
+                                        商品总额:¥<fmt:formatNumber type="number"
+                                                                value="${shopOrderReturneds.needPayAmount}"
+                                                                pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                    <td>
+                                        优惠:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.eachDiscount}"
+                                                              pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                    <td>
+                                        应付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.realPay}"
+                                                                pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                    <td>
+                                        已付金额:¥<fmt:formatNumber type="number"
+                                                                value="${shopOrderReturneds.receiptAmount}"
+                                                                pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                    <td>
+                                        待付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.restAmount}"
+                                                                pattern="0.00" maxFractionDigits="2"/>
+                                    </td>
+                                </tr>
+                            </c:if>
+                            <c:forEach items="${shopOrderReturneds.cmReturnedPurchaseProductList}"
+                                       var="cmReturnedPurchaseProduct" varStatus="cmReturnedPurchaseProductStatus">
                                 <tr>
-                                    <td style="width: 300px;">子订单编号(ID):${shopOrderReturneds.shopOrderNo}(${shopOrderReturneds.shopOrderID})</td>
-                                    <td  style="width: 250px;">子订单金额:${shopOrderReturneds.productAmount}</td>
+                                    <td rowspan="4" style="width: 295px;height: 125px">
+                                        <img style="width: 100px;height: 100px"
+                                             src="${cmReturnedPurchaseProduct.mainImage}">
+                                        <font title="${cmReturnedPurchaseProduct.name}">${fns:abbr(cmReturnedPurchaseProduct.name,30)}</font>
+                                    </td>
+                                    <td>单价:¥${cmReturnedPurchaseProduct.price}<c:if
+                                            test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if></td>
+                                    <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
+                                    <td>折扣:${cmReturnedPurchaseProduct.discount}</td>
+                                    <td>折后单价:¥${cmReturnedPurchaseProduct.discountPrice}</td>
                                     <td>
-                                        收款状态:${fns:getDictLabel(shopOrderReturneds.shopReceiptStatus,'receiptStatus' ,'' )}
+                                        购买数量(赠品数)X${cmReturnedPurchaseProduct.num}(${cmReturnedPurchaseProduct.presentNum})
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>税率:${cmReturnedPurchaseProduct.taxRate}</td>
+                                    <td>税费:¥${cmReturnedPurchaseProduct.totalAddedValueTax}</td>
+                                    <td colspan="2">总额:¥${cmReturnedPurchaseProduct.totalFee}</td>
+                                </tr>
+                                <tr>
+                                    <td><font
+                                            color="red">已发货:${cmReturnedPurchaseProduct.num+cmReturnedPurchaseProduct.presentNum - cmReturnedPurchaseProduct.notOutStore}</font>
+                                    </td>
+                                    <td><font color="red">已退货:<span
+                                            id="applicationReturnedNum${shopOrderReturnedStatus.index}${cmReturnedPurchaseProductStatus.index}">${cmReturnedPurchaseProduct.returnedPurchaseProductNum}</span></font>
+                                    </td>
+                                    <td colspan="2"><font color="red">本次退货:
+                                            ${empty cmReturnedPurchaseProduct.actualReturnedNum ? 0 : cmReturnedPurchaseProduct.actualReturnedNum}
+                                    </font>
                                     </td>
-                                    <td>发货状态:
-                                            ${fns:getDictLabel(shopOrderReturneds.sendOutStatus,'sendOutStatus' ,'' )}
+                                </tr>
+                                <tr>
+                                    <td><font
+                                            color="red">待发货:${cmReturnedPurchaseProduct.notOutStore - cmReturnedPurchaseProduct.cancelProductNum}</font>
+                                    </td>
+                                    <td><font color="red">已取消:<span
+                                            id="applicationCancelNum${shopOrderReturnedStatus.index}${cmReturnedPurchaseProductStatus.index}">${cmReturnedPurchaseProduct.cancelProductNum}</span></font>
                                     </td>
-                                    <td>付款状态:
-                                            ${fns:getDictLabel(shopOrderReturneds.payStatus,'payStatus' ,'' )}
+                                    <td colspan="2"><font color="red">本次取消:
+                                            ${empty cmReturnedPurchaseProduct.actualCancelNum ? 0 : cmReturnedPurchaseProduct.actualCancelNum}
+                                    </font>
                                     </td>
-                                    <td>供应商:${shopOrderReturneds.shopName}</td>
                                 </tr>
-                                <c:if test="${order.onlinePayFlag eq 0}">
-                                    <tr>
-                                        <td>
-                                            商品总额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                        <td>
-                                            优惠:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                        <td>
-                                            应付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.realPay}" pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                        <td>
-                                            已付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                        <td>
-                                            待付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturneds.restAmount}" pattern="0.00" maxFractionDigits="2" />
-                                        </td>
-                                    </tr>
-                                </c:if>
-                                <c:forEach items="${shopOrderReturneds.cmReturnedPurchaseProductList}" var="cmReturnedPurchaseProduct" varStatus="cmReturnedPurchaseProductStatus">
-                                    <tr>
-                                        <td  rowspan="4" style="width: 295px;height: 125px">
-                                            <img style="width: 100px;height: 100px"  src="${cmReturnedPurchaseProduct.mainImage}">
-                                            <font title="${cmReturnedPurchaseProduct.name}">${fns:abbr(cmReturnedPurchaseProduct.name,30)}</font>
-                                        </td>
-                                        <td>单价:¥${cmReturnedPurchaseProduct.price}<c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if></td>                                            <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
-                                        <td>折扣:${cmReturnedPurchaseProduct.discount}</td>
-                                        <td>折后单价:¥${cmReturnedPurchaseProduct.discountPrice}</td>
-                                        <td>购买数量(赠品数)X${cmReturnedPurchaseProduct.num}(${cmReturnedPurchaseProduct.presentNum})</td>
-                                    </tr>
-                                    <tr>
-                                        <td>税率:${cmReturnedPurchaseProduct.taxRate}</td>
-                                        <td>税费:¥${cmReturnedPurchaseProduct.totalAddedValueTax}</td>
-                                        <td colspan="2">总额:¥${cmReturnedPurchaseProduct.totalFee}</td>
-                                    </tr>
-                                    <tr>
-                                        <td><font color="red">已发货:${cmReturnedPurchaseProduct.num+cmReturnedPurchaseProduct.presentNum - cmReturnedPurchaseProduct.notOutStore}</font></td>
-                                        <td><font color="red">已退货:<span id="applicationReturnedNum${shopOrderReturnedStatus.index}${cmReturnedPurchaseProductStatus.index}">${cmReturnedPurchaseProduct.returnedPurchaseProductNum}</span></font></td>
-                                        <td colspan="2"><font color="red">本次退货:
-                                                ${empty cmReturnedPurchaseProduct.actualReturnedNum ? 0 : cmReturnedPurchaseProduct.actualReturnedNum}
-                                        </font>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <td><font color="red">待发货:${cmReturnedPurchaseProduct.notOutStore - cmReturnedPurchaseProduct.cancelProductNum}</font></td>
-                                        <td><font color="red">已取消:<span id="applicationCancelNum${shopOrderReturnedStatus.index}${cmReturnedPurchaseProductStatus.index}">${cmReturnedPurchaseProduct.cancelProductNum}</span></font></td>
-                                        <td colspan="2"><font color="red">本次取消:
-                                                ${empty cmReturnedPurchaseProduct.actualCancelNum ? 0 : cmReturnedPurchaseProduct.actualCancelNum}
-                                        </font>
-                                        </td>
-                                    </tr>
-                                    <%--<form:hidden path="cmReturnedPurchaseProductList[${shopOrderReturnedStatus.index}][${cmReturnedPurchaseProductStatus.index}].returnedReceiver" value="${cmReturnedPurchaseProduct.returnedReceiver}"/>--%>
-                                </c:forEach>
-                            </table>
-                        </td>
-                    </tr>
-                </c:forEach>
+                                <%--<form:hidden path="cmReturnedPurchaseProductList[${shopOrderReturnedStatus.index}][${cmReturnedPurchaseProductStatus.index}].returnedReceiver" value="${cmReturnedPurchaseProduct.returnedReceiver}"/>--%>
+                            </c:forEach>
+                        </table>
+                    </td>
+                </tr>
+            </c:forEach>
 
         </table>
     </form:form>
 </c:forEach>
 
 <c:if test="${empty cmReturnedPurchaseList}">
-    <p style="text-align: center;"><font  color="#1e90ff">暂无退货退款详情记录.....</font></p>
+    <p style="text-align: center;"><font color="#1e90ff">暂无退货退款详情记录.....</font></p>
 </c:if>
 <c:if test="${not empty cmReturnedPurchaseList}">
     <table id="orderTable" class="table table-striped table-bordered table-condensed">
@@ -592,11 +689,14 @@
             <td>
                 <div class="order-rows">
                     <label>发票信息:</label>
-                    <input id="invoice1" class="invoice1" name="invoice" type="radio" ${order.orderInvoice.type == 0 ? 'checked="checked"':''} disabled="disabled">
+                    <input id="invoice1" class="invoice1" name="invoice"
+                           type="radio" ${order.orderInvoice.type == 0 ? 'checked="checked"':''} disabled="disabled">
                     <label for="invoice1">不需要发票</label>
-                    <input id="invoice2" name="invoice" type="radio" ${order.orderInvoice.type == 1 ? 'checked="checked"':''} disabled="disabled">
+                    <input id="invoice2" name="invoice"
+                           type="radio" ${order.orderInvoice.type == 1 ? 'checked="checked"':''} disabled="disabled">
                     <label for="invoice2">普通发票</label>
-                    <input id="invoice3" name="invoice" type="radio" ${order.orderInvoice.type == 2 ? 'checked="checked"':''} disabled="disabled">
+                    <input id="invoice3" name="invoice"
+                           type="radio" ${order.orderInvoice.type == 2 ? 'checked="checked"':''} disabled="disabled">
                     <label for="invoice3">增值税发票</label>
                     <c:if test="${order.orderInvoice.type == 1}">
                         <br>
@@ -669,28 +769,28 @@
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/stages.js"></script>
 <script>
     $(function () {
-        $('.print-now').on('click',function() {
+        $('.print-now').on('click', function () {
             window.print();
         })
     });
 
-    (function(){
-        $('body').click(function(e) {
+    (function () {
+        $('body').click(function (e) {
             var target = $(e.target),
                 $block = $('.operation-block');
-            if(target.is('.operation-btn')) {
-                if($block.css('display') === 'none') {
+            if (target.is('.operation-btn')) {
+                if ($block.css('display') === 'none') {
                     $block.show();
                 } else {
                     $block.hide();
                 }
             }
-            if(!target.is('.operation-block') && !target.is('.operation-btn')) {
+            if (!target.is('.operation-block') && !target.is('.operation-btn')) {
                 $block.hide();
             }
         });
 
-        $('.clauseId').each(function() {
+        $('.clauseId').each(function () {
             var self = $(this);
             if (!self.prop("checked")) {
                 self.parent().hide();
@@ -709,16 +809,16 @@
             }
         })
 
-        $('body').on('mouseover', '.enlarge-pic', function() {
+        $('body').on('mouseover', '.enlarge-pic', function () {
             var thisSrc = $(this).attr('src'),
                 enlargeBox = $('#enlarge-box');
-            if(thisSrc) {
+            if (thisSrc) {
                 enlargeBox.show(50);
-                $('#enlarge-box').find('img').attr('src',thisSrc);
+                $('#enlarge-box').find('img').attr('src', thisSrc);
             }
         })
 
-        $('body').on('mouseout', '.enlarge-pic', function() {
+        $('body').on('mouseout', '.enlarge-pic', function () {
             var enlargeBox = $('#enlarge-box');
             enlargeBox.hide();
         })

+ 3 - 2
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp

@@ -271,6 +271,7 @@
                             <form:option value="4" label="广发银行0115"/>
                             <form:option value="5" label="广发银行5461"/>
                             <form:option value="6" label="虚拟银行0000"/>
+                            <form:option value="7" label="华夏银行2400"/>
                         </form:select>
                     </c:if>
                     <c:if test="${empty cmReturnedPurchase.refundFee or cmReturnedPurchase.refundFee eq 0}">
@@ -419,10 +420,10 @@
                 <font>无退款</font>
             </c:if>
             <c:if test="${order.refundType == 1}">
-                <font color="#ff8c00">部分退款</font>
+                <font>部分退款</font>
             </c:if>
             <c:if test="${order.refundType == 2}">
-                <font color="green">已退款</font>
+                <font>已退款</font>
             </c:if></td>
         </td>
     </tr>

+ 3 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/organizeOrderReturnRecord.jsp

@@ -353,6 +353,9 @@
                             <c:if test="${cmReturnedPurchase.payType == '5'}">
                                 广发银行5461
                             </c:if>
+                            <c:if test="${cmReturnedPurchase.payType == '7'}">
+                                华夏银行2400
+                            </c:if>
                         </c:if>
                         <c:if test="${empty cmReturnedPurchase.refundFee or cmReturnedPurchase.refundFee eq 0}">
                             暂无支付方式

+ 122 - 36
src/main/webapp/WEB-INF/views/modules/bulkpurchase/refundRecord.jsp

@@ -144,7 +144,16 @@
             </c:if>
         </td>
         <td>
-            收款状态:${fns:getDictLabel(order.receiptStatus,'receiptStatus' ,'' )}
+            收款状态:<%--${fns:getDictLabel(order.receiptStatus,'receiptStatus' ,'' )}--%>
+            <c:if test="${order.receiptStatus == 1}">
+                <font color="red">待收款</font>
+            </c:if>
+            <c:if test="${order.receiptStatus == 2}">
+                <font color="#ff8c00">部分收款</font>
+            </c:if>
+            <c:if test="${order.receiptStatus == 3}">
+                <font color="green">已收款</font>
+            </c:if>
         </td>
         <c:if test="${order.orderType eq 2}">
             <td>
@@ -162,7 +171,17 @@
             </td>
         </c:if>
         <td>
-            付款状态:${fns:getDictLabel(order.payStatus,'payStatus' ,'' )}
+            付款状态:<%--${fns:getDictLabel(order.payStatus,'payStatus' ,'' )}--%>
+            <c:if test="${order.payStatus == 1}">
+                <font color="red">待付款</font>
+            </c:if>
+            <c:if test="${order.payStatus == 2}">
+                <font color="#ff8c00">部分付款</font>
+            </c:if>
+            <c:if test="${order.payStatus == 3}">
+                <font color="green">已付款</font>
+            </c:if>
+
             <c:if test="${order.zeroCostFlag eq 1}">
                 <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg" style="width: 15px;margin-bottom: 4px"></span>
                     <div class="message">
@@ -171,8 +190,31 @@
                 </a>
             </c:if>
         </td>
+        <c:if test="${order.onlinePayFlag == 0}">
+        <td>
+            结算状态:
+            <c:if test="${order.settleStatus == 1}">
+                <font color="red">待结算</font>
+            </c:if>
+            <c:if test="${order.settleStatus == 2}">
+                <font color="#ff8c00">部分结算</font>
+            </c:if>
+            <c:if test="${order.settleStatus == 3}">
+                <font color="green">已结算</font>
+            </c:if>
+        </td>
+        </c:if>
         <td>
-            退款(退货)状态:${fns:getDictLabel(order.refundType,'refundType' ,'' )}
+<%--            退款(退货)状态:${fns:getDictLabel(order.refundType,'refundType' ,'' )}--%>
+    <c:if test="${order.refundType == 1}">
+        <font color="red">待发货</font>
+    </c:if>
+    <c:if test="${order.refundType == 2}">
+        <font color="#ff8c00">部分发货</font>
+    </c:if>
+    <c:if test="${order.refundType == 3}">
+        <font color="green">已发货</font>
+    </c:if>
         </td>
     </tr>
     <tr>
@@ -281,50 +323,94 @@
         </c:if>
     </c:forEach>
 </c:if>
-<c:if test="${empty receipt}">
-    <div class="record-title">收款记录: 无</div>
+<%--<c:if test="${empty receipt}">--%>
+<%--    <div class="record-title">收款记录: 无</div>--%>
+<%--</c:if>--%>
+<%--<br><br>--%>
+<%--<c:if test="${not empty cmReturnedPurchaseList}">--%>
+<%--    <div class="record-title">退款记录:</div>--%>
+<%--    <table id="cmReturnedPurchaseTable" class="table table-striped table-bordered table-condensed">--%>
+<%--        <tr>--%>
+<%--            <th class="table-order">序号</th>--%>
+<%--            <th class="table-id">退款编号</th>--%>
+<%--            <th class="table-cell3">退款金额</th>--%>
+<%--            <th class="table-cell4">申请时间</th>--%>
+<%--            <th class="table-cell5">退款状态</th>--%>
+<%--        </tr>--%>
+<%--        <c:forEach items="${cmReturnedPurchaseList}" var="cmReturnedPurchase" varStatus="cmReturnedPurchaseStatus">--%>
+<%--            <tr>--%>
+<%--                <td>--%>
+<%--                        ${cmReturnedPurchaseStatus.index + 1}--%>
+<%--                </td>--%>
+<%--                <td>--%>
+<%--                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecord.rpc?id=${cmReturnedPurchase.id}&orderID=${cmReturnedPurchase.orderID}"--%>
+<%--                       style="cursor: pointer">--%>
+<%--                            ${cmReturnedPurchase.returnedNo}</a>--%>
+<%--                </td>--%>
+<%--                <td><fmt:formatNumber value="${cmReturnedPurchase.refundFee}" type="currency"/></td>--%>
+<%--                <td>${cmReturnedPurchase.returnTime}</td>--%>
+<%--                <td><c:if test="${cmReturnedPurchase.status eq 1}">--%>
+<%--                    待审核--%>
+<%--                </c:if>--%>
+<%--                    <c:if test="${cmReturnedPurchase.status eq 2}">--%>
+<%--                        审核通过--%>
+<%--                    </c:if>--%>
+<%--                    <c:if test="${cmReturnedPurchase.status eq 3}">--%>
+<%--                        审核不通过--%>
+<%--                    </c:if>--%>
+<%--                </td>--%>
+<%--            </tr>--%>
+<%--        </c:forEach>--%>
+<%--    </table>--%>
+<%--</c:if>--%>
+<c:if test="${empty pr}">
+    <div class="record-title">付款记录:无</div>
 </c:if>
-<br><br>
-<c:if test="${not empty cmReturnedPurchaseList}">
-    <div class="record-title">退款记录:</div>
-    <table id="cmReturnedPurchaseTable" class="table table-striped table-bordered table-condensed">
+<c:if test="${not empty pr}">
+    <div class="record-title">付款记录:</div>
+    <table id="contentTable" class="table table-striped table-bordered table-condensed" width="70%" border="1">
+        <thead>
         <tr>
-            <th class="table-order">序号</th>
-            <th class="table-id">退款编号</th>
-            <th class="table-cell3">退款金额</th>
-            <th class="table-cell4">申请时间</th>
-            <th class="table-cell5">退款状态</th>
+            <th>序号</th>
+            <th>付款单ID</th>
+            <th>付款时间</th>
+            <th>付款方式</th>
+            <th>付款金额</th>
         </tr>
-        <c:forEach items="${cmReturnedPurchaseList}" var="cmReturnedPurchase" varStatus="cmReturnedPurchaseStatus">
+        </thead>
+        <tbody>
+        <c:forEach items="${pr}" var="p" varStatus="pp">
             <tr>
-                <td>
-                        ${cmReturnedPurchaseStatus.index + 1}
-                </td>
-                <td>
-                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecord.rpc?id=${cmReturnedPurchase.id}&orderID=${cmReturnedPurchase.orderID}"
-                       style="cursor: pointer">
-                            ${cmReturnedPurchase.returnedNo}</a>
-                </td>
-                <td><fmt:formatNumber value="${cmReturnedPurchase.refundFee}" type="currency"/></td>
-                <td>${cmReturnedPurchase.returnTime}</td>
-                <td><c:if test="${cmReturnedPurchase.status eq 1}">
-                    待审核
-                </c:if>
-                    <c:if test="${cmReturnedPurchase.status eq 2}">
-                        审核通过
+                <td>${pp.index + 1}</td>
+                <td><a href="${ctx}/order/cmPayShop/applyDetail?id=${p.payShopID}">${p.payShopID}</a></td>
+                <td>${p.payTime}</td>
+                <td><c:if test="${p.payType == '1'}">
+                        建设银行7297
                     </c:if>
-                    <c:if test="${cmReturnedPurchase.status eq 3}">
-                        审核不通过
+                    <c:if test="${p.payType == '2'}">
+                        中信银行0897
+                    </c:if>
+                    <c:if test="${p.payType == '3'}">
+                        中信银行7172
+                    </c:if>
+                    <c:if test="${p.payType == '4'}">
+                        广发银行0115
+                    </c:if>
+                    <c:if test="${p.payType == '5'}">
+                        广发银行5461
+                    </c:if>
+                    <c:if test="${p.payType == '7'}">
+                        华夏银行2400
                     </c:if>
                 </td>
+                <td>${p.payAmount}</td>
             </tr>
         </c:forEach>
+        </tbody>
     </table>
 </c:if>
-<c:if test="${empty cmReturnedPurchaseList}">
-    <div class="record-title">退款记录:无</div>
     <br>
-</c:if>
+
 
 
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/loadAddress.js"></script>
@@ -337,4 +423,4 @@
 
 </script>
 </body>
-</html>
+</html>

+ 331 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/settlementRecord.jsp

@@ -0,0 +1,331 @@
+<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
+<%@ taglib prefix="input" uri="/struts-tags" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>收退款记录</title>
+    <meta name="decorator" content="default"/>
+    <style>
+        .form-horizontal .controls {
+            margin-left: 0;
+        }
+
+        .dateInput input {
+            width: 150px;
+        }
+
+        .clause span {
+            margin-left: 30px;
+        }
+
+        #productTable th {
+            text-align: center;
+            white-space: nowrap;
+        }
+
+        #productTable td {
+            text-align: center;
+            white-space: nowrap;
+        }
+
+        .controls {
+            font-size: 0;
+        }
+
+        .controls .conList {
+            display: inline-block;
+            margin-right: 15px;
+        }
+
+        .conList .btn:nth-of-type(1) {
+            margin-left: 25px;
+        }
+
+        #refundTable th, #cmReturnedPurchaseTable th {
+            width: 20%;
+        }
+
+        .record-title {
+            height: 30px;
+            line-height: 30px;
+            padding-left: 8px;
+        }
+        .zeroCost .message{
+            display:none;
+            position:absolute;
+            background:#FFF;
+            white-space:nowrap;
+            border:1px solid black;
+
+        }
+        .zeroCost:hover .message{
+            display: inline-block;
+            color: black;
+            padding: 5px;
+            margin-left: 10px;
+        }
+        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+
+        });
+
+
+    </script>
+</head>
+<body>
+<input type="hidden" id="product_index" value="${fn:length(order.orderProduct)}">
+<input type="hidden" id="ctx" value="${ctx}">
+<ul class="nav nav-tabs">
+    <c:if test="${from eq '1' or from eq '2'}">
+        <c:if test="${orderType eq 2}">
+            <li><a href="${ctx}/hehe/new/order/orderList">订单列表</a></li>
+        </c:if>
+        <c:if test="${orderType ne 2}">
+            <li><a href="${ctx}/order/orderList">订单列表</a></li>
+        </c:if>
+    </c:if>
+    <c:if test="${from eq '2'}">
+        <li><a href="${ctx}/order/detail?id=${orderID}">订单详情</a></li>
+    </c:if>
+    <c:if test="${from eq '3'}">
+        <li><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>
+    </c:if>
+    <li class="active"><a href="#">收退款记录</a></li>
+</ul>
+<br/>
+<table id="orderTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    </thead>
+    <tr>
+        <td>
+            下单时间:${order.orderTime}
+        </td>
+        <td>
+            订单号(ID):${order.orderNo}(${order.orderID})
+        </td>
+        <td>
+            <c:if test="${order.organizeID != 1}">
+                订单类型:${fns:getDictLabel(order.orderType,'order_type' ,'' )}
+                <c:if test="${order.orderType eq 2}">
+                    ${order.collageFlag eq 1?'拼团订单':'独立订单'}
+                </c:if>
+            </c:if>
+        </td>
+        <td>
+            <c:if test="${order.organizeID != 1}">
+                订单来源:${fns:getDictLabel(order.orderSource,'bp_orderSource' ,'' )}
+            </c:if>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            订单状态:
+            <c:if test="${ not empty order.status}">
+                ${fns:getNewOrderStatus(order.status)}
+            </c:if>
+        </td>
+        <td>
+            收款状态:<%--${fns:getDictLabel(order.receiptStatus,'receiptStatus' ,'' )}--%>
+            <c:if test="${order.receiptStatus == 1}">
+                <font color="red">待收款</font>
+            </c:if>
+            <c:if test="${order.receiptStatus == 2}">
+                <font color="#ff8c00">部分收款</font>
+            </c:if>
+            <c:if test="${order.receiptStatus == 3}">
+                <font color="green">已收款</font>
+            </c:if>
+        </td>
+        <c:if test="${order.orderType eq 2}">
+            <td>
+                拼团状态:
+                <c:choose>
+                    <c:when test="${order.collageFlag eq 1 && (order.status eq 31 || order.status eq 32 || order.status eq 33)}">
+                        <font color="${order.collageStatus eq 1?'#00CC66':(order.collageStatus eq 2?'red':'')}">
+                                ${order.collageStatus eq 1?'拼团中':(order.collageStatus eq 2?'已拼成':'-')}
+                        </font>
+                    </c:when>
+                    <c:otherwise>
+                        -
+                    </c:otherwise>
+                </c:choose>
+            </td>
+        </c:if>
+        <td>
+            付款状态:<%--${fns:getDictLabel(order.payStatus,'payStatus' ,'' )}--%>
+            <c:if test="${order.payStatus == 1}">
+                <font color="red">待付款</font>
+            </c:if>
+            <c:if test="${order.payStatus == 2}">
+                <font color="#ff8c00">部分付款</font>
+            </c:if>
+            <c:if test="${order.payStatus == 3}">
+                <font color="green">已付款</font>
+            </c:if>
+
+            <c:if test="${order.zeroCostFlag eq 1}">
+                <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg" style="width: 15px;margin-bottom: 4px"></span>
+                    <div class="message">
+                        <span>商品成本为0,直接置为已付款,无需付款供应商</span>
+                    </div>
+                </a>
+            </c:if>
+        </td>
+        <c:if test="${order.onlinePayFlag == 0}">
+        <td>
+            结算状态:
+            <c:if test="${order.settleStatus == 1}">
+                <font color="red">待结算</font>
+            </c:if>
+            <c:if test="${order.settleStatus == 2}">
+                <font color="#ff8c00">部分结算</font>
+            </c:if>
+            <c:if test="${order.settleStatus == 3}">
+                <font color="green">已结算</font>
+            </c:if>
+        </td>
+        </c:if>
+        <td>
+<%--            退款(退货)状态:${fns:getDictLabel(order.refundType,'refundType' ,'' )}--%>
+    <c:if test="${order.refundType == 1}">
+        <font color="red">待发货</font>
+    </c:if>
+    <c:if test="${order.refundType == 2}">
+        <font color="#ff8c00">部分发货</font>
+    </c:if>
+    <c:if test="${order.refundType == 3}">
+        <font color="green">已发货</font>
+    </c:if>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            机构:${order.bpOrderUserinfo.name}<c:if test="${order.organizeID == 3}"></c:if>
+        </td>
+        <td>
+            收货人:${order.bpOrderUserinfo.shouHuoRen}
+        </td>
+        <td>
+            手机:${order.bpOrderUserinfo.mobile}
+        </td>
+        <td>
+            地址:${order.bpOrderUserinfo.province}${order.bpOrderUserinfo.city}${order.bpOrderUserinfo.town}${order.bpOrderUserinfo.address}
+        </td>
+    </tr>
+    <tr>
+        <td>
+            订单金额:¥${order.payTotalFee}
+            <c:if test="${not empty order.couponOrderRecord}">
+                <c:if test="${order.couponOrderRecord.couponType eq 0}">
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(活动券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                </c:if>
+                <c:if test="${order.couponOrderRecord.couponType eq 1}">
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(品类券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                </c:if>
+                <c:if test="${order.couponOrderRecord.couponType eq 2}">
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(用户专享券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                </c:if>
+                <c:if test="${order.couponOrderRecord.couponType eq 3}">
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(店铺券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                </c:if>
+                <c:if test="${order.couponOrderRecord.couponType eq 4}">
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(新用户券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                </c:if>
+            </c:if>
+            <c:if test="${not empty order.heheCouponRecord}">
+                <a href="${ctx}/hehe/cmHeheCoupon/receiveDetails?userId=${order.userID}">
+                    <font color="red">
+                        (${order.heheCouponRecord.couponType eq 1 ? '活动':order.heheCouponRecord.couponType eq 2?'专享':order.heheCouponRecord.couponType eq 3?'新人':order.heheCouponRecord.couponType eq 4?'好友分享':order.heheCouponRecord.couponType eq 5?'好友消费':'消费分享'}券抵扣¥${order.heheCouponRecord.couponAmount},满${order.heheCouponRecord.touchPrice}减${order.heheCouponRecord.couponAmount})
+                    </font>
+                </a>
+            </c:if>
+            <c:if test="${order.reductionAmount > 0}">
+                (分享减免¥${order.reductionAmount},满${order.reductionTouchPrice}减${order.reductionAmount})
+            </c:if>
+        </td>
+        <td>
+            应收总额:¥${order.payableAmount}
+        </td>
+        <td>
+            经理折扣:¥${order.discountFee}
+        </td>
+        <td>
+            运费:
+            <c:if test="${order.freePostFlag == 0}">
+                包邮
+            </c:if>
+            <c:if test="${order.freePostFlag == -1}">
+                到付
+            </c:if>
+            <c:if test="${order.freePostFlag == -2}">
+                仪器到付-产品包邮
+            </c:if>
+            <c:if test="${order.freePostFlag != -1 && order.freePostFlag != 0 && order.freePostFlag != -2}">
+                ¥<fmt:formatNumber value="${order.freight}" pattern="0.00"/>
+            </c:if>
+            <c:if test="${order.userBeans > 0}">
+                <font color="red">(采美豆抵用:${order.userBeans})</font>
+            </c:if>
+        </td>
+    </tr>
+    <tr>
+        <td>优惠券:${order.couponAmount}</td>
+        <td>退款总额:¥${refundFee}</td>
+        <td COLSPAN="3">
+
+        </td>
+    </tr>
+</table>
+<c:if test="${not empty settleRecord}">
+    <div class="record-title">佣金结算记录:</div>
+    <table id="refundTable" class="table table-striped table-bordered table-condensed">
+        <tr>
+            <th class="table-order">序号</th>
+            <th class="table-id">子订单ID</th>
+            <th class="table-cell3">结算时间</th>
+            <th class="table-cell4">结算金额</th>
+        </tr>
+        <c:forEach items="${settleRecord}" var="settle" varStatus="s">
+            <tr>
+                <td>${s.index + 1}</td>
+                <td>${settle.shopOrderId}</td>
+                <td><fmt:formatDate value="${settle.settleTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+                <td><fmt:formatNumber value="${settle.settleAmount}" type="currency"/></td>
+            </tr>
+        </c:forEach>
+    </table>
+</c:if>
+<c:if test="${empty settleRecord}">
+    <div class="record-title">佣金结算记录: 无</div>
+</c:if>
+
+<script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/loadAddress.js"></script>
+<script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/orderForm.js"></script>
+<script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/stages.js"></script>
+<script>
+    $(function () {
+
+    });
+
+</script>
+</body>
+</html>

+ 2 - 12
src/main/webapp/WEB-INF/views/modules/coupon/MoneyCouponForm.jsp

@@ -13,16 +13,6 @@
                         var productInfo = JSON.stringify(imageList);
                         $('#productInfo').val(productInfo);
                     }
-                    var couponType = $("input[name='couponType']:checked").val();
-                    var productType = $("input[name='productType']:checked").val();
-                    if (couponType == 0 && productType == 2) {
-                        var pcBanner = $('#pcBanner').val();
-                        var appletsBanner = $('#appletsBanner').val();
-                        if (pcBanner == '' || appletsBanner == '') {
-                            alertx("请上传Banner图");
-                            return false;
-                        }
-                    }
                     var couponAmount = $("#couponAmount").val()*1;
                     var touchPrice = $("#touchPrice").val()*1;
                     if (couponAmount >= touchPrice) {
@@ -293,7 +283,7 @@
     </div>
     <div class="productData" hidden="hidden">
         <div class="control-group">
-            <label class="control-label"><font color="red">*</font>网站活动页banner:</label>
+            <label class="control-label">网站活动页banner:</label>
             <div class="controls upload-content-image iconBox">
                 <div class="conList">
                     <form:hidden id="pcBanner" path="pcBanner" htmlEscape="false" maxlength="255" class="input-xlarge"/>
@@ -303,7 +293,7 @@
             </div>
         </div>
         <div class="control-group">
-            <label class="control-label"><font color="red">*</font>小程序活动页banner:</label>
+            <label class="control-label">小程序活动页banner:</label>
             <div class="controls upload-content-image iconBox">
                 <div class="conList">
                     <form:hidden id="appletsBanner" path="appletsBanner" htmlEscape="false" maxlength="255" class="input-xlarge"/>

Some files were not shown because too many files changed in this diff