|
|
@@ -22,6 +22,7 @@ import com.xintong.visualinspection.dao.master.CheckTaskPeriodDao;
|
|
|
import com.xintong.visualinspection.dao.master.CheckUserStatisticsDao;
|
|
|
import com.xintong.visualinspection.pojo.StatisiticPojo;
|
|
|
import com.xintong.visualinspection.pojo.UserRankingData;
|
|
|
+import com.xintong.visualinspection.service.CheckRuleService;
|
|
|
import com.xintong.visualinspection.service.ThreadTaskService;
|
|
|
import org.jxls.common.Context;
|
|
|
import org.jxls.util.JxlsHelper;
|
|
|
@@ -68,10 +69,8 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
@Autowired
|
|
|
private ThreadTaskService threadTaskService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CheckRuleService checkRuleService;
|
|
|
|
|
|
@Override
|
|
|
public List<UserChangeStation> getUserChangeStation(StatisticsBean obj) {
|
|
|
@@ -424,91 +423,91 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
return sortList;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<StatisticsBean> getFeeStationCheckItemScore(StatisticsBean obj) {
|
|
|
-
|
|
|
- // 获取收费站信息收费站人数
|
|
|
- Constant t = CodeUtil.getCodeByFlagAndValue("feestation_check_jobs", "1");
|
|
|
- String[] postions = t.getCode_name().split(",");
|
|
|
- User user = new User();
|
|
|
- List<Integer> positionList = new ArrayList<Integer>();
|
|
|
- for (int i = 0; i < postions.length; i++) {
|
|
|
- positionList.add(Integer.parseInt(postions[i]));
|
|
|
- }
|
|
|
- user.setPosition_ids(positionList);
|
|
|
- user.setInvalidtime(obj.getStart_date());
|
|
|
- List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(user);
|
|
|
- Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
- int i = 0;
|
|
|
- for (StatisticsBean sta : lists) {
|
|
|
- if (i < 7) {
|
|
|
- sta.setId(1);
|
|
|
- } else if (i < 13) {
|
|
|
- sta.setId(2);
|
|
|
- } else {
|
|
|
- sta.setId(3);
|
|
|
- }
|
|
|
- i++;
|
|
|
- mapStationInfos.put(sta.getDept_id(), sta);
|
|
|
- }
|
|
|
-
|
|
|
- // 检查人数 和 检查次数
|
|
|
- obj.setPosition_ids(positionList);
|
|
|
- List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
|
|
|
- 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()) && sta != null) {
|
|
|
- StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
- statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
|
|
|
- statis.getChecked_socre_name().add(sta.getName());
|
|
|
- statis.getChecked_score().add(sta.getScore());
|
|
|
- statis.getChecked_score_ids().add(sta.getId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<StatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
|
|
|
-
|
|
|
- sortList.sort(new Comparator<StatisticsBean>() {
|
|
|
- @Override
|
|
|
- public int compare(StatisticsBean o1, StatisticsBean o2) {
|
|
|
- if (o1.getId() > o2.getId()) {
|
|
|
- return 1;
|
|
|
- } else if (o1.getId() == o2.getId()) {
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- return sortList;
|
|
|
-
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public List<StatisticsBean> getFeeStationCheckItemScore(StatisticsBean obj) {
|
|
|
+//
|
|
|
+// // 获取收费站信息收费站人数
|
|
|
+// Constant t = CodeUtil.getCodeByFlagAndValue("feestation_check_jobs", "1");
|
|
|
+// String[] postions = t.getCode_name().split(",");
|
|
|
+// User user = new User();
|
|
|
+// List<Integer> positionList = new ArrayList<Integer>();
|
|
|
+// for (int i = 0; i < postions.length; i++) {
|
|
|
+// positionList.add(Integer.parseInt(postions[i]));
|
|
|
+// }
|
|
|
+// user.setPosition_ids(positionList);
|
|
|
+// user.setInvalidtime(obj.getStart_date());
|
|
|
+// List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(user);
|
|
|
+// Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
+// int i = 0;
|
|
|
+// for (StatisticsBean sta : lists) {
|
|
|
+// if (i < 7) {
|
|
|
+// sta.setId(1);
|
|
|
+// } else if (i < 13) {
|
|
|
+// sta.setId(2);
|
|
|
+// } else {
|
|
|
+// sta.setId(3);
|
|
|
+// }
|
|
|
+// i++;
|
|
|
+// mapStationInfos.put(sta.getDept_id(), sta);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 检查人数 和 检查次数
|
|
|
+// obj.setPosition_ids(positionList);
|
|
|
+// List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
|
|
|
+// 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()) && sta != null) {
|
|
|
+// StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
+// statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
|
|
|
+// statis.getChecked_socre_name().add(sta.getName());
|
|
|
+// statis.getChecked_score().add(sta.getScore());
|
|
|
+// statis.getChecked_score_ids().add(sta.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<StatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
|
|
|
+//
|
|
|
+// sortList.sort(new Comparator<StatisticsBean>() {
|
|
|
+// @Override
|
|
|
+// public int compare(StatisticsBean o1, StatisticsBean o2) {
|
|
|
+// if (o1.getId() > o2.getId()) {
|
|
|
+// return 1;
|
|
|
+// } else if (o1.getId() == o2.getId()) {
|
|
|
+// 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;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// return -1;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// return sortList;
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
private Integer getItemScore(StatisticsBo obj, String name) {
|
|
|
List<String> names = obj.getChecked_socre_name();
|
|
|
@@ -649,6 +648,20 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
|
|
|
@Override
|
|
|
public void getFeeStationCheckItemScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ Map<String,String> param = new HashMap<String,String>();
|
|
|
+ param.put("rule_type", "4");
|
|
|
+ CheckRule cr = checkRuleService.getItemListByRuleType(param);
|
|
|
+ List<CheckItem> itemList=null;
|
|
|
+ if(cr!=null && obj.getCheck_type() == 0)
|
|
|
+ itemList = cr.getCheck_items();
|
|
|
+ if(cr!=null && obj.getCheck_type() != 0 && obj.getCheck_type() != null){
|
|
|
+ for(CheckItem item: cr.getCheck_items()){
|
|
|
+ long id = item.getId();
|
|
|
+ if((int)id == obj.getCheck_type()){
|
|
|
+ itemList = item.getSubCheckItem();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
List<StatisticsBean> list = getFeeStationCheckItemScore(obj);
|
|
|
int totalMan = 0, totalcheckedMan = 0, totalcheckedCount = 0, totalAll = 0;
|
|
|
Map<String, Integer> scoreTypeMap = new HashMap<String, Integer>();
|
|
|
@@ -657,16 +670,21 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
StatisticsBean st = list.get(i);
|
|
|
// id值设置 seq_checked_score
|
|
|
// 平均值
|
|
|
+ DecimalFormat decimalFormat=new DecimalFormat("0.00");
|
|
|
st.setCheck_score_avg(
|
|
|
(st.getChecked_num() != 0) ? st.getAll_check_score() / (st.getChecked_num() + 0.0f) : 0.00f);
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "环境卫生"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "仪容仪表"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "表情"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "动作"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "文明用语"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "工作纪律"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "便民服务"));
|
|
|
- st.getSeq_checked_score().add(getItemScore2(st, "安全管理"));
|
|
|
+ st.setScore_avg(decimalFormat.format(st.getCheck_score_avg()));
|
|
|
+ for(CheckItem item: itemList){
|
|
|
+ st.getSeq_checked_score().add(getItemScore2(st, item.getName()));
|
|
|
+ }
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "环境卫生"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "仪容仪表"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "表情"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "动作"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "文明用语"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "工作纪律"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "便民服务"));
|
|
|
+// st.getSeq_checked_score().add(getItemScore2(st, "安全管理"));
|
|
|
totalMan += st.getPeople_num();
|
|
|
totalcheckedMan += st.getChecked_people_num();
|
|
|
totalcheckedCount += st.getChecked_num();
|
|
|
@@ -686,6 +704,7 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
map.put("totalMan", totalMan);
|
|
|
map.put("totalcheckedMan", totalcheckedMan);
|
|
|
map.put("totalcheckedCount", totalcheckedCount);
|
|
|
+ map.put("itemList",itemList);
|
|
|
List<Constant> typeList = CodeUtil.getCodeByFlag("statistic_check_item_type");
|
|
|
for (Constant c : typeList) {
|
|
|
if (scoreTypeMap.containsKey(c.getCode_name())) {
|
|
|
@@ -2500,4 +2519,98 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
|
|
|
return user_ids;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StatisticsBean> getFeeStationCheckItemScore(StatisticsBean obj) {
|
|
|
+ Map<String,String> param = new HashMap<String,String>();
|
|
|
+ param.put("rule_type", "4");
|
|
|
+ CheckRule cr = checkRuleService.getItemListByRuleType(param);
|
|
|
+ List<CheckItem> itemList=null;
|
|
|
+ if(cr!=null)
|
|
|
+ itemList = cr.getCheck_items();
|
|
|
+ // 获取收费站信息收费站人数
|
|
|
+ Constant t = CodeUtil.getCodeByFlagAndValue("feestation_check_jobs", "1");
|
|
|
+ String[] postions = t.getCode_name().split(",");
|
|
|
+ User user = new User();
|
|
|
+ List<Integer> positionList = new ArrayList<Integer>();
|
|
|
+ for (int i = 0; i < postions.length; i++) {
|
|
|
+ positionList.add(Integer.parseInt(postions[i]));
|
|
|
+ }
|
|
|
+ user.setPosition_ids(positionList);
|
|
|
+ user.setInvalidtime(obj.getStart_date());
|
|
|
+ List<StatisticsBean> lists = departmentDao.selectFeeStationGroup(user);
|
|
|
+ Map<Long, StatisticsBean> mapStationInfos = new HashMap<>();
|
|
|
+ int i = 0;
|
|
|
+ for (StatisticsBean sta : lists) {
|
|
|
+ sta.setScore(100);
|
|
|
+ mapStationInfos.put(sta.getDept_id(), sta);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查人数 和 检查次数
|
|
|
+ obj.setPosition_ids(positionList);
|
|
|
+ List<StatisticsBean> listCheckNum = statisticsDao.selectFeeStationCheckNum(obj);
|
|
|
+ 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 = null;
|
|
|
+ if(obj.getCheck_type() == 0){
|
|
|
+ listCheckedScore = statisticsDao.selectFeeStationCheckedPersonAllScoreDetail(obj);
|
|
|
+ }else{
|
|
|
+ listCheckedScore = statisticsDao.selectFeeStationCheckedPersonScoreDetailByParent(obj);
|
|
|
+ }
|
|
|
+ for (StatisticsBean sta : listCheckedScore) {
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id()) && sta != null) {
|
|
|
+ StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
+ statis.setAll_check_score(statis.getAll_check_score() + sta.getScore());
|
|
|
+ statis.getChecked_socre_name().add(sta.getName());
|
|
|
+ statis.getChecked_score().add(sta.getScore());
|
|
|
+ statis.getChecked_score_ids().add(sta.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatisticsBean> listUserCheckedScore = null;
|
|
|
+ //List<StatisticsBean> listUserCheckedScore1 = statisticsDao.selectFeeStationCheckedPersonScoreDetailByUser(obj);
|
|
|
+ if(obj.getCheck_type() == 0){
|
|
|
+ listUserCheckedScore = statisticsDao.selectFeeStationCheckedPersonScoreDetailByUser(obj);
|
|
|
+ }else{
|
|
|
+ listUserCheckedScore = statisticsDao.selectFeeStationCheckedPersonScoreDetailByUserByParentid(obj);
|
|
|
+ }
|
|
|
+ for(StatisticsBean sta : listUserCheckedScore){
|
|
|
+ if (mapStationInfos.containsKey(sta.getDept_id()) && sta != null) {
|
|
|
+ StatisticsBean statis = mapStationInfos.get(sta.getDept_id());
|
|
|
+ if(sta.getScore() > 20){
|
|
|
+ statis.setScore(statis.getScore() - 2);
|
|
|
+ }else if(sta.getScore() > 10){
|
|
|
+ statis.setScore(statis.getScore() - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ List<StatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
|
|
|
+ sortList.sort(new Comparator<StatisticsBean>() {
|
|
|
+ @Override
|
|
|
+ public int compare(StatisticsBean o1, StatisticsBean o2) {
|
|
|
+ if(o1.getScore() > o2.getScore()){
|
|
|
+ return -1;
|
|
|
+ }else if(o1.getScore() < o2.getScore()){
|
|
|
+ return 1;
|
|
|
+ }else{
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for(int c=0;c<sortList.size();c++){
|
|
|
+ if(c == 0){
|
|
|
+ sortList.get(c).setRanking(1);
|
|
|
+ }else if(sortList.get(c).getScore() == sortList.get(c-1).getScore()){
|
|
|
+ sortList.get(c).setRanking(sortList.get(c-1).getRanking());
|
|
|
+ }else if(sortList.get(c).getScore() < sortList.get(c-1).getScore()){
|
|
|
+ sortList.get(c).setRanking(c+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sortList;
|
|
|
+
|
|
|
+ }
|
|
|
}
|