Commit d4f72cf12ff31dd68ea04447a099aa72081e6a51

Authored by 郑超
1 parent 24dd1145

update

src/main/java/com/cnlive/shenhe/controller/ContentController.java
@@ -248,65 +248,70 @@ public class ContentController extends BaseController { @@ -248,65 +248,70 @@ public class ContentController extends BaseController {
248 String fileName = "图文数据"; 248 String fileName = "图文数据";
249 249
250 XSSFWorkbook wb = new XSSFWorkbook(); 250 XSSFWorkbook wb = new XSSFWorkbook();
251 - ServletOutputStream out = null; 251 + ServletOutputStream out;
252 BufferedInputStream bis = null; 252 BufferedInputStream bis = null;
253 BufferedOutputStream bos = null; 253 BufferedOutputStream bos = null;
254 try { 254 try {
255 XSSFSheet sheetlist = wb.createSheet(fileName); 255 XSSFSheet sheetlist = wb.createSheet(fileName);
256 - XSSFRow row = sheetlist.createRow(0);//行  
257 - XSSFCell cell = row.createCell(0);//列 256 + //行
  257 + XSSFRow row = sheetlist.createRow(0);
  258 + //列
  259 + XSSFCell cell = row.createCell(0);
258 cell.setCellValue("id"); 260 cell.setCellValue("id");
259 - cell = row.createCell(1);//列 261 + cell = row.createCell(1);
260 cell.setCellValue("sp昵称"); 262 cell.setCellValue("sp昵称");
261 - cell = row.createCell(2);//列 263 + cell = row.createCell(2);
262 cell.setCellValue("图文id"); 264 cell.setCellValue("图文id");
263 - cell = row.createCell(3);//列 265 + cell = row.createCell(3);
264 cell.setCellValue("内容标题"); 266 cell.setCellValue("内容标题");
265 - cell = row.createCell(4);//列 267 + cell = row.createCell(4);
266 cell.setCellValue("图文标签"); 268 cell.setCellValue("图文标签");
267 - cell = row.createCell(5);//列 269 + cell = row.createCell(5);
268 cell.setCellValue("审核类型"); 270 cell.setCellValue("审核类型");
269 - cell = row.createCell(6);//列 271 + cell = row.createCell(6);
270 cell.setCellValue("内容状态"); 272 cell.setCellValue("内容状态");
271 - cell = row.createCell(7);//列 273 + cell = row.createCell(7);
272 cell.setCellValue("图文创建时间"); 274 cell.setCellValue("图文创建时间");
273 - cell = row.createCell(8);//列 275 + cell = row.createCell(8);
274 cell.setCellValue("图文送审时间"); 276 cell.setCellValue("图文送审时间");
275 - cell = row.createCell(9);//列 277 + cell = row.createCell(9);
276 cell.setCellValue("领取状态"); 278 cell.setCellValue("领取状态");
277 - cell = row.createCell(10);//列 279 + cell = row.createCell(10);
278 cell.setCellValue("审核人"); 280 cell.setCellValue("审核人");
279 - cell = row.createCell(11);//列 281 + cell = row.createCell(11);
280 cell.setCellValue("审核意见"); 282 cell.setCellValue("审核意见");
281 - cell = row.createCell(12);//列 283 + cell = row.createCell(12);
282 cell.setCellValue("来源(昵称)"); 284 cell.setCellValue("来源(昵称)");
283 - cell = row.createCell(13);//列 285 + cell = row.createCell(13);
284 cell.setCellValue("作者(sid)"); 286 cell.setCellValue("作者(sid)");
285 - cell = row.createCell(14);//列 287 + cell = row.createCell(14);
286 cell.setCellValue("图文url"); 288 cell.setCellValue("图文url");
287 289
288 for (int i = 0; i < contentList.size(); i++) { 290 for (int i = 0; i < contentList.size(); i++) {
289 - row = sheetlist.createRow((short) (i + 1));//行  
290 - cell = row.createCell(0);//列 291 + //行
  292 + row = sheetlist.createRow((short) (i + 1));
  293 + cell = row.createCell(0);
291 cell.setCellValue(contentList.get(i).getId()); 294 cell.setCellValue(contentList.get(i).getId());
292 - cell = row.createCell(1);//列 295 + cell = row.createCell(1);
293 cell.setCellValue(sitesService.findspidDescByspid(contentList.get(i).getSp_id()).getName()); 296 cell.setCellValue(sitesService.findspidDescByspid(contentList.get(i).getSp_id()).getName());
294 - cell = row.createCell(2);//列 297 + cell = row.createCell(2);
295 cell.setCellValue(contentList.get(i).getContent_id()); 298 cell.setCellValue(contentList.get(i).getContent_id());
296 - cell = row.createCell(3);//列 299 + cell = row.createCell(3);
297 cell.setCellValue(contentList.get(i).getTitle()); 300 cell.setCellValue(contentList.get(i).getTitle());
298 /*状态需要处理成用户可读*/ 301 /*状态需要处理成用户可读*/
299 - String contentTag = "";//图文标签 content:图文发布,moment:朋友圈 302 + //图文标签 content:图文发布,moment:朋友圈
  303 + String contentTag = "";
300 if (contentList.get(i).getContent_tag().equals("content")) { 304 if (contentList.get(i).getContent_tag().equals("content")) {
301 contentTag = "图文发布"; 305 contentTag = "图文发布";
302 } else if (contentList.get(i).getContent_tag().equals("moment")) { 306 } else if (contentList.get(i).getContent_tag().equals("moment")) {
303 contentTag = "朋友圈"; 307 contentTag = "朋友圈";
304 } 308 }
305 - cell = row.createCell(4);//列 309 + cell = row.createCell(4);
306 cell.setCellValue(contentTag); 310 cell.setCellValue(contentTag);
307 311
308 /*状态需要处理成用户可读*/ 312 /*状态需要处理成用户可读*/
309 - String shenheType = "";//审核类型,1:免审,2:机审,3:人工审 313 + //审核类型,1:免审,2:机审,3:人工审
  314 + String shenheType;
310 if (contentList.get(i).getShenhe_type() == 1) { 315 if (contentList.get(i).getShenhe_type() == 1) {
311 shenheType = "免审"; 316 shenheType = "免审";
312 } else if (contentList.get(i).getShenhe_type() == 2) { 317 } else if (contentList.get(i).getShenhe_type() == 2) {
@@ -314,30 +319,34 @@ public class ContentController extends BaseController { @@ -314,30 +319,34 @@ public class ContentController extends BaseController {
314 } else { 319 } else {
315 shenheType = "人工审"; 320 shenheType = "人工审";
316 } 321 }
317 - cell = row.createCell(5);//列 322 + //列
  323 + cell = row.createCell(5);
318 cell.setCellValue(shenheType); 324 cell.setCellValue(shenheType);
319 -  
320 /*状态需要处理成用户可读*/ 325 /*状态需要处理成用户可读*/
321 - String contentStatus = "";//内容状态:0:待发布,1:已发布,2:已下线,3:已删除  
322 - if (contentList.get(i).getContent_status()==0) {  
323 - contentStatus = "待发布";  
324 - } else if (contentList.get(i).getContent_status() == 1) {  
325 - contentStatus = "已发布";  
326 - } else if (contentList.get(i).getContent_status() == 2) {  
327 - contentStatus = "已下线";  
328 - } else if (contentList.get(i).getContent_status() == 3) {  
329 - contentStatus = "已删除"; 326 + //内容状态:0:待发布,1:已发布,2:已下线,3:已删除
  327 + Integer contentState = contentList.get(i).getContent_status();
  328 + String contentStatus = "";
  329 + if (contentState != null) {
  330 + if (contentState == 0) {
  331 + contentStatus = "待发布";
  332 + } else if (contentState == 1) {
  333 + contentStatus = "已发布";
  334 + } else if (contentState == 2) {
  335 + contentStatus = "已下线";
  336 + } else if (contentState == 3) {
  337 + contentStatus = "已删除";
  338 + }
330 } 339 }
331 -  
332 - cell = row.createCell(6);//列 340 + cell = row.createCell(6);
333 cell.setCellValue(contentStatus); 341 cell.setCellValue(contentStatus);
334 - cell = row.createCell(7);//列 342 + cell = row.createCell(7);
335 cell.setCellValue(contentList.get(i).getContent_time() == null ? "" : CommonUtils.formatDate(contentList.get(i).getContent_time(), "yyyy-MM-dd HH:mm:ss")); 343 cell.setCellValue(contentList.get(i).getContent_time() == null ? "" : CommonUtils.formatDate(contentList.get(i).getContent_time(), "yyyy-MM-dd HH:mm:ss"));
336 - cell = row.createCell(8);//列 344 + cell = row.createCell(8);
337 cell.setCellValue(contentList.get(i).getCreate_date() == null ? "" : CommonUtils.formatDate(contentList.get(i).getCreate_date(), "yyyy-MM-dd HH:mm:ss")); 345 cell.setCellValue(contentList.get(i).getCreate_date() == null ? "" : CommonUtils.formatDate(contentList.get(i).getCreate_date(), "yyyy-MM-dd HH:mm:ss"));
338 346
339 /*状态需要处理成用户可读*/ 347 /*状态需要处理成用户可读*/
340 - String receiveStatus = "";//领取状态。0:未领取;1:已领取,2:已审核 348 + //领取状态。0:未领取;1:已领取,2:已审核
  349 + String receiveStatus;
341 if (contentList.get(i).getReceive_status() == 1) { 350 if (contentList.get(i).getReceive_status() == 1) {
342 receiveStatus = "已领取"; 351 receiveStatus = "已领取";
343 } else if (contentList.get(i).getReceive_status() == 2) { 352 } else if (contentList.get(i).getReceive_status() == 2) {
@@ -345,12 +354,12 @@ public class ContentController extends BaseController { @@ -345,12 +354,12 @@ public class ContentController extends BaseController {
345 } else { 354 } else {
346 receiveStatus = "未领取"; 355 receiveStatus = "未领取";
347 } 356 }
348 -  
349 - cell = row.createCell(9);//列 357 + cell = row.createCell(9);
350 cell.setCellValue(receiveStatus); 358 cell.setCellValue(receiveStatus);
351 359
352 /* 审核员需要做处理*/ 360 /* 审核员需要做处理*/
353 - String updater = "";//审核员名字 361 + //审核员名字
  362 + String updater = "";
354 if (!contentList.get(i).getReceive_status().equals(CommonConst.RECEIVE_BEFORE)) { 363 if (!contentList.get(i).getReceive_status().equals(CommonConst.RECEIVE_BEFORE)) {
355 updater = CommonUtils.isEmpty(contentList.get(i).getUpdater()) || "null".equals(contentList.get(i).getUpdater()) ? "自动通过" : contentList.get(i).getUpdater(); 364 updater = CommonUtils.isEmpty(contentList.get(i).getUpdater()) || "null".equals(contentList.get(i).getUpdater()) ? "自动通过" : contentList.get(i).getUpdater();
356 String auditor_id = contentList.get(i).getAuditor_id(); 365 String auditor_id = contentList.get(i).getAuditor_id();
@@ -365,17 +374,16 @@ public class ContentController extends BaseController { @@ -365,17 +374,16 @@ public class ContentController extends BaseController {
365 } 374 }
366 } 375 }
367 } 376 }
368 - cell = row.createCell(10);//列 377 + cell = row.createCell(10);
369 cell.setCellValue(updater); 378 cell.setCellValue(updater);
370 379
371 -  
372 - cell = row.createCell(11);//列 380 + cell = row.createCell(11);
373 cell.setCellValue(contentList.get(i).getShenhe_msg()); 381 cell.setCellValue(contentList.get(i).getShenhe_msg());
374 - cell = row.createCell(12);//列 382 + cell = row.createCell(12);
375 cell.setCellValue(contentList.get(i).getSource()); 383 cell.setCellValue(contentList.get(i).getSource());
376 - cell = row.createCell(13);//列 384 + cell = row.createCell(13);
377 cell.setCellValue(contentList.get(i).getAuthor()); 385 cell.setCellValue(contentList.get(i).getAuthor());
378 - cell = row.createCell(14);//列 386 + cell = row.createCell(14);
379 cell.setCellValue(contentList.get(i).getContent_url()); 387 cell.setCellValue(contentList.get(i).getContent_url());
380 } 388 }
381 389