|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+package com.chinaitop.depot.utils;
|
|
|
2
|
+
|
|
|
3
|
+import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
4
|
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
|
5
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
6
|
+import org.apache.poi.hssf.util.HSSFColor;
|
|
|
7
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
8
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
9
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
10
|
+import org.springframework.stereotype.Service;
|
|
|
11
|
+import org.springframework.util.StringUtils;
|
|
|
12
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
13
|
+
|
|
|
14
|
+import com.chinaitop.depot.business.model.BusinessDeliveryStorageNotice;
|
|
|
15
|
+import com.chinaitop.depot.business.model.BusinessStoreWareDetail;
|
|
|
16
|
+import com.chinaitop.depot.common.util.ExcelImportUtils;
|
|
|
17
|
+import com.chinaitop.depot.feign.BasicEnumFeignService;
|
|
|
18
|
+import com.chinaitop.depot.feign.OrgFeignService;
|
|
|
19
|
+
|
|
|
20
|
+import javax.annotation.Resource;
|
|
|
21
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
22
|
+import java.io.*;
|
|
|
23
|
+import java.math.BigDecimal;
|
|
|
24
|
+import java.text.SimpleDateFormat;
|
|
|
25
|
+import java.util.ArrayList;
|
|
|
26
|
+import java.util.HashMap;
|
|
|
27
|
+import java.util.List;
|
|
|
28
|
+import java.util.Map;
|
|
|
29
|
+
|
|
|
30
|
+/**
|
|
|
31
|
+ *
|
|
|
32
|
+ * @author My Sunshine
|
|
|
33
|
+ *
|
|
|
34
|
+ */
|
|
|
35
|
+@Service
|
|
|
36
|
+public class NoticeImportServiceImpl {
|
|
|
37
|
+
|
|
|
38
|
+ @Resource
|
|
|
39
|
+ private BasicEnumFeignService basicEnumFeignService;
|
|
|
40
|
+ @Resource
|
|
|
41
|
+ private OrgFeignService orgFeignService;
|
|
|
42
|
+
|
|
|
43
|
+ public Map<String, Object> temperData(String templatePath, HttpServletRequest request,
|
|
|
44
|
+ BusinessDeliveryStorageNotice deliveryStorageNotice, List<BusinessStoreWareDetail> storeWareDetailList) throws Exception {
|
|
|
45
|
+ // TODO Auto-generated method stub
|
|
|
46
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
47
|
+ // 服务器路径
|
|
|
48
|
+ String rootPath = request.getSession().getServletContext().getRealPath("");
|
|
|
49
|
+ //String rootPath = "D:\\eclipse_workspace\\work\\depot-yunnan\\depot-web-yunnan\\src\\main\\resources\\static\\app\\business";
|
|
|
50
|
+
|
|
|
51
|
+ // 文件相对路径
|
|
|
52
|
+ String relativePath = "/通知单详情导出模板.xlsx";
|
|
|
53
|
+ //读取临时文件,并且返回错误信息
|
|
|
54
|
+ String fileAllpath = rootPath+relativePath;
|
|
|
55
|
+ //创建临时文件
|
|
|
56
|
+ createTemp(templatePath,fileAllpath);
|
|
|
57
|
+// String fileAllpath = "E:\\粮食品种统计模板.xlsx";
|
|
|
58
|
+ //获取File
|
|
|
59
|
+ File tempFile = new File(fileAllpath);
|
|
|
60
|
+ //获取第四行数据
|
|
|
61
|
+ Workbook workbook = getWorkbook(tempFile,fileAllpath);
|
|
|
62
|
+ //向临时模板写入数据
|
|
|
63
|
+ setFileName(workbook,deliveryStorageNotice,storeWareDetailList);
|
|
|
64
|
+
|
|
|
65
|
+ // 首先要创建一个原始Excel文件的输出流对象!
|
|
|
66
|
+ FileOutputStream excelFileOutPutStream = new FileOutputStream(fileAllpath);
|
|
|
67
|
+ // 将最新的 Excel 文件写入到文件输出流中,更新文件信息!
|
|
|
68
|
+ workbook.write(excelFileOutPutStream);
|
|
|
69
|
+ // 执行 flush 操作, 将缓存区内的信息更新到文件上
|
|
|
70
|
+ excelFileOutPutStream.flush();
|
|
|
71
|
+ // 使用后,及时关闭这个输出流对象, 好习惯,再强调一遍!
|
|
|
72
|
+ excelFileOutPutStream.close();
|
|
|
73
|
+ modelMap.put("fileAllpath",fileAllpath);
|
|
|
74
|
+ return modelMap;
|
|
|
75
|
+
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+
|
|
|
79
|
+ /**
|
|
|
80
|
+ * 创建临时文件
|
|
|
81
|
+ * @param oldPath 老的文件目录
|
|
|
82
|
+ * @param newPath 新的文件目录
|
|
|
83
|
+ * @throws Exception
|
|
|
84
|
+ */
|
|
|
85
|
+ public void createTemp(String oldPath, String newPath) throws Exception{
|
|
|
86
|
+ File oldFile = new File(oldPath);
|
|
|
87
|
+ File file = new File(newPath);
|
|
|
88
|
+ FileInputStream in = new FileInputStream(oldFile);
|
|
|
89
|
+ FileOutputStream out = new FileOutputStream(file);;
|
|
|
90
|
+
|
|
|
91
|
+ byte[] buffer=new byte[2097152];
|
|
|
92
|
+ int readByte = 0;
|
|
|
93
|
+ while((readByte = in.read(buffer)) != -1){
|
|
|
94
|
+ out.write(buffer, 0, readByte);
|
|
|
95
|
+ }
|
|
|
96
|
+
|
|
|
97
|
+ in.close();
|
|
|
98
|
+ out.close();
|
|
|
99
|
+ }
|
|
|
100
|
+
|
|
|
101
|
+ //获取workbook
|
|
|
102
|
+ private Workbook getWorkbook(File file ,String FileName){
|
|
|
103
|
+ Workbook wb = null;
|
|
|
104
|
+ try {
|
|
|
105
|
+ InputStream is = new FileInputStream(file);
|
|
|
106
|
+ if(ExcelImportUtils.isExcel2007(FileName)) {
|
|
|
107
|
+ wb = new XSSFWorkbook(is);
|
|
|
108
|
+ }
|
|
|
109
|
+ else {
|
|
|
110
|
+ wb = new HSSFWorkbook(is);
|
|
|
111
|
+ }
|
|
|
112
|
+ } catch (IOException e) {
|
|
|
113
|
+ e.printStackTrace();
|
|
|
114
|
+ }
|
|
|
115
|
+ return wb;
|
|
|
116
|
+ }
|
|
|
117
|
+
|
|
|
118
|
+
|
|
|
119
|
+
|
|
|
120
|
+ //向临时模板写入数据
|
|
|
121
|
+ private void setFileName(Workbook workbook,BusinessDeliveryStorageNotice deliveryStorageNotice, List<BusinessStoreWareDetail> storeWareDetailList){
|
|
|
122
|
+
|
|
|
123
|
+ CellStyle cellStyle = workbook.createCellStyle();
|
|
|
124
|
+ cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
|
|
125
|
+ //cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THICK);
|
|
|
126
|
+ //cellStyle.setBottomBorderColor(HSSFColor.RED.index);
|
|
|
127
|
+ Sheet sheetX = workbook.getSheetAt(0);
|
|
|
128
|
+ Row row = sheetX.getRow(2);
|
|
|
129
|
+
|
|
|
130
|
+ //写数据
|
|
|
131
|
+ // row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getBillNumber());//通知单编号
|
|
|
132
|
+ //通知单编号
|
|
|
133
|
+ Cell cell= row.createCell(1);
|
|
|
134
|
+ cell.setCellValue(deliveryStorageNotice.getBillNumber());
|
|
|
135
|
+ CellStyle style= workbook.createCellStyle();
|
|
|
136
|
+ style.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
137
|
+ style.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
138
|
+ cell.setCellStyle(style);
|
|
|
139
|
+ //计划编号
|
|
|
140
|
+ if(null != deliveryStorageNotice.getPlanNumber()){
|
|
|
141
|
+ Cell cell1= row.createCell(6);
|
|
|
142
|
+ cell1.setCellValue(deliveryStorageNotice.getPlanNumber());
|
|
|
143
|
+ CellStyle style1= workbook.createCellStyle();
|
|
|
144
|
+ style1.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
145
|
+ style1.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
146
|
+ cell1.setCellStyle(style1);
|
|
|
147
|
+ }
|
|
|
148
|
+ //合同编号
|
|
|
149
|
+ if(null != deliveryStorageNotice.getContract()){
|
|
|
150
|
+ Cell cell2= row.createCell(10);
|
|
|
151
|
+ cell2.setCellValue(deliveryStorageNotice.getContract());
|
|
|
152
|
+ CellStyle style2= workbook.createCellStyle();
|
|
|
153
|
+ style2.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
154
|
+ style2.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
155
|
+ cell2.setCellStyle(style2);
|
|
|
156
|
+ }
|
|
|
157
|
+
|
|
|
158
|
+
|
|
|
159
|
+
|
|
|
160
|
+ //row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getPlanNumber());//计划编号
|
|
|
161
|
+ //row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getContract());//合同编号
|
|
|
162
|
+ Row row1 = sheetX.getRow(3);
|
|
|
163
|
+ //创建时间
|
|
|
164
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:MM:ss");
|
|
|
165
|
+ Cell cell3= row1.createCell(6);
|
|
|
166
|
+ cell3.setCellValue(sf.format(deliveryStorageNotice.getCreateTime()));
|
|
|
167
|
+ CellStyle style3= workbook.createCellStyle();
|
|
|
168
|
+ style3.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
169
|
+ style3.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
170
|
+ style3.setBorderLeft(CellStyle.BORDER_THIN);//左边框
|
|
|
171
|
+ cell3.setCellStyle(style3);
|
|
|
172
|
+ row1.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getCreater());//申请人
|
|
|
173
|
+
|
|
|
174
|
+ // row1.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(sf.format(deliveryStorageNotice.getCreateTime()));//创建时间
|
|
|
175
|
+ //根据字典id 获取名称
|
|
|
176
|
+ String ysfs = basicEnumFeignService.getEnumName(Integer.valueOf(deliveryStorageNotice.getQualityStandard()));//运输方式
|
|
|
177
|
+ row1.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(ysfs);
|
|
|
178
|
+
|
|
|
179
|
+ int currentLastRowIndex = 7;
|
|
|
180
|
+
|
|
|
181
|
+ for (int i = 0; i < storeWareDetailList.size(); i++) {
|
|
|
182
|
+ if(i!=0){
|
|
|
183
|
+ currentLastRowIndex = currentLastRowIndex+1;
|
|
|
184
|
+ }
|
|
|
185
|
+ Row row2 = sheetX.getRow(currentLastRowIndex);
|
|
|
186
|
+ String grainKind = basicEnumFeignService.getEnumName(Integer.valueOf(storeWareDetailList.get(i).getGrainKind()));
|
|
|
187
|
+ String grainDetailKind = basicEnumFeignService.getEnumName(Integer.valueOf(storeWareDetailList.get(i).getGrainDetailKind()));
|
|
|
188
|
+ String grainGrade = basicEnumFeignService.getEnumName(Integer.valueOf(storeWareDetailList.get(i).getGrainGrade()));
|
|
|
189
|
+ String grainAttribute = basicEnumFeignService.getEnumName(Integer.valueOf(storeWareDetailList.get(i).getGrainAttribute()));
|
|
|
190
|
+
|
|
|
191
|
+ //row2.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(i+1);
|
|
|
192
|
+ //根据orgId获取orgName
|
|
|
193
|
+ String orgName = orgFeignService.getOrgName(storeWareDetailList.get(i).getState());
|
|
|
194
|
+ Cell cell11= row2.createCell(0);
|
|
|
195
|
+ cell11.setCellValue(orgName);
|
|
|
196
|
+ CellStyle style11= workbook.createCellStyle();
|
|
|
197
|
+ style11.setBorderLeft(CellStyle.BORDER_THIN);//左边框
|
|
|
198
|
+ style11.setAlignment(CellStyle.ALIGN_LEFT);//居左
|
|
|
199
|
+ cell11.setCellStyle(style11);
|
|
|
200
|
+
|
|
|
201
|
+
|
|
|
202
|
+ //row2.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(orgName);
|
|
|
203
|
+ row2.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getHouseName());
|
|
|
204
|
+ row2.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getWarehouseName());
|
|
|
205
|
+ row2.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(grainKind);
|
|
|
206
|
+ row2.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(grainDetailKind);
|
|
|
207
|
+ row2.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(grainAttribute);
|
|
|
208
|
+ row2.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(grainGrade);
|
|
|
209
|
+ if(deliveryStorageNotice.getBillType().equals("1")){//入库
|
|
|
210
|
+ row2.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getInCount());
|
|
|
211
|
+ if(storeWareDetailList.get(i).getPlanRemainingNumber()!=null){
|
|
|
212
|
+ row2.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getPlanRemainingNumber());
|
|
|
213
|
+ }
|
|
|
214
|
+ if(storeWareDetailList.get(i).getPlanRemainingNumber()==null && storeWareDetailList.get(i).getRemainingNumber()!=null){
|
|
|
215
|
+ row2.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getRemainingNumber());
|
|
|
216
|
+ }
|
|
|
217
|
+ row2.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getInPrice());
|
|
|
218
|
+ //金额
|
|
|
219
|
+ Cell cell4= row2.createCell(11);
|
|
|
220
|
+ cell4.setCellValue(storeWareDetailList.get(i).getInDetailTotalPrice());
|
|
|
221
|
+ CellStyle style4= workbook.createCellStyle();
|
|
|
222
|
+ style4.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
223
|
+ cell4.setCellStyle(style4);
|
|
|
224
|
+ //row2.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getInDetailTotalPrice());
|
|
|
225
|
+ }else if(deliveryStorageNotice.getBillType().equals("3")){//出库
|
|
|
226
|
+ row2.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getOutCount());
|
|
|
227
|
+ if(storeWareDetailList.get(i).getPlanOutRemainingNumber()!=null){
|
|
|
228
|
+ row2.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getPlanOutRemainingNumber());
|
|
|
229
|
+ }
|
|
|
230
|
+ if(storeWareDetailList.get(i).getPlanOutRemainingNumber()==null && storeWareDetailList.get(i).getOutRemainingNumber()!=null){
|
|
|
231
|
+ row2.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getOutRemainingNumber());
|
|
|
232
|
+ }
|
|
|
233
|
+ row2.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getOutPrice());
|
|
|
234
|
+ //金额
|
|
|
235
|
+ Cell cell4= row2.createCell(11);
|
|
|
236
|
+ cell4.setCellValue(storeWareDetailList.get(i).getOutDetailTotalPrice());
|
|
|
237
|
+ CellStyle style4= workbook.createCellStyle();
|
|
|
238
|
+ style4.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
239
|
+ cell4.setCellStyle(style4);
|
|
|
240
|
+ //row2.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(storeWareDetailList.get(i).getOutDetailTotalPrice());
|
|
|
241
|
+ }
|
|
|
242
|
+ }
|
|
|
243
|
+ //int currentLastRowIndex1 = sheetX.getLastRowNum() + 1;
|
|
|
244
|
+
|
|
|
245
|
+ //总价
|
|
|
246
|
+ Row row3 = sheetX.getRow(14);
|
|
|
247
|
+ Cell cell4= row3.createCell(2);
|
|
|
248
|
+ cell4.setCellValue(deliveryStorageNotice.getShipingCount());
|
|
|
249
|
+ CellStyle style4= workbook.createCellStyle();
|
|
|
250
|
+ style4.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
251
|
+ style4.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
252
|
+ style4.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
253
|
+ style4.setBorderLeft(CellStyle.BORDER_THIN);//左边框
|
|
|
254
|
+ cell4.setCellStyle(style4);
|
|
|
255
|
+ Cell cell5= row3.createCell(9);
|
|
|
256
|
+ cell5.setCellValue(deliveryStorageNotice.getMoneyQuantity());
|
|
|
257
|
+ CellStyle style5= workbook.createCellStyle();
|
|
|
258
|
+ style5.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
259
|
+ style5.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
260
|
+ style5.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
261
|
+ style5.setBorderLeft(CellStyle.BORDER_THIN);//左边框
|
|
|
262
|
+ cell5.setCellStyle(style5);
|
|
|
263
|
+
|
|
|
264
|
+ //row3.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getShipingCount());
|
|
|
265
|
+ //row3.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getMoneyQuantity());
|
|
|
266
|
+ //客户信息
|
|
|
267
|
+ Row row4 = sheetX.getRow(17);
|
|
|
268
|
+ Cell cell6= row4.createCell(2);
|
|
|
269
|
+ cell6.setCellValue(deliveryStorageNotice.getDeliveryCustomer());
|
|
|
270
|
+ CellStyle style6= workbook.createCellStyle();
|
|
|
271
|
+ style6.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
272
|
+ style6.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
273
|
+ style6.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
274
|
+ cell6.setCellStyle(style6);
|
|
|
275
|
+
|
|
|
276
|
+ //row4.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getDeliveryCustomer());
|
|
|
277
|
+ row4.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getIdentification());
|
|
|
278
|
+ Cell cell7= row4.createCell(11);
|
|
|
279
|
+ cell7.setCellValue(deliveryStorageNotice.getMobile());
|
|
|
280
|
+ CellStyle style7= workbook.createCellStyle();
|
|
|
281
|
+ style7.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
282
|
+ cell7.setCellStyle(style7);
|
|
|
283
|
+
|
|
|
284
|
+ //row4.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getMobile());
|
|
|
285
|
+ //备注
|
|
|
286
|
+ Row row5 = sheetX.getRow(18);
|
|
|
287
|
+ row5.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getBillMemo());
|
|
|
288
|
+ //创建信息
|
|
|
289
|
+ Row row6 = sheetX.getRow(19);
|
|
|
290
|
+ Cell cell8= row6.createCell(2);
|
|
|
291
|
+ cell8.setCellValue(sf.format(deliveryStorageNotice.getBillDate()));
|
|
|
292
|
+ CellStyle style8= workbook.createCellStyle();
|
|
|
293
|
+ style8.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
294
|
+ style8.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
295
|
+ style8.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
296
|
+ cell8.setCellStyle(style8);
|
|
|
297
|
+ Cell cell9= row6.createCell(7);
|
|
|
298
|
+ cell9.setCellValue(deliveryStorageNotice.getBillMan());
|
|
|
299
|
+ CellStyle style9= workbook.createCellStyle();
|
|
|
300
|
+ style9.setBorderTop(CellStyle.BORDER_THIN);//上边框
|
|
|
301
|
+ style9.setBorderBottom(CellStyle.BORDER_THIN);//下边框
|
|
|
302
|
+ style9.setBorderRight(CellStyle.BORDER_THIN);//右边框
|
|
|
303
|
+ cell9.setCellStyle(style9);
|
|
|
304
|
+ //row6.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(sf.format(deliveryStorageNotice.getBillDate()));
|
|
|
305
|
+ //row6.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(deliveryStorageNotice.getBillMan());
|
|
|
306
|
+
|
|
|
307
|
+
|
|
|
308
|
+ /*// ------ 创建一行新的数据 ----------//
|
|
|
309
|
+ // 指定行索引,创建一行数据, 行索引为当前最后一行的行索引 + 1
|
|
|
310
|
+
|
|
|
311
|
+
|
|
|
312
|
+ //获取仓房名称转换用数据
|
|
|
313
|
+ Map<String,Object> basicEnumFeign = basicEnumFeignService.getStorehouseList(Integer.parseInt(orgId),"0");
|
|
|
314
|
+ Map<Integer, Object> storehouseObj = (Map<Integer, Object>) basicEnumFeign.get("houseObj");
|
|
|
315
|
+ for (DataKcglKcswDefault kcswData:listNumberTotal ) {
|
|
|
316
|
+ int newRowIndex = currentLastRowIndex ++;
|
|
|
317
|
+ Row newRow = sheetX.createRow(newRowIndex);
|
|
|
318
|
+
|
|
|
319
|
+ // 开始创建并设置该行每一单元格的信息,该行单元格的索引从 0 开始
|
|
|
320
|
+ int cellIndex = 0;
|
|
|
321
|
+
|
|
|
322
|
+ // 创建一个单元格,设置其内的数据格式为字符串,并填充内容,其余单元格类同
|
|
|
323
|
+ //仓房名称
|
|
|
324
|
+ Cell cfmc = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
325
|
+ Map<String,String> houseData = (HashMap<String, String>) storehouseObj.get(kcswData.getCh().toString());
|
|
|
326
|
+ cfmc.setCellValue(houseData.get("storehouseName"));
|
|
|
327
|
+ Cell xm = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
328
|
+ //小麦
|
|
|
329
|
+ if(ParameterUtil.isequal(kcswData.getPz(),"3164")){
|
|
|
330
|
+ xm.setCellValue(kcswData.getKcsl());
|
|
|
331
|
+ }else{
|
|
|
332
|
+ xm.setCellValue("");
|
|
|
333
|
+ }
|
|
|
334
|
+ Cell dgxj = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
335
|
+ dgxj.setCellValue("");
|
|
|
336
|
+ Cell zwxd = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
337
|
+ //中晚籼稻
|
|
|
338
|
+ if(ParameterUtil.isequal(kcswData.getPz(),"3218") || ParameterUtil.isequal(kcswData.getPz(),"3219")){
|
|
|
339
|
+ zwxd.setCellValue(kcswData.getKcsl());
|
|
|
340
|
+ }else{
|
|
|
341
|
+ zwxd.setCellValue("");
|
|
|
342
|
+ }
|
|
|
343
|
+ Cell jd = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
344
|
+ //粳稻
|
|
|
345
|
+ if(ParameterUtil.isequal(kcswData.getPz(),"3220") || ParameterUtil.isequal(kcswData.getPz(),"3221")){
|
|
|
346
|
+ jd.setCellValue(kcswData.getKcsl());
|
|
|
347
|
+ }else{
|
|
|
348
|
+ jd.setCellValue("");
|
|
|
349
|
+ }
|
|
|
350
|
+ Cell ym = newRow.createCell(cellIndex++, Cell.CELL_TYPE_STRING);
|
|
|
351
|
+ //玉米
|
|
|
352
|
+ if(ParameterUtil.isequal(kcswData.getPz(),"3165")){
|
|
|
353
|
+ ym.setCellValue(kcswData.getKcsl());
|
|
|
354
|
+ }else{
|
|
|
355
|
+ ym.setCellValue("");
|
|
|
356
|
+ }
|
|
|
357
|
+ }*/
|
|
|
358
|
+ }
|
|
|
359
|
+}
|
|
|
360
|
+
|