Selaa lähdekoodia

1.订单功能修改 页面全部修改,增加字段
2.提现功能修改 返现金额推荐金额 自动加减
3.小程序介绍人日志接口,登录,授权用户,授权手机 介绍人信息自动加减

Shanks 6 vuotta sitten
vanhempi
commit
753836e300
21 muutettua tiedostoa jossa 512 lisäystä ja 160 poistoa
  1. 5 0
      src/main/java/com/ygj/yuemum/component/Constant.java
  2. 6 0
      src/main/java/com/ygj/yuemum/controller/distributionchannel/DcIntroducerController.java
  3. 3 1
      src/main/java/com/ygj/yuemum/controller/distributionchannel/MdjCalculate.java
  4. 2 2
      src/main/java/com/ygj/yuemum/controller/global/WeChatInfoController.java
  5. 5 0
      src/main/java/com/ygj/yuemum/controller/order/YSOrderController.java
  6. 4 0
      src/main/java/com/ygj/yuemum/dao/distributionchannel/DcIntroduceLogDao.java
  7. 1 0
      src/main/java/com/ygj/yuemum/dao/distributionchannel/DcIntroducerDao.java
  8. 0 9
      src/main/java/com/ygj/yuemum/domain/distributionchannel/DcIntroducer.java
  9. 54 16
      src/main/java/com/ygj/yuemum/domain/order/YSOrder.java
  10. 27 3
      src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroduceLogService.java
  11. 0 1
      src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerApplicantService.java
  12. 18 1
      src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerExtractService.java
  13. 3 0
      src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerService.java
  14. 28 1
      src/main/java/com/ygj/yuemum/service/global/WeChatInfoService.java
  15. 154 12
      src/main/java/com/ygj/yuemum/service/order/YSOrderService.java
  16. 2 3
      src/main/java/com/ygj/yuemum/service/pay/CustomerPayService.java
  17. 2 0
      src/main/resources/application.yml
  18. 18 0
      src/main/resources/mybatis/mapper/distributionchannel/DcIntroduceLogMapper.xml
  19. 3 3
      src/main/resources/mybatis/mapper/distributionchannel/DcIntroducerExtractMapper.xml
  20. 89 84
      src/main/resources/mybatis/mapper/distributionchannel/DcIntroducerMapper.xml
  21. 88 24
      src/main/resources/mybatis/mapper/order/YSOrder.xml

+ 5 - 0
src/main/java/com/ygj/yuemum/component/Constant.java

