mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-02 13:07:57 +08:00
添加vin码启动相关逻辑代码
This commit is contained in:
@@ -9,6 +9,7 @@ public enum StartModeEnum {
|
|||||||
AUTH_CARD("2", "鉴权卡启动"),
|
AUTH_CARD("2", "鉴权卡启动"),
|
||||||
OFFLINE_CARD("3", "离线卡启动"),
|
OFFLINE_CARD("3", "离线卡启动"),
|
||||||
LIAN_LIAN("4", "联联平台启动"),
|
LIAN_LIAN("4", "联联平台启动"),
|
||||||
|
VIN_CODE("5", "车辆vin码启动"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
|||||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||||
import com.jsowell.common.enums.ykc.CardStatusEnum;
|
import com.jsowell.common.enums.ykc.CardStatusEnum;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.StartModeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.BytesUtil;
|
import com.jsowell.common.util.BytesUtil;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -14,8 +15,10 @@ import com.jsowell.common.util.YKCUtils;
|
|||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.domain.PileAuthCard;
|
import com.jsowell.pile.domain.PileAuthCard;
|
||||||
import com.jsowell.pile.dto.GenerateOrderDTO;
|
import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||||
|
import com.jsowell.pile.service.ICarVinInfoService;
|
||||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||||
import com.jsowell.pile.service.IPileAuthCardService;
|
import com.jsowell.pile.service.IPileAuthCardService;
|
||||||
|
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -41,6 +44,9 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IOrderBasicInfoService orderBasicInfoService;
|
private IOrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICarVinInfoService carVinInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
YKCOperateFactory.register(type, this);
|
YKCOperateFactory.register(type, this);
|
||||||
@@ -97,13 +103,14 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 17;
|
length = 17;
|
||||||
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String vinCode = BytesUtil.ascii2Str(vinCodeByteArr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷卡启动充电
|
* 刷卡启动充电
|
||||||
*/
|
*/
|
||||||
String logicCard = "";
|
String logicCard = "";
|
||||||
byte[] authenticationFlagByteArr = Constants.zeroByteArray;
|
byte[] authenticationFlagByteArr = Constants.zeroByteArray; // 鉴权成功标识
|
||||||
byte[] accountBalanceByteArr = Constants.zeroByteArray;
|
byte[] accountBalanceByteArr = Constants.zeroByteArray; // 账户余额
|
||||||
String transactionCode = "";
|
String transactionCode = "";
|
||||||
try {
|
try {
|
||||||
if (StringUtils.equals("01", startMode)) {
|
if (StringUtils.equals("01", startMode)) {
|
||||||
@@ -127,6 +134,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
dto.setPileAuthCardInfo(pileAuthCardInfo);
|
dto.setPileAuthCardInfo(pileAuthCardInfo);
|
||||||
dto.setPileSn(pileSn);
|
dto.setPileSn(pileSn);
|
||||||
dto.setConnectorCode(connectorCode);
|
dto.setConnectorCode(connectorCode);
|
||||||
|
dto.setStartMode(StartModeEnum.AUTH_CARD.getValue());
|
||||||
Map<String, Object> map = orderBasicInfoService.generateOrderByCard(dto);
|
Map<String, Object> map = orderBasicInfoService.generateOrderByCard(dto);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
transactionCode = (String) map.get("transactionCode");
|
transactionCode = (String) map.get("transactionCode");
|
||||||
@@ -144,6 +152,30 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
/**
|
/**
|
||||||
* TODO VIN码启动充电
|
* TODO VIN码启动充电
|
||||||
*/
|
*/
|
||||||
|
if (StringUtils.equals("03", startMode)) {
|
||||||
|
// 通过vin码查询数据库绑定用户信息
|
||||||
|
CarVinInfoVO memberInfo = carVinInfoService.getMemberInfoByVinCode(vinCode);
|
||||||
|
if (memberInfo == null) {
|
||||||
|
throw new BusinessException("", "");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals("1", memberInfo.getStatus())) {
|
||||||
|
// 1- 正常使用
|
||||||
|
throw new BusinessException("", "");
|
||||||
|
}
|
||||||
|
// vin码生成订单 vin启动充电
|
||||||
|
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||||||
|
dto.setCarVinInfoVO(memberInfo);
|
||||||
|
dto.setPileSn(pileSn);
|
||||||
|
dto.setConnectorCode(connectorCode);
|
||||||
|
dto.setStartMode(StartModeEnum.VIN_CODE.getValue());
|
||||||
|
Map<String, Object> map = orderBasicInfoService.generateOrderByCard(dto);
|
||||||
|
if (map != null) {
|
||||||
|
transactionCode = (String) map.get("transactionCode");
|
||||||
|
accountBalanceByteArr = YKCUtils.getPriceByte(String.valueOf(map.get("accountBalance")), 2);
|
||||||
|
// 鉴权成功标识 0x00 失败 0x01 成功
|
||||||
|
authenticationFlagByteArr = Constants.oneByteArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 应答
|
// 应答
|
||||||
// 交易流水号
|
// 交易流水号
|
||||||
|
|||||||
@@ -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 = "逻辑卡号")
|
@Excel(name = "逻辑卡号")
|
||||||
private String logicCard;
|
private String logicCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆vin码
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆vin码")
|
||||||
|
private String vinCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动方式
|
* 启动方式
|
||||||
* 0-后管启动;1-用户app启动
|
* 0-后管启动;1-用户app启动
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.pile.dto;
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.PileAuthCard;
|
import com.jsowell.pile.domain.PileAuthCard;
|
||||||
|
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
|
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
|
||||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -66,4 +67,9 @@ public class GenerateOrderDTO extends BasicPileDTO{
|
|||||||
* 使用刷卡创建订单时有值
|
* 使用刷卡创建订单时有值
|
||||||
*/
|
*/
|
||||||
private PileAuthCard pileAuthCardInfo;
|
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.service.*;
|
||||||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||||
import com.jsowell.pile.transaction.service.TransactionService;
|
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.OrderAmountDetailVO;
|
||||||
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||||
@@ -133,6 +134,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPileMerchantInfoService pileMerchantInfoService;
|
private IPileMerchantInfoService pileMerchantInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICarVinInfoService carVinInfoService;
|
||||||
|
|
||||||
@Value("${adapay.refundCallback}")
|
@Value("${adapay.refundCallback}")
|
||||||
private String ADAPAY_REFUND_CALLBACK_URL;
|
private String ADAPAY_REFUND_CALLBACK_URL;
|
||||||
|
|
||||||
@@ -1548,9 +1552,25 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
public Map<String, Object> generateOrderByCard(GenerateOrderDTO dto) {
|
public Map<String, Object> generateOrderByCard(GenerateOrderDTO dto) {
|
||||||
String pileSn = dto.getPileSn();
|
String pileSn = dto.getPileSn();
|
||||||
String connectorCode = dto.getConnectorCode();
|
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获取账户余额
|
// 通过memberId获取账户余额
|
||||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(pileAuthCardInfo.getMemberId());
|
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||||
if (memberVO == null) {
|
if (memberVO == null) {
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
||||||
}
|
}
|
||||||
@@ -1578,8 +1598,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
.pileSn(pileSn)
|
.pileSn(pileSn)
|
||||||
.connectorCode(connectorCode)
|
.connectorCode(connectorCode)
|
||||||
.pileConnectorCode(pileSn + connectorCode)
|
.pileConnectorCode(pileSn + connectorCode)
|
||||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
.logicCard(logicCard)
|
||||||
.startMode(StartModeEnum.AUTH_CARD.getValue())
|
.vinCode(vinCode)
|
||||||
|
.startMode(startMode)
|
||||||
.payStatus(Constants.ONE)
|
.payStatus(Constants.ONE)
|
||||||
.payAmount(totalAccountAmount)
|
.payAmount(totalAccountAmount)
|
||||||
.payTime(new Date())
|
.payTime(new Date())
|
||||||
@@ -1609,13 +1630,22 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
.build();
|
.build();
|
||||||
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||||
|
|
||||||
// 将卡状态改为启动锁定
|
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
// 将卡状态改为启动锁定
|
||||||
.id(pileAuthCardInfo.getId())
|
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
.id(pileAuthCardInfo.getId())
|
||||||
.status("2")
|
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||||
.build();
|
.status("2")
|
||||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
.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();
|
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;
|
||||||
|
}
|
||||||
113
jsowell-pile/src/main/resources/mapper/pile/CarVinInfoMapper.xml
Normal file
113
jsowell-pile/src/main/resources/mapper/pile/CarVinInfoMapper.xml
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.jsowell.pile.mapper.CarVinInfoMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.jsowell.pile.domain.CarVinInfo" id="CarVinInfoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="vinCode" column="vin_code" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="memberId" column="member_id" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectCarVinInfoVo">
|
||||||
|
select id, vin_code, status, member_id, create_by, create_time, update_by, update_time, del_flag from car_vin_info
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, vin_code, status, member_id, create_by, create_time, update_by, update_time, del_flag
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectCarVinInfoList" parameterType="com.jsowell.pile.domain.CarVinInfo" resultMap="CarVinInfoResult">
|
||||||
|
<include refid="selectCarVinInfoVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="vinCode != null and vinCode != ''"> and vin_code = #{vinCode}</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCarVinInfoById" parameterType="Long" resultMap="CarVinInfoResult">
|
||||||
|
<include refid="selectCarVinInfoVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertCarVinInfo" parameterType="com.jsowell.pile.domain.CarVinInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into car_vin_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="vinCode != null">vin_code,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="memberId != null">member_id,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="vinCode != null">#{vinCode},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="memberId != null">#{memberId},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateCarVinInfo" parameterType="com.jsowell.pile.domain.CarVinInfo">
|
||||||
|
update car_vin_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="vinCode != null">vin_code = #{vinCode},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="memberId != null">member_id = #{memberId},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteCarVinInfoById" parameterType="Long">
|
||||||
|
delete from car_vin_info where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteCarVinInfoByIds" parameterType="String">
|
||||||
|
delete from car_vin_info where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectVinInfoByVin" resultMap="CarVinInfoResult">
|
||||||
|
select <include refid="Base_Column_List"/>
|
||||||
|
from car_vin_info
|
||||||
|
where vin_code = #{vinCode,jdbcType=VARCHAR}
|
||||||
|
and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMemberInfoByVinCode" resultType="com.jsowell.pile.vo.CarVinInfoVO">
|
||||||
|
select
|
||||||
|
t1.id,
|
||||||
|
t1.vin_code as vinCode,
|
||||||
|
t1.status,
|
||||||
|
t1.member_id as memberId,
|
||||||
|
t2.mobile_number as phoneNumber,
|
||||||
|
t3.principal_balance as principalBalance,
|
||||||
|
t3.gift_balance as giftBalance
|
||||||
|
from
|
||||||
|
car_vin_info t1
|
||||||
|
join member_basic_info t2 on t1.member_id = t2.member_id and t1.del_flag = '0'
|
||||||
|
join member_wallet_info t3 on t2.member_id = t3.member_id and t2.status = '1'
|
||||||
|
where t1.vin_code = #{vinCode,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<result property="connectorCode" column="connector_code"/>
|
<result property="connectorCode" column="connector_code"/>
|
||||||
<result property="pileConnectorCode" column="pile_connector_code"/>
|
<result property="pileConnectorCode" column="pile_connector_code"/>
|
||||||
<result property="logicCard" column="logic_card"/>
|
<result property="logicCard" column="logic_card"/>
|
||||||
|
<result property="vinCode" column="vin_code"/>
|
||||||
<result property="startMode" column="start_mode"/>
|
<result property="startMode" column="start_mode"/>
|
||||||
<result property="payMode" column="pay_mode"/>
|
<result property="payMode" column="pay_mode"/>
|
||||||
<result property="payStatus" column="pay_status"/>
|
<result property="payStatus" column="pay_status"/>
|
||||||
@@ -94,6 +95,7 @@
|
|||||||
connector_code,
|
connector_code,
|
||||||
pile_connector_code,
|
pile_connector_code,
|
||||||
logic_card,
|
logic_card,
|
||||||
|
vin_code,
|
||||||
start_mode,
|
start_mode,
|
||||||
pay_mode,
|
pay_mode,
|
||||||
pay_status,
|
pay_status,
|
||||||
|
|||||||
Reference in New Issue
Block a user