Przeglądaj źródła

课件管理,每日一签

eganwu 1 rok temu
rodzic
commit
a1eec3946b

+ 4 - 4
src/custom/restcontroller/webmanage/saletool/courseware/coursewaredetail.java

@@ -43,7 +43,7 @@ public class coursewaredetail extends Controller {
             insertSQL.setValue("description", content.getStringValue("description"));
             insertSQL.setValue("sequence", content.getLongValue("sequence"));
             insertSQL.setValue("teacher", content.getStringValue("teacher"));
-            insertSQL.setValue("status", "新建");
+            insertSQL.setValue("status", "下架");
             insertSQL.setValue("filetype", content.getStringValue("filetype"));//图片、视频、pdf
             insertSQL.insert();
 
@@ -74,7 +74,7 @@ public class coursewaredetail extends Controller {
 
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_coursewaredetail");
         updateSQL.setSiteid(siteid);
-        updateSQL.setValue("status", type == 0 ? "新建" : "发布");
+        updateSQL.setValue("status", type == 0 ? "上架" : "下架");
         updateSQL.setValue("sendby", type == 0 ? "null" : username);
         updateSQL.setValue("senddate", type == 0 ? "null" : getDateTime_Str());
         updateSQL.setWhere("sat_coursewaredetailid", sat_coursewaredetailids.toArray());
@@ -94,8 +94,8 @@ public class coursewaredetail extends Controller {
             if (rows.isEmpty()) {
                 return getErrReturnObject().setErrMsg("课件不存在").toString();
             }
-            if (!rows.get(0).getString("status").equals("新建")) {
-                return getErrReturnObject().setErrMsg("非新建状态不可删除").toString();
+            if (!rows.get(0).getString("status").equals("下架")) {
+                return getErrReturnObject().setErrMsg("非下架状态不可删除").toString();
             }
         }
 

+ 30 - 9
src/custom/restcontroller/webmanage/saletool/sharematerial/DailySign.java

@@ -31,13 +31,19 @@ public class DailySign extends Controller {
 
         Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
 
+        String ondate = content.getStringValueForDate("ondate", "yyyy-MM-dd", "null");
+        if (!ondate.equals("null") && dbConnect.runSqlQuery("SELECT 1 from sat_sharematerial WHERE ondate='" + ondate + "' and siteid='" + siteid + "' and sat_sharematerialid != " + sat_sharematerialid).isNotEmpty()) {
+            return getErrReturnObject().setErrMsg("上档日期已存在").toString();
+        }
+
+
         if (sat_sharematerialid <= 0) {
             sat_sharematerialid = createTableID(sat_sharematerial);
             InsertSQL sqlFactory = SQLFactory.createInsertSQL(this, sat_sharematerial);
             sqlFactory.setSiteid(siteid);
             sqlFactory.setUniqueid(sat_sharematerialid);
             sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
-            sqlFactory.setValue("ondate", content.getStringValueForDate("ondate", "yyyy-MM-dd", "null"));
+            sqlFactory.setValue("ondate", ondate);
             sqlFactory.setValue("isqrcode", content.getBooleanValue("isqrcode"));
             sqlFactory.setValue("qrcodecontent", content.getStringValue("qrcodecontent", true));
             sqlFactory.setValue("notes", content.getStringValue("notes"));
@@ -50,7 +56,7 @@ public class DailySign extends Controller {
             UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(this, sat_sharematerial);
             sqlFactory.setUniqueid(sat_sharematerialid);
             sqlFactory.setSiteid(siteid);
-            sqlFactory.setValue("ondate", content.getStringValueForDate("ondate", "yyyy-MM-dd", "null"));
+            sqlFactory.setValue("ondate", ondate);
             sqlFactory.setValue("isqrcode", content.getBooleanValue("isqrcode"));
             sqlFactory.setValue("qrcodecontent", content.getStringValue("qrcodecontent", true));
             sqlFactory.setValue("notes", content.getStringValue("notes"));
@@ -135,14 +141,29 @@ public class DailySign extends Controller {
                 where.append("t1.createdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
                 where.append(")");
             }
+            if (whereObject.containsKey("week") && !"".equals(whereObject.getString("week"))) {
+                int week = whereObject.getIntValue("week");
+                if (week == 0) {
+                    where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE))");
+                }
+                if (week > 0) {
+                    where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE)+" + week + ")");
+                }
+                if (week < 0) {
+                    where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE)-" + Math.abs(week) + ")");
+                }
+
+            }
         }
 
         QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, sat_sharematerial,
                         "sat_sharematerialid", "type", "notes", "isqrcode", "qrcodecontent", "ondate", "readcount", "downloadcount", "createdate")
                 .setTableAlias("t1");
         sqlFactory.setSiteid(siteid);
+        sqlFactory.setWhere("classid", 1);
         sqlFactory.setWhere(where.toString());
         sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
+        System.err.println(sqlFactory.getSQL());
         Rows rows = sqlFactory.query();
 
         ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
@@ -172,23 +193,23 @@ public class DailySign extends Controller {
             }
         }
 
-        boolean isdownload=content.getBooleanValue("isdownload");
-        Long sat_sharematerialid=content.getLongValue("sat_sharematerialid");
+        boolean isdownload = content.getBooleanValue("isdownload");
+        Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
 
         QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, "sat_sharematerial_read")
                 .setTableAlias("t1");
-        sqlFactory.addJoinTable(JOINTYPE.left,"sys_users","t2","t2.userid=t1.createuserid","name");
-        sqlFactory.addQueryFields("address","''");
+        sqlFactory.addJoinTable(JOINTYPE.left, "sys_users", "t2", "t2.userid=t1.createuserid", "name");
+        sqlFactory.addQueryFields("address", "''");
         sqlFactory.setSiteid(siteid);
         sqlFactory.setWhere(where.toString());
-        sqlFactory.setWhere("isdownload",isdownload);
-        sqlFactory.setWhere("sat_sharematerialid",sat_sharematerialid);
+        sqlFactory.setWhere("isdownload", isdownload);
+        sqlFactory.setWhere("sat_sharematerialid", sat_sharematerialid);
         sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
         Rows rows = sqlFactory.query();
 
         ArrayList<Long> ids = rows.toArrayList("createuserid", new ArrayList<>());
         // 附件
-        RowsMap RowsMap = Attachment.get(this,"sys_users",ids);
+        RowsMap RowsMap = Attachment.get(this, "sys_users", ids);
         for (Row row : rows) {
             Rows Rows = RowsMap.getOrDefault(row.getString("createuserid"), new Rows());
             row.put("attinfos", Rows);