update 联联平台 枪口功率=设备额定功率/枪数

This commit is contained in:
Lemon
2023-06-20 15:52:13 +08:00
parent 780b4c5d5e
commit 6e2ee7f794
10 changed files with 181 additions and 28 deletions

View File

@@ -16,8 +16,10 @@ import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.TitleTypeEnum;
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.ScenarioEnum;
import com.jsowell.common.enums.ykc.StartModeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.AdapayUtil;
import com.jsowell.common.util.JWTUtils;
@@ -29,15 +31,7 @@ import com.jsowell.pile.domain.MemberInvoiceTitle;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
import com.jsowell.pile.domain.MemberWalletInfo;
import com.jsowell.pile.domain.PileAuthCard;
import com.jsowell.pile.dto.BindingCarNoDTO;
import com.jsowell.pile.dto.BindingCardDTO;
import com.jsowell.pile.dto.InvoiceTitleDTO;
import com.jsowell.pile.dto.MemberRegisterAndLoginDTO;
import com.jsowell.pile.dto.MemberRegisterDTO;
import com.jsowell.pile.dto.PaymentScenarioDTO;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.dto.WechatLoginDTO;
import com.jsowell.pile.dto.WeixinPayDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IMemberInvoiceTitleService;
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
@@ -49,6 +43,7 @@ import com.jsowell.pile.vo.MemberPlateNumberVO;
import com.jsowell.pile.vo.uniapp.InvoiceTitleVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import com.jsowell.pile.vo.uniapp.OrderVO;
import com.jsowell.wxpay.service.WxAppletRemoteService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
@@ -60,10 +55,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
public class MemberService {
@@ -497,5 +495,29 @@ public class MemberService {
return null;
}
public void rechargeOrderAmount(RechargeOrderAmountDTO dto) throws ParseException {
// 根据memberId查询出当前用户正在充电的 vin启动订单 或 卡启动订单
UniAppQueryOrderDTO orderDTO = new UniAppQueryOrderDTO();
orderDTO.setOrderStatus("4"); // 4-正在充电中
PageResponse pageResponse = orderService.getListByMemberIdAndOrderStatus(dto.getMemberId(), orderDTO);
if (pageResponse == null) {
return;
}
List<OrderVO> list = (List<OrderVO>) pageResponse.getList();
List<OrderVO> chargingList = list.stream()
.filter(orderVO -> orderVO.getOrderStatus().equals(OrderStatusEnum.IN_THE_CHARGING.getValue()))
.collect(Collectors.toList());
for (OrderVO orderVO : chargingList) {
if (StringUtils.equals(orderVO.getStartMode(), StartModeEnum.AUTH_CARD.getValue())
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.OFFLINE_CARD.getValue())
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.VIN_CODE.getValue())) {
BigDecimal rechargeAmount = new BigDecimal(dto.getRechargeAmount());
orderVO.setPayAmount(orderVO.getPayAmount().add(rechargeAmount));
}
}
// 将充值后的余额计算出来
// 发送0x41指令更新账户余额
}
}

View File

@@ -2,14 +2,8 @@ package com.jsowell.service;
import com.google.common.collect.Lists;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ykcCommond.GetRealTimeMonitorDataCommand;
import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand;
import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand;
import com.jsowell.pile.domain.ykcCommond.PublishPileBillingTemplateCommand;
import com.jsowell.pile.domain.ykcCommond.RebootCommand;
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.StopChargingCommand;
import com.jsowell.pile.domain.ykcCommond.UpdateFirmwareCommand;
import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.domain.PileBillingRelation;
import com.jsowell.pile.domain.PileBillingTemplate;
@@ -199,4 +193,19 @@ public class PileRemoteService {
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder().pileSnList(pileSns).build();
ykcPushCommandService.pushUpdateFileCommand(command);
}
/**
* 远程账户余额更新
*/
public void remoteAccountBalanceUpdate(RemoteAccountBalanceUpdateDTO dto) {
RemoteAccountBalanceUpdateCommand command = RemoteAccountBalanceUpdateCommand.builder()
.pileSn(dto.getPileSn())
.connectorCode(dto.getConnectorCode())
.logicCard(dto.getLogicCard())
.accountBalance(dto.getAccountBalance())
.build();
ykcPushCommandService.pushAccountBalanceUpdateCommand(command);
}
}