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

新增管理端:用户管理及商户管理模块

沈静伟 пре 4 година
родитељ
комит
0ede0acdae

+ 13 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/个人商户列表查询.sql

@@ -0,0 +1,13 @@
+select t1.tagentsid,
+       t1.siteid,
+       t1.createdate,
+       t2.fname,
+       t2.fphonenumber,
+       t2.faddress,
+       t1.fisused
+       max(t3.flastrequestdate)as flastrequestdate
+from tagents t1
+inner join tenterprise_users t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid and t2.fisadministrator=1
+left join tuserrequestlog t3 on t1.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
+where t1.ftype='¸öÈË' and t1.siteid =$siteid$ and $where$
+group by t1.tagentsid,t1.siteid,t1.createdate,t2.fname,t2.fphonenumber,t2.faddress,t1.fisused

+ 20 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户主界面查询.sql

@@ -0,0 +1,20 @@
+select t1.tagentsid,
+       t1.siteid,
+       t1.createdate,
+       t1.fagentname,
+       t1.faddress,
+       t1.fcontact,
+       t1.fphonenumber,
+       t1.fbrand,
+       t1.fintroduction,
+       t1.fdutyparagraph,
+       t1.fisused,
+       (stuff((select ',' + fprodclassname from tagents_prodclass where siteid = t1.siteid and tagentsid=t1.tagentsid for xml path('')),1,1,'')) as fprodclassname,
+       count(t2.tenterprise_userid) as fteamsize,
+       max(t3.flastrequestdate)as flastrequestdate
+from tagents t1
+inner join tenterprise_users t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+left join tuserrequestlog t3 on t1.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
+where t1.siteid =$siteid$ and t1.tagentsid=$tagentsid$
+group by t1.tagentsid,t1.siteid,t1.createdate,t1.fagentname,t1.faddress,t1.fcontact,t1.fphonenumber,t1.fbrand,
+t1.fintroduction,t1.fdutyparagraph,t1.fisused

+ 0 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商档案删除.sql → src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户档案删除.sql


+ 2 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户经营类目列表查询.sql

@@ -0,0 +1,2 @@
+select t1.tagents_prodclassid,t1.fprodclassname from tagents_prodclass t1
+where t1.siteid =$siteid$ and t1.tagentsid=$tagentsid$

+ 2 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户认证时间查询.sql

@@ -0,0 +1,2 @@
+ select t1.tagentsid,t1.checkdate from tagents_msgchangeapp t1
+ where t1.siteid=$siteid$ and t1.fstatus='ÉóºË'and t1.ftype='ÉÌ»§ÈÏÖ¤' and t1.tagentsid in $tagentsid$

+ 0 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商账号列表查询.sql → src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户账号列表查询.sql


+ 0 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商选择列表查询.sql → src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/商户选择列表查询.sql


+ 0 - 24
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商主界面查询.sql

@@ -1,24 +0,0 @@
-select t1.tagentsid,
-       t1.siteid,
-       t1.createby,
-       t1.createdate,
-       t1.changeby,
-       t1.changedate,
-       t1.fagentnum,
-       t1.fagentname,
-       t1.fagentshortname,
-       t1.fprovince,
-       t1.fcity,
-       t1.fcounty,
-       t1.faddress,
-       t1.fcontact,
-       t1.fphonenumber,
-       t1.fwechatno,
-       t1.femail,
-       t1.fbirthdate,
-       t1.fjoindate,
-       t1.fteamsize,
-       t1.ftype,
-       t1.fbrand
-from tagents t1
-where t1.siteid =$siteid$ and t1.tagentsid=$tagentsid$

+ 0 - 44
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商列表查询.sql

