Browse Source

客户定制功能角色设置、查询;居民端、工作端角色列表查询

master
sunyuchao 5 years ago
parent
commit
a7d133004f
  1. 29
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionRoleListFormDTO.java
  2. 27
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/RoleListFormDTO.java
  3. 37
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveCustomerFunctionRoleFormDTO.java
  4. 26
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionRoleListResultDTO.java
  5. 29
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionRoleController.java
  6. 21
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java
  7. 19
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionRoleService.java
  8. 50
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java
  9. 17
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionRoleDao.xml
  10. 46
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiGovRoleListResultDTO.java
  11. 44
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiGovRoleResultDTO.java
  12. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java
  13. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java
  14. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RoleDao.java
  15. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  16. 27
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  17. 9
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml
  18. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/RoleDao.xml

29
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionRoleListFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 查询客户定制功能角色列表--接口入参
*
* @author sun
*/
@Data
public class CustomerFunctionRoleListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
@NotBlank(message = "客户Id不能为空", groups = {AddUserInternalGroup.class })
private String customerId;
/**
* 定制功能ID
*/
@NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class })
private String functionId;
public interface AddUserInternalGroup {}
}

27
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/RoleListFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 客户定制功能角色设置--接口入参
*
* @author sun
*/
@Data
public class RoleListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 角色Key
*/
@NotBlank(message = "角色key不能为空", groups = {AddUserInternalGroup.class })
private String roleKey;
/**
* 角色名称
*/
@NotBlank(message = "角色名称不能为空", groups = {AddUserInternalGroup.class })
private String roleName;
public interface AddUserInternalGroup {}
}

37
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveCustomerFunctionRoleFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 客户定制功能角色设置--接口入参
*
* @author sun
*/
@Data
public class SaveCustomerFunctionRoleFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
@NotBlank(message = "客户Id不能为空", groups = {AddUserInternalGroup.class })
private String customerId;
/**
* 定制功能ID
*/
@NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class })
private String functionId;
/**
* 所属APP(工作端:gov居民端:resi)
*/
@NotBlank(message = "所属App不能为空", groups = {AddUserInternalGroup.class })
private String fromApp;
/**
* 角色信息集合
*/
private List<RoleListFormDTO> roleList;
public interface AddUserInternalGroup {}
}

26
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionRoleListResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import com.epmet.dto.form.RoleListFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 查询客户定制功能角色列表--接口返参
*
* @author sun
*/
@Data
public class CustomerFunctionRoleListResultDTO implements Serializable {
private static final long serialVersionUID = 2971689193155710437L;
/**
* 角色Key
*/
private String roleKey;
/**
* 角色名称
*/
private String roleName;
}

29
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionRoleController.java

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -26,6 +28,9 @@ 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.CustomerFunctionRoleDTO;
import com.epmet.dto.form.CustomerFunctionRoleListFormDTO;
import com.epmet.dto.form.SaveCustomerFunctionRoleFormDTO;
import com.epmet.dto.result.CustomerFunctionRoleListResultDTO;
import com.epmet.excel.CustomerFunctionRoleExcel;
import com.epmet.service.CustomerFunctionRoleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +96,28 @@ public class CustomerFunctionRoleController {
ExcelUtils.exportExcelToTarget(response, null, list, CustomerFunctionRoleExcel.class);
}
/**
* @param tokenDTO formDTO
* @return
* @author sun
* @Description 客户定制功能角色设置
*/
@PostMapping("savecustomerfunctionrole")
public Result saveCustomerFunctionRole(@LoginUser TokenDto tokenDTO, @RequestBody SaveCustomerFunctionRoleFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SaveCustomerFunctionRoleFormDTO.AddUserInternalGroup.class);
customerFunctionRoleService.saveCustomerFunctionRole(formDTO);
return new Result();
}
/**
* @param tokenDTO formDTO
* @return
* @author sun
* @Description 查询客户定制功能角色列表
*/
@PostMapping("customerfunctionrolelist")
public Result<List<CustomerFunctionRoleListResultDTO>> customerFunctionRoleList(@LoginUser TokenDto tokenDTO, @RequestBody CustomerFunctionRoleListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, CustomerFunctionRoleListFormDTO.AddUserInternalGroup.class);
return new Result<List<CustomerFunctionRoleListResultDTO>>().ok(customerFunctionRoleService.customerFunctionRoleList(formDTO));
}
}

21
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java

