|
|
|
@ -5,16 +5,16 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.StockOrderEntity;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.BasicExportStatusRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.BasicExportTimeRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.SpsSyncDataRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.info.DeleteRequest;
|
|
|
|
|
import com.glxp.sale.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.BasicUnitMaintainExportResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.SpsSyncDataResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.UdiRelevanceExportJsonResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.*;
|
|
|
|
|
import com.glxp.sale.admin.res.inventory.InvWarehouseExportResponse;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.BasicExportService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.BasicExportTimeService;
|
|
|
|
@ -41,7 +41,8 @@ public class SpsSyncExportStatusController {
|
|
|
|
|
BasicExportTimeService basicExportTimeService;
|
|
|
|
|
@Resource
|
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SpsSyncDownloadService spsSyncDownloadService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/spssync/basic/udiinfo/getStatus")
|
|
|
|
|
public BaseResponse getStatus(BasicExportStatusRequest basicExportStatusRequest) {
|
|
|
|
@ -110,76 +111,121 @@ public class SpsSyncExportStatusController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (basicExportStatusRequest.getCreateType() == 1) {
|
|
|
|
|
|
|
|
|
|
//自动创建要求被下载已完成单据任务
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData("AutoDownloadOrder", 0);
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData(ConstantStatus.SYNC_SCAN_ORDER, 0);
|
|
|
|
|
if (basicExportStatusEntity1 == null) {
|
|
|
|
|
BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
orderStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
orderStatusEntity.setIdDatas("AutoDownloadOrder");
|
|
|
|
|
orderStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
|
|
|
|
|
orderStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
orderStatusEntity.setStatus(0);
|
|
|
|
|
orderStatusEntity.setStartTime(new Date());
|
|
|
|
|
orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(orderStatusEntity);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(501,"任务已存在!");
|
|
|
|
|
BaseResponse<SpsSyncOrderResponse> baseResponse = spsSyncDownloadService.findOrder(getRequest(ConstantStatus.SYNC_SCAN_ORDER));
|
|
|
|
|
SpsSyncOrderResponse syncOrderResponse = baseResponse.getData();
|
|
|
|
|
if (CollUtil.isNotEmpty(syncOrderResponse.getOrderEntities())) {
|
|
|
|
|
BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
orderStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
orderStatusEntity.setIdDatas(ConstantStatus.SYNC_SCAN_ORDER);
|
|
|
|
|
orderStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
|
|
|
|
|
orderStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
orderStatusEntity.setStatus(0);
|
|
|
|
|
orderStatusEntity.setStartTime(new Date());
|
|
|
|
|
orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(orderStatusEntity);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "当前暂无更新数据需要同步!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "当前任务已存在!");
|
|
|
|
|
}
|
|
|
|
|
} else if (basicExportStatusRequest.getCreateType() == 2) {
|
|
|
|
|
//自动创建要求被下载单据类型任务
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData("AutoDownloadBusType", 0);
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData(ConstantStatus.SYNC_BUS_TYPE, 0);
|
|
|
|
|
if (basicExportStatusEntity2 == null) {
|
|
|
|
|
BasicExportStatusEntity busTypetatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
busTypetatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
busTypetatusEntity.setIdDatas("AutoDownloadBusType");
|
|
|
|
|
busTypetatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
|
|
|
|
|
busTypetatusEntity.setUpdateTime(new Date());
|
|
|
|
|
busTypetatusEntity.setStatus(0);
|
|
|
|
|
busTypetatusEntity.setStartTime(new Date());
|
|
|
|
|
busTypetatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(busTypetatusEntity);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(501,"任务已存在!");
|
|
|
|
|
BaseResponse<SpsSyncBusResponse> baseResponse = spsSyncDownloadService.findBusType(getRequest(ConstantStatus.SYNC_BUS_TYPE));
|
|
|
|
|
SpsSyncBusResponse spsSyncBusResponse = baseResponse.getData();
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusResponse.getBussinessLocalTypeEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncBusResponse.getBussinessOriginTypeEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncBusResponse.getBussinessTypeEntities())) {
|
|
|
|
|
BasicExportStatusEntity busTypetatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
busTypetatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
busTypetatusEntity.setIdDatas(ConstantStatus.SYNC_BUS_TYPE);
|
|
|
|
|
busTypetatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
|
|
|
|
|
busTypetatusEntity.setUpdateTime(new Date());
|
|
|
|
|
busTypetatusEntity.setStatus(0);
|
|
|
|
|
busTypetatusEntity.setStartTime(new Date());
|
|
|
|
|
busTypetatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(busTypetatusEntity);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "当前暂无更新数据需要同步!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "任务已存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (basicExportStatusRequest.getCreateType() == 3) {
|
|
|
|
|
|
|
|
|
|
//自动创建要求被下载基础信息任务
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity3 = basicExportService.findByData("AutoDownloadAllData", 0);
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity3 = basicExportService.findByData(ConstantStatus.SYNC_BASIC_DATA, 0);
|
|
|
|
|
if (basicExportStatusEntity3 == null) {
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicExportStatusEntity.setIdDatas("AutoDownloadAllData");
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(501,"任务已存在!");
|
|
|
|
|
BaseResponse<SpsSyncDataResponse> baseResponse = spsSyncDownloadService.findProductInfo(getRequest(ConstantStatus.SYNC_BASIC_DATA));
|
|
|
|
|
SpsSyncDataResponse spsSyncDataResponse = baseResponse.getData();
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncDataResponse.getThrOrderDetailEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getThrOrderEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getInvWarehouseEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getBasicUnitMaintainEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getCompanyProductRelevanceEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getThrCorpEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getUdiInfoEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getUdiRelevanceEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getThrProductsEntities())
|
|
|
|
|
|| CollUtil.isNotEmpty(spsSyncDataResponse.getThrInvWarehouseEntities())
|
|
|
|
|
) {
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicExportStatusEntity.setIdDatas(ConstantStatus.SYNC_BASIC_DATA);
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "当前暂无更新数据需要同步!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "任务已存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (basicExportStatusRequest.getCreateType() == 4) {
|
|
|
|
|
//自动创建要求被下载同步库DI信息
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity4 = basicExportService.findByData("AutoDownloadDiProducts", 0);
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity4 = basicExportService.findByData(ConstantStatus.SYNC_DI_PRODUCTS, 0);
|
|
|
|
|
if (basicExportStatusEntity4 == null) {
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicExportStatusEntity.setIdDatas("AutoDownloadDiProducts");
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.NEW_ALL_DI);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(501,"任务已存在!");
|
|
|
|
|
BaseResponse<SpSyncUdiResponse> baseResponse = spsSyncDownloadService.syncUdi(getRequest(ConstantStatus.SYNC_DI_PRODUCTS));
|
|
|
|
|
SpSyncUdiResponse spSyncUdiResponse = baseResponse.getData();
|
|
|
|
|
if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList())
|
|
|
|
|
|| CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) {
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicExportStatusEntity.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS);
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.NEW_ALL_DI);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "当前暂无更新数据需要同步!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(501, "任务已存在!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("创建成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SpsSyncDataRequest getRequest(String type) {
|
|
|
|
|
SpsSyncDataRequest spsSyncDataRequest = new SpsSyncDataRequest();
|
|
|
|
|
spsSyncDataRequest.setPage(1);
|
|
|
|
|
spsSyncDataRequest.setLimit(1);
|
|
|
|
|
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByType(type);
|
|
|
|
|
spsSyncDataRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
|
|
|
|
|
return spsSyncDataRequest;
|
|
|
|
|
}
|
|
|
|
|
}
|