| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.dto.FileDirPath; |
| | | import com.whyc.dto.Page; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.DocUserMapper; |
| | |
| | | private DocFaceService faceService; |
| | | |
| | | //查询所有用户信息 |
| | | public Response getAllUser(Page page) { |
| | | PageHelper.startPage(page.getPageCurr(),page.getPageSize()); |
| | | public Response getAllUser(int pageCurr,int pageSize) { |
| | | PageHelper.startPage(pageCurr,pageSize); |
| | | List<DocUser> list=mapper.getAllUser(); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null?true:false,pageInfo,"数据返回"); |
| | | } |
| | | //编辑所有用户信息 |
| | | public Response updateAllUser(MultipartFile file,DocUser docUser) { |
| | | public Response updateUser(MultipartFile file,DocUser docUser) { |
| | | int faceId=(docUser.getFaceId()==null||docUser.getFaceId().isEmpty())?0:Integer.valueOf(docUser.getFaceId()); |
| | | //检测是否存在重新上传的人脸 |
| | | faceId=checkFaceData(file,faceId); |
| | |
| | | |
| | | //检测是否存在重新上传的人脸 |
| | | public int checkFaceData(MultipartFile file,int faceId){ |
| | | String fileDirName = ""; |
| | | ApplicationHome applicationHome = new ApplicationHome(getClass()); |
| | | File jarFile = applicationHome.getDir(); |
| | | if( 1 == YamlProperties.runModel){ |
| | | fileDirName = jarFile.getParentFile().toString(); |
| | | }else{ |
| | | //打包版 |
| | | fileDirName = jarFile.toString(); |
| | | } |
| | | String root=fileDirName+"/face/"+File.separator; |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | String root=fileDirName+File.separator+"face"+File.separator; |
| | | if(file.isEmpty()){ |
| | | faceId=0; |
| | | return faceId; |
| | | }else{ |
| | | String fileFileName = file.getOriginalFilename(); |
| | | String filePath = root + fileFileName; |
| | |
| | | } |
| | | return faceId; |
| | | } |
| | | //删除用户信息 |
| | | public Response delUser(int id) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("id",id); |
| | | int bl=mapper.delete(wrapper); |
| | | return new Response().setII(1,bl>0?true:false,bl,"删除返回"); |
| | | } |
| | | } |