|
|
|
@ -17,11 +17,14 @@ import org.springblade.common.constant.RabbitConstant;
|
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.amqp.rabbit.connection.CorrelationData; |
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
@ -42,8 +45,8 @@ public class FactoryCommonController {
|
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "订单数据推送", notes = "传入orderInfoDTO") |
|
|
|
|
public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { |
|
|
|
|
log.info("############sendOrders: 请求参数{}",orderInfoDTO); |
|
|
|
|
try{ |
|
|
|
|
log.info("############sendOrders: 请求参数{}", orderInfoDTO); |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
//先保存原始请求数据
|
|
|
|
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
|
|
|
@ -52,22 +55,22 @@ public class FactoryCommonController {
|
|
|
|
|
orderStatusLog.setType(1); |
|
|
|
|
orderStatusLogService.save(orderStatusLog); |
|
|
|
|
|
|
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("logId", orderStatusLog.getId()); |
|
|
|
|
map.put("messageData",orderInfoDTO); |
|
|
|
|
map.put("createTime",new Date().getTime()); |
|
|
|
|
map.put("messageData", orderInfoDTO); |
|
|
|
|
map.put("createTime", new Date().getTime()); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map,new CorrelationData(String.valueOf(orderStatusLog.getId()))); |
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map, new CorrelationData(String.valueOf(orderStatusLog.getId()))); |
|
|
|
|
|
|
|
|
|
// R r = factoryDataService.handleData(orderInfoDTO);
|
|
|
|
|
return R.success("调用成功"); |
|
|
|
|
}catch (CustomerException e){ |
|
|
|
|
log.error(e.message,e); |
|
|
|
|
return R.fail(e.code,e.message); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("############sendOrders: 系统异常",e); |
|
|
|
|
return R.fail(500,"############sendOrders: 系统异常"); |
|
|
|
|
} catch (CustomerException e) { |
|
|
|
|
log.error(e.message, e); |
|
|
|
|
return R.fail(e.code, e.message); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("############sendOrders: 系统异常", e); |
|
|
|
|
return R.fail(500, "############sendOrders: 系统异常"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -77,8 +80,8 @@ public class FactoryCommonController {
|
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "订单状态推送", notes = "传入orderInfoDTO") |
|
|
|
|
public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { |
|
|
|
|
log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); |
|
|
|
|
try{ |
|
|
|
|
log.info("############sendOrderStatus: 请求参数{}", orderStatusDTO); |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
//先保存原始请求数据
|
|
|
|
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
|
|
|
@ -87,26 +90,26 @@ public class FactoryCommonController {
|
|
|
|
|
orderStatusLog.setType(2); |
|
|
|
|
orderStatusLogService.save(orderStatusLog); |
|
|
|
|
|
|
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("logId", orderStatusLog.getId()); |
|
|
|
|
map.put("type", "Push"); |
|
|
|
|
map.put("messageData",orderStatusDTO); |
|
|
|
|
map.put("createTime",new Date().getTime()); |
|
|
|
|
map.put("messageData", orderStatusDTO); |
|
|
|
|
map.put("createTime", new Date().getTime()); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); |
|
|
|
|
map.put("type", "DealWith"); |
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING,map); |
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING, map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// R r = factoryDataService.handleStatusData(orderStatusDTO);
|
|
|
|
|
return R.success("调用成功"); |
|
|
|
|
}catch (CustomerException e){ |
|
|
|
|
log.error(e.message,e); |
|
|
|
|
return R.fail(e.code,e.message); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("############sendOrderStatus: 系统异常",e); |
|
|
|
|
return R.fail(500,"############sendOrderStatus: 系统异常"); |
|
|
|
|
} catch (CustomerException e) { |
|
|
|
|
log.error(e.message, e); |
|
|
|
|
return R.fail(e.code, e.message); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("############sendOrderStatus: 系统异常", e); |
|
|
|
|
return R.fail(500, "############sendOrderStatus: 系统异常"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -119,7 +122,7 @@ public class FactoryCommonController {
|
|
|
|
|
log.info("############sendReceiveInfo: 请求参数{}", receiveInfoDTO); |
|
|
|
|
//处理数据
|
|
|
|
|
// R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO);
|
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
//先保存原始请求数据
|
|
|
|
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
|
|
|
@ -128,21 +131,21 @@ public class FactoryCommonController {
|
|
|
|
|
orderStatusLog.setType(4); |
|
|
|
|
orderStatusLogService.save(orderStatusLog); |
|
|
|
|
|
|
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("logId", orderStatusLog.getId()); |
|
|
|
|
map.put("messageData",receiveInfoDTO); |
|
|
|
|
map.put("createTime",new Date().getTime()); |
|
|
|
|
map.put("messageData", receiveInfoDTO); |
|
|
|
|
map.put("createTime", new Date().getTime()); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.RECEIVE_INFO_EXCHANGE, RabbitConstant.RECEIVE_INFO_ROUTING, map); |
|
|
|
|
|
|
|
|
|
return R.success("调用成功"); |
|
|
|
|
}catch (CustomerException e){ |
|
|
|
|
log.error(e.message,e); |
|
|
|
|
return R.fail(e.code,e.message); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("############sendReceiveInfo: 系统异常",e); |
|
|
|
|
return R.fail(500,"############sendReceiveInfo: 系统异常"); |
|
|
|
|
} catch (CustomerException e) { |
|
|
|
|
log.error(e.message, e); |
|
|
|
|
return R.fail(e.code, e.message); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("############sendReceiveInfo: 系统异常", e); |
|
|
|
|
return R.fail(500, "############sendReceiveInfo: 系统异常"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -155,8 +158,12 @@ public class FactoryCommonController {
|
|
|
|
|
public R sendUnloadCarComInfo(@RequestBody UnloadCarDTO receiveInfoDTO) { |
|
|
|
|
log.info("############sendUnloadCarComInfo: 请求参数{}", receiveInfoDTO); |
|
|
|
|
//处理数据
|
|
|
|
|
// R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO);
|
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
if (StringUtil.isBlank(receiveInfoDTO.getCompleteDate())) { |
|
|
|
|
String data = DateUtil.format(new Date(), "yyyy-mm-dd HH:mm:ss"); |
|
|
|
|
receiveInfoDTO.setCompleteDate(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//先保存原始请求数据
|
|
|
|
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
|
|
|
@ -165,27 +172,23 @@ public class FactoryCommonController {
|
|
|
|
|
orderStatusLog.setType(5); |
|
|
|
|
orderStatusLogService.save(orderStatusLog); |
|
|
|
|
|
|
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("logId", orderStatusLog.getId()); |
|
|
|
|
map.put("messageData",receiveInfoDTO); |
|
|
|
|
map.put("createTime",new Date().getTime()); |
|
|
|
|
map.put("messageData", receiveInfoDTO); |
|
|
|
|
map.put("createTime", new Date().getTime()); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
// rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map);
|
|
|
|
|
|
|
|
|
|
return R.success("调用成功"); |
|
|
|
|
}catch (CustomerException e){ |
|
|
|
|
log.error(e.message,e); |
|
|
|
|
return R.fail(e.code,e.message); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("############sendReceiveInfo: 系统异常",e); |
|
|
|
|
return R.fail(500,"############sendReceiveInfo: 系统异常"); |
|
|
|
|
} catch (CustomerException e) { |
|
|
|
|
log.error(e.message, e); |
|
|
|
|
return R.fail(e.code, e.message); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("############sendReceiveInfo: 系统异常", e); |
|
|
|
|
return R.fail(500, "############sendReceiveInfo: 系统异常"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|