新增 用户绑定vin信息接口

This commit is contained in:
Lemon
2023-06-08 17:04:27 +08:00
parent a02bebb74f
commit dec5dfbd8f
7 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.jsowell.pile.dto;
import lombok.Data;
/**
* 车辆vinDTO
*
* @author JS-ZZA
* @date 2023/6/8 15:02
*/
@Data
public class CarVinDTO {
private String vinCode;
private String memberId;
private String phoneNumber;
private String verificationCode;
}

View File

@@ -75,4 +75,11 @@ public interface CarVinInfoMapper {
* @return
*/
CarVinInfoVO getMemberInfoByVinCode(String vinCode);
/**
* 通过memberId查询绑定的车辆vin列表
* @param memberId
* @return
*/
List<CarVinInfoVO> getCarVinListByMemberId(String memberId);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -110,4 +110,11 @@
join member_wallet_info t3 on t2.member_id = t3.member_id and t2.status = '1'
where t1.vin_code = #{vinCode,jdbcType=VARCHAR}
</select>
<select id="getCarVinListByMemberId" resultType="com.jsowell.pile.vo.CarVinInfoVO">
select <include refid="Base_Column_List"/>
from car_vin_info
where member_id = #{memberId,jdbcType=VARCHAR}
and del_flag = '0'
</select>
</mapper>