From 53562814add61acfdc02d6b25dae6324f6fd5f92 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 18 五月 2023 16:38:14 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java | 142 +++++++++++++---------------------------------- 1 files changed, 40 insertions(+), 102 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java index 0f79c76..4e608b9 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java @@ -15,14 +15,17 @@ import com.stylefeng.guns.modular.system.dao.DriverTrainMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; +import com.stylefeng.guns.modular.system.util.EmailUtil; import com.stylefeng.guns.modular.system.util.HttpRequestUtil; -import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; import com.stylefeng.guns.modular.system.util.PushURL; import com.stylefeng.guns.modular.system.util.ResultUtil; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +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.Controller; @@ -34,6 +37,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -66,9 +70,6 @@ private ITLineService itLineService; @Autowired - private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; - - @Autowired private ITDriverTeamService itDriverTeamService; @Resource @@ -77,8 +78,8 @@ @Resource private DriverPunishMapper driverPunishMapper; - @Value("${pushMinistryOfTransport}") - private boolean pushMinistryOfTransport; + @Value("${spring.mail.template-path}") + private String templatePath; @@ -300,52 +301,14 @@ } List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); for(DriverTrain driverTrain : driverTrains){ - boolean b = true; for(String s : split){ String[] s1 = s.split("_"); if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ - b = false; break; } } - if(b){ - driverTrainMapper.deleteById(driverTrain.getId()); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 3); - } - } - }).start(); - } } - if(update.size() > 0){ - for(DriverTrain driverTrain : update){ - driverTrainMapper.updateById(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 2); - } - } - }).start(); - } - } - if(add.size() > 0){ - for(DriverTrain driverTrain : add){ - driverTrainMapper.insert(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 1); - } - } - }).start(); - } - } + }catch (Exception e){ e.printStackTrace(); @@ -432,19 +395,6 @@ if(update.size() > 0){ for(DriverPunish driverTrain : update){ driverPunishMapper.updateById(driverTrain); - } - } - if(add.size() > 0){ - for(DriverPunish driverTrain : add){ - driverPunishMapper.insert(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.ratedDriverPunish(driverTrain.getId()); - } - } - }).start(); } } @@ -593,17 +543,6 @@ type = 5; tDriver.setAuthState(2); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(id); - pushMinistryOfTransportUtil.baseInfoDriverApp(id); - } - } - }).start(); - if(tDriver.getUid()!=null && tDriver.getuType()!=null && tDriver.getuType() == 2){ TDriver driver = tDriverService.selectById(tDriver.getUid()); @@ -651,11 +590,38 @@ tDriver.setAuthState(4); } - Map<String,String> map = new HashMap<>(); - map.put("uid", String.valueOf(tDriver.getId())); - map.put("type", String.valueOf(type)); - String result = HttpRequestUtil.postRequest(PushURL.driver_auth_url, map); - System.out.println("司机注册审核发送短信 :【driverId="+tDriver.getId().toString()+"】,调用接口:"+result); + new Thread(new Runnable() { + @Override + public void run() { + try { + String path = templatePath + "driver/index.html"; + Document document = Jsoup.parse(new File(path), "UTF-8"); + 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("email1").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("carAudit1").attr("style", "display: none;"); + + Element driver_audit1_user = document.getElementById("driver_audit1_user"); + driver_audit1_user.text("Hello " + tDriver.getName() + ","); + Element driver_audit1_content = document.getElementById("driver_audit1_content"); + if(1 == authState){ + driver_audit1_content.text("You application has been approved."); + }else{ + driver_audit1_content.text("I'm sorry, your application was rejected. Reason for rejection: Incomplete filling in personal information."); + } + EmailUtil.send(tDriver.getEmail(), "Notice of driver registration application", document.html()); + }catch (Exception e){ + e.printStackTrace(); + } + } + }).start(); tDriverService.updateById(tDriver); } @@ -795,26 +761,8 @@ TDriver tDriver = tDriverService.selectById(driverId); if (1 == optType){ //解冻 tDriver.setAuthState(2); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(driverId); - } - } - }).start(); }else if (2 == optType){ //冻结 tDriver.setAuthState(3); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(driverId); - } - } - }).start(); } tDriver.setRemark(remark); tDriverService.updateById(tDriver); @@ -897,16 +845,6 @@ } } } - - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriver(tDriver.getId()); - } - } - }).start(); - return SUCCESS_TIP; } -- Gitblit v1.7.1