Commit d171866f authored by tangtuo's avatar tangtuo

v1.0.0功能开发

parent 17d687d9
......@@ -169,6 +169,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
copyrightVo.setAuthors(authors);
// 查询著作权人列表
List<CopyrightOwner> owners = copyrightOwnerService.getByCopyrightId(id);
copyrightVo.setOwners(owners);
// 查询权力列表
List<Authority> authorities = authorityService.getByCopyrightId(id);
copyrightVo.setAuthorities(authorities);
......
package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication;
import com.fzm.common.enums.FileSuffix;
import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.utils.OssUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
/**
* @author tangtuo
* @date 2021/12/13 17:26
*/
@Api(tags = "版权申请附件管理")
@Authentication
@RestController
@RequestMapping(value = "/copyright/file")
public class CopyrightFileController {
private static final long maxSize = 1024 * 1024 * 200;
@Resource
private OssUtil ossUtil;
@PostMapping("/upload")
@ApiOperation(value = "上传版权申请附件")
public ResponseModel<String> upload(MultipartFile file) throws IOException {
// 文件最大支持200m
if (file.getSize() > maxSize) {
throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "单个文件最大支持200M");
}
String fileName = file.getOriginalFilename();
String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
if (!FileSuffix.validFileType(fileSuffix)) {
throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "不支持当前上传的文件类型");
}
String url = ossUtil.putSimpleObject(file);
return ResponseModel.success(url);
}
}
......@@ -11,6 +11,7 @@ import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -31,7 +32,7 @@ public class CopyrightOwnerController {
@PostMapping(value = "/add")
@ApiOperation(value = "新增著作权人")
public ResponseModel<Integer> add(@RequestHeader(value = "Authentication") String token, @RequestBody CopyrightOwner owner) {
public ResponseModel<Integer> add(@RequestHeader(value = "Authorization") String token, @Validated @RequestBody CopyrightOwner owner) {
// 如果著作权人是个人的话,身份证正反面照片 著作权人手持身份证照片等信息必传
if (owner.getType().equals(OwnerTypeEnum.PERSON.getType())) {
if (StringUtils.isAnyBlank(owner.getBackPhoto(), owner.getPositivePhoto(), owner.getPersonalPhoto())) {
......@@ -51,7 +52,7 @@ public class CopyrightOwnerController {
@GetMapping(value = "/list")
@ApiOperation(value = "获取我的著作权人列表")
public ResponseModel<List<CopyrightOwner>> list(@RequestHeader(value = "Authentication") String token){
public ResponseModel<List<CopyrightOwner>> list(@RequestHeader(value = "Authorization") String token) {
Integer userId = JwtUtil.getUserIdFromToken(token);
List<CopyrightOwner> list = copyrightOwnerService.getByUserId(userId);
return ResponseModel.success(list);
......
......@@ -2,11 +2,9 @@ package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.Draft;
import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.dto.DraftDTO;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.DraftService;
import com.fzm.common.utils.JsonUtil;
import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -47,10 +45,16 @@ public class DraftController {
@PostMapping("/delete")
@ApiOperation(value = "删除草稿记录")
public ResponseModel<Boolean> delete(Integer id) {
public ResponseModel<Boolean> delete(@RequestParam Integer id) {
Boolean result = draftService.delete(id);
return ResponseModel.success(result);
}
@GetMapping("/detail")
@ApiOperation(value = "获取草稿详情")
public Draft getDetail(Integer id) {
return draftService.getById(id);
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment