1.生效区域下发格式修改 2.日志总量日志查询时间修改

This commit is contained in:
zhangwenqing
2018-09-28 12:00:13 +08:00
parent ab50f58560
commit 9ce49b9e25
9 changed files with 194 additions and 22 deletions

View File

@@ -678,8 +678,19 @@ public class BaseController {
}else{
// 判断是否是从配置界面过来的日志查询
if(StringUtils.isNotBlank(entry.getIsLogTotalSearch())) {
Calendar time = Calendar.getInstance();
time.add(Calendar.MINUTE, -5);
String searchEndTime = DateUtils.formatDateTime(time.getTime());
params.put("searchFoundEndTime",searchEndTime);
entry.setSearchFoundEndTime(searchEndTime);
time.add(Calendar.MINUTE, -5);
String searchStartTime = DateUtils.formatDateTime(time.getTime());
params.put("searchFoundStartTime", searchStartTime);
entry.setSearchFoundStartTime(searchStartTime);
// 判断startTime是否有值
if(StringUtils.isNotBlank(Constants.LOG_TIME_START)) {
/*if(StringUtils.isNotBlank(Constants.LOG_TIME_START)) {
String endTime = Constants.LOG_TIME_END;
if(StringUtils.isBlank(endTime)) {
endTime = DateUtils.getDateTime();
@@ -717,7 +728,7 @@ public class BaseController {
params.put("searchFoundEndTime",searchEndTime);
entry.setSearchFoundStartTime(searchStartTime);
entry.setSearchFoundEndTime(searchEndTime);
}
}*/
}else {
//设置默认查询当前时间及前五分钟

View File

@@ -85,9 +85,9 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
*/
List<SysDictInfo> getDistrictDict(String itemCode);
List<SysDictInfo> getEffectiveArea(String itemCode);
SysDictInfo getDictByItemCode(String itemCode);

View File

@@ -263,4 +263,22 @@
FROM sys_dict_info s
WHERE s.is_valid = 1 AND item_type = 3 AND item_code like concat(#{itemCode,jdbcType=VARCHAR},'%')
</select>
<select id="getEffectiveArea" parameterType="java.lang.String" resultType="com.nis.domain.basics.SysDictInfo">
SELECT
<include refid="sysDictInfoColumns"/>
FROM
sys_dict_info s
WHERE
s.is_valid = 1 AND s.item_code = #{itemCode}
</select>
<select id="getDictByItemCode" resultType="com.nis.domain.basics.SysDictInfo">
select
<include refid="sysDictInfoColumns"/>
from
sys_dict_info s
where
s.is_valid = 1 AND s.item_code = #{itemCode}
</select>
</mapper>

View File

@@ -1,5 +1,6 @@
package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -11,9 +12,13 @@ import com.google.common.collect.Lists;
import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.maat.EffectiveRangeCfg;
import com.nis.domain.maat.EffectiveRangeCfg.AreaIsp;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -22,7 +27,7 @@ import com.nis.web.service.BaseService;
public class SysDictInfoService extends BaseService{
@Autowired
private SysDictInfoDao sysDictInfoDao;
private SysDictInfoDao sysDictInfoDao;
@@ -216,17 +221,82 @@ public class SysDictInfoService extends BaseService{
public List<SysDictInfo> getDistrictDict(String tableName){
return sysDictInfoDao.getDistrictDict(tableName);
}
// 组织区域、运营商配置下发格式
public String setEffectiveRange(String areaEffectiveIds){
EffectiveRangeCfg rangeCfg = new EffectiveRangeCfg();
List<AreaIsp> areaIspList = new ArrayList();
List<String> locaValueList = new ArrayList();
List<String> ispValueList = new ArrayList();
for (String areaEffectiveId : StringUtils.split(areaEffectiveIds, ",")) {
String area = "";
// 区域和运营商
if(areaEffectiveId.contains(":")) {
int index = areaEffectiveId.indexOf(":");
String areaCode = areaEffectiveId.substring(0, index);
String ispCode = areaEffectiveId.substring(index+1);
// 查询该区域信息及其所有父节点信息
List<SysDictInfo> list = sysDictInfoDao.getEffectiveArea(areaCode);
for (SysDictInfo sysDictInfo : list) {
area += sysDictInfo.getItemValue();
while(sysDictInfo.getParent().getSysDictId() != 0) {
sysDictInfo = sysDictInfoDao.getDictById(sysDictInfo.getParent().getSysDictId());
area += "/"+sysDictInfo.getItemValue();
}
}
String areaItemValue = StringUtils.revertStr(area, "/");
if(!locaValueList.contains(areaItemValue)) {
locaValueList.add(areaItemValue);
}
// 查询运营商信息
SysDictInfo isp = sysDictInfoDao.getDictByItemCode(ispCode);
if(!ispValueList.contains(isp.getItemValue())) {
ispValueList.add(isp.getItemValue());
}
}else {
// 区域或运营商
SysDictInfo dict = sysDictInfoDao.getDictByItemCode(areaEffectiveId);
if(dict.getItemType() == 1) {
// 查询所有父节点区域信息
area += dict.getItemValue();
while(dict.getParent().getSysDictId() != 0) {
dict = sysDictInfoDao.getDictById(dict.getParent().getSysDictId());
area += "/"+dict.getItemValue();
}
String areaItemValue = StringUtils.revertStr(area, "/");
if(!locaValueList.contains(areaItemValue)) {
locaValueList.add(areaItemValue);
}
}else {
if(!ispValueList.contains(dict.getItemValue())) {
ispValueList.add(dict.getItemValue());
}
}
}
}
if(locaValueList.size() > 0) {
AreaIsp area = new AreaIsp();
area.setTag(Constants.AREA_TAG);
area.setValue(locaValueList);
areaIspList.add(area);
}
if(ispValueList.size() > 0) {
AreaIsp isp = new AreaIsp();
isp.setTag(Constants.ISP_TAG);
isp.setValue(ispValueList);
areaIspList.add(isp);
}
List<List<AreaIsp>> effectiveRangeList = new ArrayList();
effectiveRangeList.add(areaIspList);
rangeCfg.setEffectiveRangeList(effectiveRangeList);
return gsonToJson(rangeCfg);
}
}