package com.stylefeng.guns.modular.system.controller.specialTrain;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
|
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
|
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.dao.OrderCancelMapper;
|
import com.stylefeng.guns.modular.system.model.*;
|
import com.stylefeng.guns.modular.system.service.*;
|
import com.stylefeng.guns.modular.system.util.*;
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.data.domain.Sort;
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.servlet.ServletOutputStream;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.net.URLEncoder;
|
import java.util.*;
|
|
/**
|
* 快车订单控制器
|
*
|
* @author fengshuonan
|
* @Date 2020-09-02 17:28:59
|
*/
|
@Controller
|
@RequestMapping("/abnormalPay")
|
public class TAbnormalOrderPayCarController extends BaseController {
|
|
private String PREFIX = "/system/tAbnormalPayOrderCar/";
|
|
|
@Autowired
|
private TAbnormalPayOrderService tAbnormalPayOrderService;
|
|
@Autowired
|
private ShiroExtUtil shiroExtUtil;
|
|
|
/**
|
* 跳转到快车订单首页
|
*/
|
@RequestMapping("")
|
public String index(Model model) {
|
return PREFIX + "tAbnormalOrder.html";
|
}
|
|
/**
|
* 获取快车订单列表
|
*/
|
@RequestMapping(value = "/list")
|
@ResponseBody
|
public Object list(String insertTime,
|
String orderNum,
|
String userName,
|
String userPhone,
|
String passengers,
|
String passengersPhone,
|
Integer abnormalStatus
|
) {
|
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(tAbnormalPayOrderService.list(beginTime,endTime,orderNum,userName,userPhone,passengers,passengersPhone,abnormalStatus,shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId()));
|
return super.packForBT(page);
|
}
|
|
|
@GetMapping("/export")
|
@ResponseBody
|
public void export(String insertTime,
|
String orderNum,
|
String userName,
|
String userPhone,
|
String passengers,
|
String passengersPhone,
|
Integer abnormalStatus, 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 = tAbnormalPayOrderService.list(beginTime, endTime, orderNum, userName, userPhone, passengers, passengersPhone, abnormalStatus, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId());
|
|
// 表格数据【封装】
|
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("联系电话");
|
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("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("payMoney"))){
|
shellList.add(object.get("payMoney").toString());
|
}else {
|
shellList.add("-");
|
}
|
|
if(SinataUtil.isNotEmpty(object.get("payStatus"))){
|
shellList.add(object.get("payStatus").toString().equals("1")?"未支付":"已支付");
|
}else{
|
shellList.add("-");
|
}
|
|
if(SinataUtil.isNotEmpty(object.get("payTime"))){
|
shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("payTime").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("-");
|
}
|
|
dataList.add(shellList);
|
}
|
try {
|
// 调用工具类进行导出
|
ExcelExportUtil.easySheet("追偿支付单导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "追偿支付单导出记录", dataList,request, response);
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
}
|