Commit af94e7d5 by lixian7

Merge branch 'dev' into 'test'

Dev

See merge request !1
parents 9cc3ad5c a456118f
...@@ -3,12 +3,10 @@ package com.hikcreate.edl.pub.web.mobile.api.controller; ...@@ -3,12 +3,10 @@ package com.hikcreate.edl.pub.web.mobile.api.controller;
import com.hikcreate.common.orika.DefaultConverter; import com.hikcreate.common.orika.DefaultConverter;
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.edl.pub.web.mobile.domain.IBindService; import com.hikcreate.edl.pub.web.mobile.domain.IBindService;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation;
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.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq; 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.BindInfoReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq; import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq;
...@@ -21,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -21,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* 绑定信息的controller * 绑定信息的controller
* *
...@@ -54,7 +50,7 @@ public class BindInfoControlller extends BaseController { ...@@ -54,7 +50,7 @@ public class BindInfoControlller extends BaseController {
@ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Response<String> bindInfo(@RequestBody @Validated BindInfoReq req) { public Response<String> bindInfo(@RequestBody @Validated BindInfoReq req) {
BindInfo bindInfo = new BindInfo(); ParkBindInfo bindInfo = new ParkBindInfo();
defaultConverter.getMapperFacade().map(req, bindInfo); defaultConverter.getMapperFacade().map(req, bindInfo);
return service.bind(bindInfo); return service.bind(bindInfo);
} }
...@@ -86,8 +82,8 @@ public class BindInfoControlller extends BaseController { ...@@ -86,8 +82,8 @@ public class BindInfoControlller extends BaseController {
@PostMapping("query") @PostMapping("query")
@BodyDecryptAnnotation @BodyDecryptAnnotation
@ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Response<ResultList<BindInfo>> bindInfoQery(@RequestBody @Validated BindInfoQueryReq query) { public Response<ResultList<ParkBindInfo>> bindInfoQery( @RequestBody @Validated BindInfoQueryReq query) {
return ResponseGenerator.success(new ResultList<BindInfo>(service.selectByQuery(query))); return ResponseGenerator.success(new ResultList<ParkBindInfo>(service.selectByQuery(query)));
} }
} }
...@@ -14,7 +14,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.par ...@@ -14,7 +14,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.par
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.param.request.H5BindInfoQuery; 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.entity.ParkVerifyInfo;
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;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.CheckValidityRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.CheckValidityRes;
...@@ -125,7 +125,7 @@ public class H5Controller { ...@@ -125,7 +125,7 @@ public class H5Controller {
@HeaderDecryptAnnotation @HeaderDecryptAnnotation
public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) { public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) {
VerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(), ParkVerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10)); DateUtil.offsetDay(DateTime.now(), -10));
CheckValidityRes checkValidityRes = new CheckValidityRes(); CheckValidityRes checkValidityRes = new CheckValidityRes();
...@@ -174,7 +174,7 @@ public class H5Controller { ...@@ -174,7 +174,7 @@ public class H5Controller {
Response<Void> checkResult = smsFeign.checkVerifyCode(micReq); Response<Void> checkResult = smsFeign.checkVerifyCode(micReq);
if (StatusCode.SUCCESS.getCode() == (checkResult.getCode())) { if (StatusCode.SUCCESS.getCode() == (checkResult.getCode())) {
VerifyInfo verifyInfo = new VerifyInfo(); ParkVerifyInfo verifyInfo = new ParkVerifyInfo();
verifyInfo.setUserId(req.getUserId()); verifyInfo.setUserId(req.getUserId());
verifyInfo.setVerifyCode(req.getVerifyCode()); verifyInfo.setVerifyCode(req.getVerifyCode());
verifyInfo.setPhone(req.getPhone()); verifyInfo.setPhone(req.getPhone());
......
...@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 工具
* @menu 工具接口
* @author lixian * @author lixian
* @description * @description
* @date 2020/6/18 17:57 * @date 2020/6/18 17:57
...@@ -16,10 +18,15 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,10 +18,15 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping( "/test" ) @RequestMapping( "/test" )
public class TestController { public class ToolController {
@Autowired @Autowired
SignKeyConfigBean signKeyConfigBean; SignKeyConfigBean signKeyConfigBean;
/**
* 加密
* @param plain 明文
* @return
*/
@GetMapping( value = "encrypt" ) @GetMapping( value = "encrypt" )
public String encrypt( String plain ) { public String encrypt( String plain ) {
return EncryptStringAes.encryptAes(plain, signKeyConfigBean.getKey()); return EncryptStringAes.encryptAes(plain, signKeyConfigBean.getKey());
......
...@@ -2,7 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.domain; ...@@ -2,7 +2,7 @@ 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.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.BindInfoQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery; 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.request.UnBindReq;
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
* @author: xieshixiang * @author: xieshixiang
* @time:2020/6/18 16:11 * @time:2020/6/18 16:11
**/ **/
public interface IBindService extends IService<BindInfo> { public interface IBindService extends IService<ParkBindInfo> {
/** /**
* 信息绑定接口 * 信息绑定接口
...@@ -27,7 +27,7 @@ public interface IBindService extends IService<BindInfo> { ...@@ -27,7 +27,7 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx * @author: xsx
* @date: 2020/6/19 10:32 * @date: 2020/6/19 10:32
*/ */
Response bind( BindInfo info); Response bind( ParkBindInfo info);
/** /**
* 信息解绑 * 信息解绑
...@@ -41,7 +41,7 @@ public interface IBindService extends IService<BindInfo> { ...@@ -41,7 +41,7 @@ public interface IBindService extends IService<BindInfo> {
* @param query * @param query
* @return * @return
*/ */
List<BindInfo> selectByQuery( BindInfoQueryReq query); List<ParkBindInfo> selectByQuery( BindInfoQueryReq query);
/** /**
* 年检信息查询接口 * 年检信息查询接口
......
...@@ -25,8 +25,8 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.par ...@@ -25,8 +25,8 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.par
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.ViolationRes; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.ViolationRes;
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.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo; 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.BindInfoQueryReq;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery; 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.request.UnBindReq;
...@@ -55,7 +55,7 @@ import java.util.UUID; ...@@ -55,7 +55,7 @@ import java.util.UUID;
@Service @Service
@EnableScheduling @EnableScheduling
@Slf4j @Slf4j
public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> implements IBindService { public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> implements IBindService {
@Resource @Resource
BindInfoMapper mapper; BindInfoMapper mapper;
...@@ -78,7 +78,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -78,7 +78,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override @Override
public Response bind(BindInfo info) { public Response bind( ParkBindInfo info) {
info.setUnqId(UUID.randomUUID().toString()); info.setUnqId(UUID.randomUUID().toString());
info.setGmtBindTime(DateTime.now().toString()); info.setGmtBindTime(DateTime.now().toString());
...@@ -95,27 +95,27 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -95,27 +95,27 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
PlateNumQueryReq req = new PlateNumQueryReq(); PlateNumQueryReq req = new PlateNumQueryReq();
req.setPlateNum(info.getPlateNum()); req.setPlateNum(info.getPlateNum());
List<VehicleRes> byPlateNum = vechicleCache.getByPlateNum(req); List<VehicleRes> byPlateNum = vechicleCache.getByPlateNum(req);
if (byPlateNum==null || byPlateNum.size()==0){ if (byPlateNum == null || byPlateNum.size() == 0) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR,"车辆信息不存在"); return ResponseGenerator.fail(StatusCode.DATA_ERROR, "车辆信息不存在");
} }
for (VehicleRes res : byPlateNum) { for (VehicleRes res : byPlateNum) {
if (info.getPhone().equals(res.getSjhm())) { if (info.getPhone().equals(res.getSjhm())) {
info.setPlateType(res.getHpzl()); info.setPlateType(res.getHpzl());
} }
} }
if (info.getPlateType() == null || info.getPlateType().equals("")) { if (info.getPlateType() == null || "".equals(info.getPlateType())) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR,"当前手机号,与车辆备案手机号不一致"); return ResponseGenerator.fail(StatusCode.DATA_ERROR, "当前手机号,与车辆备案手机号不一致");
} }
//规则3:判断当前车牌号是否已绑定 //规则3:判断当前车牌号是否已绑定
QueryWrapper<BindInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<ParkBindInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", info.getUserId()); queryWrapper.eq("user_id", info.getUserId());
queryWrapper.eq("plate_num", info.getPlateNum()); queryWrapper.eq("plate_num", info.getPlateNum());
queryWrapper.eq("plate_type", info.getPlateType()); queryWrapper.eq("plate_type", info.getPlateType());
queryWrapper.eq("status", "1"); queryWrapper.eq("status", "1");
BindInfo bindExist = mapper.selectOne(queryWrapper); ParkBindInfo bindExist = mapper.selectOne(queryWrapper);
if (bindExist != null) { if (bindExist != null) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR,"此车牌号已绑定"); return ResponseGenerator.fail(StatusCode.DATA_ERROR, "此车牌号已绑定");
} else { } else {
info.setUnqId(UUID.randomUUID().toString()); info.setUnqId(UUID.randomUUID().toString());
mapper.insert(info); mapper.insert(info);
...@@ -134,7 +134,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -134,7 +134,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/** /**
* 解绑规则:30天内,同一客户解绑次数总计不能超过10次 * 解绑规则:30天内,同一客户解绑次数总计不能超过10次
*/ */
QueryWrapper<BindInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<ParkBindInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", req.getUnqId()); queryWrapper.eq("user_id", req.getUnqId());
queryWrapper.eq("unbind_time", DateUtil.offsetDay(new Date(), -30)); queryWrapper.eq("unbind_time", DateUtil.offsetDay(new Date(), -30));
queryWrapper.eq("status", "0"); queryWrapper.eq("status", "0");
...@@ -154,15 +154,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -154,15 +154,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
* @return * @return
*/ */
@Override @Override
public List<BindInfo> selectByQuery(BindInfoQueryReq query) { public List<ParkBindInfo> selectByQuery( BindInfoQueryReq query) {
return bindCache.selectByQuery(query.getUserId()); return bindCache.selectByQuery(query.getUserId());
} }
@Override @Override
public Response<YearCheckInfoRes> yearCheckInfo(H5BindInfoQuery query) { public Response<YearCheckInfoRes> yearCheckInfo(H5BindInfoQuery query) {
BindInfo bindInfo = bindCache.getById(query.getUnqId()); ParkBindInfo 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, "绑定信息不存在");
} }
PlateNumAndTypeQueryReq req = new PlateNumAndTypeQueryReq(); PlateNumAndTypeQueryReq req = new PlateNumAndTypeQueryReq();
req.setPlateNum(bindInfo.getPlateNum()); req.setPlateNum(bindInfo.getPlateNum());
...@@ -187,9 +187,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -187,9 +187,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override @Override
public Response<InsuranceInfoRes> insuranceInfo(H5BindInfoQuery query) { public Response<InsuranceInfoRes> insuranceInfo(H5BindInfoQuery query) {
BindInfo bindInfo = bindCache.getById(query.getUnqId()); ParkBindInfo 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,"绑定信息不存在");
} }
PlateNumAndTypeQueryReq req = new PlateNumAndTypeQueryReq(); PlateNumAndTypeQueryReq req = new PlateNumAndTypeQueryReq();
req.setPlateNum(bindInfo.getPlateNum()); req.setPlateNum(bindInfo.getPlateNum());
...@@ -225,9 +225,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -225,9 +225,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/** /**
* 校验当前的绑定信息是否存在 * 校验当前的绑定信息是否存在
*/ */
BindInfo bindInfo = bindCache.getById(query.getUnqId()); ParkBindInfo 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,"绑定信息不存在");
} }
/** /**
...@@ -261,15 +261,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -261,15 +261,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/** /**
* 校验当前的绑定信息是否存在 * 校验当前的绑定信息是否存在
*/ */
BindInfo bindInfo = bindCache.getById(query.getUnqId()); ParkBindInfo 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,"绑定信息不存在");
} }
/** /**
* 校验当前电话号码是否在10天内已通过验证 * 校验当前电话号码是否在10天内已通过验证
*/ */
VerifyInfo verify = verifyInfo.checkValidity(query.getPhone(), query.getUserId(), ParkVerifyInfo verify = verifyInfo.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10)); DateUtil.offsetDay(DateTime.now(), -10));
if (verify == null) { if (verify == null) {
return ResponseGenerator.fail(StatusCode.PERMISSION_DENIED); return ResponseGenerator.fail(StatusCode.PERMISSION_DENIED);
......
...@@ -2,9 +2,8 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.cache; ...@@ -2,9 +2,8 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.cache;
import cn.hutool.core.date.DateTime; 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.entity.ParkBindInfo;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching; import org.springframework.cache.annotation.Caching;
...@@ -30,10 +29,10 @@ public class BindCache { ...@@ -30,10 +29,10 @@ public class BindCache {
* @return * @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 ParkBindInfo getById( String unqId ) {
LambdaQueryWrapper<BindInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ParkBindInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BindInfo::getUnqId, unqId); queryWrapper.eq(ParkBindInfo::getUnqId, unqId);
queryWrapper.eq(BindInfo::getStatus, 1); queryWrapper.eq(ParkBindInfo::getStatus, 1);
return mapper.selectOne(queryWrapper); return mapper.selectOne(queryWrapper);
} }
...@@ -43,7 +42,7 @@ public class BindCache { ...@@ -43,7 +42,7 @@ public class BindCache {
* @return * @return
*/ */
@Cacheable( value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0" ) @Cacheable( value = "bindinfo", key = "'userId:'+#userId", unless = "#result==null or #result.size()==0" )
public List<BindInfo> selectByQuery( String userId) { public List<ParkBindInfo> selectByQuery( String userId) {
return mapper.selectByQuery(userId); return mapper.selectByQuery(userId);
} }
...@@ -59,7 +58,7 @@ public class BindCache { ...@@ -59,7 +58,7 @@ public class BindCache {
}) })
public boolean unBind(String unqId, String userId){ public boolean unBind(String unqId, String userId){
BindInfo bindInfo = new BindInfo(); ParkBindInfo bindInfo = new ParkBindInfo();
bindInfo.setUnqId(unqId); bindInfo.setUnqId(unqId);
bindInfo.setStatus("0"); bindInfo.setStatus("0");
bindInfo.setUnbindTime(DateTime.now().toString()); bindInfo.setUnbindTime(DateTime.now().toString());
......
package com.hikcreate.edl.pub.web.mobile.infra.data.mapper; package com.hikcreate.edl.pub.web.mobile.infra.data.mapper;
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.model.entity.ParkBindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
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 org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
...@@ -17,14 +13,12 @@ import java.util.List; ...@@ -17,14 +13,12 @@ import java.util.List;
* @author: xieshixiang * @author: xieshixiang
* @time:2020/6/18 15:56 * @time:2020/6/18 15:56
**/ **/
public interface BindInfoMapper extends BaseMapper<BindInfo> { public interface BindInfoMapper extends BaseMapper<ParkBindInfo> {
List<BindInfo> selectByQuery( String userId); List<ParkBindInfo> selectByQuery( String userId);
Integer bindInfoInsert(BindInfo info); Integer bindInfoInsert( ParkBindInfo info);
Integer clearPast(@Param("dateTime") Date dateTime); Integer unbind( ParkBindInfo info);
Integer unbind(BindInfo info);
} }
...@@ -2,7 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.mapper; ...@@ -2,7 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.mapper;
import cn.hutool.core.date.DateTime; 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.model.VerifyInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkVerifyInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -11,8 +11,8 @@ import org.apache.ibatis.annotations.Param; ...@@ -11,8 +11,8 @@ import org.apache.ibatis.annotations.Param;
* @author: xieshixiang * @author: xieshixiang
* @time:2020/6/19 18:34 * @time:2020/6/19 18:34
**/ **/
public interface VerifyInfoMapper extends BaseMapper<VerifyInfo> { public interface VerifyInfoMapper extends BaseMapper<ParkVerifyInfo> {
VerifyInfo checkValidity(@Param("phone") String phone,@Param("userId") String userId,@Param("time") DateTime last); ParkVerifyInfo checkValidity( @Param("phone") String phone, @Param("userId") String userId, @Param("time") DateTime last);
} }
package com.hikcreate.edl.pub.web.mobile.infra.model; package com.hikcreate.edl.pub.web.mobile.infra.model.entity;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
...@@ -12,7 +12,7 @@ import java.io.Serializable; ...@@ -12,7 +12,7 @@ import java.io.Serializable;
* @date: 2020/6/19 9:50 * @date: 2020/6/19 9:50
*/ */
@Data @Data
public class BindInfo implements Serializable { public class ParkBindInfo implements Serializable {
/** /**
* 绑定信息唯一标识,使用UUID * 绑定信息唯一标识,使用UUID
......
package com.hikcreate.edl.pub.web.mobile.infra.model; package com.hikcreate.edl.pub.web.mobile.infra.model.entity;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import lombok.Data; import lombok.Data;
...@@ -9,7 +9,7 @@ import lombok.Data; ...@@ -9,7 +9,7 @@ import lombok.Data;
* @date: 2020/6/19 18:33 * @date: 2020/6/19 18:33
*/ */
@Data @Data
public class VerifyInfo { public class ParkVerifyInfo {
/** /**
* 记录唯一id * 记录唯一id
......
...@@ -4,6 +4,7 @@ import lombok.Data; ...@@ -4,6 +4,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* @author lixian * @author lixian
...@@ -27,6 +28,7 @@ public class BindInfoReq { ...@@ -27,6 +28,7 @@ public class BindInfoReq {
* F:紫,G:绿,H:蓝,I:棕,J:黑', * F:紫,G:绿,H:蓝,I:棕,J:黑',
*/ */
@NotBlank(message = "车牌颜色不能为空") @NotBlank(message = "车牌颜色不能为空")
@Pattern(regexp = "[ABCDEFGHIJ]")
private String plateColor; private String plateColor;
/** /**
* 车牌号 * 车牌号
...@@ -38,5 +40,5 @@ public class BindInfoReq { ...@@ -38,5 +40,5 @@ public class BindInfoReq {
* 时间戳 * 时间戳
*/ */
@NotNull(message = "时间戳不能为空") @NotNull(message = "时间戳不能为空")
private Long timestamp; private Long timestamp;
} }
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper"> <mapper namespace="com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper">
<insert id="bindInfoInsert" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo"> <insert id="bindInfoInsert" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo">
insert ignore into edl_public.bind_info(unq_id,user_id,phone,plate_color,plate_num,plate_type,gmt_bind_time) insert ignore into park_bind_info(unq_id,user_id,phone,plate_color,plate_num,plate_type,gmt_bind_time)
values (#{unqId},#{userId},#{phone},#{plateColor},#{plateNum},#{plateType},#{gmtBindTime}) values (#{unqId},#{userId},#{phone},#{plateColor},#{plateNum},#{plateType},#{gmtBindTime})
</insert> </insert>
<select id="selectByQuery" parameterType="java.lang.String" <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.entity.ParkBindInfo">
select b.unq_id, b.user_id, b.phone, select b.unq_id, b.user_id, b.phone,
case plate_color case plate_color
when 'A' then '白' when 'A' then '白'
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
when '1' then '已绑定' when '1' then '已绑定'
end status, end status,
b.plate_num,b.plate_type,b.gmt_bind_time b.plate_num,b.plate_type,b.gmt_bind_time
from edl_public.bind_info as b from park_bind_info as b
where b.status='1' where b.status='1'
<if test="userId!=null and userId!=''"> <if test="userId!=null and userId!=''">
and b.user_id=#{userId} and b.user_id=#{userId}
...@@ -36,13 +36,9 @@ ...@@ -36,13 +36,9 @@
</select> </select>
<update id="unbind"> <update id="unbind">
update edl_public.bind_info as b set b.status="0",b.unbind_time=#{unbindTime} where b.unq_id=#{unqId} update park_bind_info as b set b.status="0",b.unbind_time=#{unbindTime} where b.unq_id=#{unqId}
</update> </update>
<delete id="clearPast" parameterType="java.util.Date">
delete from edl_public.bind_info where unbind_time <![CDATA[<=]]> #{dateTime} and status='0'
</delete>
</mapper> </mapper>
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<mapper namespace="com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper"> <mapper namespace="com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper">
<select id="checkValidity" resultType="com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo"> <select id="checkValidity" resultType="com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkVerifyInfo">
select id, user_id, verify_code, phone,pass_time from edl_public.verify_info as v select id, user_id, verify_code, phone,pass_time from park_verify_info as v
where pass_time <![CDATA[ >= ]]> #{time} and phone=#{phone} and user_id=#{userId} where pass_time <![CDATA[ >= ]]> #{time} and phone=#{phone} and user_id=#{userId}
</select> </select>
</mapper> </mapper>
-- auto-generated definition -- auto-generated definition
...@@ -10,7 +10,9 @@ create table bind_info ...@@ -10,7 +10,9 @@ create table bind_info
plate_type varchar(20) not null comment '车牌类型', plate_type varchar(20) not null comment '车牌类型',
status varchar(10) default '1' null comment '绑定状态:0,未绑定,1,已绑定', status varchar(10) default '1' null comment '绑定状态:0,未绑定,1,已绑定',
gmt_bind_time datetime null comment '绑定时间', gmt_bind_time datetime null comment '绑定时间',
unbind_time datetime null comment '解绑时间' unbind_time datetime null comment '解绑时间',
constraint bind_info_pk
unique (user_id, unbind_time)
) )
comment '用户车辆绑定信息'; comment '用户车辆绑定信息';
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