diff --git a/src/main/java/com/taover/bazhuayun/analysis/web/controller/manage/HeartbeatController.java b/src/main/java/com/taover/bazhuayun/analysis/web/controller/manage/HeartbeatController.java index 69e1b28..a358e1b 100644 --- a/src/main/java/com/taover/bazhuayun/analysis/web/controller/manage/HeartbeatController.java +++ b/src/main/java/com/taover/bazhuayun/analysis/web/controller/manage/HeartbeatController.java @@ -11,12 +11,16 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.taover.bazhuayun.analysis.web.constants.GlobalConstants; import com.taover.bazhuayun.analysis.web.form.HeartbeatInstanceCreateForm; import com.taover.bazhuayun.analysis.web.form.HeartbeatInstanceUpdateForm; import com.taover.bazhuayun.analysis.web.module.heartbeat.HeartbeatManager; import com.taover.bazhuayun.analysis.web.repository.AnalysisHeartbeatInstanceRepository; +import com.taover.bazhuayun.analysis.web.repository.AnalysisHeartbeatLogRepository; +import com.taover.bazhuayun.analysis.web.repository.AnalysisHeartbeatReformRepository; import com.taover.util.bean.ResultInfo; import com.taover.util.bean.UtilResultInfo; @@ -26,36 +30,12 @@ public class HeartbeatController { @Resource private AnalysisHeartbeatInstanceRepository analysisHeartbeatInstanceRepository; @Resource + private AnalysisHeartbeatLogRepository analysisHeartbeatLogRepository; + @Resource + private AnalysisHeartbeatReformRepository analysisHeartbeatReformRepository; + @Resource private HeartbeatManager heartbeatManager; - - /** - * @apiDefine ResultInfo - * @apiSuccess {string} - * @apiSuccessExample {json} Success-Response: - * { - * code:ok, - * error:null - * } - * @apiError ThrowException 出现异常 - * @apiErrorExample - * { - * code:fail, - * error:null exception - * } - */ - - /** - * @api {GET} /v1/wxorderauthoper 查询wxorderauthoper列表 - * @apiDescription 查询wxorderauthoper列表数据 - * 返回分页结果 - * - * @apiGroup wxorderauthoper - * @apiName wxorderauthoper列表 - * @apiVersion 1.0.0 - * @apiHeader Authorization - * - * @apiUse ResultInfo - */ + @GetMapping public ResultInfo get(HttpServletRequest request){ String pageStr = request.getParameter("page"); @@ -66,20 +46,9 @@ public class HeartbeatController { if(StringUtils.isEmpty(sizeStr)){ sizeStr = "10"; } - return UtilResultInfo.getSuccess("", this.analysisHeartbeatInstanceRepository.findPageBySql("1=1", Integer.valueOf(pageStr), Integer.valueOf(sizeStr), null)); + return UtilResultInfo.getSuccess("", this.analysisHeartbeatInstanceRepository.findPageBySql("1=1 order by id desc ", Integer.valueOf(pageStr), Integer.valueOf(sizeStr), null)); } - /** - * @api {GET} /v1/wxorderauthoper/{ssid} 查询ssid对应的wxorderauthoper - * @apiDescription 查询ssid对应wxorderauthoper数据 - * - * @apiGroup wxorderauthoper - * @apiName get实体数据 - * @apiVersion 1.0.0 - * @apiHeader Authorization - * - * @apiUse ResultInfo - */ @GetMapping("/{code}") public ResultInfo get(@PathVariable String code){ try { @@ -89,51 +58,40 @@ public class HeartbeatController { } } - /** - * @api {POST} /v1/wxorderauthoper 创建wxorderauthoper - * @apiDescription 创建wxorderauthoper - * - * @apiGroup wxorderauthoper - * @apiName get实体数据 - * @apiVersion 1.0.0 - * @apiHeader Authorization - * - * @apiUse ResultInfo - */ + @GetMapping("/{code}/log") + public ResultInfo getLog(@PathVariable String code, + @RequestParam(defaultValue = ""+GlobalConstants.DEFAULT_QUERY_PAGE) Integer page, + @RequestParam(defaultValue = ""+GlobalConstants.DEFAULT_QUERY_PAGE_SIZE) Integer size){ + try { + return UtilResultInfo.getSuccess("", this.analysisHeartbeatLogRepository.findPageBySql("instance_code='"+code+"' order by id desc ", page, size, null)); + } catch (Exception e) { + return UtilResultInfo.getFailure("not found record"); + } + } + + @GetMapping("/{code}/reform") + public ResultInfo getReform(@PathVariable String code, + @RequestParam(defaultValue = ""+GlobalConstants.DEFAULT_QUERY_PAGE) Integer page, + @RequestParam(defaultValue = ""+GlobalConstants.DEFAULT_QUERY_PAGE_SIZE) Integer size){ + try { + return UtilResultInfo.getSuccess("", this.analysisHeartbeatReformRepository.findPageBySql("instance_code='"+code+"' order by id desc ", page, size, null)); + } catch (Exception e) { + return UtilResultInfo.getFailure("not found record"); + } + } + @PostMapping public ResultInfo post(@RequestBody HeartbeatInstanceCreateForm form){ this.heartbeatManager.createInstance(form); return UtilResultInfo.getSuccess("创建成功"); } - /** - * @api {DELETE} /v1/wxorderauthoper/{ssid} 删除ssid对应的wxorderauthoper - * @apiDescription 删除ssid对应的wxorderauthoper数据 - * - * @apiGroup wxorderauthoper - * @apiName 删除实体数据 - * @apiVersion 1.0.0 - * @apiHeader Authorization - * - * @apiUse ResultInfo - */ @DeleteMapping("/{code}") public ResultInfo delete(@PathVariable String code){ this.heartbeatManager.deleteInstance(code); return UtilResultInfo.getSuccess("删除成功"); } - /** - * @api {PUT} /v1/wxorderauthoper/{ssid} 修改wxorderauthoper数据 - * @apiDescription 修改wxorderauthoper数据 - * - * @apiGroup wxorderauthoper - * @apiName 修改实体数据 - * @apiVersion 1.0.0 - * @apiHeader Authorization - * - * @apiUse ResultInfo - */ @PutMapping("/{code}") public ResultInfo put(@PathVariable String code, @RequestBody HeartbeatInstanceUpdateForm form){ this.heartbeatManager.updateInstance(code, form); -- libgit2 0.21.2