From dedb813021285cea7397e16760381c6484e43923 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 09:57:18 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8A=A0=E5=85=A5=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/dto/ResourceDTO.java | 28 ++++++++-- .../entity/ResourceEntityDelFlag.java | 51 +++++++++++++++++++ 2 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index ce5bb875..a4ed16b9 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -1,6 +1,7 @@ package io.renren.modules.resource.dto; import io.renren.modules.resource.entity.AttrEntity; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,13 +9,14 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; +import java.util.Optional; /** -* 资源表 -* -* @author dg -* @since 1.0 2022-04-13 -*/ + * 资源表 + * + * @author dg + * @since 1.0 2022-04-13 + */ @Data @ApiModel(value = "资源表") public class ResourceDTO implements Serializable { @@ -54,6 +56,8 @@ public class ResourceDTO implements Serializable { private Long visits; @ApiModelProperty(value = "删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他") private Integer delFlag; + @ApiModelProperty(value = "删除标志tip:0:正常;1:已删除;2:待审核;3:审核中;9其他") + private String delFlagTip; @ApiModelProperty(value = "创建人") private Long creator; @ApiModelProperty(value = "创建时间") @@ -93,4 +97,18 @@ public class ResourceDTO implements Serializable { @ApiModelProperty(value = "附件") private String enclosure; + public String getDelFlagTip() { + if (this.delFlag != null) { + Optional resourceEntityDelFlagOptional = Optional.of(ResourceEntityDelFlag.getByFlag(this.delFlag)); + if (resourceEntityDelFlagOptional.isPresent()) { + return resourceEntityDelFlagOptional.get().getTip(); + } + return delFlagTip; + } + return delFlagTip; + } + + public void setDelFlagTip(String delFlagTip) { + this.delFlagTip = delFlagTip; + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java new file mode 100644 index 00000000..65eba940 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -0,0 +1,51 @@ +package io.renren.modules.resource.entity; + + +import java.util.Arrays; + +/** + * ResourceEntity del_flag 枚举 + */ +public enum ResourceEntityDelFlag { + + NORMAL(0, "正常"), + DELETED(1, "已删除"), + PENDING_REVIEW(2, "上架待审核"), + UNDER_REVIEW(3, "上架审核中"), + UNDERCARRIAGE_REVIEW(4, "下架审核中"), + UNDERCARRIAGE(5, "已下架"), + OTHER(9, "其他"); + + private int flag; + private String tip; + + ResourceEntityDelFlag(int flag, String tip) { + this.flag = flag; + this.tip = tip; + } + + public static ResourceEntityDelFlag getByFlag(int flag) { + if (flag < 1 || flag > ResourceEntityDelFlag.values().length) { + return null; + } + ResourceEntityDelFlag[] index = ResourceEntityDelFlag.values(); + return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(null); + } + + + public int getFlag() { + return flag; + } + + public void setFlag(int flag) { + this.flag = flag; + } + + public String getTip() { + return tip; + } + + public void setTip(String tip) { + this.tip = tip; + } +} From 104d3b51295e8fc1dbd87557d748aebc9a53aba4 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 10:15:46 +0800 Subject: [PATCH 02/22] ... --- .../java/io/renren/modules/resource/dto/ResourceDTO.java | 6 +++--- .../modules/resource/entity/ResourceEntityDelFlag.java | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index a4ed16b9..ec0f58e1 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -99,13 +99,13 @@ public class ResourceDTO implements Serializable { public String getDelFlagTip() { if (this.delFlag != null) { - Optional resourceEntityDelFlagOptional = Optional.of(ResourceEntityDelFlag.getByFlag(this.delFlag)); + Optional resourceEntityDelFlagOptional = Optional.ofNullable(ResourceEntityDelFlag.getByFlag(this.delFlag)); if (resourceEntityDelFlagOptional.isPresent()) { return resourceEntityDelFlagOptional.get().getTip(); } - return delFlagTip; + return ""; } - return delFlagTip; + return ""; } public void setDelFlagTip(String delFlagTip) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java index 65eba940..0f97a212 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -25,9 +25,6 @@ public enum ResourceEntityDelFlag { } public static ResourceEntityDelFlag getByFlag(int flag) { - if (flag < 1 || flag > ResourceEntityDelFlag.values().length) { - return null; - } ResourceEntityDelFlag[] index = ResourceEntityDelFlag.values(); return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(null); } From fd645cffeb8bd30116b06f08e837f1b850c30bfc Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 15:37:56 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8B=E6=9E=B6?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceMountController.java | 65 +++++++++- .../activiti/service/ActTaskService.java | 34 +++-- .../modules/resource/dto/ResourceDTO.java | 2 + .../resource/entity/ResourceEntity.java | 21 +--- .../entity/ResourceEntityDelFlag.java | 5 +- .../ResourceUndercarriageListener.java | 117 ++++++++++++++++++ .../dto/TResourceUndercarriageApplyDTO.java | 27 ++++ .../listener/ResourceOwnerListener.java | 3 - 8 files changed, 240 insertions(+), 34 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceUndercarriageApplyDTO.java diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 8bb305a2..6ab5a4b6 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -13,8 +13,12 @@ import io.renren.modules.activiti.dto.ProcessInstanceDTO; import io.renren.modules.activiti.dto.ProcessStartDTO; import io.renren.modules.activiti.service.ActProcessService; import io.renren.modules.activiti.service.ActRunningService; +import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; +import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceMountApply.dto.TResourceBatchMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; +import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -30,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; @Api(tags = "资源上架") @@ -44,12 +49,24 @@ public class ResourceMountController { private ActRunningService actRunningService; @Autowired private TResourceMountApplyService tResourceMountApplyService; - private static String key = "resourcemountapply"; + @Autowired + private ResourceService resourceService; - private static Map params = new HashMap() { + private static String apply_key = "resourcemountapply"; // 资源上架 + + private static String undercarriage_key = "resourcundercarriageapply"; // 资源下架 + + private static Map apply_params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", key); // 限定 能力资源上架 + put("key", apply_key); // 限定 能力资源上架 + } + }; + + private static Map undercarriage_params = new HashMap() { + { + put("isLatestVersion", true); // 取最新版本 + put("key", undercarriage_key); // 限定 资源下架 } }; @@ -58,7 +75,7 @@ public class ResourceMountController { @ApiOperation("批量进行能力上架申请") public Result> apply(@RequestBody TResourceBatchMountApplyDTO tResourceBatchMountApplyDTO) { // 仿照请求接口 /act/process/lastestPage - PageData> page = actProcessService.page(params); + PageData> page = actProcessService.page(apply_params); if (page.getTotal() <= 0) { // return new Result().error("联系管理员添加流程"); } @@ -85,7 +102,7 @@ public class ResourceMountController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey(key); // 限定资源上架 + processStartDTO.setProcessDefinitionKey(apply_key); // 限定资源上架 ObjectMapper oMapper = new ObjectMapper(); Map variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class); processStartDTO.setVariables(variables); @@ -103,4 +120,42 @@ public class ResourceMountController { return dto; }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); } + + @PostMapping(value = "/undercarriage") + @ApiOperation("批量进行能力下架申请") + public Result> undercarriage(@RequestBody TResourceUndercarriageApplyDTO tResourceUndercarriageApplyDTO) { + // 仿照请求接口 /act/process/lastestPage + PageData> page = actProcessService.page(undercarriage_params); + if (page.getTotal() <= 0) { // + return new Result().error("联系管理员添加流程"); + } + logger.info("---------------------------------------------------"); + logger.info(JSONObject.toJSONString(tResourceUndercarriageApplyDTO)); + logger.info("####################################################"); + return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> { + Long resourceId = Long.valueOf(index.get("resourceId")); + String resourceName = index.get("resourceName"); + Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); + resourceDTO.ifPresent(dto -> { + dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason()); + dto.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE_REVIEW.getFlag()); // 设置为下架审核中 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + resourceService.update(dto); + }); + + logger.info("-------------------1.保存申请表单成功--------------------------"); + // 仿照请求接口 /act/running/startOfBusinessKey + ProcessStartDTO processStartDTO = new ProcessStartDTO(); + processStartDTO.setBusinessKey(resourceId.toString()); + processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架 + ObjectMapper oMapper = new ObjectMapper(); + Map variables = oMapper.convertValue(resourceDTO, Map.class); + processStartDTO.setVariables(variables); + ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); + logger.info("-------------------2.启动流程成功--------------------------"); + logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey()); + + return dto; + }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); + } } 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 3b3137a2..fc65b942 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 @@ -12,6 +12,8 @@ import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; +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.security.user.SecurityUser; @@ -72,6 +74,8 @@ public class ActTaskService extends BaseServiceImpl { @Autowired private TDemandDataService tDemandDataService; + @Autowired + private ResourceService resourceService; /** * 根据参数获取当前运行的任务信息 @@ -115,25 +119,37 @@ public class ActTaskService extends BaseServiceImpl { for (Task task : list) { TaskDTO dto = new TaskDTO(); this.convertTaskInfo(task, dto); + ObjectMapper oMapper = new ObjectMapper(); + TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.get(Long.valueOf(dto.getBusinessKey())); - TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(dto.getBusinessKey())); - TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(dto.getBusinessKey())); if (abilityApplicationDTO != null) { - ObjectMapper oMapper = new ObjectMapper(); Map variables = oMapper.convertValue(abilityApplicationDTO, Map.class); dto.setParams(variables); - } else if (resourceMountApplyDTO != null) { - ObjectMapper oMapper = new ObjectMapper(); + listDto.add(dto); + continue; + } + TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(dto.getBusinessKey())); + if (resourceMountApplyDTO != null) { Map variables = oMapper.convertValue(resourceMountApplyDTO, Map.class); dto.setParams(variables); - } else if (tDemandDataDTO != null) { - ObjectMapper oMapper = new ObjectMapper(); + listDto.add(dto); + continue; + } + TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(dto.getBusinessKey())); + if (tDemandDataDTO != null) { Map variables = oMapper.convertValue(tDemandDataDTO, Map.class); dto.setParams(variables); + listDto.add(dto); + continue; + } + ResourceDTO resourceDTO = resourceService.get(Long.valueOf(dto.getBusinessKey())); + if (resourceDTO != null) { + Map variables = oMapper.convertValue(resourceDTO, Map.class); + dto.setParams(variables); + listDto.add(dto); + continue; } - - listDto.add(dto); } return new PageData<>(listDto, (int) taskQuery.count()); } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index ec0f58e1..42eab0dc 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -96,6 +96,8 @@ public class ResourceDTO implements Serializable { @ApiModelProperty(value = "附件") private String enclosure; + @ApiModelProperty(value = "下架理由") + private String undercarriageReason; public String getDelFlagTip() { if (this.delFlag != null) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 4a5d805f..86c1bad1 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -19,11 +19,6 @@ import java.util.Date; public class ResourceEntity extends BaseEntity { private static final long serialVersionUID = 1L; -// /** -// * 主键 -// */ -// @TableId(type = IdType.INPUT) -// private Long id; /** * 类型:基础设施,数据资源等 */ @@ -88,16 +83,7 @@ public class ResourceEntity extends BaseEntity { * 删除标志:0:正常;1:已删除;9其他 */ private Integer delFlag; -// /** -// * 创建人 -// */ -// @TableField(fill = FieldFill.INSERT) -// private Long creator; -// /** -// * 创建时间 -// */ -// @TableField(fill = FieldFill.INSERT) -// private Date createDate; + /** * 修改人 */ @@ -134,4 +120,9 @@ public class ResourceEntity extends BaseEntity { * 附件 */ private String enclosure; + + /** + * 下架理由 + */ + private String undercarriageReason; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java index 0f97a212..df8f4661 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -14,7 +14,8 @@ public enum ResourceEntityDelFlag { UNDER_REVIEW(3, "上架审核中"), UNDERCARRIAGE_REVIEW(4, "下架审核中"), UNDERCARRIAGE(5, "已下架"), - OTHER(9, "其他"); + OTHER(9, "其他"), + UNKNOWN(10, "未知"); private int flag; private String tip; @@ -26,7 +27,7 @@ public enum ResourceEntityDelFlag { public static ResourceEntityDelFlag getByFlag(int flag) { ResourceEntityDelFlag[] index = ResourceEntityDelFlag.values(); - return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(null); + return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(ResourceEntityDelFlag.UNKNOWN); } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java new file mode 100644 index 00000000..14683698 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -0,0 +1,117 @@ +package io.renren.modules.resource.listener; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.service.ResourceService; +import io.renren.modules.sys.dto.SysDeptDTO; +import io.renren.modules.sys.dto.SysRoleDTO; +import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.service.SysDeptService; +import io.renren.modules.sys.service.SysRoleService; +import io.renren.modules.sys.service.SysUserService; +import org.activiti.engine.TaskService; +import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.TaskListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.Map; + + +/** + * 资源下线审核 + */ +@Component +public class ResourceUndercarriageListener implements TaskListener { + private static Logger logger = LoggerFactory.getLogger(ResourceUndercarriageListener.class); + + @Value("${big_date.name}") + private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.assignee_role_name}") + private String roleName; // 具备审批的角色名称 + + @Autowired + private SysRoleService sysRoleService; + @Autowired + private TaskService taskService; + @Autowired + private SysUserService sysUserService; + + @Autowired + private SysDeptService sysDeptService; + @Autowired + private ResourceService resourceService; + + @Override + public void notify(DelegateTask delegateTask) { + logger.error("----------------------进入资源所有者节点---------------------------"); + logger.error("事件类型:" + delegateTask.getEventName()); + SysRoleDTO roleDTO = sysRoleService.getByName(roleName); + logger.error("roleDTOId:" + roleDTO.getId()); + final String eventName = delegateTask.getEventName(); + switch (eventName) { + case EVENTNAME_CREATE: // 创建当前审批节点事件 + create(delegateTask, roleDTO); + break; + default: + logger.error("未处理该事件:" + eventName); + } + logger.error("-----------------------结束资源所有者节点---------------------------"); + + } + + /** + * 节点创建时动态分配资源部门审核人 + * + * @param delegateTask + * @param roleDTO + */ + private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) { + Map kv = delegateTask.getVariables(); + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); + ; + if (re.getDeptId() != null) { + SysDeptDTO deptDTO = + sysDeptService.get(re.getDeptId()); + SysUserDTO userDTO = null; + if (deptDTO.getId() != null) { + userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); // 搜出审批人 + } + if (userDTO != null) { + logger.error("审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName()); + taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); + } else { + logger.error("未查到该部门对应的 " + roleName + " 将使用大数据部门审核人"); + defaultUser(delegateTask.getId(), roleDTO); + } + } else { + defaultUser(delegateTask.getId(), roleDTO); + } + } + + /** + * 未找到部门对应的审核人 + * + * @param taskId + */ + private void defaultUser(String taskId, final SysRoleDTO roleDTO) { + logger.error("大数据局名称:" + bigDateDeptName); + SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); + logger.error("roleDTOId:" + roleDTO.getId()); + SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); + + if (userDTO != null) { + logger.error("大数据审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName()); + taskService.setAssignee(taskId, userDTO.getId().toString()); + } else { + logger.error("未查到大数据部门对应 " + roleName); + taskService.setAssignee(taskId, "1516728698224427010"); + } + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceUndercarriageApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceUndercarriageApplyDTO.java new file mode 100644 index 00000000..f32a5b9f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceUndercarriageApplyDTO.java @@ -0,0 +1,27 @@ +package io.renren.modules.resourceMountApply.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + + +@Data +@ApiModel(value = "资源下架申请表单") +public class TResourceUndercarriageApplyDTO implements Serializable { + @ApiModelProperty(value = "下架申请人id") + private String userId; + @ApiModelProperty(value = "下架申请人名字") + private String userName; + @ApiModelProperty(value = "下架申请人电话") + private String phone; + @ApiModelProperty(value = "下架申请人部门") + private String deptId; + @ApiModelProperty(value = "待下架的资源 id、资源名称 键值对") + private List> resource; + @ApiModelProperty(value = "下架原因") + private String reason; +} diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java index 69f6bc89..82cbe990 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java @@ -80,9 +80,6 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A case EVENTNAME_CREATE: // 创建当前审批节点事件 create(delegateTask, roleDTO); break; -// case EVENTNAME_COMPLETE: -// complete(delegateTask); -// break; default: logger.error("未处理该事件:" + eventName); } From dd261257b869bb30874b822f7bcf1ded58216591 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 16:17:05 +0800 Subject: [PATCH 04/22] =?UTF-8?q?npe=20=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E9=97=A8id=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/common/controller/DemandDataController.java | 2 +- .../renren/modules/demanData/listener/DemandDataListener.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index 30589197..242ed284 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -31,7 +31,7 @@ import java.util.Map; @RestController @RequestMapping("/demand_v2/center") public class DemandDataController { - private static Logger logger = LoggerFactory.getLogger(ResourceMountController.class); + private static Logger logger = LoggerFactory.getLogger(DemandDataController.class); @Autowired private ActProcessService actProcessService; diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java index 6d8093fe..bc85748f 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java @@ -119,7 +119,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti JsonElement jsonElement = gson.toJsonTree(kv); TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class); - if (demandDataDTO != null) { + if (demandDataDTO != null && demandDataDTO.getApplyUserDeptId() != null) { logger.error(JSONObject.toJSONString(demandDataDTO)); SysDeptDTO deptDTO = sysDeptService.get(Long.valueOf(demandDataDTO.getApplyUserDeptId())); From d0ae22658501ac97fdbefa443c12b94a34d87616 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 17:21:57 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=B8=8B=E6=9E=B6=E5=8F=91=E8=B5=B7=E4=BA=BA=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceMountController.java | 10 ++ .../controller/ActTaskController.java | 115 +++++++++--------- .../modules/resource/dto/ResourceDTO.java | 2 + .../resource/entity/ResourceEntity.java | 6 + 4 files changed, 77 insertions(+), 56 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 6ab5a4b6..4a59de53 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -20,6 +20,9 @@ import io.renren.modules.resourceMountApply.dto.TResourceBatchMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO; 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.ApiOperation; import org.codehaus.jackson.map.ObjectMapper; @@ -51,6 +54,8 @@ public class ResourceMountController { private TResourceMountApplyService tResourceMountApplyService; @Autowired private ResourceService resourceService; + @Autowired + private SysUserService sysUserService; private static String apply_key = "resourcemountapply"; // 资源上架 @@ -139,6 +144,11 @@ public class ResourceMountController { resourceDTO.ifPresent(dto -> { dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason()); dto.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE_REVIEW.getFlag()); // 设置为下架审核中 + String userId = SecurityUser.getUserId().toString(); + Optional userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId))); + userDTO.ifPresent(user -> { + dto.setUndercarriageUserName(user.getRealName()); + }); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); resourceService.update(dto); }); diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 1a535d7e..642146ba 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -14,7 +14,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -24,11 +23,12 @@ import java.util.Map; /** * 任务管理 + * * @author Jone */ @RestController @RequestMapping("/act/task") -@Api(tags="任务管理") +@Api(tags = "任务管理") public class ActTaskController { @Autowired private ActTaskService actTaskService; @@ -38,40 +38,42 @@ public class ActTaskController { /** * 获取用户任务列表 * 根据用户ID或角色组获取任务信息 + * * @return */ @GetMapping("page") @ApiOperation("待办任务,默认查询所有待办任务。根据用户ID或角色ID查询个人或组的任务") @ApiImplicitParams({ - @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 = "roleIds", value = "roleIds", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "userId", value = "userId", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "isRoleGroup", value = "是否查询分组", paramType = "query", dataType="String") + @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 = "roleIds", value = "roleIds", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "userId", value = "userId", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "isRoleGroup", value = "是否查询分组", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result> queryUserTaskPage(@ApiIgnore @RequestParam Map params){ + public Result> queryUserTaskPage(@ApiIgnore @RequestParam Map params) { PageData page = actTaskService.page(params); return new Result>().ok(page); } /** * 我的待办列表 + * * @return */ @GetMapping("myToDoTaskPage") @ApiOperation("我的待办列表") @ApiImplicitParams({ - @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 = "taskName", value = "任务名称", paramType = "query", dataType="String") + @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 = "taskName", value = "任务名称", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result> myToDoTaskPage(@ApiIgnore @RequestParam Map params){ + public Result> myToDoTaskPage(@ApiIgnore @RequestParam Map params) { params.put("userId", SecurityUser.getUserId().toString()); PageData page = actTaskService.page(params); - for(TaskDTO taskDTO : page.getList()){ - if(!StringUtils.isEmpty(taskDTO.getAssignee())){ + for (TaskDTO taskDTO : page.getList()) { + if (!StringUtils.isEmpty(taskDTO.getAssignee())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(taskDTO.getAssignee())); taskDTO.setAssigneeName(userDTO.getRealName()); } @@ -86,7 +88,7 @@ public class ActTaskController { @ApiOperation("获取任务详情") @LogOperation("获取任务详情") // @RequiresPermissions("sys:task:all") - public Result getTaskById(@PathVariable("id") String id){ + public Result getTaskById(@PathVariable("id") String id) { TaskDTO task = actTaskService.taskDetail(id); return new Result().ok(task); } @@ -96,10 +98,10 @@ public class ActTaskController { */ @PostMapping("claim") @ApiOperation("认领任务") - @ApiImplicitParam(name = "taskId", value = "taskId", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "taskId", paramType = "query", dataType = "String") // @RequiresPermissions("sys:task:all") - public Result claimTask(String taskId){ - if(StringUtils.isEmpty(taskId)){ + public Result claimTask(String taskId) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.claimTask(taskId); @@ -111,10 +113,10 @@ public class ActTaskController { */ @PostMapping("unclaim") @ApiOperation("释放任务") - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String") // @RequiresPermissions("sys:task:all") - public Result unclaimTask(String taskId){ - if(StringUtils.isEmpty(taskId)){ + public Result unclaimTask(String taskId) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.unclaimTask(taskId); @@ -127,25 +129,26 @@ public class ActTaskController { @PostMapping("complete") @ApiOperation("任务处理(完成任务)") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "comment", value = "审批意见", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "comment", value = "审批意见", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result completeTask(String taskId, String comment){ - if(StringUtils.isEmpty(taskId)){ + public Result completeTask(String taskId, String comment) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.completeTask(taskId, comment); return new Result(); } + /** * 带参数的任务处理 */ @PostMapping("completeByVariables") @ApiOperation("带参数的任务处理(完成任务)") // @RequiresPermissions("sys:task:all") - public Result completeTaskByVariables(@RequestBody TaskDTO taskDTO){ - if(StringUtils.isEmpty(taskDTO.getTaskId())){ + public Result completeTaskByVariables(@RequestBody TaskDTO taskDTO) { + if (StringUtils.isEmpty(taskDTO.getTaskId())) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.completeTaskByVariables(taskDTO); @@ -158,12 +161,12 @@ public class ActTaskController { @PostMapping("entrust") @ApiOperation("任务委托") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result taskEntrust(String taskId, String assignee){ - if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(assignee)){ + public Result taskEntrust(String taskId, String assignee) { + if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(assignee)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } String depositorId = SecurityUser.getUserId().toString(); @@ -177,12 +180,12 @@ public class ActTaskController { @GetMapping("getTaskVariables") @ApiOperation("获取流程变量") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "variableName", value = "参数的键", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "variableName", value = "参数的键", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result getTaskVariables(String taskId, String variableName){ - if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){ + public Result getTaskVariables(String taskId, String variableName) { + if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } return new Result().ok(actTaskService.getTaskVariables(taskId, variableName)); @@ -194,8 +197,8 @@ public class ActTaskController { @PostMapping("updateTaskVariable") @ApiOperation("更新任务变量") // @RequiresPermissions("sys:task:all") - public Result updateTaskVariable(@RequestBody TaskDTO taskDTO){ - if(StringUtils.isEmpty(taskDTO.getTaskId())){ + public Result updateTaskVariable(@RequestBody TaskDTO taskDTO) { + if (StringUtils.isEmpty(taskDTO.getTaskId())) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.updateTaskVariable(taskDTO); @@ -207,10 +210,10 @@ public class ActTaskController { */ @DeleteMapping("deleteTaskVariables") @ApiOperation("删除任务的所有变量") - @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String") // @RequiresPermissions("sys:task:all") - public Result deleteTaskVariables(String taskId){ - if(StringUtils.isEmpty(taskId)){ + public Result deleteTaskVariables(String taskId) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.deleteTaskVariables(taskId); @@ -223,13 +226,13 @@ public class ActTaskController { @DeleteMapping("deleteVariable") @ApiOperation("删除指定变量,默认删除本地变量") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "variableName", value = "变量名", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "scope", value = "变量的范围(local:本地;global,全局)", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "variableName", value = "变量名", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "scope", value = "变量的范围(local:本地;global,全局)", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result deleteVariable(String taskId, String variableName, String scope){ - if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){ + public Result deleteVariable(String taskId, String variableName, String scope) { + if (StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.deleteTaskVariable(taskId, variableName, scope); @@ -242,12 +245,12 @@ public class ActTaskController { @PostMapping("backPreviousTask") @ApiOperation("回退任务到上一节点") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "comment", value = "回退审核意见", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "comment", value = "回退审核意见", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result backPreviousTask(String taskId, String comment){ - if(StringUtils.isEmpty(taskId)){ + public Result backPreviousTask(String taskId, String comment) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.doBackPreviousTask(taskId, comment); @@ -260,11 +263,11 @@ public class ActTaskController { @PostMapping("endProcess") @ApiOperation("终止流程") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result endProcess(String taskId, String comment){ + public Result endProcess(String taskId, String comment) { actTaskService.endProcess(taskId, comment); return new Result(); } @@ -275,12 +278,12 @@ public class ActTaskController { @PostMapping("backToFirst") @ApiOperation("驳回,回退至第一个用户任务") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType="String") + @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result backToFirst(String taskId, String comment){ - if(StringUtils.isEmpty(taskId)){ + public Result backToFirst(String taskId, String comment) { + if (StringUtils.isEmpty(taskId)) { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.backToFirst(taskId, comment); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index 42eab0dc..cedae88f 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -98,6 +98,8 @@ public class ResourceDTO implements Serializable { private String enclosure; @ApiModelProperty(value = "下架理由") private String undercarriageReason; + @ApiModelProperty(value = "提起下架人员姓名") + private String undercarriageUserName; public String getDelFlagTip() { if (this.delFlag != null) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 86c1bad1..633c24a7 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -125,4 +125,10 @@ public class ResourceEntity extends BaseEntity { * 下架理由 */ private String undercarriageReason; + + + /** + * 提起下架人员 + */ + private String undercarriageUserName; } \ No newline at end of file From a53b817aec5fb29b06a762f473afdd92a0e754bf Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 09:13:40 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/controller/ResourceController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 15133d08..ddfa38d3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -65,11 +65,18 @@ public class ResourceController { return new Result<>().ok(resourceService.pageWithAttrs(jsonObject)); } + @GetMapping("/{id}") + @ApiOperation("信息") + public Result get(@PathVariable("id") Long id) { + ResourceDTO data = resourceService.get(id); + return new Result().ok(data); + } + @GetMapping("/select/{id}") @ApiOperation("查询资源详细信息") @LogOperation("查询资源详细信息") //@RequiresPermissions("resource:resource:info") - public Result get(@PathVariable("id") Long id) { + public Result select(@PathVariable("id") Long id) { ResourceDTO data = resourceService.selectWithAttrs(id); return new Result().ok(data); } From 830c09feafe34cf7ea9e6c14c4127a91e98bec60 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 09:47:23 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E4=B8=8B=E6=9E=B6=E9=80=9A=E8=BF=87=20?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=8A=B6=E6=80=81=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ResourceEntityDelFlag.java | 24 ++++++++++++++ .../ResourceUndercarriageListener.java | 33 +++++++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java index df8f4661..f6dd149a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -8,13 +8,37 @@ import java.util.Arrays; */ public enum ResourceEntityDelFlag { + /** + * 正常 + */ NORMAL(0, "正常"), + /** + * 已删除 + */ DELETED(1, "已删除"), + /** + * 上架待审核 + */ PENDING_REVIEW(2, "上架待审核"), + /** + * 上架审核中 + */ UNDER_REVIEW(3, "上架审核中"), + /** + * 下架审核中 + */ UNDERCARRIAGE_REVIEW(4, "下架审核中"), + /** + * 已下架 + */ UNDERCARRIAGE(5, "已下架"), + /** + * 其他 + */ OTHER(9, "其他"), + /** + * 未知 + */ UNKNOWN(10, "未知"); private int flag; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 14683698..dfa97fc2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -3,6 +3,7 @@ package io.renren.modules.resource.listener; import com.google.gson.Gson; import com.google.gson.JsonElement; import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -11,7 +12,9 @@ import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysRoleService; import io.renren.modules.sys.service.SysUserService; import org.activiti.engine.TaskService; +import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.ExecutionListener; import org.activiti.engine.delegate.TaskListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +29,7 @@ import java.util.Map; * 资源下线审核 */ @Component -public class ResourceUndercarriageListener implements TaskListener { +public class ResourceUndercarriageListener implements TaskListener, ExecutionListener { private static Logger logger = LoggerFactory.getLogger(ResourceUndercarriageListener.class); @Value("${big_date.name}") @@ -64,6 +67,31 @@ public class ResourceUndercarriageListener implements TaskListener { } + @Override + public void notify(DelegateExecution execution) throws Exception { + logger.error("----------------------进入审批通过节点---------------------------"); + logger.error("事件类型:" + execution.getEventName()); + final String eventName = execution.getEventName(); + + switch (eventName) { + case EVENTNAME_END: { + endTake(execution.getVariables()); + } + break; + } + } + + private void endTake(Map kv) { // 进入最后结束节点 + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); + if (re != null) { + re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); + resourceService.update(re); + logger.error("审批通过!资源id:" + re.getId()); + } + } + /** * 节点创建时动态分配资源部门审核人 * @@ -75,7 +103,6 @@ public class ResourceUndercarriageListener implements TaskListener { Gson gson = new Gson(); JsonElement jsonElement = gson.toJsonTree(kv); ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); - ; if (re.getDeptId() != null) { SysDeptDTO deptDTO = sysDeptService.get(re.getDeptId()); @@ -114,4 +141,6 @@ public class ResourceUndercarriageListener implements TaskListener { taskService.setAssignee(taskId, "1516728698224427010"); } } + + } From a00007992a8543fcd48e43849f53e2a367fcd862 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 09:59:39 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E5=85=8D=E6=89=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=BB=98=E8=AE=A4=E5=AE=A1=E6=A0=B8=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/CorrectionListener.java | 9 ++++++++ .../listener/DataCenterListener.java | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 82b6acbd..04e4828d 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Map; +import java.util.Optional; /** * 部门动态审批人 @@ -160,5 +161,13 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti logger.error("未查到该部门对应的 " + roleName); taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); } + + Optional resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId()))); + resourceDTOOptional.ifPresent(resource -> { + if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请 + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过"); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + } + }); } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java index 03f307e5..24cf119c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java @@ -1,5 +1,10 @@ package io.renren.modules.processForm.listener; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import io.renren.modules.processForm.dto.TAbilityApplicationDTO; +import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.service.ResourceService; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; import io.renren.modules.sys.dto.SysUserDTO; @@ -17,6 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import java.util.Map; +import java.util.Optional; + /** * 大数据局动态审批人 */ @@ -39,6 +47,8 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti private SysRoleUserService sysRoleUserService; @Autowired private SysDeptService sysDeptService; + @Autowired + private ResourceService resourceService; @Override public void notify(DelegateExecution delegateExecution) throws Exception { @@ -96,5 +106,18 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti delegateTask.setAssignee("1516728698224427010"); logger.info("未查到该部门对应 " + roleName); } + + Map kv = delegateTask.getVariables(); + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); + Optional resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId()))); + resourceDTOOptional.ifPresent(resource -> { + if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请 + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过"); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + } + }); + } } From 49bf48472af63fe425f4cca0dd83cb896d0530ad Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 10:22:47 +0800 Subject: [PATCH 09/22] ... --- .../service/impl/ResourceServiceImpl.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 2dd7d33b..84be6859 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -15,6 +15,7 @@ import io.renren.modules.resource.dao.ResourceDao; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.ResourceEntity; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceCar.dao.ResourceCarDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; @@ -72,13 +73,8 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); item.setDataResourceId(resourceID); attrDao.insert(item); }); @@ -130,7 +126,7 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); attrDao.insert(item); }); } @@ -144,7 +140,7 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", id) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); List attrEntities = attrDao.selectList(wrapper); resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe? return resourceDTO; @@ -189,7 +185,7 @@ public class ResourceServiceImpl extends CrudServiceImpl selectAttrsByResourceId(Long resourceId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", resourceId) - .eq("del_flag", 0) + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) .orderByDesc("attr_type"); return attrDao.selectList(wrapper); } @@ -212,7 +208,7 @@ public class ResourceServiceImpl extends CrudServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("create_date") .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); IPage entityIPage = resourceDao.selectPage(page, queryWrapper); return entityIPage; @@ -225,7 +221,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceDTOS = resourceDao.selectMostPopular(selectMap); page.setRecords(resourceDTOS); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("del_flag", 0).eq("type", jsonObject.getString("type")); + queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type")); Integer count = resourceDao.selectCount(queryWrapper); page.setTotal(count); return page; @@ -239,7 +235,7 @@ public class ResourceServiceImpl extends CrudServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() .eq(ResourceEntity::getId, resourceEntity.getId()) - .eq(ResourceEntity::getDelFlag, 0); + .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); resourceDao.update(entity, updateWrapper); } From 8684700c19c1a7389506d7b503d596e0cdbad5b7 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 10:45:03 +0800 Subject: [PATCH 10/22] ... --- .../src/main/resources/mapper/resourceCar/ResourceCarDao.xml | 2 +- .../mapper/resourceCollection/ResourceCollectionDao.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml index be86b2f9..ab9d3efd 100644 --- a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml @@ -45,7 +45,7 @@ select trc.* from tb_resource_car trc - left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag = 0 + left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag != 1 where 1 = 1 and trc.del_flag = 0 diff --git a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml index 4850bebf..acd8783a 100644 --- a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml @@ -57,7 +57,7 @@ SELECT trc.* FROM tb_resource_collection trc - LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag = 0 + LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1 WHERE 1 = 1 AND trc.del_flag = 0 From 87e93469e857c0c1c40b437bc92c61d34d70d815 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:19:37 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=AE=80=E7=95=A5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- renren-admin/src/main/resources/mapper/resource/ResourceDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 49df40fd..95b259f5 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -214,7 +214,7 @@ GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 - AND tdr.del_flag = 0 + AND tdr.id = #{id} From c5377cb7f3f183ede44e27f6c381c2f195cf05e5 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:28:19 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/controller/ResourceController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index ddfa38d3..495b5bb2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -50,7 +50,9 @@ public class ResourceController { @ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String") }) public Result> page(@ApiIgnore @RequestParam Map params) { - params.put("del_flag", 0); + if (!params.containsKey("del_flag")) { + params.put("del_flag", 0); + } PageData page = resourceService.page(params); page.getList().forEach(item -> { item.setInfoList(resourceService.selectAttrsByResourceId(item.getId())); From a2eefd990d6accd4f17d04362a7571876f241e72 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:33:24 +0800 Subject: [PATCH 13/22] ... --- .../resource/listener/ResourceUndercarriageListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index dfa97fc2..27d9e6fc 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -88,7 +88,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis if (re != null) { re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); resourceService.update(re); - logger.error("审批通过!资源id:" + re.getId()); + logger.error("下架审批通过!资源id:" + re.getId()); } } From 0f92ae06e544e7211f1b06decd95c9bc85b7ab62 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:39:11 +0800 Subject: [PATCH 14/22] ... --- .../resource/listener/ResourceUndercarriageListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 27d9e6fc..983ac5a2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -81,6 +81,11 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis } } + /** + * 下架审核通过 + * + * @param kv + */ private void endTake(Map kv) { // 进入最后结束节点 Gson gson = new Gson(); JsonElement jsonElement = gson.toJsonTree(kv); From aeaffb269fafb7e60685369e8eb8c2355424ff0a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:48:30 +0800 Subject: [PATCH 15/22] ... --- .../modules/resource/listener/ResourceUndercarriageListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 983ac5a2..a48f4cc0 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -79,6 +79,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis } break; } + logger.error("----------------------结束审批通过节点---------------------------"); } /** From b59b830beb0677c5bf5449478edde69e3345b6ac Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 11:51:57 +0800 Subject: [PATCH 16/22] ... --- .../modules/resource/listener/ResourceUndercarriageListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index a48f4cc0..9adce283 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -72,7 +72,6 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis logger.error("----------------------进入审批通过节点---------------------------"); logger.error("事件类型:" + execution.getEventName()); final String eventName = execution.getEventName(); - switch (eventName) { case EVENTNAME_END: { endTake(execution.getVariables()); From cd7831e68ccd790da6fa2f608957e9ddcbcf892a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 12:53:04 +0800 Subject: [PATCH 17/22] ... --- .../resource/listener/ResourceUndercarriageListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 9adce283..eaadd9e1 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -93,7 +93,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis if (re != null) { re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); resourceService.update(re); - logger.error("下架审批通过!资源id:" + re.getId()); + logger.error("下架审批通过 资源id:" + re.getId()); } } From 105b6b536ce33dfd4cb01fd983934c9aac109fe6 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 15:31:48 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=95=B0=E7=9B=AE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusController.java | 68 +++++ .../activiti/service/ActHistoryService.java | 10 + .../modules/resource/dao/ResourceDao.java | 25 +- .../resource/service/ResourceService.java | 4 +- .../service/impl/ResourceServiceImpl.java | 6 + .../modules/security/config/ShiroConfig.java | 1 + .../io/renren/modules/sys/dao/SysUserDao.java | 2 + .../modules/sys/service/SysUserService.java | 7 + .../sys/service/impl/SysUserServiceImpl.java | 10 + .../src/main/resources/application.yml | 3 + .../resources/mapper/resource/ResourceDao.xml | 240 ++++++++++-------- .../main/resources/mapper/sys/SysUserDao.xml | 12 +- 12 files changed, 272 insertions(+), 116 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/common/controller/CensusController.java diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java new file mode 100644 index 00000000..42eac9cd --- /dev/null +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -0,0 +1,68 @@ +package io.renren.common.controller; + + +import io.renren.common.utils.Result; +import io.renren.modules.resource.service.ResourceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 统计 + */ +@Api(tags = "全局统计中心") +@RestController +@RequestMapping("/census/center") +public class CensusController { + + private static Logger logger = LoggerFactory.getLogger(CensusController.class); + + @Autowired + private ResourceService resourceService; + + @Value("${census.type}") + private String[] censusTypes; // 大数据局名称 + + + /** + * 获取各类资源数目 + * + * @return + */ + @GetMapping(value = "/resource_amount") + @ApiOperation("各类资源数目") + public Result>> resourceAmount() { + List> dbAmount = resourceService.getAmountGroupByType(); + List temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList()); + Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型 + Map nullMap = new HashMap() { + { + put("amount", 0); + put("type", index); + } + }; + dbAmount.add(nullMap); + }); + Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); + Map sumMap = new HashMap() { + { + put("amount", sum); + put("type", "资源汇聚总量"); + } + }; + dbAmount.add(sumMap); + return new Result>>().ok(dbAmount); + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index 4604ead3..82c3af1c 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -6,6 +6,8 @@ import io.renren.modules.activiti.dto.ProcessInstanceDTO; import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; +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.security.user.SecurityUser; @@ -72,6 +74,8 @@ public class ActHistoryService { @Autowired private SysUserService sysUserService; + @Autowired + private ResourceService resourceService; @Autowired private TAbilityApplicationService tAbilityApplicationService; @@ -267,6 +271,12 @@ public class ActHistoryService { if (resourceMountApplyDTO != null) { dto.setName(resourceMountApplyDTO.getResourceDTO().getName()); dto.setResourceId(resourceMountApplyDTO.getResourceDTO().getId().toString()); + } else { + ResourceDTO resourceDTO = resourceService.get(Long.valueOf(dto.getBusinessKey())); + if (resourceDTO != null) { + dto.setName(resourceDTO.getName()); + dto.setResourceId(resourceDTO.getId().toString()); + } } } } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index df9d23b0..f2da6ec5 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -3,6 +3,7 @@ package io.renren.modules.resource.dao; import io.renren.common.dao.BaseDao; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.entity.ResourceEntity; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -10,11 +11,11 @@ import java.util.List; import java.util.Map; /** -* 资源表 -* -* @author dg -* @since 1.0 2022-04-13 -*/ + * 资源表 + * + * @author dg + * @since 1.0 2022-04-13 + */ @Mapper public interface ResourceDao extends BaseDao { @@ -28,13 +29,21 @@ public interface ResourceDao extends BaseDao { List selectMostPopular(Map selectMap); - ResourceDTO selectDTOById(@Param("id") Long id,@Param("userId") Long userId); + ResourceDTO selectDTOById(@Param("id") Long id, @Param("userId") Long userId); - List selectDTOPage(@Param("dto")ResourceDTO resourceDTO, + List selectDTOPage(@Param("dto") ResourceDTO resourceDTO, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize, - @Param("orderField")String orderField, + @Param("orderField") String orderField, @Param("orderType") String orderType); List selectApplyArea(Long userId); + + /** + * 获取各类资源数目 + * + * @return + */ + @MapKey("type") + List> getAmountGroupByType(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index 38bb0a81..b9a31045 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -7,11 +7,12 @@ import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.ResourceEntity; import java.util.List; +import java.util.Map; /** * 资源表 * - * @author dg + * @author dg * @since 1.0 2022-04-13 */ public interface ResourceService extends CrudService { @@ -38,4 +39,5 @@ public interface ResourceService extends CrudService> getAmountGroupByType(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 84be6859..479bfe96 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -251,4 +251,10 @@ public class ResourceServiceImpl extends CrudServiceImpl> getAmountGroupByType() { + List> amountInfo = resourceDao.getAmountGroupByType(); + return amountInfo; + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/security/config/ShiroConfig.java b/renren-admin/src/main/java/io/renren/modules/security/config/ShiroConfig.java index c07aa65d..9c6b1a12 100644 --- a/renren-admin/src/main/java/io/renren/modules/security/config/ShiroConfig.java +++ b/renren-admin/src/main/java/io/renren/modules/security/config/ShiroConfig.java @@ -77,6 +77,7 @@ public class ShiroConfig { */ filterMap.put("/upload", "anon"); filterMap.put("/upload/**", "anon"); + filterMap.put("/census/center/**", "anon"); // 全局各类统计 filterMap.put("/**", "oauth2"); shiroFilter.setFilterChainDefinitionMap(filterMap); 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 77367991..a2976bd7 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 @@ -39,4 +39,6 @@ public interface SysUserDao extends BaseDao { * @return */ SysUserEntity getByDeptIdAndRoleId(@Param("deptId") Long deptId, @Param("roleId") Long roleId); + + Long countAllUser(); } \ 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 a27655b1..f285c8e8 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 @@ -48,4 +48,11 @@ public interface SysUserService extends BaseService { SysUserDTO getByDeptIdAndRoleId(Long deptId, Long roleId); + /** + * 统计所有有效的用户 + * + * @return + */ + Long countAllUser(); + } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java index 7fdc78da..9dc62803 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java @@ -167,4 +167,14 @@ public class SysUserServiceImpl extends BaseServiceImpl #{item} @@ -104,14 +104,19 @@ IFNULL(trc.collectCount, 0) AS "collectCount", IFNULL(sd.name, '暂无部门信息') AS "deptName", IFNULL(trc2.isCollect, 'false') AS "isCollect", - (IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS total + (IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS + total FROM tb_data_resource tdr LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id - LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id - LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id - LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id - LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" FROM tb_resource_collection WHERE + LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP + BY resource_id ) trs ON tdr.id = trs.resource_id + LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = + 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id + LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag + = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id + LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" + FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} @@ -121,18 +126,18 @@ WHERE 1 = 1 AND tdr.type = #{dto.type} AND tdr.del_flag = 0 - + AND tdr.name like CONCAT('%',#{dto.name},'%') - - AND tdr.district_id = #{dto.districtId} + + AND tdr.district_id = #{dto.districtId} - - AND tdr.dept_id = #{dto.deptId} + + AND tdr.dept_id = #{dto.deptId} AND - tda.data_resource_id IN ( + tda.data_resource_id IN ( SELECT data_resource_id FROM ( SELECT tb.data_resource_id @@ -153,102 +158,115 @@ SELECT - * + * FROM - ( - SELECT - attr_value, - IFNULL( COUNT( trc.id ), 0 ) AS "colCount", - IFNULL( COUNT( taa.id ), 0 ) AS "aplCount", - ( - IFNULL( COUNT( trc.id ), 0 ) + IFNULL( COUNT( taa.id ), 0 )) AS total - FROM - tb_data_attr tda - LEFT JOIN tb_resource_collection trc ON tda.data_resource_id = trc.resource_id - AND trc.del_flag = 0 - AND trc.user_id = #{userId} - LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id - AND taa.del_flag = 0 - AND taa.user_id = #{userId} + ( + SELECT + attr_value, + IFNULL( COUNT( trc.id ), 0 ) AS "colCount", + IFNULL( COUNT( taa.id ), 0 ) AS "aplCount", + ( + IFNULL( COUNT( trc.id ), 0 ) + IFNULL( COUNT( taa.id ), 0 )) AS total + FROM + tb_data_attr tda + LEFT JOIN tb_resource_collection trc ON tda.data_resource_id = trc.resource_id + AND trc.del_flag = 0 + AND trc.user_id = #{userId} + LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id + AND taa.del_flag = 0 + AND taa.user_id = #{userId} - WHERE - 1 = 1 - AND tda.attr_type = '应用领域' - AND tda.del_flag = 0 - AND ( attr_value != '' AND attr_value IS NOT NULL ) - GROUP BY - attr_value - ORDER BY - total DESC - ) temp WHERE - temp.total != 0 + 1 = 1 + AND tda.attr_type = '应用领域' + AND tda.del_flag = 0 + AND ( attr_value != '' AND attr_value IS NOT NULL ) + GROUP BY + attr_value + ORDER BY + total DESC + ) temp + WHERE + temp.total != 0 + + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml index 74716fed..425e7868 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml @@ -6,10 +6,10 @@ + \ No newline at end of file From 53efbf246e3e1a6b63871d9ebb319576f9d75992 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 15:58:41 +0800 Subject: [PATCH 19/22] ... --- .../modules/processForm/listener/CorrectionListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 04e4828d..46c25d8c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -105,11 +105,13 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti Gson gson = new Gson(); JsonElement jsonElement = gson.toJsonTree(kv); TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); - if (abilityApplicationDTO != null) { + if (abilityApplicationDTO != null && abilityApplicationDTO.getId() != null) { abilityApplicationDTO.setDelFlag(0); abilityApplicationDTO.setApproveStatus("通过"); tAbilityApplicationService.update(abilityApplicationDTO); logger.error("审批通过!申请id:" + abilityApplicationDTO.getId()); + } else { + logger.error(kv.toString()); } } From 0014610f589b2088f700505c1f426e0274143ad9 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 16:00:58 +0800 Subject: [PATCH 20/22] ... --- .../renren/modules/processForm/listener/CorrectionListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 46c25d8c..79f51409 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -142,6 +142,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti logger.error("第二级别审批仍然为 " + bigDateDeptName); taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过"); taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + endTake(delegateTask.getVariables()); } } else { logger.error("表单内单位名称:" + abilityApplicationDTO.getUnit()); From 7c99310df7eff04ba846488e244d6048d3ab65f6 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 16:01:46 +0800 Subject: [PATCH 21/22] ... --- .../renren/modules/processForm/listener/CorrectionListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 79f51409..f5b23541 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -170,6 +170,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请 taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过"); taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + endTake(delegateTask.getVariables()); } }); } From 39b76c5c76771d433c9214c940e176445215dcbb Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 16:10:13 +0800 Subject: [PATCH 22/22] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusController.java | 27 ++++++++++++++++--- .../controller/ResourceMountController.java | 3 ++- .../ResourceUndercarriageListener.java | 1 + 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index 42eac9cd..0829cf6f 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -3,6 +3,7 @@ package io.renren.common.controller; import io.renren.common.utils.Result; import io.renren.modules.resource.service.ResourceService; +import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -13,10 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; /** @@ -31,6 +30,8 @@ public class CensusController { @Autowired private ResourceService resourceService; + @Autowired + private SysUserService sysUserService; @Value("${census.type}") private String[] censusTypes; // 大数据局名称 @@ -65,4 +66,22 @@ public class CensusController { dbAmount.add(sumMap); return new Result>>().ok(dbAmount); } + + @GetMapping(value = "/whole_amount") + @ApiOperation("平台整体情况") + public Result>> wholeAmount() { + List> result = new ArrayList>(); + CompletableFuture resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量 + List> dbAmount = resourceService.getAmountGroupByType(); + Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); + return sum; + }); + CompletableFuture userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 + return sysUserService.countAllUser(); + }); + CompletableFuture all = CompletableFuture.allOf(resourceAmount, userAmount); + all.join(); + + return new Result>>().ok(result); + } } diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 4a59de53..406b7e99 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -151,6 +151,7 @@ public class ResourceMountController { }); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); resourceService.update(dto); + logger.error(resourceDTO.get().toString()); }); logger.info("-------------------1.保存申请表单成功--------------------------"); @@ -159,7 +160,7 @@ public class ResourceMountController { processStartDTO.setBusinessKey(resourceId.toString()); processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架 ObjectMapper oMapper = new ObjectMapper(); - Map variables = oMapper.convertValue(resourceDTO, Map.class); + Map variables = oMapper.convertValue(resourceDTO.get(), Map.class); processStartDTO.setVariables(variables); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); logger.info("-------------------2.启动流程成功--------------------------"); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index eaadd9e1..ec59eb10 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -91,6 +91,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis JsonElement jsonElement = gson.toJsonTree(kv); ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); if (re != null) { + logger.error(kv.toString()); re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); resourceService.update(re); logger.error("下架审批通过 资源id:" + re.getId());