用户行为日志统计趋势信息改为:
searchBusinessType=2,根据用户名查看IP变化情况; searchBusinessType=3,根据IP查看用户名变化情况;
This commit is contained in:
@@ -369,7 +369,6 @@ public class SingleDimensionReport extends BaseRestController {
|
||||
|
||||
|
||||
ntcReportService.checkNtcRadiusReportCondition(saveLogThread, start, ntcRadiusReport);
|
||||
setGroupType(ntcRadiusReport);
|
||||
dataList= ntcReportService.findNtcRadiusReport(ntcRadiusReport);
|
||||
} catch (Exception e) {
|
||||
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
||||
@@ -421,25 +420,4 @@ public class SingleDimensionReport extends BaseRestController {
|
||||
entity.setSearchReportEndTime(map.get("endTime"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @author(zdx)
|
||||
* @date 2018年10月31日 下午2:43:13
|
||||
* @param ntcRadiusReport
|
||||
* @throws Exception
|
||||
*/
|
||||
public void setGroupType(NtcRadiusReport ntcRadiusReport) throws Exception {
|
||||
String groupType ="hour";
|
||||
if (!(StringUtil.isEmpty(ntcRadiusReport.getSearchReportStartTime())&&StringUtil.isEmpty(ntcRadiusReport.getSearchReportEndTime()))) {
|
||||
Long times = DateUtil.convertStringToTimestamp(ntcRadiusReport.getSearchReportEndTime(), DateUtil.YYYY_MM_DD_HH24_MM_SS)-DateUtil.convertStringToTimestamp(ntcRadiusReport.getSearchReportStartTime(), DateUtil.YYYY_MM_DD_HH24_MM_SS);
|
||||
if (times>24*60*60L&×<=30*24*60*60L) {
|
||||
groupType ="day";
|
||||
}else if(times>30*24*60*60L){
|
||||
groupType ="month";
|
||||
}
|
||||
}
|
||||
|
||||
ntcRadiusReport.setGroupType(groupType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,20 +645,7 @@
|
||||
<select id="findNtcRadiusReport" parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||
resultMap="NtcRadiusReportMap">
|
||||
SELECT
|
||||
nas_ip,
|
||||
account,
|
||||
<choose>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'day'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d')
|
||||
</when>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'month'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d %H')
|
||||
</otherwise>
|
||||
</choose>
|
||||
REPORT_TIME,sum(num) num
|
||||
*
|
||||
FROM ntc_radius_report
|
||||
<where>
|
||||
<if test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 and searchAccount != null and searchAccount !=''">
|
||||
@@ -676,41 +663,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
GROUP BY
|
||||
<if test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2">
|
||||
<![CDATA[account,nas_ip]]>
|
||||
</if>
|
||||
<if test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||
<![CDATA[nas_ip,account]]>
|
||||
</if>
|
||||
,
|
||||
<choose>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'day'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d')
|
||||
</when>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'month'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d %H')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
|
||||
ORDER BY
|
||||
<choose>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'day'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d')
|
||||
</when>
|
||||
<when test="groupType!= null and groupType!='' and groupType == 'month'">
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(REPORT_TIME, '%Y-%m-%d %H')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
ASC
|
||||
REPORT_TIME ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -108,7 +110,6 @@ public class NtcReportService extends BaseLogService {
|
||||
|
||||
public List findNtcRadiusReport(NtcRadiusReport entity) throws Exception {
|
||||
List resultList = null;
|
||||
|
||||
if ("1".equals(entity.getSearchBusinessType())) {
|
||||
resultList = new ArrayList<Map>();
|
||||
Map<String, List<NtcRadiusReport>> restMap = new HashMap<String, List<NtcRadiusReport>>();
|
||||
@@ -118,10 +119,33 @@ public class NtcReportService extends BaseLogService {
|
||||
restMap.put("nasIpList", nasIpList);
|
||||
resultList.add(restMap);
|
||||
}else{
|
||||
resultList = dao.findNtcRadiusReport(entity);
|
||||
}
|
||||
resultList = new ArrayList<NtcRadiusReport>();
|
||||
List<NtcRadiusReport> list = dao.findNtcRadiusReport(entity);
|
||||
|
||||
String regionName = "nasIp";
|
||||
if ("3".equals(entity.getSearchBusinessType())) {
|
||||
regionName="account";
|
||||
}
|
||||
PropertyDescriptor pd= new PropertyDescriptor(regionName, NtcRadiusReport.class);
|
||||
Method method = pd.getReadMethod();
|
||||
NtcRadiusReport temp = null;
|
||||
Object tempVal =null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i>0) {
|
||||
NtcRadiusReport obj = list.get(i);
|
||||
Object objVal = method.invoke(obj);
|
||||
if (objVal!=null && tempVal!=null && !objVal.toString().equals(tempVal.toString())) {
|
||||
temp = obj;
|
||||
tempVal = method.invoke(temp);
|
||||
resultList.add(obj);
|
||||
}
|
||||
}else{
|
||||
temp = list.get(i);
|
||||
tempVal = method.invoke(temp);
|
||||
resultList.add(list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user