Kaynağa Gözat

Merge branch 'develop-green' into develop2

# Conflicts:
#	src/custom/restcontroller/R.java
#	src/custom/restcontroller/webmanage/saletool/notice/SQL/通告列表查询.sql
hu 1 yıl önce
ebeveyn
işleme
aad8283f71

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

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

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

@@ -9,6 +9,12 @@ SELECT
     t1.checkdate,
     t1.status,
     t1.readcount
+    t1.isontop,
+    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
         LEFT JOIN sat_notice_class t2 ON t1.sat_notice_classid = t2.sat_notice_classid

+ 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

@@ -454,6 +454,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");