From 1c3f11dfd7493a4c4a8d41e2499477840bcc070c Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期五, 19 五月 2023 15:01:46 +0800
Subject: [PATCH] 限制文件大小,用户,报案人审核筛选

---
 src/main/java/com/example/jz/controller/GroupController.java |  151 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 104 insertions(+), 47 deletions(-)

diff --git a/src/main/java/com/example/jz/controller/GroupController.java b/src/main/java/com/example/jz/controller/GroupController.java
index 6999861..72d06db 100644
--- a/src/main/java/com/example/jz/controller/GroupController.java
+++ b/src/main/java/com/example/jz/controller/GroupController.java
@@ -1,89 +1,146 @@
 package com.example.jz.controller;
 
 
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.api.ApiController;
-import com.baomidou.mybatisplus.extension.api.R;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.jz.modle.R;
+import com.example.jz.modle.entity.Announcement;
 import com.example.jz.modle.entity.Group;
+import com.example.jz.modle.entity.GroupUser;
+import com.example.jz.modle.vo.GroupMessageVo;
+import com.example.jz.modle.vo.GroupUserVo;
 import com.example.jz.service.GroupService;
+import com.example.jz.service.GroupUserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
-import java.io.Serializable;
 import java.util.List;
 
 /**
  * 缇よ〃
-(Group)琛ㄦ帶鍒跺眰
+ * (Group)琛ㄦ帶鍒跺眰
  *
  * @author makejava
  * @since 2022-07-11 16:35:57
  */
 @RestController
 @RequestMapping("group")
+@Api(tags = "缇ょ粍鎺ュ彛")
 public class GroupController extends ApiController {
-    /**
-     * 鏈嶅姟瀵硅薄
-     */
-    @Resource
     private GroupService groupService;
 
+    @Autowired
+    public void setGroupService(GroupService groupService) {
+        this.groupService = groupService;
+    }
+
+    @Autowired
+    GroupUserService groupUserService;
+
     /**
-     * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹�
+     * 鏍规嵁缇ょ粍id鑾峰彇褰撳墠缇ょ粍鎵�鏈夌殑娑堟伅 淇敼
      *
-     * @param page 鍒嗛〉瀵硅薄
-     * @param group 鏌ヨ瀹炰綋
-     * @return 鎵�鏈夋暟鎹�
+     * @param id 缇ょ粍id
+     * @return 褰撳墠缇ょ粍鎵�鏈夌殑娑堟伅
      */
-    @GetMapping
-    public R selectAll(Page<Group> page, Group group) {
-        return success(this.groupService.page(page, new QueryWrapper<>(group)));
+    @GetMapping("getAllMessage")
+    @ApiOperation(value = "鑾峰彇褰撳墠缇ょ粍鎵�鏈夌殑娑堟伅")
+    @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    public R<List<GroupMessageVo>> getAllMessage(@RequestParam("id") Integer id) {
+        return R.ok(groupService.getAllMessage(id));
+    }
+
+
+    @GetMapping("getGroupMessage")
+    @ApiOperation(value = "鑾峰彇褰撳墠缇ょ粍娑堟伅閫氳繃鎴愬憳鎴栬�呭唴瀹�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "report", value = "缇ょ粍id", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "context", value = "缇ょ粍id", required = true, dataType = "String")
+    })
+    public R<List<GroupMessageVo>> get(@RequestParam(value = "report", required = false) String reporter, @RequestParam(value = "context", required = false) String context, Integer groupId) {
+        return R.ok(groupService.getByCondition(reporter, context, groupId));
+    }
+
+    @PutMapping("banSpeech")
+    @ApiOperation(value = "绂佽█")
+    @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    public R setBanSpeech(@RequestParam("id") Integer id, @RequestParam("groupId") Integer groupId) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 1).eq("user_id", id).eq("group_id", groupId)));
+    }
+
+    @PutMapping("allowSpeech")
+    @ApiOperation(value = "鍏佽鍙戣█")
+    @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    public R setAllowSpeech(@RequestParam("id") Integer id, @RequestParam("groupId") Integer groupId) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 0).eq("user_id", id).eq("group_id", groupId)));
+    }
+
+    @PutMapping("banSpeechAll")
+    @ApiOperation(value = "鍏ㄩ儴绂佽█")
+    public R setBanSpeechAll(@RequestParam("id") Integer id) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 1).eq("group_id", id)));
+    }
+
+    @PutMapping("banSpeechRemark")
+    @ApiOperation(value = "鍏ㄩ儴鍏佽鍙戣█")
+    public R setBanSpeechRemark(@RequestParam("id") Integer id) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 0).eq("group_id", id)));
     }
 
     /**
-     * 閫氳繃涓婚敭鏌ヨ鍗曟潯鏁版嵁
+     * 鏍规嵁缇ょ粍id鑾峰彇褰撳墠缇ょ粍鎵�鏈夊叕鍛�
      *
-     * @param id 涓婚敭
-     * @return 鍗曟潯鏁版嵁
+     * @param id 缇ょ粍id
+     * @return 褰撳墠缇ょ粍鎵�鏈夌殑娑堟伅
      */
