From 521efb9bc33d52ef4772f0b30f8a371ba4b0070c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期六, 11 二月 2023 19:09:42 +0800 Subject: [PATCH] 更新最新代码 --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java | 78 ++++++++++++++++++++++++++++++++++---- 1 files changed, 69 insertions(+), 9 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java index ad8bb62..fb4868a 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java @@ -13,12 +13,16 @@ import com.stylefeng.guns.modular.system.dao.CarInsuranceMapper; 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.ResultUtil; import org.apache.commons.lang.time.DateUtils; 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.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -31,6 +35,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; @@ -83,8 +88,11 @@ @Autowired private ITCarColorService carColorService; - @Value("${pushMinistryOfTransport}") - private boolean pushMinistryOfTransport; + @Value("${spring.mail.template-path}") + private String templatePath; + + + /** * 跳转到车辆管理首页 @@ -255,8 +263,13 @@ one = 2; zcModel = obj.getServerCarModelId(); } + if (obj.getType() == 1){ + four = 2; + zcModel = obj.getServerCarModelId(); + } } model.addAttribute("one",one); + model.addAttribute("four",four); model.addAttribute("zcModel",zcModel); List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1)); model.addAttribute("zcModelList",zcModelList); @@ -468,6 +481,7 @@ } tCar.setInsertTime(new Date()); tCar.setState(1); + tCar.setAuthState(1); tCarService.insert(tCar); //添加经营业务 @@ -568,16 +582,62 @@ if(tCar.getAuthState()==2){ String[] serverArray = serverBox.split(","); for (int i=0;i<serverArray.length;i++){ - TCarService service = new TCarService(); - service.setCarId(tCar.getId()); - service.setType(Integer.valueOf(serverArray[i])); - if (1 == service.getType()){ - service.setServerCarModelId(Integer.valueOf(zcModel)); + TCarService tCarService = tCarServiceService.selectOne(new EntityWrapper<TCarService>().eq("carId", tCar.getId()).eq("type", Integer.valueOf(serverArray[i]))); + if(null == tCarService){ + tCarService = new TCarService(); + tCarService.setCarId(tCar.getId()); + tCarService.setType(Integer.valueOf(serverArray[i])); + if (1 == tCarService.getType()){ + tCarService.setServerCarModelId(Integer.valueOf(zcModel)); + } + tCarServiceService.insert(tCarService); + }else{ + if (1 == tCarService.getType()){ + tCarService.setServerCarModelId(Integer.valueOf(zcModel)); + } + tCarServiceService.updateById(tCarService); } - tCarServiceService.insert(service); + + } } tCarService.updateById(tCar); + tCar = tCarService.selectById(tCar.getId()); + TDriver tDriver = tDriverService.selectById(tCar.getDriverId()); + + TCar finalTCar = tCar; + 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("driverAudit1").attr("style", "display: none;"); + Element car_audit1_user = document.getElementById("car_audit1_user"); + car_audit1_user.text("Hello " + tDriver.getName() + ","); + Element car_audit1_content = document.getElementById("car_audit1_content"); + if(2 == finalTCar.getAuthState()){ + car_audit1_content.text("You vehicle application has been approved. See the I-GO platform for details."); + }else{ + car_audit1_content.text("Sorry, your vehicle application was not approved. The reason for the failure is: incomplete filling of vehicle information."); + } + EmailUtil.send(tDriver.getEmail(), "Vehicle audit notice", document.html()); + }catch (Exception e){ + e.printStackTrace(); + } + } + }).start(); + return SUCCESS_TIP; } @@ -772,7 +832,7 @@ // } //判断服务模式【小件同城物流】 if (!six.equals("是") && !six.equals("否")){ - return new ErrorTip(500, "服务模式【小件同城物流】内容不正确"); + return new ErrorTip(500, "服务模式【小件市内物流】内容不正确"); } // //判断服务模式【小件跨城物流】 // if (!seven.equals("是") && !seven.equals("否")){ -- Gitblit v1.7.1