1.修改第三方系统接口查询排序

2.修改数据同步查询,读取配置参数
3.手动同步接口修改,使用异步执行
master
x_z 3 years ago
parent 6ede15e5cc
commit 64cfc64c11

@ -1,8 +1,8 @@
package com.glxp.api.admin.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
import com.glxp.api.admin.entity.basic.BasicExportStatusTimeEntity;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
@ -11,10 +11,12 @@ import com.glxp.api.admin.req.info.DeleteRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.basic.BasicExportService;
import com.glxp.api.admin.service.basic.BasicExportTimeService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.thread.HeartService;
import com.glxp.api.admin.util.RedisUtil;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -24,6 +26,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@RestController
public class SpsSyncExportStatusController {
@ -34,6 +37,8 @@ public class SpsSyncExportStatusController {
BasicExportTimeService basicExportTimeService;
@Resource
RedisUtil redisUtil;
@Resource
private HeartService heartService;
@GetMapping("/spssync/basic/udiinfo/getStatus")
@ -100,79 +105,26 @@ public class SpsSyncExportStatusController {
@PostMapping("/spssync/basic/schedule/create")
public BaseResponse createSchedule(@RequestBody BasicExportStatusRequest basicExportStatusRequest) {
if (basicExportStatusRequest.getCreateType() == 1) {
//自动创建要求被下载已完成单据任务
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData("AutoDownloadOrder", 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,"任务已存在!");
}
} else if (basicExportStatusRequest.getCreateType() == 2) {
//自动创建要求被下载单据类型任务
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData("AutoDownloadBusType", 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,"任务已存在!");
}
} else if (basicExportStatusRequest.getCreateType() == 3) {
//自动创建要求被下载基础信息任务
BasicExportStatusEntity basicExportStatusEntity3 = basicExportService.findByData("AutoDownloadAllData", 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,"任务已存在!");
}
} else if (basicExportStatusRequest.getCreateType() == 4) {
//自动创建要求被下载同步库DI信息
BasicExportStatusEntity basicExportStatusEntity4 = basicExportService.findByData("AutoDownloadDiProducts", 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,"任务已存在!");
}
if (null == basicExportStatusRequest || null == basicExportStatusRequest.getCreateType()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return ResultVOUtils.success("创建成功!");
if (basicExportStatusRequest.getCreateType().equals(1)) {
//同步单据
ThreadUtil.execAsync(() -> {
heartService.uploadAllOrder();
});
} else if (basicExportStatusRequest.getCreateType().equals(2)) {
//同步单据类型
ThreadUtil.execAsync(() -> {
heartService.uploadAllBus();
});
} else if (basicExportStatusRequest.getCreateType().equals(3)) {
//同步基础信息
ThreadUtil.execAsync(() -> {
heartService.uploadAllData();
});
}
return ResultVOUtils.success();
}
}

