puzhibing
2022-09-29 e28d33c09405e246a2d75fcb1f69a9e8e9d911b8
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
58
59
60
61
62
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 com.stylefeng.guns.modular.system.service.IUserInfoService;
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;
 
    @Autowired
    private IUserInfoService userInfoService;
 
 
 
    /**
     * 添加投诉
     * @param driverId      司机id
     * @param reason        投诉原因
     * @param description   描述
     * @param uid           投诉人
     * @throws Exception
     */
    @Override
    public void saveData(Integer driverId, String reason, String description, Integer uid, Integer language) throws Exception {
        if(ToolUtil.isNotEmpty(description)){
            List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
            for(SensitiveWords s : sensitiveWords){
                description = description.replaceAll(s.getContent(), "***");
            }
        }
        language = userInfoService.queryLanguage(uid, language);
        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, language == 1 ? "您的投诉已提交成功,我们会尽快处理!" : language == 2 ? "Your complaint has been submitted successfully and we will deal with it as soon as possible" : "Votre plainte a été soumise avec succès et nous la traiterons dès que possible", uid, 1);
    }
}