mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 10:00:11 +08:00
update 发布电单车计费模板
This commit is contained in:
@@ -763,6 +763,20 @@ public class TempController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
@PostMapping("/debugOrder")
|
||||
public RestApiResponse<?> debugOrder(@RequestBody DebugOrderDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
// 调试结算订单逻辑
|
||||
tempService.debugOrder(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("调试结算订单逻辑V2error,", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试结算订单逻辑
|
||||
* http://localhost:8080/temp/testSettleOrderLogic
|
||||
|
||||
@@ -26,10 +26,7 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.AfterSettleOrderDTO;
|
||||
import com.jsowell.pile.dto.ApplyRefundDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.SettleOrderReportDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
||||
@@ -1062,5 +1059,24 @@ public class TempService {
|
||||
orderBasicInfoService.splittingMethod(afterSettleOrderDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试订单
|
||||
* @param dto
|
||||
*/
|
||||
public void debugOrder(DebugOrderDTO dto) {
|
||||
if (dto == null) {
|
||||
return;
|
||||
}
|
||||
// 是否重新计算
|
||||
if (StringUtils.equals(dto.getReCalculateFlag(), "1")) {
|
||||
|
||||
}
|
||||
// 是否重新退款
|
||||
if (StringUtils.equals(dto.getReRefundFlag(), "1")) {
|
||||
}
|
||||
// 是否重新分账
|
||||
if (StringUtils.equals(dto.getReSplitFlag(), "1")) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
002212024121718083710715035892429205504
|
||||
002212024121808304610715252860795043840
|
||||
002212024121808422510715255789674143744
|
||||
002212024121811451510715301802631335936
|
||||
002212024121812305110715313278255996928
|
||||
002212024121813104910715323336701431808
|
||||
002212024121814450610715347065181925376
|
||||
002212024121817233710715386953924792320
|
||||
002212024102416494410695447094223949824
|
||||
002212024102419522510695493069857738752
|
||||
002212024102423461110695551898497138688
|
||||
002212024102508132610695679550910730240
|
||||
002212024102508310310695683984625319936
|
||||
002212024102508502610695688864317952000
|
||||
002212024102513440210695762749414916096
|
||||
|
||||
@@ -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