Browse Source

通讯录分组

eganwu 1 year ago
parent
commit
202ca8891e

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

@@ -6443,6 +6443,26 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID20240516135002 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516135102 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516135202 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516135302 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 16 - 0
src/custom/restcontroller/webmanage/saletool/phonebook/PhoneBook2.java

@@ -0,0 +1,16 @@
+package restcontroller.webmanage.saletool.phonebook;
+
+import com.alibaba.fastjson.JSONObject;
+import common.Controller;
+import common.YosException;
+
+public class PhoneBook2 extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public PhoneBook2(JSONObject content) throws YosException {
+        super(content);
+    }
+}

+ 110 - 0
src/custom/restcontroller/webmanage/saletool/phonebook/PhoneBookGroup2.java

@@ -0,0 +1,110 @@
+package restcontroller.webmanage.saletool.phonebook;
+
+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 PhoneBookGroup2 extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public PhoneBookGroup2(JSONObject content) throws YosException {
+        super(content);
+    }
+
+    @API(title = "通讯录分组新增或编辑", apiversion = R.ID20240516135002.v1.class)
+    public String insertOrUpdate() throws YosException {
+        long sys_phonebookgroupid = content.getLongValue("sys_phonebookgroupid");
+        if (sys_phonebookgroupid <= 0) {
+            sys_phonebookgroupid = createTableID("sys_phonebookgroup");
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_phonebookgroup");
+            insertSQL.setSiteid(siteid);
+            insertSQL.setUniqueid(sys_phonebookgroupid);
+            insertSQL.setValue("groupname", content.getStringValue("groupname"));
+            insertSQL.setValue("classid", 1);
+            insertSQL.setValue("isenable", content.getBooleanValue("isenable"));
+            insertSQL.setValue("sequence", content.getLongValue("sequence", 1L));
+            insertSQL.insert();
+        } else {
+            UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_phonebookgroup");
+            updateSQL.setSiteid(siteid);
+            updateSQL.setUniqueid(sys_phonebookgroupid);
+            updateSQL.setValue("groupname", content.getStringValue("groupname"));
+            updateSQL.setValue("isenable", content.getBooleanValue("isenable"));
+            updateSQL.setValue("sequence", content.getLongValue("sequence", 1L));
+            updateSQL.update();
+        }
+
+        Row row = new Row();
+        row.put("sys_phonebookgroupid", sys_phonebookgroupid);
+
+        return getSucReturnObject().setData(row).toString();
+    }
+
+    @API(title = "通讯录分组删除", apiversion = R.ID20240516135102.v1.class)
+    public String delete() throws YosException {
+        JSONArray sys_phonebookgroupids = content.getJSONArray("sys_phonebookgroupids");
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_phonebook").setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("sys_phonebookgroupid", sys_phonebookgroupids);
+        Rows rows = querySQL.query();
+        if (rows.isNotEmpty()) {
+            return getErrReturnObject().setErrMsg("当前分组已有数据,不可删除").toString();
+        }
+
+        DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sys_phonebookgroup");
+        deleteSQL.setSiteid(siteid);
+        deleteSQL.setWhere("sys_phonebookgroupid", sys_phonebookgroupids.toArray());
+        deleteSQL.delete();
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "通讯录分组列表", apiversion = R.ID20240516135202.v1.class)
+    public String list() throws YosException {
+
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("isenable") && !"".equals(whereObject.getString("isenable"))) {
+                where.append(" and (");
+                where.append("isenable=" + whereObject.getBoolean("isenable"));
+                where.append(")");
+            }
+
+        }
+
+        if (pageSorting.equals("''")) {
+            pageSorting = "t1.sequence";
+        }
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_phonebookgroup").setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere(where.toString());
+        querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
+        Rows rows = querySQL.query();
+
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "通讯录分组启用停用", apiversion = R.ID20240516135302.v1.class)
+    public String isenable() throws YosException {
+        JSONArray sys_phonebookgroupids = content.getJSONArray("sys_phonebookgroupids");
+
+        UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_phonebookgroup");
+        updateSQL.setSiteid(siteid);
+        updateSQL.setValue("isenable", content.getBooleanValue("isenable"));
+        updateSQL.setWhere("sys_phonebookgroupid ", sys_phonebookgroupids.toArray());
+        updateSQL.update();
+        return getSucReturnObject().toString();
+    }
+
+}

