|
@@ -3,10 +3,10 @@ package cn.com.ctop.alarm.modules.controller;
|
|
import cn.com.ctop.alarm.modules.entity.RuleIndicator;
|
|
import cn.com.ctop.alarm.modules.entity.RuleIndicator;
|
|
import cn.com.ctop.alarm.modules.service.IRuleIndicatorService;
|
|
import cn.com.ctop.alarm.modules.service.IRuleIndicatorService;
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -19,15 +19,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-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.RequestMethod;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
@@ -56,28 +48,30 @@ public class RuleIndicatorController {
|
|
@Autowired
|
|
@Autowired
|
|
private IRuleIndicatorService ruleIndicatorService;
|
|
private IRuleIndicatorService ruleIndicatorService;
|
|
|
|
|
|
- /**
|
|
|
|
- * 分页列表查询
|
|
|
|
- *
|
|
|
|
- * @param ruleIndicator
|
|
|
|
- * @param pageNo
|
|
|
|
- * @param pageSize
|
|
|
|
- * @param req
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
@AutoLog(value = "规则指标信息-分页列表查询")
|
|
@AutoLog(value = "规则指标信息-分页列表查询")
|
|
@ApiOperation(value = "规则指标信息-分页列表查询", notes = "规则指标信息-分页列表查询")
|
|
@ApiOperation(value = "规则指标信息-分页列表查询", notes = "规则指标信息-分页列表查询")
|
|
@GetMapping(value = "/list")
|
|
@GetMapping(value = "/list")
|
|
- public Result<IPage<RuleIndicator>> queryPageList(RuleIndicator ruleIndicator,
|
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
|
- HttpServletRequest req) {
|
|
|
|
- Result<IPage<RuleIndicator>> result = new Result<>();
|
|
|
|
- QueryWrapper<RuleIndicator> queryWrapper = QueryGenerator.initQueryWrapper(ruleIndicator, req.getParameterMap());
|
|
|
|
- Page<RuleIndicator> page = new Page<RuleIndicator>(pageNo, pageSize);
|
|
|
|
- IPage<RuleIndicator> pageList = ruleIndicatorService.page(page, queryWrapper);
|
|
|
|
|
|
+ public Result<JSONObject> queryPageList(RuleIndicator ruleIndicator) {
|
|
|
|
+ Result<JSONObject> result = new Result<>();
|
|
|
|
+ Integer mediaType = ruleIndicator.getMediaType();
|
|
|
|
+ QueryWrapper<RuleIndicator> queryWrapper = new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("media_type", mediaType);
|
|
|
|
+ queryWrapper.groupBy("dimension");
|
|
|
|
+ List<RuleIndicator> list = ruleIndicatorService.list(queryWrapper);
|
|
|
|
+ JSONObject dataJson = new JSONObject();
|
|
|
|
+ for (RuleIndicator indicator : list) {
|
|
|
|
+ String dimension = indicator.getDimension();
|
|
|
|
+ QueryWrapper<RuleIndicator> queryWrapperData = new QueryWrapper();
|
|
|
|
+ queryWrapperData.eq("media_type", mediaType);
|
|
|
|
+ queryWrapperData.eq("dimension", dimension);
|
|
|
|
+ List<RuleIndicator> dataList = ruleIndicatorService.list(queryWrapperData);
|
|
|
|
+ if (!Check.isNull(dataList)) {
|
|
|
|
+ dataJson.put(dimension, dataList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
- result.setResult(pageList);
|
|
|
|
|
|
+ result.setResult(dataJson);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|