From e8f0b3422d307c686b3a81269f9e9e4fb34a846e Mon Sep 17 00:00:00 2001 From: wjli <591616088@qq.com> Date: 星期五, 12 四月 2024 10:49:46 +0800 Subject: [PATCH] 指纹登陆返回客户端加密信息 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java index 72b5a32..be1df9b 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java @@ -18,12 +18,15 @@ import cn.exrick.xboot.your.service.ICarService; import cn.exrick.xboot.your.service.IEventLogService; import cn.exrick.xboot.your.util.FaceSystem; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.gson.Gson; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -37,10 +40,12 @@ import java.io.IOException; import java.io.InputStream; import java.util.Collection; +import java.util.Date; import java.util.Iterator; import java.util.List; //浜鸿劯姣斿妫�娴嬭溅鍘㈠紓甯稿紑鍚� @RestController +@Api(tags = "浜鸿劯姣斿妫�娴嬭溅鍘㈠紓甯稿紑鍚�") @RequestMapping("/hk") public class FaceImgController { @@ -61,7 +66,7 @@ @Autowired private IEventLogService iEventLogService; - + @ApiOperation(value = "浜鸿劯瀵规瘮鍥剧墖") @RequestMapping(value = "/faceImg", method = RequestMethod.POST) public void saveOrUpdate(HttpServletRequest request) throws IOException, ServletException { OssSetting os = new Gson().fromJson(settingService.get(SettingConstant.LOCAL_OSS).getValue(), OssSetting.class); @@ -75,12 +80,26 @@ String targetAttrs = jsonObject1.get("targetAttrs").toString(); JSONObject jsonObject2 = JSONUtil.parseObj(targetAttrs); String deviceName = jsonObject2.get("deviceName").toString(); - System.out.println(deviceName); + //System.out.println(deviceName); QueryWrapper<Car> wrapper = new QueryWrapper<Car>(); wrapper.eq("car_no",deviceName.substring(0,deviceName.length()-1)); Car one = iCarService.getOne(wrapper); if(one==null){ + return; + } + + Date date1 = new Date(); + long time = date1.getTime()-2*60*1000; + Date date = new Date(time); + String format1 = DateUtil.format(date,"yyyy-MM-dd HH:mm:ss"); + String format2 = DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss"); + QueryWrapper<Alarm> awrapper = new QueryWrapper<>(); + awrapper.between("create_time",format1,format2); + awrapper.eq("car_no",one.getCarNo()); + awrapper.eq("type",5); + List<Alarm> list = iAlarmService.list(awrapper); + if(list.size()>0){ return; } @@ -109,7 +128,7 @@ String avatar = user.getAvatar(); if(StrUtil.isNotEmpty(avatar)){ int result1 = FaceSystem.getResult(avatar, avatar2); - if(result1<60){ + if(result1<50){ flag++; }else{ deleteFile(f.getId());//鏄竴涓汉鍒犻櫎鍥剧墖 flag=0 @@ -123,7 +142,7 @@ String avatar = user1.getAvatar(); if(StrUtil.isNotEmpty(avatar)){ int result1 = FaceSystem.getResult(avatar, avatar2); - if(result1<60){ + if(result1<50){ flag++; }else{ deleteFile(f.getId()); @@ -150,7 +169,7 @@ } } catch (Exception e) { - System.out.println(e.toString()); + //System.out.println(e.toString()); } } } -- Gitblit v1.9.1