| | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TEmail; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.service.TEmailService; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | |
| | | import com.stylefeng.guns.modular.system.service.ITFeedbackService; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | @Autowired |
| | | private TEmailService emailService; |
| | | |
| | | /** |
| | | * 跳转到司机反馈管理首页 |
| | |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Feedback Processing Results"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | Element english_content = document.getElementById("english_content"); |
| | | english_content.text(remark); |
| | | EmailUtil.send(userInfo.getEmail(), "Feedback Processing Results", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | file = new File("/usr/local/nginx/html/files/html/feedbackResult_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/feedbackResult_" + randomString + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/feedbackResult_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName("Feedback Processing Results"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | tEmail.setWeek(EmailUtil.getWeek(2,i)); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm("AM"); |
| | | }else { |
| | | tEmail.setAmOrPm("PM"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(tFeedback.getType()); |
| | | notice.setContent("反馈处理结果:【"+remark+"】。"); |
| | | notice.setContent(remark); |
| | | notice.setUserId(tFeedback.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |