Pārlūkot izejas kodu

通讯录管理

eganwu 1 gadu atpakaļ
vecāks
revīzija
c28c02d7a4

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

@@ -6463,6 +6463,26 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID20240516144302 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516144402 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516144502 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240516144602 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 1 - 1
src/custom/restcontroller/common/usercenter/usercenter.java

@@ -307,7 +307,7 @@ public class usercenter extends Controller {
      *
      * @return
      */
-    @API(title = "微信账号绑定", apiversion = R.ID20240516090402.v1.class)
+    @API(title = "微信账号绑定", apiversion = R.ID20240516090402.v1.class,accesstoken = false)
     @CACHEING_CLEAN(cms = {@cm(clazz = usercenter.class, method = {"queryUserMsg"})})
     public String WechatBinding() throws YosException {
         String wechat_code = content.getString("wechat_code");

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

@@ -1,8 +1,13 @@
 package restcontroller.webmanage.saletool.phonebook;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.mysql.cj.x.protobuf.MysqlxCrud;
 import common.Controller;
 import common.YosException;
+import common.annotation.API;
+import common.data.*;
+import restcontroller.R;
 
 public class PhoneBook2 extends Controller {
     /**
@@ -13,4 +18,98 @@ public class PhoneBook2 extends Controller {
     public PhoneBook2(JSONObject content) throws YosException {
         super(content);
     }
+
+    @API(title = "通讯录新增或编辑", apiversion = R.ID20240516144302.v1.class)
+    public String insertOrUpdate() throws YosException {
+
+        Long sys_phonebookid = content.getLongValue("sys_phonebookid");
+
+        if (sys_phonebookid <= 0) {
+            sys_phonebookid = createTableID("sys_phonebook");
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_phonebook");
+            insertSQL.setSiteid(siteid);
+            insertSQL.setUniqueid(sys_phonebookid);
+            insertSQL.setValue("userid", userid);
+            insertSQL.setValue("qq", content.getStringValue("qq"));
+            insertSQL.setValue("phonenumber", content.getStringValue("phonenumber"));
+            insertSQL.setValue("wechatnum", content.getStringValue("wechatnum"));
+            insertSQL.setValue("sys_phonebookgroupid", content.getLongValue("sys_phonebookgroupid"));
+            insertSQL.setValue("name", content.getStringValue("name"));
+            insertSQL.setValue("remarks", content.getStringValue("remarks"));
+            insertSQL.setValue("depname", getDepartment(departmentid).getString("depname"));
+            insertSQL.setValue("sourcetable", "");
+            insertSQL.setValue("sourceid", 0);
+            insertSQL.insert();
+        } else {
+            UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_phonebook");
+            updateSQL.setSiteid(siteid);
+            updateSQL.setUniqueid(sys_phonebookid);
+            updateSQL.setValue("userid", userid);
+            updateSQL.setValue("qq", content.getStringValue("qq"));
+            updateSQL.setValue("phonenumber", content.getStringValue("phonenumber"));
+            updateSQL.setValue("wechatnum", content.getStringValue("wechatnum"));
+            updateSQL.setValue("sys_phonebookgroupid", content.getLongValue("sys_phonebookgroupid"));
+            updateSQL.setValue("name", content.getStringValue("name"));
+            updateSQL.setValue("remarks", content.getStringValue("remarks"));
+            updateSQL.update();
+        }
+
+
+        Row row = new Row();
+        row.put("sys_phonebookid", sys_phonebookid);
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "通讯录删除", apiversion = R.ID20240516144402.v1.class)
+    public String delete() throws YosException {
+        JSONArray sys_phonebookids = content.getJSONArray("sys_phonebookids");
+
+
+        DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sys_phonebook");
+        deleteSQL.setSiteid(siteid);
+        deleteSQL.setWhere("sys_phonebookid", sys_phonebookids.toArray());
+        deleteSQL.delete();
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "通讯录列表", apiversion = R.ID20240516144502.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("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and (");
+                where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.remarks like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("groupname") && !"".equals(whereObject.getString("groupname"))) {
+                where.append(" and (");
+                where.append("t2.groupname like'%").append(whereObject.getString("groupname")).append("%' ");
+                where.append(")");
+            }
+
+        }
+
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_phonebook"
+                ,"sys_phonebookid","name","qq","wechatnum","phonenumber","remarks").setTableAlias("t1");
+        querySQL.addJoinTable(JOINTYPE.inner, "sys_phonebookgroup", "t2", "t2.sys_phonebookgroupid=t1.sys_phonebookgroupid and t2.siteid=t1.siteid", "groupname");
+        querySQL.setWhere("t2.classid", 1);
+        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.ID20240516144602.v1.class)
+    public String applist() {
+
+        return getSucReturnObject().toString();
+    }
+
 }

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

@@ -86,6 +86,7 @@ public class PhoneBookGroup2 extends Controller {
         }
 
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_phonebookgroup").setTableAlias("t1");
+        querySQL.setWhere("classid",1);
         querySQL.setSiteid(siteid);
         querySQL.setWhere(where.toString());
         querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);