|
@@ -1,5 +1,6 @@
|
|
|
package com.huaxu.order.controller;
|
|
|
|
|
|
+import com.huaxu.client.SmsWaterClient;
|
|
|
import com.huaxu.client.UserCenterClient;
|
|
|
import com.huaxu.model.AjaxMessage;
|
|
|
import com.huaxu.model.LoginUser;
|
|
@@ -34,6 +35,9 @@ public class WorkOrderStatisticsController {
|
|
|
@Autowired
|
|
|
UserCenterClient userCenterClient;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SmsWaterClient smsWaterClient;
|
|
|
+
|
|
|
@RequestMapping(value = "completionStatistics", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "工单完成情况统计")
|
|
|
public AjaxMessage<Map<String, Object>> completionStatistics(
|
|
@@ -150,7 +154,6 @@ public class WorkOrderStatisticsController {
|
|
|
//根据用户编号,获取用户的权限
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto();
|
|
|
-
|
|
|
workOrderManageDto.setProgramItems(loginUser.getProgramItemList());
|
|
|
workOrderManageDto.setUserType(loginUser.getType());
|
|
|
//1是公司,2是公司及以下,3部门,4部门及以下,5自定义
|
|
@@ -233,7 +236,53 @@ public class WorkOrderStatisticsController {
|
|
|
return new AjaxMessage<>(ResultStatus.OK, statistics);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "dispatchTimesStatistics", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "派单次数统计")
|
|
|
+ public AjaxMessage<List<Map<String,Object>>> dispatchTimesStatistics(
|
|
|
+ @ApiParam(value = "设备或场景ID", required = true) @RequestParam(required = true) int id,
|
|
|
+ @ApiParam(value = "设备或场景标识(1:设备;2:场景)", required = true) @RequestParam(required = true) int sort,
|
|
|
+ @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<Integer> idList = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> statistics = new ArrayList<Map<String, Object>>();
|
|
|
|
|
|
+ WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto();
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ startDate = String.format("%s-01", startDate);
|
|
|
+ endDate = subMonth(startDate, 1);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ startDate = String.format("%s-01-01", startDate);
|
|
|
+ endDate = subYear(startDate, 1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ startDate = String.format("%s-01", startDate);
|
|
|
+ endDate = String.format("%s-01", endDate);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ workOrderManageDto.setStartDate(startDate);
|
|
|
+ workOrderManageDto.setEndDate(endDate);
|
|
|
+ if(sort == 1){
|
|
|
+ idList.add(id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ AjaxMessage<List<Map<String, Object>>> ajaxMessage = smsWaterClient.selectAlarmDeviceIdBySenceId(id);
|
|
|
+ for(Map<String,Object> map : ajaxMessage.getData()){
|
|
|
+ int deviceId = Integer.parseInt(map.get("device_id").toString());
|
|
|
+ idList.add(deviceId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(type ==0 || type ==2){
|
|
|
+ statistics = workOrderManageService.dispatchTimesMonthStatistics(workOrderManageDto,idList);
|
|
|
+ }
|
|
|
+ else if(type == 1){
|
|
|
+ statistics = workOrderManageService.dispatchTimesYearStatistics(workOrderManageDto,idList);
|
|
|
+ }
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, statistics);
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping(value = "distributionStatistics", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "上报类型、工单类型、工单状态统计")
|
|
@@ -312,6 +361,4 @@ public class WorkOrderStatisticsController {
|
|
|
String reStr = sdf.format(dt1);
|
|
|
return reStr;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|