From 9584d631d118876b76ce31dfdecdee0912040c1f Mon Sep 17 00:00:00 2001
From: lixian7 <lixian7>
Date: Tue, 23 Jun 2020 18:17:46 +0800
Subject: [PATCH] 解绑接口bug修复

---
 api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java    | 10 +++++++++-
 domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java |  4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java b/api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
index e2ca0b6..e7206a1 100644
--- a/api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+++ b/api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
@@ -25,6 +25,7 @@ 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 lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -56,6 +57,13 @@ public class H5Controller {
     DefaultConverter defaultConverter;
 
     /**
+     * 验证有效性限制时间
+     * 单位:小时
+     */
+    @Value("${biz.check.validity.limit.time:24}")
+    Integer checkValidityLimitTime;
+
+    /**
      * 年检信息查询接口
      *
      * @param query
@@ -127,7 +135,7 @@ public class H5Controller {
     public Response<CheckValidityRes> checkValidity(@RequestBody @Validated H5BindInfoQuery query) {
 
         ParkVerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(),
-                DateUtil.offsetDay(DateTime.now(), -1));
+                DateUtil.offsetHour(DateTime.now(), -checkValidityLimitTime));
 
         CheckValidityRes checkValidityRes = new CheckValidityRes();
         defaultConverter.getMapperFacade().map(query, checkValidityRes);
diff --git a/domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java b/domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
index 92fd7c4..d194338 100644
--- a/domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+++ b/domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
@@ -77,7 +77,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
      * 解除绑定时间限制
      * 单位:小时
      */
-    @Value("${biz.unbind.time:-720}")
+    @Value("${biz.unbind.time:720}")
     Integer unBindTime;
 
 
@@ -161,7 +161,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
          */
         QueryWrapper<ParkBindInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("user_id", req.getUserId());
-        queryWrapper.ge("unbind_time", DateUtil.offsetHour(new Date(), unBindTime));
+        queryWrapper.ge("unbind_time", DateUtil.offsetHour(new Date(), -unBindTime));
         queryWrapper.eq("status", "0");
         Integer integer = mapper.selectCount(queryWrapper);
         if (integer >= 10) {
--
libgit2 0.26.0