diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java index 210171a1b..fafb49d8c 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java @@ -23,6 +23,8 @@ public class CacheConstants { public static final int cache_expire_time_1d = 60 * 60 * 24; + public static final String QUERY_BILLING_DETAIL_BY_ID = "query_billing_detail_by_id:"; + // public static final String SELECT_PILE_BILLING_TEMPLATE_BY_ID = "select_Pile_Billing_Template_By_Id:"; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBillingTemplateService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBillingTemplateService.java index 0b81f733a..1b071db0b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBillingTemplateService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBillingTemplateService.java @@ -1,5 +1,6 @@ package com.jsowell.pile.service; +import com.jsowell.pile.domain.PileBillingDetail; import com.jsowell.pile.domain.PileBillingRelation; import com.jsowell.pile.domain.PileBillingTemplate; import com.jsowell.pile.dto.CreateOrUpdateBillingTemplateDTO; @@ -157,4 +158,6 @@ public interface IPileBillingTemplateService { * 通过站点id查询当前时间的收费详情 */ CurrentTimePriceDetails getCurrentTimePriceDetails(String stationId); + + List queryBillingDetailById(Long id); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java index 8cf4e4e86..cfe1a1b94 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java @@ -358,6 +358,20 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi return result; } + @Override + public List queryBillingDetailById(Long id) { + String redisKey = CacheConstants.QUERY_BILLING_DETAIL_BY_ID + id; + List pileBillingDetails = redisCache.getCacheList(redisKey); + if (CollectionUtils.isEmpty(pileBillingDetails)) { + pileBillingDetails = pileBillingTemplateMapper.queryBillingDetailByTemplateIds(new Long[]{id}); + if (CollectionUtils.isNotEmpty(pileBillingDetails)) { + redisCache.setCacheList(redisKey, pileBillingDetails); + redisCache.expire(redisKey, 30, TimeUnit.MINUTES); + } + } + return pileBillingDetails; + } + @Override public List queryPublicBillingTemplateList() { return pileBillingTemplateMapper.queryPublicBillingTemplateList(); @@ -391,6 +405,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi // 通过计费模板id 清缓存 if (templateId != null) { redisKeyList.add(CacheConstants.SELECT_PILE_BILLING_TEMPLATE_BY_ID + templateId); + redisKeyList.add(CacheConstants.QUERY_BILLING_DETAIL_BY_ID + templateId); } redisCache.deleteObject(redisKeyList); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java index a54d78eb7..4c9d3d65d 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java @@ -107,14 +107,14 @@ public class AMapServiceImpl implements AMapService { } aMapInfo.setConstruction(Integer.parseInt(construction)); aMapInfo.setBusineHours(stationInfo.getBusinessHours()); - + // 根据站点id查询计费模板 List priceList = getPriceInfoByStationId(String.valueOf(stationInfo.getId())); aMapInfo.setPriceChargingInfo(priceList); - + // 根据站点id查询快、慢充设备数量 Map pileNumMap = pileConnectorInfoService.getPileTypeNum(stationInfo.getId()); aMapInfo.setFastEquipmentNum(pileNumMap.get("fastTotal")); aMapInfo.setSlowEquipmentNum(pileNumMap.get("slowTotal")); - + // 根据站点查询站点下所有桩 List aMapEquipmentInfos = getPileListByStationId(String.valueOf(stationInfo.getId())); aMapInfo.setEquipmentInfos(aMapEquipmentInfos);