@@ -49,6 +49,7 @@ public class Constant {
     public static String IMGBANKCARD;
     public static String HTTPIMGBANKCARD;
     public static String WPOPENID;
+    public static String MDJAPIURL;
 
     //注入
     @Autowired(required = false)
@@ -220,4 +221,8 @@ public class Constant {
     public void getEXTRACTTEMPLATEID(@Value("${wechat.ExtractTemplateid}") String EXTRACTTEMPLATEID) {
         Constant.EXTRACTTEMPLATEID = EXTRACTTEMPLATEID;
     }
+    @Autowired(required = false)
+    public void getMDJAPIURL(@Value("${api.MDJAPIURL}") String MDJAPIURL) {
+        Constant.MDJAPIURL = MDJAPIURL;
+    }
 }

+ 6 - 0
src/main/java/com/ygj/yuemum/controller/distributionchannel/DcIntroducerController.java

@@ -7,6 +7,7 @@ import com.ygj.yuemum.service.distributionchannel.DcIntroducerService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -34,6 +35,11 @@ public class DcIntroducerController {
         return dcIntroducerService.checkDcIntroducers(wv_phone);
     }
 
+    @GetMapping("/queryDcIntroducersByUser")
+    public List<DcIntroducer> queryDcIntroducersByUser(@RequestParam("xul_phone")  String xul_phone) {
+        return dcIntroducerService.queryDcIntroducersByUser(xul_phone);
+    }
+
     @PostMapping("/insertDcIntroducer")
     public int insertDcIntroducer(@ModelAttribute DcIntroducer wxVip) {
         return dcIntroducerService.insertDcIntroducer(wxVip);

+ 3 - 1
src/main/java/com/ygj/yuemum/controller/distributionchannel/MdjCalculate.java

@@ -1,6 +1,7 @@
 package com.ygj.yuemum.controller.distributionchannel;
 
 import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.component.Constant;
 import com.ygj.yuemum.domain.admin.MdjCalculateOrder;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -16,9 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
 import java.io.IOException;
 @RestController
 public class MdjCalculate {
+    public static final String extracttemplateid = Constant.MDJAPIURL;
     @PostMapping("/mdjCalculate")
     public String mdjCalculate(@ModelAttribute MdjCalculateOrder mdjCalculateOrder) throws IOException {
-        HttpPost httpPost = new HttpPost("http://120.55.37.107:8763/introduce/activity");
+        HttpPost httpPost = new HttpPost(extracttemplateid);
         CloseableHttpClient client = HttpClients.createDefault();
         String respContent = null;
         JSONObject jsonParam = new JSONObject();

+ 2 - 2
src/main/java/com/ygj/yuemum/controller/global/WeChatInfoController.java

@@ -25,8 +25,8 @@ public class WeChatInfoController {
     }
 
     @GetMapping("/getWXOpenid")
-    public Map<String,String> getWXOpenid(@RequestParam("js_code") String js_code) {
-        return saveWeChatInfo.getWXOpenid(js_code);
+    public Map<String,String> getWXOpenid(@RequestParam("js_code") String js_code, @RequestParam("introducer") String introducer) {
+        return saveWeChatInfo.getWXOpenid(js_code,introducer);
     }
     @PostMapping("/getWxDecrypt")
     public String getWxDecrypt(@RequestParam("encrypData") String encrypData, @RequestParam("ivData") String ivData, @RequestParam("openid") String openid) {

+ 5 - 0
src/main/java/com/ygj/yuemum/controller/order/YSOrderController.java

@@ -54,6 +54,11 @@ public class YSOrderController {
         return YSOrderService.updateYSOrder(YSOrder);
     }
 
+    @PostMapping("/finishYSOrder")
+    public int finishYSOrder(@ModelAttribute YSOrder YSOrder) {
+        return YSOrderService.finishYSOrder(YSOrder);
+    }
+
     @GetMapping("/deleteYSOrder")
     public int deleteYSOrder(@RequestParam("id") Integer id) {
         return YSOrderService.deleteYSOrder(id);

+ 4 - 0
src/main/java/com/ygj/yuemum/dao/distributionchannel/DcIntroduceLogDao.java

@@ -11,6 +11,10 @@ public interface DcIntroduceLogDao {
 
     int insertDcIntroduceLog(DcIntroduceLog dcIntroduceLog);
 
+    int checkDcIntroducerLogs (DcIntroduceLog dcIntroduceLog);
+
+    int checkFirstDILogs (DcIntroduceLog dcIntroduceLog);
+
     List<DcIntroduceLog> queryDcIntroduceLogs(DcIntroduceLog dcIntroduceLog);
 
     List<DcIntroduceLog> getDcIntroduceLogs(String phone);

+ 1 - 0
src/main/java/com/ygj/yuemum/dao/distributionchannel/DcIntroducerDao.java

@@ -9,6 +9,7 @@ import java.util.List;
 public interface DcIntroducerDao {
 
     List<DcIntroducer> getDcIntroducers();
+    List<DcIntroducer> queryDcIntroducersByUser(String xul_phone);
 
     int updateDcIntroducer(DcIntroducer dcIntroducer);
 

+ 0 - 9
src/main/java/com/ygj/yuemum/domain/distributionchannel/DcIntroducer.java

@@ -8,7 +8,6 @@ public class DcIntroducer {
     private Double wv_Introduction_total;
     private Double wv_withdraw_total;
     private Integer wv_Introduction_count;
-    private Integer wv_order_count;
     private String wv_qrcode;
     private Integer wv_extract_count;
     private Integer wv_people_count;
@@ -71,14 +70,6 @@ public class DcIntroducer {
         this.wv_Introduction_count = wv_Introduction_count;
     }
 
-    public Integer getWv_order_count() {
-        return wv_order_count;
-    }
-
-    public void setWv_order_count(Integer wv_order_count) {
-        this.wv_order_count = wv_order_count;
-    }
-
     public String getWv_qrcode() {
         return wv_qrcode;
     }

+ 54 - 16
src/main/java/com/ygj/yuemum/domain/order/YSOrder.java

@@ -22,10 +22,14 @@ public class YSOrder {
     private String od_introducer_phone;
     private Integer od_introducer_consultant;
     private Integer od_order_amount;
-    private Integer od_mdj_amount;
-    private Integer od_vip_cash;
-    private Double od_earnestpay;
-    private Double od_balancepay;
+    private Integer od_order_pay_amount;
+    private Integer od_mgm_discount;
+    private Integer od_promotion_discount;
+    private Integer od_other_discount;
+    private Integer od_rebate_amount;
+    private Integer od_earnestpay;
+    private Integer od_balancepay;
+    private Integer od_promotion_id;
     private Integer od_ismdj;
     private String od_mdjstartdate;
     private String od_mdjenddate;
@@ -37,22 +41,48 @@ public class YSOrder {
     private Integer page;
     private Integer limit;
 
-    public Double getOd_earnestpay() {
+    public Integer getOd_promotion_id() {
+        return od_promotion_id;
+    }
+
+    public void setOd_promotion_id(Integer od_promotion_id) {
+        this.od_promotion_id = od_promotion_id;
+    }
+
+    public Integer getOd_earnestpay() {
         return od_earnestpay;
     }
 
-    public void setOd_earnestpay(Double od_earnestpay) {
+    public void setOd_earnestpay(Integer od_earnestpay) {
         this.od_earnestpay = od_earnestpay;
     }
 
-    public Double getOd_balancepay() {
+    public Integer getOd_balancepay() {
         return od_balancepay;
     }
 
-    public void setOd_balancepay(Double od_balancepay) {
+    public void setOd_balancepay(Integer od_balancepay) {
         this.od_balancepay = od_balancepay;
     }
 
+    public Integer getOd_order_pay_amount() {
+        return od_order_pay_amount;
+    }
+
+    public void setOd_order_pay_amount(Integer od_order_pay_amount) {
+        this.od_order_pay_amount = od_order_pay_amount;
+    }
+
+    public Integer getOd_rebate_amount() {
+        return od_rebate_amount;
+    }
+
+    public void setOd_rebate_amount(Integer od_rebate_amount) {
+        this.od_rebate_amount = od_rebate_amount;
+    }
+
+
+
     public String getOd_user_address() {
         return od_user_address;
     }
@@ -229,20 +259,28 @@ public class YSOrder {
         this.od_order_amount = od_order_amount;
     }
 
-    public Integer getOd_mdj_amount() {
-        return od_mdj_amount;
+    public Integer getOd_mgm_discount() {
+        return od_mgm_discount;
+    }
+
+    public void setOd_mgm_discount(Integer od_mgm_discount) {
+        this.od_mgm_discount = od_mgm_discount;
+    }
+
+    public Integer getOd_promotion_discount() {
+        return od_promotion_discount;
     }
 
-    public void setOd_mdj_amount(Integer od_mdj_amount) {
-        this.od_mdj_amount = od_mdj_amount;
+    public void setOd_promotion_discount(Integer od_promotion_discount) {
+        this.od_promotion_discount = od_promotion_discount;
     }
 
-    public Integer getOd_vip_cash() {
-        return od_vip_cash;
+    public Integer getOd_other_discount() {
+        return od_other_discount;
     }
 
-    public void setOd_vip_cash(Integer od_vip_cash) {
-        this.od_vip_cash = od_vip_cash;
+    public void setOd_other_discount(Integer od_other_discount) {
+        this.od_other_discount = od_other_discount;
     }
 
     public Integer getOd_ismdj() {

+ 27 - 3
src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroduceLogService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ygj.yuemum.dao.distributionchannel.DcIntroduceLogDao;
 import com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog;
+import com.ygj.yuemum.domain.distributionchannel.DcIntroducer;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -18,6 +19,8 @@ public class DcIntroduceLogService {
 
     @Autowired
     private DcIntroduceLogDao dcIntroduceLogDao;
+    @Autowired
+    private DcIntroducerService dcIntroducerService;
 
     //分页
 
@@ -34,13 +37,34 @@ public class DcIntroduceLogService {
 
 
     public int insertDcIntroduceLog(DcIntroduceLog dcIntroduceLog) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        dcIntroduceLog.setXul_date(sdf.format(new Date()));
-        return dcIntroduceLogDao.insertDcIntroduceLog(dcIntroduceLog);
+        if (dcIntroduceLog.getXul_introducer_phone() == null || dcIntroduceLog.getXul_introducer_phone().equals("null") || dcIntroduceLog.getXul_introducer_phone() == "" || dcIntroduceLog.getXul_introducer_phone() == " ") {
+            return 0;
+        } else {
+            int logCount  = dcIntroduceLogDao.checkDcIntroducerLogs(dcIntroduceLog);
+            if (logCount == 0) {
+                if (dcIntroduceLog.getXul_event() == 2) { // 手机号授权介绍人注册用户+1
+                    DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(dcIntroduceLog.getXul_introducer_phone());
+                    if (dcIntroducer != null) {
+                        // 介绍人注册用户+1
+                        dcIntroducer.setWv_register_count(dcIntroducer.getWv_register_count() + 1 );
+                        dcIntroducerService.updateDcIntroducer(dcIntroducer);
+                    }
+                }
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                dcIntroduceLog.setXul_date(sdf.format(new Date()));
+                return dcIntroduceLogDao.insertDcIntroduceLog(dcIntroduceLog);
+            } else {
+                return 0;
+            }
+        }
     }
 
     public List<DcIntroduceLog> getDcIntroduceLogs(String phone) {
         return dcIntroduceLogDao.getDcIntroduceLogs(phone);
     }
 
+    public int checkFirstDILogs(DcIntroduceLog dcIntroduceLog) {
+        return dcIntroduceLogDao.checkFirstDILogs(dcIntroduceLog);
+    }
+
 }

+ 0 - 1
src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerApplicantService.java

@@ -73,7 +73,6 @@ public class DcIntroducerApplicantService {
             dcIntroducer.setWv_qrcode(qrcodePath);
             dcIntroducer.setWv_people_count(0);
             dcIntroducer.setWv_extract_count(0);
-            dcIntroducer.setWv_order_count(0);
             dcIntroducer.setWv_register_count(0);
             dcIntroducer.setWv_finish_count(0);
             dcIntroducer.setWv_contract_count(0);

+ 18 - 1
src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerExtractService.java

@@ -59,7 +59,24 @@ public class DcIntroducerExtractService {
     }
 
     public int updateDcIntroducerExtract(DcIntroducerExtract dcIntroducerExtract) {
-        return dcIntroducerExtractDao.updateDcIntroducerExtract(dcIntroducerExtract);
+        try {
+            if (dcIntroducerExtract.getWue_type() == 4) { //拒绝推荐金额返还
+                DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(dcIntroducerExtract.getWue_phone());
+                dcIntroducer.setWv_Introduction_total(dcIntroducer.getWv_Introduction_total() + dcIntroducerExtract.getWue_applysum());
+                dcIntroducerService.updateDcIntroducer(dcIntroducer);
+            }
+
+            if (dcIntroducerExtract.getWue_type() == 3) { //打款 增加体检金额
+                DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(dcIntroducerExtract.getWue_phone());
+                dcIntroducer.setWv_withdraw_total(dcIntroducer.getWv_withdraw_total() + dcIntroducerExtract.getWue_approversum());
+                dcIntroducerService.updateDcIntroducer(dcIntroducer);
+            }
+            dcIntroducerExtractDao.updateDcIntroducerExtract(dcIntroducerExtract);
+        }catch (Exception ex) {
+            ex.printStackTrace();
+            return 0;
+        }
+        return 1;
     }
     public DcIntroducerExtract queryOneDcIntroducerExtract(Integer id) {
         return dcIntroducerExtractDao.queryOneDcIntroducerExtract(id);

+ 3 - 0
src/main/java/com/ygj/yuemum/service/distributionchannel/DcIntroducerService.java

@@ -52,6 +52,9 @@ public class DcIntroducerService {
     public int updateAccountNumber(DcIntroducer dcIntroducer) {
         return dcIntroducerDao.updateAccountNumber(dcIntroducer);
     }
+    public List<DcIntroducer> queryDcIntroducersByUser(String xul_phone) {
+        return dcIntroducerDao.queryDcIntroducersByUser(xul_phone);
+    }
 
     public DcIntroducer checkDcIntroducers(String wv_phone) {
         //从CRM里面获取推荐人等级

+ 28 - 1
src/main/java/com/ygj/yuemum/service/global/WeChatInfoService.java

@@ -6,11 +6,15 @@ import com.ygj.yuemum.component.Constant;
 import com.ygj.yuemum.dao.global.MiniAppInfoDao;
 import com.ygj.yuemum.dao.global.WeChatInfoDao;
 import com.ygj.yuemum.domain.customer.CustomerBooking;
+import com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog;
+import com.ygj.yuemum.domain.distributionchannel.DcIntroducer;
 import com.ygj.yuemum.domain.global.MiniAppInfo;
 import com.ygj.yuemum.domain.global.TemplateData;
 import com.ygj.yuemum.domain.global.WeChatInfo;
 import com.ygj.yuemum.domain.global.WechatTemplate;
 import com.ygj.yuemum.domain.wxmini.WXUser;
+import com.ygj.yuemum.service.distributionchannel.DcIntroduceLogService;
+import com.ygj.yuemum.service.distributionchannel.DcIntroducerService;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.http.HttpStatus;
@@ -49,6 +53,10 @@ public class WeChatInfoService {
     private MiniAppInfoDao miniAppInfoDao;
     @Autowired
     private WXUserService wxUserService;
+    @Autowired
+    private DcIntroduceLogService dcIntroduceLogService;
+    @Autowired
+    private DcIntroducerService dcIntroducerService;
     public String APPID = Constant.APPID;
     public String APPSECRET = Constant.APPSECRET;
     public String MINIAPPID = Constant.MINIAPPID;
@@ -365,7 +373,7 @@ public class WeChatInfoService {
         return 1;
     }
 
-    public Map<String, String> getWXOpenid(String js_code) {
+    public Map<String, String> getWXOpenid(String js_code, String introducer) {
         Map<String, String> result = new HashMap<>();
         String resultToken = sendGet(JSCODE2SESSION + "?grant_type=authorization_code" + "&appid=" + MINIAPPID + "&secret=" + MINIAPPSECRET + "&js_code=" + js_code);
         Map mapToken = JSON.parseObject(resultToken);
@@ -392,6 +400,25 @@ public class WeChatInfoService {
             result.put("openid", openid);
             result.put("type","1");
             result.put("nickName",lsid);
+
+        }
+        //介绍人介绍用户+1 多码存多条
+        DcIntroduceLog dcIntroduceLog = new DcIntroduceLog();
+        dcIntroduceLog.setXul_introducer_phone(introducer);
+        dcIntroduceLog.setXul_event(0);
+        dcIntroduceLog.setXul_openid(openid);
+        if (introducer != null && !introducer.equals("null") && introducer != "" && introducer != " ")  {
+            int filstCheck = dcIntroduceLogService.checkFirstDILogs(dcIntroduceLog);
+            if (filstCheck ==0) {
+                DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(introducer);
+                if (dcIntroducer != null) {
+                    // 介绍人注册用户+1
+                    dcIntroducer.setWv_people_count(dcIntroducer.getWv_people_count() + 1 );
+                    dcIntroducerService.updateDcIntroducer(dcIntroducer);
+                    //log 记录
+                    dcIntroduceLogService.insertDcIntroduceLog(dcIntroduceLog);
+                }
+            }
         }
         result.put("session_key", session_key);
         return result;

+ 154 - 12
src/main/java/com/ygj/yuemum/service/order/YSOrderService.java

@@ -1,11 +1,23 @@
 package com.ygj.yuemum.service.order;
 
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.ygj.yuemum.component.Constant;
 import com.ygj.yuemum.dao.maternitymatron.MmStockDao;
 import com.ygj.yuemum.dao.order.YSOrderDao;
+import com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog;
+import com.ygj.yuemum.domain.distributionchannel.DcIntroducer;
 import com.ygj.yuemum.domain.maternitymatron.MmStock;
 import com.ygj.yuemum.domain.order.YSOrder;
+import com.ygj.yuemum.service.distributionchannel.DcIntroduceLogService;
+import com.ygj.yuemum.service.distributionchannel.DcIntroducerService;
+import com.ygj.yuemum.service.distributionchannel.MiniAppService;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -18,12 +30,18 @@ import java.util.Map;
 
 @Service
 public class YSOrderService {
-
+    public static final String extracttemplateid = Constant.MDJAPIURL;
     @Autowired
     private YSOrderDao YSOrderDao;
 
     @Autowired
     private MmStockDao mmStockDao;
+    @Autowired
+    private DcIntroducerService dcIntroducerService;
+    @Autowired
+    private DcIntroduceLogService dcIntroduceLogService;
+    @Autowired
+    private MiniAppService miniAppService;
 
     //分页
     public Map<String, Object> getYSOrders(int page, int limit) {
@@ -48,7 +66,7 @@ public class YSOrderService {
         return tableData;
     }
 
-    public List<YSOrder> queryMineOrder(String od_phone){
+    public List<YSOrder> queryMineOrder(String od_phone) {
         return YSOrderDao.queryMineOrder(od_phone);
     }
 
@@ -56,12 +74,13 @@ public class YSOrderService {
         List<YSOrder> YSOrders = YSOrderDao.getAll();
         return YSOrders;
     }
+
     public String getOdno() {
         DecimalFormat dfseq = new DecimalFormat("000000");
         int seq = YSOrderDao.getAESeq() + 1;
-        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyyMMdd");
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         Date date = new Date();
-        return "YSDD"+dateFormat.format(date)+dfseq.format(seq);
+        return "YSBO" + dateFormat.format(date) + dfseq.format(seq);
     }
 
     public int addYSOrder(YSOrder YSOrder) {
@@ -74,7 +93,7 @@ public class YSOrderService {
         //调用接口
         try {
             YSOrderDao.insertSelective(YSOrder);
-        }catch (Exception ex){
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }
@@ -101,15 +120,44 @@ public class YSOrderService {
     }
 
 
-    public int updateYSOrder(YSOrder YSOrder) {
-        return YSOrderDao.updateByPrimaryKeySelective(YSOrder);
+    public int updateYSOrder(YSOrder ysOrder) {
+        return YSOrderDao.updateByPrimaryKeySelective(ysOrder);
+    }
+
+    public int finishYSOrder(YSOrder ysOrder) {
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            //更新介绍人状态 完成订单+1
+            DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(ysOrder.getOd_introducer_phone());
+            if (dcIntroducer != null) {
+                // 介绍人完成订单+1
+                dcIntroducer.setWv_finish_count(dcIntroducer.getWv_finish_count() + 1 );
+                dcIntroducerService.updateDcIntroducer(dcIntroducer);
+            }
+            //介绍人日志
+            DcIntroduceLog dcIntroduceLog = new DcIntroduceLog();
+            dcIntroduceLog.setXul_phone(ysOrder.getOd_phone());
+            dcIntroduceLog.setXul_event(7);
+            dcIntroduceLog.setXul_date(sdf.format(new Date()));
+            dcIntroduceLog.setXul_introducer_phone(ysOrder.getOd_introducer_phone());
+            dcIntroduceLog.setXul_orderno(ysOrder.getOd_no());
+            dcIntroduceLogService.insertDcIntroduceLog(dcIntroduceLog);
+            //更新订单状态
+            YSOrderDao.updateByPrimaryKeySelective(ysOrder);
+            return 1;
+        }catch (Exception ex) {
+            ex.printStackTrace();
+            return 0;
+        }
     }
 
-    public int updateYsOrderStatus(String od_no,Integer od_stauts, Double amount){
-        //更新订单状态&锁定月嫂签约
+    public int updateYsOrderStatus(String od_no, Integer od_stauts, Double amount) {
+        //锁定月嫂库存,增加介绍人返现金额,增加介绍人日志记录,变成介绍人(参加免单季),修改订单待付金额,传值CRM
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         YSOrder ysOrder = YSOrderDao.selectByOdNo(od_no);
         try {
             if (ysOrder.getOd_status() == 1) {
+                // 月嫂库存锁定
                 MmStock mmStock = new MmStock();
                 mmStock.setServant_code(ysOrder.getOd_mmid());
                 mmStock.setStart_date(ysOrder.getOd_startdate());
@@ -117,13 +165,107 @@ public class YSOrderService {
                 mmStock.setEnd_date(ysOrder.getOd_enddate());
                 mmStock.setOrderno(ysOrder.getOd_no());
                 mmStockDao.insertSelective(mmStock);
-                ysOrder.setOd_earnestpay(amount);
+                ysOrder.setOd_earnestpay(ysOrder.getOd_order_pay_amount());
+                ysOrder.setOd_order_pay_amount(
+                        ysOrder.getOd_order_amount() -
+                        ysOrder.getOd_mgm_discount() -
+                        ysOrder.getOd_promotion_discount() -
+                        ysOrder.getOd_other_discount() -
+                        ysOrder.getOd_order_pay_amount()
+                );
+                // 更新介绍人信息,转介绍单数+1 已签约+1
+                DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(ysOrder.getOd_introducer_phone());
+                if (dcIntroducer != null) {
+                    // 增加转介绍单数
+                    dcIntroducer.setWv_Introduction_count(dcIntroducer.getWv_Introduction_count() + 1);
+                    //增加已签约单数
+                    dcIntroducer.setWv_contract_count(dcIntroducer.getWv_contract_count() + 1);
+                    //升降级???!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                    dcIntroducerService.updateDcIntroducer(dcIntroducer);
+                }
+                // 增加介绍人日志记录
+                DcIntroduceLog dcIntroduceLog = new DcIntroduceLog();
+                dcIntroduceLog.setXul_phone(ysOrder.getOd_phone());
+                dcIntroduceLog.setXul_event(5);
+                dcIntroduceLog.setXul_date(sdf.format(new Date()));
+                dcIntroduceLog.setXul_introducer_phone(ysOrder.getOd_introducer_phone());
+                dcIntroduceLog.setXul_orderno(ysOrder.getOd_no());
+                dcIntroduceLogService.insertDcIntroduceLog(dcIntroduceLog);
+                // 变成介绍人(参加免单季)
+                DcIntroducer dcIntroducerMgm = dcIntroducerService.checkDcIntroducers(ysOrder.getOd_phone());
+                if (dcIntroducerMgm == null) {
+                    //生成二维码
+                    String qrcodePath = miniAppService.createQrCode(ysOrder.getOd_phone());
+                    if (qrcodePath.equals("error")) {
+                        return 9;
+                    }
+                    //增加介绍人
+                    DcIntroducer dcIntroducerNew = new DcIntroducer();
+                    dcIntroducerNew.setWv_phone(ysOrder.getOd_phone());
+                    dcIntroducerNew.setWv_gradeid(1); //再调整
+                    dcIntroducerNew.setWv_Introduction_total(0.00);
+                    dcIntroducerNew.setWv_withdraw_total(0.00);
+                    dcIntroducerNew.setWv_Introduction_count(0);
+                    dcIntroducerNew.setWv_qrcode(qrcodePath);
+                    dcIntroducerNew.setWv_people_count(0);
+                    dcIntroducerNew.setWv_extract_count(0);
+                    dcIntroducerNew.setWv_register_count(0);
+                    dcIntroducerNew.setWv_finish_count(0);
+                    dcIntroducerNew.setWv_contract_count(0);
+                    dcIntroducerService.insertDcIntroducer(dcIntroducerNew);
+                }
             } else {
-                ysOrder.setOd_balancepay(amount);
+                ysOrder.setOd_balancepay(ysOrder.getOd_order_pay_amount());
+                ysOrder.setOd_order_pay_amount(
+                        ysOrder.getOd_order_amount() -
+                        ysOrder.getOd_mgm_discount() -
+                        ysOrder.getOd_promotion_discount() -
+                        ysOrder.getOd_other_discount() -
+                        ysOrder.getOd_order_pay_amount() -
+                        Integer.valueOf(ysOrder.getOd_earnestpay().toString())
+                );
+                // 支付尾款 +推荐金额增加
+                DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(ysOrder.getOd_introducer_phone());
+                if (dcIntroducer != null) {
+                    //增加金额
+                    dcIntroducer.setWv_Introduction_total(dcIntroducer.getWv_Introduction_total() + Double.valueOf(ysOrder.getOd_rebate_amount()));
+                    dcIntroducerService.updateDcIntroducer(dcIntroducer);
+                }
+                //介绍人日志
+                DcIntroduceLog dcIntroduceLog = new DcIntroduceLog();
+                dcIntroduceLog.setXul_phone(ysOrder.getOd_phone());
+                dcIntroduceLog.setXul_event(6);
+                dcIntroduceLog.setXul_date(sdf.format(new Date()));
+                dcIntroduceLog.setXul_introducer_phone(ysOrder.getOd_introducer_phone());
+                dcIntroduceLog.setXul_orderno(ysOrder.getOd_no());
+                dcIntroduceLogService.insertDcIntroduceLog(dcIntroduceLog);
+                //回调CRM进行记录
+                HttpPost httpPost = new HttpPost(extracttemplateid);
+                CloseableHttpClient client = HttpClients.createDefault();
+                String respContent = null;
+                JSONObject jsonParam = new JSONObject();
+                jsonParam.put("odCityCode", "js");
+                jsonParam.put("odAmount", 10000);
+                jsonParam.put("odNo", "YS20181129150999");
+                jsonParam.put("odPhone", "15295794045");
+                jsonParam.put("odStatus", 3);
+                jsonParam.put("odIntroducerPhone", "15295795404");
+                jsonParam.put("odProductItem", "item_1");
+                StringEntity entity = new StringEntity(jsonParam.toString(),"utf-8");//解决中文乱码问题
+                entity.setContentEncoding("UTF-8");
+                entity.setContentType("application/json");
+                httpPost.setEntity(entity);
+                HttpResponse resp = client.execute(httpPost);
+                if(resp.getStatusLine().getStatusCode() != 200) {
+//                    HttpEntity he = resp.getEntity();
+//                    respContent = EntityUtils.toString(he,"UTF-8");
+                    return 0;
+                }
             }
+            // 更新订单状态,修改订单待付金额
             ysOrder.setOd_status(od_stauts);
             YSOrderDao.updateYsOrderStatus(ysOrder);
-        }catch (Exception ex){
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }

+ 2 - 3
src/main/java/com/ygj/yuemum/service/pay/CustomerPayService.java

@@ -80,10 +80,9 @@ public class CustomerPayService {
     public int insertYsOrderPay(CustomerPay customerPay) {
         try{
             customerPayDao.insertCustomerPay(customerPay);
-            //更新订单状态&锁定月嫂
+            //锁定月嫂库存,增加介绍人返现金额,增加介绍人日志记录,变成介绍人(参加免单季),修改订单待付金额,传值CRM
             ysOrderService.updateYsOrderStatus(customerPay.getCp_orderno(),customerPay.getCp_orderstatus(),customerPay.getCp_payamount());
-
-        }catch (Exception ex){
+         }catch (Exception ex){
             ex.printStackTrace();
             return 0;
         }

+ 2 - 0
src/main/resources/application.yml

@@ -106,5 +106,7 @@ baidu:
   BAIDUSK: "Ik3WA4BeyphCmC0z35OZ0OlgT6W7qnRC"
   AUTHHOST: "https://aip.baidubce.com/oauth/2.0/token?"
   BANKCARD: "https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard"
+api:
+  MDJAPIURL: "http://120.55.37.107:8763/introduce/activity"
 
 

+ 18 - 0
src/main/resources/mybatis/mapper/distributionchannel/DcIntroduceLogMapper.xml

@@ -14,6 +14,24 @@
     </resultMap>
 
     <!--获取所有数据-->
+    <select id="checkDcIntroducerLogs" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog">
+        select
+        count(1)
+        from dc_introduce_log
+        where xul_phone = #{xul_phone,jdbcType=VARCHAR}
+        and xul_event = #{xul_event,jdbcType=INTEGER}
+        order by id desc
+    </select>
+
+    <select id="checkFirstDILogs" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog">
+        select
+        count(1)
+        from dc_introduce_log
+        where xul_openid = #{xul_openid,jdbcType=VARCHAR}
+        and xul_event = 0
+        and xul_introducer_phone = #{xul_introducer_phone,jdbcType=INTEGER}
+        order by id desc
+    </select>
 
     <select id="queryDcIntroduceLogs" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog"
             parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroduceLog">

+ 3 - 3
src/main/resources/mybatis/mapper/distributionchannel/DcIntroducerExtractMapper.xml

@@ -83,12 +83,12 @@
         wue_phone,
         wue_bank_card,
         wue_type,
-        wue_applydate,
+        DATE_FORMAT(wue_applydate, '%Y-%m-%d') wue_applydate,
         wue_applysum,
-        wue_approverdate,
+        DATE_FORMAT(wue_approverdate, '%Y-%m-%d') wue_approverdate,
         wue_approversum,
         fgetuser_name(wue_approveruser) wue_approveruser,
-        wue_paydate,
+        DATE_FORMAT(wue_paydate, '%Y-%m-%d') wue_paydate,
         wue_remarks
         from dc_introducer_extract
         where 1=1

+ 89 - 84
src/main/resources/mybatis/mapper/distributionchannel/DcIntroducerMapper.xml

@@ -1,25 +1,24 @@
 <?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.ygj.yuemum.dao.distributionchannel.DcIntroducerDao" >
+<mapper namespace="com.ygj.yuemum.dao.distributionchannel.DcIntroducerDao">
 
-    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" >
-        <result column="id" property="id" jdbcType="INTEGER" />
-        <result column="wv_phone" property="wv_phone" jdbcType="VARCHAR" />
-        <result column="wv_gradeid" property="wv_gradeid" jdbcType="INTEGER" />
-        <result column="wv_Introduction_total" property="wv_Introduction_total" jdbcType="DECIMAL" />
-        <result column="wv_withdraw_total" property="wv_withdraw_total" jdbcType="DECIMAL" />
-        <result column="wv_Introduction_count" property="wv_Introduction_count" jdbcType="INTEGER" />
-        <result column="wv_order_count" property="wv_order_count" jdbcType="INTEGER" />
-        <result column="wv_extract_count" property="wv_extract_count" jdbcType="INTEGER" />
-        <result column="wv_qrcode" property="wv_qrcode" jdbcType="VARCHAR" />
-        <result column="wv_people_count" property="wv_people_count" jdbcType="INTEGER" />
-        <result column="wv_register_count" property="wv_register_count" jdbcType="INTEGER" />
-        <result column="wv_contract_count" property="wv_contract_count" jdbcType="INTEGER" />
-        <result column="wv_finish_count" property="wv_finish_count" jdbcType="INTEGER" />
-        <result column="wv_consultant" property="wv_consultant" jdbcType="VARCHAR" />
-        <result column="wv_account_number" property="wv_account_number" jdbcType="VARCHAR" />
-        <result column="wv_account_bank" property="wv_account_bank" jdbcType="VARCHAR" />
-        <result column="wv_account_number_path" property="wv_account_number_path" jdbcType="VARCHAR" />
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
+        <result column="id" property="id" jdbcType="INTEGER"/>
+        <result column="wv_phone" property="wv_phone" jdbcType="VARCHAR"/>
+        <result column="wv_gradeid" property="wv_gradeid" jdbcType="INTEGER"/>
+        <result column="wv_Introduction_total" property="wv_Introduction_total" jdbcType="DECIMAL"/>
+        <result column="wv_withdraw_total" property="wv_withdraw_total" jdbcType="DECIMAL"/>
+        <result column="wv_Introduction_count" property="wv_Introduction_count" jdbcType="INTEGER"/>
+        <result column="wv_extract_count" property="wv_extract_count" jdbcType="INTEGER"/>
+        <result column="wv_qrcode" property="wv_qrcode" jdbcType="VARCHAR"/>
+        <result column="wv_people_count" property="wv_people_count" jdbcType="INTEGER"/>
+        <result column="wv_register_count" property="wv_register_count" jdbcType="INTEGER"/>
+        <result column="wv_contract_count" property="wv_contract_count" jdbcType="INTEGER"/>
+        <result column="wv_finish_count" property="wv_finish_count" jdbcType="INTEGER"/>
+        <result column="wv_consultant" property="wv_consultant" jdbcType="VARCHAR"/>
+        <result column="wv_account_number" property="wv_account_number" jdbcType="VARCHAR"/>
+        <result column="wv_account_bank" property="wv_account_bank" jdbcType="VARCHAR"/>
+        <result column="wv_account_number_path" property="wv_account_number_path" jdbcType="VARCHAR"/>
     </resultMap>
 
     <!--获取所有数据-->
@@ -30,7 +29,8 @@
         order by id desc
     </select>
 
-    <select id="checkDcIntroducers" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" parameterType="java.lang.String">
+    <select id="checkDcIntroducers" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer"
+            parameterType="java.lang.String">
         select
         *
         from dc_introducer
@@ -38,9 +38,27 @@
         order by id desc
     </select>
 
+    <select id="queryDcIntroducersByUser" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer"
+            parameterType="java.lang.String">
+        SELECT
+        *
+        FROM
+        dc_introducer
+        WHERE
+        wv_phone IN (
+        SELECT DISTINCT
+        (xul_introducer_phone)
+        FROM
+        dc_introduce_log
+        WHERE
+        xul_phone =  #{xul_phone,jdbcType=VARCHAR}
+        AND xul_introducer_phone != ''
+        )
+    </select>
 
 
-    <select id="queryDcIntroducers" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
+    <select id="queryDcIntroducers" resultType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer"
+            parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
         select
         id,
         wv_phone,
@@ -50,7 +68,6 @@
         wv_Introduction_count,
         wv_extract_count,
         wv_qrcode,
-        wv_order_count,
         wv_people_count,
         wv_register_count,
         wv_contract_count,
@@ -79,9 +96,6 @@
         <if test="wv_qrcode != null and wv_qrcode != ''">
             and wv_qrcode = #{wv_qrcode,jdbcType=VARCHAR}
         </if>
-        <if test="wv_order_count != null and wv_order_count != ''">
-            and wv_order_count = #{wv_order_count,jdbcType=INTEGER}
-        </if>
         <if test="wv_people_count != null and wv_people_count != ''">
             and wv_people_count = #{wv_people_count,jdbcType=INTEGER}
         </if>
@@ -112,65 +126,62 @@
         order by id desc
     </select>
 
-    <update id="updateDcIntroducer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" >
+    <update id="updateDcIntroducer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
         update dc_introducer
-        <set >
-            <if test="wv_phone != null" >
+        <set>
+            <if test="wv_phone != null">
                 wv_phone = #{wv_phone,jdbcType=VARCHAR},
             </if>
-            <if test="wv_gradeid != null" >
+            <if test="wv_gradeid != null">
                 wv_gradeid = #{wv_gradeid,jdbcType=INTEGER},
             </if>
-            <if test="wv_Introduction_total != null" >
+            <if test="wv_Introduction_total != null">
                 wv_Introduction_total = #{wv_Introduction_total,jdbcType=DECIMAL},
             </if>
-            <if test="wv_withdraw_total != null" >
+            <if test="wv_withdraw_total != null">
                 wv_withdraw_total = #{wv_withdraw_total,jdbcType=DECIMAL},
             </if>
-            <if test="wv_Introduction_count != null" >
+            <if test="wv_Introduction_count != null">
                 wv_Introduction_count = #{wv_Introduction_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_order_count != null" >
-                wv_order_count = #{wv_order_count,jdbcType=INTEGER},
-            </if>
-            <if test="wv_extract_count != null" >
+            <if test="wv_extract_count != null">
                 wv_extract_count = #{wv_extract_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_qrcode != null" >
+            <if test="wv_qrcode != null">
                 wv_qrcode = #{wv_qrcode,jdbcType=VARCHAR},
             </if>
-            <if test="wv_register_count != null" >
+            <if test="wv_register_count != null">
                 wv_register_count = #{wv_register_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_contract_count != null" >
+            <if test="wv_contract_count != null">
                 wv_contract_count = #{wv_contract_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_finish_count != null" >
+            <if test="wv_finish_count != null">
                 wv_finish_count = #{wv_finish_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_people_count != null" >
+            <if test="wv_people_count != null">
                 wv_people_count = #{wv_people_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_consultant != null" >
+            <if test="wv_consultant != null">
                 wv_consultant = #{wv_consultant,jdbcType=INTEGER},
             </if>
 
-            <if test="wv_account_number_path != null" >
+            <if test="wv_account_number_path != null">
                 wv_account_number_path = #{wv_account_number_path,jdbcType=VARCHAR},
             </if>
-            <if test="wv_account_bank != null" >
+            <if test="wv_account_bank != null">
                 wv_account_bank = #{wv_account_bank,jdbcType=VARCHAR},
             </if>
-            <if test="wv_account_number != null" >
+            <if test="wv_account_number != null">
                 wv_account_number = #{wv_account_number,jdbcType=VARCHAR}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
 
-    <update id="updateAccountNumber" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" >
+    <update id="updateAccountNumber" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
         update dc_introducer
-        <set >
+        <set>
             <if test="wv_account_number != null" >
                 wv_account_number = #{wv_account_number,jdbcType=VARCHAR},
             </if>
@@ -185,99 +196,93 @@
     </update>
 
 
-    <insert id="insertDcIntroducer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer" >
+    <insert id="insertDcIntroducer" parameterType="com.ygj.yuemum.domain.distributionchannel.DcIntroducer">
         insert into dc_introducer
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="wv_phone != null" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="wv_phone != null">
                 wv_phone,
             </if>
-            <if test="wv_gradeid != null" >
+            <if test="wv_gradeid != null">
                 wv_gradeid,
             </if>
-            <if test="wv_Introduction_total != null" >
+            <if test="wv_Introduction_total != null">
                 wv_Introduction_total,
             </if>
-            <if test="wv_withdraw_total != null" >
+            <if test="wv_withdraw_total != null">
                 wv_withdraw_total,
             </if>
-            <if test="wv_Introduction_count != null" >
+            <if test="wv_Introduction_count != null">
                 wv_Introduction_count,
             </if>
-            <if test="wv_order_count != null" >
-                wv_order_count,
-            </if>
-            <if test="wv_extract_count != null" >
+            <if test="wv_extract_count != null">
                 wv_extract_count,
             </if>
-            <if test="wv_qrcode != null" >
+            <if test="wv_qrcode != null">
                 wv_qrcode,
             </if>
-            <if test="wv_register_count != null" >
+            <if test="wv_register_count != null">
                 wv_register_count,
             </if>
-            <if test="wv_contract_count != null" >
+            <if test="wv_contract_count != null">
                 wv_contract_count,
             </if>
-            <if test="wv_finish_count != null" >
+            <if test="wv_finish_count != null">
                 wv_finish_count,
             </if>
-            <if test="wv_people_count != null" >
+            <if test="wv_people_count != null">
                 wv_people_count,
             </if>
-            <if test="wv_account_number != null" >
+            <if test="wv_account_number != null">
                 wv_account_number,
             </if>
-            <if test="wv_account_bank != null" >
+            <if test="wv_account_bank != null">
                 wv_account_bank,
             </if>
-            <if test="wv_consultant != null" >
+            <if test="wv_consultant != null">
                 wv_consultant
             </if>
         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="wv_phone != null" >
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="wv_phone != null">
                 #{wv_phone,jdbcType=VARCHAR},
             </if>
-            <if test="wv_gradeid != null" >
+            <if test="wv_gradeid != null">
                 #{wv_gradeid,jdbcType=INTEGER},
             </if>
-            <if test="wv_Introduction_total != null" >
+            <if test="wv_Introduction_total != null">
                 #{wv_Introduction_total,jdbcType=DECIMAL},
             </if>
-            <if test="wv_withdraw_total != null" >
+            <if test="wv_withdraw_total != null">
                 #{wv_withdraw_total,jdbcType=DECIMAL},
             </if>
-            <if test="wv_extract_count != null" >
+            <if test="wv_extract_count != null">
                 #{wv_extract_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_order_count != null" >
-                #{wv_order_count,jdbcType=INTEGER},
-            </if>
-            <if test="wv_Introduction_count != null" >
+            <if test="wv_Introduction_count != null">
                 #{wv_Introduction_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_qrcode != null" >
+            <if test="wv_qrcode != null">
                 #{wv_qrcode,jdbcType=VARCHAR},
             </if>
-            <if test="wv_register_count != null" >
+            <if test="wv_register_count != null">
                 #{wv_register_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_contract_count != null" >
+            <if test="wv_contract_count != null">
                 #{wv_contract_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_finish_count != null" >
+            <if test="wv_finish_count != null">
                 #{wv_finish_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_people_count != null" >
+            <if test="wv_people_count != null">
                 #{wv_people_count,jdbcType=INTEGER},
             </if>
-            <if test="wv_account_number != null" >
+            <if test="wv_account_number != null">
                 #{wv_account_number,jdbcType=VARCHAR},
             </if>
-            <if test="wv_account_bank != null" >
+            <if test="wv_account_bank != null">
                 #{wv_account_bank,jdbcType=VARCHAR},
             </if>
-            <if test="wv_consultant != null" >
+            <if test="wv_consultant != null">
                 #{wv_consultant,jdbcType=VARCHAR}
             </if>
         </trim>

+ 88 - 24
src/main/resources/mybatis/mapper/order/YSOrder.xml

@@ -20,10 +20,14 @@
         <result column="od_introducer_phone" property="od_introducer_phone" jdbcType="VARCHAR" />
         <result column="od_introducer_consultant" property="od_introducer_consultant" jdbcType="INTEGER" />
         <result column="od_order_amount" property="od_order_amount" jdbcType="INTEGER" />
-        <result column="od_mdj_amount" property="od_mdj_amount" jdbcType="INTEGER" />
-        <result column="od_vip_cash" property="od_vip_cash" jdbcType="INTEGER" />
+        <result column="od_order_pay_amount" property="od_order_pay_amount" jdbcType="INTEGER" />
+        <result column="od_mgm_discount" property="od_mgm_discount" jdbcType="INTEGER" />
+        <result column="od_promotion_discount" property="od_promotion_discount" jdbcType="INTEGER" />
+        <result column="od_other_discount" property="od_other_discount" jdbcType="INTEGER" />
+        <result column="od_rebate_amount" property="od_rebate_amount" jdbcType="INTEGER" />
         <result column="od_earnestpay" property="od_earnestpay" jdbcType="INTEGER" />
         <result column="od_balancepay" property="od_balancepay" jdbcType="INTEGER" />
+        <result column="od_promotion_id" property="od_promotion_id" jdbcType="INTEGER" />
         <result column="od_ismdj" property="od_ismdj" jdbcType="INTEGER" />
         <result column="od_mdjstartdate" property="od_mdjstartdate" jdbcType="DATE" />
         <result column="od_mdjenddate" property="od_mdjenddate" jdbcType="DATE" />
@@ -35,7 +39,8 @@
     <sql id="Base_Column_List" >
         id,od_no, od_user_name,od_user_address,od_status,od_phone,od_startdate,od_enddate,od_mmid,od_product_id,
         od_product_item_id,od_cityid,od_contract,od_consultantid,od_introducer_phone,od_introducer_consultant,
-        od_order_amount,od_mdj_amount,od_vip_cash,od_earnestpay,od_balancepay,od_ismdj,od_mdjstartdate,od_mdjenddate,od_user,od_date
+        od_order_amount,od_order_pay_amount,od_mgm_discount,od_promotion_discount,od_other_discount,od_rebate_amount,
+        od_earnestpay,od_balancepay,od_promotion_id,od_ismdj,od_mdjstartdate,od_mdjenddate,od_user,od_date
     </sql>
 
     <!--获取所有数据-->
@@ -66,7 +71,8 @@
         fgetpackagename(od_product_id) od_product_name,od_product_id,
         od_product_item_id,
         fgetcityname(od_cityid) od_cityidname, od_cityid,od_contract,od_consultantid,od_introducer_phone,od_introducer_consultant,
-        od_order_amount,od_mdj_amount,od_vip_cash,od_earnestpay,od_balancepay,od_ismdj,od_mdjstartdate,od_mdjenddate,od_user,od_date
+        od_order_amount,od_order_pay_amount,od_mgm_discount,od_promotion_discount,od_other_discount,od_rebate_amount,
+        od_earnestpay,od_balancepay,od_promotion_id,od_ismdj,od_mdjstartdate,od_mdjenddate,od_user,od_date
         from ys_order
         order by id desc
     </select>
@@ -94,10 +100,14 @@
         od_introducer_phone,
         od_introducer_consultant,
         od_order_amount,
-        od_mdj_amount,
-        od_vip_cash,
+        od_order_pay_amount,
+        od_mgm_discount,
+        od_promotion_discount,
+        od_other_discount,
+        od_rebate_amount,
         od_earnestpay,
         od_balancepay,
+        od_promotion_id,
         od_ismdj,
         od_mdjstartdate,
         od_mdjenddate,
@@ -148,6 +158,9 @@
         <if test="od_introducer_phone != null and od_introducer_phone != ''">
             and od_introducer_phone = #{od_introducer_phone,jdbcType=VARCHAR}
         </if>
+        <if test="od_order_pay_amount != null and od_order_pay_amount != ''">
+            and od_order_pay_amount = #{od_order_pay_amount,jdbcType=INTEGER}
+        </if>
         <if test="od_ismdj != null and od_ismdj != ''">
             and od_ismdj = #{od_ismdj,jdbcType=INTEGER}
         </if>
@@ -181,10 +194,14 @@
         od_introducer_phone,
         od_introducer_consultant,
         od_order_amount,
-        od_mdj_amount,
-        od_vip_cash,
+        od_order_pay_amount,
+        od_mgm_discount,
+        od_promotion_discount,
+        od_other_discount,
+        od_rebate_amount,
         od_earnestpay,
         od_balancepay,
+        od_promotion_id,
         od_ismdj,
         od_mdjstartdate,
         od_mdjenddate,
@@ -218,10 +235,14 @@
         od_introducer_phone,
         od_introducer_consultant,
         od_order_amount,
-        od_mdj_amount,
-        od_vip_cash,
+        od_order_pay_amount,
+        od_mgm_discount,
+        od_promotion_discount,
+        od_other_discount,
+        od_rebate_amount,
         od_earnestpay,
         od_balancepay,
+        od_promotion_id,
         od_ismdj,
         od_mdjstartdate,
         od_mdjenddate,
@@ -254,10 +275,14 @@
         od_introducer_phone,
         od_introducer_consultant,
         od_order_amount,
-        od_mdj_amount,
-        od_vip_cash,
+        od_order_pay_amount,
+        od_mgm_discount,
+        od_promotion_discount,
+        od_other_discount,
+        od_rebate_amount,
         od_earnestpay,
         od_balancepay,
+        od_promotion_id,
         od_ismdj,
         od_mdjstartdate,
         od_mdjenddate,
@@ -325,18 +350,30 @@
             <if test="od_order_amount != null" >
                 od_order_amount,
             </if>
-            <if test="od_mdj_amount != null" >
-                od_mdj_amount,
+            <if test="od_order_pay_amount != null" >
+                od_order_pay_amount,
+            </if>
+            <if test="od_mgm_discount != null" >
+                od_mgm_discount,
             </if>
-            <if test="od_vip_cash != null" >
-                od_vip_cash,
+            <if test="od_promotion_discount != null" >
+                od_promotion_discount,
+            </if>
+            <if test="od_other_discount != null" >
+                od_other_discount,
             </if>
             <if test="od_earnestpay != null" >
                 od_earnestpay,
             </if>
+            <if test="od_rebate_amount != null" >
+                od_rebate_amount,
+            </if>
             <if test="od_balancepay != null" >
                 od_balancepay,
             </if>
+            <if test="od_promotion_id != null" >
+                od_promotion_id,
+            </if>
             <if test="od_ismdj != null" >
                 od_ismdj,
             </if>
@@ -402,11 +439,20 @@
             <if test="od_order_amount != null" >
                 #{od_order_amount,jdbcType=INTEGER},
             </if>
-            <if test="od_mdj_amount != null" >
-                #{od_mdj_amount,jdbcType=INTEGER},
+            <if test="od_order_pay_amount != null" >
+                #{od_order_pay_amount,jdbcType=INTEGER},
+            </if>
+            <if test="od_mgm_discount != null" >
+                #{od_mgm_discount,jdbcType=INTEGER},
+            </if>
+            <if test="od_promotion_discount != null" >
+                #{od_promotion_discount,jdbcType=INTEGER},
             </if>
-            <if test="od_vip_cash != null" >
-                #{od_vip_cash,jdbcType=INTEGER},
+            <if test="od_other_discount != null" >
+                #{od_other_discount,jdbcType=INTEGER},
+            </if>
+            <if test="od_rebate_amount != null" >
+                #{od_rebate_amount,jdbcType=INTEGER},
             </if>
             <if test="od_earnestpay != null" >
                 #{od_earnestpay,jdbcType=INTEGER},
@@ -414,6 +460,9 @@
             <if test="od_balancepay != null" >
                 #{od_balancepay,jdbcType=INTEGER},
             </if>
+            <if test="od_promotion_id != null" >
+                #{od_promotion_id,jdbcType=INTEGER},
+            </if>
             <if test="od_ismdj != null" >
                 #{od_ismdj,jdbcType=INTEGER},
             </if>
@@ -487,11 +536,20 @@
             <if test="od_order_amount != null" >
                 od_order_amount = #{od_order_amount,jdbcType=INTEGER},
             </if>
-            <if test="od_mdj_amount != null" >
-                od_mdj_amount = #{od_mdj_amount,jdbcType=INTEGER},
+            <if test="od_order_pay_amount != null" >
+                od_order_pay_amount = #{od_order_pay_amount,jdbcType=INTEGER},
+            </if>
+            <if test="od_mgm_discount != null" >
+                od_mgm_discount = #{od_mgm_discount,jdbcType=INTEGER},
+            </if>
+            <if test="od_promotion_discount != null" >
+                od_promotion_discount = #{od_promotion_discount,jdbcType=INTEGER},
             </if>
-            <if test="od_vip_cash != null" >
-                od_vip_cash = #{od_vip_cash,jdbcType=INTEGER},
+            <if test="od_other_discount != null" >
+                od_other_discount = #{od_other_discount,jdbcType=INTEGER},
+            </if>
+            <if test="od_rebate_amount != null" >
+                od_rebate_amount = #{od_rebate_amount,jdbcType=INTEGER},
             </if>
             <if test="od_earnestpay != null" >
                 od_earnestpay = #{od_earnestpay,jdbcType=INTEGER},
@@ -499,6 +557,9 @@
             <if test="od_balancepay != null" >
                 od_balancepay = #{od_balancepay,jdbcType=INTEGER},
             </if>
+            <if test="od_promotion_id != null" >
+                od_promotion_id = #{od_promotion_id,jdbcType=INTEGER},
+            </if>
             <if test="od_ismdj != null" >
                 od_ismdj = #{od_ismdj,jdbcType=INTEGER},
             </if>
@@ -531,6 +592,9 @@
             <if test="od_status != null" >
                 od_status = #{od_status,jdbcType=INTEGER},
             </if>
+            <if test="od_order_pay_amount != null" >
+                od_order_pay_amount = #{od_order_pay_amount,jdbcType=INTEGER},
+            </if>
             <if test="od_earnestpay != null" >
                 od_earnestpay = #{od_earnestpay,jdbcType=INTEGER},
             </if>