Przeglądaj źródła

效果实景管理

eganwu 1 rok temu
rodzic
commit
7232798bf4

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

@@ -6065,6 +6065,11 @@ public class R {
         }
     }
 
+    public static class ID20240417144702 {
+        public static class v1 {
+        }
+    }
+
 }
 
 

+ 101 - 7
src/custom/restcontroller/webmanage/saletool/sharematerial/DesignPic.java

@@ -1,6 +1,7 @@
 package restcontroller.webmanage.saletool.sharematerial;
 
 import beans.attachment.Attachment;
+import beans.time.Time;
 import com.alibaba.fastjson.JSONObject;
 import common.Controller;
 import common.YosException;
@@ -30,6 +31,8 @@ public class DesignPic extends Controller {
     public String insertOrUpdate() throws YosException {
         Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
 
+        boolean ispublish = content.getBooleanValue("ispublish");
+
         if (content.containsKey("sys_enterpriseid") && content.getLongValue("sys_enterpriseid") > 0) {
             sys_enterpriseid = content.getLongValue("sys_enterpriseid");
         }
@@ -67,6 +70,16 @@ public class DesignPic extends Controller {
             sqlFactory.update();
         }
 
+        if (ispublish) {
+            UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
+            updateSQL.setSiteid(siteid);
+            updateSQL.setWhere("sat_sharematerialid", sat_sharematerialid);
+            updateSQL.setValue("status", "发布");
+            updateSQL.setValue("checkdate", Time.getDateTime_Str());
+            updateSQL.setValue("checkby", username);
+            updateSQL.update();
+        }
+
 
         return detail();
     }
@@ -229,7 +242,7 @@ public class DesignPic extends Controller {
                         "sat_sharematerialid", "title", "status", "type", "commentcount", "likecount", "collectcount", "sequence", "createdate", "checkdate", "renderingsclass")
                 .setTableAlias("t1");
         querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t3", "t3.sys_enterpriseid=t1.sys_enterpriseid and t3.siteid=t1.siteid"
-                , "enterprisename","sys_enterpriseid");
+                , "enterprisename", "sys_enterpriseid");
         querySQL.setSiteid(siteid);
         querySQL.setWhere("classid", 5);
         querySQL.setWhere(where.toString());
@@ -263,18 +276,99 @@ public class DesignPic extends Controller {
                 row.put("typestr", "实景");
             }
             Rows areas = areaRows.getOrDefault(row.getString("sys_enterpriseid"), new Rows());
-            String areaname=StringUtils.join(areas.toArray("areaname"), ",");
-            row.put("areaname",areaname);
-            if(StringUtils.isBlank(areaname)){
-                row.put("enterprisename_area",row.getString("enterprisename"));
-            }else {
-                row.put("enterprisename_area",row.getString("enterprisename")+"("+row.getString("areaname")+")");
+            String areaname = StringUtils.join(areas.toArray("areaname"), ",");
+            row.put("areaname", areaname);
+            if (StringUtils.isBlank(areaname)) {
+                row.put("enterprisename_area", row.getString("enterprisename"));
+            } else {
+                row.put("enterprisename_area", row.getString("enterprisename") + "(" + row.getString("areaname") + ")");
+            }
+
+        }
+
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "小程序设计实景列表", apiversion = R.ID20240417144702.v1.class)
+    public String miniapplist() throws YosException {
+        /*
+          过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and (");
+                where.append("t1.title like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+
+            if (whereObject.containsKey("type") && !"".equals(whereObject.getString("type"))) {
+                where.append(" and (");
+                where.append("t1.type ='").append(whereObject.getString("type")).append("' ");
+                where.append(")");
+            }
+
+            if (whereObject.containsKey("style") && !"".equals(whereObject.getString("style"))) {
+                where.append(" and (");
+                where.append("JSON_CONTAINS(t1.renderingsclass->'$.style', '\"" + whereObject.getString("style") + "\"')");
+                where.append(")");
+
+            }
+            if (whereObject.containsKey("space") && !"".equals(whereObject.getString("space"))) {
+                where.append(" and (");
+                where.append("JSON_CONTAINS(t1.renderingsclass->'$.space', '\"" + whereObject.getString("space") + "\"')");
+                where.append(")");
+
+            }
+            if (whereObject.containsKey("spec") && !"".equals(whereObject.getString("spec"))) {
+                where.append(" and (");
+                where.append("JSON_CONTAINS(t1.renderingsclass->'$.spec', '\"" + whereObject.getString("spec") + "\"')");
+                where.append(")");
+
             }
 
+            if (whereObject.containsKey("spec") && !"".equals(whereObject.getString("spec"))) {
+                where.append(" and (");
+                where.append("JSON_CONTAINS(t1.renderingsclass->'$.spec', '\"" + whereObject.getString("spec") + "\"')");
+                where.append(")");
+
+            }
+
+
+        }
+
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, sat_sharematerial,
+                        "sat_sharematerialid", "title", "title_c", "commentcount", "likecount", "collectcount", "createuserid", "createby", "createdate")
+                .setTableAlias("t1");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_datacollect", "t2", "t2.siteid=t1.siteid and t2.ownertable='sat_sharematerial' and type=1 and t2.ownerid=t1.sat_sharematerialid and t2.userid='" + userid + "'");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t3", "t3.sys_enterpriseid=t1.sys_enterpriseid and t3.siteid=t1.siteid"
+                , "enterprisename", "sys_enterpriseid");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_datacollect", "t4", "t4.siteid=t1.siteid and t4.ownertable='sat_sharematerial' and type=2 and t4.ownerid=t1.sat_sharematerialid and t4.userid='" + userid + "'");
+        querySQL.addQueryFields("iscollect", "CASE WHEN t2.sys_datacollectid>0 THEN 1 ELSE 0 END");
+        querySQL.addQueryFields("islike", "CASE WHEN t2.sys_datacollectid>0 THEN 1 ELSE 0 END");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("classid", 5);
+        querySQL.setWhere(where.toString());
+        querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
+        Rows rows = querySQL.query();
+
+        ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
+        // 附件
+        RowsMap RowsMap = getAttachmentUrl(sat_sharematerial, ids);
+        for (Row row : rows) {
+            Rows Rows = RowsMap.getOrDefault(row.getString("sat_sharematerialid"), new Rows());
+            row.put("attinfos", Rows);
+            row.put("headpic", getHeadPic(row.getLong("createuserid")));
+
+
         }
 
 
         return getSucReturnObject().setData(rows).toString();
     }
 
+
 }