eganwu hace 2 años
padre
commit
ff0cc1cc60

+ 77 - 0
src/custom/restcontroller/R.java

@@ -5153,150 +5153,187 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20230720143503 {
         public static class v1 {
         }
     }
+
     public static class ID20230720143603 {
         public static class v1 {
         }
     }
+
     public static class ID20230720152503 {
         public static class v1 {
         }
     }
+
     public static class ID20230721104302 {
         public static class v1 {
         }
     }
+
     public static class ID20230721110502 {
         public static class v1 {
         }
     }
+
     public static class ID20230728133003 {
         public static class v1 {
         }
     }
+
     public static class ID20230728143503 {
         public static class v1 {
         }
     }
+
     public static class ID20230729103203 {
         public static class v1 {
         }
     }
+
     public static class ID20230726111403 {
         public static class v1 {
         }
     }
+
     public static class ID20230729142603 {
         public static class v1 {
         }
     }
+
     public static class ID20230729165303 {
         public static class v1 {
         }
     }
+
     public static class ID20230802093703 {
         public static class v1 {
         }
     }
+
     public static class ID20230802100103 {
         public static class v1 {
         }
     }
+
     public static class ID20230802103303 {
         public static class v1 {
         }
     }
+
     public static class ID20230802111003 {
         public static class v1 {
         }
     }
+
     public static class ID20230803140903 {
         public static class v1 {
         }
     }
+
     public static class ID20230803143703 {
         public static class v1 {
         }
     }
+
     public static class ID20230803165003 {
         public static class v1 {
         }
     }
+
     public static class ID20230815151203 {
         public static class v1 {
         }
     }
+
     public static class ID20230818135003 {
         public static class v1 {
         }
     }
+
     public static class ID20230826091303 {
         public static class v1 {
         }
     }
+
     public static class ID20230829161203 {
         public static class v1 {
         }
     }
+
     public static class ID20230706103703 {
         public static class v1 {
         }
     }
+
     public static class ID20230913154803 {
         public static class v1 {
         }
     }
+
     public static class ID20230918155003 {
         public static class v1 {
         }
     }
+
     public static class ID20230918155103 {
         public static class v1 {
         }
     }
+
     public static class ID20230920134403 {
         public static class v1 {
         }
     }
+
     public static class ID20230927135803 {
         public static class v1 {
         }
     }
+
     public static class ID20231007101703 {
         public static class v1 {
         }
     }
+
     public static class ID20231007101803 {
         public static class v1 {
         }
     }
+
     public static class ID20231018093803 {
         public static class v1 {
         }
     }
+
     public static class ID20231018103203 {
         public static class v1 {
         }
     }
+
     public static class ID20231018103303 {
         public static class v1 {
         }
     }
+
     public static class ID20231018142103 {
         public static class v1 {
         }
     }
+
     public static class ID20231018162103 {
         public static class v1 {
         }
     }
+
     public static class ID20231020111203 {
         public static class v1 {
         }
     }
