Shanks 7 anos atrás
pai
commit
4accc5023f
22 arquivos alterados com 1281 adições e 11 exclusões
  1. 21 0
      src/main/java/com/ygj/yuemum/controller/coupon/CouponController.java
  2. 50 0
      src/main/java/com/ygj/yuemum/controller/customer/CustomerCouponController.java
  3. 46 0
      src/main/java/com/ygj/yuemum/controller/modoo/ModooLogController.java
  4. 46 0
      src/main/java/com/ygj/yuemum/controller/order/OrderTempController.java
  5. 7 0
      src/main/java/com/ygj/yuemum/dao/coupon/CouponDao.java
  6. 28 0
      src/main/java/com/ygj/yuemum/dao/customer/CustomerCouponDao.java
  7. 23 0
      src/main/java/com/ygj/yuemum/dao/modoo/ModooLogDao.java
  8. 25 0
      src/main/java/com/ygj/yuemum/dao/order/OrderTempDao.java
  9. 6 6
      src/main/java/com/ygj/yuemum/domain/coupon/CouponLog.java
  10. 95 0
      src/main/java/com/ygj/yuemum/domain/customer/CustomerCoupon.java
  11. 50 0
      src/main/java/com/ygj/yuemum/domain/modoo/ModooLog.java
  12. 59 0
      src/main/java/com/ygj/yuemum/domain/order/OrderTemp.java
  13. 219 1
      src/main/java/com/ygj/yuemum/service/coupon/CouponService.java
  14. 56 0
      src/main/java/com/ygj/yuemum/service/customer/CustomerCouponService.java
  15. 50 0
      src/main/java/com/ygj/yuemum/service/modoo/ModooLogService.java
  16. 52 0
      src/main/java/com/ygj/yuemum/service/order/OrderTempService.java
  17. 2 2
      src/main/resources/application.yml
  18. 2 2
      src/main/resources/mybatis/mapper/coupon/CouponLogMapper.xml
  19. 34 0
      src/main/resources/mybatis/mapper/coupon/CouponMapper.xml
  20. 233 0
      src/main/resources/mybatis/mapper/customer/CustomerCouponMapper.xml
  21. 78 0
      src/main/resources/mybatis/mapper/modoo/ModooLogMapper.xml
  22. 99 0
      src/main/resources/mybatis/mapper/order/OrderTemp.xml

+ 21 - 0
src/main/java/com/ygj/yuemum/controller/coupon/CouponController.java

@@ -47,4 +47,25 @@ public class CouponController {
     public Coupon getOne(@PathVariable("id") Integer id) {
         return couponService.getCoupon(id);
     }
+
+    //Modoo API
+    @GetMapping("/getNewUserCoupon") //新用户礼包
+    public int getNewUserCoupon(@RequestParam("phone") String phone, @RequestParam("channel") Integer channel) {
+        return couponService.getNewUserCoupon(phone,channel);
+    }
+    @GetMapping("/getConsultTaskCoupon") //咨询任务
+    public int getConsultTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
+
+        return couponService.getConsultTaskCoupon(phone,channel);
+    }
+    @GetMapping("/getDetectionTaskCoupon") //测胎心任务
+    public int getDetectionTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
+
+        return couponService.getDetectionTaskCoupon(phone,channel);
+    }
+    @GetMapping("/getRechargeTaskCoupon") //充值任务
+    public int getRechargeTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
+        return couponService.getRechargeTaskCoupon(phone,channel);
+    }
+
 }

+ 50 - 0
src/main/java/com/ygj/yuemum/controller/customer/CustomerCouponController.java

@@ -0,0 +1,50 @@
+package com.ygj.yuemum.controller.customer;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.customer.CustomerCoupon;
+import com.ygj.yuemum.service.customer.CustomerCouponService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class CustomerCouponController {
+
+    @Autowired
+    private CustomerCouponService customerCouponService;
+
+    @GetMapping("/getCustomerCoupons")
+    public String getCustomerCoupons(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
+        Map<String, Object> customerCoupons = customerCouponService.getCustomerCoupons(page,limit);
+        String jso = JSONObject.toJSONString(customerCoupons);
+        return jso;
+    }
+
+    @GetMapping("/getAllCustomerCoupons")
+    public List<CustomerCoupon> getAllCoupons() {
+            return customerCouponService.getAll();
+    }
+
+    @PostMapping("/addCustomerCoupon")
+    public int add(@ModelAttribute CustomerCoupon customerCoupon) {
+        return customerCouponService.addCustomerCoupon(customerCoupon);
+    }
+
+    @GetMapping("/deleteCustomerCoupon/{id}")
+    public int delete(@PathVariable("id") Integer id) {
+        return customerCouponService.deleteCustomerCoupon(id);
+    }
+
+    @PostMapping("/updateCustomerCoupon")
+    public int update(@ModelAttribute CustomerCoupon customerCoupon) {
+        return customerCouponService.updateCustomerCoupon(customerCoupon);
+    }
+
+    @GetMapping("/getCustomerCoupon/{id}")
+    public CustomerCoupon getOne(@PathVariable("id") Integer id) {
+        return customerCouponService.getCustomerCoupon(id);
+    }
+}

+ 46 - 0
src/main/java/com/ygj/yuemum/controller/modoo/ModooLogController.java

@@ -0,0 +1,46 @@
+package com.ygj.yuemum.controller.modoo;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.modoo.ModooLog;
+import com.ygj.yuemum.service.modoo.ModooLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class ModooLogController {
+
+    @Autowired
+    private ModooLogService modooLogService;
+
+    @GetMapping("/getModooLogs")
+    public String getModooLogs(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
+        Map<String, Object> modooLogs = modooLogService.getModooLogs(page,limit);
+        String jso = JSONObject.toJSONString(modooLogs);
+        return jso;
+    }
+
+    @GetMapping("/getAllModooLogs")
+    public List<ModooLog> getAllModooLogs() {
+            return modooLogService.getAll();
+    }
+
+    @PostMapping("/addModooLog")
+    public int add(@ModelAttribute ModooLog modooLog) {
+        return modooLogService.addModooLog(modooLog);
+    }
+
+    @GetMapping("/deleteModooLog/{id}")
+    public int delete(@PathVariable("id") Integer id) {
+        return modooLogService.deleteModooLog(id);
+    }
+
+
+    @GetMapping("/getModooLog/{id}")
+    public ModooLog getOne(@PathVariable("id") Integer id) {
+        return modooLogService.getModooLog(id);
+    }
+}

+ 46 - 0
src/main/java/com/ygj/yuemum/controller/order/OrderTempController.java

@@ -0,0 +1,46 @@
+package com.ygj.yuemum.controller.order;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.order.OrderTemp;
+import com.ygj.yuemum.service.order.OrderTempService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class OrderTempController {
+
+    @Autowired
+    private OrderTempService orderTempService;
+
+    @GetMapping("/getOrderTemps")
+    public String getOrderTemps(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
+        Map<String, Object> orderTemps = orderTempService.getOrderTemps(page,limit);
+        String jso = JSONObject.toJSONString(orderTemps);
+        return jso;
+    }
+
+    @GetMapping("/getAllOrderTemps")
+    public List<OrderTemp> getAllOrderTemps() {
+            return orderTempService.getAll();
+    }
+
+    @PostMapping("/addOrderTemp")
+    public int add(@ModelAttribute OrderTemp orderTemp) {
+        return orderTempService.addOrderTemp(orderTemp);
+    }
+
+    @GetMapping("/deleteOrderTemp/{id}")
+    public int delete(@PathVariable("id") Integer id) {
+        return orderTempService.deleteOrderTemp(id);
+    }
+
+
+    @GetMapping("/getOrderTemp/{id}")
+    public OrderTemp getOne(@PathVariable("id") Integer id) {
+        return orderTempService.getOrderTemp(id);
+    }
+}

+ 7 - 0
src/main/java/com/ygj/yuemum/dao/coupon/CouponDao.java

@@ -24,6 +24,13 @@ public interface CouponDao {
 
     int getCount();
 
+    //Modoo API
 
+    int getDetectionTaskCoupon(String phone);
+
+    String  getCoupon(String cb_code);
+
+    int updateGetCoupon(String cp_code);
+    String getCouponAmount (Coupon record);
 
 }

+ 28 - 0
src/main/java/com/ygj/yuemum/dao/customer/CustomerCouponDao.java

@@ -0,0 +1,28 @@
+package com.ygj.yuemum.dao.customer;
+
+import com.ygj.yuemum.domain.customer.CustomerCoupon;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CustomerCouponDao {
+
+    List<CustomerCoupon> getAll();
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CustomerCoupon record);
+
+    CustomerCoupon selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(CustomerCoupon record);
+
+    int getCount();
+
+    int checkCustomerCoupon(CustomerCoupon record);
+    int checkSumCustomerCoupon(String cm_phone);
+
+
+
+}

+ 23 - 0
src/main/java/com/ygj/yuemum/dao/modoo/ModooLogDao.java

@@ -0,0 +1,23 @@
+package com.ygj.yuemum.dao.modoo;
+
+import com.ygj.yuemum.domain.modoo.ModooLog;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ModooLogDao {
+
+    List<ModooLog> getAll();
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(ModooLog record);
+
+    ModooLog selectByPrimaryKey(Integer id);
+
+    int getCount();
+
+
+
+}

+ 25 - 0
src/main/java/com/ygj/yuemum/dao/order/OrderTempDao.java

@@ -0,0 +1,25 @@
+package com.ygj.yuemum.dao.order;
+
+import com.ygj.yuemum.domain.order.OrderTemp;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface OrderTempDao {
+
+    List<OrderTemp> getAll();
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(OrderTemp record);
+
+    OrderTemp selectByPrimaryKey(Integer id);
+
+    int getCount();
+
+    int checkOrder(String cm_phone);
+
+
+
+}

+ 6 - 6
src/main/java/com/ygj/yuemum/domain/coupon/CouponLog.java