@ -15,6 +15,7 @@ import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.admin.util.SpGetHttp;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -32,8 +33,20 @@ public class HeartService {
@Resource
BasicExportTimeService basicExportTimeService;
public void uploadAllOrder() {
//自动创建要求被下载已完成单据任务
public BaseResponse uploadAllOrder() {
try {
Thread.sleep(50000);
} catch (Exception e) {
}
SpsSyncOrderResponse spsSyncOrderResponse = upBasicService.upAllOrder();
if (CollUtil.isEmpty(spsSyncOrderResponse.getOrderEntities())
&& CollUtil.isEmpty(spsSyncOrderResponse.getOrderDetailEntityList())
&& CollUtil.isEmpty(spsSyncOrderResponse.getWarehouseEntityList())) {
//无数据不记录日志
return ResultVOUtils.success("无数据");
}
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData("AutoUploadOrder", 0);
if (basicExportStatusEntity1 == null) {
BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity();
@ -47,28 +60,30 @@ public class HeartService {
basicExportService.insertExportStatus(orderStatusEntity);
basicExportStatusEntity1 = orderStatusEntity;
}
SpsSyncOrderResponse spsSyncOrderResponse = upBasicService.upAllOrder();
BasicExportStatusTimeEntity basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime(DateUtil.formatDate(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
basicExportStatusTimeEntity.setKey("AutoUploadOrder");
if (CollUtil.isEmpty(spsSyncOrderResponse.getWarehouseEntityList()) && CollUtil.isEmpty(spsSyncOrderResponse.getOrderEntities()) && CollUtil.isEmpty(spsSyncOrderResponse.getOrderDetailEntityList())) {
basicExportStatusEntity1.setRemark("当前没有数据需要更新");
BaseResponse<String> baseResponse1 = spGetHttp.postAllOrder(spsSyncOrderResponse);
if (baseResponse1.getCode() == 20000) {
basicExportStatusEntity1.setStatus(1);
basicExportStatusEntity1.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
BaseResponse<String> baseResponse1 = spGetHttp.postAllOrder(spsSyncOrderResponse);
if (baseResponse1.getCode() == 20000) {
basicExportStatusEntity1.setStatus(1);
basicExportStatusEntity1.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
basicExportStatusEntity1.setRemark(baseResponse1.getMessage());
}
basicExportStatusEntity1.setRemark(baseResponse1.getMessage());
}
basicExportStatusEntity1.setUpdateTime(new Date());
basicExportService.updateExportStatus(basicExportStatusEntity1);
return ResultVOUtils.success();
}
public void uploadAllBus() {
public BaseResponse uploadAllBus() {
SpsSyncBusResponse spsSyncBusResponse = upBasicService.upAllBus();
if (CollUtil.isEmpty(spsSyncBusResponse.getBussinessOriginTypeEntities())
&& CollUtil.isEmpty(spsSyncBusResponse.getBussinessLocalTypeEntities())
&& CollUtil.isEmpty(spsSyncBusResponse.getBussinessTypeEntities())) {
return ResultVOUtils.success("无数据");
}
//自动创建要求被下载单据类型任务
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData("AutoUploadBusType", 0);
if (basicExportStatusEntity2 == null) {
@ -83,31 +98,39 @@ public class HeartService {
basicExportService.insertExportStatus(busTypetatusEntity);
basicExportStatusEntity2 = busTypetatusEntity;
}
SpsSyncBusResponse spsSyncBusResponse = upBasicService.upAllBus();
BasicExportStatusTimeEntity basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime(DateUtil.formatDate(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
basicExportStatusTimeEntity.setKey("AutoUploadBusType");
if (CollUtil.isEmpty(spsSyncBusResponse.getBussinessOriginTypeEntities()) && CollUtil.isEmpty(spsSyncBusResponse.getBussinessLocalTypeEntities())
&& CollUtil.isEmpty(spsSyncBusResponse.getBussinessTypeEntities())) {
basicExportStatusEntity2.setRemark("当前没有数据需要更新!");
BaseResponse<String> baseResponse2 = spGetHttp.postAllBus(spsSyncBusResponse);
if (baseResponse2.getCode() == 20000) {
basicExportStatusEntity2.setStatus(1);
basicExportStatusEntity2.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
BaseResponse<String> baseResponse2 = spGetHttp.postAllBus(spsSyncBusResponse);
if (baseResponse2.getCode() == 20000) {
basicExportStatusEntity2.setStatus(1);
basicExportStatusEntity2.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
basicExportStatusEntity2.setRemark(baseResponse2.getMessage());
}
basicExportStatusEntity2.setRemark(baseResponse2.getMessage());
}
basicExportStatusEntity2.setUpdateTime(new Date());
basicExportService.updateExportStatus(basicExportStatusEntity2);
return ResultVOUtils.success();
}
public void uploadAllData() {
public BaseResponse uploadAllData() {
SpsSyncDataResponse syncDataResponse = upBasicService.upAllData();
if (CollUtil.isEmpty(syncDataResponse.getInvWarehouseEntities())
&& CollUtil.isEmpty(syncDataResponse.getUdiInfoEntities())
&& CollUtil.isEmpty(syncDataResponse.getBasicUnitMaintainEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrInvWarehouseEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrCorpEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrProductsEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrOrderEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrOrderDetailEntities())
&& CollUtil.isEmpty(syncDataResponse.getCompanyProductRelevanceEntities())
&& CollUtil.isEmpty(syncDataResponse.getUdiRelevanceEntities())) {
//数据不记录日志
return ResultVOUtils.success("无数据");
}
BasicExportStatusEntity basicExportStatusEntity3 = basicExportService.findByData("AutoUploadAllData", 0);
if (basicExportStatusEntity3 == null) {
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
@ -120,36 +143,22 @@ public class HeartService {
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
basicExportService.insertExportStatus(basicExportStatusEntity);
basicExportStatusEntity3 = basicExportStatusEntity;
}
SpsSyncDataResponse syncDataResponse = upBasicService.upAllData();
BasicExportStatusTimeEntity basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime(DateUtil.formatDate(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
basicExportStatusTimeEntity.setKey("AutoUploadAllData");
if (CollUtil.isEmpty(syncDataResponse.getThrOrderDetailEntities()) && CollUtil.isEmpty(syncDataResponse.getThrOrderEntities())
&& CollUtil.isEmpty(syncDataResponse.getInvWarehouseEntities())
&& CollUtil.isEmpty(syncDataResponse.getBasicUnitMaintainEntities())
&& CollUtil.isEmpty(syncDataResponse.getCompanyProductRelevanceEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrCorpEntities())
&& CollUtil.isEmpty(syncDataResponse.getUdiInfoEntities())
&& CollUtil.isEmpty(syncDataResponse.getUdiRelevanceEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrProductsEntities())
&& CollUtil.isEmpty(syncDataResponse.getThrInvWarehouseEntities())
) {
basicExportStatusEntity3.setRemark("当前没有数据需要更新");
BaseResponse<String> baseResponse = spGetHttp.postAllBaseData(syncDataResponse);
if (baseResponse.getCode() == 20000) {
basicExportStatusEntity3.setStatus(1);
basicExportStatusEntity3.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
BaseResponse<String> baseResponse = spGetHttp.postAllBaseData(syncDataResponse);
if (baseResponse.getCode() == 20000) {
basicExportStatusEntity3.setStatus(1);
basicExportStatusEntity3.setEndTime(new Date());
basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
} else {
basicExportStatusEntity3.setRemark(baseResponse.getMessage());
}
basicExportStatusEntity3.setRemark(baseResponse.getMessage());
}
basicExportStatusEntity3.setUpdateTime(new Date());
basicExportService.updateExportStatus(basicExportStatusEntity3);
return ResultVOUtils.success();
}
public void uploadScheduleList() {

@ -3,7 +3,9 @@ package com.glxp.api.admin.thread;
import cn.hutool.core.collection.CollUtil;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.dao.basic.UdiInfoDao;
import com.glxp.api.admin.dao.info.SyncDataSetDao;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.info.SyncDataSetEntity;
import com.glxp.api.admin.entity.inout.ErpOrderEntity;
import com.glxp.api.admin.entity.inout.OrderEntity;
import com.glxp.api.admin.entity.inout.WarehouseEntity;
@ -58,9 +60,14 @@ public class UpBasicService {
private CompanyProductRelevanceService companyProductRelevanceService;
@Resource
private BasicExportTimeService basicExportTimeService;
@Resource
private SyncDataSetDao syncDataSetDao;
public SpsSyncDataResponse upAllData() {
SpsSyncDataResponse syncDataResponse = new SpsSyncDataResponse();
SyncDataSetEntity syncDataSetEntity = syncDataSetDao.selectSet();
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByKey("AutoUploadAllData");
if (basicExportStatusTimeEntity == null) {
@ -70,59 +77,81 @@ public class UpBasicService {
}
//仓库字典
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
filterInvWarehouseRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterInvWarehouse(filterInvWarehouseRequest);
if (syncDataSetEntity.isBasicInv()) {
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
filterInvWarehouseRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterInvWarehouse(filterInvWarehouseRequest);
syncDataResponse.setInvWarehouseEntities(invWarehouseEntities);
}
//耗材字典
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
filterUdiInfoRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.filterUdiEntity(filterUdiInfoRequest);
List<String> results = new ArrayList<>();
udiRelevanceEntities.forEach(
item -> {
results.add(item.getUuid() + "");
}
);
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
if (results.size() > 0)
udiInfoEntities = udiInfoDao.batchSelectByUuid(results);
if (syncDataSetEntity.isBasicProducts()) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
filterUdiInfoRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.filterUdiEntity(filterUdiInfoRequest);
List<String> results = new ArrayList<>();
udiRelevanceEntities.forEach(
item -> {
results.add(item.getUuid() + "");
}
);
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
if (results.size() > 0)
udiInfoEntities = udiInfoDao.batchSelectByUuid(results);
syncDataResponse.setUdiInfoEntities(udiInfoEntities);
syncDataResponse.setUdiRelevanceEntities(udiRelevanceEntities);
}
//往来单位字典
BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
basicUnitMaintainFilterRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
if (syncDataSetEntity.isBasicCorp()) {
BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
basicUnitMaintainFilterRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
syncDataResponse.setBasicUnitMaintainEntities(basicUnitMaintainEntities);
}
//第三方仓库信息
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
if (syncDataSetEntity.isBasicInv()) {
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setLastUpdateTime(basicExportStatusTimeEntity.getLastUpdateTime());
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
syncDataResponse.setThrInvWarehouseEntities(thrInvWarehouseEntities);
}
//第三方往来单位
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrCorpRequest);
List<ThrCorpEntity> thrCorpEntities = thrCorpService.filterThrCorps(filterThrCorpRequest);
if (syncDataSetEntity.isBasicThirdCorp()) {
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrCorpRequest);
List<ThrCorpEntity> thrCorpEntities = thrCorpService.filterThrCorps(filterThrCorpRequest);
syncDataResponse.setThrCorpEntities(thrCorpEntities);
}
//第三方产品信息
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrProductsRequest);
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
if (syncDataSetEntity.isBasicThirdProducts()) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrProductsRequest);
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
syncDataResponse.setThrProductsEntities(thrProductsEntities);
}
//第三方业务单据
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrOrderRequest);
List<ThrOrderDetailEntity> allOrderDetailEntities = 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.isEmpty()) {
allOrderDetailEntities.addAll(thrOrderDetailEntities);
if (syncDataSetEntity.isBasicThirdBusOrder()) {
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterThrOrderRequest);
List<ThrOrderDetailEntity> allOrderDetailEntities = 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.isEmpty()) {
allOrderDetailEntities.addAll(thrOrderDetailEntities);
}
}
syncDataResponse.setThrOrderDetailEntities(allOrderDetailEntities);
syncDataResponse.setThrOrderEntities(thrOrderEntities);
}
//供应商产品信息关联表
@ -130,20 +159,8 @@ public class UpBasicService {
BeanUtils.copyProperties(basicExportStatusTimeEntity, filterCompanyProductRelevanceRequest);
List<CompanyProductRelevanceEntity> companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest);
SpsSyncDataResponse syncDataResponse = new SpsSyncDataResponse();
syncDataResponse.setCompanyProductRelevanceEntities(companyProductRelevanceEntities);
syncDataResponse.setInvWarehouseEntities(invWarehouseEntities);
syncDataResponse.setBasicUnitMaintainEntities(basicUnitMaintainEntities);
syncDataResponse.setThrCorpEntities(thrCorpEntities);
syncDataResponse.setThrInvWarehouseEntities(thrInvWarehouseEntities);
syncDataResponse.setThrOrderDetailEntities(allOrderDetailEntities);
syncDataResponse.setThrOrderEntities(thrOrderEntities);
syncDataResponse.setUdiInfoEntities(udiInfoEntities);
syncDataResponse.setThrProductsEntities(thrProductsEntities);
syncDataResponse.setUdiRelevanceEntities(udiRelevanceEntities);
return syncDataResponse;
}
//单据类型
@ -155,25 +172,38 @@ public class UpBasicService {
BussinessOriginTypeService bussinessOriginTypeService;
public SpsSyncBusResponse upAllBus() {
SpsSyncBusResponse spsSyncBusResponse = new SpsSyncBusResponse();
SyncDataSetEntity syncDataSetEntity = syncDataSetDao.selectSet();
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByKey("AutoUploadBusType");
if (basicExportStatusTimeEntity == null) {
basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime("1949-10-01 09:00:00");
}
BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessTypeFilterRequest);
List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterAllList(bussinessTypeFilterRequest);
BussinessLocalTypeFilterRequest bussinessLocalTypeFilterRequest = new BussinessLocalTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessLocalTypeFilterRequest);
List<BussinessLocalTypeEntity> bussinessLocalTypeEntities = bussinessLocalTypeService.filterAllList(bussinessLocalTypeFilterRequest);
BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest = new BussinessOriginTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessOriginTypeFilterRequest);
List<BussinessOriginTypeEntity> bussinessOriginTypeEntities = bussinessOriginTypeService.filterList(bussinessOriginTypeFilterRequest);
SpsSyncBusResponse spsSyncBusResponse = new SpsSyncBusResponse();
spsSyncBusResponse.setBussinessTypeEntities(bussinessTypeEntities);
spsSyncBusResponse.setBussinessLocalTypeEntities(bussinessLocalTypeEntities);
spsSyncBusResponse.setBussinessOriginTypeEntities(bussinessOriginTypeEntities);
//业务单据类型
if (syncDataSetEntity.isTypeBus()) {
BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessTypeFilterRequest);
List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterAllList(bussinessTypeFilterRequest);
spsSyncBusResponse.setBussinessTypeEntities(bussinessTypeEntities);
}
//扫码单据类型
if (syncDataSetEntity.isTypeScan()) {
BussinessLocalTypeFilterRequest bussinessLocalTypeFilterRequest = new BussinessLocalTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessLocalTypeFilterRequest);
List<BussinessLocalTypeEntity> bussinessLocalTypeEntities = bussinessLocalTypeService.filterAllList(bussinessLocalTypeFilterRequest);
spsSyncBusResponse.setBussinessLocalTypeEntities(bussinessLocalTypeEntities);
}
//第三方单据类型
if (syncDataSetEntity.isTypeThird()) {
BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest = new BussinessOriginTypeFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, bussinessOriginTypeFilterRequest);
List<BussinessOriginTypeEntity> bussinessOriginTypeEntities = bussinessOriginTypeService.filterList(bussinessOriginTypeFilterRequest);
spsSyncBusResponse.setBussinessOriginTypeEntities(bussinessOriginTypeEntities);
}
return spsSyncBusResponse;
}
@ -187,36 +217,40 @@ public class UpBasicService {
OrderDetailService orderDetailService;
public SpsSyncOrderResponse upAllOrder() {
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByKey("AutoUploadOrder");
if (basicExportStatusTimeEntity == null) {
basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime("1949-10-01 09:00:00");
}
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, orderFilterRequest);
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
List<OrderEntity> orderEntities = orderService.findAllByTime(orderFilterRequest);
List<ErpOrderEntity> allOrderDetailEntityList = new ArrayList<>();
List<WarehouseEntity> warehouseEntityList = new ArrayList<>();
if (CollUtil.isNotEmpty(orderEntities)) {
for (OrderEntity orderEntity : orderEntities) {
List<ErpOrderEntity> orderDetailEntityList = orderDetailService.filterAllByOrderIdFk(orderEntity.getId());
if (CollUtil.isNotEmpty(orderDetailEntityList)) {
allOrderDetailEntityList.addAll(orderDetailEntityList);
}
List<WarehouseEntity> codes = codesService.findByReceiptId(orderEntity.getId());
if (CollUtil.isNotEmpty(codes)) {
warehouseEntityList.addAll(codes);
SpsSyncOrderResponse syncOrderResponse = new SpsSyncOrderResponse();
//查询数据同步设置
SyncDataSetEntity syncDataSetEntity = syncDataSetDao.selectSet();
//已完成单据
if (syncDataSetEntity.isOrderScanFinish()) {
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByKey("AutoUploadOrder");
if (basicExportStatusTimeEntity == null) {
basicExportStatusTimeEntity = new BasicExportStatusTimeEntity();
basicExportStatusTimeEntity.setLastUpdateTime("1949-10-01 09:00:00");
}
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
BeanUtils.copyProperties(basicExportStatusTimeEntity, orderFilterRequest);
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
List<OrderEntity> orderEntities = orderService.findAllByTime(orderFilterRequest);
List<ErpOrderEntity> allOrderDetailEntityList = new ArrayList<>();
List<WarehouseEntity> warehouseEntityList = new ArrayList<>();
if (CollUtil.isNotEmpty(orderEntities)) {
for (OrderEntity orderEntity : orderEntities) {
List<ErpOrderEntity> orderDetailEntityList = orderDetailService.filterAllByOrderIdFk(orderEntity.getId());
if (CollUtil.isNotEmpty(orderDetailEntityList)) {
allOrderDetailEntityList.addAll(orderDetailEntityList);
}
List<WarehouseEntity> codes = codesService.findByReceiptId(orderEntity.getId());
if (CollUtil.isNotEmpty(codes)) {
warehouseEntityList.addAll(codes);
}
}
}
syncOrderResponse.setOrderEntities(orderEntities);
syncOrderResponse.setOrderDetailEntityList(allOrderDetailEntityList);
syncOrderResponse.setWarehouseEntityList(warehouseEntityList);
}
SpsSyncOrderResponse syncOrderResponse = new SpsSyncOrderResponse();
syncOrderResponse.setOrderEntities(orderEntities);
syncOrderResponse.setOrderDetailEntityList(allOrderDetailEntityList);
syncOrderResponse.setWarehouseEntityList(warehouseEntityList);
return syncOrderResponse;
}
}

@ -23,6 +23,7 @@
and scheduleType = #{scheduleType}
</if>
</where>
order by updateTime desc
</select>

@ -33,7 +33,7 @@
AND enabled = #{enabled}
</if>
</where>
order by id desc
order by id
</select>
<select id="selectByKey" parameterType="Map"
resultType="com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity">

Loading…
Cancel
Save