新增配置日志总量统计接口(不返回时间),支持按照sum排序
This commit is contained in:
@@ -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)维度聚合")
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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,7 +195,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>
|
||||
<when
|
||||
@@ -220,6 +222,95 @@
|
||||
</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>
|
||||
<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="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>
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user