|
|
@@ -2,16 +2,128 @@ package restcontroller.webmanage.saletool.data;
|
|
|
|
|
|
import common.BaseClass;
|
|
|
import common.Controller;
|
|
|
+import common.YosException;
|
|
|
+import common.data.Row;
|
|
|
import common.data.Rows;
|
|
|
|
|
|
public class DataDashboardHelper extends BaseClass {
|
|
|
|
|
|
|
|
|
-// public Long getUsedCount(Controller controller, int usertype) {
|
|
|
-//
|
|
|
-//// Rows rows =controller.dbConnect.runSqlQuery("");
|
|
|
-//
|
|
|
-// }
|
|
|
+ //启用状态且绑定小程序的账号数量;
|
|
|
+ public static Long getUsedCount(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ Row row = controller.dbConnect.runSqlQuery(0, "SELECT count(0) count from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='ACTIVE' and " +
|
|
|
+ " t1.userid in " +
|
|
|
+ " (" +
|
|
|
+ "SELECT userid FROM sys_wechatapp_openids WHERE systemclient='marketingtool' " +
|
|
|
+ "UNION ALL " +
|
|
|
+ "SELECT userid FROM sys_wechatapp_unionids" +
|
|
|
+ ")");
|
|
|
+
|
|
|
+ return row.getLong("count");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getUsedSql(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ String sql = ("SELECT t1.userid from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='ACTIVE' and " +
|
|
|
+ " t1.userid in " +
|
|
|
+ " (" +
|
|
|
+ "SELECT userid FROM sys_wechatapp_openids WHERE systemclient='marketingtool' " +
|
|
|
+ "UNION ALL " +
|
|
|
+ "SELECT userid FROM sys_wechatapp_unionids" +
|
|
|
+ ")");
|
|
|
+
|
|
|
+ return sql;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //启用状态且未绑定小程序的账号数量;
|
|
|
+ public static Long getUnBindCount(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ Row row = controller.dbConnect.runSqlQuery(0, "SELECT count(0) count from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='ACTIVE' and " +
|
|
|
+ " t1.userid not in " +
|
|
|
+ " (" +
|
|
|
+ "SELECT userid FROM sys_wechatapp_openids WHERE systemclient='marketingtool' " +
|
|
|
+ "UNION ALL " +
|
|
|
+ "SELECT userid FROM sys_wechatapp_unionids" +
|
|
|
+ ")");
|
|
|
+
|
|
|
+ return row.getLong("count");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getUnBindSql(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ String sql=( "SELECT t1.userid from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='ACTIVE' and " +
|
|
|
+ " t1.userid not in " +
|
|
|
+ " (" +
|
|
|
+ "SELECT userid FROM sys_wechatapp_openids WHERE systemclient='marketingtool' " +
|
|
|
+ "UNION ALL " +
|
|
|
+ "SELECT userid FROM sys_wechatapp_unionids" +
|
|
|
+ ")");
|
|
|
+
|
|
|
+ return sql;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //停用的账号数量;
|
|
|
+ public static Long getStopCount(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ Row row = controller.dbConnect.runSqlQuery(0, "SELECT count(0) count from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='INACTIVE'");
|
|
|
+ return row.getLong("count");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getStopSql(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ String sql=( "SELECT t1.userid from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status='INACTIVE'");
|
|
|
+ return sql;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //全部账号数量;
|
|
|
+ public static Long getAllCount(Controller controller, int usertype) throws YosException {
|
|
|
+
|
|
|
+ Row row = controller.dbConnect.runSqlQuery(0, "SELECT count(0) count from sys_usersite t1 " +
|
|
|
+ "INNER JOIN sys_users t2 ON t2.userid=t1.userid " +
|
|
|
+ "WHERE" +
|
|
|
+ " t1.siteid='" + controller.siteid + "' and " +
|
|
|
+ " t1.usertype=" + usertype + " and " +
|
|
|
+ " t2.status in ('ACTIVE','INACTIVE')");
|
|
|
+ return row.getLong("count");
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|