Przeglądaj źródła

chart statictis

chenrj-PC\chenrj 8 lat temu
rodzic
commit
68836787db

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/StatisticsBean.java

@@ -80,4 +80,7 @@ public class StatisticsBean {
     
     // 月份
     private String mth ;
+    
+    // 收费站名称
+    private String feeStationName ;
 }

+ 26 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -64,5 +64,31 @@ public class StatisticsController extends BaseController {
     	return super.returnSuccessResult(lists);
     }
     
+    /**
+     * 收费站
+     */
+    @RequestMapping(value = "/score/tollgate/info")
+    public String selectTollgateScoreChange(@RequestBody StatisticsBean obj){
+    	List<StatisticsBean> lists=  statisticsService.getFeeStationScoreInfo(obj);
+    	return super.returnSuccessResult(lists);
+    }
+    
+    /**
+     * 导管中心3
+     */
+    @RequestMapping(value = "/score/center/manage/info")
+    public String selectCentermanageScoreChange(@RequestBody StatisticsBean obj){
+    	List<StatisticsBean> lists=  statisticsService.getCenterManageScoreInfo(obj);
+    	return super.returnSuccessResult(lists);
+    }
+    
+    /**
+     * 导管下收费站
+     */
+    @RequestMapping(value = "/score/manage/tollgate/info")
+    public String selectCentermanageTollgateScoreChange(@RequestBody StatisticsBean obj){
+    	List<StatisticsBean> lists=  statisticsService.getSingleFeeStationScoreInfo(obj);
+    	return super.returnSuccessResult(lists);
+    }
     
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/StatisticsDao.java

@@ -24,4 +24,6 @@ public interface StatisticsDao  {
 	public List<StatisticsBean> selectFeeStationCheckedPersonScoreDetail(StatisticsBean obj);
 	
 	public List<StatisticsBean> selectYearScoreInfo(StatisticsBean obj);
+	
+	public List<StatisticsBean> selectFeeStationScoreInfo(StatisticsBean obj);
 }

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

@@ -85,6 +85,9 @@
 				<if test="end_date !=null">
 					AND t.end_time &lt;= #{end_date}
 				</if>
+				<if test="mth!=null and mth!=''">
+					AND monthfunc (t.start_time) =#{mth}
+				</if>
 				GROUP BY
 					mth,
 					t.checked_person
@@ -106,6 +109,9 @@
 			<if test="end_date !=null">
 				AND t.end_time &lt;= #{end_date}
 			</if>
+			<if test="mth!=null and mth!=''">
+				AND monthfunc (t.start_time) =#{mth}
+			</if>
 			GROUP BY
 				t.checked_person,
 				mth
@@ -128,5 +134,11 @@
     	</if>
     	GROUP BY tab.mth
     </select>
-      
+     
+    <select id="selectFeeStationScoreInfo" 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.checked_dept AS dept_id FROM ( <include refid="selectAllCheckedInfo" />  ) tab
+    	WHERE 1=1 
+    	GROUP BY tab.checked_dept
+    </select>
+     
 </mapper>

+ 7 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/StatisticsService.java

@@ -36,4 +36,11 @@ public interface StatisticsService {
 	
 	public List<StatisticsBean> getYearScoreChange(StatisticsBean obj);
 	
+	public List<StatisticsBean> getFeeStationScoreInfo(StatisticsBean obj);
+	
+	public List<StatisticsBean> getCenterManageScoreInfo(StatisticsBean obj);
+	
+	public List<StatisticsBean> getSingleFeeStationScoreInfo(StatisticsBean obj);
+	
+	
 }

+ 139 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBo;
@@ -412,6 +413,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		}
 	}
 
+
 	@Override
 	public List<StatisticsBean> getYearScoreChange(StatisticsBean obj) {
 		// 导管中心
@@ -427,4 +429,141 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		List<StatisticsBean> lists = statisticsDao.selectYearScoreInfo(obj);
 		return lists;
 	}
