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