|
@@ -79,9 +79,18 @@ public class JhService {
|
|
|
String businessType = request.getParameter("businessType");
|
|
|
Attach atchMap = new Attach();
|
|
|
atchMap.setC(c).setB(businessId).setA(a);
|
|
|
+ String attchStr = JSONUtil.toJsonStr(atchMap);
|
|
|
+ TbOrder dbOrder = tbOrderService.find30Seconds(attchStr, LocalDateTime.now().minusSeconds(30).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
+ if (dbOrder!=null&&!StrUtil.equals(dbOrder.getOpenid(),openid)){
|
|
|
+ throw new Exception("其他人正在付款....");
|
|
|
+ }
|
|
|
+ TbOrder successOrder=tbOrderService.findSuccessOrder(attchStr);
|
|
|
+ if (successOrder!=null){
|
|
|
+ throw new Exception("业务订单已支付....");
|
|
|
+ }
|
|
|
String out_trade_no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(6);
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
- // params.put("attach", JSONUtil.toJsonStr(atchMap));
|
|
|
+ // params.put("attach", JSONUtil.toJsonStr(atchMap));
|
|
|
params.put("productType", jhConfig.getProductType());
|
|
|
params.put("businessMerchantNo", jhConfig.getBusinessMerchantNo());
|
|
|
params.put("openId", openid);
|
|
@@ -115,7 +124,7 @@ public class JhService {
|
|
|
|
|
|
object.set("outTradeNo", out_trade_no);
|
|
|
TbOrder tbOrder = new TbOrder();
|
|
|
- tbOrder.setAttach(JSONUtil.toJsonStr(atchMap))
|
|
|
+ tbOrder.setAttach(attchStr)
|
|
|
.setOpenid(openid)
|
|
|
.setOrderTime(new Date())
|
|
|
.setOutTradeNo(out_trade_no).setPrice(money);
|
|
@@ -124,15 +133,15 @@ public class JhService {
|
|
|
return BeanUtil.beanToMap(object);
|
|
|
}
|
|
|
throw new Exception("生成订单失败");
|
|
|
- // return new HashMap<>();
|
|
|
+ // return new HashMap<>();
|
|
|
}
|
|
|
|
|
|
- private String handlerDesc(String desc){
|
|
|
- if (StrUtil.isEmpty(desc)){
|
|
|
+ private String handlerDesc(String desc) {
|
|
|
+ if (StrUtil.isEmpty(desc)) {
|
|
|
return "";
|
|
|
}
|
|
|
- if (desc.getBytes(Charset.forName("utf-8")).length>128){
|
|
|
- desc=StrUtil.sub(desc,0,desc.lastIndexOf("-"));
|
|
|
+ if (desc.getBytes(Charset.forName("utf-8")).length > 128) {
|
|
|
+ desc = StrUtil.sub(desc, 0, desc.lastIndexOf("-"));
|
|
|
handlerDesc(desc);
|
|
|
}
|
|
|
return desc;
|
|
@@ -160,7 +169,7 @@ public class JhService {
|
|
|
public void notifyResult(JhNotifyBO bo) {
|
|
|
String orderStatus = bo.getTradeStatus();
|
|
|
if (!"SUCCESS".equals(orderStatus) && !"FINISH".equals(orderStatus)) {
|
|
|
- log.error("支付订单回调失败:{}",JSONUtil.toJsonStr(bo));
|
|
|
+ log.error("支付订单回调失败:{}", JSONUtil.toJsonStr(bo));
|
|
|
return;
|
|
|
}
|
|
|
NotifyBO notifyBO = new NotifyBO();
|