|
|
|
@ -4,27 +4,12 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -54,38 +39,38 @@ public class CustomerImpressionImplTest {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void excel() {
|
|
|
|
|
try {
|
|
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
|
|
|
|
|
XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
Iterator<Row> rowIterator = sheet.rowIterator();
|
|
|
|
|
Row row = null;
|
|
|
|
|
Cell cell = null;
|
|
|
|
|
while (rowIterator.hasNext()) {
|
|
|
|
|
row = rowIterator.next();
|
|
|
|
|
cell = row.getCell(3);
|
|
|
|
|
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
|
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
|
|
|
|
|
if(client==null){
|
|
|
|
|
System.out.println();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
|
if(org==null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row.createCell(5).setCellValue(org.getString("name"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
|
|
|
|
|
workbook.write(out);
|
|
|
|
|
workbook.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// @Test
|
|
|
|
|
// public void excel() {
|
|
|
|
|
// try {
|
|
|
|
|
// XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
|
|
|
|
|
// XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
// Iterator<Row> rowIterator = sheet.rowIterator();
|
|
|
|
|
// Row row = null;
|
|
|
|
|
// Cell cell = null;
|
|
|
|
|
// while (rowIterator.hasNext()) {
|
|
|
|
|
// row = rowIterator.next();
|
|
|
|
|
// cell = row.getCell(3);
|
|
|
|
|
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
|
|
|
|
//
|
|
|
|
|
// JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
|
|
|
|
|
// if(client==null){
|
|
|
|
|
// System.out.println();
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
|
// if(org==null){
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// row.createCell(5).setCellValue(org.getString("name"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
|
|
|
|
|
// workbook.write(out);
|
|
|
|
|
// workbook.close();
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|