清空判定
This commit is contained in:
@ -45,4 +45,5 @@ public class FaceDeviceInfoRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Boolean clear;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.controller.app.facedeviceinfo;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -14,11 +15,14 @@ import cn.iocoder.yudao.module.system.service.facedeviceinfo.FaceDeviceInfoServi
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
@ -38,15 +42,29 @@ public class AppFaceDeviceInfoController {
|
||||
@Resource
|
||||
private FaceDeviceInfoService faceDeviceInfoService;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate clearRedisTemplate;
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得人脸设备信息关联门店")
|
||||
@Parameter(name = "mac", description = "设备mac码", required = true, example = "1024")
|
||||
public CommonResult<FaceDeviceInfoRespVO> getFaceDeviceInfo(@RequestParam("mac") String mac) {
|
||||
FaceDeviceInfoDO faceDeviceInfo = faceDeviceInfoService.getInfo(mac);
|
||||
return success(BeanUtils.toBean(faceDeviceInfo, FaceDeviceInfoRespVO.class));
|
||||
String today = DateUtil.date().toString("yyyyMMdd");
|
||||
FaceDeviceInfoRespVO bean = BeanUtils.toBean(faceDeviceInfo, FaceDeviceInfoRespVO.class);
|
||||
String s = clearRedisTemplate.opsForValue().get(today+faceDeviceInfo.getCarteenId());
|
||||
if(StringUtils.isNotBlank(s)){
|
||||
bean.setClear(false);
|
||||
}else {
|
||||
bean.setClear(true);
|
||||
clearRedisTemplate.opsForValue().set(today+faceDeviceInfo.getCarteenId(),"true");
|
||||
String yesterday = DateUtil.format(DateUtil.yesterday(), "yyyyMMdd");
|
||||
clearRedisTemplate.delete(yesterday+faceDeviceInfo.getCarteenId());
|
||||
}
|
||||
|
||||
return success(bean);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user