mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 发布电单车计费模板
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 调试订单DTO
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class DebugOrderDTO extends QueryOrderDTO{
|
||||
/**
|
||||
* 是否重新计算 订单主表and订单详情
|
||||
*/
|
||||
private String reCalculateFlag = "0";
|
||||
|
||||
/**
|
||||
* 是否重新退款
|
||||
*/
|
||||
private String reRefundFlag = "0";
|
||||
|
||||
/**
|
||||
* 是否重新分账
|
||||
*/
|
||||
private String reSplitFlag = "0";
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public class PileRemoteService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public boolean publishBillingTemplate(PublishBillingTemplateDTO dto) {
|
||||
public boolean publishBillingTemplateOld(PublishBillingTemplateDTO dto) {
|
||||
// 获取计费模板信息
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateByTemplateId(dto.getTemplateId());
|
||||
if (billingTemplateVO == null) {
|
||||
@@ -317,6 +317,53 @@ public class PileRemoteService {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发计费模板
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public boolean publishBillingTemplate(PublishBillingTemplateDTO dto) {
|
||||
// 获取计费模板信息
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateByTemplateId(dto.getTemplateId());
|
||||
if (billingTemplateVO == null) {
|
||||
log.warn("获取计费模板信息, 通过模板id:{}查询计费模板为null", dto.getTemplateId());
|
||||
return false;
|
||||
}
|
||||
boolean sendBillingTemplateToPile = true;
|
||||
// 会员优惠计费模板不下发
|
||||
if (Constants.ONE.equals(billingTemplateVO.getMemberFlag())) {
|
||||
sendBillingTemplateToPile = false;
|
||||
}
|
||||
// 电单车计费模板不下发
|
||||
if (Constants.TWO.equals(billingTemplateVO.getDeviceType())) {
|
||||
sendBillingTemplateToPile = false;
|
||||
}
|
||||
// 更新计费模板的发布时间
|
||||
PileBillingTemplate pileBillingTemplate = new PileBillingTemplate();
|
||||
pileBillingTemplate.setId(Long.valueOf(billingTemplateVO.getTemplateId()));
|
||||
pileBillingTemplate.setPublishTime(new Date());
|
||||
pileBillingTemplateService.updatePileBillingTemplate(pileBillingTemplate);
|
||||
|
||||
// 修改计费模板状态
|
||||
pileBillingTemplateService.changeStationTemplate(dto.getStationId(), dto.getTemplateId(), billingTemplateVO.getDeviceType(), billingTemplateVO.getMemberFlag());
|
||||
|
||||
// 下发计费模板, 电单车不支持
|
||||
if (sendBillingTemplateToPile) {
|
||||
// 获取到站点下所有的桩
|
||||
List<PileDetailVO> pileList = pileBasicInfoService.selectPileListByStationIds(Lists.newArrayList(Long.valueOf(dto.getStationId())));
|
||||
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);
|
||||
// 下发计费模板指令
|
||||
pileList.parallelStream().forEach(pileInfoVO -> publishPileBillingTemplate(pileInfoVO.getPileSn(), billingTemplateVO));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程更新
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user