Commit 0ba3fc03 by lixian7

调整接口

parent fe694fe2
package com.hikcreate.edl.pub.web.mobile.api.controller; package com.hikcreate.edl.pub.web.mobile.api.controller;
import cn.hutool.core.date.DateTime;
import com.hikcreate.common.sdk.response.apiparam.Response; import com.hikcreate.common.sdk.response.apiparam.Response;
import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator; import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; import com.hikcreate.common.sdk.response.statuscode.StatusCode;
...@@ -8,7 +7,9 @@ import com.hikcreate.edl.pub.web.mobile.domain.IBindService; ...@@ -8,7 +7,9 @@ import com.hikcreate.edl.pub.web.mobile.domain.IBindService;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; 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.ResultList; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -59,19 +60,14 @@ public class BindInfoControlller extends BaseController { ...@@ -59,19 +60,14 @@ public class BindInfoControlller extends BaseController {
/** /**
* 解绑用户信息的接口 * 解绑用户信息的接口
* *
* @param query * @param req
* @return Result * @return Result
* @author: xsx * @author: xsx
* @date: 2020/6/19 10:27 * @date: 2020/6/19 10:27
*/ */
@PostMapping("unbind") @PostMapping("unbind")
public Response unbindInfo(@RequestBody @Validated BindInfoQuery query) { public Response unbindInfo(@RequestBody @Validated UnBindReq req) {
return service.unbindInfo(req) ? ResponseGenerator.success() : ResponseGenerator.fail("解绑失败");
BindInfo bindInfo = new BindInfo();
bindInfo.setUnqId(query.getUnqId());
bindInfo.setStatus("0");
bindInfo.setUnbindTime(DateTime.now().toString());
return mapper.unbind(bindInfo) > 0 ? ResponseGenerator.success() : ResponseGenerator.fail("");
} }
/** /**
...@@ -84,10 +80,8 @@ public class BindInfoControlller extends BaseController { ...@@ -84,10 +80,8 @@ public class BindInfoControlller extends BaseController {
*/ */
@PostMapping("query") @PostMapping("query")
@ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Response<ResultList<BindInfo>> bindInfoQery(@RequestBody @Validated BindInfoQuery query) { public Response<ResultList<BindInfo>> bindInfoQery(@RequestBody @Validated BindInfoQueryReq query) {
return ResponseGenerator.success(new ResultList<BindInfo>(service.selectByQuery(query)));
return ResponseGenerator.success(new ResultList<BindInfo>(mapper.selectByQuery(query).getDataItems()));
} }
} }
...@@ -12,7 +12,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.Sms ...@@ -12,7 +12,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.Sms
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery;
import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.CheckVerifyCodeReq; import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.CheckVerifyCodeReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.SendVerifyCodeReq; import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.SendVerifyCodeReq;
...@@ -63,7 +63,7 @@ public class H5Controller { ...@@ -63,7 +63,7 @@ public class H5Controller {
* @date: 2020/6/19 10:32 * @date: 2020/6/19 10:32
*/ */
@PostMapping("yearCheckInfo") @PostMapping("yearCheckInfo")
public Response<YearCheckInfoRes> yearCheckInfo(@RequestBody @Validated BindInfoQuery query) { public Response<YearCheckInfoRes> yearCheckInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.yearCheckInfo(query); return service.yearCheckInfo(query);
} }
...@@ -77,7 +77,7 @@ public class H5Controller { ...@@ -77,7 +77,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("violationInfo") @PostMapping("violationInfo")
public Response<ResultList<ViolationInfoRes>> violationInfo(@RequestBody @Validated BindInfoQuery query) { public Response<ResultList<ViolationInfoRes>> violationInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.violationInfo(query); return service.violationInfo(query);
} }
...@@ -91,7 +91,7 @@ public class H5Controller { ...@@ -91,7 +91,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("insuranceInfo") @PostMapping("insuranceInfo")
public Response<InsuranceInfoRes> insuranceInfo(@RequestBody @Validated BindInfoQuery query) { public Response<InsuranceInfoRes> insuranceInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.insuranceInfo(query); return service.insuranceInfo(query);
} }
...@@ -106,7 +106,7 @@ public class H5Controller { ...@@ -106,7 +106,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("drivingLicenseInfo") @PostMapping("drivingLicenseInfo")
public Response<DrivingLicenseInfoRes> drivingLicenseInfo(@RequestBody @Validated BindInfoQuery query) { public Response<DrivingLicenseInfoRes> drivingLicenseInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.drivingLicenseInfo(query); return service.drivingLicenseInfo(query);
} }
...@@ -117,7 +117,7 @@ public class H5Controller { ...@@ -117,7 +117,7 @@ public class H5Controller {
* @return * @return
*/ */
@PostMapping("checkValidity") @PostMapping("checkValidity")
public Response<CheckValidityRes> checkValidity( @RequestBody @Validated BindInfoQuery query) { public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) {
VerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(), VerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10)); DateUtil.offsetDay(DateTime.now(), -10));
......
...@@ -3,9 +3,13 @@ package com.hikcreate.edl.pub.web.mobile.domain; ...@@ -3,9 +3,13 @@ package com.hikcreate.edl.pub.web.mobile.domain;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hikcreate.common.sdk.response.apiparam.Response; import com.hikcreate.common.sdk.response.apiparam.Response;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; 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.DrivingLicenseInfoRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
import java.util.List;
/** /**
* 客户绑定服务接口 * 客户绑定服务接口
...@@ -26,19 +30,33 @@ public interface IBindService extends IService<BindInfo> { ...@@ -26,19 +30,33 @@ public interface IBindService extends IService<BindInfo> {
Response bind( BindInfo info); Response bind( BindInfo info);
/** /**
* 信息解绑
* @param req
* @return
*/
boolean unbindInfo( UnBindReq req );
/**
* 查询用户绑定信息
* @param query
* @return
*/
List<BindInfo> selectByQuery( BindInfoQueryReq query);
/**
* 年检信息查询接口 * 年检信息查询接口
* *
* @param query * @param query
* @return * @return
*/ */
Response yearCheckInfo(BindInfoQuery query); Response yearCheckInfo( H5BindInfoQuery query);
/** /**
* 保险信息查询接口 * 保险信息查询接口
* @param query * @param query
* @return * @return
*/ */
Response insuranceInfo(BindInfoQuery query); Response insuranceInfo( H5BindInfoQuery query);
/** /**
* 违法信息查询接口 * 违法信息查询接口
...@@ -48,7 +66,7 @@ public interface IBindService extends IService<BindInfo> { ...@@ -48,7 +66,7 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx * @author: xsx
* @date: 2020/6/19 16:06 * @date: 2020/6/19 16:06
*/ */
Response violationInfo( BindInfoQuery query); Response violationInfo( H5BindInfoQuery query);
/** /**
* 驾照信息查询接口 * 驾照信息查询接口
...@@ -58,6 +76,6 @@ public interface IBindService extends IService<BindInfo> { ...@@ -58,6 +76,6 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx * @author: xsx
* @date: 2020/6/19 16:29 * @date: 2020/6/19 16:29
*/ */
Response<DrivingLicenseInfoRes> drivingLicenseInfo(BindInfoQuery query); Response<DrivingLicenseInfoRes> drivingLicenseInfo( H5BindInfoQuery query);
} }
...@@ -11,6 +11,7 @@ import com.hikcreate.common.sdk.response.statuscode.StatusCode; ...@@ -11,6 +11,7 @@ import com.hikcreate.common.sdk.response.statuscode.StatusCode;
import com.hikcreate.edl.pub.web.mobile.domain.IBindService; import com.hikcreate.edl.pub.web.mobile.domain.IBindService;
import com.hikcreate.edl.pub.web.mobile.infra.data.cache.BindCache; import com.hikcreate.edl.pub.web.mobile.infra.data.cache.BindCache;
import com.hikcreate.edl.pub.web.mobile.infra.data.cache.VechicleCache; import com.hikcreate.edl.pub.web.mobile.infra.data.cache.VechicleCache;
import com.hikcreate.edl.pub.web.mobile.infra.data.cache.ViolationCache;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.DrivingLicenseFeign; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.DrivingLicenseFeign;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.VechicleFeign; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.VechicleFeign;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.ViolationFeign; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.ViolationFeign;
...@@ -24,8 +25,10 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.par ...@@ -24,8 +25,10 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.par
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; 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.VerifyInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.InsuranceInfoRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.InsuranceInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList;
...@@ -67,6 +70,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -67,6 +70,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
BindCache bindCache; BindCache bindCache;
@Resource @Resource
VechicleCache vechicleCache; VechicleCache vechicleCache;
@Resource
ViolationCache violationCache;
@Override @Override
...@@ -103,8 +108,30 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -103,8 +108,30 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
} }
} }
/**
* 信息解绑
*
* @param req
* @return
*/
@Override
public boolean unbindInfo( UnBindReq req ) {
return bindCache.unBind(req.getUnqId());
}
/**
* 查询用户绑定信息
*
* @param query
* @return
*/
@Override
public List<BindInfo> selectByQuery( BindInfoQueryReq query ) {
return bindCache.selectByQuery(query.getUserId());
}
@Override @Override
public Response<YearCheckInfoRes> yearCheckInfo(BindInfoQuery query) { public Response<YearCheckInfoRes> yearCheckInfo( H5BindInfoQuery query) {
BindInfo bindInfo =bindCache.getById(query.getUnqId()); BindInfo bindInfo =bindCache.getById(query.getUnqId());
if (bindInfo == null || "0".equals(bindInfo.getStatus())) { if (bindInfo == null || "0".equals(bindInfo.getStatus())) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR); return ResponseGenerator.fail(StatusCode.DATA_ERROR);
...@@ -131,7 +158,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -131,7 +158,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
} }
@Override @Override
public Response<InsuranceInfoRes> insuranceInfo(BindInfoQuery query) { public Response<InsuranceInfoRes> insuranceInfo( H5BindInfoQuery query) {
BindInfo bindInfo = bindCache.getById(query.getUnqId()); BindInfo bindInfo = bindCache.getById(query.getUnqId());
if (bindInfo == null || "0".equals(bindInfo.getStatus())) { if (bindInfo == null || "0".equals(bindInfo.getStatus())) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR); return ResponseGenerator.fail(StatusCode.DATA_ERROR);
...@@ -166,7 +193,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -166,7 +193,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override @Override
public Response<ResultList<ViolationInfoRes>> violationInfo(BindInfoQuery query) { public Response<ResultList<ViolationInfoRes>> violationInfo( H5BindInfoQuery query) {
/** /**
* 校验当前的绑定信息是否存在 * 校验当前的绑定信息是否存在
*/ */
...@@ -181,7 +208,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -181,7 +208,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
ViolationPlateNumAndTypeQueryReq req = new ViolationPlateNumAndTypeQueryReq(); ViolationPlateNumAndTypeQueryReq req = new ViolationPlateNumAndTypeQueryReq();
req.setPlateNum(bindInfo.getPlateNum()); req.setPlateNum(bindInfo.getPlateNum());
req.setPlateType(bindInfo.getPlateType()); req.setPlateType(bindInfo.getPlateType());
List<ViolationRes> byPlateNumAndType = violatio.getByPlateNumAndType(req); List<ViolationRes> byPlateNumAndType = violationCache.getByPlateNumAndType(req);
/** /**
* 构建违章信息返回列表 * 构建违章信息返回列表
...@@ -200,7 +227,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -200,7 +227,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
} }
@Override @Override
public Response<DrivingLicenseInfoRes> drivingLicenseInfo(BindInfoQuery query) { public Response<DrivingLicenseInfoRes> drivingLicenseInfo( H5BindInfoQuery query) {
/** /**
* 校验当前的绑定信息是否存在 * 校验当前的绑定信息是否存在
*/ */
......
package com.hikcreate.edl.pub.web.mobile.infra.data.cache; package com.hikcreate.edl.pub.web.mobile.infra.data.cache;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @author lixian * @author lixian
...@@ -18,6 +22,11 @@ public class BindCache { ...@@ -18,6 +22,11 @@ public class BindCache {
@Resource @Resource
private BindInfoMapper mapper; private BindInfoMapper mapper;
/**
* 获取绑定信息
* @param unqId
* @return
*/
@Cacheable( value = "bindinfo", key = "'id:'+#unqId", unless = "#result==null" ) @Cacheable( value = "bindinfo", key = "'id:'+#unqId", unless = "#result==null" )
public BindInfo getById( String unqId ) { public BindInfo getById( String unqId ) {
LambdaQueryWrapper<BindInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BindInfo> queryWrapper = new LambdaQueryWrapper<>();
...@@ -25,4 +34,28 @@ public class BindCache { ...@@ -25,4 +34,28 @@ public class BindCache {
queryWrapper.eq(BindInfo::getStatus, 1); queryWrapper.eq(BindInfo::getStatus, 1);
return mapper.selectOne(queryWrapper); return mapper.selectOne(queryWrapper);
} }
/**
* 查询用户绑定信息
* @param userId 第三方用户ID
* @return
*/
@Cacheable( value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0" )
public List<BindInfo> selectByQuery( String userId) {
return mapper.selectByQuery(userId);
}
/**
* 解绑
* @param unqId
* @return
*/
@CacheEvict( value = "bindinfo", key = "'id:'+#unqId", condition = "#unqId!=null")
public boolean unBind(String unqId){
BindInfo bindInfo = new BindInfo();
bindInfo.setUnqId(unqId);
bindInfo.setStatus("0");
bindInfo.setUnbindTime(DateTime.now().toString());
return mapper.unbind(bindInfo) > 0 ;
}
} }
...@@ -29,7 +29,7 @@ public class VechicleCache { ...@@ -29,7 +29,7 @@ public class VechicleCache {
* @return * @return
* @param号牌号码 * @param号牌号码
*/ */
@Cacheable(value = "vehicles", key = "'platenum:'+#req.plateNum", unless = "#result==null or #result.size()==0") @Cacheable(value = "vehicles", key = "'plateNum:'+#req.plateNum", unless = "#result==null or #result.size()==0")
public List<VehicleRes> getByPlateNum( @RequestBody PlateNumQueryReq req){ public List<VehicleRes> getByPlateNum( @RequestBody PlateNumQueryReq req){
return vechicle.getByPlateNum(req); return vechicle.getByPlateNum(req);
} }
......
package com.hikcreate.edl.pub.web.mobile.infra.data.cache;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.ViolationFeign;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.request.ViolationIdCardQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.request.ViolationPlateNumAndTypeQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.ViolationRes;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* @author lixian
* @description
* @date 2020/6/21 16:46
**/
@Component
public class ViolationCache {
@Resource
ViolationFeign violatio;
/**
* 查询违法数据
*
* @param req 号牌+号牌类型,时间开始-结束
* @return
*/
@Cacheable(value = "violations", key = "'plateNum:'+#req.plateNum+':plateType:'+req.plateType+':timeStart:'+#req.timeStart+':timeEnd:'+#req.timeEnd", unless = "#result==null or #result.size()==0")
public List<ViolationRes> getByPlateNumAndType( ViolationPlateNumAndTypeQueryReq req ) {
return violatio.getByPlateNumAndType(req);
}
}
...@@ -18,16 +18,6 @@ import java.util.List; ...@@ -18,16 +18,6 @@ import java.util.List;
@FeignClient(url = "http://10.197.236.100:40204",name = "dcp-service-vehicle", path = "violation",contextId ="dcp" + @FeignClient(url = "http://10.197.236.100:40204",name = "dcp-service-vehicle", path = "violation",contextId ="dcp" +
"-service-vehicle-violation") "-service-vehicle-violation")
public interface ViolationFeign { public interface ViolationFeign {
/**
* 查询违法数据
*
* @param req 身份证号,时间开始-结束
* @return
*/
@PostMapping("/getByIdCard")
List<ViolationRes> getByIdCard(@RequestBody ViolationIdCardQueryReq req);
/** /**
* 查询违法数据 * 查询违法数据
* *
......
...@@ -4,7 +4,10 @@ import cn.hutool.core.date.DateTime; ...@@ -4,7 +4,10 @@ import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hikcreate.edl.pub.web.mobile.infra.core.page.PageResult; import com.hikcreate.edl.pub.web.mobile.infra.core.page.PageResult;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; 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 java.util.List;
/** /**
* description: * description:
...@@ -14,7 +17,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; ...@@ -14,7 +17,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery;
**/ **/
public interface BindInfoMapper extends BaseMapper<BindInfo> { public interface BindInfoMapper extends BaseMapper<BindInfo> {
PageResult<BindInfo> selectByQuery(BindInfoQuery query); List<BindInfo> selectByQuery( String userId);
Integer clearPast(DateTime dateTime); Integer clearPast(DateTime dateTime);
......
package com.hikcreate.edl.pub.web.mobile.infra.model.param.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author lixian
* @description
* @date 2020/6/21 17:00
**/
@Data
public class BindInfoQueryReq {
/**
* 查询客户的id
*/
@NotBlank(message = "客户唯一编码不能为空")
private String userId;
/**
* 时间戳
*/
@NotNull(message = "时间戳不能为空")
private long timestamp;
}
package com.hikcreate.edl.pub.web.mobile.infra.model; package com.hikcreate.edl.pub.web.mobile.infra.model.param.request;
import lombok.Data; import lombok.Data;
...@@ -12,7 +12,7 @@ import java.io.Serializable; ...@@ -12,7 +12,7 @@ import java.io.Serializable;
* @time:2020/6/18 16:07 * @time:2020/6/18 16:07
**/ **/
@Data @Data
public class BindInfoQuery implements Serializable { public class H5BindInfoQuery implements Serializable {
/** /**
* 绑定信息的唯一标识. * 绑定信息的唯一标识.
......
package com.hikcreate.edl.pub.web.mobile.infra.model.param.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author lixian
* @description
* @date 2020/6/21 16:34
**/
@Data
public class UnBindReq {
/**
* 绑定信息唯一标识
*/
@NotBlank(message = "绑定信息唯一标识不能为空")
private String unqId;
/**
* 客户id
*/
@NotBlank(message = "客户唯一编码不能为空")
private String userId;
/**
* 时间戳
*/
@NotNull(message = "时间戳不能为空")
private long timestamp;
}
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</insert> </insert>
<select id="selectByQuery" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery" <select id="selectByQuery" parameterType="java.lang.String"
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo"> resultType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo">
select b.unq_id, b.user_id, b.phone, select b.unq_id, b.user_id, b.phone,
case plate_color case plate_color
...@@ -27,13 +27,12 @@ ...@@ -27,13 +27,12 @@
when '0' then '未绑定' when '0' then '未绑定'
when '1' then '已绑定' when '1' then '已绑定'
end status, end status,
b.plate_num,b.plate_type,b.gmt_bind_time from edl_public.bind_info as b where b.status='1' b.plate_num,b.plate_type,b.gmt_bind_time
from edl_public.bind_info as b
where b.status='1'
<if test="userId!=null and nuserId!=''"> <if test="userId!=null and nuserId!=''">
and b.user_id=#{userId} and b.user_id=#{userId}
</if> </if>
<if test="phone!=null and phone!=''">
and b.phone=#{phone}
</if>
</select> </select>
<update id="unbind"> <update id="unbind">
......
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