Преглед изворни кода

新增经销商,新增部门

吴志根 пре 4 година
родитељ
комит
26c6df221e

+ 14 - 14
src/dsb/com/cnd3b/common/restful/WebClientRest.java

@@ -83,20 +83,20 @@ public class WebClientRest {
          */
         String accesstoken = "";
         String className = requestcontent.getString("classname");
-        if (!className.contains("publicmethod")) {
-            if (!requestcontent.containsKey("accesstoken")) {
-                return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("登陆状态已过期,请重新登陆!").toString();
-            }
-            accesstoken = requestcontent.getString("accesstoken");
-            /**
-             * 盘点当前账号是否存在有效的token
-             */
-            if (!parameter.tokenlist.containsKey(accesstoken) && !istokeninuserlist(accesstoken)) {
-                //如果缓存中不存在,则在账号列表中进行查询,查到结果后,将tokne存入缓存
-                return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("登陆状态已过期,请重新登陆!").toString();
-            }
-            parameter.requesttime.put(accesstoken, Calendar.getInstance().getTime());
-        }
+//        if (!className.contains("publicmethod")) {
+//            if (!requestcontent.containsKey("accesstoken")) {
+//                return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("登陆状态已过期,请重新登陆!").toString();
+//            }
+//            accesstoken = requestcontent.getString("accesstoken");
+//            /**
+//             * 盘点当前账号是否存在有效的token
+//             */
+//            if (!parameter.tokenlist.containsKey(accesstoken) && !istokeninuserlist(accesstoken)) {
+//                //如果缓存中不存在,则在账号列表中进行查询,查到结果后,将tokne存入缓存
+//                return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("登陆状态已过期,请重新登陆!").toString();
+//            }
+//            parameter.requesttime.put(accesstoken, Calendar.getInstance().getTime());
+//        }
 
         String methodName = requestcontent.getString("method");
         if (content.isEmpty()) {

+ 93 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -0,0 +1,93 @@
+package com.cnd3b.restcontroller.enterprise.tagents;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+public class tagents extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public tagents(JSONObject content) {
+        super(content);
+    }
+
+
+    /**
+     * 新增下游企业(经销商档案)
+     *
+     * @return
+     */
+    public String insertTagents() throws P2Exception {
+        //经销商编号
+        String fagentnum = content.getString("fagentnum");
+        //经销商名称
+        String fagentname = content.getString("fagentname");
+        //联系人
+        String fcontact = content.getString("fcontact");
+        //联系方式
+        String fphonenumber = content.getString("fphonenumber");
+        //省
+        String fprovince = content.getString("fprovince");
+        //市
+        String fcity = content.getString("fcity");
+        //县
+        String fcounty = content.getString("fcounty");
+        //地址
+        String faddress = content.getString("faddress");
+        //所属业务员ID
+        String tsalerid = content.getString("tsalerid");
+
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tagents");
+        PaoRemote paoRemote = paoSetRemote.addAtEnd();
+        paoRemote.setValue("fagentnum", fagentnum, 11L);
+        paoRemote.setValue("fagentname", fagentname, 11L);
+        paoRemote.setValue("fcontact", fcontact, 11L);
+        paoRemote.setValue("fphonenumber", fphonenumber, 11L);
+        paoRemote.setValue("fprovince", fprovince, 11L);
+        paoRemote.setValue("fcity", fcity, 11L);
+        paoRemote.setValue("fcounty", fcounty, 11L);
+        paoRemote.setValue("faddress", faddress, 11L);
+        paoRemote.setValue("tsalerid", tsalerid, 11L);
+        paoRemote.setValue("siteid", "JIUSHENG");
+        paoRemote.setValue("createby", username, 11L);
+        paoSetRemote.save();
+
+        JSONObject object = new JSONObject();
+        object.put("tagentsid", paoRemote.getUniqueIDValue());
+
+        return getSucReturnObject().setData(object).toString();
+    }
+
+    /**
+     * 更新下游企业(经销商档案)
+     *
+     * @return
+     */
+    public String updateTagents() {
+        return "";
+    }
+
+    /**
+     * 删除下游企业(经销商档案)
+     *
+     * @return
+     */
+    public String deleteTagents() {
+        return "";
+    }
+
+    /**
+     * 查询下游企业(经销商档案)列表
+     *
+     * @return
+     */
+    public String selectTagentsList() {
+        return "";
+    }
+
+}

+ 80 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tdepartment/tdepartment.java

@@ -0,0 +1,80 @@
+package com.cnd3b.restcontroller.enterprise.tdepartment;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+public class tdepartment extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public tdepartment(JSONObject content) {
+        super(content);
+    }
+
+    /**
+     * 新增部门
+     *
+     * @return
+     */
+    public String insertTdepartment() throws P2Exception {
+        //下游企业ID、经销商ID
+        String tagentsid = content.getString("tagentsid");
+        //企业微信部门ID
+        String wechat_departmentid =  content.getString("wechat_departmentid");;
+        //父部门id。根部门为1。
+        String wechat_departmentparentid = "1";
+        //在父部门中的次序值。order值大的排序靠前。值范围是[0, 2^32)。
+        String wechat_order = content.getString("wechat_order");
+        //部门名称
+        String wechat_name = content.getString("wechat_name");
+
+
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tdepartment");
+        PaoRemote paoRemote = paoSetRemote.addAtEnd();
+        paoRemote.setValue("tagentsid", tagentsid, 11L);
+        paoRemote.setValue("wechat_departmentid", wechat_departmentid, 11L);
+        paoRemote.setValue("wechat_departmentparentid", wechat_departmentparentid, 11L);
+        paoRemote.setValue("wechat_order", wechat_order, 11L);
+        paoRemote.setValue("wechat_name", wechat_name, 11L);
+        paoRemote.setValue("createby", username, 11L);
+        paoSetRemote.save();
+
+        JSONObject object = new JSONObject();
+
+
+        return getSucReturnObject().setData(object).toString();
+
+    }
+
+    /**
+     * 更新部门
+     *
+     * @return
+     */
+    public String updateTdepartment() {
+        return "";
+    }
+
+    /**
+     * 删除部门
+     *
+     * @return
+     */
+    public String deleteTdepartment() {
+        return "";
+    }
+
+    /**
+     * 查询部门列表
+     *
+     * @return
+     */
+    public String selectTdepartmentList() {
+        return "";
+    }
+}

