| 
					
				 | 
			
			
				@@ -1,6 +1,5 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.huaxu.order.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.client.SmsWaterClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.client.UserCenterClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.entity.Message; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10,7 +9,6 @@ import com.huaxu.model.ResultStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.order.dto.StatisticsDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.order.dto.WorkOrderManageDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.order.service.WorkOrderManageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.huaxu.process.dto.TaskUserDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.util.MessageSendUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.huaxu.util.UserUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -48,14 +46,14 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "completionStatistics", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "工单完成情况统计") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AjaxMessage<Map<String, Object>> completionStatistics( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int statsType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计开始日期", required = true) @RequestParam(required = true) String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //同比日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String sameStartDate = null, sameEndDate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //环比日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String chainStartDate = null, chainEndDate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (type == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (statsType == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = subMonth(startDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -64,7 +62,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             chainStartDate = subMonth(startDate, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             chainEndDate = subMonth(chainStartDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (type == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (statsType == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = subMonth(startDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -73,7 +71,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             chainStartDate = subYear(startDate, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             chainEndDate = subYear(chainStartDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (type == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (statsType == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = String.format("%s-01", endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -152,7 +150,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "eventStatistics", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "事件曲线数据统计展示、人均工单数据统计展示") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AjaxMessage<Map<String,Object>> eventStatistics( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int statsType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int maintainerCount = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -165,7 +163,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setUserType(loginUser.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //1是公司,2是公司及以下,3部门,4部门及以下,5自定义 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setPermissonType(loginUser.getPermissonType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        switch (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (statsType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 maintainerCount = userCenterClient.findMaintainerCount(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 startDate = String.format("%s-01", startDate); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -185,9 +183,9 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setStartDate(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setEndDate(endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (type == 0 || type == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (statsType == 0 || statsType == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statistics = workOrderManageService.eventMonthStatistics(workOrderManageDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (type == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (statsType == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statistics = workOrderManageService.eventYearStatistics(workOrderManageDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int seq=0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -212,7 +210,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "orderDurationStatistics", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "工单时长统计展示") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AjaxMessage<List<StatisticsDto>> orderDurationStatistics( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int statsType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //根据用户编号,获取用户的权限 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,7 +221,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setUserType(loginUser.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //1是公司,2是公司及以下,3部门,4部门及以下,5自定义 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setPermissonType(loginUser.getPermissonType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        switch (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (statsType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 endDate = subMonth(startDate, 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -248,7 +246,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     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 = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int statsType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -256,7 +254,7 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Map<String,Object>> statistics = new ArrayList<Map<String, Object>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        switch (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (statsType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 endDate = subMonth(startDate, 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -281,10 +279,10 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else if(sort==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             idList.add(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(type ==0 || type ==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(statsType ==0 || statsType ==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statistics =  workOrderManageService.dispatchTimesMonthStatistics(workOrderManageDto,idList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        else if(type == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        else if(statsType == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statistics =  workOrderManageService.dispatchTimesYearStatistics(workOrderManageDto,idList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return new AjaxMessage<>(ResultStatus.OK, statistics); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -293,26 +291,25 @@ public class WorkOrderStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "distributionStatistics", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "上报类型、工单类型、工单状态统计") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AjaxMessage<Map<String, Object>> distributionStatistics( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int statsType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //根据用户编号,获取用户的权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser loginUser = UserUtil.getCurrentUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        workOrderManageDto.setOrderStatus(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setProgramItems(loginUser.getProgramItemList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setUserType(loginUser.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //1是公司,2是公司及以下,3部门,4部门及以下,5自定义 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         workOrderManageDto.setPermissonType(loginUser.getPermissonType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (type == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (statsType == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = subMonth(startDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (type == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (statsType == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = subYear(startDate, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (type == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (statsType == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = String.format("%s-01", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = String.format("%s-01", endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |