refactor(buildpackage): 获取当前时间范围替代计算时间偏移量- 在 ConsignmachiningIn、ConsignmachiningInReturn、ProxyPurchaseReturn、ProxyPurchaseWarehousOrder 和 ProxyPurchaseWarehousWarehouse 类中,将 offsetTimeTime.offsetTime() 替换为 offsetTimeTime.getCurrentDateRange()
- 在 OffsetTimeTime 类中添加 getCurrentDateRange 方法,用于获取当前时间范围- 更新相关测试用例
This commit is contained in:
parent
d97fbf77b3
commit
41ea6e1f40
|
@ -173,7 +173,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,实时执行,计算时间偏移量
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
|
||||||
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,实时执行,计算时间偏移量
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
|
||||||
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,实时执行,计算时间偏移量
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
|
||||||
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,实时执行,计算时间偏移量
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
|
||||||
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,实时执行,计算时间偏移量
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
StartAndEndVo startAndEndVo = offsetTimeTime.getCurrentDateRange();
|
||||||
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,20 @@ public class OffsetTimeTime {
|
||||||
return startAndEndVo;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算时间间隔
|
* 计算时间间隔
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,9 +27,9 @@ public class ProxyPurchaseWarehousOrderTest {
|
||||||
@Test
|
@Test
|
||||||
public void startImplementByCode() {
|
public void startImplementByCode() {
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,6 @@ public class ProxyPurchaseWarehousWarehouseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void startImplementByCode() {
|
public void startImplementByCode() {
|
||||||
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024110100000118");
|
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024123100000770");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liuyang
|
||||||
|
* @Package:com.hzya.frame.plugin.lets.util
|
||||||
|
* @Project:kangarooDataCenterV3
|
||||||
|
* @name:OffsetTimeTimeTest
|
||||||
|
* @Date:2025/1/6 10:33
|
||||||
|
* @Filename:OffsetTimeTimeTest
|
||||||
|
*/
|
||||||
|
@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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue