refactor(buildpackage): 获取当前时间范围替代计算时间偏移量- 在 ConsignmachiningIn、ConsignmachiningInReturn、ProxyPurchaseReturn、ProxyPurchaseWarehousOrder 和 ProxyPurchaseWarehousWarehouse 类中,将 offsetTimeTime.offsetTime() 替换为 offsetTimeTime.getCurrentDateRange()

- 在 OffsetTimeTime 类中添加 getCurrentDateRange 方法,用于获取当前时间范围- 更新相关测试用例
This commit is contained in:
liuy 2025-01-06 10:39:14 +08:00
parent d97fbf77b3
commit 41ea6e1f40
9 changed files with 56 additions and 8 deletions

View File

@ -173,7 +173,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
} else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
}

View File

@ -174,7 +174,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
} else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
}

View File

@ -171,7 +171,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
} else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
}

View File

@ -168,7 +168,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
} else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
}

View File

@ -169,7 +169,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
} else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
}

View File

@ -48,6 +48,20 @@ public class OffsetTimeTime {
return startAndEndVo;
}
/**
* 2025年1月6日 10:31:33 获取当前时间范围比如当前时间2025年1月6日 10:31:43则时间范围2025年1月6日 00:00:00~2025年1月6日 23:59:59
*/
public StartAndEndVo getCurrentDateRange() {
Date currentDate = new Date();
String startTimeStr = DateUtil.format(currentDate, "yyyy-MM-dd") + " 00:00:00";
String endTimeStr = DateUtil.format(currentDate, "yyyy-MM-dd") + " 23:59:59";
StartAndEndVo startAndEndVo = new StartAndEndVo();
startAndEndVo.setStart_time(startTimeStr);
startAndEndVo.setEnd_time(endTimeStr);
return startAndEndVo;
}
/**
* 计算时间间隔
*

View File

@ -27,9 +27,9 @@ public class ProxyPurchaseWarehousOrderTest {
@Test
public void startImplementByCode() {
try {
proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2024103100000038");
// proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2024122300000003");
// proxyPurchaseWarehousOrder.startImplementByTime("2024-10-24 16:41:11", "2024-10-24 16:41:12");
proxyPurchaseWarehousOrder.startImplementByTime("2024-12-23 15:32:39", "2024-12-23 15:32:39");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -26,6 +26,6 @@ public class ProxyPurchaseWarehousWarehouseTest {
@Test
public void startImplementByCode() {
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024110100000118");
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024123100000770");
}
}

View File

@ -0,0 +1,34 @@
package com.hzya.frame.plugin.lets.util;
import com.alibaba.fastjson.JSON;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameOffsetTimeTimeTest
* @Date2025/1/6 10:33
* @FilenameOffsetTimeTimeTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class OffsetTimeTimeTest {
@Autowired
private OffsetTimeTime offsetTimeTime;
@Test
public void getCurrentDateRange() {
StartAndEndVo currentDateRange = offsetTimeTime.getCurrentDateRange();
System.out.println(JSON.toJSONString(currentDateRange));
}
}