mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-25 01:29:47 +08:00
update 会员充值余额时,将充值金额添加到正在充电的订单中(仅限卡启动、VIN启动)
This commit is contained in:
@@ -26,17 +26,9 @@ import com.jsowell.common.util.JWTUtils;
|
|||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.id.IdUtils;
|
import com.jsowell.common.util.id.IdUtils;
|
||||||
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
import com.jsowell.pile.domain.*;
|
||||||
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.*;
|
import com.jsowell.pile.dto.*;
|
||||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.service.IMemberInvoiceTitleService;
|
|
||||||
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
|
|
||||||
import com.jsowell.pile.service.IPileAuthCardService;
|
|
||||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
|
||||||
import com.jsowell.pile.transaction.dto.MemberTransactionDTO;
|
import com.jsowell.pile.transaction.dto.MemberTransactionDTO;
|
||||||
import com.jsowell.pile.transaction.service.TransactionService;
|
import com.jsowell.pile.transaction.service.TransactionService;
|
||||||
import com.jsowell.pile.vo.MemberPlateNumberVO;
|
import com.jsowell.pile.vo.MemberPlateNumberVO;
|
||||||
@@ -91,6 +83,12 @@ public class MemberService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMemberInvoiceTitleService memberInvoiceTitleService;
|
private IMemberInvoiceTitleService memberInvoiceTitleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileRemoteService pileRemoteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
@@ -495,6 +493,11 @@ public class MemberService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值订单金额
|
||||||
|
* @param dto
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
public void rechargeOrderAmount(RechargeOrderAmountDTO dto) throws ParseException {
|
public void rechargeOrderAmount(RechargeOrderAmountDTO dto) throws ParseException {
|
||||||
// 根据memberId查询出当前用户正在充电的 vin启动订单 或 卡启动订单
|
// 根据memberId查询出当前用户正在充电的 vin启动订单 或 卡启动订单
|
||||||
UniAppQueryOrderDTO orderDTO = new UniAppQueryOrderDTO();
|
UniAppQueryOrderDTO orderDTO = new UniAppQueryOrderDTO();
|
||||||
@@ -511,13 +514,25 @@ public class MemberService {
|
|||||||
if (StringUtils.equals(orderVO.getStartMode(), StartModeEnum.AUTH_CARD.getValue())
|
if (StringUtils.equals(orderVO.getStartMode(), StartModeEnum.AUTH_CARD.getValue())
|
||||||
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.OFFLINE_CARD.getValue())
|
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.OFFLINE_CARD.getValue())
|
||||||
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.VIN_CODE.getValue())) {
|
|| StringUtils.equals(orderVO.getStartMode(), StartModeEnum.VIN_CODE.getValue())) {
|
||||||
BigDecimal rechargeAmount = new BigDecimal(dto.getRechargeAmount());
|
|
||||||
orderVO.setPayAmount(orderVO.getPayAmount().add(rechargeAmount));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 将充值后的余额计算出来
|
// 将充值后的余额计算出来
|
||||||
|
BigDecimal rechargeAmount = new BigDecimal(dto.getRechargeAmount());
|
||||||
|
BigDecimal payAmount = orderVO.getPayAmount().add(rechargeAmount);
|
||||||
|
orderVO.setPayAmount(payAmount);
|
||||||
// 发送0x41指令更新账户余额
|
// 发送0x41指令更新账户余额
|
||||||
|
RemoteAccountBalanceUpdateDTO remoteDTO = new RemoteAccountBalanceUpdateDTO();
|
||||||
|
remoteDTO.setPileSn(orderVO.getPileSn());
|
||||||
|
remoteDTO.setConnectorCode(orderVO.getConnectorCode());
|
||||||
|
remoteDTO.setAccountBalance(String.valueOf(orderVO.getPayAmount()));
|
||||||
|
|
||||||
|
pileRemoteService.remoteAccountBalanceUpdate(remoteDTO);
|
||||||
|
|
||||||
|
// 将支付金额修改数据库
|
||||||
|
OrderBasicInfo basicInfo = new OrderBasicInfo();
|
||||||
|
basicInfo.setId(Long.parseLong(orderVO.getId()));
|
||||||
|
basicInfo.setPayAmount(payAmount);
|
||||||
|
|
||||||
|
orderBasicInfoService.updateOrderBasicInfo(basicInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,10 +201,12 @@ public class PileRemoteService {
|
|||||||
RemoteAccountBalanceUpdateCommand command = RemoteAccountBalanceUpdateCommand.builder()
|
RemoteAccountBalanceUpdateCommand command = RemoteAccountBalanceUpdateCommand.builder()
|
||||||
.pileSn(dto.getPileSn())
|
.pileSn(dto.getPileSn())
|
||||||
.connectorCode(dto.getConnectorCode())
|
.connectorCode(dto.getConnectorCode())
|
||||||
.logicCard(dto.getLogicCard())
|
|
||||||
.accountBalance(dto.getAccountBalance())
|
.accountBalance(dto.getAccountBalance())
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
if (StringUtils.isNotBlank(dto.getLogicCard())) {
|
||||||
|
command.setLogicCard(dto.getLogicCard());
|
||||||
|
}
|
||||||
ykcPushCommandService.pushAccountBalanceUpdateCommand(command);
|
ykcPushCommandService.pushAccountBalanceUpdateCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class OrderVO {
|
public class OrderVO {
|
||||||
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单号
|
* 订单号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -765,6 +765,7 @@
|
|||||||
|
|
||||||
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
|
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
t1.id,
|
||||||
t1.order_code as orderCode,
|
t1.order_code as orderCode,
|
||||||
t1.order_status as orderStatus,
|
t1.order_status as orderStatus,
|
||||||
t1.reason,
|
t1.reason,
|
||||||
|
|||||||
Reference in New Issue
Block a user