|
|
@@ -45,66 +45,13 @@ public class ExcelServiceImpl implements ExcelService{
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
|
|
DataTemplet dataTemplet = dataTempletMapper.selectByCaller(caller, companyId);
|
|
|
+ //列
|
|
|
String cols = dataTemplet.getDt_columns();
|
|
|
- /* String cols = "[{\"description\":\"物料编号\",\"necessary\":\"true\"},{\"description\":\"物料名称\",\"necessary\":\"true\"},{\"description\":\"物料类型\",\"necessary\":\"true\"},{\"description\":\"仓库编号\",\"necessary\":\"true\"},{\"description\":\"仓库名称\",\"necessary\":\"true\"}]";
|
|
|
- cols = "[{\"description\":\"物料编号\",\"necessary\":\"true\",\"position\":\"main\",\"field\":\"pr_code\",\"codefield\":true}," +
|
|
|
- "{\"description\":\"物料名称\",\"necessary\":\"true\",\"position\":\"main\",\"field\":\"pr_detail\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"更新时间\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"updateTime\",\"codefield\":false,\"type\":\"date\"}," +
|
|
|
- "{\"description\":\"规格\",\"necessary\":\"true\",\"position\":\"main\",\"field\":\"pr_spec\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"类型\",\"necessary\":\"true\",\"position\":\"main\",\"field\":\"pr_kind\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"型号\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_orispeccode\",\"codefield\":false}" +
|
|
|
- ",{\"description\":\"品牌\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_brand\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"单位\",\"necessary\":\"true\",\"position\":\"main\",\"field\":\"pr_unit\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"仓库编号\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_whcode\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"仓库名称\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_whname\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"最新采购单价\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_purcprice\",\"codefield\":false}" +
|
|
|
- ",{\"description\":\"最新出货单价\",\"necessary\":\"false\",\"position\":\"main\",\"field\":\"pr_saleprice\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"替代料仓库编号\",\"necessary\":\"true\",\"position\":\"detail\",\"field\":\"pd_whcode\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"替代料仓库名称\",\"necessary\":\"false\",\"position\":\"detail\",\"field\":\"pd_whname\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"期初数量\",\"necessary\":\"true\",\"position\":\"detail\",\"field\":\"pd_num\",\"codefield\":false}," +
|
|
|
- "{\"description\":\"单位成本\",\"necessary\":\"true\",\"position\":\"detail\",\"field\":\"pd_price\",\"codefield\":false}]";
|
|
|
- */
|
|
|
JSONArray array = (JSONArray) JSONArray.parse(cols);
|
|
|
+ //模板数据
|
|
|
String remark = dataTemplet.getDt_description();
|
|
|
- //String exampledata = dataTemplet.getDt_exampledata();
|
|
|
- //JSONArray datas = (JSONArray) JSONArray.parse(exampledata);
|
|
|
- JSONArray datas = new JSONArray();
|
|
|
- JSONObject data = new JSONObject();
|
|
|
- data.put("物料编号", "code1");
|
|
|
- data.put("物料名称", "name1");
|
|
|
- data.put("规格", "spec1");
|
|
|
- data.put("型号", "kind1");
|
|
|
- data.put("品牌", "brand1");
|
|
|
- data.put("更新时间", "2018-09-08");
|
|
|
- data.put("单位", "nuit1");
|
|
|
- data.put("类型", "leixin1");
|
|
|
- data.put("仓库编号", "whcode1");
|
|
|
- data.put("仓库名称", "whname1");
|
|
|
- data.put("最新采购单价", "100");
|
|
|
- data.put("最新出货单价", "22");
|
|
|
- data.put("替代料仓库编号", "tcode1");
|
|
|
- data.put("替代料仓库名称", "tname1");
|
|
|
- data.put("期初数量", "22");
|
|
|
- data.put("单位成本", "22");
|
|
|
- datas.add(data);
|
|
|
- JSONObject data2 = new JSONObject();
|
|
|
- data2.put("物料编号", "code2");
|
|
|
- data2.put("物料名称", "name2");
|
|
|
- data2.put("规格", "spec2");
|
|
|
- data2.put("型号", "kind2");
|
|
|
- data2.put("品牌", "brand2");
|
|
|
- data2.put("单位", "nuit2");
|
|
|
- data2.put("类型", "leixin2");
|
|
|
- data2.put("仓库编号", "whcode2");
|
|
|
- data2.put("仓库名称", "whname2");
|
|
|
- data2.put("最新采购单价", "100");
|
|
|
- data2.put("最新出货单价", "22");
|
|
|
- data2.put("替代料仓库编号", "tcode2");
|
|
|
- data2.put("替代料仓库名称", "tname2");
|
|
|
- data2.put("期初数量", "22");
|
|
|
- data2.put("单位成本", "22");
|
|
|
- datas.add(data2);
|
|
|
- System.out.println(datas.toJSONString());
|
|
|
+ String exampledata = dataTemplet.getDt_exampledata();
|
|
|
+ JSONArray datas = (JSONArray) JSONArray.parse(exampledata);
|
|
|
createWorkbook(workbook, 1, array, datas, remark);
|
|
|
map.put("workbook", workbook);
|
|
|
map.put("title", dataTemplet.getDt_title());
|