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 | 319 +++++++++++++++++++++++++++-------------------------
1 files changed, 167 insertions(+), 152 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 f79c252..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,14 +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.PushMinistryOfTransportUtil;
+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.hdf.extractor.TC;
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.*;
@@ -33,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.*;
@@ -79,17 +82,17 @@
@Autowired
private ITServerCarmodelService itServerCarmodelService;
- @Autowired
- private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
-
@Resource
private CarInsuranceMapper carInsuranceMapper;
@Autowired
private ITCarColorService carColorService;
- @Value("${pushMinistryOfTransport}")
- private boolean pushMinistryOfTransport;
+ @Value("${spring.mail.template-path}")
+ private String templatePath;
+
+
+
/**
* 跳转到车辆管理首页
@@ -260,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);
@@ -318,24 +326,8 @@
public ResultUtil saveCarInsurance(CarInsurance carInsurance){
if(carInsurance.getId() == null){
carInsuranceMapper.insert(carInsurance);
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){//上传数据
- pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 1);
- }
- }
- }).start();
}else{
carInsuranceMapper.updateById(carInsurance);
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){//上传数据
- pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 2);
- }
- }
- }).start();
}
return ResultUtil.success();
@@ -386,14 +378,6 @@
@RequestMapping(value = "/delCarInsurance", method = RequestMethod.POST)
public ResultUtil delCarInsurance(Integer id){
carInsuranceMapper.deleteById(id);
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){//上传数据
- pushMinistryOfTransportUtil.baseInfoVehicleInsurance(id, 3);
- }
- }
- }).start();
return ResultUtil.success();
}
@@ -457,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)){
@@ -497,6 +486,7 @@
}
tCar.setInsertTime(new Date());
tCar.setState(1);
+ tCar.setAuthState(1);
tCarService.insert(tCar);
//添加经营业务
@@ -512,16 +502,6 @@
}
tCarServiceService.insert(service);
}
-
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){//上传数据
- pushMinistryOfTransportUtil.baseInfoCompanyStat();
- pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
- }
- }
- }).start();
return SUCCESS_TIP;
}
@@ -541,16 +521,6 @@
obj.setCarId(null);
tDriverService.updateById(obj);
}
-
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){//上传数据
- pushMinistryOfTransportUtil.baseInfoCompanyStat();
- pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
- }
- }
- }).start();
return SUCCESS_TIP;
}
@@ -559,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)){
@@ -608,14 +583,6 @@
}
tCarService.updateById(tCar);
- new Thread(new Runnable() {
- @Override
- public void run() {
- if(pushMinistryOfTransport){
- pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
- }
- }
- }).start();
return SUCCESS_TIP;
}
@RequestMapping(value = "/updateAuth")
@@ -625,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;
}
@@ -663,16 +678,16 @@
shellList.add("所属分公司[提示:加盟车辆选填]");
shellList.add("所属加盟商[提示:加盟车辆选填]");
shellList.add("服务模式:专车[是/否]");
- shellList.add("服务模式:出租车[是/否]");
- shellList.add("服务模式:跨城出行[是/否]");
- shellList.add("服务模式:小件同城物流[是/否]");
- shellList.add("服务模式:小件跨城物流[是/否]");
- shellList.add("服务模式:包车[是/否]");
+// shellList.add("服务模式:出租车[是/否]");
+// shellList.add("服务模式:跨城出行[是/否]");
+ shellList.add("服务模式:市内小件物流[是/否]");
+// shellList.add("服务模式:小件跨城物流[是/否]");
+// shellList.add("服务模式:包车[是/否]");
shellList.add("车辆品牌");
shellList.add("车辆类型");
shellList.add("车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]");
shellList.add("车牌号");
- shellList.add("行驶证编号");
+ shellList.add("roadworthiness sticker");
shellList.add("年检到期时间[例如 2020-02-02]");
shellList.add("商业保险到期时间[例如 2020-02-02]");
dataList.add(shellList);
@@ -732,81 +747,81 @@
three = String.valueOf(cell3.getStringCellValue()).trim();
}
- Cell cell4 = row.getCell(4); //服务模式:出租车[是/否]
- String four = null;
- if (SinataUtil.isNotEmpty(cell4)){
- four = String.valueOf(cell4.getStringCellValue()).trim();
- }
+// Cell cell4 = row.getCell(4); //服务模式:出租车[是/否]
+// String four = null;
+// if (SinataUtil.isNotEmpty(cell4)){
+// four = String.valueOf(cell4.getStringCellValue()).trim();
+// }
+//
+// Cell cell5 = row.getCell(5); //服务模式:跨城出行[是/否]
+// String five = null;
+// if (SinataUtil.isNotEmpty(cell5)){
+// five = String.valueOf(cell5.getStringCellValue()).trim();
+// }
- Cell cell5 = row.getCell(5); //服务模式:跨城出行[是/否]
- String five = null;
- if (SinataUtil.isNotEmpty(cell5)){
- five = String.valueOf(cell5.getStringCellValue()).trim();
- }
-
- Cell cell6 = row.getCell(6); //服务模式:小件跨城物流[是/否]
+ Cell cell6 = row.getCell(4); //服务模式:小件跨城物流[是/否]
String six = null;
if (SinataUtil.isNotEmpty(cell6)){
six = String.valueOf(cell6.getStringCellValue()).trim();
}
- Cell cell7 = row.getCell(7); //服务模式:小件跨城物流[是/否]
- String seven = null;
- if (SinataUtil.isNotEmpty(cell7)){
- seven = String.valueOf(cell7.getStringCellValue()).trim();
- }
+// Cell cell7 = row.getCell(7); //服务模式:小件跨城物流[是/否]
+// String seven = null;
+// if (SinataUtil.isNotEmpty(cell7)){
+// seven = String.valueOf(cell7.getStringCellValue()).trim();
+// }
+//
+// Cell cell8 = row.getCell(8); //服务模式:包车[是/否]
+// String eight = null;
+// if (SinataUtil.isNotEmpty(cell8)){
+// eight = String.valueOf(cell8.getStringCellValue()).trim();
+// }
- Cell cell8 = row.getCell(8); //服务模式:包车[是/否]
- String eight = null;
- if (SinataUtil.isNotEmpty(cell8)){
- eight = String.valueOf(cell8.getStringCellValue()).trim();
- }
-
- Cell cell9 = row.getCell(9); //车辆品牌
+ Cell cell9 = row.getCell(5); //车辆品牌
String nine = null;
if (SinataUtil.isNotEmpty(cell9)){
nine = String.valueOf(cell9.getStringCellValue()).trim();
}
- Cell cell10 = row.getCell(10); //车辆类型
+ Cell cell10 = row.getCell(6); //车辆类型
String ten = null;
if (SinataUtil.isNotEmpty(cell10)){
ten = String.valueOf(cell10.getStringCellValue()).trim();
}
- Cell cell11 = row.getCell(11); //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]
+ Cell cell11 = row.getCell(7); //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]
String eleven = null;
if (SinataUtil.isNotEmpty(cell11)){
eleven = String.valueOf(cell11.getStringCellValue()).trim();
}
- Cell cell12 = row.getCell(12); //车牌号
+ Cell cell12 = row.getCell(8); //车牌号
String twelve = null;
if (SinataUtil.isNotEmpty(cell12)){
twelve = String.valueOf(cell12.getStringCellValue()).trim();
}
- Cell cell13 = row.getCell(13); //行驶证编号
+ Cell cell13 = row.getCell(9); //行驶证编号
String thirteen = null;
if (SinataUtil.isNotEmpty(cell13)){
thirteen = String.valueOf(cell13.getStringCellValue()).trim();
}
- Cell cell14 = row.getCell(14); //年检到期时间
+ Cell cell14 = row.getCell(10); //年检到期时间
String fourteen = null;
if (SinataUtil.isNotEmpty(cell14)){
fourteen = String.valueOf(cell14.getStringCellValue()).trim();
}
- Cell cell15 = row.getCell(15); //商业保险到期时间
+ Cell cell15 = row.getCell(11); //商业保险到期时间
String fifteen = null;
if (SinataUtil.isNotEmpty(cell15)){
fifteen = String.valueOf(cell15.getStringCellValue()).trim();
}
- if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(three) || SinataUtil.isEmpty(four)
- || SinataUtil.isEmpty(five) || SinataUtil.isEmpty(six) || SinataUtil.isEmpty(seven)
- || SinataUtil.isEmpty(eight) || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten)
+ if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(three) /*|| SinataUtil.isEmpty(four)
+ || SinataUtil.isEmpty(five) */|| SinataUtil.isEmpty(six) || /*SinataUtil.isEmpty(seven)
+ || SinataUtil.isEmpty(eight) || */SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten)
|| SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen)
|| SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen)){
return new ErrorTip(500, "单元格不能为空");
@@ -819,26 +834,26 @@
if (!three.equals("是") && !three.equals("否")){
return new ErrorTip(500, "服务模式【专车】内容不正确");
}
- //判断服务模式【出租车】
- if (!four.equals("是") && !four.equals("否")){
- return new ErrorTip(500, "服务模式【出租车】内容不正确");
- }
- //判断服务模式【跨城出行】
- if (!five.equals("是") && !five.equals("否")){
- return new ErrorTip(500, "服务模式【跨城出行】内容不正确");
- }
+// //判断服务模式【出租车】
+// if (!four.equals("是") && !four.equals("否")){
+// return new ErrorTip(500, "服务模式【出租车】内容不正确");
+// }
+// //判断服务模式【跨城出行】
+// if (!five.equals("是") && !five.equals("否")){
+// return new ErrorTip(500, "服务模式【跨城出行】内容不正确");
+// }
//判断服务模式【小件同城物流】
if (!six.equals("是") && !six.equals("否")){
- return new ErrorTip(500, "服务模式【小件同城物流】内容不正确");
+ return new ErrorTip(500, "服务模式【小件市内物流】内容不正确");
}
- //判断服务模式【小件跨城物流】
- if (!seven.equals("是") && !seven.equals("否")){
- return new ErrorTip(500, "服务模式【小件跨城物流】内容不正确");
- }
- //判断服务模式【包车】
- if (!eight.equals("是") && !eight.equals("否")){
- return new ErrorTip(500, "服务模式【包车】内容不正确");
- }
+// //判断服务模式【小件跨城物流】
+// if (!seven.equals("是") && !seven.equals("否")){
+// return new ErrorTip(500, "服务模式【小件跨城物流】内容不正确");
+// }
+// //判断服务模式【包车】
+// if (!eight.equals("是") && !eight.equals("否")){
+// return new ErrorTip(500, "服务模式【包车】内容不正确");
+// }
//判断车辆颜色
if (!eleven.equals("黑色") && !eleven.equals("银色") && !eleven.equals("白色") && !eleven.equals("红色") && !eleven.equals("黄色") && !eleven.equals("橙色") && !eleven.equals("蓝色")){
return new ErrorTip(500, "车辆颜色内容不正确");
@@ -934,20 +949,20 @@
service.setType(1);
tCarServiceService.insert(service);
}
- //添加出租车服务模式
- if ("是".equals(four)){
- TCarService service = new TCarService();
- service.setCarId(car.getId());
- service.setType(2);
- tCarServiceService.insert(service);
- }
- //添加跨城出行服务模式
- if ("是".equals(five)){
- TCarService service = new TCarService();
- service.setCarId(car.getId());
- service.setType(3);
- tCarServiceService.insert(service);
- }
+// //添加出租车服务模式
+// if ("是".equals(four)){
+// TCarService service = new TCarService();
+// service.setCarId(car.getId());
+// service.setType(2);
+// tCarServiceService.insert(service);
+// }
+// //添加跨城出行服务模式
+// if ("是".equals(five)){
+// TCarService service = new TCarService();
+// service.setCarId(car.getId());
+// service.setType(3);
+// tCarServiceService.insert(service);
+// }
//添加小件同城物流服务模式
if ("是".equals(six)){
TCarService service = new TCarService();
@@ -955,20 +970,20 @@
service.setType(4);
tCarServiceService.insert(service);
}
- //添加小件跨城物流服务模式
- if ("是".equals(seven)){
- TCarService service = new TCarService();
- service.setCarId(car.getId());
- service.setType(5);
- tCarServiceService.insert(service);
- }
- //添加包车服务模式
- if ("是".equals(eight)){
- TCarService service = new TCarService();
- service.setCarId(car.getId());
- service.setType(6);
- tCarServiceService.insert(service);
- }
+// //添加小件跨城物流服务模式
+// if ("是".equals(seven)){
+// TCarService service = new TCarService();
+// service.setCarId(car.getId());
+// service.setType(5);
+// tCarServiceService.insert(service);
+// }
+// //添加包车服务模式
+// if ("是".equals(eight)){
+// TCarService service = new TCarService();
+// service.setCarId(car.getId());
+// service.setType(6);
+// tCarServiceService.insert(service);
+// }
}
}
} catch (Exception e) {
@@ -1038,7 +1053,7 @@
shellList.add("颜色");
shellList.add("服务模式");
shellList.add("车牌号");
- shellList.add("行驶证号码");
+ shellList.add("roadworthiness sticker");
shellList.add("座位数");
shellList.add("关联司机");
shellList.add("年检到期时间");
--
Gitblit v1.7.1