update 加缓存

This commit is contained in:
2023-06-21 10:16:33 +08:00
parent a8260e5373
commit 2105e83522
2 changed files with 14 additions and 10 deletions

View File

@@ -571,7 +571,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
byte[] PlanLossRatio = Constants.zeroByteArray;
// 48个时段费率半小时为一个时段
Map<Integer, List<String>> timeMap = billingTemplateVO.getTimeMap();
Map<String, List<String>> timeMap = billingTemplateVO.getTimeMap();
List<String> periodOfTime = DateUtils.getPeriodOfTime();
byte[] timeArray = new byte[periodOfTime.size()];
for (int i = 0; i < periodOfTime.size(); i++) {
@@ -596,14 +596,14 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
* @param timeMap 尖峰平谷4个类型的时间段每个类型都包含一个时间段集合
* @return
*/
private byte getTimeType(String timeRange, Map<Integer, List<String>> timeMap) {
private byte getTimeType(String timeRange, Map<String, List<String>> timeMap) {
byte b = 5;
// 这里的timeRange是00:00-00:30 这样的格式
String[] split = timeRange.split("-");
LocalTime startTime1 = DateUtils.getLocalTime(split[0]);
LocalTime endTime1 = DateUtils.getLocalTime(split[1]);
for (Map.Entry<Integer, List<String>> entry : timeMap.entrySet()) {
for (Map.Entry<String, List<String>> entry : timeMap.entrySet()) {
List<String> value = entry.getValue().stream().filter(StringUtils::isNotBlank).collect(Collectors.toList()); // 每个类型时间段集合
if (CollectionUtils.isEmpty(value)) {
continue;
@@ -616,7 +616,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
boolean overlap = DateUtils.isOverlap(startTime1, endTime1, startTime2, endTime2, false);
if (overlap) {
return (byte) entry.getKey().intValue();
return (byte) Integer.parseInt(entry.getKey());
}
}
}

View File

@@ -89,19 +89,23 @@ public class BillingTemplateVO {
.toString();
}
public Map<Integer, List<String>> getTimeMap() {
Map<Integer, List<String>> resultMap = Maps.newHashMap();
public Map<String, List<String>> getTimeMap() {
Map<String, List<String>> resultMap = Maps.newHashMap();
if (StringUtils.isNotBlank(this.getSharpApplyDate())) {
resultMap.put(0x00, Lists.newArrayList(this.getSharpApplyDate().split(",")));
// resultMap.put(0x00, Lists.newArrayList(this.getSharpApplyDate().split(",")));
resultMap.put("00", Lists.newArrayList(this.getSharpApplyDate().split(",")));
}
if (StringUtils.isNotBlank(this.getPeakApplyDate())) {
resultMap.put(0x01, Lists.newArrayList(this.getPeakApplyDate().split(",")));
// resultMap.put(0x01, Lists.newArrayList(this.getPeakApplyDate().split(",")));
resultMap.put("01", Lists.newArrayList(this.getPeakApplyDate().split(",")));
}
if (StringUtils.isNotBlank(this.getFlatApplyDate())) {
resultMap.put(0x02, Lists.newArrayList(this.getFlatApplyDate().split(",")));
// resultMap.put(0x02, Lists.newArrayList(this.getFlatApplyDate().split(",")));
resultMap.put("02", Lists.newArrayList(this.getFlatApplyDate().split(",")));
}
if (StringUtils.isNotBlank(this.getValleyApplyDate())) {
resultMap.put(0x03, Lists.newArrayList(this.getValleyApplyDate().split(",")));
// resultMap.put(0x03, Lists.newArrayList(this.getValleyApplyDate().split(",")));
resultMap.put("03", Lists.newArrayList(this.getValleyApplyDate().split(",")));
}
return resultMap;
}