From 531114059500b39d9573890b5a2af7a9fa88089b Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 23 Jul 2021 14:05:52 +0800
Subject: [PATCH] 1.统计

---
 src/main/java/org/springblade/modules/information/controller/InformationController.java |  170 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 148 insertions(+), 22 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 e73fad0..bd2db80 100644
--- a/src/main/java/org/springblade/modules/information/controller/InformationController.java
+++ b/src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -209,7 +209,7 @@
 	}
 
 
-	/**
+	/**  未缴社保数量
 	 * 通过辖区查询机构id,然后通过机构id查询当前机构交社保的人数(numj单位已交社保数量;numz单位人员总数)
 	 */
 	@PostMapping("/selectCs")
@@ -347,6 +347,8 @@
 		Integer khb=0;
 		Integer pqa=0;
 		Integer pqb=0;
+		String deptname=null;
+		String jurname=null;
 		//保安员数量
 		Map<String, Object> map = new HashMap<String, Object>();
 		Map<String, Object> mapzc = new HashMap<String, Object>();
@@ -355,71 +357,89 @@
 		Map<String, Object> mapkh = new HashMap<String, Object>();
 		Map<String, Object> mappq = new HashMap<String, Object>();
 		Map<String, Object> mapC = new HashMap<String, Object>();
-		List<Map<Object, Integer>> maps = informationService.queryCountB(jurisdiction, deptid);
+		List<Map<Object, Object>> maps = informationService.queryCountB(jurisdiction, deptid);
 		for (int i=0;i<maps.size();i++){
 			//这个月数量
-			a+=maps.get(i).get("thisnum");
+			String thisnum = maps.get(i).get("thisnum").toString();
+			a+= Integer.valueOf(thisnum);
 			//上个月数量
-			b+=  maps.get(i).get("lastnum");
+			String lastnum = maps.get(i).get("lastnum").toString();
+			b+=Integer.valueOf(lastnum);
 
 		}
 		map.put("thisnum",a);
 		map.put("lastnum",b);
+		map.put("List",maps);
 		mapC.put("baoan",map);
 		//正常保安员数量
-		List<Map<Object, Integer>> maps1 = informationService.queryCountZc(jurisdiction, deptid);
+		List<Map<Object, Object>> maps1 = informationService.queryCountZc(jurisdiction, deptid);
 		for (int i=0;i<maps1.size();i++){
 			//这个月数量
-			zca+= maps1.get(i).get("thisnum");
+			String thisnum = maps1.get(i).get("thisnum").toString();
+			zca+= Integer.valueOf(thisnum);
 			//上个月数量
-			zcb+= maps1.get(i).get("lastnum");
+			String lastnum = maps1.get(i).get("lastnum").toString();
+			zcb+= Integer.valueOf(lastnum);
 		}
 		mapzc.put("thisnum",zca);
 		mapzc.put("lastnum",zcb);
+		mapzc.put("List",maps1);
 		mapC.put("zcbaoan",mapzc);
 		//持证保安数量
-		List<Map<Object, Integer>> maps2 = informationService.queryCountCz(jurisdiction, deptid);
+		List<Map<Object, Object>> maps2 = informationService.queryCountCz(jurisdiction, deptid);
 		for (int i=0;i<maps2.size();i++){
 			//这个月数量
-			cza+=maps2.get(i).get("thisnum");
+			String thisnum = maps2.get(i).get("thisnum").toString();
+			cza+= Integer.valueOf(thisnum);
 			//上个月数量
-			czb+=  maps2.get(i).get("lastnum");
+			String lastnum = maps2.get(i).get("lastnum").toString();
+			czb+= Integer.valueOf(lastnum);
 		}
 		mapcz.put("thisnum",cza);
 		mapcz.put("lastnum",czb);
+		mapcz.put("List",maps2);
 		mapC.put("czbaoan",mapcz);
 		//缴纳社保数量
