|
@@ -15,7 +15,10 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.util.List;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneOffset;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 业务对象指标Controller
|
|
@@ -62,10 +65,37 @@ public class BizObjMetricsController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('obj:metrics:query')")
|
|
|
@GetMapping(value = "/{objMetricsId}")
|
|
|
public AjaxResult getInfo(@PathVariable("objMetricsId") Long objMetricsId) {
|
|
|
+ BizObjMetrics metrics = bizObjMetricsService.selectBizObjMetricsByObjMetricsId(objMetricsId);
|
|
|
return success(bizObjMetricsService.selectBizObjMetricsByObjMetricsId(objMetricsId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取业务对象指标详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取业务对象历史趋势")
|
|
|
+ @GetMapping(value = "/history/{objMetricsId}")
|
|
|
+ public AjaxResult history(@PathVariable("objMetricsId") Long objMetricsId) {
|
|
|
+ List<Long> times = new ArrayList<>();
|
|
|
+ List<Float> values = new ArrayList<>();
|
|
|
+ LocalDateTime ed = LocalDateTime.now();
|
|
|
+ LocalDateTime st = ed.minusDays(7);
|
|
|
+ Random r = new Random();
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ do {
|
|
|
+ long time = st.toEpochSecond(ZoneOffset.ofHours(8)) * 1000;
|
|
|
+ times.add(time);
|
|
|
+ float f = r.nextFloat() * 100;
|
|
|
+// System.err.println(df.format(f));
|
|
|
+ values.add(Float.parseFloat(df.format(f)));
|
|
|
+ st = st.plusMinutes(15);
|
|
|
+ } while (!st.isAfter(ed));
|
|
|
+ Map<String, Object> map = new HashMap<>(16);
|
|
|
+ map.put("times", times);
|
|
|
+ map.put("values", values);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 新增业务对象指标
|
|
|
*/
|
|
|
@ApiOperation("新增业务对象指标")
|