| | |
| | | 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)表服务实现类 |
| | |
| | | @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; |
| | | } |
| | | } |
| | | |