+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 权限范围表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-24
+ */
+@Data
+public class OperationScopeDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 范围key
+ */
+ private String scopeKey;
+
+ /**
+ * 范围名称
+ */
+ private String scopeName;
+
+ /**
+ * 是否删除,0:未删除,1:已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建者id
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新者id
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java
new file mode 100644
index 0000000000..17f8866215
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.result.RoleOpeScopeResultDTO;
+import com.epmet.entity.OperationScopeEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.context.annotation.Scope;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 权限范围表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-24
+ */
+@Mapper
+public interface OperationScopeDao extends BaseDao {
+
+ /**
+ * 查询角色的操作key对应操作范围列表
+ * @param roleId 角色id
+ * @param operationKey 操作key
+ * @return
+ */
+ Set listOperationScopesByRoleId(@Param("roleId") String roleId,
+ @Param("operationKey") String operationKey);
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java
similarity index 61%
rename from epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java
rename to epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java
index d57c02ebde..60982f5528 100644
--- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java
@@ -15,33 +15,19 @@
* along with this program. If not, see .
*/
-package com.epmet.redis;
+package com.epmet.dao;
-import com.epmet.commons.tools.redis.RedisUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.RoleScopeEntity;
+import org.apache.ibatis.annotations.Mapper;
/**
- * 角色能进行那些操作
+ * 角色能操作哪些范围
*
* @author generator generator@elink-cn.com
- * @since v1.0.0 2020-04-22
+ * @since v1.0.0 2020-04-24
*/
-@Component
-public class RoleOperationRedis {
- @Autowired
- private RedisUtils redisUtils;
-
- public void delete(Object[] ids) {
-
- }
-
- public void set(){
-
- }
-
- public String get(String id){
- return null;
- }
-
+@Mapper
+public interface RoleScopeDao extends BaseDao {
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java
new file mode 100644
index 0000000000..2fd6b18361
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 权限范围表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-24
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("operation_scope")
+public class OperationScopeEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 范围key
+ */
+ private String scopeKey;
+
+ /**
+ * 范围名称
+ */
+ private String scopeName;
+
+}
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java
new file mode 100644
index 0000000000..2c3c6f21dc
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.dao.OperationScopeDao;
+import com.epmet.dto.OperationScopeDTO;
+import com.epmet.entity.OperationScopeEntity;
+import com.epmet.service.OperationScopeService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 权限范围表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-24
+ */
+@Service
+public class OperationScopeServiceImpl extends BaseServiceImpl implements OperationScopeService {
+
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, OperationScopeDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, OperationScopeDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public OperationScopeDTO get(String id) {
+ OperationScopeEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, OperationScopeDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(OperationScopeDTO dto) {
+ OperationScopeEntity entity = ConvertUtils.sourceToTarget(dto, OperationScopeEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(OperationScopeDTO dto) {
+ OperationScopeEntity entity = ConvertUtils.sourceToTarget(dto, OperationScopeEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java
index bb6d914d2e..a690363b33 100644
--- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java
@@ -27,7 +27,6 @@ import com.epmet.dao.RoleOperationDao;
import com.epmet.dto.RoleOperationDTO;
import com.epmet.dto.result.RoleOperationResultDTO;
import com.epmet.entity.RoleOperationEntity;
-import com.epmet.redis.RoleOperationRedis;
import com.epmet.service.RoleOperationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,9 +46,6 @@ import java.util.Map;
@Service
public class RoleOperationServiceImpl extends BaseServiceImpl implements RoleOperationService {
- @Autowired
- private RoleOperationRedis roleOperationRedis;
-
@Override
public PageData page(Map params) {
IPage page = baseDao.selectPage(
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java
new file mode 100644
index 0000000000..bff52f8d64
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.dao.RoleScopeDao;
+import com.epmet.dto.RoleScopeDTO;
+import com.epmet.entity.RoleScopeEntity;
+import com.epmet.service.RoleScopeService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 角色能操作哪些范围
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-24
+ */
+@Service
+public class RoleScopeServiceImpl extends BaseServiceImpl implements RoleScopeService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, RoleScopeDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, RoleScopeDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public RoleScopeDTO get(String id) {
+ RoleScopeEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, RoleScopeDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(RoleScopeDTO dto) {
+ RoleScopeEntity entity = ConvertUtils.sourceToTarget(dto, RoleScopeEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(RoleScopeDTO dto) {
+ RoleScopeEntity entity = ConvertUtils.sourceToTarget(dto, RoleScopeEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql
index bcc1d74a5d..93d8c2a148 100644
--- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql
+++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql
@@ -10,6 +10,7 @@ CREATE TABLE `operation_scope` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围key',
`SCOPE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围名称',
+ `SCOPE_INDEX` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围序号',
`DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除',
`REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id',
@@ -61,7 +62,8 @@ CREATE TABLE `role_operation` (
CREATE TABLE `role_scope` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID',
- `SCOPE_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围Key',
+ `OPERATION_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作Key',
+ `SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围Key',
`DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除',
`REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id',
diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml
new file mode 100644
index 0000000000..ab6839e941
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml
new file mode 100644
index 0000000000..fdca928212
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java
index 173e19243a..61944d3939 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java
+++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java
@@ -30,7 +30,7 @@ public class AccessController {
private AccessService accessService;
/**
- * 查询用户可操作功能列表(包含缓存)
+ * 查询用户可操作功能列表(同时更新缓存)
* @param tokenDto
* @param staffOperationDTO
* @return
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java
index 8cb514ad3f..b41a5e59ca 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java
+++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java
@@ -16,7 +16,7 @@ import java.util.List;
* @Description
* @Author sun
*/
-@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class)
+@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class, url = "localhost:8099")
public interface GovAccessFeignClient {
/**
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
index 737988fd0b..8c03d28764 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
+++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
@@ -2,6 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
@@ -49,4 +50,11 @@ public interface GovOrgFeignClient {
@PostMapping(value = "/gov/org/customerstaffgrid/getstaffgrid")
Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO);
+ /**
+ * 根据Id查询agency
+ * @param agencyId
+ * @return
+ */
+ @PostMapping("/gov/org/agency/{agencyId}")
+ Result getAgencyById(@PathVariable("agencyId") String agencyId);
}
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
index 818a325666..128f81bd50 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
+++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
@@ -3,6 +3,7 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
@@ -28,6 +29,11 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO);
}
+ @Override
+ public Result getAgencyById(String agencyId) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId);
+ }
+
@Override
public Result getLatestCustomer(String userId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getLatestCustomer", userId);
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
index 1da258978a..d76e2e2f34 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
+++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
@@ -1,14 +1,20 @@
package com.epmet.service.impl;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.StaffPermCacheFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.RoleOperationResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovAccessFeignClient;
+import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.AccessService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -21,12 +27,17 @@ import java.util.Set;
@Service
public class AccessServiceImpl implements AccessService {
+ private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class);
+
@Autowired
private EpmetUserFeignClient userFeignClient;
@Autowired
private GovAccessFeignClient govAccessFeignClient;
+ @Autowired
+ private GovOrgFeignClient govOrgFeignClient;
+
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@@ -49,24 +60,46 @@ public class AccessServiceImpl implements AccessService {
roleDTOS.addAll(gridResult.getData());
}
- // 拼装
+ // 拼装操作key列表
Set opeKeys = new HashSet<>();
+ // 角色ID列表
+ Set roleIds = new HashSet<>();
roleDTOS.forEach(roleDto -> {
String roleId = roleDto.getId();
- List roleOperations = govAccessFeignClient.listOperationsByRoleId(roleId).getData();
- roleOperations.forEach(roleOpe -> {
- if (roleOpe != null) {
- opeKeys.add(roleOpe.getOperationKey());
- }
- });
+ Result> result = govAccessFeignClient.listOperationsByRoleId(roleId);
+ if (result.getCode() != 0) {
+ // 获取operation异常
+ logger.error("调用GovAccess,根据RoleId查询Operation列表失败:{}", result.getMsg());
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ }
+ List roleOperations = result.getData();
+ // 角色id
+ roleIds.add(roleDto.getId());
+ if (!CollectionUtils.isEmpty(roleOperations)) {
+ roleOperations.forEach(roleOpe -> {
+ if (roleOpe != null) {
+ opeKeys.add(roleOpe.getOperationKey());
+ }
+ });
+ }
});
+ // 查询该直属机关的orgIdPath
+ Result agencyById = govOrgFeignClient.getAgencyById(agencyId);
+ if (agencyById.getCode() != 0 || agencyById.getData() == null) {
+ logger.error("根据当前机构id[{}]查询pids失败:{}", agencyId, agencyById.getMsg());
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ }
+
// 将最新权限缓存到redis,为了尽量统一操作入口,调用gov-access接口实现
StaffPermCacheFormDTO staffPermCacheFormDTO = new StaffPermCacheFormDTO();
staffPermCacheFormDTO.setApp(app);
staffPermCacheFormDTO.setClient(client);
staffPermCacheFormDTO.setStaffId(staffId);
staffPermCacheFormDTO.setPermissions(opeKeys);
+ staffPermCacheFormDTO.setRoleIdList(roleIds);
+ // 拼接orgIdPath
+ staffPermCacheFormDTO.setOrgIdPath(String.format("%s:%s", agencyById.getData().getPids(), agencyId));
govAccessFeignClient.updatePermissionCache(staffPermCacheFormDTO);
return opeKeys;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java
new file mode 100644
index 0000000000..d18a182d1e
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java
@@ -0,0 +1,27 @@
+package com.epmet.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 根据userId查询customerId 的DTO
+ * @Auther zxc
+ * @Create 2020-04-24 15:57
+ */
+@Data
+public class CustomerIdDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * userId 用户id
+ */
+ private String userId;
+
+ /**
+ * customerId 客户id
+ */
+ private String customerId;
+
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java
index 1188979f4a..57680d2ecd 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java
@@ -16,20 +16,10 @@ package com.epmet.dto.form;
* along with this program. If not, see .
*/
-
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
-import java.util.List;
-
-/**
- * 添加部门人员DTO
- * @Auther zxc
- * @Create 2020-04-24 14:51
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
/**
* 添加部门-接口入参
@@ -41,16 +31,6 @@ public class AddDepartmentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
- /**
- *部门id
- */
- private String departmentId;
-
- /**
- * 选中人员id
- */
- private List selectedList;
-
/**
* 所属组织机构ID(customer_agency.id)
*/
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java
new file mode 100644
index 0000000000..96503be98e
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java
@@ -0,0 +1,31 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 添加部门人员DTO
+ * @Auther zxc
+ * @Create 2020-04-24 14:51
+ */
+@Data
+public class AddDepartmentStaffFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *部门id
+ */
+ @NotBlank(message = "部门id不能为空")
+ private String departmentId;
+
+ /**
+ * 选中人员id
+ */
+ @NotBlank(message = "选中人员不能为空")
+ private List selectedList;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
index b8b8300489..728e6e03a8 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
@@ -18,17 +18,17 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.AgencysResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
+import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.service.AgencyService;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -110,4 +110,21 @@ public class AgencyController {
public Result> agencyList(@RequestBody AgencyListFormDTO formDTO) {
return agencyService.agencyList(formDTO);
}
+
+ /**
+ * 根据Id查询agency
+ * @param agencyId
+ * @return
+ */
+ @PostMapping("{agencyId}")
+ public Result getAgencyById(@PathVariable("agencyId") String agencyId) {
+ CustomerAgencyEntity agency = agencyService.getAgencyById(agencyId);
+ CustomerAgencyDTO customerAgencyDTO = new CustomerAgencyDTO();
+ if (agency != null) {
+ BeanUtils.copyProperties(agency, customerAgencyDTO);
+ return new Result().ok(customerAgencyDTO);
+ }
+ return new Result();
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
index 33a1d7fe87..eba65e1372 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
@@ -29,9 +29,15 @@ public class DepartmentController {
@Autowired
private DepartmentService departmentService;
+ /**
+ * 添加部门人员
+ * @param tokenDto
+ * @param addDepartmentStaffFormDTO
+ * @return
+ */
@PostMapping(value = "adddepartmentstaff")
- public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){
- return null;
+ public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){
+ return departmentService.addDepartmentStaff(tokenDto,addDepartmentStaffFormDTO);
}
/**
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java
index 22ab90c4ba..2f103d1daf 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java
@@ -41,4 +41,11 @@ public interface CustomerStaffDepartmentDao extends BaseDao selectUserIdByDepartmentId(@Param("departmentId") String departmentId);
+
+ /**
+ * 修改部门人数
+ * @param
+ * @auther zxc
+ */
+ void updateDepartmentStaffCount(@Param("addCount")Integer addCount,@Param("departmentId")String departmentId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
index 96f51e83ec..8eb86517de 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -3,6 +3,10 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.CustomerStaffGridDTO;
+import com.epmet.dto.StaffGridListDTO;
+import com.epmet.dto.form.AddDepartmentStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffInfoFromDTO;
import com.epmet.dto.form.StaffSubmitFromDTO;
@@ -36,6 +40,11 @@ public interface EpmetUserFeignClient {
@PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid")
Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO);
+ /**
+ * 获取网格下人员具体信息(头像、名字...)
+ * @param customerStaffGridDTOS
+ * @return
+ */
@PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid")
Result> getStaffGridList(@RequestBody List customerStaffGridDTOS);
@@ -47,6 +56,11 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/staffsinagency")
Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
+ /**
+ * 获取网格下未禁用的人员数量
+ * @param userIdDTO
+ * @return
+ */
@PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid")
Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO);
@@ -120,4 +134,12 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/getdepartmentstafflist")
Result> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO);
+ /**
+ * 根据userId查询customerId
+ * @param addDepartmentStaffFormDTO
+ * @auther zxc
+ */
+ @PostMapping("/epmetuser/customerstaff/selectcustomeridbyuserid")
+ Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO);
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
index 273b6172d1..1284fb622b 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
@@ -4,6 +4,10 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.CustomerStaffGridDTO;
+import com.epmet.dto.StaffGridListDTO;
+import com.epmet.dto.form.AddDepartmentStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffInfoFromDTO;
import com.epmet.dto.form.StaffSubmitFromDTO;
@@ -82,4 +86,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result disabledStaff(StaffInfoFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "disabledStaff", fromDTO);
}
+ @Override
+ public Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectCustomerIdByUserId", addDepartmentStaffFormDTO);
+ }
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
index f2edc0c462..d09e56ba05 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
@@ -23,6 +23,7 @@ import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.AgencysResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
+import com.epmet.entity.CustomerAgencyEntity;
import java.util.List;
@@ -80,4 +81,11 @@ public interface AgencyService {
* @Description 获取组织列表
*/
Result> agencyList(AgencyListFormDTO formDTO);
+
+ /**
+ * 根据Id查询
+ * @param agencyId
+ * @return
+ */
+ CustomerAgencyEntity getAgencyById(String agencyId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
index 48fe029fb0..2d49860de2 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
@@ -17,7 +17,9 @@
package com.epmet.service;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@@ -77,4 +79,11 @@ public interface DepartmentService {
* @Description 获取机构下部门列表
*/
Result> departmentList(DepartmentListFormDTO formDTO);
+
+ /**
+ * 添加部门人员
+ * @param addDepartmentStaffFormDTO
+ * @return
+ */
+ Result addDepartmentStaff(TokenDto tokenDto,AddDepartmentStaffFormDTO addDepartmentStaffFormDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index a71c53e80a..7177d64d7e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -184,4 +184,9 @@ public class AgencyServiceImpl implements AgencyService {
List agencyList = customerAgencyDao.selectAgencyList(formDTO.getAgencyId());
return new Result>().ok(agencyList);
}
+
+ @Override
+ public CustomerAgencyEntity getAgencyById(String agencyId) {
+ return customerAgencyDao.selectById(agencyId);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
index a53a6bac1c..075799dfb8 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
@@ -177,6 +177,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl griddetail(CustomerGridFormDTO customerGridFormDTO) {
GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO);
List customerStaffGridDTOS = baseDao.selectUserIdByGridId(customerGridFormDTO);
+ //获取人员具体信息(头像、名字...)
Result> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS);
griddetail.setStaffGridList(staffGridList.getData());
return new Result().ok(griddetail);
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
index 263daff4ac..dda0d02ae7 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
@@ -20,17 +20,20 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerDepartmentConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerDepartmentDao;
import com.epmet.dao.CustomerStaffDepartmentDao;
+import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
+import com.epmet.entity.CustomerStaffDepartmentEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.service.DepartmentService;
import com.epmet.util.ModuleConstant;
@@ -197,4 +200,30 @@ public class DepartmentServiceImpl implements DepartmentService {
List departmentList = customerDepartmentDao.selectDepartmentList(formDTO.getAgencyId());
return new Result>().ok(departmentList);
}
+
+ /**
+ * 添加部门人员
+ * @param tokenDto
+ * @param addDepartmentStaffFormDTO
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result addDepartmentStaff(TokenDto tokenDto,AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) {
+ CustomerStaffDepartmentEntity customerStaffDepartmentEntity = new CustomerStaffDepartmentEntity();
+ Result> listResult = epmetUserFeignClient.selectCustomerIdByUserId(addDepartmentStaffFormDTO);
+ List data = listResult.getData();
+ customerStaffDepartmentEntity.setDepartmentId(addDepartmentStaffFormDTO.getDepartmentId());
+ customerStaffDepartmentEntity.setCreatedBy(tokenDto.getUserId());
+ customerStaffDepartmentEntity.setUpdatedBy(tokenDto.getUserId());
+ customerStaffDepartmentEntity.setDelFlag("0");
+ customerStaffDepartmentEntity.setRevision(0);
+ for (CustomerIdDTO customerIdDTO : data) {
+ customerStaffDepartmentEntity.setUserId(customerIdDTO.getUserId());
+ customerStaffDepartmentEntity.setCustomerId(customerIdDTO.getCustomerId());
+ customerStaffDepartmentDao.insert(customerStaffDepartmentEntity);
+ }
+ customerStaffDepartmentDao.updateDepartmentStaffCount(data.size(),addDepartmentStaffFormDTO.getDepartmentId());
+ return new Result();
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml
index 8df91287f1..6f13998784 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml
@@ -14,5 +14,15 @@
+
+
+ UPDATE
+ customer_department
+ SET
+ total_user = total_user + #{addCount}
+ WHERE
+ id = #{departmentId}
+
+
\ No newline at end of file
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java
index 78905406ba..9bc2f4c4de 100644
--- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java
@@ -23,7 +23,7 @@ import lombok.Data;
/**
- * 政府端角色表
+ * 政府端角色字典表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-04-22
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
index f1ed7bd6ba..748252137b 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
@@ -27,6 +27,10 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.CustomerStaffGridDTO;
+import com.epmet.dto.StaffGridListDTO;
+import com.epmet.dto.form.*;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffDetailResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
@@ -145,18 +149,13 @@ public class CustomerStaffController {
return customerStaffService.getCustomerStaffInfoByUserId(formDTO);
}
- @PostMapping(value = "selectgridstaffcountbyuserid")
- public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){
- return customerStaffService.selectGridStaffCountByUserId(userIdDTO);
- }
-
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("staffsinagency")
- public Result> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) {
+ public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO);
}
@@ -166,74 +165,18 @@ public class CustomerStaffController {
* @return
*/
@PostMapping("stafflist")
- public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) {
+ public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffList(fromDTO);
}
/**
- * 人员添加页面初始化
- *
- * @param fromDTO 参数
- * @return Result
+ * 查询网格下未被禁用人员
+ * @param userIdDTO
+ * @auther zxc
*/
- @PostMapping("rolelist")
- public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
- return customerStaffService.addStaffInit(fromDTO);
- }
-
- /**
- * 人员编辑页面初始化
- *
- * @param fromDTO 参数
- * @return Result
- */
- @PostMapping("editstaffinit")
- public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
- return customerStaffService.editStaffInit(fromDTO);
- }
-
- /**
- * 人员添加
- *
- * @param fromDTO 参数
- * @return Result
- */
- @PostMapping("addstaff")
- public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){
- return customerStaffService.addStaff(fromDTO);
- }
-
- /**
- * 人员编辑
- *
- * @param fromDTO 参数
- * @return Result
- */
- @PostMapping("editstaff")
- public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){
- return customerStaffService.editStaff(fromDTO);
- }
-
- /**
- * 人员详情
- *
- * @param fromDTO 参数
- * @return Result
- */
- @PostMapping("staffdetail")
- public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){
- return customerStaffService.getStaffDetail(fromDTO);
- }
-
- /**
- * 人员禁用
- *
- * @param fromDTO 参数
- * @return Result
- */
- @PostMapping("disabledstaff")
- public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){
- return customerStaffService.disabledStaff(fromDTO);
+ @PostMapping(value = "selectgridstaffcountbyuserid")
+ public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){
+ return customerStaffService.selectGridStaffCountByUserId(userIdDTO);
}
/**
@@ -246,4 +189,9 @@ public class CustomerStaffController {
public Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO) {
return customerStaffService.getDepartmentStaffList(fromDTO);
}
+
+ @PostMapping(value = "selectcustomeridbyuserid")
+ public Result> selectCustomerIdByUserId(@RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){
+ return customerStaffService.selectCustomerIdByUserId(addDepartmentStaffFormDTO);
+ }
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
index 795b0a34d9..c3fc1b9f24 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
@@ -1,5 +1,7 @@
package com.epmet.controller;
+import com.epmet.commons.mybatis.entity.DataScope;
+import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO;
@@ -65,7 +67,7 @@ public class StaffRoleController {
ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class);
String roleKey = staffRoleFormDTO.getRoleKey();
String orgId = staffRoleFormDTO.getOrgId();
- List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId);
+ List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId , DataScope.getDefault());
return new Result>().ok(staffRoleDTOS);
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
index e74e4b6ce5..6c4cab6dc7 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
@@ -20,10 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
-import com.epmet.dto.form.CustomerStaffFormDTO;
-import com.epmet.dto.form.StaffInfoFromDTO;
-import com.epmet.dto.form.DepartmentInStaffFormDTO;
-import com.epmet.dto.form.StaffsInAgencyFromDTO;
+import com.epmet.dto.form.*;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
@@ -115,4 +112,11 @@ public interface CustomerStaffDao extends BaseDao {
* @Description 根据客户Id及userId集合查询用户基本信息
*/
List selectDepartmentStaffList(DepartmentInStaffFormDTO fromDTO);
+
+ /**
+ *
+ * @param departmentStaffFormDTO
+ * @auther zxc
+ */
+ List selectCustomerIdByUserId(AddDepartmentStaffFormDTO departmentStaffFormDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
index a79bafba8b..abd130c21c 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
@@ -21,15 +21,10 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
-import com.epmet.dto.form.CustomerGridFormDTO;
+import com.epmet.dto.form.*;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
-import com.epmet.dto.form.CustomerStaffFormDTO;
-import com.epmet.dto.form.StaffInfoFromDTO;
-import com.epmet.dto.form.StaffSubmitFromDTO;
-import com.epmet.dto.form.DepartmentInStaffFormDTO;
-import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffDetailResultDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
@@ -218,4 +213,11 @@ public interface CustomerStaffService extends BaseService {
* @Description 根据客户Id及userId集合查询用户基本信息
*/
Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO);
+
+ /**
+ * 根据userId查询customerId
+ * @param: addDepartmentStaffFormDTO
+ * @auther: zxc
+ */
+ Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
index 88742d7400..9c6af5321e 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
@@ -17,6 +17,7 @@
package com.epmet.service;
+import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.StaffRoleDTO;
@@ -100,7 +101,7 @@ public interface StaffRoleService extends BaseService {
* @param orgId
* @return
*/
- List listStaffsInRole(String roleKey, String orgId);
+ List listStaffsInRole(String roleKey, String orgId, DataScope dataScope);
/**
* 清空工作人员权限
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
index fdd47f560d..d3a98772bd 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
@@ -32,6 +32,17 @@ import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
+import com.epmet.dto.form.*;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.CustomerStaffGridDTO;
+import com.epmet.dto.GovStaffRoleDTO;
+import com.epmet.dto.StaffGridListDTO;
+import com.epmet.dto.StaffRoleDTO;
+import com.epmet.dto.result.StaffDetailResultDTO;
+import com.epmet.dto.result.DepartInStaffListResultDTO;
+import com.epmet.dto.result.StaffInfoResultDTO;
+import com.epmet.dto.result.StaffInitResultDTO;
+import com.epmet.dto.result.StaffRoleResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.entity.StaffRoleEntity;
@@ -352,4 +363,14 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffList);
}
+ /**
+ *
+ * @param: addDepartmentStaffFormDTO
+ * @auther: zxc
+ */
+ @Override
+ public Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) {
+ return new Result>().ok(baseDao.selectCustomerIdByUserId(addDepartmentStaffFormDTO));
+ }
+
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
index 0a9d7ce90d..180521ebe3 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
@@ -19,6 +19,8 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.annotation.DataFilter;
+import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -110,7 +112,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) {
+ public List listStaffsInRole(String roleKey, String orgId, DataScope dataScope) {
return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId);
}
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
index b2bd97dbd4..d1cfdd797d 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
@@ -145,4 +145,20 @@
ORDER BY CONVERT (real_name USING gbk) ASC
+
+
+
\ No newline at end of file