1、修改文件上传接口的请求头中日期格式的处理;
2、修改http配置表单的区域管控加载,以及提交验证。
This commit is contained in:
@@ -39,7 +39,7 @@ public class ToMaatResult implements Serializable{
|
||||
private String accessUrl;
|
||||
private Long rawLen;
|
||||
private String digest;
|
||||
private MaatCfg configCompileList;
|
||||
private List configCompileList;
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
@@ -76,10 +76,10 @@ public class ToMaatResult implements Serializable{
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
public MaatCfg getConfigCompileList() {
|
||||
public List getConfigCompileList() {
|
||||
return configCompileList;
|
||||
}
|
||||
public void setConfigCompileList(MaatCfg configCompileList) {
|
||||
public void setConfigCompileList(List configCompileList) {
|
||||
this.configCompileList = configCompileList;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ConfigServiceUtil {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static ToMaatResult postFileCfg(String params,File file,JSONObject fileDesc) throws MaatConvertException{
|
||||
public static ToMaatResult postFileCfg(String params,File file,String fileDesc) throws MaatConvertException{
|
||||
String result = null;
|
||||
ToMaatResult bean = null;
|
||||
String url = Constants.SERVICE_URL+Constants.FILE_UPLOAD_CFG;
|
||||
@@ -293,7 +293,8 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
getId(1,1);
|
||||
// getId(1,1);
|
||||
System.out.println(IpUtil.convertMask(4));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -238,7 +238,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return timeMap;
|
||||
}
|
||||
}
|
||||
|
||||
public static Date formateUtcDate(String date) throws ParseException{
|
||||
String format = "yyyy-MM-dd'T'HH:mm:ss.SSS";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.parse(date);
|
||||
}
|
||||
/**
|
||||
* @param args
|
||||
* @throws ParseException
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JsonMapper extends ObjectMapper {
|
||||
* SerializerProvider provider) throws IOException,
|
||||
* JsonProcessingException { jgen.writeString(""); } });
|
||||
*/
|
||||
this.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
this.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"));
|
||||
// 进行HTML解码。
|
||||
this.registerModule(new SimpleModule().addSerializer(String.class, new JsonSerializer<String>() {
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -13,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.httpclient.util.DateUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
@@ -23,8 +27,11 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AppIdCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
@@ -32,6 +39,7 @@ import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -162,16 +170,18 @@ public class AvController extends BaseController {
|
||||
String oldSampleUrl = entity.getSamplePath();
|
||||
try {
|
||||
if(isAudit==1){
|
||||
Date creatTime = entity.getCreateTime();
|
||||
//音视频文件上传接口调用
|
||||
File srcFile = new File(oldSrcUrl);
|
||||
Map<String,Object> srcMap = new HashMap();
|
||||
srcMap.put("filetype", FileUtils.getSuffix(srcFile.getName(), false));
|
||||
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
srcMap.put("createTime", entity.getCreateTime());
|
||||
|
||||
srcMap.put("createTime",creatTime);
|
||||
srcMap.put("key",FileUtils.getPrefix(srcFile.getName(), false));
|
||||
srcMap.put("fileName", srcFile.getName());
|
||||
srcMap.put("checksum", entity.getSrcMd5());
|
||||
ToMaatResult result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JSONObject.fromObject(srcMap));
|
||||
ToMaatResult result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JsonMapper.toJsonString(srcMap));
|
||||
logger.info("音视频源文件上传响应信息:"+result1);
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
String srcAccessUrl = null;
|
||||
@@ -185,11 +195,11 @@ public class AvController extends BaseController {
|
||||
Map<String,Object> sampleMap = new HashMap();
|
||||
sampleMap.put("filetype", FileUtils.getSuffix(sampleFile.getName(), false));
|
||||
sampleMap.put("datatype", "fileSystem");//样例文件存入fastdfs
|
||||
sampleMap.put("createTime", entity.getCreateTime());
|
||||
sampleMap.put("createTime", creatTime);
|
||||
sampleMap.put("key",FileUtils.getPrefix(sampleFile.getName(), false));
|
||||
sampleMap.put("fileName", sampleFile.getName());
|
||||
sampleMap.put("checksum", entity.getSampleMd5());
|
||||
ToMaatResult result2 = ConfigServiceUtil.postFileCfg(null, sampleFile, JSONObject.fromObject(sampleMap));
|
||||
ToMaatResult result2 = ConfigServiceUtil.postFileCfg(null, sampleFile, JsonMapper.toJsonString(sampleMap));
|
||||
logger.info("音视频样例文件上传响应信息:"+result2);
|
||||
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
* 网站配置
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
@@ -43,9 +45,16 @@ public interface WebsiteCfgDao extends CrudDao<CfgIndexInfo>{
|
||||
public void deleteHttpResHdrCfg(CfgIndexInfo entity);
|
||||
public void deleteHttpBodyCfg(CfgIndexInfo entity);
|
||||
public void updateCfgIndex(CfgIndexInfo entity);
|
||||
|
||||
public void updateCfgValid(BaseCfg entity);
|
||||
public void auditCfg(BaseCfg entity);
|
||||
|
||||
|
||||
public List<CfgIndexInfo> getDnsList(CfgIndexInfo entity);
|
||||
public List<DnsIpCfg> getDnsIp(CfgIndexInfo entity);
|
||||
public List<DnsDomainCfg> getDnsDomain(CfgIndexInfo entity);
|
||||
public void saveDnsIpCfg(DnsIpCfg entity);
|
||||
public void saveDnsDomainCfg(DnsDomainCfg entity);
|
||||
public void deleteDnsIpCfg(CfgIndexInfo entity);
|
||||
public void deleteDnsDomainCfg(CfgIndexInfo entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -342,37 +342,79 @@ public abstract class BaseService {
|
||||
* @return
|
||||
*/
|
||||
public static IpCfg ipConvert(IpCfg dstIp,BaseIpCfg srcIp){
|
||||
if(srcIp.getSrcIpAddress()!=null){
|
||||
if(srcIp.getSrcIpAddress()!=null){
|
||||
if(srcIp.getSrcIpAddress().indexOf("/")!=-1){
|
||||
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
|
||||
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
if(srcIp.getIpType()==4){
|
||||
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
|
||||
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}else if(srcIp.getSrcIpAddress().indexOf("-")!=-1){
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("-")[0]);
|
||||
dstIp.setSrcIpMask(IpUtil.getMask(srcIp.getSrcIpAddress().split("-")[0], srcIp.getSrcIpAddress().split("-")[1]));
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("-")[0]);
|
||||
dstIp.setSrcIpMask(IpUtil.getMask(srcIp.getSrcIpAddress().split("-")[0], srcIp.getSrcIpAddress().split("-")[1]));
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
}else{
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("::");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
dstIp.setSrcIp("0.0.0.0");
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
}else{
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("::");
|
||||
}
|
||||
}
|
||||
if(srcIp.getDestIpAddress()!=null){
|
||||
if(srcIp.getDestIpAddress().indexOf("/")!=-1){
|
||||
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
|
||||
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
if(srcIp.getIpType()==4){
|
||||
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
|
||||
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}else if(srcIp.getDestIpAddress().indexOf("-")!=-1){
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("-")[0]);
|
||||
dstIp.setDstIpMask(IpUtil.getMask(srcIp.getDestIpAddress().split("-")[0], srcIp.getDestIpAddress().split("-")[1]));
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("-")[0]);
|
||||
dstIp.setDstIpMask(IpUtil.getMask(srcIp.getDestIpAddress().split("-")[0], srcIp.getDestIpAddress().split("-")[1]));
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("0.0.0.0");
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("0.0.0.0");
|
||||
}else{
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("::");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
dstIp.setDstIp("0.0.0.0");
|
||||
dstIp.setDstIpMask("0.0.0.0");
|
||||
if(srcIp.getIpType()==4){
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("0.0.0.0");
|
||||
}else{
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("::");
|
||||
}
|
||||
}
|
||||
if(srcIp.getSrcPort()!=null){
|
||||
if(srcIp.getSrcPort().indexOf("/")!=-1){
|
||||
|
||||
@@ -88,6 +88,14 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public Page<CfgIndexInfo> getDnsList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<CfgIndexInfo> list = websiteCfgDao.getDnsList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public List<IpPortCfg> getHttpIpList(IpPortCfg entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<!-- BEGIN THEME GLOBAL STYLES -->
|
||||
<link
|
||||
href="${pageContext.request.contextPath}/static/global/css/components.css"
|
||||
rel="stylesheet" id="style_components" type="text/css" />
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/static/global/scripts/common.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.boxSolid {
|
||||
border: 1px solid #eeeeee
|
||||
@@ -19,53 +13,6 @@
|
||||
$(document)
|
||||
.ready(
|
||||
function() {
|
||||
switchIpType($("select[name$='ipType']"));
|
||||
areaControlInit();
|
||||
$("input[name='isAreaEffective']")
|
||||
.on(
|
||||
'change',
|
||||
function() {
|
||||
var val = $(this).val();
|
||||
if (val == 1) {
|
||||
$(".areaType").removeClass(
|
||||
"hidden");
|
||||
if ($(
|
||||
"input[name='areaType']:checked")
|
||||
.val() == 1) {//areaISP
|
||||
$("#areaIsp").removeClass(
|
||||
"hidden");
|
||||
} else if ($(
|
||||
"input[name='areaType']:checked")
|
||||
.val() == 0) {//areaIp
|
||||
$("#areaIp").removeClass(
|
||||
"hidden");
|
||||
}
|
||||
} else {
|
||||
$(".areaType").addClass(
|
||||
"hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
$("#areaIsp")
|
||||
.addClass("hidden");
|
||||
}
|
||||
});
|
||||
$("select[name$='ipType']").on("change", function() {
|
||||
switchIpType($(this));
|
||||
});
|
||||
$("input[name='areaType']").on('change', function() {
|
||||
var val = $(this).val();
|
||||
if ($(this).is(":visible")) {
|
||||
if (val == 0) {
|
||||
$("#areaIp").removeClass("hidden");
|
||||
$("#areaIsp").addClass("hidden");
|
||||
} else {
|
||||
$("#areaIsp").removeClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
}
|
||||
} else {
|
||||
$("#areaIsp").addClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
}
|
||||
});
|
||||
$("#cancel").on("click", function() {
|
||||
window.history.back();
|
||||
});
|
||||
@@ -101,10 +48,23 @@
|
||||
},
|
||||
submitHandler : function(form) {
|
||||
//loading('onloading...');
|
||||
//代表所有业务都隐藏了,提示必须增加一种业务数据
|
||||
if($(".boxSolid").length ==$(".boxSolid.hidden").length){
|
||||
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
//代表所有区域都隐藏了,提示必须增加个区域信息
|
||||
if($("input[name='isAreaEffective']:checked").val()==1 && $(".container-fluid:visible").size()==0){
|
||||
if($("#areaIsp").hasClass("hidden")) $("#areaIp").find(".glyphicon-plus").click();
|
||||
if($("#areaIp").hasClass("hidden")) $("#areaIsp").find(".glyphicon-plus").click();
|
||||
top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
//将disable属性的元素删除
|
||||
$(".disabled").each(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
form.submit();
|
||||
},
|
||||
errorContainer : "#messageBox",
|
||||
|
||||
Reference in New Issue
Block a user