Bläddra i källkod

首页和健康度管理页面接口修改

wukai 5 dagar sedan
förälder
incheckning
a6bb5a59e9

+ 3 - 3
jjt-admin/src/main/java/com/jjt/web/controller/system/SysConfigController.java

@@ -59,9 +59,9 @@ public class SysConfigController extends BaseController {
     /**
      * 根据参数键名查询参数值
      */
-    @GetMapping(value = "/configKey/{configKey}")
-    public AjaxResult getConfigKey(@PathVariable String configKey) {
-        return success(configService.selectConfigByKey(configKey));
+    @GetMapping(value = "/configKey")
+    public AjaxResult getConfigKey(String key) {
+        return success(configService.selectConfigByKey(key));
     }
 
     /**

+ 2 - 2
jjt-admin/src/main/java/com/jjt/web/controller/system/SysDictDataController.java

@@ -62,8 +62,8 @@ public class SysDictDataController extends BaseController {
     /**
      * 根据字典类型查询字典数据信息
      */
-    @GetMapping(value = "/type/{dictType}")
-    public AjaxResult dictType(@PathVariable String dictType) {
+    @GetMapping(value = "/type")
+    public AjaxResult dictType(String dictType) {
         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
         if (StringUtils.isNull(data)) {
             data = new ArrayList<SysDictData>();

+ 10 - 10
jjt-biz/src/main/java/com/jjt/biz/controller/BizModelController.java

@@ -51,16 +51,16 @@ public class BizModelController extends BaseController {
     private IHlScoreService hlScoreService;
 
     @ApiOperation("选择对象")
-    @GetMapping("/obj/select/{modelId}")
-    public TableDataInfo objSelect(@ApiParam(value = "模型ID", required = true) @PathVariable("modelId") Long modelId) {
+    @GetMapping("/obj/select")
+    public TableDataInfo objSelect(@ApiParam(value = "模型ID", required = true) Long modelId) {
         PageHelper.startPage(1, 1000, "").setReasonable(true);
         List<BizObj> list = bizModelService.selectObjList(modelId);
         return getDataTable(list);
     }
 
     @ApiOperation("添加对象")
-    @GetMapping("/obj/add/{modelId}")
-    public AjaxResult objAdd(@ApiParam(value = "模型ID", required = true) @PathVariable("modelId") Long modelId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
+    @GetMapping("/obj/add")
+    public AjaxResult objAdd(@ApiParam(value = "模型ID", required = true) Long modelId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
         return success(bizModelService.insertObj(modelId, objIds));
     }
 
@@ -72,8 +72,8 @@ public class BizModelController extends BaseController {
     }
 
     @ApiOperation("导入分类")
-    @GetMapping("/imp/{modelId}")
-    public AjaxResult imp(@ApiParam(value = "模型ID", required = true) @PathVariable("modelId") Long modelId) {
+    @GetMapping("/imp")
+    public AjaxResult imp(@ApiParam(value = "模型ID", required = true) Long modelId) {
         bizModelService.impClass(modelId);
         return success();
     }
@@ -215,8 +215,8 @@ public class BizModelController extends BaseController {
      */
     @ApiOperation("获取业务模型详细信息")
     //@PreAuthorize("@ss.hasPermi('hl:bm:query')")
-    @GetMapping(value = "/{modelId}")
-    public AjaxResult getInfo(@PathVariable("modelId") Long modelId) {
+    @GetMapping(value = "/detail")
+    public AjaxResult getInfo(Long modelId) {
         return success(bizModelService.selectBizModelByModelId(modelId));
     }
 
@@ -249,8 +249,8 @@ public class BizModelController extends BaseController {
     @ApiOperation("删除业务模型")
     //@PreAuthorize("@ss.hasPermi('hl:bm:remove')")
     @Log(title = "业务模型", businessType = BusinessType.DELETE)
-    @GetMapping("/del/{modelIds}")
-    public AjaxResult remove(@PathVariable Long[] modelIds) {
+    @GetMapping("/del")
+    public AjaxResult remove(Long[] modelIds) {
         return toAjax(bizModelService.deleteBizModelByModelIds(modelIds));
     }
 

+ 2 - 2
jjt-biz/src/main/java/com/jjt/biz/controller/BizModelDetailController.java

@@ -96,8 +96,8 @@ public class BizModelDetailController extends BaseController {
     @ApiOperation("删除业务模型明细")
     //@PreAuthorize("@ss.hasPermi('hl:bd:remove')")
     @Log(title = "业务模型明细", businessType = BusinessType.DELETE)
-    @GetMapping("/del/{bizDetailIds}")
-    public AjaxResult remove(@PathVariable Long[] bizDetailIds) {
+    @GetMapping("/del")
+    public AjaxResult remove(Long[] bizDetailIds) {
         for (Long id : bizDetailIds) {
             BizModelDetail detail = bizModelDetailService.selectBizModelDetailByBizDetailId(id);
             modelService.cleanClass(detail.getModelId());

+ 79 - 42
jjt-biz/src/main/java/com/jjt/biz/service/impl/BizObjMetricsServiceImpl.java

@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.session.ExecutorType;
 import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -68,6 +69,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
     private ISysConfigService configService;
     @Resource
     private IBizObjMcService mcService;
+    @Resource
+    private JdbcTemplate jdbcTemplate;
 
     /**
      * 查询业务对象指标
@@ -791,8 +794,15 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
         Map<Long, AlarmRecord> recordMap = alarmRecordService.selectAlarmRecordListCurr(objId);
         //查询当前对象未结束事件列表
         Map<Long, HlEvent> eventMap = eventService.selectHlEventListCurr(objId);
-        updateJvmMetrics(objId, agentVOList, date, recordMap, eventMap);
-        updateLinkMetrics(objId, pinpointVOList, date, recordMap, eventMap);
+        Map<Long, BigDecimal> updateMap = new HashMap<>();
+        updateJvmMetrics(objId, agentVOList, date, recordMap, eventMap, updateMap);
+        updateLinkMetrics(objId, pinpointVOList, date, recordMap, eventMap, updateMap);
+        if (updateMap.size() > 0) {
+            jdbcTemplate.batchUpdate("update biz_obj_metrics set d_value = ?, UPDATE_TIME = ? where obj_metrics_id = ?",
+                    updateMap.entrySet().stream()
+                            .map(entry -> new Object[]{entry.getValue(), new Date(), entry.getKey()})
+                             .collect(Collectors.toList()));
+        }
     }
 
     /**
@@ -802,18 +812,17 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
      *              * @param agentVOList    jvm信息
      * @param date  数据时间
      */
-    private void updateJvmMetrics(Long objId, List<AgentVO> agentVOList, Date
-            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
+    private void updateJvmMetrics(Long objId, List<AgentVO> agentVOList, Date date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap, Map<Long, BigDecimal> updateMap) {
         BizObjMetrics jvmMetrics = new BizObjMetrics();
         jvmMetrics.setObjId(objId);
         jvmMetrics.setMetricsCode("pp.jvm.");
         List<BizObjMetrics> omList = selectBizObjMetricsList(jvmMetrics);
         for (AgentVO vo : agentVOList) {
             if (vo.getCode() == 100) {
-                updateMetricsValues(omList, "tps", vo.getAgentId(), BigDecimal.valueOf(vo.getTps()), date, recordMap, eventMap);
-                updateMetricsValues(omList, "heap.usage", vo.getAgentId(), BigDecimal.valueOf(vo.getHeapUsage()), date, recordMap, eventMap);
-                updateMetricsValues(omList, "open", vo.getAgentId(), BigDecimal.valueOf(vo.getOpenFiles()), date, recordMap, eventMap);
-                updateMetricsValues(omList, "gc", vo.getAgentId(), BigDecimal.valueOf(vo.getGcCount()), date, recordMap, eventMap);
+                updateMetricsValues(omList, "tps", vo.getAgentId(), BigDecimal.valueOf(vo.getTps()), date, recordMap, eventMap, updateMap);
+                updateMetricsValues(omList, "heap.usage", vo.getAgentId(), BigDecimal.valueOf(vo.getHeapUsage()), date, recordMap, eventMap, updateMap);
+                updateMetricsValues(omList, "open", vo.getAgentId(), BigDecimal.valueOf(vo.getOpenFiles()), date, recordMap, eventMap, updateMap);
+                updateMetricsValues(omList, "gc", vo.getAgentId(), BigDecimal.valueOf(vo.getGcCount()), date, recordMap, eventMap, updateMap);
             }
         }
 
@@ -829,7 +838,7 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
      * @param date         数据时间
      */
     private void updateMetricsValues(List<BizObjMetrics> omList, String metricSuffix, String agentId, BigDecimal value, Date
-            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
+            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap, Map<Long, BigDecimal> updateMap) {
         List<BizObjMetricsData> dataList = new ArrayList<>();
         List<AlarmRecord> addRList = new ArrayList<>();
         List<AlarmRecord> updateRList = new ArrayList<>();
@@ -841,7 +850,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
                 .forEach(om -> {
                     om.setDValue(value);
                     om.setUpdateTime(DateUtils.getNowDate());
-                    updateList.add(om);
+                    updateMap.put(om.getObjMetricsId(), value);
+//                    updateList.add(om);
 //                    updateBizObjMetrics(om);
                     BizObjMetricsData data = new BizObjMetricsData();
                     data.setObjMetricsId(om.getObjMetricsId());
@@ -866,36 +876,62 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
                         updateEList.add(eMap.get("update"));
                     }
                 });
-        batchUpdate(updateList, dataList, addRList, updateRList, addEList, updateEList);
+        batchUpdate(null, dataList, addRList, updateRList, addEList, updateEList);
     }
 
     private void batchUpdate
             (List<BizObjMetrics> metricsToUpdate, List<BizObjMetricsData> dataList, List<AlarmRecord> addRList, List<AlarmRecord> updateRList, List<HlEvent> addEList, List<HlEvent> updateEList) {
         // 更新所有需要更新的BizObjMetrics对象
-        try (SqlSession sqlSession = factory.openSession(ExecutorType.BATCH, false)) {
-            BizObjMetricsMapper mapper = sqlSession.getMapper(BizObjMetricsMapper.class);
-            if (metricsToUpdate != null && metricsToUpdate.size() > 0) {
+        if (metricsToUpdate != null && !metricsToUpdate.isEmpty()) {
+            // 按 objMetricsId 排序,保证更新顺序一致,避免死锁
+            metricsToUpdate.sort(Comparator.comparing(BizObjMetrics::getObjMetricsId));
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.BATCH, false)) {
+                BizObjMetricsMapper mapper = sqlSession.getMapper(BizObjMetricsMapper.class);
                 metricsToUpdate.forEach(mapper::updateBizObjMetrics);
+                sqlSession.commit();
             }
-            if (dataList != null && dataList.size() > 0) {
+        }
+
+        if (dataList != null && dataList.size() > 0) {
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.SIMPLE, false)) {
                 BizObjMetricsDataMapper dataMapper = sqlSession.getMapper(BizObjMetricsDataMapper.class);
                 dataList.forEach(dataMapper::insertBizObjMetricsData);
+                sqlSession.commit();
             }
-            AlarmRecordMapper recordMapper = sqlSession.getMapper(AlarmRecordMapper.class);
-            if (addRList != null && addRList.size() > 0) {
+        }
+
+        if (addRList != null && addRList.size() > 0) {
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.SIMPLE, false)) {
+                AlarmRecordMapper recordMapper = sqlSession.getMapper(AlarmRecordMapper.class);
                 addRList.forEach(recordMapper::insertAlarmRecord);
+                sqlSession.commit();
             }
-            if (updateRList != null && updateRList.size() > 0) {
+        }
+
+        if (updateRList != null && updateRList.size() > 0) {
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.SIMPLE, false)) {
+                AlarmRecordMapper recordMapper = sqlSession.getMapper(AlarmRecordMapper.class);
+                updateRList.sort(Comparator.comparing(AlarmRecord::getAlarmId));
                 updateRList.forEach(recordMapper::updateAlarmRecord);
+                sqlSession.commit();
             }
-            HlEventMapper eventMapper = sqlSession.getMapper(HlEventMapper.class);
-            if (addEList != null && addEList.size() > 0) {
+        }
+
+        if (addEList != null && addEList.size() > 0) {
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.SIMPLE, false)) {
+                HlEventMapper eventMapper = sqlSession.getMapper(HlEventMapper.class);
                 addEList.forEach(eventMapper::insertHlEvent);
+                sqlSession.commit();
             }
-            if (updateEList != null && updateEList.size() > 0) {
+        }
+
+        if (updateEList != null && updateEList.size() > 0) {
+            try (SqlSession sqlSession = factory.openSession(ExecutorType.SIMPLE, false)) {
+                HlEventMapper eventMapper = sqlSession.getMapper(HlEventMapper.class);
+                updateEList.sort(Comparator.comparing(HlEvent::getEventId));
                 updateEList.forEach(eventMapper::updateHlEvent);
+                sqlSession.commit();
             }
-            sqlSession.commit();
         }
     }
 
@@ -907,9 +943,9 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
      * @param date           时间
      */
     private void updateLinkMetrics(Long objId, List<PinpointVO> pinpointVOList, Date
-            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
+            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap, Map<Long, BigDecimal> updateMap) {
         Map<String, List<BizObjMetrics>> metricsMap = getAllMetricsForObjId(objId);
-        pinpointVOList.forEach(vo -> updateMetricsValues(metricsMap, vo, date, recordMap, eventMap));
+        pinpointVOList.forEach(vo -> updateMetricsValues(metricsMap, vo, date, recordMap, eventMap, updateMap));
     }
 
 
@@ -921,9 +957,9 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
      * @param date       时间
      */
     private void updateMetricsValues(Map<String, List<BizObjMetrics>> metricsMap, PinpointVO vo, Date
-            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
+            date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap, Map<Long, BigDecimal> updateMap) {
         List<BizObjMetricsData> dataList = new ArrayList<>();
-        List<BizObjMetrics> updateList = new ArrayList<>();
+//        List<BizObjMetrics> updateList = new ArrayList<>();
         List<AlarmRecord> addRList = new ArrayList<>();
         List<AlarmRecord> updateRList = new ArrayList<>();
         List<HlEvent> addEList = new ArrayList<>();
@@ -933,24 +969,24 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
             list.forEach(om -> {
                 if (om.getMetricsName().startsWith(vo.getCategory() + "/")) {
                     if (vo.getTot() != 0) {
-                        updateMetric(om, "pp.1s", vo.getTime1s(), date, dataList, updateList);
-                        updateMetric(om, "pp.3s", vo.getTime3s(), date, dataList, updateList);
-                        updateMetric(om, "pp.5s", vo.getTime5s(), date, dataList, updateList);
-                        updateMetric(om, "pp.100ms", vo.getTime100ms(), date, dataList, updateList);
-                        updateMetric(om, "pp.300ms", vo.getTime300ms(), date, dataList, updateList);
-                        updateMetric(om, "pp.500ms", vo.getTime500ms(), date, dataList, updateList);
-                        updateMetric(om, "pp.tot", vo.getTot(), date, dataList, updateList);
-                        updateMetric(om, "pp.sum", vo.getSum(), date, dataList, updateList);
-                        updateMetric(om, "pp.max", vo.getMax(), date, dataList, updateList);
-                        updateMetric(om, "pp.avg", vo.getAvg(), date, dataList, updateList);
-                        updateMetric(om, "pp.slow", vo.getSlow(), date, dataList, updateList);
-                        updateMetric(om, "pp.error", vo.getError(), date, dataList, updateList);
+                        updateMetric(om, "pp.1s", vo.getTime1s(), date, dataList, updateMap);
+                        updateMetric(om, "pp.3s", vo.getTime3s(), date, dataList, updateMap);
+                        updateMetric(om, "pp.5s", vo.getTime5s(), date, dataList, updateMap);
+                        updateMetric(om, "pp.100ms", vo.getTime100ms(), date, dataList, updateMap);
+                        updateMetric(om, "pp.300ms", vo.getTime300ms(), date, dataList, updateMap);
+                        updateMetric(om, "pp.500ms", vo.getTime500ms(), date, dataList, updateMap);
+                        updateMetric(om, "pp.tot", vo.getTot(), date, dataList, updateMap);
+                        updateMetric(om, "pp.sum", vo.getSum(), date, dataList, updateMap);
+                        updateMetric(om, "pp.max", vo.getMax(), date, dataList, updateMap);
+                        updateMetric(om, "pp.avg", vo.getAvg(), date, dataList, updateMap);
+                        updateMetric(om, "pp.slow", vo.getSlow(), date, dataList, updateMap);
+                        updateMetric(om, "pp.error", vo.getError(), date, dataList, updateMap);
                         Integer time1 = vo.getTime1s();
                         if (time1 == null) {
                             time1 = vo.getTime100ms();
                         }
                         BigDecimal rate = BigDecimal.valueOf(time1).divide(BigDecimal.valueOf(vo.getTot()), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
-                        updateMetric(om, "pp.rate", rate, date, dataList, updateList);
+                        updateMetric(om, "pp.rate", rate, date, dataList, updateMap);
                         if (om.getDValue() != null) {
                             //处理告警
                             Map<String, AlarmRecord> aMap = alarmRecordService.process(om, recordMap, date);
@@ -974,7 +1010,7 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
                 }
             });
         }
-        batchUpdate(updateList, dataList, addRList, updateRList, addEList, updateEList);
+        batchUpdate(null, dataList, addRList, updateRList, addEList, updateEList);
 //        metricsMap.values().stream()
 //                .filter(om -> om.getMetricsCode().startsWith(vo.getApplicationName() + "/"))
 //                .forEach(om -> {
@@ -1002,11 +1038,12 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
      * @param date   时间
      */
     private void updateMetric(BizObjMetrics om, String suffix, Number value, Date
-            date, List<BizObjMetricsData> dataList, List<BizObjMetrics> updateList) {
+            date, List<BizObjMetricsData> dataList, Map<Long, BigDecimal> updateMap) {
         if (om.getMetricsCode().endsWith(suffix) && value != null) {
             om.setDValue(BigDecimal.valueOf(value.doubleValue()));
             om.setUpdateTime(new Date());
-            updateList.add(om);
+            updateMap.put(om.getObjMetricsId(), om.getDValue());
+//            updateList.add(om);
 //            updateBizObjMetrics(om);
 
             BizObjMetricsData data = new BizObjMetricsData();

+ 2 - 2
jjt-biz/src/main/java/com/jjt/hl/controller/HlClassController.java

@@ -93,8 +93,8 @@ public class HlClassController extends BaseController {
     @ApiOperation("删除模型健康度分类")
     //@PreAuthorize("@ss.hasPermi('hl:hc:remove')")
     @Log(title = "模型健康度分类", businessType = BusinessType.DELETE)
-    @GetMapping("/del/{hlClassIds}")
-    public AjaxResult remove(@PathVariable Long[] hlClassIds) {
+    @GetMapping("/del")
+    public AjaxResult remove(Long[] hlClassIds) {
         return toAjax(hlClassService.deleteHlClassByHlClassIds(hlClassIds));
     }
 }

+ 6 - 6
jjt-biz/src/main/java/com/jjt/hl/controller/HlMetricsController.java

@@ -65,16 +65,16 @@ public class HlMetricsController extends BaseController {
     }
 
     @ApiOperation("根据分类ID查询选择指标列表")
-    @GetMapping("/select/{hlClassId}")
-    public AjaxResult select(@PathVariable("hlClassId") Long hlClassId) {
+    @GetMapping("/select")
+    public AjaxResult select(Long hlClassId) {
         HlClass hlClass = hlClassService.selectHlClassByHlClassId(hlClassId);
         List<HlMetrics> list = hlMetricsService.selectHlMetricsList4ModelId(hlClass.getModelId(), hlClass.getObjType());
         return AjaxResult.success(list);
     }
 
     @ApiOperation("添加指标")
-    @GetMapping("/add/{hlClassId}")
-    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) @PathVariable("hlClassId") Long hlClassId, @ApiParam(value = "指标ID数组", required = true) Long[] ids) {
+    @GetMapping("/add")
+    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) Long hlClassId, @ApiParam(value = "指标ID数组", required = true) Long[] ids) {
         return success(hlMetricsService.insertMetrics(hlClassId, ids));
     }
 
@@ -142,8 +142,8 @@ public class HlMetricsController extends BaseController {
     @ApiOperation("删除业务模型健康度指标")
     //@PreAuthorize("@ss.hasPermi('hl:hm:remove')")
     @Log(title = "业务模型健康度指标", businessType = BusinessType.DELETE)
-    @GetMapping("/del/{hlMetricsIds}")
-    public AjaxResult remove(@PathVariable Long[] hlMetricsIds) {
+    @GetMapping("/del")
+    public AjaxResult remove(Long[] hlMetricsIds) {
         return toAjax(hlMetricsService.deleteHlMetricsByHlMetricsIds(hlMetricsIds));
     }
 }

+ 2 - 2
jjt-biz/src/main/java/com/jjt/hl/controller/HlMetricsScoreController.java

@@ -52,8 +52,8 @@ public class HlMetricsScoreController extends BaseController {
      * 查询模型健康度分类得分列表
      */
     @ApiOperation("根据指标查询扣分明细")
-    @GetMapping("/detail/{scoreMetricsId}")
-    public AjaxResult detail4score(@PathVariable("scoreMetricsId") Long scoreMetricsId) {
+    @GetMapping("/detail")
+    public AjaxResult detail4score(Long scoreMetricsId) {
         List<ScoreDetailVO> list = detailService.detailList(scoreMetricsId);
         return AjaxResult.success(list);
     }

+ 8 - 8
jjt-biz/src/main/java/com/jjt/hl/controller/HlObjController.java

@@ -42,8 +42,8 @@ public class HlObjController extends BaseController {
     private IBizModelDetailService modelDetailService;
 
     @ApiOperation("根据分类ID查询对象")
-    @GetMapping("/list/{hlClassId}")
-    public AjaxResult list(@PathVariable("hlClassId") Long hlClassId) {
+    @GetMapping("/list-class")
+    public AjaxResult list(Long hlClassId) {
         HlObj hlObj = new HlObj();
         hlObj.setHlClassId(hlClassId);
         List<HlObj> list = hlObjService.selectHlObjList(hlObj);
@@ -51,8 +51,8 @@ public class HlObjController extends BaseController {
     }
 
     @ApiOperation("根据分类ID查询选择对象列表")
-    @GetMapping("/select/{hlClassId}")
-    public AjaxResult select(@PathVariable("hlClassId") Long hlClassId) {
+    @GetMapping("/select")
+    public AjaxResult select(Long hlClassId) {
         HlClass hlClass = hlClassService.selectHlClassByHlClassId(hlClassId);
 
         BizModelDetail detail = new BizModelDetail();
@@ -68,8 +68,8 @@ public class HlObjController extends BaseController {
     }
 
     @ApiOperation("添加对象")
-    @GetMapping("/add/{hlClassId}")
-    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) @PathVariable("hlClassId") Long hlClassId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
+    @GetMapping("/add")
+    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) Long hlClassId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
         return success(hlObjService.insertObj(hlClassId, objIds));
     }
 
@@ -137,8 +137,8 @@ public class HlObjController extends BaseController {
     @ApiOperation("删除模型健康度对象")
     //@PreAuthorize("@ss.hasPermi('hl:ho:remove')")
     @Log(title = "模型健康度对象", businessType = BusinessType.DELETE)
-    @GetMapping("/del/{hlObjIds}")
-    public AjaxResult remove(@PathVariable Long[] hlObjIds) {
+    @GetMapping("/del")
+    public AjaxResult remove(Long[] hlObjIds) {
         return toAjax(hlObjService.deleteHlObjByHlObjIds(hlObjIds));
     }
 }

+ 2 - 1
jjt-biz/src/main/java/com/jjt/task/DataTask.java

@@ -31,7 +31,8 @@ public class DataTask {
      */
     public void pp() {
         Date date = new Date();
-        objService.selectBizObjList(new BizObj()).forEach(obj -> {
+        List<BizObj> list=objService.selectBizObjList(new BizObj());
+        list.forEach(obj -> {
             metricsService.pinpointMetricsValue(obj.getObjId(), date);
         });
     }

+ 1 - 0
jjt-biz/src/main/resources/mapper/obj/BizObjMetricsMapper.xml

@@ -124,6 +124,7 @@
                 and REMARK = #{remark}
             </if>
         </where>
+        order by OBJ_METRICS_ID
     </select>
 
     <select id="selectBizObjMetricsByObjMetricsId" parameterType="Long"

+ 58 - 58
jjt-quartz/src/main/java/com/jjt/quartz/config/ScheduleConfig.java

@@ -1,58 +1,58 @@
-//package com.jjt.quartz.config;
-//
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.Profile;
-//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-//
-//import javax.sql.DataSource;
-//import java.util.Properties;
-//
-///**
-// * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效)
-// *
-// * @author jjt
-// */
-//@Configuration
-//@Profile({"!junit","!jt"})
-//public class ScheduleConfig {
-//    @Bean
-//    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
-//        SchedulerFactoryBean factory = new SchedulerFactoryBean();
-//        factory.setDataSource(dataSource);
-//
-//        // quartz参数
-//        Properties prop = new Properties();
-//        prop.put("org.quartz.scheduler.instanceName", "JjtScheduler");
-//        prop.put("org.quartz.scheduler.instanceId", "AUTO");
-//        // 线程池配置
-//        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
-//        prop.put("org.quartz.threadPool.threadCount", "20");
-//        prop.put("org.quartz.threadPool.threadPriority", "5");
-//        // JobStore配置
-//        prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
-//        // 集群配置
-//        prop.put("org.quartz.jobStore.isClustered", "true");
-//        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
-//        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "10");
-//        prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
-//
-//        // sqlserver 启用
-//        // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
-//        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
-//        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
-//        factory.setQuartzProperties(prop);
-//
-//        factory.setSchedulerName("JjtScheduler");
-//        // 延时启动
-//        factory.setStartupDelay(1);
-//        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
-//        // 可选,QuartzScheduler
-//        // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
-//        factory.setOverwriteExistingJobs(true);
-//        // 设置自动启动,默认为true
-//        factory.setAutoStartup(true);
-//
-//        return factory;
-//    }
-//}
+package com.jjt.quartz.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+
+import javax.sql.DataSource;
+import java.util.Properties;
+
+/**
+ * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效)
+ *
+ * @author jjt
+ */
+@Configuration
+@Profile({"!junit", "!jt"})
+public class ScheduleConfig {
+    @Bean
+    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
+        SchedulerFactoryBean factory = new SchedulerFactoryBean();
+        factory.setDataSource(dataSource);
+
+        // quartz参数
+        Properties prop = new Properties();
+        prop.put("org.quartz.scheduler.instanceName", "JjtScheduler");
+        prop.put("org.quartz.scheduler.instanceId", "AUTO");
+        // 线程池配置
+        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
+        prop.put("org.quartz.threadPool.threadCount", "20");
+        prop.put("org.quartz.threadPool.threadPriority", "5");
+        // JobStore配置
+        prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
+        // 集群配置
+        prop.put("org.quartz.jobStore.isClustered", "true");
+        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
+        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "10");
+        prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
+
+        // sqlserver 启用
+        // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
+        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
+        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
+        factory.setQuartzProperties(prop);
+
+        factory.setSchedulerName("JjtScheduler");
+        // 延时启动
+        factory.setStartupDelay(1);
+        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
+        // 可选,QuartzScheduler
+        // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
+        factory.setOverwriteExistingJobs(true);
+        // 设置自动启动,默认为true
+        factory.setAutoStartup(true);
+
+        return factory;
+    }
+}