|
|
|
@ -204,53 +204,59 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
|
entity.setReadingAmount(NumConstant.ZERO); |
|
|
|
//是不是草稿箱
|
|
|
|
entity.setNewsReleaseState(newsReleaseState); |
|
|
|
|
|
|
|
boolean isSave = true; |
|
|
|
if (StringUtils.isNotBlank(newsDTO.getId())) { |
|
|
|
isSave = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (isSave) { |
|
|
|
insert(entity); |
|
|
|
} else { |
|
|
|
updateById(entity); |
|
|
|
newsDepartmentService.deleteByNewsId(entity.getId()); |
|
|
|
} |
|
|
|
//判断是否是草稿箱 是的话 不执行下面操作
|
|
|
|
//草稿箱的新增和更新
|
|
|
|
if (YesOrNoEnum.YES.value().equals(newsReleaseState)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 通知所属部门id
|
|
|
|
Long newsDeptId = entity.getStreetId(); |
|
|
|
// 能接收通知的所有网格的ID
|
|
|
|
List<Long> newsGridList = Lists.newArrayList(); |
|
|
|
if (null != entity.getCommunityId()) { |
|
|
|
newsDeptId = entity.getCommunityId(); |
|
|
|
} |
|
|
|
if (null != entity.getGridId()) { |
|
|
|
newsDeptId = entity.getGridId(); |
|
|
|
newsGridList.add(newsDeptId); |
|
|
|
} |
|
|
|
if (isSave) { |
|
|
|
insert(entity); |
|
|
|
} else { |
|
|
|
updateById(entity); |
|
|
|
newsDepartmentService.deleteByNewsId(entity.getId()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 通知所属部门id
|
|
|
|
Long newsDeptId = entity.getStreetId(); |
|
|
|
// 能接收通知的所有网格的ID
|
|
|
|
List<Long> newsGridList = Lists.newArrayList(); |
|
|
|
if (null != entity.getCommunityId()) { |
|
|
|
newsDeptId = entity.getCommunityId(); |
|
|
|
} |
|
|
|
if (null != entity.getGridId()) { |
|
|
|
newsDeptId = entity.getGridId(); |
|
|
|
newsGridList.add(newsDeptId); |
|
|
|
} |
|
|
|
|
|
|
|
if (!user.getDeptIdList().contains(newsDeptId)) { |
|
|
|
throw new RenException("您没有操作此部门的数据权限"); |
|
|
|
} |
|
|
|
if (!user.getDeptIdList().contains(newsDeptId)) { |
|
|
|
throw new RenException("您没有操作此部门的数据权限"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(newsGridList)) { |
|
|
|
Result<List<Long>> adminResult = adminFeignClient.listGridIdByDeptPid(newsDeptId); |
|
|
|
if (!adminResult.success() || CollUtil.isEmpty(adminResult.getData())) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
if (CollUtil.isEmpty(newsGridList)) { |
|
|
|
Result<List<Long>> adminResult = adminFeignClient.listGridIdByDeptPid(newsDeptId); |
|
|
|
if (!adminResult.success() || CollUtil.isEmpty(adminResult.getData())) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
} |
|
|
|
newsGridList = adminResult.getData(); |
|
|
|
}else { |
|
|
|
} |
|
|
|
newsGridList = adminResult.getData(); |
|
|
|
} else { |
|
|
|
if (isSave) { |
|
|
|
insert(entity); |
|
|
|
} else { |
|
|
|
updateById(entity); |
|
|
|
newsDepartmentService.deleteByNewsId(entity.getId()); |
|
|
|
} |
|
|
|
this.newsDepartmentService.save(entity.getId(), newsGridList); |
|
|
|
} |
|
|
|
this.newsDepartmentService.save(entity.getId(), newsGridList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void modifyDraftsPublic(String id) { |
|
|
|
NewsDTO newsDTO = get(id); |
|
|
|
publishNews(newsDTO, YesOrNoEnum.YES.value()); |
|
|
|
publishNews(newsDTO, YesOrNoEnum.NO.value()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|