master
wangning 7 years ago
parent bb395fc38e
commit ddee63590f

@ -28,4 +28,9 @@ public class WeekReportGenerationTask {
lastweek = DateUtils.addDays(lastweek, -7);
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());
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.apps.core.impls;
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;
@ -10,7 +11,6 @@ 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.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
@ -23,10 +23,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -44,7 +41,8 @@ public class CustomerImpressionImplTest {
private StringRedisTemplate stringRedisTemplate;
@Resource
private ClientMapper clientMapper;
@Resource
private OrgMapper orgMapper;
// @Test
// public void redisQueue() {
@ -56,75 +54,38 @@ public class CustomerImpressionImplTest {
// }
// }
@Ignore
@Test
public void excel() {
try {
List<JSONObject> asd =null;
Map<String,JSONObject> map = new HashMap<>();
asd.forEach(p->{
map.put(p.getString("sub_merchant_id"),p);
});
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/qwe.xlsx")));
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(1);
if(cell==null){
cell = row.getCell(3);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
if(client==null){
System.out.println();
continue;
}
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
JSONObject tmpOBJ = map.get(cell.getStringCellValue());
if(tmpOBJ==null){
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
if(org==null){
continue;
}
row.createCell(4).setCellValue(tmpOBJ.getString("cc"));
row.createCell(5).setCellValue(tmpOBJ.getString("maxct"));
row.createCell(5).setCellValue(org.getString("name"));
}
//
//
// if (!"Australia".equals(row.getCell(1).getStringCellValue())) {
// continue;
// }
// cell = row.getCell(0);
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
//
// JSONObject client = clientMapper.clientInfoBySubMerchantId(cell.getStringCellValue());
// if(client==null){
// continue;
// }
// row.createCell(4).setCellValue(client.getString("bd_user_name"));
// row.createCell(5).setCellValue(client.getString("client_moniker"));
// row.createCell(6).setCellValue(client.getString("short_name"));
// }
//
// XSSFSheet sheet3 = workbook.getSheetAt(3);
// Iterator<Row> rowIterator3 = sheet3.rowIterator();
// while (rowIterator3.hasNext()) {
// row = rowIterator3.next();
// if (!"Australia".equals(row.getCell(1).getStringCellValue())) {
// continue;
// }
// cell = row.getCell(0);
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
// JSONObject client = clientMapper.clientInfoBySubMerchantId(cell.getStringCellValue());
// if(client==null){
// continue;
// }
// row.createCell(4).setCellValue(client.getString("bd_user_name"));
// row.createCell(5).setCellValue(client.getString("client_moniker"));
// row.createCell(6).setCellValue(client.getString("short_name"));
// }
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/订单fin.xlsx");
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
workbook.write(out);
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Loading…
Cancel
Save