From e809f5955584e600d8612540ea814977c49774c2 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 27 八月 2025 23:51:54 +0800
Subject: [PATCH] 修改bug

---
 ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java |  150 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 131 insertions(+), 19 deletions(-)

diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java
index 91a7143..ba8292b 100644
--- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java
+++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java
@@ -72,6 +72,9 @@
 
     @Autowired
     private ITLineService itLineService;
+
+    @Autowired
+    private ITRegionService tRegionService;
     
     @Autowired
     private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
@@ -185,6 +188,8 @@
         //查询线路列表
         List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1));
         model.addAttribute("lineList",lineList);
+        List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+        model.addAttribute("provinceList",provinceList);
         return PREFIX + "tDriver_add.html";
     }
 
@@ -314,6 +319,25 @@
         //查询驾驶员已添加的线路列表
         List<Map<String, Object>> driverLineList = tDriverLineService.getDriverLineListByDriverId(tDriverId);
         model.addAttribute("driverLineList",driverLineList);
+        model.addAttribute("provinceId", 1);
+        if(ToolUtil.isNotEmpty(tDriver.getPlaceOfEmployment())){
+            TRegion area = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriver.getPlaceOfEmployment()));
+            model.addAttribute("areaId",area.getId());
+            TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("id", area.getParentId()));
+            model.addAttribute("cityId",city.getId());
+            TRegion province = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("id", city.getParentId()));
+            model.addAttribute("provinceId",province.getId());
+
+            //市
+            List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", city.getParentId()));
+            model.addAttribute("cityList",cityList);
+            //区
+            List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", area.getParentId()));
+            model.addAttribute("areaList",areaList);
+        }
+        //省
+        List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+        model.addAttribute("provinceList",provinceList);
         return PREFIX + "tDriver_edit.html";
     }
 
@@ -747,6 +771,14 @@
         if (count > 0){
             return "error";
         }
+        if(ToolUtil.isEmpty(tDriver.getIdCard())){
+            return "身份证号不能为空";
+        }
+        Boolean b = UserUtil.idCardAuth(tDriver.getName(), tDriver.getIdCard());
+        if(!b){
+            return "司机姓名和身份证号不匹配";
+        }
+
         if (1 == roleType){  //平台
             if (2 == companyType.intValue()){
                 if (SinataUtil.isNotEmpty(oneId)){
@@ -1006,6 +1038,13 @@
                 return "error";
             }
         }
+        if(ToolUtil.isEmpty(tDriver.getIdCard())){
+            return "身份证号不能为空";
+        }
+        Boolean b = UserUtil.idCardAuth(tDriver.getName(), tDriver.getIdCard());
+        if(!b){
+            return "司机姓名和身份证号不匹配";
+        }
         if (1 == roleType){  //平台
             if (2 == companyType.intValue()){
                 if (SinataUtil.isNotEmpty(oneId)){
@@ -1089,6 +1128,7 @@
         obj.setEmergencyContactAddress(tDriver.getEmergencyContactAddress());
         obj.setUpdateTime(new Date());
         obj.setUpdateUser(shiroExtUtil.getUser().getId());
+        obj.setPlaceOfEmployment(tDriver.getPlaceOfEmployment());
         tDriverService.updateAllColumnById(obj);
     
         //删除业务
@@ -1158,6 +1198,7 @@
             shellList.add("经营业务:跨城出行[是/否]");
             shellList.add("登录账号[手机号]");
             shellList.add("登录密码[密码长度为6-18]");
+            shellList.add("从业地行政编号");
         } else if (shiroExtUtil.getUser().getRoleType() == 2) {
             title = "分公司导入司机模板";
         
@@ -1175,6 +1216,7 @@
             shellList.add("经营业务:跨城出行[是/否]");
             shellList.add("登录账号[手机号]");
             shellList.add("登录密码[密码长度为6-18]");
+            shellList.add("从业地行政编号");
         } else if (shiroExtUtil.getUser().getRoleType() == 3) {
             title = "加盟商导入司机模板";
         
@@ -1191,6 +1233,7 @@
             shellList.add("经营业务:跨城出行[是/否]");
             shellList.add("登录账号[手机号]");
             shellList.add("登录密码[密码长度为6-18]");
+            shellList.add("从业地行政编号");
         }
         dataList.add(shellList);
 
@@ -1248,7 +1291,7 @@
                                 break;
                         }
                     }
-            
+
                     Cell cell2 = row.getCell(2);  //所属分公司[提示:加盟司机选填]
                     String two = null;
                     if (SinataUtil.isNotEmpty(cell2)) {
@@ -1445,10 +1488,24 @@
                         }
                     }
 
