From 651f8e426aa57ec5ebcdfddf840a21449dff4269 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期一, 20 二月 2023 18:06:43 +0800 Subject: [PATCH] 代理商管理,司机管理部分 --- management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java | 1849 ---------------------------------------------------------- 1 files changed, 30 insertions(+), 1,819 deletions(-) diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java index 55adaa4..04dc568 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java @@ -1,50 +1,23 @@ package com.stylefeng.guns.modular.system.controller.general; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; -import com.stylefeng.guns.core.base.tips.ErrorTip; -import com.stylefeng.guns.core.common.constant.factory.PageFactory; -import com.stylefeng.guns.core.shiro.ShiroKit; -import com.stylefeng.guns.core.util.*; -import com.stylefeng.guns.modular.system.dao.DriverPunishMapper; -import com.stylefeng.guns.modular.system.dao.DriverTrainMapper; -import com.stylefeng.guns.modular.system.model.*; -import com.stylefeng.guns.modular.system.service.*; -import com.stylefeng.guns.modular.system.util.HttpRequestUtil; -import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; -import com.stylefeng.guns.modular.system.util.PushURL; -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.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.beans.factory.annotation.Autowired; import com.stylefeng.guns.core.log.LogObjectHolder; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; +import org.springframework.web.bind.annotation.RequestParam; +import com.stylefeng.guns.modular.system.model.TDriver; +import com.stylefeng.guns.modular.system.service.ITDriverService; /** - * 司机审核列表控制器 + * 控制器 * * @author fengshuonan - * @Date 2020-06-04 17:35:28 + * @Date 2023-02-20 09:07:06 */ @Controller @RequestMapping("/tDriver") @@ -55,34 +28,8 @@ @Autowired private ITDriverService tDriverService; - @Autowired - private ITCompanyService tCompanyService; - - @Autowired - private ITDriverServiceService tDriverServiceService; - - @Autowired - private ITDriverLineService tDriverLineService; - - @Autowired - private ITLineService itLineService; - - @Autowired - private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; - - @Resource - private DriverTrainMapper driverTrainMapper; - - @Resource - private DriverPunishMapper driverPunishMapper; - - @Value("${pushMinistryOfTransport}") - private boolean pushMinistryOfTransport; - - - /** - * 跳转到司机审核列表首页 + * 跳转到首页 */ @RequestMapping("") public String index() { @@ -90,1815 +37,79 @@ } /** - * 跳转到审核通过司机首页 - */ - @RequestMapping("/yesDriver") - public String yesDriver() { - return PREFIX + "yesDriver.html"; - } - - /** - * 跳转到添加司机 + * 跳转到添加 */ @RequestMapping("/tDriver_add") - public String tDriverAdd(Model model) { - List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); - model.addAttribute("companyList",companyList); - - Integer roleType = ShiroKit.getUser().getRoleType(); - model.addAttribute("roleType",roleType); - if (2 == roleType){ - List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>() - .eq("type", 3) - .eq("superiorId",ShiroKit.getUser().getObjectId()) - .notIn("state",1) - .notIn("flag",3)); - model.addAttribute("franchiseeList",franchiseeList); - }else{ - model.addAttribute("franchiseeList",null); - } - //查询当前用户所属分公司/加盟商 - model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); - - //查询线路列表 - List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1)); - model.addAttribute("lineList",lineList); + public String tDriverAdd() { return PREFIX + "tDriver_add.html"; } /** - * 跳转到修改审核司机 - */ - @RequestMapping("/tDriver_immediately/{tDriverId}") - public String tDriver_immediately(@PathVariable Integer tDriverId, Model model) { - Map<String, Object> tDriver = tDriverService.getDriverById(tDriverId); - model.addAttribute("item",tDriver); - LogObjectHolder.me().set(tDriver); - return PREFIX + "tDriver_immediately.html"; - } - - /** - * 跳转到选择车辆页面 - */ - @RequestMapping("/tDriver_changeCar/{tDriverId}") - public String tDriver_changeCar(@PathVariable Integer tDriverId, Model model) { - model.addAttribute("tDriverId",tDriverId); - return PREFIX + "tDriver_changeCar.html"; - } - - /** - * 跳转到冻结/解冻司机页面 - */ - @RequestMapping("/tDriver_optDriver/{tDriverId}/{optType}") - public String tDriver_optDriver(@PathVariable Integer tDriverId,@PathVariable Integer optType, Model model) { - model.addAttribute("tDriverId",tDriverId); - model.addAttribute("optType",optType); - return PREFIX + "tDriver_optDriver.html"; - } - - /** - * 跳转到查看司机详情 - */ - @RequestMapping("/tDriver_look/{tDriverId}") - public String tDriver_look(@PathVariable Integer tDriverId, Model model) { - Map<String, Object> tDriver = tDriverService.getDriverById(tDriverId); - model.addAttribute("item",tDriver); - LogObjectHolder.me().set(tDriver); - return PREFIX + "tDriver_look.html"; - } - - /** - * 跳转到修改司机 + * 跳转到修改 */ @RequestMapping("/tDriver_update/{tDriverId}") public String tDriverUpdate(@PathVariable Integer tDriverId, Model model) { TDriver tDriver = tDriverService.selectById(tDriverId); model.addAttribute("item",tDriver); LogObjectHolder.me().set(tDriver); - - Integer roleType = ShiroKit.getUser().getRoleType(); - model.addAttribute("roleType",roleType); - model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); - - if (1 == roleType){ - List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); - model.addAttribute("companyList",companyList); - List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tDriver.getCompanyId())); - model.addAttribute("franchiseeList",franchiseeList); - }else if (2 == roleType){ - List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); - model.addAttribute("franchiseeList",franchiseeList); - } - - //查询平台ID - TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); - //判断是平台司机还是加盟司机 - if ((SinataUtil.isEmpty(tDriver.getCompanyId()) || tDriver.getCompanyId() == 0 || tDriver.getCompanyId() == company.getId()) && (SinataUtil.isEmpty(tDriver.getFranchiseeId()) || tDriver.getFranchiseeId() == 0)){ - model.addAttribute("companyType",1); - }else{ - model.addAttribute("companyType",2); - } - - //获取经营业务 - List<TDriverService> serviceList = tDriverServiceService.selectList(new EntityWrapper<TDriverService>().eq("driverId", tDriverId)); - Integer one = 1; - Integer two = 1; - Integer three = 1; - Integer four = 1; - Integer five = 1; - Integer six = 1; - for (TDriverService obj : serviceList){ - if (obj.getType() == 1){ - one = 2; - } - if (obj.getType() == 2){ - two = 2; - } - if (obj.getType() == 3){ - three = 2; - } - if (obj.getType() == 4){ - four = 2; - } - if (obj.getType() == 5){ - five = 2; - } - if (obj.getType() == 6){ - six = 2; - } - } - model.addAttribute("one",one); - model.addAttribute("two",two); - model.addAttribute("three",three); - model.addAttribute("four",four); - model.addAttribute("five",five); - model.addAttribute("six",six); - - //查询线路列表 - List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1)); - model.addAttribute("lineList",lineList); - //查询驾驶员已添加的线路列表 - List<Map<String, Object>> driverLineList = tDriverLineService.getDriverLineListByDriverId(tDriverId); - model.addAttribute("driverLineList",driverLineList); return PREFIX + "tDriver_edit.html"; } /** - * 跳转到添加培训页 - * @param id - * @param model - * @return - */ - @RequestMapping("/showTraining") - public String showTraining(Integer id, Model model){ - model.addAttribute("id", id); - return PREFIX + "training.html"; - } - - - /** - * 保存培训数据 - * @param train - * @param driverId - * @return - */ - @ResponseBody - @RequestMapping(value = "/saveTrain", method = RequestMethod.POST) - public ResultUtil saveTrain(String train, Integer driverId){ - if(ToolUtil.isEmpty(train)){ - return ResultUtil.error("请添加有效的培训记录"); - } - String[] split = train.split(","); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - List<DriverTrain> update = new ArrayList<>(); - List<DriverTrain> add = new ArrayList<>(); - for(String s : split){ - String[] s1 = s.split("_"); - if(ToolUtil.isNotEmpty(s1[0])){//修改 - DriverTrain driverTrain = driverTrainMapper.selectById(s1[0]); - driverTrain.setDriverId(driverId); - driverTrain.setCourseName(s1[1]); - driverTrain.setCourseDate(sdf.parse(s1[2])); - driverTrain.setStartTime(s1[3]); - driverTrain.setStopTime(s1[4]); - driverTrain.setDuration(Integer.valueOf(s1[5])); - update.add(driverTrain); - }else{//添加 - DriverTrain driverTrain = new DriverTrain(); - driverTrain.setDriverId(driverId); - driverTrain.setCourseName(s1[1]); - driverTrain.setCourseDate(sdf.parse(s1[2])); - driverTrain.setStartTime(s1[3]); - driverTrain.setStopTime(s1[4]); - driverTrain.setDuration(Integer.valueOf(s1[5])); - add.add(driverTrain); - } - } - List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); - for(DriverTrain driverTrain : driverTrains){ - boolean b = true; - for(String s : split){ - String[] s1 = s.split("_"); - if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ - b = false; - break; - } - } - if(b){ - driverTrainMapper.deleteById(driverTrain.getId()); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 3); - } - } - }).start(); - } - } - if(update.size() > 0){ - for(DriverTrain driverTrain : update){ - driverTrainMapper.updateById(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 2); - } - } - }).start(); - } - } - if(add.size() > 0){ - for(DriverTrain driverTrain : add){ - driverTrainMapper.insert(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 1); - } - } - }).start(); - } - } - - }catch (Exception e){ - e.printStackTrace(); - return ResultUtil.runErr(); - } - return ResultUtil.success(); - } - - /** - * 获取司机的所有培训数据 - * @param driverId - * @return - */ - @ResponseBody - @RequestMapping(value = "/queryAllTrain", method = RequestMethod.POST) - public ResultUtil queryAllTrain(Integer driverId){ - List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); - return ResultUtil.success(driverTrains); - } - - - /** - * 跳转到处罚页 - * @param id - * @param model - * @return - */ - @RequestMapping("/showPunish") - public String showPunish(Integer id, Model model){ - model.addAttribute("id", id); - return PREFIX + "punish.html"; - } - - - /** - * 保存处罚数据 - * @param punish - * @param driverId - * @return - */ - @ResponseBody - @RequestMapping(value = "/savePunish", method = RequestMethod.POST) - public ResultUtil savePunish(String punish, Integer driverId){ - if(ToolUtil.isEmpty(punish)){ - return ResultUtil.error("请添加有效的培训记录"); - } - String[] split = punish.split(","); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - List<DriverPunish> update = new ArrayList<>(); - List<DriverPunish> add = new ArrayList<>(); - for(String s : split){ - String[] s1 = s.split("_"); - if(ToolUtil.isNotEmpty(s1[0])){//修改 - DriverPunish driverPunish = driverPunishMapper.selectById(s1[0]); - driverPunish.setDriverId(driverId); - driverPunish.setPunishTime(sdf.parse(s1[1])); - driverPunish.setPunishReason(s1[2]); - driverPunish.setPunishReault(s1[3]); - update.add(driverPunish); - }else{//添加 - DriverPunish driverPunish = new DriverPunish(); - driverPunish.setDriverId(driverId); - driverPunish.setPunishTime(sdf.parse(s1[1])); - driverPunish.setPunishReason(s1[2]); - driverPunish.setPunishReault(s1[3]); - add.add(driverPunish); - } - } - List<DriverPunish> driverPunishes = driverPunishMapper.queryAllPunish(driverId); - for(DriverPunish driverTrain : driverPunishes){ - boolean b = true; - for(String s : split){ - String[] s1 = s.split("_"); - if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ - b = false; - break; - } - } - if(b){ - driverTrainMapper.deleteById(driverTrain.getId()); - } - } - if(update.size() > 0){ - for(DriverPunish driverTrain : update){ - driverPunishMapper.updateById(driverTrain); - } - } - if(add.size() > 0){ - for(DriverPunish driverTrain : add){ - driverPunishMapper.insert(driverTrain); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.ratedDriverPunish(driverTrain.getId()); - } - } - }).start(); - } - } - - }catch (Exception e){ - e.printStackTrace(); - return ResultUtil.runErr(); - } - return ResultUtil.success(); - } - - - /** - * 获取所有处罚数据 - * @param driverId - * @return - */ - @ResponseBody - @RequestMapping(value = "/queryAllPunish", method = RequestMethod.POST) - public ResultUtil queryAllPunish(Integer driverId){ - List<DriverPunish> driverPunishes = driverPunishMapper.queryAllPunish(driverId); - return ResultUtil.success(driverPunishes); - } - - - /** - * 根据分公司ID获取加盟商 - * @param oneId - * @return - */ - @RequestMapping(value = "/oneChange") - @ResponseBody - public Object oneChange(@RequestParam Integer oneId) { - List<TCompany> list = new ArrayList<>(); - if (SinataUtil.isNotEmpty(oneId)){ - list = tCompanyService.selectList(new EntityWrapper<TCompany>() - .eq("type", 3) - .eq("superiorId", oneId) - .notIn("flag",3) - .notIn("state",1)); - } - return list; - } - - /** - * 获取司机审核列表列表 + * 获取列表 */ @RequestMapping(value = "/list") @ResponseBody - public Object list(String insertTime, - String companyName, - String phone, - String account, - Integer addType, - Integer authState) { - 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 PageFactory<Map<String, Object>>().defaultPage(); - if (ShiroKit.getUser().getRoleType() != 1){ - page.setRecords(null); - }else{ - page.setRecords(tDriverService.getAuthDriverList(page,beginTime,endTime,companyName,phone,account,addType,authState)); - } - return super.packForBT(page); + public Object list(String createTime,String phone,Integer status) { + EntityWrapper<TDriver> wrapper = tDriverService.getPageList(createTime,phone,status); + return tDriverService.selectList(wrapper); } /** - * 获取审核通过的司机列表 + * 获取列表 */ - @RequestMapping(value = "/listYesDriver") + @RequestMapping(value = "/list-back") @ResponseBody - public Object listYesDriver(String insertTime, - String companyName, - String phone, - String name, - Integer addType, - Integer authState) { - 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 PageFactory<Map<String, Object>>().defaultPage(); - page.setRecords(tDriverService.getDriverList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,companyName,phone,name,addType,authState)); - return super.packForBT(page); + public Object listBack(String condition) { + return tDriverService.selectList(null); } /** - * 获取可被选择的车辆列表 - */ - @RequestMapping(value = "/selectCarList/{tDriverId}") - @ResponseBody - public Object selectCarList(@PathVariable Integer tDriverId, - String carLicensePlate, - String brandName, - String modelName, - String color, - String serverStr) { - TDriver driver = tDriverService.selectById(tDriverId); - /*String useCarIdStr = null; - //查询已被使用的车辆ID - if (SinataUtil.isNotEmpty(driver.getCarId())){ - useCarIdStr = tDriverService.getUseCarIdStr(driver.getCarId()); - }else{ - useCarIdStr = tDriverService.getUseCarIdStr(null); - }*/ - //2020-08-21:新需求,已被绑定的车辆可以被继续绑定 - Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); - page.setRecords(tDriverService.getCanSelectCarList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),null,carLicensePlate,brandName,modelName,color,serverStr)); - return super.packForBT(page); - - } - - /** - * 审核操作 1=通过 2=不通过 - */ - @RequestMapping(value = "/authOpt") - @ResponseBody - public Object authOpt(Integer id,Integer authState) { - if (SinataUtil.isNotEmpty(id) && SinataUtil.isNotEmpty(authState)){ - TDriver tDriver = tDriverService.selectById(id); - Integer type = 0; - if (1 == authState){ - type = 5; - tDriver.setAuthState(2); - - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(id); - pushMinistryOfTransportUtil.baseInfoDriverApp(id); - } - } - }).start(); - }else{ - type = 6; - tDriver.setAuthState(4); - } - - Map<String,String> map = new HashMap<>(); - map.put("uid", String.valueOf(tDriver.getId())); - map.put("type", String.valueOf(type)); - String result = HttpRequestUtil.postRequest(PushURL.driver_auth_url, map); - System.out.println("司机注册审核发送短信 :【driverId="+tDriver.getId().toString()+"】,调用接口:"+result); - - tDriverService.updateById(tDriver); - } - return SUCCESS_TIP; - } - - /** - * 更换车辆操作 - */ - @RequestMapping(value = "/selectCarOpt") - @ResponseBody - public Object selectCarOpt(Integer tDriverId,Integer carId) { - if (SinataUtil.isNotEmpty(tDriverId) && SinataUtil.isNotEmpty(carId)){ - TDriver tDriver = tDriverService.selectById(tDriverId); - tDriver.setCarId(carId); - tDriverService.updateById(tDriver); - } - return SUCCESS_TIP; - } - - /** - * 新增司机审核列表 + * 新增 */ @RequestMapping(value = "/add") @ResponseBody - public Object add(TDriver tDriver,@RequestParam String serverBox,@RequestParam String lineStr,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId) { - //判断登录账户是否重复 - int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone()).in("authState", "1,2,3").ne("flag", 3)); - if (count > 0){ - return "error"; - } - if (1 == roleType){ //平台 - if (2 == companyType.intValue()){ - if (SinataUtil.isNotEmpty(oneId)){ - tDriver.setCompanyId(oneId); - } - if (SinataUtil.isNotEmpty(twoId)){ - tDriver.setFranchiseeId(twoId); - } - }else if (1 == companyType.intValue()){ - TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); - tDriver.setCompanyId(company.getId()); - tDriver.setFranchiseeId(franchiseeId); - } - tDriver.setAddType(2); - tDriver.setIsPlatCar(1); - tDriver.setAuthState(2); - }else if (2 == roleType){ //分公司 - if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ - tDriver.setCompanyId(ShiroKit.getUser().getObjectId()); - } - if (SinataUtil.isNotEmpty(franchiseeId)){ - tDriver.setFranchiseeId(franchiseeId); - } - tDriver.setAddType(3); - tDriver.setIsPlatCar(2); - tDriver.setAuthState(1); - tDriver.setAddObjectId(ShiroKit.getUser().getObjectId()); - }else if (3 == roleType){ //加盟商 - TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); - if (SinataUtil.isNotEmpty(tCompany)){ - tDriver.setCompanyId(tCompany.getSuperiorId()); - } - if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ - tDriver.setFranchiseeId(ShiroKit.getUser().getObjectId()); - } - tDriver.setAddType(4); - tDriver.setIsPlatCar(2); - tDriver.setAuthState(1); - tDriver.setAddObjectId(ShiroKit.getUser().getObjectId()); - } - tDriver.setInsertTime(new Date()); - tDriver.setInsertUser(ShiroKit.getUser().getId()); -// tDriver.setPassword(MD5Util.encrypt(tDriver.getPassword())); - - tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#")); - + public Object add(TDriver tDriver) { tDriverService.insert(tDriver); - - //添加经营业务 - String[] serverArray = serverBox.split(","); - for (int i=0;i<serverArray.length;i++){ - TDriverService service = new TDriverService(); - service.setDriverId(tDriver.getId()); - service.setType(Integer.valueOf(serverArray[i])); - tDriverServiceService.insert(service); - - if (3 == Integer.valueOf(serverArray[i])){ - //添加线路 - if (SinataUtil.isNotEmpty(lineStr)){ - addLine(lineStr,tDriver.getId()); - } - } - } - return SUCCESS_TIP; } /** - * 添加线路 - * @param subArr - * @param id - */ - public void addLine(String subArr,Integer id){ - JSONArray jsonArray = JSON.parseArray(subArr); - int size = jsonArray.size(); - for (int i = 0; i < size; i++){ - JSONObject jsonObject = jsonArray.getJSONObject(i); - TDriverLine line = new TDriverLine(); - line.setCreateTime(new Date()); - line.setAddTime(jsonObject.getString("time")); - line.setLineId(jsonObject.getInteger("lineId")); - line.setDriverId(id); - tDriverLineService.insert(line); - } - } - - - /** - * 删除司机审核列表 + * 删除 */ @RequestMapping(value = "/delete") @ResponseBody public Object delete(@RequestParam Integer tDriverId) { - TDriver driver = tDriverService.selectById(tDriverId); - driver.setFlag("3"); - tDriverService.updateById(driver); - return SUCCESS_TIP; - } - /** - * 操作司机状态 - */ - @RequestMapping(value = "/optDriver") - @ResponseBody - public Object optDriver(@RequestParam Integer driverId,@RequestParam String remark,@RequestParam Integer optType) { - if (SinataUtil.isNotEmpty(driverId) && SinataUtil.isNotEmpty(optType)){ - TDriver tDriver = tDriverService.selectById(driverId); - if (1 == optType){ //解冻 - tDriver.setAuthState(2); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(driverId); - } - } - }).start(); - }else if (2 == optType){ //冻结 - tDriver.setAuthState(3); - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoCompanyStat(); - pushMinistryOfTransportUtil.baseInfoDriver(driverId); - } - } - }).start(); - } - tDriver.setRemark(remark); - tDriverService.updateById(tDriver); - } + tDriverService.deleteById(tDriverId); return SUCCESS_TIP; } /** - * 修改司机审核列表 + * 修改 */ @RequestMapping(value = "/update") @ResponseBody - public Object update(TDriver tDriver,@RequestParam String serverBox,@RequestParam String lineStr,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId) { - TDriver obj = tDriverService.selectById(tDriver.getId()); - if (!obj.getPhone().equals(tDriver.getPhone())){ - //判断登录账户是否重复 - int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone()).in("authState", "1,2,3")); - if (count > 0){ - return "error"; - } - } - if (1 == roleType){ //平台 - if (2 == companyType.intValue()){ - if (SinataUtil.isNotEmpty(oneId)){ - tDriver.setCompanyId(oneId); - } - if (SinataUtil.isNotEmpty(twoId)){ - tDriver.setFranchiseeId(twoId); - } - }else if (1 == companyType.intValue()){ - TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); - tDriver.setCompanyId(company.getId()); - tDriver.setFranchiseeId(franchiseeId); - } - }else if (2 == roleType){ //分公司 - if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ - tDriver.setCompanyId(ShiroKit.getUser().getObjectId()); - } - if (SinataUtil.isNotEmpty(franchiseeId)){ - tDriver.setFranchiseeId(franchiseeId); - } - }else if (3 == roleType){ //加盟商 - TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); - if (SinataUtil.isNotEmpty(tCompany)){ - tDriver.setCompanyId(tCompany.getSuperiorId()); - } - if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ - tDriver.setFranchiseeId(ShiroKit.getUser().getObjectId()); - } - } - tDriver.setUpdateTime(new Date()); - tDriver.setUpdateUser(ShiroKit.getUser().getId()); -// tDriver.setPassword(MD5Util.encrypt(tDriver.getPassword())); - tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#")); + public Object update(TDriver tDriver) { tDriverService.updateById(tDriver); - - //删除业务 - tDriverServiceService.delete(new EntityWrapper<TDriverService>().eq("driverId",tDriver.getId())); - - //删除线路 - tDriverLineService.delete(new EntityWrapper<TDriverLine>().eq("driverId",tDriver.getId())); - - //添加经营业务 - String[] serverArray = serverBox.split(","); - for (int i=0;i<serverArray.length;i++){ - TDriverService service = new TDriverService(); - service.setDriverId(tDriver.getId()); - service.setType(Integer.valueOf(serverArray[i])); - tDriverServiceService.insert(service); - - if (3 == Integer.valueOf(serverArray[i])){ - //添加线路 - if (SinataUtil.isNotEmpty(lineStr)){ - addLine(lineStr,tDriver.getId()); - } - } - } - - new Thread(new Runnable() { - @Override - public void run() { - if(pushMinistryOfTransport){//上传数据 - pushMinistryOfTransportUtil.baseInfoDriver(tDriver.getId()); - } - } - }).start(); - return SUCCESS_TIP; } /** - * 下载模板 - * @param request - * @param response + * 详情 */ - @RequestMapping(value = "/uploadDriverModel") - public void uploadDriverModel(HttpServletRequest request, HttpServletResponse response) { - // 表格数据【封装】 - List<List<String>> dataList = new ArrayList<List<String>>(); - - String title = ""; - - // 首行【封装】 - List<String> shellList = new ArrayList<String>(); - if (ShiroKit.getUser().getRoleType() == 1){ - title = "平台导入司机模板"; - - 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("登录密码[密码长度为6-18]"); - }else if (ShiroKit.getUser().getRoleType() == 2){ - title = "分公司导入司机模板"; - - 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("登录密码[密码长度为6-18]"); - }else if (ShiroKit.getUser().getRoleType() == 3){ - title = "加盟商导入司机模板"; - - 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("登录密码[密码长度为6-18]"); - } - dataList.add(shellList); - - try { - // 调用工具类进行导出 - ExcelExportUtil.easySheet(title+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), title, dataList, request, response); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 导入操作 - * @param request - * @return - */ - @RequestMapping(value="/exportDriver",method = RequestMethod.POST) + @RequestMapping(value = "/detail/{tDriverId}") @ResponseBody - public Object exportDriver(HttpServletRequest request){ - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); - try { - if (ShiroKit.getUser().getRoleType() == 1){ - Workbook book = WoUtil.ImportFile(file); - 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(); - } - - Cell cell1 = row.getCell(1); //所属机构[平台司机/加盟司机] - String one = null; - if (SinataUtil.isNotEmpty(cell1)){ - one = String.valueOf(cell1.getStringCellValue()).trim(); - } - - Cell cell2 = row.getCell(2); //所属分公司[提示:加盟司机选填] - String two = null; - if (SinataUtil.isNotEmpty(cell2)){ - two = String.valueOf(cell2.getStringCellValue()).trim(); - } - - Cell cell3 = row.getCell(3); //所属加盟商[提示:加盟司机选填] - String three = null; - if (SinataUtil.isNotEmpty(cell3)){ - 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 cell5 = row.getCell(5); //驾驶证号码 - String five = null; - if (SinataUtil.isNotEmpty(cell5)){ - five = String.valueOf(cell5.getStringCellValue()).trim(); - } - - Cell cell6 = row.getCell(6); //驾龄 - 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 cell8 = row.getCell(8); //居住地址 - String eight = null; - if (SinataUtil.isNotEmpty(cell8)){ - eight = String.valueOf(cell8.getStringCellValue()).trim(); - } - - Cell cell9 = row.getCell(9); //出租车资格证号 - String nine = null; - if (SinataUtil.isNotEmpty(cell9)){ - nine = String.valueOf(cell9.getStringCellValue()).trim(); - } - - Cell cell10 = row.getCell(10); //工号[选填] - String ten = null; - if (SinataUtil.isNotEmpty(cell10)){ - ten = String.valueOf(cell10.getStringCellValue()).trim(); - } - - Cell cell11 = row.getCell(11); //经营业务:专车[是/否] - String eleven = null; - if (SinataUtil.isNotEmpty(cell11)){ - eleven = String.valueOf(cell11.getStringCellValue()).trim(); - } - - Cell cell12 = row.getCell(12); //经营业务:专车[是/否] - String twelve = null; - if (SinataUtil.isNotEmpty(cell12)){ - twelve = String.valueOf(cell12.getStringCellValue()).trim(); - } - - Cell cell13 = row.getCell(13); //经营业务:跨城出行[是/否] - String thirteen = null; - if (SinataUtil.isNotEmpty(cell13)){ - thirteen = String.valueOf(cell13.getStringCellValue()).trim(); - } - - Cell cell14 = row.getCell(14); //经营业务:小件同城物流[是/否] - String fourteen = null; - if (SinataUtil.isNotEmpty(cell14)){ - fourteen = String.valueOf(cell14.getStringCellValue()).trim(); - } - - Cell cell15 = row.getCell(15); //经营业务:小件跨城物流[是/否] - String fifteen = null; - if (SinataUtil.isNotEmpty(cell15)){ - fifteen = String.valueOf(cell15.getStringCellValue()).trim(); - } - - Cell cell16 = row.getCell(16); //经营业务:包车[是/否] - String sixteen = null; - if (SinataUtil.isNotEmpty(cell16)){ - sixteen = String.valueOf(cell16.getStringCellValue()).trim(); - } - - Cell cell17 = row.getCell(17); //登录账号[手机号] - String seventeen = null; - if (SinataUtil.isNotEmpty(cell17)){ - seventeen = String.valueOf(cell17.getStringCellValue()).trim(); - } - - Cell cell18 = row.getCell(18); //登录密码[密码长度为6-18] - String eighteen = null; - if (SinataUtil.isNotEmpty(cell18)){ - eighteen = String.valueOf(cell18.getStringCellValue()).trim(); - } - - 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(fourteen) || SinataUtil.isEmpty(fifteen) || SinataUtil.isEmpty(sixteen) - || SinataUtil.isEmpty(seventeen)|| SinataUtil.isEmpty(eighteen)){ - return new ErrorTip(500, "单元格不能为空"); - }else{ - //判断账号是否存在 - int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", seventeen).in("authState", "1,2,3").ne("flag", 3)); - if (count > 0){ - continue; - } - - //判断所属机构 - if (!one.equals("平台司机") && !one.equals("加盟司机")){ - return new ErrorTip(500, "所属机构内容不正确"); - } - //判断性别 - if (!four.equals("男") && !four.equals("女")){ - return new ErrorTip(500, "性别内容不正确"); - } - //判断经营业务【专车】 - if (!eleven.equals("是") && !eleven.equals("否")){ - return new ErrorTip(500, "经营业务【专车】内容不正确"); - } - //判断经营业务【出租车】 - if (!twelve.equals("是") && !twelve.equals("否")){ - return new ErrorTip(500, "经营业务【出租车】内容不正确"); - } - //判断经营业务【跨城出行】 - if (!thirteen.equals("是") && !thirteen.equals("否")){ - return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); - } - //判断经营业务【小件同城物流】 - if (!fourteen.equals("是") && !fourteen.equals("否")){ - return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); - } - //判断经营业务【小件跨城物流】 - if (!fifteen.equals("是") && !fifteen.equals("否")){ - return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); - } - //判断经营业务【包车】 - if (!sixteen.equals("是") && !sixteen.equals("否")){ - return new ErrorTip(500, "经营业务【包车】内容不正确"); - } - //判断驾龄 - if (!isInteger(six)){ - return new ErrorTip(500, "驾龄格式不正确"); - } - //判断手机号 - if (!isPhone(seventeen)){ - return new ErrorTip(500, "登录账号[手机号]格式不正确"); - } - //判断登录密码 - if (!isPassword(eighteen)){ - return new ErrorTip(500, "登录密码格式不正确"); - } - - //查找平台公司 - TCompany platCompany = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).notIn("flag", "3").last(" limit 1")); - Integer companyId = platCompany.getId(); - Integer franchiseeId = 0; - if ("加盟司机".equals(one)){ - //判断所属分公司是否存在 - if (SinataUtil.isNotEmpty(two)){ - TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("name", two).eq("type", 2).notIn("flag", "3").last(" limit 1")); - if (SinataUtil.isNotEmpty(company)){ - companyId = company.getId(); - //判断加盟商是否存在 - if (SinataUtil.isNotEmpty(three)){ - TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",company.getId()).eq("name", three).eq("type", 3).notIn("flag", "3").last(" limit 1")); - if (SinataUtil.isNotEmpty(franchisee)){ - franchiseeId = franchisee.getId(); - } - } - } - } - } - TDriver driver = new TDriver(); - driver.setAccount(seventeen); - driver.setJobNumber(ten); - driver.setPhone(seventeen); - driver.setPassword(ShiroKit.md5(eighteen, "SA;d5#")); - driver.setName(zero); - if ("男".equals(four)){ - driver.setSex(1); - }else if ("女".equals(four)){ - driver.setSex(2); - } - driver.setIdCard(seven); - driver.setDriverAge(Integer.valueOf(six)); - driver.setDriveCard(five); - driver.setTaxiAptitudeCard(nine); - if ("平台司机".equals(one)){ - driver.setIsPlatCar(1); - }else if ("加盟司机".equals(one)){ - driver.setIsPlatCar(2); - } - driver.setCompanyId(companyId); - driver.setFranchiseeId(franchiseeId); - driver.setState(2); - driver.setAuthState(2); - driver.setFlag("1"); - driver.setInsertUser(ShiroKit.getUser().getId()); - driver.setInsertTime(new Date()); - driver.setAddType(2); - driver.setAddObjectId(ShiroKit.getUser().getObjectId()); - if(SinataUtil.isNotEmpty(eight)){ - driver.setDriverAddress(eight); - } - tDriverService.insert(driver); - - - //添加专车服务模式 - if ("是".equals(eleven)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(1); - itDriverServiceService.insert(service); - } - //添加出租车服务模式 - if ("是".equals(twelve)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(2); - itDriverServiceService.insert(service); - } - //添加跨城出行服务模式 - if ("是".equals(thirteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(3); - itDriverServiceService.insert(service); - } - //添加小件同城物流服务模式 - if ("是".equals(fourteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(4); - itDriverServiceService.insert(service); - } - //添加小件跨城物流服务模式 - if ("是".equals(fifteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(5); - itDriverServiceService.insert(service); - } - //添加包车服务模式 - if ("是".equals(sixteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(6); - itDriverServiceService.insert(service); - } - } - } - }else if (ShiroKit.getUser().getRoleType() == 2){ - Workbook book = WoUtil.ImportFile(file); - 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(); - } - - Cell cell1 = row.getCell(1); //所属加盟商[选填] - String one = null; - if (SinataUtil.isNotEmpty(cell1)){ - one = String.valueOf(cell1.getStringCellValue()).trim(); - } - - Cell cell2 = row.getCell(2); //性别[男/女] - String two = null; - if (SinataUtil.isNotEmpty(cell2)){ - two = String.valueOf(cell2.getStringCellValue()).trim(); - } - - Cell cell3 = row.getCell(3); //驾驶证号码 - String three = null; - if (SinataUtil.isNotEmpty(cell3)){ - 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 cell5 = row.getCell(5); //身份证号 - String five = null; - if (SinataUtil.isNotEmpty(cell5)){ - five = String.valueOf(cell5.getStringCellValue()).trim(); - } - - Cell cell6 = row.getCell(6); //居住地址 - 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 cell8 = row.getCell(8); //工号[选填] - String eight = null; - if (SinataUtil.isNotEmpty(cell8)){ - eight = String.valueOf(cell8.getStringCellValue()).trim(); - } - - Cell cell9 = row.getCell(9); //经营业务:专车[是/否] - String nine = null; - if (SinataUtil.isNotEmpty(cell9)){ - nine = String.valueOf(cell9.getStringCellValue()).trim(); - } - - Cell cell10 = row.getCell(10); //经营业务:出租车[是/否] - String ten = null; - if (SinataUtil.isNotEmpty(cell10)){ - ten = String.valueOf(cell10.getStringCellValue()).trim(); - } - - Cell cell11 = row.getCell(11); //经营业务:跨城出行[是/否] - String eleven = null; - if (SinataUtil.isNotEmpty(cell11)){ - eleven = String.valueOf(cell11.getStringCellValue()).trim(); - } - - Cell cell12 = row.getCell(12); //经营业务:小件同城物流[是/否] - String twelve = null; - if (SinataUtil.isNotEmpty(cell12)){ - twelve = String.valueOf(cell12.getStringCellValue()).trim(); - } - - Cell cell13 = row.getCell(13); //经营业务:小件跨城物流[是/否] - String thirteen = null; - if (SinataUtil.isNotEmpty(cell13)){ - thirteen = String.valueOf(cell13.getStringCellValue()).trim(); - } - - Cell cell14 = row.getCell(14); //经营业务:包车[是/否] - String fourteen = null; - if (SinataUtil.isNotEmpty(cell14)){ - fourteen = String.valueOf(cell14.getStringCellValue()).trim(); - } - - Cell cell15 = row.getCell(15); //登录账号[手机号] - String fifteen = null; - if (SinataUtil.isNotEmpty(cell15)){ - fifteen = String.valueOf(cell15.getStringCellValue()).trim(); - } - - Cell cell16 = row.getCell(16); //登录密码[密码长度为6-18] - String sixteen = null; - if (SinataUtil.isNotEmpty(cell16)){ - sixteen = String.valueOf(cell16.getStringCellValue()).trim(); - } - 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(twelve) || SinataUtil.isEmpty(thirteen) - || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) || SinataUtil.isEmpty(sixteen)){ - 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; - } - //判断性别 - if (!two.equals("男") && !two.equals("女")){ - return new ErrorTip(500, "性别内容不正确"); - } - //判断经营业务【专车】 - if (!nine.equals("是") && !nine.equals("否")){ - return new ErrorTip(500, "经营业务【专车】内容不正确"); - } - //判断经营业务【出租车】 - if (!ten.equals("是") && !ten.equals("否")){ - return new ErrorTip(500, "经营业务【出租车】内容不正确"); - } - //判断经营业务【跨城出行】 - if (!eleven.equals("是") && !eleven.equals("否")){ - return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); - } - //判断经营业务【小件同城物流】 - if (!twelve.equals("是") && !twelve.equals("否")){ - return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); - } - //判断经营业务【小件跨城物流】 - if (!thirteen.equals("是") && !thirteen.equals("否")){ - return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); - } - //判断经营业务【包车】 - if (!fourteen.equals("是") && !fourteen.equals("否")){ - return new ErrorTip(500, "经营业务【包车】内容不正确"); - } - //判断驾龄 - if (!isInteger(four)){ - return new ErrorTip(500, "驾龄格式不正确"); - } - //判断手机号 - if (!isPhone(fifteen)){ - return new ErrorTip(500, "登录账号[手机号]格式不正确"); - } - //判断登录密码 - if (!isPassword(sixteen)){ - return new ErrorTip(500, "登录密码格式不正确"); - } - //查找平台公司 - Integer companyId = ShiroKit.getUser().getObjectId(); - Integer franchiseeId = 0; - //判断所属分公司是否存在 - if (SinataUtil.isNotEmpty(one)){ - TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",companyId).eq("name", one).eq("type", 3).notIn("flag", "3").last(" limit 1")); - if (SinataUtil.isNotEmpty(franchisee)){ - franchiseeId = franchisee.getId(); - } - } - - TDriver driver = new TDriver(); - driver.setAccount(fifteen); - driver.setJobNumber(eight); - driver.setPhone(fifteen); - driver.setPassword(ShiroKit.md5(sixteen, "SA;d5#")); - driver.setName(zero); - if ("男".equals(two)){ - driver.setSex(1); - }else if ("女".equals(two)){ - driver.setSex(2); - } - driver.setIdCard(five); - driver.setDriverAge(Integer.valueOf(four)); - driver.setDriveCard(three); - driver.setTaxiAptitudeCard(seven); - driver.setIsPlatCar(2); - driver.setCompanyId(companyId); - driver.setFranchiseeId(franchiseeId); - driver.setState(1); - driver.setAuthState(1); - driver.setFlag("1"); - driver.setInsertUser(ShiroKit.getUser().getId()); - driver.setInsertTime(new Date()); - driver.setAddType(3); - driver.setAddObjectId(ShiroKit.getUser().getObjectId()); - if (SinataUtil.isNotEmpty(six)){ - driver.setDriverAddress(six); - } - tDriverService.insert(driver); - - //添加专车服务模式 - if ("是".equals(nine)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(1); - itDriverServiceService.insert(service); - } - //添加出租车服务模式 - if ("是".equals(ten)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(2); - itDriverServiceService.insert(service); - } - //添加跨城出行服务模式 - if ("是".equals(eleven)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(3); - itDriverServiceService.insert(service); - } - //添加小件同城物流服务模式 - if ("是".equals(twelve)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(4); - itDriverServiceService.insert(service); - } - //添加小件跨城物流服务模式 - if ("是".equals(thirteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(5); - itDriverServiceService.insert(service); - } - //添加包车服务模式 - if ("是".equals(fourteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(6); - itDriverServiceService.insert(service); - } - - } - } - }else if (ShiroKit.getUser().getRoleType() == 3){ - Workbook book = WoUtil.ImportFile(file); - 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(); - } - - Cell cell2 = row.getCell(1); //性别[男/女] - String one = null; - if (SinataUtil.isNotEmpty(cell2)){ - one = String.valueOf(cell2.getStringCellValue()).trim(); - } - - Cell cell3 = row.getCell(2); //驾驶证号码 - String two = null; - if (SinataUtil.isNotEmpty(cell3)){ - two = String.valueOf(cell3.getStringCellValue()).trim(); - } - - Cell cell4 = row.getCell(3); //驾龄 - String three = null; - if (SinataUtil.isNotEmpty(cell4)){ - three = String.valueOf(cell4.getStringCellValue()).trim(); - } - - Cell cell5 = row.getCell(4); //身份证号 - String four = null; - if (SinataUtil.isNotEmpty(cell5)){ - four = String.valueOf(cell5.getStringCellValue()).trim(); - } - - Cell cell6 = row.getCell(5); //居住地址 - String five = null; - if (SinataUtil.isNotEmpty(cell6)){ - five = String.valueOf(cell6.getStringCellValue()).trim(); - } - - Cell cell7 = row.getCell(6); //出租车资格证号 - String six = null; - if (SinataUtil.isNotEmpty(cell7)){ - six = String.valueOf(cell7.getStringCellValue()).trim(); - } - - Cell cell8 = row.getCell(7); //工号[选填] - String seven = null; - if (SinataUtil.isNotEmpty(cell8)){ - seven = String.valueOf(cell8.getStringCellValue()).trim(); - } - - Cell cell9 = row.getCell(8); //经营业务:专车[是/否] - String eight = null; - if (SinataUtil.isNotEmpty(cell9)){ - eight = String.valueOf(cell9.getStringCellValue()).trim(); - } - - Cell cell10 = row.getCell(9); //经营业务:出租车[是/否] - String nine = null; - if (SinataUtil.isNotEmpty(cell10)){ - nine = String.valueOf(cell10.getStringCellValue()).trim(); - } - - Cell cell11 = row.getCell(10); //经营业务:跨城出行[是/否] - String ten = null; - if (SinataUtil.isNotEmpty(cell11)){ - ten = String.valueOf(cell11.getStringCellValue()).trim(); - } - - Cell cell12 = row.getCell(11); //经营业务:小件同城物流[是/否] - String eleven = null; - if (SinataUtil.isNotEmpty(cell12)){ - eleven = String.valueOf(cell12.getStringCellValue()).trim(); - } - - Cell cell13 = row.getCell(12); //经营业务:小件跨城物流[是/否] - String twelve = null; - if (SinataUtil.isNotEmpty(cell13)){ - twelve = String.valueOf(cell13.getStringCellValue()).trim(); - } - - Cell cell14 = row.getCell(13); //经营业务:包车[是/否] - String thirteen = null; - if (SinataUtil.isNotEmpty(cell14)){ - thirteen = String.valueOf(cell14.getStringCellValue()).trim(); - } - - Cell cell15 = row.getCell(14); //登录账号[手机号] - String fourteen = null; - if (SinataUtil.isNotEmpty(cell15)){ - fourteen = String.valueOf(cell15.getStringCellValue()).trim(); - } - - Cell cell16 = row.getCell(15); //登录密码[密码长度为6-18] - String fifteen = null; - if (SinataUtil.isNotEmpty(cell16)){ - fifteen = String.valueOf(cell16.getStringCellValue()).trim(); - } - 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(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen) - || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) ){ - 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; - } - //判断性别 - if (!one.equals("男") && !one.equals("女")){ - return new ErrorTip(500, "性别内容不正确"); - } - //判断经营业务【专车】 - if (!eight.equals("是") && !eight.equals("否")){ - return new ErrorTip(500, "经营业务【专车】内容不正确"); - } - //判断经营业务【出租车】 - if (!nine.equals("是") && !nine.equals("否")){ - return new ErrorTip(500, "经营业务【出租车】内容不正确"); - } - //判断经营业务【跨城出行】 - if (!ten.equals("是") && !ten.equals("否")){ - return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); - } - //判断经营业务【小件同城物流】 - if (!eleven.equals("是") && !eleven.equals("否")){ - return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); - } - //判断经营业务【小件跨城物流】 - if (!twelve.equals("是") && !twelve.equals("否")){ - return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); - } - //判断经营业务【包车】 - if (!thirteen.equals("是") && !thirteen.equals("否")){ - return new ErrorTip(500, "经营业务【包车】内容不正确"); - } - //判断驾龄 - if (!isInteger(three)){ - return new ErrorTip(500, "驾龄格式不正确"); - } - //判断手机号 - if (!isPhone(fourteen)){ - return new ErrorTip(500, "登录账号[手机号]格式不正确"); - } - //判断登录密码 - if (!isPassword(fifteen)){ - return new ErrorTip(500, "登录密码格式不正确"); - } - //查找平台公司 - Integer companyId = 0; - Integer franchiseeId = 0; - TCompany franchisee = itCompanyService.selectById(ShiroKit.getUser().getObjectId()); - if (SinataUtil.isNotEmpty(franchisee)){ - companyId = franchisee.getSuperiorId(); - franchiseeId = franchisee.getId(); - } - if (companyId == 0 && franchiseeId == 0){ - return new ErrorTip(500, "当前登录账户上级分公司不能为空"); - } - - TDriver driver = new TDriver(); - driver.setAccount(fourteen); - driver.setJobNumber(seven); - driver.setPhone(fourteen); - driver.setPassword(ShiroKit.md5(fifteen, "SA;d5#")); - driver.setName(zero); - if ("男".equals(one)){ - driver.setSex(1); - }else if ("女".equals(one)){ - driver.setSex(2); - } - driver.setIdCard(four); - driver.setDriverAge(Integer.valueOf(three)); - driver.setDriveCard(two); - driver.setTaxiAptitudeCard(six); - driver.setIsPlatCar(2); - driver.setCompanyId(companyId); - driver.setFranchiseeId(franchiseeId); - driver.setState(1); - driver.setAuthState(1); - driver.setFlag("1"); - driver.setInsertUser(ShiroKit.getUser().getId()); - driver.setInsertTime(new Date()); - driver.setAddType(4); - driver.setAddObjectId(ShiroKit.getUser().getObjectId()); - if (SinataUtil.isNotEmpty(five)){ - driver.setDriverAddress(five); - } - tDriverService.insert(driver); - - //添加专车服务模式 - if ("是".equals(eight)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(1); - itDriverServiceService.insert(service); - } - //添加出租车服务模式 - if ("是".equals(nine)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(2); - itDriverServiceService.insert(service); - } - //添加跨城出行服务模式 - if ("是".equals(ten)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(3); - itDriverServiceService.insert(service); - } - //添加小件同城物流服务模式 - if ("是".equals(eleven)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(4); - itDriverServiceService.insert(service); - } - //添加小件跨城物流服务模式 - if ("是".equals(twelve)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(5); - itDriverServiceService.insert(service); - } - //添加包车服务模式 - if ("是".equals(thirteen)){ - TDriverService service = new TDriverService(); - service.setDriverId(driver.getId()); - service.setType(6); - itDriverServiceService.insert(service); - } - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return SUCCESS_TIP; + public Object detail(@PathVariable("tDriverId") Integer tDriverId) { + return tDriverService.selectById(tDriverId); } - - - - - @Autowired - private ITCompanyService itCompanyService; - - @Autowired - private ITDriverServiceService itDriverServiceService; - - /** - * 验证是否可以字符转为整数 - * @param str - * @return - */ - public static boolean isInteger(String str) { - try{ - String reg = "^[0-9]\\d*$"; - boolean flag = str.matches(reg); - return flag; - }catch(NumberFormatException e) { - System.out.println("异常:\"" + str + "\"..."); - return false; - } - } - /** - * 验证手机号格式是否正确 - * @param str - * @return - */ - public static boolean isPhone(String str) { - try{ - String reg = "^1\\d{10}$"; - boolean flag = str.matches(reg); - return flag; - }catch(NumberFormatException e) { - System.out.println("异常:\"" + str + "\"..."); - return false; - } - } - /** - * 验证密码长度是否正确 - * @param str - * @return - */ - public static boolean isPassword(String str) { - try{ - String reg = "^.{6,18}$"; - boolean flag = str.matches(reg); - return flag; - }catch(NumberFormatException e) { - System.out.println("异常:\"" + str + "\"..."); - return false; - } - } - - /** - * 导出司机信息 - */ - @RequestMapping(value = "/outDriver") - public void outDriver(HttpServletRequest request, HttpServletResponse response) { - List<Map<String,Object>> listMap = tDriverService.getDriverListNoPage(ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId()); - - // 表格数据【封装】 - List<List<String>> dataList = new ArrayList<>(); - - //第一行显示【封装】 - List<String> twoList = new ArrayList<String>(); - twoList.add("总计:"); - twoList.add(String.valueOf(listMap.size())+"条"); - dataList.add(twoList); - - // 列【封装】 - List<String> shellList = new ArrayList<String>(); - 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("状态"); - dataList.add(shellList); - - for (Map<String,Object> object : listMap){ - // 详细数据列【封装】 - shellList = new ArrayList<String>(); - if(SinataUtil.isNotEmpty(object.get("insertTime"))){ - shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("name"))){ - shellList.add(object.get("name").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("phone"))){ - shellList.add(object.get("phone").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("sex"))){ - shellList.add(object.get("sex").toString() == "1"?"男":"女"); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("addType"))){ - - shellList.add(object.get("addType").toString().equals("1")?"司机注册":(object.get("addType").toString().equals("2")?"平台添加":(object.get("addType").toString().equals("3")?"分公司添加":(object.get("addType").toString().equals("4")?"加盟商添加":"")))); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("companyName"))){ - shellList.add(object.get("companyName").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("franchiseeName"))){ - shellList.add(object.get("franchiseeName").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("carLicensePlate"))){ - shellList.add(object.get("carLicensePlate").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("serverStr"))){ - shellList.add(object.get("serverStr").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("lineStr"))){ - shellList.add(object.get("lineStr").toString()); - }else{ - shellList.add("-"); - } - if(SinataUtil.isNotEmpty(object.get("evaluateNum"))){ - shellList.add(object.get("evaluateNum").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("historyNum"))){ - shellList.add(object.get("historyNum").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("historyMoney"))){ - shellList.add(object.get("historyMoney").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("balance"))){ - shellList.add(object.get("balance").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("laveActivityMoney"))){ - shellList.add(object.get("laveActivityMoney").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("laveBusinessMoney"))){ - shellList.add(object.get("laveBusinessMoney").toString()); - }else{ - shellList.add("0"); - } - if(SinataUtil.isNotEmpty(object.get("authState"))){ - shellList.add(object.get("authState").toString().equals("1")?"待审核":(object.get("authState").toString().equals("2")?"正常":(object.get("authState").toString().equals("3")?"冻结":(object.get("authState").toString().equals("4")?"已拒绝":"")))); - - shellList.add(object.get("authState").toString()); - }else{ - shellList.add("-"); - } - dataList.add(shellList); - } - try { - // 调用工具类进行导出 - ExcelExportUtil.easySheet("司机信息导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "司机信息导出记录", dataList,request, response); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -- Gitblit v1.7.1