Browse Source

订单付费

eganwu 2 years ago
parent
commit
e5c4010989

+ 2 - 2
src/custom/restcontroller/system/payorder/SQL/付费订单_详细账号列表.sql

@@ -4,14 +4,14 @@ from (
                          t2.name,
                          t2.accountno,
                          t2.phonenumber,
-                         t3.agentname,
+                         t3.enterprisename,
                          t1.enddate,
                          t1.begdate,
                          t1.price,
                          t5.partitionname
          from sys_payorderitems t1
                   INNER JOIN sys_users t2 ON t2.userid = t1.userid
-                  LEFT JOIN sa_agents t3 ON t3.sa_agentsid = t1.sa_agentsid
+                  inner JOIN sys_enterprise t3 ON t3.sys_enterpriseid = t1.sys_enterpriseid
                   left JOIN sys_payorder t4 on t4.sys_payorderid = t1.sys_payorderid and t4.siteid = t1.siteid
                   LEFT JOIN sys_site_systempartition t5
                             ON t5.sys_site_systempartitionid = t4.sys_site_systempartitionid and

+ 2 - 1
src/custom/restcontroller/system/payorder/SQL/账号列表.sql

@@ -4,10 +4,11 @@ SELECT t1.userid,
        t2.name,
        t2.accountno,
        t2.phonenumber,
-       t5.agentname
+       t6.enterprisename
 from sa_agent_hr t1
          INNER JOIN sys_users t2 ON t2.userid = t1.userid and t2.status!='DELETED'
          inner join sys_usersite t3 ON t3.userid = t1.userid and t3.siteid=t1.siteid
          LEFT JOIN sa_agents t5 ON t5.sa_agentsid = t1.sa_agentsid and t5.siteid = t1.siteid
+         inner JOIN sys_enterprise t6 ON t6.sys_enterpriseid = t5.sys_enterpriseid
 WHERE t1.siteid = $siteid$
   and $where$

+ 201 - 201
src/custom/restcontroller/system/payorder/payorder.java

@@ -521,207 +521,207 @@ public class payorder extends Controller {
         return rows.get(0).getLong("usersiteid");
     }
 
-    @API(title = "获取当前登陆角色授权信息")
-    @CACHEING
-    public String query_userauth() throws YosException {
-        if (content.containsKey("systemclient")) {
-            systemclient = content.getString("systemclient");
-        }
-
-        int sys_payincidence = getPayIncidence();
-        int sys_payswitch = getPaySwitch();
-        /**
-         * 获取角色系统授权
-         */
-        SQLFactory systemsql = new SQLFactory(this, "获取角色系统授权");
-        systemsql.addParameter("userid", userid);
-        systemsql.addParameter("siteid", siteid);
-        systemsql.addParameter("systemclient", systemclient);
-        Rows systemRows = dbConnect.runSqlQuery(systemsql);
-
-
-        /**
-         * 获取角色模块授权
-         */
-        SQLFactory modulesql = new SQLFactory(this, "获取角色模块授权");
-        modulesql.addParameter("userid", userid);
-        modulesql.addParameter("siteid", siteid);
-        modulesql.addParameter("systemclient", systemclient);
-        Rows moduleRows = dbConnect.runSqlQuery(modulesql);
-        for (Row row : moduleRows) {
-            row.put("iconurl", getSystemModuleIconUrl(row.getLong("systemmoduleid"), "icon"));
-            row.put("iconurl_mainnav", getSystemModuleIconUrl(row.getLong("systemmoduleid"), "mainnavicon"));
-        }
-        RowsMap moduleRowsMap = moduleRows.toRowsMap("systemid");
-
-        /**
-         * 获取角色应用授权
-         */
-        SQLFactory appsql = new SQLFactory(this, "获取角色应用授权");
-        appsql.addParameter("userid", userid);
-        appsql.addParameter("siteid", siteid);
-        appsql.addParameter("systemclient", systemclient);
-        Rows appRows = dbConnect.runSqlQuery(appsql);
-        RowsMap appRowsMap = appRows.toRowsMap("systemmoduleid");
-
-        /**
-         * 获取角色功能授权
-         */
-        SQLFactory optionsql = new SQLFactory(this, "获取角色功能授权");
-        optionsql.addParameter("userid", userid);
-        optionsql.addParameter("siteid", siteid);
-        Rows OptionRows = dbConnect.runSqlQuery(optionsql);
-        RowsMap optionRowsMap = OptionRows.toRowsMap("systemappid");
-        /**
-         * 获取角色限制栏位
-         */
-        SQLFactory hiddenfieldsql = new SQLFactory(this, "获取角色限制栏位");
-        hiddenfieldsql.addParameter("userid", userid);
-        hiddenfieldsql.addParameter("siteid", siteid);
-        RowsMap hiddenfieldRowsMap = dbConnect.runSqlQuery(hiddenfieldsql).toRowsMap("systemappid");
-
-
-        /**
-         * 获取应用网格配置
-         */
-        SQLFactory gridsql = new SQLFactory(this, "获取角色应用网格配置");
-        gridsql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
-        Rows gridrows = dbConnect.runSqlQuery(gridsql);
-        RowsMap gridRowsMap = gridrows.toRowsMap("systemappid");
-
-        /**
-         * 获取应用表格配置
-         */
-        SQLFactory tablesql = new SQLFactory(this, "获取角色应用表格配置");
-        tablesql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
-        Rows tablerows = dbConnect.runSqlQuery(tablesql);
-        RowsMap tableRowsMap = tablerows.toRowsMap("systemappid");
-
-        SQLFactory tablecolsql = new SQLFactory(this, "获取角色应用表格栏位配置");
-        tablecolsql.addParameter_in("tableid", tablerows.toArrayList("tableid"));
-        RowsMap tablecolRowsMap = dbConnect.runSqlQuery(tablecolsql).toRowsMap("tableid");
-
-        /**
-         * 获取应用小组件配置
-         */
-        SQLFactory wedgitsql = new SQLFactory(this, "获取角色应用小组件配置");
-        wedgitsql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
-        RowsMap wedgitRowsMap = dbConnect.runSqlQuery(wedgitsql).toRowsMap("systemappid");
-
-
-        for (Row systemRow : systemRows) {
-            Rows modulerows = moduleRowsMap.get(systemRow.getString("systemid"));
-            for (Row moduleRow : modulerows) {
-                Rows approws = appRowsMap.get(moduleRow.getString("systemmoduleid"));
-                for (Row appRow : approws) {
-                    String systemappid = appRow.getString("systemappid");
-
-                    Rows optionRows = optionRowsMap.get(systemappid);
-                    optionRows.removeColumn(new String[]{"systemappid"});
-
-                    Rows hiddenfieldRows = hiddenfieldRowsMap.get(systemappid);
-                    hiddenfieldRows.removeColumn(new String[]{"systemappid"});
-
-                    Rows wedgitsRows = wedgitRowsMap.get(systemappid);
-                    wedgitsRows.removeColumn(new String[]{"systemappid"});
-
-                    JSONObject gridObject = new JSONObject();
-                    Rows gridRows = gridRowsMap.get(systemappid);
-                    for (Row gridRow : gridRows) {
-                        gridObject.put(gridRow.getString("grid"), gridRow);
-                    }
-                    gridRows.removeColumn(new String[]{"systemappid", "grid", "gridid"});
-
-                    JSONObject tableObject = new JSONObject();
-                    Rows tableRows = tableRowsMap.get(systemappid);
-                    for (Row tableRow : tableRows) {
-                        Rows tablecolRows = tablecolRowsMap.get(tableRow.getString("tableid"));
-                        tablecolRows.removeColumn(new String[]{"tableid", "tablecolid"});
-                        tableRow.put("tablecols", tablecolRows);
-                        tableObject.put(tableRow.getString("table"), tableRow);
-                    }
-                    tableRows.removeColumn(new String[]{"systemappid", "table", "tableid"});
-
-                    JSONObject metaObject = new JSONObject();
-                    metaObject.put("title", appRow.getString("systemappname"));
-                    metaObject.put("auth", optionRows);
-                    metaObject.put("hiddenfields", hiddenfieldRows);
-                    metaObject.put("wedgits", wedgitsRows);
-                    metaObject.put("grids", gridObject);
-                    metaObject.put("tables", tableObject);
-
-                    appRow.put("path", appRow.getString("apppath"));
-                    appRow.put("name", appRow.getString("systemapp"));
-                    appRow.put("meta", metaObject);
-                    appRow.put("component", "");
-
-                    //查询当前应用是否需要付费
-                    if (sys_payswitch == 0) {
-                        appRow.put("isneedpay", false);
-                    } else {
-                        appRow.put("isneedpay", getNeedPay(systemappid, sys_payincidence));
-                    }
-
-                }
-                moduleRow.put("apps", approws);
-            }
-            systemRow.put("modules", modulerows);
-        }
-        appRows.removeColumn(new String[]{"systemappname", "systemapp", "apppath"});
-        parameter.userauth_systemids.put(userid, systemRows);
-        parameter.userauth_systemmoduleids.put(userid, moduleRows);
-        parameter.userauth_systemappids.put(userid, appRows);
-        parameter.userauth_optionids.put(userid, OptionRows);
-        return getSucReturnObject().setData(systemRows).toString();
-    }
-
-
-    public boolean getNeedPay(String systemappid, int sys_payincidence) throws YosException {
-        long sa_agentsid = userInfo.getAgentID();
-        if (usertype == 21 || usertype == 22) {
-            //判断是否在试用期
-            if (dbConnect.runSqlQuery(" SELECT 1 from sys_usertrialperiod WHERE siteid='" + siteid + "' and userid='" + userid + "' and CURRENT_DATE <enddate ").isNotEmpty()) {
-                return false;
-            }
-            //判断应用是否有设置付费版本
-            if (dbConnect.runSqlQuery("SELECT 1 from sys_site_systempartition WHERE siteid='" + siteid + "' and JSON_CONTAINS(systemappids, '" + systemappid + "') ").isEmpty()) {
-                return false;
-            }
-
-            StringBuffer where = new StringBuffer(" 1=1 ");
-
-            if (sys_payincidence == 1) {
-                where.append(" and t1.userid=" + userid);
-            }
-            if (sys_payincidence == 2) {
-                where.append(" and t1.sa_agentsid=" + sa_agentsid);
-            }
-            //查询主账号是否有付费记录
-            if (sys_payincidence == 1 && usertype == 22) {
-                SQLFactory sqlFactory = new SQLFactory(this, "查询是否有付费记录");
-                sqlFactory.addParameter("siteid", siteid);
-                sqlFactory.addParameter("systemappids", systemappid);
-                sqlFactory.addParameter_SQL("where", " t1.userid in (SELECT userid from sa_agent_hr WHERE sa_agentsid=" + sa_agentsid + " and isleader=1)");
-                String sql = sqlFactory.getSQL();
-                if (dbConnect.runSqlQuery(sql).isEmpty()) {
-                    return true;
-                }
-            }
-
-
-            SQLFactory sqlFactory = new SQLFactory(this, "查询是否有付费记录");
-            sqlFactory.addParameter("siteid", siteid);
-            sqlFactory.addParameter("systemappids", systemappid);
-            sqlFactory.addParameter_SQL("where", where);
-            String sql = sqlFactory.getSQL();
-            if (dbConnect.runSqlQuery(sql).isNotEmpty()) {
-                return false;
-            }
-            return true;
-        } else {
-            return false;
-        }
-    }
+//    @API(title = "获取当前登陆角色授权信息")
+//    @CACHEING
+//    public String query_userauth() throws YosException {
+//        if (content.containsKey("systemclient")) {
+//            systemclient = content.getString("systemclient");
+//        }
+//
+//        int sys_payincidence = getPayIncidence();
+//        int sys_payswitch = getPaySwitch();
+//        /**
+//         * 获取角色系统授权
+//         */
+//        SQLFactory systemsql = new SQLFactory(this, "获取角色系统授权");
+//        systemsql.addParameter("userid", userid);
+//        systemsql.addParameter("siteid", siteid);
+//        systemsql.addParameter("systemclient", systemclient);
+//        Rows systemRows = dbConnect.runSqlQuery(systemsql);
+//
+//
+//        /**
+//         * 获取角色模块授权
+//         */
+//        SQLFactory modulesql = new SQLFactory(this, "获取角色模块授权");
+//        modulesql.addParameter("userid", userid);
+//        modulesql.addParameter("siteid", siteid);
+//        modulesql.addParameter("systemclient", systemclient);
+//        Rows moduleRows = dbConnect.runSqlQuery(modulesql);
+//        for (Row row : moduleRows) {
+//            row.put("iconurl", getSystemModuleIconUrl(row.getLong("systemmoduleid"), "icon"));
+//            row.put("iconurl_mainnav", getSystemModuleIconUrl(row.getLong("systemmoduleid"), "mainnavicon"));
+//        }
+//        RowsMap moduleRowsMap = moduleRows.toRowsMap("systemid");
+//
+//        /**
+//         * 获取角色应用授权
+//         */
+//        SQLFactory appsql = new SQLFactory(this, "获取角色应用授权");
+//        appsql.addParameter("userid", userid);
+//        appsql.addParameter("siteid", siteid);
+//        appsql.addParameter("systemclient", systemclient);
+//        Rows appRows = dbConnect.runSqlQuery(appsql);
+//        RowsMap appRowsMap = appRows.toRowsMap("systemmoduleid");
+//
+//        /**
+//         * 获取角色功能授权
+//         */
+//        SQLFactory optionsql = new SQLFactory(this, "获取角色功能授权");
+//        optionsql.addParameter("userid", userid);
+//        optionsql.addParameter("siteid", siteid);
+//        Rows OptionRows = dbConnect.runSqlQuery(optionsql);
+//        RowsMap optionRowsMap = OptionRows.toRowsMap("systemappid");
+//        /**
+//         * 获取角色限制栏位
+//         */
+//        SQLFactory hiddenfieldsql = new SQLFactory(this, "获取角色限制栏位");
+//        hiddenfieldsql.addParameter("userid", userid);
+//        hiddenfieldsql.addParameter("siteid", siteid);
+//        RowsMap hiddenfieldRowsMap = dbConnect.runSqlQuery(hiddenfieldsql).toRowsMap("systemappid");
+//
+//
+//        /**
+//         * 获取应用网格配置
+//         */
+//        SQLFactory gridsql = new SQLFactory(this, "获取角色应用网格配置");
+//        gridsql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
+//        Rows gridrows = dbConnect.runSqlQuery(gridsql);
+//        RowsMap gridRowsMap = gridrows.toRowsMap("systemappid");
+//
+//        /**
+//         * 获取应用表格配置
+//         */
+//        SQLFactory tablesql = new SQLFactory(this, "获取角色应用表格配置");
+//        tablesql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
+//        Rows tablerows = dbConnect.runSqlQuery(tablesql);
+//        RowsMap tableRowsMap = tablerows.toRowsMap("systemappid");
+//
+//        SQLFactory tablecolsql = new SQLFactory(this, "获取角色应用表格栏位配置");
+//        tablecolsql.addParameter_in("tableid", tablerows.toArrayList("tableid"));
+//        RowsMap tablecolRowsMap = dbConnect.runSqlQuery(tablecolsql).toRowsMap("tableid");
+//
+//        /**
+//         * 获取应用小组件配置
+//         */
+//        SQLFactory wedgitsql = new SQLFactory(this, "获取角色应用小组件配置");
+//        wedgitsql.addParameter_in("systemappid", appRows.toArrayList("systemappid"));
+//        RowsMap wedgitRowsMap = dbConnect.runSqlQuery(wedgitsql).toRowsMap("systemappid");
+//
+//
+//        for (Row systemRow : systemRows) {
+//            Rows modulerows = moduleRowsMap.get(systemRow.getString("systemid"));
+//            for (Row moduleRow : modulerows) {
+//                Rows approws = appRowsMap.get(moduleRow.getString("systemmoduleid"));
+//                for (Row appRow : approws) {
+//                    String systemappid = appRow.getString("systemappid");
+//
+//                    Rows optionRows = optionRowsMap.get(systemappid);
+//                    optionRows.removeColumn(new String[]{"systemappid"});
+//
+//                    Rows hiddenfieldRows = hiddenfieldRowsMap.get(systemappid);
+//                    hiddenfieldRows.removeColumn(new String[]{"systemappid"});
+//
+//                    Rows wedgitsRows = wedgitRowsMap.get(systemappid);
+//                    wedgitsRows.removeColumn(new String[]{"systemappid"});
+//
+//                    JSONObject gridObject = new JSONObject();
+//                    Rows gridRows = gridRowsMap.get(systemappid);
+//                    for (Row gridRow : gridRows) {
+//                        gridObject.put(gridRow.getString("grid"), gridRow);
+//                    }
+//                    gridRows.removeColumn(new String[]{"systemappid", "grid", "gridid"});
+//
+//                    JSONObject tableObject = new JSONObject();
+//                    Rows tableRows = tableRowsMap.get(systemappid);
+//                    for (Row tableRow : tableRows) {
+//                        Rows tablecolRows = tablecolRowsMap.get(tableRow.getString("tableid"));
+//                        tablecolRows.removeColumn(new String[]{"tableid", "tablecolid"});
+//                        tableRow.put("tablecols", tablecolRows);
+//                        tableObject.put(tableRow.getString("table"), tableRow);
+//                    }
+//                    tableRows.removeColumn(new String[]{"systemappid", "table", "tableid"});
+//
+//                    JSONObject metaObject = new JSONObject();
+//                    metaObject.put("title", appRow.getString("systemappname"));
+//                    metaObject.put("auth", optionRows);
+//                    metaObject.put("hiddenfields", hiddenfieldRows);
+//                    metaObject.put("wedgits", wedgitsRows);
+//                    metaObject.put("grids", gridObject);
+//                    metaObject.put("tables", tableObject);
+//
+//                    appRow.put("path", appRow.getString("apppath"));
+//                    appRow.put("name", appRow.getString("systemapp"));
+//                    appRow.put("meta", metaObject);
+//                    appRow.put("component", "");
+//
+//                    //查询当前应用是否需要付费
+//                    if (sys_payswitch == 0) {
+//                        appRow.put("isneedpay", false);
+//                    } else {
+//                        appRow.put("isneedpay", getNeedPay(systemappid, sys_payincidence));
+//                    }
+//
+//                }
+//                moduleRow.put("apps", approws);
+//            }
+//            systemRow.put("modules", modulerows);
+//        }
+//        appRows.removeColumn(new String[]{"systemappname", "systemapp", "apppath"});
+//        parameter.userauth_systemids.put(userid, systemRows);
+//        parameter.userauth_systemmoduleids.put(userid, moduleRows);
+//        parameter.userauth_systemappids.put(userid, appRows);
+//        parameter.userauth_optionids.put(userid, OptionRows);
+//        return getSucReturnObject().setData(systemRows).toString();
+//    }
+
+
+//    public boolean getNeedPay(String systemappid, int sys_payincidence) throws YosException {
+//        long sa_agentsid = userInfo.getAgentID();
+//        if (usertype == 21 || usertype == 22) {
+//            //判断是否在试用期
+//            if (dbConnect.runSqlQuery(" SELECT 1 from sys_usertrialperiod WHERE siteid='" + siteid + "' and userid='" + userid + "' and CURRENT_DATE <enddate ").isNotEmpty()) {
+//                return false;
+//            }
+//            //判断应用是否有设置付费版本
+//            if (dbConnect.runSqlQuery("SELECT 1 from sys_site_systempartition WHERE siteid='" + siteid + "' and JSON_CONTAINS(systemappids, '" + systemappid + "') ").isEmpty()) {
+//                return false;
+//            }
+//
+//            StringBuffer where = new StringBuffer(" 1=1 ");
+//
+//            if (sys_payincidence == 1) {
+//                where.append(" and t1.userid=" + userid);
+//            }
+//            if (sys_payincidence == 2) {
+//                where.append(" and t1.sa_agentsid=" + sa_agentsid);
+//            }
+//            //查询主账号是否有付费记录
+//            if (sys_payincidence == 1 && usertype == 22) {
+//                SQLFactory sqlFactory = new SQLFactory(this, "查询是否有付费记录");
+//                sqlFactory.addParameter("siteid", siteid);
+//                sqlFactory.addParameter("systemappids", systemappid);
+//                sqlFactory.addParameter_SQL("where", " t1.userid in (SELECT userid from sa_agent_hr WHERE sa_agentsid=" + sa_agentsid + " and isleader=1)");
+//                String sql = sqlFactory.getSQL();
+//                if (dbConnect.runSqlQuery(sql).isEmpty()) {
+//                    return true;
+//                }
+//            }
+//
+//
+//            SQLFactory sqlFactory = new SQLFactory(this, "查询是否有付费记录");
+//            sqlFactory.addParameter("siteid", siteid);
+//            sqlFactory.addParameter("systemappids", systemappid);
+//            sqlFactory.addParameter_SQL("where", where);
+//            String sql = sqlFactory.getSQL();
+//            if (dbConnect.runSqlQuery(sql).isNotEmpty()) {
+//                return false;
+//            }
+//            return true;
+//        } else {
+//            return false;
+//        }
+//    }
 
     @API(title = "绑定商户退款单号")
     public String bindOutRefundNo() throws YosException {