Browse Source

手动打分 增加权限控制

feature/dangjian
zhangyongzhangyong 5 years ago
parent
commit
181e2bd978
  1. 14
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java
  2. 9
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java
  3. 9
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java
  4. 5
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java
  5. 27
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml
  6. 24
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java
  7. 5
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java
  8. 40
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/ManualScoreServiceImpl.java
  9. 8
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/ManualScoreDao.xml

14
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java

@ -294,4 +294,18 @@ public class SysDeptController {
List<UserSysDeptInfoResultDTO> list = sysDeptService.listAllDeptInfo(formDTO);
return new Result<List<UserSysDeptInfoResultDTO>>().ok(list);
}
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author zhangyong
* @Description 获取用户数据权限信息: 机构类型键值
* @Date 2020-05-06
**/
@PostMapping("queryUserSysDeptTypeKey")
public Result<List<UserSysDeptInfoResultDTO>> queryUserSysDeptTypeKey(@RequestBody UserSysDeptInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
List<UserSysDeptInfoResultDTO> list = sysDeptService.queryUserSysDeptTypeKey(formDTO);
return new Result<List<UserSysDeptInfoResultDTO>>().ok(list);
}
}

9
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java

@ -201,4 +201,13 @@ public interface SysDeptDao extends BaseDao<SysDeptEntity> {
* @Date: 2020-04-14
*/
List<UserSysDeptInfoResultDTO> selectListAllDeptInfo(Map<String, Object> map);
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author zhangyong
* @Description 获取用户数据权限信息: 机构类型键值
* @Date 2020-05-06
**/
List<UserSysDeptInfoResultDTO> selectListUserSysDeptTypeKey(UserSysDeptInfoFormDTO formDTO);
}

9
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java

@ -271,4 +271,13 @@ public interface SysDeptService extends BaseService<SysDeptEntity> {
* @Date: 2020-04-14
*/
List<UserSysDeptInfoResultDTO> listAllDeptInfo(UserSysDeptInfoFormDTO formDTO);
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author zhangyong
* @Description 获取用户数据权限信息: 机构类型键值
* @Date 2020-05-06
**/
List<UserSysDeptInfoResultDTO> queryUserSysDeptTypeKey(UserSysDeptInfoFormDTO formDTO);
}

5
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

@ -1059,6 +1059,11 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
return list;
}
@Override
public List<UserSysDeptInfoResultDTO> queryUserSysDeptTypeKey(UserSysDeptInfoFormDTO formDTO) {
return baseDao.selectListUserSysDeptTypeKey(formDTO);
}
/**
*
* 组织机构名称修改发送MQ消息

27
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml

@ -325,10 +325,35 @@
AND sd.type_key = #{typeKey}
</if>
<if test="deptId != null and deptId != '' ">
AND instr(sd.pids, #{deptId}) > 0
AND instr(sd.id, #{deptId}) > 0 or instr(sd.pid, #{deptId}) > 0
</if>
<if test="typeKey != null and typeKey != '' ">
AND sd.type_key = #{typeKey}
</if>
<if test="deptName != null and deptName != '' ">
AND sd.NAME = #{deptName}
</if>
</select>
<select id="selectListUserSysDeptTypeKey" parameterType="com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO"
resultType="com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO">
SELECT
sd.id,
sd.NAME,
sd.pid,
p.NAME AS parentName,
sd.pids,
sd.type_key typeKey
FROM
sys_dept sd
LEFT JOIN sys_dept p ON ( sd.pid = p.id )
WHERE
sd.del_flag = '0'
<if test="deptIdList!=null and deptIdList.size()>0">
AND sd.id IN
<foreach collection="deptIdList" item="deptId" index="index" open="(" close=")" separator=",">
#{deptId}
</foreach>
</if>
</select>
</mapper>

24
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java

@ -63,13 +63,23 @@ public interface AdminFeignClient {
Result<DeptLevelAndLeaderDTO> getDeptInfoById(@PathVariable("deptId") Long deptId,
@PathVariable("leaderFlag") String leaderFlag);
/**
* @Description: 获取全部的部门基本信息
* @Param: [userSysDeptInfoFormDTO]
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author: zy
* @Date: 2020-04-14
*/
/**
* @Description: 获取全部的部门基本信息
* @Param: [userSysDeptInfoFormDTO]
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author: zy
* @Date: 2020-04-14
*/
@PostMapping(value = "sys/dept/queryAllDeptInfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<UserSysDeptInfoResultDTO>> queryAllDeptInfo(UserSysDeptInfoFormDTO userSysDeptInfoFormDTO);
/**
* @param userSysDeptInfoFormDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO>>
* @Author zhangyong
* @Description 获取用户数据权限信息: 机构类型键值
* @Date 2020-05-06
**/
@PostMapping(value = "sys/dept/queryUserSysDeptTypeKey", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<UserSysDeptInfoResultDTO>> queryUserSysDeptTypeKey(UserSysDeptInfoFormDTO userSysDeptInfoFormDTO);
}

5
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java

@ -45,4 +45,9 @@ public class AdminFeignClientFallback implements AdminFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "queryAllDeptInfo", userSysDeptInfoFormDTO);
}
@Override
public Result<List<UserSysDeptInfoResultDTO>> queryUserSysDeptTypeKey(UserSysDeptInfoFormDTO userSysDeptInfoFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "queryUserSysDeptTypeKey", userSysDeptInfoFormDTO);
}
}

