|
|
@@ -32,88 +32,88 @@ import com.xintong.visualinspection.service.BaseService;
|
|
|
import com.xintong.visualinspection.service.StatisticsService;
|
|
|
|
|
|
/**
|
|
|
- * 文件名:StatisticsServiceImpl
|
|
|
- * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
|
|
|
+ * 文件名:StatisticsServiceImpl 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation
|
|
|
+ * 2017 版权所有.
|
|
|
*/
|
|
|
@Service
|
|
|
public class StatisticsServiceImpl extends BaseService implements StatisticsService {
|
|
|
|
|
|
- private static final org.slf4j.Logger logger = LoggerFactory.getLogger(StatisticsServiceImpl.class);
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private StatisticsDao statisticsDao ;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DepartmentDao departmentDao ;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserInfoDao userInfoDao;
|
|
|
-
|
|
|
+ private static final org.slf4j.Logger logger = LoggerFactory.getLogger(StatisticsServiceImpl.class);
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StatisticsDao statisticsDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DepartmentDao departmentDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserInfoDao userInfoDao;
|
|
|
+
|
|
|
@Override
|
|
|
public List<StatisticsBo> getEmployeeCheckedInfo(StatisticsBean obj) {
|
|
|
// 查看是否有部门id
|
|
|
Long organId = obj.getDept_id();
|
|
|
// 将检索出来的数据放到如map中
|
|
|
List<StatisticsBean> list = statisticsDao.selectStatistics(obj);
|
|
|
-
|
|
|
+
|
|
|
List<StatisticsBean> timesList = statisticsDao.selectCheckedTimes(obj);
|
|
|
-
|
|
|
- Map<Long,StatisticsBo> statisticBoMap = new HashMap<Long,StatisticsBo>();
|
|
|
-
|
|
|
+
|
|
|
+ Map<Long, StatisticsBo> statisticBoMap = new HashMap<Long, StatisticsBo>();
|
|
|
+
|
|
|
User user = new User();
|
|
|
user.setPositionid(1);
|
|
|
- if(obj.getDept_id()!=null)
|
|
|
+ if (obj.getDept_id() != null)
|
|
|
user.setOrganid(obj.getDept_id().intValue());
|
|
|
List<User> listUserts = userInfoDao.getUsers(user);
|
|
|
- for(User u:listUserts){
|
|
|
- if(u.getFee_station_name()!=null){
|
|
|
+ for (User u : listUserts) {
|
|
|
+ if (u.getFee_station_name() != null) {
|
|
|
StatisticsBo tmp = new StatisticsBo();
|
|
|
tmp.setUser(u);
|
|
|
- statisticBoMap.put(u.getId()+0L, tmp);
|
|
|
+ statisticBoMap.put(u.getId() + 0L, tmp);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// for(User user:CacheUtil.userMap.values()){
|
|
|
-// if(user.getPositionid() ==1){
|
|
|
-// if(organId ==null || user.getOrganid()+0L == organId+0L ){
|
|
|
-// StatisticsBo tmp = new StatisticsBo();
|
|
|
-// tmp.setUser(user);
|
|
|
-// statisticBoMap.put(user.getId()+0L,tmp);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
- for( StatisticsBean statisticsBean : list ){
|
|
|
- if(statisticBoMap.containsKey(statisticsBean.getUser_id())){
|
|
|
+
|
|
|
+ // for(User user:CacheUtil.userMap.values()){
|
|
|
+ // if(user.getPositionid() ==1){
|
|
|
+ // if(organId ==null || user.getOrganid()+0L == organId+0L ){
|
|
|
+ // StatisticsBo tmp = new StatisticsBo();
|
|
|
+ // tmp.setUser(user);
|
|
|
+ // statisticBoMap.put(user.getId()+0L,tmp);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ for (StatisticsBean statisticsBean : list) {
|
|
|
+ if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
|
|
|
StatisticsBo tmp = statisticBoMap.get(statisticsBean.getUser_id());
|
|
|
- if(statisticsBean.getName()!=null && statisticsBean.getScore()!=null){
|
|
|
+ if (statisticsBean.getName() != null && statisticsBean.getScore() != null) {
|
|
|
tmp.getChecked_socre_name().add(statisticsBean.getName());
|
|
|
tmp.getChecked_score().add(statisticsBean.getScore());
|
|
|
- tmp.setCheck_all_score(tmp.getCheck_all_score()+statisticsBean.getScore() );
|
|
|
+ tmp.setCheck_all_score(tmp.getCheck_all_score() + statisticsBean.getScore());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- for(StatisticsBean statisticsBean : timesList){
|
|
|
- if(statisticBoMap.containsKey(statisticsBean.getUser_id())){
|
|
|
+
|
|
|
+ for (StatisticsBean statisticsBean : timesList) {
|
|
|
+ if (statisticBoMap.containsKey(statisticsBean.getUser_id())) {
|
|
|
StatisticsBo tmp = statisticBoMap.get(statisticsBean.getUser_id());
|
|
|
tmp.setChecked_num(statisticsBean.getChecked_num());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<StatisticsBo> lists = new ArrayList<>(statisticBoMap.values());
|
|
|
// 进行排序
|
|
|
lists.sort(new Comparator<StatisticsBo>() {
|
|
|
@Override
|
|
|
public int compare(StatisticsBo o1, StatisticsBo o2) {
|
|
|
- if(o1.getCheck_all_score() >= o2.getCheck_all_score() ){
|
|
|
+ if (o1.getCheck_all_score() >= o2.getCheck_all_score()) {
|
|
|
return 1;
|
|
|
- }else{
|
|
|
- return -1 ;
|
|
|
+ } else {
|
|
|
+ return -1;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return lists;
|
|
|
}
|
|
|
|
|
|
@@ -121,35 +121,35 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
public List<StatisticsBean> getFeeStationCheckedScore(StatisticsBean obj) {
|
|
|
// 获取收费站信息收费站人数
|
|
|
List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
|
|
|
- Map<Long,StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
- for(StatisticsBean sta:lists){
|
|
|
+ Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
+ for (StatisticsBean sta : lists) {
|
|
|
mapStationInfos.put(sta.getDept_id(), sta);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 检查人数 和 检查次数
|
|
|
List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
|
|
|
- for(StatisticsBean sta:listCheckNum){
|
|
|
- if(mapStationInfos.containsKey(sta.getDept_id())){
|
|
|
+ for (StatisticsBean sta : listCheckNum) {
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id())) {
|
|
|
mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
|
|
|
mapStationInfos.get(sta.getDept_id()).setChecked_people_num(sta.getChecked_people_num());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<StatisticsBean> listCheckedScore = statisticsDao.selectFeeStationCheckedScore(obj);
|
|
|
- for(StatisticsBean sta:listCheckedScore){
|
|
|
- if(mapStationInfos.containsKey(sta.getDept_id())){
|
|
|
+ for (StatisticsBean sta : listCheckedScore) {
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id())) {
|
|
|
StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
- statis.setAll_check_score( statis.getAll_check_score()+sta.getScore());
|
|
|
- if(sta.getScore() <= 15){
|
|
|
- statis.setScore_fifteen(statis.getScore_fifteen()+1);
|
|
|
- }else if(sta.getScore()<=50){
|
|
|
- statis.setScore_fifty(statis.getScore_fifty()+1);
|
|
|
- }else{
|
|
|
- statis.setScore_over_fifty(statis.getScore_over_fifty()+1);
|
|
|
+ statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
|
|
|
+ if (sta.getScore() <= 15) {
|
|
|
+ statis.setScore_fifteen(statis.getScore_fifteen() + 1);
|
|
|
+ } else if (sta.getScore() <= 50) {
|
|
|
+ statis.setScore_fifty(statis.getScore_fifty() + 1);
|
|
|
+ } else {
|
|
|
+ statis.setScore_over_fifty(statis.getScore_over_fifty() + 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return new ArrayList<>(mapStationInfos.values());
|
|
|
}
|
|
|
|
|
|
@@ -158,32 +158,32 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
|
|
|
// 获取收费站信息收费站人数
|
|
|
List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(obj);
|
|
|
- Map<Long,StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
- for(StatisticsBean sta:lists){
|
|
|
+ Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
+ for (StatisticsBean sta : lists) {
|
|
|
mapStationInfos.put(sta.getDept_id(), sta);
|
|
|
}
|
|
|
-
|
|
|
- // 检查人数 和 检查次数
|
|
|
+
|
|
|
+ // 检查人数 和 检查次数
|
|
|
List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
|
|
|
- for(StatisticsBean sta:listCheckNum){
|
|
|
- if(mapStationInfos.containsKey(sta.getDept_id())){
|
|
|
+ for (StatisticsBean sta : listCheckNum) {
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id())) {
|
|
|
mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
|
|
|
mapStationInfos.get(sta.getDept_id()).setChecked_people_num(sta.getChecked_people_num());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<StatisticsBean> listCheckedScore = statisticsDao.selectFeeStationCheckedPersonScoreDetail(obj);
|
|
|
- for(StatisticsBean sta:listCheckedScore){
|
|
|
- if(mapStationInfos.containsKey(sta.getDept_id())){
|
|
|
+ for (StatisticsBean sta : listCheckedScore) {
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id())) {
|
|
|
StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
- statis.setAll_check_score( statis.getAll_check_score()+sta.getScore());
|
|
|
+ statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
|
|
|
statis.getChecked_socre_name().add(sta.getName());
|
|
|
statis.getChecked_score().add(sta.getScore());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return new ArrayList<>(mapStationInfos.values());
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -191,9 +191,22 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
// 检索数据
|
|
|
List<StatisticsBo> listStatistic = getEmployeeCheckedInfo(obj);
|
|
|
// 处理数据
|
|
|
- // todo ...
|
|
|
-
|
|
|
-
|
|
|
+ //Integer[] emp_assess = new Integer[listStatistic.size()];
|
|
|
+ for (int i = 0; i < listStatistic.size(); i++) {
|
|
|
+ StatisticsBo st = new StatisticsBo();
|
|
|
+ st = listStatistic.get(i);
|
|
|
+ try {
|
|
|
+ st.setCheck_score_avg(listStatistic.get(i).getCheck_all_score()
|
|
|
+ / listStatistic.get(i).getChecked_num());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ /*List<Integer> checked_score_list = st.getChecked_score();
|
|
|
+ for (int j = 0; j < checked_score_list.size(); i++) {
|
|
|
+ emp_assess[j] = checked_score_list.get(i);
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+
|
|
|
String path = "D:/file20170606.xls";
|
|
|
try (InputStream is = this.getClass().getResourceAsStream("/employee_order.xls")) {
|
|
|
try (OutputStream os = new FileOutputStream(path)) {
|
|
|
@@ -222,7 +235,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
toClient.write(buffer);
|
|
|
toClient.flush();
|
|
|
toClient.close();
|
|
|
- }catch(Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
logger.error(e.toString());
|
|
|
}
|
|
|
}
|
|
|
@@ -230,13 +243,13 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
@Override
|
|
|
public void getFeeStationCheckedScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
// TODO Auto-generated method stub
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void getFeeStationCheckItemScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
// TODO Auto-generated method stub
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|