Bladeren bron

fix merger

周箭河 5 jaren geleden
bovenliggende
commit
4e987f2a87

+ 68 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PayService.java

@@ -0,0 +1,68 @@
+package com.ym.mec.biz.service;
+
+
+import com.ym.mec.thirdparty.yqpay.YqPayUtil;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/** 
+ * 上传工具服务层实现类
+ */
+@Service
+public class PayService {
+
+	/**
+	 * 返回订单提交数据
+	 * @param amount 金额
+	 * @param orderNo 订单编号
+	 * @param notifyUrl 异步通知地址
+	 * @param returnUrl 支付返回地址
+	 * @param orderSubject 订单标题
+	 * @param orderBody 订单内容
+	 * @return
+	 * @throws Exception
+	 */
+	public Map getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
+
+//        String notifyUrl = ""; //异步通知地址
+//        String returnUrl = ""; //还回地址
+//        String orderBody = "大雅乐盟培训课程";//订单内容
+//        String orderSubject = "培训订单";//订单标题
+//        String orderNo = "2019121263844";//订单编号
+//        BigDecimal amount = new BigDecimal("654369"); //订单金额
+
+		String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付提交地址
+		String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
+
+		//List<Map> tempRoutingList = new ArrayList();
+//        Map<String, Object> routingList = new HashMap<>();
+//        routingList.put("routingMerNo", routingAccount.getSellerNo());//分佣账户
+////      routingList.put("routingFee", order.getAmount()); //分佣金额
+//        routingList.put("routingFee", order.getAmount().subtract((order.getAmount().multiply(new BigDecimal(0.28)).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP))); //分佣金额
+//        tempRoutingList.add(routingList);
+//
+
+		Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
+		resultMap.put("sellerNo", "0021677"); //收款商户号
+		resultMap.put("payChannels", payChannels); //支付方式
+		resultMap.put("orderBody", orderBody); //订单信息
+		resultMap.put("payAmount", amount); //支付金额
+		resultMap.put("apiPayType", "1"); //*API支付类型1-即时支付,2-担保支付,3-预授权支付*/
+		resultMap.put("tradeType", "0"); //*交易类型1—充值,0—收款*
+		resultMap.put("merMerOrderNo", orderNo); //商户订单号
+		resultMap.put("orderSubject", orderSubject); //订单标题
+		resultMap.put("returnUrl", returnUrl); //前台页面地址
+		//resultMap.put("tempRoutingList", JSON.toJSONString(tempRoutingList));//分账设置
+		Map rqMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
+		rqMap.put("host", payUrl);
+		return rqMap;
+	}
+
+}

+ 0 - 3
mec-student/pom.xml

@@ -11,9 +11,6 @@
 	<artifactId>mec-student</artifactId>
 	<name>mec-student</name>
 	<url>http://maven.apache.org</url>
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-	</properties>
 	<dependencies>
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -22,7 +22,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId","/register/findGoodsGroups").permitAll().anyRequest().authenticated().and().httpBasic();
+		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId","/musicGroup/test").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 11 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.LinkedHashMap;
@@ -31,7 +32,7 @@ import java.util.Map;
 @RestController
 public class MusicGroupController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private MusicGroupService musicGroupService;
@@ -45,6 +46,7 @@ public class MusicGroupController extends BaseController {
     private GoodsService goodsService;
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired PayService payService;
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -146,4 +148,12 @@ public class MusicGroupController extends BaseController {
         rqMap.put("payUrl", "http://pay.url");
         return succeed(rqMap);
     }
+
+    @GetMapping("/test")
+    public Object test() throws Exception {
+
+        BigDecimal amount = new BigDecimal("200");
+        Map map = payService.getPayMap(amount,"201978564578","https://pay.dayaedu.com/notify","","测试订单","测试订单");
+        return succeed(map);
+    }
 }

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayUtil.java

@@ -26,7 +26,7 @@ public class YqPayUtil {
         rqMap.put("apiContent", JSON.toJSONString(resultMap));
         rqMap.put("signType", signType);
         String beforeSignedData = CFCARAUtil.joinMapValue(rqMap, '&');
-        this.sign = CFCARAUtil.signMessageByP1(beforeSignedData, "certificate/yqpay.pfx", "aaa123123");
+        this.sign = CFCARAUtil.signMessageByP1(beforeSignedData, "config/certificate/yqpay.pfx","aaa123123");
         rqMap.put("sign", this.sign);
         this.requestMap = rqMap;
     }

BIN
mec-thirdparty/src/main/resources/config/certificate/sq_formal_sign.cer


BIN
mec-thirdparty/src/main/resources/config/certificate/yqpay.cer


BIN
mec-thirdparty/src/main/resources/config/certificate/yqpay.pfx