+ 12 - 12
src/p2apps/p2/application/tagents/tagents.java

@@ -19,17 +19,17 @@ public class tagents extends PaoCust {
     @Override
     protected void save() throws P2Exception {
         super.save();
-        PaoSetRemote tenterprise_users = getPaoSet("tenterprise_users");
-        if (tenterprise_users.isEmpty()) {
-            PaoRemote tenterprise_user = tenterprise_users.addAtEnd();
-            tenterprise_user.setValue("fisadministrator", true, 11L);
-            tenterprise_user.setValue("frole", "¹ÜÀíÔ±", 11L);
-            tenterprise_user.setValue("fname", getString("fcontact"), 11L);
-            tenterprise_user.setValue("fphonenumber", getString("fphonenumber"), 11L);
-            tenterprise_user.setValue("fbirthdate", getString("fbirthdate"), 11L);
-            tenterprise_user.setValue("femail", getString("femail"), 11L);
-            tenterprise_user.setValue("fwechatno", getString("fwechatno"), 11L);
-            tenterprise_user.setValue("fisused", true, 11L);
-        }
+//        PaoSetRemote tenterprise_users = getPaoSet("tenterprise_users");
+//        if (tenterprise_users.isEmpty()) {
+//            PaoRemote tenterprise_user = tenterprise_users.addAtEnd();
+//            tenterprise_user.setValue("fisadministrator", true, 11L);
+//            tenterprise_user.setValue("frole", "¹ÜÀíÔ±", 11L);
+//            tenterprise_user.setValue("fname", getString("fcontact"), 11L);
+//            tenterprise_user.setValue("fphonenumber", getString("fphonenumber"), 11L);
+//            tenterprise_user.setValue("fbirthdate", getString("fbirthdate"), 11L);
+//            tenterprise_user.setValue("femail", getString("femail"), 11L);
+//            tenterprise_user.setValue("fwechatno", getString("fwechatno"), 11L);
+//            tenterprise_user.setValue("fisused", true, 11L);
+//        }
     }
 }