From 744cd0a3bc66de73a94e320724b1bb776a6e4080 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期三, 19 十月 2022 17:43:50 +0800
Subject: [PATCH] 更新minlo

---
 src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java |   44 ++++++++++++---------
 src/main/java/com/example/jz/controller/WxAppController.java        |    7 ++-
 src/main/java/com/example/jz/service/impl/CauseServiceImpl.java     |   35 +++++++++--------
 src/test/java/com/example/jz/JzApplicationTests.java                |    2 
 pom.xml                                                             |    2 
 src/main/resources/application.yml                                  |   15 +++++--
 6 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/pom.xml b/pom.xml
index 936fb03..94c8a10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,7 @@
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.3.2</version>
+            <version>3.4.2</version>
         </dependency>
         <!-- httpclient-->
         <dependency>
diff --git a/src/main/java/com/example/jz/controller/WxAppController.java b/src/main/java/com/example/jz/controller/WxAppController.java
index 6415d2b..2c7afe6 100644
--- a/src/main/java/com/example/jz/controller/WxAppController.java
+++ b/src/main/java/com/example/jz/controller/WxAppController.java
@@ -17,6 +17,7 @@
 import lombok.SneakyThrows;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.ResponseEntity;
@@ -36,9 +37,11 @@
 
     private final String wxApp_accessToken_verify_url = "https://api.weixin.qq.com/cgi-bin/token";
 
-    private final String appid = "wxebbb232d366dae09";
+    @Value("${wx.appid}")
+    private  String appid;
 
-    private final String secret = "9a160c97c821eaa163240e8ec9185b77";
+    @Value("${wx.secret}")
+    private String secret;
 
     private final String js_code = "";
 
diff --git a/src/main/java/com/example/jz/service/impl/CauseServiceImpl.java b/src/main/java/com/example/jz/service/impl/CauseServiceImpl.java
index 63ecf0f..a36d140 100644
--- a/src/main/java/com/example/jz/service/impl/CauseServiceImpl.java
+++ b/src/main/java/com/example/jz/service/impl/CauseServiceImpl.java
@@ -172,25 +172,26 @@
     public PageParam<CauseReportVo> getReporterList(Integer causeId) {
         PageParam<Report> PageParam = new PageParam<>();
         PageParam<Report> reportPageParam = reportDao.selectPage(PageParam, new QueryWrapper<Report>().eq("cause_id", causeId).orderByDesc("ctime"));
-        List<CauseReportVo> causeReportVos = reportPageParam.getRecords().stream()
-                .map(
-                        a -> {
-                            CauseReportVo causeReportVo = new CauseReportVo();
-                            User user = userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId()));
-                            BeanUtils.copyProperties(a, causeReportVo);
-                            causeReportVo.setMobile(user.getUserMobile());
-                            causeReportVo.setIdcard(user.getUserIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"));
-                            causeReportVo.setReporterName(user.getRealName());
-                            if (causeReportVo.getIsInGroup()==1) {
-                                causeReportVo.setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id",causeId)).getId());
-                            }
-                            return causeReportVo;
-                        }
-                ).collect(Collectors.toList());
-
         PageParam<CauseReportVo> causeReportVoPageParam = new PageParam<>();
         BeanUtils.copyProperties(reportPageParam, causeReportVoPageParam);
-        causeReportVoPageParam.setRecords(causeReportVos);
+        if (!reportPageParam.getRecords().isEmpty()){
+            List<CauseReportVo> causeReportVos = reportPageParam.getRecords().stream()
+                    .map(
+                            a -> {
+                                CauseReportVo causeReportVo = new CauseReportVo();
+                                User user = userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId()));
+                                BeanUtils.copyProperties(a, causeReportVo);
+                                causeReportVo.setMobile(user.getUserMobile());
+                                causeReportVo.setIdcard(user.getUserIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"));
+                                causeReportVo.setReporterName(user.getRealName());
+                                if (causeReportVo.getIsInGroup()==1) {
+                                    causeReportVo.setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id",causeId)).getId());
+                                }
+                                return causeReportVo;
+                            }
+                    ).collect(Collectors.toList());
+            causeReportVoPageParam.setRecords(causeReportVos);
+        }
         return causeReportVoPageParam;
     }
 
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 0ed9841..b4542c9 100644
--- a/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java
+++ b/src/main/java/com/example/jz/service/impl/WorkbenchServiceImpl.java
@@ -3,8 +3,8 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.example.jz.dao.*;
 import com.example.jz.modle.entity.*;