-    @GetMapping("{id}")
-    public R selectOne(@PathVariable Serializable id) {
-        return success(this.groupService.getById(id));
+    @GetMapping("getAllNotice")
+    @ApiOperation(value = "鑾峰彇褰撳墠缇ょ粍鎵�鏈夌殑鍏憡")
+    @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    public R<List<Announcement>> getAllNotice(@RequestParam("id") Integer id) {
+        return R.ok(groupService.getAllNotice(id));
     }
 
     /**
-     * 鏂板鏁版嵁
+     * 鍙戦�佷俊鎭�
      *
-     * @param group 瀹炰綋瀵硅薄
-     * @return 鏂板缁撴灉
+     * @param id   缇ょ粍id
+     * @param text 娑堟伅鍐呭
+     * @return 鍙戦�佺粨鏋�
      */
-    @PostMapping
-    public R insert(@RequestBody Group group) {
-        return success(this.groupService.save(group));
+    @GetMapping("sendMessage")
+    @ApiOperation(value = "鍙戦�佷俊鎭�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "text", value = "娑堟伅鏂囨湰", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    })
+    public R<Boolean> sendMessage(@RequestParam("id") Integer id, @RequestParam("text") String text) {
+        if (StringUtils.isBlank(text)) {
+            return R.failed("鏂囨湰涓虹┖");
+        }
+        return R.ok(groupService.sendMessage(id, text));
     }
 
     /**
-     * 淇敼鏁版嵁
+     * 鑾峰彇缇ょ粍鎵�鏈変汉鍛樺垪琛� 淇敼
      *
-     * @param group 瀹炰綋瀵硅薄
-     * @return 淇敼缁撴灉
+     * @param id 缇ょ粍id
+     * @return 缇ょ粍鎵�鏈変汉鍛樺垪琛�
      */
-    @PutMapping
-    public R update(@RequestBody Group group) {
-        return success(this.groupService.updateById(group));
+    @GetMapping("getAllUser")
+    @ApiOperation(value = "鑾峰彇缇ょ粍鎵�鏈変汉鍛樺垪琛�")
+    @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
+    public R<List<GroupUserVo>> getAllUser(@RequestParam("id") Integer id) {
+        return R.ok(groupService.getAllUser(id));
     }
 
-    /**
-     * 鍒犻櫎鏁版嵁
-     *
-     * @param idList 涓婚敭缁撳悎
-     * @return 鍒犻櫎缁撴灉
-     */
-    @DeleteMapping
-    public R delete(@RequestParam("idList") List<Long> idList) {
-        return success(this.groupService.removeByIds(idList));
+    @GetMapping("getAllGroupName")
+    @ApiOperation(value = "鑾峰彇缇ょ粍鍚嶇О")
+    public R<List<Group>> getAllGroupName() {
+        return R.ok(groupService.list());
     }
-}
-
+}
\ No newline at end of file

--
Gitblit v1.8.0