-		List<Map<Object, Integer>> maps3 = informationService.queryCountSb(jurisdiction, deptid);
+		List<Map<Object, Object>> maps3 = informationService.queryCountSb(jurisdiction, deptid);
 		for (int i=0;i<maps3.size();i++){
 			//这个月数量
-			sba+=maps3.get(i).get("thisnum");
+			String thisnum = maps3.get(i).get("thisnum").toString();
+			sba+= Integer.valueOf(thisnum);
 			//上个月数量
-			sbb+=maps3.get(i).get("lastnum");
+			String lastnum = maps3.get(i).get("lastnum").toString();
+			sbb+= Integer.valueOf(lastnum);
 		}
 		mapsb.put("thisnum",sba);
 		mapsb.put("lastnum",sbb);
-		mapC.put("sbbaoan",mapsb);
+		mapsb.put("List",maps3);
+		mapC.put("sheb",mapsb);
 		//服务客户数量
-		List<Map<Object, Integer>> maps4 = informationService.queryCountKh(jurisdiction, deptid);
+		List<Map<Object, Object>> maps4 = informationService.queryCountKh(jurisdiction, deptid);
 		for (int i=0;i<maps4.size();i++){
 			//这个月数量
-			kha+=maps4.get(i).get("thisnum");
+			String thisnum = maps4.get(i).get("thisnum").toString();
+			kha+= Integer.valueOf(thisnum);
 			//上个月数量
-			khb+=maps4.get(i).get("lastnum");
+			String lastnum = maps4.get(i).get("lastnum").toString();
+			khb+= Integer.valueOf(lastnum);
 		}
 		mapkh.put("thisnum",kha);
 		mapkh.put("lastnum",khb);
+		mapkh.put("List",maps4);
 		mapC.put("kh",mapkh);
 		//保安派遣数量
-		List<Map<Object, Integer>> maps5 = informationService.queryCountPq(jurisdiction, deptid);
+		List<Map<Object, Object>> maps5 = informationService.queryCountPq(jurisdiction, deptid);
 		for (int i=0;i<maps5.size();i++){
 			//这个月数量
-			pqa+=maps5.get(i).get("thisnum");
+			String thisnum = maps5.get(i).get("thisnum").toString();
+			pqa+= Integer.valueOf(thisnum);
 			//上个月数量
-			pqb+=maps5.get(i).get("lastnum");
+			String lastnum = maps5.get(i).get("lastnum").toString();
+			pqb+= Integer.valueOf(lastnum);
 		}
 		mappq.put("thisnum",pqa);
 		mappq.put("lastnum",pqb);
+		mappq.put("List",maps5);
 		mapC.put("paiq",mappq);
 		lists.add(mapC);
 		return R.data(lists);
@@ -452,12 +472,16 @@
 		//保安持证数量
 		Map<String, String> mapcz = informationService.queryYearZc(year,jurisdiction,deptid);
 		mapcz = (HashMap<String, String>) sortMapBykeyAsc(mapcz) ;//key升序
-		mapcz1.put("cz",mapcz);
+		mapcz1.put("chiz",mapcz);
 		lists.add(mapcz1);
 		//缴纳社保数
 		Map<String, String> mapsb = informationService.queryYearSoil(year,jurisdiction,deptid);
 		mapsb = (HashMap<String, String>) sortMapBykeyAsc(mapsb) ;//key升序
-		mapsb1.put("sb",mapsb);
+		mapsb1.put("sheb",mapsb);
+		//保安派遣
+		Map<String, String> mapde = informationService.queryYearBanan(year, jurisdiction, deptid);
+		mapde = (HashMap<String, String>) sortMapBykeyAsc(mapde) ;//key升序
+		mapsb1.put("paiq",mapde);
 		lists.add(mapsb1);
 		return R.data(lists);
 	}
@@ -472,6 +496,20 @@
 		Calendar cal = Calendar.getInstance();
 		String year = String.valueOf(cal.get(Calendar.YEAR));
 		Map<String, String> map = informationService.queryYearKh(year,jurisdiction,deptid);
