|
|
|
@ -3,6 +3,7 @@ package com.glxp.api.service.thrsys;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.config.WebSocketServer;
|
|
|
|
|
import com.glxp.api.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
@ -46,8 +47,6 @@ public class ThrOrdersDlService {
|
|
|
|
|
ThrOrderExportLogService thrOrderExportLogService;
|
|
|
|
|
@Resource
|
|
|
|
|
ThrOrderImportDetailService thrOrderImportDetailService;
|
|
|
|
|
// @Resource
|
|
|
|
|
// ThrOrderImportService thrOrderImportService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ErpOrderClient erpOrderClient;
|
|
|
|
@ -56,6 +55,8 @@ public class ThrOrdersDlService {
|
|
|
|
|
SyncDataSetService syncDataSetService;
|
|
|
|
|
@Resource
|
|
|
|
|
HttpOkClient httpOkClient;
|
|
|
|
|
@Resource
|
|
|
|
|
private IThrBusTypeOriginService iThrBusTypeOriginService;
|
|
|
|
|
|
|
|
|
|
public String getIpUrl() {
|
|
|
|
|
SyncDataSetEntity syncDataSetEntity = syncDataSetService.findSet();
|
|
|
|
@ -67,22 +68,22 @@ public class ThrOrdersDlService {
|
|
|
|
|
|
|
|
|
|
ThrOrderImportLogEntity thrOrderImportLogEntity = thrOrderImportLogService.selectByGenKey(genKey);
|
|
|
|
|
|
|
|
|
|
//todo单据还没设计好
|
|
|
|
|
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = bussinessTypeService.findByActionKey(action, "orderQueryUrl");
|
|
|
|
|
// if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
|
|
|
|
|
// WebSocketServer.sendInfo("业务单据查询接口未设置!", "sid");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
ThrSystemDetailEntity thrSystemDetailEntity=new ThrSystemDetailEntity();
|
|
|
|
|
ThrSystemDetailEntity thrSystemDetailEntity = iThrBusTypeOriginService.findSysByAction(action, "orderQueryUrl");
|
|
|
|
|
if (thrSystemDetailEntity == null || !thrSystemDetailEntity.getEnabled()) {
|
|
|
|
|
WebSocketServer.sendInfo("业务单据查询接口未设置!", "sid");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (thrSystemDetailEntity.getThirdSysFk() == null) {
|
|
|
|
|
WebSocketServer.sendInfo("业务单据查询接口未设置!", "sid");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
int page = 1;
|
|
|
|
|
int limit = 100;
|
|
|
|
|
while (page != -1) {
|
|
|
|
|
page = getOrders(page, limit, thrSystemDetailEntity.getValue(), thrSystemDetailEntity.getThirdSysFk(), thrOrderImportLogEntity, action, filterThrProductsRequest);
|
|
|
|
|
page = getOrders(page, limit, thrSystemDetailEntity.getThirdSysFk(), thrOrderImportLogEntity, action, filterThrProductsRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
thrOrderImportLogService.importThrOrder(genKey);
|
|
|
|
|
|
|
|
|
|
redisUtil.set(Constant.dlThrProducts, "false");
|
|
|
|
|
WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
|
|
|
|
|
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
@ -94,20 +95,27 @@ public class ThrOrdersDlService {
|
|
|
|
|
ThrOrderImportLogEntity thrOrderImportLogEntity = thrOrderImportLogService.selectByGenKey(genKey);
|
|
|
|
|
if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
|
|
|
|
|
for (ThrOrderResponse erpOrderResponse : erpOrderResponses) {
|
|
|
|
|
List<ThrOrderImportDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
|
|
|
|
|
BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
|
|
|
|
|
ThrOrderEntity originEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
|
|
|
|
|
if (originEntity != null) {
|
|
|
|
|
thrOrderService.deleteById(originEntity.getId() + "");
|
|
|
|
|
thrOrderDetailService.deleteByOrderIdFk(originEntity.getId() + "");
|
|
|
|
|
}
|
|
|
|
|
thrOrderService.insertThrOrder(thrOrderEntity);
|
|
|
|
|
List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
for (ThrOrderResponse.SubErpOrder subPurchase : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
ThrOrderImportDetailEntity thrOrderDetailEntity = new ThrOrderImportDetailEntity();
|
|
|
|
|
ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
|
|
|
|
|
thrOrderDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
BeanUtils.copyProperties(subPurchase, thrOrderDetailEntity);
|
|
|
|
|
BeanUtils.copyProperties(subPurchase, thrOrderDetailEntity);
|
|
|
|
|
BeanUtils.copyProperties(erpOrderResponse, thrOrderDetailEntity);
|
|
|
|
|
thrOrderDetailEntity.setGenKeyFk(thrOrderImportLogEntity.getGenKey());
|
|
|
|
|
thrOrderDetailEntity.setThirdSysFk(thirdSys);
|
|
|
|
|
thrOrderDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
thrOrderDetailEntities.add(thrOrderDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
thrOrderImportDetailService.insertOrderImportDetails(thrOrderDetailEntities);
|
|
|
|
|
thrOrderDetailService.insertThrOrderDetails(thrOrderDetailEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
thrOrderImportLogService.importThrOrder(genKey);
|
|
|
|
|
redisUtil.set(Constant.dlThrProducts, "false");
|
|
|
|
|
WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
|
|
|
|
|
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
@ -213,209 +221,7 @@ public class ThrOrdersDlService {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// @Async
|
|
|
|
|
// public void genJsonFile(String genKey, ThrOrderExportRequest thrOrderExportRequest) {
|
|
|
|
|
// ThrOrderExportJsonResponse thrOrderExportJsonResponse = new ThrOrderExportJsonResponse();
|
|
|
|
|
// ThrOrderExportLogEntity thrOrderExportLogEntity = thrOrderExportLogService.selectByGenKey(genKey);
|
|
|
|
|
// BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(thrOrderExportRequest.getBillAction());
|
|
|
|
|
// List<ErpOrderResponse> erpOrderResponses = thrOrderExportRequest.getErpOrderResponses();
|
|
|
|
|
// //选中导出
|
|
|
|
|
// if (thrOrderExportRequest.getErpOrderResponses() != null && thrOrderExportRequest.getErpOrderResponses().size() > 0) {
|
|
|
|
|
// BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
|
|
|
|
|
// bussinessTypeFilterRequest.setEnabled(true);
|
|
|
|
|
// if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = new ArrayList<>();
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
// for (ErpOrderResponse erpOrderResponse : erpOrderResponses) {
|
|
|
|
|
// ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
|
|
|
|
|
// thrOrderEntities.add(thrOrderEntity);
|
|
|
|
|
// if (erpOrderResponse.getSubErpOrders() != null && erpOrderResponse.getSubErpOrders().size() > 0) {
|
|
|
|
|
// for (ErpOrderResponse.SubErpOrder subErpOrder : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
// ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
|
|
|
|
|
// BeanUtils.copyProperties(subErpOrder, thrOrderDetailEntity);
|
|
|
|
|
// thrOrderDetailEntities.add(thrOrderDetailEntity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
// } else {//一键导出
|
|
|
|
|
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", bussinessTypeEntity.getThirdSysFk());
|
|
|
|
|
// if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
|
|
|
|
|
// thrOrderExportLogEntity.setRemark("业务单据接口地址未定义");
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (!basicThirdSysDetailEntity.getEnabled() || basicThirdSysDetailEntity.getThirdSysFk() == null) {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
|
|
|
|
|
// thrOrderExportLogEntity.setRemark("第三方系统业务单据接口服务未启用");
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (basicThirdSysDetailEntity.getFromType() == 0) {
|
|
|
|
|
// FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
|
|
|
|
|
// filterThrOrderRequest.setThirdSysFk(bussinessTypeEntity.getThirdSysFk());
|
|
|
|
|
// BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
|
|
|
|
|
// erpOrderResponses = getThrOrders(filterThrOrderRequest);
|
|
|
|
|
// if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = new ArrayList<>();
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
// for (ErpOrderResponse erpOrderResponse : erpOrderResponses) {
|
|
|
|
|
// ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
|
|
|
|
|
// thrOrderEntities.add(thrOrderEntity);
|
|
|
|
|
// if (erpOrderResponse.getSubErpOrders() != null && erpOrderResponse.getSubErpOrders().size() > 0) {
|
|
|
|
|
// for (ErpOrderResponse.SubErpOrder subErpOrder : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
// ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
|
|
|
|
|
// BeanUtils.copyProperties(subErpOrder, thrOrderDetailEntity);
|
|
|
|
|
// thrOrderDetailEntities.add(thrOrderDetailEntity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
|
|
|
|
|
// BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
|
|
|
|
|
// List<ThrOrderDetailEntity> results = new ArrayList<>();
|
|
|
|
|
// for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
|
|
|
|
|
// FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
|
|
|
|
|
// filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
|
|
|
|
|
// if (thrOrderDetailEntities != null) {
|
|
|
|
|
// results.addAll(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(results);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// FileWriter writer = new FileWriter(thrOrderExportLogEntity.getFilePath());
|
|
|
|
|
// writer.write(JSONUtil.toJsonStr(thrOrderExportJsonResponse));
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// @Async
|
|
|
|
|
// public void uploadSpssync(String genKey, ThrOrderExportRequest thrOrderExportRequest) {
|
|
|
|
|
//
|
|
|
|
|
// ThrOrderExportJsonResponse thrOrderExportJsonResponse = new ThrOrderExportJsonResponse();
|
|
|
|
|
// ThrOrderExportLogEntity thrOrderExportLogEntity = thrOrderExportLogService.selectByGenKey(genKey);
|
|
|
|
|
// BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(thrOrderExportRequest.getBillAction());
|
|
|
|
|
// List<ErpOrderResponse> erpOrderResponses = thrOrderExportRequest.getErpOrderResponses();
|
|
|
|
|
// //选中导出
|
|
|
|
|
// if (thrOrderExportRequest.getErpOrderResponses() != null && thrOrderExportRequest.getErpOrderResponses().size() > 0) {
|
|
|
|
|
// BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
|
|
|
|
|
// bussinessTypeFilterRequest.setEnabled(true);
|
|
|
|
|
// if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = new ArrayList<>();
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
// for (ErpOrderResponse erpOrderResponse : erpOrderResponses) {
|
|
|
|
|
// ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
|
|
|
|
|
// thrOrderEntities.add(thrOrderEntity);
|
|
|
|
|
// if (erpOrderResponse.getSubErpOrders() != null && erpOrderResponse.getSubErpOrders().size() > 0) {
|
|
|
|
|
// for (ErpOrderResponse.SubErpOrder subErpOrder : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
// ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
|
|
|
|
|
// BeanUtils.copyProperties(subErpOrder, thrOrderDetailEntity);
|
|
|
|
|
// thrOrderDetailEntities.add(thrOrderDetailEntity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
// } else {//一键导出
|
|
|
|
|
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", bussinessTypeEntity.getThirdSysFk());
|
|
|
|
|
// if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
|
|
|
|
|
// thrOrderExportLogEntity.setRemark("业务单据接口地址未定义");
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (!basicThirdSysDetailEntity.getEnabled() || basicThirdSysDetailEntity.getThirdSysFk() == null) {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
|
|
|
|
|
// thrOrderExportLogEntity.setRemark("第三方系统业务单据接口服务未启用");
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (basicThirdSysDetailEntity.getFromType() == 0) {
|
|
|
|
|
// FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
|
|
|
|
|
// filterThrOrderRequest.setThirdSysFk(bussinessTypeEntity.getThirdSysFk());
|
|
|
|
|
// BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
|
|
|
|
|
// erpOrderResponses = getThrOrders(filterThrOrderRequest);
|
|
|
|
|
// if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = new ArrayList<>();
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
// for (ErpOrderResponse erpOrderResponse : erpOrderResponses) {
|
|
|
|
|
// ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
|
|
|
|
|
// thrOrderEntities.add(thrOrderEntity);
|
|
|
|
|
// if (erpOrderResponse.getSubErpOrders() != null && erpOrderResponse.getSubErpOrders().size() > 0) {
|
|
|
|
|
// for (ErpOrderResponse.SubErpOrder subErpOrder : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
// ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
|
|
|
|
|
// BeanUtils.copyProperties(subErpOrder, thrOrderDetailEntity);
|
|
|
|
|
// thrOrderDetailEntities.add(thrOrderDetailEntity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
|
|
|
|
|
// BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
|
|
|
|
|
// List<ThrOrderDetailEntity> results = new ArrayList<>();
|
|
|
|
|
// for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
|
|
|
|
|
// FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
|
|
|
|
|
// filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
|
|
|
|
|
// if (thrOrderDetailEntities != null) {
|
|
|
|
|
// results.addAll(thrOrderDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderEntityList(thrOrderEntities);
|
|
|
|
|
// thrOrderExportJsonResponse.setThrOrderDetailEntities(results);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// String response = httpOkClient.uCloudPost(getIpUrl() + "/spssync/thirdsys/order/upload", thrOrderExportJsonResponse);
|
|
|
|
|
// BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
// });
|
|
|
|
|
// if (baseResponse.getCode() == 20000) {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
// } else {
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
|
|
|
|
|
// }
|
|
|
|
|
// thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
// thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// public String getName(List<BussinessTypeEntity> bussinessTypeEntities, String action) {
|
|
|
|
|
// for (BussinessTypeEntity bussinessTypeEntity : bussinessTypeEntities) {
|
|
|
|
|
// if (bussinessTypeEntity.getAction().equals(action)) {
|
|
|
|
|
// return bussinessTypeEntity.getName();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return action;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
public void uploadSmp(String genKey, ThrOrderExportRequest thrOrderExportRequest) {
|
|
|
|
|
|
|
|
|
@ -494,7 +300,7 @@ public class ThrOrdersDlService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getOrders(int page, int limit, String orderUrl, String thirdSys, ThrOrderImportLogEntity
|
|
|
|
|
public int getOrders(int page, int limit, String thirdSys, ThrOrderImportLogEntity
|
|
|
|
|
thrOrderImportLogEntity, String action, FilterThrOrderRequest filterThrOrderRequest) {
|
|
|
|
|
if (filterThrOrderRequest == null)
|
|
|
|
|
filterThrOrderRequest = new FilterThrOrderRequest();
|
|
|
|
@ -513,7 +319,6 @@ public class ThrOrdersDlService {
|
|
|
|
|
thrOrderEntity.setThirdSysFk(thirdSys);
|
|
|
|
|
thrOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
thrOrderService.insertThrOrder(thrOrderEntity);
|
|
|
|
|
// thrOrderEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
|
|
|
|
|
List<ThrOrderImportDetailEntity> thrOrderDetailEntities = new ArrayList<>();
|
|
|
|
|
for (ThrOrderResponse.SubErpOrder subPurchase : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
ThrOrderImportDetailEntity thrOrderDetailEntity = new ThrOrderImportDetailEntity();
|
|
|
|
@ -543,60 +348,7 @@ public class ThrOrdersDlService {
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// public List<List<String>> exportThrOrders(FilterThrOrderRequest filterThrOrderRequest) {
|
|
|
|
|
// BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
|
|
|
|
|
// bussinessTypeFilterRequest.setEnabled(true);
|
|
|
|
|
// List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterList(bussinessTypeFilterRequest);
|
|
|
|
|
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", filterThrOrderRequest.getThirdSysFk());
|
|
|
|
|
// int page = 1;
|
|
|
|
|
// int limit = 100;
|
|
|
|
|
// List<ErpOrderResponse> erpOrderResponseList = new ArrayList<>();
|
|
|
|
|
// while (true) {
|
|
|
|
|
// List<ErpOrderResponse> datas = getThrOrders(page, limit, basicThirdSysDetailEntity.getValue(), filterThrOrderRequest);
|
|
|
|
|
// if (datas != null && datas.size() >= limit) {
|
|
|
|
|
// erpOrderResponseList.addAll(datas);
|
|
|
|
|
// page++;
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// if (datas != null) {
|
|
|
|
|
// erpOrderResponseList.addAll(datas);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// List<List<String>> excelData = new ArrayList<>();
|
|
|
|
|
// for (ErpOrderResponse erpOrderResponse : erpOrderResponseList) {
|
|
|
|
|
// for (ErpOrderResponse.SubErpOrder subPurchase : erpOrderResponse.getSubErpOrders()) {
|
|
|
|
|
// List<String> rows = new ArrayList<>();
|
|
|
|
|
// rows.add(erpOrderResponse.getBillNo());
|
|
|
|
|
// rows.add(erpOrderResponse.getBilldate());
|
|
|
|
|
// BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(erpOrderResponse.getCorpId(), filterThrOrderRequest.getThirdSysFk());
|
|
|
|
|
//// if (basicUnitMaintainEntity != null)
|
|
|
|
|
//// rows.add(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
//// else
|
|
|
|
|
// rows.add(erpOrderResponse.getCorpId());
|
|
|
|
|
//// rows.add(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
//// rows.add(erpOrderResponse.getCorpId());
|
|
|
|
|
// rows.add(erpOrderResponse.getCorpName());
|
|
|
|
|
// rows.add(getName(bussinessTypeEntities, erpOrderResponse.getBillType()));
|
|
|
|
|
//// rows.add(erpOrderResponse.getBillType());
|
|
|
|
|
// rows.add(erpOrderResponse.getBillFlag());
|
|
|
|
|
// rows.add(subPurchase.getProductId());
|
|
|
|
|
// rows.add(subPurchase.getProductName());
|
|
|
|
|
// rows.add(subPurchase.getSpec());
|
|
|
|
|
// rows.add(subPurchase.getBatchNo());
|
|
|
|
|
// rows.add(subPurchase.getProductDate());
|
|
|
|
|
// rows.add(subPurchase.getExpireDate());
|
|
|
|
|
// rows.add(subPurchase.getCount() + "");
|
|
|
|
|
// rows.add(subPurchase.getReCount() + "");
|
|
|
|
|
// rows.add(erpOrderResponse.getOriginType());
|
|
|
|
|
// excelData.add(rows);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return excelData;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
public List<ThrOrderResponse> getThrOrders(FilterThrOrderRequest filterThrOrderRequest) {
|
|
|
|
|
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("orderQueryUrl", filterThrOrderRequest.getThirdSysFk());
|
|
|
|
|
int page = 1;
|
|
|
|
@ -634,48 +386,4 @@ public class ThrOrdersDlService {
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// public List<List<String>> genExcelData(FilterThrOrderRequest filterThrOrderRequest) {
|
|
|
|
|
//
|
|
|
|
|
// BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
|
|
|
|
|
// bussinessTypeFilterRequest.setEnabled(true);
|
|
|
|
|
// List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterList(bussinessTypeFilterRequest);
|
|
|
|
|
// List<List<String>> excelData = new ArrayList<>();
|
|
|
|
|
// List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
|
|
|
|
|
// for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
|
|
|
|
|
// FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
|
|
|
|
|
// filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
|
|
|
|
|
// List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
|
|
|
|
|
// if (thrOrderDetailEntities != null) {
|
|
|
|
|
// for (ThrOrderDetailEntity thrOrderDetailEntity : thrOrderDetailEntities) {
|
|
|
|
|
// List<String> rows = new ArrayList<>();
|
|
|
|
|
// rows.add(thrOrderEntity.getBillNo());
|
|
|
|
|
// rows.add(thrOrderEntity.getBilldate());
|
|
|
|
|
//
|
|
|
|
|
//// BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(thrOrderEntity.getCorpId(), filterThrOrderRequest.getThirdSysFk());
|
|
|
|
|
//// if (basicUnitMaintainEntity != null)
|
|
|
|
|
//// rows.add(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
//// else
|
|
|
|
|
// rows.add(thrOrderEntity.getCorpId());
|
|
|
|
|
//
|
|
|
|
|
//// rows.add(thrOrderEntity.getCorpId());
|
|
|
|
|
// rows.add(thrOrderEntity.getCorpName());
|
|
|
|
|
// rows.add(getName(bussinessTypeEntities, thrOrderEntity.getBillType()));
|
|
|
|
|
// rows.add(thrOrderEntity.getBillFlag());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getProductId());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getProductName());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getSpec());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getBatchNo());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getProductDate());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getExpireDate());
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getCount() + "");
|
|
|
|
|
// rows.add(thrOrderDetailEntity.getReCount() + "");
|
|
|
|
|
// rows.add(thrOrderEntity.getOriginType());
|
|
|
|
|
// excelData.add(rows);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// return excelData;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|