From 81dcb037f2ee0e19ebb2abd7234ddf0f117f2c10 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 07 六月 2023 09:55:51 +0800
Subject: [PATCH] 抽佣分成修改
---
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java | 2525 +++++++++++++++++----------------------------------------
1 files changed, 764 insertions(+), 1,761 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..eeb4c9d 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,67 @@
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.baomidou.mybatisplus.mapper.Wrapper;
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.base.tips.SuccessTip;
+import com.stylefeng.guns.core.log.LogObjectHolder;
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.core.shiro.ShiroUser;
+import com.stylefeng.guns.modular.system.controller.resp.TDriverCommissionResp;
+import com.stylefeng.guns.modular.system.controller.resp.TDriverResp;
+import com.stylefeng.guns.modular.system.controller.util.ExcelUtil;
+import com.stylefeng.guns.modular.system.controller.util.HttpUtils;
+import com.stylefeng.guns.modular.system.controller.util.TokenUtils;
+import com.stylefeng.guns.modular.system.controller.util.UUIDUtil;
+import com.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper;
+import com.stylefeng.guns.modular.system.enums.UserTypeEnum;
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.ui.Model;
+import com.stylefeng.guns.modular.system.util.DateUtil;
+import com.stylefeng.guns.modular.system.util.RedisUtil;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.shiro.subject.Subject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import com.stylefeng.guns.core.log.LogObjectHolder;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
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.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.time.LocalDate;
+import java.time.Period;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
- * 司机审核列表控制器
+ * 控制器
*
* @author fengshuonan
- * @Date 2020-06-04 17:35:28
+ * @Date 2023-02-20 09:07:06
*/
@Controller
@RequestMapping("/tDriver")
@@ -56,33 +73,36 @@
private ITDriverService tDriverService;
@Autowired
- private ITCompanyService tCompanyService;
+ private ITRegionService tRegionService;
@Autowired
- private ITDriverServiceService tDriverServiceService;
+ private ITAgentService tAgentService;
@Autowired
- private ITDriverLineService tDriverLineService;
+ private ITBranchOfficeService tBranchOfficeService;
+ @Autowired
+ private RedisTemplate<String,String> redisTemplate;
+ @Autowired
+ private HttpUtils httpUtils;
+ @Autowired
+ private TokenUtils tokenUtils;
+ @Autowired
+ private ITDriverWorkService tDriverWorkService;
+ @Autowired
+ private RedisUtil redisUtil;
+ @Autowired
+ private ITRechargeRecordService tRechargeRecordService;
@Autowired
- private ITLineService itLineService;
-
- @Autowired
- private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
+ private ITSystemConfigService systemConfigService;
@Resource
- private DriverTrainMapper driverTrainMapper;
+ private AccountChangeDetailMapper accountChangeDetailMapper;
- @Resource
- private DriverPunishMapper driverPunishMapper;
-
- @Value("${pushMinistryOfTransport}")
- private boolean pushMinistryOfTransport;
-
-
+ private Logger log = LoggerFactory.getLogger(this.getClass());
/**
- * 跳转到司机审核列表首页
+ * 跳转到首页
*/
@RequestMapping("")
public String index() {
@@ -90,1815 +110,798 @@
}
/**
- * 跳转到审核通过司机首页
+ * 跳转到佣金首页
*/
- @RequestMapping("/yesDriver")
- public String yesDriver() {
- return PREFIX + "yesDriver.html";
+ @RequestMapping("/commission")
+ public String commissionIndex() {
+ return PREFIX + "tDriverCommission.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) {
+ @RequestMapping("/tDriver_update")
+ public String tDriverUpdate( Integer tDriverId, Model model) {
TDriver tDriver = tDriverService.selectById(tDriverId);
- model.addAttribute("item",tDriver);
+ TDriverResp tDriverResp = new TDriverResp();
+ BeanUtils.copyProperties(tDriver,tDriverResp);
+
+ // 查询邀请人
+ TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId());
+ if(Objects.nonNull(tDriver1)){
+ tDriverResp.setInviterName(tDriver1.getName());
+ tDriverResp.setInviterPhone(tDriver1.getPhone());
+ }
+
+ // 查询区域
+ TRegion district = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriver.getAreaCode())
+ .last("LIMIT 1"));
+ TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriver.getCityCode())
+ .last("LIMIT 1"));
+
+// tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName()+"/"+tDriver.getAreaName());
+// if(Objects.nonNull(district) && Objects.nonNull(city)){
+// tDriverResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
+// }
+ if(StringUtils.hasLength(tDriver.getAreaName()) && !tDriver.getAreaName().equals(tDriver.getCityName())){
+ tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName()+"/"+tDriver.getAreaName());
+ }else {
+ tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName());
+ }
+
+ if(Objects.nonNull(city)){
+ if(Objects.nonNull(district) && !district.getCode().equals(city.getCode())){
+ tDriverResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
+ }else {
+ tDriverResp.setAreaId(city.getParentId()+"/"+city.getId());
+ }
+ }
+
+ model.addAttribute("item",tDriverResp);
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";
+ @RequestMapping("/tDriver_start_and_stop")
+ public String tAppUserStartAndStop( Integer id,
+ Model model) {
+ TDriver tDriver = tDriverService.selectById(id);
+
+ model.addAttribute("id",id);
+ model.addAttribute("status",tDriver.getStatus());
+ return PREFIX + "tDriverStartAndStop.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("请添加有效的培训记录");
+ @RequestMapping("/rechargeBalancePage")
+ public String rechargeBalancePage( Integer id,
+ Model model) {
+ model.addAttribute("id",id);
+ return PREFIX + "tDriverRechargeBalancePage.html";
+ }
+
+ /**
+ * 跳转异常页面
+ * @return
+ */
+ @RequestMapping("/tDriver_exception")
+ public String tDriverException(Model model) {
+ model.addAttribute("isException",2);
+ return PREFIX + "tDriverException.html";
+ }
+ /**
+ * 跳转异常启用冻结页面
+ * @return
+ */
+ @RequestMapping("/tDriverException_start_and_stop")
+ public String tDriverExceptionStartAndStop(Integer id,Model model) {
+ TDriver tDriver = tDriverService.selectById(id);
+ model.addAttribute("id",id);
+ model.addAttribute("status",tDriver.getStatus());
+ return PREFIX + "tDriverExceptionStartAndStop.html";
+ }
+
+ /**
+ * 跳转审核页面
+ * @return
+ */
+ @RequestMapping("/auditPage")
+ public String auditPage( Integer id,Model model) {
+ tDriverService.auditPage(id,model);
+ return PREFIX + "tDriverAudit.html";
+ }
+
+ /**
+ * 跳转详情页面
+ */
+ @RequestMapping("/driverDetail")
+ public String driverDetail(Integer tDriverId, Model model) {
+ tDriverService.auditPage(tDriverId,model);
+ return PREFIX + "tDriverDetail.html";
+ }
+
+ /**
+ * 佣金跳转详情页面
+ */
+ @RequestMapping("/commission/driverCommissionDetail")
+ public String driverCommissionDetail(Integer tDriverId,Integer levelFlag, Model model) {
+ tDriverService.driverCommissionDetail(tDriverId,levelFlag,model);
+ return PREFIX + "tDriverCommissionDetail.html";
+ }
+
+ /**
+ * 跳转区域页面编辑
+ */
+ @RequestMapping("/areaPageUpdate")
+ public String areaPageUpdate(String area,String areaId,Model model) {
+
+ String[] split = area.split("/");
+ model.addAttribute("provinceName",split[0]);
+ model.addAttribute("cityName",split[1]);
+ if(split.length>2){
+ model.addAttribute("districtName",split[2]);
+ }else {
+ model.addAttribute("districtName","");
}
- 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();
+ String[] split1 = areaId.split("/");
+ model.addAttribute("provinceId",split1[0]);
+ model.addAttribute("cityId",split1[1]);
+ if(split1.length>2) {
+ model.addAttribute("districtId", split1[2]);
+ }else {
+ model.addAttribute("districtId", "");
}
- return ResultUtil.success();
+
+
+ List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+ model.addAttribute("provinceList",tRegions);
+ List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
+
+
+ // 查询市
+ List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
+ model.addAttribute("cityList",tRegions1);
+
+ // 查询区
+ List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList());
+ List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", split1[1]));
+ model.addAttribute("districtList",tRegions2);
+
+ return PREFIX + "tDriverAreaUpdate.html";
}
/**
- * 获取司机的所有培训数据
- * @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);
- }
+ @RequestMapping("/areaPageAdd")
+ public String areaPageAdd(String area,String areaId,Model model) {
+ String[] split1 = areaId.split("/");
+ List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+ model.addAttribute("provinceList",tRegions);
+// List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
+// // 查询市
+// List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
+// model.addAttribute("cityList",tRegions1);
+//
+// // 查询区
+// List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList());
+// List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds));
+// model.addAttribute("districtList",tRegions2);
+ if(StringUtils.hasLength(area) && StringUtils.hasLength(areaId)){
+ String[] split = area.split("/");
+ model.addAttribute("provinceName",split[0]);
+ model.addAttribute("cityName",split[1]);
+ if(split.length>2){
+ model.addAttribute("districtName",split[2]);
+ }else {
+ model.addAttribute("districtName","");
+ }
- /**
- * 跳转到处罚页
- * @param id
- * @param model
- * @return
- */
- @RequestMapping("/showPunish")
- public String showPunish(Integer id, Model model){
- model.addAttribute("id", id);
- return PREFIX + "punish.html";
- }
+ model.addAttribute("provinceId",split1[0]);
+ model.addAttribute("cityId",split1[1]);
+ if(split1.length>2) {
+ model.addAttribute("districtId", split1[2]);
+ }else {
+ model.addAttribute("districtId", "");
+ }
+ List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
+ model.addAttribute("cityList",tRegions1);
- /**
- * 保存处罚数据
- * @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("请添加有效的培训记录");
+ // 查询区
+ List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", split1[1]));
+ model.addAttribute("districtList",tRegions2);
+ }else {
+ model.addAttribute("cityList",new ArrayList<>());
+ model.addAttribute("districtList",new ArrayList<>());
+
+ model.addAttribute("provinceName","");
+ model.addAttribute("cityName","split[1]");
+ model.addAttribute("districtName","");
+
+ model.addAttribute("provinceId","");
+ model.addAttribute("cityId","split1[1]");
+ model.addAttribute("districtId", "");
}
- 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;
+ return PREFIX + "tDriverAreaAdd.html";
}
/**
- * 获取司机审核列表列表
+ * 获取列表
*/
@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);
- }
-
- /**
- * 获取审核通过的司机列表
- */
- @RequestMapping(value = "/listYesDriver")
- @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);
- }
-
- /**
- * 获取可被选择的车辆列表
- */
- @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);
+ public Object list(String createTime,String phone,Integer status) {
+ EntityWrapper<TDriver> wrapper = tDriverService.getPageList(createTime,phone,status);
+ wrapper.orderBy("createTime",false);
+ List<TDriver> tDrivers = tDriverService.selectList(wrapper);
+ List<TDriverResp> tDriverResp = tDriverService.getTDriverResp(tDrivers);
+ for (TDriverResp driverResp : tDriverResp) {
+ TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>()
+ .eq("driverId", driverResp.getId())
+ .orderBy("workTime", false)
+ .last("LIMIT 1"));
+ if(Objects.nonNull(tDriverWork)){
+ // 如果是下班状态,计算未上线天数,,如果为上班状态,则设置为0
+ if(tDriverWork.getStatus() == 1){
+ driverResp.setNotOnlineCount(0);
+ }else {
+ Period period = Period.between(DateUtil.dateToLocalDate(tDriverWork.getOffWorkTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(period.getYears()*365 + period.getMonths()*30 + Math.abs(period.getDays()));
+ }
+ }else {
+ if(Objects.nonNull(driverResp.getApprovalTime())){
+ // 没有上班记录,计算审核时间
+ Period period = Period.between(DateUtil.dateToLocalDate(driverResp.getApprovalTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(period.getYears()*365 + period.getMonths()*30 + Math.abs(period.getDays()));
+ }else {
+ driverResp.setNotOnlineCount(0);
+ }
}
-
- 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;
+ return tDriverResp;
}
-
/**
- * 更换车辆操作
+ * 获取佣金列表
*/
- @RequestMapping(value = "/selectCarOpt")
+ @RequestMapping(value = "/commission/list")
@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);
+ public Object commissionList(String name,String phone,Integer status) {
+ EntityWrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status);
+ List<TDriver> tDrivers = tDriverService.selectList(wrapper);
+ List<TDriverCommissionResp> commissionResp = tDriverService.getTDriverCommissionResp(tDrivers);
+ for (TDriverCommissionResp tDriverCommissionResp : commissionResp) {
+ tDriverCommissionResp.setLevelFlag(0);
}
+ return commissionResp;
+ }
+ /**
+ * 获取异常列表
+ */
+ @RequestMapping(value = "/exceptionList")
+ @ResponseBody
+ public Object exceptionList(String createTime,String phone,Integer status) {
+ EntityWrapper<TDriver> wrapper = tDriverService.getPageList(createTime,phone,status);
+ wrapper.eq("isException",2);
+ wrapper.orderBy("createTime",false);
+ List<TDriver> tDrivers = tDriverService.selectList(wrapper);
+ List<TDriverResp> tDriverResp = tDriverService.getTDriverResp(tDrivers);
+ for (TDriverResp driverResp : tDriverResp) {
+ TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>()
+ .eq("driverId", driverResp.getId())
+ .orderBy("workTime", false)
+ .last("LIMIT 1"));
+ if(Objects.nonNull(tDriverWork)){
+ // 如果是下班状态,计算未上线天数,,如果为上班状态,则设置为0
+ if(tDriverWork.getStatus() == 1){
+ driverResp.setNotOnlineCount(0);
+ }else {
+ Period period = Period.between(DateUtil.dateToLocalDate(tDriverWork.getOffWorkTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(period.getYears()*365 + period.getMonths()*30 + Math.abs(period.getDays()));
+ }
+ }else {
+ if(Objects.nonNull(driverResp.getApprovalTime())){
+ // 没有上班记录,计算审核时间
+ Period period = Period.between(DateUtil.dateToLocalDate(driverResp.getApprovalTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(period.getYears()*365 + period.getMonths()*30 + Math.abs(period.getDays()));
+ }else {
+ driverResp.setNotOnlineCount(0);
+ }
+ }
+ }
+ return tDriverResp;
+ }
+
+ /**
+ * 佣金关联列表
+ */
+ @RequestMapping(value = "/commission/connect/list")
+ @ResponseBody
+ public Object commissionConnectList(String driverId,Integer levelFlag) {
+ // 查询当前用户的用户信息
+ TDriver tDriver = tDriverService.selectById(driverId);
+
+ EntityWrapper<TDriver> wrapper = new EntityWrapper<>();
+ if(StringUtils.hasLength(driverId)){
+ wrapper.eq("inviterId",driverId);
+ }
+ wrapper.orderBy("createTime",false);
+ List<TDriver> list = tDriverService.selectList(wrapper);
+ List<TDriverCommissionResp> commissionResp = new ArrayList<>();
+ try{
+ commissionResp = tDriverService.getTDriverCommissionResp(list);
+ for (TDriverCommissionResp tDriverCommissionResp : commissionResp) {
+ if(Objects.nonNull(tDriver)){
+ tDriverCommissionResp.setInviterName(tDriver.getName());
+ tDriverCommissionResp.setInviterPhone(tDriver.getPhone());
+ if(levelFlag == 0){
+ tDriverCommissionResp.setLevelFlag(1);
+ tDriverCommissionResp.setLevel("一级");
+ }
+ if(levelFlag == 1){
+ tDriverCommissionResp.setLevelFlag(2);
+ tDriverCommissionResp.setLevel("二级");
+ }
+ if(levelFlag == 2){
+ tDriverCommissionResp.setLevelFlag(3);
+ tDriverCommissionResp.setLevel("三级");
+ }
+
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return commissionResp;
+ }
+
+ /**
+ * 获取列表
+ */
+ @RequestMapping(value = "/list-back")
+ @ResponseBody
+ public Object listBack(String condition) {
+ return tDriverService.selectList(null);
+ }
+ /**
+ * ocr
+ */
+ @RequestMapping(value = "/ocr")
+ @ResponseBody
+ public JSONObject ocr(MultipartFile multipartFile) {
+ /*String accessToken = redisTemplate.opsForValue().get(TokenUtils.ACCESS_TOKEN_CACHE_KEY);
+ if (!StringUtils.hasLength(accessToken)) {
+ accessToken = tokenUtils.getSimpleAccessToken();
+ }
+ File file = new File(imgUrl);
+ String url = Constant.OCR_URL.replace("MODE", "scan").replace("ACCESS_TOKEN", accessToken);
+ String result = httpUtils.registRequest(url, file);
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ System.err.println(jsonObject);
+ return jsonObject;*/
+ String originalFilename = multipartFile.getOriginalFilename();
+ String[] filename = originalFilename.split("\\.");
+ log.info("tupian::"+filename[0]+"//"+filename[1]);
+ File file= null;
+ try {
+ file = File.createTempFile(filename[0], "."+filename[1]);
+ multipartFile.transferTo(file);
+ file.deleteOnExit();
+ log.info("file:"+file.getName());
+ } catch (IOException e) {
+ log.error("ocr识别失败:{}",e.getMessage());
+ }
+ return tDriverService.ocr(file);
+ }
+
+ /**
+ * 审核
+ */
+ @RequestMapping(value = "/auditSubmit")
+ @ResponseBody
+ public Object auditSubmit(Integer id,Integer approvalStatus,String approvalNotes) {
+ TDriver tDriver = tDriverService.selectById(id);
+ tDriver.setApprovalStatus(approvalStatus);
+ tDriver.setApprovalNotes(approvalNotes);
+ // 审核用户id
+ Subject subject = ShiroKit.getSubject();
+ ShiroUser shiroUser = (ShiroUser)subject.getPrincipal();
+ tDriver.setApprovalUserId(shiroUser.getId());
+ tDriver.setApprovalTime(new Date());
+ tDriverService.updateById(tDriver);
+
+ //增加积分奖励
+ if(approvalStatus == 2 && null != tDriver.getInviterId()){
+ TSystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 4));
+ Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7");
+ TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId());
+
+ AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
+ accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
+ accountChangeDetail.setUserType(2);
+ accountChangeDetail.setUserId(tDriver1.getId());
+ accountChangeDetail.setType(2);
+ accountChangeDetail.setChangeType(10);
+ accountChangeDetail.setOldData(tDriver1.getIntegral().doubleValue());
+ tDriver1.setIntegral(tDriver1.getIntegral() + num7);
+ accountChangeDetail.setNewData(tDriver1.getIntegral().doubleValue());
+ accountChangeDetail.setExplain("推荐奖励");
+ accountChangeDetail.setCreateTime(new Date());
+ accountChangeDetailMapper.insert(accountChangeDetail);
+ tDriverService.updateById(tDriver1);
+ }
+
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()));
+ public Object add(TDriver tDriver) {
- tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#"));
-
+ int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone()));
+ if(count>0){
+ return new SuccessTip(500,"该司机已存在!");
+ }
+ Object o = tDriverService.addOrUpdate(tDriver);
+ if(Objects.nonNull(o)){
+ return o;
+ }
+ // 默认值板块
+ tDriver.setName(tDriver.getName().replace(" ",""));
+ tDriver.setEmergencyContact(tDriver.getEmergencyContact().replace(" ",""));
+ tDriver.setCode(UUIDUtil.getNumberRandom(16));
+ tDriver.setBalance(BigDecimal.ZERO);
+ tDriver.setBackgroundBalance(BigDecimal.ZERO);
+ tDriver.setCommission(BigDecimal.ZERO);
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-status")
+ @ResponseBody
+ public Object updateStatus(Integer id,Integer status,
+ String remark) {
+ TDriver tDriver = tDriverService.selectById(id);
+ if(1 == status){
+ tDriver.setStatus(2);
+ String value = redisUtil.getValue("DRIVER_" + tDriver.getPhone());
+ redisUtil.remove(value);
+ redisUtil.remove("DRIVER_" + tDriver.getPhone());
+ TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>()
+ .eq("driverId", tDriver.getId())
+ .eq("status", 1)
+ .orderBy("workTime", false)
+ .last("LIMIT 1"));
+ if(Objects.nonNull(tDriverWork)){
+ tDriverWork.setStatus(2);
+ tDriverWork.setOffWorkTime(new Date());
+ tDriverWorkService.updateById(tDriverWork);
+ }
+ }
+ if(2 == status){
+ tDriver.setStatus(1);
+ }
+ tDriver.setRemark(remark);
+ tDriverService.updateById(tDriver);
+ return SUCCESS_TIP;
+ }
+
+ /**
+ * 充值余额
+ */
+ @ApiOperation(value = "充值余额")
+ @RequestMapping(value = "/recharge-balance")
+ @Transactional(rollbackFor = Exception.class)
+ @ResponseBody
+ public Object rechargeBalance(Integer id, String money) {
+ TDriver tDriver = tDriverService.selectById(id);
+ tDriver.setBackgroundBalance(new BigDecimal(money).add(tDriver.getBackgroundBalance()));
+ tDriverService.updateById(tDriver);
+
+ // 添加充值记录
+ TRechargeRecord tRechargeRecord = new TRechargeRecord();
+ tRechargeRecord.setType(UserTypeEnum.AGENT.getCode());
+ tRechargeRecord.setUserId(id);
+ tRechargeRecord.setCode(UUIDUtil.getNumberRandom(16));
+ tRechargeRecord.setAmount(new BigDecimal(money));
+ tRechargeRecord.setPayType(2);
+ tRechargeRecord.setPayTime(new Date());
+ tRechargeRecord.setPayStatus(2);
+ tRechargeRecord.setCreateTime(new Date());
+ Integer id1 = Objects.requireNonNull(ShiroKit.getUser()).getObjectId();
+ tRechargeRecord.setAgentId(id1);
+ tRechargeRecordService.insert(tRechargeRecord);
+ 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";
- }
+ public Object update(TDriver tDriver) {
+ TDriver driver = tDriverService.selectOne(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone())
+ .last("LIMIT 1"));
+ if(Objects.nonNull(driver) && !tDriver.getId().equals(driver.getId())){
+ return new SuccessTip(500,"该司机已存在!");
}
- 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());
- }
+// Object ocr = ocr("E:\\071bf986db0b00355c0ed190bbd3b16.png");
+// System.err.println(ocr);
+ Object o = tDriverService.addOrUpdate(tDriver);
+ if(Objects.nonNull(o)){
+ return o;
}
- tDriver.setUpdateTime(new Date());
- tDriver.setUpdateUser(ShiroKit.getUser().getId());
-// tDriver.setPassword(MD5Util.encrypt(tDriver.getPassword()));
- tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#"));
+ tDriver.setName(tDriver.getName().replace(" ",""));
+ tDriver.setEmergencyContact(tDriver.getEmergencyContact().replace(" ",""));
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");
+ public Object detail(@PathVariable("tDriverId") Integer tDriverId) {
+ return tDriverService.selectById(tDriverId);
+ }
+
+ @ApiOperation(value = "省查询",notes="省查询")
+ @RequestMapping(value = "/areaProvince")
+ @ResponseBody
+ public Object areaProvince(Model model) {
+ return tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+ }
+
+ @ApiOperation(value = "市区查询",notes="市区查询")
+ @RequestMapping(value = "/areaCity")
+ @ResponseBody
+ public Object areaCity(Integer parentId,Model model) {
+ List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId));
+ model.addAttribute("list",tRegions);
+ return tRegions;
+ }
+
+
+
+ @ApiOperation(value = "导出司机列表",notes="导出司机列表")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
+ })
+ @RequestMapping(value = "/export")
+ @ResponseBody
+ public void export(String createTime,String phone,Integer status,HttpServletResponse response) {
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);
+ Date date = new Date();
+ DateFormat format = new SimpleDateFormat("yyyyMMdd");
+ String time1 = format.format(date);
+ String fileName = "DriverInfo"+time1+".xls";
+ String[] title = new String[] {"编号","姓名","手机号","性别","驾驶证号码","身份证号码",
+ "身份证","所属代理商","所属分公司","钱包余额","累计订单量","当月订单量","积分","拒单次数","状态","审核状态","添加时间"};
+ EntityWrapper<TDriver> wrapper = tDriverService.getPageList(createTime,phone,status);
+ wrapper.orderBy("createTime",false);
+ List<TDriver> tDrivers = tDriverService.selectList(wrapper);
+ List<TDriverResp> tDriverResp = tDriverService.getTDriverResp(tDrivers);
- 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);
- }
- }
+ String[][] values = new String[tDriverResp.size()][];
+ for (int i = 0; i < tDriverResp.size(); i++) {
+ TDriverResp d = tDriverResp.get(i);
+ values[i] = new String[title.length];
+ values[i][0] = d.getCode();
+ values[i][1] = d.getName();
+ values[i][2] = d.getPhone();
+ Integer sex = d.getSex();
+ if(Objects.isNull(sex)){
+ values[i][3] = "未知";
+ }else if(1 == sex){
+ values[i][3] = "男";
+ }else if(2 == sex){
+ values[i][3] = "女";
}
- }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);
- }
-
- }
+ values[i][4] = d.getDriverLicenseNumber();
+ values[i][5] = d.getIdcard();
+ if(StringUtils.hasLength(d.getIdcardFront())){
+ values[i][6] = "已上传";
+ }else {
+ values[i][6] = "未上传";
}
- }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);
- }
- }
+ values[i][7] = d.getAgentName();
+ values[i][8] = d.getBranchName();
+ values[i][9] = String.valueOf(d.getBalance());
+ values[i][10] = String.valueOf(d.getCumulativeOrderCount());
+ values[i][11] = String.valueOf(d.getMonthOrderCount());
+ values[i][12] = String.valueOf(d.getIntegral());
+ values[i][13] = String.valueOf(d.getRefusalCount());
+ Integer status1 = d.getStatus();
+ if(1 == status1){
+ values[i][14] = "正常";
+ }else if(2 == status1){
+ values[i][14] = "冻结";
+ }else {
+ values[i][14] = "删除";
}
+ Integer approvalStatus = d.getApprovalStatus();
+ if(1 == approvalStatus){
+ values[i][15] = "待审核";
+ }else if(2 == approvalStatus){
+ values[i][15] = "已同意";
+ }else {
+ values[i][15] = "已拒绝";
+ }
+ values[i][16] = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(d.getCreateTime());
}
- } catch (Exception e) {
- e.printStackTrace();
- }
- return SUCCESS_TIP;
- }
-
-
-
-
- @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);
+ HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null);
+ ExcelUtil.setResponseHeader(response, fileName);
+ OutputStream os = response.getOutputStream();
+ wb.write(os);
+ os.flush();
+ os.close();
} catch (Exception e) {
e.printStackTrace();
}
}
+ @ApiOperation(value = "导出司机异常列表",notes="导出司机异常列表")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
+ })
+ @RequestMapping(value = "/export-exception")
+ @ResponseBody
+ public void exportException(String createTime,String phone,Integer status,HttpServletResponse response) {
+ try {
+ Date date = new Date();
+ DateFormat format = new SimpleDateFormat("yyyyMMdd");
+ String time1 = format.format(date);
+ String fileName = "DriverExceptionInfo"+time1+".xls";
+ String[] title = new String[] {"编号","姓名","手机号","性别","驾驶证号码","身份证号码",
+ "身份证","累计订单量","当月订单量","积分","连续未上线(天)","状态","添加时间"};
+ EntityWrapper<TDriver> wrapper = tDriverService.getPageList(createTime,phone,status);
+ wrapper.eq("isException",2);
+ wrapper.orderBy("createTime",false);
+ List<TDriver> tDrivers = tDriverService.selectList(wrapper);
+ List<TDriverResp> tDriverResp = tDriverService.getTDriverResp(tDrivers);
+ for (TDriverResp driverResp : tDriverResp) {
+ TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>()
+ .eq("driverId", driverResp.getId())
+ .orderBy("workTime", false)
+ .last("LIMIT 1"));
+ if(Objects.nonNull(tDriverWork)){
+ // 如果是下班状态,计算未上线天数,,如果为上班状态,则设置为0
+ if(tDriverWork.getStatus() == 1){
+ driverResp.setNotOnlineCount(0);
+ }else {
+ Period period = Period.between(DateUtil.dateToLocalDate(tDriverWork.getOffWorkTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(Math.abs(period.getDays()));
+ }
+ }else {
+ // 没有上班记录,计算审核时间
+ Period period = Period.between(DateUtil.dateToLocalDate(driverResp.getApprovalTime()), LocalDate.now());
+ driverResp.setNotOnlineCount(Math.abs(period.getDays()));
+ }
+ }
+
+ String[][] values = new String[tDriverResp.size()][];
+ for (int i = 0; i < tDriverResp.size(); i++) {
+ TDriverResp d = tDriverResp.get(i);
+ values[i] = new String[title.length];
+ values[i][0] = d.getCode();
+ values[i][1] = d.getName();
+ values[i][2] = d.getPhone();
+ Integer sex = d.getSex();
+ if(Objects.isNull(sex)){
+ values[i][3] = "未知";
+ }else if(1 == sex){
+ values[i][3] = "男";
+ }else if(2 == sex){
+ values[i][3] = "女";
+ }
+ values[i][4] = d.getDriverLicenseNumber();
+ values[i][5] = d.getIdcard();
+ if(StringUtils.hasLength(d.getIdcardFront())){
+ values[i][6] = "已上传";
+ }else {
+ values[i][6] = "未上传";
+ }
+ values[i][7] = String.valueOf(d.getCumulativeOrderCount());
+ values[i][8] = String.valueOf(d.getMonthOrderCount());
+ values[i][9] = String.valueOf(d.getIntegral());
+ values[i][10] = String.valueOf(Objects.isNull(d.getNotOnlineCount())?0:d.getNotOnlineCount());
+ values[i][11] = "异常";
+ values[i][12] = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(d.getCreateTime());
+ }
+ HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null);
+ ExcelUtil.setResponseHeader(response, fileName);
+ OutputStream os = response.getOutputStream();
+ wb.write(os);
+ os.flush();
+ os.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ @ApiOperation(value = "导出司机佣金列表",notes="导出司机佣金列表")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
+ })
+ @RequestMapping(value = "/export-commission")
+ @ResponseBody
+ public void exportCommission(String name,String phone,Integer status,HttpServletResponse response) {
+ try {
+ Date date = new Date();
+ DateFormat format = new SimpleDateFormat("yyyyMMdd");
+ String time1 = format.format(date);
+ String fileName = "CommissionInfo"+time1+".xls";
+ String[] title = new String[] {"姓名","手机号","所属代理商","推广人数","关联人数",
+ "累计获得佣金","可提现佣金","已提现金额","状态"};
+ EntityWrapper<TDriver> wrapper = tDriverService.getCommissionPageList(name,phone,status);
+// wrapper.ne("isException",2);
+ // 是否异常
+ List<TDriver> list = tDriverService.selectList(wrapper);
+
+ List<TDriverCommissionResp> commissionResp = tDriverService.getTDriverCommissionResp(list);
+
+ String[][] values = new String[commissionResp.size()][];
+ for (int i = 0; i < commissionResp.size(); i++) {
+ TDriverCommissionResp d = commissionResp.get(i);
+ values[i] = new String[title.length];
+ values[i][0] = d.getName();
+ values[i][1] = d.getPhone();
+ values[i][2] = d.getAgentName();
+ values[i][3] = String.valueOf(Objects.isNull(d.getNumberPromoters()) ? 0:d.getNumberPromoters());
+ values[i][4] = String.valueOf(d.getConnectedPersons());
+ values[i][5] = String.valueOf(d.getAccumulatedCommission());
+ values[i][6] = String.valueOf(Objects.isNull(d.getCommission())?0:d.getCommission());
+ values[i][7] = String.valueOf(d.getWithdrawnAmount());
+ Integer status1 = d.getStatus();
+ if(1 == status1){
+ values[i][8] = "正常";
+ }else if(2 == status1){
+ values[i][8] = "冻结";
+ }else if(3 == status1){
+ values[i][8] = "已删除";
+ }
+ }
+ HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null);
+ ExcelUtil.setResponseHeader(response, fileName);
+ OutputStream os = response.getOutputStream();
+ wb.write(os);
+ os.flush();
+ os.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
--
Gitblit v1.7.1