+ 19 - 12
src/custom/restcontroller/webmanage/users/visitors.java

@@ -60,7 +60,7 @@ public class visitors extends Controller {
 
         row.putAll(getUser(userid));
         row.put("headpic", getHeadPic(userid));
-        row.put("attinfos", Attachment.get(this,"sys_users",userid,"headportrait"));
+        row.put("attinfos", Attachment.get(this, "sys_users", userid, "headportrait"));
         //查询角色
         Rows rolenameRows = dbConnect.runSqlQuery("select rolename from sys_userrole t1 " +
                 "inner join sys_role t2 ON t2.roleid=t1.roleid and t2.siteid=t1.siteid " +
@@ -88,9 +88,9 @@ public class visitors extends Controller {
                 "WHERE t2.sys_enterpriseid=" + sys_enterpriseid + " and t1.siteid='" + siteid + "'");
 
         row.put("areaname", StringUtils.join(areaRows.toArray("areaname"), ","));
-        row.put("sys_enterpriseid",sys_enterpriseid);
+        row.put("sys_enterpriseid", sys_enterpriseid);
 
-        row.put("enterprise_hr",userInfo.getEnterprise_HrRow());
+        row.put("enterprise_hr", userInfo.getEnterprise_HrRow());
 
         return getSucReturnObject().setData(row).toString();
     }
@@ -104,7 +104,7 @@ public class visitors extends Controller {
         insertSQL.setUniqueid(createTableID("sys_datacollect"));
         insertSQL.setSiteid(siteid);
         insertSQL.setValue("userid", userid);
-        insertSQL.setValue("ownertable", "sys_user");
+        insertSQL.setValue("ownertable", "sys_users");
         insertSQL.setValue("ownerid", tempuserid);
         insertSQL.setValue("type", 3);
         insertSQL.insert();
@@ -124,25 +124,32 @@ public class visitors extends Controller {
                 "WHERE t1.userid=" + tempuserid + " and t1.siteid='" + siteid + "'");
         row.put("rolenames", StringUtils.join(rolenameRows.toArray("rolename"), ","));
 
-        Rows attinfoRows = Attachment.get(this, "sys_user", tempuserid);
+        Rows attinfoRows = Attachment.get(this, "sys_users", tempuserid);
         row.put("attinfos", attinfoRows);
 
         //标签
-        ArrayList<String> tagList = DataTag.queryTag(this, "sys_user", tempuserid, false);
+        ArrayList<String> tagList = DataTag.queryTag(this, "sys_users", tempuserid, false);
         //系统标签
-        tagList.addAll(DataTag.queryTag(this, "sys_user", tempuserid, true));
+        tagList.addAll(DataTag.queryTag(this, "sys_users", tempuserid, true));
         row.put("tag", tagList);
 
-        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=2 and ownertable='sys_user' and ownerid='" + tempuserid + "'");
+        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=2 and ownertable='sys_users' and ownerid='" + tempuserid + "'");
         row.put("count_like", rows.get(0).getLong("count"));
 
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_user' and ownerid='" + tempuserid + "'");
+        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_users' and ownerid='" + tempuserid + "'");
         row.put("count_read", rows.get(0).getLong("count"));
 
-        rows= dbConnect.runSqlQuery("SELECT userid,max(createdate) createdate from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_user' and ownerid='" + tempuserid + "' GROUP  BY userid LIMIT 3");
+        if (dbConnect.runSqlQuery("SELECT * from sys_datacollect WHERE  siteid='" + siteid + "' and type=2 and ownertable='sys_users' and ownerid='" + tempuserid + "' and userid=" + userid).isNotEmpty()) {
+            row.put("islike", 1);
+        } else {
+            row.put("islike", 0);
+        }
+
+
+        rows = dbConnect.runSqlQuery("SELECT userid,max(createdate) createdate from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_users' and ownerid='" + tempuserid + "' GROUP  BY userid LIMIT 3");
 
-        for (Row readrow:rows) {
-            readrow.put("headpic",getHeadPic(readrow.getLong("userid")));
+        for (Row readrow : rows) {
+            readrow.put("headpic", getHeadPic(readrow.getLong("userid")));
         }
         row.put("readusers", rows);