Przeglądaj źródła

修改易乾接口

周箭河 5 lat temu
rodzic
commit
ce32f924fc

+ 5 - 5
pom.xml

@@ -53,11 +53,6 @@
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
-			<dependency>
-				<groupId>org.projectlombok</groupId>
-				<artifactId>lombok</artifactId>
-				<optional>true</optional>
-			</dependency>
 		</dependencies>
 	</dependencyManagement>
 
@@ -171,6 +166,11 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-freemarker</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<optional>true</optional>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 17 - 15
src/main/java/com/ym/mec/collectfee/controller/YqPayController.java

@@ -1,22 +1,21 @@
 package com.ym.mec.collectfee.controller;
 
 import com.alibaba.fastjson.JSON;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import com.ym.mec.collectfee.entity.Order;
 import com.ym.mec.collectfee.service.OrderService;
 import com.ym.mec.collectfee.service.YqPayService;
 import com.ym.mec.collectfee.service.YqQueryService;
-import com.ym.mec.collectfee.service.impl.OrderServiceImpl;
 import com.ym.mec.collectfee.utils.GenerateNum;
 import com.ym.mec.collectfee.utils.yqpay.*;
-import org.hibernate.validator.constraints.SafeHtml;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import lombok.extern.log4j.Log4j;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -24,6 +23,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.zip.Inflater;
 
+@Slf4j
 @RestController
 @RequestMapping("yqPay")
 public class YqPayController {
@@ -49,10 +49,11 @@ public class YqPayController {
         order.setOrderNo(orderNo);
         order.setCreateTime(new Date());
         order.setStatus(1);
-        Long id = orderService.insert(order);
 
         /*卖家双乾商户号*/
         String sellerNo = "0022652"; //某笔定义到某个商户
+        order.setAccount(sellerNo);
+        Long id = orderService.insert(order);
         /*订单信息*/
         String orderBody = "大雅乐盟培训课程";
         /*订单标题*/
@@ -99,7 +100,7 @@ public class YqPayController {
      */
     @RequestMapping("/query")
     public String query(String merOrderNoList) throws Exception {
-        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //回调地址
+        String notifyUrl = ""; //回调地址
         Map<String, Object> resultMap = new LinkedHashMap<>();
         resultMap.put("merOrderNoList", merOrderNoList);
         Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
@@ -115,7 +116,7 @@ public class YqPayController {
      */
     @RequestMapping("/queryaccount")
     public String queryAccount(String sonMerNo) throws Exception {
-        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //回调地址
+        String notifyUrl = ""; //回调地址
         Map<String, Object> resultMap = new LinkedHashMap<>();
         resultMap.put("merOrderNoList", sonMerNo);
         Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
@@ -159,11 +160,11 @@ public class YqPayController {
     }
 
     /**
-     * 提现发送短信
-     *
+     * 提现短信
      * @return
      * @throws Exception
      */
+    @PostMapping("/sendsms")
     public Msg sendSms(@ModelAttribute Intfc intfc) throws Exception {
         String notifyUrl = ""; //回调地址
         String merMerOrderNo = GenerateNum.getInstance().GenerateOrderNo();
@@ -172,18 +173,18 @@ public class YqPayController {
         resultMap.put("merMerOrderNo", merMerOrderNo); //商户订单号
         resultMap.put("amount", intfc.getAmount()); //提现金额
         resultMap.put("cardNo", intfc.getCardNo()); //提现银行卡号
-        resultMap.put("phone", intfc.getPhone()); //预留手机号(选填)
-        resultMap.put("cardType", intfc.getCardType()); //卡类型 0-个人银行卡,1-企业银行卡。(选填)
+//        resultMap.put("phone", intfc.getPhone()); //预留手机号(选填)
+//        resultMap.put("cardType", intfc.getCardType()); //卡类型 0-个人银行卡,1-企业银行卡。(选填)
         Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
         return yqPayService.intfc(requestMap);
     }
 
     /**
      * 提现
-     *
      * @return
      * @throws Exception
      */
+    @PostMapping("/intfc")
     public Msg intfc(@ModelAttribute Intfc intfc) throws Exception {
         String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //回调地址
         String merMerOrderNo = GenerateNum.getInstance().GenerateOrderNo();
@@ -192,8 +193,8 @@ public class YqPayController {
         resultMap.put("merMerOrderNo", merMerOrderNo); //商户订单号
         resultMap.put("amount", intfc.getAmount()); //提现金额
         resultMap.put("cardNo", intfc.getCardNo()); //提现银行卡号
-        resultMap.put("phone", intfc.getPhone()); //预留手机号(选填)
-        resultMap.put("cardType", intfc.getCardType()); //卡类型 0-个人银行卡,1-企业银行卡。(选填)
+//        resultMap.put("phone", intfc.getPhone()); //预留手机号(选填)
+//        resultMap.put("cardType", intfc.getCardType()); //卡类型 0-个人银行卡,1-企业银行卡。(选填)
         resultMap.put("seqNo", ""); //流水号(选填)
         resultMap.put("smsCode", ""); //验证码(选填)
         Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
@@ -210,6 +211,7 @@ public class YqPayController {
      */
     @RequestMapping("/notify")
     public Msg notify(@ModelAttribute Msg msg) throws Exception {
+        log.info(msg.toString());
         Map<String, Object> rqMap = new LinkedHashMap<String, Object>();
         rqMap.put("code", msg.getCode());
         rqMap.put("msg", msg.getMsg());
@@ -234,7 +236,7 @@ public class YqPayController {
             if (order.getOrderNo().isEmpty()) {
                 order.setPayId(notifyMsg.getOrderNo()); //更新易乾付订单号
             }
-            if (status == 0) {
+            if(status == 0){
                 order.setPay(notifyMsg.getPayAmount());
                 order.setPayTime(new Date());
             }

+ 4 - 9
src/main/java/com/ym/mec/collectfee/utils/yqpay/Intfc.java

@@ -1,12 +1,15 @@
 package com.ym.mec.collectfee.utils.yqpay;
 
+import lombok.ToString;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
 /**
  * 提现信息
  */
+@ToString
 public class Intfc {
 
     private String wdMerNo; //提现商户号
-    private String merMerOrderNo; //商户订单号
     private String amount; //提现金额
     private String cardNo; //提现银行卡号
     private String phone; //预留手机号(选填)
@@ -14,14 +17,6 @@ public class Intfc {
     private String seqNo; //流水号(选填)
     private String smsCode; //验证码(选填)
 
-    public String getMerMerOrderNo() {
-        return merMerOrderNo;
-    }
-
-    public void setMerMerOrderNo(String merMerOrderNo) {
-        this.merMerOrderNo = merMerOrderNo;
-    }
-
     public String getWdMerNo() {
         return wdMerNo;
     }

+ 3 - 0
src/main/java/com/ym/mec/collectfee/utils/yqpay/Msg.java

@@ -1,5 +1,8 @@
 package com.ym.mec.collectfee.utils.yqpay;
 
+import lombok.ToString;
+
+@ToString
 public class Msg {
 
     private String code;