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:
@@ -3,7 +3,9 @@ package com.jsowell.pile.service;
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.CarVinInfo;
|
||||
import com.jsowell.pile.dto.CarVinDTO;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.AuthCardVO;
|
||||
|
||||
/**
|
||||
* 车辆vin码Service接口
|
||||
@@ -74,4 +76,17 @@ public interface ICarVinInfoService {
|
||||
*/
|
||||
CarVinInfoVO getMemberInfoByVinCode(String vinCode);
|
||||
|
||||
/**
|
||||
* 通过memberId查询绑定的车辆vin列表
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
List<CarVinInfoVO> getCarVinListByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 用户绑定车辆vin
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int bindAuthCard(CarVinDTO dto);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,13 @@ package com.jsowell.pile.service.impl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.dto.CarVinDTO;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,6 +28,9 @@ public class CarVinInfoServiceImpl implements ICarVinInfoService {
|
||||
@Autowired
|
||||
private CarVinInfoMapper carVinInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private IMemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询车辆vin码
|
||||
*
|
||||
@@ -114,4 +123,44 @@ public class CarVinInfoServiceImpl implements ICarVinInfoService {
|
||||
memberInfo.setAccountBalance(memberInfo.getPrincipalBalance().add(memberInfo.getGiftBalance()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
return memberInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过memberId查询绑定的车辆vin列表
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CarVinInfoVO> getCarVinListByMemberId(String memberId) {
|
||||
return carVinInfoMapper.getCarVinListByMemberId(memberId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户绑定车辆vin
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int bindAuthCard(CarVinDTO dto) {
|
||||
String phoneNumber = dto.getPhoneNumber();
|
||||
// 判断此用户是否已注册小程序账号
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(phoneNumber);
|
||||
if (memberBasicInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_USER_IS_NOT_REGISTER);
|
||||
}
|
||||
// 判断此vin号码是否已被绑定
|
||||
CarVinInfo carVinInfo = carVinInfoMapper.selectVinInfoByVin(dto.getVinCode());
|
||||
if (carVinInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
if (!StringUtils.equals("1", carVinInfo.getStatus())) {
|
||||
throw new BusinessException("", "");
|
||||
}
|
||||
// 绑定操作
|
||||
carVinInfo.setVinCode(dto.getVinCode());
|
||||
carVinInfo.setStatus("1");
|
||||
carVinInfo.setMemberId(dto.getMemberId());
|
||||
carVinInfo.setCreateBy(dto.getMemberId());
|
||||
|
||||
return carVinInfoMapper.insertCarVinInfo(carVinInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user