|  | @@ -1,6 +1,9 @@
 | 
	
		
			
				|  |  |  package com.xunmei.core.evaluate.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import cn.hutool.core.date.DateTime;
 | 
	
		
			
				|  |  | +import cn.hutool.core.date.DateUtil;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.domain.AjaxResult;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.page.TableDataInfo;
 | 
	
	
		
			
				|  | @@ -11,14 +14,18 @@ import com.xunmei.core.evaluate.domain.CoreEvaluateTask;
 | 
	
		
			
				|  |  |  import com.xunmei.core.evaluate.dto.EvaluateTaskContentDTO;
 | 
	
		
			
				|  |  |  import com.xunmei.core.evaluate.dto.EvaluateTaskDTO;
 | 
	
		
			
				|  |  |  import com.xunmei.core.evaluate.dto.EvaluateTaskStatisticsDTO;
 | 
	
		
			
				|  |  | +import com.xunmei.core.evaluate.service.ICoreEvaluatePlanService;
 | 
	
		
			
				|  |  |  import com.xunmei.core.evaluate.service.ICoreEvaluateTaskService;
 | 
	
		
			
				|  |  | +import com.xunmei.core.evaluate.vo.CoreEvaluatePlanVO;
 | 
	
		
			
				|  |  |  import com.xunmei.core.evaluate.vo.CoreEvaluateTaskVO;
 | 
	
		
			
				|  |  | +import com.xunmei.core.retrieval.service.impl.CoreMonitoringRetrievalTaskServiceImpl;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.time.LocalDate;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Map;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -34,6 +41,10 @@ import java.util.Map;
 | 
	
		
			
				|  |  |  public class CoreEvaluateTaskController extends BaseController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ICoreEvaluateTaskService coreEvaluateTaskService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ICoreEvaluatePlanService coreEvaluatePlanService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private CoreMonitoringRetrievalTaskServiceImpl coreMonitoringRetrievalTaskService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询外包评价任务列表
 | 
	
	
		
			
				|  | @@ -59,10 +70,41 @@ public class CoreEvaluateTaskController extends BaseController {
 | 
	
		
			
				|  |  |      @RequiresPermissions("core:evaluateTask:list")
 | 
	
		
			
				|  |  |      @GetMapping("/statistics")
 | 
	
		
			
				|  |  |      public AjaxResult statistics(EvaluateTaskStatisticsDTO evaluateTaskStatisticsDTO) {
 | 
	
		
			
				|  |  | -        AjaxResult ajaxResult =AjaxResult.success();
 | 
	
		
			
				|  |  | -        ajaxResult.put(AjaxResult.DATA_TAG,coreEvaluateTaskService.statistics(evaluateTaskStatisticsDTO));
 | 
	
		
			
				|  |  | -        LocalDate localDate= LocalDate.now();
 | 
	
		
			
				|  |  | -        ajaxResult.put("tittle","押运公司评价情况表("+localDate.getYear()+"年"+localDate.getMonthValue()+"月)");
 | 
	
		
			
				|  |  | +        AjaxResult ajaxResult = AjaxResult.success();
 | 
	
		
			
				|  |  | +        if (null != evaluateTaskStatisticsDTO.getPlanId()) {
 | 
	
		
			
				|  |  | +            CoreEvaluatePlanVO coreEvaluatePlanVO = coreEvaluatePlanService.selectCoreEvaluatePlanById(evaluateTaskStatisticsDTO.getPlanId());
 | 
	
		
			
				|  |  | +            LocalDate localDate = LocalDate.now();
 | 
	
		
			
				|  |  | +            String dateTitle = null;
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                switch (coreEvaluatePlanVO.getEvaluateCycle()) {
 | 
	
		
			
				|  |  | +                    case "0":
 | 
	
		
			
				|  |  | +                        dateTitle = localDate.getYear() + "年" + localDate.getMonthValue() + "月)";
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setStartTime(DateUtils.parseDate(localDate.getYear() + "-" + localDate.getMonthValue() + "-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss.SSS"));
 | 
	
		
			
				|  |  | +                        String lastDay = coreMonitoringRetrievalTaskService.getLastDay(localDate.getYear(), localDate.getMonthValue(), "yyyy-MM-dd");
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setEndTime(DateUtils.parseDate(lastDay + " 23:59:59", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss.SSS"));
 | 
	
		
			
				|  |  | +                        break;
 | 
	
		
			
				|  |  | +                    case "1":
 | 
	
		
			
				|  |  | +                        DateTime beginOfQuarter = DateUtil.beginOfQuarter(new java.util.Date());
 | 
	
		
			
				|  |  | +                        DateTime endOfQuarter = DateUtil.endOfQuarter(new Date());
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setStartTime(beginOfQuarter);
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setEndTime(endOfQuarter);
 | 
	
		
			
				|  |  | +                        int month = localDate.getMonthValue();
 | 
	
		
			
				|  |  | +                        int quarter = (month - 1) / 3 + 1;
 | 
	
		
			
				|  |  | +                        dateTitle = localDate.getYear() + "年第" + quarter + "季度)";
 | 
	
		
			
				|  |  | +                        break;
 | 
	
		
			
				|  |  | +                    default:
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setStartTime(DateUtils.parseDate(localDate.getYear() + "-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss.SSS"));
 | 
	
		
			
				|  |  | +                        evaluateTaskStatisticsDTO.setEndTime(DateUtils.parseDate(localDate.getYear() + "-12-31 23:59:59", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss.SSS"));
 | 
	
		
			
				|  |  | +                        dateTitle = localDate.getYear() + "年)";
 | 
	
		
			
				|  |  | +                        break;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } catch (Exception e) {
 | 
	
		
			
				|  |  | +                e.printStackTrace();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            ajaxResult.put("tittle", coreEvaluatePlanVO.getEvaluateName() + "(" + dateTitle);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ajaxResult.put(AjaxResult.DATA_TAG, coreEvaluateTaskService.statistics(evaluateTaskStatisticsDTO));
 | 
	
		
			
				|  |  |          return ajaxResult;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |