| | |
| | | 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.model.UserInfo; |
| | | 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 com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveData(Integer driverId, String reason, String description, Integer uid) throws Exception { |
| | | 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.setIsHandle(0); |
| | | this.insert(complaint); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您的投诉已提交成功,我们会尽快处理!", uid, 1); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/complaint.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "投诉司机" : language == 2 ? "Complain Driver" : "Se plaindre du conducteur", document.html()); |
| | | } |
| | | 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); |
| | | } |
| | | } |