From 9ef68c9682b9bb56b72031fd92d150d65edfc07c Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 17 Sep 2021 20:58:57 +0800
Subject: [PATCH] 1.统计

---
 src/main/java/org/springblade/modules/information/controller/InformationController.java |  187 +++++++++++++++++++++++++++-------------------
 1 files changed, 110 insertions(+), 77 deletions(-)

diff --git a/src/main/java/org/springblade/modules/information/controller/InformationController.java b/src/main/java/org/springblade/modules/information/controller/InformationController.java
index 5468e92..5367c8a 100644
--- a/src/main/java/org/springblade/modules/information/controller/InformationController.java
+++ b/src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -764,22 +764,23 @@
 
 	/**
 	 * 派遣數量統計
-	 */
-	@PostMapping("/selectPCount")
-	public R selectPCount(String jurisdiction, String deptid) {
-		Map<String, Object> map = new HashMap<String, Object>();
-		List<Map<String, Object>> lists = new ArrayList<>();
-		Map map1 = informationService.selectPcount(jurisdiction, deptid);
-		String pnum = map1.get("pnum").toString();
-		Integer a = Integer.valueOf(pnum);
-		Map map2 = informationService.selectWPcount(jurisdiction, deptid);
-		String wpnum = map2.get("wpnum").toString();
-		Integer b = Integer.valueOf(wpnum);
-		map.put("PCount", a);
-		map.put("WPCount", b);
-		lists.add(map);
-		return R.data(lists);
-	}
+	 //	 */
+//	@PostMapping("/selectPCount")
+//	public R selectPCount(String jurisdiction, String deptid) {
+//		Map<String, Object> map = new HashMap<String, Object>();
+//		List<Map<String, Object>> lists = new ArrayList<>();
+//		Map map1 = informationService.selectPcount(jurisdiction, deptid);
+//		String pnum = map1.get("pnum").toString();
+//		Integer a = Integer.valueOf(pnum);
+//		Map map2 = informationService.selectWPcount(jurisdiction, deptid);
+//		String wpnum = map2.get("wpnum").toString();
+//		Integer b = Integer.valueOf(wpnum);
+//		map.put("PCount", a);
+//		map.put("WPCount", b);
+//		lists.add(map);
+//		return R.data(lists);
+//	}
+
 
 //	/**
 //	 * 单位列表
@@ -803,8 +804,8 @@
 	 * 保安员统计
 	 */
 	@PostMapping("/selectLi")
-	public R<IPage> selectLi(String jurisdiction, String deptid,String stats, Query query) {
-		IPage list = informationService.selectLi(Condition.getPage(query), jurisdiction, deptid,stats);
+	public R<IPage> selectLi(String jurisdiction, String deptid, String stats, Query query) {
+		IPage list = informationService.selectLi(Condition.getPage(query), jurisdiction, deptid, stats);
 		return R.data(list);
 	}
 
@@ -864,8 +865,8 @@
 	 * 保安员详情
 	 */
 	@PostMapping("/selectUIn")
-	public R<IPage> selectUIn(String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil,Query query) {
-		IPage list = informationService.selectUIn(Condition.getPage(query),deptid, name, hold, photo, examinationtype, dispatch, soil);
+	public R<IPage> selectUIn(String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil, Query query) {
+		IPage list = informationService.selectUIn(Condition.getPage(query), deptid, name, hold, photo, examinationtype, dispatch, soil);
 		return R.data(list);
 	}
 
@@ -1015,7 +1016,7 @@
 			if (a <= 0) {
 				continue;
 			} else if (a >= 19 && a < 35) {
-				qcount ++;
+				qcount++;
 			} else if (a >= 36 && a < 59) {
 				zcount++;
 			} else {
@@ -1023,12 +1024,11 @@
 			}
 		}
 		Map map = new HashMap();
-		map.put("qcount",qcount);
-		map.put("zcount",zcount);
-		map.put("lcount",lcount);
+		map.put("qcount", qcount);
+		map.put("zcount", zcount);
+		map.put("lcount", lcount);
 		return R.data(map);
 	}
