bug修复,代码备份

master
anthonywj 2 years ago
parent 294bd273d8
commit a9c7628017

@ -112,14 +112,16 @@ public class BasicDownloadController {
return ResultVOUtils.success(json);
} else if (basicExportStatusRequest.getType().equals(BasicProcessStatus.NEW_ALL_UDIS)) {//国家库信息
BasicExportStatusEntity basicExportStatusEntity = basicExportService.findById(basicExportStatusRequest.getId());
String data = (String) redisUtil.get(basicExportStatusRequest.getId() + "");
// String data = (String) redisUtil.get(basicExportStatusRequest.getId() + "");
String fileName = basicExportStatusEntity.getCacheFilePath();
String data = FileUtils.readFileAll(fileName);
SpSyncUdiResponse spSyncUdiResponse = null;
if (StrUtil.isNotEmpty(data)) {
spSyncUdiResponse = JSONObject.parseObject(data, new TypeReference<SpSyncUdiResponse>() {
});
spSyncUdiResponse.setTaskId(basicExportStatusEntity.getTaskId());
}
basicExportService.finished(basicExportStatusRequest.getId());
// basicExportService.finished(basicExportStatusRequest.getId());
return ResultVOUtils.success(spSyncUdiResponse);
}
return ResultVOUtils.error(500, "数据不存在!");

@ -347,7 +347,8 @@ public class SpsSyncDataController {
basicUploadStatusEntity.setIdDatas(exportType.getKey());
basicUploadStatusEntity.setType(exportType.getRemark());
basicUploadStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
// basicUploadStatusEntity.setRemark();
JSONObject jsonObject = JSONObject.parseObject(content).getJSONObject("data");
basicUploadStatusEntity.setRemark(jsonObject.getString(Constant.SYNC_REMARK));
FileUtils.makeDirectory(filePath + "upload/");
String fileName = filePath + "upload/" + exportType.getRemark() + "-" + taskId + ".udi";
FileUtils.SaveFileAs(content, fileName);

@ -83,7 +83,7 @@ public class SyncController {
if (StrUtil.isNotEmpty(upperServerHost)) {
uri = upperServerHost + "/" + uri;
}
JSONObject jsonObject = redirect(request, uri, ConstantStatus.SYNC_SCAN_ORDER, BasicProcessStatus.NEW_ALL_ORDER);
JSONObject jsonObject = redirect(request, uri);
return jsonObject;
}
@ -235,10 +235,13 @@ public class SyncController {
basicUploadStatusEntity.setIdDatas(idDatas);
basicUploadStatusEntity.setType(type);
basicUploadStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
basicUploadService.insertDownloadStatus(basicUploadStatusEntity);
JSONObject jsonObject = JSONObject.parseObject(content);
basicUploadStatusEntity.setRemark(jsonObject.getString(Constant.SYNC_REMARK));
FileUtils.makeDirectory(filePath + "upload/");
String fileName = filePath + "upload/" + type + "-" + taskId + ".udi";
FileUtils.SaveFileAs(content, fileName);
basicUploadStatusEntity.setCacheFilePath(fileName);
basicUploadService.insertDownloadStatus(basicUploadStatusEntity);
}
@Async

@ -77,7 +77,7 @@ public class BasicExportServiceImpl extends ServiceImpl<BasicExportDao,BasicExpo
BasicExportStatusEntity basicExportStatusEntity = basicExportDao.selectById(id);
if (null != basicExportStatusEntity) {
basicExportStatusEntity.setEndTime(DateUtil.getDateTime());
basicExportStatusEntity.setStatus(1);
// basicExportStatusEntity.setStatus(1);
basicExportDao.updateExportStatus(basicExportStatusEntity);
}
}

