Browse Source

Merge remote-tracking branch 'origin/dev_govorg' into dev_govorg

# Conflicts:
#	epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
#	epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
#	epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java
dev_shibei_match
yinzuomei 5 years ago
parent
commit
61fd70f885
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
  2. 8
      epmet-module/gov-access/gov-access-client/pom.xml
  3. 82
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java
  4. 87
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java
  5. 33
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java
  6. 38
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java
  7. 51
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java
  8. 62
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java
  9. 47
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java
  10. 103
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java
  11. 110
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java
  12. 10
      epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql
  13. 33
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml
  14. 13
      epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java
  15. 9
      epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java
  16. 6
      epmet-module/gov-mine/gov-mine-server/pom.xml
  17. 12
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java
  18. 42
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java
  19. 17
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
  20. 33
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  21. 25
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java
  22. 14
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  23. 21
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  24. 28
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java
  25. 11
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  26. 19
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java
  27. 12
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
  28. 61
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
  29. 24
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
  30. 28
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java
  31. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java
  32. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java
  33. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java
  34. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  35. 24
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  36. 91
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java
  37. 86
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java
  38. 18
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java
  39. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java
  40. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  41. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  42. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java
  43. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  44. 61
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java
  45. 56
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java
  46. 68
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java
  47. 65
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java
  48. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java
  49. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java
  50. 102
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  51. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java
  52. 95
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  53. 114
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  54. 38
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java
  55. 104
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  56. 32
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  57. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml
  58. 20
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

5
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";
}

8
epmet-module/gov-access/gov-access-client/pom.xml

@ -11,5 +11,11 @@
<artifactId>gov-access-client</artifactId>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>

82
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

87
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

33
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<List<RoleOperationResultDTO>> listOperationsByRoleId(@PathVariable("roleId") String roleId) {
List<RoleOperationResultDTO> roleOperationResultDTOS = roleOperationService.listOperationsByRoleId(roleId);
return new Result<List<RoleOperationResultDTO>>().ok(roleOperationResultDTOS);
}
}

38
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<RoleOperationEntity> {
List<RoleOperationResultDTO> listOperationsByRoleId(@Param("roleId") String roleId);
}

51
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

62
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

47
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}

103
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<RoleOperationEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<RoleOperationDTO>
* @author generator
* @date 2020-04-22
*/
PageData<RoleOperationDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<RoleOperationDTO>
* @author generator
* @date 2020-04-22
*/
List<RoleOperationDTO> list(Map<String, Object> 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<RoleOperationResultDTO> listOperationsByRoleId(String roleId);
}

110
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<RoleOperationDao, RoleOperationEntity> implements RoleOperationService {
@Autowired
private RoleOperationRedis roleOperationRedis;
@Override
public PageData<RoleOperationDTO> page(Map<String, Object> params) {
IPage<RoleOperationEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, RoleOperationDTO.class);
}
@Override
public List<RoleOperationDTO> list(Map<String, Object> params) {
List<RoleOperationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, RoleOperationDTO.class);
}
private QueryWrapper<RoleOperationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<RoleOperationEntity> 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<RoleOperationResultDTO> listOperationsByRoleId(String roleId) {
return baseDao.listOperationsByRoleId(roleId);
}
}

10
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',

33
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.RoleOperationDao">
<resultMap type="com.epmet.entity.RoleOperationEntity" id="roleOperationMap">
<result property="id" column="ID"/>
<result property="roleId" column="ROLE_ID"/>
<result property="operationKey" column="OPERATION_KEY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<resultMap id="RoleOperationResultDTO" type="com.epmet.dto.result.RoleOperationResultDTO" extends="roleOperationMap">
<result property="operationName" column="OPERATION_NAME"/>
</resultMap>
<select id="listOperationsByRoleId" resultMap="RoleOperationResultDTO">
SELECT
ro.*,
o.OPERATION_NAME
FROM
role_operation ro
INNER JOIN operation o ON ( ro.OPERATION_KEY = o.OPERATION_KEY )
WHERE
ro.ROLE_ID = #{roleId}
</select>
</mapper>

13
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;
}

9
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;
}

6
epmet-module/gov-mine/gov-mine-server/pom.xml

@ -71,6 +71,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-access-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

12
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 = "查询上一次登录的网格信息失败";
}

42
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<Set<String>> getStaffOperations(@LoginUser TokenDto tokenDto, @RequestBody StaffOperationDTO staffOperationDTO) {
//public Result<Set<String>> getStaffOperations(@RequestBody StaffOperationDTO staffOperationDTO) {
String agencyId = staffOperationDTO.getAgencyId();
String gridId = staffOperationDTO.getGridId();
String staffId = tokenDto.getUserId();
Set<String> opeKeys = accessService.listOpeKeysByStaffId(staffId, agencyId, gridId);
return new Result<Set<String>>().ok(opeKeys);
}
}

17
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<List<String>> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) {
return staffAgencyService.switchGrid(switchGridFormDTO);
}
/**
* @Description 得到工作人员最后一次登录的网格
* @Param TokenDto -> userId/staffId
* @Param LatestGridFormDTO -> customerId
* @return Result<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 11:16
**/
@PostMapping("getlatestgrid")
public Result<CustomerGridByUserIdResultDTO> getLatestGrid(@LoginUser TokenDto tokenDto, @RequestBody LatestGridFormDTO latestGridFormDTO){
latestGridFormDTO.setStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(latestGridFormDTO);
return staffAgencyService.getLatestGrid(latestGridFormDTO);
}
}

33
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<LatestCustomerResultDTO> getLatestCustomer(@PathVariable("userId") String userId);
/**
* @Description 查询工作人员上次登录的网格
* @Param customerId ; staffId
* @return Result<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 10:44
**/
@PostMapping(value = "/epmetuser/staffgridvisited/getstafflatestgrid")
Result<CustomerGridByUserIdResultDTO> 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<List<GovStaffRoleDTO>> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO);
}

25
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<List<RoleOperationResultDTO>> listOperationsByRoleId(@PathVariable("roleId") String roleId);
}

14
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<LatestCustomerResultDTO> getLatestCustomer(@PathVariable("userId") String userId);
/**
* @Description 查询指定客户下一个用户所在的网格,调用gov-org
* @Param LatestGridFormDTO -> customerId ; staffId
* @return Result<CustomerGridDTO>
* @Author wangc
* @Date 2020.04.23 10:53
**/
@PostMapping(value = "/gov/org/customerstaffgrid/getstaffgrid")
Result<CustomerGridByUserIdResultDTO> getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO);
}

21
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<LatestCustomerResultDTO> getLatestCustomer(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId);
}
@Override
public Result<List<GovStaffRoleDTO>> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff");
}
@Override
public Result<CustomerGridByUserIdResultDTO> 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);

28
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<List<RoleOperationResultDTO>> listOperationsByRoleId(String roleId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationsByRoleId");
}
}

11
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<LatestCustomerResultDTO> getLatestCustomer(String userId) {
return null;
}
@Override
public Result<CustomerGridByUserIdResultDTO> getStaffGrid(LatestGridFormDTO latestGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO);
}
@Override
public Result<LatestCustomerResultDTO> getLatestCustomer(String userId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getLatestCustomer", userId);

19
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<String> listOpeKeysByStaffId(String staffId, String agencyId, String gridId);
}

12
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<List<String>> switchGrid(SwitchGridFormDTO switchGridFormDTO);
/**
* @Description 得到工作人员最后一次登录的网格
* @Param LatestGridFormDTO -> staffId ; customerId
* @return Result<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 11:14
**/
Result<CustomerGridByUserIdResultDTO> getLatestGrid(LatestGridFormDTO latestGridFormDTO);
}

61
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<String> listOpeKeysByStaffId(String staffId, String agencyId, String gridId) {
List<GovStaffRoleDTO> roleDTOS = new ArrayList<>();
// 查询机关单位权限
StaffRoleFormDTO formDTO = new StaffRoleFormDTO();
formDTO.setStaffId(staffId);
formDTO.setOrgId(agencyId);
Result<List<GovStaffRoleDTO>> agencyResult = userFeignClient.getRolesOfStaff(formDTO);
if (!CollectionUtils.isEmpty(agencyResult.getData())) {
roleDTOS.addAll(agencyResult.getData());
}
// 查询网格权限
formDTO.setStaffId(staffId);
formDTO.setOrgId(gridId);
Result<List<GovStaffRoleDTO>> gridResult = userFeignClient.getRolesOfStaff(formDTO);
if (!CollectionUtils.isEmpty(gridResult.getData())) {
roleDTOS.addAll(gridResult.getData());
}
// 拼装
Set<String> opeKeys = new HashSet<>();
roleDTOS.forEach(roleDto -> {
String roleId = roleDto.getId();
List<RoleOperationResultDTO> roleOperations = govAccessFeignClient.listOperationsByRoleId(roleId).getData();
roleOperations.forEach(roleOpe -> {
if (roleOpe != null) {
opeKeys.add(roleOpe.getOperationKey());
}
});
});
return opeKeys;
}
}