@ -18,8 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerFunctionRoleDTO;
import com.epmet.dto.form.CustomerFunctionRoleListFormDTO;
import com.epmet.dto.result.CustomerFunctionRoleListResultDTO;
import com.epmet.entity.CustomerFunctionRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户定制功能角色列表
@ -29,5 +35,18 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerFunctionRoleDao extends BaseDao<CustomerFunctionRoleEntity> {
/**
* @author sun
* @Description 根据客户Id删除客户功能角色信息
*/
void delByCustomerId(@Param("customerId") String customerId);
/**
* @param formDTO
* @return
* @author sun
* @Description 查询客户定制功能角色列表
*/
List<CustomerFunctionRoleListResultDTO> selectCustomerFunctionRoleList(CustomerFunctionRoleListFormDTO formDTO);
}

19
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionRoleService.java

@ -20,6 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerFunctionRoleDTO;
import com.epmet.dto.form.CustomerFunctionRoleListFormDTO;
import com.epmet.dto.form.SaveCustomerFunctionRoleFormDTO;
import com.epmet.dto.result.CustomerFunctionRoleListResultDTO;
import com.epmet.entity.CustomerFunctionRoleEntity;
import java.util.List;
@ -92,4 +95,20 @@ public interface CustomerFunctionRoleService extends BaseService<CustomerFunctio
* @date 2020-09-07
*/
void delete(String[] ids);
/**
* @param formDTO
* @return
* @author sun
* @Description 客户定制功能角色设置
*/
void saveCustomerFunctionRole(SaveCustomerFunctionRoleFormDTO formDTO);
/**
* @param formDTO
* @return
* @author sun
* @Description 查询客户定制功能角色列表
*/
List<CustomerFunctionRoleListResultDTO> customerFunctionRoleList(CustomerFunctionRoleListFormDTO formDTO);
}

50
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java

@ -20,11 +20,17 @@ 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.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
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.CustomerFunctionRoleDao;
import com.epmet.dto.CustomerFunctionRoleDTO;
import com.epmet.dto.form.CustomerFunctionRoleListFormDTO;
import com.epmet.dto.form.RoleListFormDTO;
import com.epmet.dto.form.SaveCustomerFunctionRoleFormDTO;
import com.epmet.dto.result.CustomerFunctionRoleListResultDTO;
import com.epmet.entity.CustomerFunctionRoleEntity;
import com.epmet.redis.CustomerFunctionRoleRedis;
import com.epmet.service.CustomerFunctionRoleService;
@ -33,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -101,4 +108,47 @@ public class CustomerFunctionRoleServiceImpl extends BaseServiceImpl<CustomerFun
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return
* @author sun
* @Description 客户定制功能角色设置
*/
@Override
public void saveCustomerFunctionRole(SaveCustomerFunctionRoleFormDTO formDTO) {
List<CustomerFunctionRoleEntity> listEntity = new ArrayList<>();
//1.封装数据
List<RoleListFormDTO> roleList = formDTO.getRoleList();
roleList.forEach(role->{
CustomerFunctionRoleEntity entity = new CustomerFunctionRoleEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setFunctionId(formDTO.getFunctionId());
entity.setFromApp(formDTO.getFromApp());
entity.setRoleKey(role.getRoleKey());
entity.setRoleName(role.getRoleName());
listEntity.add(entity);
});
//2.先按客户Id执行删除操作
baseDao.delByCustomerId(formDTO.getCustomerId());
//3.批量新增
if(!insertBatch(listEntity)){
throw new RenException("定制功能角色设置失败");
}
}
/**
* @param formDTO
* @return
* @author sun
* @Description 查询客户定制功能角色列表
*/
@Override
public List<CustomerFunctionRoleListResultDTO> customerFunctionRoleList(CustomerFunctionRoleListFormDTO formDTO) {
//1.根据客户Id、功能Id查询客户定制功能设置的角色列表
return baseDao.selectCustomerFunctionRoleList(formDTO);
}
}

17
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionRoleDao.xml

@ -3,5 +3,22 @@
<mapper namespace="com.epmet.dao.CustomerFunctionRoleDao">
<select id="selectCustomerFunctionRoleList" resultType="com.epmet.dto.result.CustomerFunctionRoleListResultDTO">
SELECT
role_key AS "roleKey",
role_name AS "roleName"
FROM
customer_function_role
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND function_id = #{functionId}
</select>
<delete id="delByCustomerId">
DELETE
FROM customer_function_role
WHERE customer_id = #{customerId}
</delete>
</mapper>

46
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiGovRoleListResultDTO.java

@ -0,0 +1,46 @@
/**
* 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.List;
/**
* 获取居民端工作端人员角色列表--接口返参
*
* @author sun
*/
@Data
public class ResiGovRoleListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 居民端角色列表
*/
private List<ResiGovRoleResultDTO> resiRoleList;
/**
* 工作端角色列表
*/
private List<ResiGovRoleResultDTO> govRoleList;
}

44
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiGovRoleResultDTO.java

