mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update
This commit is contained in:
@@ -23,6 +23,8 @@ public class CacheConstants {
|
||||
|
||||
public static final int cache_expire_time_1d = 60 * 60 * 24;
|
||||
|
||||
public static final String GET_PILE_MODEL_INFO_BY_MODEL_ID = "get_pile_model_info_by_model_id:";
|
||||
|
||||
public static final String QUERY_BILLING_DETAIL_BY_ID = "query_billing_detail_by_id:";
|
||||
|
||||
//
|
||||
|
||||
@@ -70,4 +70,6 @@ public interface PileModelInfoMapper {
|
||||
* @return PileModelInfo对象
|
||||
*/
|
||||
List<PileModelInfoVO> getPileModelInfoByPileSnList(@Param("pileSnList") List<String> pileSns);
|
||||
|
||||
PileModelInfoVO getPileModelInfoByModelId(@Param("modelId") Long modelId);
|
||||
}
|
||||
|
||||
@@ -69,4 +69,6 @@ public interface IPileModelInfoService {
|
||||
List<PileModelInfoVO> getPileModelInfoByPileSnList(List<String> pileSns);
|
||||
|
||||
PileModelInfoVO getPileModelInfoByPileSn(String pileSn);
|
||||
|
||||
PileModelInfoVO getPileModelInfoByModelId(Long modelId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.PileModelInfo;
|
||||
import com.jsowell.pile.mapper.PileModelInfoMapper;
|
||||
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 充电桩型号信息Service业务层处理
|
||||
@@ -23,6 +26,9 @@ public class PileModelInfoServiceImpl implements IPileModelInfoService {
|
||||
@Autowired
|
||||
private PileModelInfoMapper pileModelInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询充电桩型号信息
|
||||
*
|
||||
@@ -66,6 +72,7 @@ public class PileModelInfoServiceImpl implements IPileModelInfoService {
|
||||
@Override
|
||||
public int updatePileModelInfo(PileModelInfo pileModelInfo) {
|
||||
pileModelInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
cleanCache(new Long[]{pileModelInfo.getId()});
|
||||
return pileModelInfoMapper.updatePileModelInfo(pileModelInfo);
|
||||
}
|
||||
|
||||
@@ -77,6 +84,7 @@ public class PileModelInfoServiceImpl implements IPileModelInfoService {
|
||||
*/
|
||||
@Override
|
||||
public int deletePileModelInfoByIds(Long[] ids) {
|
||||
cleanCache(ids);
|
||||
return pileModelInfoMapper.deletePileModelInfoByIds(ids);
|
||||
}
|
||||
|
||||
@@ -88,6 +96,7 @@ public class PileModelInfoServiceImpl implements IPileModelInfoService {
|
||||
*/
|
||||
@Override
|
||||
public int deletePileModelInfoById(Long id) {
|
||||
cleanCache(new Long[]{id});
|
||||
return pileModelInfoMapper.deletePileModelInfoById(id);
|
||||
}
|
||||
|
||||
@@ -110,4 +119,25 @@ public class PileModelInfoServiceImpl implements IPileModelInfoService {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileModelInfoVO getPileModelInfoByModelId(Long modelId) {
|
||||
String redisKey = CacheConstants.GET_PILE_MODEL_INFO_BY_MODEL_ID + modelId;
|
||||
PileModelInfoVO modelInfoVO = redisCache.getCacheObject(redisKey);
|
||||
if (Objects.isNull(modelInfoVO)) {
|
||||
modelInfoVO = pileModelInfoMapper.getPileModelInfoByModelId(modelId);
|
||||
if (Objects.nonNull(modelInfoVO)) {
|
||||
redisCache.setCacheObject(redisKey, modelInfoVO, CacheConstants.cache_expire_time_1d);
|
||||
}
|
||||
}
|
||||
return modelInfoVO;
|
||||
}
|
||||
|
||||
private void cleanCache(Long[] modelIds) {
|
||||
List<String> redisKeyList = Lists.newArrayList();
|
||||
for (Long modelId : modelIds) {
|
||||
redisKeyList.add(CacheConstants.GET_PILE_MODEL_INFO_BY_MODEL_ID + modelId);
|
||||
}
|
||||
redisCache.deleteObject(redisKeyList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,5 +143,25 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPileModelInfoByModelId" resultType="com.jsowell.pile.vo.web.PileModelInfoVO">
|
||||
SELECT
|
||||
t2.id as modelId,
|
||||
t2.model_name as modelName,
|
||||
t2.rated_power as ratedPower,
|
||||
t2.rated_current as ratedCurrent,
|
||||
t2.rated_voltage as ratedVoltage,
|
||||
t2.speed_type as speedType,
|
||||
t2.charger_pile_type as chargerPileType,
|
||||
t2.connector_num as connectorNum,
|
||||
t2.interface_standard as interfaceStandard,
|
||||
t2.create_by as createBy,
|
||||
t2.create_time as createTime,
|
||||
t2.update_by as updateBy,
|
||||
t2.update_time as updateTime
|
||||
FROM
|
||||
pile_model_info t2
|
||||
WHERE
|
||||
t2.del_flag = '0'
|
||||
and t2.id = #{modelId,jdbcType=BIGINT}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -293,10 +293,11 @@ public class AMapServiceImpl implements AMapService {
|
||||
info.setEquipmentID(pileBasicInfo.getSn());
|
||||
info.setManufacturerName("举视");
|
||||
// 查询型号
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileBasicInfo.getSn());
|
||||
// PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileBasicInfo.getSn());
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByModelId(pileBasicInfo.getModelId());
|
||||
|
||||
info.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType()));
|
||||
info.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||
info.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, RoundingMode.HALF_UP));
|
||||
|
||||
List<AMapConnectorInfo> aMapConnectorInfos = getConnectorListBySN(pileBasicInfo.getSn());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user