Commit b18bf5ae authored by cy's avatar cy

代码优化

parent f00027b1
......@@ -208,7 +208,6 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (null == firstRule) {
return R.error("无体育本科录取规则!");
}
//获取体育专科一批录取规则
AdmissionRule secondRule = admissionRuleMapper.getByType(SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
if (null == secondRule) {
......
......@@ -38,25 +38,25 @@ public class Common {
/***
* 支付宝--回调地址
*/
//测试服务器
public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/aliPayCallBack.do";
//测试
//public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/aliPayCallBack.do";
//线上
//public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/aliPayCallBack.do";
public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/aliPayCallBack.do";
/***
* 支付宝--pc端支付成功跳转地址
*/
//测试服务器
public static final String RETURN_URL_PC = "http://111.203.232.171:8999/#/wallet";
//测试
//public static final String RETURN_URL_PC = "http://111.203.232.171:8999/#/wallet";
//线上
//public static final String RETURN_URL_PC = "https://jygkzy.com/#/wallet";
public static final String RETURN_URL_PC = "https://jygkzy.com/#/wallet";
/***
* 支付宝--手机网页支付成功跳转地址
*/
//测试服务器
public static final String RETURN_URL_WAP = "http://111.203.232.171:8999/#/history";
//测试
//public static final String RETURN_URL_WAP = "http://111.203.232.171:8999/#/history";
//线上
//public static final String RETURN_URL_WAP = "https://jygkzy.com/#/history";
public static final String RETURN_URL_WAP = "https://jygkzy.com/#/history";
/**
......
package cn.wisenergy.service.util;
import cn.wisenergy.model.dto.PayPageDto;
import cn.wisenergy.service.wxpay.WxCommon;
import com.alibaba.fastjson.JSONObject;
import okhttp3.HttpUrl;
import java.io.UnsupportedEncodingException;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
import java.util.UUID;
/**
* @author 86187
*/
public class SignDemo {
public static String getToken(String method, HttpUrl url, String body,String nonceStr,long timestamp) throws UnsupportedEncodingException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException {
String message = buildMessage(method, url, timestamp, nonceStr, body);
String signature = sign(message.getBytes("utf-8"));
return "mchid=\"" + WxCommon.MCHID + "\","
+ "nonce_str=\"" + nonceStr + "\","
+ "timestamp=\"" + timestamp + "\","
+ "serial_no=\"" + WxCommon.SERIAL_NO + "\","
+ "signature=\"" + signature + "\"";
}
public static String sign(byte[] message) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, InvalidKeySpecException {
Signature sign = Signature.getInstance("SHA256withRSA");
KeyFactory factory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = factory.generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(WxCommon.SECRET_KEY)));
sign.initSign(privateKey);
sign.update(message);
return Base64.getEncoder().encodeToString(sign.sign());
}
public static String buildMessage(String method, HttpUrl url, long timestamp, String nonceStr, String body) {
String canonicalUrl = url.encodedPath();
if (url.encodedQuery() != null) {
canonicalUrl += "?" + url.encodedQuery();
}
return method + "\n"
+ canonicalUrl + "\n"
+ timestamp + "\n"
+ nonceStr + "\n"
+ body + "\n";
}
// public static void main(String[] args) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, UnsupportedEncodingException, InvalidKeySpecException {
// String method = "POST";
// HttpUrl httpurl = HttpUrl.parse("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi");
// long timestamp = System.currentTimeMillis() / 1000;
// String nonceStr = UUID.randomUUID().toString().replace("-", "");
// String url = "v3/pay/transactions/native";
// String tradeNo = "21" + System.currentTimeMillis();
// PayPageDto payPageDto = new PayPageDto();
// payPageDto.setTotal(100);
//
// //构造签名body
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("appid", WxCommon.APP_ID);
// jsonObject.put("mchid", WxCommon.MCHID);
// jsonObject.put("timestamp", timestamp);
// jsonObject.put("nonce_str", nonceStr);
// jsonObject.put("url", url);
// jsonObject.put("method", method);
// jsonObject.put("description", "充值");
// jsonObject.put("out_trade_no", tradeNo);
// jsonObject.put("notify_url", WxCommon.NOTIFY_URL);
// jsonObject.put("amount", payPageDto);
// String sign = getToken(method, httpurl, jsonObject.toJSONString());
// System.out.println("签名:" + sign);
// }
}
......@@ -8,16 +8,10 @@ package cn.wisenergy.service.wxpay;
*/
public class WxCommon {
public static final String APP_ID = "wx7d8f4502a2bfa865";
public static final String MCHID = "1606042985";
//public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/wxPayCallBack.do";
public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/wxPayCallBack.do";
public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/wxPayCallBack.do";
//public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/wxPayCallBack.do";
public static final String WX_PAY_URL_pc = "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
public static final String WX_PAY_QUERY = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/";
public static final String SECRET_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhGq+iGQueP8EU" +
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.expection.BaseException;
import cn.wisenergy.common.utils.Md5Util;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.SchemeInfo;
import cn.wisenergy.model.vo.SchemeQueryVo;
......@@ -119,4 +120,46 @@ public class SchemeController {
return schemeService.ceishi(schemeId);
}
/* public static void main(String[] args) {
String[] phone=new String[33];
phone[0]="15965977067";
phone[1]="15965920796";
phone[2]="15965971937";
phone[3]="18315885088";
phone[4]="15965960118";
phone[5]="15969639057";
phone[6]="15965982318";
phone[7]="15998753136";
phone[8]="15953778757";
phone[9]="15865902595";
phone[10]="15964157072";
phone[11]="15969643706";
phone[12]="15965970182";
phone[13]="15965911269";
phone[14]="15969639822";
phone[15]="15965926106";
phone[16]="15965920057";
phone[17]="15965970832";
phone[18]="15969639228";
phone[19]="15965203196";
phone[20]="15965908178";
phone[21]="15998753006";
phone[22]="15953769708";
phone[23]="15953753868";
phone[24]="18765503766";
phone[25]="15969753628";
phone[26]="15964706698";
phone[27]="13853414102";
phone[28]="15998775876";
phone[29]="15998787387";
phone[30]="15953778857";
phone[31]="15953778586";
phone[32]="15053413643";
String pass;
for(int i=0 ;i<phone.length;i++){
pass=Md5Util.digestMD5("123456"+phone[i]);
System.out.println(phone[i]+":"+pass);
}
}*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment