|
@@ -1,5 +1,6 @@
|
|
|
package com.lc.ibps.common.provider;
|
|
package com.lc.ibps.common.provider;
|
|
|
|
|
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -28,6 +29,7 @@ import com.lc.ibps.common.system.persistence.entity.NewsPo;
|
|
|
import com.lc.ibps.common.system.repository.NewsRepository;
|
|
import com.lc.ibps.common.system.repository.NewsRepository;
|
|
|
import com.lc.ibps.common.system.repository.NewsRightsRepository;
|
|
import com.lc.ibps.common.system.repository.NewsRightsRepository;
|
|
|
import com.lc.ibps.common.system.service.INewsRightsService;
|
|
import com.lc.ibps.common.system.service.INewsRightsService;
|
|
|
|
|
+import com.lc.ibps.common.system.service.impl.NewsService;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -55,6 +57,8 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
private NewsRightsRepository newsRightsRepository;
|
|
private NewsRightsRepository newsRightsRepository;
|
|
|
@Resource
|
|
@Resource
|
|
|
private INewsRightsService iNewsRightsService;
|
|
private INewsRightsService iNewsRightsService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private NewsService newsService;
|
|
|
|
|
|
|
|
@ApiOperation(value = "公告列表(分页条件查询)数据", notes = "公告列表(分页条件查询)数据")
|
|
@ApiOperation(value = "公告列表(分页条件查询)数据", notes = "公告列表(分页条件查询)数据")
|
|
|
@Override
|
|
@Override
|
|
@@ -86,6 +90,10 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
queryFilter.addParamsFilter("curUserId", ContextUtil.getCurrentUserId());
|
|
queryFilter.addParamsFilter("curUserId", ContextUtil.getCurrentUserId());
|
|
|
|
|
|
|
|
List<NewsPo> newsPos = newsRepository.query(queryFilter);
|
|
List<NewsPo> newsPos = newsRepository.query(queryFilter);
|
|
|
|
|
+ boolean isSuper = ContextUtil.isSuper();
|
|
|
|
|
+ if(!isSuper){
|
|
|
|
|
+ newsPos = newsRepository.getScopeNews(newsPos);
|
|
|
|
|
+ }
|
|
|
APIPageList<NewsPo> pageList = getAPIPageList(newsPos);
|
|
APIPageList<NewsPo> pageList = getAPIPageList(newsPos);
|
|
|
result.setData(pageList);
|
|
result.setData(pageList);
|
|
|
result.addVariable("pageResult", pageList.getPageResult());
|
|
result.addVariable("pageResult", pageList.getPageResult());
|
|
@@ -94,7 +102,7 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "查询公告信息", notes = "根据传入id查询,并返回公告信息")
|
|
@ApiOperation(value = "查询公告信息", notes = "根据传入id查询,并返回公告信息")
|
|
|
@Override
|
|
@Override
|
|
|
public APIResult<NewsPo> get(
|
|
public APIResult<NewsPo> get(
|
|
@@ -109,8 +117,8 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "保存", notes = "保存公告信息",
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "保存", notes = "保存公告信息",
|
|
|
extensions = {
|
|
extensions = {
|
|
|
@Extension(properties = {
|
|
@Extension(properties = {
|
|
|
@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
@@ -119,6 +127,56 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
@Signature
|
|
@Signature
|
|
|
@Override
|
|
@Override
|
|
|
public APIResult<Void> save(
|
|
public APIResult<Void> save(
|
|
|
|
|
+ @ApiParam(name = "newsPo", value = "公告信息对象", required = true)
|
|
|
|
|
+ @RequestBody(required = true) NewsPo newsPo) { // 保持原有参数不变
|
|
|
|
|
+
|
|
|
|
|
+ APIResult<Void> result = new APIResult<>();
|
|
|
|
|
+ boolean hasScope = true;
|
|
|
|
|
+ List<String> scopeUserIds = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ scopeUserIds = newsPo.getScopeUserIds();
|
|
|
|
|
+ hasScope = scopeUserIds != null;
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(newsPo.getId())){
|
|
|
|
|
+ APIResult<NewsPo> newsPoAPIResult = get(newsPo.getId());
|
|
|
|
|
+ NewsPo data = newsPoAPIResult.getData();
|
|
|
|
|
+ if(data != null){
|
|
|
|
|
+ if(!data.getUserId().equalsIgnoreCase(ContextUtil.getCurrentUserId())){
|
|
|
|
|
+ throw new Exception("不能修改其他人的公告!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //构造领域对象和保存数据
|
|
|
|
|
+ News news = newsRepository.newInstance(newsPo);
|
|
|
|
|
+ news.save();
|
|
|
|
|
+ String newsId = newsPo.getId();
|
|
|
|
|
+ String deptIdStr = newsPo.getDepId();
|
|
|
|
|
+ iNewsRightsService.saveNewsRights(deptIdStr, newsId);
|
|
|
|
|
+ result.setMessage(I18nUtil.getMessage("com.lc.ibps.common.provider.NewsProvider.save"));
|
|
|
|
|
+ result.addVariable("id", newsId);
|
|
|
|
|
+ //使用 scopeUserIds 做业务逻辑
|
|
|
|
|
+ if (hasScope == true && scopeUserIds != null && newsRepository.isTableExists("t_ggfwb")) {
|
|
|
|
|
+ //暂定newsType为user,后期可扩展(user=用户, dept=部门, role=角色')
|
|
|
|
|
+ newsService.saveNewsScope("user", scopeUserIds,newsId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ setExceptionResult(result, StateEnum.ERROR_NEWS.getCode(), I18nUtil.getMessage(StateEnum.ERROR_NEWS.getCode()+""), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 公告增加可见范围
|
|
|
|
|
+ @ApiOperation(value = "保存", notes = "保存公告信息",
|
|
|
|
|
+ extensions = {
|
|
|
|
|
+ @Extension(properties = {
|
|
|
|
|
+ @ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ @Signature
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public APIResult<Void> saveold(
|
|
|
@ApiParam(name = "newsPo", value = "公告信息对象", required = true)
|
|
@ApiParam(name = "newsPo", value = "公告信息对象", required = true)
|
|
|
@RequestBody(required = true) NewsPo newsPo) {
|
|
@RequestBody(required = true) NewsPo newsPo) {
|
|
|
APIResult<Void> result = new APIResult<>();
|
|
APIResult<Void> result = new APIResult<>();
|
|
@@ -146,6 +204,7 @@ public class NewsProvider extends GenericProvider implements INewsService, INews
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
@ApiOperation(value = "删除(批量)", notes = "批量删除公告记录",
|
|
@ApiOperation(value = "删除(批量)", notes = "批量删除公告记录",
|
|
|
extensions = {
|
|
extensions = {
|