From 76368e3f45acaf795f6f0faf56044c786341f726 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期六, 11 二月 2023 19:06:26 +0800 Subject: [PATCH] 更新代码 --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 81 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 77 insertions(+), 4 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 57acfd1..c6b4277 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -9,19 +9,26 @@ import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; import com.stylefeng.guns.modular.system.dao.RegionMapper; +import com.stylefeng.guns.modular.system.dao.UserInfoMapper; import com.stylefeng.guns.modular.system.model.Company; import com.stylefeng.guns.modular.system.model.Driver; import com.stylefeng.guns.modular.system.model.Region; +import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.ICompanyService; import com.stylefeng.guns.modular.system.service.IDriverService; import com.stylefeng.guns.modular.system.service.IIncomeService; import com.stylefeng.guns.modular.system.service.ISystemNoticeService; import com.stylefeng.guns.modular.system.util.*; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; +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.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; @@ -69,6 +76,12 @@ @Autowired private ALiSendSms aLiSendSms; + + @Resource + private UserInfoMapper userInfoMapper; + + @Value("${spring.mail.template-path}") + private String templatePath; @@ -396,15 +409,75 @@ } @Override - public void sendVerificationCode(Integer orderId) throws Exception { + public void sendVerificationCode(Integer orderId, Integer language) throws Exception { OrderLogistics orderLogistics = this.selectById(orderId); String random = ""; for(int i = 0; i < 6; i++){ random += Double.valueOf(Math.random() * 10).intValue(); } - orderLogistics.setPickUpCode("123456"); + orderLogistics.setPickUpCode(random); this.updateById(orderLogistics); - //发送短信 - //aLiSendSms.sendSms(orderLogistics.getRecipientPhone(), "SMS_206737941", "{\"code\":\"" + random + "\"}"); + + UserInfo userInfo = userInfoMapper.selectById(orderLogistics.getUserId()); + if(ToolUtil.isNotEmpty(userInfo.getEmail())){ + String path = templatePath + "index.html"; + Document document = Jsoup.parse(new File(path), "UTF-8"); + if(1 == language){ + document.getElementById("english").attr("style", "display: none;"); + document.getElementById("french").attr("style", "display: none;"); + document.getElementById("invite").attr("style", "display: none;"); + document.getElementById("user").attr("style", "display: none;"); + document.getElementById("settle").attr("style", "display: none;"); + document.getElementById("pass").attr("style", "display: none;"); + document.getElementById("bill").attr("style", "display: none;"); + document.getElementById("reward").attr("style", "display: none;"); + document.getElementById("rewardToday").attr("style", "display: none;"); + document.getElementById("driverAudit").attr("style", "display: none;"); + document.getElementById("carAudit").attr("style", "display: none;"); + + Element email_user = document.getElementById("email_user"); + email_user.text("您好 ,"); + Element email_content = document.getElementById("email_content"); + email_content.text("邮件取件码是:" + random + ",请在5分钟内完成验证"); + } + if(2 == language){ + document.getElementById("chinese").attr("style", "display: none;"); + document.getElementById("french").attr("style", "display: none;"); + document.getElementById("invite1").attr("style", "display: none;"); + document.getElementById("user1").attr("style", "display: none;"); + document.getElementById("settle1").attr("style", "display: none;"); + document.getElementById("pass1").attr("style", "display: none;"); + document.getElementById("bill1").attr("style", "display: none;"); + document.getElementById("reward1").attr("style", "display: none;"); + document.getElementById("rewardToday1").attr("style", "display: none;"); + document.getElementById("driverAudit1").attr("style", "display: none;"); + document.getElementById("carAudit1").attr("style", "display: none;"); + + Element email1_user = document.getElementById("email1_user"); + email1_user.text("Hello ,"); + Element email1_content = document.getElementById("email1_content"); + email1_content.text("pickup code is " + random + ", please complete the verification within 5 minutes. If the request wasn't made by you, please ignore this email."); + } + if(3 == language){ + document.getElementById("chinese").attr("style", "display: none;"); + document.getElementById("english").attr("style", "display: none;"); + document.getElementById("invite2").attr("style", "display: none;"); + document.getElementById("user2").attr("style", "display: none;"); + document.getElementById("settle2").attr("style", "display: none;"); + document.getElementById("pass2").attr("style", "display: none;"); + document.getElementById("bill2").attr("style", "display: none;"); + document.getElementById("reward2").attr("style", "display: none;"); + document.getElementById("rewardToday2").attr("style", "display: none;"); + document.getElementById("driverAudit2").attr("style", "display: none;"); + document.getElementById("carAudit2").attr("style", "display: none;"); + + Element email2_user = document.getElementById("email2_user"); + email2_user.text("Bonjour ,"); + Element email2_content = document.getElementById("email2_content"); + email2_content.text("Vous êtes lié à une adresse e-mail. Le code de vérification e-mail pour cette demande est: " + random + ". Veuillez compléter la vérification dans les 5 minutes"); + } + EmailUtil.send(userInfo.getEmail(), language == 1 ? "取件码" : language == 2 ? "Pickup code" : "Code de prise en charge", document.html()); + } + } } -- Gitblit v1.7.1