diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/CarVinController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/CarVinController.java deleted file mode 100644 index 1cc30b1d1..000000000 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/CarVinController.java +++ /dev/null @@ -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 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; - } -} diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java index e2c6ed729..c39d81348 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java @@ -13,12 +13,13 @@ import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.YKCUtils; import com.jsowell.netty.factory.YKCOperateFactory; -import com.jsowell.pile.domain.MemberBasicInfo; import com.jsowell.pile.domain.MemberPlateNumberRelation; import com.jsowell.pile.domain.PileAuthCard; import com.jsowell.pile.dto.GenerateOrderDTO; -import com.jsowell.pile.service.*; -import com.jsowell.wxpay.dto.WechatSendMsgDTO; +import com.jsowell.pile.service.IMemberBasicInfoService; +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 io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; @@ -45,9 +46,6 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{ @Autowired private IOrderBasicInfoService orderBasicInfoService; - @Autowired - private ICarVinInfoService carVinInfoService; - @Autowired private IMemberPlateNumberRelationService memberPlateNumberRelationService; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/CarVinInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/CarVinInfo.java deleted file mode 100644 index b2de19e25..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/CarVinInfo.java +++ /dev/null @@ -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(); - } -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/CarVinDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/CarVinDTO.java deleted file mode 100644 index aa16ecb92..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/CarVinDTO.java +++ /dev/null @@ -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; -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/CarVinInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/CarVinInfoMapper.java deleted file mode 100644 index 4ea336aaa..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/CarVinInfoMapper.java +++ /dev/null @@ -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 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 getCarVinListByMemberId(String memberId); -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/ICarVinInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/ICarVinInfoService.java deleted file mode 100644 index d7f96d007..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/ICarVinInfoService.java +++ /dev/null @@ -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 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 getCarVinListByMemberId(String memberId); - - /** - * 用户绑定车辆vin - * @param dto - * @return - */ - int bindAuthCard(CarVinDTO dto); - - /** - * 用户解绑车辆vin信息 - * @param dto - */ - int unbindCarVin(CarVinDTO dto); -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/CarVinInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/CarVinInfoServiceImpl.java deleted file mode 100644 index 7326b101e..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/CarVinInfoServiceImpl.java +++ /dev/null @@ -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 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 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); - } - - -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/CarVinInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/CarVinInfoVO.java deleted file mode 100644 index 786d6acf3..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/CarVinInfoVO.java +++ /dev/null @@ -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; -} diff --git a/jsowell-pile/src/main/resources/mapper/pile/CarVinInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/CarVinInfoMapper.xml deleted file mode 100644 index 08d06c526..000000000 --- a/jsowell-pile/src/main/resources/mapper/pile/CarVinInfoMapper.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - select id, vin_code, status, member_id, create_by, create_time, update_by, update_time, del_flag from car_vin_info - - - - id, vin_code, status, member_id, create_by, create_time, update_by, update_time, del_flag - - - - - - - - insert into car_vin_info - - vin_code, - status, - member_id, - create_by, - create_time, - update_by, - update_time, - del_flag, - - - #{vinCode}, - #{status}, - #{memberId}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{delFlag}, - - - - - update car_vin_info - - vin_code = #{vinCode}, - status = #{status}, - member_id = #{memberId}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - del_flag = #{delFlag}, - - where id = #{id} - - - - delete from car_vin_info where id = #{id} - - - - delete from car_vin_info where id in - - #{id} - - - - - - - - - \ No newline at end of file