| | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | for (TUser user : tUsers) { |
| | | if(ToolUtil.isNotEmpty(user.getEmail())){ |
| | | Integer language = user.getLanguage(); |
| | | for (String key : strings) { |
| | | Double aDouble = map.get(key); |
| | | String path1 = templatePath + "user/discount.html"; |
| | |
| | | Element english_ride = document1.getElementById("english_ride"); |
| | | english_ride.text("Discount for I-GO " + key); |
| | | Element english_discount = document1.getElementById("english_discount"); |
| | | english_discount.text(" Enjoy " + aDouble + "% off your trip fare."); |
| | | english_discount.text(" Enjoy " + new BigDecimal((100 - aDouble)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() + "% off your trip fare."); |
| | | EmailUtil.send(user.getEmail(), "Discount activities", document1.html()); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | File file = new File("/home/igotechgh/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | file = new File("/usr/local/nginx/html/files/html/discount_" + randomString + ".html"); |
| | | file = new File("/home/igotechgh/nginx/html/files/html/discount_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/discount_" + randomString + ".html"; |
| | | String link ="https://igo.i-go.group/files/html/discount_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(user.getId()); |