Commit 85ca9ccc by xieshixiang

返回参数校对

parent 0ae1e2ec
......@@ -10,6 +10,8 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,7 +36,7 @@ public class BindInfoControlller extends BaseController {
@Autowired
IBindService service;
@Autowired
DefaultConverter defaultConverter;
DefaultConverter defaultConverter;
/**
......@@ -48,8 +50,7 @@ public class BindInfoControlller extends BaseController {
@PostMapping("bind")
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Response<String> bindInfo(@RequestBody @Validated BindInfoReq req) {
public Response<BindInfoRes> bindInfo(@RequestBody @Validated BindInfoReq req) {
ParkBindInfo bindInfo = new ParkBindInfo();
defaultConverter.getMapperFacade().map(req, bindInfo);
return service.bind(bindInfo);
......@@ -81,8 +82,8 @@ public class BindInfoControlller extends BaseController {
@PostMapping("query")
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Response<ResultList<ParkBindInfo>> bindInfoQery( @RequestBody @Validated BindInfoQueryReq query) {
return ResponseGenerator.success(new ResultList<ParkBindInfo>(service.selectByQuery(query)));
public Response<ResultList<BindInfoQueryRes>> bindInfoQery(@RequestBody @Validated BindInfoQueryReq query) {
return ResponseGenerator.success(new ResultList<BindInfoQueryRes>(service.selectByQuery(query)));
}
}
......@@ -30,7 +30,7 @@ public class ToolController {
* @return
*/
@GetMapping( value = "encrypt" )
public String encrypt( String plain ) {
public String encrypt(String plain) {
return EncryptStringAes.encryptAes(plain, signKeyConfigBean.getKey());
}
......@@ -41,7 +41,7 @@ public class ToolController {
* @return
*/
@GetMapping( value = "decrypt" )
public String decrypt( String cipher ) {
public String decrypt(String cipher) {
return EncryptStringAes.decryptAes(cipher, signKeyConfigBean.getKey());
}
......
......@@ -6,6 +6,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
import java.util.List;
......@@ -41,7 +42,7 @@ public interface IBindService extends IService<ParkBindInfo> {
* @param query
* @return
*/
List<ParkBindInfo> selectByQuery( BindInfoQueryReq query);
List<BindInfoQueryRes> selectByQuery(BindInfoQueryReq query);
/**
* 年检信息查询接口
......
......@@ -28,6 +28,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkVerifyInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.InsuranceInfoRes;
......@@ -148,7 +149,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
* @return
*/
@Override
public List<ParkBindInfo> selectByQuery(BindInfoQueryReq query) {
public List<BindInfoQueryRes> selectByQuery(BindInfoQueryReq query) {
return bindCache.selectByQuery(query.getUserId());
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
......@@ -42,7 +43,7 @@ public class BindCache {
* @return
*/
@Cacheable( value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0" )
public List<ParkBindInfo> selectByQuery( String userId) {
public List<BindInfoQueryRes> selectByQuery(String userId) {
return mapper.selectByQuery(userId);
}
......
......@@ -2,6 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
......@@ -15,10 +16,10 @@ import java.util.List;
**/
public interface BindInfoMapper extends BaseMapper<ParkBindInfo> {
List<ParkBindInfo> selectByQuery( String userId);
List<BindInfoQueryRes> selectByQuery(String userId);
Integer bindInfoInsert( ParkBindInfo info);
Integer unbind( ParkBindInfo info);
Integer unbind(ParkBindInfo info);
}
......@@ -27,5 +27,5 @@ public class UnBindReq {
* 时间戳
*/
@NotNull(message = "时间戳不能为空")
private long timestamp;
private long timestamp;
}
......@@ -2,6 +2,8 @@ package com.hikcreate.edl.pub.web.mobile.infra.model.param.response;
import lombok.Data;
import java.io.Serializable;
/**
* 公共加密返回消息类
* @author lixian
......@@ -9,7 +11,7 @@ import lombok.Data;
* @date 2020/6/19 10:44
**/
@Data
public class BaseEncryptRes {
public class BaseEncryptRes implements Serializable {
/**
* 加密字段
*/
......
package com.hikcreate.edl.pub.web.mobile.infra.model.param.response;
import lombok.Data;
import java.io.Serializable;
/**
* 绑定信息查询接口返回结果封装
*
* @author: xieshixiang
* @time:2020/6/22 19:52
**/
@Data
public class BindInfoQueryRes implements Serializable {
/**
* 绑定信息唯一标识,使用UUID
*/
private String unqId;
/**
* 车牌颜色:A:白,B:灰,C:黄,D:粉,E:红,
* F:紫,G:绿,H:蓝,I:棕,J:黑',
*/
private String plateColor;
/**
* 车牌号
*/
private String plateNum;
/**
* 绑定时间
*/
private String gmtBindTime;
}
......@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
......@@ -15,7 +16,7 @@ import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultList<T> {
public class ResultList<T> implements Serializable {
List<T> list;
......
......@@ -9,25 +9,8 @@
<select id="selectByQuery" parameterType="java.lang.String"
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo">
select b.unq_id, b.user_id, b.phone,
case plate_color
when 'A' then '白'
when 'B' then '灰'
when 'C' then '黄'
when 'D' then '粉'
when 'E' then '红'
when 'F' then '紫'
when 'G' then '绿'
when 'H' then '蓝'
when 'I' then '棕'
when 'J' then '黑'
end plateColor,
case status
when '0' then '未绑定'
when '1' then '已绑定'
end status,
b.plate_num,b.plate_type,b.gmt_bind_time
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes">
select b.unq_id,b.plate_color,b.plate_num,b.gmt_bind_time
from park_bind_info as b
where b.status='1'
<if test="userId!=null and userId!=''">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment