|
|
|
@ -2,6 +2,7 @@ package com.glxp.sale.admin.thread;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.FileConstant;
|
|
|
|
@ -19,6 +20,7 @@ import com.glxp.sale.admin.thread.didl.AsyncDiDlHelper;
|
|
|
|
|
import com.glxp.sale.admin.util.*;
|
|
|
|
|
import com.glxp.sale.common.res.BaseResponse;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -41,6 +43,9 @@ public class DlAllDataService {
|
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
@Resource
|
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void dllNewAllData() {
|
|
|
|
|
log.info("下载所有基础信息---");
|
|
|
|
@ -153,7 +158,7 @@ public class DlAllDataService {
|
|
|
|
|
SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
|
|
|
|
for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) {
|
|
|
|
|
|
|
|
|
|
BaseResponse<SpsSyncOrderResponse> baseResponse = null;
|
|
|
|
|
BaseResponse<String> baseResponse = null;
|
|
|
|
|
SpsSyncDataRequest spsSyncDataRequest = new SpsSyncDataRequest();
|
|
|
|
|
if (basicExportStatusEntity.getFromType() == 0) {
|
|
|
|
|
BaseResponse<String> response = spGetHttp.getLastUpdateTime("AutoDownloadOrder");
|
|
|
|
@ -166,26 +171,27 @@ public class DlAllDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
SpsSyncOrderResponse syncOrderResponse = baseResponse.getData();
|
|
|
|
|
if (syncOrderResponse != null &&
|
|
|
|
|
(CollUtil.isNotEmpty(syncOrderResponse.getOrderEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(syncOrderResponse.getOrderDetailEntityList())
|
|
|
|
|
|| CollUtil.isNotEmpty(syncOrderResponse.getWarehouseEntityList()))
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
JSONObject syncOrderResponse = JSON.parseObject(baseResponse.getData());
|
|
|
|
|
if (syncOrderResponse != null) {
|
|
|
|
|
String key = gennerOrderUtils.getOrders();
|
|
|
|
|
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
|
|
|
|
myEntity.setId(key);
|
|
|
|
|
myEntity.setTaskId(syncOrderResponse.getTaskId());
|
|
|
|
|
String taskId = syncOrderResponse.getString("taskId");
|
|
|
|
|
myEntity.setTaskId(taskId);
|
|
|
|
|
myEntity.setStatus(0);
|
|
|
|
|
myEntity.setUpdateTime(new Date());
|
|
|
|
|
myEntity.setStartTime(DateUtil.getDateTime());
|
|
|
|
|
myEntity.setIdDatas(ConstantStatus.SYNC_SCAN_ORDER);
|
|
|
|
|
myEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
|
|
|
|
|
myEntity.setRemark(syncOrderResponse.toString());
|
|
|
|
|
// myEntity.setRemark(syncOrderResponse.toString());
|
|
|
|
|
basicExportService.insertExportStatus(myEntity);
|
|
|
|
|
myEntity.setStatus(Constant.SYNC_STATUS_WAIT);
|
|
|
|
|
if (downstream.getParamValue().equals("1")) {
|
|
|
|
|
redisUtil.set(key, baseResponse.getData());
|
|
|
|
|
// redisUtil.set(key, baseResponse.getData());
|
|
|
|
|
FileUtils.makeDirectory(filePath + "upload/");
|
|
|
|
|
String fileName = filePath + "upload/" + BasicProcessStatus.NEW_ALL_ORDER + "-" + key + ".udi";
|
|
|
|
|
FileUtils.SaveFileAs(baseResponse.getData(), fileName);
|
|
|
|
|
myEntity.setTransportType(BasicProcessStatus.INTERFACE_TYPE);
|
|
|
|
|
myEntity.setStatus(Constant.SYNC_STATUS_WAIT_DL);
|
|
|
|
|
basicExportService.updateExportStatus(myEntity);
|
|
|
|
|