| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @param id 资源id |
| | | */ |
| | | @GetMapping(value = "getResDetail") |
| | | public Result getResDetail(String id) { |
| | | |
| | | public Result getResDetail(String id,HttpServletResponse response) { |
| | | Res res = resService.read(id); |
| | | Result pathResult = resService.readAccessPath(id, null); |
| | | |
| | | return new Result(true, "success", CollectionUtils.newObjectMap("type", res.getType(), "name", res.getName(), |
| | | "coverUrl", res.getCoverPageUrl(), "remark", res.getRemark(), "fullPath", pathResult.getDataT("path"))); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.*; |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<FileMeta> fileUpload(MultipartFile uploadFile, String objectKey) { |
| | | ObsClient obsClient = null; |
| | |
| | | } |
| | | InputStream inputStream = uploadFile.getInputStream(); |
| | | long available = inputStream.available(); |
| | | // PutObjectRequest request = new PutObjectRequest(bucketName,objectKey,inputStream); |
| | | PutObjectRequest request = new PutObjectRequest(bucketName,destPath,inputStream); |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | objectMetadata.setContentLength(available); |
| | | request.setMetadata(objectMetadata); |
| | | // request. |
| | | // 设置对象访问权限为公共读 |
| | | request.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); |
| | | PutObjectResult result = obsClient.putObject(request); |
| | | fileMeta = new FileMeta(); |
| | | ResFile file = fileService.insertFileToDBTwo(objectKey, uploadFile.getSize(), result.getObjectUrl(), uploadFile.getContentType()); |
| | | // SetObjectMetadataRequest ObjectMetadataRequest = new SetObjectMetadataRequest(bucketName, destPath); |
| | | // ObjectMetadataRequest.setContentDisposition("inline"); |
| | | // obsClient.setObjectMetadata(ObjectMetadataRequest); |
| | | |
| | | fileMeta.setFileId(file.getFileId()); |
| | | fileMeta.setPath(result.getObjectUrl()); |
| | | fileMeta.setFileSize(uploadFile.getSize() / 1024 + "kb"); |
| | |
| | | // System.out.println(user.getUserId()); |
| | | // System.out.println(user.getOrganizationId()); |
| | | // System.out.println(StuStudent.STATUS_ACTIVE); |
| | | System.out.println(user.getOrganizationId()); |
| | | System.out.println(user.getUserId()); |
| | | |
| | | ClsClass objClsClass = this.findUnique("select c from StuStudent t," |
| | | + " ClsClass c where c.classId = t.classId " |
| | | + " and c.orgId = ? and t.userId = ? and t.status = ? order by t.createTime desc", CollectionUtils.newList(user.getOrganizationId(), user.getUserId(), StuStudent.STATUS_ACTIVE), ClsClass.class); |
| | |
| | | wrapper.setOrg(org); |
| | | wrapper.setClass(objClsClass); |
| | | wrapper.setLoginInfo(param.getCacheIpFlag(), param.getIp(), param.getPlatForm()); |
| | | System.out.println("aaa"+user.getUserId()); |
| | | session.setAttribute(UserInfoWrapper.INF_USER_ID,user.getUserId()); |
| | | session.setAttribute(UserInfoWrapper.INF_USER_NAME,user.getName()); |
| | | if(objClsClass!=null){ |