|
|
@@ -1,7 +1,9 @@
|
|
|
package com.doc.biz.controller;
|
|
|
|
|
|
import com.doc.biz.domain.DocActor;
|
|
|
+import com.doc.biz.domain.DocActorUser;
|
|
|
import com.doc.biz.service.IDocActorService;
|
|
|
+import com.doc.biz.service.IDocActorUserService;
|
|
|
import com.doc.common.annotation.Log;
|
|
|
import com.doc.common.core.controller.BaseController;
|
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
|
@@ -10,17 +12,20 @@ import com.doc.common.enums.BusinessType;
|
|
|
import com.doc.common.utils.poi.ExcelUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 文档协作Controller
|
|
|
*
|
|
|
* @author wukai
|
|
|
- * @date 2023-08-15
|
|
|
+ * @date 2023-09-18
|
|
|
*/
|
|
|
@Api(tags = "文档协作")
|
|
|
@RestController
|
|
|
@@ -28,72 +33,113 @@ import java.util.List;
|
|
|
public class DocActorController extends BaseController {
|
|
|
@Resource
|
|
|
private IDocActorService docActorService;
|
|
|
+ @Resource
|
|
|
+ private IDocActorUserService actorUserService;
|
|
|
|
|
|
- /**
|
|
|
- * 查询文档协作列表
|
|
|
- */
|
|
|
- @ApiOperation("查询文档协作列表")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:list')")
|
|
|
- @GetMapping("/list")
|
|
|
- public TableDataInfo list(DocActor docActor) {
|
|
|
- startPage();
|
|
|
- List<DocActor> list = docActorService.selectDocActorList(docActor);
|
|
|
- return getDataTable(list);
|
|
|
+ @ApiOperation("归档")
|
|
|
+ @PutMapping("/{docId}")
|
|
|
+ public AjaxResult put(@ApiParam(value = "文件ID", required = true) @PathVariable(name = "docId") Long docId) {
|
|
|
+ DocActor docActor = new DocActor();
|
|
|
+ docActor.setDocId(docId);
|
|
|
+ docActor.setIsFiled("Y");
|
|
|
+ docActor.setFiledTime(new Date());
|
|
|
+ return AjaxResult.success(docActorService.updateDocActor(docActor));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出文档协作列表
|
|
|
- */
|
|
|
- @ApiOperation("导出文档协作列表")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:export')")
|
|
|
- @Log(title = "文档协作", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, DocActor docActor) {
|
|
|
- List<DocActor> list = docActorService.selectDocActorList(docActor);
|
|
|
- ExcelUtil<DocActor> util = new ExcelUtil<DocActor>(DocActor.class);
|
|
|
- util.exportExcel(response, list, "文档协作数据");
|
|
|
+ @ApiOperation("获取已选择人员")
|
|
|
+ @GetMapping("/{docId}")
|
|
|
+ public List<DocActorUser> get(@ApiParam(value = "文件ID", required = true) @PathVariable(name = "docId") Long docId) {
|
|
|
+ DocActorUser actorUser = new DocActorUser();
|
|
|
+ actorUser.setDocId(docId);
|
|
|
+ return actorUserService.selectDocActorUserList(actorUser);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取文档协作详细信息
|
|
|
- */
|
|
|
- @ApiOperation("获取文档协作详细信息")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:query')")
|
|
|
- @GetMapping(value = "/{autoId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("autoId") Long autoId) {
|
|
|
- return success(docActorService.selectDocActorByAutoId(autoId));
|
|
|
- }
|
|
|
+ @ApiOperation("添加协作人员")
|
|
|
+ @PostMapping("/{docId}")
|
|
|
+ public AjaxResult add(@ApiParam(value = "文件ID", required = true) @PathVariable(name = "docId") Long docId, @ApiParam(value = "协作人员", required = true) @RequestBody List<Long> users) {
|
|
|
+ DocActor actor = docActorService.selectDocActorByDocId(docId);
|
|
|
+ if (actor == null) {
|
|
|
+ actor = new DocActor();
|
|
|
+ actor.setDocId(docId);
|
|
|
+ docActorService.insertDocActor(actor);
|
|
|
+ }
|
|
|
+ actorUserService.deleteDocActorUserByDocId(docId);
|
|
|
+ users.forEach(u -> {
|
|
|
+ DocActorUser actorUser = new DocActorUser();
|
|
|
+ actorUser.setUserId(u);
|
|
|
+ actorUser.setDocId(docId);
|
|
|
+ actorUserService.insertDocActorUser(actorUser);
|
|
|
+ });
|
|
|
|
|
|
- /**
|
|
|
- * 新增文档协作
|
|
|
- */
|
|
|
- @ApiOperation("新增文档协作")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:add')")
|
|
|
- @Log(title = "文档协作", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping
|
|
|
- public AjaxResult add(@RequestBody DocActor docActor) {
|
|
|
- return toAjax(docActorService.insertDocActor(docActor));
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改文档协作
|
|
|
- */
|
|
|
- @ApiOperation("修改文档协作")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:edit')")
|
|
|
- @Log(title = "文档协作", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping
|
|
|
- public AjaxResult edit(@RequestBody DocActor docActor) {
|
|
|
- return toAjax(docActorService.updateDocActor(docActor));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除文档协作
|
|
|
- */
|
|
|
- @ApiOperation("删除文档协作")
|
|
|
- //@PreAuthorize("@ss.hasPermi('biz:actor:remove')")
|
|
|
- @Log(title = "文档协作", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{autoIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] autoIds) {
|
|
|
- return toAjax(docActorService.deleteDocActorByAutoIds(autoIds));
|
|
|
- }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 查询文档协作列表
|
|
|
+// */
|
|
|
+// //@ApiOperation("查询文档协作列表")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:list')")
|
|
|
+// @GetMapping("/list")
|
|
|
+// public TableDataInfo list(DocActor docActor) {
|
|
|
+// startPage();
|
|
|
+// List<DocActor> list = docActorService.selectDocActorList(docActor);
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 导出文档协作列表
|
|
|
+// */
|
|
|
+// //@ApiOperation("导出文档协作列表")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:export')")
|
|
|
+// @Log(title = "文档协作", businessType = BusinessType.EXPORT)
|
|
|
+// @PostMapping("/export")
|
|
|
+// public void export(HttpServletResponse response, DocActor docActor) {
|
|
|
+// List<DocActor> list = docActorService.selectDocActorList(docActor);
|
|
|
+// ExcelUtil<DocActor> util = new ExcelUtil<DocActor>(DocActor.class);
|
|
|
+// util.exportExcel(response, list, "文档协作数据");
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 获取文档协作详细信息
|
|
|
+// */
|
|
|
+// //@ApiOperation("获取文档协作详细信息")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:query')")
|
|
|
+// @GetMapping(value = "/{docId}")
|
|
|
+// public AjaxResult getInfo(@PathVariable("docId") Long docId) {
|
|
|
+// return success(docActorService.selectDocActorByDocId(docId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 新增文档协作
|
|
|
+// */
|
|
|
+// //@ApiOperation("新增文档协作")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:add')")
|
|
|
+// @Log(title = "文档协作", businessType = BusinessType.INSERT)
|
|
|
+// @PostMapping
|
|
|
+// public AjaxResult add(@RequestBody DocActor docActor) {
|
|
|
+// return toAjax(docActorService.insertDocActor(docActor));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 修改文档协作
|
|
|
+// */
|
|
|
+// //@ApiOperation("修改文档协作")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:edit')")
|
|
|
+// @Log(title = "文档协作", businessType = BusinessType.UPDATE)
|
|
|
+// @PutMapping
|
|
|
+// public AjaxResult edit(@RequestBody DocActor docActor) {
|
|
|
+// return toAjax(docActorService.updateDocActor(docActor));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 删除文档协作
|
|
|
+// */
|
|
|
+// // @ApiOperation("删除文档协作")
|
|
|
+// @PreAuthorize("@ss.hasPermi('biz:actor:remove')")
|
|
|
+// @Log(title = "文档协作", businessType = BusinessType.DELETE)
|
|
|
+// @DeleteMapping("/{docIds}")
|
|
|
+// public AjaxResult remove(@PathVariable Long[] docIds) {
|
|
|
+// return toAjax(docActorService.deleteDocActorByDocIds(docIds));
|
|
|
+// }
|
|
|
}
|