|
|
@ -70,8 +70,8 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<NoticeDTO> page(Map<String, Object> params) { |
|
|
|
String noticeTitle= (String) params.get("noticeTitle"); |
|
|
|
params.put("noticeTitle",noticeTitle.trim()); |
|
|
|
String noticeTitle = (String) params.get("noticeTitle"); |
|
|
|
params.put("noticeTitle", noticeTitle.trim()); |
|
|
|
QueryWrapper<NoticeEntity> wrapper = this.getWrapper(params) |
|
|
|
.eq(FieldConstant.CREATED_BY, SecurityUser.getUserId()); |
|
|
|
|
|
|
@ -92,7 +92,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
private QueryWrapper<NoticeEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
String noticeTitle = ((String) params.get("noticeTitle")); |
|
|
|
if(StringUtils.isNotBlank(noticeTitle)){ |
|
|
|
if (StringUtils.isNotBlank(noticeTitle)) { |
|
|
|
noticeTitle.trim(); |
|
|
|
} |
|
|
|
QueryWrapper<NoticeEntity> wrapper = new QueryWrapper<>(); |
|
|
@ -105,11 +105,11 @@ 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())){ |
|
|
|
/*if(StringUtils.isNotBlank(dto.getAllDeptIds())){ |
|
|
|
String[] idsShow = dto.getAllDeptIds().split(","); |
|
|
|
List<String> ids = Arrays.asList(idsShow); |
|
|
|
dto.setAllDeptIdsShow(ids.subList(1,ids.size())); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
@ -135,49 +135,28 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
*/ |
|
|
|
private void saveOrUpdate(NoticeDTO dto) { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
// 通知所属部门(发布者所在部门)
|
|
|
|
Long noticeDeptId = user.getDeptId(); |
|
|
|
dto.setCreatorName(user.getRealName()); |
|
|
|
|
|
|
|
NoticeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeEntity.class); |
|
|
|
entity.setDeptId(noticeDeptId); |
|
|
|
entity.setDeptName(user.getDeptName()); |
|
|
|
|
|
|
|
List<String> allDeptIds = dto.getAllDeptIdsShow(); |
|
|
|
// notice所属部门id
|
|
|
|
Long noticeDeptId = 0L; |
|
|
|
if(allDeptIds != null && allDeptIds.size() != 0){ |
|
|
|
// 塞入全部部门ids,names
|
|
|
|
noticeDeptId = Long.valueOf(allDeptIds.get(allDeptIds.size() - 1)); |
|
|
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(noticeDeptId)); |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
}else { |
|
|
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|
|
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|
|
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
//赋值deptid name 最小组织
|
|
|
|
String[] newAllDeptIds=deptDTO.getAllDeptIds().split(","); |
|
|
|
entity.setDeptId(Long.parseLong(newAllDeptIds[newAllDeptIds.length-1])); |
|
|
|
|
|
|
|
String[] newAllDeptNames=deptDTO.getAllDeptNames().split("-"); |
|
|
|
entity.setDeptName(newAllDeptNames[newAllDeptNames.length-1]); |
|
|
|
} |
|
|
|
}else { |
|
|
|
throw new RenException("所属部门不能为空"); |
|
|
|
} |
|
|
|
if (!user.getDeptIdList().contains(noticeDeptId)) { |
|
|
|
throw new RenException("您没有操作此部门的数据权限"); |
|
|
|
} |
|
|
|
List<Long> noticeGridList = new ArrayList<>(); |
|
|
|
if(allDeptIds.size() == 3){ |
|
|
|
noticeGridList.add(noticeDeptId); |
|
|
|
} |
|
|
|
if (CollUtil.isEmpty(noticeGridList)) { |
|
|
|
Result<List<Long>> adminResult = adminFeignClient.listGridIdByDeptPid(noticeDeptId); |
|
|
|
if (!adminResult.success() || CollUtil.isEmpty(adminResult.getData())) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
} |
|
|
|
noticeGridList = adminResult.getData(); |
|
|
|
// 塞入全部部门ids,names
|
|
|
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(noticeDeptId)); |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取用户部门信息失败"); |
|
|
|
} else { |
|
|
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|
|
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|
|
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
} |
|
|
|
|
|
|
|
List<Long> noticeGridList = getAllGridId(dto.getAllDeptIdsShow()); |
|
|
|
|
|
|
|
boolean isSave = true; |
|
|
|
if (StringUtils.isNotBlank(dto.getId())) { |
|
|
|
isSave = false; |
|
|
@ -196,6 +175,27 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
this.noticeDepartmentService.save(entity.getId(), noticeGridList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理前端选中的部门,取出所有网格id |
|
|
|
* |
|
|
|
* @param allDeptIdsShow |
|
|
|
* @return java.util.List<java.lang.Long> |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2020/1/28 16:12 |
|
|
|
*/ |
|
|
|
private List<Long> getAllGridId(List<Long[]> allDeptIdsShow) { |
|
|
|
List<Long> gridIdList = Lists.newArrayList(); |
|
|
|
for (Long[] deptOptions : allDeptIdsShow) { |
|
|
|
if (deptOptions.length == NumConstant.FOUR) { |
|
|
|
gridIdList.add(deptOptions[NumConstant.THREE]); |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollUtil.isEmpty(gridIdList)) { |
|
|
|
throw new RenException("请选择至少一个最低机构部门"); |
|
|
|
} |
|
|
|
return gridIdList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
@ -227,7 +227,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> |
|
|
|
@Override |
|
|
|
public Result<EpdcNoticeDetailResultDTO> getNoticeDetailById(String noticeId) { |
|
|
|
EpdcNoticeDetailResultDTO dto = this.baseDao.selectOneAppNotice(noticeId); |
|
|
|
dto.setNoticeContent("<div style=\"font-size:19px;line-height:31px\">"+dto.getNoticeContent()+"</div>"); |
|
|
|
dto.setNoticeContent("<div style=\"font-size:19px;line-height:31px\">" + dto.getNoticeContent() + "</div>"); |
|
|
|
return new Result().ok(dto); |
|
|
|
} |
|
|
|
|
|
|
|