+
     public static class ID20231020111303 {
         public static class v1 {
         }
@@ -5322,90 +5359,112 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20231024110003 {
         public static class v1 {
         }
     }
+
     public static class ID20231025144003 {
         public static class v1 {
         }
     }
+
     public static class ID20231025144103 {
         public static class v1 {
         }
     }
+
     public static class ID20231025160203 {
         public static class v1 {
         }
     }
+
     public static class ID20231030091403 {
         public static class v1 {
         }
     }
+
     public static class ID20231030093503 {
         public static class v1 {
         }
     }
+
     public static class ID20231103100503 {
         public static class v1 {
         }
     }
+
     public static class ID20231115095103 {
         public static class v1 {
         }
     }
+
     public static class ID20231201144302 {
         public static class v1 {
         }
     }
+
     public static class ID20231201145402 {
         public static class v1 {
         }
     }
+
     public static class ID20231201145502 {
         public static class v1 {
         }
     }
+
     public static class ID20231201153702 {
         public static class v1 {
         }
     }
+
     public static class ID20230706094703 {
         public static class v1 {
         }
     }
+
     public static class ID20231205134103 {
         public static class v1 {
         }
     }
+
     public static class ID20231208133902 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134002 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134102 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134202 {
         public static class v1 {
         }
     }
+
     public static class ID20231211141802 {
         public static class v1 {
         }
     }
+
     public static class ID20231212110202 {
         public static class v1 {
         }
     }
+
     public static class ID20231212111202 {
         public static class v1 {
         }
     }
+
     public static class ID2023121221131702 {
         public static class v1 {
         }
@@ -5420,6 +5479,7 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20231121145103 {
         public static class v1 {
         }
@@ -5434,10 +5494,12 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20240123163302 {
         public static class v1 {
         }
     }
+
     public static class ID2024020201095102 {
         public static class v1 {
         }
@@ -5502,6 +5564,21 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID20240314102902 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240314112102 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240314134002 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 0 - 7
src/custom/restcontroller/webmanage/saletool/courseware/SQL/课件管理-新增.sql

@@ -1,7 +0,0 @@
-INSERT INTO sat_courseware(sat_coursewareid, siteid, createdepid, createuserid, createby, createdate, authuserid,
-                           authdepid,
-                           changeuserid, changeby, changedate, title, readcount,
-                           sat_courseware_classid, notes, status, canfiledownload, begdate,enddate)
-VALUES ($sat_coursewareid$, $siteid$, $createdepid$, $createuserid$, $createby$, CURRENT_TIME, $authuserid$,
-        $authdepid$,
-        $createuserid$, $createby$, CURRENT_TIME, $title$, 0, $sat_courseware_classid$, $notes$, '新建', $canfiledownload$, $begdate$,$enddate$)

+ 0 - 20
src/custom/restcontroller/webmanage/saletool/courseware/SQL/课件管理-更新.sql

@@ -1,20 +0,0 @@
-UPDATE sat_courseware
-SET siteid=$siteid$,
-    createdepid = $createdepid$,
-    authuserid = $authuserid$,
-    authdepid = $authdepid$,
-    changedate = CURRENT_TIME,
-    changeuserid = $changeuserid$,
-    changeby = $changeby$,
-    title = $title$,
-    notes = $notes$,
-    status = '新建',
-    canfiledownload = $canfiledownload$,
-    begdate = $begdate$,
-    enddate = $enddate$,
-    sat_courseware_classid = $sat_courseware_classid$
-WHERE sat_coursewareid = $sat_coursewareid$
-
-
-
-

+ 5 - 3
src/custom/restcontroller/webmanage/saletool/courseware/SQL/课件管理-查询.sql

@@ -13,9 +13,11 @@ SELECT
     t1.begdate,
     t1.enddate,
     t1.status,
-    t3.classname classname1,
-    (SELECT IFNULL(FORMAT(sum(studycount),0),0) FROM sat_courseware_read WHERE  siteid = t1.siteid AND sat_coursewareid = t1.sat_coursewareid) studycount,
-    (SELECT count(*)  FROM sys_attachment_links WHERE   siteid = t1.siteid AND ownerid = t1.sat_coursewareid AND ownertable = 'sat_courseware' AND usetype = 'default') attachmentcount
+    t1.publishdate,
+    t1.teacher,
+    t1.description,
+    t1.sequence,
+    t3.classname classname1
 FROM
     sat_courseware t1
         LEFT JOIN sat_courseware_class t2 ON t1.sat_courseware_classid = t2.sat_courseware_classid

+ 4 - 0
src/custom/restcontroller/webmanage/saletool/courseware/SQL/课件管理-查询详细.sql

@@ -13,6 +13,10 @@ SELECT
     t1.begdate,
     t1.enddate,
     t1.status,
+    t1.description,
+    t1.teacher,
+    t1.sequence,
+    t1.publishdate,
     t3.classname classname1,
      t3.sat_courseware_classid sat_courseware_classid_1,
     (SELECT IFNULL(FORMAT(sum(studycount),0),0) FROM sat_courseware_read WHERE  siteid = t1.siteid AND sat_coursewareid = t1.sat_coursewareid) studycount,

+ 87 - 55
src/custom/restcontroller/webmanage/saletool/courseware/courseware.java

@@ -11,10 +11,7 @@ import common.annotation.API;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.annotation.cm;
-import common.data.Row;
-import common.data.Rows;
-import common.data.RowsMap;
-import common.data.SQLFactory;
+import common.data.*;
 import restcontroller.R;
 import utility.email.EmailContent;
 
@@ -27,48 +24,44 @@ public class courseware extends Controller {
         super(content);
     }
 
-    @API(title = "新增或更新")
+    @API(title = "新增或更新", apiversion = R.ID20240314102902.v1.class)
     @CACHEING_CLEAN(cms = {@cm(clazz = courseware.class, method = {"select"})})
     public String insertOrUpdate() throws YosException {
 
-        String title = content.getString("title", "sat_courseware");
-        Long sat_courseware_classid = content.getLong("sat_courseware_classid");
-        String notes = content.getString("notes", "sat_courseware");
-        JSONArray tagArray = content.getJSONArray("tag");
-        boolean canfiledownload = content.getBoolean("canfiledownload");
-        String begdate = content.getString("begdate");
-        String enddate = content.getString("enddate");
         Long sat_coursewareid = content.getLong("sat_coursewareid");
 
-        SQLFactory sqlFactory;
+
         if (sat_coursewareid <= 0) {
             sat_coursewareid = createTableID("sat_courseware");
-            sqlFactory = new SQLFactory(this, "课件管理-新增");
-            sqlFactory.addParameter("createuserid", userid);
-            sqlFactory.addParameter("createby", username);
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware");
+            insertSQL.setUniqueid(sat_coursewareid);
+            insertSQL.setSiteid(siteid);
+            insertSQL.setValue("createdepid", departmentid);
+            insertSQL.setValue("authuserid", userid);
+            insertSQL.setValue("authdepid", departmentid);
+            insertSQL.setValue("title", content.getStringValue("title"));
+            insertSQL.setValue("sequence", content.getLongValue("sequence"));
+            insertSQL.setValue("description", content.getStringValue("description"));
+            insertSQL.setValue("teacher", content.getStringValue("teacher"));
+            insertSQL.setValue("sat_courseware_classid", content.getLongValue("sat_courseware_classid"));
+            insertSQL.setValue("publishdate", content.getStringValueForDate("publishdate", "yyyy-MM-dd", "null"));
+            insertSQL.setValue("status", "新建");
+            insertSQL.insert();
+
         } else {
-            sqlFactory = new SQLFactory(this, "课件管理-更新");
-            sqlFactory.addParameter("changeby", username);
-            sqlFactory.addParameter("changeuserid", userid);
+            UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_courseware");
+            updateSQL.setSiteid(siteid);
+            updateSQL.setUniqueid(sat_coursewareid);
+            updateSQL.setValue("title", content.getString("title"));
+            updateSQL.setValue("publishdate", content.getStringValueForDate("publishdate", "yyyy-MM-dd", "null"));
+            updateSQL.setValue("sat_courseware_classid", content.getLongValue("sat_courseware_classid"));
+            updateSQL.setValue("sequence", content.getLongValue("sequence"));
+            updateSQL.setValue("teacher", content.getStringValue("teacher"));
+            updateSQL.setValue("description", content.getStringValue("description"));
+            updateSQL.update();
         }
-        sqlFactory.addParameter("createdepid", departmentid);
-        sqlFactory.addParameter("authuserid", userid);
-        sqlFactory.addParameter("authdepid", departmentid);
-        sqlFactory.addParameter("sat_coursewareid", sat_coursewareid);
-        sqlFactory.addParameter("title", title);
-        sqlFactory.addParameter("sat_courseware_classid", sat_courseware_classid);
-        sqlFactory.addParameter("notes", notes);
-        sqlFactory.addParameter("canfiledownload", canfiledownload);
-//        sqlFactory.addParameter("tag", tagArray.toJSONString());
-        sqlFactory.addParameter("siteid", siteid);
-        sqlFactory.addParameter("begdate", begdate);
-        sqlFactory.addParameter("enddate", enddate);
 
-        ArrayList<String> list = (ArrayList<String>) JSONObject.parseArray(tagArray.toJSONString(), String.class);
-        DataTag.updateTag(this, "sat_courseware", sat_coursewareid, list);
 
-
-        dbConnect.runSqlUpdate(sqlFactory);
         content.put("sat_coursewareid", sat_coursewareid);
         return selectDetail();
     }
@@ -79,6 +72,18 @@ public class courseware extends Controller {
     public String delete() throws YosException {
 
         JSONArray array = content.getJSONArray("sat_coursewareids");
+
+        for (Object obj : array) {
+            Rows rows = dbConnect.runSqlQuery("SELECT * from sat_courseware WHERE sat_coursewareid=" + obj + " and siteid='" + siteid + "'");
+            if (rows.isEmpty()) {
+                return getErrReturnObject().setErrMsg("课程不存在").toString();
+            }
+            if (!rows.get(0).getString("status").equals("新建")) {
+                return getErrReturnObject().setErrMsg("非新建状态不可删除").toString();
+            }
+        }
+
+
         SQLFactory sqlFactory = new SQLFactory(this, "课程-删除");
         sqlFactory.addParameter_in("sat_coursewareid", array.toArray());
         String sql = sqlFactory.getSQL();
@@ -88,27 +93,23 @@ public class courseware extends Controller {
     }
 
 
-    @API(title = "审核")
+    @API(title = "课程发布", apiversion = R.ID20240314112102.v1.class)
     @CACHEING_CLEAN(cms = {@cm(clazz = courseware.class, method = {"select"})})
     public String audit() throws Exception {
-        Long sat_coursewareid = content.getLong("sat_coursewareid");
+        JSONArray sat_coursewareids = content.getJSONArray("sat_coursewareids");
         int type = content.getIntValue("type");
-        String status = "新建";
-        if (type == 0) {
-            status = "新建";
-        } else {
-            status = "发布";
-        }
 
-        SQLFactory sqlFactory = new SQLFactory(this, "课件管理-审核");
-        sqlFactory.addParameter("sat_coursewareid", sat_coursewareid);
-        sqlFactory.addParameter("checkby", username);
-        sqlFactory.addParameter("status", status);
-        dbConnect.runSqlUpdate(sqlFactory);
+        UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_courseware");
+        updateSQL.setSiteid(siteid);
+        updateSQL.setValue("status", type == 0 ? "新建" : "发布");
+        updateSQL.setValue("checkby",type == 0 ? "null" : username);
+        updateSQL.setValue("checkdate",type == 0 ? "null" : getDateTime_Str());
+        updateSQL.setWhere("sat_coursewareid",sat_coursewareids.toArray());
+        updateSQL.update();
         //发送邮件和消息,发布时发送消息
-        if (type != 0) {
-            sendMsg(sat_coursewareid);
-        }
+//        if (type != 0) {
+//            sendMsg(sat_coursewareid);
+//        }
 
 
         return getSucReturnObject().toString();
@@ -146,7 +147,6 @@ public class courseware extends Controller {
     }
 
     @API(title = "管理端-商学院-课程列表", apiversion = R.ID20221102143402.v1.class)
-    @CACHEING
     public String select() throws YosException {
 
         /*
@@ -180,6 +180,16 @@ public class courseware extends Controller {
                     where.append(")");
                 }
             }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and (");
+                where.append("t1.checkdate >='").append(whereObject.getString("begindate")).append("' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and (");
+                where.append("t1.checkdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
+                where.append(")");
+            }
 
         }
 
@@ -206,12 +216,20 @@ public class courseware extends Controller {
             row.put("attinfos", attRowsMap.getOrDefault(row.getString("sat_coursewareid"), new Rows()));
             row.put("tag", tagMap.get(row.getString("sat_coursewareid")));
 
+            String classname1=row.getString("classname1");
+            String classname2=row.getString("classname2");
+            if(classname1.equals("")){
+                row.put("classname",classname2);
+            }else{
+                row.put("classname",classname1+"/"+classname2);
+            }
+
         }
 
         return getSucReturnObject().setData(rows).toString();
     }
 
-    @API(title = "课程详细")
+    @API(title = "课程详细",apiversion =R.ID20240314134002.v1.class )
     public String selectDetail() throws YosException {
         Long sat_coursewareid = content.getLong("sat_coursewareid");
         SQLFactory sqlFactory = new SQLFactory(this, "课件管理-查询详细");
@@ -223,7 +241,19 @@ public class courseware extends Controller {
         RowsMap coverRowsMap = getAttachmentUrl("sat_courseware", ids, "cover");
         //附件
         RowsMap attRowsMap = getAttachmentUrl("sat_courseware", ids, "default");
-        for (Row row : rows) {
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_courseware_auth",
+                "roleid");
+        querySQL.addJoinTable(JOINTYPE.inner, "sys_role", "t2", "t1.roleid=t2.roleid and t1.siteid=t2.siteid",
+                "rolename");
+        querySQL.setTableAlias("t1");
+        querySQL.setWhere("t1.siteid", siteid);
+        querySQL.setWhere("t1.sat_coursewareid", sat_coursewareid);
+        Rows roleRows = querySQL.query();
+
+        Row row = new Row();
+        if (rows.isNotEmpty()) {
+            row = rows.get(0);
             Rows coverRows = coverRowsMap.get(row.getString("sat_coursewareid"));
             if (coverRows.isEmpty()) {
                 row.put("cover", "");
@@ -233,9 +263,11 @@ public class courseware extends Controller {
 
             row.put("attinfos", attRowsMap.getOrDefault(row.getString("sat_coursewareid"), new Rows()));
             row.put("tag", DataTag.queryTag(this, "sat_courseware", sat_coursewareid, false));
+            row.putIfAbsent("publishdate","");
+            row.put("role", roleRows);
         }
 
-        return getSucReturnObject().setData(rows.size() > 0 ? rows.get(0) : new Row()).toString();
+        return getSucReturnObject().setData(row).toString();
     }
 
 }