|
|
@ -17,6 +17,7 @@ |
|
|
|
|
|
|
|
package com.elink.esua.epdc.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
@ -30,6 +31,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.dao.NoticeDao; |
|
|
|
import com.elink.esua.epdc.dao.NoticeDepartmentDao; |
|
|
|
import com.elink.esua.epdc.dto.NoticeDTO; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO; |
|
|
@ -68,19 +70,28 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
@Autowired |
|
|
|
private NoticeDepartmentService noticeDepartmentService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private NoticeDepartmentDao noticeDepartmentDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<NoticeDTO> page(Map<String, Object> params) { |
|
|
|
String noticeTitle = (String) params.get("noticeTitle"); |
|
|
|
params.put("noticeTitle", noticeTitle.trim()); |
|
|
|
QueryWrapper<NoticeEntity> wrapper = this.getWrapper(params) |
|
|
|
.eq(FieldConstant.CREATED_BY, SecurityUser.getUserId()) |
|
|
|
.isNull("type_id"); |
|
|
|
|
|
|
|
IPage<NoticeEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
wrapper |
|
|
|
); |
|
|
|
return getPageData(page, NoticeDTO.class); |
|
|
|
// String noticeTitle = (String) params.get("noticeTitle");
|
|
|
|
// params.put("noticeTitle", noticeTitle.trim());
|
|
|
|
// QueryWrapper<NoticeEntity> wrapper = this.getWrapper(params)
|
|
|
|
// .eq(FieldConstant.CREATED_BY, SecurityUser.getUserId());
|
|
|
|
//
|
|
|
|
// IPage<NoticeEntity> page = baseDao.selectPage(
|
|
|
|
// getPage(params, FieldConstant.CREATED_TIME, false),
|
|
|
|
// wrapper
|
|
|
|
// );
|
|
|
|
// return getPageData(page, NoticeDTO.class);
|
|
|
|
|
|
|
|
params.put("createdBy", SecurityUser.getUserId()); |
|
|
|
|
|
|
|
IPage<NoticeDTO> page = getPage(params); |
|
|
|
List<NoticeDTO> list = baseDao.getModulePageList(params); |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -89,7 +100,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
String gridId = (String) params.get("gridId"); |
|
|
|
params.put("noticeTitle", noticeTitle.trim()); |
|
|
|
params.put("deptIdList", SecurityUser.getUser().getDeptIdList()); |
|
|
|
params.put("gridId",gridId.trim()); |
|
|
|
params.put("gridId", gridId.trim()); |
|
|
|
IPage<NoticeDTO> page = getPage(params); |
|
|
|
List<NoticeDTO> list = baseDao.selectListByDeptId(params); |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
@ -118,7 +129,7 @@ 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(entity.getTypeId())){ |
|
|
|
if (StringUtils.isNotBlank(entity.getTypeId())) { |
|
|
|
String[] ids = entity.getAllTypeId().split(","); |
|
|
|
List<String> moduleTypes = Arrays.asList(ids); |
|
|
|
dto.setAllTypeId(moduleTypes); |
|
|
@ -128,9 +139,38 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
List<String> ids = Arrays.asList(idsShow); |
|
|
|
dto.setAllDeptIdsShow(ids.subList(1,ids.size())); |
|
|
|
}*/ |
|
|
|
// 通知部门回显
|
|
|
|
List<Long> listNoticeDeptId = noticeDepartmentDao.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) { |
|
|
@ -160,6 +200,14 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
NoticeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeEntity.class); |
|
|
|
entity.setDeptId(noticeDeptId); |
|
|
|
entity.setDeptName(user.getDeptName()); |
|
|
|
if(!CollectionUtils.isEmpty(dto.getAllTypeId())){ |
|
|
|
entity.setAllTypeId(StringUtils.join(dto.getAllTypeId(), ",")); |
|
|
|
} |
|
|
|
if ("0".equals(entity.getTopFlag())) { |
|
|
|
entity.setTopTime(null); |
|
|
|
} else { |
|
|
|
entity.setTopTime(new Date()); |
|
|
|
} |
|
|
|
|
|
|
|
// 塞入全部部门ids,names
|
|
|
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(noticeDeptId)); |
|
|
@ -257,13 +305,13 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @describe: 后台内容管理-新增/更新 |
|
|
|
* @author wangtong |
|
|
|
* @date 2021/8/11 14:19 |
|
|
|
* @params [] |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
private void saveContentOrUpdate(NoticeDTO dto){ |
|
|
|
* @return void |
|
|
|
* @describe: 后台内容管理-新增/更新 |
|
|
|
* @author wangtong |
|
|
|
* @date 2021/8/11 14:19 |
|
|
|
* @params [] |
|
|
|
*/ |
|
|
|
private void saveContentOrUpdate(NoticeDTO dto) { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
// 通知所属部门(发布者所在部门)
|
|
|
|
Long noticeDeptId = user.getDeptId(); |
|
|
@ -273,9 +321,9 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
entity.setDeptId(noticeDeptId); |
|
|
|
entity.setDeptName(user.getDeptName()); |
|
|
|
entity.setAllTypeId(StringUtils.join(dto.getAllTypeId(), ",")); |
|
|
|
if("0".equals(entity.getTopFlag())){ |
|
|
|
if ("0".equals(entity.getTopFlag())) { |
|
|
|
entity.setTopTime(null); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
entity.setTopTime(new Date()); |
|
|
|
} |
|
|
|
// 塞入全部部门ids,names
|
|
|
@ -319,18 +367,49 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public Result handleIsTop(NoticeDTO dto) { |
|
|
|
NoticeEntity entity = selectById(dto.getId()); |
|
|
|
if (null == entity) { |
|
|
|
return new Result().error("未查到相关数据"); |
|
|
|
} |
|
|
|
if ("0".equals(dto.getTopFlag())) { |
|
|
|
entity.setTopFlag("1"); |
|
|
|
entity.setTopTime(new Date()); |
|
|
|
} else { |
|
|
|
entity.setTopFlag("0"); |
|
|
|
} |
|
|
|
updateById(entity); |
|
|
|
return new Result().ok(""); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result handleIsUpDown(NoticeDTO dto) { |
|
|
|
NoticeEntity entity = selectById(dto.getId()); |
|
|
|
if (null == entity) { |
|
|
|
return new Result().error("未查到相关数据"); |
|
|
|
} |
|
|
|
if ("0".equals(dto.getNoticeUpDownState())) { |
|
|
|
entity.setNoticeUpDownState("1"); |
|
|
|
} else { |
|
|
|
entity.setNoticeUpDownState("0"); |
|
|
|
} |
|
|
|
updateById(entity); |
|
|
|
return new Result().ok(""); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* 组织机构信息处理 |
|
|
|
* |
|
|
|
* @params [dto, noticeList] |
|
|
|
* @return java.util.List<com.elink.esua.epdc.entity.NoticeEntity> |
|
|
|
* @params [dto, noticeList] |
|
|
|
* @author liuchuang |
|
|
|
* @since 2020/3/7 14:56 |
|
|
|
*/ |
|
|
|
private List<NoticeEntity> handleOrganizationInfo(OrganizationModifyDTO dto, List<NoticeDTO> noticeList) { |
|
|
|
List<NoticeEntity> entities = new ArrayList<>(); |
|
|
|
for (NoticeDTO notice: noticeList) { |
|
|
|
for (NoticeDTO notice : noticeList) { |
|
|
|
NoticeEntity entity = new NoticeEntity(); |
|
|
|
if (StringUtils.isNotEmpty(notice.getParentDeptIds()) && StringUtils.isNotEmpty(notice.getParentDeptNames())) { |
|
|
|
List<String> parentDeptIds = Arrays.asList(notice.getParentDeptIds().split(",")); |
|
|
|