diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index eab4df7b72..f8fb4b718d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -73,4 +73,9 @@ public interface ServiceConstant { * 消息服务 */ String EPMET_MESSAGE_SERVER = "epmet-message-server"; + + /** + * 政府端权限服务 + */ + String GOV_ACCESS_SERVER = "gov-access-server"; } diff --git a/epmet-module/gov-access/gov-access-client/pom.xml b/epmet-module/gov-access/gov-access-client/pom.xml index 35a138e635..b20a28582a 100644 --- a/epmet-module/gov-access/gov-access-client/pom.xml +++ b/epmet-module/gov-access/gov-access-client/pom.xml @@ -11,5 +11,11 @@ gov-access-client - + + + com.epmet + epmet-commons-tools + 2.0.0 + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java new file mode 100644 index 0000000000..bda4931386 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java @@ -0,0 +1,82 @@ +/** + * 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.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 是否删除,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/result/RoleOperationResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java new file mode 100644 index 0000000000..dc7fc1559e --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java @@ -0,0 +1,87 @@ +/** + * 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.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 操作名称 + */ + private String operationName; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private String 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-server/src/main/java/com/epmet/controller/RoleController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java new file mode 100644 index 0000000000..8e9778734b --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java @@ -0,0 +1,33 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.service.RoleOperationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("role") +public class RoleController { + + @Autowired + private RoleOperationService roleOperationService; + + /** + * 查询角色对应的操作列表 + * @param roleId + * @return + */ + @PostMapping("operations/{roleId}") + public Result> listOperationsByRoleId(@PathVariable("roleId") String roleId) { + List roleOperationResultDTOS = roleOperationService.listOperationsByRoleId(roleId); + return new Result>().ok(roleOperationResultDTOS); + } + + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java new file mode 100644 index 0000000000..a1b408ba7a --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java @@ -0,0 +1,38 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.entity.RoleOperationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface RoleOperationDao extends BaseDao { + + List listOperationsByRoleId(@Param("roleId") String roleId); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java new file mode 100644 index 0000000000..96f70de1be --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.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-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("role_operation") +public class RoleOperationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java new file mode 100644 index 0000000000..4b0c4ee373 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java @@ -0,0 +1,62 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationExcel { + + @Excel(name = "") + private String id; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "操作key") + private String operationKey; + + @Excel(name = "是否删除,0:未删除,1:已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建者id") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者id") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ 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/redis/RoleOperationRedis.java new file mode 100644 index 0000000000..d57c02ebde --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java @@ -0,0 +1,47 @@ +/** + * 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.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class RoleOperationRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java new file mode 100644 index 0000000000..ebc000a36b --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java @@ -0,0 +1,103 @@ +/** + * 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; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.RoleOperationDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.entity.RoleOperationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface RoleOperationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return RoleOperationDTO + * @author generator + * @date 2020-04-22 + */ + RoleOperationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(RoleOperationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(RoleOperationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); + + /** + * 查询角色对应的操作列表 + * @param roleId + * @return + */ + List listOperationsByRoleId(String roleId); +} \ 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 new file mode 100644 index 0000000000..bb6d914d2e --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java @@ -0,0 +1,110 @@ +/** + * 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.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; +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-22 + */ +@Service +public class RoleOperationServiceImpl extends BaseServiceImpl implements RoleOperationService { + + @Autowired + private RoleOperationRedis roleOperationRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, RoleOperationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, RoleOperationDTO.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 RoleOperationDTO get(String id) { + RoleOperationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, RoleOperationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(RoleOperationDTO dto) { + RoleOperationEntity entity = ConvertUtils.sourceToTarget(dto, RoleOperationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RoleOperationDTO dto) { + RoleOperationEntity entity = ConvertUtils.sourceToTarget(dto, RoleOperationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List listOperationsByRoleId(String roleId) { + return baseDao.listOperationsByRoleId(roleId); + } + +} \ 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 c7c63b6c42..67e7a5c7b2 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 @@ -6,7 +6,7 @@ -- #SET FOREIGN_KEY_CHECKS = 0; -- DROP TABLE IF EXISTS `permission_scope`; -CREATE TABLE `permission_scope` ( +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 '范围名称', @@ -22,8 +22,8 @@ CREATE TABLE `permission_scope` ( -- ---------------------------- -- Table structure for resource_ope -- ---------------------------- -DROP TABLE IF EXISTS `resource_ope`; -CREATE TABLE `resource_ope` ( +-- DROP TABLE IF EXISTS `operation`; +CREATE TABLE `operation` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `OPERATION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `OPERATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, @@ -40,7 +40,7 @@ CREATE TABLE `resource_ope` ( -- ---------------------------- -- Table structure for role_operation -- ---------------------------- -DROP TABLE IF EXISTS `role_operation`; +-- DROP TABLE IF EXISTS `role_operation`; CREATE TABLE `role_operation` ( `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', @@ -57,7 +57,7 @@ CREATE TABLE `role_operation` ( -- ---------------------------- -- Table structure for role_scope -- ---------------------------- -DROP TABLE IF EXISTS `role_scope`; +-- DROP TABLE IF EXISTS `role_scope`; 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', diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml new file mode 100644 index 0000000000..0845fc5202 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java new file mode 100644 index 0000000000..220f1f4a8f --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class StaffOperationDTO { + + //@NotBlank(message = "角色所属组织ID不能为空") + private String agencyId; + + //@NotBlank(message = "角色所属网格ID不能为空") + private String gridId; +} diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java new file mode 100644 index 0000000000..48938483bb --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -0,0 +1,9 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class StaffRoleFormDTO { + private String staffId; + private String orgId; +} diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index e9965f902b..b06d8fc331 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -71,6 +71,12 @@ 2.0.0 compile + + com.epmet + gov-access-client + 2.0.0 + compile + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java new file mode 100644 index 0000000000..b6a2591152 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java @@ -0,0 +1,12 @@ +package com.epmet.constant; + +/** + * @Description 机构员工的常量 + * @IntefaceName StaffAgencyConstant + * @Author wangc + * @date 2020.04.23 11:25 + */ +public interface StaffAgencyConstant { + + String QUERY_LATEST_GRID_INFO_FAILED = "查询上一次登录的网格信息失败"; +} 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 new file mode 100644 index 0000000000..9cef45a3b4 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java @@ -0,0 +1,42 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.StaffOperationDTO; +import com.epmet.service.AccessService; +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 java.util.List; +import java.util.Set; + +/** + * @return + * 我的权限相关 + * @Author wxz + * @Description + * @Date 2020/4/22 22:18 + **/ +@RestController +@RequestMapping("access") +public class AccessController { + + @Autowired + private AccessService accessService; + + @PostMapping("getstaffoperations") + public Result> getStaffOperations(@LoginUser TokenDto tokenDto, @RequestBody StaffOperationDTO staffOperationDTO) { + //public Result> getStaffOperations(@RequestBody StaffOperationDTO staffOperationDTO) { + String agencyId = staffOperationDTO.getAgencyId(); + String gridId = staffOperationDTO.getGridId(); + String staffId = tokenDto.getUserId(); + Set opeKeys = accessService.listOpeKeysByStaffId(staffId, agencyId, gridId); + return new Result>().ok(opeKeys); + } + +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java index 372936494b..a947fa817b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java @@ -21,6 +21,8 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.SwitchGridFormDTO; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.service.StaffAgencyService; @@ -78,4 +80,19 @@ public class StaffAgencyController { public Result> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { return staffAgencyService.switchGrid(switchGridFormDTO); } + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param TokenDto -> userId/staffId + * @Param LatestGridFormDTO -> customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:16 + **/ + @PostMapping("getlatestgrid") + public Result getLatestGrid(@LoginUser TokenDto tokenDto, @RequestBody LatestGridFormDTO latestGridFormDTO){ + latestGridFormDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(latestGridFormDTO); + return staffAgencyService.getLatestGrid(latestGridFormDTO); + } + } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index a4196b9f7d..2e261727b2 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -3,11 +3,19 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffGridVisitedFormDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import com.epmet.dto.form.StaffRoleFormDTO; + /** * @Description @@ -15,6 +23,24 @@ import org.springframework.web.bind.annotation.RequestBody; */ @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + @GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") + Result getLatestCustomer(@PathVariable("userId") String userId); + + /** + * @Description 查询工作人员上次登录的网格 + * @Param customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:44 + **/ + @PostMapping(value = "/epmetuser/staffgridvisited/getstafflatestgrid") + Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); /** * @param staffGridVisitedFormDTO @@ -25,4 +51,11 @@ public interface EpmetUserFeignClient { **/ @PostMapping(value = "/epmetuser/staffgridvisited/savestaffgridvisitedrecord", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result saveStaffGridVisitedRecord(@RequestBody StaffGridVisitedFormDTO staffGridVisitedFormDTO); + /** + * 查询工作人员的角色 + * @return + */ + @PostMapping("/epmetuser/staffrole/staffroles") + Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); } + 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 new file mode 100644 index 0000000000..facacdb301 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -0,0 +1,25 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.feign.fallback.GovAccessFeignClientFallback; +import com.epmet.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) +public interface GovAccessFeignClient { + + @PostMapping("/gov/access/role/operations/{roleId}") + Result> listOperationsByRoleId(@PathVariable("roleId") String roleId); +} 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 f87abc24e4..737988fd0b 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,12 +2,15 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -35,4 +38,15 @@ public interface GovOrgFeignClient { */ @GetMapping("/gov/org/customerstaffagency/getlatestcustomer/{userId}") Result getLatestCustomer(@PathVariable("userId") String userId); + + /** + * @Description 查询指定客户下一个用户所在的网格,调用gov-org + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:53 + **/ + @PostMapping(value = "/gov/org/customerstaffgrid/getstaffgrid") + Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO); + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 161de27c58..fba1ee780a 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -1,12 +1,20 @@ 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.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description * @Author sun @@ -14,6 +22,19 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result getLatestCustomer(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); + } + + @Override + public Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff"); + } + @Override + public Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffLatestGrid",latestGridFormDTO); + } @Override public Result saveStaffGridVisitedRecord(StaffGridVisitedFormDTO staffGridVisitedFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffGridVisitedRecord", staffGridVisitedFormDTO); diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java new file mode 100644 index 0000000000..0fc5df6a94 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java @@ -0,0 +1,28 @@ +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.StaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovAccessFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@Component +public class GovAccessFeignClientFallback implements GovAccessFeignClient { + + @Override + public Result> listOperationsByRoleId(String roleId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationsByRoleId"); + } +} 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 944eef1619..832c538376 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.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.GovOrgFeignClient; @@ -22,6 +23,16 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); } + @Override + public Result getLatestCustomer(String userId) { + return null; + } + + @Override + public Result getStaffGrid(LatestGridFormDTO latestGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO); + } + @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/AccessService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java new file mode 100644 index 0000000000..bb213bd94d --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java @@ -0,0 +1,19 @@ +package com.epmet.service; + +import java.util.List; +import java.util.Set; + +/** + * 权限service + * @Author wxz + * @Description + * @Date 2020/4/22 23:29 + **/ +public interface AccessService { + /** + * 根据staffId查询角色Key列表 + * @param staffId + * @return + */ + Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId); +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index d2f7254998..cc45335509 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -17,11 +17,14 @@ package com.epmet.service; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.SwitchGridFormDTO; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -56,4 +59,13 @@ public interface StaffAgencyService { * @Date 2020/4/23 10:49 **/ Result> switchGrid(SwitchGridFormDTO switchGridFormDTO); + + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param LatestGridFormDTO -> staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:14 + **/ + Result getLatestGrid(LatestGridFormDTO latestGridFormDTO); } \ No newline at end of file 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 new file mode 100644 index 0000000000..c7823cd335 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -0,0 +1,61 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.StaffRoleDTO; +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.service.AccessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +public class AccessServiceImpl implements AccessService { + + @Autowired + private EpmetUserFeignClient userFeignClient; + + @Autowired + private GovAccessFeignClient govAccessFeignClient; + + @Override + public Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId) { + List roleDTOS = new ArrayList<>(); + // 查询机关单位权限 + StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); + formDTO.setStaffId(staffId); + formDTO.setOrgId(agencyId); + Result> agencyResult = userFeignClient.getRolesOfStaff(formDTO); + if (!CollectionUtils.isEmpty(agencyResult.getData())) { + roleDTOS.addAll(agencyResult.getData()); + } + // 查询网格权限 + formDTO.setStaffId(staffId); + formDTO.setOrgId(gridId); + Result> gridResult = userFeignClient.getRolesOfStaff(formDTO); + if (!CollectionUtils.isEmpty(gridResult.getData())) { + roleDTOS.addAll(gridResult.getData()); + } + + // 拼装 + Set opeKeys = 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()); + } + }); + }); + return opeKeys; + } +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index dd2243920b..092debf3c6 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -24,7 +24,6 @@ import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; import org.slf4j.Logger; @@ -63,6 +62,29 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { return govOrgFeignClient.getLatestCustomer(tokenDTO.getUserId()); } + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param LatestGridFormDTO -> staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:14 + **/ + @Override + public Result getLatestGrid(LatestGridFormDTO latestGridFormDTO) { + Result latestGridResult = + epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO); + if(latestGridResult.success() && null != latestGridResult.getData() && StringUtils.isNotBlank(latestGridResult.getData().getGridId())){ + return latestGridResult; + }else{ + Result staffGridResult = + govOrgFeignClient.getStaffGrid(latestGridFormDTO); + if(staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())){ + return staffGridResult; + } + } + return new Result().error(StaffAgencyConstant.QUERY_LATEST_GRID_INFO_FAILED); + } + @Override public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java new file mode 100644 index 0000000000..7642a7ae0b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author: wangc + * @description: + * @date: Created in 2020-04-22 18:19 + */ +@Data +public class LatestGridFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空") + private String customerId; + + /** + * 工作人员Id + * */ + @NotBlank(message = "工作人员Id不能为空") + private String staffId; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java index ec584efb56..757d7383a7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java @@ -26,6 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.excel.CustomerStaffGridExcel; import com.epmet.service.CustomerStaffGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +39,7 @@ import java.util.Map; /** - * 网格人员关系表 + * 网格人员关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 @@ -45,7 +47,7 @@ import java.util.Map; @RestController @RequestMapping("customerstaffgrid") public class CustomerStaffGridController { - + @Autowired private CustomerStaffGridService customerStaffGridService; @@ -91,4 +93,16 @@ public class CustomerStaffGridController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffGridExcel.class); } + /** + * @Description 查询指定客户下一个用户所在的网格,调用gov-org + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:53 + **/ + @PostMapping("getstaffgrid") + public Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){ + ValidatorUtils.validateEntity(latestGridFormDTO); + return customerStaffGridService.getStaffGridOrderByGridName(latestGridFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java index 01dc0c2721..dc61c9039f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.CustomerStaffGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffGridDao extends BaseDao { - + + /** + * @Description 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 + * @Param LatestGridFormDTO -> customerId ; userId + * @return CustomerGridDTO + * @Author wangc + * @Date 2020.04.23 01:09 + **/ + CustomerGridDTO selectStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java index a0b273fb76..5a085e3d1d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java @@ -19,7 +19,10 @@ package com.epmet.service; 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.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import java.util.List; @@ -92,4 +95,13 @@ public interface CustomerStaffGridService extends BaseService customerId ; staffId + * @return CustomerGridDTO + * @Author wangc + * @Date 2020.04.23 09:11 + **/ + Result getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java index 894bb6a888..074ac2f36a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java @@ -23,8 +23,12 @@ 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.commons.tools.utils.Result; import com.epmet.dao.CustomerStaffGridDao; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import com.epmet.redis.CustomerStaffGridRedis; import com.epmet.service.CustomerStaffGridService; @@ -101,4 +105,14 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO) { + CustomerGridDTO grid = baseDao.selectStaffGridOrderByGridName(latestGridFormDTO); + CustomerGridByUserIdResultDTO result = new CustomerGridByUserIdResultDTO(); + result.setGridName(grid.getGridName()); + result.setGridId(grid.getId()); + result.setAgencyId(grid.getPid()); + return new Result().ok(result); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml index 13dbdb25ce..47a9de4a33 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml @@ -17,4 +17,28 @@ + + + \ 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 new file mode 100644 index 0000000000..78905406ba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java @@ -0,0 +1,91 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class GovStaffRoleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色所属体系类型:agency,department,grid + */ + private String orgType; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java new file mode 100644 index 0000000000..59d649f970 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.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. + *

+ * 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-22 + */ +@Data +public class StaffRoleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 用户ID + */ + private String staffId; + + /** + * 角色ID + */ + private String roleId; + + /** + * 角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID + */ + private String orgId; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java new file mode 100644 index 0000000000..ac116b4a4f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class StaffRoleFormDTO { + + @NotBlank(message = "工作人员ID不能为空") + private String staffId; + + /** + * 机构id,可以是agencyId,DeptId,GridId + */ + @NotBlank(message = "工作人员所属组织ID不能为空") + private String orgId; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java index ff4a8a00a9..2e8dc01c3f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java @@ -17,6 +17,10 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.service.StaffGridVisitedService; @@ -42,6 +46,19 @@ public class StaffGridVisitedController { @Autowired private StaffGridVisitedService staffGridVisitedService; + /** + * @Description 查询工作人员上次登录的网格 + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:05 + **/ + @PostMapping("getstafflatestgrid") + Result getStaffLatestGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){ + ValidatorUtils.validateEntity(latestGridFormDTO); + return staffGridVisitedService.getStaffLatestGrid(latestGridFormDTO); + } + /** * @param staffGridVisitedFormDTO * @return com.epmet.commons.tools.utils.Result 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 new file mode 100644 index 0000000000..8e6fcba4ac --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -0,0 +1,53 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.service.GovStaffRoleService; +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 java.util.ArrayList; +import java.util.List; + +/** + * @return + * 工作人员相关api + * @Author wxz + * @Description + * @Date 2020/4/22 22:44 + **/ +@RestController +@RequestMapping("staffrole") +public class StaffRoleController { + + @Autowired + private GovStaffRoleService govStaffRoleService; + + /** + * 根据工作人员查询工作人员具有的角色列表 + * @return + */ + @PostMapping("staffroles") + public Result> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + ValidatorUtils.validateEntity(staffRoleFormDTO); + String staffId = staffRoleFormDTO.getStaffId(); + String orgId = staffRoleFormDTO.getOrgId(); + List staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId); + List staffRoleDTOS = new ArrayList<>(); + staffRoleEntities.forEach(role -> { + GovStaffRoleDTO dto = new GovStaffRoleDTO(); + BeanUtils.copyProperties(role, dto); + staffRoleDTOS.add(dto); + }); + return new Result>().ok(staffRoleDTOS); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java new file mode 100644 index 0000000000..8967f79733 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -0,0 +1,37 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.GovStaffRoleEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface GovStaffRoleDao extends BaseDao { + + List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java index d905202603..6869f1a5bf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.StaffGridVisitedEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffGridVisitedDao extends BaseDao { - + + /** + * @Description 通过staffId和customerId查询当前用户上一次登录的网格信息 + * @Param LatestGridFormDTO + * @return gridId + * @Author wangc + * @Date 2020.04.23 00:40 + **/ + String selectStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java new file mode 100644 index 0000000000..1a69f5a6c2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StaffRoleEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface StaffRoleDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java new file mode 100644 index 0000000000..80ee011dcd --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java @@ -0,0 +1,61 @@ +/** + * 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-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("gov_staff_role") +public class GovStaffRoleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色所属体系类型:agency,department,grid + */ + private String orgType; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java new file mode 100644 index 0000000000..20f828a52d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.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. + *

+ * 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-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_role") +public class StaffRoleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String staffId; + + /** + * 角色ID + */ + private String roleId; + + /** + * 角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID + */ + private String orgId; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java new file mode 100644 index 0000000000..3448b75a7e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java @@ -0,0 +1,68 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class GovStaffRoleExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。") + private String customerId; + + @Excel(name = "角色key") + private String roleKey; + + @Excel(name = "角色名称") + private String roleName; + + @Excel(name = "角色所属体系类型:agency,department,grid") + private String orgType; + + @Excel(name = "") + private Integer delFlag; + + @Excel(name = "") + private Integer revision; + + @Excel(name = "") + private String createdBy; + + @Excel(name = "") + private Date createdTime; + + @Excel(name = "") + private String updatedBy; + + @Excel(name = "") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java new file mode 100644 index 0000000000..78def4343b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java @@ -0,0 +1,65 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class StaffRoleExcel { + + @Excel(name = "") + private String id; + + @Excel(name = "用户ID") + private String staffId; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID") + private String orgId; + + @Excel(name = "") + private Integer delFlag; + + @Excel(name = "") + private Integer revision; + + @Excel(name = "") + private String createdBy; + + @Excel(name = "") + private Date createdTime; + + @Excel(name = "") + private String updatedBy; + + @Excel(name = "") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java new file mode 100644 index 0000000000..2ad77b306a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java @@ -0,0 +1,47 @@ +/** + * 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.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class GovStaffRoleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java new file mode 100644 index 0000000000..47714034af --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java @@ -0,0 +1,47 @@ +/** + * 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.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class StaffRoleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java new file mode 100644 index 0000000000..942a001921 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -0,0 +1,102 @@ +/** + * 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; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.entity.GovStaffRoleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface GovStaffRoleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GovStaffRoleDTO + * @author generator + * @date 2020-04-22 + */ + GovStaffRoleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(GovStaffRoleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(GovStaffRoleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); + + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @return + */ + List listRolesByStaffId(String staffId, String orgId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java index 86e31b2c3e..e7989a7de1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java @@ -21,6 +21,8 @@ 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.StaffGridVisitedDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.entity.StaffGridVisitedEntity; @@ -95,6 +97,15 @@ public interface StaffGridVisitedService extends BaseService staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 00:28 + **/ + Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + /** * @param staffGridVisitedFormDTO * @return com.epmet.commons.tools.utils.Result 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 new file mode 100644 index 0000000000..f5787beaa8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -0,0 +1,95 @@ +/** + * 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; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.entity.StaffRoleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface StaffRoleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StaffRoleDTO + * @author generator + * @date 2020-04-22 + */ + StaffRoleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(StaffRoleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(StaffRoleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java new file mode 100644 index 0000000000..fac6d94901 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -0,0 +1,114 @@ +/** + * 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.GovStaffRoleDao; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.redis.GovStaffRoleRedis; +import com.epmet.service.GovStaffRoleService; +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-22 + */ +@Service +public class GovStaffRoleServiceImpl extends BaseServiceImpl implements GovStaffRoleService { + + @Autowired + private GovStaffRoleRedis govStaffRoleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GovStaffRoleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GovStaffRoleDTO.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 GovStaffRoleDTO get(String id) { + GovStaffRoleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GovStaffRoleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GovStaffRoleDTO dto) { + GovStaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, GovStaffRoleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GovStaffRoleDTO dto) { + GovStaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, GovStaffRoleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @return + */ + @Override + public List listRolesByStaffId(String staffId, String orgId) { + return baseDao.listRolesByStaffId(staffId, orgId); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java index 1475dfcf2a..5b0ab6bf60 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java @@ -24,12 +24,22 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.GridVisitedConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffGridVisitedDao; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.entity.StaffGridVisitedEntity; +import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffGridVisitedService; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,6 +56,12 @@ import java.util.Map; @Service public class StaffGridVisitedServiceImpl extends BaseServiceImpl implements StaffGridVisitedService { + private static final Logger logger = LoggerFactory.getLogger(StaffGridVisitedServiceImpl.class); + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -106,4 +122,26 @@ public class StaffGridVisitedServiceImpl extends BaseServiceImpl getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + + CustomerGridByUserIdResultDTO gridResult = new CustomerGridByUserIdResultDTO(); + String gridId = baseDao.selectStaffLatestGrid(latestGridFormDTO); + if(StringUtils.isNotBlank(gridId)){ + CustomerGridFormDTO param = new CustomerGridFormDTO(); + param.setGridId(gridId); + Result gridInfoResult = + govOrgFeignClient.getCustomerGridByGridId(param); + if(gridInfoResult.success() && null != gridInfoResult.getData() && StringUtils.isNotBlank(gridInfoResult.getData().getId())){ + gridResult.setAgencyId(gridInfoResult.getData().getPid()); + gridResult.setGridId(gridId); + gridResult.setGridName(gridInfoResult.getData().getGridName()); + }else{ + logger.warn(GridVisitedConstant.QUERY_EXCEPTION); + } + } + + return new Result().ok(gridResult); + } + } \ 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 new file mode 100644 index 0000000000..bf717ba530 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -0,0 +1,104 @@ +/** + * 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.StaffRoleDao; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.entity.StaffRoleEntity; +import com.epmet.redis.StaffRoleRedis; +import com.epmet.service.StaffRoleService; +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-22 + */ +@Service +public class StaffRoleServiceImpl extends BaseServiceImpl implements StaffRoleService { + + @Autowired + private StaffRoleRedis staffRoleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffRoleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffRoleDTO.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 StaffRoleDTO get(String id) { + StaffRoleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffRoleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffRoleDTO dto) { + StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffRoleDTO dto) { + StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.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-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml new file mode 100644 index 0000000000..95949edd10 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml index 38ce0bff3c..73978e23f3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml @@ -16,5 +16,21 @@ + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml new file mode 100644 index 0000000000..79ad9ca489 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file