Browse Source

悦所订单支付开发

huan.wang@yueguanjia.com 5 years ago
parent
commit
1e3ec40893
25 changed files with 572 additions and 90 deletions
  1. 15 0
      pom.xml
  2. 6 0
      src/main/java/com/ygj/yuemum/component/Constant.java
  3. 10 9
      src/main/java/com/ygj/yuemum/controller/equipment/EquipmenteHireHeadController.java
  4. 6 0
      src/main/java/com/ygj/yuemum/controller/global/PackagesController.java
  5. 53 0
      src/main/java/com/ygj/yuemum/controller/pay/CreatePayQrCodeController.java
  6. 44 0
      src/main/java/com/ygj/yuemum/controller/pay/CustomerPayController.java
  7. 27 0
      src/main/java/com/ygj/yuemum/controller/pay/CustomerPayVoucherController.java
  8. 1 0
      src/main/java/com/ygj/yuemum/dao/global/PackagesDao.java
  9. 2 0
      src/main/java/com/ygj/yuemum/dao/pay/CustomerPayDao.java
  10. 1 0
      src/main/java/com/ygj/yuemum/dao/pay/CustomerPayVoucherDao.java
  11. 9 0
      src/main/java/com/ygj/yuemum/domain/global/Packages.java
  12. 27 0
      src/main/java/com/ygj/yuemum/domain/pay/CustomerPay.java
  13. 18 0
      src/main/java/com/ygj/yuemum/domain/pay/CustomerPayVoucher.java
  14. 18 0
      src/main/java/com/ygj/yuemum/domain/pay/PayMents.java
  15. 3 0
      src/main/java/com/ygj/yuemum/service/global/PackagesService.java
  16. 3 3
      src/main/java/com/ygj/yuemum/service/order/YSOrderService.java
  17. 73 19
      src/main/java/com/ygj/yuemum/service/pay/CustomerPayService.java
  18. 4 0
      src/main/java/com/ygj/yuemum/service/pay/CustomerPayVoucherService.java
  19. 2 0
      src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java
  20. 108 0
      src/main/java/com/ygj/yuemum/utils/QrCodeUtils.java
  21. 47 46
      src/main/resources/application.yml
  22. 9 2
      src/main/resources/mybatis/mapper/global/PackagesMapper.xml
  23. 55 5
      src/main/resources/mybatis/mapper/pay/CustomerPayMapper.xml
  24. 27 4
      src/main/resources/mybatis/mapper/pay/CustomerPayVoucherMapper.xml
  25. 4 2
      src/main/resources/mybatis/mapper/pay/PayMentsMapper.xml

+ 15 - 0
pom.xml

@@ -228,6 +228,21 @@
             <version>0.9.0</version>
         </dependency>
 
+
+        <!--引入生成二维码的依赖-->
+        <!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+
         <!--热部署-->
         <dependency>
             <groupId>org.springframework.boot</groupId>

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

@@ -64,6 +64,7 @@ public class Constant {
     public static Integer LMP;
     public static Integer AGE;
     public static Integer MAXSCHOLARSHIPS;
+    public static String CREATEQRURL;
 
     //注入
     @Autowired(required = false)
@@ -304,4 +305,9 @@ public class Constant {
     public void getMAXSCHOLARSHIPS(@Value("${college.MAXSCHOLARSHIPS}") Integer MAXSCHOLARSHIPS) {
         Constant.MAXSCHOLARSHIPS = MAXSCHOLARSHIPS;
     }
+
+    @Autowired(required = false)
+    public void getCREATEQRURL(@Value("${api.CREATEQRURL}") String CREATEQRURL) {
+        Constant.CREATEQRURL = CREATEQRURL;
+    }
 }

+ 10 - 9
src/main/java/com/ygj/yuemum/controller/equipment/EquipmenteHireHeadController.java

@@ -3,12 +3,14 @@ package com.ygj.yuemum.controller.equipment;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ygj.yuemum.domain.equipment.EquipmenteHireHead;
+import com.ygj.yuemum.domain.pay.CustomerPay;
 import com.ygj.yuemum.service.equipment.EquipmenteHireHeadService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Map;
+
 @Api(tags = "设备租赁顾客相关接口")
 @RestController
 public class EquipmenteHireHeadController {
@@ -72,13 +74,12 @@ public class EquipmenteHireHeadController {
         return equipmenteHireHeadService.equipmentSettle(equipmenteHireHead);
     }
 
-    @RequestMapping(value = "/WxPayReturn", method = RequestMethod.POST, produces="application/json;charset=UTF-8")
-    @ResponseBody
-    public int WxPayReturn(@RequestBody Map<String,String> params) {
-        EquipmenteHireHead equipmenteHireHead = new EquipmenteHireHead();
-        equipmenteHireHead.setEh_code(params.get("eh_code"));
-        equipmenteHireHead.setEh_status(2);
-        return equipmenteHireHeadService.updateEqorderStatus(equipmenteHireHead);
-    }
-
+    //    @RequestMapping(value = "/WxPayReturn", method = RequestMethod.POST, produces="application/json;charset=UTF-8")
+//    @ResponseBody
+//    public int WxPayReturn(@RequestBody Map<String,String> params) {
+//        EquipmenteHireHead equipmenteHireHead = new EquipmenteHireHead();
+//        equipmenteHireHead.setEh_code(params.get("eh_code"));
+//        equipmenteHireHead.setEh_status(2);
+//        return equipmenteHireHeadService.updateEqorderStatus(equipmenteHireHead);
+//    }
 }

+ 6 - 0
src/main/java/com/ygj/yuemum/controller/global/PackagesController.java

@@ -3,6 +3,7 @@ package com.ygj.yuemum.controller.global;
 
 import com.ygj.yuemum.domain.global.Packages;
 import com.ygj.yuemum.service.global.PackagesService;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -42,6 +43,11 @@ public class PackagesController {
         Packages packager = packagesService.getPackageDetail(p_code);
         return packager;
     }
+    @GetMapping("/getRatioById")
+    public Packages getRatioById(@RequestParam("id") Integer id) {
+        Packages packager = packagesService.getRatioById(id);
+        return packager;
+    }
 
 
 }

