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 | 691 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 601 insertions(+), 90 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 a7704f2..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 @@ -23,7 +23,10 @@ import com.stylefeng.guns.modular.system.util.*; import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; -import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.DeleteStafNodeRequest; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -69,6 +72,9 @@ @Autowired private ITLineService itLineService; + + @Autowired + private ITRegionService tRegionService; @Autowired private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; @@ -97,7 +103,7 @@ @Autowired private IUserService userService; - @Resource + @Autowired private ShiroExtUtil shiroExtUtil; /** @@ -182,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"; } @@ -311,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"; } @@ -585,9 +612,10 @@ } Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); if (shiroExtUtil.getUser().getRoleType() != 1) { - page.setRecords(null); + User user = userService.selectById(shiroExtUtil.getUser().getId()); + page.setRecords(tDriverService.getAuthDriverList(page, beginTime, endTime, companyName, phone, account, addType, authState, user.getObjectId())); } else { - page.setRecords(tDriverService.getAuthDriverList(page, beginTime, endTime, companyName, phone, account, addType, authState)); + page.setRecords(tDriverService.getAuthDriverList(page, beginTime, endTime, companyName, phone, account, addType, authState, null)); } return super.packForBT(page); } @@ -648,6 +676,8 @@ @ResponseBody public Object authOpt(Integer id,Integer authState) { if (SinataUtil.isNotEmpty(id) && SinataUtil.isNotEmpty(authState)){ + ShiroUser user1 = shiroExtUtil.getUser(); + User user2 = userService.selectById(user1.getId()); TDriver tDriver = tDriverService.selectById(id); Integer type = 0; if (1 == authState){ @@ -680,9 +710,10 @@ TCompany tCompany = itCompanyService.selectById(objectId); List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDriver.getPhone(), tCompany.getEnterCode()); Long empId = null; + Integer empnew = null; if(null == userInfoByPhone || userInfoByPhone.size() == 0){ SaveStaffNodeRequest request = new SaveStaffNodeRequest(); - request.setMobile(tCompany.getPrincipalPhone()); + request.setMobile(user2.getPhone()); request.setEntercode(tCompany.getEnterCode()); request.setEmpName(tDriver.getName()); request.setEmpNickname(tDriver.getName()); @@ -694,14 +725,21 @@ request.setPositionId(1); request.setSuperLevel(0); request.setHideMobile(0); - SaveStaffNode saveStaffNode = EmployeeUtil.saveStaffNode(request); + ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); + if(200 != resultUtil.getStatus()){ + return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); + } + SaveStaffNode saveStaffNode = resultUtil.getData(); empId = saveStaffNode.getEmpId(); + empnew = 1; }else{ empId = userInfoByPhone.get(0).getEmpId(); + empnew = 0; } tDriver.setEmpId(empId); tDriver.setEntercode(tCompany.getEnterCode()); tDriver.setEnterId(Long.valueOf(tCompany.getEnterCode())); + tDriver.setEmpnew(empnew); } tDriverService.updateById(tDriver); } @@ -733,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)){ @@ -781,13 +827,15 @@ //审核通过,在中台添加司机账号 if (2 == tDriver.getAuthState()) { ShiroUser user = shiroExtUtil.getUser(); + User user2 = userService.selectById(user.getId()); Integer objectId = user.getObjectId(); TCompany tCompany = itCompanyService.selectById(objectId); List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDriver.getPhone(), tCompany.getEnterCode()); Long empId = null; + Integer empnew = null; if(null == userInfoByPhone || userInfoByPhone.size() == 0){ SaveStaffNodeRequest request = new SaveStaffNodeRequest(); - request.setMobile(tCompany.getPrincipalPhone()); + request.setMobile(user2.getPhone()); request.setEntercode(tCompany.getEnterCode()); request.setEmpName(tDriver.getName()); request.setEmpNickname(tDriver.getName()); @@ -799,16 +847,23 @@ request.setPositionId(1); request.setSuperLevel(0); request.setHideMobile(0); - SaveStaffNode saveStaffNode = EmployeeUtil.saveStaffNode(request); + ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); + if(200 != resultUtil.getStatus()){ + return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); + } + SaveStaffNode saveStaffNode = resultUtil.getData(); empId = saveStaffNode.getEmpId(); + empnew = 1; }else{ empId = userInfoByPhone.get(0).getEmpId(); + empnew = 0; } TCompany tCompany1 = itCompanyService.selectById(tDriver.getCompanyId()); tDriver.setEmpId(empId); tDriver.setEntercode(tCompany1.getEnterCode()); tDriver.setEnterId(Long.valueOf(tCompany1.getEnterCode())); + tDriver.setEmpnew(empnew); } tDriverService.insert(tDriver); @@ -861,28 +916,27 @@ driver.setFlag("3"); ShiroUser user = shiroExtUtil.getUser(); TCompany tCompany = itCompanyService.selectById(user.getObjectId()); - if (null != driver.getEmpId()) { + if (null != driver.getEmpId() && 1 == driver.getEmpnew()) { //中台先删除司机 - GetStaffNodeRequest request = new GetStaffNodeRequest(); - request.setEmpId(driver.getEmpId()); - request.setMobile(tCompany.getPrincipalPhone()); - request.setEntercode(tCompany.getEnterCode()); - StaffNodeInfo staffNode = EmployeeUtil.getStaffNode(request); - if (null != staffNode && "1".equals(staffNode.getIsValid())) { + List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(driver.getPhone(), tCompany.getEnterCode()); + if (null != userInfoByPhone && 0 < userInfoByPhone.size() && 1 == driver.getEmpnew()) { DeleteStafNodeRequest deleteStafNodeRequest = new DeleteStafNodeRequest(); deleteStafNodeRequest.setEmpId(driver.getEmpId()); deleteStafNodeRequest.setEntercode(tCompany.getEnterCode()); deleteStafNodeRequest.setMobile(tCompany.getPrincipalPhone()); - EmployeeUtil.ecrmDeleteStafNode(deleteStafNodeRequest); + ResultUtil resultUtil = EmployeeUtil.ecrmDeleteStafNode(deleteStafNodeRequest); + if(200 != resultUtil.getStatus()){ + return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); + } } } tDriverService.updateById(driver); - String value = (String) redisTemplate.opsForValue().get("DRIVER_" + driver.getPhone()); + String value = (String) redisTemplate.opsForValue().get("dache:DRIVER_" + driver.getPhone()); if (ToolUtil.isNotEmpty(value)) { redisTemplate.delete(value); } - redisTemplate.delete("DRIVER_" + driver.getId()); - redisTemplate.delete("DRIVER_" + driver.getPhone()); + redisTemplate.delete("dache:DRIVER_" + driver.getId()); + redisTemplate.delete("dache:DRIVER_" + driver.getPhone()); return SUCCESS_TIP; } /** @@ -916,23 +970,26 @@ } }).start(); - String value = (String) redisTemplate.opsForValue().get("DRIVER_" + tDriver.getPhone()); + String value = (String) redisTemplate.opsForValue().get("dache:DRIVER_" + tDriver.getPhone()); if (ToolUtil.isNotEmpty(value)) { redisTemplate.delete(value); } - redisTemplate.delete("DRIVER_" + tDriver.getId()); - redisTemplate.delete("DRIVER_" + tDriver.getPhone()); + redisTemplate.delete("dache:DRIVER_" + tDriver.getId()); + redisTemplate.delete("dache:DRIVER_" + tDriver.getPhone()); } tDriver.setRemark(remark); //审核通过,在中台添加司机账号 if (2 == tDriver.getAuthState() && tDriver.getEmpId() == null) { + ShiroUser user = shiroExtUtil.getUser(); + User user2 = userService.selectById(user.getId()); Integer objectId = tDriver.getCompanyId(); TCompany tCompany = itCompanyService.selectById(objectId); List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDriver.getPhone(), tCompany.getEnterCode()); Long empId = null; + Integer empnew = null; if(null == userInfoByPhone || userInfoByPhone.size() == 0){ SaveStaffNodeRequest request = new SaveStaffNodeRequest(); - request.setMobile(tCompany.getPrincipalPhone()); + request.setMobile(user2.getPhone()); request.setEntercode(tCompany.getEnterCode()); request.setEmpName(tDriver.getName()); request.setEmpNickname(tDriver.getName()); @@ -944,15 +1001,22 @@ request.setPositionId(1); request.setSuperLevel(0); request.setHideMobile(0); - SaveStaffNode saveStaffNode = EmployeeUtil.saveStaffNode(request); + ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); + if(200 != resultUtil.getStatus()){ + return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); + } + SaveStaffNode saveStaffNode = resultUtil.getData(); empId = saveStaffNode.getEmpId(); + empnew = 1; }else{ empId = userInfoByPhone.get(0).getEmpId(); + empnew = 0; } tDriver.setEmpId(empId); tDriver.setEntercode(tCompany.getEnterCode()); tDriver.setEnterId(Long.valueOf(tCompany.getEnterCode())); + tDriver.setEmpnew(empnew); } tDriverService.updateById(tDriver); @@ -973,6 +1037,13 @@ 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()){ @@ -1057,6 +1128,7 @@ obj.setEmergencyContactAddress(tDriver.getEmergencyContactAddress()); obj.setUpdateTime(new Date()); obj.setUpdateUser(shiroExtUtil.getUser().getId()); + obj.setPlaceOfEmployment(tDriver.getPlaceOfEmployment()); tDriverService.updateAllColumnById(obj); //删除业务 @@ -1126,6 +1198,7 @@ shellList.add("经营业务:跨城出行[是/否]"); shellList.add("登录账号[手机号]"); shellList.add("登录密码[密码长度为6-18]"); + shellList.add("从业地行政编号"); } else if (shiroExtUtil.getUser().getRoleType() == 2) { title = "分公司导入司机模板"; @@ -1143,6 +1216,7 @@ shellList.add("经营业务:跨城出行[是/否]"); shellList.add("登录账号[手机号]"); shellList.add("登录密码[密码长度为6-18]"); + shellList.add("从业地行政编号"); } else if (shiroExtUtil.getUser().getRoleType() == 3) { title = "加盟商导入司机模板"; @@ -1159,6 +1233,7 @@ shellList.add("经营业务:跨城出行[是/否]"); shellList.add("登录账号[手机号]"); shellList.add("登录密码[密码长度为6-18]"); + shellList.add("从业地行政编号"); } dataList.add(shellList); @@ -1178,6 +1253,8 @@ @RequestMapping(value="/exportDriver",method = RequestMethod.POST) @ResponseBody public Object exportDriver(HttpServletRequest request){ + ShiroUser user = shiroExtUtil.getUser(); + User user2 = userService.selectById(user.getId()); MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); try { @@ -1190,103 +1267,245 @@ Cell cell0 = row.getCell(0); //司机名称 String zero = null; if (SinataUtil.isNotEmpty(cell0)) { - zero = String.valueOf(cell0.getStringCellValue()).trim(); + int cellType = cell0.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + zero = cell0.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + zero = String.valueOf((long)cell0.getNumericCellValue()).trim(); + break; + } } Cell cell1 = row.getCell(1); //所属机构[平台司机/加盟司机] String one = null; if (SinataUtil.isNotEmpty(cell1)) { - one = String.valueOf(cell1.getStringCellValue()).trim(); + int cellType = cell1.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + one = cell1.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + one = String.valueOf((long)cell1.getNumericCellValue()).trim(); + break; + } } - + Cell cell2 = row.getCell(2); //所属分公司[提示:加盟司机选填] String two = null; if (SinataUtil.isNotEmpty(cell2)) { - two = String.valueOf(cell2.getStringCellValue()).trim(); + int cellType = cell2.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + two = cell2.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + two = String.valueOf((long)cell2.getNumericCellValue()).trim(); + break; + } } Cell cell3 = row.getCell(3); //所属加盟商[提示:加盟司机选填] String three = null; if (SinataUtil.isNotEmpty(cell3)){ - three = String.valueOf(cell3.getStringCellValue()).trim(); + int cellType = cell3.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + three = cell3.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + three = String.valueOf((long)cell3.getNumericCellValue()).trim(); + break; + } } Cell cell4 = row.getCell(4); //性别[男/女] String four = null; if (SinataUtil.isNotEmpty(cell4)){ - four = String.valueOf(cell4.getStringCellValue()).trim(); + int cellType = cell4.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + four = cell4.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + four = String.valueOf((long)cell4.getNumericCellValue()).trim(); + break; + } } Cell cell5 = row.getCell(5); //驾驶证号码 String five = null; if (SinataUtil.isNotEmpty(cell5)){ - five = String.valueOf(cell5.getStringCellValue()).trim(); + int cellType = cell5.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + five = cell5.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + five = String.valueOf((long)cell5.getNumericCellValue()).trim(); + break; + } } Cell cell6 = row.getCell(6); //驾龄 String six = null; if (SinataUtil.isNotEmpty(cell6)){ - six = String.valueOf(cell6.getStringCellValue()).trim(); + int cellType = cell6.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + six = cell6.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + six = String.valueOf((long)cell6.getNumericCellValue()).trim(); + break; + } } Cell cell7 = row.getCell(7); //身份证号 String seven = null; if (SinataUtil.isNotEmpty(cell7)){ - seven = String.valueOf(cell7.getStringCellValue()).trim(); + int cellType = cell7.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + seven = cell7.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + seven = String.valueOf((long)cell7.getNumericCellValue()).trim(); + break; + } } Cell cell8 = row.getCell(8); //居住地址 String eight = null; if (SinataUtil.isNotEmpty(cell8)){ - eight = String.valueOf(cell8.getStringCellValue()).trim(); + int cellType = cell8.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eight = cell8.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eight = String.valueOf((long)cell8.getNumericCellValue()).trim(); + break; + } } Cell cell9 = row.getCell(9); //出租车资格证号 String nine = null; if (SinataUtil.isNotEmpty(cell9)){ - nine = String.valueOf(cell9.getStringCellValue()).trim(); + int cellType = cell9.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + nine = cell9.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + nine = String.valueOf((long)cell9.getNumericCellValue()).trim(); + break; + } } Cell cell10 = row.getCell(10); //工号[选填] String ten = null; if (SinataUtil.isNotEmpty(cell10)){ - ten = String.valueOf(cell10.getStringCellValue()).trim(); + int cellType = cell10.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + ten = cell10.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + ten = String.valueOf((long)cell10.getNumericCellValue()).trim(); + break; + } } Cell cell11 = row.getCell(11); //经营业务:快车[是/否] String eleven = null; if (SinataUtil.isNotEmpty(cell11)){ - eleven = String.valueOf(cell11.getStringCellValue()).trim(); + int cellType = cell11.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eleven = cell11.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eleven = String.valueOf((long)cell11.getNumericCellValue()).trim(); + break; + } } Cell cell12 = row.getCell(12); //经营业务:快车[是/否] String twelve = null; if (SinataUtil.isNotEmpty(cell12)){ - twelve = String.valueOf(cell12.getStringCellValue()).trim(); + int cellType = cell12.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + twelve = cell12.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + twelve = String.valueOf((long)cell12.getNumericCellValue()).trim(); + break; + } } Cell cell13 = row.getCell(13); //经营业务:跨城出行[是/否] String thirteen = null; if (SinataUtil.isNotEmpty(cell13)){ - thirteen = String.valueOf(cell13.getStringCellValue()).trim(); + int cellType = cell13.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + thirteen = cell13.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + thirteen = String.valueOf((long)cell13.getNumericCellValue()).trim(); + break; + } } Cell cell17 = row.getCell(14); //登录账号[手机号] String seventeen = null; if (SinataUtil.isNotEmpty(cell17)){ - seventeen = String.valueOf(cell17.getStringCellValue()).trim(); + int cellType = cell17.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + seventeen = cell17.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + seventeen = String.valueOf((long)cell17.getNumericCellValue()).trim(); + break; + } } Cell cell18 = row.getCell(15); //登录密码[密码长度为6-18] String eighteen = null; if (SinataUtil.isNotEmpty(cell18)){ - eighteen = String.valueOf(cell18.getStringCellValue()).trim(); + int cellType = cell18.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eighteen = cell18.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eighteen = String.valueOf((long)cell18.getNumericCellValue()).trim(); + break; + } + } + + 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{ //判断账号是否存在 @@ -1294,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, "所属机构内容不正确"); @@ -1326,6 +1548,10 @@ //判断登录密码 if (!isPassword(eighteen)){ return new ErrorTip(500, "登录密码格式不正确"); + } + //从业地行政编号 + if (!isPassword(cell201)){ + return new ErrorTip(500, "从业地行政编号不正确"); } //查找平台公司 @@ -1377,19 +1603,21 @@ 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(); TCompany tCompany = itCompanyService.selectById(objectId); List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(driver.getPhone(), tCompany.getEnterCode()); Long empId = null; + Integer empnew = null; if(null == userInfoByPhone || userInfoByPhone.size() == 0){ SaveStaffNodeRequest saveStaffNodeRequest = new SaveStaffNodeRequest(); - saveStaffNodeRequest.setMobile(tCompany.getPrincipalPhone()); + saveStaffNodeRequest.setMobile(user2.getPhone()); saveStaffNodeRequest.setEntercode(tCompany.getEnterCode()); saveStaffNodeRequest.setEmpName(driver.getName()); saveStaffNodeRequest.setEmpNickname(driver.getName()); @@ -1401,19 +1629,26 @@ saveStaffNodeRequest.setPositionId(1); saveStaffNodeRequest.setSuperLevel(0); saveStaffNodeRequest.setHideMobile(0); - SaveStaffNode saveStaffNode = EmployeeUtil.saveStaffNode(saveStaffNodeRequest); + ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(saveStaffNodeRequest); + if(200 != resultUtil.getStatus()){ + return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); + } + SaveStaffNode saveStaffNode = resultUtil.getData(); empId = saveStaffNode.getEmpId(); + empnew = 1; }else{ 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(); @@ -1442,100 +1677,232 @@ 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)) { - zero = String.valueOf(cell0.getStringCellValue()).trim(); + int cellType = cell0.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + zero = cell0.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + zero = String.valueOf((long)cell0.getNumericCellValue()).trim(); + break; + } } - + Cell cell1 = row.getCell(1); //所属加盟商[选填] String one = null; if (SinataUtil.isNotEmpty(cell1)) { - one = String.valueOf(cell1.getStringCellValue()).trim(); + int cellType = cell1.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + one = cell1.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + one = String.valueOf((long)cell1.getNumericCellValue()).trim(); + break; + } } - + Cell cell2 = row.getCell(2); //性别[男/女] String two = null; if (SinataUtil.isNotEmpty(cell2)) { - two = String.valueOf(cell2.getStringCellValue()).trim(); + int cellType = cell2.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + two = cell2.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + two = String.valueOf((long)cell2.getNumericCellValue()).trim(); + break; + } } Cell cell3 = row.getCell(3); //驾驶证号码 String three = null; if (SinataUtil.isNotEmpty(cell3)){ - three = String.valueOf(cell3.getStringCellValue()).trim(); + int cellType = cell3.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + three = cell3.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + three = String.valueOf((long)cell3.getNumericCellValue()).trim(); + break; + } } Cell cell4 = row.getCell(4); //驾龄 String four = null; if (SinataUtil.isNotEmpty(cell4)){ - four = String.valueOf(cell4.getStringCellValue()).trim(); + int cellType = cell4.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + four = cell4.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + four = String.valueOf((long)cell4.getNumericCellValue()).trim(); + break; + } } Cell cell5 = row.getCell(5); //身份证号 String five = null; if (SinataUtil.isNotEmpty(cell5)){ - five = String.valueOf(cell5.getStringCellValue()).trim(); + int cellType = cell5.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + five = cell5.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + five = String.valueOf((long)cell5.getNumericCellValue()).trim(); + break; + } } Cell cell6 = row.getCell(6); //居住地址 String six = null; if (SinataUtil.isNotEmpty(cell6)){ - six = String.valueOf(cell6.getStringCellValue()).trim(); + int cellType = cell6.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + six = cell6.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + six = String.valueOf((long)cell6.getNumericCellValue()).trim(); + break; + } } Cell cell7 = row.getCell(7); //出租车资格证号 String seven = null; if (SinataUtil.isNotEmpty(cell7)){ - seven = String.valueOf(cell7.getStringCellValue()).trim(); + int cellType = cell7.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + seven = cell7.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + seven = String.valueOf((long)cell7.getNumericCellValue()).trim(); + break; + } } Cell cell8 = row.getCell(8); //工号[选填] String eight = null; if (SinataUtil.isNotEmpty(cell8)){ - eight = String.valueOf(cell8.getStringCellValue()).trim(); + int cellType = cell8.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eight = cell8.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eight = String.valueOf((long)cell8.getNumericCellValue()).trim(); + break; + } } Cell cell9 = row.getCell(9); //经营业务:快车[是/否] String nine = null; if (SinataUtil.isNotEmpty(cell9)){ - nine = String.valueOf(cell9.getStringCellValue()).trim(); + int cellType = cell9.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + nine = cell9.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + nine = String.valueOf((long)cell9.getNumericCellValue()).trim(); + break; + } } Cell cell10 = row.getCell(10); //经营业务:出租车[是/否] String ten = null; if (SinataUtil.isNotEmpty(cell10)){ - ten = String.valueOf(cell10.getStringCellValue()).trim(); + int cellType = cell10.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + ten = cell10.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + ten = String.valueOf((long)cell10.getNumericCellValue()).trim(); + break; + } } Cell cell11 = row.getCell(11); //经营业务:跨城出行[是/否] String eleven = null; if (SinataUtil.isNotEmpty(cell11)){ - eleven = String.valueOf(cell11.getStringCellValue()).trim(); + int cellType = cell11.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eleven = cell11.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eleven = String.valueOf((long)cell11.getNumericCellValue()).trim(); + break; + } } Cell cell15 = row.getCell(12); //登录账号[手机号] String fifteen = null; if (SinataUtil.isNotEmpty(cell15)){ - fifteen = String.valueOf(cell15.getStringCellValue()).trim(); + int cellType = cell15.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + fifteen = cell15.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + fifteen = String.valueOf((long)cell15.getNumericCellValue()).trim(); + break; + } } Cell cell16 = row.getCell(13); //登录密码[密码长度为6-18] String sixteen = null; if (SinataUtil.isNotEmpty(cell16)){ - sixteen = String.valueOf(cell16.getStringCellValue()).trim(); + int cellType = cell16.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + sixteen = cell16.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + sixteen = String.valueOf((long)cell16.getNumericCellValue()).trim(); + 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("女")){ @@ -1565,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; @@ -1575,7 +1948,7 @@ franchiseeId = franchisee.getId(); } } - + TDriver driver = new TDriver(); driver.setAccount(fifteen); driver.setJobNumber(eight); @@ -1601,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(); @@ -1627,7 +2001,7 @@ service.setType(3); itDriverServiceService.insert(service); } - + } } } else if (shiroExtUtil.getUser().getRoleType() == 3) { @@ -1635,94 +2009,217 @@ 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)) { - zero = String.valueOf(cell0.getStringCellValue()).trim(); + int cellType = cell0.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + zero = cell0.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + zero = String.valueOf((long)cell0.getNumericCellValue()).trim(); + break; + } } - + Cell cell2 = row.getCell(1); //性别[男/女] String one = null; if (SinataUtil.isNotEmpty(cell2)) { - one = String.valueOf(cell2.getStringCellValue()).trim(); + int cellType = cell2.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + one = cell2.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + one = String.valueOf((long)cell2.getNumericCellValue()).trim(); + break; + } } - + Cell cell3 = row.getCell(2); //驾驶证号码 String two = null; if (SinataUtil.isNotEmpty(cell3)) { - two = String.valueOf(cell3.getStringCellValue()).trim(); + int cellType = cell3.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + two = cell3.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + two = String.valueOf((long)cell3.getNumericCellValue()).trim(); + break; + } } Cell cell4 = row.getCell(3); //驾龄 String three = null; if (SinataUtil.isNotEmpty(cell4)){ - three = String.valueOf(cell4.getStringCellValue()).trim(); + int cellType = cell4.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + three = cell4.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + three = String.valueOf((long)cell4.getNumericCellValue()).trim(); + break; + } } Cell cell5 = row.getCell(4); //身份证号 String four = null; if (SinataUtil.isNotEmpty(cell5)){ - four = String.valueOf(cell5.getStringCellValue()).trim(); + int cellType = cell5.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + four = cell5.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + four = String.valueOf((long)cell5.getNumericCellValue()).trim(); + break; + } } Cell cell6 = row.getCell(5); //居住地址 String five = null; if (SinataUtil.isNotEmpty(cell6)){ - five = String.valueOf(cell6.getStringCellValue()).trim(); + int cellType = cell6.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + five = cell6.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + five = String.valueOf((long)cell6.getNumericCellValue()).trim(); + break; + } } Cell cell7 = row.getCell(6); //出租车资格证号 String six = null; if (SinataUtil.isNotEmpty(cell7)){ - six = String.valueOf(cell7.getStringCellValue()).trim(); + int cellType = cell7.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + six = cell7.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + six = String.valueOf((long)cell7.getNumericCellValue()).trim(); + break; + } } Cell cell8 = row.getCell(7); //工号[选填] String seven = null; if (SinataUtil.isNotEmpty(cell8)){ - seven = String.valueOf(cell8.getStringCellValue()).trim(); + int cellType = cell8.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + seven = cell8.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + seven = String.valueOf((long)cell8.getNumericCellValue()).trim(); + break; + } } Cell cell9 = row.getCell(8); //经营业务:快车[是/否] String eight = null; if (SinataUtil.isNotEmpty(cell9)){ - eight = String.valueOf(cell9.getStringCellValue()).trim(); + int cellType = cell9.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + eight = cell9.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + eight = String.valueOf((long)cell9.getNumericCellValue()).trim(); + break; + } } Cell cell10 = row.getCell(9); //经营业务:出租车[是/否] String nine = null; if (SinataUtil.isNotEmpty(cell10)){ - nine = String.valueOf(cell10.getStringCellValue()).trim(); + int cellType = cell10.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + nine = cell10.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + nine = String.valueOf((long)cell10.getNumericCellValue()).trim(); + break; + } } Cell cell11 = row.getCell(10); //经营业务:跨城出行[是/否] String ten = null; if (SinataUtil.isNotEmpty(cell11)){ - ten = String.valueOf(cell11.getStringCellValue()).trim(); + int cellType = cell11.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + ten = cell11.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + ten = String.valueOf((long)cell11.getNumericCellValue()).trim(); + break; + } } Cell cell15 = row.getCell(11); //登录账号[手机号] String fourteen = null; if (SinataUtil.isNotEmpty(cell15)){ - fourteen = String.valueOf(cell15.getStringCellValue()).trim(); + int cellType = cell15.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + fourteen = cell15.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + fourteen = String.valueOf((long)cell15.getNumericCellValue()).trim(); + break; + } } Cell cell16 = row.getCell(12); //登录密码[密码长度为6-18] String fifteen = null; if (SinataUtil.isNotEmpty(cell16)){ - fifteen = String.valueOf(cell16.getStringCellValue()).trim(); + int cellType = cell16.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: + fifteen = cell16.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + fifteen = String.valueOf((long)cell16.getNumericCellValue()).trim(); + 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("女")){ @@ -1789,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); } @@ -1875,8 +2373,21 @@ * 导出司机信息 */ @RequestMapping(value = "/outDriver") - public void outDriver(HttpServletRequest request, HttpServletResponse response) { - List<Map<String, Object>> listMap = tDriverService.getDriverListNoPage(shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId()); + public void outDriver(String insertTime, + String companyName, + String phone, + String name, + Integer addType, + Integer authState, HttpServletRequest request, HttpServletResponse response) { + String beginTime = null; + String endTime = null; + if (SinataUtil.isNotEmpty(insertTime)){ + String[] timeArray = insertTime.split(" - "); + beginTime = timeArray[0]; + endTime = timeArray[1]; + } + Page<Map<String, Object>> page = new Page<>(0, 10000); + List<Map<String, Object>> listMap = tDriverService.getDriverList(page, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), beginTime, endTime, companyName, phone, name, addType, authState); // 表格数据【封装】 List<List<String>> dataList = new ArrayList<>(); @@ -1927,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