From e43e2f457c52f9a8d4a0aa9d45aa4a0fba94315d Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期一, 26 十二月 2022 16:58:10 +0800
Subject: [PATCH] fix: 小程序公告

---
 src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java |    2 
 src/main/java/com/example/jz/modle/vo/ReportVo.java                 |   11 +++--
 src/main/java/com/example/jz/controller/WxAppController.java        |   49 ++++++++++++++++++++++--
 3 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/example/jz/controller/WxAppController.java b/src/main/java/com/example/jz/controller/WxAppController.java
index 658cccc..65d5b1b 100644
--- a/src/main/java/com/example/jz/controller/WxAppController.java
+++ b/src/main/java/com/example/jz/controller/WxAppController.java
@@ -3,6 +3,7 @@
 
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -12,6 +13,7 @@
 import com.example.jz.modle.entity.*;
 import com.example.jz.modle.vo.CauseVo;
 import com.example.jz.modle.vo.MemberVo;
+import com.example.jz.modle.vo.ReportVo;
 import com.example.jz.service.*;
 import com.example.jz.utils.HttpUtil;
 import lombok.SneakyThrows;
@@ -38,7 +40,7 @@
     private final String wxApp_accessToken_verify_url = "https://api.weixin.qq.com/cgi-bin/token";
 
     @Value("${wx.appid}")
-    private  String appid;
+    private String appid;
 
     @Value("${wx.secret}")
     private String secret;
@@ -66,6 +68,8 @@
     MessageService messageService;
     @Autowired
     GroupUserService groupUserService;
+    @Autowired
+    PublicityService publicityService;
 
     @GetMapping("/login")
     @SneakyThrows
@@ -126,7 +130,7 @@
         loginMessage.put("id", id);
         loginMessage.put("token", token);
         loginMessage.put("role", role);
-        loginMessage.put("time",user1.getUserIdcard());
+        loginMessage.put("time", user1.getUserIdcard());
         return R.ok(loginMessage);
     }
 
@@ -200,7 +204,7 @@
     @GetMapping("/user/group/list")
     public R getUserMessage(@RequestParam Integer id, @RequestParam String newDate, @RequestParam String lastDate) {
         ArrayList<Map<String, Object>> list = new ArrayList<>();
-        reportService.list((new QueryWrapper<Report>().eq("user_id", id)).groupBy("user_id"))
+        reportService.list((new QueryWrapper<Report>().eq("user_id", id)))
                 .forEach(item ->
                         {
                             GroupUser groupUser = groupUserService.getOne(new QueryWrapper<GroupUser>().eq("user_id", item.getId()));
@@ -394,7 +398,7 @@
 
     @GetMapping("/group/user/sendMsg")
     public R sendUserMsg(@RequestParam Integer id, @RequestParam Integer groupId, @RequestParam String msg) {
-        if (StringUtils.isBlank(msg)){
+        if (StringUtils.isBlank(msg)) {
             return R.failed("msg is blank");
         }
         Message message = new Message();
@@ -405,4 +409,41 @@
         message.setReportName(userService.getOne(new QueryWrapper<User>().eq("id", reportService.getOne(new QueryWrapper<Report>().eq("id", id)).getUserId())).getRealName());
         return R.ok(messageService.save(message));
     }
+
+    @GetMapping("/group/member/detail")
+    public R getMemberDetail(@RequestParam Integer id) {
+        Report report = reportService.getOne(new LambdaQueryWrapper<Report>().eq(Report::getId, id));
+        ReportVo reportVo = new ReportVo();
+        BeanUtils.copyProperties(report, reportVo);
+        User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, report.getUserId()));
+        reportVo.setReporterName(user.getRealName());
+        reportVo.setMobile(user.getUserMobile());
+        reportVo.setIdcard(user.getUserIdcard());
+        return R.ok(reportVo);
+    }
+
+    @GetMapping("/manager/report")
+    public R queryReport() {
+        return R.ok(reportService.list(new LambdaQueryWrapper<Report>().eq(Report::getStatus, 0))
+                .stream()
+                .map(item -> {
+                    ReportVo reportVo = new ReportVo();
+                    BeanUtils.copyProperties(item, reportVo);
+                    User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, item.getUserId()));
+                    reportVo.setReporterName(user.getRealName());
+                    reportVo.setMobile(user.getUserMobile());
+                    reportVo.setIdcard(user.getUserIdcard());
+                    return reportVo;
+                })
+                .collect(Collectors.toList()));
+    }
+
+    @GetMapping("/publicity")
+    public R queryPublicity(@RequestParam(required = false) Integer size) {
+        List<Publicity> publicityList = publicityService.list(new LambdaQueryWrapper<Publicity>().eq(Publicity::getStatus, 1));
+        if (size != null) {
+            return R.ok(publicityList.stream().limit(size));
+        }
+        return R.ok(publicityList);
+    }
 }
diff --git a/src/main/java/com/example/jz/modle/vo/ReportVo.java b/src/main/java/com/example/jz/modle/vo/ReportVo.java
index e99002e..2e77d91 100644
--- a/src/main/java/com/example/jz/modle/vo/ReportVo.java
+++ b/src/main/java/com/example/jz/modle/vo/ReportVo.java
@@ -1,5 +1,6 @@
 package com.example.jz.modle.vo;
 
+import com.example.jz.modle.entity.Report;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -12,7 +13,7 @@
  */
 @Data
 @ApiModel(description = "寰呭鏍镐汉鍛�", value = "CauseVo")
-public class ReportVo {
+public class ReportVo extends Report {
     //鎶ユ浜�
     @ApiModelProperty(value = "鎶ユ浜�",dataType = "String")
     private String reporterName;
@@ -24,8 +25,8 @@
     @ApiModelProperty(value = "鎶ユ浜鸿韩浠借瘉鍙�",dataType = "String")
     //鎶ユ浜鸿韩浠借瘉鍙�
     private String idcard;
-
-    //鎶ユ浜篿d
-    @ApiModelProperty(value = "id",dataType = "Integer")
-    private Integer id;
+//
+//    //鎶ユ浜篿d
+//    @ApiModelProperty(value = "id",dataType = "Integer")
+//    private Integer id;
 }
diff --git a/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java b/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java
index b4542c9..b000f9e 100644
--- a/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java
+++ b/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java
@@ -79,7 +79,7 @@
                     reportVo.setIdcard(user.getUserIdcard().replaceAll(regex, "*"));
                     reportVo.setMobile(user.getUserMobile());
                 }
-                reportVo.setId(a.getId());
+//                reportVo.setId(a.getId());
                 reportVos.add(reportVo);
             });
         }

--
Gitblit v1.8.0