|
|
|
@ -25,16 +25,15 @@ import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusTimeEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SyncDataSetEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.*;
|
|
|
|
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
|
|
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
|
|
|
import com.glxp.api.res.auth.InvSpaceResponse;
|
|
|
|
|
import com.glxp.api.res.sync.*;
|
|
|
|
|
import com.glxp.api.service.auth.*;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBusTypeChangeService;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
|
|
|
|
|
import com.glxp.api.service.thrsys.*;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
|
import com.glxp.api.util.RedisUtil;
|
|
|
|
@ -237,6 +236,11 @@ public class HeartService {
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getUserData(info, taskId, now, syncTime));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case THIRD_DATA:
|
|
|
|
|
if (needExec(info.getBasicThirdDept(), info.getBasicThirdInv(), info.getBasicThirdProducts(),info.getBasicThirdCorp())) {
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getThirdData(info, taskId, now, syncTime));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case COUNTRY_DI_DATA:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -571,7 +575,7 @@ public class HeartService {
|
|
|
|
|
if (needExec(info.getDepartment())) {
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
if (syncTime == null) {
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEPARTMENT);
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEPT_DATA);
|
|
|
|
|
} else {
|
|
|
|
|
map = syncTimeMap;
|
|
|
|
|
}
|
|
|
|
@ -689,6 +693,113 @@ public class HeartService {
|
|
|
|
|
return dataResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final ThrDeptService thrDeptService;
|
|
|
|
|
private final ThrInvWarehouseService thrInvWarehouseService;
|
|
|
|
|
private final ThrProductsService thrProductsService;
|
|
|
|
|
private final ThrCorpService thrCorpService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取第三方模块数据
|
|
|
|
|
*
|
|
|
|
|
* @param info 同步设置
|
|
|
|
|
* @param now 当前时间
|
|
|
|
|
* @param syncTime 同步时间 -- 传入时不操作exportTime表
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private SpsSyncThrDataResponse getThirdData(SyncDataSetEntity info, String taskId, Date now, Date syncTime) {
|
|
|
|
|
SpsSyncThrDataResponse dataResponse = null;
|
|
|
|
|
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
|
|
|
|
|
syncTimeMap.put("isNew", true);
|
|
|
|
|
syncTimeMap.put("oldDate", syncTime);
|
|
|
|
|
|
|
|
|
|
//确认有开启第三方部门信息同步
|
|
|
|
|
if (needExec(info.getBasicThirdDept())) {
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
if (syncTime == null) {
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_DEPT);
|
|
|
|
|
} else {
|
|
|
|
|
map = syncTimeMap;
|
|
|
|
|
}
|
|
|
|
|
List<ThrDeptEntity> deptEntityList = thrDeptService.list(Wrappers.lambdaQuery(ThrDeptEntity.class)
|
|
|
|
|
.le((boolean) map.get("isNew"), ThrDeptEntity::getUpdateTime, now)
|
|
|
|
|
.between(!(boolean) map.get("isNew"), ThrDeptEntity::getUpdateTime
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deptEntityList)) {
|
|
|
|
|
dataResponse = new SpsSyncThrDataResponse();
|
|
|
|
|
dataResponse.setDeptEntities(deptEntityList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//确认有开启第三方仓库信息同步
|
|
|
|
|
if(needExec(info.getBasicThirdInv())){
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
if (syncTime == null) {
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_WAREHOUSE);
|
|
|
|
|
} else {
|
|
|
|
|
map = syncTimeMap;
|
|
|
|
|
}
|
|
|
|
|
List<ThrInvWarehouseEntity> warehouseEntityList = thrInvWarehouseService.list(Wrappers.lambdaQuery(ThrInvWarehouseEntity.class)
|
|
|
|
|
.le((boolean) map.get("isNew"), ThrInvWarehouseEntity::getUpdateTime, now)
|
|
|
|
|
.between(!(boolean) map.get("isNew"), ThrInvWarehouseEntity::getUpdateTime
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(warehouseEntityList)) {
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
dataResponse = new SpsSyncThrDataResponse();
|
|
|
|
|
}
|
|
|
|
|
dataResponse.setInvWarehouseEntities(warehouseEntityList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//确认有开启仓库字典同步
|
|
|
|
|
if (needExec(info.getBasicThirdProducts())) {
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
if (syncTime == null) {
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_PRODUCTS);
|
|
|
|
|
} else {
|
|
|
|
|
map = syncTimeMap;
|
|
|
|
|
}
|
|
|
|
|
List<ThrProductsEntity> productsEntityList = thrProductsService.list(Wrappers.lambdaQuery(ThrProductsEntity.class)
|
|
|
|
|
.le((boolean) map.get("isNew"), ThrProductsEntity::getUpdateTime, now)
|
|
|
|
|
.between(!(boolean) map.get("isNew"), ThrProductsEntity::getUpdateTime
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(productsEntityList)) {
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
dataResponse = new SpsSyncThrDataResponse();
|
|
|
|
|
}
|
|
|
|
|
dataResponse.setProductsEntityList(productsEntityList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//确认有开启第三方往来单位信息同步
|
|
|
|
|
if (needExec(info.getBasicThirdCorp())) {
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
if (syncTime == null) {
|
|
|
|
|
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_CORP);
|
|
|
|
|
} else {
|
|
|
|
|
map = syncTimeMap;
|
|
|
|
|
}
|
|
|
|
|
List<ThrCorpEntity> corpEntities = thrCorpService.list(Wrappers.lambdaQuery(ThrCorpEntity.class)
|
|
|
|
|
.le((boolean) map.get("isNew"), ThrCorpEntity::getUpdateTime, now)
|
|
|
|
|
.between(!(boolean) map.get("isNew"), ThrCorpEntity::getUpdateTime
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(corpEntities)) {
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
dataResponse = new SpsSyncThrDataResponse();
|
|
|
|
|
}
|
|
|
|
|
dataResponse.setCorpEntities(corpEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dataResponse != null) {
|
|
|
|
|
dataResponse.setTaskId(taskId);
|
|
|
|
|
}
|
|
|
|
|
return dataResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否需要执行 由内向外
|
|
|
|
|
*
|
|
|
|
|