40
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/ManualScoreServiceImpl.java

@ -164,9 +164,24 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
// 用户所选部门id
List<Long> dataScopeDeptList = new ArrayList<>();
if (!("".equals(params.get("deptId")))){
long deptId = Long.valueOf(params.get("deptId").toString()).longValue();
dataScopeDeptList.add(deptId);
List<Long> deptIdList = SecurityUser.getUser().getDeptIdList(); //获取用户权限
UserSysDeptInfoFormDTO userSysDeptInfoFormDTO = new UserSysDeptInfoFormDTO();
userSysDeptInfoFormDTO.setDeptIdList(deptIdList);
Result<List<UserSysDeptInfoResultDTO>> deptTypeKeys =adminFeignClient.queryUserSysDeptTypeKey(userSysDeptInfoFormDTO);
if (!("".equals(params.get("deptId")))){ //根据选择部门 项导出模板
for (int i = 0; i < deptTypeKeys.getData().size(); i++){
if (deptType.equals(deptTypeKeys.getData().get(i).getTypeKey())){
dataScopeDeptList.add(deptTypeKeys.getData().get(i).getId());
}
}
} else { //根据默认数据权限导出模板
for (int i = 0; i < deptTypeKeys.getData().size(); i++){
if (deptType.equals(deptTypeKeys.getData().get(i).getTypeKey())){
dataScopeDeptList.add(deptTypeKeys.getData().get(i).getId());
}
}
}
// 考核周期开始月
YearMonth scoreStartDateMonth = YearMonth.parse(month);
@ -258,13 +273,13 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
return new Result();
}
/**
/**
* @Description: excel导入时检查 所选月份下部门是否已打分
* @Param: [recordList, user]
* @return: java.lang.StringBuffer
* @Author: zy
* @Date: 2020-04-22
*/
* @Param: [recordList, user]
* @return: java.lang.StringBuffer
* @Author: zy
* @Date: 2020-04-22
*/
private StringBuffer excelImportCheckDeptWhetherManualScore(List<ManualScoreExcel> recordList, UserDetail user) {
StringBuffer deptErrorInfo = new StringBuffer();
for (ManualScoreExcel manualScoreExcel : recordList) {
@ -282,7 +297,7 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
}
return deptErrorInfo;
}
/**
* @Description: 调用admin模块查询部门信息详情
* @param dataScopeDeptList 用户数据权限
@ -318,7 +333,7 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
//根据部门名称获取部门id及所有详细信息
Result<List<UserSysDeptInfoResultDTO>> deptInfo = adminFeignClient.queryAllDeptInfo(userSysDeptInfoFormDTO);
List<UserSysDeptInfoResultDTO> userSysDeptInfoResultDTOList = deptInfo.getData();
DeptLevelAndLeaderDTO deptLevelInfo = deptUtils.getDeptLevelInfo(userSysDeptInfoResultDTOList.get(0).getId(), YesOrNoEnum.YES);
ManualScoreEntity manualScoreEntity = new ManualScoreEntity();
manualScoreEntity.setDeptId(deptLevelInfo.getDeptId());
@ -371,6 +386,7 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
@Override
public PageData<ManualScoreDTO> listManualScoreResultDTO(Map<String, Object> params) {
params.put("deptId", params.get("deptId").toString());
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
IPage<ManualScoreDTO> page = getPage(params);
List<ManualScoreDTO> list = baseDao.selectListManualScoreResultDTO(params);
return new PageData<>(list, page.getTotal());
@ -396,4 +412,4 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu
}
return big;
}
}
}

8
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/ManualScoreDao.xml

@ -43,6 +43,12 @@
<if test="deptId != '' and deptId != null">
AND m.all_dept_ids like concat('%',#{deptId},'%')
</if>
<if test="deptIdList!=null and deptIdList.size()>0">
AND m.DEPT_ID IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
ORDER BY m.SCORE DESC, m.CREATED_TIME DESC
</select>
@ -57,4 +63,4 @@
left(m.`MONTH`, 7)= #{monthString}
AND m.DEPT_ID = #{deptId}
</select>
</mapper>
</mapper>

Loading…
Cancel
Save