| | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.whyc.util.ActionUtil.getApplication; |
| | | |
| | |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加",notes = "添加到人脸库") |
| | | public Response add(@RequestParam String fileData,String uName,Integer uId ){ |
| | | public Response add(@RequestBody Map<String,Object> paramMap ){ |
| | | String fileData = (String) paramMap.get("fileData"); |
| | | String uName = (String) paramMap.get("uName"); |
| | | Integer uId = Integer.parseInt((String)paramMap.get("uId")); |
| | | //传参 uId,uName,fileData--文件流 |
| | | fileData = fileData.replaceAll(" ", "+"); |
| | | |
| | |
| | | Response checkRes1 = FaceIdentifyUtil.orientAndPxDetect(faceEngine,imageInfo); |
| | | if((boolean)checkRes1.getData()){ |
| | | /*=========图片保存===========*/ |
| | | //获取到tomcat webapp绝对路径 |
| | | String realPath = getApplication().getRealPath("/"); |
| | | String[] split = realPath.split(File.separator); |
| | | //String[] split = realPath.split("\\\\"); |
| | | String projectName = split[split.length - 1]; |
| | | |
| | | String webAppPath = realPath.substring(0, realPath.lastIndexOf(projectName)); |
| | | ApplicationHome applicationHome = new ApplicationHome(getClass()); |
| | | File jarFile = applicationHome.getDir(); |
| | | |
| | | //存储人脸图片的文件夹 |
| | | String fileDirName = webAppPath + projectName + "_photo"; |
| | | String fileDirName = jarFile.getParentFile().toString()+File.separator+"fg_photo"; |
| | | |
| | | File file = new File(fileDirName); |
| | | //不存在则创建该文件夹 |
| | |
| | | */ |
| | | @GetMapping("info") |
| | | @ApiOperation(value = "查询人脸信息") |
| | | public Response getInfo(){ |
| | | public Response getInfo(HttpServletRequest request){ |
| | | //传入pageNum,pageSize |
| | | UserInf userInf = (UserInf) ActionUtil.getSession().getAttribute("user"); |
| | | UserInf userInf = (UserInf) request.getSession().getAttribute("user"); |
| | | UserInf user = service.getInfo(userInf.getUId()); |
| | | |
| | | return new Response().set(1,user); |