@ -40,6 +40,7 @@ import java.util.Date;
import java.util.List;
import static com.glxp.sale.admin.constant.BasicProcessStatus.NEW_ALL_UDIS;
import static com.glxp.sale.admin.constant.ConstantStatus.SYNC_SCAN_ORDER;
@Slf4j
@Service
@ -161,8 +162,7 @@ public class DlAllDataService {
public void dllNewAllOrder() {
log.info("下载所有单据---");
BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest();
basicExportStatusRequest.setIdDatas("AutoDownloadOrder");
basicExportStatusRequest.setStatus(BasicExportStatusEnum.WAIT_BUILT.getCode());
basicExportStatusRequest.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode());
basicExportStatusRequest.setType(BasicProcessStatus.NEW_ALL_ORDER);
basicExportStatusRequest.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
BaseResponse<List<BasicExportStatusEntity>> basicStatuss = spGetHttp.getBasicStatus(basicExportStatusRequest);
@ -188,34 +188,40 @@ public class DlAllDataService {
JSONObject syncOrderResponse = JSON.parseObject(baseResponse.getData());
if (syncOrderResponse != null) {
String key = gennerOrderUtils.getOrders();
// String key = gennerOrderUtils.getOrders();
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
myEntity.setId(key);
String taskId = syncOrderResponse.getString("taskId");
myEntity.setId(taskId);
JSONArray fileJson = syncOrderResponse.getJSONArray("files");
List<String> syncFiles = fileJson.toJavaList(String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
idcService.batchDownloadFile(spGetHttp.getSpmsUrl(), syncFiles.toArray(new String[syncFiles.size()]));
if (fileJson != null) {
List<String> syncFiles = fileJson.toJavaList(String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
idcService.batchDownloadFile(spGetHttp.getSpmsUrl(), syncFiles.toArray(new String[syncFiles.size()]));
}
}
String remark = syncOrderResponse.getString(Constant.SYNC_REMARK);
myEntity.setTaskId(taskId);
myEntity.setStatus(0);
myEntity.setStatus(BasicExportStatusEnum.WAIT_BUILT.getCode());
myEntity.setUpdateTime(new Date());
myEntity.setStartTime(DateUtil.getDateTime());
myEntity.setIdDatas(ConstantStatus.SYNC_SCAN_ORDER);
myEntity.setRemark(remark);
myEntity.setIdDatas(SYNC_SCAN_ORDER);
myEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
basicExportService.insertExportStatus(myEntity);
myEntity.setStatus(Constant.SYNC_STATUS_WAIT);
if (downstream.getParamValue().equals("1")) {
FileUtils.makeDirectory(filePath + "upload/");
String fileName = filePath + "upload/" + BasicProcessStatus.NEW_ALL_ORDER + "-" + key + ".udi";
String fileName = filePath + "upload/" + BasicProcessStatus.NEW_ALL_ORDER + "-" + taskId + ".udi";
FileUtils.SaveFileAs(baseResponse.getData(), fileName);
myEntity.setTransportType(BasicProcessStatus.INTERFACE_TYPE);
myEntity.setStatus(Constant.SYNC_STATUS_WAIT_DL);
myEntity.setCacheFilePath(fileName);
myEntity.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode());
basicExportService.updateExportStatus(myEntity);
} else {
String path = getPath();
String fileName = path + FileConstant.upWaitCopy_products + key + ".LowerIn";
String fileName = path + FileConstant.upWaitCopy_products + taskId + ".LowerIn";
String datas = JSON.toJSONString(baseResponse.getData());
FileUtils.SaveFileAs(datas, fileName);
myEntity.setStatus(Constant.SYNC_STATUS_SUCCESS);
@ -230,7 +236,8 @@ public class DlAllDataService {
BasicExportStatusEntity basicExportStatusEntity1 = basicExportStatusEntities.get(0);
basicExportStatusEntity1.setStatus(4);
spGetHttp.postUpdateBasicStatus(basicExportStatusEntity1);
spGetHttp.updateLastTime("AutoDownloadOrder", DateUtil.formatDate(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
spGetHttp.finishTask(basicExportStatusEntity1.getId());
spGetHttp.updateLastTime(SYNC_SCAN_ORDER, DateUtil.formatDate(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
} else {
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
}
@ -262,6 +269,7 @@ public class DlAllDataService {
RelaySyncDto bean = JSONUtil.toBean(dataStr, RelaySyncDto.class);
JSONObject jsonObject = JSONObject.parseObject(bean.getFileContent());
JSONArray jsonArray = jsonObject.getJSONArray("syncFiles");
String remark = jsonObject.getString(Constant.SYNC_REMARK);
if (jsonArray != null) {
List<String> list = JSONArray.parseArray(jsonArray.toJSONString(), String.class);
idcService.batchDownloadFile(spGetHttp.getSpmsUrl(), list.toArray(new String[list.size()]));
@ -270,9 +278,9 @@ public class DlAllDataService {
// 将数据写入文件
// try {
FileUtils.makeDirectory(filePath + "sync/");
String fileName = filePath + "sync/" + exportType.getRemark() + "-" + bean.getTaskId() + ".udi";
FileUtils.SaveFileAs(bean.getFileContent(), fileName);
FileUtils.makeDirectory(filePath + "sync/");
String fileName = filePath + "sync/" + exportType.getRemark() + "-" + bean.getTaskId() + ".udi";
FileUtils.SaveFileAs(bean.getFileContent(), fileName);
// } catch (IOException e) {
// log.error("从UDI自助平台拉取基础数据 文件[{}]写入异常----{}",bean.getFilePath(), e.getMessage());
// throw new RuntimeException(e);
@ -285,7 +293,7 @@ public class DlAllDataService {
.type(exportType.getRemark())
.transportType(1)
.scheduleType(0)
.fromType(1)
.fromType(1).remark(remark)
.startTime(DateUtil.getDateTime())
.updateTime(new Date())
.cacheFilePath(fileName)
@ -298,7 +306,7 @@ public class DlAllDataService {
}
private void writeFile(String filePath, String content) throws IOException {
String folder = filePath.substring(0,filePath.lastIndexOf('/')-1);
String folder = filePath.substring(0, filePath.lastIndexOf('/') - 1);
File file = new File(folder);
if (!file.exists()) {
file.mkdirs();
@ -346,7 +354,7 @@ public class DlAllDataService {
log.info("下载所有国家库DI信息--");
BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest();
basicExportStatusRequest.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS);
basicExportStatusRequest.setStatus(BasicExportStatusEnum.WAIT_BUILT.getCode());
basicExportStatusRequest.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode());
basicExportStatusRequest.setType(NEW_ALL_UDIS);
basicExportStatusRequest.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
BaseResponse<List<BasicExportStatusEntity>> basicStatuss = spGetHttp.getBasicStatus(basicExportStatusRequest);
@ -390,7 +398,7 @@ public class DlAllDataService {
//记录下载日志
myEntity.setCacheFilePath(fileName);
myEntity.setStatus(Constant.SYNC_STATUS_WAIT_DL);
myEntity.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode());
myEntity.setTransportType(BasicProcessStatus.INTERFACE_TYPE);
myEntity.setCacheFilePath(fileName);
basicExportService.updateExportStatus(myEntity);

@ -16,4 +16,7 @@ public class Constant {
public static final int SYNC_STATUS_FAIL = 2; //处理失败
public static final int SYNC_STATUS_WAIT = 0; //等待处理
public static final int SYNC_STATUS_WAIT_DL = 3; //等待下游下载
public static final String SYNC_REMARK = "syncRemark";
}

@ -1,4 +1,4 @@
spring.profiles.active=pro
spring.profiles.active=dev
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.config-location=classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations=classpath:mybatis/mapper/*/*.xml

Loading…
Cancel
Save