diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java index b9689da7e..32576c7b8 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java @@ -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 page = avCfgService.getAvFileSampleList(new Page(request, response), entity); + Page page = avCfgService.getAvFileSampleList(new Page(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 page = avCfgService.getAvSignSampleList(new Page(request, response), entity); + Page page = avCfgService.getAvSignSampleList(new Page(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); diff --git a/src/main/java/com/nis/web/service/configuration/AvCfgService.java b/src/main/java/com/nis/web/service/configuration/AvCfgService.java index 11b643a1e..8b16a3e3a 100644 --- a/src/main/java/com/nis/web/service/configuration/AvCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvCfgService.java @@ -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 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 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 data = (Map)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 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 sampleRes = gson.fromJson(result1,Map.class); - //获取文件上传响应信息(文件访问路径) - entity.setSampleUrl(sampleRes.get("data").toString()); + String sampleAccessUrl = null; + if(!StringUtil.isEmpty(sampleRes.get("data"))){ + Map data = (Map)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(":"+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){ //调用服务接口下发配置数据 diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index ff3a5545c..c014a9f6d 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -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 diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 70e6f1a10..6733dc3a3 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -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 diff --git a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp index 93be14dbd..6d97795be 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp @@ -282,11 +282,11 @@ - + - + - + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp index 870550b78..1fcc72118 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp @@ -117,11 +117,11 @@
- + - +
- + + + +
- +

- - + +

- + - +
- -
- -
- - + +
+ +
+ +
- - - - - - - - - - - +
 ${menu.name}${menu.code}${fns:abbr(menu.href,30)} - - - - - ${menu.sort} - - ${fns:abbr(menu.permission,30)} - - ', this.href)"> - -
+ + + + + + + + + + + + - + + + + + + + + + + + + + + + + +
+  ${menu.name}${menu.code}${menu.functionId}${fns:abbr(menu.href,30)} + + + + + ${menu.sort} + + + + + + + + ${fns:abbr(menu.permission,30)} ', this.href)">
-
- -
-
- -
-
-
- + +
+ +
+
+ + +
+
+
+
-
- +
+ - + \ No newline at end of file