mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 11:49:49 +08:00
去除car_vin_info
This commit is contained in:
@@ -1,125 +0,0 @@
|
|||||||
package com.jsowell.api.uniapp;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.jsowell.common.annotation.Anonymous;
|
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
|
||||||
import com.jsowell.common.exception.BusinessException;
|
|
||||||
import com.jsowell.common.response.RestApiResponse;
|
|
||||||
import com.jsowell.pile.dto.CarVinDTO;
|
|
||||||
import com.jsowell.pile.dto.MemberRegisterAndLoginDTO;
|
|
||||||
import com.jsowell.pile.service.ICarVinInfoService;
|
|
||||||
import com.jsowell.pile.vo.CarVinInfoVO;
|
|
||||||
import com.jsowell.pile.vo.uniapp.AuthCardVO;
|
|
||||||
import com.jsowell.service.MemberService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @author JS-ZZA
|
|
||||||
* @date 2023/6/8 13:56
|
|
||||||
*/
|
|
||||||
@Anonymous
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/uniapp/carVin")
|
|
||||||
public class CarVinController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ICarVinInfoService carVinInfoService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MemberService memberService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户查询绑定的vin列表
|
|
||||||
* http://localhost:8080/uniapp/carVin/getCarVinList
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/getCarVinList")
|
|
||||||
public RestApiResponse<?> getCarVinList(HttpServletRequest request){
|
|
||||||
RestApiResponse<?> response = null;
|
|
||||||
try {
|
|
||||||
String memberId = getMemberIdByAuthorization(request);
|
|
||||||
logger.info("查询用户Vin列表 param memberId:{}", memberId);
|
|
||||||
List<CarVinInfoVO> list = carVinInfoService.getCarVinListByMemberId(memberId);
|
|
||||||
response = new RestApiResponse<>(list);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("查询用户Vin列表 error", e);
|
|
||||||
response = new RestApiResponse<>(e);
|
|
||||||
}
|
|
||||||
logger.info("查询用户Vin列表 result : {}", response);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户绑定车辆vin信息
|
|
||||||
* http://localhost:8080/uniapp/carVin/bindCarVin
|
|
||||||
* @param request
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/bindCarVin")
|
|
||||||
public RestApiResponse<?> bindCarVin(HttpServletRequest request, @RequestBody CarVinDTO dto) {
|
|
||||||
logger.info("用户绑定Vin params: {}", JSONObject.toJSONString(dto));
|
|
||||||
RestApiResponse<?> response = null;
|
|
||||||
try {
|
|
||||||
String memberId = getMemberIdByAuthorization(request);
|
|
||||||
if (memberId == null) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
|
||||||
}
|
|
||||||
dto.setMemberId(memberId);
|
|
||||||
// 校验短信验证码
|
|
||||||
// MemberRegisterAndLoginDTO registerAndLoginDTO = MemberRegisterAndLoginDTO.builder()
|
|
||||||
// .mobileNumber(dto.getPhoneNumber())
|
|
||||||
// .verificationCode(dto.getVerificationCode())
|
|
||||||
// .build();
|
|
||||||
// memberService.checkVerificationCode(registerAndLoginDTO);
|
|
||||||
int i = carVinInfoService.bindAuthCard(dto);
|
|
||||||
response = new RestApiResponse<>(i);
|
|
||||||
}catch (BusinessException e){
|
|
||||||
logger.warn("用户绑定Vin warn:", e);
|
|
||||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("用户绑定Vin error", e);
|
|
||||||
response = new RestApiResponse<>(e);
|
|
||||||
}
|
|
||||||
logger.info("用户绑定Vin result:{}", response);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户解绑车辆vin信息
|
|
||||||
* http://localhost:8080/uniapp/carVin/unbindCarVin
|
|
||||||
* @param request
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/unbindCarVin")
|
|
||||||
public RestApiResponse<?> unbindCarVin(HttpServletRequest request, @RequestBody CarVinDTO dto) {
|
|
||||||
logger.info("用户解绑车辆vin信息 params:{}", JSONObject.toJSONString(dto));
|
|
||||||
RestApiResponse<?> response = null;
|
|
||||||
try {
|
|
||||||
String memberId = getMemberIdByAuthorization(request);
|
|
||||||
if (memberId == null) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
|
||||||
}
|
|
||||||
dto.setMemberId(memberId);
|
|
||||||
carVinInfoService.unbindCarVin(dto);
|
|
||||||
response = new RestApiResponse<>();
|
|
||||||
} catch (BusinessException e) {
|
|
||||||
logger.warn("用户解绑车辆vin信息 warn ", e);
|
|
||||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
||||||
}catch (Exception e) {
|
|
||||||
logger.warn("用户解绑车辆vin信息 error ", e);
|
|
||||||
response = new RestApiResponse<>(e);
|
|
||||||
}
|
|
||||||
logger.info("用户解绑车辆vin信息 result :{}", response);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,12 +13,13 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
|
||||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||||
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.*;
|
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||||
import com.jsowell.wxpay.dto.WechatSendMsgDTO;
|
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
|
||||||
|
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||||
|
import com.jsowell.pile.service.IPileAuthCardService;
|
||||||
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -45,9 +46,6 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IOrderBasicInfoService orderBasicInfoService;
|
private IOrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ICarVinInfoService carVinInfoService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMemberPlateNumberRelationService memberPlateNumberRelationService;
|
private IMemberPlateNumberRelationService memberPlateNumberRelationService;
|
||||||
|
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过memberId查询绑定的车辆vin列表
|
|
||||||
* @param memberId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVinInfoVO> getCarVinListByMemberId(String memberId);
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
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接口
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过memberId查询绑定的车辆vin列表
|
|
||||||
* @param memberId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVinInfoVO> getCarVinListByMemberId(String memberId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户绑定车辆vin
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int bindAuthCard(CarVinDTO dto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户解绑车辆vin信息
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
int unbindCarVin(CarVinDTO dto);
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
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.domain.PileAuthCard;
|
|
||||||
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;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMemberBasicInfoService memberBasicInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过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);
|
|
||||||
}
|
|
||||||
carVinInfo = new CarVinInfo();
|
|
||||||
// 绑定操作
|
|
||||||
carVinInfo.setVinCode(dto.getVinCode());
|
|
||||||
carVinInfo.setStatus("1");
|
|
||||||
carVinInfo.setMemberId(dto.getMemberId());
|
|
||||||
carVinInfo.setCreateBy(dto.getMemberId());
|
|
||||||
|
|
||||||
return carVinInfoMapper.insertCarVinInfo(carVinInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户解绑车辆vin信息
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int unbindCarVin(CarVinDTO dto) {
|
|
||||||
// 根据传过来的vin号查询数据库
|
|
||||||
CarVinInfo carVinInfo = selectVinInfoByVin(dto.getVinCode());
|
|
||||||
if (carVinInfo == null) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
|
||||||
}
|
|
||||||
// 如果memberId对应的上,则进行解绑操作 (将数据库中 del_flag 改为 1)
|
|
||||||
if (!StringUtils.equals(carVinInfo.getMemberId(), dto.getMemberId())) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
|
||||||
}
|
|
||||||
carVinInfo.setDelFlag("1");
|
|
||||||
return updateCarVinInfo(carVinInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<select id="getCarVinListByMemberId" 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.member_id = #{memberId,jdbcType=VARCHAR}
|
|
||||||
and del_flag = '0'
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user