generated from root/miduo_server
订单导出功能修改
parent
a1c9137c06
commit
d05dfb2fc7
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.jmfy.WebSecurityConfig;
|
||||
import com.jmfy.dao.*;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.model.vo.OrderExcelVo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.*;
|
||||
import config.SRechargeCommodityConfig;
|
||||
|
|
@ -13,8 +14,10 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -43,39 +46,128 @@ public class OrderInfoController {
|
|||
private ChannelInfoDao channelInfoDao;
|
||||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OrderInfoController.class);
|
||||
|
||||
@RequestMapping(value = "/getOrder", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String getOrder(HttpServletRequest request, ModelMap map) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
long startTime = DateUtil.timeToStamp2(parameterMap.get("startTime").replace("T"," "));
|
||||
long endTime = DateUtil.timeToStamp2(parameterMap.get("endTime").replace("T"," "));
|
||||
String serverId = parameterMap.get("serverId");
|
||||
String userId = parameterMap.get("userId");
|
||||
String packId = parameterMap.get("packId");
|
||||
|
||||
List<Corder> cgPayOrders = findOrders(startTime, endTime, userId, packId, serverId);
|
||||
|
||||
List<Corder> cgPayOrders = findOrders(request);
|
||||
map.put("cgPayOrders",cgPayOrders);
|
||||
return "userOrderInfo";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/exportExcelRequest", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public void exportExcelRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
String userId = parameterMap.get("userId");
|
||||
long startTime = DateUtil.timeToStamp2(parameterMap.get("startTime").replace("T"," "));
|
||||
long endTime = DateUtil.timeToStamp2(parameterMap.get("endTime").replace("T"," "));
|
||||
public @ResponseBody
|
||||
int exportExcelRequest(HttpServletRequest request) throws Exception {
|
||||
String name = request.getParameter("name");
|
||||
List<Corder> orders = findOrders(request);
|
||||
TaskKit.scheduleWithFixedOne(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
exportOrderExcel(name,orders);
|
||||
}
|
||||
},1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
List<Corder> cgPayOrders = findOrders(startTime, endTime, userId, "ALLORDER", "0");
|
||||
if(cgPayOrders.isEmpty()){
|
||||
throw new Exception("订单查询数据为空,导出失败!");
|
||||
@RequestMapping(value = "/downLoadExcel", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public void downLoadExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String path = request.getParameter("path");
|
||||
// 返回文件到前台下载
|
||||
ResponseFileUtil.responseFileForLoad(path, "application/x-download;charset=utf-8",response);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deleteExcel", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int deleteExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String path = request.getParameter("path");
|
||||
File file = new File(path);
|
||||
// 删除文件
|
||||
if (file != null && file.isFile()){
|
||||
file.delete();
|
||||
return 1;
|
||||
}
|
||||
createOrderExcel(request,response,cgPayOrders);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载订单列表
|
||||
* @param request
|
||||
* @param map
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/getOrderExcelList", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String getOrderExcelList(HttpServletRequest request, ModelMap map) throws Exception {
|
||||
ArrayList<OrderExcelVo> excelVos = new ArrayList<>();
|
||||
getOrderExcelVoList(excelVos,getPath());
|
||||
map.put("excelVos",excelVos);
|
||||
return "exporOrder";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载订单列表
|
||||
* @param excelVos
|
||||
* @param path
|
||||
*/
|
||||
private void getOrderExcelVoList(List<OrderExcelVo> excelVos, String path){
|
||||
// 获取文件信息
|
||||
File file = new File(path);
|
||||
// 文件夹
|
||||
if(file.isDirectory()) {
|
||||
// 获取文件夹下的全部文件
|
||||
File[] files = file.listFiles();
|
||||
if (files != null){
|
||||
// 遍历文件
|
||||
for (File file1 : files) {
|
||||
// 文件
|
||||
if (file1.isFile()){
|
||||
// 使用【_】分割,长度为3 例子:十月订单_1_1638263074961.xls
|
||||
String[] split = file1.getName().split("_");
|
||||
if (split.length != 3){
|
||||
continue;
|
||||
}
|
||||
// 对象封装
|
||||
String fileName = split[2];
|
||||
int index = fileName.lastIndexOf('.');
|
||||
String substring = fileName.substring(0, index);
|
||||
String date = DateUtil.stampToTime(Long.parseLong(substring));
|
||||
OrderExcelVo excelVo = new OrderExcelVo(split[1], split[0], date, file1.getPath());
|
||||
excelVos.add(excelVo);
|
||||
}
|
||||
// 子目录
|
||||
else if (file1.isDirectory()){
|
||||
getOrderExcelVoList(excelVos,file1.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件路径
|
||||
*/
|
||||
private String getPath(){
|
||||
// 文件路径
|
||||
String osName = System.getProperty("os.name");
|
||||
String path = "";
|
||||
if (osName.matches("^(?i)Windows.*$")) {
|
||||
// Window 系统
|
||||
path = "conf/orderexcel/";
|
||||
} else {
|
||||
// Linux 系统
|
||||
path = "../config/orderexcel/";
|
||||
}
|
||||
// 创建路径
|
||||
File file = new File(path);
|
||||
if (!file.exists() && !file.isDirectory()){
|
||||
file.mkdirs();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,7 +180,16 @@ public class OrderInfoController {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private List<Corder> findOrders(long startTime,long endTime,String userId,String packId,String serverId) throws Exception {
|
||||
private List<Corder> findOrders(HttpServletRequest request) throws Exception {
|
||||
// 参数
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
long startTime = DateUtil.timeToStamp2(parameterMap.get("startTime").replace("T"," "));
|
||||
long endTime = DateUtil.timeToStamp2(parameterMap.get("endTime").replace("T"," "));
|
||||
String serverId = parameterMap.get("serverId");
|
||||
String userId = parameterMap.get("userId");
|
||||
String packId = parameterMap.get("packId");
|
||||
|
||||
// 获取每天的时间
|
||||
long now = DateUtil.now();
|
||||
String start = DateUtil.stampToTime(startTime);
|
||||
String end = DateUtil.stampToTime(endTime);
|
||||
|
|
@ -195,23 +296,17 @@ public class OrderInfoController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 生成订单文件
|
||||
* @param request
|
||||
* @param response
|
||||
* 导出excel到文件目录
|
||||
* @param cgPayOrders
|
||||
*/
|
||||
private void createOrderExcel(HttpServletRequest request,HttpServletResponse response,List<Corder> cgPayOrders){
|
||||
private void exportOrderExcel(String name,List<Corder> cgPayOrders){
|
||||
long start = DateUtil.now();
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("state", null);
|
||||
// 生成提示信息,
|
||||
response.setContentType("application/csv;charset=gbk");
|
||||
OutputStream fOut = null;
|
||||
FileOutputStream fOut = null;
|
||||
try
|
||||
{
|
||||
// 进行转码,使其支持中文文件名
|
||||
String codedFileName = java.net.URLEncoder.encode("订单信息", "UTF-8");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + codedFileName + ".xls");
|
||||
int excelId = seqUtils.getSequence("c_order_excel_id");
|
||||
String excel = getPath() + name + "_" + excelId + "_" + start + ".xls";
|
||||
fOut = new FileOutputStream(excel);
|
||||
// 产生工作簿对象
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFCellStyle contextstyle = workbook.createCellStyle();
|
||||
|
|
@ -292,7 +387,6 @@ public class OrderInfoController {
|
|||
}
|
||||
rowIndex++;
|
||||
}
|
||||
fOut = response.getOutputStream();
|
||||
workbook.write(fOut);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
@ -312,12 +406,10 @@ public class OrderInfoController {
|
|||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
session.setAttribute("state", "open");
|
||||
}
|
||||
LOGGER.info("导出订单操作,excel文件写入耗时:{}毫秒",DateUtil.now()-start);
|
||||
}
|
||||
|
||||
|
||||
public static Object getFieldValueByName(String fieldName, Object o) {
|
||||
try {
|
||||
String firstLetter = fieldName.substring(0, 1).toUpperCase();
|
||||
|
|
@ -330,7 +422,6 @@ public class OrderInfoController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static JSONObject sendGet(String params) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// URL url = new URL(URL);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.jmfy.model.vo;
|
||||
|
||||
public class OrderExcelVo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String date;
|
||||
private String path;
|
||||
|
||||
public OrderExcelVo() {
|
||||
}
|
||||
|
||||
public OrderExcelVo(String id, String name, String date, String path) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.date = date;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
}
|
||||
|
|
@ -47,8 +47,8 @@ public enum PowersEnum {
|
|||
// 流水日志管理500-599
|
||||
BILL_LOG(500,"流水日志管理",500,1,""),
|
||||
ITEM_LOG(501,"道具日志",500,1,"toFlowPage"),
|
||||
ORDER_LIST(502,"订单列表",500,1,"toOrderPage"),
|
||||
DOWNLOADS_ORDER_LIST(503,"下载订单列表",500,1,"toExporOrderPage"),
|
||||
ORDER_LIST(502,"订单查询和导出",500,1,"toOrderPage"),
|
||||
DOWNLOADS_ORDER_LIST(503,"订单下载列表查看",500,1,"getOrderExcelList"),
|
||||
|
||||
// 封禁管理,封禁管理600-699
|
||||
BANNED_MANAGER(600,"封禁管理",600,1,""),
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class AutoServerManager {
|
|||
// 注册人数3分钟检查一次
|
||||
if (now >= (date + TIME)) {
|
||||
// 获取服务器id
|
||||
String serverId = String.valueOf(Integer.valueOf(newServer.getServer_id()) - 1);
|
||||
String serverId = String.valueOf(Integer.parseInt(newServer.getServer_id()) - 1);
|
||||
// 注册人数
|
||||
long registerNum = serverInfoDao.getRegisterNum(serverId);
|
||||
LOGGER.info("自动开服,注册人数判断,条件值:{},当前服务器人数:{}:{}", setting.getNum(), serverId, registerNum);
|
||||
|
|
@ -130,7 +130,7 @@ public class AutoServerManager {
|
|||
boolean serverStatus = verifyServerStatus(serverInfo);
|
||||
if (serverStatus){
|
||||
// 旧服务器状态更新
|
||||
String serverId = String.valueOf(Integer.valueOf(serverInfo.getServer_id()) - 1);
|
||||
String serverId = String.valueOf(Integer.parseInt(serverInfo.getServer_id()) - 1);
|
||||
ServerInfo oldServer = serverInfoDao.getServerinfo(serverId);
|
||||
updateServer(oldServer, ServerStatusEnum.CROWDING.getId(), 0, serverId);
|
||||
// 新服务器状态更新
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 返回文件流到浏览器
|
||||
*/
|
||||
public class ResponseFileUtil {
|
||||
|
||||
/**
|
||||
* 返回前台文件流进行展示
|
||||
*
|
||||
* @param filePath 要返回的文件具体路径
|
||||
* @param contentType 例如:"image/png"
|
||||
* @param response
|
||||
*/
|
||||
public static void responseFileForShow(String filePath, String contentType, HttpServletResponse response)
|
||||
throws Exception {
|
||||
ResponseFileUtil.responseFile(filePath, contentType, false, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回前台文件流进行下载
|
||||
*
|
||||
* @param filePath 要返回的文件具体路径
|
||||
* @param contentType 例如:"application/x-download;charset=utf-8"
|
||||
* @param response
|
||||
*/
|
||||
public static void responseFileForLoad(String filePath, String contentType, HttpServletResponse response)
|
||||
throws Exception {
|
||||
ResponseFileUtil.responseFile(filePath, contentType, true, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用response返回文件流
|
||||
*
|
||||
* @param filePath 要返回的文件具体路径
|
||||
* @param contentType contentType类型
|
||||
* 例如:"application/x-download;charset=utf-8"
|
||||
* 例如:"image/png"
|
||||
* @param isLoad true时下载,false时展示
|
||||
* @param response 借助response进行流的返回
|
||||
*/
|
||||
public static void responseFile(String filePath, String contentType, boolean isLoad, HttpServletResponse response)
|
||||
throws Exception {
|
||||
// 声明工具类
|
||||
BufferedInputStream in = null;
|
||||
BufferedOutputStream out = null;
|
||||
|
||||
try {
|
||||
// 若路径为空
|
||||
if (StringUtils.isEmpty(filePath)) {
|
||||
throw new Exception("invalid filepath of null.");
|
||||
}
|
||||
|
||||
// 没找到文件
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
throw new Exception("file not exist in path [" + filePath + "]");
|
||||
}
|
||||
|
||||
// 设置MineType类型
|
||||
response.setContentType(contentType);
|
||||
|
||||
// 如果是下载,指定文件名称
|
||||
if (isLoad) {
|
||||
// 获取文件名
|
||||
String fileName = file.getName();
|
||||
response.addHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
}
|
||||
|
||||
// 输出文件流到浏览器
|
||||
in = new BufferedInputStream(new FileInputStream(filePath));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
byte[] buffer = new byte[(int) file.length()];
|
||||
int count = 0;
|
||||
while ((count = in.read(buffer, 0, (int) file.length())) != -1) {
|
||||
out.write(buffer, 0, count);
|
||||
}
|
||||
|
||||
out.flush();
|
||||
file = null;
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
// 关闭输入输出流
|
||||
closeStream(in, out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭输入输出流
|
||||
*/
|
||||
public static void closeStream(InputStream in, OutputStream out) {
|
||||
if (null != in) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != out) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,59 +37,33 @@
|
|||
href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" id="form-article-add" action="/exportExcelRequest" method="post" onsubmit="return exportExcel()">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>生成玩家订单</span>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
开始时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="datetime-local" name="startTime" class="input-text" style="width: 210px" step="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
结束时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="datetime-local" name="endTime" class="input-text" style="width: 210px" step="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red"></span>
|
||||
用户ID:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input autocomplete="off" type="text" name="userId" placeholder="游戏中的玩家id(可不填)" value=""
|
||||
class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row cl">-->
|
||||
<!-- <label class="form-label col-xs-4 col-sm-2">-->
|
||||
<!-- <span class="c-red">*</span>-->
|
||||
<!-- 游戏名称:</label>-->
|
||||
<!-- <div class="formControls col-xs-8 col-sm-9">-->
|
||||
<!-- <select name="gameId" class="input-text" id="gameId"><!–下拉列表–>-->
|
||||
<!-- <option th:each="game:${allGameName}" th:value="${game.id}" th:text="${game.name}"></option>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="submit">
|
||||
<i class="Hui-iconfont"></i> 开始导出
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
<th width="100">id</th>
|
||||
<th width="200">名字</th>
|
||||
<th width="200">时间</th>
|
||||
<th width="200">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="obj:${excelVos}">
|
||||
<!--<td><input type="checkbox" value="" name=""/></td>-->
|
||||
<td th:text="${obj.getId()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getName()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getDate()}" style="text-align: center;"></td>
|
||||
<th style="text-align: center;">
|
||||
<button type="submit" th:id="${obj.path}" class="btn btn-primary" onclick="return downloadFile(this)">
|
||||
<i class="Hui-iconfont"></i> 下载
|
||||
</button>
|
||||
<span class="startExport"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<button type="button" th:id="${obj.path}" class="btn btn-primary" onclick="return deleteFile(this)">
|
||||
<i class="Hui-iconfont"></i> 删除
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -116,51 +90,43 @@
|
|||
});
|
||||
});
|
||||
|
||||
function exportExcel() {
|
||||
var startTime = $("input[name='startTime']").val();
|
||||
var endTime = $("input[name='endTime']").val();
|
||||
|
||||
if (startTime === '' || startTime == null) {
|
||||
alert("开始时间不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (endTime === '' || endTime == null) {
|
||||
alert("结束时间不能为空!");
|
||||
return false;
|
||||
}
|
||||
function downloadFile(obj) {
|
||||
var path = $(obj).attr("id");
|
||||
var form = $("<form>");
|
||||
form.attr("style","display:none");
|
||||
form.attr("target","");
|
||||
form.attr("method","post");
|
||||
form.attr("action","/downLoadExcel");
|
||||
var input1 = $("<input>");
|
||||
input1.attr("type","hidden");
|
||||
input1.attr("name","path");
|
||||
input1.attr("value",path);
|
||||
$("body").append(form);
|
||||
form.append(input1);
|
||||
form.submit();
|
||||
form.remove();
|
||||
}
|
||||
|
||||
// var intervalFlag = true; //是否执行轮询的标志
|
||||
// // 进度查询
|
||||
// function getProgress(interVal) {
|
||||
// $._post2('/exportExcelRequestResult', {}, function (res) {
|
||||
// if (res.arrangeStatus == 0) {
|
||||
// //成功
|
||||
// clearInterval(interVal); //清空轮询
|
||||
// intervalFlag = false; //设置为不执行轮询
|
||||
// } else if (res.arrangeStatus == 1) {
|
||||
// //失败
|
||||
// clearInterval(interVal);
|
||||
// intervalFlag = false;
|
||||
// } else if (res.arrangeStatus == 2) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // 隔两秒访问
|
||||
// function interval() {
|
||||
// var pro;
|
||||
// // 定时器
|
||||
// var interVal;
|
||||
// var time = 1;
|
||||
// interVal = setInterval(function () {
|
||||
// // 获取返回对象
|
||||
// pro = getProgress(interVal);
|
||||
// startExport.html('<span style="color: red; ">正在处理..</span>');
|
||||
// }, 2000);
|
||||
// }
|
||||
|
||||
function deleteFile(obj) {
|
||||
var path = $(obj).attr("id");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"path": path
|
||||
},
|
||||
url: "/deleteExcel",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('删除成功!', {icon: 6, time: 1000});
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('删除失败', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -88,9 +88,15 @@
|
|||
<span class="c-red"></span>
|
||||
用户ID:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input autocomplete="off" type="text" name="userId" placeholder="游戏中的玩家id" value=""
|
||||
class="input-text"/>
|
||||
<span class="USERID"></span>
|
||||
<input autocomplete="off" type="text" name="userId" placeholder="游戏中的玩家id" value="" class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red"></span>
|
||||
文件名称:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input autocomplete="off" type="text" name="name" placeholder="查询不用填写,名字不能包含下划线" value="" class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -98,6 +104,7 @@
|
|||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont"></i> 查询</button>
|
||||
<button class="btn btn-primary" type="button" onclick="return tableToExcel()"><i class="Hui-iconfont"></i> 导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -127,6 +134,54 @@
|
|||
});
|
||||
});
|
||||
|
||||
function tableToExcel() {
|
||||
var startTime = $("input[name='startTime']").val();
|
||||
if (startTime === '' || startTime == null) {
|
||||
alert("导出失败,开始时间错误!");
|
||||
return false;
|
||||
}
|
||||
var endTime = $("input[name='endTime']").val();
|
||||
if (endTime === '' || endTime == null) {
|
||||
alert("导出失败,结束时间错误!");
|
||||
return false;
|
||||
}
|
||||
var name = $("input[name='name']").val();
|
||||
if (name === '' || name == null) {
|
||||
alert("导出失败,文件名不能为空!");
|
||||
return false;
|
||||
}
|
||||
if(name.indexOf("_") != -1){
|
||||
alert("导出失败,文件名不能包含下划线!");
|
||||
return false;
|
||||
}
|
||||
var serverId = $("#serverId").val();
|
||||
var userId = $("#userId").val();
|
||||
var packId = $("#packId").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"startTime": startTime,
|
||||
"endTime": endTime,
|
||||
"serverId": serverId,
|
||||
"userId": userId,
|
||||
"packId": packId,
|
||||
"name": name
|
||||
},
|
||||
url: "/exportExcelRequest",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
alert("操作成功!");
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
alert("操作失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function findFlow() {
|
||||
var serverId = $("#serverId").val();
|
||||
if (serverId === '' || serverId == null) {
|
||||
|
|
|
|||
|
|
@ -28,17 +28,9 @@
|
|||
</nav>
|
||||
<div class="page-container" style="text-align: center">
|
||||
<h2><span style="color:red;">玩家充值订单信息</span></h2>
|
||||
<div class="text-c">
|
||||
<!--<input type="text" placeholder="物品名称" name="itemName" value="" class="input-text" style="width:120px">-->
|
||||
<button onclick="return tableToExcel()" class="btn btn-primary upload-btn">
|
||||
<i class="Hui-iconfont"></i>
|
||||
导出
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="text-c">
|
||||
<div class="mt-20">
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="aa">>
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="aa">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
|
|
@ -106,60 +98,6 @@
|
|||
{"orderable": false, "aTargets": [0, 8]}// 不参与排序的列
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
function tableToExcel() {
|
||||
var titles = $("#aa").find("tr:first th"); //获得表头td数组
|
||||
var json = $("#aa").find("tr:not(:first)").map(function (i, e) {
|
||||
var getDisplay = e.style.display;
|
||||
if (getDisplay !== "none") {
|
||||
return "{" + $(e).children("td").map(function (j, el) {
|
||||
var name = $(titles[j]).html();
|
||||
return name + ":'" + $(el).html() + "'";
|
||||
}).get().join(",") + "}";
|
||||
}
|
||||
}).get().join(",");
|
||||
// var aa =JSON.stringify(json); //将JSON对象转化为JSON字符
|
||||
// alert(aa);
|
||||
// var obj = JSON.parse(cc); //由JSON字符串转换为JSON对象
|
||||
// alert(obj);
|
||||
// const jsonData = JSON.stringify(json.responseObject);
|
||||
var jsonData = eval("[" + json + "]");
|
||||
var aa = JSON.stringify(jsonData);
|
||||
var jsonData = JSON.parse(aa);//转换为json对象
|
||||
// var jsonData = JSON.stringify(aa);
|
||||
// alert(jsonData);
|
||||
// var jsonData =JSON.parse(bb);
|
||||
// alert(jsonData);
|
||||
// alert(jsonData)
|
||||
// var jsonData = [{用户id:'30006627',服务器ID:'10212',时间:'2019-04-11 00:02:51',用户等级:'100',道具名称:'0',道具数量:'0',动作后的物品存量:'4',物品操作原因:'213',增加:'0'}]
|
||||
// alert(jsonData);
|
||||
// var bb =JSON.stringify(jsonData); //将JSON对象转化为JSON字符
|
||||
// alert(bb);
|
||||
// alert(json);
|
||||
let str = "平台订单号,玩家id,支付时间,礼包id,支付方式,充值金额,区服id,角色注册时间," +
|
||||
"礼包名称,礼包内容,货币类型,货币数量,渠道名称,账号id,支付sdk,平台\n";
|
||||
for (let i = 0; i < jsonData.length; i++) {
|
||||
var parse = jsonData[i];
|
||||
// var bb =JSON.stringify(jsonData[i])
|
||||
// alert(bb);
|
||||
// var parse = JSON.parse(bb);
|
||||
// alert(parse);
|
||||
for (let item in parse) {
|
||||
str += parse[item];
|
||||
str+= "\t";
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
|
||||
let link = document.createElement("a");
|
||||
link.href = uri;
|
||||
link.download = "order.csv";
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<html xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
|
|
@ -26,19 +26,29 @@
|
|||
<h1 class="f-20 text-success">太初行管理后台</h1>
|
||||
</div>
|
||||
<div style="margin-left: 20px;font-size: 18px">
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-11-11]</h2>
|
||||
<p class="f-16"> 1、天眼封禁优化</p>
|
||||
<p class="f-16"> 2、服务器列表优化,新增缓存刷新按钮</p>
|
||||
<p class="f-16"> 3、服务器信息修改功能优化</p>
|
||||
<p class="f-16">
|
||||
ps:{ 开服时间、版本号、上次重启时间、游戏端口状态、支付端口状态 }为缓存数据,可以通过刷新缓存获取最新数据,其他数据没有缓存
|
||||
<br>
|
||||
ps:缓存刷新为后台执行,点击刷新后缓存状态会更改为
|
||||
<span style="color: red">检测中</span>,前端无法立即获得结果,刷新结果需要重新获取界面信息
|
||||
<br>
|
||||
ps:想要快速获得数据,可以在点击刷新按钮后,间隔1-2分钟后点击右上角绿色刷新按钮,缓存状态变为
|
||||
<div>
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-12-01]</h2>
|
||||
<p class="f-16" style="line-height:40px;">
|
||||
1、订单导出功能大改,解决下载订单需要在页面卡半天的问题,详细修改如下:<br>
|
||||
(1)订单列表的两个按钮改为:《订单查询和导出》 和 《订单下载列表》<br>
|
||||
《订单查询和导出》负责订单的查询和导出,导出需要输入文件名称,文件名称不能包含下划线"_"<br>
|
||||
(2)导出改为在服务器后台导出订单,导出完成的订单会在《订单下载列表》展示出来,可以通过下载按钮下载到本地<br>
|
||||
导出依然需要时间,所以不会第一时间在下载列表展示出来,可以等几分钟再查看,期间可以切换和操作其他功能
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-11-11]</h2>
|
||||
<p class="f-16" style="line-height:40px;">
|
||||
1、天眼封禁优化<br>
|
||||
2、服务器列表优化,新增缓存刷新按钮<br>
|
||||
3、服务器信息修改功能优化<br>
|
||||
ps:{ 开服时间、版本号、上次重启时间、游戏端口状态、支付端口状态 }为缓存数据,可以通过刷新缓存获取最新数据,其他数据没有缓存<br>
|
||||
ps:缓存刷新为后台执行,点击刷新后缓存状态会更改为<br>
|
||||
<span style="color: red">检测中</span>,前端无法立即获得结果,刷新结果需要重新获取界面信息<br>
|
||||
ps:想要快速获得数据,可以在点击刷新按钮后,间隔1-2分钟后点击右上角绿色刷新按钮,缓存状态变为<br>
|
||||
<span style="color: green">检测完成</span>代表是数据刷新成功,为目前最新数据
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer mt-20">
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in New Issue