/** | /** | ||||
* ETC客户信息 | * ETC客户信息 | ||||
* @author : qiubh | * @author : qiubh | ||||
* @date : 2025-04-18 | |||||
* @date : 2025-04-18f | |||||
* @desc : 在原有基础上,将所有时间字段由字符型改成时间类型 | * @desc : 在原有基础上,将所有时间字段由字符型改成时间类型 | ||||
* userType、customerIdType、agentIdType使用枚举 | * userType、customerIdType、agentIdType使用枚举 | ||||
* 注掉部分业务中用不到的字段(表里还留着) | * 注掉部分业务中用不到的字段(表里还留着) |
package cn.com.taiji.core.entity.comm; | |||||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||||
import javax.persistence.Column; | |||||
import javax.persistence.Entity; | |||||
import javax.persistence.Table; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/15 10:23 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@Entity | |||||
@Table(name = "IAW_VEHICLE_BIND") | |||||
public class IawVehicleBind extends AbstractStringPropertyUUIDEntity { | |||||
/** 车牌号+颜色 */ | |||||
private String vehicleId; | |||||
/** 车牌号 */ | |||||
private String vehiclePlate; | |||||
/** 车牌颜色 */ | |||||
private String vehiclePlateColor; | |||||
/** etc卡号 */ | |||||
private String cardId; | |||||
/** 卡类型1-记账卡 2-储值卡 3-预存卡 */ | |||||
private Integer cardType; | |||||
/** 用户账号openId,关联USER_ACCOUNT_INFO表 */ | |||||
private String openId; | |||||
/** 绑定状态,默认1-绑定 2-解除 */ | |||||
private Integer bindStatus; | |||||
/** 绑定时间 */ | |||||
private LocalDateTime bindTime; | |||||
/** 解绑时间 */ | |||||
private LocalDateTime UnbindTime; | |||||
/** 发行成功后的自动绑定,默认是,1-是 0-否 */ | |||||
private Boolean autoBind; | |||||
/** 实际操作人openId,他人激活或者业务员激活时此字段和account_id不一致 */ | |||||
private String operaterId; | |||||
@Column(name = "VEHICLE_ID") | |||||
public String getVehicleId() { | |||||
return vehicleId; | |||||
} | |||||
public void setVehicleId(String vehicleId) { | |||||
this.vehicleId = vehicleId; | |||||
} | |||||
@Column(name = "VEHICLE_PLATE") | |||||
public String getVehiclePlate() { | |||||
return vehiclePlate; | |||||
} | |||||
public void setVehiclePlate(String vehiclePlate) { | |||||
this.vehiclePlate = vehiclePlate; | |||||
} | |||||
@Column(name = "VEHICLE_PLATE_COLOR") | |||||
public String getVehiclePlateColor() { | |||||
return vehiclePlateColor; | |||||
} | |||||
public void setVehiclePlateColor(String vehiclePlateColor) { | |||||
this.vehiclePlateColor = vehiclePlateColor; | |||||
} | |||||
@Column(name = "CARD_ID") | |||||
public String getCardId() { | |||||
return cardId; | |||||
} | |||||
public void setCardId(String cardId) { | |||||
this.cardId = cardId; | |||||
} | |||||
@Column(name = "CARD_TYPE") | |||||
public Integer getCardType() { | |||||
return cardType; | |||||
} | |||||
public void setCardType(Integer cardType) { | |||||
this.cardType = cardType; | |||||
} | |||||
@Column(name = "OPEN_ID") | |||||
public String getOpenId() { | |||||
return openId; | |||||
} | |||||
public void setOpenId(String openId) { | |||||
this.openId = openId; | |||||
} | |||||
@Column(name = "BIND_STATUS") | |||||
public Integer getBindStatus() { | |||||
return bindStatus; | |||||
} | |||||
public void setBindStatus(Integer bindStatus) { | |||||
this.bindStatus = bindStatus; | |||||
} | |||||
@Column(name = "BIND_TIME") | |||||
public LocalDateTime getBindTime() { | |||||
return bindTime; | |||||
} | |||||
public void setBindTime(LocalDateTime bindTime) { | |||||
this.bindTime = bindTime; | |||||
} | |||||
@Column(name = "UNBIND_TIME") | |||||
public LocalDateTime getUnbindTime() { | |||||
return UnbindTime; | |||||
} | |||||
public void setUnbindTime(LocalDateTime unbindTime) { | |||||
UnbindTime = unbindTime; | |||||
} | |||||
@Column(name = "AUTO_BIND") | |||||
public Boolean getAutoBind() { | |||||
return autoBind; | |||||
} | |||||
public void setAutoBind(Boolean autoBind) { | |||||
this.autoBind = autoBind; | |||||
} | |||||
@Column(name = "OPERATER_ID") | |||||
public String getOperaterId() { | |||||
return operaterId; | |||||
} | |||||
public void setOperaterId(String operaterId) { | |||||
this.operaterId = operaterId; | |||||
} | |||||
} |
package cn.com.taiji.core.entity.user; | |||||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||||
import cn.com.taiji.core.entity.dict.basic.IdType; | |||||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||||
import javax.persistence.*; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* 用户账号 | |||||
* | |||||
* @Classname | |||||
* @Date 2023/02/21 | |||||
* @Created by zhuwentian | |||||
* @Version | |||||
* @Description | |||||
*/ | |||||
@Entity | |||||
@Table(name = "USER_ACCOUNT_INFO") | |||||
public class AccountInfo extends AbstractStringPropertyUUIDEntity { | |||||
/** | |||||
* 账号 | |||||
*/ | |||||
private String account; | |||||
/** | |||||
* 登录密码 | |||||
*/ | |||||
private String loginPass; | |||||
/** | |||||
* 手机号 | |||||
*/ | |||||
private String mobile; | |||||
/** | |||||
* 应用id | |||||
*/ | |||||
private String appId; | |||||
/** | |||||
* openId | |||||
*/ | |||||
private String openId; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private LocalDateTime createTime; | |||||
/** | |||||
* 更新时间时间 | |||||
*/ | |||||
private LocalDateTime updateTime; | |||||
/** | |||||
* 用户-证件号码 | |||||
*/ | |||||
private String idNum; | |||||
/** | |||||
* 用户-证件类型 | |||||
*/ | |||||
private IdType idType; | |||||
/** | |||||
* 会员类型: | |||||
* 1、个人会员 | |||||
* 2、企业会员 | |||||
*/ | |||||
private UserType userType; | |||||
/** | |||||
* 登录方来源 | |||||
*/ | |||||
private SourceType loginSource; | |||||
/** | |||||
* 用户姓名/企业名称 | |||||
*/ | |||||
private String userName; | |||||
/** | |||||
* 性别 | |||||
*/ | |||||
private Gender gender; | |||||
/** | |||||
* 昵称 | |||||
*/ | |||||
private String nickName; | |||||
/*** | |||||
* 用户注册在极光推送上的id | |||||
*/ | |||||
private String registrationId; | |||||
/*** | |||||
* 用户在微信小程序的唯一身份标识openid | |||||
*/ | |||||
private String wxOpenid; | |||||
/*** | |||||
* 用户在微信公众号的唯一身份标识openid | |||||
*/ | |||||
private String mpOpenid; | |||||
/*** | |||||
* 用户在同一微信开发方平台的唯一身份标识unionId | |||||
*/ | |||||
private String wxUnionid; | |||||
/*** | |||||
* 判断该用户是否需要立刻修改密码 | |||||
* 0-不需要 | |||||
* 1-需要 | |||||
*/ | |||||
private String needChangePasswordNow; | |||||
/** | |||||
* 支付宝openid | |||||
*/ | |||||
@Column(name = "ZFB_OPEN_ID") | |||||
private String zfbOpenId; | |||||
/** | |||||
* 支付宝userid | |||||
*/ | |||||
@Column(name = "ZFB_USER_ID") | |||||
private String zfbUserId; | |||||
public String getZfbUserId() { | |||||
return zfbUserId; | |||||
} | |||||
public void setZfbUserId(String zfbUserId) { | |||||
this.zfbUserId = zfbUserId; | |||||
} | |||||
public String getZfbOpenId() { | |||||
return zfbOpenId; | |||||
} | |||||
public void setZfbOpenId(String zfbOpenId) { | |||||
this.zfbOpenId = zfbOpenId; | |||||
} | |||||
@Column(name = "ACCOUNT") | |||||
public String getAccount() { | |||||
return account; | |||||
} | |||||
@Column(name = "MOBILE") | |||||
public String getMobile() { | |||||
return mobile; | |||||
} | |||||
@Column(name = "LOGIN_PASS") | |||||
public String getLoginPass() { | |||||
return loginPass; | |||||
} | |||||
@Column(name = "APP_ID") | |||||
public String getAppId() { | |||||
return appId; | |||||
} | |||||
@Column(name = "OPEN_ID") | |||||
public String getOpenId() { | |||||
return openId; | |||||
} | |||||
@Column(name = "CREATE_TIME") | |||||
public LocalDateTime getCreateTime() { | |||||
return createTime; | |||||
} | |||||
@Column(name = "UPDATE_TIME") | |||||
public LocalDateTime getUpdateTime() { | |||||
return updateTime; | |||||
} | |||||
@Column(name = "ID_NUM") | |||||
public String getIdNum() { | |||||
return idNum; | |||||
} | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "ID_TYPE") | |||||
public IdType getIdType() { | |||||
return idType; | |||||
} | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "USER_TYPE") | |||||
public UserType getUserType() { | |||||
return userType; | |||||
} | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "LOGIN_SOURCE") | |||||
public SourceType getLoginSource() { | |||||
return loginSource; | |||||
} | |||||
@Column(name = "USER_NAME") | |||||
public String getUserName() { | |||||
return userName; | |||||
} | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "GENDER") | |||||
public Gender getGender() { | |||||
return gender; | |||||
} | |||||
@Column(name = "NICK_NAME") | |||||
public String getNickName() { | |||||
return nickName; | |||||
} | |||||
@Column(name = "REGISTRATION_ID") | |||||
public String getRegistrationId() { | |||||
return registrationId; | |||||
} | |||||
@Column(name = "NEED_CHANGE_PASSWORD_NOW") | |||||
public String getNeedChangePasswordNow() { | |||||
return needChangePasswordNow; | |||||
} | |||||
@Column(name = "WX_OPENID") | |||||
public String getWxOpenid() { | |||||
return wxOpenid; | |||||
} | |||||
@Column(name = "MP_OPENID") | |||||
public String getMpOpenid() { | |||||
return mpOpenid; | |||||
} | |||||
@Column(name = "WX_UNIONID") | |||||
public String getWxUnionid() { | |||||
return wxUnionid; | |||||
} | |||||
public void setAccount(String account) { | |||||
this.account = account; | |||||
} | |||||
public void setMobile(String mobile) { | |||||
this.mobile = mobile; | |||||
} | |||||
public void setLoginPass(String loginPass) { | |||||
this.loginPass = loginPass; | |||||
} | |||||
public void setAppId(String appId) { | |||||
this.appId = appId; | |||||
} | |||||
public void setOpenId(String openId) { | |||||
this.openId = openId; | |||||
} | |||||
public void setCreateTime(LocalDateTime createTime) { | |||||
this.createTime = createTime; | |||||
} | |||||
public void setUpdateTime(LocalDateTime updateTime) { | |||||
this.updateTime = updateTime; | |||||
} | |||||
public void setIdNum(String idNum) { | |||||
this.idNum = idNum; | |||||
} | |||||
public void setIdType(IdType idType) { | |||||
this.idType = idType; | |||||
} | |||||
public void setUserType(UserType userType) { | |||||
this.userType = userType; | |||||
} | |||||
public void setLoginSource(SourceType loginSource) { | |||||
this.loginSource = loginSource; | |||||
} | |||||
public void setUserName(String userName) { | |||||
this.userName = userName; | |||||
} | |||||
public void setGender(Gender gender) { | |||||
this.gender = gender; | |||||
} | |||||
public void setNickName(String nickName) { | |||||
this.nickName = nickName; | |||||
} | |||||
public void setRegistrationId(String registrationId) { | |||||
this.registrationId = registrationId; | |||||
} | |||||
public void setWxOpenid(String wxOpenid) { | |||||
this.wxOpenid = wxOpenid; | |||||
} | |||||
public void setMpOpenid(String mpOpenid) { | |||||
this.mpOpenid = mpOpenid; | |||||
} | |||||
public void setWxUnionid(String wxUnionid) { | |||||
this.wxUnionid = wxUnionid; | |||||
} | |||||
public void setNeedChangePasswordNow(String needChangePasswordNow) { | |||||
this.needChangePasswordNow = needChangePasswordNow; | |||||
} | |||||
public AccountInfo() { | |||||
} | |||||
public AccountInfo(String openId) { | |||||
this.openId = openId; | |||||
} | |||||
public AccountInfo(String account, String openId, String userName, String mobile, String wxOpenid, String registrationId, String mpOpenid) { | |||||
this.account = account; | |||||
this.openId = openId; | |||||
this.userName = userName; | |||||
this.mobile = mobile; | |||||
this.wxOpenid = wxOpenid; | |||||
this.registrationId = registrationId; | |||||
this.mpOpenid = mpOpenid; | |||||
} | |||||
} |
@Query("from QtkCardInfo where cardId in ?1") | @Query("from QtkCardInfo where cardId in ?1") | ||||
public List<QtkCardInfo> findByCardIds(List<String> cardIds); | public List<QtkCardInfo> findByCardIds(List<String> cardIds); | ||||
@Query("from QtkCardInfo as c where c.customerId =?1 ") | |||||
List<QtkCardInfo> listByCustomerInfo(String var1); | |||||
@Query("from QtkCardInfo as c where c.customerId =?1 and c.vehicleId = ?2 order by c.insertTime desc") | |||||
List<QtkCardInfo> listByCustomerIdAndVehicleId(String customerId, String vehicleId); | |||||
} | } |
@Query("from QtkCustomerInfo where customerId=?1") | @Query("from QtkCustomerInfo where customerId=?1") | ||||
QtkCustomerInfo findByCustomerId(String customerId); | QtkCustomerInfo findByCustomerId(String customerId); | ||||
@Query(" from QtkCustomerInfo where customerIdtype = ?1 and customerIdnum = ?2") | |||||
@Query(" from QtkCustomerInfo where customerIdType = ?1 and customerIdNum = ?2") | |||||
QtkCustomerInfo findByCustomerIdTypeAndCustomerIdNum(IdType customerIdType, String customerIdNum); | QtkCustomerInfo findByCustomerIdTypeAndCustomerIdNum(IdType customerIdType, String customerIdNum); | ||||
@Query("from QtkCustomerInfo where customerIdNum = ?1 and customerIdType = ?2 and userType = ?3") | |||||
QtkCustomerInfo findByCustomerIdNumAndCustomerIdTypeAndUserType(String customerIdNum, Integer customerIdType, Integer userType); | |||||
} | } |
package cn.com.taiji.core.repo.jpa.comm; | |||||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||||
import cn.com.taiji.core.entity.comm.IawVehicleBind; | |||||
import org.springframework.data.jpa.repository.Query; | |||||
import java.util.List; | |||||
public interface IawVehicleBindRepo extends AbstractJpaRepo<IawVehicleBind,String> { | |||||
@Query(" from IawVehicleBind where openId = ?1 order by bindTime desc") | |||||
List<IawVehicleBind> queryVehicleBind(String openId); | |||||
} |
package cn.com.taiji.core.repo.jpa.user; | |||||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||||
import cn.com.taiji.core.entity.user.AccountInfo; | |||||
import org.springframework.data.jpa.repository.Query; | |||||
import java.util.List; | |||||
public interface AccountInfoRepo extends AbstractJpaRepo<AccountInfo, String> { | |||||
@Query("FROM AccountInfo WHERE openId=?1") | |||||
AccountInfo findByOpenId(String openId); | |||||
AccountInfo findByIdNumAndUserType(String idNum, UserType userType); | |||||
} |
package cn.com.taiji.iaw.api.comm; | |||||
import cn.com.taiji.common.manager.ManagerException; | |||||
import cn.com.taiji.common.model.dao.Pagination; | |||||
import cn.com.taiji.common.web.ApiResponse; | |||||
import cn.com.taiji.iaw.api.MyValidController; | |||||
import cn.com.taiji.iaw.dto.comm.*; | |||||
import cn.com.taiji.iaw.manager.comm.IawVehicleBindManager; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.PostMapping; | |||||
import org.springframework.web.bind.annotation.RequestBody; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import javax.validation.Valid; | |||||
import java.util.List; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/15 11:04 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@Api(tags = {"车辆绑定与解绑"}) | |||||
@RestController | |||||
@RequestMapping("/api/vehicle") | |||||
public class IawVehicleBindController extends MyValidController { | |||||
@Autowired | |||||
private IawVehicleBindManager manager; | |||||
@ApiOperation("车辆绑定列表查询") | |||||
@PostMapping("/page") | |||||
public ApiResponse<Pagination> page(@Valid @RequestBody VehicleBindPageRequestDTO dto) throws ManagerException { | |||||
return ApiResponse.of(manager.page(dto)); | |||||
} | |||||
@ApiOperation(value = "车辆绑定") | |||||
@PostMapping(value = "/bind") | |||||
public ApiResponse<VehicleBindResponseDTO> bind(@Valid @RequestBody VehicleBindRequestDTO dto) throws ManagerException { | |||||
VehicleBindResponseDTO resDto = manager.bind(dto); | |||||
return ApiResponse.of(resDto).setMessage("绑定成功"); | |||||
} | |||||
@ApiOperation(value = "车辆解绑") | |||||
@PostMapping(value = "/unBind") | |||||
public ApiResponse<VehicleUnBindResponseDTO> unBind(@Valid @RequestBody VehicleUnBindRequestDTO dto) throws ManagerException { | |||||
VehicleUnBindResponseDTO resDto = manager.unBind(dto); | |||||
return ApiResponse.of(resDto).setMessage("解绑成功"); | |||||
} | |||||
@ApiOperation("etc卡信息查询") | |||||
@PostMapping("/queryCardInfo") | |||||
public ApiResponse<List<CardInfoQueryResponseDTO>> queryCardInfo(@Valid @RequestBody CardInfoQueryRequestDTO dto) throws ManagerException { | |||||
return ApiResponse.of(manager.queryCardInfo(dto)); | |||||
} | |||||
} |
//package cn.com.taiji.iaw.api.comm; | |||||
// | |||||
//import cn.com.taiji.common.manager.ManagerException; | |||||
//import cn.com.taiji.common.model.dao.Pagination; | |||||
//import cn.com.taiji.common.web.ApiResponse; | |||||
//import cn.com.taiji.iaw.api.MyValidController; | |||||
//import cn.com.taiji.iaw.dto.*; | |||||
//import cn.com.taiji.iaw.manager.comm.QtkVehicleBindManager; | |||||
//import io.swagger.annotations.Api; | |||||
//import io.swagger.annotations.ApiOperation; | |||||
//import org.springframework.beans.factory.annotation.Autowired; | |||||
//import org.springframework.web.bind.annotation.PostMapping; | |||||
//import org.springframework.web.bind.annotation.RequestBody; | |||||
//import org.springframework.web.bind.annotation.RequestMapping; | |||||
//import org.springframework.web.bind.annotation.RestController; | |||||
// | |||||
//import javax.validation.Valid; | |||||
// | |||||
///** | |||||
// * @Auther: humh | |||||
// * @Description: | |||||
// * @Date: 2025/4/15 11:04 | |||||
// * @email: huminghao@mail.taiji.com.cn | |||||
// * @version: 1.0 | |||||
// */ | |||||
//@Api(tags = {"车辆绑定与解绑"}) | |||||
//@RestController | |||||
//@RequestMapping("/api/vehicle") | |||||
//public class QtkVehicleBindController extends MyValidController { | |||||
// | |||||
// @Autowired | |||||
// private QtkVehicleBindManager manager; | |||||
// | |||||
// @ApiOperation("车辆绑定列表查询") | |||||
// @PostMapping("/page") | |||||
// public ApiResponse<Pagination> page(@Valid @RequestBody VehicleBindPageRequestDTO dto) throws ManagerException { | |||||
// return ApiResponse.of(manager.page(dto)); | |||||
// } | |||||
// | |||||
// @ApiOperation(value = "车辆绑定") | |||||
// @PostMapping(value = "/bind") | |||||
// public ApiResponse<VehicleBindResponseDTO> bind(@Valid @RequestBody VehicleBindRequestDTO dto) throws ManagerException { | |||||
// VehicleBindResponseDTO resDto = manager.bind(dto); | |||||
// return ApiResponse.of(resDto).setMessage("绑定成功"); | |||||
// } | |||||
// | |||||
// | |||||
// @ApiOperation(value = "车辆解绑") | |||||
// @PostMapping(value = "/unBind") | |||||
// public ApiResponse<VehicleUnBindResponseDTO> unBind(@Valid @RequestBody VehicleUnBindRequestDTO dto) throws ManagerException { | |||||
// VehicleUnBindResponseDTO resDto = manager.unBind(dto); | |||||
// return ApiResponse.of(resDto).setMessage("解绑成功"); | |||||
// } | |||||
// | |||||
// | |||||
//// @ApiOperation("etc卡信息查询") | |||||
//// @PostMapping("/queryCardInfo") | |||||
//// public ApiResponse<List<CardInfoQueryResponseDTO>> queryCardInfo(@Valid @RequestBody CardInfoQueryRequestDTO dto) throws ManagerException { | |||||
//// return ApiResponse.of(manager.queryCardInfo(dto)); | |||||
//// } | |||||
// | |||||
// | |||||
//} |
package cn.com.taiji.iaw.dto.comm; | |||||
import cn.com.taiji.iaw.dto.AbstractBizRequestDTO; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Getter; | |||||
import lombok.Setter; | |||||
import lombok.experimental.Accessors; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/23 15:14 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@ApiModel(description = "卡信息查询请求") | |||||
@Getter | |||||
@Setter | |||||
@Accessors(chain = true) | |||||
public class CardInfoQueryRequestDTO extends AbstractBizRequestDTO { | |||||
@ApiModelProperty(value = "车牌号") | |||||
@NotBlank | |||||
private String vehiclePlate; | |||||
@ApiModelProperty(value = "车牌颜色") | |||||
@NotNull | |||||
private Integer vehiclePlateColor; | |||||
} |
package cn.com.taiji.iaw.dto.comm; | |||||
import cn.com.taiji.common.model.BaseModel; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Getter; | |||||
import lombok.Setter; | |||||
import lombok.experimental.Accessors; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/15 11:11 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@ApiModel(description = "卡信息查询响应") | |||||
@Getter | |||||
@Setter | |||||
@Accessors(chain = true) | |||||
public class CardInfoQueryResponseDTO extends BaseModel { | |||||
/** etc卡号 */ | |||||
private String cardId; | |||||
/** 卡类型1-记账卡 2-储值卡 3-预存卡 */ | |||||
private Integer cardType; | |||||
} |
package cn.com.taiji.iaw.manager.comm; | |||||
import cn.com.taiji.common.manager.ManagerException; | |||||
import cn.com.taiji.common.model.dao.Pagination; | |||||
import cn.com.taiji.iaw.dto.comm.*; | |||||
import java.util.List; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/15 11:25 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
public interface IawVehicleBindManager { | |||||
VehicleBindResponseDTO bind(VehicleBindRequestDTO dto) throws ManagerException; | |||||
VehicleUnBindResponseDTO unBind(VehicleUnBindRequestDTO dto) throws ManagerException; | |||||
Pagination page(VehicleBindPageRequestDTO dto); | |||||
List<CardInfoQueryResponseDTO> queryCardInfo(CardInfoQueryRequestDTO dto) throws ManagerException; | |||||
} |
package cn.com.taiji.iaw.manager.comm; | |||||
import cn.com.taiji.common.manager.ManagerException; | |||||
import cn.com.taiji.common.model.dao.Pagination; | |||||
import cn.com.taiji.common.pub.BeanTools; | |||||
import cn.com.taiji.common.pub.CollectionTools; | |||||
import cn.com.taiji.core.entity.basic.QtkCardInfo; | |||||
import cn.com.taiji.core.entity.comm.IawVehicleBind; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; | |||||
import cn.com.taiji.core.repo.jpa.comm.IawVehicleBindRepo; | |||||
import cn.com.taiji.iaw.dto.comm.*; | |||||
import cn.com.taiji.iaw.repo.jpa.request.comm.VehicleBindPageRequest; | |||||
import cn.com.taiji.iaw.tools.WxLoginUserUtil; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.time.LocalDateTime; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/15 11:25 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@Service | |||||
public class IawVehicleBindManagerImpl implements IawVehicleBindManager { | |||||
@Autowired | |||||
private IawVehicleBindRepo repo; | |||||
@Autowired | |||||
private WxLoginUserUtil wxLoginUserUtil; | |||||
@Autowired | |||||
private QtkCardInfoRepo cardInfoRepo; | |||||
@Override | |||||
public VehicleBindResponseDTO bind(VehicleBindRequestDTO dto) throws ManagerException { | |||||
VehicleBindResponseDTO resDto = new VehicleBindResponseDTO(); | |||||
if (!StringUtils.isEmpty(dto.getOpenId())){ | |||||
String customerId = wxLoginUserUtil.getCustomerIdFromOpenId(dto.getOpenId()); | |||||
if (StringUtils.isEmpty(customerId)){ | |||||
throw new ManagerException("车辆不是操作人名下的卡签关联车辆,无法绑定!"); | |||||
} | |||||
List<QtkCardInfo> cardInfos = cardInfoRepo.listByCustomerInfo(customerId); | |||||
if (CollectionTools.isEmpty(cardInfos)){ | |||||
throw new ManagerException("车辆不是操作人名下的卡签关联车辆,无法绑定!"); | |||||
} | |||||
if (!cardInfos.stream().map(QtkCardInfo::getCardId).collect(Collectors.toList()).contains(dto.getCardId())){ | |||||
throw new ManagerException("该车辆的ETC卡号校验失败,无法绑定!"); | |||||
} | |||||
IawVehicleBind vehicleBind = new IawVehicleBind(); | |||||
BeanTools.copyProperties(dto, vehicleBind,"id"); | |||||
vehicleBind.setVehicleId(dto.getVehiclePlate() + "_" + dto.getVehiclePlateColor()); | |||||
vehicleBind.setBindStatus(1);//默认1,1-绑定 2-解除 | |||||
vehicleBind.setBindTime(LocalDateTime.now()); | |||||
vehicleBind.setAutoBind(false); | |||||
repo.save(vehicleBind); | |||||
resDto.setId(vehicleBind.getId()); | |||||
} | |||||
return resDto; | |||||
} | |||||
@Override | |||||
public VehicleUnBindResponseDTO unBind(VehicleUnBindRequestDTO dto) throws ManagerException { | |||||
IawVehicleBind vehicleBind = repo.findById(dto.getId()).orElse(null); | |||||
if (vehicleBind == null){ | |||||
throw new ManagerException("未查询到车辆信息,请刷新重试!"); | |||||
} | |||||
vehicleBind.setBindStatus(2);//1-绑定 2-解除 | |||||
vehicleBind.setUnbindTime(LocalDateTime.now()); | |||||
repo.save(vehicleBind); | |||||
VehicleUnBindResponseDTO resDto = new VehicleUnBindResponseDTO(); | |||||
resDto.setId(dto.getId()); | |||||
return resDto; | |||||
} | |||||
@Override | |||||
public Pagination page(VehicleBindPageRequestDTO dto) { | |||||
VehicleBindPageRequest pageRequest = new VehicleBindPageRequest(); | |||||
BeanTools.copyProperties(dto, pageRequest); | |||||
// 判断入口路径,微信端只查自己的openId | |||||
return repo.page(pageRequest); | |||||
} | |||||
@Override | |||||
public List<CardInfoQueryResponseDTO> queryCardInfo(CardInfoQueryRequestDTO dto) throws ManagerException { | |||||
String customerId = wxLoginUserUtil.getCustomerIdFromOpenId(dto.getOpenId()); | |||||
if (StringUtils.isEmpty(customerId)){ | |||||
throw new ManagerException("未获取到用户信息!"); | |||||
} | |||||
List<QtkCardInfo> cardInfos = cardInfoRepo.listByCustomerIdAndVehicleId(customerId, dto.getVehiclePlate() + "_" + dto.getVehiclePlateColor()); | |||||
List<CardInfoQueryResponseDTO> list = new ArrayList<>(); | |||||
for (QtkCardInfo cardInfo : cardInfos) { | |||||
CardInfoQueryResponseDTO resDTo = new CardInfoQueryResponseDTO(); | |||||
resDTo.setCardId(cardInfo.getCardId()); | |||||
resDTo.setCardType(cardInfo.getCardType()); | |||||
list.add(resDTo); | |||||
} | |||||
return list; | |||||
} | |||||
} |
//package cn.com.taiji.iaw.manager.comm; | |||||
// | |||||
//import cn.com.taiji.common.manager.ManagerException; | |||||
//import cn.com.taiji.common.model.dao.Pagination; | |||||
//import cn.com.taiji.iaw.dto.*; | |||||
// | |||||
///** | |||||
// * @Auther: humh | |||||
// * @Description: | |||||
// * @Date: 2025/4/15 11:25 | |||||
// * @email: huminghao@mail.taiji.com.cn | |||||
// * @version: 1.0 | |||||
// */ | |||||
//public interface QtkVehicleBindManager { | |||||
// | |||||
// VehicleBindResponseDTO bind(VehicleBindRequestDTO dto) throws ManagerException; | |||||
// | |||||
// VehicleUnBindResponseDTO unBind(VehicleUnBindRequestDTO dto) throws ManagerException; | |||||
// | |||||
// Pagination page(VehicleBindPageRequestDTO dto); | |||||
// | |||||
// List<CardInfoQueryResponseDTO> queryCardInfo(CardInfoQueryRequestDTO dto) throws ManagerException; | |||||
//} |
//package cn.com.taiji.iaw.manager.comm; | |||||
// | |||||
//import cn.com.taiji.common.manager.ManagerException; | |||||
//import cn.com.taiji.common.model.dao.Pagination; | |||||
//import cn.com.taiji.common.pub.BeanTools; | |||||
//import cn.com.taiji.common.pub.CollectionTools; | |||||
//import cn.com.taiji.core.entity.basic.QtkCardInfo; | |||||
//import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; | |||||
//import cn.com.taiji.iaw.dto.*; | |||||
//import org.apache.commons.lang3.StringUtils; | |||||
//import org.springframework.beans.factory.annotation.Autowired; | |||||
//import org.springframework.stereotype.Service; | |||||
// | |||||
//import java.time.LocalDateTime; | |||||
//import java.util.ArrayList; | |||||
//import java.util.List; | |||||
//import java.util.stream.Collectors; | |||||
// | |||||
///** | |||||
// * @Auther: humh | |||||
// * @Description: | |||||
// * @Date: 2025/4/15 11:25 | |||||
// * @email: huminghao@mail.taiji.com.cn | |||||
// * @version: 1.0 | |||||
// */ | |||||
//@Service | |||||
//public class QtkVehicleBindManagerImpl implements QtkVehicleBindManager{ | |||||
// | |||||
// @Autowired | |||||
// private QtkVehicleBindRepo repo; | |||||
// @Autowired | |||||
// private WxLoginUserUtil wxLoginUserUtil; | |||||
// @Autowired | |||||
// private QtkCardInfoRepo cardInfoRepo; | |||||
// | |||||
// @Override | |||||
// public VehicleBindResponseDTO bind(VehicleBindRequestDTO dto) throws ManagerException { | |||||
// VehicleBindResponseDTO resDto = new VehicleBindResponseDTO(); | |||||
// if (!StringUtils.isEmpty(dto.getOpenId())){ | |||||
// String customerId = wxLoginUserUtil.getCustomerIdFromOpenId(dto.getOpenId()); | |||||
// if (StringUtils.isEmpty(customerId)){ | |||||
// throw new ManagerException("车辆不是操作人名下的卡签关联车辆,无法绑定!"); | |||||
// } | |||||
// List<QtkCardInfo> cardInfos = cardInfoRepo.listByCustomerInfo(customerId); | |||||
// if (CollectionTools.isEmpty(cardInfos)){ | |||||
// throw new ManagerException("车辆不是操作人名下的卡签关联车辆,无法绑定!"); | |||||
// } | |||||
// if (!cardInfos.stream().map(QtkCardInfo::getCardId).collect(Collectors.toList()).contains(dto.getCardId())){ | |||||
// throw new ManagerException("该车辆的ETC卡号校验失败,无法绑定!"); | |||||
// } | |||||
// QtkVehicleBind vehicleBind = new QtkVehicleBind(); | |||||
// BeanTools.copyProperties(dto, vehicleBind,"id"); | |||||
// vehicleBind.setVehicleId(dto.getVehiclePlate() + "_" + dto.getVehiclePlateColor()); | |||||
// vehicleBind.setBindStatus(1);//默认1,1-绑定 2-解除 | |||||
// vehicleBind.setBindTime(LocalDateTime.now()); | |||||
// vehicleBind.setAutoBind(false); | |||||
// repo.save(vehicleBind); | |||||
// resDto.setId(vehicleBind.getId()); | |||||
// } | |||||
// return resDto; | |||||
// } | |||||
// | |||||
// @Override | |||||
// public VehicleUnBindResponseDTO unBind(VehicleUnBindRequestDTO dto) throws ManagerException { | |||||
// QtkVehicleBind vehicleBind = repo.findById(dto.getId()).orElse(null); | |||||
// if (vehicleBind == null){ | |||||
// throw new ManagerException("未查询到车辆信息,请刷新重试!"); | |||||
// } | |||||
// vehicleBind.setBindStatus(2);//1-绑定 2-解除 | |||||
// vehicleBind.setUnbindTime(LocalDateTime.now()); | |||||
// repo.save(vehicleBind); | |||||
// VehicleUnBindResponseDTO resDto = new VehicleUnBindResponseDTO(); | |||||
// resDto.setId(dto.getId()); | |||||
// return resDto; | |||||
// } | |||||
// | |||||
// @Override | |||||
// public Pagination page(VehicleBindPageRequestDTO dto) { | |||||
// VehicleBindPageRequest pageRequest = new VehicleBindPageRequest(); | |||||
// BeanTools.copyProperties(dto, pageRequest); | |||||
// // 判断入口路径,微信端只查自己的openId | |||||
// return repo.page(pageRequest); | |||||
// } | |||||
// | |||||
// @Override | |||||
// public List<CardInfoQueryResponseDTO> queryCardInfo(CardInfoQueryRequestDTO dto) throws ManagerException { | |||||
// String customerId = wxLoginUserUtil.getCustomerIdFromOpenId(dto.getOpenId()); | |||||
// if (StringUtils.isEmpty(customerId)){ | |||||
// throw new ManagerException("未获取到用户信息!"); | |||||
// } | |||||
// List<QtkCardInfo> cardInfos = cardInfoRepo.listByCustomerIdAndVehicleId(customerId, dto.getVehiclePlate() + "_" + dto.getVehiclePlateColor()); | |||||
// List<CardInfoQueryResponseDTO> list = new ArrayList<>(); | |||||
// for (QtkCardInfo cardInfo : cardInfos) { | |||||
// CardInfoQueryResponseDTO resDTo = new CardInfoQueryResponseDTO(); | |||||
// resDTo.setCardId(cardInfo.getCardId()); | |||||
// resDTo.setCardType(cardInfo.getCardType()); | |||||
// resDTo.setCardStatus(cardInfo.getCardStatus()); | |||||
// list.add(resDTo); | |||||
// } | |||||
// return list; | |||||
// } | |||||
// | |||||
// | |||||
//} |
//package cn.com.taiji.iaw.repo.jpa.request.comm; | |||||
// | |||||
//import cn.com.taiji.common.pub.dao.HqlBuilder; | |||||
//import io.swagger.annotations.ApiModel; | |||||
//import lombok.Getter; | |||||
//import lombok.Setter; | |||||
//import lombok.experimental.Accessors; | |||||
// | |||||
///** | |||||
// * @Auther: humh | |||||
// * @Description: | |||||
// * @Date: 2025/4/16 20:39 | |||||
// * @email: huminghao@mail.taiji.com.cn | |||||
// * @version: 1.0 | |||||
// */ | |||||
//@ApiModel(description = "车辆绑定与解绑分页查询") | |||||
//@Getter | |||||
//@Setter | |||||
//@Accessors(chain = true) | |||||
//public class VehicleBindPageRequest extends JpaPageableDataRequest<QtkVehicleBind> { | |||||
// | |||||
// /** 绑定状态 */ | |||||
// private Integer bindStatus = 1; | |||||
// /** openId */ | |||||
// private String openId; | |||||
// /** 车牌号 */ | |||||
// private String vehiclePlate; | |||||
// /** 车牌号 */ | |||||
// private Integer vehiclePlateColor; | |||||
// | |||||
// @Override | |||||
// public HqlBuilder toSelectHql() { | |||||
// HqlBuilder hql = new HqlBuilder("from " + QtkVehicleBind.class.getName() + " where 1=1 "); | |||||
// hql.append(" and bindStatus = :bindStatus ", bindStatus); | |||||
// hql.append(" and openId = :openId ", openId); | |||||
// hql.append(" and vehiclePlate = :vehiclePlate ", vehiclePlate); | |||||
// hql.append(" and vehiclePlateColor = :vehiclePlateColor ", vehiclePlateColor); | |||||
// hql.append(" order by bindTime desc "); | |||||
// return hql; | |||||
// } | |||||
//} | |||||
package cn.com.taiji.iaw.repo.jpa.request.comm; | |||||
import cn.com.taiji.common.pub.dao.HqlBuilder; | |||||
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest; | |||||
import cn.com.taiji.core.entity.comm.IawVehicleBind; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Getter; | |||||
import lombok.Setter; | |||||
import lombok.experimental.Accessors; | |||||
/** | |||||
* @Auther: humh | |||||
* @Description: | |||||
* @Date: 2025/4/16 20:39 | |||||
* @email: huminghao@mail.taiji.com.cn | |||||
* @version: 1.0 | |||||
*/ | |||||
@ApiModel(description = "车辆绑定与解绑分页查询") | |||||
@Getter | |||||
@Setter | |||||
@Accessors(chain = true) | |||||
public class VehicleBindPageRequest extends JpaPageableDataRequest<IawVehicleBind> { | |||||
/** 绑定状态 */ | |||||
private Integer bindStatus = 1; | |||||
/** openId */ | |||||
private String openId; | |||||
/** 车牌号 */ | |||||
private String vehiclePlate; | |||||
/** 车牌号 */ | |||||
private Integer vehiclePlateColor; | |||||
@Override | |||||
public HqlBuilder toSelectHql() { | |||||
HqlBuilder hql = new HqlBuilder("from " + IawVehicleBind.class.getName() + " where 1=1 "); | |||||
hql.append(" and bindStatus = :bindStatus ", bindStatus); | |||||
hql.append(" and openId = :openId ", openId); | |||||
hql.append(" and vehiclePlate = :vehiclePlate ", vehiclePlate); | |||||
hql.append(" and vehiclePlateColor = :vehiclePlateColor ", vehiclePlateColor); | |||||
hql.append(" order by bindTime desc "); | |||||
return hql; | |||||
} | |||||
} |
package cn.com.taiji.iaw.tools; | |||||
import cn.com.taiji.common.manager.AbstractManager; | |||||
import cn.com.taiji.common.manager.ManagerException; | |||||
import cn.com.taiji.core.entity.basic.QtkCustomerInfo; | |||||
import cn.com.taiji.core.entity.dict.basic.UserType; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkCustomerInfoRepo; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.stereotype.Component; | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class WxLoginUserUtil extends AbstractManager { | |||||
private final AccountInfoRepo accountInfoRepo; | |||||
private final QtkCustomerInfoRepo customerInfoRepo; | |||||
/** | |||||
* 通过openId获取用户列表 | |||||
* @param openId 小程序端openId | |||||
*/ | |||||
public QtkCustomerInfo getCustomerInfoFromOpenId(String openId) throws ManagerException { | |||||
AccountInfo accountInfo = accountInfoRepo.findByOpenId(openId); | |||||
if (accountInfo == null) { | |||||
throw new ManagerException("身份认证信息错误"); | |||||
} | |||||
return customerInfoRepo.findByCustomerIdNumAndCustomerIdTypeAndUserType(accountInfo.getIdNum(), | |||||
accountInfo.getIdType().getCode(), accountInfo.getUserType().getCode()); | |||||
} | |||||
/** | |||||
* 通过openId获取用户编号 | |||||
* @param openId 小程序端openId | |||||
*/ | |||||
public String getCustomerIdFromOpenId(String openId) throws ManagerException { | |||||
QtkCustomerInfo customerInfo = getCustomerInfoFromOpenId(openId); | |||||
if (customerInfo == null) { | |||||
return null; | |||||
} | |||||
return customerInfo.getCustomerId(); | |||||
} | |||||
/** | |||||
* 通过openId获取AccountInfo | |||||
* @param openId 小程序端openId | |||||
*/ | |||||
public AccountInfo getAccountInfoFromOpenId(String openId) throws ManagerException { | |||||
AccountInfo accountInfo = accountInfoRepo.findByOpenId(openId); | |||||
if (accountInfo == null){ | |||||
throw new ManagerException("身份认证信息错误"); | |||||
} | |||||
return accountInfo; | |||||
} | |||||
/** | |||||
* 通过customId获得account信息 | |||||
*/ | |||||
public AccountInfo getAccountInfoFromCustomerId(String customerId) throws ManagerException { | |||||
QtkCustomerInfo customer = customerInfoRepo.findByCustomerId(customerId); | |||||
AccountInfo accountInfo = accountInfoRepo.findByIdNumAndUserType(customer.getCustomerIdNum(), UserType.fromCode(customer.getUserType())); | |||||
if (accountInfo == null) { | |||||
throw new ManagerException("身份认证信息错误"); | |||||
} | |||||
return accountInfo; | |||||
} | |||||
/* | |||||
* 通过AccountInfo获得QtkCustomerInfo信息 | |||||
*/ | |||||
public QtkCustomerInfo getCustomerInfoFromAccountInfo(AccountInfo accountInfo) throws ManagerException { | |||||
QtkCustomerInfo customer = customerInfoRepo.findByCustomerIdNumAndCustomerIdTypeAndUserType(accountInfo.getIdNum(), | |||||
accountInfo.getIdType().getCode(), accountInfo.getUserType().getCode()); | |||||
if (customer == null) { | |||||
throw new ManagerException("身份认证信息错误"); | |||||
} | |||||
return customer; | |||||
} | |||||
} |