+                    Cell cell20 = row.getCell(16);  //从业地行政编号
+                    String cell201 = null;
+                    if (SinataUtil.isNotEmpty(cell20)){
+                        int cellType = cell20.getCellType();
+                        switch (cellType) {
+                            case Cell.CELL_TYPE_STRING:
+                                cell201 = cell20.getStringCellValue().trim();
+                                break;
+                            case Cell.CELL_TYPE_NUMERIC:
+                                cell201 = String.valueOf((long)cell20.getNumericCellValue()).trim();
+                                break;
+                        }
+                    }
+
                     if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(one) || SinataUtil.isEmpty(four)
                             || SinataUtil.isEmpty(five) || SinataUtil.isEmpty(six) || SinataUtil.isEmpty(nine)
                             || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen)
-                            || SinataUtil.isEmpty(seventeen)|| SinataUtil.isEmpty(eighteen)){
+                            || SinataUtil.isEmpty(seventeen)|| SinataUtil.isEmpty(eighteen)|| SinataUtil.isEmpty(cell201)){
                         return new ErrorTip(500, "单元格不能为空");
                     }else{
                         //判断账号是否存在
@@ -1456,7 +1513,10 @@
                         if (count > 0){
                             continue;
                         }
-
+                        Boolean b = UserUtil.idCardAuth(zero, seven);
+                        if(!b){
+                            return new ErrorTip(500, "司机姓名和身份证号不匹配");
+                        }
                         //判断所属机构
                         if (!one.equals("平台司机") && !one.equals("加盟司机")){
                             return new ErrorTip(500, "所属机构内容不正确");
@@ -1488,6 +1548,10 @@
                         //判断登录密码
                         if (!isPassword(eighteen)){
                             return new ErrorTip(500, "登录密码格式不正确");
+                        }
+                        //从业地行政编号
+                        if (!isPassword(cell201)){
+                            return new ErrorTip(500, "从业地行政编号不正确");
                         }
 
                         //查找平台公司
@@ -1539,10 +1603,11 @@
                         driver.setInsertTime(new Date());
                         driver.setAddType(2);
                         driver.setAddObjectId(shiroExtUtil.getUser().getObjectId());
+                        driver.setPlaceOfEmployment(cell201);
                         if (SinataUtil.isNotEmpty(eight)) {
                             driver.setDriverAddress(eight);
                         }
-    
+
                         //审核通过,在中台添加司机账号
                         if (2 == driver.getAuthState()) {
                             Integer objectId = driver.getCompanyId();
@@ -1575,15 +1640,15 @@
                                 empId = userInfoByPhone.get(0).getEmpId();
                                 empnew = 0;
                             }
-                            
+
                             driver.setEmpId(empId);
                             driver.setEntercode(tCompany.getEnterCode());
                             driver.setEnterId(Long.valueOf(tCompany.getEnterCode()));
                             driver.setEmpnew(empnew);
                         }
                         tDriverService.insert(driver);
-    
-    
+
+
                         //添加快车服务模式
                         if ("是".equals(eleven)) {
                             TDriverService service = new TDriverService();
@@ -1612,7 +1677,7 @@
                 Sheet sh = book.getSheetAt(0);   //获取到第一个表
                 for (int i = 1; i <= sh.getLastRowNum(); i++) {
                     Row row = sh.getRow(i);
-            
+
                     Cell cell0 = row.getCell(0);  //司机名称
                     String zero = null;
                     if (SinataUtil.isNotEmpty(cell0)) {
@@ -1626,7 +1691,7 @@
                                 break;
                         }
                     }
-            
+
                     Cell cell1 = row.getCell(1);  //所属加盟商[选填]
                     String one = null;
                     if (SinataUtil.isNotEmpty(cell1)) {
@@ -1640,7 +1705,7 @@
                                 break;
                         }
                     }
-            
+
                     Cell cell2 = row.getCell(2);  //性别[男/女]
                     String two = null;
                     if (SinataUtil.isNotEmpty(cell2)) {
@@ -1808,16 +1873,36 @@
                                 break;
                         }
                     }
+
+                    Cell cell17 = row.getCell(14);  //从业地行政编号
+                    String cell1701 = null;
+                    if (SinataUtil.isNotEmpty(cell17)){
+                        int cellType = cell17.getCellType();
+                        switch (cellType) {
+                            case Cell.CELL_TYPE_STRING:
+                                cell1701 = cell17.getStringCellValue().trim();
+                                break;
+                            case Cell.CELL_TYPE_NUMERIC:
+                                cell1701 = String.valueOf((long)cell17.getNumericCellValue()).trim();
+                                break;
+                        }
+                    }
                     if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(two) || SinataUtil.isEmpty(three) || SinataUtil.isEmpty(four)
                             || SinataUtil.isEmpty(five) || SinataUtil.isEmpty(seven)
                             || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten)
