dev-discount
袁野 4 years ago
commit 86995339dd
  1. 2
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 85
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  3. 102
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  4. 2
      hai-cweb/src/main/resources/dev/config.properties
  5. BIN
      hai-cweb/src/main/resources/privatekey/apiclient_cert.p12
  6. 23
      hai-cweb/src/main/resources/privatekey/apiclient_cert.pem
  7. 28
      hai-cweb/src/main/resources/privatekey/apiclient_key.pem
  8. 5
      hai-service/pom.xml
  9. 39
      hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java
  10. 3
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -105,6 +105,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/sms/sendSmsCode")
.excludePathPatterns("/sms/getSmsCode")
.excludePathPatterns("/user/login")
.excludePathPatterns("/user/getUnionId")
.excludePathPatterns("/order/orderToH5Pay")
.excludePathPatterns("/wechat/*")
;
}

@ -8,6 +8,9 @@ import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SessionKeyCache;
import com.cweb.config.SysConst;
import com.cweb.config.WxMaConfiguration;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -35,10 +38,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.*;
@Controller
@RequestMapping(value = "/wechat")
@ -68,7 +68,7 @@ public class WechatController {
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaJscode2SessionResult session = wxService.jsCode2SessionInfo(code);
//保存小程序用户登录的openId及sessionKey信息
SessionKeyCache.setData(session.getOpenid(), session.getSessionKey(), -1);
SessionKeyCache.setData(session.getOpenid(), session, -1);
JSONObject jo = new JSONObject();
jo.put("openId", session.getOpenid());
return ResponseMsgUtil.success(jo);
@ -126,11 +126,11 @@ public class WechatController {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
String sessionKey = SessionKeyCache.getData(openId);
WxMaJscode2SessionResult session = SessionKeyCache.getData(openId);
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(sessionKey, encryptedData, iv);
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
@ -170,18 +170,22 @@ public class WechatController {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
String sessionKey = SessionKeyCache.getData(openId);
WxMaJscode2SessionResult session = SessionKeyCache.getData(openId);
System.out.println(JSONObject.toJSONString(session));
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(session.getSessionKey(), encryptedData, iv);
WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey, encryptedData, iv);
if (userInfo == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
HighUser user = highUserService.findByUnionId(userInfo.getUnionId());
if (StringUtils.isBlank(session.getUnionid())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "获取UnionId失败");
}
HighUser user = highUserService.findByOpenId(session.getOpenid());
if (user == null) {
user = new HighUser();
user.setUnionId(userInfo.getUnionId());
user.setUnionId(session.getUnionid());
user.setOpenId(openId);
user.setRegTime(new Date());
user.setStatus(1);
@ -190,8 +194,10 @@ public class WechatController {
user.setName(userInfo.getNickName());
highUserService.insertUser(user);
} else {
user.setUnionId(session.getUnionid());
user.setHeaderImg(userInfo.getAvatarUrl());
user.setName(userInfo.getNickName());
user.setOpenId(userInfo.getOpenId());
highUserService.updateUser(user);
}
@ -200,7 +206,7 @@ public class WechatController {
user.setPassword(null);
highUserModel.setHighUser(user);
SessionObject so = new SessionObject(userInfo.getUnionId(), 1 , highUserModel);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
@ -283,11 +289,13 @@ public class WechatController {
params.put("openid", openid);
params.put("lang", "zh_CN");
JSONObject userInfo = HttpsUtils.doGet("https://api.weixin.qq.com/sns/userinfo", params);
System.out.println(userInfo.toJSONString());
if (StringUtils.isNotBlank(userInfo.getString("errcode"))) {
log.error("getH5UserInfo error!", "获取微信用户信息失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信用户信息失败");
}
if (StringUtils.isBlank(userInfo.getString("unionid"))) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "获取UnionId失败");
}
HighUser user = highUserService.findByUnionId(userInfo.getString("unionid"));
if (user == null) {
@ -301,6 +309,7 @@ public class WechatController {
user.setName(userInfo.getString("nickname"));
highUserService.insertUser(user);
} else {
user.setOpenIdH5(openid);
user.setHeaderImg(userInfo.getString("headimgurl"));
user.setName(userInfo.getString("nickname"));
highUserService.updateUser(user);
@ -320,4 +329,54 @@ public class WechatController {
}
@RequestMapping(value = "/getUnionId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "刷取unionid")
public ResponseData getUnionId(HttpServletRequest request, HttpServletResponse response) {
try {
// 获取access_token
Map<String, Object> params = new HashMap<>();
params.put("appid", SysConst.getSysConfig().getWxAppId());
params.put("secret", SysConst.getSysConfig().getWxAppSecret());
params.put("grant_type", "client_credential");
JSONObject jsonObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params);
System.out.println(jsonObject.toJSONString());
String accessToken = jsonObject.getString("access_token");
if (StringUtils.isBlank(accessToken)) {
log.error("getH5UserInfo error!", "获取微信access_token失败" );
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败");
}
params.clear();
List<Map<String,Object>> userMapList = new ArrayList<>();
Map<String,Object> userMap;
int pageNum = 1;
while (true) {
userMapList.clear();;
PageHelper.startPage(pageNum, 100);
PageInfo<HighUser> pageInfo = new PageInfo<>(highUserService.getListUser(new HashMap<>()));
if (pageInfo.getList().size() > 0) {
for (HighUser user : pageInfo.getList()) {
userMap = new HashMap<>();
userMap.put("openid", user.getOpenId());
userMap.put("lang", "zh_CN");
userMapList.add(userMap);
}
params.put("user_list", userMapList);
System.out.println(JSONObject.toJSONString(params));
JSONObject userInfo = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=" + accessToken, JSONObject.toJSONString(params));
System.out.println(userInfo.toJSONString());
}
pageNum++;
break;
}
return ResponseMsgUtil.success("处理成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,6 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.exception.ErrorCode;
@ -9,8 +10,10 @@ import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.OrderType;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.Base64Util;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.MathUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder;
@ -21,9 +24,21 @@ import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCouponService;
import com.hai.service.HighOrderService;
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,10 +50,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
/**
@ -207,4 +223,84 @@ public class OrderController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderToH5Pay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "H5订单下单")
public ResponseData orderToH5Pay(@RequestBody String reqBodyStr) {
try {
/* if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
if ( orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}*/
Map<String,Object> param = new HashMap<>();
param.put("appid", SysConst.getSysConfig().getWxMchAppId());
param.put("mchid", SysConst.getSysConfig().getWxSubMchId());
param.put("description", "购买商品");
param.put("out_trade_no", String.valueOf(new Date().getTime()));
param.put("notify_url", SysConst.getSysConfig().getNotifyUrl());
Map<String,Object> amountMap = new HashMap<>();
amountMap.put("total", 1);
param.put("amount", amountMap);
Map<String,Object> sceneInfoMap = new HashMap<>();
sceneInfoMap.put("payer_client_ip", "127.0.0.1");
Map<String,Object> h5InfoMap = new HashMap<>();
h5InfoMap.put("type", "Wap");
sceneInfoMap.put("h5_info", h5InfoMap);
param.put("scene_info", sceneInfoMap);
Map<String,Object> header = new HashMap<>();
String post = getToken("POST", "/v3/pay/transactions/h5", JSONObject.toJSONString(param));
header.put("Accept","application/json");
header.put("Authorization", "WECHATPAY2-SHA256-RSA2048 " + post);
JSONObject object = HttpsUtils.doPost("https://api.mch.weixin.qq.com/v3/pay/transactions/h5", param, header);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
String getToken(String method, String url, String body) throws UnsupportedEncodingException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException {
long timeMillis = System.currentTimeMillis();
String nonceStr = String.valueOf(timeMillis);
long timestamp = System.currentTimeMillis() / 1000;
String message = buildMessage(method, url, timestamp, nonceStr, body);
PrivateKey privateKey = PemUtil.loadPrivateKey(new FileInputStream("G:/hurui-project/hai-parent/hai-cweb/src/main/resources/privatekey/apiclient_key.pem"));
String signature = sign(privateKey,message.getBytes("utf-8"));
return "mchid=\"" + SysConst.getSysConfig().getWxSubMchId() + "\","
+ "nonce_str=\"" + nonceStr + "\","
+ "timestamp=\"" + timestamp + "\","
+ "serial_no=\"" + "1B08DC2A078B0B1F77A65C97C445AAD545B5EAA6" + "\","
+ "signature=\"" + signature + "\"";
}
String sign(PrivateKey privateKey,byte[] message) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(privateKey);
sign.update(message);
return Base64.getEncoder().encodeToString(sign.sign());
}
String buildMessage(String method, String url, long timestamp, String nonceStr, String body) {
return method + "\n"
+ url + "\n"
+ timestamp + "\n"
+ nonceStr + "\n"
+ body + "\n";
}
}

@ -9,7 +9,7 @@ wxApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5
wxMchAppId=wx637bd6f7314daa46
wxMchId=1289663601
wxSubAppId=wx8d49e2f83025229d
wxSubMchId=1603942866
wxSubMchId=1609882817
wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder
notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID3TCCAsWgAwIBAgIUGwjcKgeLCx93plyXxEWq1UW16qYwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjEwNTMwMTMwNTM1WhcNMjYwNTI5MTMwNTM1WjBvMRMwEQYDVQQDDAox
NjA5ODgyODE3MRswGQYDVQQKDBLlvq7kv6HllYbmiLfns7vnu58xGzAZBgNVBAsM
EuS4quS9k+aIt+m7juadqOePjTELMAkGA1UEBgwCQ04xETAPBgNVBAcMCFNoZW5a
aGVuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyofjHIn+PWAwM9Z
2/uv8hyRCP+nh8YcylUrRsgQtjoKi1HbRtj9AAwo0eBKgFZ3IviM2+4kQRctcN76
cGBVGJh8Pvz7MreZgqTLPVHDLz5aVuyc7gzjCQ9o4B5pRjCdR3ORQuK1E+F65IGK
Ez2CjuVnZ+hGvsKhP2NExdhJ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JYaHVqngcYqI12UdJ5YyDtp+YJTt
3e9/l/IOP2s3TvkLL4Vb0hZ8dvzUhwb6F0zLpzJq+bjDUKD0OLVD4kmJumFbFaeU
Kt9Mg1qg5p6Ukw6i5l+HFkzgKA2TkjVV2bMieFEEfwKBgHAxLffRyMer0vEzs7iq
Sm05FVoURm9wqeM0SCpXtXOtuXiDoxtw8jSCh/mXTiKAgEx3K/KO4fiBB5tCQKzA
TYcP72Jmqvuc4d/5FFH2sKuCiJ5s/XAlGo2zGSDbbkV7KJnRxOtYptW3Zt1VBQG1
ECOoJd0HryxcP3qSddJHPMV9
-----END PRIVATE KEY-----

@ -298,6 +298,11 @@
<version>1.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-apache-httpclient</artifactId>
<version>0.2.2</version>
</dependency>
</dependencies>
</project>

@ -338,6 +338,45 @@ public class HttpsUtils {
return null;
}
public static JSONObject doWxH5PayPost(String apiUrl, Map<String,Object> body, Map<String,Object> header) {
CloseableHttpClient httpClient = null;
if (apiUrl.startsWith("https")) {
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory())
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build();
} else {
httpClient = HttpClients.createDefault();
}
String httpStr = null;
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(apiUrl);
httpPost.setConfig(requestConfig);
for (Map.Entry<String, Object> entry : header.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue().toString());
}
StringEntity stringEntity = new StringEntity(body.get("from").toString());// 解决中文乱码问题
stringEntity.setContentEncoding("UTF-8");
stringEntity.setContentType("application/x-www-form-urlencoded");
httpPost.setEntity(stringEntity);
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
httpStr = EntityUtils.toString(entity, "UTF-8");
return JSON.parseObject(httpStr);
} catch (Exception e) {
log.error(e.getMessage(),e);
} finally {
if (response != null) {
try {
EntityUtils.consume(response.getEntity());
} catch (IOException e) {
log.error(e.getMessage(),e);
}
}
}
return null;
}
/**
* 发送 POST 请求JSON形式
*

@ -112,7 +112,7 @@ public class HighUserServiceImpl implements HighUserService {
if (highUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户");
}
if (StringUtils.isBlank(highUser.getPhone())) {
if (StringUtils.isNotBlank(highUser.getPhone())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定手机号,请勿重复绑定");
}
@ -125,6 +125,7 @@ public class HighUserServiceImpl implements HighUserService {
highUser.setStatus(0);
highUserMapper.updateByPrimaryKey(highUser);
user.setGold(user.getGold() + highUser.getGold());
user.setHeaderImg(highUser.getHeaderImg());
user.setName(highUser.getName());
user.setOpenId(highUser.getOpenId());

Loading…
Cancel
Save