diff --git a/pigx-common/pigx-common-core/pom.xml b/pigx-common/pigx-common-core/pom.xml
index 72752e787..553137e43 100644
--- a/pigx-common/pigx-common-core/pom.xml
+++ b/pigx-common/pigx-common-core/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-core
diff --git a/pigx-common/pigx-common-job/pom.xml b/pigx-common/pigx-common-job/pom.xml
index f9650cb69..f58da7175 100644
--- a/pigx-common/pigx-common-job/pom.xml
+++ b/pigx-common/pigx-common-job/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-job
@@ -33,12 +33,6 @@
pigx 定时任务
-
- org.projectlombok
- lombok
- true
-
-
com.dangdang
diff --git a/pigx-common/pigx-common-log/pom.xml b/pigx-common/pigx-common-log/pom.xml
index eca18bad8..75ca4bac4 100644
--- a/pigx-common/pigx-common-log/pom.xml
+++ b/pigx-common/pigx-common-log/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-log
@@ -38,18 +38,22 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
com.pig4cloud
pigx-upms-api
- ${pigx.version}
+ 1.7.0
+
+
+
+ org.springframework.security
+ spring-security-core
- com.pig4cloud
- pigx-common-security
- ${pigx.version}
+ org.springframework.security.oauth
+ spring-security-oauth2
diff --git a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java
index 968ae1600..f6060beb5 100644
--- a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java
+++ b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java
@@ -23,11 +23,14 @@ import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpUtil;
import com.pig4cloud.pigx.admin.api.entity.SysLog;
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
-import com.pig4cloud.pigx.common.security.util.SecurityUtils;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
+import java.util.Objects;
/**
* 系统日志工具类
@@ -36,16 +39,45 @@ import javax.servlet.http.HttpServletRequest;
*/
public class SysLogUtils {
public static SysLog getSysLog() {
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+ HttpServletRequest request = ((ServletRequestAttributes) Objects
+ .requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
SysLog sysLog = new SysLog();
- sysLog.setCreateBy(SecurityUtils.getUser().getUsername());
+ sysLog.setCreateBy(Objects.requireNonNull(getUsername()));
sysLog.setType(CommonConstant.STATUS_NORMAL);
sysLog.setRemoteAddr(HttpUtil.getClientIP(request));
sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI()));
sysLog.setMethod(request.getMethod());
sysLog.setUserAgent(request.getHeader("user-agent"));
sysLog.setParams(HttpUtil.toParams(request.getParameterMap()));
- sysLog.setServiceId(SecurityUtils.getClientId());
+ sysLog.setServiceId(getClientId());
return sysLog;
}
+
+ /**
+ * 获取客户端
+ *
+ * @return clientId
+ */
+ private static String getClientId() {
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication instanceof OAuth2Authentication) {
+ OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
+ return auth2Authentication.getOAuth2Request().getClientId();
+ }
+ return null;
+ }
+
+ /**
+ * 获取用户名称
+ *
+ * @return username
+ */
+ private static String getUsername() {
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication == null) {
+ return null;
+ }
+ return authentication.getName();
+ }
+
}
diff --git a/pigx-common/pigx-common-security/pom.xml b/pigx-common/pigx-common-security/pom.xml
index 21e1f7041..a58d4480a 100644
--- a/pigx-common/pigx-common-security/pom.xml
+++ b/pigx-common/pigx-common-security/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-security
@@ -38,22 +38,18 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
org.springframework.cloud
spring-cloud-starter-security
-
- org.springframework.boot
- spring-boot-starter-jdbc
-
com.pig4cloud
pigx-upms-api
- ${pigx.version}
+ 1.7.0
diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/annotation/EnablePigxResourceServer.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/annotation/EnablePigxResourceServer.java
new file mode 100644
index 000000000..eff0f2f18
--- /dev/null
+++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/annotation/EnablePigxResourceServer.java
@@ -0,0 +1,8 @@
+package com.pig4cloud.pigx.common.security;
+
+/**
+ * @author lengleng
+ * @date 2018/11/10
+ */
+public @interface EnablePigxResourceServer {
+}
diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java
new file mode 100644
index 000000000..3ec1b7e07
--- /dev/null
+++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pigx.common.security.component;
+
+import lombok.Data;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author lengleng
+ * @date 2018/11/10
+ *
+ * 资源服务器对外直接暴露URL
+ */
+@Data
+@Configuration
+@ConditionalOnExpression("!'${ignore}'.isEmpty()")
+@ConfigurationProperties(prefix = "ignore")
+public class PermitAllUrlProperties {
+ private List urls = new ArrayList<>();
+}
diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerAutoConfiguration.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerAutoConfiguration.java
new file mode 100644
index 000000000..34a5bee2d
--- /dev/null
+++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerAutoConfiguration.java
@@ -0,0 +1,8 @@
+package com.pig4cloud.pigx.common.security;
+
+/**
+ * @author lengleng
+ * @date 2018/11/10
+ */
+public class PigxResourceServerAutoConfiguration {
+}
diff --git a/pigx-common/pigx-common-swagger/pom.xml b/pigx-common/pigx-common-swagger/pom.xml
index 597c7bb98..ade99628d 100644
--- a/pigx-common/pigx-common-swagger/pom.xml
+++ b/pigx-common/pigx-common-swagger/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-swagger
@@ -34,12 +34,6 @@
-
-
- com.pig4cloud
- pigx-common-security
- ${pigx.version}
-
io.springfox
diff --git a/pigx-common/pigx-common-transaction/pom.xml b/pigx-common/pigx-common-transaction/pom.xml
index 9062d1adb..125ad4135 100644
--- a/pigx-common/pigx-common-transaction/pom.xml
+++ b/pigx-common/pigx-common-transaction/pom.xml
@@ -5,7 +5,7 @@
com.pig4cloud
pigx-common
- ${pigx.version}
+ 1.7.0
pigx-common-transaction
@@ -17,7 +17,7 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
diff --git a/pigx-common/pom.xml b/pigx-common/pom.xml
index ea1970619..c830e7514 100644
--- a/pigx-common/pom.xml
+++ b/pigx-common/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-common
diff --git a/pigx-config/pom.xml b/pigx-config/pom.xml
index c40548009..dc2e0f9e1 100644
--- a/pigx-config/pom.xml
+++ b/pigx-config/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-config
diff --git a/pigx-config/src/main/resources/config/pigx-activiti-dev.yml b/pigx-config/src/main/resources/config/pigx-activiti-dev.yml
new file mode 100644
index 000000000..73afe508e
--- /dev/null
+++ b/pigx-config/src/main/resources/config/pigx-activiti-dev.yml
@@ -0,0 +1,53 @@
+## spring security 配置
+security:
+ oauth2:
+ client:
+ client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)
+ client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)
+ scope: server
+
+## 定时任务
+spring:
+ # 保存定时任务的数据源
+ datasource:
+ type: com.zaxxer.hikari.HikariDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ username: root
+ password: root
+ url: jdbc:mysql://pigx-mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
+ elasticjob:
+ # 分布式任务协调依赖zookeeper
+ zookeeper:
+ server-lists: pigx-zookeeper:2181
+ namespace: pigx-daemon
+ # 普通任务
+ simples:
+ spring-simple-job:
+ job-class: com.pig4cloud.pigx.daemon.job.PigxSimpleJob
+ cron: 0 0 0/1 * * ?
+ sharding-total-count: 3
+ sharding-item-parameters: 0=service1,1=service2,2=service3
+ eventTraceRdbDataSource: 'dataSource'
+ listener:
+ listener-class: com.pig4cloud.pigx.daemon.listener.PigxElasticJobListener
+ spring-simple-job2:
+ job-class: com.pig4cloud.pigx.daemon.job.PigxSimpleJob2
+ cron: 0 0 0/1 * * ?
+ sharding-total-count: 3
+ sharding-item-parameters: 0=service1,1=service2,2=service3
+ eventTraceRdbDataSource: 'dataSource'
+ listener:
+ listener-class: com.pig4cloud.pigx.daemon.listener.PigxElasticJobListener
+ # 简单任务
+ dataflows:
+ spring-dataflow-job:
+ job-class: com.pig4cloud.pigx.daemon.job.PigxDataflowJob
+ cron: 0 0 0/1 * * ?
+ sharding-total-count: 3
+ sharding-item-parameters: 0=service1,1=service2,2=service3
+ streaming-process: true
+ eventTraceRdbDataSource: 'dataSource'
+ listener:
+ distributed-listener-class: com.pig4cloud.pigx.daemon.listener.PigxDistributeElasticJobListener
+ started-timeout-milliseconds: 5000
+ completed-timeout-milliseconds: 10000
diff --git a/pigx-eureka/pom.xml b/pigx-eureka/pom.xml
index f4253b057..b2110aa27 100644
--- a/pigx-eureka/pom.xml
+++ b/pigx-eureka/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-eureka
diff --git a/pigx-eureka/src/main/resources/bootstrap.yml b/pigx-eureka/src/main/resources/bootstrap.yml
index 4705ec741..ac184d19e 100644
--- a/pigx-eureka/src/main/resources/bootstrap.yml
+++ b/pigx-eureka/src/main/resources/bootstrap.yml
@@ -7,8 +7,10 @@ spring:
name: pig
password: pig
application:
- name: pigx-eureka
-
+ name: pig-eureka
+ cloud:
+ config:
+ enabled: false
# docker-compose部署时候 hostname 换成pigx-eureka
# 类似的 redis 使用pigx-redis ,gateway 换成 pigx-gateway
eureka:
diff --git a/pigx-gateway/pom.xml b/pigx-gateway/pom.xml
index ffe9f08e3..d7dbcd397 100644
--- a/pigx-gateway/pom.xml
+++ b/pigx-gateway/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-gateway
@@ -63,7 +63,7 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
diff --git a/pigx-upms/pigx-upms-api/pom.xml b/pigx-upms/pigx-upms-api/pom.xml
index 1e421ba1d..b47946ebf 100644
--- a/pigx-upms/pigx-upms-api/pom.xml
+++ b/pigx-upms/pigx-upms-api/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-upms
- ${pigx.version}
+ 1.7.0
pigx-upms-api
@@ -38,7 +38,7 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/TreeUtil.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/TreeUtil.java
index a695f5c27..c048e79a5 100644
--- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/TreeUtil.java
+++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/TreeUtil.java
@@ -40,7 +40,7 @@ public class TreeUtil {
*/
public static List bulid(List treeNodes, Object root) {
- List trees = new ArrayList();
+ List trees = new ArrayList<>();
for (T treeNode : treeNodes) {
@@ -51,7 +51,7 @@ public class TreeUtil {
for (T it : treeNodes) {
if (it.getParentId() == treeNode.getId()) {
if (treeNode.getChildren() == null) {
- treeNode.setChildren(new ArrayList());
+ treeNode.setChildren(new ArrayList<>());
}
treeNode.add(it);
}
@@ -86,7 +86,7 @@ public class TreeUtil {
for (T it : treeNodes) {
if (treeNode.getId() == it.getParentId()) {
if (treeNode.getChildren() == null) {
- treeNode.setChildren(new ArrayList());
+ treeNode.setChildren(new ArrayList<>());
}
treeNode.add(findChildren(it, treeNodes));
}
@@ -102,7 +102,7 @@ public class TreeUtil {
* @return
*/
public static List bulidTree(List menus, int root) {
- List trees = new ArrayList();
+ List trees = new ArrayList<>();
MenuTree node;
for (SysMenu menu : menus) {
node = new MenuTree();
diff --git a/pigx-upms/pigx-upms-biz/pom.xml b/pigx-upms/pigx-upms-biz/pom.xml
index 2b858f04a..4dfb1f9a0 100644
--- a/pigx-upms/pigx-upms-biz/pom.xml
+++ b/pigx-upms/pigx-upms-biz/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-upms
- ${pigx.version}
+ 1.7.0
pigx-upms-biz
@@ -37,13 +37,13 @@
com.pig4cloud
pigx-upms-api
- ${pigx.version}
+ 1.7.0
com.pig4cloud
pigx-common-log
- ${pigx.version}
+ 1.7.0
@@ -55,7 +55,7 @@
com.pig4cloud
pigx-common-swagger
- ${pigx.version}
+ 1.7.0
@@ -69,8 +69,9 @@
- org.springframework.cloud
- spring-cloud-starter-security
+ com.pig4cloud
+ pigx-common-security
+ 1.7.0
diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java
index bc930fb1e..2bdeed422 100644
--- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java
+++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java
@@ -47,7 +47,7 @@ import java.util.Map;
* @since 2017-11-19
*/
@RestController
-@RequestMapping("/dict")
+@RequestMapping("/dict" )
public class DictController {
@Autowired
private SysDictService sysDictService;
@@ -58,7 +58,7 @@ public class DictController {
* @param id ID
* @return 字典信息
*/
- @GetMapping("/{id}")
+ @GetMapping("/{id}" )
public SysDict dict(@PathVariable Integer id) {
return sysDictService.selectById(id);
}
@@ -69,7 +69,7 @@ public class DictController {
* @param params 分页对象
* @return 分页对象
*/
- @GetMapping("/dictPage")
+ @GetMapping("/dictPage" )
public Page dictPage(@RequestParam Map params) {
return sysDictService.selectPage(new Query<>(params), new EntityWrapper<>());
}
@@ -80,8 +80,8 @@ public class DictController {
* @param type 类型
* @return 同类型字典
*/
- @GetMapping("/type/{type}")
- @Cacheable(value = "dict_details", key = "#type")
+ @GetMapping("/type/{type}" )
+ @Cacheable(value = "dict_details", key = "#type" )
public List findDictByType(@PathVariable String type) {
SysDict condition = new SysDict();
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
@@ -95,10 +95,10 @@ public class DictController {
* @param sysDict 字典信息
* @return success、false
*/
- @SysLog("添加字典")
+ @SysLog("添加字典" )
@PostMapping
- @CacheEvict(value = "dict_details", key = "#sysDict.type")
- @PreAuthorize("@pms.hasPermission('sys_dict_add')")
+ @CacheEvict(value = "dict_details", key = "#sysDict.type" )
+ @PreAuthorize("@pms.hasPermission('sys_dict_add')" )
public R dict(@Valid @RequestBody SysDict sysDict) {
return new R<>(sysDictService.insert(sysDict));
}
@@ -110,10 +110,10 @@ public class DictController {
* @param type 类型
* @return R
*/
- @SysLog("删除字典")
- @DeleteMapping("/{id}/{type}")
- @CacheEvict(value = "dict_details", key = "#type")
- @PreAuthorize("@pms.hasPermission('sys_dict_del')")
+ @SysLog("删除字典" )
+ @DeleteMapping("/{id}/{type}" )
+ @CacheEvict(value = "dict_details", key = "#type" )
+ @PreAuthorize("@pms.hasPermission('sys_dict_del')" )
public R deleteDict(@PathVariable Integer id, @PathVariable String type) {
return new R<>(sysDictService.deleteById(id));
}
@@ -125,9 +125,9 @@ public class DictController {
* @return success/false
*/
@PutMapping
- @SysLog("修改字典")
- @CacheEvict(value = "dict_details", key = "#sysDict.type")
- @PreAuthorize("@pms.hasPermission('sys_dict_edit')")
+ @SysLog("修改字典" )
+ @CacheEvict(value = "dict_details", key = "#sysDict.type" )
+ @PreAuthorize("@pms.hasPermission('sys_dict_edit')" )
public R editDict(@Valid @RequestBody SysDict sysDict) {
return new R<>(sysDictService.updateById(sysDict));
}
diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDeptRelationService.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDeptRelationService.java
index 4c839b76b..8a69b5659 100644
--- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDeptRelationService.java
+++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDeptRelationService.java
@@ -20,6 +20,7 @@
package com.pig4cloud.pigx.admin.service;
import com.baomidou.mybatisplus.service.IService;
+import com.pig4cloud.pigx.admin.api.entity.SysDept;
import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
/**
@@ -32,4 +33,24 @@ import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
*/
public interface SysDeptRelationService extends IService {
+ /**
+ * 新建部门关系
+ *
+ * @param sysDept 部门
+ */
+ void insertDeptRelation(SysDept sysDept);
+
+ /**
+ * 通过ID删除部门关系
+ *
+ * @param id
+ */
+ void deleteAllDeptRealtion(Integer id);
+
+ /**
+ * 更新部门关系
+ *
+ * @param relation
+ */
+ void updateDeptRealtion(SysDeptRelation relation);
}
diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java
index 0390c698e..a830fea30 100644
--- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java
+++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java
@@ -19,12 +19,18 @@
package com.pig4cloud.pigx.admin.service.impl;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.pig4cloud.pigx.admin.api.entity.SysDept;
import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
import com.pig4cloud.pigx.admin.mapper.SysDeptRelationMapper;
import com.pig4cloud.pigx.admin.service.SysDeptRelationService;
+import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.stream.Collectors;
+
/**
*
* 服务实现类
@@ -34,6 +40,53 @@ import org.springframework.stereotype.Service;
* @since 2018-02-12
*/
@Service
+@AllArgsConstructor
public class SysDeptRelationServiceImpl extends ServiceImpl implements SysDeptRelationService {
+ private final SysDeptRelationMapper sysDeptRelationMapper;
+
+ /**
+ * 维护部门关系
+ *
+ * @param sysDept 部门
+ */
+ @Override
+ public void insertDeptRelation(SysDept sysDept) {
+ //增加部门关系表
+ SysDeptRelation condition = new SysDeptRelation();
+ condition.setDescendant(sysDept.getParentId());
+ List relationList = sysDeptRelationMapper
+ .selectList(new EntityWrapper<>(condition))
+ .stream().map(relation -> {
+ relation.setDescendant(sysDept.getDeptId());
+ return relation;
+ }).collect(Collectors.toList());
+ this.insertBatch(relationList);
+
+ //自己也要维护到关系表中
+ SysDeptRelation own = new SysDeptRelation();
+ own.setDescendant(sysDept.getDeptId());
+ own.setAncestor(sysDept.getDeptId());
+ sysDeptRelationMapper.insert(own);
+ }
+
+ /**
+ * 通过ID删除部门关系
+ *
+ * @param id
+ */
+ @Override
+ public void deleteAllDeptRealtion(Integer id) {
+ baseMapper.deleteAllDeptRealtion(id);
+ }
+
+ /**
+ * 更新部门关系
+ *
+ * @param relation
+ */
+ @Override
+ public void updateDeptRealtion(SysDeptRelation relation) {
+ baseMapper.updateDeptRealtion(relation);
+ }
}
diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptServiceImpl.java
index 7f6ba9e81..61a5c65eb 100644
--- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptServiceImpl.java
+++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptServiceImpl.java
@@ -26,7 +26,7 @@ import com.pig4cloud.pigx.admin.api.entity.SysDept;
import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
import com.pig4cloud.pigx.admin.api.vo.TreeUtil;
import com.pig4cloud.pigx.admin.mapper.SysDeptMapper;
-import com.pig4cloud.pigx.admin.mapper.SysDeptRelationMapper;
+import com.pig4cloud.pigx.admin.service.SysDeptRelationService;
import com.pig4cloud.pigx.admin.service.SysDeptService;
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
import lombok.AllArgsConstructor;
@@ -34,8 +34,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
-import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
*
@@ -48,8 +48,7 @@ import java.util.List;
@Service
@AllArgsConstructor
public class SysDeptServiceImpl extends ServiceImpl implements SysDeptService {
- private final SysDeptMapper sysDeptMapper;
- private final SysDeptRelationMapper sysDeptRelationMapper;
+ private final SysDeptRelationService sysDeptRelationService;
/**
* 添加信息部门
@@ -62,30 +61,10 @@ public class SysDeptServiceImpl extends ServiceImpl impl
SysDept sysDept = new SysDept();
BeanUtils.copyProperties(dept, sysDept);
this.insert(sysDept);
- this.insertDeptRelation(sysDept);
+ sysDeptRelationService.insertDeptRelation(sysDept);
return Boolean.TRUE;
}
- /**
- * 维护部门关系
- *
- * @param sysDept 部门
- */
- private void insertDeptRelation(SysDept sysDept) {
- //增加部门关系表
- SysDeptRelation deptRelation = new SysDeptRelation();
- deptRelation.setDescendant(sysDept.getParentId());
- List deptRelationList = sysDeptRelationMapper.selectList(new EntityWrapper<>(deptRelation));
- for (SysDeptRelation sysDeptRelation : deptRelationList) {
- sysDeptRelation.setDescendant(sysDept.getDeptId());
- sysDeptRelationMapper.insert(sysDeptRelation);
- }
- //自己也要维护到关系表中
- SysDeptRelation own = new SysDeptRelation();
- own.setDescendant(sysDept.getDeptId());
- own.setAncestor(sysDept.getDeptId());
- sysDeptRelationMapper.insert(own);
- }
/**
* 删除部门
@@ -100,7 +79,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl
sysDept.setUpdateTime(LocalDateTime.now());
sysDept.setDelFlag(CommonConstant.STATUS_DEL);
this.deleteById(sysDept);
- sysDeptRelationMapper.deleteAllDeptRealtion(id);
+ sysDeptRelationService.deleteAllDeptRealtion(id);
return Boolean.TRUE;
}
@@ -118,7 +97,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl
SysDeptRelation relation = new SysDeptRelation();
relation.setAncestor(sysDept.getParentId());
relation.setDescendant(sysDept.getDeptId());
- sysDeptRelationMapper.updateDeptRealtion(relation);
+ sysDeptRelationService.updateDeptRealtion(relation);
return Boolean.TRUE;
}
@@ -131,7 +110,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl
@Override
public List selectListTree(EntityWrapper sysDeptEntityWrapper) {
sysDeptEntityWrapper.orderBy("order_num", false);
- return getDeptTree(this.selectList(sysDeptEntityWrapper), 0);
+ return getDeptTree(this.selectList(sysDeptEntityWrapper));
}
@@ -139,22 +118,19 @@ public class SysDeptServiceImpl extends ServiceImpl impl
* 构建部门树
*
* @param depts 部门
- * @param root 根节点
* @return
*/
- private List getDeptTree(List depts, int root) {
- List trees = new ArrayList<>();
- DeptTree node;
- for (SysDept dept : depts) {
- if (dept.getParentId().equals(dept.getDeptId())) {
- continue;
- }
- node = new DeptTree();
- node.setId(dept.getDeptId());
- node.setParentId(dept.getParentId());
- node.setName(dept.getName());
- trees.add(node);
- }
- return TreeUtil.bulid(trees, root);
+ private List getDeptTree(List depts) {
+
+ List treeList = depts.stream()
+ .filter(dept -> !dept.getDeptId().equals(dept.getParentId()))
+ .map(dept -> {
+ DeptTree node = new DeptTree();
+ node.setId(dept.getDeptId());
+ node.setParentId(dept.getParentId());
+ node.setName(dept.getName());
+ return node;
+ }).collect(Collectors.toList());
+ return TreeUtil.bulid(treeList, 0);
}
}
diff --git a/pigx-upms/pom.xml b/pigx-upms/pom.xml
index 3767fb208..862a81210 100644
--- a/pigx-upms/pom.xml
+++ b/pigx-upms/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-upms
diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml
index 32a13d2de..9adbfb3a6 100755
--- a/pigx-visual/pigx-codegen/pom.xml
+++ b/pigx-visual/pigx-codegen/pom.xml
@@ -6,7 +6,7 @@
com.pig4cloud
pigx-visual
- ${pigx.version}
+ 1.7.0
pigx-codegen
@@ -34,13 +34,19 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
-
+
com.pig4cloud
pigx-common-swagger
- ${pigx.version}
+ 1.7.0
+
+
+
+ com.pig4cloud
+ pigx-common-security
+ 1.7.0
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/PigxCodeGenApplication.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/PigxCodeGenApplication.java
index 6a393292e..cde1505d8 100755
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/PigxCodeGenApplication.java
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/PigxCodeGenApplication.java
@@ -17,6 +17,7 @@
package com.pig4cloud.pigx.codegen;
+import com.pig4cloud.pigx.common.security.feign.EnablePigxFeignClients;
import com.pig4cloud.pigx.common.swagger.annotation.EnablePigxSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
@@ -28,6 +29,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
*/
@EnablePigxSwagger2
@SpringCloudApplication
+@EnablePigxFeignClients
public class PigxCodeGenApplication {
public static void main(String[] args) {
diff --git a/pigx-visual/pigx-daemon/pom.xml b/pigx-visual/pigx-daemon/pom.xml
index 04b1a8872..23292b6da 100644
--- a/pigx-visual/pigx-daemon/pom.xml
+++ b/pigx-visual/pigx-daemon/pom.xml
@@ -23,7 +23,7 @@
com.pig4cloud
pigx-visual
- ${pigx.version}
+ 1.7.0
pigx-daemon
@@ -41,7 +41,7 @@
com.pig4cloud
pigx-common-job
- ${pigx.version}
+ 1.7.0
@@ -64,11 +64,17 @@
curator-recipes
${curator.version}
-
+
com.pig4cloud
pigx-common-swagger
- ${pigx.version}
+ 1.7.0
+
+
+
+ com.pig4cloud
+ pigx-common-security
+ 1.7.0
diff --git a/pigx-visual/pigx-monitor/pom.xml b/pigx-visual/pigx-monitor/pom.xml
index d482c5803..79d6fda2e 100644
--- a/pigx-visual/pigx-monitor/pom.xml
+++ b/pigx-visual/pigx-monitor/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx-visual
- ${pigx.version}
+ 1.7.0
pigx-monitor
diff --git a/pigx-visual/pigx-tx-manager/pom.xml b/pigx-visual/pigx-tx-manager/pom.xml
index fa2557769..d584d0533 100644
--- a/pigx-visual/pigx-tx-manager/pom.xml
+++ b/pigx-visual/pigx-tx-manager/pom.xml
@@ -5,7 +5,7 @@
com.pig4cloud
pigx-visual
- ${pigx.version}
+ 1.7.0
pigx-tx-manager
@@ -63,7 +63,7 @@
com.pig4cloud
pigx-common-core
- ${pigx.version}
+ 1.7.0
diff --git a/pigx-visual/pom.xml b/pigx-visual/pom.xml
index c2ba378be..858d71ee5 100644
--- a/pigx-visual/pom.xml
+++ b/pigx-visual/pom.xml
@@ -24,7 +24,7 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
pigx-visual
diff --git a/pom.xml b/pom.xml
index c7aa9d064..4253257c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,13 +24,12 @@
com.pig4cloud
pigx
- ${pigx.version}
+ 1.7.0
${project.artifactId}
pom
https://www.pig4cloud.com
- 1.7.0
2.0.6.RELEASE
Finchley.SR2
Cairo-SR3