From 5b04d19edea32888efa9ee4881395a21da348e3f Mon Sep 17 00:00:00 2001
From: 安瑾然 <107107765@qq.com>
Date: 星期四, 14 七月 2022 14:21:44 +0800
Subject: [PATCH] commit

---
 src/main/java/com/example/jz/service/impl/ReportServiceImpl.java |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java b/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
index 924ec9f..71860a6 100644
--- a/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
+++ b/src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
@@ -1,10 +1,20 @@
 package com.example.jz.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.jz.dao.CauseDao;
+import com.example.jz.dao.GroupDao;
+import com.example.jz.dao.GroupUserDao;
 import com.example.jz.dao.ReportDao;
+import com.example.jz.modle.entity.Group;
+import com.example.jz.modle.entity.GroupUser;
 import com.example.jz.modle.entity.Report;
 import com.example.jz.service.ReportService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
 
 /**
  * 鎶ユ琛�(Report)琛ㄦ湇鍔″疄鐜扮被
@@ -15,5 +25,31 @@
 @Service("reportService")
 public class ReportServiceImpl extends ServiceImpl<ReportDao, Report> implements ReportService {
 
+    @Autowired
+    private ReportDao reportDao;
+    @Autowired
+    private GroupDao groupDao;
+    @Autowired
+    private GroupUserDao groupUserDao;
+
+    /**
+     * 瀹℃牳鎶ユ
+     *
+     * @param report
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean audit(Report report) {
+        // 1. 鏇存柊鎶ユ琛�
+        report.setStatus(1);
+        reportDao.updateById(report);
+        // 2. 鏇存柊缇ょ敤鎴疯〃
+        Group group = groupDao.selectOne(new LambdaQueryWrapper<>(Group.class)
+                .eq(Group::getCauseId, report.getCauseId()));
+        GroupUser groupUser = new GroupUser().setGroupId(group.getId()).setUserId(report.getUserId()).setCtime(new Date()).setBanSpeech(0);
+        groupUserDao.insert(groupUser);
+        return true;
+    }
 }
 

--
Gitblit v1.8.0