@@ -1,44 +0,0 @@
-select t1.tagentsid,
-       t1.siteid,
-       t1.createby,
-       t1.createdate,
-       t1.changeby,
-       t1.changedate,
-       t1.fagentnum,
-       t1.fagentname,
-       t1.fagentshortname,
-       t1.fprovince,
-       t1.fcity,
-       t1.fcounty,
-       t1.faddress,
-       t1.fcontact,
-       t1.fphonenumber,
-       t1.fwechatno,
-       t1.femail,
-       t1.fdutyparagraph,
-       t1.fbirthdate,
-       t1.fpayment,
-       t1.fjoindate,
-       t1.fteamsize,
-       t1.fbegdate,
-       t1.fenddate,
-       t1.fcooperationstatus,
-       t1.fsaleruserid,
-       t1.fappmodel,
-       t1.ftype,
-       t4.createdate                                                                                    as factivationtime,
-       case when t4.fenddate >= GETDATE() then 'ÓÐЧ' when t4.createdate IS null then '´ý¼¤»î' else 'µ½ÆÚ' end as faccountstatus,
-       convert(varchar(10), t6.fdate, 120)                     as ffirstlogintime
-from tagents t1
-         left join (select max(tpayinfoid) tpayinfoid, siteid, tagentsid from tpayinfo group by siteid, tagentsid) t3
-                   on t1.siteid = t3.siteid and t1.tagentsid = t3.tagentsid
-         left join tpayinfo t4
-                   on t3.siteid = t4.siteid and t3.tagentsid = t4.tagentsid and t3.tpayinfoid = t4.tpayinfoid
-
-         left join (select min(tuserrequestlogid) tuserrequestlogid, siteid, tenterprise_userid
-                    from tuserrequestlog
-                    group by siteid, tenterprise_userid) t5
-                   on t2.siteid = t5.siteid and t2.tenterprise_userid = t5.tenterprise_userid
-         left join tuserrequestlog t6 on t5.siteid = t6.siteid and t5.tenterprise_userid = t6.tenterprise_userid and
-                                         t5.tuserrequestlogid = t6.tuserrequestlogid
-where t1.siteid =$siteid$ and $where$

+ 0 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商经营类目查询.sql

@@ -1,2 +0,0 @@
-select tagents_prodclassid,fprodclassname from tagents_prodclass
-where t1.siteid =$siteid$ and t1.tagentsid=$tagentsid$

+ 0 - 37
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商账号激活统计.sql

@@ -1,37 +0,0 @@
-select t.faccountstatus, sum(t.fcount) as fcount
-from (
-         select t.faccountstatus, count(faccountstatus) fcount
-         from (
-                  select case
-                             when t3.fenddate >= GETDATE() then '綠마롤'
-                             else '灌마롤' end as faccountstatus
-                  from tagents t1
-                           left join (select max(tpayinfoid) tpayinfoid, siteid, tagentsid
-                                      from tpayinfo
-                                      group by siteid, tagentsid) t2
-                                     on t1.siteid = t2.siteid and t1.tagentsid = t2.tagentsid
-                           left join tpayinfo t3
-                                     on t2.siteid = t3.siteid and t2.tagentsid = t3.tagentsid and
-                                        t2.tpayinfoid = t3.tpayinfoid
-                  where t1.siteid = $siteid$
-                  union all
-select case
-           when exists(select tagentsid from tuserrequestlog where siteid = t1.siteid and tagentsid = t1.tagentsid)
-               then '綠賈痰'
-           else '灌賈痰' end as faccountstatus
-from tagents t1
-where t1.siteid = $siteid$
-    ) t
-group by t.faccountstatus
-union all
-select '灌마롤', 0
-union all
-select '綠마롤', 0
-union all
-select '綠賈痰', 0
-union all
-select '灌賈痰',
-       0 )t
-group by faccountstatus
-order by case when faccountstatus='綠마롤' then 1 when faccountstatus='灌마롤' then 2 when faccountstatus='綠賈痰' then 3 when faccountstatus='灌賈痰' then 4
-end

+ 17 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/认证商户列表查询.sql

@@ -0,0 +1,17 @@
+select t1.tagentsid,
+       t1.siteid,
+       t1.createdate,
+       t1.fagentname,
+       t1.faddress,
+       t1.fcontact,
+       t1.fphonenumber,
+       t1.fbrand,
+       t1.fisused
+       (stuff((select ',' + fprodclassname from tagents_prodclass where siteid = t1.siteid and tagentsid=t1.tagentsid for xml path('')),1,1,'')) as fprodclassname,
+       count(t2.tenterprise_userid) as fteamsize,
+       max(t3.flastrequestdate)as flastrequestdate
+from tagents t1
+inner join tenterprise_users t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+left join tuserrequestlog t3 on t1.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
+where t1.siteid =$siteid$ and $where$ and t1.ftype!='¸öÈË'
+group by t1.tagentsid,t1.siteid,t1.createdate,t1.fagentname,t1.faddress,t1.fcontact,t1.fphonenumber,t1.fbrand,t1.fisused

