master
wangning 7 years ago
parent 14854979f8
commit 0bdb01445b

@ -28,9 +28,4 @@ public class WeekReportGenerationTask {
lastweek = DateUtils.addDays(lastweek, -7); lastweek = DateUtils.addDays(lastweek, -7);
weekReporter.generateReport(DateFormatUtils.format(lastweek, "yyyy-MM-dd"), true); weekReporter.generateReport(DateFormatUtils.format(lastweek, "yyyy-MM-dd"), true);
} }
public static void main(String[] args) {
String asd = "a sd ";
System.out.println(asd);
System.out.println(asd.trim());
}
} }

@ -54,38 +54,38 @@ public class CustomerImpressionImplTest {
// } // }
// } // }
@Test // @Test
public void excel() { // public void excel() {
try { // try {
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx"))); // XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
XSSFSheet sheet = workbook.getSheetAt(0); // XSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator(); // Iterator<Row> rowIterator = sheet.rowIterator();
Row row = null; // Row row = null;
Cell cell = null; // Cell cell = null;
while (rowIterator.hasNext()) { // while (rowIterator.hasNext()) {
row = rowIterator.next(); // row = rowIterator.next();
cell = row.getCell(3); // cell = row.getCell(3);
cell.setCellType(HSSFCell.CELL_TYPE_STRING); // cell.setCellType(HSSFCell.CELL_TYPE_STRING);
//
JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim()); // JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
if(client==null){ // if(client==null){
System.out.println(); // System.out.println();
continue; // continue;
} // }
JSONObject org = orgMapper.findOne(client.getIntValue("org_id")); // JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
if(org==null){ // if(org==null){
continue; // continue;
} // }
//
row.createCell(5).setCellValue(org.getString("name")); // row.createCell(5).setCellValue(org.getString("name"));
} // }
//
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx"); // OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
workbook.write(out); // workbook.write(out);
workbook.close(); // workbook.close();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} }
Loading…
Cancel
Save