@@ -5,17 +5,17 @@ public class CouponLog {
     private Integer id;
     private String cp_code;
     private Integer cl_type;
-    private Integer cb_code;
-    private Integer cl_mp;
+    private String cb_code;
+    private String cl_mp;
     private Integer cl_user;
     private String cl_date;
     private String cl_billno;
 
-    public Integer getCb_code() {
+    public String getCb_code() {
         return cb_code;
     }
 
-    public void setCb_code(Integer cb_code) {
+    public void setCb_code(String cb_code) {
         this.cb_code = cb_code;
     }
 
@@ -43,11 +43,11 @@ public class CouponLog {
         this.cl_type = cl_type;
     }
 
-    public Integer getCl_mp() {
+    public String getCl_mp() {
         return cl_mp;
     }
 
-    public void setCl_mp(Integer cl_mp) {
+    public void setCl_mp(String cl_mp) {
         this.cl_mp = cl_mp;
     }
 

+ 95 - 0
src/main/java/com/ygj/yuemum/domain/customer/CustomerCoupon.java

@@ -0,0 +1,95 @@
+package com.ygj.yuemum.domain.customer;
+
+public class CustomerCoupon {
+
+    private Integer id;
+    private String cm_code;
+    private String cm_phone;
+    private String cb_code;
+    private String cc_code;
+    private Integer cp_status;
+    private String cc_getdate;
+    private Integer cc_getchannel;
+    private String cc_usedate;
+    private String cc_usebillno;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCm_code() {
+        return cm_code;
+    }
+
+    public void setCm_code(String cm_code) {
+        this.cm_code = cm_code;
+    }
+
+    public String getCm_phone() {
+        return cm_phone;
+    }
+
+    public void setCm_phone(String cm_phone) {
+        this.cm_phone = cm_phone;
+    }
+
+    public String getCb_code() {
+        return cb_code;
+    }
+
+    public void setCb_code(String cb_code) {
+        this.cb_code = cb_code;
+    }
+
+    public String getCc_code() {
+        return cc_code;
+    }
+
+    public void setCc_code(String cc_code) {
+        this.cc_code = cc_code;
+    }
+
+    public Integer getCp_status() {
+        return cp_status;
+    }
+
+    public void setCp_status(Integer cp_status) {
+        this.cp_status = cp_status;
+    }
+
+    public String getCc_getdate() {
+        return cc_getdate;
+    }
+
+    public void setCc_getdate(String cc_getdate) {
+        this.cc_getdate = cc_getdate;
+    }
+
+    public Integer getCc_getchannel() {
+        return cc_getchannel;
+    }
+
+    public void setCc_getchannel(Integer cc_getchannel) {
+        this.cc_getchannel = cc_getchannel;
+    }
+
+    public String getCc_usedate() {
+        return cc_usedate;
+    }
+
+    public void setCc_usedate(String cc_usedate) {
+        this.cc_usedate = cc_usedate;
+    }
+
+    public String getCc_usebillno() {
+        return cc_usebillno;
+    }
+
+    public void setCc_usebillno(String cc_usebillno) {
+        this.cc_usebillno = cc_usebillno;
+    }
+}

+ 50 - 0
src/main/java/com/ygj/yuemum/domain/modoo/ModooLog.java

@@ -0,0 +1,50 @@
+package com.ygj.yuemum.domain.modoo;
+
+public class ModooLog {
+
+    private Integer id;
+    private String ml_usermp;
+    private String ml_testtime;
+    private Integer ml_testduration;
+    private String ml_datetime;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getMl_usermp() {
+        return ml_usermp;
+    }
+
+    public void setMl_usermp(String ml_usermp) {
+        this.ml_usermp = ml_usermp;
+    }
+
+    public String getMl_testtime() {
+        return ml_testtime;
+    }
+
+    public void setMl_testtime(String ml_testtime) {
+        this.ml_testtime = ml_testtime;
+    }
+
+    public Integer getMl_testduration() {
+        return ml_testduration;
+    }
+
+    public void setMl_testduration(Integer ml_testduration) {
+        this.ml_testduration = ml_testduration;
+    }
+
+    public String getMl_datetime() {
+        return ml_datetime;
+    }
+
+    public void setMl_datetime(String ml_datetime) {
+        this.ml_datetime = ml_datetime;
+    }
+}

+ 59 - 0
src/main/java/com/ygj/yuemum/domain/order/OrderTemp.java

@@ -0,0 +1,59 @@
+package com.ygj.yuemum.domain.order;
+
+public class OrderTemp {
+
+    private Integer id;
+    private String ot_code;
+    private String cm_phone;
+    private String ot_startdate;
+    private String ot_enddate;
+    private Integer jl_mmid;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOt_code() {
+        return ot_code;
+    }
+
+    public void setOt_code(String ot_code) {
+        this.ot_code = ot_code;
+    }
+
+    public String getCm_phone() {
+        return cm_phone;
+    }
+
+    public void setCm_phone(String cm_phone) {
+        this.cm_phone = cm_phone;
+    }
+
+    public String getOt_startdate() {
+        return ot_startdate;
+    }
+
+    public void setOt_startdate(String ot_startdate) {
+        this.ot_startdate = ot_startdate;
+    }
+
+    public String getOt_enddate() {
+        return ot_enddate;
+    }
+
+    public void setOt_enddate(String ot_enddate) {
+        this.ot_enddate = ot_enddate;
+    }
+
+    public Integer getJl_mmid() {
+        return jl_mmid;
+    }
+
+    public void setJl_mmid(Integer jl_mmid) {
+        this.jl_mmid = jl_mmid;
+    }
+}

+ 219 - 1
src/main/java/com/ygj/yuemum/service/coupon/CouponService.java

@@ -3,9 +3,15 @@ package com.ygj.yuemum.service.coupon;
 import com.github.pagehelper.PageHelper;
 import com.ygj.yuemum.dao.coupon.CouponDao;
 import com.ygj.yuemum.domain.coupon.Coupon;
+import com.ygj.yuemum.domain.coupon.CouponLog;
+import com.ygj.yuemum.domain.customer.CustomerCoupon;
+import com.ygj.yuemum.service.customer.CustomerCouponService;
+import com.ygj.yuemum.service.order.OrderTempService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -15,20 +21,29 @@ public class CouponService {
 
     @Autowired
     private CouponDao couponDao;
+    @Autowired
+    private OrderTempService orderTempService;
+    @Autowired
+    private CustomerCouponService customerCouponService;
+    @Autowired
+    private CouponLogService couponLogService;
+
     //分页
     public Map<String, Object> getCoupons(int page, int limit) {
         PageHelper.startPage(page, limit);
         List<Coupon> coupons = couponDao.getAll();
         Map<String, Object> tableData = new HashMap<>();
-        Integer count  = couponDao.getCount();
+        Integer count = couponDao.getCount();
         tableData.put("items", coupons);
         tableData.put("total", count);
         return tableData;
     }
+
     public List<Coupon> getAll() {
         List<Coupon> coupons = couponDao.getAll();
         return coupons;
     }
+
     public int addCoupon(Coupon coupon) {
         return couponDao.insertSelective(coupon);
     }
@@ -53,5 +68,208 @@ public class CouponService {
         return couponDao.selectByPrimaryKey(id);
     }
 
+    //Modoo API 1.成功领取 |  61.已有订单  |  62.重复领取 |  63.超出金额 |  98.优惠券不足 |  99.系统异常
+    public int getNewUserCoupon(String phone, int channel) {//新用户礼包
+        /*
+        券总金额大于500 不能再领
+        检查用户是否符合领取条件 customer_coupon order_temp --
+        获取优惠券信息 --
+        保存都customer_coupon表 --
+        更新优惠券状态--
+        日志里面插入一条信息--
+        返回
+        */
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (customerCouponService.checkSumCustomerCoupon(phone) > 500) {
+                return 63;
+            }
+            if (orderTempService.checkOrder(phone) > 0) {
+                return 61;
+            }
+            CustomerCoupon checkCustomer = new CustomerCoupon();
+            checkCustomer.setCm_phone(phone);
+            checkCustomer.setCb_code("PVP2018051297451");
+            if (customerCouponService.checkCustomerCoupon(checkCustomer) > 0) {
+                return 62;
+            }
+            String cp_code = couponDao.getCoupon("PVP2018051297451");
+            if (cp_code.equals(null)) {
+                return 98;
+            }
+            CustomerCoupon customerCoupon = new CustomerCoupon();
+            customerCoupon.setCm_phone(phone);
+            customerCoupon.setCb_code("PVP2018051297451");
+            customerCoupon.setCc_code(cp_code);
+            customerCoupon.setCp_status(1);
+            customerCoupon.setCc_getdate(sdf.format(new Date()));
+            customerCoupon.setCc_getchannel(channel);
+            customerCouponService.addCustomerCoupon(customerCoupon);
+            couponDao.updateGetCoupon(cp_code);
+            CouponLog couponLog = new CouponLog();
+            couponLog.setCp_code(cp_code);
+            couponLog.setCl_type(1);
+            couponLog.setCl_mp(phone);
+            couponLog.setCl_user(9527);
+            couponLog.setCl_date(sdf.format(new Date()));
+            couponLog.setCb_code("PVP2018051297451");
+            couponLogService.addCouponLog(couponLog);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 99;
+        }
+
+        return 1;
+    }
+
+    public int getConsultTaskCoupon(String phone, int channel) {//咨询任务
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (customerCouponService.checkSumCustomerCoupon(phone) > 500) {
+                return 63;
+            }
+            if (orderTempService.checkOrder(phone) > 0) {
+                return 61;
+            }
+            CustomerCoupon checkCustomer = new CustomerCoupon();
+            checkCustomer.setCm_phone(phone);
+            checkCustomer.setCb_code("PVP2018051273883");
+            int coupons = customerCouponService.checkCustomerCoupon(checkCustomer);
+            Coupon getCouponAmount = new Coupon();
+            if ( coupons >= 3) {
+                return 62;
+            } else if (coupons == 2){
+                getCouponAmount.setCp_amount(50);
+            } else if (coupons == 1){
+                getCouponAmount.setCp_amount(30);
+            } else if (coupons == 0){
+                getCouponAmount.setCp_amount(20);
+            }
+            getCouponAmount.setCb_code("PVP2018051273883");
+            String cp_code = couponDao.getCouponAmount(getCouponAmount);
+            if (cp_code.equals(null)) {
+                return 98;
+            }
+            CustomerCoupon customerCoupon = new CustomerCoupon();
+            customerCoupon.setCm_phone(phone);
+            customerCoupon.setCb_code("PVP2018051273883");
+            customerCoupon.setCc_code(cp_code);
+            customerCoupon.setCp_status(1);
+            customerCoupon.setCc_getdate(sdf.format(new Date()));
+            customerCoupon.setCc_getchannel(channel);
+            customerCouponService.addCustomerCoupon(customerCoupon);
+            couponDao.updateGetCoupon(cp_code);
+            CouponLog couponLog = new CouponLog();
+            couponLog.setCp_code(cp_code);
+            couponLog.setCl_type(1);
+            couponLog.setCl_mp(phone);
+            couponLog.setCl_user(9527);
+            couponLog.setCl_date(sdf.format(new Date()));
+            couponLog.setCb_code("PVP2018051273883");
+            couponLogService.addCouponLog(couponLog);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 99;
+        }
+
+        return 1;
+    }
+
+    public int getDetectionTaskCoupon(String phone, int channel) {//测胎心任务
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (customerCouponService.checkSumCustomerCoupon(phone) > 500) {
+                return 63;
+            }
+            if (orderTempService.checkOrder(phone) > 0) {
+                return 61;
+            }
+            CustomerCoupon checkCustomer = new CustomerCoupon();
+            checkCustomer.setCm_phone(phone);
+            checkCustomer.setCb_code("PVP2018051211608");
+            int coupons = customerCouponService.checkCustomerCoupon(checkCustomer);
+            Coupon getCouponAmount = new Coupon();
+            if ( coupons >= 3) {
+                return 62;
+            } else if (coupons == 2) getCouponAmount.setCp_amount(50);
+            else if (coupons == 1){
+                getCouponAmount.setCp_amount(30);
+            } else if (coupons == 0){
+                getCouponAmount.setCp_amount(20);
+            }
+            getCouponAmount.setCb_code("PVP2018051211608");
+            String cp_code = couponDao.getCouponAmount(getCouponAmount);
+            if (cp_code.equals(null)) {
+                return 98;
+            }
+            CustomerCoupon customerCoupon = new CustomerCoupon();
+            customerCoupon.setCm_phone(phone);
+            customerCoupon.setCb_code("PVP2018051211608");
+            customerCoupon.setCc_code(cp_code);
+            customerCoupon.setCp_status(1);
+            customerCoupon.setCc_getdate(sdf.format(new Date()));
+            customerCoupon.setCc_getchannel(channel);
+            customerCouponService.addCustomerCoupon(customerCoupon);
+            couponDao.updateGetCoupon(cp_code);
+            CouponLog couponLog = new CouponLog();
+            couponLog.setCp_code(cp_code);
+            couponLog.setCl_type(1);
+            couponLog.setCl_mp(phone);
+            couponLog.setCl_user(9527);
+            couponLog.setCl_date(sdf.format(new Date()));
+            couponLog.setCb_code("PVP2018051211608");
+            couponLogService.addCouponLog(couponLog);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 99;
+        }
+
+        return 1;
+    }
+
+    public int getRechargeTaskCoupon(String phone, int channel) {//充值任务
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (customerCouponService.checkSumCustomerCoupon(phone) > 500) {
+                return 63;
+            }
+            if (orderTempService.checkOrder(phone) > 0) {
+                return 61;
+            }
+            CustomerCoupon checkCustomer = new CustomerCoupon();
+            checkCustomer.setCm_phone(phone);
+            checkCustomer.setCb_code("PVP2018051263016");
+            if (customerCouponService.checkCustomerCoupon(checkCustomer) > 0) {
+                return 62;
+            }
+            String cp_code = couponDao.getCoupon("PVP2018051263016");
+            if (cp_code.equals(null)) {
+                return 98;
+            }
+            CustomerCoupon customerCoupon = new CustomerCoupon();
+            customerCoupon.setCm_phone(phone);
+            customerCoupon.setCb_code("PVP2018051263016");
+            customerCoupon.setCc_code(cp_code);
+            customerCoupon.setCp_status(1);
+            customerCoupon.setCc_getdate(sdf.format(new Date()));
+            customerCoupon.setCc_getchannel(channel);
+            customerCouponService.addCustomerCoupon(customerCoupon);
+            couponDao.updateGetCoupon(cp_code);
+            CouponLog couponLog = new CouponLog();
+            couponLog.setCp_code(cp_code);
+            couponLog.setCl_type(1);
+            couponLog.setCl_mp(phone);
+            couponLog.setCl_user(9527);
+            couponLog.setCl_date(sdf.format(new Date()));
+            couponLog.setCb_code("PVP2018051263016");
+            couponLogService.addCouponLog(couponLog);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 99;
+        }
+
+        return 1;
+    }
+
 
 }

+ 56 - 0
src/main/java/com/ygj/yuemum/service/customer/CustomerCouponService.java

@@ -0,0 +1,56 @@
+package com.ygj.yuemum.service.customer;
+
+import com.github.pagehelper.PageHelper;
+import com.ygj.yuemum.dao.customer.CustomerCouponDao;
+import com.ygj.yuemum.domain.customer.CustomerCoupon;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class CustomerCouponService {
+
+    @Autowired
+    private CustomerCouponDao customerCouponDao;
+    //分页
+    public Map<String, Object> getCustomerCoupons(int page, int limit) {
+        PageHelper.startPage(page, limit);
+        List<CustomerCoupon> customerCoupons = customerCouponDao.getAll();
+        Map<String, Object> tableData = new HashMap<>();
+        Integer count  = customerCouponDao.getCount();
+        tableData.put("items", customerCoupons);
+        tableData.put("total", count);
+        return tableData;
+    }
+    public List<CustomerCoupon> getAll() {
+        List<CustomerCoupon> customerCoupons = customerCouponDao.getAll();
+        return customerCoupons;
+    }
+    public int addCustomerCoupon(CustomerCoupon customerCoupon) {
+        return customerCouponDao.insertSelective(customerCoupon);
+    }
+
+
+    public int deleteCustomerCoupon(Integer id) {
+        return customerCouponDao.deleteByPrimaryKey(id);
+    }
+
+    public int updateCustomerCoupon(CustomerCoupon customerCoupon) {
+        return customerCouponDao.updateByPrimaryKeySelective(customerCoupon);
+    }
+
+    public CustomerCoupon getCustomerCoupon(Integer id) {
+        return customerCouponDao.selectByPrimaryKey(id);
+    }
+
+    public int checkCustomerCoupon(CustomerCoupon record) {
+        return customerCouponDao.checkCustomerCoupon(record);
+    }
+    public int checkSumCustomerCoupon(String phone) {
+        return customerCouponDao.checkSumCustomerCoupon(phone);
+    }
+
+}

+ 50 - 0
src/main/java/com/ygj/yuemum/service/modoo/ModooLogService.java

@@ -0,0 +1,50 @@
+package com.ygj.yuemum.service.modoo;
+
+import com.github.pagehelper.PageHelper;
+import com.ygj.yuemum.dao.modoo.ModooLogDao;
+import com.ygj.yuemum.domain.modoo.ModooLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ModooLogService {
+
+    @Autowired
+    private ModooLogDao modooLogDao;
+
+    //分页
+    public Map<String, Object> getModooLogs(int page, int limit) {
+        PageHelper.startPage(page, limit);
+        List<ModooLog> modooLogs = modooLogDao.getAll();
+        Map<String, Object> tableData = new HashMap<>();
+        Integer count = modooLogDao.getCount();
+        tableData.put("items", modooLogs);
+        tableData.put("total", count);
+        return tableData;
+    }
+
+    public List<ModooLog> getAll() {
+        List<ModooLog> modooLogs = modooLogDao.getAll();
+        return modooLogs;
+    }
+
+    public int addModooLog(ModooLog modooLog) {
+        return modooLogDao.insertSelective(modooLog);
+    }
+
+
+    public int deleteModooLog(Integer id) {
+        return modooLogDao.deleteByPrimaryKey(id);
+    }
+
+
+    public ModooLog getModooLog(Integer id) {
+        return modooLogDao.selectByPrimaryKey(id);
+    }
+
+
+}

+ 52 - 0
src/main/java/com/ygj/yuemum/service/order/OrderTempService.java

@@ -0,0 +1,52 @@
+package com.ygj.yuemum.service.order;
+
+import com.github.pagehelper.PageHelper;
+import com.ygj.yuemum.dao.order.OrderTempDao;
+import com.ygj.yuemum.domain.order.OrderTemp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class OrderTempService {
+
+    @Autowired
+    private OrderTempDao orderTempDao;
+
+    //分页
+    public Map<String, Object> getOrderTemps(int page, int limit) {
+        PageHelper.startPage(page, limit);
+        List<OrderTemp> orderTemps = orderTempDao.getAll();
+        Map<String, Object> tableData = new HashMap<>();
+        Integer count = orderTempDao.getCount();
+        tableData.put("items", orderTemps);
+        tableData.put("total", count);
+        return tableData;
+    }
+
+    public List<OrderTemp> getAll() {
+        List<OrderTemp> orderTemps = orderTempDao.getAll();
+        return orderTemps;
+    }
+
+    public int addOrderTemp(OrderTemp orderTemp) {
+        return orderTempDao.insertSelective(orderTemp);
+    }
+
+
+    public int deleteOrderTemp(Integer id) {
+        return orderTempDao.deleteByPrimaryKey(id);
+    }
+
+
+    public OrderTemp getOrderTemp(Integer id) {
+        return orderTempDao.selectByPrimaryKey(id);
+    }
+    public int checkOrder(String phone) {
+        return orderTempDao.checkOrder(phone);
+    }
+
+}

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

@@ -2,8 +2,8 @@ server:
   port: 8888
 mybatis:
   config-location: classpath:mybatis/mybatis-config.xml
-  mapper-locations: mybatis/mapper/admin/*.xml,mybatis/mapper/maternitymatron/*.xml,mybatis/mapper/coupon/*.xml,mybatis/mapper/global/*.xml
-  mybatis.type-aliases-package: com.ygj.yuemum.domain/admin,com.ygj.yuemum.domain/maternitymatron,com.ygj.yuemum.domain/coupon,com.ygj.yuemum.domain/global
+  mapper-locations: mybatis/mapper/admin/*.xml,mybatis/mapper/maternitymatron/*.xml,mybatis/mapper/coupon/*.xml,mybatis/mapper/global/*.xml,mybatis/mapper/customer/*.xml,mybatis/mapper/modoo/*.xml,mybatis/mapper/order/*.xml
+  mybatis.type-aliases-package: com.ygj.yuemum.domain/admin,com.ygj.yuemum.domain/maternitymatron,com.ygj.yuemum.domain/coupon,com.ygj.yuemum.domain/global,com.ygj.yuemum.domain/customer,com.ygj.yuemum.domain/modoo,com.ygj.yuemum.domain/order
   log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 spring:
   datasource:

+ 2 - 2
src/main/resources/mybatis/mapper/coupon/CouponLogMapper.xml

@@ -7,7 +7,7 @@
         <result column="cp_code" property="cp_code" jdbcType="VARCHAR" />
         <result column="cb_code" property="cb_code" jdbcType="INTEGER" />
         <result column="cl_type" property="cl_type" jdbcType="INTEGER" />
-        <result column="cl_mp" property="cl_mp" jdbcType="INTEGER" />
+        <result column="cl_mp" property="cl_mp" jdbcType="VARCHAR" />
         <result column="cl_user" property="cl_user" jdbcType="INTEGER" />
         <result column="cl_date" property="cl_date" jdbcType="DATE" />
         <result column="cl_billno" property="cl_billno" jdbcType="DATE" />
@@ -81,7 +81,7 @@
                 #{cl_type,jdbcType=INTEGER},
             </if>
             <if test="cl_mp != null" >
-                #{cl_mp,jdbcType=INTEGER},
+                #{cl_mp,jdbcType=VARCHAR},
             </if>
             <if test="cl_user != null" >
                 #{cl_user,jdbcType=INTEGER},

+ 34 - 0
src/main/resources/mybatis/mapper/coupon/CouponMapper.xml

@@ -106,4 +106,38 @@
             </if>
         </trim>
     </insert>
+    <!--Modoo API-->
+    <select id="getCoupon" resultType="java.lang.String" parameterType="java.lang.String" >
+        select
+        cp_code
+        from coupon
+        where cb_code = #{cb_code,jdbcType=INTEGER}
+        and cp_status = 1
+        and  cp_enddate &gt; now()
+        order by id asc limit 1
+    </select>
+
+    <select id="getCouponAmount" resultType="java.lang.String" parameterType="com.ygj.yuemum.domain.coupon.Coupon" >
+        select
+        cp_code
+        from coupon
+        where
+        1=1
+        <if test="cb_code != null and cb_code != ''">
+            and cb_code = #{cb_code,jdbcType=VARCHAR}
+        </if>
+        <if test="cp_amount != null and cp_amount != ''">
+            and cp_amount = #{cp_amount,jdbcType=INTEGER}
+        </if>
+        and cp_status = 1
+        and  cp_enddate &gt; now()
+        order by id asc limit 1
+    </select>
+
+    <update id="updateGetCoupon" parameterType="java.lang.String" >
+        update coupon
+        set cp_status = 2
+        where cp_code = #{cp_code,jdbcType=INTEGER}
+    </update>
+
 </mapper>

+ 233 - 0
src/main/resources/mybatis/mapper/customer/CustomerCouponMapper.xml

@@ -0,0 +1,233 @@
+<?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.customer.CustomerCouponDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.customer.CustomerCoupon" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="cm_code" property="cm_code" jdbcType="VARCHAR" />
+        <result column="cm_phone" property="cm_phone" jdbcType="VARCHAR" />
+        <result column="cb_code" property="cb_code" jdbcType="VARCHAR" />
+        <result column="cc_code" property="cc_code" jdbcType="VARCHAR" />
+        <result column="cp_status" property="cp_status" jdbcType="INTEGER" />
+        <result column="cc_getdate" property="cc_getdate" jdbcType="DATE" />
+        <result column="cc_getchannel" property="cc_getchannel" jdbcType="INTEGER" />
+        <result column="cc_usedate" property="cc_usedate" jdbcType="DATE" />
+        <result column="cc_usebillno" property="cc_usebillno" jdbcType="VARCHAR" />
+    </resultMap>
+
+    <sql id="Base_Column_List" >
+        id, cm_code,cm_phone,cb_code,cc_code,cp_status,cc_getdate,cc_getchannel,cc_usedate,cc_usebillno
+    </sql>
+
+    <!--获取所有数据-->
+    <select id="getCount" resultType="java.lang.Integer" >
+        select
+        count(1)
+        from customer_coupon
+    </select>
+
+
+    <select id="getAll" resultMap="BaseResultMap" >
+        select
+        id, cm_code,cm_phone,cb_code,cc_code,cp_status,cc_getdate,cc_getchannel,cc_usedate,cc_usebillno
+        from customer_coupon
+        order by id desc
+    </select>
+
+
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+        select
+        <include refid="Base_Column_List" />
+        from customer_coupon
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <select id="checkCustomerCoupon" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.customer.CustomerCoupon" >
+        SELECT
+        count(1)
+        FROM
+        customer_coupon
+        WHERE
+        1=1
+        <if test="_parameter != null" >
+            and cm_phone = #{cm_phone,jdbcType=VARCHAR}
+        </if>
+        <if test="cb_code != null" >
+            and cb_code = #{cb_code,jdbcType=VARCHAR}
+        </if>
+    </select>
+
+    <select id="checkSumCustomerCoupon" resultType="java.lang.Integer" parameterType="java.lang.String" >
+        SELECT
+        ifnull(sum(tb.cp_amount), 0)
+        FROM
+        customer_coupon ta,
+        coupon tb
+        WHERE
+        ta.cc_code = tb.cp_code
+        <if test="_parameter != null" >
+            and cm_phone = #{cm_phone,jdbcType=VARCHAR}
+        </if>
+        AND ta.cp_status = 1
+        AND tb.cc_code IN (
+        'PVP2018051297451',
+        'PVP2018051273883',
+        'PVP2018051211608',
+        'PVP2018051263016'
+        )
+
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+        delete from customer_coupon
+        where cb_code = #{cb_code,jdbcType=VARCHAR}
+    </delete>
+
+    <!-- 插入一条培训信息 -->
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.customer.CustomerCoupon" >
+        insert into customer_coupon
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="cm_code != null" >
+                cm_code,
+            </if>
+            <if test="cm_phone != null" >
+                cm_phone,
+            </if>
+            <if test="cb_code != null" >
+                cb_code,
+            </if>
+            <if test="cc_code != null" >
+                cc_code,
+            </if>
+            <if test="cp_status != null" >
+                cp_status,
+            </if>
+            <if test="cc_getdate != null" >
+                cc_getdate,
+            </if>
+            <if test="cc_getchannel != null" >
+                cc_getchannel,
+            </if>
+            <if test="cc_usedate != null" >
+                cc_usedate,
+            </if>
+            <if test="cc_usebillno != null" >
+                cc_usebillno
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="cm_code != null" >
+                #{cm_code,jdbcType=VARCHAR},
+            </if>
+            <if test="cm_phone != null" >
+                #{cm_phone,jdbcType=VARCHAR},
+            </if>
+            <if test="cb_code != null" >
+                #{cb_code,jdbcType=VARCHAR},
+            </if>
+            <if test="cc_code != null" >
+                #{cc_code,jdbcType=VARCHAR},
+            </if>
+            <if test="cp_status != null" >
+                #{cp_status,jdbcType=INTEGER},
+            </if>
+            <if test="cc_getdate != null" >
+                #{cc_getdate,jdbcType=DATE},
+            </if>
+            <if test="cc_getchannel != null" >
+                #{cc_getchannel,jdbcType=INTEGER},
+            </if>
+            <if test="cc_usedate != null" >
+                #{cc_usedate,jdbcType=DATE},
+            </if>
+            <if test="cc_usebillno != null" >
+                #{cc_usebillno,jdbcType=VARCHAR}
+            </if>
+        </trim>
+    </insert>
+
+    <!-- 根据id更新一条培训信息 -->
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.customer.CustomerCoupon" >
+        update customer_coupon
+        <set >
+            <if test="cm_code != null" >
+                cm_code = #{cm_code,jdbcType=VARCHAR},
+            </if>
+            <if test="cm_phone != null" >
+                cm_phone = #{cm_phone,jdbcType=VARCHAR},
+            </if>
+            <if test="cb_rule != null" >
+                cb_rule = #{cb_rule,jdbcType=VARCHAR},
+            </if>
+            <if test="cb_packages != null" >
+                cb_packages = #{cb_packages,jdbcType=VARCHAR},
+            </if>
+            <if test="cb_citys != null" >
+                cb_citys = #{cb_citys,jdbcType=VARCHAR}
+            </if>
+            <if test="cb_citys != null" >
+                cb_citys = #{cb_citys,jdbcType=VARCHAR}
+            </if>
+            <if test="cb_citys != null" >
+                cb_citys = #{cb_citys,jdbcType=VARCHAR}
+            </if>
+            <if test="cb_citys != null" >
+                cb_citys = #{cb_citys,jdbcType=VARCHAR}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+    <select id="getQCouponBatchconut" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.customer.CustomerCoupon">
+        select
+        count(1)
+        from customer_coupon
+        where 1=1
+        <if test="id != null and id != ''">
+            and id = #{id,jdbcType=INTEGER}
+        </if>
+        <if test="cb_code != null and cb_code != ''">
+            and cb_code = #{cb_code,jdbcType=INTEGER}
+        </if>
+        <if test="cb_name != null and cb_name != ''">
+            and cb_name like "%"#{cb_name,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_rule != null and cb_rule != ''">
+            and cb_rule like "%"#{cb_rule,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_packages != null and cb_packages != ''">
+            and cb_packages like "%"#{cb_packages,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_citys != null and cb_citys != ''">
+            and cb_citys like "%"#{cb_citys,jdbcType=VARCHAR}"%"
+        </if>
+    </select>
+
+    <select id="getQCouponBatch" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.customer.CustomerCoupon">
+        select
+        id, cb_code,cb_name,cb_rule,fgetpackages(id) cb_packages,fgetmoretcityname(id) cb_citys
+        from customer_coupon
+        where 1=1
+        <if test="id != null and id != ''">
+            and id = #{id,jdbcType=INTEGER}
+        </if>
+        <if test="cb_code != null and cb_code != ''">
+            and cb_code = #{cb_code,jdbcType=INTEGER}
+        </if>
+        <if test="cb_name != null and cb_name != ''">
+            and cb_name like "%"#{cb_name,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_rule != null and cb_rule != ''">
+            and cb_rule like "%"#{cb_rule,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_packages != null and cb_packages != ''">
+            and cb_packages like "%"#{cb_packages,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="cb_citys != null and cb_citys != ''">
+            and cb_citys like "%"#{cb_citys,jdbcType=VARCHAR}"%"
+        </if>
+
+    </select>
+
+
+</mapper>

+ 78 - 0
src/main/resources/mybatis/mapper/modoo/ModooLogMapper.xml

@@ -0,0 +1,78 @@
+<?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.modoo.ModooLogDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.modoo.ModooLog" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="ml_usermp" property="ml_usermp" jdbcType="VARCHAR" />
+        <result column="ml_testtime" property="ml_testtime" jdbcType="DATE" />
+        <result column="ml_testduration" property="ml_testduration" jdbcType="INTEGER" />
+        <result column="ml_datetime" property="ml_datetime" jdbcType="DATE" />
+    </resultMap>
+
+    <sql id="Base_Column_List" >
+        id,ml_usermp, ml_testtime,ml_testduration,ml_datetime
+    </sql>
+
+    <!--获取所有数据-->
+    <select id="getCount" resultType="java.lang.Integer" >
+        select
+        count(1)
+        from modoo_log
+    </select>
+
+
+    <select id="getAll" resultMap="BaseResultMap" >
+        select
+        id,ml_usermp, ml_testtime,ml_testduration,ml_datetime
+        from modoo_log
+        order by id desc
+    </select>
+
+
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+        select
+        <include refid="Base_Column_List" />
+        from modoo_log
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+        delete from modoo_log
+        where cb_code = #{cb_code,jdbcType=VARCHAR}
+    </delete>
+
+    <!-- 插入一条培训信息 -->
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.modoo.ModooLog" >
+        insert into modoo_log
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="ml_usermp != null" >
+                ml_usermp,
+            </if>
+            <if test="ml_testtime != null" >
+                ml_testtime,
+            </if>
+            <if test="ml_testduration != null" >
+                ml_testduration,
+            </if>
+            <if test="ml_datetime != null" >
+                ml_datetime
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="ml_usermp != null" >
+                #{ml_usermp,jdbcType=VARCHAR},
+            </if>
+            <if test="ml_testtime != null" >
+                #{ml_testtime,jdbcType=DATE},
+            </if>
+            <if test="ml_testduration != null" >
+                #{ml_testduration,jdbcType=INTEGER},
+            </if>
+            <if test="ml_datetime != null" >
+                #{ml_datetime,jdbcType=DATE}
+            </if>
+        </trim>
+    </insert>
+
+</mapper>

+ 99 - 0
src/main/resources/mybatis/mapper/order/OrderTemp.xml

@@ -0,0 +1,99 @@
+<?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.order.OrderTempDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.order.OrderTemp" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="ot_code" property="ot_code" jdbcType="VARCHAR" />
+        <result column="cm_phone" property="cm_phone" jdbcType="VARCHAR" />
+        <result column="ot_startdate" property="ot_startdate" jdbcType="DATE" />
+        <result column="ot_enddate" property="ot_enddate" jdbcType="DATE" />
+        <result column="jl_mmid" property="jl_mmid" jdbcType="INTEGER" />
+    </resultMap>
+
+    <sql id="Base_Column_List" >
+        id,ot_code, cm_phone,ot_startdate,ot_enddate,jl_mmid
+    </sql>
+
+    <!--获取所有数据-->
+    <select id="getCount" resultType="java.lang.Integer" >
+        select
+        count(1)
+        from order_temp
+    </select>
+
+    <select id="checkOrder" resultType="java.lang.Integer" parameterType="java.lang.String">
+        SELECT
+        count(1)
+        FROM
+        order_temp
+        WHERE
+        1=1
+        <if test="_parameter != null" >
+            and cm_phone = #{cm_phone,jdbcType=VARCHAR}
+        </if>
+        AND DATE_FORMAT(now(), '%Y-%m-%d') &gt;= ot_startdate
+        AND DATE_FORMAT(now(), '%Y-%m-%d') &lt;= ot_enddate
+    </select>
+
+
+    <select id="getAll" resultMap="BaseResultMap" >
+        select
+        id,ot_code, cm_phone,ot_startdate,ot_enddate,jl_mmid
+        from order_temp
+        order by id desc
+    </select>
+
+
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+        select
+        <include refid="Base_Column_List" />
+        from order_temp
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+        delete from modoo_log
+        where cb_code = #{cb_code,jdbcType=VARCHAR}
+    </delete>
+
+    <!-- 插入一条培训信息 -->
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.order.OrderTemp" >
+        insert into order_temp
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="ot_code != null" >
+                ot_code,
+            </if>
+            <if test="cm_phone != null" >
+                cm_phone,
+            </if>
+            <if test="ot_startdate != null" >
+                ot_startdate,
+            </if>
+            <if test="ot_enddate != null" >
+                ot_enddate,
+            </if>
+            <if test="jl_mmid != null" >
+                jl_mmid
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="ot_code != null" >
+                #{ot_code,jdbcType=VARCHAR},
+            </if>
+            <if test="cm_phone != null" >
+                #{cm_phone,jdbcType=VARCHAR},
+            </if>
+            <if test="ot_startdate != null" >
+                #{ot_startdate,jdbcType=DATE},
+            </if>
+            <if test="ot_enddate != null" >
+                #{ot_enddate,jdbcType=DATE},
+            </if>
+            <if test="jl_mmid != null" >
+                #{jl_mmid,jdbcType=VARCHAR}
+            </if>
+        </trim>
+    </insert>
+
+</mapper>