generated from root/miduo_server
master
parent
fffd8486c8
commit
a59d2cf5a0
|
|
@ -89,6 +89,7 @@ public class OrderInfoController {
|
|||
* @throws Exception
|
||||
*/
|
||||
private List<Corder> findOrders(String startTime,String endTime,String userId,String packId,String serverId) throws Exception {
|
||||
long start = DateUtil.now();
|
||||
List<String> days = JsonUtil.getDays(startTime,endTime);
|
||||
|
||||
Map<Integer, SRechargeCommodityConfig> rechargeMap = FileCacheUtils.rechargeMap;
|
||||
|
|
@ -180,6 +181,7 @@ public class OrderInfoController {
|
|||
cgPayOrders.add(corder);
|
||||
}
|
||||
}
|
||||
LOGGER.info("导出订单操作,redis查询耗时:{}毫秒",DateUtil.now()-start);
|
||||
return cgPayOrders;
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +192,7 @@ public class OrderInfoController {
|
|||
* @param cgPayOrders
|
||||
*/
|
||||
private void createOrderExcel(HttpServletRequest request,HttpServletResponse response,List<Corder> cgPayOrders){
|
||||
LOGGER.info("订单信息导出中===============================================");
|
||||
long start = DateUtil.now();
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("state", null);
|
||||
// 生成提示信息,
|
||||
|
|
@ -304,7 +306,7 @@ public class OrderInfoController {
|
|||
}
|
||||
session.setAttribute("state", "open");
|
||||
}
|
||||
LOGGER.info("订单信息导出完成===============================================");
|
||||
LOGGER.info("导出订单操作,excel文件写入耗时:{}毫秒",DateUtil.now()-start);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ public class ExcelUtil {
|
|||
* @return
|
||||
*/
|
||||
public static String xssfDeal(MultipartFile file) throws IOException {
|
||||
// 返回的处理结果
|
||||
StringBuilder dealResult = new StringBuilder();
|
||||
// 创建workbook对象,读取整个文档
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
|
@ -34,28 +32,12 @@ public class ExcelUtil {
|
|||
int lastRowNum = sheet.getLastRowNum();
|
||||
// 判断第一列标题是否包含 “userId”
|
||||
String title = sheet.getRow(0).getCell(0).getStringCellValue();
|
||||
if (title.indexOf("userId") < 0) {
|
||||
if (!title.contains("userId")) {
|
||||
return "请注意,首列标题须为:userId!";
|
||||
} else if (lastRowNum <= 0) {
|
||||
return "您导入的excel文件为空,请重新导入!";
|
||||
}
|
||||
for (Row row : sheet) {
|
||||
// 读取每一行的单元格
|
||||
Cell cell = row.getCell(0);
|
||||
// 单元格不为空
|
||||
if (cell != null) {
|
||||
// 将该列单元格类型设置为String
|
||||
cell.setCellType(Cell.CELL_TYPE_STRING);
|
||||
// 第一列数据
|
||||
String materialCode = cell.getStringCellValue();
|
||||
if (!"".equals(materialCode) && !materialCode.contains("userId")) {
|
||||
// 拼接用户id
|
||||
dealResult.append(materialCode).append("#");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return String.valueOf(dealResult);
|
||||
return excelRead(sheet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,8 +46,6 @@ public class ExcelUtil {
|
|||
* @return
|
||||
*/
|
||||
public static String hssfDeal(InputStream inputStream) throws IOException {
|
||||
// 返回的处理结果
|
||||
StringBuilder dealResult = new StringBuilder();
|
||||
// 创建workbook对象,读取整个文档
|
||||
POIFSFileSystem poifsFileSystem = new POIFSFileSystem(inputStream);
|
||||
HSSFWorkbook wb = new HSSFWorkbook(poifsFileSystem);
|
||||
|
|
@ -73,11 +53,22 @@ public class ExcelUtil {
|
|||
HSSFSheet sheetAt = wb.getSheetAt(0);
|
||||
// 判断第一列标题是否包含 “userId”
|
||||
String title = sheetAt.getRow(0).getCell(0).getStringCellValue();
|
||||
if (title.indexOf("userId") < 0) {
|
||||
if (!title.contains("userId")) {
|
||||
return "首列标题须为:userId!";
|
||||
}
|
||||
return excelRead(sheetAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* excel读取
|
||||
* @param sheet
|
||||
* @return
|
||||
*/
|
||||
private static String excelRead(Sheet sheet){
|
||||
// 返回的处理结果
|
||||
StringBuilder dealResult = new StringBuilder();
|
||||
// 循环读取某一行
|
||||
for (Row row : sheetAt) {
|
||||
for (Row row : sheet) {
|
||||
// 读取每一行的单元格
|
||||
Cell cell = row.getCell(0);
|
||||
// 单元格不为空
|
||||
|
|
@ -91,7 +82,6 @@ public class ExcelUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return String.valueOf(dealResult);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue