打印日志

This commit is contained in:
Guoqs
2024-09-09 20:47:34 +08:00
parent c646700ddc
commit 26c9ca05e8
6 changed files with 118 additions and 120 deletions

View File

@@ -158,7 +158,6 @@ public class PileService {
*/ */
public AppletPileDetailVO getPileDetailByPileSn(String param) throws Exception { public AppletPileDetailVO getPileDetailByPileSn(String param) throws Exception {
AppletPileDetailVO vo = null; AppletPileDetailVO vo = null;
try {
log.info("查询充电枪口详情-getPileDetailByPileSn, param:{}", param); log.info("查询充电枪口详情-getPileDetailByPileSn, param:{}", param);
if (StringUtils.isBlank(param)) { if (StringUtils.isBlank(param)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
@@ -215,7 +214,6 @@ public class PileService {
// MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId()); // MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId());
log.info("查询充电枪口详情-billingPriceVOS:{}", JSON.toJSONString(billingPriceVOS)); log.info("查询充电枪口详情-billingPriceVOS:{}", JSON.toJSONString(billingPriceVOS));
vo = AppletPileDetailVO.builder() vo = AppletPileDetailVO.builder()
.pileInfo(pileInfoVO) .pileInfo(pileInfoVO)
.connectorInfoList(connectorInfoList) .connectorInfoList(connectorInfoList)
@@ -223,10 +221,6 @@ public class PileService {
.stationInfo(stationInfo) .stationInfo(stationInfo)
.billingPriceList(billingPriceVOS) .billingPriceList(billingPriceVOS)
.build(); .build();
} catch (Exception e) {
log.error("查询充电枪详情error", e);
}
return vo; return vo;
} }

View File

@@ -50,6 +50,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -127,17 +128,17 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
@Override @Override
public PileBasicInfo selectPileBasicInfoBySN(String pileSn) { public PileBasicInfo selectPileBasicInfoBySN(String pileSn) {
// 加缓存 // 加缓存
// String redisKey = CacheConstants.SELECT_PILE_BASIC_INFO_BY_SN + pileSn; String redisKey = CacheConstants.SELECT_PILE_BASIC_INFO_BY_SN + pileSn;
// PileBasicInfo pileBasicInfo = redisCache.getCacheObject(redisKey); PileBasicInfo pileBasicInfo = redisCache.getCacheObject(redisKey);
// if (pileBasicInfo == null) { if (pileBasicInfo == null) {
// // 查数据库 // 查数据库
// pileBasicInfo = pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn); pileBasicInfo = pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn);
// if (pileBasicInfo != null) { if (pileBasicInfo != null) {
// redisCache.setCacheObject(redisKey, pileBasicInfo, 15, TimeUnit.MINUTES); redisCache.setCacheObject(redisKey, pileBasicInfo, 15, TimeUnit.MINUTES);
// } }
// } }
PileBasicInfo pileBasicInfo = pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn); // PileBasicInfo pileBasicInfo = pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn);
return pileBasicInfo; return pileBasicInfo;
} }

View File

@@ -606,17 +606,17 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
@Override @Override
public List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(String stationId) { public List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(String stationId) {
// 加缓存 // 加缓存
// String redisKey = CacheConstants.QUERY_STATION_BILLING_TEMPLATE_LIST + stationId; String redisKey = CacheConstants.QUERY_STATION_BILLING_TEMPLATE_LIST + stationId;
// List<BillingTemplateVO> voList = redisCache.getCacheList(redisKey); List<BillingTemplateVO> voList = redisCache.getCacheList(redisKey);
// if (CollectionUtils.isEmpty(voList)) { if (CollectionUtils.isEmpty(voList)) {
// voList = pileBillingTemplateMapper.queryStationBillingTemplateList(stationId); voList = pileBillingTemplateMapper.queryStationBillingTemplateList(stationId);
// if (CollectionUtils.isNotEmpty(voList)) { if (CollectionUtils.isNotEmpty(voList)) {
// redisCache.setCacheList(redisKey, voList); redisCache.setCacheList(redisKey, voList);
// redisCache.expire(redisKey, 15, TimeUnit.MINUTES); redisCache.expire(redisKey, 15, TimeUnit.MINUTES);
// } }
// } }
List<BillingTemplateVO> voList = pileBillingTemplateMapper.queryStationBillingTemplateList(stationId); // List<BillingTemplateVO> voList = pileBillingTemplateMapper.queryStationBillingTemplateList(stationId);
return voList; return voList;
} }

View File

@@ -48,6 +48,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -119,22 +120,22 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
@Override @Override
public List<PileConnectorInfo> selectPileConnectorInfoList(String pileSn) { public List<PileConnectorInfo> selectPileConnectorInfoList(String pileSn) {
// 取缓存 // 取缓存
// String redisKey = CacheConstants.SELECT_PILE_CONNECTOR_INFO_LIST + pileSn; String redisKey = CacheConstants.SELECT_PILE_CONNECTOR_INFO_LIST + pileSn;
// List<PileConnectorInfo> result = redisCache.getCacheObject(redisKey); List<PileConnectorInfo> result = redisCache.getCacheObject(redisKey);
// if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
// // 缓存为空,查数据库 // 缓存为空,查数据库
// PileConnectorInfo pileConnectorInfo = new PileConnectorInfo();
// pileConnectorInfo.setPileSn(pileSn);
// result = selectPileConnectorInfoList(pileConnectorInfo);
// if (CollectionUtils.isNotEmpty(result)) {
// // 查询数据库不为空存redis 2分钟
// redisCache.setCacheObject(redisKey, result, 5, TimeUnit.MINUTES);
// }
// }
PileConnectorInfo pileConnectorInfo = new PileConnectorInfo(); PileConnectorInfo pileConnectorInfo = new PileConnectorInfo();
pileConnectorInfo.setPileSn(pileSn); pileConnectorInfo.setPileSn(pileSn);
List<PileConnectorInfo> result = selectPileConnectorInfoList(pileConnectorInfo); result = selectPileConnectorInfoList(pileConnectorInfo);
if (CollectionUtils.isNotEmpty(result)) {
// 查询数据库不为空存redis 2分钟
redisCache.setCacheObject(redisKey, result, 5, TimeUnit.MINUTES);
}
}
// PileConnectorInfo pileConnectorInfo = new PileConnectorInfo();
// pileConnectorInfo.setPileSn(pileSn);
// List<PileConnectorInfo> result = selectPileConnectorInfoList(pileConnectorInfo);
return result; return result;
} }

View File

@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 充电桩型号信息Service业务层处理 * 充电桩型号信息Service业务层处理
@@ -121,16 +122,16 @@ public class PileModelInfoServiceImpl implements PileModelInfoService {
@Override @Override
public PileModelInfoVO getPileModelInfoByModelId(Long modelId) { public PileModelInfoVO getPileModelInfoByModelId(Long modelId) {
// String redisKey = CacheConstants.GET_PILE_MODEL_INFO_BY_MODEL_ID + modelId; String redisKey = CacheConstants.GET_PILE_MODEL_INFO_BY_MODEL_ID + modelId;
// PileModelInfoVO modelInfoVO = redisCache.getCacheObject(redisKey); PileModelInfoVO modelInfoVO = redisCache.getCacheObject(redisKey);
// if (Objects.isNull(modelInfoVO)) { if (Objects.isNull(modelInfoVO)) {
// modelInfoVO = pileModelInfoMapper.getPileModelInfoByModelId(modelId); modelInfoVO = pileModelInfoMapper.getPileModelInfoByModelId(modelId);
// if (Objects.nonNull(modelInfoVO)) { if (Objects.nonNull(modelInfoVO)) {
// redisCache.setCacheObject(redisKey, modelInfoVO, CacheConstants.cache_expire_time_1d); redisCache.setCacheObject(redisKey, modelInfoVO, CacheConstants.cache_expire_time_1d);
// } }
// } }
PileModelInfoVO modelInfoVO = pileModelInfoMapper.getPileModelInfoByModelId(modelId); // PileModelInfoVO modelInfoVO = pileModelInfoMapper.getPileModelInfoByModelId(modelId);
return modelInfoVO; return modelInfoVO;
} }

View File

@@ -53,6 +53,7 @@ import java.text.DecimalFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -108,14 +109,14 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
@Override @Override
public PileStationInfo selectPileStationInfoById(Long id) { public PileStationInfo selectPileStationInfoById(Long id) {
// 加缓存 // 加缓存
// String redisKey = CacheConstants.SELECT_PILE_STATION_INFO_BY_ID + id; String redisKey = CacheConstants.SELECT_PILE_STATION_INFO_BY_ID + id;
// PileStationInfo pileStationInfo = redisCache.getCacheObject(redisKey); PileStationInfo pileStationInfo = redisCache.getCacheObject(redisKey);
// if (pileStationInfo == null) { if (pileStationInfo == null) {
// // 查数据库 // 查数据库
// pileStationInfo = pileStationInfoMapper.selectPileStationInfoById(id); pileStationInfo = pileStationInfoMapper.selectPileStationInfoById(id);
// redisCache.setCacheObject(redisKey, pileStationInfo, 15, TimeUnit.MINUTES); redisCache.setCacheObject(redisKey, pileStationInfo, 15, TimeUnit.MINUTES);
// } }
PileStationInfo pileStationInfo = pileStationInfoMapper.selectPileStationInfoById(id); // PileStationInfo pileStationInfo = pileStationInfoMapper.selectPileStationInfoById(id);
return pileStationInfo; return pileStationInfo;
} }