From cf71570fb38ad1983cd40e65fb09e259e509d2a3 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 06 五月 2024 09:36:45 +0800
Subject: [PATCH] 修改bug
---
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java | 94 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 83 insertions(+), 11 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..43981ca 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);
@@ -428,7 +441,12 @@
*/
@RequestMapping(value = "/add")
@ResponseBody
- public Object add(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel) {
+ public Object add(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel) throws Exception {
+ TCar tCar1 = tCarService.selectOne(new EntityWrapper<TCar>().eq("state", 1).ne("authState", 4).eq("carLicensePlate", tCar.getCarLicensePlate()));
+ if(null != tCar1){
+ throw new Exception("车牌号重复");
+ }
+
if (1 == roleType){ //平台
if (2 == companyType.intValue()){
if (SinataUtil.isNotEmpty(oneId)){
@@ -468,6 +486,7 @@
}
tCar.setInsertTime(new Date());
tCar.setState(1);
+ tCar.setAuthState(1);
tCarService.insert(tCar);
//添加经营业务
@@ -510,7 +529,12 @@
*/
@RequestMapping(value = "/update")
@ResponseBody
- public Object update(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel) {
+ public Object update(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel)throws Exception {
+ TCar tCar1 = tCarService.selectOne(new EntityWrapper<TCar>().eq("state", 1).ne("authState", 4).eq("carLicensePlate", tCar.getCarLicensePlate()));
+ if(null != tCar1 && tCar.getId().compareTo(tCar1.getId()) != 0){
+ throw new Exception("车牌号重复");
+ }
+
if (1 == roleType){ //平台
if (2 == companyType.intValue()){
if (SinataUtil.isNotEmpty(oneId)){
@@ -568,16 +592,64 @@
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").remove();
+ document.getElementById("french").remove();
+ document.getElementById("invite1").remove();
+ document.getElementById("user1").remove();
+ document.getElementById("settle1").remove();
+ document.getElementById("pass1").remove();
+ document.getElementById("email1").remove();
+ document.getElementById("bill1").remove();
+ document.getElementById("reward1").remove();
+ document.getElementById("rewardToday1").remove();
+ document.getElementById("driverAudit1").remove();
+
+ document.getElementsByTag("title").get(0).text(2 == finalTCar.getAuthState() ? "Vehicle is verified and qualified" : "Vehicle is not verified and qualified");
+ Element car_audit1_user = document.getElementById("car_audit1_user");
+ car_audit1_user.text("Hello " + tDriver.getFirstName() + " " + tDriver.getLastName() + ",");
+ 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(), 2 == finalTCar.getAuthState() ? "Vehicle is verified and qualified" : "Vehicle is not verified and qualified", document.html());
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ }).start();
+
return SUCCESS_TIP;
}
@@ -772,7 +844,7 @@
// }
//判断服务模式【小件同城物流】
if (!six.equals("是") && !six.equals("否")){
- return new ErrorTip(500, "服务模式【小件同城物流】内容不正确");
+ return new ErrorTip(500, "服务模式【小件市内物流】内容不正确");
}
// //判断服务模式【小件跨城物流】
// if (!seven.equals("是") && !seven.equals("否")){
--
Gitblit v1.7.1