Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/collect_fee

# Conflicts:
#	src/main/resources/config/mybatis/OrderMapper.xml
zouxuan 5 years ago
parent
commit
885bd7d458

+ 18 - 1
pom.xml

@@ -181,6 +181,17 @@
 			<artifactId>springfox-swagger-ui</artifactId>
 			<version>2.2.2</version>
 		</dependency>
+		<dependency>
+			<groupId>io.springfox</groupId>
+			<artifactId>springfox-swagger2</artifactId>
+			<version>2.7.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>io.springfox</groupId>
+			<artifactId>springfox-swagger-ui</artifactId>
+			<version>2.7.0</version>
+		</dependency>
 	</dependencies>
 
 	<build>
@@ -192,11 +203,17 @@
 				<executions>
 					<execution>
 						<goals>
-							<goal>build-info</goal>
 							<goal>repackage</goal>
 						</goals>
 					</execution>
 				</executions>
+				<configuration>
+					<includeSystemScope>true</includeSystemScope>
+					<addResources>true</addResources>
+					<fork>true</fork>
+					<mainClass>com.ym.mec.collectfee.CollectFeeServerApplication</mainClass>
+					<layout>ZIP</layout>
+				</configuration>
 			</plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>

+ 9 - 5
src/main/java/com/ym/mec/collectfee/controller/YqPayController.java

@@ -7,6 +7,8 @@ import com.ym.mec.collectfee.service.YqPayService;
 import com.ym.mec.collectfee.service.YqQueryService;
 import com.ym.mec.collectfee.utils.GenerateNum;
 import com.ym.mec.collectfee.utils.yqpay.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
@@ -22,6 +24,7 @@ import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+@Api(description = "支付")
 @Slf4j
 @RestController
 @RequestMapping("yqPay")