-
 
 
 	/**
@@ -1041,7 +1041,7 @@
 		//查出所有辖区
 		List<Map<Object, Object>> list = informationService.selJur();
 		List<Map<String, Object>> lists = new ArrayList<>();
-		for (int i = 0; i < list.size(); i++){
+		for (int i = 0; i < list.size(); i++) {
 			Map<String, Object> map = new HashMap<String, Object>();
 			Map<String, Object> mapc = new HashMap<String, Object>();
 			String id = list.get(i).get("id").toString();
@@ -1054,11 +1054,11 @@
 			}
 			String substring = strArrays.substring(0, strArrays.length() - 1);
 			List<Map<Object, Object>> maps = informationService.seleJuList(substring);
-			mapc.put("confess",maps.get(0).get("num"));
-			mapc.put("staff",maps.get(1).get("num"));
-			mapc.put("security",maps.get(2).get("num"));
-			mapc.put("armed",maps.get(3).get("num"));
-			mapc.put("region",maps.get(4).get("num"));
+			mapc.put("confess", maps.get(0).get("num"));
+			mapc.put("staff", maps.get(1).get("num"));
+			mapc.put("security", maps.get(2).get("num"));
+			mapc.put("armed", maps.get(3).get("num"));
+			mapc.put("region", maps.get(4).get("num"));
 			map.put("name", list.get(i).get("deptname"));
 			map.put("server", mapc);
 			lists.add(map);
@@ -1147,19 +1147,19 @@
 			String deptid = strArrays.substring(0, strArrays.length() - 1);
 			Map<String, Object> map = new HashMap<String, Object>();
 			List<Map<String, Object>> objectStringMap = iDeptService.selectHold(deptid);
-			if (objectStringMap.size()==0) {
+			if (objectStringMap.size() == 0) {
 				map.put("name", list.get(i).get("deptname"));
 				map.put("cz", cznumber);
 				map.put("wcz", wcznumber);
 				lists.add(map);
 			} else {
-				for (int c=0;c<objectStringMap.size();c++){
+				for (int c = 0; c < objectStringMap.size(); c++) {
 					String cz = objectStringMap.get(c).get("cz").toString();
 					cznumber += Integer.valueOf(cz);
 					String wcz = objectStringMap.get(c).get("wcz").toString();
 					wcznumber += Integer.valueOf(wcz);
 				}
-				map.put("name",  list.get(i).get("deptname"));
+				map.put("name", list.get(i).get("deptname"));
 				map.put("cz", cznumber);
 				map.put("wcz", wcznumber);
 				lists.add(map);
@@ -1182,7 +1182,7 @@
 		Map<String, Object> map = new HashMap<String, Object>();
 		Integer count = 0;
 		List<Map<String, Object>> lists = new ArrayList<>();
-		if (jurisdiction.equals("1372091709474910209")){
+		if (jurisdiction.equals("1372091709474910209")) {
 			List<Map<Object, Object>> maps = informationService.selectBx(jurisdiction, deptid, type);
 			for (int i = 0; i < maps.size(); i++) {
 				String num = maps.get(i).get("num").toString();
@@ -1191,8 +1191,7 @@
 			map.put("count", count);
 			map.put("list", maps);
 			lists.add(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1212,7 +1211,6 @@
 
 		return R.data(lists);
 	}
-
 
 
 	/**
@@ -1237,8 +1235,7 @@
 			map.put("count", count);
 			map.put("list", maps);
 			lists.add(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1264,10 +1261,10 @@
 	 */
 	@PostMapping("/selectWg")
 	public R selectWg(String jurisdiction) {
-		if (jurisdiction.equals("1372091709474910209")){
+		if (jurisdiction.equals("1372091709474910209")) {
 			List<Map<Object, Object>> list = informationService.selectWg(jurisdiction);
 			List list1 = new ArrayList();
-			int count=0;
+			int count = 0;
 			Map map = new HashMap();
 			for (int i = 0; i < list.size(); i++) {
 				//总数
@@ -1280,22 +1277,20 @@
 				String sbnums = list.get(i).get("sbnum").toString();
 				int sbnum = Integer.parseInt(sbnums);
 				//保安总人数为0
-				if (znum==0){
+				if (znum == 0) {
 					continue;
-				}
-				else {
+				} else {
 					int a = znum / 2;
-					if (cznum<=a || sbnum<=a){
+					if (cznum <= a || sbnum <= a) {
 						count++;
 						list1.add(list.get(i));
 					}
 				}
 			}
-			map.put("count",count);
-			map.put("list",list1);
+			map.put("count", count);
+			map.put("list", list1);
 			return R.data(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1305,7 +1300,7 @@
 			String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
 			List<Map<Object, Object>> list = informationService.selectWg(jurisdictiond);
 			List list1 = new ArrayList();
-			int count=0;
+			int count = 0;
 			Map map = new HashMap();
 			for (int i = 0; i < list.size(); i++) {
 				//总数
@@ -1318,19 +1313,18 @@
 				String sbnums = list.get(i).get("sbnum").toString();
 				int sbnum = Integer.parseInt(sbnums);
 				//保安总人数为0
-				if (znum==0){
+				if (znum == 0) {
 					continue;
-				}
-				else {
+				} else {
 					int a = znum / 2;
-					if (cznum<=a || sbnum<=a){
+					if (cznum <= a || sbnum <= a) {
 						count++;
 						list1.add(list.get(i));
 					}
 				}
 			}
-			map.put("count",count);
-			map.put("list",list1);
+			map.put("count", count);
+			map.put("list", list1);
 			return R.data(map);
 		}
 
@@ -1342,7 +1336,7 @@
 	 */
 	@PostMapping("/selectJy")
 	public R selectJy(String jurisdiction) {
-		if (jurisdiction.equals("1372091709474910209")){
+		if (jurisdiction.equals("1372091709474910209")) {
 			List<Map<Object, Object>> list = informationService.selectJy(jurisdiction);
 			List list1 = new ArrayList();
 			Map map = new HashMap();
@@ -1358,8 +1352,7 @@
 			map.put("count", count);
 			map.put("List", list1);
 			return R.data(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1408,8 +1401,7 @@
 			map.put("count", count);
 			map.put("List", list1);
 			return R.data(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1447,8 +1439,7 @@
 			List<Map<Object, Object>> maps = informationService.selectCf(jurisdiction);
 			map.put("count", maps.size());
 			return R.data(map);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1468,11 +1459,10 @@
 	 */
 	@PostMapping("/selectIn")
 	public R selectIn(String jurisdiction) {
-		if (jurisdiction.equals("1372091709474910209")|| "".equals(jurisdiction)) {
+		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
 			List<Map<Object, Object>> maps = informationService.selectIn(jurisdiction);
 			return R.data(maps);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1490,11 +1480,10 @@
 	 */
 	@PostMapping("/selectTb")
 	public R<IPage> selectTb(String jurisdiction, String enterpriseName, Query query) {
-		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)){
+		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
 			IPage list = informationService.selectTb(Condition.getPage(query), jurisdiction, enterpriseName);
 			return R.data(list);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1513,11 +1502,10 @@
 	 */
 	@PostMapping("/selectJj")
 	public R<IPage> selectJj(String jurisdiction, String enterpriseName, Query query) {
-		if (jurisdiction.equals("1372091709474910209")|| "".equals(jurisdiction)) {
+		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
 			IPage list = informationService.selectJj(Condition.getPage(query), jurisdiction, enterpriseName);
 			return R.data(list);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1534,12 +1522,11 @@
 	 * 业务统计情况
 	 */
 	@PostMapping("/selectYw")
-	public R<IPage> selectYw(String jurisdiction, String deptid,String stats, Query query) {
-		if (jurisdiction.equals("1372091709474910209")|| "".equals(jurisdiction)) {
+	public R<IPage> selectYw(String jurisdiction, String deptid, String stats, Query query) {
+		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
 			IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid, stats);
 			return R.data(list);
-		}
-		else {
+		} else {
 			String childer = informationService.selJurchilder(jurisdiction);
 			String[] split = childer.split(",");
 			String strArrays = "";
@@ -1552,4 +1539,50 @@
 		}
 	}
 
+	@PostMapping("/selectPCount")
+	public R selectPCount(String jurisdiction, String deptid) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		List<Map<String, Object>> lists = new ArrayList<>();
+		String childer = informationService.selJurchilder(jurisdiction);
+		String[] split = childer.split(",");
+		String strArrays = "";
+		for (int j = 0; j < split.length; j++) {
+			strArrays += "'" + split[j] + "',";
+		}
+		Integer pnums = 0;
+		Integer wpnums = 0;
+		if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
+			List<Map<String, Object>> list = informationService.seleP(jurisdiction, deptid);
+			for (int i = 0; i < list.size(); i++) {
+				String pnum = list.get(i).get("pnum").toString();
+				Integer a = Integer.parseInt(pnum);
+				pnums += a;
+				String wpnum = list.get(i).get("wpnum").toString();
+				Integer b = Integer.parseInt(wpnum);
+				wpnums += b;
+			}
+		} else {
+			String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
+			List<Map<String, Object>> list = informationService.seleP(jurisdictiond, deptid);
+			for (int i = 0; i < list.size(); i++) {
+				String pnum = list.get(i).get("pnum").toString();
+				Integer a = Integer.parseInt(pnum);
+				pnums += a;
+				String wpnum = list.get(i).get("wpnum").toString();
+				Integer b = Integer.parseInt(wpnum);
+				wpnums += b;
+			}
+		}
+//		Map map1 = informationService.selectPcount(jurisdiction, deptid);
+//		String pnum = map1.get("pnum").toString();
+//		Integer a = Integer.valueOf(pnum);
+//		Map map2 = informationService.selectWPcount(jurisdiction, deptid);
+//		String wpnum = map2.get("wpnum").toString();
+//		Integer b = Integer.valueOf(wpnum);
+		map.put("PCount", pnums);
+		map.put("WPCount", wpnums);
+		lists.add(map);
+		return R.data(lists);
+	}
+
 }

--
Gitblit v1.9.3