-import com.example.jz.modle.vo.ReportVo;
 import com.example.jz.modle.vo.MessageVo;
+import com.example.jz.modle.vo.ReportVo;
 import com.example.jz.service.WorkbenchService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -69,30 +69,36 @@
         //鏌ヨ寰呭鏍镐汉
         List<Report> reports = reportDao.selectList(new QueryWrapper<Report>().eq("status", 0).orderByDesc("ctime").last("limit 5"));
         ArrayList<ReportVo> reportVos = new ArrayList<>();
-        reports.forEach(a -> {
-            User user = userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId()));
-            ReportVo reportVo = new ReportVo();
-            reportVo.setReporterName(user.getRealName());
-            String regex = "(?<=[\\d]{3})\\d(?=[\\d]{4})";
-            reportVo.setIdcard(user.getUserIdcard().replaceAll(regex, "*"));
-            reportVo.setMobile(user.getUserMobile());
-            reportVo.setId(a.getId());
-            reportVos.add(reportVo);
-        });
+        if(!reports.isEmpty()){
+            reports.forEach(a -> {
+                User user = userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId()));
+                ReportVo reportVo = new ReportVo();
+                if (user!=null){
+                    reportVo.setReporterName(user.getRealName());
+                    String regex = "(?<=[\\d]{3})\\d(?=[\\d]{4})";
+                    reportVo.setIdcard(user.getUserIdcard().replaceAll(regex, "*"));
+                    reportVo.setMobile(user.getUserMobile());
+                }
+                reportVo.setId(a.getId());
+                reportVos.add(reportVo);
+            });
+        }
         return reportVos;
     }
 
     @Override
     public List<MessageVo> getGroupMessage() {
         ArrayList<MessageVo> messageVos = new ArrayList<>();
-        messageDao.selectList(new QueryWrapper<Message>().orderByDesc("ctime")).stream()
-                .filter(item->item.getUserId()!=null).limit(5).forEach(a -> {
-                    MessageVo messageVo = new MessageVo();
-                    messageVo.setGroupName(groupDao.selectOne(new QueryWrapper<Group>().eq("id", a.getGroupId())).getGroupName());
-                    BeanUtils.copyProperties(a, messageVo);
-                    messageVo.setUserName(a.getReportName());
-                    messageVos.add(messageVo);
-                });
+        if (!messageVos.isEmpty()){
+            messageDao.selectList(new QueryWrapper<Message>().orderByDesc("ctime")).stream()
+                    .filter(item->item.getUserId()!=null).limit(5).forEach(a -> {
+                        MessageVo messageVo = new MessageVo();
+                        messageVo.setGroupName(groupDao.selectOne(new QueryWrapper<Group>().eq("id", a.getGroupId())).getGroupName());
+                        BeanUtils.copyProperties(a, messageVo);
+                        messageVo.setUserName(a.getReportName());
+                        messageVos.add(messageVo);
+                    });
+        }
         return messageVos;
     }
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 12b725f..bd2a932 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,6 +1,6 @@
 # 绔彛鍙�
 server:
-  port: 8081
+  port: 8888
 
 # spring閰嶇疆
 spring:
@@ -31,9 +31,9 @@
 
 # minio閰嶇疆
 minio:
-  address: http://119.28.5.249:9000
-  accessKey: minioadmin
-  secretKey: minioadmin
+  address: http://42.193.1.25:9000
+  accessKey: satori
+  secretKey: 12345678
   bucketName: img
 
 # mybatis閰嶇疆
@@ -44,4 +44,9 @@
       id-type: auto
       field-strategy: NOT_NULL
   configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+#灏忕▼搴�
+wx:
+  appid: wx15ee01704b3c9dd0
+  secret: a96eaee73d9de507d8412b7d2959b927
\ No newline at end of file
diff --git a/src/test/java/com/example/jz/JzApplicationTests.java b/src/test/java/com/example/jz/JzApplicationTests.java
index a033531..12f05a2 100644
--- a/src/test/java/com/example/jz/JzApplicationTests.java
+++ b/src/test/java/com/example/jz/JzApplicationTests.java
@@ -22,7 +22,7 @@
 
     @Test
     void test() {
-        System.out.println(defaultPwdEncoder.encode("123456"));
+        System.out.println(defaultPwdEncoder.encode("qyjz2022!@#"));
     }
 
 }

--
Gitblit v1.8.0