|
|
@ -27,7 +27,6 @@ import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.StrConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
@ -276,15 +275,13 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu |
|
|
|
* @Date: 2020-04-14 |
|
|
|
*/ |
|
|
|
private ManualScoreEntity packageManualScoreByExcelData(ManualScoreExcel excelData, UserDetail user) { |
|
|
|
|
|
|
|
// 获取用户所有数据权限对应的部门
|
|
|
|
List<DeptLevelAndLeaderDTO> deptList = getDeptListByDateScope(user.getDeptIdList()); |
|
|
|
DeptLevelAndLeaderDTO deptByExcelData = getDeptByExcelData(excelData, deptList); |
|
|
|
if (null == deptByExcelData) { |
|
|
|
throw new RenException("匹配数据权限失败"); |
|
|
|
} |
|
|
|
|
|
|
|
DeptLevelAndLeaderDTO deptLevelInfo = deptUtils.getDeptLevelInfo(deptByExcelData.getDeptId(), YesOrNoEnum.YES); |
|
|
|
UserSysDeptInfoFormDTO userSysDeptInfoFormDTO = new UserSysDeptInfoFormDTO(); |
|
|
|
userSysDeptInfoFormDTO.setDeptName(excelData.getDeptName()); |
|
|
|
//根据部门名称获取部门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()); |
|
|
|
manualScoreEntity.setAllDeptIds(deptLevelInfo.getAllDeptIds()); |
|
|
@ -305,52 +302,6 @@ public class ManualScoreServiceImpl extends BaseServiceImpl<ManualScoreDao, Manu |
|
|
|
return manualScoreEntity; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description: 通过数据权限获取所有部门列表 |
|
|
|
* @Param: [deptIdList] |
|
|
|
* @return: java.util.List<com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO> |
|
|
|
* @Author: zy |
|
|
|
* @Date: 2020-04-14 |
|
|
|
*/ |
|
|
|
private List<DeptLevelAndLeaderDTO> getDeptListByDateScope(List<Long> deptIdList) { |
|
|
|
List<DeptLevelAndLeaderDTO> deptList = Lists.newArrayList(); |
|
|
|
DeptLevelAndLeaderDTO deptLevelInfo; |
|
|
|
for (Long deptId : deptIdList) { |
|
|
|
deptLevelInfo = deptUtils.getDeptLevelInfo(deptId, YesOrNoEnum.NO); |
|
|
|
deptList.add(deptLevelInfo); |
|
|
|
} |
|
|
|
return deptList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description: 从数据权限的所有部门中,匹配excel中的一行数据 |
|
|
|
* @param excelData excel中的某一行 |
|
|
|
* @param deptList 用户部门权限中的所有部门 |
|
|
|
* @return: com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO |
|
|
|
* @Author: zy |
|
|
|
* @Date: 2020-04-14 |
|
|
|
*/ |
|
|
|
private DeptLevelAndLeaderDTO getDeptByExcelData(ManualScoreExcel excelData, List<DeptLevelAndLeaderDTO> deptList) { |
|
|
|
String[] deptNameAll = excelData.getDeptName().split("-"); |
|
|
|
String allDeptNames = ""; |
|
|
|
if (deptNameAll.length == 3) { |
|
|
|
allDeptNames = deptNameAll[0].trim() |
|
|
|
.concat(StrConstant.HYPHEN).concat(deptNameAll[1].trim()) |
|
|
|
.concat(StrConstant.HYPHEN).concat(deptNameAll[2].trim()); |
|
|
|
} else if (deptNameAll.length == 2) { |
|
|
|
allDeptNames = deptNameAll[0].trim() |
|
|
|
.concat(StrConstant.HYPHEN).concat(deptNameAll[1].trim()); |
|
|
|
} else if (deptNameAll.length == 1) { |
|
|
|
allDeptNames = deptNameAll[0].trim(); |
|
|
|
} |
|
|
|
for (DeptLevelAndLeaderDTO oneDept : deptList) { |
|
|
|
if (oneDept.getAllDeptNames().contains(allDeptNames)) { |
|
|
|
return oneDept; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除文件夹(强制删除) |
|
|
|
* |
|
|
|