Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/action/VideoFileAction.java =================================================================== diff -u -r25533 -r25547 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/action/VideoFileAction.java (.../VideoFileAction.java) (revision 25533) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/action/VideoFileAction.java (.../VideoFileAction.java) (revision 25547) @@ -261,4 +261,16 @@ String type = StrutsParamUtils.getPraramValue("videoType", null); videoFileManager.loadTousseVideoByTdIdAndVideoType(tousseId, type); } + //修改视频名称 + public void updateVideoName(){ + String id = StrutsParamUtils.getPraramValue("id", null); + String objectId = StrutsParamUtils.getPraramValue("objectId", null); + String oldUuidVideoName = StrutsParamUtils.getPraramValue("oldUuidVideoName", null); + String oldVideoName = StrutsParamUtils.getPraramValue("oldVideoName", null); + String newVideoName = StrutsParamUtils.getPraramValue("newVideoName", null); + if(StringUtils.isBlank(newVideoName)){ + return; + } + videoFileManager.updateVideoName(id, objectId, oldUuidVideoName, oldVideoName, newVideoName); + } } Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManagerImpl.java =================================================================== diff -u -r25533 -r25547 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManagerImpl.java (.../VideoFileManagerImpl.java) (revision 25533) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManagerImpl.java (.../VideoFileManagerImpl.java) (revision 25547) @@ -30,6 +30,7 @@ import com.forgon.tools.StrutsResponseUtils; import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.json.JSONUtil; public class VideoFileManagerImpl implements VideoFileManager { private ObjectDao objectDao; @@ -264,6 +265,10 @@ JSONObject obj = new JSONObject(); Long id = rs.getLong("id"); String videoName = rs.getString("videoName"); + if(StringUtils.isNotBlank(videoName)){ + int pointIndex = videoName.lastIndexOf("."); + videoName = videoName.substring(0, pointIndex); + } String uuid_videoName = rs.getString("uuid_videoName"); String name = rs.getString("name"); obj.put("id", id); @@ -284,5 +289,44 @@ DatabaseUtil.closeResultSetAndStatement(rs); } + } + @Override + public void updateVideoName(String id, String objectId, String oldUuidVideoName, + String oldVideoName, String newVideoName) { + ResultSet rs = null; + boolean result = false; + try { + //1.修改本地video文件 + String newUuidVideoName = oldUuidVideoName.replaceAll(oldVideoName, newVideoName); + SupplyRoomConfig supplyRoomConfig = supplyRoomConfigManager.getSystemParamsObj(); + String path = supplyRoomConfig.getSaveImagePath() + "/packingTeacherVideo"; + File oldFile = new File(path, oldUuidVideoName); + if(!oldFile.exists()){ + return; + } + File newFile = new File(path, newUuidVideoName); + if(!oldFile.renameTo(newFile)){ + return; + } + //2.修改videoName uuid_videoName 3.修改器械包中的uuid_vidoeNames + newVideoName = newUuidVideoName.substring(newUuidVideoName.indexOf("_")+1); + rs= objectDao.executeSql("select uuid_vedioNames from TousseDefinition where id="+objectId); + String newUuid_vedioNames = null; + if(rs.next()){ + String uuid_vedioNames = rs.getString("uuid_vedioNames"); + newUuid_vedioNames = uuid_vedioNames.replaceAll(oldUuidVideoName, newUuidVideoName); + } + String sql = "update VideoFile set uuid_videoName='"+ newUuidVideoName +"', videoName='"+ newVideoName +"' where id="+ id +";" + + "update TousseDefinition set uuid_vedioNames='"+ newUuid_vedioNames +"' where id="+ objectId +";"; + result = objectDao.excuteSQL(sql); + JSONObject jsonObject = JSONUtil.buildJsonObject(result); + StrutsResponseUtils.output(jsonObject); + } catch (Exception e) { + e.printStackTrace(); + JSONObject jsonObject = JSONUtil.buildJsonObject(result); + StrutsResponseUtils.output(jsonObject); + }finally{ + DatabaseUtil.closeResultSetAndStatement(rs); + } } } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseUploadVideoManager.js =================================================================== diff -u -r25533 -r25547 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseUploadVideoManager.js (.../tousseUploadVideoManager.js) (revision 25533) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseUploadVideoManager.js (.../tousseUploadVideoManager.js) (revision 25547) @@ -192,7 +192,48 @@ menuDisabled: true, header : "视频名称", width:200, - dataIndex : 'videoName' + dataIndex : 'videoName', + menuDisabled : true, + editor : new top.Ext.form.TextField({ + maxLength : 30, + minLength : 1, + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal,record){ + var selectedRecordData = top.Ext.getCmp('tousseTeachingVideoGrid').getSelectionModel().getSelections()[0].data; + var choose = false; + if(newVal != null && newVal.trim() != '' && newVal.trim() != oldVal.trim()){ + top.Ext.MessageBox.confirm("请确认","视频名称是否改为" + newVal.trim() + "?", + function(button, text) { + if ("yes" == button){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/videoFileAction!updateVideoName.do', + params : { + id : selectedRecordData.id, + objectId : selectedRecordData.td_id, + oldUuidVideoName : selectedRecordData.uuid_videoName, + oldVideoName : oldVal, + newVideoName : newVal.trim() + }, + success : function(result){ + toussePackingVideoStore.reload(); + }, + failure : function(){ + } + }); + }else{ + toussePackingVideoStore.reload(); + } + }); + } + }, + specialkey:function(field,e){ + if(e.getKey()==Ext.EventObject.ENTER){ + toussePackingVideoStore.reload(); + } + } + } + }) },{ id:'moveUpDown', menuDisabled: true, @@ -238,7 +279,7 @@ columnWidth : 1, layout: 'form', items : [ - new top.Ext.grid.GridPanel({ + new top.Ext.grid.EditorGridPanel({ id : 'tousseTeachingVideoGrid', store : toussePackingVideoStore, tbar : tbar, Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManager.java =================================================================== diff -u -r25533 -r25547 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManager.java (.../VideoFileManager.java) (revision 25533) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/videomanager/service/VideoFileManager.java (.../VideoFileManager.java) (revision 25547) @@ -40,4 +40,13 @@ * @param videoType */ public void loadTousseVideoByTdIdAndVideoType(String objectId, String videoType); + /** + * 修改视频名称 + * @param id viodeId + * @param objectId 器械包id + * @param oldUuidVideoName 旧的带UUID字符的视频名称 + * @param oldVideoName 旧的视频名称 + * @param newVideoName 新的视频名称 + */ + public void updateVideoName(String id , String objectId, String oldUuidVideoName, String oldVideoName, String newVideoName); } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js =================================================================== diff -u -r25533 -r25547 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js (.../comboTousseForm.js) (revision 25533) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/comboTousseForm.js (.../comboTousseForm.js) (revision 25547) @@ -1099,7 +1099,7 @@ uploadToussePackingImageFile(imageTypeToussePacking, id); } }, { - text: '配包教学视频上传', + text: '配包教学视频', id: 'uploadVedio', handler: function () { uploadToussePackingVideoFile(videoType,id);