Browse Source

欧派的推送入库数据

training
pref_mail@163.com 1 year ago
parent
commit
2eef9b9395
  1. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java
  2. 5
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  3. 45
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java
  4. 13
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java
  5. 16
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java

@ -8,4 +8,7 @@ public interface IAsyncDataService {
void handlerMtDataToHt(Long mainId);
void handlerOuPaiDataToHt(Long mainId);
}

5
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java

@ -318,6 +318,11 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
log.info("##############handlerMtDataToHt: 处理数据完成");
}
@Override
public void handlerOuPaiDataToHt(Long mainId) {
}
/**
* 添加订单包件
*

45
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java

@ -1,14 +1,27 @@
package com.logpm.factory.oupai.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.comfac.service.IOrderStatusLogService;
import com.logpm.factory.oupai.service.IOuPaiFactoryDataService;
import com.logpm.factory.oupai.vo.OuPaiDataPushVO;
import com.logpm.factory.snm.entity.OrderStatusLog;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* 欧派工厂推送数据
*/
@ -19,16 +32,42 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value = "欧派工厂数据", tags = "欧派工厂数据")
public class OupaiFactoryDataController {
private final IOuPaiFactoryDataService mtFactoryDataService;
private final IOrderStatusLogService orderStatusLogService;
private final IAsyncDataService syncDataService;
@GetMapping("/acceptOupaiFactoryData")
public R acceptOupaiFactoryData(OuPaiDataPushVO ouPaiDataPushVO){
// log.info("acceptOupaiFactoryData 参数 json {}",json);
public R acceptOupaiFactoryData(@Validated @RequestBody OuPaiDataPushVO ouPaiDataPushVO, HttpServletRequest request) {
log.info("acceptOupaiFactoryData 参数ouPaiDataPushVO {}",ouPaiDataPushVO.toString());
//先保存原始请求数据
OrderStatusLog orderStatusLog = new OrderStatusLog();
orderStatusLog.setArgs(JSONObject.toJSONString(ouPaiDataPushVO));
orderStatusLog.setStatus(1);
orderStatusLog.setType(3);
orderStatusLog.setBrand("欧派");
orderStatusLogService.save(orderStatusLog);
Long id = null;
try {
id = mtFactoryDataService.saveData(ouPaiDataPushVO);
orderStatusLog.setStatus(0);
} catch (ServiceException e) {
log.warn("############data: 保存数据失败 carNum={}",ouPaiDataPushVO.getCarNum());
log.error("############data: 保存数据失败",e);
//修改保存数据的状态
orderStatusLog.setStatus(2);
}
orderStatusLogService.saveOrUpdate(orderStatusLog);
//开启异步线程处理数据
if(!Objects.isNull(id)){
syncDataService.handlerOuPaiDataToHt(id);
}
return R.data(ouPaiDataPushVO.getCarNum());
return R.data(null);
}

13
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java

@ -0,0 +1,13 @@
package com.logpm.factory.oupai.service;
import com.logpm.factory.oupai.vo.OuPaiDataPushVO;
public interface IOuPaiFactoryDataService {
/**
* 保存欧派的数据推送
* @param ouPaiDataPushVO
* @return
*/
Long saveData(OuPaiDataPushVO ouPaiDataPushVO);
}

16
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java

@ -0,0 +1,16 @@
package com.logpm.factory.oupai.service.impl;
import com.logpm.factory.oupai.service.IOuPaiFactoryDataService;
import com.logpm.factory.oupai.vo.OuPaiDataPushVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class OuPaiFactoryDataServiceImpl implements IOuPaiFactoryDataService {
@Override
public Long saveData(OuPaiDataPushVO ouPaiDataPushVO) {
return null;
}
}
Loading…
Cancel
Save