记录资源下架发起人姓名

This commit is contained in:
wangliwen 2022-05-10 17:21:57 +08:00
parent dd261257b8
commit d0ae226585
4 changed files with 77 additions and 56 deletions

View File

@ -20,6 +20,9 @@ import io.renren.modules.resourceMountApply.dto.TResourceBatchMountApplyDTO;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
@ -51,6 +54,8 @@ public class ResourceMountController {
private TResourceMountApplyService tResourceMountApplyService; private TResourceMountApplyService tResourceMountApplyService;
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@Autowired
private SysUserService sysUserService;
private static String apply_key = "resourcemountapply"; // 资源上架 private static String apply_key = "resourcemountapply"; // 资源上架
@ -139,6 +144,11 @@ public class ResourceMountController {
resourceDTO.ifPresent(dto -> { resourceDTO.ifPresent(dto -> {
dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason()); dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason());
dto.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE_REVIEW.getFlag()); // 设置为下架审核中 dto.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE_REVIEW.getFlag()); // 设置为下架审核中
String userId = SecurityUser.getUserId().toString();
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId)));
userDTO.ifPresent(user -> {
dto.setUndercarriageUserName(user.getRealName());
});
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resourceService.update(dto); resourceService.update(dto);
}); });

View File

@ -14,7 +14,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -24,11 +23,12 @@ import java.util.Map;
/** /**
* 任务管理 * 任务管理
*
* @author Jone * @author Jone
*/ */
@RestController @RestController
@RequestMapping("/act/task") @RequestMapping("/act/task")
@Api(tags="任务管理") @Api(tags = "任务管理")
public class ActTaskController { public class ActTaskController {
@Autowired @Autowired
private ActTaskService actTaskService; private ActTaskService actTaskService;
@ -38,40 +38,42 @@ public class ActTaskController {
/** /**
* 获取用户任务列表 * 获取用户任务列表
* 根据用户ID或角色组获取任务信息 * 根据用户ID或角色组获取任务信息
*
* @return * @return
*/ */
@GetMapping("page") @GetMapping("page")
@ApiOperation("待办任务默认查询所有待办任务。根据用户ID或角色ID查询个人或组的任务") @ApiOperation("待办任务默认查询所有待办任务。根据用户ID或角色ID查询个人或组的任务")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "roleIds", value = "roleIds", paramType = "query", dataType="String"), @ApiImplicitParam(name = "roleIds", value = "roleIds", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "userId", paramType = "query", dataType="String"), @ApiImplicitParam(name = "userId", value = "userId", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isRoleGroup", value = "是否查询分组", paramType = "query", dataType="String") @ApiImplicitParam(name = "isRoleGroup", value = "是否查询分组", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result<PageData<TaskDTO>> queryUserTaskPage(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TaskDTO>> queryUserTaskPage(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TaskDTO> page = actTaskService.page(params); PageData<TaskDTO> page = actTaskService.page(params);
return new Result<PageData<TaskDTO>>().ok(page); return new Result<PageData<TaskDTO>>().ok(page);
} }
/** /**
* 我的待办列表 * 我的待办列表
*
* @return * @return
*/ */
@GetMapping("myToDoTaskPage") @GetMapping("myToDoTaskPage")
@ApiOperation("我的待办列表") @ApiOperation("我的待办列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType="String") @ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result<PageData<TaskDTO>> myToDoTaskPage(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TaskDTO>> myToDoTaskPage(@ApiIgnore @RequestParam Map<String, Object> params) {
params.put("userId", SecurityUser.getUserId().toString()); params.put("userId", SecurityUser.getUserId().toString());
PageData<TaskDTO> page = actTaskService.page(params); PageData<TaskDTO> page = actTaskService.page(params);
for(TaskDTO taskDTO : page.getList()){ for (TaskDTO taskDTO : page.getList()) {
if(!StringUtils.isEmpty(taskDTO.getAssignee())){ if (!StringUtils.isEmpty(taskDTO.getAssignee())) {
SysUserDTO userDTO = sysUserService.get(Long.valueOf(taskDTO.getAssignee())); SysUserDTO userDTO = sysUserService.get(Long.valueOf(taskDTO.getAssignee()));
taskDTO.setAssigneeName(userDTO.getRealName()); taskDTO.setAssigneeName(userDTO.getRealName());
} }
@ -86,7 +88,7 @@ public class ActTaskController {
@ApiOperation("获取任务详情") @ApiOperation("获取任务详情")
@LogOperation("获取任务详情") @LogOperation("获取任务详情")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result getTaskById(@PathVariable("id") String id){ public Result getTaskById(@PathVariable("id") String id) {
TaskDTO task = actTaskService.taskDetail(id); TaskDTO task = actTaskService.taskDetail(id);
return new Result().ok(task); return new Result().ok(task);
} }
@ -96,10 +98,10 @@ public class ActTaskController {
*/ */
@PostMapping("claim") @PostMapping("claim")
@ApiOperation("认领任务") @ApiOperation("认领任务")
@ApiImplicitParam(name = "taskId", value = "taskId", paramType = "query", dataType="String") @ApiImplicitParam(name = "taskId", value = "taskId", paramType = "query", dataType = "String")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result claimTask(String taskId){ public Result claimTask(String taskId) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.claimTask(taskId); actTaskService.claimTask(taskId);
@ -111,10 +113,10 @@ public class ActTaskController {
*/ */
@PostMapping("unclaim") @PostMapping("unclaim")
@ApiOperation("释放任务") @ApiOperation("释放任务")
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String") @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result unclaimTask(String taskId){ public Result unclaimTask(String taskId) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.unclaimTask(taskId); actTaskService.unclaimTask(taskId);
@ -127,25 +129,26 @@ public class ActTaskController {
@PostMapping("complete") @PostMapping("complete")
@ApiOperation("任务处理(完成任务)") @ApiOperation("任务处理(完成任务)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "审批意见", paramType = "query", dataType="String") @ApiImplicitParam(name = "comment", value = "审批意见", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result completeTask(String taskId, String comment){ public Result completeTask(String taskId, String comment) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.completeTask(taskId, comment); actTaskService.completeTask(taskId, comment);
return new Result(); return new Result();
} }
/** /**
* 带参数的任务处理 * 带参数的任务处理
*/ */
@PostMapping("completeByVariables") @PostMapping("completeByVariables")
@ApiOperation("带参数的任务处理(完成任务)") @ApiOperation("带参数的任务处理(完成任务)")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result completeTaskByVariables(@RequestBody TaskDTO taskDTO){ public Result completeTaskByVariables(@RequestBody TaskDTO taskDTO) {
if(StringUtils.isEmpty(taskDTO.getTaskId())){ if (StringUtils.isEmpty(taskDTO.getTaskId())) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.completeTaskByVariables(taskDTO); actTaskService.completeTaskByVariables(taskDTO);
@ -158,12 +161,12 @@ public class ActTaskController {
@PostMapping("entrust") @PostMapping("entrust")
@ApiOperation("任务委托") @ApiOperation("任务委托")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType="String") @ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result taskEntrust(String taskId, String assignee){ public Result taskEntrust(String taskId, String assignee) {
if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(assignee)){ if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(assignee)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
String depositorId = SecurityUser.getUserId().toString(); String depositorId = SecurityUser.getUserId().toString();
@ -177,12 +180,12 @@ public class ActTaskController {
@GetMapping("getTaskVariables") @GetMapping("getTaskVariables")
@ApiOperation("获取流程变量") @ApiOperation("获取流程变量")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "variableName", value = "参数的键", paramType = "query", dataType="String") @ApiImplicitParam(name = "variableName", value = "参数的键", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result getTaskVariables(String taskId, String variableName){ public Result getTaskVariables(String taskId, String variableName) {
if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){ if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
return new Result().ok(actTaskService.getTaskVariables(taskId, variableName)); return new Result().ok(actTaskService.getTaskVariables(taskId, variableName));
@ -194,8 +197,8 @@ public class ActTaskController {
@PostMapping("updateTaskVariable") @PostMapping("updateTaskVariable")
@ApiOperation("更新任务变量") @ApiOperation("更新任务变量")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result updateTaskVariable(@RequestBody TaskDTO taskDTO){ public Result updateTaskVariable(@RequestBody TaskDTO taskDTO) {
if(StringUtils.isEmpty(taskDTO.getTaskId())){ if (StringUtils.isEmpty(taskDTO.getTaskId())) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.updateTaskVariable(taskDTO); actTaskService.updateTaskVariable(taskDTO);
@ -207,10 +210,10 @@ public class ActTaskController {
*/ */
@DeleteMapping("deleteTaskVariables") @DeleteMapping("deleteTaskVariables")
@ApiOperation("删除任务的所有变量") @ApiOperation("删除任务的所有变量")
@ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String") @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String")
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result deleteTaskVariables(String taskId){ public Result deleteTaskVariables(String taskId) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.deleteTaskVariables(taskId); actTaskService.deleteTaskVariables(taskId);
@ -223,13 +226,13 @@ public class ActTaskController {
@DeleteMapping("deleteVariable") @DeleteMapping("deleteVariable")
@ApiOperation("删除指定变量,默认删除本地变量") @ApiOperation("删除指定变量,默认删除本地变量")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "variableName", value = "变量名", paramType = "query", dataType="String"), @ApiImplicitParam(name = "variableName", value = "变量名", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "scope", value = "变量的范围local本地global,全局)", paramType = "query", dataType="String") @ApiImplicitParam(name = "scope", value = "变量的范围local本地global,全局)", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result deleteVariable(String taskId, String variableName, String scope){ public Result deleteVariable(String taskId, String variableName, String scope) {
if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){ if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.deleteTaskVariable(taskId, variableName, scope); actTaskService.deleteTaskVariable(taskId, variableName, scope);
@ -242,12 +245,12 @@ public class ActTaskController {
@PostMapping("backPreviousTask") @PostMapping("backPreviousTask")
@ApiOperation("回退任务到上一节点") @ApiOperation("回退任务到上一节点")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "回退审核意见", paramType = "query", dataType="String") @ApiImplicitParam(name = "comment", value = "回退审核意见", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result backPreviousTask(String taskId, String comment){ public Result backPreviousTask(String taskId, String comment) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.doBackPreviousTask(taskId, comment); actTaskService.doBackPreviousTask(taskId, comment);
@ -260,11 +263,11 @@ public class ActTaskController {
@PostMapping("endProcess") @PostMapping("endProcess")
@ApiOperation("终止流程") @ApiOperation("终止流程")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType="String") @ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result endProcess(String taskId, String comment){ public Result endProcess(String taskId, String comment) {
actTaskService.endProcess(taskId, comment); actTaskService.endProcess(taskId, comment);
return new Result(); return new Result();
} }
@ -275,12 +278,12 @@ public class ActTaskController {
@PostMapping("backToFirst") @PostMapping("backToFirst")
@ApiOperation("驳回,回退至第一个用户任务") @ApiOperation("驳回,回退至第一个用户任务")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType="String") @ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:task:all") // @RequiresPermissions("sys:task:all")
public Result backToFirst(String taskId, String comment){ public Result backToFirst(String taskId, String comment) {
if(StringUtils.isEmpty(taskId)){ if (StringUtils.isEmpty(taskId)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
actTaskService.backToFirst(taskId, comment); actTaskService.backToFirst(taskId, comment);

View File

@ -98,6 +98,8 @@ public class ResourceDTO implements Serializable {
private String enclosure; private String enclosure;
@ApiModelProperty(value = "下架理由") @ApiModelProperty(value = "下架理由")
private String undercarriageReason; private String undercarriageReason;
@ApiModelProperty(value = "提起下架人员姓名")
private String undercarriageUserName;
public String getDelFlagTip() { public String getDelFlagTip() {
if (this.delFlag != null) { if (this.delFlag != null) {

View File

@ -125,4 +125,10 @@ public class ResourceEntity extends BaseEntity {
* 下架理由 * 下架理由
*/ */
private String undercarriageReason; private String undercarriageReason;
/**
* 提起下架人员
*/
private String undercarriageUserName;
} }