diff --git a/hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory/MapperEntityFactory.java b/hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory/MapperEntityFactory.java index 0210d4df9..5155ff61c 100644 --- a/hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory/MapperEntityFactory.java +++ b/hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory/MapperEntityFactory.java @@ -21,6 +21,7 @@ package org.hswebframework.web.commons.entity.factory; import lombok.SneakyThrows; import org.hswebframework.web.NotFoundException; import org.hswebframework.utils.ClassUtils; +import org.hswebframework.web.bean.BeanFactory; import org.hswebframework.web.bean.FastBeanCopier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +35,7 @@ import java.util.function.Supplier; * @since 3.0 */ @SuppressWarnings("unchecked") -public class MapperEntityFactory implements EntityFactory { +public class MapperEntityFactory implements EntityFactory ,BeanFactory { private Map realTypeMapper = new HashMap<>(); private Logger logger = LoggerFactory.getLogger(this.getClass()); private Map copierCache = new HashMap<>(); diff --git a/hsweb-core/src/main/java/org/hswebframework/web/bean/BeanFactory.java b/hsweb-core/src/main/java/org/hswebframework/web/bean/BeanFactory.java new file mode 100644 index 000000000..db22e66b5 --- /dev/null +++ b/hsweb-core/src/main/java/org/hswebframework/web/bean/BeanFactory.java @@ -0,0 +1,6 @@ +package org.hswebframework.web.bean; + +public interface BeanFactory { + + T newInstance(Class beanType); +} diff --git a/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java b/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java index a01040226..824b64170 100644 --- a/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java +++ b/hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java @@ -2,6 +2,7 @@ package org.hswebframework.web.bean; import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.beanutils.BeanUtilsBean; import org.apache.commons.beanutils.PropertyUtilsBean; @@ -33,10 +34,18 @@ public final class FastBeanCopier { private static final Map wrapperClassMapping = new HashMap<>(); - public static final DefaultConvert DEFAULT_CONVERT = new DefaultConvert(); + public static final DefaultConverter DEFAULT_CONVERT = new DefaultConverter(); public static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; + public static BeanFactory BEAN_FACTORY = new BeanFactory() { + @Override + @SneakyThrows + public T newInstance(Class beanType) { + return beanType == Map.class ? (T) new HashMap<>() : beanType.newInstance(); + } + }; + static { wrapperClassMapping.put(byte.class, Byte.class); wrapperClassMapping.put(short.class, Short.class); @@ -265,7 +274,9 @@ public final class FastBeanCopier { boolean hasGeneric = false; if (field != null) { String[] arr = Arrays.stream(ResolvableType.forField(field) - .getGenerics()).map(ResolvableType::getRawClass) + .getGenerics()) + .map(ResolvableType::getRawClass) + .filter(Objects::nonNull) .map(t -> t.getName().concat(".class")) .toArray(String[]::new); if (arr.length > 0) { @@ -324,16 +335,16 @@ public final class FastBeanCopier { } else { if (Cloneable.class.isAssignableFrom(targetType)) { try { - convertCode.append("(" + getTypeName() + ")").append(getterCode).append(".clone()"); + convertCode.append("(").append(getTypeName()).append(")").append(getterCode).append(".clone()"); } catch (Exception e) { convertCode.append(getterCode); } } else { if ((Map.class.isAssignableFrom(targetType) || Collection.class.isAssignableFrom(type)) && hasGeneric) { - convertCode.append("(" + getTypeName() + ")").append(convert); + convertCode.append("(").append(getTypeName()).append(")").append(convert); } else { - convertCode.append("(" + getTypeName() + ")").append(getterCode); + convertCode.append("(").append(getTypeName()).append(")").append(getterCode); // convertCode.append(getterCode); } @@ -398,7 +409,12 @@ public final class FastBeanCopier { } - static final class DefaultConvert implements Converter { + public static final class DefaultConverter implements Converter { + private BeanFactory beanFactory = BEAN_FACTORY; + + public void setBeanFactory(BeanFactory beanFactory) { + this.beanFactory = beanFactory; + } public Collection newCollection(Class targetClass) { @@ -504,9 +520,7 @@ public final class FastBeanCopier { return converter.convert(targetClass, source); } - T newTarget = targetClass == Map.class ? (T) new HashMap<>() : targetClass.newInstance(); - copy(source, newTarget); - return newTarget; + return copy(source, beanFactory.newInstance(targetClass),this); } catch (Exception e) { log.warn("复制类型{}->{}失败", source, targetClass, e); throw new UnsupportedOperationException(e.getMessage(), e); diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java index 3dbff33f0..fa39c6b10 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java @@ -25,6 +25,7 @@ import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer; import com.alibaba.fastjson.serializer.SerializerFeature; import org.hswebframework.web.ThreadLocalUtils; +import org.hswebframework.web.bean.FastBeanCopier; import org.hswebframework.web.commons.entity.factory.EntityFactory; import org.hswebframework.web.commons.entity.factory.MapperEntityFactory; import org.hswebframework.web.convert.CustomMessageConverter; @@ -64,8 +65,6 @@ import java.lang.reflect.Type; import java.util.List; /** - * TODO 完成注释 - * * @author zhouhao */ @Configuration @@ -175,7 +174,9 @@ public class HswebAutoConfiguration { @Bean(name = "entityFactory") @ConditionalOnMissingBean(EntityFactory.class) public MapperEntityFactory mapperEntityFactory() { - return new MapperEntityFactory(entityProperties.createMappers()); + MapperEntityFactory entityFactory = new MapperEntityFactory(entityProperties.createMappers()); + FastBeanCopier.BEAN_FACTORY = entityFactory; + return entityFactory; } @Bean diff --git a/hsweb-system/hsweb-system-all/pom.xml b/hsweb-system/hsweb-system-all/pom.xml deleted file mode 100644 index a1d0a5a79..000000000 --- a/hsweb-system/hsweb-system-all/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - hsweb-system - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - pom - hsweb-system-all - - - - org.hswebframework.web - hsweb-system-authorization-starter - ${project.version} - - - - org.hswebframework.web - hsweb-system-database-manager-starter - ${project.version} - - - - org.hswebframework.web - hsweb-system-dictionary-starter - ${project.version} - - - - org.hswebframework.web - hsweb-system-organizational-starter - ${project.version} - - - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/pom.xml b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/pom.xml deleted file mode 100644 index 2d214506f..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - hsweb-system-calendar - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-calendar-api - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/Calendar.java b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/Calendar.java deleted file mode 100644 index d0fc8c198..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/Calendar.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.hswebframework.web.calendar.api; - -public interface Calendar { - -} diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarEvent.java b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarEvent.java deleted file mode 100644 index 223deae66..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.hswebframework.web.calendar.api; - -public interface CalendarEvent { -} diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarService.java b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarService.java deleted file mode 100644 index 9a0793e15..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-api/src/main/java/org/hswebframework/web/calendar/api/CalendarService.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.hswebframework.web.calendar.api; - -public class CalendarService { - - -} diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-cluster/pom.xml b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-cluster/pom.xml deleted file mode 100644 index 61c03aff4..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-cluster/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - hsweb-system-calendar - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-calendar-cluster - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-local/pom.xml b/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-local/pom.xml deleted file mode 100644 index a7a5a2fec..000000000 --- a/hsweb-system/hsweb-system-calendar/hsweb-system-calendar-local/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - hsweb-system-calendar - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-calendar-local - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-calendar/pom.xml b/hsweb-system/hsweb-system-calendar/pom.xml deleted file mode 100644 index 0dec47faa..000000000 --- a/hsweb-system/hsweb-system-calendar/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - hsweb-system - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-calendar - pom - - hsweb-system-calendar-api - hsweb-system-calendar-local - hsweb-system-calendar-cluster - - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-cli/README.md b/hsweb-system/hsweb-system-cli/README.md deleted file mode 100644 index ee263ea68..000000000 --- a/hsweb-system/hsweb-system-cli/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## 在线命令行工具 - -可通过在线执行命令脚本,查看系统信息,维护等功能 - -## API -//todo \ No newline at end of file diff --git a/hsweb-system/hsweb-system-cli/pom.xml b/hsweb-system/hsweb-system-cli/pom.xml deleted file mode 100644 index b6ab38310..000000000 --- a/hsweb-system/hsweb-system-cli/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - hsweb-system - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-cli - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-history/README.md b/hsweb-system/hsweb-system-history/README.md deleted file mode 100644 index 919fb511f..000000000 --- a/hsweb-system/hsweb-system-history/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## 历史记录管理 -用于记录各种数据历史记录 - -## API -//todo \ No newline at end of file diff --git a/hsweb-system/hsweb-system-history/pom.xml b/hsweb-system/hsweb-system-history/pom.xml deleted file mode 100644 index eef161d9b..000000000 --- a/hsweb-system/hsweb-system-history/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - hsweb-system - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-system-history - - - \ No newline at end of file diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/PersonnelAuthorizationHolder.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/PersonnelAuthorizationHolder.java index eedfdf35a..062b730a6 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/PersonnelAuthorizationHolder.java +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/PersonnelAuthorizationHolder.java @@ -11,8 +11,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; /** - * TODO 完成注释 - * * @author zhouhao */ public class PersonnelAuthorizationHolder { diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/TreeNode.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/TreeNode.java index 3b2dc5ca3..9f99614cd 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/TreeNode.java +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/TreeNode.java @@ -16,10 +16,10 @@ import java.util.function.Predicate; public class TreeNode implements Serializable { private static final long serialVersionUID = 1_0; - /** - * 父节点,根节点为{@code null} - */ - private TreeNode parent; +// /** +// * 父节点,根节点为{@code null} +// */ +// private TreeNode parent; /** * 节点值 @@ -32,14 +32,14 @@ public class TreeNode implements Serializable { private int level; private Set> children; - - public TreeNode getParent() { - return parent; - } - - public void setParent(TreeNode parent) { - this.parent = parent; - } +// +// public TreeNode getParent() { +// return parent; +// } +// +// public void setParent(TreeNode parent) { +// this.parent = parent; +// } public V getValue() { return value; @@ -55,6 +55,7 @@ public class TreeNode implements Serializable { public void setChildren(Set> children) { this.children = children; + children.forEach(node -> node.setLevel(getLevel() + 1)); } public int getLevel() { diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorization.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorization.java index 48883a3d4..c89f59718 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorization.java +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorization.java @@ -1,10 +1,17 @@ package org.hswebframework.web.organizational.authorization.simple; -import org.hswebframework.web.organizational.authorization.Personnel; -import org.hswebframework.web.organizational.authorization.PersonnelAuthorization; -import org.hswebframework.web.organizational.authorization.Position; -import org.hswebframework.web.organizational.authorization.TreeNode; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import org.hswebframework.web.Maps; +import org.hswebframework.web.bean.BeanFactory; +import org.hswebframework.web.bean.Converter; +import org.hswebframework.web.bean.FastBeanCopier; +import org.hswebframework.web.organizational.authorization.*; +import org.hswebframework.web.organizational.authorization.relation.Relation; import org.hswebframework.web.organizational.authorization.relation.Relations; +import org.hswebframework.web.organizational.authorization.relation.SimpleRelation; +import org.hswebframework.web.organizational.authorization.relation.SimpleRelations; import java.util.Collections; import java.util.Set; @@ -14,13 +21,13 @@ import java.util.Set; */ public class SimplePersonnelAuthorization implements PersonnelAuthorization { private static final long serialVersionUID = 1_0; - private Personnel personnel; + private Personnel personnel; private Set> districtIds; private Set> orgIds; private Set> positionIds; private Set> departmentIds; - private Relations relations; - private Set positions; + private Relations relations; + private Set positions; public void setPositions(Set positions) { this.positions = positions; @@ -96,4 +103,6 @@ public class SimplePersonnelAuthorization implements PersonnelAuthorization { public void setDepartmentIds(Set> departmentIds) { this.departmentIds = departmentIds; } + + } diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilder.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilder.java new file mode 100644 index 000000000..6b10654d5 --- /dev/null +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilder.java @@ -0,0 +1,55 @@ +package org.hswebframework.web.organizational.authorization.simple; + +import com.alibaba.fastjson.JSON; +import org.hswebframework.web.bean.BeanFactory; +import org.hswebframework.web.bean.FastBeanCopier; +import org.hswebframework.web.organizational.authorization.*; +import org.hswebframework.web.organizational.authorization.relation.Relation; +import org.hswebframework.web.organizational.authorization.relation.Relations; +import org.hswebframework.web.organizational.authorization.relation.SimpleRelation; +import org.hswebframework.web.organizational.authorization.relation.SimpleRelations; + +import java.util.Map; + +public class SimplePersonnelAuthorizationBuilder { + static FastBeanCopier.DefaultConverter converter = new FastBeanCopier.DefaultConverter(); + + static { + converter.setBeanFactory(new BeanFactory() { + @Override + public T newInstance(Class targetClass) { + if (targetClass == Position.class) { + return (T) new SimplePosition(); + } + if (targetClass == Personnel.class) { + return (T) new SimplePersonnel(); + } + if (targetClass == Department.class) { + return (T) new SimpleDepartment(); + } + if (targetClass == Organization.class) { + return (T) new SimpleOrganization(); + } + if (targetClass == District.class) { + return (T) new SimpleDistrict(); + } + if (targetClass == Relation.class) { + return (T) new SimpleRelation(); + } + if (targetClass == Relations.class) { + return (T) new SimpleRelations(); + } + return FastBeanCopier.BEAN_FACTORY.newInstance(targetClass); + } + }); + } + + public static SimplePersonnelAuthorization fromJson(String json) { + return fromMap(JSON.parseObject(json)); + } + + public static SimplePersonnelAuthorization fromMap(Map map) { + return FastBeanCopier.copy(map, new SimplePersonnelAuthorization(), converter); + } + +} diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/test/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilderTest.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/test/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilderTest.java new file mode 100644 index 000000000..d0d66c2d4 --- /dev/null +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/test/java/org/hswebframework/web/organizational/authorization/simple/SimplePersonnelAuthorizationBuilderTest.java @@ -0,0 +1,38 @@ +package org.hswebframework.web.organizational.authorization.simple; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import org.hswebframework.web.Maps; +import org.hswebframework.web.bean.FastBeanCopier; +import org.junit.Test; + +import java.util.Arrays; +import java.util.HashMap; + +import static org.hswebframework.web.organizational.authorization.simple.SimplePersonnelAuthorizationBuilder.fromJson; + +public class SimplePersonnelAuthorizationBuilderTest { + + @Test + public void test() { + JSONObject auth = new JSONObject(); + auth.put("personnel", Maps.buildMap() + .put("id", "1234") + .put("name", "234") + .get()); + + auth.put("orgIds", JSON.parseArray("[{\"value\":\"123\",\"children\":[{\"value\":\"234\"}]}]")); + + auth.put("positions", JSON.parseArray("[{\"id\":\"1234\"," + + "\"department\":{\"id\":\"1234\",\"org\":{\"id\":\"234\",\"district\":{\"id\":\"test\"}}}}]")); + + SimplePersonnelAuthorization authorization = fromJson(auth.toJSONString()); + + + Object json = JSON.toJSON(authorization); + System.out.println(JSON.toJSONString(json, SerializerFeature.PrettyFormat)); + + System.out.println(JSON.toJSONString(FastBeanCopier.copy(authorization,new JSONObject())).equals(json.toString())); + } +} \ No newline at end of file diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java index 687f4e18d..a0dd1fcd1 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java @@ -454,7 +454,7 @@ public class SimplePersonService extends GenericEntityService parentNode = new TreeNode<>(); parentNode.setValue(parent.getId()); parentNode.setChildren(treeNodes); - treeNode.setParent(parentNode); +// treeNode.setParent(parentNode); } treeNode.setValue(node.getId()); if (node.getChildren() != null && !node.getChildren().isEmpty()) { diff --git a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableUtilsController.java b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableUtilsController.java index e27e6b728..0440ba1f7 100644 --- a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableUtilsController.java +++ b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableUtilsController.java @@ -1,6 +1,8 @@ package org.hswebframework.web.workflow.flowable.controller; +import io.swagger.annotations.Api; import org.activiti.engine.impl.pvm.process.ActivityImpl; +import org.hswebframework.web.authorization.annotation.Authorize; import org.hswebframework.web.controller.message.ResponseMessage; import org.hswebframework.web.entity.workflow.ActDefEntity; import org.hswebframework.web.service.workflow.ActDefService; @@ -20,7 +22,9 @@ import static org.hswebframework.web.commons.entity.param.QueryParamEntity.singl * @Date 2017/9/4. */ @RestController -@RequestMapping("workflow/utils/") +@RequestMapping("workflow/utils") +@Api(tags = "工作流-节点配置", description = "工作流节点配置") +@Authorize(permission = "workflow-utils", description = "节点配置") public class FlowableUtilsController { @Autowired diff --git a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/utils/CustomGroupEntityManager.java b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/utils/CustomGroupEntityManager.java index 96541f99a..02c4c1480 100644 --- a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/utils/CustomGroupEntityManager.java +++ b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/utils/CustomGroupEntityManager.java @@ -11,11 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -/** - * Created by Administrator on 2016/3/19 0019. - */ public class CustomGroupEntityManager extends GroupEntityManager { private UserService userService; @@ -45,7 +44,7 @@ public class CustomGroupEntityManager extends GroupEntityManager { List sysRoles = userService.getUserRole(id); return ActivitiUserUtil.toActivitiGroups(sysRoles); } catch (EmptyResultDataAccessException e) { - return null; + return new ArrayList<>(); } } diff --git a/hsweb-system/pom.xml b/hsweb-system/pom.xml index 4e4edb21f..439824088 100644 --- a/hsweb-system/pom.xml +++ b/hsweb-system/pom.xml @@ -19,17 +19,13 @@ hsweb-system-datasource hsweb-system-workflow hsweb-system-schedule - hsweb-system-cli - hsweb-system-all hsweb-system-organizational hsweb-system-file hsweb-system-template hsweb-system-script - hsweb-system-history hsweb-system-dictionary hsweb-system-oauth2-server hsweb-system-oauth2-client - hsweb-system-calendar hsweb-system-dashboard hsweb-system-dev-tools