|
@@ -1,5 +1,6 @@
|
|
|
package com.huaxu.order.controller;
|
|
|
|
|
|
+import com.huaxu.client.UserCenterClient;
|
|
|
import com.huaxu.model.AjaxMessage;
|
|
|
import com.huaxu.model.LoginUser;
|
|
|
import com.huaxu.model.ResultStatus;
|
|
@@ -30,6 +31,9 @@ public class WorkOrderStatisticsController {
|
|
|
@Autowired
|
|
|
WorkOrderManageService workOrderManageService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ UserCenterClient userCenterClient;
|
|
|
+
|
|
|
@RequestMapping(value = "completionStatistics", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "工单完成情况统计")
|
|
|
public AjaxMessage<Map<String, Object>> completionStatistics(
|
|
@@ -129,12 +133,14 @@ public class WorkOrderStatisticsController {
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "eventStatistics", method = RequestMethod.GET)
|
|
|
- @ApiOperation(value = "事件曲线数据统计展示")
|
|
|
- public AjaxMessage<List<Map<String, Object>>> eventStatistics(
|
|
|
+ @ApiOperation(value = "事件曲线数据统计展示、人均工单数据统计展示")
|
|
|
+ public AjaxMessage<Map<String,Object>> eventStatistics(
|
|
|
@ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type,
|
|
|
@ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate,
|
|
|
@ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException {
|
|
|
- List<Map<String, Object>> statistics = null;
|
|
|
+ int maintainerCount = 0;
|
|
|
+ Map<String,Object> result = new HashMap<>();
|
|
|
+ List<Map<String, Object>> statistics = new ArrayList<>(), average =new ArrayList<>();
|
|
|
//根据用户编号,获取用户的权限
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto();
|
|
@@ -145,14 +151,17 @@ public class WorkOrderStatisticsController {
|
|
|
workOrderManageDto.setPermissonType(loginUser.getPermissonType());
|
|
|
switch (type) {
|
|
|
case 0:
|
|
|
+ maintainerCount = userCenterClient.findMaintainerCount(startDate);
|
|
|
startDate = String.format("%s-01", startDate);
|
|
|
endDate = subMonth(startDate, 1);
|
|
|
break;
|
|
|
case 1:
|
|
|
+ maintainerCount = userCenterClient.findMaintainerCount(String.format("%-12",startDate));
|
|
|
startDate = String.format("%s-01-01", startDate);
|
|
|
endDate = subYear(startDate, 1);
|
|
|
break;
|
|
|
case 2:
|
|
|
+ maintainerCount = userCenterClient.findMaintainerCount(endDate);
|
|
|
startDate = String.format("%s-01", startDate);
|
|
|
endDate = String.format("%s-01", endDate);
|
|
|
break;
|
|
@@ -165,13 +174,25 @@ public class WorkOrderStatisticsController {
|
|
|
} else if (type == 1) {
|
|
|
statistics = workOrderManageService.eventYearStatistics(workOrderManageDto);
|
|
|
}
|
|
|
-
|
|
|
- return new AjaxMessage<>(ResultStatus.OK, statistics);
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+ for(Map<String,Object> map : statistics){
|
|
|
+ double number = 0;
|
|
|
+ if(maintainerCount > 0){
|
|
|
+ number = Double.parseDouble(map.get("数量").toString())/maintainerCount;
|
|
|
+ }
|
|
|
+ Map<String,Object> data = new HashMap<>();
|
|
|
+ data.put("日期",map.get("日期"));
|
|
|
+ data.put("数量",df.format(number));
|
|
|
+ average.add(data);
|
|
|
+ }
|
|
|
+ result.put("事件数量",statistics);
|
|
|
+ result.put("人均工单",average);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "distributionStatistics", method = RequestMethod.GET)
|
|
|
- @ApiOperation(value = "分布统计")
|
|
|
+ @ApiOperation(value = "上报类型、工单类型、工单状态统计")
|
|
|
public AjaxMessage<Map<String, Object>> distributionStatistics(
|
|
|
@ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type,
|
|
|
@ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate,
|