refactor(sales): 重构销售出库和销售退货插件的时间处理逻辑
- 将按小时分割时间的逻辑改为直接使用整天的时间范围 - 优化了 SoSaleOutPluginInitializerToC 和 SoSaleReturnPluginInitializerToC 类中的代码 - 注释掉了原有的按小时循环的代码,简化了逻辑 - 在测试类中添加了 executeBusiness 方法的调用,用于后续的接口测试
This commit is contained in:
parent
ceac1d668a
commit
6b58abc666
|
@ -2598,21 +2598,26 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
logger.info("OFS销售出库单同步U8C销售订单,目标拉取时间:" + calculateYesterdayStr);
|
logger.info("OFS销售出库单同步U8C销售订单,目标拉取时间:" + calculateYesterdayStr);
|
||||||
|
|
||||||
for (int i = 0; i <= 23; i++) {
|
|
||||||
String iStr = null;
|
|
||||||
if (i <= 9) {
|
|
||||||
iStr = "0" + i;
|
|
||||||
} else {
|
|
||||||
iStr = String.valueOf(i);
|
|
||||||
}
|
|
||||||
String startTime = calculateYesterdayStr + " " + iStr + ":00:00";
|
|
||||||
String endTime = calculateYesterdayStr + " " + iStr + ":59:59";
|
|
||||||
|
|
||||||
StartAndEndVo startAndEndVo = new StartAndEndVo();
|
StartAndEndVo startAndEndVo = new StartAndEndVo();
|
||||||
startAndEndVo.setStart_time(startTime);
|
startAndEndVo.setStart_time(calculateYesterdayStr + " 00:00:00");
|
||||||
startAndEndVo.setEnd_time(endTime);
|
startAndEndVo.setEnd_time(calculateYesterdayStr + " 23:59:59");
|
||||||
startAndEnd.add(startAndEndVo);
|
startAndEnd.add(startAndEndVo);
|
||||||
}
|
|
||||||
|
// for (int i = 0; i <= 23; i++) {
|
||||||
|
// String iStr = null;
|
||||||
|
// if (i <= 9) {
|
||||||
|
// iStr = "0" + i;
|
||||||
|
// } else {
|
||||||
|
// iStr = String.valueOf(i);
|
||||||
|
// }
|
||||||
|
// String startTime = calculateYesterdayStr + " " + iStr + ":00:00";
|
||||||
|
// String endTime = calculateYesterdayStr + " " + iStr + ":59:59";
|
||||||
|
//
|
||||||
|
// StartAndEndVo startAndEndVo = new StartAndEndVo();
|
||||||
|
// startAndEndVo.setStart_time(startTime);
|
||||||
|
// startAndEndVo.setEnd_time(endTime);
|
||||||
|
// startAndEnd.add(startAndEndVo);
|
||||||
|
// }
|
||||||
return startAndEnd;
|
return startAndEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2332,21 +2332,26 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
logger.info("OFS销售出库单同步U8C销售订单,目标拉取时间:" + calculateYesterdayStr);
|
logger.info("OFS销售出库单同步U8C销售订单,目标拉取时间:" + calculateYesterdayStr);
|
||||||
|
|
||||||
for (int i = 0; i <= 23; i++) {
|
|
||||||
String iStr = null;
|
|
||||||
if (i <= 9) {
|
|
||||||
iStr = "0" + i;
|
|
||||||
} else {
|
|
||||||
iStr = String.valueOf(i);
|
|
||||||
}
|
|
||||||
String startTime = calculateYesterdayStr + " " + iStr + ":00:00";
|
|
||||||
String endTime = calculateYesterdayStr + " " + iStr + ":59:59";
|
|
||||||
|
|
||||||
StartAndEndVo startAndEndVo = new StartAndEndVo();
|
StartAndEndVo startAndEndVo = new StartAndEndVo();
|
||||||
startAndEndVo.setStart_time(startTime);
|
startAndEndVo.setStart_time(calculateYesterdayStr + " 00:00:00");
|
||||||
startAndEndVo.setEnd_time(endTime);
|
startAndEndVo.setEnd_time(calculateYesterdayStr + " 23:59:59");
|
||||||
startAndEnd.add(startAndEndVo);
|
startAndEnd.add(startAndEndVo);
|
||||||
}
|
|
||||||
|
// for (int i = 0; i <= 23; i++) {
|
||||||
|
// String iStr = null;
|
||||||
|
// if (i <= 9) {
|
||||||
|
// iStr = "0" + i;
|
||||||
|
// } else {
|
||||||
|
// iStr = String.valueOf(i);
|
||||||
|
// }
|
||||||
|
// String startTime = calculateYesterdayStr + " " + iStr + ":00:00";
|
||||||
|
// String endTime = calculateYesterdayStr + " " + iStr + ":59:59";
|
||||||
|
//
|
||||||
|
// StartAndEndVo startAndEndVo = new StartAndEndVo();
|
||||||
|
// startAndEndVo.setStart_time(startTime);
|
||||||
|
// startAndEndVo.setEnd_time(endTime);
|
||||||
|
// startAndEnd.add(startAndEndVo);
|
||||||
|
// }
|
||||||
return startAndEnd;
|
return startAndEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.plugin.lets.plugin.sales;
|
package com.hzya.frame.plugin.lets.plugin.sales;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.WebappApplication;
|
import com.hzya.frame.WebappApplication;
|
||||||
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
|
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
|
||||||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
|
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
|
||||||
|
@ -97,10 +98,13 @@ class SoSaleOutPluginInitializerToCTest {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-10-18 00:00:00", "2024-10-18 23:59:59");
|
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-10-18 00:00:00", "2024-10-18 23:59:59");
|
||||||
String code = "LETS-SH2024052100015139";
|
// String code = "LETS-SH2024052100015139";
|
||||||
soSaleOutPluginInitializerToC.startImplementStockByCode(code, "tran");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode(code, "tran");
|
||||||
|
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByTimeAndTran("2024-10-22 00:00:00", "2024-10-22 23:59:59");
|
// soSaleOutPluginInitializerToC.startImplementStockByTimeAndTran("2024-10-22 00:00:00", "2024-10-22 23:59:59");
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
soSaleOutPluginInitializerToC.executeBusiness(jsonObject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.plugin.lets.plugin.sales;
|
package com.hzya.frame.plugin.lets.plugin.sales;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.WebappApplication;
|
import com.hzya.frame.WebappApplication;
|
||||||
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -40,7 +41,10 @@ public class SoSaleReturnPluginInitializerToCTest {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-10-21 00:00:00", "2024-10-21 23:59:59");
|
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-10-21 00:00:00", "2024-10-21 23:59:59");
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue