删除充电桩计费模板 缓存

This commit is contained in:
Guoqs
2024-11-21 14:48:42 +08:00
parent 4de27ac56e
commit a0ab309134
2 changed files with 14 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ import java.net.UnknownHostException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Service @Service
public class PileRemoteService { public class PileRemoteService {
@@ -289,16 +290,20 @@ public class PileRemoteService {
pileBillingTemplate.setId(Long.valueOf(billingTemplateVO.getTemplateId())); pileBillingTemplate.setId(Long.valueOf(billingTemplateVO.getTemplateId()));
pileBillingTemplate.setPublishTime(new Date()); pileBillingTemplate.setPublishTime(new Date());
pileBillingTemplateService.updatePileBillingTemplate(pileBillingTemplate); pileBillingTemplateService.updatePileBillingTemplate(pileBillingTemplate);
// 获取到站点下所有的桩
// 获取到站点下所有的桩, 下发计费模板, 电单车不支持
if (StringUtils.equals(billingTemplateVO.getDeviceType(), Constants.ONE)) {
List<PileDetailVO> pileList = pileBasicInfoService.selectPileListByStationIds(Lists.newArrayList(Long.valueOf(dto.getStationId()))); List<PileDetailVO> pileList = pileBasicInfoService.selectPileListByStationIds(Lists.newArrayList(Long.valueOf(dto.getStationId())));
if (CollectionUtils.isNotEmpty(pileList)) { if (CollectionUtils.isNotEmpty(pileList)) {
// 删除缓存
List<String> collect = pileList.parallelStream()
.map(vo -> CacheConstants.BILLING_TEMPLATE_BY_PILE_SN + vo.getPileSn())
.collect(Collectors.toList());
redisCache.deleteObject(collect);
// 下发计费模板, 电单车不支持
if (StringUtils.equals(billingTemplateVO.getDeviceType(), Constants.ONE)) {
// 下发指令 // 下发指令
pileList.parallelStream().forEach(pileInfoVO -> publishPileBillingTemplate(pileInfoVO.getPileSn(), billingTemplateVO)); pileList.parallelStream().forEach(pileInfoVO -> publishPileBillingTemplate(pileInfoVO.getPileSn(), billingTemplateVO));
} }
} }
// 修改计费模板状态 // 修改计费模板状态
pileBillingTemplateService.changeStationTemplate(dto.getStationId(), dto.getTemplateId(), billingTemplateVO.getDeviceType()); pileBillingTemplateService.changeStationTemplate(dto.getStationId(), dto.getTemplateId(), billingTemplateVO.getDeviceType());
return true; return true;

View File

@@ -26,10 +26,7 @@ import com.jsowell.pile.transaction.service.TransactionService;
import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO; import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails; import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
import com.jsowell.pile.vo.web.BillingDetailVO; import com.jsowell.pile.vo.web.*;
import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.pile.vo.web.EchoBillingTemplateVO;
import com.jsowell.pile.vo.web.MemberGroupVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -586,6 +583,8 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
// 通过站点id清缓存 // 通过站点id清缓存
if (StringUtils.isNotBlank(stationId)) { if (StringUtils.isNotBlank(stationId)) {
redisKeyList.add(CacheConstants.QUERY_STATION_BILLING_TEMPLATE_LIST + stationId); redisKeyList.add(CacheConstants.QUERY_STATION_BILLING_TEMPLATE_LIST + stationId);
// 删除充电桩缓存
} }
// 通过计费模板id 清缓存 // 通过计费模板id 清缓存
if (templateId != null) { if (templateId != null) {