|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.logpm.factory.pan.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import com.logpm.factory.comfac.service.IAsyncDataService; |
|
|
|
@ -25,6 +26,7 @@ import com.logpm.factory.pan.service.IPanFactoryDataService;
|
|
|
|
|
import com.logpm.factory.pan.service.IPanFactoryOrderService; |
|
|
|
|
import com.logpm.factory.pan.service.IPanPackageInfoService; |
|
|
|
|
import com.logpm.factory.pan.service.IPanPackageListService; |
|
|
|
|
import com.logpm.factory.props.SendDataProperties; |
|
|
|
|
import com.logpm.factory.snm.bean.Resp; |
|
|
|
|
import com.logpm.factory.snm.entity.OrderStatusLog; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -32,9 +34,13 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.Objects; |
|
|
|
@ -57,8 +63,8 @@ public class PanFactoryDataController extends BladeController {
|
|
|
|
|
private final IPanPackageListService packageListService; |
|
|
|
|
private final IPanFactoryDataService panFactoryDataService; |
|
|
|
|
private final IAsyncDataService syncDataService; |
|
|
|
|
private RabbitTemplate rabbitTemplate; |
|
|
|
|
private final IOrderStatusLogService panOrderStatusLogService; |
|
|
|
|
private final SendDataProperties sendDataProperties; |
|
|
|
|
|
|
|
|
|
// @ResponseBody
|
|
|
|
|
// @PostMapping("/token")
|
|
|
|
@ -87,7 +93,6 @@ public class PanFactoryDataController extends BladeController {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 工厂数据推送接口 |
|
|
|
|
*/ |
|
|
|
@ -111,26 +116,32 @@ public class PanFactoryDataController extends BladeController {
|
|
|
|
|
//判断数据是否已存入
|
|
|
|
|
String orderNo = factoryOrderDTO.getOrderNo(); |
|
|
|
|
Long orderId = null; |
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
orderId = panFactoryDataService.saveData(factoryOrderDTO); |
|
|
|
|
panOrderStatusLog.setStatus(0); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.warn("############data: 保存数据失败 orderNo={}",orderNo); |
|
|
|
|
log.error("############data: 保存数据失败",e); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.warn("############data: 保存数据失败 orderNo={}", orderNo); |
|
|
|
|
log.error("############data: 保存数据失败", e); |
|
|
|
|
//修改保存数据的状态
|
|
|
|
|
panOrderStatusLog.setStatus(2); |
|
|
|
|
} |
|
|
|
|
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); |
|
|
|
|
|
|
|
|
|
//开启异步线程处理数据
|
|
|
|
|
if(!Objects.isNull(orderId)){ |
|
|
|
|
// syncDataService.handlerPanDataToHt(orderId);
|
|
|
|
|
if (!Objects.isNull(orderId)) { |
|
|
|
|
if (ObjectUtil.equal(sendDataProperties.getSend(), "old")) { |
|
|
|
|
log.info("推送到老系统"); |
|
|
|
|
syncDataService.handlerPanDataToHt(orderId); |
|
|
|
|
} |
|
|
|
|
// 走新系统暂存单
|
|
|
|
|
syncDataService.handlerPanDataToHtNew(orderId); |
|
|
|
|
if (ObjectUtil.equal(sendDataProperties.getSend(), "new")) { |
|
|
|
|
log.info("推送到新系统"); |
|
|
|
|
syncDataService.handlerPanDataToHtNew(orderId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS"); |
|
|
|
|
return Resp.successOrderNo(factoryOrderDTO.getOrderNo(), factoryOrderDTO.getDeliveryNumber(), "SUCCESS"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|