-                            || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(fifteen) || SinataUtil.isEmpty(sixteen)){
+                            || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(fifteen)
+                            || SinataUtil.isEmpty(sixteen) || SinataUtil.isEmpty(cell1701)){
                         return new ErrorTip(500, "单元格不能为空");
                     }else{
                         //判断账号是否存在
                         int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", fifteen).in("authState", "1,2,3").ne("flag", 3));
                         if (count > 0){
                             continue;
+                        }
+
+                        Boolean b = UserUtil.idCardAuth(zero, five);
+                        if(!b){
+                            return new ErrorTip(500, "司机姓名和身份证号不匹配");
                         }
                         //判断性别
                         if (!two.equals("男") && !two.equals("女")){
@@ -1847,6 +1932,12 @@
                         if (!isPassword(sixteen)) {
                             return new ErrorTip(500, "登录密码格式不正确");
                         }
+                        //从业地行政编号
+                        if (!isPassword(cell1701)) {
+                            return new ErrorTip(500, "从业地行政编号不正确");
+                        }
+
+
                         //查找平台公司
                         Integer companyId = shiroExtUtil.getUser().getObjectId();
                         Integer franchiseeId = 0;
@@ -1857,7 +1948,7 @@
                                 franchiseeId = franchisee.getId();
                             }
                         }
-    
+
                         TDriver driver = new TDriver();
                         driver.setAccount(fifteen);
                         driver.setJobNumber(eight);
@@ -1883,11 +1974,12 @@
                         driver.setInsertTime(new Date());
                         driver.setAddType(3);
                         driver.setAddObjectId(shiroExtUtil.getUser().getObjectId());
+                        driver.setPlaceOfEmployment(cell1701);
                         if (SinataUtil.isNotEmpty(six)) {
                             driver.setDriverAddress(six);
                         }
                         tDriverService.insert(driver);
-    
+
                         //添加快车服务模式
                         if ("是".equals(nine)) {
                             TDriverService service = new TDriverService();
@@ -1909,7 +2001,7 @@
                             service.setType(3);
                             itDriverServiceService.insert(service);
                         }
-    
+
                     }
                 }
             } else if (shiroExtUtil.getUser().getRoleType() == 3) {
@@ -1917,7 +2009,7 @@
                 Sheet sh = book.getSheetAt(0);   //获取到第一个表
                 for (int i = 1; i <= sh.getLastRowNum(); i++) {
                     Row row = sh.getRow(i);
-            
+
                     Cell cell0 = row.getCell(0);  //司机名称
                     String zero = null;
                     if (SinataUtil.isNotEmpty(cell0)) {
@@ -1931,7 +2023,7 @@
                                 break;
                         }
                     }
-            
+
                     Cell cell2 = row.getCell(1);  //性别[男/女]
                     String one = null;
                     if (SinataUtil.isNotEmpty(cell2)) {
@@ -1945,7 +2037,7 @@
                                 break;
                         }
                     }
-            
+
                     Cell cell3 = row.getCell(2);  //驾驶证号码
                     String two = null;
                     if (SinataUtil.isNotEmpty(cell3)) {
@@ -2099,16 +2191,35 @@
                                 break;
                         }
                     }
+
+                    Cell cell17 = row.getCell(13);  //登录密码[密码长度为6-18]
+                    String cell1701 = null;
+                    if (SinataUtil.isNotEmpty(cell17)){
+                        int cellType = cell17.getCellType();
+                        switch (cellType) {
+                            case Cell.CELL_TYPE_STRING:
+                                cell1701 = cell17.getStringCellValue().trim();
+                                break;
+                            case Cell.CELL_TYPE_NUMERIC:
+                                cell1701 = String.valueOf((long)cell17.getNumericCellValue()).trim();
+                                break;
+                        }
+                    }
                     if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(one)  || SinataUtil.isEmpty(two) || SinataUtil.isEmpty(three) || SinataUtil.isEmpty(four)
                             || SinataUtil.isEmpty(six) || SinataUtil.isEmpty(eight)
                             || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten)
-                            || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) ){
+                            || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen)
+                            || SinataUtil.isEmpty(cell1701)){
                         return new ErrorTip(500, "单元格不能为空");
                     }else{
                         //判断账号是否存在
                         int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", fourteen).in("authState", "1,2,3").ne("flag", 3));
                         if (count > 0){
                             continue;
+                        }
+                        Boolean b = UserUtil.idCardAuth(zero, four);
+                        if(!b){
+                            return new ErrorTip(500, "司机姓名和身份证号不匹配");
                         }
                         //判断性别
                         if (!one.equals("男") && !one.equals("女")){
@@ -2175,6 +2286,7 @@
                         driver.setInsertTime(new Date());
                         driver.setAddType(4);
                         driver.setAddObjectId(shiroExtUtil.getUser().getObjectId());
+                        driver.setPlaceOfEmployment(cell1701);
                         if (SinataUtil.isNotEmpty(five)) {
                             driver.setDriverAddress(five);
                         }
@@ -2326,7 +2438,7 @@
                 shellList.add("-");
             }
             if(SinataUtil.isNotEmpty(object.get("sex"))){
-                shellList.add(object.get("sex").toString() == "1"?"男":"女");
+                shellList.add(object.get("sex").toString().equals("1")?"男":"女");
             }else{
                 shellList.add("-");
             }

--
Gitblit v1.7.1