Pārlūkot izejas kodu

增加乐器采购清单确认接口

周箭河 5 gadi atpakaļ
vecāks
revīzija
837ad506d3

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/config/FeignConfiguration.java

@@ -14,7 +14,7 @@ public class FeignConfiguration {
 		// 这里记录所有,根据实际情况选择合适的日志level
 		return Logger.Level.FULL;
 	}
-	
+
 	@Bean
 	public RequestInterceptor requestInterceptor(){
 		return new RequestHeaderConfiguration();

+ 9 - 8
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -12,20 +12,18 @@ import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.thirdparty.adapay.Pay;
-import com.ym.mec.thirdparty.union.NotifyMsg;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.thirdparty.yqpay.YqPayUtil;
-import com.ym.mec.thirdparty.yqpay.YqQueryService;
+import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
+import com.ym.mec.thirdparty.yqpay.RsqMsg;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.snaker.engine.core.OrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -47,7 +45,7 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private MusicGroupService musicGroupService;
     @Autowired
-    private YqQueryService yqQueryService;
+    private YqPayFeignService yqQueryService;
 
 //    @PostMapping("/notify")
 //    public String notify(@ModelAttribute NotifyMsg notifyMsg) {
@@ -148,7 +146,7 @@ public class StudentOrderController extends BaseController {
     }
 
 
-    //@Scheduled(cron = "0/5 * * * * ?")
+    @Scheduled(cron = "0/5 * * * * ?")
     public void getOrderStatus() throws Exception {
         List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING, "YQPAY");
         String merOrderNos = ""; //
@@ -168,8 +166,11 @@ public class StudentOrderController extends BaseController {
         Map<String, Object> resultMap = new LinkedHashMap<>();
         resultMap.put("merOrderNoList", merOrderNos);
         Map<String, Object> requestMap = YqPayUtil.getRequestMap(notifyUrl, resultMap);
-        Msg queryRs = yqQueryService.orderQuery(requestMap);
-        // = yqQueryService.orderQuery(requestMap);
+
+        RsqMsg rsqMsg = new RsqMsg(requestMap);
+
+       Msg queryRs = yqQueryService.orderQuery(rsqMsg);
+
        logger.info("查询易乾结果" +queryRs.toString());
        //logger.info("查询易乾结果" + queryRs.toString());
         if (queryRs.getCode().equals("88")) {

+ 13 - 1
mec-thirdparty/pom.xml

@@ -84,6 +84,18 @@
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-openfeign</artifactId>
 		</dependency>
-    </dependencies>
+		<!-- https://mvnrepository.com/artifact/io.github.openfeign.form/feign-form-spring -->
+		<dependency>
+			<groupId>io.github.openfeign.form</groupId>
+			<artifactId>feign-form-spring</artifactId>
+			<version>2.0.5</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/io.github.openfeign.form/feign-form-spring -->
+		<dependency>
+			<groupId>io.github.openfeign.form</groupId>
+			<artifactId>feign-form-spring</artifactId>
+			<version>2.0.5</version>
+		</dependency>
+	</dependencies>
 
 </project>

+ 79 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/RsqMsg.java

@@ -0,0 +1,79 @@
+package com.ym.mec.thirdparty.yqpay;
+
+import java.util.Map;
+
+public class RsqMsg {
+    private String merNo;
+    private String version;
+    private String notifyUrl;
+    private String timestamp;
+    private String apiContent;
+    private String signType;
+    private String sign;
+
+    public RsqMsg(Map<String, Object> payMap) {
+        merNo = (String) payMap.get("merNo");
+        version = (String) payMap.get("version");
+        notifyUrl = (String) payMap.get("notifyUrl");
+        timestamp = (String) payMap.get("timestamp");
+        apiContent = (String) payMap.get("apiContent");
+        signType = (String) payMap.get("signType");
+        sign = (String) payMap.get("sign");
+    }
+
+    public String getMerNo() {
+        return merNo;
+    }
+
+    public void setMerNo(String merNo) {
+        this.merNo = merNo;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getApiContent() {
+        return apiContent;
+    }
+
+    public void setApiContent(String apiContent) {
+        this.apiContent = apiContent;
+    }
+
+    public String getSignType() {
+        return signType;
+    }
+
+    public void setSignType(String signType) {
+        this.signType = signType;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 51 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayFeignService.java

@@ -0,0 +1,51 @@
+package com.ym.mec.thirdparty.yqpay;
+
+import feign.Logger;
+import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.cloud.openfeign.support.SpringEncoder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+
+import java.util.Map;
+
+@FeignClient(value = "YqPayFeignService",url = "https://qyfquery.95epay.com",configuration = YqPayFeignService.FormSupportConfig.class)
+public interface YqPayFeignService {
+
+    @PostMapping(name = "订单查询", value = "/query/trade/tradeQuery",
+            consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
+            produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}
+    )
+    Msg orderQuery(RsqMsg rsqMsg);
+
+    @RequestMapping(name = "用户信息查询", value = "/query/account/queryAccount", method = RequestMethod.POST)
+    String queryAccount(@RequestParam Map<String, Object> map);
+
+    @RequestMapping(name = "对账查询", value = "/query/bill/billQuery", method = RequestMethod.POST)
+    String billQuery(@RequestParam Map<String, Object> map);
+
+
+    class FormSupportConfig {
+
+
+        @Autowired
+        private ObjectFactory<HttpMessageConverters> messageConverters;
+        // new一个form编码器,实现支持form表单提交
+        @Bean
+        public Encoder feignFormEncoder() {
+            return new SpringFormEncoder(new SpringEncoder(messageConverters));
+        }
+        // 开启Feign的日志
+        @Bean
+        public Logger.Level logger() {
+            return Logger.Level.FULL;
+        }
+    }
+
+    }

+ 0 - 21
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqQueryService.java

@@ -1,21 +0,0 @@
-package com.ym.mec.thirdparty.yqpay;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.Map;
-
-@FeignClient(value = "yqQuery", url = "https://qyfquery.95epay.com")
-public interface YqQueryService {
-
-    @RequestMapping(name = "订单查询", value = "/query/trade/tradeQuery", method = RequestMethod.POST)
-    Msg orderQuery(@RequestParam Map<String, Object> map);
-
-    @RequestMapping(name = "用户信息查询", value = "/query/account/queryAccount", method = RequestMethod.POST)
-    String queryAccount(@RequestParam Map<String, Object> map);
-
-    @RequestMapping(name = "对账查询", value = "/query/bill/billQuery", method = RequestMethod.POST)
-    String billQuery(@RequestParam Map<String, Object> map);
-}