|
|
@@ -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,10 +413,11 @@ 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());
|
|
|
@@ -424,7 +426,235 @@ 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,StatisticsBean> feeStationMap = new HashMap<>();
|
|
|
+ // 获取所有的收费站
|
|
|
+ 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:feeStationList){
|
|
|
+ if(feeStationMap.containsKey(sta.getDept_id())){
|
|
|
+ feeStationMap.get(sta.getDept_id()).setFeeStationName(sta.getName());
|
|
|
+ feeStationMap.get(sta.getDept_id()).setPeople_num(sta.getPeople_num());
|
|
|
+ }else{
|
|
|
+ sta.setAll_check_score(0);
|
|
|
+ sta.setChecked_num(0);
|
|
|
+ sta.setFeeStationName(sta.getName());
|
|
|
+ reList.add(sta);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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).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++ ;
|
|
|
+ }
|
|
|
+
|
|
|
+ return centerManageList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考核情况占比
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public StatisticsBean getCheckedScoreInfo(StatisticsBean obj) {
|
|
|
+ int people_num = 0 ;
|
|
|
+ StatisticsBean returnObj = new StatisticsBean();
|
|
|
+ if(obj.getQueryType() ==0){
|
|
|
+ // 公司
|
|
|
+ // 公司总人数
|
|
|
+ List<StatisticsBean> feeStationList = userInfoDao.getUsersCountList();
|
|
|
+ if(feeStationList!=null && feeStationList.size()>0){
|
|
|
+ for(StatisticsBean sta : feeStationList){
|
|
|
+ people_num += sta.getPeople_num();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(obj.getQueryType() == 1){
|
|
|
+ // 道管中心
|
|
|
+ Organ organ =new Organ();
|
|
|
+ organ.setParentid(obj.getDept_id().intValue());
|
|
|
+ List<Organ> list = departmentDao.getOrgan(organ);
|
|
|
+ // 将导管中心下的收费站部门id 列表放入到list中
|
|
|
+ obj.setDept_list(list);
|
|
|
+
|
|
|
+ people_num = userInfoDao.getUsersCenterManageCount(obj);
|
|
|
+ }else if(obj.getQueryType() == 2){
|
|
|
+ // 收费站
|
|
|
+ List<StatisticsBean> 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StatisticsBean> userLostScoreInfoList = statisticsDao.selectCheckedScoreList(obj);
|
|
|
+
|
|
|
+ for (StatisticsBean sta : userLostScoreInfoList) {
|
|
|
+ if (sta.getAll_check_score() <= 15) {
|
|
|
+ returnObj.setScore_fifteen(returnObj.getScore_fifteen() + 1);
|
|
|
+ } else if (sta.getAll_check_score() <= 50) {
|
|
|
+ returnObj.setScore_fifty(returnObj.getScore_fifty() + 1);
|
|
|
+ } else {
|
|
|
+ returnObj.setScore_over_fifty(returnObj.getScore_over_fifty() + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnObj.setPeople_num(people_num);
|
|
|
+
|
|
|
+ return returnObj;
|
|
|
+ }
|
|
|
}
|