sap基础数据同步,更新时段修改

highway
zhaoxiaolin 1 year ago
parent 50da3686fb
commit 73d26c1f8b

@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -81,8 +82,12 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++product同步开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
Date maxTime = sapBomMapper.getProductMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getProductMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
qo.setLaeda(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
@ -113,8 +118,12 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++bom同步开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
Date maxTime = sapBomMapper.getProductMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getProductMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
@ -131,7 +140,6 @@ public class SapController extends BaseController {
/**
* 线
* @param SapRouterQuery qo
* @return
*/
@PostMapping("/sapRouterSync")
@ -147,8 +155,12 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++工艺同步开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
Date maxTime = sapBomMapper.getRouteMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getRouteMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
qo.setWerks(dateSource.get("poolName").replace("ds_",""));//工厂
@ -227,8 +239,12 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++工作中心开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
qo.setWerks(dateSource.get("poolName").replace("ds_",""));//工厂
Date maxTime = sapBomMapper.getMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
@ -263,8 +279,12 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++供应商主数据开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
sapSupplierQuery.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
Date maxTime = sapBomMapper.getSupplierMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getSupplierMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
sapSupplierQuery.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
@ -301,8 +321,13 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++客户主数据开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
sapCustom.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
Date maxTime = sapBomMapper.getCustomMaxTime();
if(maxTime != null){
Date maxTime0 = sapBomMapper.getCustomMaxTime();
if(maxTime0 != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
sapCustom.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}

Loading…
Cancel
Save