From 96286178ee1c257c130cb2ad964a781f36c4eee5 Mon Sep 17 00:00:00 2001
From: yn147 <2270338776@qq.com>
Date: 星期三, 10 五月 2023 16:23:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/qxueyou/scc/teach/res/service/impl/ResService.java |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/res/service/impl/ResService.java b/src/main/java/com/qxueyou/scc/teach/res/service/impl/ResService.java
index d142c62..c6d79e1 100644
--- a/src/main/java/com/qxueyou/scc/teach/res/service/impl/ResService.java
+++ b/src/main/java/com/qxueyou/scc/teach/res/service/impl/ResService.java
@@ -30,9 +30,9 @@
 import com.qxueyou.scc.teach.subject.service.impl.SubjectLectureService;
 
 /**
- * 资源服务
+ * 璧勬簮鏈嶅姟
  *
- * @author 夏德虎
+ * @author 澶忓痉铏�
  */
 @Service
 public class ResService extends CommonAppService implements IResService {
@@ -46,12 +46,12 @@
 
     @Autowired
     private ApplicationContext appContext;
-    
+
     @Autowired
     private IClassLectureService classLectureService;
 
     /**
-     * 各类型资源服务实现
+     * 鍚勭被鍨嬭祫婧愭湇鍔″疄鐜�
      */
     private Map<String, IResItemService> resItemServiceMap = new HashMap<String, IResItemService>(6);
 
@@ -87,7 +87,7 @@
         res.setCoverPageUrl(coverPageUrl);
         res.setItemDestId(resItemId);
         res.setName(name);
-        res.setStatus(Res.STATUS_CONVER);
+        res.setStatus(Res.STATUS_DRAFT);
         res.setType(type);
         res.setResDirId(dirId);
         res.setRemark(remark);
@@ -109,7 +109,7 @@
             TraceUtils.setCreateTrace(res);
             res.setItemDestId(resItemId);
             res.setName(name);
-            res.setStatus(Res.STATUS_CONVER);
+            res.setStatus(Res.STATUS_DRAFT);
             res.setType(type);
             res.setLibId(dir.getLibId());
             res.setResDirId(dirId);
@@ -129,13 +129,13 @@
 
         Res res = read(Res.class, resId);
 
-        resItemServiceMap.get(res.getType()).update(res.getItemDestId(), name);
+//        resItemServiceMap.get(res.getType()).update(res.getItemDestId(), name);
 
         TraceUtils.setUpdateTrace(res);
         res.setName(name);
         res.setCoverPageUrl(coverPageUrl);
         res.setRemark(remark);
-
+        res.setStatus(Res.STATUS_DRAFT);
         save(res);
 
         return new Result(true, "success");
@@ -157,7 +157,7 @@
     }
 
     /**
-     * @param resId 资源id
+     * @param resId 璧勬簮id
      * @return
      */
     private Result delete(String resId) {
@@ -258,9 +258,9 @@
         ResLib lib = this.getResLib(libType, ownerId);
 
         StringBuffer hql = new StringBuffer(
-                "from Res where deleteFlag is false and name like ? and libId=? and status=? order by updateTime desc");
+                "from Res where deleteFlag is false and name like ? and libId like ? and status=? order by updateTime desc");
 
