| | |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.general.TDriverController; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | 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.PayMoneyUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 跨城出行订单控制器 |
| | |
| | | |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | @Resource |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | |
| | |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer lineId, |
| | | Integer state) { |
| | | Integer state, |
| | | Integer abnormal, |
| | | Integer promotion, |
| | | String promotionUser) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state)); |
| | | page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/export") |
| | | @ResponseBody |
| | | public void export(String insertTime, |
| | | String orderNum, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String passengers, |
| | | String passengersPhone, |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer lineId, |
| | | Integer state, |
| | | Integer abnormal, |
| | | Integer promotion, |
| | | String promotionUser, HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)) { |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String, Object>> list = tOrderCrossCityService.getCrossCityOrderListExport(null, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(list.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("是否异常订单"); |
| | | shellList.add("是否推广订单"); |
| | | shellList.add("推广员姓名"); |
| | | shellList.add("推广员电话"); |
| | | dataList.add(shellList); |
| | | |
| | | for (Map<String,Object> object : list){ |
| | | // 详细数据列【封装】 |
| | | 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("orderNum"))){ |
| | | shellList.add(object.get("orderNum").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | // 1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单 |
| | | if(SinataUtil.isNotEmpty(object.get("orderSource"))){ |
| | | switch (object.get("orderSource").toString()){ |
| | | case "1": |
| | | shellList.add("APP下单"); |
| | | break; |
| | | case "2": |
| | | shellList.add("扫码下单"); |
| | | break; |
| | | case "3": |
| | | shellList.add("小程序下单"); |
| | | break; |
| | | case "4": |
| | | shellList.add("司机下单"); |
| | | break; |
| | | case "5": |
| | | shellList.add("调度下单"); |
| | | break; |
| | | case "6": |
| | | shellList.add("道行龙城下单"); |
| | | break; |
| | | default: |
| | | shellList.add("-"); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("travelTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("travelTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("userName"))){ |
| | | shellList.add(object.get("userName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("userPhone"))){ |
| | | shellList.add(object.get("userPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("passengers"))){ |
| | | shellList.add(object.get("passengers").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("passengersPhone"))){ |
| | | shellList.add(object.get("passengersPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("contactPersonPhone"))){ |
| | | shellList.add(object.get("contactPersonPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("startAddress"))){ |
| | | shellList.add(object.get("startAddress").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("endAddress"))){ |
| | | shellList.add(object.get("endAddress").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("lineName"))){ |
| | | shellList.add(object.get("lineName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("serverCarModelName"))){ |
| | | shellList.add(object.get("serverCarModelName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("driver"))){ |
| | | shellList.add(object.get("driver").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("car"))){ |
| | | shellList.add(object.get("car").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("orderMoney"))){ |
| | | shellList.add(object.get("orderMoney").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | // 1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付 |
| | | if(SinataUtil.isNotEmpty(object.get("state"))){ |
| | | switch (object.get("state").toString()){ |
| | | case "1": |
| | | shellList.add("待接单"); |
| | | break; |
| | | case "2": |
| | | shellList.add("待出发"); |
| | | break; |
| | | case "3": |
| | | shellList.add("待到达预约地点"); |
| | | break; |
| | | case "4": |
| | | shellList.add("待乘客上车"); |
| | | break; |
| | | case "5": |
| | | shellList.add("服务中"); |
| | | break; |
| | | case "6": |
| | | shellList.add("完成服务"); |
| | | break; |
| | | case "7": |
| | | shellList.add("待支付"); |
| | | break; |
| | | case "8": |
| | | shellList.add("待评价"); |
| | | break; |
| | | case "9": |
| | | shellList.add("已完成"); |
| | | break; |
| | | case "10": |
| | | shellList.add("已取消"); |
| | | break; |
| | | case "11": |
| | | shellList.add("改派中"); |
| | | break; |
| | | case "12": |
| | | shellList.add("取消待支付"); |
| | | break; |
| | | default: |
| | | shellList.add("-"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("abnormal"))){ |
| | | shellList.add(object.get("abnormal").toString().equals("1")?"否":"是"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("promotion"))){ |
| | | shellList.add(object.get("promotion").toString().equals("1")?"否":"是"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("promotionUser"))){ |
| | | shellList.add(object.get("promotionUser").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("promotionPhone"))){ |
| | | shellList.add(object.get("promotionPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("订单导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "订单导出记录", dataList,request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |