|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.cms.controller;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
|
|
@@ -34,6 +35,9 @@ import java.util.stream.Collectors;
|
|
|
@Api(tags = "资讯服务")
|
|
|
public class NewsController extends BaseController {
|
|
|
|
|
|
+ // 全局资讯类型
|
|
|
+ private static final List<Integer> globalNewsTypes = Lists.newArrayList(4, 6, 26, 29);
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysNewsInformationService sysNewsInformationService;
|
|
|
@Autowired
|
|
@@ -68,7 +72,7 @@ public class NewsController extends BaseController {
|
|
|
@ApiOperation("资讯列表分页查询")
|
|
|
@GetMapping(value = "/list")
|
|
|
public Object getList(NewsInformationQueryInfo queryInfo) {
|
|
|
- if (queryInfo.getType() == 6 || queryInfo.getType() == 4 || queryInfo.getType() == 26) {
|
|
|
+ if (Objects.nonNull(queryInfo.getType()) && globalNewsTypes.contains(queryInfo.getType())) {
|
|
|
queryInfo.setTenantId(-1);
|
|
|
}
|
|
|
String clientId = queryInfo.getClientId();
|
|
@@ -98,8 +102,7 @@ public class NewsController extends BaseController {
|
|
|
@GetMapping(value = "/queryPage")
|
|
|
public Object queryPage(NewsInformationQueryInfo queryInfo) {
|
|
|
|
|
|
- if (queryInfo.getType() != null
|
|
|
- && (queryInfo.getType() == 6 || queryInfo.getType() == 4 || queryInfo.getType() == 26)) {
|
|
|
+ if (Objects.nonNull(queryInfo.getType()) && globalNewsTypes.contains(queryInfo.getType())) {
|
|
|
queryInfo.setTenantId(-1);
|
|
|
}
|
|
|
|
|
@@ -152,7 +155,7 @@ public class NewsController extends BaseController {
|
|
|
@PreAuthorize("@pcs.hasPermissions('news/add')")
|
|
|
public Object add(SysNewsInformation newsInfo) {
|
|
|
|
|
|
- if (newsInfo.getType() == 6 || newsInfo.getType() == 4 || newsInfo.getType() == 26) {
|
|
|
+ if (Objects.nonNull(newsInfo.getType()) && globalNewsTypes.contains(newsInfo.getType())) {
|
|
|
newsInfo.setTenantId(-1);
|
|
|
}
|
|
|
/*if (newsInfo.getContent().length() > 7999) {
|
|
@@ -175,7 +178,7 @@ public class NewsController extends BaseController {
|
|
|
if (newsInfo.getType() == null) {
|
|
|
newsInfo.setType(originNewsInfo.getType());
|
|
|
}
|
|
|
- if (newsInfo.getType() == 6 || newsInfo.getType() == 4 || newsInfo.getType() == 26) {
|
|
|
+ if (Objects.nonNull(newsInfo.getType()) && globalNewsTypes.contains(newsInfo.getType())) {
|
|
|
newsInfo.setTenantId(-1);
|
|
|
}
|
|
|
return succeed(sysNewsInformationService.update(newsInfo));
|