fix : AliForExcel

master
luoyang14z7 6 years ago
parent 7b1991f71e
commit 5695e312f0

@ -5,9 +5,10 @@ import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -25,8 +26,8 @@ public class AliforexcelServiceImpl implements AliforexcelService {
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
OutputStream ous = null;
try{
JSONObject params = query.toJsonParam();
List<JSONObject> partners = clientMapper.passPartners(params);
JSONObject params = query.toJsonParam();
List<JSONObject> partners = clientMapper.passPartners(params);
httpResponse.setContentType("application/octet-stream;");
httpResponse.setCharacterEncoding("utf-8");
String fileName = "支付宝进件专用--";
@ -34,18 +35,12 @@ public class AliforexcelServiceImpl implements AliforexcelService {
httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName +query.getDatefrom() + "~" +query.getDateto() + ".xls");
ous = httpResponse.getOutputStream();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFFont font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 15);
CellStyle analysisStyle = wb.createCellStyle();
analysisStyle.setFont(font);
Sheet sheet = wb.createSheet("支付宝进件专用" );
sheet.createFreezePane(1, 2);
sheet.setDefaultColumnWidth((short) 25);
int rowNum = 0;
Row row = sheet.createRow(rowNum);
String[] title = {"公司注册名称", "对外营业名称", "","所属行业(数字代码即可)","地址","eg. Monday-Friday 09:00-20:00,Saturday-Sunday 10:00-22:00\n请注意格式","+61 452296105\n" +
"请注意格式","youtube视频介绍链接若有","门店介绍","标签"};
String[] title = {"Company name", "Store name", "Partner Code","Industry","Store address","Business hours","Contact information","Video link (optional)","Store description","Tags"};
for (int i = 0; i < title.length; i++) {
row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]);
}

@ -168,7 +168,7 @@
</select>
<select id="passPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT
company_name,short_name,client_moniker,alipayindustry,address,suburb,state,postcode,business_hours,company_phone,description
company_name,short_name,client_moniker,alipayindustry,address,suburb,state,postcode,business_hours,company_phone,merchant_introduction
from sys_clients
<where>
(approve_result=1 or (approve_result=2 and (source=1 or source=2)))

Loading…
Cancel
Save