chenrj-PC\chenrj vor 8 Jahren
Ursprung
Commit
4ecd549049

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/UserInfoDao.java

@@ -1,5 +1,6 @@
 package com.xintong.visualinspection.dao.cluster;
 
+import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.User;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -19,4 +20,6 @@ public interface UserInfoDao {
     public void delete(Integer id);
     public User findByUserName(String username);
     public List<User> getAllCheckmans();
+    public List<StatisticsBean> getUsersCountList();
+    public Integer getUsersCenterManageCount(StatisticsBean obj);
 }

+ 12 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/UserInfoMapper.xml

@@ -87,6 +87,18 @@
         where username= #{username}
     </select>
     
+    <select id="getUsersCenterManageCount" parameterType="com.xintong.visualinspection.bean.StatisticsBean"  resultType="java.lang.Integer">
+    	SELECT  count(1)  FROM t_sys_users t 
+    			INNER JOIN t_br_layer_fee_station tf ON t.organid = tf.organ_id  
+    			WHERE t.status >0  AND t.positionid  in (1,6)  AND t.organid in ( SELECT id FROM t_sys_organ where parentid=#{dept_id} )  
+    </select>
+    
+    <select id="getUsersCountList"  resultType="com.xintong.visualinspection.bean.StatisticsBean">
+    	SELECT t.organid AS dept_id , count(1) AS people_num,tf.name FROM t_sys_users t 
+    			INNER JOIN t_br_layer_fee_station tf ON t.organid = tf.organ_id  
+    			WHERE t.status >0  AND t.positionid  in (1,6) GROUP BY t.organid
+			ORDER BY t.organid 
+    </select>
     
     <select id="getUsers" parameterType="com.xintong.visualinspection.bean.User" resultMap="BaseResultMap"  >
         SELECT

+ 1 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -122,7 +122,7 @@
     <select id="selectYearScoreInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
     	SELECT sum(tab.checkd_all_score) AS all_check_score  , sum(tab.checked_num) AS checked_num  , tab.mth FROM ( <include refid="selectAllCheckedInfo" />  ) tab 
     	WHERE 1=1 
-    	<if test="dept_list!=null and queryType == 2 ">
+    	<if test="dept_list!=null and queryType == 2 and dept_list.size()>0 ">
     		AND	tab.checked_dept IN
 		    	<foreach item="obj"  collection="dept_list" open="("
 		            separator="," close=")">

+ 50 - 13
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -417,7 +417,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 	@Override
 	public List<StatisticsBean> getYearScoreChange(StatisticsBean obj) {
 		// 导管中心
-		if(obj.getQueryType()!=null && obj.getQueryType() == 2){
+		if(obj.getQueryType()!=null && obj.getQueryType() == 1){
 			// 检索当前导管中心下的deptid
 			Organ organ =new Organ();
 			organ.setParentid(obj.getDept_id().intValue());
@@ -426,32 +426,62 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			obj.setDept_list(list);
 		}
 		
+		// 这边把总人数计算出来
+		List<StatisticsBean> feeStationList ;
+		int people_num = 0 ;
+		if(obj.getQueryType()!=null && obj.getQueryType() == 1 ){
+			// 道管中心
+			people_num = userInfoDao.getUsersCenterManageCount(obj);
+			
+		}else if(obj.getQueryType()!=null && obj.getQueryType() == 2){
+			// 收费站
+			feeStationList = userInfoDao.getUsersCountList();
+			if(feeStationList!=null && feeStationList.size()>0){
+				for(StatisticsBean sta : feeStationList){
+					if(obj.getDept_id()+0L == sta.getDept_id()){
+						people_num = sta.getPeople_num();
+					}
+				}
+			}
+		}else{
+			// 总公司
+			feeStationList = userInfoDao.getUsersCountList();
+			if(feeStationList!=null && feeStationList.size()>0){
+				for(StatisticsBean sta : feeStationList){
+					people_num += sta.getPeople_num();
+				}
+			}
+		}
+		
+		
 		List<StatisticsBean> lists = statisticsDao.selectYearScoreInfo(obj);
+		for(StatisticsBean sta:lists){
+			sta.setPeople_num(people_num);
+		}
 		return lists;
 	}
 
 	private List<StatisticsBean> reFeeStationScoreInfo(StatisticsBean obj){
 		List<StatisticsBean> scoreList = statisticsDao.selectFeeStationScoreInfo(obj);
-		Map<Long,FeeStation> feeStationMap = new HashMap<>();
+		Map<Long,StatisticsBean> feeStationMap = new HashMap<>();
 		// 获取所有的收费站
-		List<FeeStation> feeList = departmentDao.getAllFS();
-		for(FeeStation feeObj :  feeList){
-			if(!feeStationMap.containsKey(feeObj.getDeptid())){
-				feeStationMap.put(Long.parseLong(feeObj.getDeptid()) , feeObj);
+		List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
+		for(StatisticsBean feeObj :  scoreList){
+			if(!feeStationMap.containsKey(feeObj.getDept_id() )){
+				feeStationMap.put(feeObj.getDept_id() , feeObj);
 			}
 		}
 		// 需要补充的
 		List<StatisticsBean> reList = new ArrayList<>();
 		
-		for(StatisticsBean sta:scoreList){
+		for(StatisticsBean sta:feeStationList){
 			if(feeStationMap.containsKey(sta.getDept_id())){
-				sta.setFeeStationName(feeStationMap.get(sta.getDept_id()).getName());
+				feeStationMap.get(sta.getDept_id()).setFeeStationName(sta.getName());
+				feeStationMap.get(sta.getDept_id()).setPeople_num(sta.getPeople_num());
 			}else{
-				StatisticsBean e = new StatisticsBean();
-				e.setAll_check_score(0);
-				e.setChecked_num(0);
-				e.setFeeStationName(feeStationMap.get(sta.getDept_id()).getName());
-				reList.add(e);
+				sta.setAll_check_score(0);
+				sta.setChecked_num(0);
+				reList.add(sta);
 			}
 		}
 		scoreList.addAll(reList);
@@ -547,18 +577,25 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 							centerManageMap.get(sta.getDept_id()).getAll_check_score());
 				centerManageList.get(0).setChecked_num(centerManageList.get(0).getChecked_num() + 
 						centerManageMap.get(sta.getDept_id()).getChecked_num());
+				centerManageList.get(0).setPeople_num(centerManageList.get(0).getPeople_num() + 
+						centerManageMap.get(sta.getDept_id()).getPeople_num());
+				
 				centerManageList.get(0).setFeeStationName("连云港");
 			} else if (i < 13) {
 				centerManageList.get(1).setAll_check_score(centerManageList.get(1).getAll_check_score()+ 
 						centerManageMap.get(sta.getDept_id()).getAll_check_score());
 				centerManageList.get(1).setChecked_num(centerManageList.get(1).getChecked_num() + 
 						centerManageMap.get(sta.getDept_id()).getChecked_num());
+				centerManageList.get(1).setPeople_num(centerManageList.get(1).getPeople_num() + 
+						centerManageMap.get(sta.getDept_id()).getPeople_num());
 				centerManageList.get(1).setFeeStationName("盐城");
 			} else {
 				centerManageList.get(2).setAll_check_score(centerManageList.get(2).getAll_check_score()+ 
 						centerManageMap.get(sta.getDept_id()).getAll_check_score());
 				centerManageList.get(2).setChecked_num(centerManageList.get(2).getChecked_num() + 
 						centerManageMap.get(sta.getDept_id()).getChecked_num());
+				centerManageList.get(2).setPeople_num(centerManageList.get(2).getPeople_num() + 
+						centerManageMap.get(sta.getDept_id()).getPeople_num());
 				centerManageList.get(2).setFeeStationName("南通");
 			}
 			i++ ;