|
@@ -21,8 +21,10 @@ import com.usky.dxtop.model.Order;
|
|
import com.usky.dxtop.service.CallApiLogService;
|
|
import com.usky.dxtop.service.CallApiLogService;
|
|
import com.usky.dxtop.service.OrderService;
|
|
import com.usky.dxtop.service.OrderService;
|
|
import com.usky.dxtop.service.api.TopApi;
|
|
import com.usky.dxtop.service.api.TopApi;
|
|
|
|
+import com.usky.dxtop.service.config.rabbitmq.charge.ChargeConsumeConfig;
|
|
import com.usky.dxtop.service.emun.OrderPayType;
|
|
import com.usky.dxtop.service.emun.OrderPayType;
|
|
import com.usky.dxtop.service.emun.OrderStatus;
|
|
import com.usky.dxtop.service.emun.OrderStatus;
|
|
|
|
+import com.usky.dxtop.service.vo.ChargeVO;
|
|
import com.usky.dxtop.service.vo.OrderExport;
|
|
import com.usky.dxtop.service.vo.OrderExport;
|
|
import com.usky.dxtop.service.vo.OrderReport;
|
|
import com.usky.dxtop.service.vo.OrderReport;
|
|
import com.usky.dxtop.service.vo.OrderRequest;
|
|
import com.usky.dxtop.service.vo.OrderRequest;
|
|
@@ -31,7 +33,9 @@ import ma.glasnost.orika.MapperFacade;
|
|
import ma.glasnost.orika.MapperFactory;
|
|
import ma.glasnost.orika.MapperFactory;
|
|
import ma.glasnost.orika.impl.DefaultMapperFactory;
|
|
import ma.glasnost.orika.impl.DefaultMapperFactory;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.FastByteArrayOutputStream;
|
|
import org.springframework.util.FastByteArrayOutputStream;
|
|
@@ -66,6 +70,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
@Autowired
|
|
@Autowired
|
|
private CallApiLogService callApiLogService;
|
|
private CallApiLogService callApiLogService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier(ChargeConsumeConfig.TEMPLATE)
|
|
|
|
+ private RabbitTemplate rabbitTemplate;
|
|
|
|
+
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
@@ -179,19 +187,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void callCardTopApi(Order order) {
|
|
public void callCardTopApi(Order order) {
|
|
- boolean b;
|
|
|
|
- String param = "";
|
|
|
|
- String result = "";
|
|
|
|
|
|
+ boolean b = true;
|
|
try {
|
|
try {
|
|
- b = true;
|
|
|
|
- //TODO 等待测试接口,url,请求,响应需要替换
|
|
|
|
|
|
+ ChargeVO chargeVo = new ChargeVO();
|
|
|
|
+ chargeVo.setSeq(order.getId());
|
|
|
|
+ chargeVo.setAmt(order.getMoney());
|
|
|
|
+ chargeVo.setCard("h");
|
|
|
|
+ chargeVo.setMob(order.getOrderNumber());
|
|
|
|
+ chargeVo.setName("test");
|
|
|
|
+ rabbitTemplate.convertAndSend(ChargeConsumeConfig.NAME, ChargeConsumeConfig.NAME, JSON.toJSON(chargeVo));
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
b = false;
|
|
b = false;
|
|
- log.error("---order---卡充值api调用异常"+ e.getMessage());
|
|
|
|
|
|
+ log.error("---order---卡充值消息发送异常"+ e.getMessage());
|
|
}
|
|
}
|
|
- callApiLogService.saveOrUpdate(order.getOrderNumber(),CARD_TOP,TopApi.DEAL_SELECT_URL,JSONObject.toJSONString(param),result);
|
|
|
|
if (b){
|
|
if (b){
|
|
- //成功修改状态成功
|
|
|
|
|
|
+ //成功修改状态支付成功
|
|
order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
}else {
|
|
}else {
|
|
//失败修改状态为卡充值失败
|
|
//失败修改状态为卡充值失败
|
|
@@ -254,6 +264,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
b = false;
|
|
b = false;
|
|
}
|
|
}
|
|
if (b){
|
|
if (b){
|
|
|
|
+ //修改订单状态为支付成功
|
|
|
|
+ order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
+ this.updateById(order);
|
|
//调用卡充值api
|
|
//调用卡充值api
|
|
callCardTopApi(order);
|
|
callCardTopApi(order);
|
|
}
|
|
}
|