|
|
|
@ -183,7 +183,30 @@ public class SapController extends BaseController {
|
|
|
|
|
@Log(title = "供应商主数据", businessType = BusinessType.SAP)
|
|
|
|
|
public R sapSupplierSync(){
|
|
|
|
|
SapSupplierQuery sapSupplierQuery = new SapSupplierQuery();
|
|
|
|
|
return sapWorkCenterService.sapSupplierSync(sapSupplierQuery);
|
|
|
|
|
// 加载sf-cloud库的sys_datasource
|
|
|
|
|
SysUser sysUser = new SysUser();
|
|
|
|
|
sysUser.setUserId(1L);
|
|
|
|
|
R<List<Map<String, String>>> dateSources0 = remoteUserService.getPoolNameList(sysUser);
|
|
|
|
|
List<Map<String, String>> dateSources = dateSources0.getData();
|
|
|
|
|
dateSources.forEach(dateSource -> {
|
|
|
|
|
logger.info("++++++++++++" + dateSource.get("poolName") + "++++供应商主数据开始++++++++++");
|
|
|
|
|
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
|
|
|
|
|
sapSupplierQuery.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
|
|
|
|
|
Date maxTime = sapBomMapper.getMaxTime();
|
|
|
|
|
if(maxTime != null){
|
|
|
|
|
sapSupplierQuery.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
R r = sapWorkCenterService.sapSupplierSync(sapSupplierQuery);
|
|
|
|
|
if(r.getCode()==200){
|
|
|
|
|
List<SapSupplier> dtos = (List<SapSupplier>) r.getData();
|
|
|
|
|
sapWorkCenterService.syncSupplier(dtos);
|
|
|
|
|
}else{
|
|
|
|
|
logger.error("++++++++++++" + dateSource.get("poolName")+"错误信息:"+ r.getMsg());
|
|
|
|
|
}
|
|
|
|
|
logger.error("++++++++++++" + dateSource.get("poolName") + "++++供应商主数据结束++++++++++");
|
|
|
|
|
});
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -195,7 +218,30 @@ public class SapController extends BaseController {
|
|
|
|
|
@Log(title = "客户主数据", businessType = BusinessType.SAP)
|
|
|
|
|
public R sapCustomSync(){
|
|
|
|
|
SapCustom sapCustom = new SapCustom();
|
|
|
|
|
return sapWorkCenterService.sapCustomSync(sapCustom);
|
|
|
|
|
// 加载sf-cloud库的sys_datasource
|
|
|
|
|
SysUser sysUser = new SysUser();
|
|
|
|
|
sysUser.setUserId(1L);
|
|
|
|
|
R<List<Map<String, String>>> dateSources0 = remoteUserService.getPoolNameList(sysUser);
|
|
|
|
|
List<Map<String, String>> dateSources = dateSources0.getData();
|
|
|
|
|
dateSources.forEach(dateSource -> {
|
|
|
|
|
logger.info("++++++++++++" + dateSource.get("poolName") + "++++客户主数据开始++++++++++");
|
|
|
|
|
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
|
|
|
|
|
sapCustom.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
|
|
|
|
|
Date maxTime = sapBomMapper.getMaxTime();
|
|
|
|
|
if(maxTime != null){
|
|
|
|
|
sapCustom.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
R r = sapWorkCenterService.sapCustomSync(sapCustom);
|
|
|
|
|
if(r.getCode()==200){
|
|
|
|
|
List<SapCustom> dtos = (List<SapCustom>) r.getData();
|
|
|
|
|
sapWorkCenterService.syncCustom(dtos);
|
|
|
|
|
}else{
|
|
|
|
|
logger.error("++++++++++++" + dateSource.get("poolName")+"错误信息:"+ r.getMsg());
|
|
|
|
|
}
|
|
|
|
|
logger.error("++++++++++++" + dateSource.get("poolName") + "++++客户主数据结束++++++++++");
|
|
|
|
|
});
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|