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,99 @@
|
||||
package com.jsowell.pile.domain;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import com.jsowell.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 车辆vin码对象 car_vin_info
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-06-07
|
||||
*/
|
||||
public class CarVinInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 车辆vin码
|
||||
*/
|
||||
@Excel(name = "车辆vin码")
|
||||
private String vinCode;
|
||||
|
||||
/**
|
||||
* 状态(1-正常使用; 2-启动锁定;9-停用)
|
||||
*/
|
||||
@Excel(name = "状态", readConverterExp = "1=-正常使用;,2=-启动锁定;9-停用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@Excel(name = "会员id")
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setVinCode(String vinCode) {
|
||||
this.vinCode = vinCode;
|
||||
}
|
||||
|
||||
public String getVinCode() {
|
||||
return vinCode;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("id", getId())
|
||||
.append("vinCode", getVinCode())
|
||||
.append("status", getStatus())
|
||||
.append("memberId", getMemberId())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,12 @@ public class OrderBasicInfo extends BaseEntity {
|
||||
@Excel(name = "逻辑卡号")
|
||||
private String logicCard;
|
||||
|
||||
/**
|
||||
* 车辆vin码
|
||||
*/
|
||||
@Excel(name = "车辆vin码")
|
||||
private String vinCode;
|
||||
|
||||
/**
|
||||
* 启动方式
|
||||
* 0-后管启动;1-用户app启动
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import lombok.Data;
|
||||
@@ -66,4 +67,9 @@ public class GenerateOrderDTO extends BasicPileDTO{
|
||||
* 使用刷卡创建订单时有值
|
||||
*/
|
||||
private PileAuthCard pileAuthCardInfo;
|
||||
|
||||
/**
|
||||
* vin启动有值
|
||||
*/
|
||||
private CarVinInfoVO carVinInfoVO;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.CarVinInfo;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 车辆vin码Mapper接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-06-07
|
||||
*/
|
||||
@Component
|
||||
public interface CarVinInfoMapper {
|
||||
/**
|
||||
* 查询车辆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 id 车辆vin码主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarVinInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除车辆vin码
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarVinInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 通过vin查询用户信息
|
||||
* @param vinCode
|
||||
* @return
|
||||
*/
|
||||
CarVinInfoVO getMemberInfoByVinCode(String vinCode);
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jsowell.pile.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 车辆vin基本信息VO
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/6/7 10:14
|
||||
*/
|
||||
@Data
|
||||
public class CarVinInfoVO {
|
||||
private String id;
|
||||
|
||||
// 车辆vin码
|
||||
private String vinCode;
|
||||
|
||||
// 状态
|
||||
private String status;
|
||||
|
||||
// 会员id
|
||||
private String memberId;
|
||||
|
||||
// 手机号码
|
||||
private String phoneNumber;
|
||||
|
||||
// 本金余额
|
||||
private BigDecimal principalBalance;
|
||||
|
||||
// 赠送余额
|
||||
private BigDecimal giftBalance;
|
||||
|
||||
// 账户总余额
|
||||
private BigDecimal accountBalance;
|
||||
}
|
||||
Reference in New Issue
Block a user