generated from root/miduo_server
订单报错兼容
parent
341d511407
commit
2836006e24
|
@ -6,7 +6,6 @@ import com.jmfy.WebSecurityConfig;
|
|||
import com.jmfy.dao.*;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
|
||||
import com.jmfy.utils.*;
|
||||
import config.SRechargeCommodityConfig;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
|
@ -16,7 +15,6 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.ModelMap;
|
||||
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;
|
||||
|
@ -28,8 +26,6 @@ import java.lang.reflect.Method;
|
|||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -76,6 +72,9 @@ public class OrderInfoController {
|
|||
long endTime = DateUtil.timeToStamp(parameterMap.get("endTime").replace("T"," "));
|
||||
|
||||
List<Corder> cgPayOrders = findOrders(startTime, endTime, userId, "ALLORDER", "0");
|
||||
if(cgPayOrders.isEmpty()){
|
||||
throw new Exception("订单查询数据为空,导出失败!");
|
||||
}
|
||||
createOrderExcel(request,response,cgPayOrders);
|
||||
}
|
||||
|
||||
|
@ -181,7 +180,7 @@ public class OrderInfoController {
|
|||
});
|
||||
}
|
||||
// 礼包内容文字化
|
||||
corder.setProductContent(builder.substring(0,builder.length()-1).toString());
|
||||
corder.setProductContent(builder.substring(0,builder.length()).toString());
|
||||
}
|
||||
// 用户信息获取
|
||||
GSUserFinal gsUser = gsUserDao.findUserInfoCache(server,Integer.valueOf(accountid));
|
||||
|
@ -207,12 +206,11 @@ public class OrderInfoController {
|
|||
session.setAttribute("state", null);
|
||||
// 生成提示信息,
|
||||
response.setContentType("application/csv;charset=gbk");
|
||||
String codedFileName = null;
|
||||
OutputStream fOut = null;
|
||||
try
|
||||
{
|
||||
// 进行转码,使其支持中文文件名
|
||||
codedFileName = java.net.URLEncoder.encode("订单信息", "UTF-8");
|
||||
String codedFileName = java.net.URLEncoder.encode("订单信息", "UTF-8");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + codedFileName + ".xls");
|
||||
// 产生工作簿对象
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
|
@ -224,7 +222,7 @@ public class OrderInfoController {
|
|||
Field[] field = cgPayOrders.get(0).getClass().getDeclaredFields();
|
||||
//创建一行
|
||||
HSSFRow headerRow = sheet.createRow(0);
|
||||
while (cellIndex<field.length){
|
||||
while (cellIndex < field.length){
|
||||
//创建一列
|
||||
HSSFCell cell = headerRow.createCell(cellIndex);
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
|
|
Loading…
Reference in New Issue