puzhibing
2023-02-15 2811bab657aab4145b65a45a824fb63e93b58e30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.ComplaintMapper;
import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper;
import com.stylefeng.guns.modular.system.model.Complaint;
import com.stylefeng.guns.modular.system.model.SensitiveWords;
import com.stylefeng.guns.modular.system.service.IComplaintService;
import com.stylefeng.guns.modular.system.service.ISystemNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
 
@Service
public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService {
 
    @Resource
    private SensitiveWordsMapper sensitiveWordsMapper;
 
    @Autowired
    private ISystemNoticeService systemNoticeService;
 
 
 
    /**
     * 添加投诉
     * @param driverId      司机id
     * @param reason        投诉原因
     * @param description   描述
     * @param uid           投诉人
     * @throws Exception
     */
    @Override
    public void saveData(Integer driverId, String reason, String description, Integer uid) throws Exception {
        if(ToolUtil.isNotEmpty(description)){
            List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
            for(SensitiveWords s : sensitiveWords){
                description = description.replaceAll(s.getContent(), "***");
            }
        }
        Complaint complaint = new Complaint();
        complaint.setInsertTime(new Date());
        complaint.setDriverId(driverId);
        complaint.setReason(reason);
        complaint.setDescription(description);
        complaint.setUserId(uid);
        complaint.setIsHandle(0);
        this.insert(complaint);
 
        systemNoticeService.addSystemNotice(1, "您的投诉已提交成功,我们会尽快处理!", uid, 1);
    }
}