mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
添加vin码启动相关逻辑代码
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.CarVinInfo;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
|
||||
/**
|
||||
* 车辆vin码Service接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-06-07
|
||||
*/
|
||||
public interface ICarVinInfoService {
|
||||
/**
|
||||
* 查询车辆vin码
|
||||
*
|
||||
* @param id 车辆vin码主键
|
||||
* @return 车辆vin码
|
||||
*/
|
||||
public CarVinInfo selectCarVinInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询车辆vin码列表
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 车辆vin码集合
|
||||
*/
|
||||
public List<CarVinInfo> selectCarVinInfoList(CarVinInfo carVinInfo);
|
||||
|
||||
/**
|
||||
* 通过vin查询信息
|
||||
* @param vinCode
|
||||
* @return
|
||||
*/
|
||||
CarVinInfo selectVinInfoByVin(String vinCode);
|
||||
|
||||
/**
|
||||
* 新增车辆vin码
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCarVinInfo(CarVinInfo carVinInfo);
|
||||
|
||||
/**
|
||||
* 修改车辆vin码
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCarVinInfo(CarVinInfo carVinInfo);
|
||||
|
||||
/**
|
||||
* 批量删除车辆vin码
|
||||
*
|
||||
* @param ids 需要删除的车辆vin码主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarVinInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除车辆vin码信息
|
||||
*
|
||||
* @param id 车辆vin码主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarVinInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 通过vin查询用户信息
|
||||
* @param vinCode
|
||||
* @return
|
||||
*/
|
||||
CarVinInfoVO getMemberInfoByVinCode(String vinCode);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.CarVinInfoMapper;
|
||||
import com.jsowell.pile.domain.CarVinInfo;
|
||||
import com.jsowell.pile.service.ICarVinInfoService;
|
||||
|
||||
/**
|
||||
* 车辆vin码Service业务层处理
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-06-07
|
||||
*/
|
||||
@Service
|
||||
public class CarVinInfoServiceImpl implements ICarVinInfoService {
|
||||
@Autowired
|
||||
private CarVinInfoMapper carVinInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询车辆vin码
|
||||
*
|
||||
* @param id 车辆vin码主键
|
||||
* @return 车辆vin码
|
||||
*/
|
||||
@Override
|
||||
public CarVinInfo selectCarVinInfoById(Long id) {
|
||||
return carVinInfoMapper.selectCarVinInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆vin码列表
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 车辆vin码
|
||||
*/
|
||||
@Override
|
||||
public List<CarVinInfo> selectCarVinInfoList(CarVinInfo carVinInfo) {
|
||||
return carVinInfoMapper.selectCarVinInfoList(carVinInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车辆vin码
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCarVinInfo(CarVinInfo carVinInfo) {
|
||||
carVinInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return carVinInfoMapper.insertCarVinInfo(carVinInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过vin查询信息
|
||||
* @param vinCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarVinInfo selectVinInfoByVin(String vinCode) {
|
||||
return carVinInfoMapper.selectVinInfoByVin(vinCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆vin码
|
||||
*
|
||||
* @param carVinInfo 车辆vin码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCarVinInfo(CarVinInfo carVinInfo) {
|
||||
carVinInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return carVinInfoMapper.updateCarVinInfo(carVinInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车辆vin码
|
||||
*
|
||||
* @param ids 需要删除的车辆vin码主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCarVinInfoByIds(Long[] ids) {
|
||||
return carVinInfoMapper.deleteCarVinInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆vin码信息
|
||||
*
|
||||
* @param id 车辆vin码主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCarVinInfoById(Long id) {
|
||||
return carVinInfoMapper.deleteCarVinInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过vin查询用户信息
|
||||
* @param vinCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarVinInfoVO getMemberInfoByVinCode(String vinCode){
|
||||
CarVinInfoVO memberInfo = carVinInfoMapper.getMemberInfoByVinCode(vinCode);
|
||||
if (memberInfo == null) {
|
||||
return null;
|
||||
}
|
||||
memberInfo.setAccountBalance(memberInfo.getPrincipalBalance().add(memberInfo.getGiftBalance()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
return memberInfo;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
@@ -133,6 +134,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private ICarVinInfoService carVinInfoService;
|
||||
|
||||
@Value("${adapay.refundCallback}")
|
||||
private String ADAPAY_REFUND_CALLBACK_URL;
|
||||
|
||||
@@ -1548,9 +1552,25 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
public Map<String, Object> generateOrderByCard(GenerateOrderDTO dto) {
|
||||
String pileSn = dto.getPileSn();
|
||||
String connectorCode = dto.getConnectorCode();
|
||||
PileAuthCard pileAuthCardInfo = dto.getPileAuthCardInfo();
|
||||
String startMode = dto.getStartMode();
|
||||
String logicCard = "";
|
||||
String memberId = "";
|
||||
String vinCode = "";
|
||||
PileAuthCard pileAuthCardInfo = new PileAuthCard();
|
||||
CarVinInfoVO carVinInfoVO = new CarVinInfoVO();
|
||||
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// 刷卡启动充电
|
||||
pileAuthCardInfo = dto.getPileAuthCardInfo();
|
||||
memberId = pileAuthCardInfo.getMemberId();
|
||||
logicCard = pileAuthCardInfo.getLogicCard();
|
||||
}else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
// vin启动充电
|
||||
carVinInfoVO = dto.getCarVinInfoVO();
|
||||
memberId = carVinInfoVO.getMemberId();
|
||||
vinCode = carVinInfoVO.getVinCode();
|
||||
}
|
||||
// 通过memberId获取账户余额
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(pileAuthCardInfo.getMemberId());
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||
if (memberVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
||||
}
|
||||
@@ -1578,8 +1598,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.pileConnectorCode(pileSn + connectorCode)
|
||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||
.startMode(StartModeEnum.AUTH_CARD.getValue())
|
||||
.logicCard(logicCard)
|
||||
.vinCode(vinCode)
|
||||
.startMode(startMode)
|
||||
.payStatus(Constants.ONE)
|
||||
.payAmount(totalAccountAmount)
|
||||
.payTime(new Date())
|
||||
@@ -1609,13 +1630,22 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
.build();
|
||||
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||
|
||||
// 将卡状态改为启动锁定
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.id(pileAuthCardInfo.getId())
|
||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||
.status("2")
|
||||
.build();
|
||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// 将卡状态改为启动锁定
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.id(pileAuthCardInfo.getId())
|
||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||
.status("2")
|
||||
.build();
|
||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
} else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
// 将vin码改成启动锁定
|
||||
CarVinInfo carVinInfo = new CarVinInfo();
|
||||
carVinInfo.setId(Long.parseLong(carVinInfoVO.getId()));
|
||||
carVinInfo.setVinCode(carVinInfoVO.getVinCode());
|
||||
carVinInfo.setStatus("2");
|
||||
carVinInfoService.updateCarVinInfo(carVinInfo);
|
||||
}
|
||||
|
||||
// 组装结果集
|
||||
Map<String, Object> resultMap = Maps.newHashMap();
|
||||
|
||||
Reference in New Issue
Block a user