Просмотр исходного кода

列表增加已阅量以及阅读数据统计

hu 1 год назад
Родитель
Сommit
c55f9a046e

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

@@ -5598,6 +5598,10 @@ public class R {
         }
     }
 
+    public static class ID2024082910591603 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 1 - 0
src/custom/restcontroller/webmanage/saletool/notice/SQL/通告列表查询.sql

@@ -16,6 +16,7 @@ SELECT
     t1.readcount,
 		(CASE WHEN  (SELECT COUNT(*) FROM sat_notice_read WHERE  siteid = t1.siteid AND sat_noticeid = t1.sat_noticeid  and createuserid =$userid$)>0 THEN '已读' ELSE '未读' END) readstatus,
     (SELECT COUNT(*) FROM sat_notice_read WHERE  siteid = t1.siteid AND sat_noticeid = t1.sat_noticeid) readpersoncount,
+    (SELECT COUNT(*) FROM sat_notice_read WHERE  siteid = t1.siteid AND sat_noticeid = t1.sat_noticeid and sa_agentsid !=0) readagentcount,
     (SELECT count(*)  FROM sys_attachment_links WHERE   siteid = t1.siteid AND ownerid = t1.sat_noticeid AND ownertable = 'sat_notice' ) attachmentcount
 FROM
     sat_notice t1

+ 14 - 0
src/custom/restcontroller/webmanage/saletool/notice/SQL/通告阅读数据查询.sql

@@ -0,0 +1,14 @@
+SELECT
+    t1.agentnum,
+    t3.enterprisename,
+    t2.createdate,
+    IF
+    ( ifnull( sat_notice_readid, 0 )= 0, '未读', '已读' ) readstatus
+FROM
+    sa_agents t1
+        LEFT JOIN ( SELECT * FROM sat_notice_read WHERE sat_noticeid = $sat_noticeid$ ) t2 ON t1.sa_agentsid = t2.sa_agentsid
+        AND t1.siteid = t2.siteid
+        LEFT JOIN sys_enterprise t3 ON t1.sys_enterpriseid = t3.sys_enterpriseid
+        AND t1.siteid = t3.siteid
+WHERE
+    t1.siteid = $siteid$ and $where$

+ 27 - 0
src/custom/restcontroller/webmanage/saletool/notice/notice.java

@@ -474,6 +474,33 @@ public class notice extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+    @API(title = "通告阅读数据接口", apiversion = R.ID2024082910591603.v1.class)
+    @CACHEING
+    public String queryNoticeReadAgent() throws YosException {
+
+        long sat_noticeid=content.getLongValue("sat_noticeid");
+        String where = " 1=1 ";
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where = where + " and(t1.agentnum like '%" + whereObject.getString("condition")
+                        + "%' or t3.enterprisename like '%" + whereObject.getString("condition") + "%')";
+            }
+            if (whereObject.containsKey("readstatus") && !"".equals(whereObject.getString("readstatus"))) {
+                where = where + " and if(ifnull( sat_notice_readid, 0 )= 0, '未读', '已读') ='" + whereObject.getString("readstatus") + "' ";
+
+            }
+        }
+
+        SQLFactory factory = new SQLFactory(this, "通告阅读数据查询", pageSize, pageNumber, pageSorting);
+        factory.addParameter("sat_noticeid", sat_noticeid);
+        factory.addParameter("siteid", siteid);
+        factory.addParameter_SQL("where", where);
+        Rows rows = dbConnect.runSqlQuery(factory.getSQL());
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+
     @API(title = "更新下载附件记录")
     public String updateDownloadRecord() throws YosException {
         Long sat_noticeid = content.getLong("sat_noticeid");