This commit is contained in:
2023-06-21 11:19:51 +08:00
parent c22bffc08f
commit 8fdaf216f5
4 changed files with 23 additions and 3 deletions

View File

@@ -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:";

View File

@@ -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<PileBillingDetail> queryBillingDetailById(Long id);
}

View File

@@ -358,6 +358,20 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
return result;
}
@Override
public List<PileBillingDetail> queryBillingDetailById(Long id) {
String redisKey = CacheConstants.QUERY_BILLING_DETAIL_BY_ID + id;
List<PileBillingDetail> 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<BillingTemplateVO> 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);
}

View File

@@ -107,14 +107,14 @@ public class AMapServiceImpl implements AMapService {
}
aMapInfo.setConstruction(Integer.parseInt(construction));
aMapInfo.setBusineHours(stationInfo.getBusinessHours());
// 根据站点id查询计费模板
List<AMapPriceChargingInfo> priceList = getPriceInfoByStationId(String.valueOf(stationInfo.getId()));
aMapInfo.setPriceChargingInfo(priceList);
// 根据站点id查询快、慢充设备数量
Map<String, Integer> pileNumMap = pileConnectorInfoService.getPileTypeNum(stationInfo.getId());
aMapInfo.setFastEquipmentNum(pileNumMap.get("fastTotal"));
aMapInfo.setSlowEquipmentNum(pileNumMap.get("slowTotal"));
// 根据站点查询站点下所有桩
List<AMapEquipmentInfo> aMapEquipmentInfos = getPileListByStationId(String.valueOf(stationInfo.getId()));
aMapInfo.setEquipmentInfos(aMapEquipmentInfos);