From 8ce17a5601a978e70880940f9d372f5e208c8626 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 26 Aug 2022 14:12:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/service/impl/ResourceServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 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 85ac2a0b..8a736367 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 @@ -1275,9 +1275,8 @@ public class ResourceServiceImpl extends CrudServiceImpl Date: Fri, 26 Aug 2022 14:32:44 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/common/utils/JhlDAPTool.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java b/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java index e07a51a6..5d44667c 100644 --- a/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java +++ b/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java @@ -106,9 +106,6 @@ public class JhlDAPTool { user.put("distinguishedName",next.get().toString()); }else if("objectGUID".equals(next.getID())){ String guidStr = next.get().toString(); - //Object o = next.get(0); - - String guid = guidObject2String((byte[]) next.get(0)); user.put("id",SingleID.getSingleID(guid)); user.put("guid",guid); @@ -162,16 +159,6 @@ public class JhlDAPTool { } builder.append('-'); -// for (int i = 8; i <9; i++) -// { -// String hex = Integer.toHexString(b[i] & 0xFF); -// if (hex.length() == 1) -// { -// hex = '0' + hex; -// } -// builder.append(hex); -// } -// builder.append('-'); for (int i = 8; i <10; i++) { String hex = Integer.toHexString(b[i] & 0xFF); From ffe1b86a28158830fe53341c68dd5a077e35e59e Mon Sep 17 00:00:00 2001 From: Koi-tsk <337023856@qq.com> Date: Fri, 26 Aug 2022 14:47:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=9E=8D=E5=90=88=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuse/controller/FuseController.java | 7 -- .../modules/fuse/service/TbFuseService.java | 2 - .../fuse/service/impl/TbFuseServiceImpl.java | 75 ++++++++++--------- 3 files changed, 40 insertions(+), 44 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java index d05ee9ca..3da55e70 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java @@ -62,13 +62,6 @@ public class FuseController { return new Result().ok(tbFuseService.getFuseById(id)); } - @GetMapping("getDataResource") - @ApiOperation("获取资源数据") - @LogOperation("获取资源数据") - public Result> getDataResource() { - return new Result().ok(tbFuseService.getDataResource()); - } - @PostMapping @ApiOperation("保存") @LogOperation("保存") diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java index b296b7ef..f50ea326 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java @@ -16,8 +16,6 @@ public interface TbFuseService extends CrudService { TbFuseDTO getFuseById(Long id); - List getDataResource(); - Integer addFuse(TbFuseDTO dto); Integer updateFuse(TbFuseDTO dto); diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java index 39d39908..407db5dd 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java @@ -33,7 +33,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.swing.text.html.Option; import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -46,6 +50,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl getDataResource() { - int pageNum=0; - int pageSize=getDataResourceCount(); - List result = new ArrayList<>(); - Optional factory = DataResourceFactory.build(); - if (factory.isPresent()) { - GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(pageNum).setPageSize(pageSize); - Map dataMap = (Map) factory.get().getDataResource(dto); - if (dataMap != null) { - List> list = (List>) dataMap.get("data"); - list.forEach(map -> result.add(new HashMap() {{ - if (map.containsKey("zyname")) { - put("id", map.get("guid")); - put("name", map.get("zyname")); - } else { - put("id", map.get("serviceId")); - put("name", map.get("serviceName")); + private Map> getDataResource() { + Map result=new ConcurrentHashMap(); + final int pageSize = CPU_NUM * 10; + AtomicInteger pageIndex = new AtomicInteger(1); + AtomicBoolean end = new AtomicBoolean(true); + List completableFutures=new CopyOnWriteArrayList<>(); + while(end.get()){ + completableFutures.add(CompletableFuture.supplyAsync(()->{ + Optional factory = DataResourceFactory.build(); + if (factory.isPresent()) { + GetDataResourceListDto dto=new GetDataResourceListDto().setPageNum(pageIndex.get()).setPageSize(pageSize); + Map dataResource = (Map) factory.get().getDataResource(dto); + if(!dataResource.isEmpty()){ + List> list = (List>) dataResource.get("data"); + pageIndex.getAndIncrement(); + return new HashMap(){{put( list.stream().map(map->{ + if (map.containsKey("zyname")) { + return map.get("guid"); + } else { + return map.get("serviceId"); + } + }), list);}}; } - }})); - } + } + return null; + }).thenAcceptAsync(map->{ + if(map != null){ + result.putAll(map); + } + })); } return result; } - private int getDataResourceCount() { - int count=30; - Optional factory = DataResourceFactory.build(); - if (factory.isPresent()) { - GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30); - Map dataMap = (Map) factory.get().getDataResource(dto); - if (dataMap != null) { - count=Integer.parseInt(dataMap.get("rows").toString()); - } - } - return count; - } - private List getFuseResourceByFuseId(Long fuseId) { - List dataResourceMap = new ArrayList<>(); + Map dataResourceMap = new HashMap(); List result = new ArrayList(); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("fuse_id", fuseId); List list = fuseResourceDao.selectList(wrapper); Map> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)); if (resourceMap.containsKey("数据资源")) { - dataResourceMap.addAll(getDataResource()); + dataResourceMap.putAll(getDataResource()); } resourceMap.forEach((type, value) -> { if ("组件服务".equals(type)) { @@ -215,7 +220,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl { TbFuseResourceDTO dto = new TbFuseResourceDTO(); BeanUtils.copyProperties(attr, dto); - dto.setResource(dataResourceMap.stream().filter(it->it.get("id").equals(dto.getResourceId())).findFirst()); + dto.setResource(dataResourceMap.get(dto.getResourceId())); return dto; }).collect(Collectors.toList())); } else if ("基础设施".equals(type)) { From fdc9019a4bc165e3b3061bb875e456eb878bbf9a Mon Sep 17 00:00:00 2001 From: Koi-tsk <337023856@qq.com> Date: Fri, 26 Aug 2022 16:26:18 +0800 Subject: [PATCH 4/4] =?UTF-8?q?v3=E5=AE=A1=E6=89=B9=EF=BC=9A=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E5=AE=A1=E6=89=B9=E4=B8=8E=E7=94=B3=E8=AF=B7=E4=BA=BA?= =?UTF-8?q?=E4=B8=80=E6=A0=B7=EF=BC=8C=E9=BB=98=E8=AE=A4=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/v3/ApplyDistrictListener.java | 15 +++++++++++++++ .../processForm/listener/v3/CityListener.java | 14 ++++++++++++++ .../listener/v3/OwnerDistrictListener.java | 14 ++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/ApplyDistrictListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/ApplyDistrictListener.java index 2f83b64b..22dc606d 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/ApplyDistrictListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/ApplyDistrictListener.java @@ -3,6 +3,8 @@ package io.renren.modules.processForm.listener.v3; import com.alibaba.fastjson.JSON; import com.google.common.collect.ImmutableMap; import io.renren.common.annotation.ActivitiNoticeOperation; +import io.renren.modules.activiti.service.ActTaskService; +import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.sys.dao.SysUserDao; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -17,6 +19,7 @@ import org.activiti.engine.TaskService; import org.activiti.engine.delegate.*; import org.activiti.engine.delegate.event.ActivitiEvent; import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -98,6 +101,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); assignee = defaultAssigneeRoleId; } + mpComplete(delegateTask, assignee); logger.error("分配的用户id为:{}", assignee); } else { try { @@ -108,6 +112,17 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A } } + private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人 + if (StringUtils.isNotEmpty(assignee) + && StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class)) + && delegateTask.getVariable("creator", String.class).equals(assignee)) { + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过"); + taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE); + taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + } + } + @Override public void notify(DelegateExecution delegateExecution) throws Exception { diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/CityListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/CityListener.java index 8d993161..019b35cc 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/CityListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/CityListener.java @@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3; import com.alibaba.fastjson.JSON; import com.google.common.collect.ImmutableMap; import io.renren.common.annotation.ActivitiNoticeOperation; +import io.renren.modules.activiti.service.ActTaskService; import io.renren.modules.sys.dao.SysUserDao; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -17,6 +18,7 @@ import org.activiti.engine.TaskService; import org.activiti.engine.delegate.*; import org.activiti.engine.delegate.event.ActivitiEvent; import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -99,6 +101,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); assignee = defaultAssigneeRoleId; } + mpComplete(delegateTask, assignee); logger.error("分配的用户id为:{}", assignee); } else { try { @@ -109,6 +112,17 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv } } + private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人 + if (StringUtils.isNotEmpty(assignee) + && StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class)) + && delegateTask.getVariable("creator", String.class).equals(assignee)) { + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过"); + taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE); + taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + } + } + @Override public void notify(DelegateExecution delegateExecution) throws Exception { diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/OwnerDistrictListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/OwnerDistrictListener.java index f3d2f24f..ee6abdf1 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/OwnerDistrictListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v3/OwnerDistrictListener.java @@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3; import com.alibaba.fastjson.JSON; import com.google.common.collect.ImmutableMap; import io.renren.common.annotation.ActivitiNoticeOperation; +import io.renren.modules.activiti.service.ActTaskService; import io.renren.modules.sys.dao.SysUserDao; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -16,6 +17,7 @@ import org.activiti.engine.TaskService; import org.activiti.engine.delegate.*; import org.activiti.engine.delegate.event.ActivitiEvent; import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -95,6 +97,7 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); assignee = defaultAssigneeRoleId; } + mpComplete(delegateTask, assignee); logger.error("分配的用户id为:{}", assignee); } else { try { @@ -104,6 +107,17 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A } } } + private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人 + if (StringUtils.isNotEmpty(assignee) + && StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class)) + && delegateTask.getVariable("creator", String.class).equals(assignee)) { + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过"); + taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE); + taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + } + } + @Override public void notify(DelegateExecution delegateExecution) throws Exception {