1、修改时间范围取值
2、物料分类包装桶增加逻辑
This commit is contained in:
parent
f8d2b24a0a
commit
4b7e7440d8
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -212,6 +212,22 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
||||||
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
||||||
|
|
||||||
|
String maxPartition = "";
|
||||||
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
|
// 1. 查询最大分区值
|
||||||
|
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
||||||
|
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
||||||
|
|
||||||
|
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
||||||
|
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
||||||
|
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < timeRanges.size(); i++) {
|
for (int i = 0; i < timeRanges.size(); i++) {
|
||||||
Date[] range = timeRanges.get(i);
|
Date[] range = timeRanges.get(i);
|
||||||
String startDate = simpleDateFormat.format(range[0]);
|
String startDate = simpleDateFormat.format(range[0]);
|
||||||
@ -226,17 +242,6 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
|
|
||||||
// 分区字段和时间字段组合查询条件
|
// 分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -330,17 +335,6 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
StringBuilder conditionBuilder = new StringBuilder();
|
StringBuilder conditionBuilder = new StringBuilder();
|
||||||
// 修改点:分区字段和时间字段组合查询条件
|
// 修改点:分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -461,7 +455,7 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将时间范围拆分为多个区间,并确保结束时间包含时间部分以覆盖完整日期
|
* 将时间范围拆分为多个区间,确保区间连续且不重叠
|
||||||
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param daysInterval 间隔天数
|
* @param daysInterval 间隔天数
|
||||||
@ -482,22 +476,19 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
Date adjustedEndDate = endCal.getTime();
|
Date adjustedEndDate = endCal.getTime();
|
||||||
|
|
||||||
while (calendar.getTime().before(adjustedEndDate)) {
|
while (calendar.getTime().before(adjustedEndDate)) {
|
||||||
|
// 区间开始时间(当前日期的00:00:00)
|
||||||
Date rangeStart = calendar.getTime();
|
Date rangeStart = calendar.getTime();
|
||||||
|
|
||||||
// 增加间隔天数
|
// 增加间隔天数-1天,然后设置为23:59:59作为区间结束时间
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, daysInterval);
|
calendar.add(Calendar.DAY_OF_MONTH, daysInterval - 1);
|
||||||
Date potentialRangeEnd = calendar.getTime();
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
|
||||||
// 调整区间结束时间为当前日期的23:59:59
|
Date rangeEnd = calendar.getTime();
|
||||||
Calendar rangeEndCal = Calendar.getInstance();
|
|
||||||
rangeEndCal.setTime(potentialRangeEnd);
|
|
||||||
rangeEndCal.set(Calendar.HOUR_OF_DAY, 23);
|
|
||||||
rangeEndCal.set(Calendar.MINUTE, 59);
|
|
||||||
rangeEndCal.set(Calendar.SECOND, 59);
|
|
||||||
rangeEndCal.set(Calendar.MILLISECOND, 999);
|
|
||||||
Date rangeEnd = rangeEndCal.getTime();
|
|
||||||
|
|
||||||
// 如果调整后的区间结束时间超过最终结束时间,使用调整后的结束时间
|
// 如果区间结束时间超过最终结束时间,使用最终结束时间
|
||||||
if (rangeEnd.after(adjustedEndDate)) {
|
if (rangeEnd.after(adjustedEndDate)) {
|
||||||
rangeEnd = adjustedEndDate;
|
rangeEnd = adjustedEndDate;
|
||||||
}
|
}
|
||||||
@ -505,7 +496,16 @@ public class ProductionDataSyncServiceImpl implements DataSyncService {
|
|||||||
ranges.add(new Date[]{rangeStart, rangeEnd});
|
ranges.add(new Date[]{rangeStart, rangeEnd});
|
||||||
|
|
||||||
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
||||||
calendar.add(Calendar.MILLISECOND, 1);
|
calendar.add(Calendar.MILLISECOND, 1); // 加1毫秒到下一天
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
// 如果已经达到或超过结束时间,则退出循环
|
||||||
|
if (calendar.getTime().after(adjustedEndDate)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ranges;
|
return ranges;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,6 +243,21 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
||||||
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
||||||
|
|
||||||
|
String maxPartition = "";
|
||||||
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
|
// 1. 查询最大分区值
|
||||||
|
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
||||||
|
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
||||||
|
|
||||||
|
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
||||||
|
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
||||||
|
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < timeRanges.size(); i++) {
|
for (int i = 0; i < timeRanges.size(); i++) {
|
||||||
Date[] range = timeRanges.get(i);
|
Date[] range = timeRanges.get(i);
|
||||||
String startDate = simpleDateFormat.format(range[0]);
|
String startDate = simpleDateFormat.format(range[0]);
|
||||||
@ -257,17 +272,6 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
|
|
||||||
// 分区字段和时间字段组合查询条件
|
// 分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -360,17 +364,6 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
StringBuilder conditionBuilder = new StringBuilder();
|
StringBuilder conditionBuilder = new StringBuilder();
|
||||||
// 修改点:分区字段和时间字段组合查询条件
|
// 修改点:分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -444,7 +437,7 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将时间范围拆分为多个区间,并确保结束时间包含时间部分以覆盖完整日期
|
* 将时间范围拆分为多个区间,确保区间连续且不重叠
|
||||||
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param daysInterval 间隔天数
|
* @param daysInterval 间隔天数
|
||||||
@ -465,22 +458,19 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
Date adjustedEndDate = endCal.getTime();
|
Date adjustedEndDate = endCal.getTime();
|
||||||
|
|
||||||
while (calendar.getTime().before(adjustedEndDate)) {
|
while (calendar.getTime().before(adjustedEndDate)) {
|
||||||
|
// 区间开始时间(当前日期的00:00:00)
|
||||||
Date rangeStart = calendar.getTime();
|
Date rangeStart = calendar.getTime();
|
||||||
|
|
||||||
// 增加间隔天数
|
// 增加间隔天数-1天,然后设置为23:59:59作为区间结束时间
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, daysInterval);
|
calendar.add(Calendar.DAY_OF_MONTH, daysInterval - 1);
|
||||||
Date potentialRangeEnd = calendar.getTime();
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
|
||||||
// 调整区间结束时间为当前日期的23:59:59
|
Date rangeEnd = calendar.getTime();
|
||||||
Calendar rangeEndCal = Calendar.getInstance();
|
|
||||||
rangeEndCal.setTime(potentialRangeEnd);
|
|
||||||
rangeEndCal.set(Calendar.HOUR_OF_DAY, 23);
|
|
||||||
rangeEndCal.set(Calendar.MINUTE, 59);
|
|
||||||
rangeEndCal.set(Calendar.SECOND, 59);
|
|
||||||
rangeEndCal.set(Calendar.MILLISECOND, 999);
|
|
||||||
Date rangeEnd = rangeEndCal.getTime();
|
|
||||||
|
|
||||||
// 如果调整后的区间结束时间超过最终结束时间,使用调整后的结束时间
|
// 如果区间结束时间超过最终结束时间,使用最终结束时间
|
||||||
if (rangeEnd.after(adjustedEndDate)) {
|
if (rangeEnd.after(adjustedEndDate)) {
|
||||||
rangeEnd = adjustedEndDate;
|
rangeEnd = adjustedEndDate;
|
||||||
}
|
}
|
||||||
@ -488,7 +478,16 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
ranges.add(new Date[]{rangeStart, rangeEnd});
|
ranges.add(new Date[]{rangeStart, rangeEnd});
|
||||||
|
|
||||||
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
||||||
calendar.add(Calendar.MILLISECOND, 1);
|
calendar.add(Calendar.MILLISECOND, 1); // 加1毫秒到下一天
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
// 如果已经达到或超过结束时间,则退出循环
|
||||||
|
if (calendar.getTime().after(adjustedEndDate)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ranges;
|
return ranges;
|
||||||
}
|
}
|
||||||
@ -820,7 +819,8 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
|||||||
|| StringUtils.isNotBlank(jldw)
|
|| StringUtils.isNotBlank(jldw)
|
||||||
|| StringUtils.isNotBlank(wlfl)) {
|
|| StringUtils.isNotBlank(wlfl)) {
|
||||||
try {
|
try {
|
||||||
newWlmc = purchaseUtil.materialClassificationFiltering(bkgs, wlmc, wlbm, jldw, djhyf, wlfl);
|
newWlmc = purchaseUtil.materialClassificationFiltering(bkgs.trim(),
|
||||||
|
wlmc.trim(), wlbm.trim(), jldw.trim(), djhyf, wlfl.trim());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,6 +187,20 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
// 计算时间范围并拆分为30天一组
|
// 计算时间范围并拆分为30天一组
|
||||||
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
List<Date[]> timeRanges = splitTimeRange(startDated, endDated, 30);
|
||||||
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
LOGGER.info("时间范围拆分为 {} 个查询区间", timeRanges.size());
|
||||||
|
String maxPartition = "";
|
||||||
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
|
// 1. 查询最大分区值
|
||||||
|
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
||||||
|
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
||||||
|
|
||||||
|
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
||||||
|
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
||||||
|
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < timeRanges.size(); i++) {
|
for (int i = 0; i < timeRanges.size(); i++) {
|
||||||
Date[] range = timeRanges.get(i);
|
Date[] range = timeRanges.get(i);
|
||||||
@ -202,17 +216,6 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
|
|
||||||
// 分区字段和时间字段组合查询条件
|
// 分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -306,17 +309,6 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
StringBuilder conditionBuilder = new StringBuilder();
|
StringBuilder conditionBuilder = new StringBuilder();
|
||||||
// 修改点:分区字段和时间字段组合查询条件
|
// 修改点:分区字段和时间字段组合查询条件
|
||||||
if (partitionField != null && !partitionField.isEmpty()) {
|
if (partitionField != null && !partitionField.isEmpty()) {
|
||||||
// 1. 查询最大分区值
|
|
||||||
String maxPartitionSql = "SELECT MAX(" + partitionField + ") AS max_partition FROM " + tableName;
|
|
||||||
List<RowMap> maxPartitionResult = rdsapi.getMaps(maxPartitionSql);
|
|
||||||
|
|
||||||
if (maxPartitionResult.isEmpty() || maxPartitionResult.get(0).get("max_partition") == null) {
|
|
||||||
LOGGER.warn("表[{}]没有找到分区字段[{}]的数据", tableName, partitionField);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxPartition = maxPartitionResult.get(0).getString("max_partition");
|
|
||||||
LOGGER.info("表[{}]的最大分区为: {}", tableName, maxPartition);
|
|
||||||
|
|
||||||
// 添加分区条件
|
// 添加分区条件
|
||||||
conditionBuilder.append(partitionField)
|
conditionBuilder.append(partitionField)
|
||||||
@ -443,7 +435,7 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将时间范围拆分为多个区间,并确保结束时间包含时间部分以覆盖完整日期
|
* 将时间范围拆分为多个区间,确保区间连续且不重叠
|
||||||
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param startDate 开始时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
* @param endDate 结束时间(yyyy-MM-dd格式,时间部分为00:00:00)
|
||||||
* @param daysInterval 间隔天数
|
* @param daysInterval 间隔天数
|
||||||
@ -464,22 +456,19 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
Date adjustedEndDate = endCal.getTime();
|
Date adjustedEndDate = endCal.getTime();
|
||||||
|
|
||||||
while (calendar.getTime().before(adjustedEndDate)) {
|
while (calendar.getTime().before(adjustedEndDate)) {
|
||||||
|
// 区间开始时间(当前日期的00:00:00)
|
||||||
Date rangeStart = calendar.getTime();
|
Date rangeStart = calendar.getTime();
|
||||||
|
|
||||||
// 增加间隔天数
|
// 增加间隔天数-1天,然后设置为23:59:59作为区间结束时间
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, daysInterval);
|
calendar.add(Calendar.DAY_OF_MONTH, daysInterval - 1);
|
||||||
Date potentialRangeEnd = calendar.getTime();
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
|
||||||
// 调整区间结束时间为当前日期的23:59:59
|
Date rangeEnd = calendar.getTime();
|
||||||
Calendar rangeEndCal = Calendar.getInstance();
|
|
||||||
rangeEndCal.setTime(potentialRangeEnd);
|
|
||||||
rangeEndCal.set(Calendar.HOUR_OF_DAY, 23);
|
|
||||||
rangeEndCal.set(Calendar.MINUTE, 59);
|
|
||||||
rangeEndCal.set(Calendar.SECOND, 59);
|
|
||||||
rangeEndCal.set(Calendar.MILLISECOND, 999);
|
|
||||||
Date rangeEnd = rangeEndCal.getTime();
|
|
||||||
|
|
||||||
// 如果调整后的区间结束时间超过最终结束时间,使用调整后的结束时间
|
// 如果区间结束时间超过最终结束时间,使用最终结束时间
|
||||||
if (rangeEnd.after(adjustedEndDate)) {
|
if (rangeEnd.after(adjustedEndDate)) {
|
||||||
rangeEnd = adjustedEndDate;
|
rangeEnd = adjustedEndDate;
|
||||||
}
|
}
|
||||||
@ -487,7 +476,16 @@ public class SaleDataSyncServiceImpl implements DataSyncService {
|
|||||||
ranges.add(new Date[]{rangeStart, rangeEnd});
|
ranges.add(new Date[]{rangeStart, rangeEnd});
|
||||||
|
|
||||||
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
// 准备下一个区间的开始时间:当前区间结束时间的下一天00:00:00
|
||||||
calendar.add(Calendar.MILLISECOND, 1);
|
calendar.add(Calendar.MILLISECOND, 1); // 加1毫秒到下一天
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
// 如果已经达到或超过结束时间,则退出循环
|
||||||
|
if (calendar.getTime().after(adjustedEndDate)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ranges;
|
return ranges;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,14 +79,13 @@ public class PurchaseUtil {
|
|||||||
newWlmc = "包装桶";
|
newWlmc = "包装桶";
|
||||||
} else if ("北新防水".equals(bkgs) && wlmc.contains("桶") && jldw.contains("个")) {
|
} else if ("北新防水".equals(bkgs) && wlmc.contains("桶") && jldw.contains("个")) {
|
||||||
newWlmc = "包装桶";
|
newWlmc = "包装桶";
|
||||||
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("盖") && djhyf < 5.0) {
|
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("盖") && !wlmc.contains("桶") && !wlmc.contains("罐") && djhyf < 3.5) {
|
||||||
newWlmc = "桶盖";
|
newWlmc = "桶盖";
|
||||||
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("桶身")) {
|
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("桶身") && jldw.equals("个")) {
|
||||||
newWlmc = "包装桶";
|
newWlmc = "包装桶";
|
||||||
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("桶") && jldw.contains("个")) {
|
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("桶") && !wlmc.contains("桶身") && djhyf>3.5 && jldw.equals("个")) {
|
||||||
newWlmc = "包装桶";
|
newWlmc = "包装桶";
|
||||||
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("罐")
|
} else if ("北新嘉宝莉".equals(bkgs) && wlmc.contains("罐") && !wlmc.contains("箱") && jldw.equals("个")) {
|
||||||
&& !wlmc.contains("箱") && wlfl.contains("包装物") && jldw.equals("个")) {
|
|
||||||
newWlmc = "包装桶";
|
newWlmc = "包装桶";
|
||||||
} else {
|
} else {
|
||||||
newWlmc = wlmc;
|
newWlmc = wlmc;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user