24
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<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 11:14
**/
@Override
public Result<CustomerGridByUserIdResultDTO> getLatestGrid(LatestGridFormDTO latestGridFormDTO) {
Result<CustomerGridByUserIdResultDTO> latestGridResult =
epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO);
if(latestGridResult.success() && null != latestGridResult.getData() && StringUtils.isNotBlank(latestGridResult.getData().getGridId())){
return latestGridResult;
}else{
Result<CustomerGridByUserIdResultDTO> staffGridResult =
govOrgFeignClient.getStaffGrid(latestGridFormDTO);
if(staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())){
return staffGridResult;
}
}
return new Result<CustomerGridByUserIdResultDTO>().error(StaffAgencyConstant.QUERY_LATEST_GRID_INFO_FAILED);
}
@Override
public Result<List<String>> switchGrid(SwitchGridFormDTO switchGridFormDTO) {

28
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;
}

18
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<CustomerGridDTO>
* @Author wangc
* @Date 2020.04.23 10:53
**/
@PostMapping("getstaffgrid")
public Result<CustomerGridByUserIdResultDTO> getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){
ValidatorUtils.validateEntity(latestGridFormDTO);
return customerStaffGridService.getStaffGridOrderByGridName(latestGridFormDTO);
}
}

13
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<CustomerStaffGridEntity> {
/**
* @Description 查询指定客户下一个用户所在的网格按照网格名称升序排序取第一个
* @Param LatestGridFormDTO -> customerId ; userId
* @return CustomerGridDTO
* @Author wangc
* @Date 2020.04.23 01:09
**/
CustomerGridDTO selectStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO);
}

12
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<CustomerStaffGridE
* @date 2020-04-20
*/
void delete(String[] ids);
/**
* @Description 查询指定客户下一个用户所在的网格按照网格名称升序排序取第一个
* @Param LatestGridFormDTO -> customerId ; staffId
* @return CustomerGridDTO
* @Author wangc
* @Date 2020.04.23 09:11
**/
Result<CustomerGridByUserIdResultDTO> getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO);
}

14
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<CustomerStaffG
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Result<CustomerGridByUserIdResultDTO> 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<CustomerGridByUserIdResultDTO>().ok(result);
}
}

24
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -17,4 +17,28 @@
</resultMap>
<!-- 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 -->
<select id="selectStaffGridOrderByGridName" parameterType="com.epmet.dto.form.LatestGridFormDTO" resultType="com.epmet.dto.CustomerGridDTO">
SELECT
grid.ID,
grid.GRID_NAME,
grid.PID
FROM CUSTOMER_GRID grid
LEFT JOIN
CUSTOMER_STAFF_GRID staff ON
(
grid.ID = staff.GRID_ID
AND
staff.DEL_FLAG = '0'
AND
staff.CUSTOMER_ID = #{customerId}
AND
staff.USER_ID = #{staffId}
)
WHERE
grid.DEL_FLAG = '0'
ORDER BY grid.GRID_NAME ASC
LIMIT 1
</select>
</mapper>

91
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

86
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

18
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;
}

17
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<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 10:05
**/
@PostMapping("getstafflatestgrid")
Result<CustomerGridByUserIdResultDTO> getStaffLatestGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){
ValidatorUtils.validateEntity(latestGridFormDTO);
return staffGridVisitedService.getStaffLatestGrid(latestGridFormDTO);
}
/**
* @param staffGridVisitedFormDTO
* @return com.epmet.commons.tools.utils.Result

53
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<List<GovStaffRoleDTO>> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO);
String staffId = staffRoleFormDTO.getStaffId();
String orgId = staffRoleFormDTO.getOrgId();
List<GovStaffRoleEntity> staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId);
List<GovStaffRoleDTO> staffRoleDTOS = new ArrayList<>();
staffRoleEntities.forEach(role -> {
GovStaffRoleDTO dto = new GovStaffRoleDTO();
BeanUtils.copyProperties(role, dto);
staffRoleDTOS.add(dto);
});
return new Result<List<GovStaffRoleDTO>>().ok(staffRoleDTOS);
}
}

37
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java

@ -0,0 +1,37 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GovStaffRoleEntity> {
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
}

13
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<StaffGridVisitedEntity> {
/**
* @Description 通过staffId和customerId查询当前用户上一次登录的网格信息
* @Param LatestGridFormDTO
* @return gridId
* @Author wangc
* @Date 2020.04.23 00:40
**/
String selectStaffLatestGrid(LatestGridFormDTO latestGridFormDTO);
}

