Commit c2d69122 by xieshixiang

修改时间类型

parent 20a0ec64
...@@ -13,9 +13,9 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.Sms ...@@ -13,9 +13,9 @@ 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.param.request.H5BindInfoQuery;
import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkVerifyInfo; 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.H5BindInfoQuery;
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;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
...@@ -117,16 +117,17 @@ public class H5Controller { ...@@ -117,16 +117,17 @@ public class H5Controller {
} }
/** /**
* 验证当前手机号是否在10天内,已通过验证 * 验证当前手机号是否在1天内,已通过验证
*
* @param query * @param query
* @return * @return
*/ */
@PostMapping("checkValidity") @PostMapping("checkValidity")
@HeaderDecryptAnnotation @HeaderDecryptAnnotation
public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) { public Response<CheckValidityRes> checkValidity(@RequestBody @Validated H5BindInfoQuery query) {
ParkVerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(), ParkVerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10)); DateUtil.offsetDay(DateTime.now(), -1));
CheckValidityRes checkValidityRes = new CheckValidityRes(); CheckValidityRes checkValidityRes = new CheckValidityRes();
defaultConverter.getMapperFacade().map(query, checkValidityRes); defaultConverter.getMapperFacade().map(query, checkValidityRes);
...@@ -178,7 +179,7 @@ public class H5Controller { ...@@ -178,7 +179,7 @@ public class H5Controller {
verifyInfo.setUserId(req.getUserId()); verifyInfo.setUserId(req.getUserId());
verifyInfo.setVerifyCode(req.getVerifyCode()); verifyInfo.setVerifyCode(req.getVerifyCode());
verifyInfo.setPhone(req.getPhone()); verifyInfo.setPhone(req.getPhone());
verifyInfo.setPassTime(DateTime.now().toString()); verifyInfo.setPassTime(DateTime.now());
verifyInfoMapper.insert(verifyInfo); verifyInfoMapper.insert(verifyInfo);
} }
return checkResult; return checkResult;
......
...@@ -112,7 +112,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i ...@@ -112,7 +112,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
info.setUnqId(unqIdUtil.getUnqId()); info.setUnqId(unqIdUtil.getUnqId());
info.setGmtBindTime(new Date().toString()); info.setGmtBindTime(new Date());
mapper.insert(info); mapper.insert(info);
return ResponseGenerator.success(new BindInfoRes(info.getUnqId())); return ResponseGenerator.success(new BindInfoRes(info.getUnqId()));
} }
...@@ -150,7 +150,20 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i ...@@ -150,7 +150,20 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
*/ */
@Override @Override
public List<BindInfoQueryRes> selectByQuery(BindInfoQueryReq query) { public List<BindInfoQueryRes> selectByQuery(BindInfoQueryReq query) {
return bindCache.selectByQuery(query.getUserId()); List<ParkBindInfo> parkBindInfos = bindCache.selectByQuery(query.getUserId());
List<BindInfoQueryRes> resList = new ArrayList<>(3);
if (parkBindInfos != null && !parkBindInfos.isEmpty()) {
for (ParkBindInfo item : parkBindInfos) {
BindInfoQueryRes resultItem = new BindInfoQueryRes();
resultItem.setPlateColor(item.getPlateColor());
resultItem.setPlateNum(item.getPlateNum());
resultItem.setUnqId(item.getUnqId());
resultItem.setGmtBindTime(item.getGmtBindTime().getTime());
resList.add(resultItem);
}
}
return resList;
} }
@Override @Override
...@@ -262,10 +275,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i ...@@ -262,10 +275,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
} }
/** /**
* 校验当前电话号码是否在10天内已通过验证 * 校验当前电话号码是否在1天内已通过验证
*/ */
ParkVerifyInfo verify = verifyInfo.checkValidity(query.getPhone(), query.getUserId(), ParkVerifyInfo verify = verifyInfo.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10)); DateUtil.offsetDay(DateTime.now(), -1));
if (verify == null) { if (verify == null) {
return ResponseGenerator.fail(StatusCode.PERMISSION_DENIED); return ResponseGenerator.fail(StatusCode.PERMISSION_DENIED);
} }
...@@ -296,8 +309,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i ...@@ -296,8 +309,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
*/ */
DrivingLicenseInfoRes result = new DrivingLicenseInfoRes(); DrivingLicenseInfoRes result = new DrivingLicenseInfoRes();
result.setDriverName(drivingLicenseRes.getXm()); result.setDriverName(drivingLicenseRes.getXm());
result.setPlateNum(drivingLicenseRes.getSfzmhm()); result.setPlateNum(byPlateNumAndType.getHphm());
result.setValidityTime(drivingLicenseRes.getYxqz()); String validityTime = drivingLicenseRes.getYxqz();
validityTime.substring(0, validityTime.length() - 3);
result.setValidityTime(validityTime);
String status = DateUtil.compare(DateUtil.parseDate(drivingLicenseRes.getYxqz()), new Date()) >= 0 ? "有效" : String status = DateUtil.compare(DateUtil.parseDate(drivingLicenseRes.getYxqz()), new Date()) >= 0 ? "有效" :
"已过期"; "已过期";
result.setStatus(status); result.setStatus(status);
......
...@@ -3,7 +3,6 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.cache; ...@@ -3,7 +3,6 @@ package com.hikcreate.edl.pub.web.mobile.infra.data.cache;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo; 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.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;
...@@ -45,7 +44,7 @@ public class BindCache { ...@@ -45,7 +44,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<BindInfoQueryRes> selectByQuery(String userId) { public List<ParkBindInfo> selectByQuery(String userId) {
return mapper.selectByQuery(userId); return mapper.selectByQuery(userId);
} }
...@@ -65,7 +64,7 @@ public class BindCache { ...@@ -65,7 +64,7 @@ public class BindCache {
ParkBindInfo bindInfo = new ParkBindInfo(); ParkBindInfo bindInfo = new ParkBindInfo();
bindInfo.setUnqId(unqId); bindInfo.setUnqId(unqId);
bindInfo.setStatus("0"); bindInfo.setStatus("0");
bindInfo.setUnbindTime(new Date().toString()); bindInfo.setUnbindTime(new Date());
return mapper.unbind(bindInfo) > 0; return mapper.unbind(bindInfo) > 0;
} }
} }
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
**/ **/
public interface BindInfoMapper extends BaseMapper<ParkBindInfo> { public interface BindInfoMapper extends BaseMapper<ParkBindInfo> {
List<BindInfoQueryRes> selectByQuery(String userId); List<ParkBindInfo> selectByQuery(String userId);
Integer bindInfoInsert( ParkBindInfo info); Integer bindInfoInsert( ParkBindInfo info);
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 绑定信息实体类 * 绑定信息实体类
...@@ -47,11 +48,11 @@ public class ParkBindInfo implements Serializable { ...@@ -47,11 +48,11 @@ public class ParkBindInfo implements Serializable {
/** /**
* 绑定时间 * 绑定时间
*/ */
private String gmtBindTime; private Date gmtBindTime;
/** /**
* 解绑时间 * 解绑时间
*/ */
private String unbindTime; private Date unbindTime;
} }
package com.hikcreate.edl.pub.web.mobile.infra.model.entity; package com.hikcreate.edl.pub.web.mobile.infra.model.entity;
import cn.hutool.core.date.DateTime;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* 短信验证通过记录 * 短信验证通过记录
* *
...@@ -30,7 +32,7 @@ public class ParkVerifyInfo { ...@@ -30,7 +32,7 @@ public class ParkVerifyInfo {
/** /**
* 上次通过验证的时间 * 上次通过验证的时间
*/ */
private String passTime; private Date passTime;
} }
...@@ -30,6 +30,6 @@ public class BindInfoQueryRes implements Serializable { ...@@ -30,6 +30,6 @@ public class BindInfoQueryRes implements Serializable {
/** /**
* 绑定时间 * 绑定时间
*/ */
private String gmtBindTime; private Long gmtBindTime;
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<select id="selectByQuery" parameterType="java.lang.String" <select id="selectByQuery" parameterType="java.lang.String"
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes"> resultType="com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo">
select b.unq_id,b.plate_color,b.plate_num,b.gmt_bind_time select b.unq_id,b.plate_color,b.plate_num,b.gmt_bind_time
from park_bind_info as b from park_bind_info as b
where b.status='1' where b.status='1'
......
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