@ -0,0 +1,44 @@
/**
* 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;
/**
* 获取居民端工作端人员角色列表--接口返参
*
* @author sun
*/
@Data
public class ResiGovRoleResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 角色key
*/
private String roleKey;
/**
* 角色名称
*/
private String roleName;
}

17
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java

@ -1,11 +1,16 @@
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.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.RoleDTO;
import com.epmet.dto.form.GovStaffRoleFormDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.IssueInitiatorResultDTO;
import com.epmet.dto.result.ResiGovRoleListResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -59,4 +64,16 @@ public class GovStaffRoleController {
return new Result<List<GovStaffRoleResultDTO>>().ok(roleDTOS);
}
/**
* @param tokenDTO
* @return ResiGovRoleListResultDTO
* @author sun
* @Description 获取居民端工作端人员角色列表
*/
@PostMapping("resigovrolelist")
public Result<ResiGovRoleListResultDTO> resiGovRoleList(@LoginUser TokenDto tokenDTO){
return new Result<ResiGovRoleListResultDTO>().ok(govStaffRoleService.resiGovRoleList());
}
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleResultDTO;
import com.epmet.entity.GovStaffRoleTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,4 +39,10 @@ public interface GovStaffRoleTemplateDao extends BaseDao<GovStaffRoleTemplateEnt
* @return
*/
List<GovStaffRoleTemplateDTO> listValidateRoles();
/**
* @author sun
* @Description 获取工作端角色列表
*/
List<ResiGovRoleResultDTO> selectGovRoleList();
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RoleDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.RoleDTO;
import com.epmet.dto.result.ResiGovRoleResultDTO;
import com.epmet.entity.RoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -41,4 +42,10 @@ public interface RoleDao extends BaseDao<RoleEntity> {
* @return RoleEntity
*/
RoleEntity selectRoleByKey(RoleEntity param);
/**
* @author sun
* @Description 获取居民端角色列表
*/
List<ResiGovRoleResultDTO> selectResiRoleList();
}

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

@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleListResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import java.util.List;
@ -127,4 +128,10 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
List<GovStaffRoleTemplateDTO> listRoleTemplates();
GovStaffRoleResultDTO getDTOById(String roleId);
/**
* @author sun
* @Description 获取居民端工作端人员角色列表
*/
ResiGovRoleListResultDTO resiGovRoleList();
}

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

@ -27,10 +27,13 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.GovStaffRoleDao;
import com.epmet.dao.GovStaffRoleTemplateDao;
import com.epmet.dao.RoleDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.InitDefaultOperationsFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleListResultDTO;
import com.epmet.dto.result.ResiGovRoleResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.feign.GovAccessFeignClient;
import com.epmet.redis.GovStaffRoleRedis;
@ -66,6 +69,9 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
@Autowired
private GovAccessFeignClient govAccessFeignClient;
@Autowired
private RoleDao roleDao;
@Override
public PageData<GovStaffRoleDTO> page(Map<String, Object> params) {
IPage<GovStaffRoleEntity> page = baseDao.selectPage(
@ -181,4 +187,25 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
public GovStaffRoleResultDTO getDTOById(String roleId) {
return govStaffRoleDao.getDTOById(roleId);
}
/**
* @param
* @return ResiGovRoleListResultDTO
* @author sun
* @Description 获取居民端工作端人员角色列表
*/
@Override
public ResiGovRoleListResultDTO resiGovRoleList() {
ResiGovRoleListResultDTO resultDTO = new ResiGovRoleListResultDTO();
//1.查询居民端角色列表
List<ResiGovRoleResultDTO> resiRoleList = roleDao.selectResiRoleList();
//2.查询工作端角色列表
List<ResiGovRoleResultDTO> govRoleList = govStaffRoleTemplateDao.selectGovRoleList();
//3.封装数据并返回
resultDTO.setResiRoleList(resiRoleList);
resultDTO.setGovRoleList(govRoleList);
return resultDTO;
}
}

9
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml

@ -23,5 +23,14 @@
WHERE DEL_FLAG = 0
</select>
<select id="selectGovRoleList" resultType="com.epmet.dto.result.ResiGovRoleResultDTO">
SELECT
role_key AS "roleKey",
role_name AS "roleName"
FROM gov_staff_role_template
WHERE del_flag = '0'
ORDER BY full_time_only DESC
</select>
</mapper>

8
epmet-user/epmet-user-server/src/main/resources/mapper/RoleDao.xml

@ -27,4 +27,12 @@
and ROLE_KEY = #{roleKey}
and DEL_FLAG = 0
</select>
<select id="selectResiRoleList" resultType="com.epmet.dto.result.ResiGovRoleResultDTO">
SELECT
role_key AS "roleKey",
role_name AS "roleName"
FROM epmet_role
WHERE del_flag = '0'
</select>
</mapper>
Loading…
Cancel
Save