|
|
|
@ -13,11 +13,9 @@ import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
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.*; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.SuperAdminEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.ErrorCode; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.redis.RedisKeys; |
|
|
|
@ -28,6 +26,7 @@ import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.TreeUtils; |
|
|
|
import com.elink.esua.epdc.constant.TypeKeyConstant; |
|
|
|
import com.elink.esua.epdc.dao.SysDeptDao; |
|
|
|
import com.elink.esua.epdc.dto.*; |
|
|
|
import com.elink.esua.epdc.dto.epdc.GridForLeaderRegisterDTO; |
|
|
|
@ -522,4 +521,54 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
List<Long> deptIdList = baseDao.pageDeptIdByTypeKey(typeKey, pageSize, pageIndex); |
|
|
|
return new Result().ok(deptIdList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public DeptLevelAndLeaderDTO getDeptInfoById(Long deptId, Integer leaderFlag) { |
|
|
|
if (null == deptId || null == leaderFlag) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
SysDeptEntity sysDeptEntity = baseDao.selectById(deptId); |
|
|
|
if (null == sysDeptEntity) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
String deptName = sysDeptEntity.getName(); |
|
|
|
String pids = sysDeptEntity.getPids(); |
|
|
|
// 上级机构id
|
|
|
|
String parentDeptIds = NumConstant.ZERO_STR.equals(pids) ? "" : pids; |
|
|
|
// 全部机构id
|
|
|
|
String allDeptIds = StringUtils.isBlank(pids) ? String.valueOf(deptId) : |
|
|
|
pids.concat(StrConstant.COMMA).concat(String.valueOf(deptId)); |
|
|
|
|
|
|
|
// 上级机构名称
|
|
|
|
String parentDeptNames = ""; |
|
|
|
if (StringUtils.isNotBlank(parentDeptIds)) { |
|
|
|
String[] pidArray = parentDeptIds.split(StrConstant.COMMA); |
|
|
|
List<String> deptNameList = Lists.newArrayList(); |
|
|
|
SysDeptEntity dept; |
|
|
|
for (int i = 0; i < pidArray.length; i++) { |
|
|
|
dept = baseDao.selectById(Long.parseLong(pidArray[i])); |
|
|
|
deptNameList.add(dept.getName()); |
|
|
|
} |
|
|
|
parentDeptNames = StringUtils.join(deptNameList, StrConstant.HYPHEN); |
|
|
|
} |
|
|
|
// 全部机构名称
|
|
|
|
String allDeptNames = StringUtils.isBlank(parentDeptNames) ? deptName : |
|
|
|
parentDeptNames.concat(StrConstant.HYPHEN).concat(deptName); |
|
|
|
|
|
|
|
DeptLevelAndLeaderDTO deptLevel = new DeptLevelAndLeaderDTO(); |
|
|
|
deptLevel.setDeptId(deptId); |
|
|
|
deptLevel.setDeptName(deptName); |
|
|
|
deptLevel.setParentDeptIds(parentDeptIds); |
|
|
|
deptLevel.setParentDeptNames(parentDeptNames); |
|
|
|
deptLevel.setAllDeptIds(allDeptIds); |
|
|
|
deptLevel.setAllDeptNames(allDeptNames); |
|
|
|
deptLevel.setTypeKey(sysDeptEntity.getTypeKey()); |
|
|
|
|
|
|
|
if (YesOrNoEnum.YES.value().equals(leaderFlag)) { |
|
|
|
String leaderName = baseDao.selectDeptLeaderName(deptId, TypeKeyConstant.ROLE_GRID_LEADER); |
|
|
|
deptLevel.setLeaderName(leaderName); |
|
|
|
} |
|
|
|
|
|
|
|
return deptLevel; |
|
|
|
} |
|
|
|
} |
|
|
|
|