33
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffRoleEntity> {
}

61
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java

@ -0,0 +1,61 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

56
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

68
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java

@ -0,0 +1,68 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

65
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java

@ -0,0 +1,65 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}

102
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java

@ -0,0 +1,102 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GovStaffRoleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<GovStaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
PageData<GovStaffRoleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<GovStaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
List<GovStaffRoleDTO> list(Map<String, Object> 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<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
}

11
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<StaffGridVisitedEnt
*/
void delete(String[] ids);
/**
* @Description 得到工作人员上次登录的网格
* @Param LatestGridFormDTO -> staffId ; customerId
* @return Result<CustomerGridByUserIdResultDTO>
* @Author wangc
* @Date 2020.04.23 00:28
**/
Result<CustomerGridByUserIdResultDTO> getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO);
/**
* @param staffGridVisitedFormDTO
* @return com.epmet.commons.tools.utils.Result

95
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffRoleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<StaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
PageData<StaffRoleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
List<StaffRoleDTO> list(Map<String, Object> 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);
}

114
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java

@ -0,0 +1,114 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GovStaffRoleDao, GovStaffRoleEntity> implements GovStaffRoleService {
@Autowired
private GovStaffRoleRedis govStaffRoleRedis;
@Override
public PageData<GovStaffRoleDTO> page(Map<String, Object> params) {
IPage<GovStaffRoleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, GovStaffRoleDTO.class);
}
@Override
public List<GovStaffRoleDTO> list(Map<String, Object> params) {
List<GovStaffRoleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, GovStaffRoleDTO.class);
}
private QueryWrapper<GovStaffRoleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<GovStaffRoleEntity> 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<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId) {
return baseDao.listRolesByStaffId(staffId, orgId);
}
}

38
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<StaffGridVisitedDao, StaffGridVisitedEntity> implements StaffGridVisitedService {
private static final Logger logger = LoggerFactory.getLogger(StaffGridVisitedServiceImpl.class);
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Override
public PageData<StaffGridVisitedDTO> page(Map<String, Object> params) {
IPage<StaffGridVisitedEntity> page = baseDao.selectPage(
@ -106,4 +122,26 @@ public class StaffGridVisitedServiceImpl extends BaseServiceImpl<StaffGridVisite
return new Result();
}
@Override
public Result<CustomerGridByUserIdResultDTO> getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) {
CustomerGridByUserIdResultDTO gridResult = new CustomerGridByUserIdResultDTO();
String gridId = baseDao.selectStaffLatestGrid(latestGridFormDTO);
if(StringUtils.isNotBlank(gridId)){
CustomerGridFormDTO param = new CustomerGridFormDTO();
param.setGridId(gridId);
Result<CustomerGridDTO> 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<CustomerGridByUserIdResultDTO>().ok(gridResult);
}
}

104
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffRoleDao, StaffRoleEntity> implements StaffRoleService {
@Autowired
private StaffRoleRedis staffRoleRedis;
@Override
public PageData<StaffRoleDTO> page(Map<String, Object> params) {
IPage<StaffRoleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StaffRoleDTO.class);
}
@Override
public List<StaffRoleDTO> list(Map<String, Object> params) {
List<StaffRoleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StaffRoleDTO.class);
}
private QueryWrapper<StaffRoleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<StaffRoleEntity> 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));
}
}

32
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.GovStaffRoleDao">
<resultMap type="com.epmet.entity.GovStaffRoleEntity" id="govStaffRoleMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="roleKey" column="ROLE_KEY"/>
<result property="roleName" column="ROLE_NAME"/>
<result property="orgType" column="ORG_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="listRolesByStaffId" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT
r.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
sr.STAFF_ID = #{staffId}
AND sr.ORG_ID = #{orgId}
</select>
</mapper>

16
epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml

@ -16,5 +16,21 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 通过staffId和customerId查询当前用户上一次登录的网格信息 -->
<select id="selectStaffLatestGrid" parameterType="com.epmet.dto.form.LatestGridFormDTO" resultType="string">
SELECT
GRID_ID
FROM
STAFF_GRID_VISITED
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId}
AND
STAFF_ID = #{staffId}
ORDER BY
CREATED_TIME DESC
LIMIT 1
</select>
</mapper>

20
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.StaffRoleDao">
<resultMap type="com.epmet.entity.StaffRoleEntity" id="staffRoleMap">
<result property="id" column="ID"/>
<result property="staffId" column="STAFF_ID"/>
<result property="roleId" column="ROLE_ID"/>
<result property="orgId" column="ORG_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save