1、文件样例配置审核通过后,删除本地文件;2、修正配置列表时间查询条件与排序设置。

This commit is contained in:
zhangwei
2018-05-22 13:47:49 +08:00
parent d0ffbe9f1c
commit c65b09c688
8 changed files with 172 additions and 91 deletions

View File

@@ -33,7 +33,7 @@ public class AvController extends BaseController {
//音视频文件样例配置列表
@RequestMapping(value = {"/sample/fileSampleList"})
public String fileSampleList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvFileSampleCfg entity){
Page<AvFileSampleCfg> page = avCfgService.getAvFileSampleList(new Page<AvFileSampleCfg>(request, response), entity);
Page<AvFileSampleCfg> page = avCfgService.getAvFileSampleList(new Page<AvFileSampleCfg>(request, response,"a"), entity);
model.addAttribute("page", page);
initPageCondition(model);
return "/cfg/av/fileSampleList";
@@ -41,7 +41,7 @@ public class AvController extends BaseController {
//音视频标志样例配置列表
@RequestMapping(value = {"/sample/signSampleList"})
public String signSampleList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvSignSampleCfg entity){
Page<AvSignSampleCfg> page = avCfgService.getAvSignSampleList(new Page<AvSignSampleCfg>(request, response), entity);
Page<AvSignSampleCfg> page = avCfgService.getAvSignSampleList(new Page<AvSignSampleCfg>(request, response,"a"), entity);
model.addAttribute("page", page);
initPageCondition(model);
return "/cfg/av/signSampleList";
@@ -86,7 +86,7 @@ public class AvController extends BaseController {
File uploadSampleFile = new File(sampleFilePath+sep+sampleFileName);
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
FileCopyUtils.copy(sampleFile.getBytes(),uploadSampleFile);
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+request.getContextPath();
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
String srcUrl = host+"/srcFile/"+uploadSrcFile.getName();
String sampleUrl = host+"/sampleFile/"+uploadSampleFile.getName();
logger.info("srcUrl:"+srcUrl);

View File

@@ -24,6 +24,7 @@ import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.FileUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AvCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -149,44 +150,73 @@ public class AvCfgService extends BaseService{
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(entity.getSrcPath());
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());
String result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JSONObject.fromObject(srcMap));
logger.info("音视频源文件上传响应信息:"+result1);
//获取文件上传响应信息(文件访问路径)
//获取文件上传响应信息(新的文件访问路径)
Map<String, Object> srcRes = gson.fromJson(result1,Map.class);
entity.setSrcUrl(srcRes.get("data").toString());
File smapleFile = new File(entity.getSamplePath());
String srcAccessUrl = null;
if(!StringUtil.isEmpty(srcRes.get("data"))){
Map<String,Object> data = (Map<String,Object>)srcRes.get("data");
if(!StringUtil.isEmpty(data.get("accessUrl"))){
srcAccessUrl=data.get("accessUrl").toString();
entity.setSrcUrl(srcAccessUrl);
// entity.setSrcPath("");
}
}
File sampleFile = new File(oldSampleUrl);
Map<String,Object> sampleMap = new HashMap();
sampleMap.put("filetype", FileUtils.getSuffix(smapleFile.getName(), false));
sampleMap.put("filetype", FileUtils.getSuffix(sampleFile.getName(), false));
srcMap.put("datatype", "fileSystem");//样例文件存入fastdfs
sampleMap.put("createTime", entity.getCreateTime());
sampleMap.put("key",FileUtils.getPrefix(smapleFile.getName(), false));
sampleMap.put("fileName", smapleFile.getName());
sampleMap.put("key",FileUtils.getPrefix(sampleFile.getName(), false));
sampleMap.put("fileName", sampleFile.getName());
sampleMap.put("checksum", entity.getSampleMd5());
String result2 = ConfigServiceUtil.postFileCfg(null, srcFile, JSONObject.fromObject(sampleMap));
logger.info("音视频样例文件上传响应信息:"+result2);
//获取文件上传响应信息(新的文件访问路径)
Map<String, Object> sampleRes = gson.fromJson(result1,Map.class);
//获取文件上传响应信息(文件访问路径)
entity.setSampleUrl(sampleRes.get("data").toString());
String sampleAccessUrl = null;
if(!StringUtil.isEmpty(sampleRes.get("data"))){
Map<String,Object> data = (Map<String,Object>)sampleRes.get("data");
if(!StringUtil.isEmpty(data.get("accessUrl"))){
sampleAccessUrl = data.get("accessUrl").toString();
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);
avCfgDao.auditAvFileSample(entity);
//删除本地源文件和样例文件
if(!oldSrcUrl.equals(entity.getSrcUrl())){
FileUtils.deleteFile(oldSrcUrl);
}
if(!oldSampleUrl.equals(entity.getSampleUrl())){
FileUtils.deleteFile(oldSampleUrl);
}
list.add(entity);
}
if(isAudit==1){
//调用服务接口下发配置数据

View File

@@ -546,7 +546,7 @@ src_file=src file
select_file=please select file
sample_file=sample file
sample_sign=sample sign
click_detail=please click\u201Cshow detail\u201Dbutton\uFF0Cview detailed error information\uFF0Cthanks\uFF01
click_detail=please click\u201Cview detail\u201Dbutton\uFF0Cview detailed error information\uFF0Cthanks\uFF01
return_lastpage=return last page
show_detail=view detail
hidden_detail=hide detail

View File

@@ -372,7 +372,7 @@ src_file=src file
select_file=please select file
sample_file=sample file
sample_sign=sample sign
click_detail=please click\u201Cshow detail\u201Dbutton\uFF0Cview detailed error information\uFF0Cthanks\uFF01
click_detail=please click\u201Cview detail\u201Dbutton\uFF0Cview detailed error information\uFF0Cthanks\uFF01
return_lastpage=return last page
show_detail=view detail
hidden_detail=hide detail

View File

@@ -282,11 +282,11 @@
<th><spring:message code="valid_identifier"/></th>
<th><spring:message code="is_audit"/></th>
<th><spring:message code="creator"/></th>
<th class="sort-column r.create_time"><spring:message code="config_time"/></th>
<th class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th><spring:message code="editor"/></th>
<th class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
<th class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
<th><spring:message code="auditor"/></th>
<th class="sort-column r.audit_time"><spring:message code="audit_time"/></th>
<th class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
<%-- <th><spring:message code="operation"></spring:message></th> --%>
</tr>
</thead>

View File

@@ -117,11 +117,11 @@
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
</div>
<div class="pull-right">
<shiro:hasPermission name="avFileSample:config">
<shiro:hasPermission name="avSignSample:config">
<sys:delRow url="${ctx}/ntc/av/sample/signSampleForm" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/ntc/av/sample/updateAvSignSampleValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
</shiro:hasPermission>
<shiro:hasPermission name="avFileSample:audit">
<shiro:hasPermission name="avSignSample:audit">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message>
@@ -285,11 +285,11 @@
<th><spring:message code="valid_identifier"/></th>
<th><spring:message code="is_audit"/></th>
<th><spring:message code="creator"/></th>
<th class="sort-column r.create_time"><spring:message code="config_time"/></th>
<th class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th><spring:message code="editor"/></th>
<th class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
<th class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
<th><spring:message code="auditor"/></th>
<th class="sort-column r.audit_time"><spring:message code="audit_time"/></th>
<th class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
<%-- <th><spring:message code="operation"></spring:message></th> --%>
</tr>
</thead>

View File

@@ -9,7 +9,7 @@ if (Servlets.isAjaxRequest(request)) {
if (ex!=null && StringUtils.startsWith(ex.getMessage(), "msg:")){
out.print(StringUtils.replace(ex.getMessage(), "msg:", ""));
}else{
out.print("操作权限不足.");
out.print("<spring:message code=\"no_permission\"/>.");
}
}

View File

@@ -1,90 +1,141 @@
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>菜单管理</title>
<title>菜单管理</title>
<link href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
<script src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#treeTable").treeTable({expandLevel : 3}).show();
});
function updateSort() {
loading('正在提交,请稍等...');
$("#listForm").attr("action", "${ctx}/sys/menu/updateSort");
$("#listForm").submit();
}
</script>
<link
href="${ctxStatic}/global/plugins/treeTable/themes/vsStyle/treeTable.min.css"
rel="stylesheet" type="text/css" />
<script
src="${ctxStatic}/global/plugins/treeTable/jquery.treeTable.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#treeTable").treeTable({
expandLevel : 3
}).show();
});
function updateSort() {
loading('正在提交,请稍等...');
$("#listForm").attr("action", "${ctx}/sys/menu/updateSort");
$("#listForm").submit();
}
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<shiro:hasPermission name="sys:menu:edit"><button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/sys/menu/form'">&nbsp;<spring:message code="add"/>&nbsp;</button></shiro:hasPermission>
<shiro:hasPermission name="sys:menu:edit">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/sys/menu/form'">
&nbsp;
<spring:message code="add" />
&nbsp;
</button>
</shiro:hasPermission>
</div>
<h3 class="page-title">
<spring:message code="menuManage"/>
<small><spring:message code="date_list"/></small>
<spring:message code="menuManage" />
<small><spring:message code="date_list" /></small>
</h3>
<h5 class="page-header"></h5>
<div class="row">
<div class="col-md-12">
<div class="portlet">
<div class="portlet-body">
<div class="row" >
<div class="col-md-12">
<sys:message content="${message}"/>
<div class="row">
<div class="col-md-12">
<sys:message content="${message}" />
<form id="listForm" method="post">
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<thead><tr><th><spring:message code="menu_name"/></th><th><spring:message code="unicode"/></th><th><spring:message code="link"/></th><th style="text-align:center;"><spring:message code="sort"/></th><th><spring:message code="visible"/></th><th><spring:message code="permission_mark"/></th><shiro:hasPermission name="sys:menu:edit"><th><spring:message code="operation"/></th></shiro:hasPermission></tr></thead>
<tbody><c:forEach items="${list}" var="menu">
<tr id="${menu.id}" pId="${menu.parent.id ne 1?menu.parent.id:0}">
<td nowrap><i class="${not empty menu.icon?menu.icon:' hide'} font-blue-sharp"></i> &nbsp;<a href="${ctx}/sys/menu/form?id=${menu.id}">${menu.name}</a></td>
<td>${menu.code}</td>
<td title="${menu.href}">${fns:abbr(menu.href,30)}</td>
<td style="text-align:center;">
<shiro:hasPermission name="sys:menu:edit">
<input type="hidden" name="ids" value="${menu.id}"/>
<input name="sorts" type="text" value="${menu.sort}" style="width:50px;margin:0;padding:0;text-align:center;border: 1px solid #ddd;">
</shiro:hasPermission><shiro:lacksPermission name="sys:menu:edit">
${menu.sort}
</shiro:lacksPermission>
</td>
<td><c:choose><c:when test="${menu.isShow eq '1'}"><spring:message code="display"/></c:when><c:otherwise><spring:message code="hide"/></c:otherwise></c:choose></td>
<td title="${menu.permission}">${fns:abbr(menu.permission,30)}</td>
<shiro:hasPermission name="sys:menu:edit"><td nowrap>
<a href="${ctx}/sys/menu/form?id=${menu.id}"><spring:message code="edit"/></a>
<a href="${ctx}/sys/menu/delete?id=${menu.id}" onclick="return confirmx('<spring:message code="delete_all_child"/>', this.href)"><spring:message code="delete"/></a>
<a href="${ctx}/sys/menu/form?parent.id=${menu.id}"><spring:message code="add_child_menu"></spring:message></a>
</td></shiro:hasPermission>
<table id="treeTable"
class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th><spring:message code="menu_name" /></th>
<th><spring:message code="unicode" /></th>
<th><spring:message code="functionId" /></th>
<th><spring:message code="link" /></th>
<th style="text-align:center;"><spring:message
code="sort" /></th>
<th><spring:message code="visible" /></th>
<th><spring:message code="permission_mark" /></th>
<shiro:hasPermission name="sys:menu:edit">
<th><spring:message code="operation" /></th>
</shiro:hasPermission>
</tr>
</c:forEach></tbody>
</thead>
<tbody>
<c:forEach items="${list}" var="menu">
<tr id="${menu.id}"
pId="${menu.parent.id ne 1?menu.parent.id:0}">
<td nowrap><i
class="${not empty menu.icon?menu.icon:' hide'} font-blue-sharp"></i>
&nbsp;<a href="${ctx}/sys/menu/form?id=${menu.id}">${menu.name}</a></td>
<td>${menu.code}</td>
<td>${menu.functionId}</td>
<td title="${menu.href}">${fns:abbr(menu.href,30)}</td>
<td style="text-align:center;"><shiro:hasPermission
name="sys:menu:edit">
<input type="hidden" name="ids" value="${menu.id}" />
<input name="sorts" type="text" value="${menu.sort}"
style="width:50px;margin:0;padding:0;text-align:center;border: 1px solid #ddd;">
</shiro:hasPermission>
<shiro:lacksPermission name="sys:menu:edit">
${menu.sort}
</shiro:lacksPermission></td>
<td><c:choose>
<c:when test="${menu.isShow eq '1'}">
<spring:message code="display" />
</c:when>
<c:otherwise>
<spring:message code="hide" />
</c:otherwise>
</c:choose></td>
<td title="${menu.permission}">${fns:abbr(menu.permission,30)}</td>
<shiro:hasPermission name="sys:menu:edit">
<td nowrap><a
href="${ctx}/sys/menu/form?id=${menu.id}"><spring:message
code="edit" /></a> <a
href="${ctx}/sys/menu/delete?id=${menu.id}"
onclick="return confirmx('<spring:message code="delete_all_child"/>', this.href)"><spring:message
code="delete" /></a> <a
href="${ctx}/sys/menu/form?parent.id=${menu.id}"><spring:message
code="add_child_menu"></spring:message></a></td>
</shiro:hasPermission>
</tr>
</c:forEach>
</tbody>
</table>
<shiro:hasPermission name="sys:menu:edit"><div class="form-actions pagination-left">
<button id="btnSubmit" class="btn btn-primary" type="button" onclick="updateSort();"><spring:message code="save_sort"/></button>
</div></shiro:hasPermission>
</form>
</div>
</div>
</div>
<shiro:hasPermission name="sys:menu:edit">
<div class="form-actions pagination-left">
<button id="btnSubmit" class="btn btn-primary" type="button"
onclick="updateSort();">
<spring:message code="save_sort" />
</button>
</div>
</shiro:hasPermission>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>