|
@@ -1,4 +1,55 @@
|
|
|
package com.huaxu.order.controller;
|
|
|
|
|
|
+import com.huaxu.model.AjaxMessage;
|
|
|
+import com.huaxu.model.LoginUser;
|
|
|
+import com.huaxu.model.ResultStatus;
|
|
|
+import com.huaxu.order.dto.WorkOrderManageDto;
|
|
|
+import com.huaxu.order.service.WorkOrderManageService;
|
|
|
+import com.huaxu.util.UserUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/order/workOrderStatistics/")
|
|
|
+@Api(tags = "工单统计")
|
|
|
public class WorkOrderStatisticsController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ WorkOrderManageService workOrderManageService;
|
|
|
+
|
|
|
+ @RequestMapping(value = "completionStatistics", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "工单完成情况统计()")
|
|
|
+ public AjaxMessage<Map<String,Object>> completionStatistics(
|
|
|
+ @ApiParam(value="统计类型:0-按月统计,1-按年统计",required =true) @RequestParam(required = true) int type,
|
|
|
+ @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy)", required = true) @RequestParam(required = true) String startDate) {
|
|
|
+ if(type==0){
|
|
|
+ startDate = String.format("%s-01",startDate);
|
|
|
+ }
|
|
|
+ else if(type==1){
|
|
|
+ startDate = String.format("%s-01-01",startDate);
|
|
|
+ }
|
|
|
+ //根据用户编号,获取用户的权限
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ WorkOrderManageDto workOrderManageDto = new WorkOrderManageDto();
|
|
|
+ workOrderManageDto.setStartDate(startDate);
|
|
|
+ workOrderManageDto.setOrderStatus(type);
|
|
|
+ workOrderManageDto.setProgramItems(loginUser.getProgramItemList());
|
|
|
+ workOrderManageDto.setUserType(loginUser.getType());
|
|
|
+ //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
|
|
|
+ workOrderManageDto.setPermissonType(loginUser.getPermissonType());
|
|
|
+ Map<String,Object> result=workOrderManageService.workOrderStatistics(workOrderManageDto);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|