| | |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | //import com.stylefeng.guns.modular.system.util.ICBCPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.CompareFace; |
| | | import com.stylefeng.guns.modular.system.util.HuaWeiSMSUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.ActivityWarpper; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/face") |
| | | @ApiOperation(value = "面容识别", tags = {"司机端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "面容文件地址", name = "url", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> driverLogin(String url,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | //通过第三方进行识别 |
| | | if (CompareFace.faceCompare(url, driver.getFaceImgUrl())){ |
| | | driver.setLastFacialTime(new Date()); |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | driver.setFailCount(driver.getFailCount()==null? 0: driver.getFailCount()+1); |
| | | driverService.updateById(driver); |
| | | if (driver.getFailCount()==5){ |
| | | return new ResultUtil<>(-1,"已满五次,退回主页"); |
| | | } |
| | | //成功的话保存最后识别时间 |
| | | return ResultUtil.error("人脸认证失败,请重试"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取首页统计数据 |