|
|
@@ -26,7 +26,6 @@ public class notice extends Controller {
|
|
|
}
|
|
|
|
|
|
@API(title = "通告列表", apiversion = R.ID20221111090904.v1.class)
|
|
|
- @CACHEING
|
|
|
public String queryNoticeList() throws YosException {
|
|
|
String where = " 1=1 ";
|
|
|
if (content.containsKey("where")) {
|
|
|
@@ -38,10 +37,17 @@ public class notice extends Controller {
|
|
|
where = where + " and t1.sat_notice_classid = " + whereObject.getString("sat_notice_classid");
|
|
|
}
|
|
|
if (whereObject.containsKey("isread") && !"".equals(whereObject.getString("isread"))) {
|
|
|
- if (whereObject.getBooleanValue("isread")) {
|
|
|
- where = where + " and (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)='已读'";
|
|
|
- } else {
|
|
|
- where = where + " and (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)='未读'";
|
|
|
+ //已读
|
|
|
+ if (whereObject.getLongValue("isread") == 0) {
|
|
|
+ where = where + " and t3.confirmed =0";
|
|
|
+ }
|
|
|
+ //已知
|
|
|
+ if (whereObject.getLongValue("isread") == 1) {
|
|
|
+ where = where + " and t3.confirmed =1";
|
|
|
+ }
|
|
|
+ //未读
|
|
|
+ if (whereObject.getLongValue("isread") == 2) {
|
|
|
+ where = where + " and t3.confirmed is null";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -59,11 +65,14 @@ public class notice extends Controller {
|
|
|
if (sa_saleareaids.size() == 0) {
|
|
|
sa_saleareaids.add(-1l);
|
|
|
}
|
|
|
-
|
|
|
- ArrayList<Long> roleids = dbConnect.runSqlQuery("SELECT roleid from sys_userrole WHERE userid=23797 and siteid='" + siteid + "' ").toArrayList("roleid", new ArrayList<>());
|
|
|
+ userid = 23797;
|
|
|
+ ArrayList<Long> roleids = dbConnect.runSqlQuery("SELECT roleid from sys_userrole WHERE userid=" + userid + " and siteid='" + siteid + "' ").toArrayList("roleid", new ArrayList<>());
|
|
|
if (roleids.size() == 0) {
|
|
|
roleids.add(-1L);
|
|
|
}
|
|
|
+ if (pageSorting.equals("''")) {
|
|
|
+ pageSorting = "t1.checkdate desc";
|
|
|
+ }
|
|
|
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "通告列表查询", pageSize, pageNumber, pageSorting);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
@@ -77,33 +86,35 @@ public class notice extends Controller {
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
|
|
|
|
|
|
- ArrayList<Long> ids = rows.toArrayList("sat_noticeid", new ArrayList<Long>());
|
|
|
- // 封面cover
|
|
|
- RowsMap coverRowsMap = getAttachmentUrl("sat_notice", ids, "cover");
|
|
|
- // 附件
|
|
|
- RowsMap RowsMap = getAttachmentUrl("sat_notice", ids);
|
|
|
+// ArrayList<Long> ids = rows.toArrayList("sat_noticeid", new ArrayList<Long>());
|
|
|
+// // 封面cover
|
|
|
+// RowsMap coverRowsMap = getAttachmentUrl("sat_notice", ids, "cover");
|
|
|
+// // 附件
|
|
|
+// RowsMap RowsMap = getAttachmentUrl("sat_notice", ids);
|
|
|
for (Row row : rows) {
|
|
|
- Rows Rows = RowsMap.get(row.getString("sat_noticeid"));
|
|
|
- if (Rows.isEmpty()) {
|
|
|
- row.put("attinfos", new Rows());
|
|
|
- } else {
|
|
|
- row.put("attinfos", Rows);
|
|
|
+// Rows Rows = RowsMap.get(row.getString("sat_noticeid"));
|
|
|
+// if (Rows.isEmpty()) {
|
|
|
+// row.put("attinfos", new Rows());
|
|
|
+// } else {
|
|
|
+// row.put("attinfos", Rows);
|
|
|
+// }
|
|
|
+// Rows coverRows = coverRowsMap.get(row.getString("sat_noticeid"));
|
|
|
+// if (coverRows.isEmpty()) {
|
|
|
+// row.put("cover", "");
|
|
|
+// } else {
|
|
|
+// row.put("cover", coverRows.get(0).getString("url"));
|
|
|
+// }
|
|
|
+ if (row.getLong("confirmed") == 0) {
|
|
|
+ row.putIfAbsent("readstatus", "已读");
|
|
|
+ }
|
|
|
+ if (row.getLong("confirmed") == 1) {
|
|
|
+ row.putIfAbsent("readstatus", "已知");
|
|
|
}
|
|
|
- Rows coverRows = coverRowsMap.get(row.getString("sat_noticeid"));
|
|
|
- if (coverRows.isEmpty()) {
|
|
|
- row.put("cover", "");
|
|
|
- } else {
|
|
|
- row.put("cover", coverRows.get(0).getString("url"));
|
|
|
+ if (row.getLong("confirmed") == 2) {
|
|
|
+ row.putIfAbsent("readstatus", "未读");
|
|
|
}
|
|
|
}
|
|
|
-// SQLFactory sqlFactorycount = new SQLFactory(this, "通告列表总数量查询");
|
|
|
-// sqlFactorycount.addParameter("siteid", siteid);
|
|
|
-// sqlFactorycount.addParameter_in("departmentid", departmentid);
|
|
|
-// sqlFactorycount.addParameter_in("userid", userid);
|
|
|
-// sqlFactorycount.addParameter_in("hrid", hrid);
|
|
|
-// sqlFactorycount.addParameter_in("sa_agentsid", userInfo.getAgentID());
|
|
|
-// sqlFactorycount.addParameter_in("sa_saleareaid", userInfo.getSaleAreaIds());
|
|
|
-// Row readrow = dbConnect.runSqlQuery(0, sqlFactorycount);
|
|
|
+
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("readNum", rows.getTotalRows());
|
|
|
|