记得上下班打卡 | git大法好,push需谨慎

Commit c925b957 authored by anjiabin's avatar anjiabin

修改订单创建逻辑

parent 1985b78f
......@@ -22,4 +22,5 @@ public class DragonPayOrderQueryRespDto {
private String orderCode;
private BigDecimal price;
private String paymentType;
private String paymentAt;
}
......@@ -13,4 +13,5 @@ public class PayNotifyDto {
private String orderCode;
private BigDecimal price;
private String paymentType;
private String paymentAt;
}
......@@ -2,7 +2,9 @@ package com.liquidnet.service.dragon.channel.strategy.biz;
import com.alibaba.fastjson.JSON;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.dragon.bo.PayNotifyReqBo;
import com.liquidnet.service.dragon.constant.DragonConstant;
......@@ -148,6 +150,11 @@ public class DragonPayBiz {
payNotifyDto.setOrderCode(dragonOrdersDto.getOrderCode());
payNotifyDto.setPrice(dragonOrdersDto.getPrice());
payNotifyDto.setPaymentType(dragonOrdersDto.getPaymentType());
if(StringUtil.isNotNull(dragonOrdersDto.getPaymentAt())){
payNotifyDto.setPaymentAt(DateUtil.Formatter.yyyyMMddHHmmss.format(dragonOrdersDto.getPaymentAt()));
}else{
payNotifyDto.setPaymentAt("");
}
payNotifyReqBo.setPayNotifyDto(payNotifyDto);
return payNotifyReqBo;
}
......@@ -265,7 +272,7 @@ public class DragonPayBiz {
// e.printStackTrace();
// }
// }
public void sendNotify(PayNotifyReqBo payNotifyReqBo){
public boolean sendNotify(PayNotifyReqBo payNotifyReqBo){
PayNotifyDto payNotifyDto = payNotifyReqBo.getPayNotifyDto();
LocalDateTime nowTime = LocalDateTime.now();
CloseableHttpClient httpclient = HttpClients.createDefault();
......@@ -287,6 +294,7 @@ public class DragonPayBiz {
nvps.add(new BasicNameValuePair("orderCode", payNotifyDto.getOrderCode()));
nvps.add(new BasicNameValuePair("price", payNotifyDto.getPrice().toString()));
nvps.add(new BasicNameValuePair("paymentType", payNotifyDto.getPaymentType()));
nvps.add(new BasicNameValuePair("paymentAt", payNotifyDto.getPaymentAt()));
jsonData = JSON.toJSONString(nvps);
log.info("dragon:notify:post url:{}",payNotifyReqBo.getNotifyUrl());
log.info("dragon:notify:post data:{}",jsonData);
......@@ -300,10 +308,12 @@ public class DragonPayBiz {
this.createDragonPayNotify(payNotifyReqBo,jsonData);
//更新通知状态-通知成功
this.updateNotifyStatus(payNotifyDto.getCode(),Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_SUCCESS.getCode()));
return true;
} else {
this.createDragonPayNotifyFail(payNotifyReqBo,jsonData);
//更新通知状态-通知失败
this.updateNotifyStatus(payNotifyDto.getCode(),Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_FAIL.getCode()));
return false;
}
} catch (ConnectTimeoutException e) {
......@@ -311,13 +321,13 @@ public class DragonPayBiz {
this.createDragonPayNotifyFail(payNotifyReqBo,jsonData);
//更新通知状态-通知失败
this.updateNotifyStatus(payNotifyDto.getCode(),Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_EXPIRE.getCode()));
return false;
} catch (Exception e) {
log.error("dragon:sendNotify 请求失败",e);
this.createDragonPayNotifyFail(payNotifyReqBo,jsonData);
//更新通知状态-通知失败
this.updateNotifyStatus(payNotifyDto.getCode(),Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_FAIL.getCode()));
return false;
}finally {
//释放连接
try {
......
package com.liquidnet.service.dragon.service.impl;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
......@@ -65,6 +66,11 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
queryRespDto.setOrderCode(ordersDto.getOrderCode());
queryRespDto.setPrice(ordersDto.getPrice());
queryRespDto.setPaymentType(ordersDto.getPaymentType());
if(StringUtil.isNotNull(ordersDto.getPaymentAt())){
queryRespDto.setPaymentAt(DateUtil.Formatter.yyyyMMddHHmmss.format(ordersDto.getPaymentAt()));
}else{
queryRespDto.setPaymentAt("");
}
return queryRespDto;
}
//如果未支付进行三方查询
......
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