|
@@ -37,6 +37,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@@ -172,6 +173,7 @@ public class VisitorMainService extends SuperService {
|
|
|
if (entity == null) {
|
|
if (entity == null) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
|
|
|
}
|
|
}
|
|
|
|
|
+ checkReViewInfo(entity);
|
|
|
return ResultContent.buildSuccess(toModel(entity));
|
|
return ResultContent.buildSuccess(toModel(entity));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -285,19 +287,86 @@ public class VisitorMainService extends SuperService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查数据 审核是否是否已过期
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param visitorMain
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
public ResultContent checkReViewInfo(VisitorMain visitorMain) {
|
|
public ResultContent checkReViewInfo(VisitorMain visitorMain) {
|
|
|
if (ObjectUtils.isNotEmpty(visitorMain)) {
|
|
if (ObjectUtils.isNotEmpty(visitorMain)) {
|
|
|
if (visitorMain.getState() == VisitorState.WaitReView && visitorMain.getEndTime() <= System.currentTimeMillis()) {
|
|
if (visitorMain.getState() == VisitorState.WaitReView && visitorMain.getEndTime() <= System.currentTimeMillis()) {
|
|
|
// 待审核 结束时间已过期
|
|
// 待审核 结束时间已过期
|
|
|
visitorMain.setState(VisitorState.Cancel);
|
|
visitorMain.setState(VisitorState.Cancel);
|
|
|
- visitorMain.setReviewRemark("申请数据过期");
|
|
|
|
|
|
|
+ visitorMain.setReviewRemark("申请数据已失效");
|
|
|
visitorMainDao.save(visitorMain);
|
|
visitorMainDao.save(visitorMain);
|
|
|
- return ResultContent.buildFail("数据已过期");
|
|
|
|
|
|
|
+ return ResultContent.buildFail("数据已失效");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查数据是否过期
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param visitorMain
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent checkExpireInfo(VisitorMain visitorMain) {
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(visitorMain)) {
|
|
|
|
|
+ if (visitorMain.getReViewSuccess() != null && visitorMain.getReViewSuccess() && visitorMain.getEndTime() <= System.currentTimeMillis()) {
|
|
|
|
|
+ com.github.microservice.auth.client.content.ResultContent resultContent = userFaceService.delete(visitorMain.getTempUserId(), visitorMain.getFaceFileId());
|
|
|
|
|
+ if (resultContent.isSuccess()) {
|
|
|
|
|
+ visitorMain.setIsCancel(Boolean.TRUE);
|
|
|
|
|
+ visitorMain.setIsClearFace(Boolean.TRUE);
|
|
|
|
|
+ visitorMainDao.save(visitorMain);
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultContent.buildFail("数据为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 每天检查数据,,如果访问时间已过期,则清除人脸数据
|
|
|
|
|
+ */
|
|
|
|
|
+ public void loopCheckVisitorData() {
|
|
|
|
|
+ this.checkAllWaitReView();
|
|
|
|
|
+ this.checkAllOverTimeData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查所有的 审核通过的是否过期(好清理人脸信息)
|
|
|
|
|
+ */
|
|
|
|
|
+ private void checkAllOverTimeData() {
|
|
|
|
|
+ VisitorMainSearch param = new VisitorMainSearch();
|
|
|
|
|
+ param.setReViewSuccess(Boolean.TRUE);
|
|
|
|
|
+ param.setIsCancel(Boolean.FALSE);
|
|
|
|
|
+
|
|
|
|
|
+ Pageable pageable = PageRequest.of(0, 100);
|
|
|
|
|
+ Page<VisitorMain> page = visitorMainDao.page(pageable, param);
|
|
|
|
|
+ List<VisitorMain> list = page.getContent();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
+ list.forEach(visitorMain -> {
|
|
|
|
|
+ checkExpireInfo(visitorMain);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查所有的待审核得数据是否过期
|
|
|
|
|
+ */
|
|
|
|
|
+ private void checkAllWaitReView() {
|
|
|
|
|
+ List<VisitorMain> list = visitorMainDao.findByState(VisitorState.WaitReView);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
+ list.stream().forEach(visitorMain -> {
|
|
|
|
|
+ checkReViewInfo(visitorMain);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public VisitorMainModel toModel(VisitorMain entity) {
|
|
public VisitorMainModel toModel(VisitorMain entity) {
|
|
|
VisitorMainModel model = null;
|
|
VisitorMainModel model = null;
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|