+ 53 - 0
src/main/java/com/ygj/yuemum/controller/pay/CreatePayQrCodeController.java

@@ -0,0 +1,53 @@
+package com.ygj.yuemum.controller.pay;
+
+
+import com.ygj.yuemum.component.Constant;
+import com.ygj.yuemum.service.pay.CustomerPayService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import sun.misc.BASE64Encoder;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+@Api(tags = "支付订单相关接口")
+@RestController
+public class CreatePayQrCodeController {
+    public static final String RESUMEFILE = Constant.RESUMEFILE;
+    @Autowired
+    private CustomerPayService customerPayService;
+
+    @RequestMapping(value = "/createPayQrCode", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
+    @ResponseBody
+    public String createPayQrCode(@RequestBody Map<String,String> params) throws Exception {
+        String orderNo = params.get("orderNo");
+        String channel= params.get("channel");
+        float price= Float.parseFloat(params.get("price"));
+        float originPrice= Float.parseFloat(params.get("originPrice"));
+        String title= params.get("title");
+        String productName= params.get("productName");
+        Integer productId= Integer.parseInt(params.get("productId"));
+        String payment_steps = params.get("payment_steps");
+        String out_trade_no = orderNo + "SEQ" + payment_steps;
+        BufferedImage bufferedImage =  customerPayService.createPayQrCode(out_trade_no,channel,price,originPrice,title,productName,productId);
+        //保存一下
+//        ByteArrayOutputStream os = new ByteArrayOutputStream();
+//        ImageIO.write(bufferedImage, "jpg", os);
+//        FileUtils.writeByteArrayToFile(new File(RESUMEFILE+"666.jpg"), os.toByteArray());
+//        os.close();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ImageIO.write(bufferedImage, "png", baos);
+        byte[] bytes = baos.toByteArray();//转换成字节
+        BASE64Encoder encoder = new BASE64Encoder();
+        String png_base64 = encoder.encodeBuffer(bytes).trim();//转换成base64串
+        png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");
+        System.out.println(png_base64);
+        Map<String, Object> tableData = new HashMap<>();
+        tableData.put("img",png_base64);
+        return png_base64;
+    }
+}

+ 44 - 0
src/main/java/com/ygj/yuemum/controller/pay/CustomerPayController.java

@@ -1,13 +1,24 @@
 package com.ygj.yuemum.controller.pay;
 
 
+import com.google.zxing.WriterException;
 import com.ygj.yuemum.domain.pay.CustomerPay;
 import com.ygj.yuemum.service.pay.CustomerPayService;
 import io.swagger.annotations.Api;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.swing.plaf.IconUIResource;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
+
 @Api(tags = "支付订单相关接口")
 @RestController
 public class CustomerPayController {
@@ -20,6 +31,13 @@ public class CustomerPayController {
         List<CustomerPay> customerPays = customerPayService.selectCustomerPay(cp_orderno);
         return customerPays;
     }
+
+    @GetMapping("/queryCustomerPayAndVoucher")
+    public List<CustomerPay> queryCustomerPayAndVoucher(@RequestParam("cp_orderno") String cp_orderno) {
+        return  customerPayService.queryCustomerPayAndVoucher(cp_orderno);
+    }
+
+
     @PostMapping("/queryYSOrderPay")
     public CustomerPay queryYSOrderPay(@ModelAttribute CustomerPay customerPay){
         return customerPayService.queryYSOrderPay(customerPay);
@@ -38,4 +56,30 @@ public class CustomerPayController {
     public int checkCustomerPay(@ModelAttribute CustomerPay customerPay) {
         return  customerPayService.checkCustomerPay(customerPay);
     }
+
+    @RequestMapping(value = "/WxPayReturn", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
+    @ResponseBody
+    public int WxPayReturn(@RequestBody Map<String, String> params) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        CustomerPay customerPay = new CustomerPay();
+        String orderNo[] = params.get("orderNo").split("SEQ");
+        customerPay.setCp_orderno(orderNo[0]);
+        customerPay.setCp_date(simpleDateFormat.format(new Date()));
+        customerPay.setCp_orderstatus(2);
+        customerPay.setCp_ordertype(2);
+        customerPay.setOut_trade_no(params.get("orderNo"));
+        if (params.get("channel").equals("wx_pub_qr")) {
+            customerPay.setCp_paytype("2");
+        } else if (params.get("channel").equals("wx_pub_qr")) {
+            customerPay.setCp_paytype("1");
+        } else {
+            return 0;
+        }
+        customerPay.setPayment_steps(Integer.parseInt(orderNo[1]));
+        customerPay.setCp_payamount(Double.parseDouble(params.get("price")));
+        return  customerPayService.insertCustomerPay(customerPay);
+    }
+
+
+
 }

+ 27 - 0
src/main/java/com/ygj/yuemum/controller/pay/CustomerPayVoucherController.java

@@ -0,0 +1,27 @@
+package com.ygj.yuemum.controller.pay;
+
+
+import com.ygj.yuemum.domain.pay.CustomerPayVoucher;
+import com.ygj.yuemum.domain.pay.DiscountChannel;
+import com.ygj.yuemum.service.pay.CustomerPayVoucherService;
+import com.ygj.yuemum.service.pay.DiscountChannelService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api(tags = "支付渠道相关接口")
+@RestController
+public class CustomerPayVoucherController {
+
+    @Autowired
+    private CustomerPayVoucherService customerPayVoucherService;
+    @GetMapping("/queryVoucherByTradeNo")
+    public CustomerPayVoucher queryVoucherByTradeNo(@RequestParam("out_trade_no") String out_trade_no) {
+        return customerPayVoucherService.queryVoucherByTradeNo(out_trade_no);
+    }
+
+}

+ 1 - 0
src/main/java/com/ygj/yuemum/dao/global/PackagesDao.java

@@ -17,4 +17,5 @@ public interface PackagesDao {
     String getPackageCRMCode(String p_code);
     Packages getBizID(String p_code);
     List<Packages> getPackageListsDefault(String p_branches);
+    Packages getRatioById(Integer id);
 }

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/pay/CustomerPayDao.java

@@ -11,5 +11,7 @@ public interface CustomerPayDao {
     List<CustomerPay> selectCustomerPay(String cp_orderno);
     int insertCustomerPay(CustomerPay customerPay);
     CustomerPay queryYSOrderPay(CustomerPay customerPay);
+    List<CustomerPay> queryCustomerPayAndVoucher(String cp_orderno);
     int checkCustomerPay (CustomerPay customerPay);
+    int queryPaySumByOrderNo(String cp_orderno);
 }

+ 1 - 0
src/main/java/com/ygj/yuemum/dao/pay/CustomerPayVoucherDao.java

@@ -14,4 +14,5 @@ public interface CustomerPayVoucherDao {
     int deleteCustomerPayVoucher(String cv_filename);
     int deleteCustomerPayVoucherAll(String eh_code);
     int deleteOrderPayPhoto(CustomerPayVoucher customerPayVoucher);
+    CustomerPayVoucher queryVoucherByTradeNo(String out_trade_no);
 }

+ 9 - 0
src/main/java/com/ygj/yuemum/domain/global/Packages.java

@@ -17,6 +17,15 @@ public class Packages {
     private String p_detaildesc;
     private String p_biz_id;
     private String p_branches;
+    private String payment_steps;
+
+    public String getPayment_steps() {
+        return payment_steps;
+    }
+
+    public void setPayment_steps(String payment_steps) {
+        this.payment_steps = payment_steps;
+    }
 
     public String getP_branches() {
         return p_branches;

+ 27 - 0
src/main/java/com/ygj/yuemum/domain/pay/CustomerPay.java

@@ -15,9 +15,36 @@ public class CustomerPay {
     private String cp_username;
     private String cp_date;
     private String od_biz_user;
+    private Integer payment_steps;
+    private String out_trade_no;
+    private String cv_filepath;
     private Integer page;
     private Integer limit;
 
+    public String getCv_filepath() {
+        return cv_filepath;
+    }
+
+    public void setCv_filepath(String cv_filepath) {
+        this.cv_filepath = cv_filepath;
+    }
+
+    public Integer getPayment_steps() {
+        return payment_steps;
+    }
+
+    public void setPayment_steps(Integer payment_steps) {
+        this.payment_steps = payment_steps;
+    }
+
+    public String getOut_trade_no() {
+        return out_trade_no;
+    }
+
+    public void setOut_trade_no(String out_trade_no) {
+        this.out_trade_no = out_trade_no;
+    }
+
     public String getOd_biz_user() {
         return od_biz_user;
     }

+ 18 - 0
src/main/java/com/ygj/yuemum/domain/pay/CustomerPayVoucher.java

@@ -7,6 +7,24 @@ public class CustomerPayVoucher {
     private Integer cv_orderstaus;
     private String cv_filename;
     private String cv_filepath;
+    private Integer payment_steps;
+    private String out_trade_no;
+
+    public Integer getPayment_steps() {
+        return payment_steps;
+    }
+
+    public void setPayment_steps(Integer payment_steps) {
+        this.payment_steps = payment_steps;
+    }
+
+    public String getOut_trade_no() {
+        return out_trade_no;
+    }
+
+    public void setOut_trade_no(String out_trade_no) {
+        this.out_trade_no = out_trade_no;
+    }
 
     public Integer getCv_orderstaus() {
         return cv_orderstaus;

+ 18 - 0
src/main/java/com/ygj/yuemum/domain/pay/PayMents.java

@@ -9,6 +9,24 @@ public class PayMents {
     private String pm_config;
     private Integer pm_enable;
     private Integer pm_isonline;
+    private Integer is_voucher;
+    private String qr_channel;
+
+    public String getQr_channel() {
+        return qr_channel;
+    }
+
+    public void setQr_channel(String qr_channel) {
+        this.qr_channel = qr_channel;
+    }
+
+    public Integer getIs_voucher() {
+        return is_voucher;
+    }
+
+    public void setIs_voucher(Integer is_voucher) {
+        this.is_voucher = is_voucher;
+    }
 
     public Integer getId() {
         return id;

+ 3 - 0
src/main/java/com/ygj/yuemum/service/global/PackagesService.java

@@ -43,5 +43,8 @@ public class PackagesService {
     public Packages getBizID(String p_code){
         return packagesDao.getBizID(p_code);
     }
+    public Packages getRatioById(Integer id){
+        return packagesDao.getRatioById(id);
+    }
 
 }

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

@@ -296,8 +296,8 @@ public class YSOrderService {
                 ysOrderServiceLog.setOd_userid(ysOrder.getOd_user());
                 ysOrderServiceLogService.insertYSOrderServiceLog(ysOrderServiceLog);
 //                氚云调用
-                ysOrder.setOd_biz_user(cp_objectId);
-                bizObjectApiService.createObject(ysOrder,payName);
+//                ysOrder.setOd_biz_user(cp_objectId);
+//                bizObjectApiService.createObject(ysOrder,payName);
             } else {
                 //支付尾款时第三次调用CRM接口
                 ysOrder.setOd_balancepay(ysOrder.getOd_order_pay_amount());
@@ -371,7 +371,7 @@ public class YSOrderService {
             ysOrder.setOd_status(od_stauts);
             YSOrderDao.updateYsOrderStatus(ysOrder);
             //氚云调用
-            bizObjectApiService.createSecondPay(ysOrder,payName);
+//            bizObjectApiService.createSecondPay(ysOrder,payName);
         } catch (Exception ex) {
             ex.printStackTrace();
             return 0;

+ 73 - 19
src/main/java/com/ygj/yuemum/service/pay/CustomerPayService.java

@@ -1,27 +1,40 @@
 package com.ygj.yuemum.service.pay;
 
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.component.Constant;
 import com.ygj.yuemum.dao.equipment.EquipmenteHireDetailDao;
 import com.ygj.yuemum.dao.equipment.EquipmenteHireHeadDao;
 import com.ygj.yuemum.dao.pay.CustomerPayDao;
 import com.ygj.yuemum.domain.equipment.EquipmentLog;
 import com.ygj.yuemum.domain.equipment.EquipmenteHireDetail;
 import com.ygj.yuemum.domain.equipment.EquipmenteHireHead;
+import com.ygj.yuemum.domain.order.YSOrder;
 import com.ygj.yuemum.domain.pay.CustomerPay;
 import com.ygj.yuemum.service.equipment.EquipmentInfoService;
 import com.ygj.yuemum.service.equipment.EquipmentLogService;
 import com.ygj.yuemum.service.order.YSOrderService;
+import com.ygj.yuemum.utils.QrCodeUtils;
+import org.apache.http.HttpEntity;
+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.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
 @Service
 public class CustomerPayService {
+    public String CREATEQRURL = Constant.CREATEQRURL;
 
     @Autowired
-
     private CustomerPayDao customerPayDao;
     @Autowired
     private EquipmentInfoService equipmentInfoService;
@@ -39,14 +52,21 @@ public class CustomerPayService {
     public List<CustomerPay> selectCustomerPay(String cp_orderno) {
         return customerPayDao.selectCustomerPay(cp_orderno);
     }
-    public CustomerPay queryYSOrderPay (CustomerPay customerPay){
+
+    public List<CustomerPay> queryCustomerPayAndVoucher(String cp_orderno) {
+        return customerPayDao.queryCustomerPayAndVoucher(cp_orderno);
+    }
+
+    public CustomerPay queryYSOrderPay(CustomerPay customerPay) {
         return customerPayDao.queryYSOrderPay(customerPay);
     }
-    public int checkCustomerPay (CustomerPay customerPay) {
+
+    public int checkCustomerPay(CustomerPay customerPay) {
         return customerPayDao.checkCustomerPay(customerPay);
     }
+
     public int insertCustomerPay(CustomerPay customerPay) {
-        try{
+        try {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             customerPayDao.insertCustomerPay(customerPay);
             EquipmenteHireHead equipmenteHireHead = new EquipmenteHireHead();
@@ -65,7 +85,7 @@ public class CustomerPayService {
                 equipmentLogService.insertEquipmentLog(equipmentLog);
             }
 
-        }catch (Exception ex){
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }
@@ -73,9 +93,9 @@ public class CustomerPayService {
     }
 
     public int insertCustomerPayOnLine(CustomerPay customerPay) {
-        try{
+        try {
             customerPayDao.insertCustomerPay(customerPay);
-        }catch (Exception ex){
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }
@@ -83,22 +103,56 @@ public class CustomerPayService {
     }
 
     public int insertYsOrderPay(CustomerPay customerPay) {
-        try{
-            //验证是否已经付款
-            int payCount = customerPayDao.checkCustomerPay(customerPay);
-            if (payCount <= 0) {
-                customerPayDao.insertCustomerPay(customerPay);
-                //找到支付名称 保存氚云
-                String payName = payMentsService.getPayName(customerPay.getCp_paytype());
-                //锁定月嫂库存,增加介绍人返现金额,增加介绍人日志记录,变成介绍人(参加免单季),修改订单待付金额,传值CRM
-                ysOrderService.updateYsOrderStatus(customerPay.getCp_orderno(),customerPay.getCp_orderstatus(),customerPay.getCp_payamount(),customerPay.getOd_biz_user(),payName);
-            } else {
-                return 9;
+        try {
+            int paySum = customerPayDao.queryPaySumByOrderNo(customerPay.getCp_orderno());
+            YSOrder ysOrder = ysOrderService.selectByOdNo(customerPay.getCp_orderno());
+            if (ysOrder.getOd_order_pay_amount() == paySum + customerPay.getCp_payamount()) {
+                customerPay.setCp_orderstatus(3);
             }
-         }catch (Exception ex){
+            customerPayDao.insertCustomerPay(customerPay);
+            //找到支付名称 保存氚云
+            String payName = payMentsService.getPayName(customerPay.getCp_paytype());
+            //锁定月嫂库存,增加介绍人返现金额,增加介绍人日志记录,变成介绍人(参加免单季),修改订单待付金额,传值CRM
+            ysOrderService.updateYsOrderStatus(customerPay.getCp_orderno(), customerPay.getCp_orderstatus(), customerPay.getCp_payamount(), customerPay.getOd_biz_user(), payName);
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }
         return 1;
     }
+
+    public BufferedImage createPayQrCode(String orderNo, String channel, Float price, Float originPrice, String title, String productName, Integer productId) throws Exception {
+        //调用支付接口
+        QrCodeUtils qrCodeUtils = new QrCodeUtils();
+        String url = null;
+        HttpPost httpPost = new HttpPost(CREATEQRURL);
+        CloseableHttpClient client = HttpClients.createDefault();
+        String respContent = null;
+        JSONObject jsonParam = new JSONObject();
+        jsonParam.put("orderNo", orderNo);
+        jsonParam.put("channel", channel);
+        jsonParam.put("price", price);
+        jsonParam.put("originPrice", originPrice);
+        jsonParam.put("title", title);
+        jsonParam.put("productName", productName);
+        jsonParam.put("productId", productId);
+        StringEntity entity = new StringEntity(jsonParam.toString(), "utf-8");//解决中文乱码问题
+        entity.setContentEncoding("UTF-8");
+        entity.setContentType("application/json");
+        httpPost.setEntity(entity);
+        HttpResponse resp = client.execute(httpPost);
+        HttpEntity he = resp.getEntity();
+        respContent = EntityUtils.toString(he, "UTF-8");
+        org.json.JSONObject jsonObject = new org.json.JSONObject(respContent);
+        if (channel.equals("alipay_qr")) {
+            url = jsonObject.getString("body");
+        } else if (channel.equals("wx_pub_qr")) {
+            url = jsonObject.getJSONObject("body").getString("codeUrl");
+        } else {
+            return null;
+        }
+        //生成二维码
+
+        return qrCodeUtils.encodeIO(url, true);
+    }
 }

+ 4 - 0
src/main/java/com/ygj/yuemum/service/pay/CustomerPayVoucherService.java

@@ -18,6 +18,10 @@ public class CustomerPayVoucherService {
         return customerPayVoucherDao.selectCustomerPayVoucher(eh_code);
     }
 
+    public CustomerPayVoucher queryVoucherByTradeNo(String out_trade_no){
+        return customerPayVoucherDao.queryVoucherByTradeNo(out_trade_no);
+    }
+
     public List<CustomerPayVoucher> queryOrderPayPhoto(CustomerPayVoucher customerPayVoucher) {
         return customerPayVoucherDao.queryOrderPayPhoto(customerPayVoucher);
     }

+ 2 - 0
src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java

@@ -134,6 +134,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/queryUserMMSearch", "anon");
         filterChainDefinitionMap.put("/getMmInfoResume", "anon");
         filterChainDefinitionMap.put("/getPackageImagesByID", "anon");
+        filterChainDefinitionMap.put("/selectCustomerPay", "anon");
+        filterChainDefinitionMap.put("/createPayQrCode", "anon");
         //萌动开放权限
         filterChainDefinitionMap.put("/getNewUserCoupon", "anon");
         filterChainDefinitionMap.put("/getConsultTaskCoupon", "anon");

+ 108 - 0
src/main/java/com/ygj/yuemum/utils/QrCodeUtils.java

@@ -0,0 +1,108 @@
+package com.ygj.yuemum.utils;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import com.ygj.yuemum.component.Constant;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.util.Hashtable;
+
+/**
+ * 二维码生成工具类
+ */
+public class QrCodeUtils {
+    private static final String CHARSET = "utf-8";
+    private static final String FORMAT_NAME = "JPG";
+    public static final String RESUMEFILE = Constant.RESUMEFILE;
+    // 二维码尺寸
+    private static final int QRCODE_SIZE = 300;
+    // LOGO宽度
+    private static final int WIDTH = 60;
+    // LOGO高度
+    private static final int HEIGHT = 60;
+
+    private static BufferedImage createImage(String content, String imgPath,
+                                             boolean needCompress) throws Exception {
+        Hashtable hints = new Hashtable();
+        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+        hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
+        hints.put(EncodeHintType.MARGIN, 1);
+        BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
+                BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
+        int width = bitMatrix.getWidth();
+        int height = bitMatrix.getHeight();
+        BufferedImage image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_RGB);
+        for (int x = 0; x < width; x++) {
+            for (int y = 0; y < height; y++) {
+                image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000
+                        : 0xFFFFFFFF);
+            }
+        }
+        if (imgPath == null || "".equals(imgPath)) {
+            return image;
+        }
+        // 插入图片
+        QrCodeUtils.insertImage(image, imgPath, needCompress);
+        return image;
+    }
+
+
+    private static void insertImage(BufferedImage source, String imgPath,
+                                    boolean needCompress) throws Exception {
+        File file = new File(imgPath);
+        if (!file.exists()) {
+            System.err.println(""+imgPath+"   该文件不存在!");
+            return;
+        }
+        Image src = ImageIO.read(new File(imgPath));
+        int width = src.getWidth(null);
+        int height = src.getHeight(null);
+        if (needCompress) { // 压缩LOGO
+            if (width > WIDTH) {
+                width = WIDTH;
+            }
+            if (height > HEIGHT) {
+                height = HEIGHT;
+            }
+            Image image = src.getScaledInstance(width, height,
+                    Image.SCALE_SMOOTH);
+            BufferedImage tag = new BufferedImage(width, height,
+                    BufferedImage.TYPE_INT_RGB);
+            Graphics g = tag.getGraphics();
+            g.drawImage(image, 0, 0, null); // 绘制缩小后的图
+            g.dispose();
+            src = image;
+        }
+        // 插入LOGO
+        Graphics2D graph = source.createGraphics();
+        int x = (QRCODE_SIZE - width) / 2;
+        int y = (QRCODE_SIZE - height) / 2;
+        graph.drawImage(src, x, y, width, height, null);
+        Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
+        graph.setStroke(new BasicStroke(3f));
+        graph.draw(shape);
+        graph.dispose();
+    }
+
+    //获取生成二维码的图片流
+    public static BufferedImage encodeIO(String content, Boolean needCompress) throws Exception {
+        String imgPath = RESUMEFILE + "logo300.png";
+//        BufferedImage image = QrCodeUtils.createImage(content, imgPath,
+//                needCompress);
+//        //创建储存图片二进制流的输出流
+//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+//        //将二进制数据写入ByteArrayOutputStream
+//        ImageIO.write(image, "jpg", baos);
+//        return baos;
+        return QrCodeUtils.createImage(content, imgPath, needCompress);
+    }
+}

+ 47 - 46
src/main/resources/application.yml

@@ -48,53 +48,53 @@ coupon:
 #  RechargeTaskCoupon : "PVP2018051714111"
 #图片上传路径--------------------------
 #本地
-#file:
-#  ROOT : "C:/apache-tomcat-9.0.14/webapps/resume/img/"
-#  ResumeFile : "C:/apache-tomcat-9.0.14/webapps/resume/"
-#  httpRoot : "http://localhost:8080/resume/img/"
-#  httphtmlRoot : "http://localhost:8080/resume/"
-#  modulePath : "C:/apache-tomcat-9.0.14/webapps/resume/resume.html"
-#  payvoucher : "C:/apache-tomcat-9.0.14/webapps/payvoucher"
-#  httppayvoucher : "http://localhost:8080/payvoucher"
-#  promotionvoucher : "C:/apache-tomcat-9.0.14/webapps/MiniProgram/promotion/offline"
-#  httppromotionvoucher : "http://localhost:8080/MiniProgram/promotion/offline"
-#  qrcode: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm"
-#  httpqrcode: "http://127.0.0.1:8080/MiniProgram/mgm"
-#  IMGBANKCARD: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm/bankCard/"
-#  HTTPIMGBANKCARD: "http://127.0.0.1:8080/MiniProgram/mgm/bankCard/"
-#  LOCALQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm"
-#  DEMOQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm/pop"
-#  HTTPOPPQRCODE: "http://127.0.0.1:8080/MiniProgram/mgm/pop"
-#  TESTQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/promotion/test"
-#  HTTTESTQRCODE: "http://127.0.0.1:8080/MiniProgram/promotion/test/dc"
-#  BANNERIMGURL: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/index/banner/"
-#  HTTPBANNERIMGURL: "http://127.0.0.1:8080/MiniProgram/index/banner/"
-#  DIANPINGIMGURL: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/dianping/"
-#  HTTPDIANPINGIMGURL: "http://127.0.0.1:8080/MiniProgram/dianping/"
-#测试
 file:
-  ROOT : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/img/"
-  ResumeFile : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/"
-  httpRoot : "http://218.78.47.145:3306/resume/img/"
-  httphtmlRoot : "http://218.78.47.145:3306/resume/"
-  modulePath : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/resume.html"
-  payvoucher : "/home/tomcat/apache-tomcat-9.0.30/webapps/payvoucher"
-  httppayvoucher : "http://218.78.47.145:3306/payvoucher"
-  promotionvoucher : "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/promotion/offline"
-  httppromotionvoucher : "http://218.78.47.145:3306/MiniProgram/promotion/offline"
-  qrcode: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm"
-  httpqrcode: "http://218.78.47.145:3306/MiniProgram/mgm"
-  IMGBANKCARD: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm/bankCard/"
-  HTTPIMGBANKCARD: "http://218.78.47.145:3306/MiniProgram/mgm/bankCard/"
-  LOCALQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm"
-  DEMOQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm/pop"
-  HTTPOPPQRCODE: "http://218.78.47.145:3306/MiniProgram/mgm/pop"
-  TESTQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/promotion/test"
-  HTTTESTQRCODE: "http://218.78.47.145:3306/MiniProgram/promotion/test/dc"
-  BANNERIMGURL: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/index/banner/"
-  HTTPBANNERIMGURL: "http://218.78.47.145:3306/MiniProgram/index/banner/"
-  DIANPINGIMGURL: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/dianping/"
-  HTTPDIANPINGIMGURL: "http://218.78.47.145:3306/MiniProgram/dianping/"
+  ROOT : "D:/apache-tomcat-9.0.29/webapps/resume/img/"
+  ResumeFile : "D:/apache-tomcat-9.0.29/webapps/resume/"
+  httpRoot : "http://localhost:8080/resume/img/"
+  httphtmlRoot : "http://localhost:8080/resume/"
+  modulePath : "D:/apache-tomcat-9.0.29/webapps/resume/resume.html"
+  payvoucher : "D:/apache-tomcat-9.0.29/webapps/payvoucher"
+  httppayvoucher : "http://localhost:8080/payvoucher"
+  promotionvoucher : "D:/apache-tomcat-9.0.29/webapps/MiniProgram/promotion/offline"
+  httppromotionvoucher : "http://localhost:8080/MiniProgram/promotion/offline"
+  qrcode: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/mgm"
+  httpqrcode: "http://127.0.0.1:8080/MiniProgram/mgm"
+  IMGBANKCARD: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/mgm/bankCard/"
+  HTTPIMGBANKCARD: "http://127.0.0.1:8080/MiniProgram/mgm/bankCard/"
+  LOCALQRCODE: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/mgm"
+  DEMOQRCODE: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/mgm/pop"
+  HTTPOPPQRCODE: "http://127.0.0.1:8080/MiniProgram/mgm/pop"
+  TESTQRCODE: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/promotion/test"
+  HTTTESTQRCODE: "http://127.0.0.1:8080/MiniProgram/promotion/test/dc"
+  BANNERIMGURL: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/index/banner/"
+  HTTPBANNERIMGURL: "http://127.0.0.1:8080/MiniProgram/index/banner/"
+  DIANPINGIMGURL: "D:/apache-tomcat-9.0.29/webapps/MiniProgram/dianping/"
+  HTTPDIANPINGIMGURL: "http://127.0.0.1:8080/MiniProgram/dianping/"
+#测试
+#file:
+#  ROOT : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/img/"
+#  ResumeFile : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/"
+#  httpRoot : "http://218.78.47.145:3306/resume/img/"
+#  httphtmlRoot : "http://218.78.47.145:3306/resume/"
+#  modulePath : "/home/tomcat/apache-tomcat-9.0.30/webapps/resume/resume.html"
+#  payvoucher : "/home/tomcat/apache-tomcat-9.0.30/webapps/payvoucher"
+#  httppayvoucher : "http://218.78.47.145:3306/payvoucher"
+#  promotionvoucher : "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/promotion/offline"
+#  httppromotionvoucher : "http://218.78.47.145:3306/MiniProgram/promotion/offline"
+#  qrcode: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm"
+#  httpqrcode: "http://218.78.47.145:3306/MiniProgram/mgm"
+#  IMGBANKCARD: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm/bankCard/"
+#  HTTPIMGBANKCARD: "http://218.78.47.145:3306/MiniProgram/mgm/bankCard/"
+#  LOCALQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm"
+#  DEMOQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/mgm/pop"
+#  HTTPOPPQRCODE: "http://218.78.47.145:3306/MiniProgram/mgm/pop"
+#  TESTQRCODE: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/promotion/test"
+#  HTTTESTQRCODE: "http://218.78.47.145:3306/MiniProgram/promotion/test/dc"
+#  BANNERIMGURL: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/index/banner/"
+#  HTTPBANNERIMGURL: "http://218.78.47.145:3306/MiniProgram/index/banner/"
+#  DIANPINGIMGURL: "/home/tomcat/apache-tomcat-9.0.30/webapps/MiniProgram/dianping/"
+#  HTTPDIANPINGIMGURL: "http://218.78.47.145:3306/MiniProgram/dianping/"
 #生产
 #file:
 #  ROOT : "/usr/local/tomcat/tomcat7/webapps/resume/img/"
@@ -150,6 +150,7 @@ api:
 #  BIZOBJECTSERVICE: "http://47.111.190.117:8088/edw/h3/operateObjects"
   BIZUSERSERVICE: "https://www.h3yun.com/OpenApi/Invoke"
 #  BIZOBJECTSERVICE: "http://192.168.1.213:8010/h3/operateObjects"
+  CREATEQRURL: "https://test.yueguanjia.com/jielin-web/pay/third/prepay/approve"
 college:
   LMP: 43
   AGE: 12

+ 9 - 2
src/main/resources/mybatis/mapper/global/PackagesMapper.xml

@@ -19,6 +19,7 @@
         <result column="p_detaildesc" property="p_detaildesc" jdbcType="VARCHAR" />
         <result column="p_biz_id" property="p_biz_id" jdbcType="VARCHAR" />
         <result column="p_branches" property="p_branches" jdbcType="VARCHAR" />
+        <result column="payment_steps" property="payment_steps" jdbcType="VARCHAR" />
     </resultMap>
 
     <!--获取所有数据-->
@@ -31,7 +32,7 @@
 
     <select id="getPackageAll" resultType="com.ygj.yuemum.domain.global.Packages" >
         select
-        p_code,p_type,p_name,p_days,p_amount
+        p_code,p_type,p_name,p_days,p_amount,payment_steps
         from packages
     </select>
 
@@ -72,7 +73,7 @@
     </select>
 
     <select id="getPackageDetail" resultType="com.ygj.yuemum.domain.global.Packages"  parameterType="java.lang.String" >
-        select p_name,p_days,p_amount,p_detailimg,p_detaildesc
+        select p_name,p_days,p_amount,p_detailimg,p_detaildesc,payment_steps
         from packages
         where p_code = #{p_code,jdbcType=VARCHAR}
     </select>
@@ -90,5 +91,11 @@
         where p_code = #{p_code,jdbcType=VARCHAR}
     </select>
 
+    <select id="getRatioById" resultType="com.ygj.yuemum.domain.global.Packages"  parameterType="java.lang.Integer" >
+        select *
+        from packages
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
 
 </mapper>

+ 55 - 5
src/main/resources/mybatis/mapper/pay/CustomerPayMapper.xml

@@ -15,15 +15,52 @@
         <result column="cp_usercode" property="cp_usercode" jdbcType="VARCHAR" />
         <result column="cp_username" property="cp_username" jdbcType="VARCHAR" />
         <result column="cp_date" property="cp_date" jdbcType="DATE" />
+        <result column="payment_steps" property="payment_steps" jdbcType="INTEGER" />
+        <result column="out_trade_no" property="out_trade_no" jdbcType="VARCHAR" />
     </resultMap>
 
     <sql id="Base_Column_List" >
-        id, cp_ordertype,cp_orderno,cp_orderstatus,cp_channel,cp_discount,cp_paytype,cp_payamount,cp_comments,cp_usercode,cp_date
+        id, cp_ordertype,cp_orderno,cp_orderstatus,cp_channel,
+        cp_discount,cp_paytype,cp_payamount,cp_comments,cp_usercode,
+        cp_date,payment_steps,out_trade_no
     </sql>
     <!-- 此处添加查询信息-->
     <select id="selectCustomerPay" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
-        id, cp_ordertype,cp_orderno,cp_orderstatus,cp_channel,cp_discount,fgetequipmenpayname(cp_paytype) cp_paytype,cp_payamount,cp_comments,cp_usercode,cp_date
+        id, cp_ordertype,cp_orderno,cp_orderstatus,cp_channel,cp_discount,fgetequipmenpayname(cp_paytype) cp_paytype,cp_payamount,cp_comments,fgetuser_name(cp_usercode) cp_username,cp_date,payment_steps,out_trade_no
+        from customer_pay
+        where cp_orderno = #{cp_orderno,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
+
+    <select id="queryCustomerPayAndVoucher" resultMap="BaseResultMap" parameterType="java.lang.String" >
+        SELECT
+        customer_pay.id,
+        cp_ordertype,
+        cp_orderno,
+        cp_orderstatus,
+        cp_channel,
+        cp_discount,
+        fgetequipmenpayname ( cp_paytype ) cp_paytype,
+        cp_payamount,
+        cp_comments,
+        fgetuser_name ( cp_usercode ) cp_username,
+        cp_date,
+        customer_pay.payment_steps,
+        customer_pay.out_trade_no,
+        customer_pay_voucher.cv_filepath
+    FROM
+        customer_pay left JOIN customer_pay_voucher on customer_pay.out_trade_no = customer_pay_voucher.out_trade_no
+    where
+         cp_orderno = #{cp_orderno,jdbcType=VARCHAR}
+    order by id desc
+    </select>
+
+
+    <select id="queryPaySumByOrderNo" resultType="java.lang.Integer" parameterType="java.lang.String" >
+        select
+        sum(cp_payamount)
         from customer_pay
         where cp_orderno = #{cp_orderno,jdbcType=VARCHAR}
         order by id desc
@@ -52,7 +89,8 @@
         cp_comments,
         cp_usercode,
         fgetuser_name(cp_usercode) cp_username,
-        cp_date
+        cp_date,
+        payment_steps,out_trade_no
         from customer_pay
         where cp_orderno = #{cp_orderno,jdbcType=VARCHAR}
         and cp_orderstatus = #{cp_orderstatus,jdbcType=INTEGER}
@@ -91,7 +129,13 @@
                 cp_usercode,
             </if>
             <if test="cp_date != null" >
-                cp_date
+                cp_date,
+            </if>
+            <if test="payment_steps != null" >
+                payment_steps,
+            </if>
+            <if test="out_trade_no != null" >
+                out_trade_no
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -123,7 +167,13 @@
                 #{cp_usercode,jdbcType=VARCHAR},
             </if>
             <if test="cp_date != null" >
-                #{cp_date,jdbcType=DATE}
+                #{cp_date,jdbcType=DATE},
+            </if>
+            <if test="payment_steps != null" >
+                #{payment_steps,jdbcType=INTEGER},
+            </if>
+            <if test="out_trade_no != null" >
+                #{out_trade_no,jdbcType=VARCHAR}
             </if>
         </trim>
     </insert>

+ 27 - 4
src/main/resources/mybatis/mapper/pay/CustomerPayVoucherMapper.xml

@@ -8,6 +8,8 @@
         <result column="cv_orderstaus" property="cv_orderstaus" jdbcType="INTEGER" />
         <result column="cv_filename" property="cv_filename" jdbcType="VARCHAR" />
         <result column="cv_filepath" property="cv_filepath" jdbcType="VARCHAR" />
+        <result column="payment_steps" property="payment_steps" jdbcType="INTEGER" />
+        <result column="out_trade_no" property="out_trade_no" jdbcType="VARCHAR" />
     </resultMap>
 
     <sql id="Base_Column_List" >
@@ -16,7 +18,7 @@
     <!-- 此处添加查询信息-->
     <select id="selectCustomerPayVoucher" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
-        id, eh_code,cv_filename,cv_orderstaus,cv_filepath
+        id, eh_code,cv_filename,cv_orderstaus,cv_filepath,payment_steps,out_trade_no
         from customer_pay_voucher
         where eh_code = #{eh_code,jdbcType=VARCHAR}
         order by id desc
@@ -24,13 +26,22 @@
 
     <select id="queryOrderPayPhoto" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.pay.CustomerPayVoucher" >
         select
-        id, eh_code,cv_filename,cv_orderstaus,cv_filepath
+        id, eh_code,cv_filename,cv_orderstaus,cv_filepath,payment_steps,out_trade_no
         from customer_pay_voucher
         where eh_code = #{eh_code,jdbcType=VARCHAR}
         and cv_orderstaus = #{cv_orderstaus,jdbcType=INTEGER}
         order by id desc
     </select>
 
+
+    <select id="queryVoucherByTradeNo" resultType="com.ygj.yuemum.domain.pay.CustomerPayVoucher" parameterType="java.lang.String" >
+        select
+        *
+        from customer_pay_voucher
+        where out_trade_no = #{out_trade_no,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
     <!-- 插入一条培训信息 -->
     <insert id="insertCustomerPayVoucher" parameterType="com.ygj.yuemum.domain.pay.CustomerPayVoucher" >
         insert into customer_pay_voucher
@@ -45,7 +56,13 @@
                 cv_orderstaus,
             </if>
             <if test="cv_filepath != null" >
-                cv_filepath
+                cv_filepath,
+            </if>
+            <if test="payment_steps != null" >
+                payment_steps,
+            </if>
+            <if test="out_trade_no != null" >
+                out_trade_no
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -59,7 +76,13 @@
                 #{cv_orderstaus,jdbcType=INTEGER},
             </if>
             <if test="cv_filepath != null" >
-                #{cv_filepath,jdbcType=VARCHAR}
+                #{cv_filepath,jdbcType=VARCHAR},
+            </if>
+            <if test="payment_steps != null" >
+                #{payment_steps,jdbcType=INTEGER},
+            </if>
+            <if test="out_trade_no != null" >
+                #{out_trade_no,jdbcType=VARCHAR}
             </if>
         </trim>
     </insert>

+ 4 - 2
src/main/resources/mybatis/mapper/pay/PayMentsMapper.xml

@@ -11,19 +11,21 @@
         <result column="pm_config" property="pm_config" jdbcType="VARCHAR" />
         <result column="pm_enable" property="pm_enable" jdbcType="INTEGER" />
         <result column="pm_isonline" property="pm_isonline" jdbcType="INTEGER" />
+        <result column="is_voucher" property="is_voucher" jdbcType="INTEGER" />
+        <result column="qr_channel" property="qr_channel" jdbcType="VARCHAR" />
     </resultMap>
 
     <!--获取所有数据-->
     <select id="getPayMentSelect" resultType="com.ygj.yuemum.domain.pay.PayMents" >
         select
-        id,pm_code,pm_name,pm_desc,pm_order,pm_config,pm_enable,pm_isonline
+        id,pm_code,pm_name,pm_desc,pm_order,pm_config,pm_enable,pm_isonline,is_voucher,qr_channel
         from payments
         where pm_enable = '1'
     </select>
 
     <select id="getPayMentAll" resultType="com.ygj.yuemum.domain.pay.PayMents" >
         select
-        id,pm_code,pm_name,pm_desc,pm_order,pm_config,pm_enable,pm_isonline
+        id,pm_code,pm_name,pm_desc,pm_order,pm_config,pm_enable,pm_isonline,is_voucher,qr_channel
         from payments
     </select>