StatisticsController.java 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. package com.xintong.visualinspection.controller;
  2. import java.util.*;
  3. import com.xintong.system.err.BusinessException;
  4. import com.xintong.visualinspection.bean.*;
  5. import com.xintong.visualinspection.pojo.StatisiticPojo;
  6. import com.xintong.visualinspection.pojo.StatisticExUser;
  7. import com.xintong.visualinspection.pojo.UserRankingData;
  8. import com.xintong.visualinspection.service.CommonService;
  9. import com.xintong.visualinspection.util.AuthorUtil;
  10. import com.xintong.visualinspection.util.CacheUtil;
  11. import com.xintong.visualinspection.util.Constants;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import com.github.pagehelper.PageHelper;
  15. import com.github.pagehelper.PageInfo;
  16. import com.xintong.visualinspection.service.StatisticsService;
  17. import com.xintong.visualinspection.util.CodeUtil;
  18. import javax.servlet.http.HttpServletRequest;
  19. /**
  20. * 文件名:StatisticsController
  21. * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  22. */
  23. @RestController
  24. @RequestMapping("/statistics")
  25. public class StatisticsController extends BaseController {
  26. @Autowired
  27. private StatisticsService statisticsService;
  28. @Autowired
  29. private CommonService commonService;
  30. /**
  31. * 温馨服务考核情况反馈表(所有员工排名)
  32. * @return
  33. * String
  34. * @exception
  35. * @since 1.0.0
  36. */
  37. @RequestMapping(value = "/employee/order")
  38. public String getEmployeeOrder(@RequestBody StatisticsBean obj){
  39. List<StatisticsBo> lists= statisticsService.getEmployeeCheckedInfo(obj);
  40. List<UserChangeStation> userChangeStations = statisticsService.getUserChangeStation(obj);
  41. Map<String,Object> m = new HashMap<>();
  42. m.put("lists",lists);
  43. m.put("userChangeStations",userChangeStations);
  44. return super.returnSuccessResult(m);
  45. }
  46. @RequestMapping(value = "/employee/order/data")
  47. public String getEmployeeOrder(@RequestParam(required = false) String data){
  48. String res = "";
  49. if(data!=null){
  50. String[] items = data.split("\\$");
  51. //写
  52. if(items.length>1){
  53. CacheUtil.commonDataMap.put(items[0],items[1]);
  54. }else{
  55. //读
  56. res = CacheUtil.commonDataMap.get(items[0]);
  57. }
  58. }
  59. return super.returnSuccessResult((Object) res);
  60. }
  61. /**
  62. * 获取用户排名详情
  63. * @param obj
  64. * @return
  65. */
  66. @RequestMapping(value = "/employee/order/detail")
  67. public String getEmployeeOrderByUserId(@RequestBody StatisticsBean obj){
  68. UserRankingData userRankingData= statisticsService.getEmployeeRankingData(obj);
  69. return super.returnSuccessResult(userRankingData);
  70. }
  71. /**
  72. * 温馨服务检查千分考核扣分情况汇总表
  73. * @param obj
  74. * @return
  75. */
  76. @RequestMapping(value = "/score/info")
  77. public String getScoreInfo(@RequestBody StatisticsBean obj){
  78. List<StatisticsBean> lists= statisticsService.getFeeStationCheckedScore(obj);
  79. int totalMan=0,totalcheckedMan=0,totalcheckedCount=0,total0=0,total15=0,total50=0,totalOver50=0,totalAll = 0;
  80. for(StatisticsBean bean:lists){
  81. totalMan+=bean.getPeople_num();
  82. totalcheckedMan+=bean.getChecked_people_num();
  83. totalcheckedCount+=bean.getChecked_num();
  84. total0+=(bean.getChecked_people_num()-bean.getScore_fifteen()-bean.getScore_fifty()-bean.getScore_over_fifty());
  85. total15+=bean.getScore_fifteen();
  86. total50+=bean.getScore_fifty();
  87. totalOver50+=bean.getScore_over_fifty();
  88. totalAll+=bean.getAll_check_score();
  89. }
  90. Map<String,Object> resultMap = new HashMap<String,Object>();
  91. resultMap.put("list", lists);
  92. resultMap.put("totalMan", totalMan);
  93. resultMap.put("totalcheckedMan", totalcheckedMan);
  94. resultMap.put("totalcheckedCount", totalcheckedCount);
  95. resultMap.put("total0", total0);
  96. resultMap.put("total15", total15);
  97. resultMap.put("total50", total50);
  98. resultMap.put("totalOver50", totalOver50);
  99. resultMap.put("totalAll", totalAll);
  100. return super.returnSuccessResult(resultMap);
  101. }
  102. /**
  103. * 温馨服务检查情况统计表
  104. */
  105. @RequestMapping(value = "/score/item/info")
  106. public String getScoreItemInfo(@RequestBody StatisticsBean obj){
  107. List<StatisticsBean> lists= statisticsService.getFeeStationCheckItemScore(obj);
  108. int totalMan=0,totalcheckedMan=0,totalcheckedCount=0,totalAll=0;
  109. Map<String,Integer> scoreTypeMap = new HashMap<String,Integer>();
  110. for(StatisticsBean bean:lists){
  111. totalMan+=bean.getPeople_num();
  112. totalcheckedMan+=bean.getChecked_people_num();
  113. totalcheckedCount+=bean.getChecked_num();
  114. totalAll+=bean.getAll_check_score();
  115. List<String> names = bean.getChecked_socre_name();
  116. List<Integer> scores = bean.getChecked_score();
  117. for(int i=0;i<names.size();i++){
  118. Integer score = scoreTypeMap.get(names.get(i));
  119. if(score==null) score=0;
  120. score+=scores.get(i);
  121. if(names.get(i)!=null){
  122. scoreTypeMap.put(names.get(i), score);
  123. }
  124. }
  125. // bean.get
  126. }
  127. Map<String,Object> resultMap = new HashMap<String,Object>();
  128. resultMap.put("list", lists);
  129. resultMap.put("totalMan", totalMan);
  130. resultMap.put("totalcheckedMan", totalcheckedMan);
  131. resultMap.put("totalcheckedCount", totalcheckedCount);
  132. resultMap.put("totalAll", totalAll);
  133. resultMap.putAll(scoreTypeMap);
  134. // resultMap.put("total50", total50);
  135. // resultMap.put("totalOver50", totalOver50);
  136. // resultMap.put("totalAll", totalAll);
  137. return super.returnSuccessResult(resultMap);
  138. }
  139. /**
  140. * 运营管理综合检查情况统计表
  141. */
  142. @RequestMapping(value = "/operation/manage/integration")
  143. public String getOperationInfo(@RequestBody StatisticsBean obj){
  144. Map<Long, Organ> deptMap = commonService.getDeptMap();
  145. List<FeeStation> rmList = commonService.getAllDeptByLayer("RM");
  146. List<StatisticsBean> lists= statisticsService.getOperationInfo(obj);
  147. int totalMan=0,totalCompanyNum=0,totalCompanyScore=0,totalThirdNum=0,
  148. totalThirdScore=0,totalSpecialNum=0,totalSpecialScore=0,totalOnsiteNum=0,
  149. totalOnsiteScore=0,totalDataNum=0,totalDataScore=0;
  150. for(StatisticsBean bean:lists){
  151. bean.setParent_dept_id(deptMap.get(bean.getDept_id().longValue()).getParentid().longValue());
  152. bean.setParent_name(deptMap.get(bean.getParent_dept_id()).getOrganname());
  153. totalMan+=bean.getPeople_num();
  154. totalCompanyNum += bean.getCompany_check_num();
  155. totalCompanyScore += bean.getCompany_total_score();
  156. totalThirdNum += bean.getThird_check_num();
  157. totalThirdScore += bean.getThird_total_score();
  158. totalSpecialNum += bean.getSpecial_check_num();
  159. totalSpecialScore += bean.getSpecial_total_score();
  160. totalOnsiteNum += bean.getOnsite_check_num();
  161. totalOnsiteScore += bean.getOnsite_total_score();
  162. totalDataNum += bean.getData_check_num();
  163. totalDataScore += bean.getData_total_score();
  164. }
  165. Map<String,Object> resultMap = new HashMap<String,Object>();
  166. resultMap.put("list", lists);
  167. resultMap.put("rmlist", rmList);
  168. resultMap.put("totalMan", totalMan);
  169. resultMap.put("totalCompanyNum", totalCompanyNum);
  170. resultMap.put("totalCompanyScore", totalCompanyScore);
  171. resultMap.put("totalThirdNum", totalThirdNum);
  172. resultMap.put("totalThirdScore", totalThirdScore);
  173. resultMap.put("totalSpecialNum", totalSpecialNum);
  174. resultMap.put("totalSpecialScore", totalSpecialScore);
  175. resultMap.put("totalOnsiteNum", totalOnsiteNum);
  176. resultMap.put("totalOnsiteScore", totalOnsiteScore);
  177. resultMap.put("totalDataNum", totalDataNum);
  178. resultMap.put("totalDataScore", totalDataScore);
  179. return super.returnSuccessResult(resultMap);
  180. }
  181. /**
  182. * 12个月考核等分总体
  183. */
  184. @RequestMapping(value = "/score/year/info")
  185. public String selectYearScoreChange(@RequestBody StatisticsBean obj){
  186. List<StatisticsBean> lists= statisticsService.getYearScoreChange(obj);
  187. return super.returnSuccessResult(lists);
  188. }
  189. /**
  190. * 收费站
  191. */
  192. @RequestMapping(value = "/score/tollgate/info")
  193. public String selectTollgateScoreChange(@RequestBody StatisticsBean obj){
  194. List<StatisticsBean> lists= statisticsService.getFeeStationScoreInfo(obj);
  195. return super.returnSuccessResult(lists);
  196. }
  197. /**
  198. * 道管中心3
  199. */
  200. @RequestMapping(value = "/score/center/manage/info")
  201. public String selectCentermanageScoreChange(@RequestBody StatisticsBean obj){
  202. List<StatisticsBean> lists= statisticsService.getCenterManageScoreInfo(obj);
  203. return super.returnSuccessResult(lists);
  204. }
  205. /**
  206. * 道管下收费站
  207. */
  208. @RequestMapping(value = "/score/manage/tollgate/info")
  209. public String selectCentermanageTollgateScoreChange(@RequestBody StatisticsBean obj){
  210. List<StatisticsBean> lists= statisticsService.getSingleFeeStationScoreInfo(obj);
  211. return super.returnSuccessResult(lists);
  212. }
  213. /**
  214. * 考核扣分情况比
  215. */
  216. @RequestMapping(value = "/lost/score/rate")
  217. public String getCheckedInfoRate(@RequestBody StatisticsBean obj){
  218. StatisticsBean returnObj= statisticsService.getCheckedScoreInfo(obj);
  219. return super.returnSuccessResult(returnObj);
  220. }
  221. /**
  222. * 考核扣分项情况比
  223. */
  224. @RequestMapping(value = "/lost/itemscore/rate")
  225. public String getCheckedItemInfoRate(@RequestBody StatisticsBean obj){
  226. List<StatisticsBean> returnList= statisticsService.getCheckedItemScoreInfo(obj);
  227. return super.returnSuccessResult(returnList);
  228. }
  229. /**
  230. * 考核扣分项两次占比
  231. */
  232. @RequestMapping(value = "/lost/twice/itemscore/rate")
  233. public String getTwiceCheckedItemInfoRate(@RequestBody StatisticsBean obj){
  234. Map<String,List<StatisticsBean>> returnMap= statisticsService.get2CheckedItemScoreInfo(obj);
  235. return super.returnSuccessResult(returnMap);
  236. }
  237. /**
  238. * 获取导管中心前10名,后10名 或者收费站排名
  239. */
  240. @RequestMapping(value = "/stuff/score/info")
  241. public String getPersonalStuffItemInfo(@RequestBody StatisticsBean obj){
  242. List<StatisticsBean> returnList= statisticsService.getPersonalScoreInfo(obj);
  243. return super.returnSuccessResult(returnList);
  244. }
  245. /**
  246. * 获取收费站排名前5名
  247. */
  248. @RequestMapping(value = "/fs/up/five")
  249. public String getFsUp5PersonInfo(@RequestBody StatisticsBean obj){
  250. List<StatisticsBean> returnList= statisticsService.getFSUp5Person(obj);
  251. return super.returnSuccessResult(returnList);
  252. }
  253. /**
  254. * 获取收费站中人的12月情况
  255. */
  256. @RequestMapping(value = "/one/person/year/info")
  257. public String getFsOnePersonInfo(@RequestBody StatisticsBean obj){
  258. List<StatisticsBean> returnList= statisticsService.getOneFSCheckedInfo(obj);
  259. return super.returnSuccessResult(returnList);
  260. }
  261. /**
  262. * 获取收费站各项扣分情况
  263. */
  264. @RequestMapping(value = "/one/person/checkedItem/info")
  265. public String getFsOnePersonCheckedItemInfo(@RequestBody StatisticsBean obj){
  266. List<StatisticsBean> returnList= statisticsService.getOneCheckedItemInfo(obj);
  267. return super.returnSuccessResult(returnList);
  268. }
  269. /**
  270. * 获取收费站具体某个人的扣分详情
  271. */
  272. @RequestMapping(value = "/one/checkedItem/detail/info/{page}/{size}")
  273. public String getFsOnePersonCheckedItemDetailInfo(HttpServletRequest request, @RequestBody StatisticsBean obj, @PathVariable Integer page, @PathVariable Integer size){
  274. //PageHelper.offsetPage(page, size);
  275. boolean isshow = true;
  276. //获取个人权限
  277. User user = getCurrentUser(request);
  278. if(AuthorUtil.hasRole(user, Constants.ROLE_STATION_ADMIN)
  279. ||AuthorUtil.hasRole(user, Constants.ROLE_STATION)
  280. ||AuthorUtil.hasRole(user, Constants.ROLE_STATION_AGENT)
  281. ||AuthorUtil.containsRole(user, "ROLE_STATION")){
  282. //判断是否是单钱周期
  283. Date a = new Date();
  284. if(obj.getEnd_date()!=null && obj.getEnd_date().getTime()>a.getTime()){
  285. isshow = false;
  286. }
  287. }
  288. if(isshow){
  289. PageHelper.startPage(page, size);
  290. List<StatisticsBean> returnList= statisticsService.getOneCheckedDetailInfo(obj);
  291. return super.returnSuccessResult(new PageInfo(returnList));
  292. }else{
  293. return super.returnSuccessResult(new PageInfo(new ArrayList<StatisticsBean>()));
  294. }
  295. }
  296. /**
  297. * 获取考核列表情况
  298. */
  299. @RequestMapping(value = "/checkman/info")
  300. public String getCheckmanInfo(@RequestBody CheckmanStatisticsBean obj){
  301. CheckmanStatisticsBean returnObj= statisticsService.getCheckmanStatisticInfo(obj);
  302. return super.returnSuccessResult(returnObj);
  303. }
  304. /**
  305. * 获取考勤列表情况
  306. */
  307. @RequestMapping(value = "/fs/work/info")
  308. public String getFsworkInfo(@RequestBody StatisticsFsWork obj){
  309. List<StatisticsFsWork> returnObj= statisticsService.getFsWorkStatisticInfo(obj);
  310. return super.returnSuccessResultTime(returnObj);
  311. }
  312. /**
  313. * 获取顶岗考勤列表情况
  314. */
  315. @RequestMapping(value = "/fs/unregular/work/info")
  316. public String getFsUnregularworkInfo(@RequestBody StatisticsFsWork obj){
  317. List<StatisticsFsWork> returnObj= statisticsService.getUnregularFsWorkStatisticInfo(obj);
  318. return super.returnSuccessResultTime(returnObj);
  319. }
  320. /**
  321. * 正常在岗人数
  322. */
  323. @RequestMapping(value = "/fs/work/person")
  324. public String getFsworkInfoPersonNumber(@RequestBody StatisticsFsWork obj){
  325. List<StatisticsFsWork> returnObj= statisticsService.getFsWorkPerson(obj);
  326. return super.returnSuccessResultTime(returnObj);
  327. }
  328. /**
  329. * 顶岗人数统计
  330. */
  331. @RequestMapping(value = "/fs/unregular/work/person")
  332. public String getFsUnregularworkInfoPersonNumber(@RequestBody StatisticsFsWork obj){
  333. List<StatisticsFsWork> returnObj= statisticsService.getFsWorkUnregularWorkPerson(obj);
  334. return super.returnSuccessResultTime(returnObj);
  335. }
  336. /**
  337. * 申诉统计
  338. */
  339. @RequestMapping(value = "/check/appeal")
  340. public String getCheckAppeal(@RequestBody CheckAppealStatistic obj){
  341. List<CheckAppealStatistic> returnObj= statisticsService.getCheckAppealStatistic(obj);
  342. return super.returnSuccessResultTime(returnObj);
  343. }
  344. /**
  345. * 业务提升情况反馈表(所有员工排名)
  346. * @return
  347. * String
  348. * @exception
  349. * @since 1.0.0
  350. */
  351. @RequestMapping(value = "/business/feedback")
  352. public String getBusinessFeedback(@RequestBody StatisticsBean obj){
  353. List<StatisticsBo> lists= statisticsService.getBusinessFeedbackInfo(obj);
  354. return super.returnSuccessResult(lists);
  355. }
  356. @RequestMapping(value = "/check/wrecker")
  357. public String getCheckWrecker(@RequestBody StatisticsBean obj){
  358. List<StatisticsBean> lists= statisticsService.getWreckerCheckInfo(obj);
  359. return super.returnSuccessResult(lists);
  360. }
  361. @RequestMapping(value = "/check/wrecker/staff")
  362. public String getCheckWreckerStaff(@RequestBody WreckerStatisticsBO obj){
  363. List<WreckerStatisticsBO> lists= statisticsService.getWreckerStaffInfo(obj);
  364. return super.returnSuccessResult(lists);
  365. }
  366. @RequestMapping(value = "/user/score")
  367. public String getFsOnePersonCheckedItemDetailInfo(@RequestBody UserStatistic obj){
  368. List<StatisiticPojo> returnList= statisticsService.getuserStatistic(obj);
  369. return super.returnSuccessResult((returnList));
  370. }
  371. @RequestMapping(value = "/userex/add")
  372. public String addcheckSExUser(@RequestBody StatisticExUser obj){
  373. Object s = statisticsService.addcheckSExUser(obj);
  374. if(s==null) throw new BusinessException(20001,"发生错误");
  375. return super.returnSuccessResult();
  376. }
  377. @RequestMapping(value = "/userex/delete")
  378. public String deletecheckSExUser(@RequestBody StatisticExUser obj){
  379. Object s=statisticsService.deletecheckSExUser(obj);
  380. if(s==null) throw new BusinessException(20001,"发生错误");
  381. return super.returnSuccessResult();
  382. }
  383. @RequestMapping(value = "/dept")
  384. public String getDeptStatistic(@RequestBody DeptStatistic obj){
  385. Map<String,List<DeptStatistic>> s=statisticsService.getDeptStatistic(obj);
  386. if(s==null) throw new BusinessException(20002,"参数不对");
  387. return super.returnSuccessResult(s);
  388. }
  389. }