Browse Source

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/xjrsoft/module/oa/controller/NewsController.java
phoenix 1 năm trước cách đây
mục cha
commit
df9e699c8b

+ 15 - 7
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -14,6 +14,14 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.oa.dto.*;
+import com.xjrsoft.module.oa.dto.AddNewsDto;
+import com.xjrsoft.module.oa.dto.ChangeNewsDto;
+import com.xjrsoft.module.oa.dto.DeleteNewsRelationDto;
+import com.xjrsoft.module.oa.dto.NewsPageDto;
+import com.xjrsoft.module.oa.dto.NewsRelationPageDto;
+import com.xjrsoft.module.oa.dto.NewsReplyDto;
+import com.xjrsoft.module.oa.dto.UpdateNewsDto;
+import com.xjrsoft.module.oa.dto.UpdateNewsRelationDto;
 import com.xjrsoft.module.oa.entity.News;
 import com.xjrsoft.module.oa.entity.NewsAppendix;
 import com.xjrsoft.module.oa.entity.NewsRelation;
@@ -152,20 +160,20 @@ public class NewsController {
 
     @PutMapping("/change-status")
     @ApiOperation(value = "发布或下架新闻")
-    public RT<Boolean> changeStatus(@RequestParam("id") String id, @RequestParam("type") Integer type) throws Exception {
-        News xjrNews = newsService.getById(id);
-        if (type == null || xjrNews == null) {
+    public RT<Boolean> changeStatus(@RequestBody ChangeNewsDto changeNewsDto) throws Exception {
+        News xjrNews = newsService.getById(changeNewsDto.getId());
+        if (changeNewsDto.getStatus() == null || xjrNews == null) {
             throw new Exception("参数异常");
         }
-        if (type.equals(xjrNews.getStatus())) {
-            if (type == 2) {
+        if (changeNewsDto.getStatus().equals(xjrNews.getStatus())) {
+            if (changeNewsDto.getStatus() == 2) {
                 throw new Exception("新闻已发布!!!");
-            } else if (type == 3) {
+            } else if (changeNewsDto.getStatus() == 3) {
                 throw new Exception("新闻已下架!!!");
             }
         }
         //将原来的修改enabled_mark改为修改status
-        xjrNews.setStatus(type);
+        xjrNews.setStatus(changeNewsDto.getStatus());
         if(xjrNews.getStatus() == 2){
             newsService.SendMessage(xjrNews.getId());
         }

+ 26 - 0
src/main/java/com/xjrsoft/module/oa/dto/ChangeNewsDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.oa.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author: tzx
+ * @Date: 2022/6/27 16:27
+ */
+@Data
+public class ChangeNewsDto {
+
+    /**
+     * 类型(1-新闻2-公告)
+     */
+    @NotNull(message = "id不能为空!")
+    private Long id;
+    /**
+     * 类型(1-新闻2-公告)
+     */
+    @ApiModelProperty("状态 1=未发布 2=已发布 3=下架")
+    @NotNull(message = "状态不能为空!")
+    private Integer status;
+}