You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.4 KiB
Java
90 lines
3.4 KiB
Java
package com.glxp.api.service.sync;
|
|
|
|
import com.glxp.api.entity.thrsys.ThrCorpEntity;
|
|
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
|
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
|
import com.glxp.api.entity.thrsys.ThrProductsEntity;
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
import com.glxp.api.res.sync.SpsSyncThrDataResponse;
|
|
import com.glxp.api.res.sync.SpsSyncThrProductsResponse;
|
|
import com.glxp.api.res.system.SyncDataSetResponse;
|
|
import com.glxp.api.service.thrsys.ThrCorpService;
|
|
import com.glxp.api.service.thrsys.ThrDeptService;
|
|
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
|
|
import com.glxp.api.service.thrsys.ThrProductsService;
|
|
import com.glxp.api.util.DateUtil;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 上传第三方基础数据到自助平台
|
|
*/
|
|
@Service
|
|
public class UpThrDataService {
|
|
|
|
@Resource
|
|
private SyncDataSetService syncDataSetService;
|
|
@Resource
|
|
private ThrDeptService thrDeptService;
|
|
@Resource
|
|
private ThrInvWarehouseService thrInvWarehouseService;
|
|
@Resource
|
|
private ThrProductsService thrProductsService;
|
|
@Resource
|
|
private ThrCorpService thrCorpService;
|
|
|
|
/**
|
|
* 上传最近更新的第三方基础信息数据
|
|
*
|
|
* @param spsSyncDataRequest
|
|
* @return
|
|
*/
|
|
public SpsSyncThrDataResponse upThrData(SpsSyncDataRequest spsSyncDataRequest) {
|
|
SpsSyncThrDataResponse spsSyncThrDataResponse = new SpsSyncThrDataResponse();
|
|
//查询数据同步设置
|
|
SyncDataSetResponse syncDataSet = syncDataSetService.selectSet();
|
|
|
|
//第三方部门信息
|
|
if (syncDataSet.getBasicThirdDept() == 1) {
|
|
List<ThrDeptEntity> deptEntities = thrDeptService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
|
spsSyncThrDataResponse.setDeptEntities(deptEntities);
|
|
}
|
|
|
|
//第三方仓库信息
|
|
if (syncDataSet.getBasicThirdInv() == 1) {
|
|
List<ThrInvWarehouseEntity> invWarehouseEntities = thrInvWarehouseService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
|
spsSyncThrDataResponse.setInvWarehouseEntities(invWarehouseEntities);
|
|
}
|
|
|
|
//第三方往来单位信息
|
|
if (syncDataSet.getBasicThirdCorp() == 1) {
|
|
List<ThrCorpEntity> corpEntities = thrCorpService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
|
spsSyncThrDataResponse.setCorpEntities(corpEntities);
|
|
}
|
|
return spsSyncThrDataResponse;
|
|
}
|
|
|
|
/**
|
|
* 上传最近更新的第三方产品信息数据
|
|
*
|
|
* @param spsSyncDataRequest
|
|
* @return
|
|
*/
|
|
public SpsSyncThrProductsResponse upThrProducts(SpsSyncDataRequest spsSyncDataRequest) {
|
|
SpsSyncThrProductsResponse spsSyncThrProductsResponse = new SpsSyncThrProductsResponse();
|
|
//查询数据同步设置
|
|
SyncDataSetResponse syncDataSet = syncDataSetService.selectSet();
|
|
|
|
//第三方产品信息
|
|
if (syncDataSet.getBasicThirdProducts() == 1) {
|
|
List<ThrProductsEntity> thrProductsEntities = thrProductsService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
|
spsSyncThrProductsResponse.setProductsEntities(thrProductsEntities);
|
|
}
|
|
|
|
return spsSyncThrProductsResponse;
|
|
}
|
|
|
|
}
|