+ 123 - 68
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -6,15 +6,15 @@ import com.cnd3b.common.Controller;
 import com.cnd3b.common.D3bException;
 import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
+import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.data.db.DataPool;
-import org.omg.CORBA.OBJ_ADAPTER;
+import p2.common.parse.J;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 
 public class tagents extends Controller {
@@ -22,24 +22,45 @@ public class tagents extends Controller {
         super(content);
     }
 
+
     /**
-     * 数据统计
+     * 个人商户列表查询
      *
      * @return
      */
-    public String query_analysis() {
-        SQLFactory sqlFactory = new SQLFactory(this, "经销商账号激活统计");
-        sqlFactory.addParameter("siteid", siteid);
-        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
-        return getSucReturnObject().setData(rows).saveToDataPool().toString();
+    public String query_singleagentsList() {
+        /**
+         * 过滤条件设置
+         */
+        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("t2.fname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t2.fphonenumber like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+        }
+        SQLFactory singleagentSql = new SQLFactory(this, "个人商户列表查询", pageSize, pageNumber, "t1.tagentsid");
+        singleagentSql.addParameter("siteid", siteid);
+        singleagentSql.addParameter_SQL("where", where);
+        Rows rows = dbConnect.runSqlQuery(singleagentSql.getSQL());
+
+        ArrayList<String> tagentsidlist = dbConnect.runSqlQuery("select tagentsid from tagents_msgchangeapp where ftype='商户认证' and fstatus='申请'").toArrayList("tagentsid");
+        for (Row row : rows) {
+            String tagentsid = row.getString("tagentsid");
+            row.put("fstatus", tagentsidlist.contains(tagentsid) ? "认证中" : "未认证");
+        }
+        return getSucReturnObject().setDataByPaging(rows).setFinalDo(DataPool.defaultdatalife, 1);
     }
 
     /**
-     * 企业档案经销商列表查询
+     * 商列表查询
      *
      * @return
      */
-    public String query_enterpriseAgentsList() {
+    public String query_agentsList() {
         /**
          * 过滤条件设置
          */
@@ -48,53 +69,69 @@ public class tagents extends Controller {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
                 where.append(" and(");
-                where.append("t1.fagentshortname like'%").append(whereObject.getString("condition")).append("%' ");
-                where.append("or t1.fagentname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("t1.fagentname like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append("or t1.fphonenumber like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append("or t1.fcontact like'%").append(whereObject.getString("condition")).append("%' ");
-                where.append("or t1.ftype like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.fbrand like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append(")");
             }
-            if (whereObject.containsKey("faccountstatus")) {
-                if ("已付费".equals(whereObject.getString("faccountstatus"))) {
-                    where.append("and(t4.fenddate >= GETDATE())");
-                } else if ("未付费".equals(whereObject.getString("faccountstatus"))) {
-                    where.append("and(t4.createdate IS null or t4.fenddate < GETDATE())");
-                }
-            }
-            if (whereObject.containsKey("fsaler") && !"".equals(whereObject.getString("fsaler"))) {
-                where.append("and(t2.fname='").append(whereObject.getString("fsaler")).append("')");
-            }
-            if (whereObject.containsKey("ftype") && !"".equals(whereObject.getString("ftype"))) {
-                where.append(" and(");
-                where.append("t1.ftype like'%").append(whereObject.getString("ftype")).append("%' ");
-                where.append(")");
+        }
+        SQLFactory agentsql = new SQLFactory(this, "认证商户列表查询", pageSize, pageNumber, "t1.tagentsid");
+        agentsql.addParameter("siteid", siteid);
+        agentsql.addParameter_SQL("where", where);
+        Rows rows = dbConnect.runSqlQuery(agentsql.getSQL());
+
+        SQLFactory agentchecksql = new SQLFactory(this, "商户认证时间查询");
+        agentchecksql.addParameter("siteid", siteid);
+        agentchecksql.addParameter_in("tagentsid", rows.toArrayList("tagentsid"));
+        RowsMap agentcheckrowsMap = dbConnect.runSqlQuery(agentchecksql.getSQL()).toRowsMap("tagentsid");
+
+        for (Row row : rows) {
+            String tagentsid = row.getString("tagentsid");
+            if (agentcheckrowsMap.containsKey(tagentsid)) {
+                row.put("checkdate", agentcheckrowsMap.get(tagentsid).get(0).getString("checkdate"));
+            } else {
+                row.put("checkdate", row.getString("createdate"));
             }
         }
-        SQLFactory sql = new SQLFactory(this, "经销商列表查询", pageSize, pageNumber, "t1.tagentsid");
-        sql.addParameter("siteid", siteid);
-        sql.addParameter_SQL("where", where);
-        Rows rows = dbConnect.runSqlQuery(sql.getSQL());
+
         return getSucReturnObject().setDataByPaging(rows).setFinalDo(DataPool.defaultdatalife, 1);
     }
 
+
     /**
      * 企业档案经销商主界面查询
      *
      * @return
      */
-    public String query_enterpriseAgentsMain() {
+    public String query_agentsMain() {
         tagentsid = content.getLong("tagentsid");
-        SQLFactory sql = new SQLFactory(this, "经销商主界面查询");
+        SQLFactory sql = new SQLFactory(this, "商主界面查询");
         sql.addParameter("siteid", siteid);
         sql.addParameter("tagentsid", tagentsid);
         Rows rows = dbConnect.runSqlQuery(sql.getSQL());
         for (Row row : rows) {
-            SQLFactory prodclass = new SQLFactory(this, "经销商经营类目查询");
+            SQLFactory prodclass = new SQLFactory(this, "商经营类目列表查询");
             prodclass.addParameter("siteid", siteid);
             prodclass.addParameter("tagentsid", tagentsid);
             Rows prodclassrows = dbConnect.runSqlQuery(prodclass.getSQL());
-            row.put("prodclass", prodclassrows);
+            row.put("fprodclassname", prodclassrows);
+            row.put("attinfos", getAttachmentUrl("tagentsid", String.valueOf(tagentsid), "brandlogo"));
+
+            //修改申请查询
+            Rows tagents_msgchangeappRows = dbConnect.runSqlQuery("select fchangemsg,ftype,tagents_msgchangappid from tagents_msgchangeapp where fstatus='申请' and siteid='" + siteid + "' and tagentsid='" + tagentsid + "'");
+            if (tagents_msgchangeappRows.isEmpty()) {
+                row.put("msgchangeapp", "{}");
+            } else {
+                String ftype = tagents_msgchangeappRows.get(0).getString("ftype");
+                String fchangemsg = tagents_msgchangeappRows.get(0).getString("fchangemsg");
+                long tagents_msgchangappid = tagents_msgchangeappRows.get(0).getLong("tagents_msgchangappid");
+                JSONObject msgchangeappObject = new JSONObject();
+                msgchangeappObject.put("ftype", ftype);
+                msgchangeappObject.put("fchangemsg", JSONObject.parseObject(fchangemsg));
+                msgchangeappObject.put("tagents_msgchangappid", tagents_msgchangappid);
+                row.put("msgchangeapp", msgchangeappObject);
+            }
         }
         return getSucReturnObject().setData(rows).toString();
     }
@@ -104,7 +141,7 @@ public class tagents extends Controller {
      *
      * @return
      */
-    public String modify_enterpriseAgent() throws D3bException, P2Exception {
+    public String modify_agent() throws D3bException, P2Exception {
         long tagentsid = content.getLong("tagentsid");//经销商id
         /**
          * 只有个人才可进行商户认证
@@ -140,11 +177,12 @@ public class tagents extends Controller {
             tagents_msgchangeappSet.save();
 
             content.put("tagents_msgchangappid", tagents_msgchangappid);
-            check_enterpriseAgent();
+            check_agentmodify();
         }
         return getSucReturnObject().toString();
     }
 
+
     /**
      * 经销商信息修改审核
      *
@@ -152,7 +190,7 @@ public class tagents extends Controller {
      * @throws D3bException
      * @throws P2Exception
      */
-    public String check_enterpriseAgent() throws D3bException, P2Exception {
+    public String check_agentmodify() throws D3bException, P2Exception {
         long tagents_msgchangappid = content.getLong("tagents_msgchangappid");
         Rows rows = dbConnect.runSqlQuery("select ftype,fchangemsg,tagentsid from tagents_msgchangeapp where fstatus='申请'and siteid='" + siteid + "' and tagents_msgchangappid='" + tagents_msgchangappid + "'");
         if (rows.isEmpty()) {
@@ -161,37 +199,34 @@ public class tagents extends Controller {
         String ftype = rows.get(0).getString("ftype");
         String fchangemsg = rows.get(0).getString("fchangemsg");
         long tagentsid = rows.get(0).getLong("tagentsid");
-
         PaoSetRemote tagentsSet = getP2ServerSystemPaoSet("tagents", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "'");
         if (!tagentsSet.isEmpty()) {
             PaoRemote tagents = tagentsSet.getPao(0);
-            JSONArray changemsgarray = JSONArray.parseArray(fchangemsg);
-            for (Object o : changemsgarray) {
-                JSONObject changemsgObject = (JSONObject) o;
-                Iterator it = changemsgObject.keySet().iterator();
-                while (it.hasNext()) {
-                    String key = (String) it.next();
-                    if ("saleprodclass".equals(key)) {
-                        //经营类目修改
-                        JSONArray saleprodclassArray = changemsgObject.getJSONArray("saleprodclass");
-                        PaoSetRemote tagents_prodclassSet = tagents.getPaoSet("$tagents_prodclass", "tagents_prodclass", "tagentsid=" + tagentsid);
-                        tagents_prodclassSet.deleteAll();
-                        for (Object saleprodclassObject : saleprodclassArray) {
-                            String fprodclassname = (String) saleprodclassObject;
-                            PaoRemote saleprodclassPao = tagents_prodclassSet.addAtEnd();
-                            saleprodclassPao.setValue("tagentsid", tagentsid, 11L);
-                            saleprodclassPao.setValue("siteid", siteid, 11L);
-                            saleprodclassPao.setValue("fprodclassname", fprodclassname, 11L);
-                        }
-                    } else {
-                        String value = changemsgObject.getString(key);
-                        tagents.setValue(key, value, 11L);
+            JSONObject changemsgObject = JSONObject.parseObject(fchangemsg);
+            Iterator it = changemsgObject.keySet().iterator();
+            while (it.hasNext()) {
+                String key = (String) it.next();
+                if ("saleprodclass".equals(key)) {
+                    //经营类目修改
+                    JSONArray saleprodclassArray = changemsgObject.getJSONArray("saleprodclass");
+                    PaoSetRemote tagents_prodclassSet = tagents.getPaoSet("$tagents_prodclass", "tagents_prodclass", "tagentsid=" + tagentsid);
+                    tagents_prodclassSet.deleteAll();
+                    for (Object saleprodclassObject : saleprodclassArray) {
+                        String fprodclassname = (String) saleprodclassObject;
+                        PaoRemote saleprodclassPao = tagents_prodclassSet.addAtEnd();
+                        saleprodclassPao.setValue("tagentsid", tagentsid, 11L);
+                        saleprodclassPao.setValue("siteid", siteid, 11L);
+                        saleprodclassPao.setValue("fprodclassname", fprodclassname, 11L);
                     }
+                } else {
+                    String value = changemsgObject.getString(key);
+                    tagents.setValue(key, value, 11L);
                 }
-                if (ftype.equals("商户认证")) {
-                    tagents.setValue("ftype", "普通商户", 11L);
-                }
             }
+            if (ftype.equals("商户认证")) {
+                tagents.setValue("ftype", "普通商户", 11L);
+            }
+
             PaoSetRemote tagents_msgchangeappSet = tagents.getPaoSet("$tagents_msgchangeapp", "tagents_msgchangeapp", "tagents_msgchangappid=" + tagents_msgchangappid);
             tagents_msgchangeappSet.getPao(0).setValue("fstatus", "审核", 11L);
             tagents_msgchangeappSet.getPao(0).setValue("checkby", username, 11L);
@@ -208,15 +243,35 @@ public class tagents extends Controller {
      *
      * @return
      */
-    public String delete_enterpriseAgent() {
-        SQLFactory sqlFactory = new SQLFactory(this, "经销商档案删除");
+    public String delete_agent() {
+        if (!dbConnect.runSqlQuery("select *from tuserrequestlog where siteid='" + siteid + "' and tagentsid='" + tagentsid + "'").isEmpty()) {
+            return getErrReturnObject().setErrMsg("当前商户已有访问记录,不可删除,建议停用").toString();
+        }
+
+        SQLFactory sqlFactory = new SQLFactory(this, "商户档案删除");
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("tagentsid", content.getString("tagentsid"));
         String result = dbConnect.runSqlUpdate(sqlFactory.getSQL());
         if ("true".equals(result)) {
             return getSucReturnObject().toString();
         } else {
-            return getErrReturnObject().setErrMsg(result).toString();
+            return getErrReturnObject().toString();
+        }
+    }
+
+    /**
+     * 企业经销商档案启用停用
+     *
+     * @return
+     */
+    public String use_agent() {
+        int fisused = content.getInteger("fisused");
+        long tagentsid = content.getLong("tagentsid");
+        String result = dbConnect.runSqlUpdate("update tagents set fisused=" + fisused + " where siteid='" + siteid + "' and tagentsid='" + tagentsid + "'");
+        if ("true".equals(result)) {
+            return getSucReturnObject().toString();
+        } else {
+            return getErrReturnObject().toString();
         }
     }
 
@@ -225,8 +280,8 @@ public class tagents extends Controller {
      *
      * @return
      */
-    public String query_enterpriseAgentUsers() {
-        SQLFactory sql = new SQLFactory(this, "经销商账号列表查询");
+    public String query_agentUsers() {
+        SQLFactory sql = new SQLFactory(this, "商账号列表查询");
         sql.addParameter("siteid", siteid);
         sql.addParameter("tagentsid", content.getString("tagentsid"));
         Rows rows = dbConnect.runSqlQuery(sql.getSQL());

+ 5 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/users/SQL/系统账号列表查询.sql

@@ -0,0 +1,5 @@
+select t1.tenterprise_userid,t1.fname,t1.fphonenumber,t1.fsex,t1.frole,t3.fagentname,max(t2.flastrequestdate)as flastrequestdate from tenterprise_users t1
+left join tuserrequestlog t2 on t1.siteid=t2.siteid and t1.tenterprise_userid=t2.tenterprise_userid
+left join tagents t3 on t1.siteid=t3.siteid and t1.tagentsid=t3.tagentsid
+where t1.siteid=$siteid$ and $where$
+group by t1.tenterprise_userid,t1.fname,t1.fphonenumber,t1.fsex,t1.frole,t3.fagentname

+ 39 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/users/users.java

@@ -0,0 +1,39 @@
+package com.cnd3b.restcontroller.enterprise.users;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import com.cnd3b.common.data.Rows;
+import com.cnd3b.common.data.SQLFactory;
+
+public class users extends Controller {
+    public users(JSONObject content) {
+        super(content);
+    }
+
+    public String query_userList() {
+        /**
+         *排序条件设置
+         */
+        String[] sortfield = {"t1.tenterprise_userid desc"};
+        String sort = getSort(sortfield, "t1.tenterprise_userid desc");
+        /**
+         * 过滤条件设置
+         */
+        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.fphonenumber like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.fagentname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.fname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+        }
+        SQLFactory sqlFactory = new SQLFactory(this, "系统账号列表查询", pageSize, pageNumber, sort);
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter_SQL("where", where);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        return getSucReturnObject().setDataByPaging(rows, sortfield).saveToDataPool().toString();
+    }
+}