diff options
| author | renkaige <[email protected]> | 2019-05-07 11:36:13 +0800 |
|---|---|---|
| committer | renkaige <[email protected]> | 2019-05-07 11:36:13 +0800 |
| commit | f2c8e1244ea80a2ce729b3ebd0e507990746a3d4 (patch) | |
| tree | e52621c03667ba50362ed57f3f1f4bd8d5ce35b1 | |
| parent | b3f70174f1e9a58ddb31662a35c7deff5a3a8879 (diff) | |
新增配置日志总量统计接口(不返回时间),支持按照sum排序
4 files changed, 143 insertions, 3 deletions
diff --git a/src/main/java/com/nis/web/controller/restful/SingleDimensionReportController.java b/src/main/java/com/nis/web/controller/restful/SingleDimensionReportController.java index 9109842..963216c 100644 --- a/src/main/java/com/nis/web/controller/restful/SingleDimensionReportController.java +++ b/src/main/java/com/nis/web/controller/restful/SingleDimensionReportController.java @@ -110,6 +110,48 @@ public class SingleDimensionReportController extends BaseRestController { return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功",
ntcPzReportPage, 0);
}
+ @RequestMapping(value = "/ntcPzCountReport", method = RequestMethod.GET)
+ @ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,具体应用于界面配置报表业务")
+ public Map<String, ?> ntcPzCountReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request,
+ HttpServletResponse response) {
+ long start = System.currentTimeMillis();
+ AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
+ null);
+
+ Page<?> ntcPzReportPage = null;
+ try {
+ resetReportTime(ntcPzReport, true);
+ // 验证实时报表
+ ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcPzReport, NtcPzReport.class, page);
+ // 验证serachCfgId
+ ntcReportService.checkNumericCondition(saveLogThread, start, ntcPzReport.getSearchCfgId(), "searchCfgId");
+ String orderBy = "";
+ if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
+ orderBy = Page.getOrderBySql(NtcPzReport.class.getSimpleName(), page.getOrderBy());
+ } else {
+ orderBy = "report_time";
+ }
+ page.setOrderBy(orderBy);
+ ntcPzReportPage = ntcReportService
+ .findNtcPzCountReport(new Page<NtcPzReport>(request, response, NtcPzReport.class), ntcPzReport);
+ } catch (Exception e) {
+ saveLogThread.setExceptionInfo("配置日志总量统计失败:" + e.getMessage());
+ logger.error("配置日志总量统计失败:" + ExceptionUtil.getExceptionMsg(e));
+ if (e instanceof RestServiceException) {
+ throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start,
+ "配置日志总量统计失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
+ } else if (e instanceof ServiceRuntimeException) {
+ throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
+ "配置日志总量统计失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
+ } else {
+ throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
+ "配置日志总量统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
+ }
+ }
+
+ return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功",
+ ntcPzReportPage, 0);
+ }
@RequestMapping(value = "/ntcServiceReport", method = RequestMethod.GET)
@ApiOperation(value = "业务类型统计查询服务", httpMethod = "GET", notes = "业务类型统计查询服务,基于业务类型(service)维度聚合")
diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.java b/src/main/java/com/nis/web/dao/NtcReportDao.java index 62c2cd0..dbea3cc 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.java +++ b/src/main/java/com/nis/web/dao/NtcReportDao.java @@ -25,6 +25,7 @@ import com.nis.domain.restful.NtcURLIpReport; @MyBatisDao
public interface NtcReportDao extends CrudDao {
List<NtcPzReport> findNtcPzReport(NtcPzReport pz);
+ List<NtcPzReport> findNtcPzCountReport(NtcPzReport pz);
List<NtcServiceReport> findNtcServiceReport(NtcServiceReport pz);
diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.xml b/src/main/java/com/nis/web/dao/NtcReportDao.xml index 4003fd6..d817858 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.xml +++ b/src/main/java/com/nis/web/dao/NtcReportDao.xml @@ -144,7 +144,8 @@ </choose>
<choose>
- <when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
NTC_PZ_STAT_HOUR
</when>
@@ -194,10 +195,98 @@ </choose>
<choose>
- <when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
+ NTC_PZ_STAT_HOUR
+ </when>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
+ NTC_PZ_STAT_HOUR
+ </when>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
+ NTC_PZ_STAT_DAILY
+ </when>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
+ NTC_PZ_STAT_MONTH
+ </when>
+ <otherwise>
+ NTC_PZ_REPORT
+ </otherwise>
+ </choose>
+ <choose>
+ <when
+ test="page !=null and page.orderBy != null and page.orderBy != ''">
+ ORDER BY ${page.orderBy}
+ </when>
+ </choose>
+ </select>
+
+
+ <select id="findNtcPzCountReport"
+ parameterType="com.nis.domain.restful.NtcPzReport"
+ resultMap="NtcPzReportMap">
+ SELECT
+
+ <choose>
+ <when
+ test="page !=null and page.fields != null and page.fields != ''">
+ ${page.fields}
+ </when>
+ <otherwise>
+ CFG_ID,SERVICE,SUM
+ </otherwise>
+ </choose>
+ FROM (SELECT CFG_ID,SERVICE,SUM(SUM) SUM
+ FROM
+
+ <choose>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
+ NTC_PZ_REPORT
+ </when>
+
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR
</when>
<when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
+ NTC_PZ_STAT_DAILY
+ </when>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
+ NTC_PZ_STAT_MONTH
+ </when>
+ <otherwise>
+ NTC_PZ_REPORT
+ </otherwise>
+ </choose>
+ <where>
+ <if test="searchCfgId != null and searchCfgId !=''">
+ <![CDATA[AND CFG_ID in (${searchCfgId})]]>
+ </if>
+ <if test="searchService != null and searchService !=''">
+ <![CDATA[AND SERVICE in (${searchService})]]>
+ </if>
+ <if
+ test="searchReportStartTime != null and searchReportStartTime !=''">
+ <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
+ </if>
+ <if
+ test="searchReportEndTime != null and searchReportEndTime !=''">
+ <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
+ </if>
+ </where>
+ GROUP BY CFG_ID,SERVICE
+ )
+ <choose>
+ <when
+ test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
+ NTC_PZ_REPORT
+ </when>
+ <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR
</when>
@@ -220,6 +309,8 @@ </when>
</choose>
</select>
+
+
<select id="findNtcServiceReport"
parameterType="com.nis.domain.restful.NtcServiceReport"
resultMap="NtcServiceReportMap">
@@ -786,7 +877,8 @@ </if>
</where>
group by url
- ) ntc_reject_url_statistic order by ipCount desc,connCount desc
+ ) ntc_reject_url_statistic order by ipCount desc,connCount
+ desc
</select>
diff --git a/src/main/java/com/nis/web/service/restful/NtcReportService.java b/src/main/java/com/nis/web/service/restful/NtcReportService.java index 786eccf..553f06f 100644 --- a/src/main/java/com/nis/web/service/restful/NtcReportService.java +++ b/src/main/java/com/nis/web/service/restful/NtcReportService.java @@ -60,6 +60,11 @@ public class NtcReportService extends BaseLogService { }
}
+ public Page<?> findNtcPzCountReport(Page<NtcPzReport> page, NtcPzReport entity) throws Exception {
+ entity.setPage(page);
+ page.setList(dao.findNtcPzCountReport(entity));
+ return page;
+ }
public Page<NtcServiceReport> findNtcServiceReport(Page<NtcServiceReport> page, NtcServiceReport entity)
throws Exception {
|
