|
@@ -36,7 +36,8 @@ public class WxPayServiceImpl implements WxPayService {
|
|
public static final String PALMPAY_APPID = "";
|
|
public static final String PALMPAY_APPID = "";
|
|
public static final String PALMPAY_APPKEY = "";
|
|
public static final String PALMPAY_APPKEY = "";
|
|
public static final String PALMPAY_MCHID = "";
|
|
public static final String PALMPAY_MCHID = "";
|
|
- public static final String PALMPAY_URL = "https://pay.palmpay.cn/sdkServer/thirdpays/pay/WECHAT_SUB";
|
|
|
|
|
|
+// public static final String PALMPAY_URL = "https://pay.palmpay.cn/sdkServer/thirdpays/pay/WECHAT_SUB";
|
|
|
|
+ public static final String PALMPAY_URL = "http://101.200.72.53:18085/sdkServer/thirdpays/pay/WECHAT_SUB";
|
|
@Autowired
|
|
@Autowired
|
|
private GoodsMapper goodsMapper;
|
|
private GoodsMapper goodsMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -86,8 +87,8 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
|
|
|
Integer ophostId = adminConfig.getOphostId();
|
|
Integer ophostId = adminConfig.getOphostId();
|
|
Ophost ophost = ophostMapper.selectByPrimaryKey(ophostId);
|
|
Ophost ophost = ophostMapper.selectByPrimaryKey(ophostId);
|
|
- Config url_pay = configMapper.selectByName("url_pay");
|
|
|
|
- String url = "http://" + url_pay.getValue();
|
|
|
|
|
|
+// Config url_pay = configMapper.selectByName("url_pay");
|
|
|
|
+ String url = "http://" + wxpay.getPayHost();
|
|
AdminExtend adminExtend = adminExtendMapper.selectByPrimaryKey(channelId);
|
|
AdminExtend adminExtend = adminExtendMapper.selectByPrimaryKey(channelId);
|
|
//todo 入库
|
|
//todo 入库
|
|
long orderid = TimeUnit.NANOSECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS) + wxPayRequest.getUserId();
|
|
long orderid = TimeUnit.NANOSECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS) + wxPayRequest.getUserId();
|
|
@@ -150,8 +151,8 @@ public class WxPayServiceImpl implements WxPayService {
|
|
WxPayInfo wxPayInfo = new WxPayInfo();
|
|
WxPayInfo wxPayInfo = new WxPayInfo();
|
|
wxPayInfo.setUserId(userByUserId.getId() + "");
|
|
wxPayInfo.setUserId(userByUserId.getId() + "");
|
|
wxPayInfo.setOrderId(String.valueOf(order.getId()));
|
|
wxPayInfo.setOrderId(String.valueOf(order.getId()));
|
|
- if (StringUtils.isNotEmpty(wxpay.getAppid()) || StringUtils.isNotEmpty(wxPayRequest.getOpenid())) {
|
|
|
|
- map.put("subAppid", wxpay.getAppid());
|
|
|
|
|
|
+ if ( StringUtils.isNotEmpty(wxPayRequest.getOpenid())) {
|
|
|
|
+ map.put("subAppid", wxpay.getAppid()==null?"":wxpay.getAppid());
|
|
map.put("openid", wxPayRequest.getOpenid());
|
|
map.put("openid", wxPayRequest.getOpenid());
|
|
|
|
|
|
String result = HTTPSUtil.sendGetByHttps(PALMPAY_URL, map);
|
|
String result = HTTPSUtil.sendGetByHttps(PALMPAY_URL, map);
|
|
@@ -208,27 +209,29 @@ public class WxPayServiceImpl implements WxPayService {
|
|
String openid = map.get("openid");
|
|
String openid = map.get("openid");
|
|
String timeEnd = map.get("timeEnd");
|
|
String timeEnd = map.get("timeEnd");
|
|
if ("success".equals(status)) {
|
|
if ("success".equals(status)) {
|
|
- Integer id = Integer.valueOf(outTradeNo.substring(8, outTradeNo.length()));
|
|
|
|
|
|
+ Integer id = Integer.valueOf(outTradeNo.substring(14, outTradeNo.length()));
|
|
|
|
+ log.info("订单号:" + id);
|
|
Orders order = ordersMapper.selectByPrimaryKey(id);
|
|
Orders order = ordersMapper.selectByPrimaryKey(id);
|
|
if (order == null) {
|
|
if (order == null) {
|
|
log.error("订单不存在");
|
|
log.error("订单不存在");
|
|
return "error";
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
+
|
|
if (!"1".equals(order.getState())) {
|
|
if (!"1".equals(order.getState())) {
|
|
Orders orders = new Orders();
|
|
Orders orders = new Orders();
|
|
orders.setId(id);
|
|
orders.setId(id);
|
|
orders.setOutTradeNo(outTradeNo);
|
|
orders.setOutTradeNo(outTradeNo);
|
|
- orders.setState(1);
|
|
|
|
|
|
+ orders.setState("1");
|
|
orders.setPdorderid(pdorderid);
|
|
orders.setPdorderid(pdorderid);
|
|
orders.setTransactionId(chorderid);
|
|
orders.setTransactionId(chorderid);
|
|
orders.setUpdatetime(DateUtils.getNow());
|
|
orders.setUpdatetime(DateUtils.getNow());
|
|
orders.setFinishtime(DateUtils.getNow());
|
|
orders.setFinishtime(DateUtils.getNow());
|
|
ordersMapper.updateByPrimaryKeySelective(orders);
|
|
ordersMapper.updateByPrimaryKeySelective(orders);
|
|
bookService.insertKandian(order.getUserId(), "1", order.getKandian(), order.getFreeKandian());
|
|
bookService.insertKandian(order.getUserId(), "1", order.getKandian(), order.getFreeKandian());
|
|
|
|
+ cacheService.updateUserByIdCache(order.getUserId());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- cacheService.updateUserByIdCache(order.getUserId());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
return "success";
|
|
return "success";
|
|
@@ -314,5 +317,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
WxPayInfo wxPayInfo = new WxPayInfo();
|
|
WxPayInfo wxPayInfo = new WxPayInfo();
|
|
wxPayInfo.setPayInfo(map1);
|
|
wxPayInfo.setPayInfo(map1);
|
|
System.out.println(JsonUtils.toJsonStr(wxPayInfo));
|
|
System.out.println(JsonUtils.toJsonStr(wxPayInfo));
|
|
|
|
+ String s = "202109091408295802";
|
|
|
|
+ System.out.println(s.substring(14));
|
|
}
|
|
}
|
|
}
|
|
}
|