|
@ -135,14 +135,33 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
public NewsDTO get(String id) { |
|
|
public NewsDTO get(String id) { |
|
|
NewsEntity entity = baseDao.selectById(id); |
|
|
NewsEntity entity = baseDao.selectById(id); |
|
|
NewsDTO dto = ConvertUtils.sourceToTarget(entity, NewsDTO.class); |
|
|
NewsDTO dto = ConvertUtils.sourceToTarget(entity, NewsDTO.class); |
|
|
/*if(StringUtils.isNotBlank(dto.getAllDeptIds())){ |
|
|
// 通过新闻id,查询新闻关联的部门id
|
|
|
String[] idsShow = dto.getAllDeptIds().split(","); |
|
|
List<Long> listDeptId = baseDao.selectListNewsDepartment(dto.getId()); |
|
|
List<String> ids = Arrays.asList(idsShow); |
|
|
// 查完整的部门ID
|
|
|
dto.setAllDeptIdsShow(ids.subList(1,ids.size())); |
|
|
dto.setAllDeptIdsShow(this.getParentAllDeptInfo(listDeptId)); |
|
|
}*/ |
|
|
|
|
|
return dto; |
|
|
return dto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<Long[]> getParentAllDeptInfo(List<Long> listDeptId){ |
|
|
|
|
|
// [0,1,2,3]
|
|
|
|
|
|
List<Long[]> allDeptIdsShowList = new ArrayList<>(); |
|
|
|
|
|
for (Long list : listDeptId){ |
|
|
|
|
|
// 查询父级部门
|
|
|
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(list.toString()); |
|
|
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); |
|
|
|
|
|
String allDeptIds = parentAndAllDeptDTO.getAllDeptIds(); |
|
|
|
|
|
String[] deptIdsShow = allDeptIds.split(","); |
|
|
|
|
|
Long[] allDeptIdsShowLong = new Long[deptIdsShow.length]; |
|
|
|
|
|
// 从第一级开始保存
|
|
|
|
|
|
for (int i = 0; i <= deptIdsShow.length -1; i++){ |
|
|
|
|
|
allDeptIdsShowLong[i] = Long.valueOf(deptIdsShow[i]); |
|
|
|
|
|
} |
|
|
|
|
|
allDeptIdsShowList.add(allDeptIdsShowLong); |
|
|
|
|
|
} |
|
|
|
|
|
return allDeptIdsShowList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(NewsDTO dto) { |
|
|
public void save(NewsDTO dto) { |
|
|