+
+	private List<StatisticsBean> reFeeStationScoreInfo(StatisticsBean obj){
+		List<StatisticsBean> scoreList = statisticsDao.selectFeeStationScoreInfo(obj);
+		Map<Long,FeeStation> 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> reList = new ArrayList<>();
+		
+		for(StatisticsBean sta:scoreList){
+			if(feeStationMap.containsKey(sta.getDept_id())){
+				sta.setFeeStationName(feeStationMap.get(sta.getDept_id()).getName());
+			}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);
+			}
+		}
+		scoreList.addAll(reList);
+		return scoreList;
+	}
+	
+	/**
+	 * 检索公司收费站的排名
+	 */
+	@Override
+	public List<StatisticsBean> getFeeStationScoreInfo(StatisticsBean obj) {
+		List<StatisticsBean> scoreList = reFeeStationScoreInfo(obj);
+		
+		scoreList.sort(new Comparator<StatisticsBean>() {
+			@Override
+			public int compare(StatisticsBean o1, StatisticsBean o2) {
+				if(o1.getChecked_num()!=0 && o2.getChecked_num()!=0){
+					if (o1.getAll_check_score()/(o1.getChecked_num()+0.0) > o2.getAll_check_score()/(o2.getChecked_num()+0.0) ) {
+						return 1;
+					} else if (o1.getAll_check_score()/(o1.getChecked_num()+0.0) < o2.getAll_check_score()/(o2.getChecked_num()+0.0)) {
+						return -1;
+					} else {
+						return 0;
+					}
+				}else{
+					if(o1.getChecked_num() == 0){
+						return -1 ;
+					}else if(o2.getChecked_num() ==0){
+						return 1;
+					}else{
+						return 0;
+					}
+				}
+			}
+		});
+		
+		return scoreList;
+	}
+	
+	/**
+	 * 检索某个导管中心下的收费站排名
+	 */
+	@Override
+	public List<StatisticsBean> getSingleFeeStationScoreInfo(StatisticsBean obj) {
+		List<StatisticsBean> resultList = new ArrayList<>();
+		
+		List<StatisticsBean> scoreList = reFeeStationScoreInfo(obj);
+		Map<Long,StatisticsBean> centerManageMap = new HashMap<>();
+		for(StatisticsBean sta : scoreList){
+			if(! centerManageMap.containsKey(sta.getDept_id())){
+				centerManageMap.put(sta.getDept_id(), sta);
+			}
+		}
+		Organ organ =new Organ();
+		organ.setParentid(obj.getDept_id().intValue());
+		List<Organ> list = departmentDao.getOrgan(organ);
+		
+		for(Organ org : list){
+			if(centerManageMap.containsKey( org.getId()+0L)){
+				resultList.add(centerManageMap.get(org.getId()+0L));
+			}
+		}
+		
+		return resultList;
+	}
+	
+	/**
+	 * 检索导管中心排名和数据
+	 */
+	@Override
+	public List<StatisticsBean> getCenterManageScoreInfo(StatisticsBean obj) {
+		
+		// 导管中心
+		List<StatisticsBean> centerManageList = new ArrayList<>();
+		for(int i=0;i<3;i++){
+			StatisticsBean e =new StatisticsBean();
+			centerManageList.add(e);
+		}
+		
+		List<StatisticsBean> scoreList = reFeeStationScoreInfo(obj);
+		Map<Long,StatisticsBean> centerManageMap = new HashMap<>();
+		for(StatisticsBean sta : scoreList){
+			if(! centerManageMap.containsKey(sta.getDept_id())){
+				centerManageMap.put(sta.getDept_id(), sta);
+			}
+		}
+		
+		List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
+		int i = 0;
+		for (StatisticsBean sta : lists) {
+			if (i < 7) {
+				centerManageList.get(0).setAll_check_score(centerManageList.get(0).getAll_check_score()+ 
+							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).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).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).setFeeStationName("南通");
+			}
+			i++ ;
+		}
+		
+		return centerManageList;
+	}
 }