Bladeren bron

屏蔽paytm

李天标 5 jaren geleden
bovenliggende
commit
e00223d3e1

+ 5 - 5
pom.xml

@@ -35,11 +35,11 @@
 
 	<dependencies>
 		<!-- paytm支付 -->
-		<dependency>
-			<groupId>myjar</groupId>
-			<artifactId>PaytmChecksum</artifactId>
-			<version>1.0</version>
-		</dependency>
+<!--		<dependency>-->
+<!--			<groupId>myjar</groupId>-->
+<!--			<artifactId>PaytmChecksum</artifactId>-->
+<!--			<version>1.1</version>-->
+<!--		</dependency>-->
 		<!-- Spring Component End -->
 		<dependency>
 			<groupId>org.json</groupId>

+ 3 - 0
src/main/java/com/shawn/model/entity/TAdmin.java

@@ -94,6 +94,9 @@ public class TAdmin {
 	private String phone;
 
 	@ApiModelProperty(value="")
+	private String open;
+
+	@ApiModelProperty(value="")
 	private String isRefund;
 
 	@ApiModelProperty(value="")

+ 69 - 0
src/main/java/com/shawn/model/entity/TAdminExample.java

@@ -1666,6 +1666,75 @@ public class TAdminExample {
             addCriterion("if_foreign not between", value1, value2, "ifForeign");
             return (Criteria) this;
         }
+        public Criteria andOpenIsNull() {
+            addCriterion("open is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIsNotNull() {
+            addCriterion("open is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenEqualTo(String value) {
+            addCriterion("open =", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenNotEqualTo(String value) {
+            addCriterion("open <>", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenGreaterThan(String value) {
+            addCriterion("open >", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenGreaterThanOrEqualTo(String value) {
+            addCriterion("open >=", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenLessThan(String value) {
+            addCriterion("open <", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenLessThanOrEqualTo(String value) {
+            addCriterion("open <=", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenLike(String value) {
+            addCriterion("open like", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenNotLike(String value) {
+            addCriterion("open not like", value, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIn(List<String> values) {
+            addCriterion("open in", values, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenNotIn(List<String> values) {
+            addCriterion("open not in", values, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenBetween(String value1, String value2) {
+            addCriterion("open between", value1, value2, "open");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenNotBetween(String value1, String value2) {
+            addCriterion("open not between", value1, value2, "open");
+            return (Criteria) this;
+        }
     }
 
     /**

+ 2 - 0
src/main/java/com/shawn/web/controller/TAdminController.java

@@ -56,6 +56,8 @@ public class TAdminController extends BaseController<TAdmin,TAdminExample,TAdmin
 		criteria.andPasswordEqualTo(param.getPassword());
 		List<TAdmin> list = tAdminService.selectByOption(example);
 		if(list.size()>0){
+			TAdmin admin = tAdminService.selectEntityById(list.get(0).getId());
+//			admin.getIfOpen();
 			return ResponseEntity.status(HttpStatus.OK)
 					.body(new ResultMessage().setCode(true).setData(list.get(0)).setMessage("SUCCESS"));
 		}

+ 136 - 135
src/main/java/com/shawn/web/controller/TWeixinController.java

@@ -17,7 +17,7 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import com.alibaba.fastjson.JSONObject;
-import com.paytm.pg.merchant.CheckSumServiceHelper;
+//import com.paytm.pg.merchant.CheckSumServiceHelper;
 import com.shawn.model.entity.*;
 import com.shawn.service.interfac.TAdminServiceInterface;
 import com.shawn.util.JoinpayConstant;
@@ -64,145 +64,146 @@ public class TWeixinController extends BaseController<TWeixin,TWeixinExample,TWe
      * @param
      * @return
      */
-    @GetMapping("/paytmpay")
-    public ResponseEntity<?> paytmpay(String orderId,String type ) {
-        /* initialize an object */
-        JSONObject paytmParams = new JSONObject();
-
-        /* body parameters */
-        JSONObject body = new JSONObject();
-        if(type.equals("SMS")){
-            body.put("sendSms", true);
-        }else{
-            body.put("sendEmail", true);
-        }
-        Double amount = 0.10;
-        body.put("amount", amount);
-        /* Find your MID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */
-        JSONObject customerContact = new JSONObject();
-        customerContact.put("customerEmail", "520283710@qq.com");
-        customerContact.put("customerMobile", "9910215225");
-        body.put("customerContact", customerContact);
-        body.put("statusCallbackUrl", "https://app.sunzee.com.cn/ShenzeeServer/TWeixin/paytmNotify");
-        body.put("mid", "WorldP64425807474247");
-
-        /* Possible value are "GENERIC", "FIXED", "INVOICE" */
-        body.put("linkType", "LINK_TYPE");
-
-        /* Enter your choice of payment link description here, special characters are not allowed */
-        body.put("linkDescription", "PAYMENT LINK DESCRIPTION");
-
-        /* Enter your choice of payment link name here, special characters and spaces are not allowed */
-        body.put("linkName", "PAYMENTLINKNAME");
-        String result = "";
-/**
- * Generate checksum by parameters we have in body
- * You can get Checksum JAR from https://developer.paytm.com/docs/v1/payment-gateway/#code
- * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
- */
-        String checksum2="";
-        try { String checksum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum("kbzk1DSbJiV_O3p5", body.toString());
-            checksum2 = checksum;
-        /* head parameters */
-        JSONObject head = new JSONObject();
-        Long startTs = System.currentTimeMillis(); // 当前时间戳
-        /* This will be AES */
-            Long yiu=new Long(9000l);
-            Long cd=new Long(startTs);
-            Long d=cd-yiu;
-//            Long time = startTs-yiu;‬
-        head.put("timestamp", d);
-        head.put("tokenType", "AES");
-
-        /* put generated checksum value here */
-        head.put("signature", checksum);
-
-        /* prepare JSON string for request */
-        paytmParams.put("body", body);
-        paytmParams.put("head", head);
-        String post_data = paytmParams.toString();
-
-        /* for Staging */
-        URL url = new URL("https://securegw-stage.paytm.in/link/create");
-
-        /* for Production */
-// URL url = new URL("https://securegw.paytm.in/link/create);
-//            TWeixin weixin = new TWeixin();
-//            weixin.setAdminId("1");
-//            weixin.setAvatarUrl(paytmParams.toString().substring(0,200));
-//            weixin.setCreateDate(new Date());
-//            weixin.setModifyDate(new Date());
-//            weixin.setNickName(checksum);
-//            tWeixinService.insert(weixin);
-
-            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-            connection.setRequestMethod("POST");
-            connection.setRequestProperty("Content-Type", "application/json");
-            connection.setDoOutput(true);
-
-            DataOutputStream requestWriter = new DataOutputStream(connection.getOutputStream());
-            requestWriter.writeBytes(post_data);
-            requestWriter.close();
-            String responseData = "";
-            InputStream is = connection.getInputStream();
-            BufferedReader responseReader = new BufferedReader(new InputStreamReader(is));
-            if ((responseData = responseReader.readLine()) != null) {
-                result=responseData;
-                System.out.append("Response: " + responseData);
-            }
-            // System.out.append("Request: " + post_data);
-            responseReader.close();
-        } catch (Exception exception) {
-            exception.printStackTrace();
-        }
-        return ResponseEntity.status(HttpStatus.OK)
-                .body(new ResultMessage().setCode(true).setData(result).setMessage(checksum2));
-    }
+//    @GetMapping("/paytmpay")
+//    public ResponseEntity<?> paytmpay(String orderId,String type ) {
+//        /* initialize an object */
+//        JSONObject paytmParams = new JSONObject();
+//
+//        /* body parameters */
+//        JSONObject body = new JSONObject();
+//        if(type.equals("SMS")){
+//            body.put("sendSms", true);
+//        }else{
+//            body.put("sendEmail", true);
+//        }
+//        Double amount = 0.10;
+//        body.put("amount", amount);
+//        /* Find your MID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */
+//        JSONObject customerContact = new JSONObject();
+//        customerContact.put("customerEmail", "520283710@qq.com");
+//        customerContact.put("customerMobile", "9910215225");
+//        body.put("customerContact", customerContact);
+//        body.put("statusCallbackUrl", "https://app.sunzee.com.cn/ShenzeeServer/TWeixin/paytmNotify");
+//        body.put("mid", "WorldP64425807474247");
+//
+//        /* Possible value are "GENERIC", "FIXED", "INVOICE" */
+//        body.put("linkType", "LINK_TYPE");
+//
+//        /* Enter your choice of payment link description here, special characters are not allowed */
+//        body.put("linkDescription", "PAYMENT LINK DESCRIPTION");
+//
+//        /* Enter your choice of payment link name here, special characters and spaces are not allowed */
+//        body.put("linkName", "PAYMENTLINKNAME");
+//        String result = "";
+///**
+// * Generate checksum by parameters we have in body
+// * You can get Checksum JAR from https://developer.paytm.com/docs/v1/payment-gateway/#code
+// * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
+// */
+//        String checksum2="";
+//        try { String checksum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum("kbzk1DSbJiV_O3p5", body.toString());
+//
+//        /* head parameters */
+//        JSONObject head = new JSONObject();
+//        Long startTs = System.currentTimeMillis(); // 当前时间戳
+//        /* This will be AES */
+//            Long yiu=new Long(9000l);
+//            Long cd=new Long(startTs);
+//            Long d=cd-yiu;
+////            Long time = startTs-yiu;‬
+//        head.put("timestamp", d);
+//        head.put("tokenType", "AES");
+//
+//        /* put generated checksum value here */
+//        head.put("signature", checksum);
+//
+//        /* prepare JSON string for request */
+//        paytmParams.put("body", body);
+//        paytmParams.put("head", head);
+//        String post_data = paytmParams.toString();
+//
+//        /* for Staging */
+//        URL url = new URL("https://securegw-stage.paytm.in/link/create");
+//
+//        /* for Production */
+//// URL url = new URL("https://securegw.paytm.in/link/create);
+////            TWeixin weixin = new TWeixin();
+////            weixin.setAdminId("1");
+////            weixin.setAvatarUrl(paytmParams.toString().substring(0,200));
+////            weixin.setCreateDate(new Date());
+////            weixin.setModifyDate(new Date());
+////            weixin.setNickName(checksum);
+////            tWeixinService.insert(weixin);
+//
+//            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+//            connection.setRequestMethod("POST");
+//            connection.setRequestProperty("Content-Type", "application/json");
+//            connection.setDoOutput(true);
+//
+//            DataOutputStream requestWriter = new DataOutputStream(connection.getOutputStream());
+//            requestWriter.writeBytes(post_data);
+//            requestWriter.close();
+//            String responseData = "";
+//            InputStream is = connection.getInputStream();
+//            BufferedReader responseReader = new BufferedReader(new InputStreamReader(is));
+//            checksum2 = checksum;
+//            if ((responseData = responseReader.readLine()) != null) {
+//                result=responseData;
+//                System.out.append("Response: " + responseData);
+//            }
+//            // System.out.append("Request: " + post_data);
+//            responseReader.close();
+//        } catch (Exception exception) {
+//            exception.printStackTrace();
+//        }
+//        return ResponseEntity.status(HttpStatus.OK)
+//                .body(new ResultMessage().setCode(true).setData(result.substring(0,240)).setMessage(checksum2));
+//    }
     /**
      * 支付成功回调
      *
      * @return
      */
-    @RequestMapping(value = "/paytmNotify", method = RequestMethod.GET)
-    @ResponseBody
-    public Object refund(HttpServletRequest request) {
-
-//        String r6_Status = request.getParameter("r6_Status");
-        try {String paytmChecksum = null;
-
-        /* Create a TreeMap from the parameters received in POST */
-        TreeMap<String, String> paytmParams = new TreeMap<String, String>();
-        for (Map.Entry<String, String[]> requestParamsEntry : request.getParameterMap().entrySet()) {
-            if ("CHECKSUMHASH".equalsIgnoreCase(requestParamsEntry.getKey())){
-                paytmChecksum = requestParamsEntry.getValue()[0];
-            } else {
-                paytmParams.put(requestParamsEntry.getKey(), requestParamsEntry.getValue()[0]);
-            }
-
-        }
-        TWeixin weixin = new TWeixin();
-        weixin.setAdminId("1");
-        weixin.setAvatarUrl(paytmParams.toString().substring(0,240));
-        weixin.setCreateDate(new Date());
-        weixin.setModifyDate(new Date());
-        weixin.setNickName(paytmChecksum);
-            tWeixinService.insert(weixin);
-/**
- * Verify checksum
- * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
- */
-        boolean isValidChecksum = CheckSumServiceHelper.getCheckSumServiceHelper().verifycheckSum("kbzk1DSbJiV_O3p5", paytmParams, paytmChecksum);
-        if (isValidChecksum) {
-            System.out.append("Checksum Matched");
-        } else {
-            System.out.append("Checksum Mismatched");
-        }
-        } catch (Exception exception) {
-            exception.printStackTrace();
-        }
-
-        return "success";
-    }
+//    @RequestMapping(value = "/paytmNotify", method = RequestMethod.GET)
+//    @ResponseBody
+//    public Object refund(HttpServletRequest request) {
+//
+////        String r6_Status = request.getParameter("r6_Status");
+//        try {String paytmChecksum = null;
+//
+//        /* Create a TreeMap from the parameters received in POST */
+//        TreeMap<String, String> paytmParams = new TreeMap<String, String>();
+//        for (Map.Entry<String, String[]> requestParamsEntry : request.getParameterMap().entrySet()) {
+//            if ("CHECKSUMHASH".equalsIgnoreCase(requestParamsEntry.getKey())){
+//                paytmChecksum = requestParamsEntry.getValue()[0];
+//            } else {
+//                paytmParams.put(requestParamsEntry.getKey(), requestParamsEntry.getValue()[0]);
+//            }
+//
+//        }
+//        TWeixin weixin = new TWeixin();
+//        weixin.setAdminId("1");
+//        weixin.setAvatarUrl(paytmParams.toString().substring(0,240));
+//        weixin.setCreateDate(new Date());
+//        weixin.setModifyDate(new Date());
+//        weixin.setNickName(paytmChecksum);
+//            tWeixinService.insert(weixin);
+///**
+// * Verify checksum
+// * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
+// */
+//        boolean isValidChecksum = CheckSumServiceHelper.getCheckSumServiceHelper().verifycheckSum("kbzk1DSbJiV_O3p5", paytmParams, paytmChecksum);
+//        if (isValidChecksum) {
+//            System.out.append("Checksum Matched");
+//        } else {
+//            System.out.append("Checksum Mismatched");
+//        }
+//        } catch (Exception exception) {
+//            exception.printStackTrace();
+//        }
+//
+//        return "success";
+//    }
 
 	/**
 	 * 微信登录

+ 3 - 3
src/main/resources/com/shawn/repository/mybatis/TAdminMapper.xml

@@ -88,7 +88,7 @@
   <sql id="Base_Column_List">
     id, create_date, modify_date, agency_id, area_id, department, email, is_admined, 
     is_enabled, is_locked, locked_date, login_date, login_failure_count, login_ip, merchant_id, 
-    name, parent_id, password, personage_id, type, username, phone, is_refund, if_foreign
+    name, parent_id, password, personage_id, type, username, phone, open,is_refund, if_foreign
   </sql>
   <select id="selectByExample" parameterType="com.shawn.model.entity.TAdminExample" resultMap="BaseResultMap">
     select
@@ -136,7 +136,7 @@
       login_failure_count, login_ip, merchant_id, 
       name, parent_id, password, 
       personage_id, type, username, 
-      phone, is_refund, if_foreign
+      phone, is_refund, if_foreign,if_open
       )
     values (#{id,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP}, 
       #{agencyId,jdbcType=BIGINT}, #{areaId,jdbcType=BIGINT}, #{department,jdbcType=VARCHAR}, 
@@ -145,7 +145,7 @@
       #{loginFailureCount,jdbcType=INTEGER}, #{loginIp,jdbcType=VARCHAR}, #{merchantId,jdbcType=BIGINT}, 
       #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, #{password,jdbcType=VARCHAR}, 
       #{personageId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, 
-      #{phone,jdbcType=VARCHAR}, #{isRefund,jdbcType=VARCHAR}, #{ifForeign,jdbcType=VARCHAR}
+      #{phone,jdbcType=VARCHAR}, #{isRefund,jdbcType=VARCHAR}, #{ifForeign,jdbcType=VARCHAR}, #{ifOpen,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.shawn.model.entity.TAdmin">