|  |  |  | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") | 
|---|
|  |  |  | public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response,Integer isFace) throws Exception { | 
|---|
|  |  |  | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 
|---|
|  |  |  | upload(multipartRequest, response, folder + "/", | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode(),isFace); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/uploadPicture", headers = "content-type=multipart/form-data") | 
|---|
|  |  |  | public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response,Integer isFace) throws Exception { | 
|---|
|  |  |  | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 
|---|
|  |  |  | Iterator<String> fileNames = multipartRequest.getFileNames(); | 
|---|
|  |  |  | Map<String, Object> context = new HashMap<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode(),isFace); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | //                    boolean r = ftp.uploadInputstream(compressImg(is),fileName); | 
|---|
|  |  |  | boolean r = ftp.uploadInputstream(is,fileName); | 
|---|
|  |  |  | if(r){ | 
|---|
|  |  |  | if(Constants.equalsInteger(isFace,Constants.ZERO)){ | 
|---|
|  |  |  | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ | 
|---|
|  |  |  | //验证人脸评分 | 
|---|
|  |  |  | //人脸评分 | 
|---|
|  |  |  | FacePictureCheckRequest param = new FacePictureCheckRequest(); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode() + | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode(); | 
|---|
|  |  |  | param.setFacePicUrl(prefixUrl + fileName); | 
|---|
|  |  |  | BaseResponse<FacePictureCheckResponse> responseBaseResponse = HKService.facePictureCheck(param); | 
|---|
|  |  |  | if(responseBaseResponse == null || !StringUtils.equals(responseBaseResponse.getCode(), HKConstants.RESPONSE_SUCCEE)){ | 
|---|
|  |  |  | throw  new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | //                                throw  new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | FacePictureCheckResponse facePictureCheckResponse = responseBaseResponse.getData(); | 
|---|
|  |  |  | if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ | 
|---|
|  |  |  | throw  new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | //                                throw  new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!facePictureCheckResponse.getCheckResult()){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), facePictureCheckResponse.getStatusMessage()); | 
|---|
|  |  |  | //                                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), facePictureCheckResponse.getStatusMessage()); | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", facePictureCheckResponse.getStatusMessage()); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String bucketName, | 
|---|
|  |  |  | String access_id, String access_key, String resourcePath, String endpoint) throws Exception { | 
|---|
|  |  |  | String access_id, String access_key, String resourcePath, String endpoint,Integer isFace) throws Exception { | 
|---|
|  |  |  | response.setCharacterEncoding("UTF-8"); | 
|---|
|  |  |  | response.setContentType("text/html;charset=UTF-8"); | 
|---|
|  |  |  | Map<String, Object> context = new HashMap<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); | 
|---|
|  |  |  | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { | 
|---|
|  |  |  | // 移动成功,返回文件名 | 
|---|
|  |  |  | // sendSuccessMessage(response, resourcePath+key); | 
|---|
|  |  |  | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ | 
|---|
|  |  |  | //验证人脸评分 | 
|---|
|  |  |  | //人脸评分 | 
|---|
|  |  |  | FacePictureCheckRequest param = new FacePictureCheckRequest(); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode(); | 
|---|
|  |  |  | param.setFacePicUrl(prefixUrl + key); | 
|---|
|  |  |  | BaseResponse<FacePictureCheckResponse> responseBaseResponse = HKService.facePictureCheck(param); | 
|---|
|  |  |  | if(responseBaseResponse == null || !StringUtils.equals(responseBaseResponse.getCode(), HKConstants.RESPONSE_SUCCEE)){ | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | FacePictureCheckResponse facePictureCheckResponse = responseBaseResponse.getData(); | 
|---|
|  |  |  | if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", "对不起,人脸评分获取数据失败~"); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!facePictureCheckResponse.getCheckResult()){ | 
|---|
|  |  |  | context.put("code", 0); | 
|---|
|  |  |  | context.put("message", facePictureCheckResponse.getStatusMessage()); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | context.put("success", true); | 
|---|
|  |  |  | context.put("code", 200); | 
|---|
|  |  |  | context.put("errno",0); | 
|---|