update 支付 占桩订单 后面拼上时间戳

This commit is contained in:
2023-11-03 16:07:28 +08:00
parent b592371883
commit c3d3c9eb9b
3 changed files with 64 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.ScenarioEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.AdapayUtil;
import com.jsowell.common.util.DateUtils;
@@ -106,20 +107,27 @@ public class AdapayService {
}
String openId = memberBasicInfo.getOpenId();
// 支付场景
String type = dto.getType();
// 封装对象
String amount = AdapayUtil.formatAmount(dto.getPayAmount()); // 用户支付金额
// String payMode = Constants.ADAPAY_PAY_MODE_DELAY; // 汇付延时分账
String delayMode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
String payMode = MerchantDelayModeEnum.getAdapayPayMode(delayMode);
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
createAdaPaymentParam.setOrder_no(dto.getOrderCode() + "_" +DateUtils.dateTimeNow());
// 请求订单号
String orderNo = dto.getOrderCode();
if (ScenarioEnum.OCCUPY.getValue().equals(type)) {
orderNo = orderNo + "_" + DateUtils.dateTimeNow();
}
createAdaPaymentParam.setOrder_no(orderNo);
createAdaPaymentParam.setPay_amt(amount);
createAdaPaymentParam.setApp_id(config.getAdapayAppId());
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
createAdaPaymentParam.setGoods_title(dto.getGoodsTitle());
createAdaPaymentParam.setGoods_desc(dto.getGoodsDesc()); // 这个字段是微信支付凭证的商品名
Map<String, String> map = Maps.newHashMap();
map.put("type", dto.getType());
map.put("type", type);
map.put("orderCode", dto.getOrderCode());
map.put("payMode", payMode);
map.put("memberId", dto.getMemberId());
@@ -1131,4 +1139,42 @@ public class AdapayService {
} while (hasMore);
return resultList;
}
/**
* 查询支付列表
*/
public List<AdaPayment> queryPaymentByOrderNo(String orderNo) throws BaseAdaPayException {
List<AdaPayment> resultList = Lists.newArrayList();
String wechatAppId = "wxbb3e0d474569481d";
String appId = "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa";
int pageNum = 0; // 页面容量,取值范围 1~20默认值为 10
int pageSize = 20; // 页面容量,取值范围 1~20默认值为 10
boolean hasMore;
do {
pageNum += 1;
// 根据时间段查询支付对象列表
Map<String, Object> queryListParam = Maps.newHashMap();
queryListParam.put("app_id", appId);
queryListParam.put("page_index", pageNum);
queryListParam.put("page_size", pageSize);
queryListParam.put("order_no", orderNo);
System.out.println("查询支付对象列表请求参数:" + JSON.toJSONString(queryListParam));
Map<String, Object> paymentListResult = Payment.queryList(queryListParam, wechatAppId);
if (paymentListResult == null) {
break;
}
String jsonString = JSON.toJSONString(paymentListResult);
System.out.println("查询支付对象列表result" + jsonString);
JSONObject jsonObject = JSON.parseObject(jsonString);
List<AdaPayment> list = jsonObject.getList("payments", AdaPayment.class, JSONReader.Feature.FieldBased);
resultList.addAll(list);
hasMore = jsonObject.getBoolean("has_more");
} while (hasMore);
return resultList;
}
}

View File

@@ -2012,6 +2012,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
for (OrderBasicInfo orderBasicInfo : orderList) {
this.cleanCacheByOrderCode(orderBasicInfo.getOrderCode(), orderBasicInfo.getTransactionCode());
// 通过订单号查询汇付有没有支付单
}
}
return orderList.size();