Bladeren bron

长图文管理

eganwu 2 jaren geleden
bovenliggende
commit
934fac74b2

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

@@ -5942,6 +5942,36 @@ public class R {
         }
     }
 
+    public static class ID20240329131402 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240329131502 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240329131702 {
+        public static class v1 {
+        }
+    }
+    public static class ID20240329131802 {
+        public static class v1 {
+        }
+    }
+    public static class ID20240329131902 {
+        public static class v1 {
+        }
+    }
+    public static class ID20240329132002 {
+        public static class v1 {
+        }
+    }
+
+
+
+
 }
 
 

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

@@ -123,7 +123,7 @@ public class coursewaredetail extends Controller {
 
         ArrayList<Long> ids = rows.toArrayList("sat_coursewaredetailid", new ArrayList<>());
         //附件
-        RowsMap attRowsMap = getAttachmentUrl("sat_coursewaredetail", ids, "default");
+        RowsMap attRowsMap = getAttachmentUrl("sat_coursewaredetail", ids);
 
         Row detailRow = new Row();
         if (rows.isNotEmpty()) {

+ 154 - 0
src/custom/restcontroller/webmanage/saletool/sharematerial/LongPicText.java

@@ -0,0 +1,154 @@
+package restcontroller.webmanage.saletool.sharematerial;
+
+import beans.time.Time;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.data.*;
+import restcontroller.R;
+
+public class LongPicText extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public LongPicText(JSONObject content) throws YosException {
+        super(content);
+    }
+
+    @API(title = "长图文新增或更新", apiversion = R.ID20240329131402.v1.class)
+    public String insertOrUpdate() throws YosException {
+
+        Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
+
+        Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
+        JSONObject jsonObject = new JSONObject();
+        if (rows.isNotEmpty()) {
+            jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
+        }
+        jsonObject.put("style_bottom", content.getStringValue("style_bottom"));
+        jsonObject.put("style_signup", content.getStringValue("style_signup"));
+
+        if (sat_sharematerialid <= 0) {
+            jsonObject.put("pics", new JSONArray());
+            sat_sharematerialid = createTableID("sat_sharematerial");
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_sharematerial");
+            insertSQL.setSiteid(siteid);
+            insertSQL.setUniqueid(sat_sharematerialid);
+            insertSQL.setValue("classid", "2");
+            insertSQL.setValue("sys_enterpriseid", sys_enterpriseid);
+            insertSQL.setValue("type", content.getIntValue("type"));
+            insertSQL.setValue("title", content.getStringValue("title"));
+            insertSQL.setValue("sharepagecontrol", jsonObject);
+            insertSQL.setValue("content", content.getStringValue("content"));
+            insertSQL.insert();
+            content.put("sat_sharematerialid", sat_sharematerialid);
+        }
+
+        if (sat_sharematerialid > 0) {
+
+
+            UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
+            updateSQL.setSiteid(siteid);
+            updateSQL.setUniqueid(sat_sharematerialid);
+            updateSQL.setValue("classid", "2");
+            updateSQL.setValue("sys_enterpriseid", sys_enterpriseid);
+            updateSQL.setValue("type", content.getIntValue("type"));
+            updateSQL.setValue("title", content.getStringValue("title"));
+            updateSQL.setValue("sharepagecontrol", jsonObject);
+            updateSQL.setValue("content", content.getStringValue("content"));
+            updateSQL.update();
+        }
+
+
+        return detail();
+    }
+
+    @API(title = "长图文详情", apiversion = R.ID20240329131502.v1.class)
+    public String detail() throws YosException {
+
+        Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
+
+        QuerySQL querySQ = SQLFactory.createQuerySQL(this, "sat_sharematerial")
+                .setTableAlias("t1");
+        querySQ.setSiteid(siteid);
+        querySQ.setWhere("sat_sharematerialid", sat_sharematerialid);
+
+        Rows rows = querySQ.query();
+        Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
+        //1:图片;2:视频;3:图文
+        if (detailRow.getInteger("type") == 1) {
+            detailRow.put("typestr", "图片");
+        }
+        if (detailRow.getInteger("type") == 2) {
+            detailRow.put("typestr", "视频");
+        }
+        if (detailRow.getInteger("type") == 3) {
+            detailRow.put("typestr", "图文");
+        }
+
+        Rows attRows = getAttachmentUrl("sat_sharematerial", sat_sharematerialid);
+        detailRow.put("attinfos", attRows);
+
+
+        return getSucReturnObject().setData(detailRow).toString();
+    }
+
+
+    @API(title = "长图文上下架", apiversion = R.ID20240329131702.v1.class)
+    public String updateStatus() throws YosException {
+
+        JSONArray sat_sharematerialids = content.getJSONArray("sat_sharematerialids");
+        int status = content.getIntValue("status");
+
+        UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
+        updateSQL.setSiteid(siteid);
+        updateSQL.setWhere("sat_sharematerialid", sat_sharematerialids);
+        updateSQL.setValue("status", status == 0 ? "新建" : "发布");
+        updateSQL.setValue("checkdate", status == 0 ? "null" : Time.getDateTime_Str());
+        updateSQL.setValue("checkby", status == 0 ? "null" : username);
+        updateSQL.update();
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "长图文列表", apiversion = R.ID20240329131802.v1.class)
+    public String list() {
+
+
+        return getSucReturnObject().toString();
+    }
+
+
+    @API(title = "长图文绑定图片信息", apiversion = R.ID20240329131902.v1.class)
+    public String updatePicInfo() throws YosException {
+
+        Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
+
+        Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
+        JSONObject jsonObject = new JSONObject();
+        JSONArray jsonArray = new JSONArray();
+        if (rows.isNotEmpty()) {
+            jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
+            jsonArray = rows.get(0).getJSONArray("pics");
+        }
+
+
+        UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
+        updateSQL.setSiteid(siteid);
+        updateSQL.setUniqueid(sat_sharematerialid);
+
+        updateSQL.setValue("sharepagecontrol", jsonObject);
+        updateSQL.update();
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "长图文解绑图片信息", apiversion = R.ID20240329132002.v1.class)
+    public String deletePicInfo() {
+        return getSucReturnObject().toString();
+    }
+}