| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.jjt.biz.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.biz.domain.BizObjMetrics; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.biz.domain.BizObjMetricsData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.biz.service.IBizObjMetricsDataService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10,6 +11,7 @@ import com.jjt.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.common.core.page.TableDataInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.common.enums.BusinessType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jjt.common.utils.poi.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.system.service.ISysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -17,9 +19,6 @@ import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.text.DecimalFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.time.ZoneOffset; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,6 +35,8 @@ public class BizObjMetricsController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IBizObjMetricsService bizObjMetricsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IBizObjMetricsDataService dataService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ISysConfigService configService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询业务对象指标列表 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -79,13 +80,19 @@ public class BizObjMetricsController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("获取业务对象历史趋势") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping(value = "/history/{objMetricsId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AjaxResult history(@PathVariable("objMetricsId") Long objMetricsId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int jg = Integer.parseInt(configService.selectConfigByKey("api.data.time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int size = 1440 / jg * 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //设置默认获取3天的数据,根据数据间隔时间来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageHelper.startPage(1, size, "create_time desc").setReasonable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BizObjMetricsData data = new BizObjMetricsData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data.setObjMetricsId(objMetricsId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<BizObjMetricsData> list = dataService.selectBizObjMetricsDataList(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Long> times = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Float> values = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        list.sort(Comparator.comparing(BizObjMetricsData::getCreateTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         list.forEach(d -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             times.add(d.getCreateTime().getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             values.add(d.getdValue().floatValue()); 
			 |