update 加缓存

This commit is contained in:
2023-06-21 09:02:56 +08:00
parent 1d9115e927
commit e8206404ed
3 changed files with 586 additions and 534 deletions

View File

@@ -23,6 +23,9 @@ public class CacheConstants {
public static final int cache_expire_time_1d = 60 * 60 * 24; public static final int cache_expire_time_1d = 60 * 60 * 24;
//
public static final String SELECT_PILE_BILLING_TEMPLATE_BY_ID = "select_Pile_Billing_Template_By_Id:";
// 站点计费模板列表 // 站点计费模板列表
public static final String QUERY_STATION_BILLING_TEMPLATE_LIST = "query_station_billing_template_list:"; public static final String QUERY_STATION_BILLING_TEMPLATE_LIST = "query_station_billing_template_list:";

View File

@@ -19,6 +19,7 @@ import com.jsowell.thirdparty.amap.util.AMapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
@@ -59,6 +60,7 @@ public class AMapServiceImpl implements AMapService {
*/ */
@Override @Override
public List<AMapStationInfo> getStationInfos(GetStationInfoDTO dto) { public List<AMapStationInfo> getStationInfos(GetStationInfoDTO dto) {
StopWatch sw = new StopWatch("高德拉取充电站静态数据");
List<AMapStationInfo> resultList = new ArrayList<>(); List<AMapStationInfo> resultList = new ArrayList<>();
if (StringUtils.equals("page", dto.getType())) { if (StringUtils.equals("page", dto.getType())) {
@@ -68,12 +70,15 @@ public class AMapServiceImpl implements AMapService {
PageUtils.startPage(pageNo, pageSize); PageUtils.startPage(pageNo, pageSize);
} }
// 查询站点信息 // 查询站点信息
sw.start("查询站点信息");
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty(); List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty();
sw.stop();
if (CollectionUtils.isEmpty(stationInfos)) { if (CollectionUtils.isEmpty(stationInfos)) {
return new ArrayList<>(); return new ArrayList<>();
} }
AMapStationInfo aMapInfo; AMapStationInfo aMapInfo;
// 拼装高德格式数据 // 拼装高德格式数据
sw.start("拼装高德格式数据");
for (PileStationInfo stationInfo : stationInfos) { for (PileStationInfo stationInfo : stationInfos) {
aMapInfo = new AMapStationInfo(); aMapInfo = new AMapStationInfo();
@@ -113,7 +118,7 @@ public class AMapServiceImpl implements AMapService {
resultList.add(aMapInfo); resultList.add(aMapInfo);
} }
sw.stop();
return resultList; return resultList;
} }