Commit 29bc0eb1 by xieshixiang

修改解绑条件限制逻辑

parent ae5601ce
...@@ -5,12 +5,10 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator; ...@@ -5,12 +5,10 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; 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.HeaderDecryptAnnotation;
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.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.UnBindReq; 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;
...@@ -69,7 +67,7 @@ public class BindInfoControlller extends BaseController { ...@@ -69,7 +67,7 @@ public class BindInfoControlller extends BaseController {
*/ */
@PostMapping("unbind") @PostMapping("unbind")
public Response unbindInfo(@RequestBody @Validated UnBindReq req) { public Response unbindInfo(@RequestBody @Validated UnBindReq req) {
return service.unbindInfo(req) ? ResponseGenerator.success() : ResponseGenerator.fail("解绑失败"); return service.unbindInfo(req) ? ResponseGenerator.success() : ResponseGenerator.fail("解绑失败");
} }
/** /**
......
...@@ -165,7 +165,7 @@ public class H5Controller { ...@@ -165,7 +165,7 @@ public class H5Controller {
* @date: 2020/6/21 13:58 * @date: 2020/6/21 13:58
*/ */
@PostMapping("checkVerifyCode") @PostMapping("checkVerifyCode")
public Response<Void> sendVerifyCode(@RequestBody @Validated CheckVerifyCodeReq req) { public Response<Void> checkVerifyCode(@RequestBody @Validated CheckVerifyCodeReq req) {
CheckVerifyCodeMicReq micReq = new CheckVerifyCodeMicReq(); CheckVerifyCodeMicReq micReq = new CheckVerifyCodeMicReq();
micReq.setPhone(req.getPhone()); micReq.setPhone(req.getPhone());
......
...@@ -37,7 +37,6 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfo ...@@ -37,7 +37,6 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfo
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -86,6 +85,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -86,6 +85,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆 //判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper boundQuery = new QueryWrapper(); QueryWrapper boundQuery = new QueryWrapper();
boundQuery.eq("user_id", info.getUserId()); boundQuery.eq("user_id", info.getUserId());
boundQuery.eq("status", "1");
Integer bound = mapper.selectCount(boundQuery); Integer bound = mapper.selectCount(boundQuery);
if (bound >= 3) { if (bound >= 3) {
return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR); return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR);
...@@ -108,12 +108,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -108,12 +108,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
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");
BindInfo bindExist = mapper.selectOne(queryWrapper); BindInfo bindExist = mapper.selectOne(queryWrapper);
if (bindExist != null) { if (bindExist != null) {
info.setUnqId(bindExist.getUnqId()); return ResponseGenerator.fail(StatusCode.ALERT_ERROR);
info.setStatus("1");
mapper.updateById(info);
} else { } else {
info.setUnqId(UUID.randomUUID().toString()); info.setUnqId(UUID.randomUUID().toString());
mapper.insert(info); mapper.insert(info);
...@@ -129,7 +127,18 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -129,7 +127,18 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
*/ */
@Override @Override
public boolean unbindInfo(UnBindReq req) { public boolean unbindInfo(UnBindReq req) {
return bindCache.unBind(req.getUnqId(), req.getUserId());
QueryWrapper<BindInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", req.getUnqId());
queryWrapper.eq("unbind_time", DateUtil.offsetDay(new Date(), -30));
queryWrapper.eq("status", "0");
Integer integer = mapper.selectCount(queryWrapper);
if (integer >= 10) {
return false;
} else {
return bindCache.unBind(req.getUnqId(), req.getUserId());
}
} }
/** /**
...@@ -297,15 +306,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -297,15 +306,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
} }
@Scheduled(cron = "0 0/30 * * * ?") // @Scheduled(cron = "0 0/30 * * * ?")
public void clearPast() { // public void clearPast() {
DateTime now = DateTime.now(); // DateTime now = DateTime.now();
log.info("开始清除,已过期且无效的绑定信息.当前时间:" + now); // log.info("开始清除,已过期且无效的绑定信息.当前时间:" + now);
Date lastMonth = DateUtil.offsetDay(now, -30); // Date lastMonth = DateUtil.offsetDay(now, -30);
Integer count = mapper.clearPast(lastMonth); // Integer count = mapper.clearPast(lastMonth);
log.info("清除完毕,共清除过期且无效的绑定信息:" + count); // log.info("清除完毕,共清除过期且无效的绑定信息:" + count);
}
}
}
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