From 51a9737881246b90bd221c06f5f79d32a71893b4 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 13 十二月 2023 01:14:19 +0800 Subject: [PATCH] 更新 --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ProblemController.java | 4 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 9 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java | 3 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java | 5 UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java | 5 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 54 +++++ UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 20 + UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java | 58 ++++++ UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Tingg/TinggPayoutUtil.java | 4 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java | 2 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java | 337 ++++++++++++++++++++++++------------- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java | 4 12 files changed, 367 insertions(+), 138 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ProblemController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ProblemController.java index 3608748..0018ab9 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ProblemController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ProblemController.java @@ -76,13 +76,13 @@ @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil<List<ProblemWarpper>> queryProblems(Integer pageNum, Integer size, Integer languag, HttpServletRequest request){ + public ResultUtil<List<ProblemWarpper>> queryProblems(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } - List<Map<String, Object>> maps = problemService.queryProblems(pageNum, size, uid, languag); + List<Map<String, Object>> maps = problemService.queryProblems(pageNum, size, uid, language); return ResultUtil.success(ProblemWarpper.getProblemWarpper(maps)); }catch (Exception e){ e.printStackTrace(); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java index e243b4f..5743d27 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java @@ -13,6 +13,7 @@ import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; +import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import com.stylefeng.guns.modular.system.warpper.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -227,6 +228,7 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("邮箱验证"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + nickName + ","); Element content_chinese = document.getElementById("content_chinese"); @@ -235,20 +237,65 @@ if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Verification email"); Element user_chinese = document.getElementById("user_english"); user_chinese.text("Hello " + nickName + ","); - Element content_chinese = document.getElementById("content_english"); - content_chinese.text(authCode); + Element content_english = document.getElementById("content_english"); + content_english.text(authCode); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Courriel de vérification"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + nickName + ","); Element content_french = document.getElementById("content_french"); content_french.text(authCode); } - EmailUtil.send(email, language == 1 ? "验证码" : language == 2 ? "Verification code" : "Code de vérification", document.html()); + EmailUtil.send(email, language == 1 ? "邮箱验证" : language == 2 ? "Verification mailbox" : "Courriel de vérification", 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/mainbox_" + 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/mainbox_" + 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/mainbox_" + randomString + ".html"; + TEmail tEmail = new TEmail(); + tEmail.setLink(link); + tEmail.setUserId(uid); + tEmail.setType(1); + tEmail.setName(language == 1 ? "邮箱验证" : language == 2 ? "Verification email" : "Courriel de vérification"); + tEmail.setCreateTime(new Date()); + int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; + tEmail.setWeek(EmailUtil.getWeek(language,i)); + boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); + if(am){ + tEmail.setAmOrPm(language==1?"上午":language==2?"AM":"Dans la matinée"); + }else { + tEmail.setAmOrPm(language==1?"下午":language==2?"PM":"après-midi"); + } + emailService.insert(tEmail); } return ResultUtil.success(); }catch (Exception e){ @@ -828,7 +875,6 @@ phone = "233" + phone; } UserInfo userInfo = userInfoService.selectById(uid); - smsrecordService.saveData(4, userInfo.getPhone(), code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); boolean b = userInfoService.checkCaptcha(phone, code); Map<String, Object> map = new HashMap<>(); map.put("ok", b ? 1 : 0); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 843d0b9..c8f4b5a 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -978,6 +978,7 @@ endTime = dateUtil.getStartOrEndDate(endTime, "end"); List<Map<String, Object>> list = orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); for (Map<String, Object> map : list) { + map.put("orderName", language == 1 ? "包裹订单" : language == 2 ? "Package" : "Livraison"); if(null != map.get("time")){ String time = map.get("time").toString(); map.put("time", DateUtil.conversionFormat(language, time)); @@ -1040,6 +1041,9 @@ this.updateById(orderLogistics); //调用回退接口 PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); + if(null == query){ + return ResultUtil.error("支付数据异常,无法完成退款"); + } UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); @@ -1068,7 +1072,10 @@ this.updateById(orderLogistics); integer = orderCancel.getId(); //调用回退接口 - PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); + PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2); + if(null == query){ + return ResultUtil.error("支付数据异常,无法完成退款"); + } UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index adc94bc..6150e32 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -1034,6 +1034,7 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("打车收据"); Element title_chinese = document.getElementById("title_chinese"); title_chinese.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); Element xcf_chinese = document.getElementById("xcf_chinese"); @@ -1078,6 +1079,7 @@ if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Ride Receipt"); Element title_english = document.getElementById("title_english"); title_english.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); Element xcf_english = document.getElementById("xcf_english"); @@ -1122,6 +1124,7 @@ if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Reçu de course"); Element title_french = document.getElementById("title_french"); title_french.text("Le " + DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ", vous avez dépensé GHS " + orderPrivateCar.getPayMoney() + " sur le voyage"); Element xcf_french = document.getElementById("xcf_french"); @@ -1346,6 +1349,7 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("打车收据"); Element title_chinese = document.getElementById("title_chinese"); title_chinese.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); Element xcf_chinese = document.getElementById("xcf_chinese"); @@ -1390,6 +1394,7 @@ if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Ride Receipt"); Element title_english = document.getElementById("title_english"); title_english.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); Element xcf_english = document.getElementById("xcf_english"); @@ -1434,6 +1439,7 @@ if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Reçu de course"); Element title_french = document.getElementById("title_french"); title_french.text("Le " + DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ", vous avez dépensé GHS " + orderPrivateCar.getPayMoney() + " sur le voyage"); Element xcf_french = document.getElementById("xcf_french"); @@ -1633,26 +1639,29 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("红包活动"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); Element time_chinese = document.getElementById("time_chinese"); - time_chinese.text("此活动有效期在" + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + "至" + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ",详情请查看I-GO平台"); + time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ",详情请查看I-GO平台"); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Lucky-promo activities"); Element user_english = document.getElementById("user_english"); user_english.text("Hello " + userInfo.getNickName() + ","); Element time_english = document.getElementById("time_english"); - time_english.text("You could use it from" + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + "to" + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ",check more details on the app."); + time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ",check more details on the app."); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Activités bonus"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); Element time_french = document.getElementById("time_french"); - time_french.text("Cette promotion est valable du" + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + "au" + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); + time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(query.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); } EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); @@ -1850,6 +1859,7 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("打车收据"); Element title_chinese = document.getElementById("title_chinese"); title_chinese.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); Element xcf_chinese = document.getElementById("xcf_chinese"); @@ -1894,6 +1904,7 @@ if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Ride Receipt"); Element title_english = document.getElementById("title_english"); title_english.text(DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); Element xcf_english = document.getElementById("xcf_english"); @@ -1938,6 +1949,7 @@ if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Reçu de course"); Element title_french = document.getElementById("title_french"); title_french.text("Le " + DateUtil.conversionFormat(language, sdf.format(orderPrivateCar.getTravelTime())) + ", vous avez dépensé GHS " + orderPrivateCar.getPayMoney() + " sur le voyage"); Element xcf_french = document.getElementById("xcf_french"); @@ -2089,6 +2101,7 @@ endTime = dateUtil.getStartOrEndDate(endTime, "end"); List<Map<String, Object>> list = orderPrivateCarMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); for (Map<String, Object> map : list) { + map.put("orderName", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course"); if(null != map.get("time")){ String time = map.get("time").toString(); map.put("time", DateUtil.conversionFormat(language, time)); @@ -2271,6 +2284,7 @@ public List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception { List<Map<String, Object>> list = orderPrivateCarMapper.queryRedEnvelope(uid); for (Map<String, Object> map : list) { + map.put("name", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course"); if(null != map.get("time")){ String time = map.get("time").toString(); map.put("time", DateUtil.conversionFormat(language, time)); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java index 58320a8..b0e2815 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java @@ -28,5 +28,5 @@ * @return * @throws Exception */ - List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid, Integer languag) throws Exception; + List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid, Integer language) throws Exception; } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java index 92f6a7d..16e5b16 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java @@ -84,18 +84,21 @@ if(language == 1){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("投诉司机"); Element chinese_user = document.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo.getNickName() + ","); } if(language == 2){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Complain against driver"); Element english_user = document.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); } if(language == 3){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Porter plainte contre le chauffeur"); Element french_user = document.getElementById("french_user"); french_user.text("Bonjour " + userInfo.getNickName() + ","); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java index 9c250a8..58101f7 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java @@ -87,18 +87,21 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("意见反馈"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Feedback"); Element user_english = document.getElementById("user_english"); user_english.text("Hello " + userInfo.getNickName() + ","); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Rétroaction"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); } @@ -130,7 +133,7 @@ FileOutputStream fileOutputStream = new FileOutputStream(file1); HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream); - String link ="http://182.160.16.251:81/files/html/complain_" + randomString + ".html"; + String link ="http://182.160.16.251:81/files/html/feedback_" + randomString + ".html"; TEmail tEmail = new TEmail(); tEmail.setLink(link); tEmail.setUserId(uid); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java index 54a5d3e..79d84d6 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java @@ -72,13 +72,13 @@ * @throws Exception */ @Override - public List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid, Integer languag) throws Exception { + public List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid, Integer language) throws Exception { pageNum = (pageNum - 1) * size; List<Map<String, Object>> list = problemMapper.queryProblems(pageNum, size, uid); for (Map<String, Object> map : list) { if(null != map.get("insertTime")){ String insertTime = map.get("insertTime").toString(); - map.put("insertTime", DateUtil.conversionFormat(languag, insertTime)); + map.put("insertTime", DateUtil.conversionFormat(language, insertTime)); } } return list; diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java index 5416863..1090a48 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java @@ -10,10 +10,13 @@ import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; import com.stylefeng.guns.modular.system.dao.ReportLossMapper; import com.stylefeng.guns.modular.system.model.ReportLoss; +import com.stylefeng.guns.modular.system.model.TEmail; import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.IReportLossService; import com.stylefeng.guns.modular.system.service.IUserInfoService; +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 com.stylefeng.guns.modular.taxi.model.OrderTaxi; import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; import org.jsoup.Jsoup; @@ -24,6 +27,9 @@ import org.springframework.stereotype.Service; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; import java.util.Date; @Service @@ -46,6 +52,9 @@ @Value("${spring.mail.template-path}") private String templatePath; + + @Autowired + private TEmailService emailService; @@ -95,25 +104,68 @@ if(language == 1){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("物品报失"); Element english_user = document.getElementById("chinese_user"); english_user.text("您好 " + userInfo.getNickName() + ","); - EmailUtil.send(userInfo.getEmail(), "物品报失", document.html()); } if(language == 2){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Report items lost"); Element english_user = document.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); - EmailUtil.send(userInfo.getEmail(), "Report items lost", document.html()); } if(language == 3){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Signaler l'objet perdu"); Element english_user = document.getElementById("french_user"); english_user.text("Bonjour! " + userInfo.getNickName() + ","); - EmailUtil.send(userInfo.getEmail(), "Signaler l'objet perdu", document.html()); } + EmailUtil.send(userInfo.getEmail(), language == 1 ? "物品报失" : language == 2 ? "Report items lost" : "Signaler l'objet perdu", 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/reportLoss_" + 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/reportLoss_" + 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/reportLoss_" + randomString + ".html"; + TEmail tEmail = new TEmail(); + tEmail.setLink(link); + tEmail.setUserId(userInfo.getId()); + tEmail.setType(1); + tEmail.setName(language == 1 ? "物品报失" : language == 2 ? "Report items lost" : "Signaler l'objet perdu"); + tEmail.setCreateTime(new Date()); + int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; + tEmail.setWeek(EmailUtil.getWeek(language,i)); + boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); + if(am){ + tEmail.setAmOrPm(language==1?"上午":language==2?"AM":"Dans la matinée"); + }else { + tEmail.setAmOrPm(language==1?"下午":language==2?"PM":"après-midi"); + } + emailService.insert(tEmail); } }catch (Exception e){ e.printStackTrace(); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java index be35644..47e4702 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java @@ -155,6 +155,7 @@ break; } smsUtil.sendCellulantMessage(phone, sms); + smsrecordService.saveData(type, phone, authCode, sms); } return ResultUtil.success(); } @@ -244,18 +245,21 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("注册成功"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Registered successfully"); Element user_english = document.getElementById("user_english"); user_english.text("Hello " + userInfo.getNickName() + ","); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Enregistré avec succès"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); } @@ -302,7 +306,6 @@ tEmail.setAmOrPm(language==1?"下午":language==2?"PM":"après-midi"); } emailService.insert(tEmail); - } this.addCoupon(userInfo, language);//添加优惠券 @@ -400,8 +403,8 @@ String link ="http://182.160.16.251:81/files/html/invitation_" + randomString + ".html"; TEmail tEmail = new TEmail(); tEmail.setLink(link); - tEmail.setUserId(uid); - tEmail.setType(1); + tEmail.setUserId(driver.getId()); + tEmail.setType(2); tEmail.setName(language == 1 ? "邀请奖励" : language == 2 ? "Invite and earn" : "Invitez et récompensez"); tEmail.setCreateTime(new Date()); int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; @@ -435,6 +438,7 @@ endTime = DateUtil.conversionFormat(language, endTime); } int num = 0; + double fullMoney = 0; for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ //判断当前优惠券金额是否大于可发放剩余总金额 if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ @@ -460,6 +464,7 @@ //修改剩余可发放总金额 lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); num++; + fullMoney = userCouponRecord.getFullMoney(); } UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); @@ -471,32 +476,41 @@ if(language == 1){ document1.getElementById("english").remove(); document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); Element chinese_user = document1.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo1.getNickName() + ","); Element chinese_number = document1.getElementById("chinese_number"); chinese_number.text("您有" + num + "张优惠券到账"); Element chinese_date = document1.getElementById("chinese_date"); chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); } if(language == 2){ document1.getElementById("chinese").remove(); document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); Element english_user = document1.getElementById("english_user"); english_user.text("Hello " + userInfo1.getNickName() + ","); Element english_number = document1.getElementById("english_number"); english_number.text("You have received " + num + " coupons"); Element english_date = document1.getElementById("english_date"); - english_date.text("You could use them from" + startTime + "to" + endTime); + english_date.text("You could use them from " + startTime + " to " + endTime); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); } if(language == 3){ document1.getElementById("chinese").remove(); document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé sur le compte"); Element french_user = document1.getElementById("french_user"); - french_user.text("Bonjour " + userInfo1.getNickName() + ","); + french_user.text("Cher(ère) " + userInfo1.getNickName() + ","); Element french_number = document1.getElementById("french_number"); - french_number.text("Vous avez " + num + " coupons à recevoir"); + french_number.text("Vous avez reçu " + num + " coupons."); Element french_date = document1.getElementById("french_date"); - french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); + french_date.text("Vous devriez les utiliser du" + startTime + " au " + endTime + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); } EmailUtil.send(userInfo1.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 @@ -562,8 +576,6 @@ loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); loginWarpper.setEmail(userInfo.getEmail()); - - smsrecordService.saveData(1, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); return ResultUtil.success(loginWarpper); } @@ -703,18 +715,21 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("注册成功"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Registered successfully"); Element user_english = document.getElementById("user_english"); user_english.text("Hello " + userInfo.getNickName() + ","); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Enregistré avec succès"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); } @@ -789,9 +804,20 @@ Date date = new Date(); for(Map<String, Object> map : query){ Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); - String startTime = map.get("startTime").toString(); - String endTime = map.get("endTime").toString(); + String startTime = ""; + String endTime = ""; + if(null != map.get("startTime")){ + startTime = map.get("startTime").toString(); + map.put("startTime", DateUtil.conversionFormat(language, startTime)); + startTime = DateUtil.conversionFormat(language, startTime); + } + if(null != map.get("endTime")){ + endTime = map.get("endTime").toString(); + map.put("endTime", DateUtil.conversionFormat(language, endTime)); + endTime = DateUtil.conversionFormat(language, endTime); + } int num = 0; + double fullMoney = 0; for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ //判断当前优惠券金额是否大于可发放剩余总金额 if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ @@ -817,45 +843,56 @@ //修改剩余可发放总金额 lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); num++; + fullMoney = userCouponRecord.getFullMoney(); } UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); userActivityInviteMapper.updateById(uai); if(ToolUtil.isNotEmpty(userInfo.getEmail())){ - String path = templatePath + "user/coupon.html"; - Document document = Jsoup.parse(new File(path), "UTF-8"); + String path1 = templatePath + "user/coupon.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); if(language == 1){ - document.getElementById("english").remove(); - document.getElementById("french").remove(); - Element chinese_user = document.getElementById("chinese_user"); + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); + Element chinese_user = document1.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo.getNickName() + ","); - Element chinese_number = document.getElementById("chinese_number"); + Element chinese_number = document1.getElementById("chinese_number"); chinese_number.text("您有" + num + "张优惠券到账"); - Element chinese_date = document.getElementById("chinese_date"); + Element chinese_date = document1.getElementById("chinese_date"); chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); } if(language == 2){ - document.getElementById("chinese").remove(); - document.getElementById("french").remove(); - Element english_user = document.getElementById("english_user"); + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); + Element english_user = document1.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); - Element english_number = document.getElementById("english_number"); + Element english_number = document1.getElementById("english_number"); english_number.text("You have received " + num + " coupons"); - Element english_date = document.getElementById("english_date"); - english_date.text("You could use them from" + startTime + "to" + endTime); + Element english_date = document1.getElementById("english_date"); + english_date.text("You could use them from " + startTime + " to " + endTime); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); } if(language == 3){ - document.getElementById("chinese").remove(); - document.getElementById("english").remove(); - Element french_user = document.getElementById("french_user"); - french_user.text("Bonjour " + userInfo.getNickName() + ","); - Element french_number = document.getElementById("french_number"); - french_number.text("Vous avez " + num + " coupons à recevoir"); - Element french_date = document.getElementById("french_date"); - french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé sur le compte"); + Element french_user = document1.getElementById("french_user"); + french_user.text("Cher(ère) " + userInfo.getNickName() + ","); + Element french_number = document1.getElementById("french_number"); + french_number.text("Vous avez reçu " + num + " coupons."); + Element french_date = document1.getElementById("french_date"); + french_date.text("Vous devriez les utiliser du" + startTime + " au " + endTime + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); } - EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document.html()); + + EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 File file = new File("/usr/local/nginx/html/files/html/"); if(!file.exists()){ @@ -867,7 +904,7 @@ file.createNewFile(); } FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document.html()); + fileWriter.write(document1.html()); fileWriter.flush(); fileWriter.close(); FileInputStream fileInputStream = new FileInputStream(file); @@ -998,18 +1035,21 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("注册成功"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Registered successfully"); Element user_english = document.getElementById("user_english"); user_english.text("Hello " + userInfo.getNickName() + ","); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Enregistré avec succès"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); } @@ -1082,9 +1122,20 @@ Date date = new Date(); for(Map<String, Object> map : query){ Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); - String startTime = map.get("startTime").toString(); - String endTime = map.get("endTime").toString(); + String startTime = ""; + String endTime = ""; + if(null != map.get("startTime")){ + startTime = map.get("startTime").toString(); + map.put("startTime", DateUtil.conversionFormat(language, startTime)); + startTime = DateUtil.conversionFormat(language, startTime); + } + if(null != map.get("endTime")){ + endTime = map.get("endTime").toString(); + map.put("endTime", DateUtil.conversionFormat(language, endTime)); + endTime = DateUtil.conversionFormat(language, endTime); + } int num = 0; + double fullMoney = 0; for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ //判断当前优惠券金额是否大于可发放剩余总金额 if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ @@ -1110,45 +1161,55 @@ //修改剩余可发放总金额 lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); num++; + fullMoney = userCouponRecord.getFullMoney(); } UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); userActivityInviteMapper.updateById(uai); if(ToolUtil.isNotEmpty(userInfo.getEmail())){ - String path = templatePath + "user/coupon.html"; - Document document = Jsoup.parse(new File(path), "UTF-8"); + String path1 = templatePath + "user/coupon.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); if(language == 1){ - document.getElementById("english").remove(); - document.getElementById("french").remove(); - Element chinese_user = document.getElementById("chinese_user"); + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); + Element chinese_user = document1.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo.getNickName() + ","); - Element chinese_number = document.getElementById("chinese_number"); + Element chinese_number = document1.getElementById("chinese_number"); chinese_number.text("您有" + num + "张优惠券到账"); - Element chinese_date = document.getElementById("chinese_date"); + Element chinese_date = document1.getElementById("chinese_date"); chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); } if(language == 2){ - document.getElementById("chinese").remove(); - document.getElementById("french").remove(); - Element english_user = document.getElementById("english_user"); + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); + Element english_user = document1.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); - Element english_number = document.getElementById("english_number"); + Element english_number = document1.getElementById("english_number"); english_number.text("You have received " + num + " coupons"); - Element english_date = document.getElementById("english_date"); - english_date.text("You could use them from" + startTime + "to" + endTime); + Element english_date = document1.getElementById("english_date"); + english_date.text("You could use them from " + startTime + " to " + endTime); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); } if(language == 3){ - document.getElementById("chinese").remove(); - document.getElementById("english").remove(); - Element french_user = document.getElementById("french_user"); - french_user.text("Bonjour " + userInfo.getNickName() + ","); - Element french_number = document.getElementById("french_number"); - french_number.text("Vous avez " + num + " coupons à recevoir"); - Element french_date = document.getElementById("french_date"); - french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé sur le compte"); + Element french_user = document1.getElementById("french_user"); + french_user.text("Cher(ère) " + userInfo.getNickName() + ","); + Element french_number = document1.getElementById("french_number"); + french_number.text("Vous avez reçu " + num + " coupons."); + Element french_date = document1.getElementById("french_date"); + french_date.text("Vous devriez les utiliser du" + startTime + " au " + endTime + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); } - EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document.html()); + EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 File file = new File("/usr/local/nginx/html/files/html/"); if(!file.exists()){ @@ -1160,7 +1221,7 @@ file.createNewFile(); } FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document.html()); + fileWriter.write(document1.html()); fileWriter.flush(); fileWriter.close(); FileInputStream fileInputStream = new FileInputStream(file); @@ -1225,8 +1286,6 @@ userInfo.setUpdateUser(userInfo.getId()); userInfo.setUpdateTime(new Date()); this.updateById(userInfo); - - smsrecordService.saveData(3, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); return ResultUtil.success(); } @@ -1295,8 +1354,6 @@ userInfo.setUpdateTime(new Date()); userInfo.setUpdateUser(userInfo.getId()); this.updateById(userInfo); - - smsrecordService.saveData(2, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); return ResultUtil.success(new LoginWarpper()); } @@ -1475,7 +1532,7 @@ } if(payType == 2){//银行卡支付 - Integer integer = paymentRecordService.saveData(2, uid, 1, null, null, 1, money, "", 1);//添加预支付数据 + Integer integer = paymentRecordService.saveData(2, uid, 1, null, null, 2, money, "", 1);//添加预支付数据 BankCard bankCard = bankCardService.selectById(bankCardId); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String merchantTransactionId = sdf.format(new Date()) + language + integer; @@ -1543,18 +1600,21 @@ if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("重置密码"); Element user_chinese = document.getElementById("user_chinese"); user_chinese.text("您好 " + userInfo.getNickName() + ","); } if(2 == language){ document.getElementById("chinese").remove(); document.getElementById("french").remove(); + document.getElementsByTag("title").get(0).text("Reset password"); Element user_chinese = document.getElementById("user_english"); user_chinese.text("Hello " + userInfo.getNickName() + ","); } if(3 == language){ document.getElementById("chinese").remove(); document.getElementById("english").remove(); + document.getElementsByTag("title").get(0).text("Réinitialiser le mot de passe"); Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); } @@ -1705,8 +1765,19 @@ for(Map<String, Object> map : query){ //添加通用优惠券 Double lavePrice = Double.valueOf(String.valueOf(map.get("lavePrice"))); - String startTime = map.get("startTime").toString(); - String endTime = map.get("endTime").toString(); + String startTime = ""; + String endTime = ""; + if(null != map.get("startTime")){ + startTime = map.get("startTime").toString(); + map.put("startTime", DateUtil.conversionFormat(language, startTime)); + startTime = DateUtil.conversionFormat(language, startTime); + } + if(null != map.get("endTime")){ + endTime = map.get("endTime").toString(); + map.put("endTime", DateUtil.conversionFormat(language, endTime)); + endTime = DateUtil.conversionFormat(language, endTime); + } + double fullMoney = 0; if(null != map.get("bcompanyId")){ for(int i = 0; i < Integer.valueOf(String.valueOf(map.get("generalNum"))); i++){ //判断当前发放的优惠券是否大于剩余总发放金额 @@ -1731,6 +1802,7 @@ userCouponRecord.setCouponActivityId(Integer.valueOf(String.valueOf(map.get("id")))); userCouponRecord.setCouponId(Integer.valueOf(String.valueOf(map.get("bId")))); list.add(userCouponRecord); + fullMoney = userCouponRecord.getFullMoney(); //开始修改剩余总发放金额 lavePrice -= Double.valueOf(String.valueOf(map.get("bmoney"))); } @@ -1835,39 +1907,48 @@ UserInfo userInfo = userInfoMapper.selectById(userId); if(ToolUtil.isNotEmpty(userInfo.getEmail())){ - String path = templatePath + "user/coupon.html"; - Document document = Jsoup.parse(new File(path), "UTF-8"); + String path1 = templatePath + "user/coupon.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); if(language == 1){ - document.getElementById("english").remove(); - document.getElementById("french").remove(); - Element chinese_user = document.getElementById("chinese_user"); + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); + Element chinese_user = document1.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo.getNickName() + ","); - Element chinese_number = document.getElementById("chinese_number"); + Element chinese_number = document1.getElementById("chinese_number"); chinese_number.text("您有" + list.size() + "张优惠券到账"); - Element chinese_date = document.getElementById("chinese_date"); + Element chinese_date = document1.getElementById("chinese_date"); chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); } if(language == 2){ - document.getElementById("chinese").remove(); - document.getElementById("french").remove(); - Element english_user = document.getElementById("english_user"); + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); + Element english_user = document1.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); - Element english_number = document.getElementById("english_number"); + Element english_number = document1.getElementById("english_number"); english_number.text("You have received " + list.size() + " coupons"); - Element english_date = document.getElementById("english_date"); - english_date.text("You could use them from" + startTime + "to" + endTime); + Element english_date = document1.getElementById("english_date"); + english_date.text("You could use them from " + startTime + " to " + endTime); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); } if(language == 3){ - document.getElementById("chinese").remove(); - document.getElementById("english").remove(); - Element french_user = document.getElementById("french_user"); - french_user.text("Bonjour " + userInfo.getNickName() + ","); - Element french_number = document.getElementById("french_number"); - french_number.text("Vous avez " + list.size() + " coupons à recevoir"); - Element french_date = document.getElementById("french_date"); - french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé sur le compte"); + Element french_user = document1.getElementById("french_user"); + french_user.text("Cher(ère) " + userInfo.getNickName() + ","); + Element french_number = document1.getElementById("french_number"); + french_number.text("Vous avez reçu " + list.size() + " coupons."); + Element french_date = document1.getElementById("french_date"); + french_date.text("Vous devriez les utiliser du" + startTime + " au " + endTime + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); } - EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document.html()); + EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 File file = new File("/usr/local/nginx/html/files/html/"); if(!file.exists()){ @@ -1879,7 +1960,7 @@ file.createNewFile(); } FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document.html()); + fileWriter.write(document1.html()); fileWriter.flush(); fileWriter.close(); FileInputStream fileInputStream = new FileInputStream(file); @@ -1963,13 +2044,25 @@ private synchronized void addCoupon(UserInfo userInfo, Integer language) throws Exception{ //添加优惠券 List<Map<String, Object>> list = userActivityRegisteredService.query(language, userInfo.getCompanyId()); - int num = 0; + for(Map<String, Object> map : list){ if(null != map){ Integer totalNum = Integer.valueOf(String.valueOf(map.get("totalNum"))); Double lavePrice = Double.valueOf(String.valueOf(map.get("lavePrice"))); - String startTime = map.get("startTime").toString(); - String endTime = map.get("endTime").toString(); + String startTime = ""; + String endTime = ""; + if(null != map.get("startTime")){ + startTime = map.get("startTime").toString(); + map.put("startTime", DateUtil.conversionFormat(language, startTime)); + startTime = DateUtil.conversionFormat(language, startTime); + } + if(null != map.get("endTime")){ + endTime = map.get("endTime").toString(); + map.put("endTime", DateUtil.conversionFormat(language, endTime)); + endTime = DateUtil.conversionFormat(language, endTime); + } + double fullMoney = 0; + int num = 0; for(int i = totalNum; i > 0; i--){ //判断当前发放的优惠券是否大于剩余可发送总金额 if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ @@ -2002,39 +2095,48 @@ userActivityRegisteredService.updateById(uar); if(ToolUtil.isNotEmpty(userInfo.getEmail())){ - String path = templatePath + "user/coupon.html"; - Document document = Jsoup.parse(new File(path), "UTF-8"); + String path1 = templatePath + "user/coupon.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); if(language == 1){ - document.getElementById("english").remove(); - document.getElementById("french").remove(); - Element chinese_user = document.getElementById("chinese_user"); + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); + Element chinese_user = document1.getElementById("chinese_user"); chinese_user.text("您好 " + userInfo.getNickName() + ","); - Element chinese_number = document.getElementById("chinese_number"); + Element chinese_number = document1.getElementById("chinese_number"); chinese_number.text("您有" + num + "张优惠券到账"); - Element chinese_date = document.getElementById("chinese_date"); + Element chinese_date = document1.getElementById("chinese_date"); chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); } if(language == 2){ - document.getElementById("chinese").remove(); - document.getElementById("french").remove(); - Element english_user = document.getElementById("english_user"); + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); + Element english_user = document1.getElementById("english_user"); english_user.text("Hello " + userInfo.getNickName() + ","); - Element english_number = document.getElementById("english_number"); + Element english_number = document1.getElementById("english_number"); english_number.text("You have received " + num + " coupons"); - Element english_date = document.getElementById("english_date"); - english_date.text("You could use them from" + startTime + "to" + endTime); + Element english_date = document1.getElementById("english_date"); + english_date.text("You could use them from " + startTime + " to " + endTime); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); } if(language == 3){ - document.getElementById("chinese").remove(); - document.getElementById("english").remove(); - Element french_user = document.getElementById("french_user"); - french_user.text("Bonjour " + userInfo.getNickName() + ","); - Element french_number = document.getElementById("french_number"); - french_number.text("Vous avez " + list.size() + " coupons à recevoir"); - Element french_date = document.getElementById("french_date"); - french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé sur le compte"); + Element french_user = document1.getElementById("french_user"); + french_user.text("Cher(ère) " + userInfo.getNickName() + ","); + Element french_number = document1.getElementById("french_number"); + french_number.text("Vous avez reçu " + num + " coupons."); + Element french_date = document1.getElementById("french_date"); + french_date.text("Vous devriez les utiliser du" + startTime + " au " + endTime + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); } - EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document.html()); + EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 File file = new File("/usr/local/nginx/html/files/html/"); if(!file.exists()){ @@ -2046,7 +2148,7 @@ file.createNewFile(); } FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document.html()); + fileWriter.write(document1.html()); fileWriter.flush(); fileWriter.close(); FileInputStream fileInputStream = new FileInputStream(file); @@ -2077,10 +2179,11 @@ } emailService.insert(tEmail); } + + //添加系统消息 + systemNoticeService.addSystemNotice(1, language == 1 ? "您已获得" + num + "张优惠券,点击查看" : language == 2 ? "You've got " + num + " coupon, click to view" : "Vous avez reçu " + num + " coupon, cliquez pour voir", userInfo.getId(), 2); } } - //添加系统消息 - systemNoticeService.addSystemNotice(1, language == 1 ? "您已获得" + num + "张优惠券,点击查看" : language == 2 ? "You've got " + num + " coupon, click to view" : "Vous avez reçu " + num + " coupon, cliquez pour voir", userInfo.getId(), 2); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Tingg/TinggPayoutUtil.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Tingg/TinggPayoutUtil.java index f5c684d..1e5c321 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Tingg/TinggPayoutUtil.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Tingg/TinggPayoutUtil.java @@ -47,7 +47,7 @@ packet.setMSISDN(phone); packet.setAccountNumber(phone); packet.setPayerTransactionID(payerTransactionID); - packet.setAmount(amount); + packet.setAmount(Double.valueOf(amount.intValue())); packet.setNarration(narration); packet.setDatePaymentReceived(sdf.format(new Date())); packet.setExtraData(new ExtraData(callbackUrl)); @@ -70,7 +70,5 @@ System.err.println("支付结果返回" + s); return payoutResponse; } - - } diff --git a/UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java b/UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java index 7aeaf09..6006a1f 100644 --- a/UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java +++ b/UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java @@ -1,7 +1,9 @@ //package com.stylefeng.guns; // +//import com.alibaba.fastjson.JSON; //import com.stylefeng.guns.modular.system.util.SMSUtil; //import com.stylefeng.guns.modular.system.util.Tingg.TinggPayoutUtil; +//import com.stylefeng.guns.modular.system.util.Tingg.model.PayoutResponse; //import com.twilio.Twilio; //import com.twilio.http.TwilioRestClient; //import com.twilio.rest.api.v2010.Account; @@ -30,6 +32,7 @@ // // @Test // public void test(){ -// smsUtil.sendCellulantMessage("233500666666", "test"); +// PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout("GH-VODAFONE-B2C", "+233500666666", "123465", 1.00d, "", "测试转账"); +// System.err.println(JSON.toJSONString(payoutResponse)); // } //} -- Gitblit v1.7.1