1、样例配置审核,一条配置提交一次服务(为了保证一条配置提交过程完整的事务性);2、表单验证信息完善;3、列表分类性质标签列显示样式调整
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
@@ -13,13 +20,20 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
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;
|
||||
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.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 处理音视频业务
|
||||
@@ -124,9 +138,84 @@ public class AvController extends BaseController {
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改文件样例配置审核状态
|
||||
/**
|
||||
* 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/sample/auditAvFileSample"})
|
||||
public String auditAvFileSample(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.auditAvFileSample(isAudit,isValid,ids);
|
||||
// avCfgService.auditAvFileSample(isAudit,isValid,ids);
|
||||
AvFileSampleCfg entity = new AvFileSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = avCfgService.getAvFileSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
String oldSrcUrl = entity.getSrcPath();
|
||||
String oldSampleUrl = entity.getSamplePath();
|
||||
if(isAudit==1){
|
||||
//音视频文件上传接口调用
|
||||
try {
|
||||
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("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));
|
||||
logger.info("音视频源文件上传响应信息:"+result1);
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
String srcAccessUrl = null;
|
||||
if(!StringUtil.isEmpty(result1)){
|
||||
ResponseData data = result1.getData();
|
||||
srcAccessUrl=data.getAccessUrl();
|
||||
entity.setSrcUrl(srcAccessUrl);
|
||||
// entity.setSrcPath("");
|
||||
}
|
||||
File sampleFile = new File(oldSampleUrl);
|
||||
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("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));
|
||||
logger.info("音视频样例文件上传响应信息:"+result2);
|
||||
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
String sampleAccessUrl = null;
|
||||
if(!StringUtil.isEmpty(result2)){
|
||||
ResponseData data = result2.getData();
|
||||
sampleAccessUrl = data.getAccessUrl();
|
||||
entity.setSampleUrl(sampleAccessUrl);
|
||||
// entity.setSamplePath("");
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频文件样例配置下发失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
avCfgService.auditAvFileSample(entity,isAudit);
|
||||
//删除本地源文件和样例文件
|
||||
if(!oldSrcUrl.equals(entity.getSrcUrl())){
|
||||
FileUtils.deleteFile(oldSrcUrl);
|
||||
}
|
||||
if(!oldSampleUrl.equals(entity.getSampleUrl())){
|
||||
FileUtils.deleteFile(oldSampleUrl);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改标志样例配置状态
|
||||
@@ -136,9 +225,27 @@ public class AvController extends BaseController {
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改标志样例配置审核状态
|
||||
/**
|
||||
* 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/sample/auditAvSignSample"})
|
||||
public String auditAvSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.auditAvSignSample(isAudit,isValid,ids);
|
||||
// avCfgService.auditAvSignSample(isAudit,isValid,ids);
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = avCfgService.getAvSignSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
avCfgService.auditAvSignSample(entity,isAudit);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,80 +141,12 @@ public class AvCfgService extends BaseService{
|
||||
|
||||
|
||||
}
|
||||
public void auditAvFileSample(Integer isAudit,Integer isValid,String ids){
|
||||
AvFileSampleCfg entity = new AvFileSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
List<AvFileSampleCfg> list = new ArrayList();
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
for(String id :idArray){
|
||||
entity = getAvFileSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
|
||||
String oldSrcUrl = entity.getSrcPath();
|
||||
String oldSampleUrl = entity.getSamplePath();
|
||||
if(isAudit==1){
|
||||
//音视频文件上传接口调用
|
||||
try {
|
||||
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("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));
|
||||
logger.info("音视频源文件上传响应信息:"+result1);
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
String srcAccessUrl = null;
|
||||
if(!StringUtil.isEmpty(result1)){
|
||||
ResponseData data = result1.getData();
|
||||
srcAccessUrl=data.getAccessUrl();
|
||||
entity.setSrcUrl(srcAccessUrl);
|
||||
// entity.setSrcPath("");
|
||||
}
|
||||
File sampleFile = new File(oldSampleUrl);
|
||||
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("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));
|
||||
logger.info("音视频样例文件上传响应信息:"+result2);
|
||||
|
||||
//获取文件上传响应信息(新的文件访问路径)
|
||||
String sampleAccessUrl = null;
|
||||
if(!StringUtil.isEmpty(result2)){
|
||||
ResponseData data = result2.getData();
|
||||
sampleAccessUrl = data.getAccessUrl();
|
||||
entity.setSampleUrl(sampleAccessUrl);
|
||||
// entity.setSamplePath("");
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频文件样例配置下发失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
avCfgDao.auditAvFileSample(entity);
|
||||
//删除本地源文件和样例文件
|
||||
if(!oldSrcUrl.equals(entity.getSrcUrl())){
|
||||
FileUtils.deleteFile(oldSrcUrl);
|
||||
}
|
||||
if(!oldSampleUrl.equals(entity.getSampleUrl())){
|
||||
FileUtils.deleteFile(oldSampleUrl);
|
||||
}
|
||||
list.add(entity);
|
||||
}
|
||||
public void auditAvFileSample(AvFileSampleCfg entity,Integer isAudit){
|
||||
//修改数据库审核状态信息
|
||||
avCfgDao.auditAvFileSample(entity);
|
||||
List<AvFileSampleCfg> list = new ArrayList<AvFileSampleCfg>();
|
||||
list.add(entity);
|
||||
//一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(list);
|
||||
@@ -255,19 +187,10 @@ public class AvCfgService extends BaseService{
|
||||
avCfgDao.updateAvSignSampleValid(entity);
|
||||
}
|
||||
}
|
||||
public void auditAvSignSample(Integer isAudit,Integer isValid,String ids){
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
List<AvSignSampleCfg> list = new ArrayList();
|
||||
for(String id :idArray){
|
||||
entity = getAvSignSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
avCfgDao.auditAvSignSample(entity);
|
||||
list.add(entity);
|
||||
}
|
||||
public void auditAvSignSample(AvSignSampleCfg entity,Integer isAudit){
|
||||
avCfgDao.auditAvSignSample(entity);
|
||||
List<AvSignSampleCfg> list = new ArrayList<AvSignSampleCfg>();
|
||||
list.add(entity);
|
||||
if(isAudit==1){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(list);
|
||||
|
||||
@@ -130,7 +130,7 @@ $(function(){
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="harm_level"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="level" value="${_cfg.level }">
|
||||
<input class="form-control required" range="[0,100]" type="text" name="level" value="${_cfg.level }">
|
||||
</div>
|
||||
<div for="level"></div>
|
||||
</div>
|
||||
@@ -156,7 +156,7 @@ $(function(){
|
||||
</div>
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
</div>
|
||||
<div for="srcFile"></div>
|
||||
<div for="srcFileInfo"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@@ -179,7 +179,7 @@ $(function(){
|
||||
<span id="sampleFileInfo">${_cfg.sampleUrl }</span> --%>
|
||||
<input id="sampleUrl" name="sampleUrl" type="hidden" value="${_cfg.sampleUrl }" />
|
||||
</div>
|
||||
<div for="sampleFile"></div>
|
||||
<div for="sampleFileInfo"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${classify}" target="_blank" data-original-title="${classify}"
|
||||
<a href="javascript:;" data-original-title="${classify}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(classify,20)}
|
||||
</a>
|
||||
@@ -353,7 +353,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${attribute}" target="_blank" data-original-title="${attribute}"
|
||||
<a href="javascript:;" data-original-title="${attribute}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(attribute,20)}
|
||||
</a>
|
||||
@@ -373,7 +373,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${lableInfo}" target="_blank" data-original-title="${lableInfo}"
|
||||
<a href="javascript:;" data-original-title="${lableInfo}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(lableInfo,20)}
|
||||
</a>
|
||||
|
||||
@@ -105,11 +105,11 @@ $(function(){
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="harm_level"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="level" value="${_cfg.level }">
|
||||
<input class="form-control required digest" range="[0,100]" type="text" name="level" value="${_cfg.level }">
|
||||
</div>
|
||||
<div for="level"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@@ -118,6 +118,7 @@ $(function(){
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="description" value="${_cfg.description }">
|
||||
</div>
|
||||
<div for="description"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@@ -134,6 +135,7 @@ $(function(){
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${classify}" target="_blank" data-original-title="${classify}"
|
||||
<a href="javascript:;" data-original-title="${classify}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(classify,20)}
|
||||
</a>
|
||||
@@ -350,7 +350,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${attribute}" target="_blank" data-original-title="${attribute}"
|
||||
<a href="javascript:;" data-original-title="${attribute}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(attribute,20)}
|
||||
</a>
|
||||
@@ -370,7 +370,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${lableInfo}" target="_blank" data-original-title="${lableInfo}"
|
||||
<a href="javascript:;" data-original-title="${lableInfo}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(lableInfo,20)}
|
||||
</a>
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${classify}" target="_blank" data-original-title="${classify}"
|
||||
<a href="javascript:;" data-original-title="${classify}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(classify,20)}
|
||||
</a>
|
||||
@@ -400,7 +400,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${attribute}" target="_blank" data-original-title="${attribute}"
|
||||
<a href="javascript:;" data-original-title="${attribute}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(attribute,20)}
|
||||
</a>
|
||||
@@ -420,7 +420,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="${lableInfo}" target="_blank" data-original-title="${lableInfo}"
|
||||
<a href="javascript:;" data-original-title="${lableInfo}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(lableInfo,20)}
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user