+		map = (HashMap<String, String>) sortMapBykeyAsc(map) ;//key升序
+		return R.data(map);
+	}
+
+
+	/**
+	 * 查询本年所有月份的保安派遣数量
+	 * @return
+	 */
+	@GetMapping("/queryYearBanan")
+	public R queryYearBanan(String jurisdiction,String deptid) {
+		Calendar cal = Calendar.getInstance();
+		String year = String.valueOf(cal.get(Calendar.YEAR));
+		Map<String, String> map = informationService.queryYearBanan(year,jurisdiction,deptid);
 		map = (HashMap<String, String>) sortMapBykeyAsc(map) ;//key升序
 		return R.data(map);
 	}
@@ -508,4 +546,92 @@
 		return sortedMap;
 	}
 
+
+
+	/**
+	 * 统计保安员资格异常的数量
+	 */
+	@PostMapping("/selectExtype")
+	public R selectExtype(String jurisdiction,String deptid) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		Integer count=0;
+		List<Map<String, Object>> lists = new ArrayList<>();
+		List<Map<Object, Integer>> maps = informationService.selectExtype(jurisdiction, deptid);
+		for (int i=0;i<maps.size();i++){
+			count+=maps.get(i).get("num");
+		}
+		map.put("count",count);
+		map.put("list",maps);
+		lists.add(map);
+		return R.data(lists);
+	}
+
+	/**
+	 * 统计保安员表现差的数量
+	 */
+	@PostMapping("/selectBx")
+	public R selectBx(String jurisdiction,String deptid) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		Integer count=0;
+		List<Map<String, Object>> lists = new ArrayList<>();
+		List<Map<Object, Integer>> maps = informationService.selectExtype(jurisdiction, deptid);
+		for (int i=0;i<maps.size();i++){
+			count+=maps.get(i).get("num");
+		}
+		map.put("count",count);
+		map.put("list",maps);
+		lists.add(map);
+		return R.data(lists);
+	}
+
+
+
+
+	/**
+	 * 分局预警统计
+	 */
+	@PostMapping("/selectFj")
+	public R selectFj(){
+		//辖区信息
+		List<Map<Object, Object>> list = informationService.selectJur();
+		List<Map<String, Object>> lists = new ArrayList<>();
+		for (int i=0;i<list.size();i++){
+			Integer count=0;
+			Map<String, Object> map = new HashMap<String, Object>();
+			//辖区id
+			String jurisdiction = list.get(i).get("id").toString();
+			//辖区名称
+			String jurname = list.get(i).get("dept_name").toString();
+			//保安员表现差预警数量
+			List<Map<Object, Integer>> mapbx = informationService.selectBx(jurisdiction, "");
+			for (int ibx=0;ibx<mapbx.size();ibx++){
+				count+=mapbx.get(ibx).get("num");
+			}
+			//保安员资格异常的数量
+			List<Map<Object, Integer>> mapEx = informationService.selectExtype(jurisdiction, "");
+			for (int iex=0;iex<mapEx.size();iex++){
+				count+=mapEx.get(iex).get("num");
+			}
+			//保安公司未持证数量
+			List<Map<Object, String>> mapgs = informationService.selectInCount(jurisdiction,"");
+			count+=mapgs.size();
+			//未缴社保数量
+			List<Map<String, Object>> mapsb = informationService.selectCs(jurisdiction,"");
+			for (int isb=0;isb<mapsb.size();isb++){
+				//交社保数
+				String numjs = mapsb.get(isb).get("numj").toString();
+				Integer numj = Integer.parseInt(numjs);
+				//单位总人数
+				String numzs = mapsb.get(isb).get("numz").toString();
+				Integer numz = Integer.parseInt(numzs);
+				//统计未交社保人数
+				int i1 = numz - numj;
+				count+=i1;
+			}
+			map.put("Count",count);
+			map.put("jurname",jurname);
+			lists.add(map);
+		}
+		return R.data(lists);
+	}
 }

--
Gitblit v1.9.3