From a94fce5066167b9d67cc797a1f950b308443ffae Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Mon, 8 Aug 2022 15:36:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=B3=BB=E7=BB=9F-=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0-=E9=83=A8=E9=97=A8=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8F=8A=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=B7=B2=E5=8A=9E=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=94=B3=E8=AF=B7=E7=94=A8=E6=88=B7=E6=89=80=E5=9C=A8?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=8F=8A=E7=94=B3=E8=AF=B7=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HistoryController.java | 7 ++++- .../activiti/dto/ProcessActivityDTO.java | 3 ++ .../renren/modules/activiti/dto/TaskDTO.java | 6 ++++ .../activiti/service/ActTaskService.java | 31 +++++++++++++++++++ .../io/renren/modules/sys/dao/SysUserDao.java | 2 ++ .../modules/sys/service/SysUserService.java | 1 + .../main/resources/mapper/sys/SysUserDao.xml | 4 +++ 7 files changed, 53 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java index 21a7b36a..6707483a 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java @@ -18,6 +18,7 @@ import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; +import io.renren.modules.sys.dao.SysUserDao; import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; @@ -79,6 +80,9 @@ public class HistoryController { @Autowired protected RuntimeService runtimeService; + @Autowired + private SysUserDao sysUserDao; + @GetMapping("getInstImage") @ApiOperation(value = "获取流程活动图", produces = "application/octet-stream") @LogOperation("获取流程活动图") @@ -195,6 +199,7 @@ public class HistoryController { if (StringUtils.isNotEmpty(activityDTO.getStartUserId())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getStartUserId())); activityDTO.setStartUserName(userDTO != null ? userDTO.getRealName() : ""); + activityDTO.setStartUserDeptName(sysUserDao.getDeptNameByUserId(userDTO.getId().toString())); } if (StringUtils.isNotEmpty(activityDTO.getAssignee())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getAssignee())); @@ -212,7 +217,7 @@ public class HistoryController { } if (abilityApplicationDTOS != null && !abilityApplicationDTOS.isEmpty()) { StringBuffer stringBuffer = new StringBuffer(); - abilityApplicationDTOS.stream().map(TAbilityApplicationDTO::getSystem).filter(index -> StringUtils.isNotEmpty(index)).forEach(index -> { + abilityApplicationDTOS.stream().map(TAbilityApplicationDTO::getSystem).filter(StringUtils::isNotEmpty).forEach(index -> { stringBuffer.append(index); stringBuffer.append(","); }); diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessActivityDTO.java b/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessActivityDTO.java index 4b316c89..f6165ca7 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessActivityDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessActivityDTO.java @@ -41,6 +41,9 @@ public class ProcessActivityDTO { @ApiModelProperty(value = "发起人姓名") private String startUserName; + @ApiModelProperty(value = "发起人部门名称") + private String startUserDeptName; + @ApiModelProperty(value = "受理人") private String assignee; diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java b/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java index ac1aa73f..80614c0a 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java @@ -29,6 +29,12 @@ public class TaskDTO { @ApiModelProperty(value = "用户名称") private String userName; + @ApiModelProperty(value = "用户部门名称") + private String userDeptName; + + @ApiModelProperty(value = "申请内容") + private String applyTitle; + @ApiModelProperty(value = "任务参数") private Map params; diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 3967c819..d4c62838 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -17,12 +17,17 @@ import io.renren.modules.demandComment.dto.TDemandCommentDTO; import io.renren.modules.demandComment.service.TDemandCommentService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; +import io.renren.modules.resource.dao.ResourceDao; import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.entity.ResourceEntity; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.security.user.SecurityUser; +import io.renren.modules.sys.dao.SysDeptDao; +import io.renren.modules.sys.dao.SysUserDao; import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.entity.SysDeptEntity; import io.renren.modules.sys.entity.SysUserEntity; import io.renren.modules.sys.service.SysRoleUserService; import io.renren.modules.sys.service.SysUserService; @@ -108,6 +113,12 @@ public class ActTaskService extends BaseServiceImpl { private ResourceService resourceService; @Autowired private SysUserService sysUserService; + @Autowired + private SysUserDao sysUserDao; + @Autowired + private SysDeptDao sysDeptDao; + @Autowired + private ResourceDao resourceDao; /** * 根据参数获取当前运行的任务信息 @@ -210,13 +221,18 @@ public class ActTaskService extends BaseServiceImpl { TaskDTO dto = new TaskDTO(); this.convertTaskInfo(task, dto); Map processVariable = new LinkedHashMap<>(); + + if (task.getProcessVariables().containsKey("tAbilityApplicationDTOList")) { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); + List dtoList = (List) task.getProcessVariables().get("tAbilityApplicationDTOList"); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(dtoList.get(0))); if (jsonObject != null) { dto.setUserName(jsonObject.containsKey("user") ? jsonObject.getString("user") : ""); + dto.setUserDeptName(sysUserDao.getDeptNameByUserId(jsonObject.containsKey("userId") ? jsonObject.getString("userId") : null)); + dto.setApplyTitle(jsonObject.containsKey("title") ? jsonObject.getString("title") : ""); } listDto.add(dto); continue; @@ -227,6 +243,8 @@ public class ActTaskService extends BaseServiceImpl { dto.setParams(processVariable); Optional creator = Optional.ofNullable(sysUserService.selectById(Long.parseLong(processVariable.get("creator").toString()))); dto.setUserName(creator.get().getRealName()); + dto.setApplyTitle(""); + dto.setUserDeptName(creator.get().getDeptName()); listDto.add(dto); continue; } @@ -239,6 +257,9 @@ public class ActTaskService extends BaseServiceImpl { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); dto.setUserName(abilityApplicationDTO.getUser()); + ResourceEntity resourceEntity = resourceDao.selectById(abilityApplicationDTO.getResourceId()); + dto.setApplyTitle(resourceEntity == null ? "" : resourceEntity.getName()); + dto.setUserDeptName(abilityApplicationDTO.getUnit()); listDto.add(dto); continue; } @@ -249,6 +270,9 @@ public class ActTaskService extends BaseServiceImpl { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); dto.setUserName(resourceMountApplyDTO.getUserName()); + SysDeptEntity dept = sysDeptDao.getById(Long.parseLong(resourceMountApplyDTO.getDeptId())); + dto.setUserDeptName(dept == null ? "" : dept.getName()); + dto.setApplyTitle(resourceMountApplyDTO.getResourceDTO().getName()); listDto.add(dto); continue; } @@ -259,6 +283,8 @@ public class ActTaskService extends BaseServiceImpl { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); dto.setUserName(tDemandDataDTO.getApplyUserName()); + dto.setUserDeptName(tDemandDataDTO.getApplyUserDeptName()); + dto.setApplyTitle(tDemandDataDTO.getDemandSubject()); listDto.add(dto); continue; } @@ -269,6 +295,9 @@ public class ActTaskService extends BaseServiceImpl { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); dto.setUserName(resourceDTO.getUndercarriageUserName()); + dto.setApplyTitle(resourceDTO.getName()); + SysDeptEntity dept = sysDeptDao.getById(resourceDTO.getUpdater()); + dto.setUserDeptName(dept == null ? "" : dept.getName()); listDto.add(dto); continue; } @@ -280,6 +309,8 @@ public class ActTaskService extends BaseServiceImpl { processVariable.putAll(task.getProcessVariables()); dto.setParams(processVariable); dto.setUserName(tDemandCommentDTO.getName()); + dto.setApplyTitle(tDemandCommentDTO.getComment()); + dto.setUserDeptName(tDemandCommentDTO.getCreateDeptName()); listDto.add(dto); continue; } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java index 3afee291..c7017178 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java @@ -45,4 +45,6 @@ public interface SysUserDao extends BaseDao { void batchSaveUser(@Param("list")List list); SysUserEntity getUserByName(@Param("username") String username); + + String getDeptNameByUserId(@Param("id") String id); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java b/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java index af53b03d..d1343513 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java @@ -5,6 +5,7 @@ import io.renren.common.service.BaseService; import io.renren.common.utils.Result; import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.entity.SysUserEntity; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; diff --git a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml index 68bee307..1aedde02 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml @@ -96,4 +96,8 @@ SELECT id,username FROM sys_user WHERE username = #{username} limit 1 + + \ No newline at end of file