Kaynağa Gözat

小麦登统表需求改造

fanxw 1 yıl önce
ebeveyn
işleme
94ab54fc58

+ 65 - 4
src/main/java/com/chinaitop/agile/controller/RegistrationController.java

@@ -259,11 +259,13 @@ public class RegistrationController {
259 259
 			@ApiImplicitParam(name = "zbr", value = "制表人", paramType = "query"),
260 260
 			@ApiImplicitParam(name = "shdw", value = "收货单位", paramType = "query"),
261 261
 			@ApiImplicitParam(name = "dwfzr", value = "单位负责人", paramType = "query"),
262
-			@ApiImplicitParam(name = "orgId", value = "组织机构ID", paramType = "query")
262
+			@ApiImplicitParam(name = "orgId", value = "组织机构ID", paramType = "query"),
263
+			@ApiImplicitParam(name = "banben", value = "版本(0:新标准,1:旧标准)", paramType = "query"),
264
+			@ApiImplicitParam(name = "sfdcqb", value = "是否导出全部(0:是,1:否)", paramType = "query")
263 265
 	})
264 266
 	public void  exportWheatListPageInfo(HttpServletResponse response,HttpServletRequest request,
265 267
 										 String houseId, String warehouseId, String startDate, String endDate,
266
-										 String zbr, String shdw, String dwfzr, String orgId){
268
+										 String zbr, String shdw, String dwfzr, String orgId, String banben, String sfdcqb){
267 269
 		Map<String,Object> map = new HashMap<String,Object>();
268 270
 		try {
269 271
 			if (null != houseId && !"".equals(houseId)) {
@@ -283,8 +285,11 @@ public class RegistrationController {
283 285
 			if (null != endDate && !"".equals(endDate)) {
284 286
 				map.put("endDate", endDate);
285 287
 			}
288
+			if (StringUtils.isBlank(banben)) {
289
+				banben = "0";
290
+			}
286 291
 			List<Map<String,Object>> list = registrationService.getWheatListPageInfo(map);
287
-			HSSFWorkbook workbook = registrationService.wheatdataTransfor(list,zbr,shdw,dwfzr);
292
+			HSSFWorkbook workbook = registrationService.wheatdataTransfor(list, zbr, shdw, dwfzr, banben, sfdcqb);
288 293
 			String fileName = "小麦登统表";
289 294
 			// 获取输出流
290 295
 			OutputStream os = response.getOutputStream();
@@ -361,7 +366,63 @@ public class RegistrationController {
361 366
 			e.printStackTrace();
362 367
 		}
363 368
 	}
364
-	
369
+
370
+	@RequestMapping(value="/exportCrudeOilListPageInfo", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
371
+	@ApiOperation(value="条件导出原油入库情况数据", notes = "条件查询和列表一致")
372
+	@ApiImplicitParams({
373
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
374
+		@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
375
+		@ApiImplicitParam(name = "tankId", value = "油罐id", paramType = "query"),
376
+		@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query"),
377
+		@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query"),
378
+		@ApiImplicitParam(name = "orgId", value = "组织机构ID", paramType = "query"),
379
+		@ApiImplicitParam(name = "zbr", value = "制表人", paramType = "query"),
380
+		@ApiImplicitParam(name = "shdw", value = "收货单位", paramType = "query"),
381
+		@ApiImplicitParam(name = "dwfzr", value = "单位负责人", paramType = "query")
382
+	})
383
+	public void exportCrudeOilListPageInfo(HttpServletResponse response, HttpServletRequest request, Integer pageNum, Integer pageSize,
384
+			String tankId, String startDate, String endDate, String orgId, String zbr, String shdw, String dwfzr){
385
+		Map<String,Object> map = new HashMap<String,Object>();
386
+		try {
387
+			if (null != tankId && !"".equals(tankId)) {
388
+				map.put("tankId", tankId);
389
+			}
390
+
391
+			if (StringUtils.isNotBlank(orgId)) {
392
+				map.put("orgId", orgId);
393
+			}
394
+
395
+			if (null != startDate && !"".equals(startDate)) {
396
+				map.put("startDate", startDate);
397
+			}
398
+			if (null != endDate && !"".equals(endDate)) {
399
+				map.put("endDate", endDate);
400
+			}
401
+			if(null != pageNum && null != pageSize){
402
+				PageHelper.startPage(pageNum, pageSize);
403
+			}
404
+			List<Map<String,Object>> list = registrationService.getCrudeOilListPageInfo(map);
405
+			HSSFWorkbook workbook = registrationService.crudeOilTransfor(list,zbr,shdw,dwfzr);
406
+			String fileName = "原油登统表";
407
+			// 获取输出流
408
+			OutputStream os = response.getOutputStream();
409
+			// 重置输出流
410
+			response.reset();
411
+			// 设定输出文件头
412
+			response.setHeader("Content-disposition", "attachment; filename=" + new String(fileName.getBytes("GB2312"), "8859_1") + ".xlsx");
413
+			//name属性设置和跨服访问有关
414
+			response.setHeader("Access-Control-Allow-Origin", "*");
415
+			// 定义输出内容类型
416
+			response.setContentType("application/vnd.ms-excel;charset=gb2312");
417
+			workbook.write(os);
418
+			//关闭流
419
+			os.close();
420
+			return;
421
+		} catch (Exception e) {
422
+			e.printStackTrace();
423
+		}
424
+	}
425
+
365 426
 	@RequestMapping(value="/test", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
366 427
 	@ApiOperation(value="测试")
367 428
 	@ApiImplicitParams({

+ 25 - 18
src/main/java/com/chinaitop/agile/mapper/DataKcglKcswDefaultMapper.xml

@@ -530,7 +530,7 @@
530 530
             a.cph as cphm, b.sjcfbh as cf, b.sjhwbh as hw, c.enumname as lspz, d.enumname scnf,
531 531
             b.cpzsj as rq, b.xzklhjz as rksl, e.enumname lsdj, sf.sf, rz.rz, zzzl.zzzl, 
532 532
             kwz.kwz, wjzz.wjzz, yjzz.yjzz, sxw.sxw, bwslzl.bwslzl, csl.csl, bblzl.bblzl, hpl.hpl, 
533
-            cmbl.cmbl, psl.psl, syl.syl, sml.sml, szqw.szqw, ydzs.ydzs, substr(be.enumname,0,2) ccfs   
533
+            cmbl.cmbl, psl.psl, syl.syl, sml.sml, szqw.szqw, ydzs.ydzs, rssl.rssl, substr(be.enumname,0,2) ccfs   
534 534
         FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
535 535
               from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
536 536
         inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
@@ -711,6 +711,16 @@
711 711
             	and jyxx.unitid = #{orgId} 
712 712
 		     </if>
713 713
         ) ydzs on ydzs.bizno = a.bizno
714
+        left join(
715
+             select jyxx.bizno,flt.jyz as rssl
716
+             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
717
+              from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
718
+             left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
719
+             where flt.zbxmc = '402882e87318022e017318e470090045'
720
+			 <if test="orgId != null">
721
+            	and jyxx.unitid = #{orgId} 
722
+		     </if>
723
+        ) rssl on rssl.bizno = a.bizno
714 724
         WHERE nvl(a.BizNo,'-1') != '-1' and  a.lspz = '3164'
715 725
 		<if test="orgId != null">
716 726
         	and jyxx.unitid = #{orgId} 
@@ -733,7 +743,7 @@
733 743
 		select wheat.clbh cphm,wheat.cfmc cf,wheat.hwmc hw,wheat.pzmc lspz,wheat.scnd scnf,
734 744
 			wheat.rkrq rq,wheat.rksl*1000 rksl,wheat.dj lsdj,wheat.sf,wheat.rz,wheat.zzzl,
735 745
 			wheat.zzkwz kwz,wheat.wjzz,wheat.yjzz, wheat.sxw, wheat.bwslzl,wheat.csl,wheat.bblzl,wheat.hpl,
736
-			wheat.cmbl,wheat.psl,wheat.syl,wheat.sml,wheat.szqw,wheat.ydzs,wheat.ccfs
746
+			wheat.cmbl,wheat.psl,wheat.syl,wheat.sml,wheat.szqw,wheat.ydzs, wheat.rssl, wheat.ccfs
737 747
 		from depot:record_wheat_info wheat
738 748
 		left join depot:basic_storehouse storehouse on storehouse.org_id = wheat.org_id and storehouse.del_flag = 1
739 749
 			 and storehouse.library_type = 0 and storehouse.storehouse_name = wheat.cfmc
@@ -1446,70 +1456,67 @@
1446 1456
         inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
1447 1457
         LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
1448 1458
         LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
1449
-        <!-- left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1450
-              from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno -->
1451
-        <!-- left join depot:basic_tank bs on bs.id = b.sjchID -->
1452 1459
         left join(
1453 1460
              select jyxx.bizno,flt.jyz as qwzw
1454
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1461
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1455 1462
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1456 1463
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1457
-             where flt.zbxmc = '402882e87321dc72017321f9314f000e' 
1464
+             where flt.zbxmc = 'cf5b3dabd8b511ec81ac00ff2bc9e548' 
1458 1465
              <if test="orgId != null">
1459 1466
             	and jyxx.unitid = #{orgId} 
1460 1467
 		     </if>
1461 1468
         ) qwzw on qwzw.bizno = a.bizno
1462 1469
         left join(
1463 1470
              select jyxx.bizno,flt.jyz as sfhfw
1464
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1471
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1465 1472
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1466 1473
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1467
-             where flt.zbxmc = 'c8baedcc732711eabc7300ff188bbfa4'
1474
+             where flt.zbxmc = 'cf5b37a3d8b511ec81ac00ff2bc9e548'
1468 1475
 			 <if test="orgId != null">
1469 1476
             	and jyxx.unitid = #{orgId} 
1470 1477
 		     </if>
1471 1478
         ) sfhfw on sfhfw.bizno = a.bizno
1472 1479
         left join(
1473 1480
              select jyxx.bizno,flt.jyz as brxzz
1474
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1481
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1475 1482
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1476 1483
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1477
-             where flt.zbxmc = 'c8bdddc4732711eabc7300ff188bbfa4'
1484
+             where flt.zbxmc = 'cf5b3864d8b511ec81ac00ff2bc9e548'
1478 1485
 			 <if test="orgId != null">
1479 1486
             	and jyxx.unitid = #{orgId} 
1480 1487
 		     </if>
1481 1488
         ) brxzz on brxzz.bizno = a.bizno
1482 1489
         left join(
1483 1490
              select jyxx.bizno,flt.jyz as sj
1484
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1491
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1485 1492
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1486 1493
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1487
-             where flt.zbxmc = 'c8c0bbf7732711eabc7300ff188bbfa4'
1494
+             where flt.zbxmc = 'cf5b392ed8b511ec81ac00ff2bc9e548'
1488 1495
              <if test="orgId != null">
1489 1496
             	and jyxx.unitid = #{orgId} 
1490 1497
 		     </if>
1491 1498
         ) sj on sj.bizno = a.bizno
1492 1499
         left join(
1493 1500
              select jyxx.bizno,flt.jyz as gyhz
1494
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1501
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1495 1502
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1496 1503
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1497
-             where flt.zbxmc = 'c8c3c8f4732711eabc7300ff188bbfa4'
1504
+             where flt.zbxmc = 'cf5b39d6d8b511ec81ac00ff2bc9e548'
1498 1505
 			 <if test="orgId != null">
1499 1506
             	and jyxx.unitid = #{orgId} 
1500 1507
 		     </if>
1501 1508
         ) gyhz on gyhz.bizno = a.bizno
1502 1509
         left join(
1503 1510
              select jyxx.bizno,flt.jyz as rjcll
1504
-             from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
1511
+             from (select * from (select dataid, bizno, unitid, row_number() over(partition by BizNo order by modifydate desc) rn
1505 1512
               from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
1506 1513
              left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
1507
-             where flt.zbxmc = 'c8c3c8f4732711eabc7300ff188bbfa5'
1514
+             where flt.zbxmc = 'cf5b3a79d8b511ec81ac00ff2bc9e548'
1508 1515
 			 <if test="orgId != null">
1509 1516
             	and jyxx.unitid=#{orgId} 
1510 1517
 		     </if>
1511 1518
         ) rjcll on rjcll.bizno = a.bizno
1512
-        WHERE nvl(a.BizNo,'-1') != '-1' and  a.lspz = '7052'
1519
+        WHERE nvl(a.BizNo,'-1') != '-1' and  a.lspz = '7144'
1513 1520
 		<if test="orgId != null">
1514 1521
         	and a.unitid = #{orgId} 
1515 1522
 		</if>  

+ 3 - 1
src/main/java/com/chinaitop/agile/service/RegistrationService.java

@@ -17,8 +17,10 @@ public interface RegistrationService {
17 17
 	
18 18
 	List<Map<String, Object>> getCrudeOilListPageInfo(Map<String, Object> map);
19 19
 
20
-	HSSFWorkbook wheatdataTransfor(List<Map<String, Object>> list, String zbr, String shdw, String dwfzr);
20
+	HSSFWorkbook wheatdataTransfor(List<Map<String, Object>> list, String zbr, String shdw, String dwfzr, String banben, String sfdcqb);
21 21
 
22 22
     HSSFWorkbook ricedataTransfor(List<Map<String, Object>> list, String zbr, String shdw, String dwfzr);
23 23
 
24
+	HSSFWorkbook crudeOilTransfor(List<Map<String, Object>> list, String zbr, String shdw, String dwfzr);
25
+
24 26
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1085 - 251
src/main/java/com/chinaitop/agile/service/impl/RegistrationServiceImpl.java