-        List<Object> args = CollectionUtils.newList(keyword + "%", lib == null ? null : lib.getLibId(),Res.STATUS_DRAFT);
+        List<Object> args = CollectionUtils.newList(keyword + "%", lib == null ? "%" : lib.getLibId() + "%",Res.STATUS_DRAFT);
 
         if (!StringUtils.isEmpty(resType)) {
             hql.append(" and type=?");
@@ -276,9 +276,9 @@
     public int listResCountByLib(String libType, String ownerId, String text, String resType) {
         ResLib lib = this.getResLib(libType, ownerId);
 
-        StringBuffer hql = new StringBuffer("from Res where deleteFlag is false and libId=? order by updateTime desc");
+        StringBuffer hql = new StringBuffer("from Res where deleteFlag is false and libId like ? order by updateTime desc");
 
-        List<Object> args = CollectionUtils.newList(null == lib ? null : lib.getLibId());
+        List<Object> args = CollectionUtils.newList(null == lib ? "%" : lib.getLibId()+"%");
 
         if (!StringUtils.isEmpty(resType)) {
             hql.append(" and type=?");
@@ -306,17 +306,18 @@
     public Result readAccessPath(String resId, String attribute) {
 
         Res res = read(Res.class, resId);
-        
-        Object path = Res.FILE_TYPE_VIDEO.equals(res.getType())?JSONObject.parse(resItemServiceMap.get(res.getType()).readAccessPath(res.getItemDestId(), attribute)):CollectionUtils.newObjectMap("path", resItemServiceMap.get(res.getType()).readAccessPath(res.getItemDestId(), attribute));
+        String type="0";
+//        Object path = Res.FILE_TYPE_VIDEO.equals(res.getType())? JSONObject.parse(resItemServiceMap.get(res.getType()).readAccessPath(res.getItemDestId(), attribute)):CollectionUtils.newObjectMap("path", resItemServiceMap.get(res.getType()).readAccessPath(res.getItemDestId(), attribute));
+        Object path = Res.FILE_TYPE_VIDEO.equals(type)? resItemServiceMap.get(type).readAccessPath(res.getItemDestId(), attribute):resItemServiceMap.get(type).readAccessPath(res.getItemDestId(), attribute);
         if(Res.FILE_TYPE_DOC.equals(res.getType())) {
         	 return new Result(true, "success",
                      CollectionUtils.newObjectMap("path", path, "name", res.getName(), "coverPageUrl", res.getCoverPageUrl(), "size",
-                    		 this.classLectureService.readDocPageCount(res.getItemDestId())));//文件的页数
+                    		 this.classLectureService.readDocPageCount(res.getItemDestId())));//鏂囦欢鐨勯〉鏁�
         }else {
         	 return new Result(true, "success",
                      CollectionUtils.newObjectMap("path", path, "name", res.getName(), "coverPageUrl", res.getCoverPageUrl(), "size", 0));
         }
-       
+
     }
 
     @Override
@@ -359,7 +360,7 @@
     public Result deleteDir(String[] dirIds) {
 
         for (String dirId : dirIds) {
-            deleteFile4Dir(dirId);// 删除对应的文件
+            deleteFile4Dir(dirId);// 鍒犻櫎瀵瑰簲鐨勬枃浠�
             deleteDir(dirId);
         }
 
@@ -378,9 +379,9 @@
     }
 
     /**
-     * 删除资源库文件夹对应删除文件
+     * 鍒犻櫎璧勬簮搴撴枃浠跺す瀵瑰簲鍒犻櫎鏂囦欢
      *
-     * @param dirId 文件夹id
+     * @param dirId 鏂囦欢澶筰d
      */
     @Override
     public void deleteFile4Dir(String dirId) {
@@ -392,7 +393,7 @@
     @Override
     public ResDir doGetRootDir(String type, String ownerId) {
         ResLib lib = getResLib(type, ownerId);
-        // 无资源库则初始化,并返回根节点
+        // 鏃犺祫婧愬簱鍒欏垵濮嬪寲,骞惰繑鍥炴牴鑺傜偣
         if (lib == null) {
             Result result = initResLib(type, ownerId);
             return read(ResDir.class, result.getDataT("rootDirId"));
@@ -410,11 +411,11 @@
 
     private List<ResDir> doGetChildDirsInner(String parentDirId, String type) {
 
-        // 根节点的处理
+        // 鏍硅妭鐐圭殑澶勭悊
         if (StringUtils.isEmpty(parentDirId)) {
             ResLib lib = getResLib(type, ClientUtils.getUserId());
 
-            // 无资源库则初始化,并返回根节点
+            // 鏃犺祫婧愬簱鍒欏垵濮嬪寲,骞惰繑鍥炴牴鑺傜偣
             if (lib == null) {
                 Result result = initUserLib();
                 return CollectionUtils.newList(ResDir.class, read(ResDir.class, result.getDataT("rootDirId")));
@@ -453,7 +454,7 @@
 
         if (lib == null) {
 
-            Result result = addDir(RES_DIR_ROOT, "根目录");
+            Result result = addDir(RES_DIR_ROOT, "鏍圭洰褰�");
 
             lib = new ResLib();
 
@@ -500,7 +501,7 @@
     }
 
     /**
-     * 定时器监控转码完成后设置同步res表的状态
+     * 瀹氭椂鍣ㄧ洃鎺ц浆鐮佸畬鎴愬悗璁剧疆鍚屾res琛ㄧ殑鐘舵��
      */
     @Scheduled(cron = "0/2 * * * * ?")
     public void doTimer() {

--
Gitblit v1.8.0