@@ -44,7 +47,8 @@ public class YqPayController {
      * @return String
      * @throws Exception
      */
-    @RequestMapping("/toPay")
+    @ApiOperation(value = "提交支付", notes = "易乾支付统一下单")
+    @PostMapping("/toPay")
     @Transactional
     public Msg toPay(@ModelAttribute @Validated Order order) throws Exception {
         String orderNo = GenerateNum.getInstance().GenerateOrderNo();
@@ -100,7 +104,7 @@ public class YqPayController {
      * @return
      * @throws Exception
      */
-    @RequestMapping("/query")
+    @PostMapping("/query")
     public String query(String merOrderNoList) throws Exception {
         String notifyUrl = ""; //回调地址
         Map<String, Object> resultMap = new LinkedHashMap<>();
@@ -116,7 +120,7 @@ public class YqPayController {
      * @return
      * @throws Exception
      */
-    @RequestMapping("/queryaccount")
+    @PostMapping("/queryaccount")
     public String queryAccount(String sonMerNo) throws Exception {
         String notifyUrl = ""; //回调地址
         Map<String, Object> resultMap = new LinkedHashMap<>();
@@ -148,7 +152,7 @@ public class YqPayController {
      * @return
      * @throws Exception
      */
-    @RequestMapping("/platformtransferacc")
+    @PostMapping("/platformtransferacc")
     public String platformTransferAcc() throws Exception {
         String notifyUrl = ""; //回调地址
         Map<String, Object> resultMap = new LinkedHashMap<>();
@@ -211,7 +215,7 @@ public class YqPayController {
      * @return String
      * @throws Exception
      */
-    @RequestMapping("/notify")
+    @PostMapping("/notify")
     public Msg notify(@ModelAttribute Msg msg) throws Exception {
         log.info(msg.toString());
         Map<String, Object> rqMap = new LinkedHashMap<String, Object>();

+ 41 - 4
src/main/java/com/ym/mec/collectfee/controller/YqRegController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.collectfee.controller;
 
+import com.ym.mec.collectfee.utils.GenerateNum;
 import com.ym.mec.collectfee.utils.yqpay.YqPayUtil;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
@@ -22,15 +23,17 @@ public class YqRegController {
      * @return
      * @throws Exception
      */
-    @GetMapping("/register")
-    public String register(ModelMap map) throws Exception {
+    @GetMapping("/per")
+    public String per(ModelMap map) throws Exception {
 
         String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址
 
+        String seraialNumber = GenerateNum.getInstance().GenerateOrderNo();
+
         Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
         resultMap.put("type", "H5");
-        resultMap.put("returnUrl", "https://www.baidu.com");
-        resultMap.put("seraialNumber", "785679");
+        resultMap.put("returnUrl", "http://dev.dayaedu.com/");
+        resultMap.put("seraialNumber", seraialNumber);
         resultMap.put("merType", "per");
 
         Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
@@ -38,4 +41,38 @@ public class YqRegController {
         return "/reg/register";
     }
 
+    @GetMapping("/com")
+    public String com(ModelMap map) throws Exception {
+        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址
+
+        String seraialNumber = GenerateNum.getInstance().GenerateOrderNo();
+
+        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
+        resultMap.put("type", "H5");
+        resultMap.put("returnUrl", "http://dev.dayaedu.com/");
+        resultMap.put("seraialNumber", seraialNumber);
+        resultMap.put("merType", "com");
+
+        Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
+        map.addAttribute("info", requestMap);
+        return "/reg/register";
+    }
+
+    @GetMapping("/pcy")
+    public String pcy(ModelMap map) throws Exception {
+        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址
+
+        String seraialNumber = GenerateNum.getInstance().GenerateOrderNo();
+
+        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
+        resultMap.put("type", "H5");
+        resultMap.put("returnUrl", "http://dev.dayaedu.com/");
+        resultMap.put("seraialNumber", seraialNumber);
+        resultMap.put("merType", "pcy");
+
+        Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
+        map.addAttribute("info", requestMap);
+        return "/reg/register";
+    }
+
 }

+ 2 - 0
src/main/java/com/ym/mec/collectfee/entity/Order.java

@@ -1,6 +1,7 @@
 package com.ym.mec.collectfee.entity;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
@@ -13,6 +14,7 @@ import java.util.Date;
 public class Order {
 
 	/**  */
+	@ApiModelProperty(hidden = true)
 	private Integer id;
 	
 	/** 订单号。订单流水号 */

+ 6 - 4
src/main/java/com/ym/mec/collectfee/utils/yqpay/CFCARAUtil.java

@@ -11,6 +11,7 @@ import org.springframework.core.io.ClassPathResource;
 import javax.crypto.spec.SecretKeySpec;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.InputStreamReader;
 import java.security.Key;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
@@ -47,8 +48,9 @@ public class CFCARAUtil {
      *
      */
     public static String signMessageByP1(String message, String pfxPath, String passWord) throws Exception{
-        File file = new ClassPathResource(pfxPath).getFile();
-        PrivateKey userPriKey = KeyUtil.getPrivateKeyFromPFX(new FileInputStream(file), passWord);
+       // File file = new ClassPathResource(pfxPath).getFile();
+
+        PrivateKey userPriKey = KeyUtil.getPrivateKeyFromPFX(new ClassPathResource(pfxPath).getInputStream(), passWord);
         Signature signature = new Signature();
         byte[] base64P7SignedData = signature.p1SignMessage(Mechanism.SHA256_RSA, message.getBytes("UTF-8"), userPriKey, session);
         return new String(base64P7SignedData);
@@ -63,8 +65,8 @@ public class CFCARAUtil {
      * @throws Exception
      */
     public static boolean verifyMessageByP1(String beforeSignedData, String afterSignedData, String certPath) throws Exception{
-        File file = new ClassPathResource(certPath).getFile();
-        X509Cert cert = new X509Cert(new FileInputStream(file));
+        //File file = new ClassPathResource(certPath).getFile();
+        X509Cert cert = new X509Cert(new ClassPathResource(certPath).getInputStream());
         PublicKey publicKey = cert.getPublicKey();
         Signature signature = new Signature();
         return signature.p1VerifyMessage(Mechanism.SHA256_RSA, beforeSignedData.getBytes("UTF-8"), afterSignedData.getBytes("UTF-8"), publicKey, session);

+ 5 - 5
src/main/resources/config/mybatis/OrderMapper.xml

@@ -34,12 +34,12 @@
 	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="Order" >
-		SELECT * FROM order WHERE id = #{id} 
+		SELECT * FROM `order` WHERE id = #{id}
 	</select>
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="Order">
-		SELECT * FROM order ORDER BY id
+		SELECT * FROM `order` ORDER BY id
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
@@ -60,17 +60,17 @@
 	
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
-		DELETE FROM order WHERE id = #{id} 
+		DELETE FROM `order` WHERE id = #{id}
 	</delete>
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="Order" parameterType="map">
-		SELECT * FROM order ORDER BY id <include refid="global.limit"/>
+		SELECT * FROM `order` ORDER BY id <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM order
+		SELECT COUNT(*) FROM `order`
 	</select>
 
 	<select id="getOrderByUserId" resultMap="Order">

+ 1 - 1
src/main/resources/templates/reg/register.ftl

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <title>register</title>
 </head>
-<body>
+<body style="display: none">
 <form action="https://qyfapi.95epay.com/api/api/page/registerPage" method="POST" id="sent_register">
     <p>First merNo: <input type="text" name="merNo" value="${info.merNo}"/></p>
     <p>Last version: <input type="text" name="version" value="${info.version}"/></p>