|
@@ -53,11 +53,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
@Autowired
|
|
@Autowired
|
|
private CallApiLogService callApiLogService;
|
|
private CallApiLogService callApiLogService;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public boolean add(Order order) {
|
|
public boolean add(Order order) {
|
|
- order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
- //调用卡充值api
|
|
|
|
- return this.save(order);
|
|
|
|
|
|
+ order.setOrderFlag(OrderStatus.NO_PAYMENT.getCode());
|
|
|
|
+ this.save(order);
|
|
|
|
+ callCardTopApi(order);
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -157,18 +160,27 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean callCardTopApi(Order order) {
|
|
|
|
|
|
+ public void callCardTopApi(Order order) {
|
|
//TODO 等待测试接口,url,请求,响应需要替换
|
|
//TODO 等待测试接口,url,请求,响应需要替换
|
|
boolean b = false;
|
|
boolean b = false;
|
|
try {
|
|
try {
|
|
String param = "";
|
|
String param = "";
|
|
String result = "";
|
|
String result = "";
|
|
|
|
+ b = true;
|
|
callApiLogService.add(order.getOrderNumber(),CARD_TOP,TopApi.DEAL_SELECT_URL,JSONObject.toJSONString(param),result);
|
|
callApiLogService.add(order.getOrderNumber(),CARD_TOP,TopApi.DEAL_SELECT_URL,JSONObject.toJSONString(param),result);
|
|
- return false;
|
|
|
|
|
|
+ if (b){
|
|
|
|
+ //成功修改状态成功
|
|
|
|
+ order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
+ this.updateById(order);
|
|
|
|
+ }else {
|
|
|
|
+ //失败修改状态为卡充值失败
|
|
|
|
+ order.setOrderFlag(OrderStatus.PAYMENT_ERROR_DEBIT.getCode());
|
|
|
|
+ this.updateById(order);
|
|
|
|
+ }
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error("---order---卡充值api调用异常"+ e.getMessage());
|
|
log.error("---order---卡充值api调用异常"+ e.getMessage());
|
|
|
|
+ throw new CustomException("卡充值异常"+e.getMessage());
|
|
}
|
|
}
|
|
- return b;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -212,16 +224,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
boolean b = isCheckOrder(order.getOrderNumber());
|
|
boolean b = isCheckOrder(order.getOrderNumber());
|
|
if (b){
|
|
if (b){
|
|
//调用卡充值api
|
|
//调用卡充值api
|
|
- b = callCardTopApi(order);
|
|
|
|
- if (b){
|
|
|
|
- //成功修改状态成功
|
|
|
|
- order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
- this.updateById(order);
|
|
|
|
- }else {
|
|
|
|
- //失败修改状态为卡充值失败
|
|
|
|
- order.setOrderFlag(OrderStatus.PAYMENT_ERROR_DEBIT.getCode());
|
|
|
|
- this.updateById(order);
|
|
|
|
- }
|
|
|
|
|
|
+ callCardTopApi(order);
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error("---order---修改数据库失败"+e.getMessage());
|
|
log.error("---order---修改数据库失败"+e.getMessage());
|