Browse Source

消息通知-通知管理,增加通知部门回显

feature/syp_points
zhangyongzhangyong 5 years ago
parent
commit
9ce60a50cb
  1. 9
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java
  2. 35
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java
  3. 9
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeDao.xml

9
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java

@ -121,4 +121,13 @@ public interface NoticeDao extends BaseDao<NoticeEntity> {
* @Date 09:46 2020-05-19
**/
List<EpdcNoticeListResultDTO> selectListV2AppNotice(EpdcNoticeListV2FormDTO formDto);
/**
* 根据主键ID, 查询通知的部门id
* @param noticeId
* @return java.util.List<Long[]>
* @Author zhangyong
* @Date 09:43 2020-06-02
**/
List<Long> selectListNoticeDeptIdInfo(String noticeId);
}

35
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java

@ -122,14 +122,39 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
public NoticeDTO get(String id) {
NoticeEntity entity = baseDao.selectById(id);
NoticeDTO dto = ConvertUtils.sourceToTarget(entity, NoticeDTO.class);
/*if(StringUtils.isNotBlank(dto.getAllDeptIds())){
String[] idsShow = dto.getAllDeptIds().split(",");
List<String> ids = Arrays.asList(idsShow);
dto.setAllDeptIdsShow(ids.subList(1,ids.size()));
}*/
// 通知部门回显
List<Long> listNoticeDeptId = baseDao.selectListNoticeDeptIdInfo(dto.getId());
dto.setAllDeptIdsShow(this.getParentAllDeptInfo(listNoticeDeptId));
return dto;
}
/**
* 根据部门id, 查询所有的父级id, 最后拼接起来
* @param listDeptId
* @return java.util.List<java.lang.Long[]>
* @Author zhangyong
* @Date 09:55 2020-06-02
**/
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
@Transactional(rollbackFor = Exception.class)
public void save(NoticeDTO dto) {

9
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeDao.xml

@ -116,4 +116,13 @@
en.RELEASE_TIME DESC
LIMIT #{pageIndex},#{pageSize}
</select>
<select id="selectListNoticeDeptIdInfo" resultType="Long">
SELECT
DEPT_ID deptId
FROM
epdc_notice_department nd
WHERE nd.DEL_FLAG = 0
AND nd.NOTICE_ID = #{noticeId}
</select>
</mapper>

Loading…
Cancel
Save