2026-01-18 06:48:37 +08:00
package com.group.service ;
import java.util.ArrayList ;
import java.util.List ;
import java.util.Map ;
import java.util.Set ;
import javax.xml.bind.annotation.XmlElementDecl.GLOBAL ;
import com.data.bean.AccountBean ;
import com.data.bean.GroupBean ;
import com.data.bean.GroupMemberBean ;
import com.data.cache.AccountCache ;
import com.data.cache.GroupCache ;
import com.data.cache.GroupMemberCache ;
import com.data.util.ConsumeCode ;
import com.data.util.CountUtil ;
import com.data.util.ErrorCode ;
import com.data.util.Utility ;
import com.taurus.core.entity.ITArray ;
import com.taurus.core.entity.ITObject ;
import com.taurus.core.entity.TArray ;
import com.taurus.core.entity.TObject ;
import com.taurus.core.plugin.database.DataBase ;
import com.taurus.core.plugin.redis.Redis ;
import com.taurus.core.plugin.redis.RedisLock ;
import com.taurus.core.util.DateUtils ;
import com.taurus.core.util.Logger ;
import com.taurus.core.util.StringUtil ;
import com.taurus.web.WebException ;
import jdk.nashorn.internal.objects.Global ;
import redis.clients.jedis.Jedis ;
import redis.clients.jedis.Pipeline ;
public class GroupLogService {
private static final Logger log = Logger . getLogger ( GroupLogService . class ) ;
// 体力值变化
private static final int CHOOSE_CHAGE = 1 ;
// 操作上分
private static final int CHOOSE_UPPER = 2 ;
// 操作下分
private static final int CHOOSE_SUB = 4 ;
// 抽水
private static final int CHOOSE_PUMP = 8 ;
// 奖励
private static final int CHOOSE_RWARD = 16 ;
// 转账
private static final int CHOOSE_TRADE = 32 ;
// 提取
private static final int CHOOSE_TAKE_REWARD = 64 ;
// 洗牌
private static final int CHOOSE_XIPAI = 128 ;
2026-05-01 15:25:05 +08:00
2026-03-27 16:25:13 +08:00
private static final String redisdb = "group1_db13" ;
2026-01-18 06:48:37 +08:00
/ * *
* 上 下 分 记 录 类 型
* /
private static final int [ ] MGRLOG_TYPE = { ConsumeCode . HP_MGR_UPPER , ConsumeCode . HP_MGR_SUB ,
ConsumeCode . HP_PARTNER_UPPER , ConsumeCode . HP_PARTNER_SUB } ;
/ * *
* 获 取 成 员 排 行
*
* @param groupId
* @param pid
* @param limit
* @param num
* @param beginTime
* @param endTime
* @return
* @throws Exception
* /
public static final ITObject getMemberRank ( int groupId , int uid , int pid , int type , int limit , int num ,
int beginTime , int endTime ) throws Exception {
ITObject obj1 = TObject . newInstance ( ) ;
GroupMemberBean mng_bean = GroupCache . getMember ( groupId , uid ) ;
if ( mng_bean = = null ) {
throw new WebException ( ErrorCode . GROUP_NOT_MEMBER ) ;
}
int mgn_partner = mng_bean . partnerLev ;
int mgn_lev = mng_bean . lev ;
String strGodsList = null ;
Set < String > godsList = Redis . use ( "group1_db1" ) . smembers ( "gods" ) ;
Jedis jedis1 = Redis . use ( "group1_db1" ) . getJedis ( ) ;
boolean findok = false ;
try {
if ( ! godsList . isEmpty ( ) ) {
for ( String mem : godsList ) {
String havemems = jedis1 . hget ( "gods_super" , mem ) ;
if ( ! StringUtil . isNotEmpty ( havemems ) ) {
// 判断是否是超级号
if ( strGodsList = = null ) {
strGodsList = mem ;
} else {
strGodsList + = "," + mem ;
}
}
}
if ( ! strGodsList . isEmpty ( ) ) {
strGodsList = "(" + strGodsList + ")" ;
findok = true ;
}
}
} finally {
jedis1 . close ( ) ;
}
// log.info("getMemberRank strGodsList:"+strGodsList+" mgn_partner:"+mgn_partner
// + " mgn_lev:"+mgn_lev);
// if (mgn_lev == 1 && mgn_partner == 0) {
String sql = String . format (
"SELECT uid,SUM(win) AS win,SUM(round) as round,SUM(score) as score FROM group_member_log WHERE groupId = %s " ,
groupId ) ;
if ( pid > 0 ) {
sql = sql + " AND pid =" + pid ;
}
if ( findok ) {
sql = sql + " AND uid not in " + strGodsList ;
}
if ( type = = 0 ) {
sql = sql + String . format ( " AND time >=%s AND time <%s GROUP BY uid ORDER BY round DESC limit %s,%s" ,
beginTime , endTime , limit , num ) ;
} else if ( type = = 1 ) {
sql = sql + String . format ( " AND time >=%s AND time <%s GROUP BY uid ORDER BY score DESC limit %s,%s" ,
beginTime , endTime , limit , num ) ;
}
// log.info("getMemberRank sql:"+sql);
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
AccountBean acc = AccountCache . getAccount ( obj . getInt ( "uid" ) ) ;
obj . putString ( "nick" , acc . nick ) ;
obj . putString ( "portrait" , acc . portrait ) ;
}
obj1 . putTArray ( "ranks" , arr ) ;
String sql2 = String . format (
"select count(uid) as num from group_member_log where groupId = %s and round > 0 and time >=%s AND time <%s " ,
groupId , beginTime , endTime ) ;
if ( findok ) {
sql2 = sql2 + " and uid not in " + strGodsList ;
}
// log.info("getMemberRank sql2:"+sql2);
int allActiveNum = 0 ;
ITArray arr2 = DataBase . use ( ) . executeQueryByTArray ( sql2 ) ;
if ( arr2 . size ( ) > 0 ) {
ITObject obj = arr2 . getTObject ( 0 ) ;
allActiveNum = obj . getLong ( "num" ) . intValue ( ) ;
}
obj1 . putInt ( "allActiveNum" , allActiveNum ) ;
// }
obj1 . putInt ( "limit" , limit ) ;
return obj1 ;
}
/ * *
* 获 取 战 绩 列 表
*
* @param platform
* @param groupId
* @param limit
* @param num
* @return
* /
public static ITObject getPersonRecords ( String platform , int groupId , int timeType , int beginTime , int endTime ,
int limit , int num , int qid , int uid ) throws Exception {
String qid_sql = StringUtil . Empty ;
qid_sql = "and uid=" + qid ;
ITArray militaryList = TArray . newInstance ( ) ;
ITObject obj1 = TObject . newInstance ( ) ;
if ( timeType = = 0 ) {
beginTime = DateUtils . getBeginDay ( ) ;
endTime = DateUtils . getBeginDay ( ) + 3600 * 24 ;
} else if ( timeType = = 1 ) {
beginTime = DateUtils . getBeginDay ( ) - 3600 * 24 ;
endTime = DateUtils . getBeginDay ( ) ;
} else if ( timeType = = 2 ) {
beginTime = DateUtils . getBeginDay ( ) - 3600 * 48 ;
endTime = DateUtils . getBeginDay ( ) - 3600 * 24 ;
}
int total = 0 ;
int consume = 0 ;
String where = String . format ( "gid=%s and time>=%s and time<=%s" , groupId , beginTime , endTime ) ;
if ( limit = = 0 ) {
String count_sql = String . format ( "SELECT count(*) AS total FROM room_rec_log where %s %s" , where , qid_sql ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( count_sql ) ;
if ( arr . size ( ) > 0 ) {
ITObject obj = arr . getTObject ( 0 ) ;
total = obj . getLong ( "total" ) . intValue ( ) ;
}
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
String key = String . format ( "g%s:m%s:consume_hp" , groupId , uid ) ;
if ( timeType > = 0 & & timeType < = 2 ) {
String hp_key = String . format ( "%s:d%s" , key , beginTime ) ;
String r_str = jedis9 . get ( hp_key ) ;
int r_num = 0 ;
if ( StringUtil . isNotEmpty ( r_str ) ) {
r_num = Integer . parseInt ( r_str ) ;
}
consume = r_num ;
} else {
int timeBegin = beginTime ;
while ( timeBegin < = endTime ) {
String hp_key = String . format ( "%s:d%s" , key , timeBegin ) ;
String r_str = jedis9 . get ( hp_key ) ;
int r_num = 0 ;
if ( StringUtil . isNotEmpty ( r_str ) ) {
r_num = Integer . parseInt ( r_str ) ;
}
consume + = r_num ;
timeBegin + = 86400 ;
}
}
getMemberData ( jedis9 , uid , obj1 , groupId , 0 , beginTime , endTime , false , false ) ;
} finally {
jedis9 . close ( ) ;
}
}
String sql = String . format (
"select rec_key from room_rec_log where %s %s GROUP BY roomid ORDER BY time desc limit %s,%s" , where ,
qid_sql , limit , num ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( list . size ( ) > 0 ) {
Jedis jedis5 = Redis . use ( "group1_db5" ) . getJedis ( ) ;
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject tem = list . getTObject ( i ) ;
String rec_key = tem . getString ( "rec_key" ) ;
ITObject obj = Utility . getMilitaryList ( jedis5 , rec_key , platform ) ;
if ( obj = = null ) {
continue ;
}
militaryList . addTObject ( obj ) ;
}
} finally {
jedis5 . close ( ) ;
}
}
obj1 . putTArray ( "records" , militaryList ) ;
obj1 . putInt ( "limit" , limit ) ;
obj1 . putInt ( "total" , total ) ;
obj1 . putInt ( "consume" , consume ) ;
return obj1 ;
}
public static ITObject getPartnerStatPlay ( int groupId , int uid , int parent_id , int limit , int num , int timeType ,
int beginTime , int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
String gp_key = GroupCache . genPidsKey ( groupId ) ;
Set < String > pids = Redis . use ( "group1_db11" ) . zrangeByScore ( gp_key , 10 , 11 ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
ITArray arr = TArray . newInstance ( ) ;
try {
for ( String pid : pids ) {
ITObject objp = TObject . newInstance ( ) ;
objp . putInt ( "pid" , Integer . parseInt ( pid ) ) ;
if ( timeType = = 0 ) {
String key = String . format ( "g{%s}:m%s:valid_round:p%s" , groupId , uid , pid ) ;
int round = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "round" , round ) ;
key = String . format ( "g%s:hp_cost:m%s:p%s" , groupId , uid , pid ) ;
int pump = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "pump" , pump ) ;
key = String . format ( "g{%s}:m%s:p%s:reward_log" , groupId , uid , pid ) ;
int award = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "award" , award ) ;
} else if ( timeType = = 1 ) {
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:valid_round:p%s%s" , groupId , uid , pid , curMonth ) ;
int round = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "round" , round ) ;
key = String . format ( "g%s:hp_cost:m%s:p%s%s" , groupId , uid , pid , curMonth ) ;
int pump = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "pump" , pump ) ;
key = String . format ( "g{%s}:m%s:p%s:reward_log%s" , groupId , uid , pid , curMonth ) ;
int award = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "award" , award ) ;
} else if ( timeType = = 2 ) {
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:valid_round:p%s%s" , groupId , uid , pid , curMonth ) ;
int round = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "round" , round ) ;
key = String . format ( "g%s:hp_cost:m%s:p%s%s" , groupId , uid , pid , curMonth ) ;
int pump = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "pump" , pump ) ;
key = String . format ( "g{%s}:m%s:p%s:reward_log%s" , groupId , uid , pid , curMonth ) ;
int award = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objp . putInt ( "award" , award ) ;
}
arr . addTObject ( objp ) ;
}
} finally {
jedis9 . close ( ) ;
}
obj . putTArray ( "members" , arr ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static ITObject getDirectStatMember ( int groupId , int uid , int rootUid , int limit , int num , int timeType ,
int beginTime , int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
String sql = String . format (
"SELECT uid, partnerLev" + " FROM group_member"
+ " WHERE groupId = %s and ((parentId=%s and partnerLev = 0) or uid = %s) GROUP BY uid %s" ,
groupId , uid , uid , limitSql ) ;
ITArray temp = TArray . newInstance ( ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
if ( objLine . containsKey ( "uid" ) ) {
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
objLine . putString ( "nick" , acc . nick ) ;
// int newBeginTime = beginTime - 86400*30;
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , false , false ) ;
if ( timeType = = 0 ) {
{
String tmpKey = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , tmpKey + "reward_log" , beginTime , endTime ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objLine . putInt ( "reward_hp" , ( int ) reward_hp ) ;
} else if ( timeType = = 1 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 2 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
}
temp . addTObject ( objLine ) ;
}
}
} finally {
jedis9 . close ( ) ;
}
obj . putTArray ( "members" , temp ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static ITObject getXingYunHaoMember ( int groupId , int limit , int num , int timeType , int beginTime ,
int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
String strGodsList = null ;
Set < String > godsList = Redis . use ( "group1_db1" ) . smembers ( "gods" ) ;
Map < String , String > mapString = Redis . use ( "group1_db1" ) . hgetAll ( "gods_special" ) ;
for ( Map . Entry < String , String > entry : mapString . entrySet ( ) ) {
String strPlayerId = entry . getKey ( ) ;
godsList . remove ( strPlayerId ) ;
}
List < String > allList = new ArrayList < String > ( ) ;
allList . addAll ( godsList ) ;
for ( String mem : godsList ) {
if ( strGodsList = = null ) {
strGodsList = mem ;
} else {
strGodsList + = "," + mem ;
}
}
String sql = String . format (
"SELECT uid, partnerLev" + " FROM group_member" + " WHERE groupId = %s and uid in (%s) GROUP BY uid %s" ,
groupId , strGodsList , limitSql ) ;
ITArray temp = TArray . newInstance ( ) ;
int allTotalWin = 0 ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
if ( objLine . containsKey ( "uid" ) ) {
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
objLine . putString ( "nick" , acc . nick ) ;
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , false , false ) ;
temp . addTObject ( objLine ) ;
}
}
for ( String user : allList ) {
String key = String . format ( "g{%s}:m%s:" , groupId , user ) ;
int total_win = _getCountValue ( jedis9 , key + "total_win_self" , beginTime , endTime ) ;
allTotalWin + = total_win ;
}
} finally {
jedis9 . close ( ) ;
}
obj . putTArray ( "members" , temp ) ;
obj . putInt ( "limit" , limit ) ;
obj . putLong ( "all_total_win" , allTotalWin ) ;
return obj ;
}
public static ITObject getPartnerStatMember ( int groupId , int uid , int rootUid , int limit , int num , int timeType ,
int beginTime , int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
String sql = String . format (
"SELECT uid, partnerLev" + " FROM group_member"
+ " WHERE groupId = %s and (parentId=%s or uid = %s) and partnerLev > 0 GROUP BY uid %s" ,
groupId , uid , uid , limitSql ) ;
ITArray temp = TArray . newInstance ( ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
if ( objLine . containsKey ( "uid" ) ) {
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
2026-05-01 15:25:05 +08:00
objLine . putString ( "nick" , acc = = null ? "" : acc . nick ) ;
2026-01-18 06:48:37 +08:00
if ( tagUid ! = uid ) {
// int newBeginTime = beginTime - 86400 * 30;
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , false , true ) ;
} else {
// int newBeginTime = beginTime - 86400 * 30;
// getMemberData(jedis9,tagUid,objLine,groupId,timeType,
// beginTime,endTime,false,true);
getDirectMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime ) ;
}
if ( tagUid = = uid ) {
if ( timeType = = 0 ) {
String tmpKey = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , tmpKey + "d_reward" , beginTime , endTime ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
// String key = String.format("g{%s}:m%s:d_reward", groupId, tagUid);
// int reward_hp1 = _getCountValue(jedis9, key, beginTime, endTime);
// objLine.putInt("reward_hp", reward_hp1);
} else if ( timeType = = 1 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 2 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
}
} else {
if ( timeType = = 0 ) {
String tmpKey = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , tmpKey + "d_reward" , beginTime , endTime ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
String undersql = "select * from group_member gm,account a where a.id=gm.uid and gm.parentId="
+ tagUid ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( undersql ) ;
int under_round = 0 ;
int under_win = 0 ;
int under_total_win = 0 ;
int under_reward_hp = 0 ;
if ( arr . size ( ) > 0 ) {
// log.info("underKey:"+uid);
for ( int ii = 0 ; ii < arr . size ( ) ; ii + + ) {
ITObject underData = arr . getTObject ( ii ) ;
String underKey = String . format ( "g{%s}:m%s:" , groupId , underData . getInt ( "uid" ) ) ;
under_round + = _getCountValue ( jedis9 , underKey + "round_log" , beginTime , endTime ) ;
under_win + = _getCountValue ( jedis9 , underKey + "valid_round" , beginTime , endTime ) ;
under_reward_hp + = _getCountValue ( jedis9 , underKey + "d_reward" , beginTime ,
endTime ) ;
// under_total_win += _getCountValue(jedis9, underKey + "total_win", beginTime, endTime);
// log.info("underKey:"+underKey);
// log.info("under_reward_hp:"+under_reward_hp);
}
if ( under_reward_hp ! = 0 ) {
objLine . putLong ( "reward_tongji" , under_reward_hp ) ; // 获得奖励
}
// param.putInt("total_win", under_total_win); // 总赢分
} else {
objLine . putLong ( "reward_tongji" , reward_hp ) ; // 获得奖励
}
objLine . putLong ( "reward_tongji" , reward_hp ) ; // 获得奖励
// String key = String.format("g{%s}:m%s:d_reward", groupId, tagUid);
// int reward_hp = _getCountValue(jedis9, key, beginTime, endTime);
// objLine.putInt("reward_hp", reward_hp);
} else if ( timeType = = 1 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 2 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
}
}
temp . addTObject ( objLine ) ;
}
}
} finally {
jedis9 . close ( ) ;
}
obj . putTArray ( "members" , temp ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static ITObject findPartnerStatMember ( int groupId , int uid , int rootUid , int tagId , int limit , int num ,
int timeType , int beginTime , int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
String sql = String . format ( "SELECT uid, partnerLev" + " FROM group_member"
+ " WHERE groupId = %s and (parentId=%s or uid = %s) and partnerLev > 0 and uid=%s GROUP BY uid %s" ,
groupId , uid , uid , tagId , limitSql ) ;
ITArray temp = TArray . newInstance ( ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
if ( objLine . containsKey ( "uid" ) ) {
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
objLine . putString ( "nick" , acc . nick ) ;
if ( tagUid ! = uid ) {
// int newBeginTime = beginTime - 86400 * 30;
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , false , true ) ;
} else {
// int newBeginTime = beginTime - 86400 * 30;
// getMemberData(jedis9,tagUid,objLine,groupId,timeType,
// beginTime,endTime,false,true);
getDirectMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime ) ;
}
if ( tagUid = = uid ) {
if ( timeType = = 0 ) {
{
String tmpKey = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , tmpKey + "reward_log" , beginTime , endTime ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 1 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 2 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
}
} else {
if ( timeType = = 0 ) {
{
long reward_hp_total = 0 ;
List < Integer > listParent = Utility . getChildParentList ( groupId , tagUid , true ) ;
for ( Integer parId : listParent ) {
String tmpKey = String . format ( "g{%s}:m%s:" , groupId , parId ) ;
int reward_hp = _getCountValue ( jedis9 , tmpKey + "reward_log" , beginTime , endTime ) ;
reward_hp_total + = reward_hp ;
}
String key = String . format ( "g{%s}:m%s:d_reward" , groupId , tagUid ) ;
int reward_hp = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
if ( reward_hp_total = = 0 ) {
reward_hp_total = reward_hp ;
}
objLine . putInt ( "reward_tongji" , ( int ) reward_hp_total ) ;
}
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getCountValue ( jedis9 , key , beginTime , endTime ) ;
objLine . putInt ( "reward_hp" , ( int ) reward_hp ) ;
} else if ( timeType = = 1 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
} else if ( timeType = = 2 ) {
{
String key = String . format ( "g{%s}:m%s:" , groupId , tagUid ) ;
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
objLine . putInt ( "reward_tongji" , reward_hp ) ;
}
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
String key = String . format ( "g{%s}:m%s:reward_log_to:par%s" , groupId , tagUid , uid ) ;
int reward_hp = _getValue ( jedis9 , key + curMonth ) ;
objLine . putInt ( "reward_hp" , reward_hp ) ;
}
}
temp . addTObject ( objLine ) ;
}
}
} finally {
jedis9 . close ( ) ;
}
obj . putTArray ( "members" , temp ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static ITObject getPartnerStat ( int groupId , int uid , int limit , int num , int timeType , int beginTime ,
int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
GroupMemberBean gmb = GroupCache . getMember ( groupId , uid ) ;
int lev = gmb . lev ;
boolean mgr = lev < 3 ;
ITArray list = null ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
if ( mgr ) {
String sql = String . format ( "SELECT A.uid,A.partnerLev, A.autoscore,"
+ "(SELECT COUNT(uid) FROM group_member B where B.groupId = %s AND B.parentId = A.uid) AS total "
+ "FROM group_member AS A" + " where A.groupId= %s and A.partnerLev=1 %s" , groupId , groupId ,
limitSql ) ;
list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-06-01 19:24:36 +08:00
// log.info("统计sql:" + sql);
2026-01-18 06:48:37 +08:00
} else {
String sql = String . format (
"SELECT A.uid,A.partnerLev, A.autoscore, (SELECT COUNT(uid) FROM group_member B where B.groupId = %s AND B.parentId = A.uid) AS total "
+ "FROM group_member AS A"
+ " where A.groupId= %s and (A.parentId=%s or A.uid=%s) AND A.partnerLev >0 %s" ,
groupId , groupId , uid , uid , limitSql ) ;
list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-06-01 19:24:36 +08:00
// log.info("统计sql:" + sql);
2026-01-18 06:48:37 +08:00
}
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
2026-03-27 16:25:13 +08:00
if ( acc ! = null ) {
objLine . putString ( "nick" , acc . nick ) ;
}
2026-01-18 06:48:37 +08:00
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , true , true ) ;
}
} catch ( Exception e ) {
log . error ( e ) ;
} finally {
jedis9 . close ( ) ;
jedis10 . close ( ) ;
}
obj . putTArray ( "members" , list ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static ITObject findPartnerStat ( int groupId , int uid , int tagId , int limit , int num , int timeType ,
int beginTime , int endTime ) throws Exception {
ITObject obj = TObject . newInstance ( ) ;
GroupMemberBean gmb = GroupCache . getMember ( groupId , uid ) ;
int lev = gmb . lev ;
boolean mgr = lev < 3 ;
ITArray list = null ;
String limitSql = String . format ( "limit %s,%s" , limit , num ) ;
if ( mgr ) {
String sql = String . format ( "SELECT A.uid,A.partnerLev, A.autoscore,"
+ "(SELECT COUNT(uid) FROM group_member B where B.groupId = %s AND B.parentId = A.uid) AS total "
+ "FROM group_member AS A" + " where A.groupId= %s and A.uid=%s %s" , groupId , groupId , tagId ,
limitSql ) ;
list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
} else {
if ( uid ! = tagId ) {
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId , tagId , true ) ;
if ( par_list = = null | | ! par_list . contains ( uid ) ) {
throw new WebException ( ErrorCode . GROUP_NOT_PERMISSION ) ;
}
} finally {
jedis10 . close ( ) ;
}
}
String sql = String . format (
"SELECT A.uid,A.partnerLev, A.autoscore, (SELECT COUNT(uid) FROM group_member B where B.groupId = %s AND B.parentId = A.uid) AS total "
+ "FROM group_member AS A" + " where A.groupId= %s AND A.uid=%s %s" ,
groupId , groupId , tagId , limitSql ) ;
list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
}
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject objLine = list . getTObject ( i ) ;
int tagUid = objLine . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( tagUid ) ;
2026-05-01 15:25:05 +08:00
objLine . putString ( "nick" , acc = = null ? "" : acc . nick ) ;
2026-01-18 06:48:37 +08:00
getMemberData ( jedis9 , tagUid , objLine , groupId , timeType , beginTime , endTime , true , true ) ;
}
} finally {
jedis9 . close ( ) ;
jedis10 . close ( ) ;
}
obj . putTArray ( "members" , list ) ;
obj . putInt ( "limit" , limit ) ;
return obj ;
}
public static void getMemberData ( Jedis jedis9 , int uid , ITObject param , int groupId , int timeType , int beginTime ,
int endTime , boolean rewardHP , boolean total ) throws Exception {
GroupBean gb = GroupCache . getGroup ( groupId ) ;
String key = String . format ( "g{%s}:m%s:" , groupId , uid ) ;
String self = total ? "" : "_self" ;
if ( timeType = = 0 ) {
// 包含下级合伙人
long reward_hp_total = 0 ;
// List<Integer> listParent = Utility.getChildParentList(groupId, uid, true);
String uidkey = String . format ( "g{%s}:m%s:d_reward" , groupId , uid ) ;
int reward_hp = _getCountValue ( jedis9 , uidkey , beginTime , endTime ) ;
param . putLong ( "reward_hp" , reward_hp ) ; // 获得奖励
// if (rewardHP) {
//// int reward_hp = _getCountValue(jedis9,key + "reward_log",beginTime,endTime);
//// param.putInt("reward_hp", reward_hp);
//
// // 包含下级合伙人
// long reward_hp_total = 0;
// // List<Integer> listParent = Utility.getChildParentList(groupId, uid, true);
// String uidkey = String.format("g{%s}:m%s:d_reward", groupId, uid);
// int reward_hp = _getCountValue(jedis9, uidkey, beginTime, endTime);
//
// param.putLong("reward_hp", reward_hp); // 获得奖励
// }
int valid_round = _getCountValue ( jedis9 , key + "valid_round" + self , beginTime , endTime ) ;
// param.putInt("valid_round", valid_round);
// int win_round = _getCountNumValue(jedis9, key + "valid_round", beginTime, endTime);
int win_round = _getCountNumValue ( jedis9 , key + "valid_round" , beginTime , endTime ) ;
param . putInt ( "win_round" , win_round ) ;
int total_round = _getCountValue ( jedis9 , key + "round_log" + self , beginTime , endTime ) ;
2026-05-08 16:30:36 +08:00
int total_win = _getCountValue ( jedis9 , key + "total_win" + self , beginTime , endTime ) ;
2026-01-18 06:48:37 +08:00
2026-05-08 16:30:36 +08:00
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt,ifnull(sum(win_score),0) win_score,ifnull(sum(round_reward),0) round_reward from team_round_stat_day where uid="
2026-03-27 16:25:13 +08:00
+ uid + " and stat_day>=" + beginTime + " and stat_day<" + endTime ;
2026-01-18 06:48:37 +08:00
log . info ( "roundSql:" + roundSql ) ;
ITArray roundArr = DataBase . use ( ) . executeQueryByTArray ( roundSql ) ;
if ( roundArr . size ( ) > 0 ) {
ITObject userData = roundArr . getTObject ( 0 ) ;
2026-03-27 16:25:13 +08:00
total_round = userData . getDouble ( "round_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "round_cnt" ) . intValue ( )
: total_round ;
valid_round = userData . getDouble ( "bigwin_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "bigwin_cnt" ) . intValue ( )
2026-06-01 19:24:36 +08:00
: 0 ;
2026-05-08 16:30:36 +08:00
total_win = userData . getDouble ( "win_score" ) . intValue ( ) ! = 0
? userData . getDouble ( "win_score" ) . intValue ( )
: total_win ;
reward_hp = userData . getDouble ( "round_reward" ) . intValue ( ) > 0
? userData . getDouble ( "round_reward" ) . intValue ( )
: reward_hp ;
2026-01-18 06:48:37 +08:00
}
// if (beginTime==1753286400&&endTime==1753372800){
// param.putInt("total_round" , total_round+valid_round/100);
// }else {
// param.putInt("total_round" , total_round);
// }
// g{618028}:m668628:xipai_reward_log_to:par100095:d1758470400
// int xipai_hp_cost = jedis9.getInt("g{"+groupId+"}:m668628:xipai_reward_log_to:par100095:d1758470400");
String sql = "select * from group_member gm,account a where a.id=gm.uid and gm.parentId=" + uid ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
int under_round = 0 ;
int under_win = 0 ;
int under_total_win = 0 ;
int under_reward_hp = 0 ;
int xipai_hp_cost = 0 ;
if ( arr . size ( ) > 0 ) {
// log.info("underKey:"+uid);
for ( int i = 0 ; i < arr . size ( ) ; i + + ) {
ITObject underData = arr . getTObject ( i ) ;
String underKey = String . format ( "g{%s}:m%s:" , groupId , underData . getInt ( "uid" ) ) ;
// under_round += _getCountValue(jedis9, underKey + "round_log", beginTime, endTime);
under_win + = _getCountValue ( jedis9 , underKey + "valid_round" , beginTime , endTime ) ;
under_reward_hp + = _getCountValue ( jedis9 , underKey + "d_reward" , beginTime , endTime ) ;
// log.info("xipai_hp_cost_key:" + "g{" + groupId + "}:m" + underData.getInt("uid")
// + ":xipai_reward_log_to:par" + gb.owner + ":d" + beginTime + "");
//
// String xipai_hp_cost_key = jedis9.get("g{" + groupId + "}:m" + underData.getInt("uid")
// + ":xipai_cost_log:par" + gb.owner + ":d" + beginTime + "");
// log.info("xipai_hp_cost:" + xipai_hp_cost_key);
//
// xipai_hp_cost += (xipai_hp_cost_key == null ? 0 : Integer.parseInt(xipai_hp_cost_key));
// under_total_win += _getCountValue(jedis9, underKey + "total_win", beginTime, endTime);
// log.info("underKey:"+underKey);
// log.info("under_reward_hp:"+under_reward_hp);
}
if ( under_reward_hp ! = 0 ) {
param . putLong ( "reward_hp" , under_reward_hp ) ; // 获得赠送
}
// param.putInt("valid_round", under_win);
} else {
param . putInt ( "total_round" , total_round ) ;
param . putLong ( "reward_hp" , reward_hp ) ; // 获得赠送
}
String cost_key = jedis9 . get ( "g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "" ) ;
int xipai_cost = cost_key = = null ? 0 : Integer . parseInt ( cost_key ) ;
2026-06-01 19:24:36 +08:00
// log.info("xipai_cost:" + xipai_cost);
2026-01-18 06:48:37 +08:00
param . putInt ( "total_win" , total_win - xipai_cost ) ; // 总赢分
param . putInt ( "total_round" , total_round ) ; // 总场次
param . putInt ( "valid_round" , valid_round ) ; // 大赢家
param . putLong ( "reward_hp" , reward_hp ) ; // 获得赠送
ITObject gallc = GroupService . getAllHpCache ( groupId , uid , 30 ) ;
param . putTObject ( "hpall" , gallc ) ;
} else if ( timeType = = 1 ) {
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
if ( rewardHP ) {
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
param . putInt ( "reward_hp" , reward_hp ) ;
}
int win_round = _getNumValue ( jedis9 , key + "valid_round" + self + curMonth ) ;
int valid_round = _getValue ( jedis9 , key + "valid_round" + self + curMonth ) ;
int total_round = _getValue ( jedis9 , key + "round_log" + self + curMonth ) ;
int total_win = _getValue ( jedis9 , key + "total_win" + self + curMonth ) ;
2026-05-08 16:30:36 +08:00
String cost_key = jedis9 . get ( "g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "" ) ;
int xipai_cost = cost_key = = null ? 0 : Integer . parseInt ( cost_key ) ;
2026-06-01 19:24:36 +08:00
// log.info("xipai_cost:" + xipai_cost);
2026-01-18 06:48:37 +08:00
2026-05-08 16:30:36 +08:00
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt,ifnull(sum(win_score),0) win_score,ifnull(sum(round_reward),0) round_reward from team_round_stat_day where uid="
+ uid + " and stat_day>=" + beginTime + " and stat_day<" + endTime ;
2026-06-01 19:24:36 +08:00
// log.info("timeType==1--roundSql:" + roundSql);
2026-05-08 16:30:36 +08:00
ITArray roundArr = DataBase . use ( ) . executeQueryByTArray ( roundSql ) ;
if ( roundArr . size ( ) > 0 ) {
ITObject userData = roundArr . getTObject ( 0 ) ;
total_round = userData . getDouble ( "round_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "round_cnt" ) . intValue ( )
: total_round ;
valid_round = userData . getDouble ( "bigwin_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "bigwin_cnt" ) . intValue ( )
2026-06-01 19:24:36 +08:00
: 0 ;
2026-05-08 16:30:36 +08:00
total_win = userData . getDouble ( "win_score" ) . intValue ( ) ! = 0
? userData . getDouble ( "win_score" ) . intValue ( )
: total_win ;
}
param . putInt ( "valid_round" , valid_round ) ;
param . putInt ( "total_round" , total_round ) ;
param . putInt ( "win_round" , win_round ) ;
param . putInt ( "total_win" , total_win - xipai_cost ) ;
2026-01-18 06:48:37 +08:00
2026-05-08 16:30:36 +08:00
2026-01-18 06:48:37 +08:00
ITObject gallc = GroupService . getAllHpCache ( groupId , uid , 30 ) ;
param . putTObject ( "hpall" , gallc ) ;
} else if ( timeType = = 2 ) {
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
if ( rewardHP ) {
int reward_hp = _getValue ( jedis9 , key + "reward_log" + curMonth ) ;
param . putInt ( "reward_hp" , reward_hp ) ;
}
int win_round = _getNumValue ( jedis9 , key + "valid_round" + self + curMonth ) ;
int valid_round = _getValue ( jedis9 , key + "valid_round" + self + curMonth ) ;
int total_round = _getValue ( jedis9 , key + "round_log" + self + curMonth ) ;
int total_win = _getValue ( jedis9 , key + "total_win" + self + curMonth ) ;
2026-05-08 16:30:36 +08:00
String cost_key = jedis9 . get ( "g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "" ) ;
int xipai_cost = cost_key = = null ? 0 : Integer . parseInt ( cost_key ) ;
2026-06-01 19:24:36 +08:00
// log.info("xipai_cost:" + xipai_cost);
2026-05-08 16:30:36 +08:00
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt,ifnull(sum(win_score),0) win_score,ifnull(sum(round_reward),0) round_reward from team_round_stat_day where uid="
+ uid + " and stat_day>=" + beginTime + " and stat_day<" + endTime ;
2026-06-01 19:24:36 +08:00
// log.info("timeType==2--roundSql:" + roundSql);
2026-05-08 16:30:36 +08:00
ITArray roundArr = DataBase . use ( ) . executeQueryByTArray ( roundSql ) ;
if ( roundArr . size ( ) > 0 ) {
ITObject userData = roundArr . getTObject ( 0 ) ;
total_round = userData . getDouble ( "round_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "round_cnt" ) . intValue ( )
: total_round ;
valid_round = userData . getDouble ( "bigwin_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "bigwin_cnt" ) . intValue ( )
2026-06-01 19:24:36 +08:00
: 0 ;
2026-05-08 16:30:36 +08:00
total_win = userData . getDouble ( "win_score" ) . intValue ( ) ! = 0
? userData . getDouble ( "win_score" ) . intValue ( )
: total_win ;
}
param . putInt ( "total_win" , total_win - xipai_cost ) ;
param . putInt ( "total_round" , total_round ) ;
param . putInt ( "valid_round" , valid_round ) ;
param . putInt ( "win_round" , win_round ) ;
2026-01-18 06:48:37 +08:00
ITObject gallc = GroupService . getAllHpCache ( groupId , uid , 30 ) ;
param . putTObject ( "hpall" , gallc ) ;
}
}
public static List < Integer > getMemberLogList ( int groupId , int uid , boolean self ) {
String pl_key = String . format ( "g{%s}:member_list:%s" , groupId , uid ) ;
Set < String > child_list = Redis . use ( "group1_db10" ) . smembers ( pl_key ) ;
List < Integer > list = new ArrayList < > ( ) ;
if ( self ) {
list . add ( uid ) ;
}
for ( String str : child_list ) {
list . add ( Integer . parseInt ( str ) ) ;
}
return list ;
}
private static void getDirectMemberData ( Jedis jedis9 , int uid , ITObject param , int groupId , int timeType ,
int beginTime , int endTime ) {
String key = String . format ( "g{%s}:m%s:" , groupId , uid ) ;
if ( timeType = = 0 ) {
/ *
* int valid_round = _getCountValue ( jedis9 , key +
* "d_valid_round" , beginTime , endTime ) ; param . putInt ( "valid_round" ,
* valid_round ) ;
*
* int total_round = _getCountValue ( jedis9 , key +
* "d_round_log" , beginTime , endTime ) ; param . putInt ( "total_round" , total_round ) ;
*
* int total_win = _getCountValue ( jedis9 , key + "d_total_win" , beginTime , endTime ) ;
* param . putInt ( "total_win" , total_win ) ;
* /
int valid_round = _getCountValue ( jedis9 , key + "d_valid_round" , beginTime , endTime ) ;
param . putInt ( "valid_round" , valid_round ) ;
int win_round = _getCountNumValue ( jedis9 , key + "d_valid_round" , beginTime , endTime ) ;
param . putInt ( "win_round" , win_round ) ;
int total_round = _getCountValue ( jedis9 , key + "d_round_log" , beginTime , endTime ) ;
param . putInt ( "total_round" , total_round ) ;
int total_win = _getCountValue ( jedis9 , key + "d_total_win" , beginTime , endTime ) ;
param . putInt ( "total_win" , total_win ) ;
} else if ( timeType = = 1 ) {
String curMonth = ":m" + DateUtils . getBeginMonth ( ) ;
int valid_round = _getValue ( jedis9 , key + "d_valid_round" + curMonth ) ;
param . putInt ( "valid_round" , valid_round ) ;
int win_round = _getNumValue ( jedis9 , key + "d_valid_round" + curMonth ) ;
param . putInt ( "win_round" , win_round ) ;
int total_round = _getValue ( jedis9 , key + "d_round_log" + curMonth ) ;
param . putInt ( "total_round" , total_round ) ;
int total_win = _getValue ( jedis9 , key + "d_total_win" + curMonth ) ;
param . putInt ( "total_win" , total_win ) ;
} else if ( timeType = = 2 ) {
String curMonth = ":m" + DateUtils . getBeginLastMonth ( ) ;
int valid_round = _getValue ( jedis9 , key + "d_valid_round" + curMonth ) ;
param . putInt ( "valid_round" , valid_round ) ;
int win_round = _getNumValue ( jedis9 , key + "d_valid_round" + curMonth ) ;
param . putInt ( "win_round" , win_round ) ;
int total_round = _getValue ( jedis9 , key + "d_round_log" + curMonth ) ;
param . putInt ( "total_round" , total_round ) ;
int total_win = _getValue ( jedis9 , key + "d_total_win" + curMonth ) ;
param . putInt ( "total_win" , total_win ) ;
}
}
/ * *
* 获 取 战 绩 列 表
*
* @param platform
* @param groupId
* @param limit
* @param num
* @return
* /
public static ITObject getMemberStat ( int groupId , int uid , int qid , int partnerId , int limit , int num , int timeType ,
int beginTime , int endTime , int sortType ) throws Exception {
ITObject obj1 = TObject . newInstance ( ) ;
String qid_sql = StringUtil . Empty ;
if ( qid > 0 ) {
GroupMemberBean mng_bean = GroupCache . getMember ( groupId , uid ) ;
if ( mng_bean = = null ) {
throw new WebException ( ErrorCode . GROUP_NOT_MEMBER ) ;
}
int mgn_partner = mng_bean . partnerLev ;
int mgn_lev = mng_bean . lev ;
if ( mgn_lev = = 3 & & mgn_partner = = 0 ) {
throw new WebException ( ErrorCode . GROUP_NOT_PARTNER ) ;
}
if ( mgn_lev = = 3 ) {
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId , qid , false ) ;
2026-06-01 19:24:36 +08:00
if ( ( par_list = = null | | ! par_list . contains ( uid ) ) & & qid ! = uid ) {
2026-01-18 06:48:37 +08:00
throw new WebException ( ErrorCode . GROUP_NOT_PERMISSION ) ;
}
} finally {
jedis10 . close ( ) ;
}
}
qid_sql = " AND A.uid=" + qid ;
} else if ( partnerId > 0 ) {
String ugm_key = GroupMemberCache . genKey ( groupId , partnerId ) ;
String lev = Redis . use ( "group1_db10" ) . hget ( ugm_key , "lev" ) ;
boolean mgr = StringUtil . isNotEmpty ( lev ) & & Integer . parseInt ( lev ) < 3 ;
String p = Utility . getChildParentSql ( groupId , partnerId , true ) ;
if ( mgr ) {
p = p + ",0" ;
}
if ( Integer . parseInt ( lev ) > 1 ) {
qid_sql = String . format ( " AND (A.parentId in(%s) or A.uid = %s)" , p , partnerId ) ;
}
GroupBean gb = GroupCache . getGroup ( groupId ) ;
if ( gb . owner = = uid & & partnerId = = gb . owner ) {
qid_sql = "" ;
}
// qid_sql = String.format(" AND A.parentId = %s", partnerId);
}
if ( timeType = = 0 ) {
beginTime = DateUtils . getBeginDay ( ) ;
endTime = DateUtils . getEndDay ( ) ;
} else if ( timeType = = 1 ) {
beginTime = DateUtils . getBeginDay ( ) - 3600 * 24 ;
endTime = DateUtils . getBeginDay ( ) ;
} else if ( timeType = = 2 ) {
beginTime = DateUtils . getBeginDay ( ) - 3600 * 48 ;
endTime = DateUtils . getBeginDay ( ) - 3600 * 24 ;
}
String order_sql = "ORDER BY win DESC " ;
if ( sortType > 0 ) {
ArrayList < String > tempSortList = new ArrayList < String > ( ) ;
tempSortList . add ( "score" ) ;
tempSortList . add ( "round" ) ;
tempSortList . add ( "win" ) ;
tempSortList . add ( "pump" ) ;
order_sql = String . format ( " ORDER BY %s %s " , tempSortList . get ( ( sortType - 1 ) / 2 ) ,
( sortType % 2 = = 1 ? "DESC" : "ASC" ) ) ;
}
String sql = String . format (
2026-05-01 15:25:05 +08:00
"SELECT IFNULL(B.win, 0) AS win, IFNULL(B.ROUND, 0) AS round, IFNULL(B.score, 0) + IFNULL(D.reason15_hp, 0) AS score, IFNULL(C.pump, 0) AS pump, A.uid, A.hp, A.lev, A.partnerLev "
2026-01-18 06:48:37 +08:00
+ "FROM group_member AS A "
+ "LEFT JOIN( SELECT SUM(win) AS win, SUM(ROUND) AS ROUND, SUM(score) AS score, uid FROM group_member_log WHERE groupId = %s AND TIME >= %s AND TIME < %s GROUP BY uid ) AS B ON A.uid = B.uid "
+ "LEFT JOIN( SELECT IFNULL(SUM(hp), 0) AS pump, uid FROM group_hp_log WHERE gid = %s AND TIME >= %s AND TIME < %s AND reason = 7 GROUP BY uid ) AS C ON A.uid = C.uid "
2026-05-01 15:25:05 +08:00
+ "LEFT JOIN (SELECT SUM(hp) AS reason15_hp,uid FROM group_hp_log WHERE gid = %s AND TIME >= %s AND TIME < %s AND reason = 18 GROUP BY uid ) AS D ON A.uid = D.uid "
2026-01-18 06:48:37 +08:00
+ "WHERE A.groupId = %s AND round > 0 %s " + "GROUP BY A.uid %s" + "limit %s,%s" ,
2026-05-01 15:25:05 +08:00
groupId , beginTime , endTime , groupId , beginTime , endTime , groupId , beginTime , endTime , groupId , qid_sql ,
order_sql , limit , num ) ;
2026-01-18 06:48:37 +08:00
2026-06-01 19:24:36 +08:00
// log.info("查询sql:" + sql);
2026-01-18 06:48:37 +08:00
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( arr . size ( ) > 0 ) {
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
String strtmp = "" ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
AccountBean acc = AccountCache . getAccount ( obj . getInt ( "uid" ) ) ;
if ( acc ! = null ) {
obj . putString ( "nick" , acc . nick ) ;
} else {
obj . putString ( "nick" , StringUtil . Empty ) ;
}
//
strtmp = String . format (
"SELECT IFNULL(SUM(hp), 0) AS reward_hp from group_hp_log where gid=%s and reason=7 and uid=%s and time >=%s AND time <%s" ,
groupId , acc . id , beginTime , endTime ) ;
ITArray arrtmp = DataBase . use ( ) . executeQueryByTArray ( strtmp ) ;
if ( arrtmp . size ( ) > 0 ) {
obj . putDouble ( "`pump`" , arrtmp . getTObject ( 0 ) . getDouble ( "reward_hp" ) ) ;
} else {
obj . putInt ( "pump" , 0 ) ;
}
}
} finally {
jedis9 . close ( ) ;
}
}
obj1 . putTArray ( "members" , arr ) ;
obj1 . putInt ( "limit" , limit ) ;
return obj1 ;
}
/ * *
* 获 取 战 绩 列 表
*
* @param platform
* @param groupId
* @param limit
* @param num
* @return
* /
public static ITObject getRecords ( String platform , int groupId , int limit , int num , int qid , int uid ,
int includeMembers , int timeType , int beginTime , int endTime ) throws Exception {
boolean find = true ;
boolean mgr = true ;
boolean tagIsPartner = false ;
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
GroupMemberBean mng = GroupCache . getMember ( groupId , uid ) ;
int _lev = mng . lev ;
mgr = _lev < 3 ;
if ( qid > 0 ) {
GroupMemberBean tag = GroupCache . getMember ( groupId , qid ) ;
if ( tag ! = null ) {
int parentId = tag . parentId ;
if ( ! mgr ) {
if ( parentId = = 0 ) {
2026-06-01 19:24:36 +08:00
// log.info("parentId == 0 find:"+find);
2026-01-18 06:48:37 +08:00
find = false ;
} else {
if ( tag . partnerLev > 0 ) {
tagIsPartner = true ;
}
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId ,
includeMembers = = 0 ? parentId : qid , true ) ;
2026-06-01 19:24:36 +08:00
if ( ( par_list = = null | | ! par_list . contains ( uid ) ) & & uid ! = qid ) {
// log.info("par_list:"+par_list);
// log.info("uid:"+uid);
//
// log.info("par_list == null || !par_list.contains(uid) find:"+find);
2026-01-18 06:48:37 +08:00
find = false ;
}
}
}
} else {
2026-06-01 19:24:36 +08:00
log . info ( "else find:" + find ) ;
2026-01-18 06:48:37 +08:00
find = false ;
}
}
2026-06-01 19:24:36 +08:00
} catch ( Exception e ) {
e . printStackTrace ( ) ;
log . error ( e ) ;
2026-01-18 06:48:37 +08:00
} finally {
jedis10 . close ( ) ;
}
ITArray militaryList = TArray . newInstance ( ) ;
if ( find ) {
String where = StringUtil . Empty ;
if ( timeType = = 0 ) {
where = String . format ( "gid=%s and time>=%s and time<=%s" , groupId , beginTime , endTime ) ;
} else if ( timeType = = 1 ) {
beginTime = DateUtils . getBeginMonth ( ) ;
where = String . format ( "gid=%s and time>=%s" , groupId , beginTime ) ;
} else if ( timeType = = 2 ) {
beginTime = DateUtils . getBeginLastMonth ( ) ;
endTime = DateUtils . getBeginMonth ( ) ;
where = String . format ( "gid=%s and time>=%s and time<=%s" , groupId , beginTime , endTime ) ;
} else {
beginTime = DateUtils . getBeginDay ( ) - 259200 ;
endTime = DateUtils . getEndDay ( ) ;
where = String . format ( "gid=%s and time>=%s and time<=%s" , groupId , beginTime , endTime ) ;
}
if ( qid = = 0 ) {
if ( ! mgr ) {
String p = Utility . getChildParentSql ( groupId , uid , true ) ;
where + = String . format ( " and (parentId in(%s) or uid = %s)" , p , uid ) ;
}
} else {
if ( includeMembers = = 1 ) {
String p ;
if ( tagIsPartner ) {
p = Utility . getChildParentSql ( groupId , qid , true ) ;
where + = String . format ( " and (parentId in(%s) or uid = %s)" , p , qid ) ;
} else {
where + = " and uid=" + qid ;
}
} else {
where + = " and uid=" + qid ;
}
}
String sql = String . format ( "select rec_key from room_rec_log where %s ORDER BY time desc limit %s,%s" ,
where , limit , num ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( list . size ( ) > 0 ) {
Jedis jedis5 = Redis . use ( "group1_db5" ) . getJedis ( ) ;
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject tem = list . getTObject ( i ) ;
String rec_key = tem . getString ( "rec_key" ) ;
ITObject obj = Utility . getMilitaryList ( jedis5 , rec_key , platform ) ;
if ( obj = = null ) {
continue ;
}
militaryList . addTObject ( obj ) ;
}
} finally {
jedis5 . close ( ) ;
}
}
}
ITObject obj1 = TObject . newInstance ( ) ;
obj1 . putTArray ( "records" , militaryList ) ;
obj1 . putInt ( "limit" , limit ) ;
return obj1 ;
}
/ * *
* 根 据 房 间 ID 查 询 战 绩
*
* @param platform
* @param groupId
* @param roomid
* @return
* /
public static ITArray findRecordByRoom ( String platform , int groupId , String roomid , int uid ) throws Exception {
if ( StringUtil . isNotEmpty ( roomid ) ) {
if ( roomid . length ( ) ! = 6 ) {
return null ;
}
}
boolean find = false ;
int time3last = DateUtils . getBeginDay ( ) - 259200 ;
String sql = String . format ( "select rec_key,uid from room_rec_log where gid=%s and roomid='%s' and time>=%s" ,
groupId , roomid , time3last ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( list . size ( ) = = 0 )
return null ;
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
GroupMemberBean mng = GroupCache . getMember ( groupId , uid ) ;
int _lev = mng . lev ;
boolean mgr = _lev < 3 ;
if ( ! mgr ) {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject obj = list . getTObject ( i ) ;
int id = obj . getInt ( "uid" ) ;
if ( id = = uid ) {
find = true ;
break ;
}
GroupMemberBean tag = GroupCache . getMember ( groupId , id ) ;
if ( tag = = null )
continue ;
int par = tag . parentId ;
if ( par = = 0 )
continue ;
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId , par , true ) ;
if ( par_list ! = null & & par_list . contains ( uid ) ) {
find = true ;
break ;
}
}
} else {
find = true ;
}
} finally {
jedis10 . close ( ) ;
}
if ( ! find )
return null ;
ITArray militaryList = TArray . newInstance ( ) ;
Jedis jedis5 = Redis . use ( "group1_db5" ) . getJedis ( ) ;
try {
for ( int i = 0 ; i < list . size ( ) ; i + + ) {
String rec_key = list . getTObject ( i ) . getString ( "rec_key" ) ;
ITObject data = Utility . getMilitaryList ( jedis5 , rec_key , platform ) ;
boolean flag = true ;
for ( int j = 0 ; j < militaryList . size ( ) ; j + + ) {
ITObject temp = militaryList . getTObject ( j ) ;
String temp_create_time = temp . getString ( "create_time" ) ;
String create_time = data . getString ( "create_time" ) ;
String temp_rec_key = temp . getString ( "military_id" ) ;
if ( temp_rec_key . equals ( rec_key ) & & create_time . equals ( temp_create_time ) ) {
flag = false ;
break ;
}
}
if ( flag ) {
militaryList . addTObject ( data ) ;
}
}
return militaryList ;
} finally {
jedis5 . close ( ) ;
}
}
/ * *
*
* @param groupId
* @param uid
* @param limit
* @param num
* @param type 1 上 分 2 下 分 3 合 伙 人 上 分 4 合 伙 人 下 分
* @return
* @throws Exception
* /
public static final ITObject getHpLogMgr ( int groupId , int uid , int limit , int num , int type , int qid ,
String tagName ) throws Exception {
GroupMemberBean mng = GroupCache . getMember ( groupId , uid ) ;
int beginDay = DateUtils . getBeginDay ( ) ;
int beginTime = beginDay - 9 * 24 * 3600 ;
if ( mng . lev > = 3 ) {
beginTime = beginDay - 2 * 24 * 3600 ;
}
long endTime = DateUtils . getEndDay ( ) ;
int reason = MGRLOG_TYPE [ type - 1 ] ;
String mgr_sql = StringUtil . Empty ;
String qid_sql = StringUtil . Empty ;
ITArray arr = null ;
if ( type > 2 ) {
mgr_sql = "and A.mgr_id=" + uid ;
if ( StringUtil . isNotEmpty ( tagName ) | | qid > 0 ) {
if ( qid > 0 ) {
qid_sql = "and A.uid=" + qid ;
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format (
"SELECT uid,mgr_id,hp,cur_hp,time FROM group_hp_log as A %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
}
if ( StringUtil . isNotEmpty ( tagName ) ) {
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format ( "SELECT A.uid,A.mgr_id,A.hp,A.cur_hp,A.time " + "FROM group_hp_log as A "
+ "RIGHT JOIN account as B " + "ON A.uid = B.id and B.nick like '%%%s%%' "
+ "%s ORDER BY time desc " + "limit %s,%s" , tagName , where_sql , limit , num ) ;
ITArray temp = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( temp . size ( ) > 0 ) {
if ( arr = = null ) {
arr = temp ;
} else {
for ( int i = 0 ; i < temp . size ( ) ; i + + ) {
ITObject mo = temp . getTObject ( i ) ;
if ( qid > 0 & & mo . getInt ( "uid" ) = = qid ) {
continue ;
}
arr . addTObject ( temp . getTObject ( i ) ) ;
}
}
}
}
} else {
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format (
"SELECT uid,mgr_id,hp,cur_hp,time FROM group_hp_log as A %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
}
} else {
if ( StringUtil . isNotEmpty ( tagName ) | | qid > 0 ) {
if ( qid > 0 ) {
qid_sql = "and (A.uid=" + qid ;
qid_sql + = " or A.mgr_id=" + qid + ")" ;
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format (
"SELECT uid,mgr_id,hp,cur_hp,time FROM group_hp_log as A %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
}
if ( StringUtil . isNotEmpty ( tagName ) ) {
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format ( "SELECT A.uid,A.mgr_id,A.hp,A.cur_hp,A.time " + "FROM group_hp_log as A "
+ "RIGHT JOIN account as B "
+ "ON (A.uid = B.id OR A.mgr_id = B.id) and B.nick like '%%%s%%' "
+ "%s ORDER BY time desc " + "limit %s,%s" , tagName , where_sql , limit , num ) ;
ITArray temp = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
if ( temp . size ( ) > 0 ) {
if ( arr = = null ) {
arr = temp ;
} else {
for ( int i = 0 ; i < temp . size ( ) ; i + + ) {
ITObject mo = temp . getTObject ( i ) ;
if ( qid > 0 & & mo . getInt ( "uid" ) = = qid ) {
continue ;
}
arr . addTObject ( temp . getTObject ( i ) ) ;
}
}
}
}
} else {
String where_sql = String . format (
"WHERE A.gid = %s " + "and A.reason = %s " + "and A.time>=%s " + "and A.time <=%s %s %s" ,
groupId , reason , beginTime , endTime , mgr_sql , qid_sql ) ;
String sql = String . format (
"SELECT uid,mgr_id,hp,cur_hp,time FROM group_hp_log as A %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
}
}
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
if ( arr ! = null ) {
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
AccountBean acc = AccountCache . getAccount ( obj . getInt ( "uid" ) ) ;
obj . putString ( "t_nick" , acc . nick ) ;
acc = AccountCache . getAccount ( obj . getInt ( "mgr_id" ) ) ;
obj . putString ( "m_nick" , acc . nick ) ;
}
resData . putTArray ( "hp_logs" , arr ) ;
}
return resData ;
}
/ * *
* 获 取 体 力 值 管 理 统 计 数 据
*
* @param groupId
* @return
* @throws Exception
* /
public static final ITObject getHpLogMgrCount ( int groupId ) throws Exception {
int beginTime = DateUtils . getBeginDay ( ) - 9 * 24 * 3600 ;
long upper_count = 0 ;
long sub_count = 0 ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
String str = null ;
for ( int i = 0 ; i < 10 ; + + i ) {
String hp_mgr_upper_key = String . format ( "g%s:hp_mgr:upper:d%s" , groupId , beginTime ) ;
String hp_mgr_sub_key = String . format ( "g%s:hp_mgr:sub:d%s" , groupId , beginTime ) ;
str = jedis9 . get ( hp_mgr_upper_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
upper_count + = Long . parseLong ( str ) ;
}
str = jedis9 . get ( hp_mgr_sub_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
sub_count + = Long . parseLong ( str ) ;
}
beginTime + = 24 * 3600 ;
}
String hp_cost_key = String . format ( "g%s:hp_cost:d%s" , groupId , DateUtils . getBeginDay ( ) ) ;
long hp_cost_count = 0 ;
str = jedis9 . get ( hp_cost_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
hp_cost_count + = Long . parseLong ( str ) ;
}
hp_cost_key = String . format ( "g%s:hp_cost:d%s" , groupId , DateUtils . getBeginLastday ( ) ) ;
long last_hp_cost_count = 0 ;
str = jedis9 . get ( hp_cost_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
last_hp_cost_count + = Long . parseLong ( str ) ;
}
ITObject resData = TObject . newInstance ( ) ;
resData . putLong ( "hp_cost" , hp_cost_count ) ;
resData . putLong ( "last_hp_cost" , last_hp_cost_count ) ;
resData . putLong ( "hp_upper" , upper_count ) ;
resData . putLong ( "hp_sub" , sub_count ) ;
return resData ;
} finally {
jedis9 . close ( ) ;
}
}
/ * *
* 获 取 体 力 值 管 理 员 详 细 信 息
*
* @param jedis9
* @param groupId
* @param uid
* @param beginTime
* @param endTime
* @param mgr
* @return
* /
private static final ITObject _getHpLogMgrInfo ( Jedis jedis9 , int groupId , int uid , int beginTime , int endTime ,
boolean mgr ) {
long upper_count = 0 ;
long sub_count = 0 ;
AccountBean acc = AccountCache . getAccount ( uid ) ;
String str = null ;
int tem = beginTime ;
int tem_day = ( endTime - beginTime ) / 86400 ;
String hp_key = mgr ? "hp_mgr" : "hp_par" ;
for ( int k = 0 ; k < tem_day ; + + k ) {
String hp_mgr_upper_key = String . format ( "g%s:%s:upper:u%s:d%s" , groupId , hp_key , uid , tem ) ;
String hp_mgr_sub_key = String . format ( "g%s:%s:sub:u%s:d%s" , groupId , hp_key , uid , tem ) ;
str = jedis9 . get ( hp_mgr_upper_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
upper_count + = Long . parseLong ( str ) ;
}
str = jedis9 . get ( hp_mgr_sub_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
sub_count + = Long . parseLong ( str ) ;
}
tem + = 86400 ;
}
ITObject info = TObject . newInstance ( ) ;
info . putLong ( "hp_upper" , upper_count ) ;
info . putLong ( "hp_sub" , sub_count ) ;
info . putString ( "nick" , acc . nick ) ;
if ( mgr ) {
String gm_key = "gm_" + groupId + "_" + uid ;
String lev_str = Redis . use ( "group1_db10" ) . hget ( gm_key , "lev" ) ;
info . putInt ( "lev" , StringUtil . isEmpty ( lev_str ) ? 2 : Integer . parseInt ( lev_str ) ) ;
}
return info ;
}
/ * *
* 获 取 体 力 值 管 理 员 详 细 信 息
*
* @param groupId
* @param uid 操 作 人
* @param beginTime
* @param endTime
* @param type 1 管 理 员 2 合 伙 人
* @return
* @throws Exception
* /
public static final ITArray getHpLogMgrInfo ( int groupId , int uid , int beginTime , int endTime , int type )
throws Exception {
if ( type = = 1 ) {
String sql = String . format ( "SELECT uid FROM group_member WHERE groupId =%s AND lev <3" , groupId ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
ITArray list = TArray . newInstance ( ) ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
ITObject info = _getHpLogMgrInfo ( jedis9 , groupId , obj . getInt ( "uid" ) , beginTime , endTime , type = = 1 ) ;
list . addTObject ( info ) ;
}
return list ;
} finally {
jedis9 . close ( ) ;
}
} else {
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
ITArray list = TArray . newInstance ( ) ;
ITObject info = _getHpLogMgrInfo ( jedis9 , groupId , uid , beginTime , endTime , type = = 1 ) ;
list . addTObject ( info ) ;
return list ;
} finally {
jedis9 . close ( ) ;
}
}
}
/ * *
* 体 力 值 抽 水 记 录
*
* @param groupId
* @param tagId
* @param limit
* @param num
* @param choose
* @return
* /
public static final ITObject getHpLogPumpInfo ( int groupId , int uids , int limit , int num , int beginTime , int endTime )
throws Exception {
String where_sql = String . format ( "WHERE gid = %s and reason = %s and time>=%s and time <=%s" , groupId ,
ConsumeCode . HP_PUMP , beginTime , endTime ) ;
String sql = String . format ( "SELECT uid,hp,roomid,pid,time FROM group_hp_log %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
int uid = obj . getInt ( "uid" ) ;
AccountBean acc = AccountCache . getAccount ( uid ) ;
obj . putString ( "nick" , acc . nick ) ;
}
int hp_cost = 0 ;
int hp_reward = 0 ;
int count = 0 ;
int valid_count = 0 ;
int reward_hpnum = 0 ;
if ( limit = = 0 ) {
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
String hp_cost_key = String . format ( "g%s:hp_cost" , groupId ) ;
String hp_reward_key = String . format ( "g%s:hp_reward" , groupId ) ;
String total_round = String . format ( "g%s:round" , groupId ) ;
String valid_round = String . format ( "g%s:valid_room" , groupId ) ;
2026-06-01 19:24:36 +08:00
// log.info("盟主号大赢家总数:" + _getCountValue(jedis9, valid_round, beginTime, endTime));
2026-03-27 16:25:13 +08:00
2026-01-18 09:24:22 +08:00
valid_count = _getCountValue ( jedis9 , valid_round , beginTime , endTime ) ;
GroupBean gb = GroupCache . getGroup ( groupId ) ;
2026-03-27 16:25:13 +08:00
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt from team_round_stat_day where uid="
+ gb . owner + " and stat_day>=" + beginTime + " and stat_day<" + endTime ;
2026-05-01 15:25:05 +08:00
log . info ( "盟主号大赢家总数SQL:" + roundSql ) ;
2026-06-01 19:24:36 +08:00
// String reward_hp = String.format("g{%s}:m%s:", groupId,uids);
hp_cost = _getCountValue ( jedis9 , hp_cost_key , beginTime , endTime ) ;
hp_reward = _getCountValue ( jedis9 , hp_reward_key , beginTime , endTime ) ;
count = _getCountValue ( jedis9 , total_round , beginTime , endTime ) ;
2026-01-18 09:24:22 +08:00
ITArray roundArr = DataBase . use ( ) . executeQueryByTArray ( roundSql ) ;
if ( roundArr . size ( ) > 0 ) {
ITObject userData = roundArr . getTObject ( 0 ) ;
2026-03-27 16:25:13 +08:00
valid_count = userData . getDouble ( "bigwin_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "bigwin_cnt" ) . intValue ( )
2026-06-01 19:24:36 +08:00
: 0 ;
count = userData . getDouble ( "round_cnt" ) . intValue ( ) > 0
? userData . getDouble ( "round_cnt" ) . intValue ( )
: count ;
2026-01-18 09:24:22 +08:00
}
2026-06-01 19:24:36 +08:00
// log.info("盟主号大赢家总数SQL:" + valid_count);
2026-01-18 09:24:22 +08:00
2026-01-18 06:48:37 +08:00
// reward_hpnum = _getCountValue(jedis9,reward_hp +
// "reward_log",beginTime,endTime);
} finally {
jedis9 . close ( ) ;
}
}
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
resData . putTArray ( "hp_logs" , arr ) ;
// 计算群主每日抽水
GroupBean gb = GroupCache . getGroup ( groupId ) ;
String pumpwhere_sql = String . format (
" WHERE gid = %s and uid=%s and reason = %s and time>=%s and time <=%s AND info != '' " , groupId ,
gb . owner , ConsumeCode . HP_PARTNER_REWARD , beginTime , endTime ) ;
String pumpsql = String . format ( "SELECT ifnull(sum(hp),0) as hp FROM group_hp_log %s " , pumpwhere_sql ) ;
ITArray resultArray = DataBase . use ( ) . executeQueryByTArray ( pumpsql ) ;
if ( resultArray . size ( ) = = 0 ) {
resData . putInt ( "pump" , 0 ) ;
} else {
ITObject dbData = resultArray . getTObject ( 0 ) ;
Double pump = dbData . getDouble ( "hp" ) ;
String xipaiwhere_sql = String . format (
2026-05-01 15:25:05 +08:00
" WHERE gid = %s and reason in(%s,%s) and time>=%s and time <=%s AND info != '' " , groupId ,
ConsumeCode . HP_XIPAI_PUMP , ConsumeCode . HP_PARTNER_XIPAI_REWARD_BACK , beginTime , endTime ) ;
2026-01-18 06:48:37 +08:00
String xipaisql = String . format ( "SELECT ifnull(sum(hp),0) as hp FROM group_hp_log %s " , xipaiwhere_sql ) ;
ITArray xipaiArray = DataBase . use ( ) . executeQueryByTArray ( xipaisql ) ;
if ( xipaiArray . size ( ) = = 0 ) {
2026-03-27 16:25:13 +08:00
// 获得赠送
2026-01-18 06:48:37 +08:00
resData . putDouble ( "pump" , pump ) ;
} else {
ITObject xipaiData = xipaiArray . getTObject ( 0 ) ;
2026-03-27 16:25:13 +08:00
// 获得赠送
2026-01-18 06:48:37 +08:00
resData . putDouble ( "pump" , pump - xipaiData . getDouble ( "hp" ) ) ;
}
2026-06-01 19:24:36 +08:00
2026-01-18 06:48:37 +08:00
}
// resData.putInt("pump", hp_cost);
2026-06-01 19:24:36 +08:00
String rewardsql = String . format (
" SELECT -sum(win_score+round_reward) reward FROM `team_round_stat_day` WHERE stat_day >= %s AND stat_day < %s and uid!=%s" ,
beginTime , endTime , gb . owner ) ;
// log.info("rewardsql:" + rewardsql);
ITArray rewardArray = DataBase . use ( ) . executeQueryByTArray ( rewardsql ) ;
if ( rewardArray . size ( ) ! = 0 ) {
ITObject rewardData = rewardArray . getTObject ( 0 ) ;
// log.info("reward:" + rewardData.getDouble("reward") );
resData . putDouble ( "pump" , rewardData . getDouble ( "reward" ) ) ;
}
2026-01-18 06:48:37 +08:00
resData . putInt ( "gains" , hp_cost - hp_reward ) ;
2026-03-27 16:25:13 +08:00
// 总数
2026-01-18 06:48:37 +08:00
resData . putInt ( "count" , count ) ;
2026-03-27 16:25:13 +08:00
// 场次
2026-06-01 19:24:36 +08:00
// log.info("valid_count:" + valid_count);
// log.info("hp_cost - hp_reward:" + (hp_cost - hp_reward));
2026-01-18 06:48:37 +08:00
resData . putInt ( "valid_count" , valid_count ) ;
return resData ;
}
/ * *
* 体 力 值 详 情
*
* @param groupId
* @param tagId
* @param limit
* @param num
* @param choose
* @return
* /
public static final ITObject getHpLogInfo ( int groupId , int tagId , int limit , int num , int choose , int beginTime ,
int endTime ) throws Exception {
String reason_sql = StringUtil . Empty ;
if ( ( choose & CHOOSE_UPPER ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_MGR_UPPER + "," + ConsumeCode . HP_PARTNER_UPPER + "," ;
reason_sql + = ConsumeCode . HP_MGR_SUB + "," + ConsumeCode . HP_PARTNER_SUB + "," ;
}
if ( ( choose & CHOOSE_SUB ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_MGR_SUB + "," + ConsumeCode . HP_PARTNER_SUB + "," ;
}
if ( ( choose & CHOOSE_PUMP ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_PUMP + "," ;
}
if ( ( choose & CHOOSE_RWARD ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_PARTNER_REWARD + "," ;
}
if ( ( choose & CHOOSE_CHAGE ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_PUMP_TOTAL + "," ;
2026-05-08 16:30:36 +08:00
reason_sql + = ConsumeCode . HP_PUMP_BAODI + "," ;
2026-01-18 06:48:37 +08:00
}
if ( ( choose & CHOOSE_TRADE ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_TRADE + "," ;
}
if ( ( choose & CHOOSE_TAKE_REWARD ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_TAKE_REWARD + "," ;
}
if ( ( choose & CHOOSE_XIPAI ) ! = 0 ) {
reason_sql + = ConsumeCode . HP_PARTNER_XIPAI_REWARD + "," ;
}
2026-05-08 16:30:36 +08:00
2026-05-01 15:25:05 +08:00
2026-01-18 06:48:37 +08:00
// reason_sql +=ConsumeCode.HP_CLEARING+ ",";
if ( StringUtil . isNotEmpty ( reason_sql ) ) {
reason_sql = reason_sql . substring ( 0 , reason_sql . length ( ) - 1 ) ;
} else {
reason_sql = "0" ;
}
// int time = DateUtils.getBeginDay() - 2 * 24 * 3600;
String where_sql = String . format ( "WHERE gid = %s and uid =%s and reason in(%s) and time > %s and time < %s" ,
groupId , tagId , reason_sql , beginTime , endTime ) ;
String sql = String . format ( "SELECT pid,mgr_id,hp,reason,cur_hp,time,info,roomid " + "FROM group_hp_log %s "
+ "ORDER BY time desc " + "limit %s,%s" , where_sql , limit , num ) ;
2026-06-01 19:24:36 +08:00
// log.info("getHpLogInfo sql:" + sql);
2026-01-18 06:48:37 +08:00
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
int mgr_id = obj . getInt ( "mgr_id" ) ;
if ( mgr_id > 0 ) {
AccountBean acc = AccountCache . getAccount ( obj . getInt ( "mgr_id" ) ) ;
obj . putString ( "m_nick" , acc . nick ) ;
}
}
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
resData . putTArray ( "hp_logs" , arr ) ;
return resData ;
}
/ * *
* 体 力 值 详 情
*
* @param groupId
* @param tagId
* @param limit
* @param num
* @param choose
* @return
* /
public static final ITObject getHpLogDetailInfo ( int groupId , int tagId , String roomId , int time ) throws Exception {
String reason_sql = StringUtil . Empty ;
reason_sql + = ConsumeCode . HP_CLEARING + "," ;
reason_sql + = ConsumeCode . HP_PUMP + "," ;
reason_sql + = ConsumeCode . HP_XIPAI_PUMP + "," ;
2026-05-08 16:30:36 +08:00
// reason_sql += ConsumeCode.HP_PUMP_BAODI + ",";
2026-01-18 06:48:37 +08:00
if ( StringUtil . isNotEmpty ( reason_sql ) ) {
reason_sql = reason_sql . substring ( 0 , reason_sql . length ( ) - 1 ) ;
} else {
reason_sql = "0" ;
}
String where_sql = String . format (
"WHERE gid = %s and uid =%s and reason in(%s) and roomId ='%s' and time >= %s and time <= %s and hp!=0" ,
groupId , tagId , reason_sql , roomId , time - 7200 , time + 3600 ) ;
String sql = String . format (
"SELECT mgr_id,hp,reason,cur_hp,time,info,roomid " + "FROM group_hp_log %s " + "ORDER BY time desc" ,
where_sql ) ;
2026-06-01 19:24:36 +08:00
// log.info("详情sql:"+sql);
2026-01-18 06:48:37 +08:00
try {
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
for ( int i = 0 ; i < arr . size ( ) ; + + i ) {
ITObject obj = arr . getTObject ( i ) ;
int mgr_id = obj . getInt ( "mgr_id" ) ;
if ( mgr_id > 0 ) {
AccountBean acc = AccountCache . getAccount ( obj . getInt ( "mgr_id" ) ) ;
obj . putString ( "m_nick" , acc . nick ) ;
}
}
ITObject resData = TObject . newInstance ( ) ;
resData . putTArray ( "hp_logs" , arr ) ;
return resData ;
} catch ( Exception e ) {
log . info ( "sql error:" + sql ) ;
log . error ( e ) ;
}
ITObject resData = TObject . newInstance ( ) ;
return resData ;
}
private static final int _getCountValue ( Jedis jedis9 , String key , int beginTime , int endTime ) {
String str = null ;
int tem = beginTime ;
int tem_day = ( endTime - beginTime ) / 86400 ;
int count = 0 ;
for ( int k = 0 ; k < tem_day ; + + k ) {
String tem_key = String . format ( "%s:d%s" , key , tem ) ;
str = jedis9 . get ( tem_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
count + = Integer . parseInt ( str ) ;
}
tem + = 86400 ;
}
return count ;
}
private static final int _getValue ( Jedis jedis9 , String key ) {
int count = 0 ;
String str = jedis9 . get ( key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
count = Integer . parseInt ( str ) ;
}
return count ;
}
private static final int _getCountNumValue ( Jedis jedis9 , String key , int beginTime , int endTime ) {
String str = null ;
int tem = beginTime ;
int tem_day = ( endTime - beginTime ) / 86400 ;
int count = 0 ;
for ( int k = 0 ; k < tem_day ; + + k ) {
String tem_key = String . format ( "%s:d%s" , key , tem ) ;
str = jedis9 . get ( tem_key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
count + + ;
}
tem + = 86400 ;
}
return count ;
}
private static final int _getNumValue ( Jedis jedis9 , String key ) {
int count = 0 ;
String str = jedis9 . get ( key ) ;
if ( StringUtil . isNotEmpty ( str ) ) {
count + + ;
}
return count ;
}
/ * *
* 获 取 奖 励 日 志
*
* @param groupId
* @param tagId
* @param limit
* @param num
* @param beginTime
* @param endTime
* @return
* @throws Exception
* /
public static final ITObject getRewardLog ( int groupId , int tagId , int limit , int num , int beginTime , int endTime )
throws Exception {
String where_sql = String . format (
"WHERE gid = %s and (reason = %s or reason = %s ) and time>=%s and time <=%s and uid=%s and hp != 0" ,
groupId , ConsumeCode . HP_PARTNER_REWARD , ConsumeCode . HP_PARTNER_XIPAI_REWARD , beginTime , endTime , tagId ) ;
int total_num = 0 ;
int total_hp = 0 ;
if ( limit = = 0 ) {
String count_sql = String . format (
"SELECT IFNULL(SUM(round),0) AS num,IFNULL(SUM(hp),0) AS total_hp FROM group_hp_log %s" , where_sql ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( count_sql ) ;
if ( arr . size ( ) > 0 ) {
ITObject obj = arr . getTObject ( 0 ) ;
total_num = obj . getDouble ( "num" ) . intValue ( ) ;
total_hp = obj . getDouble ( "total_hp" ) . intValue ( ) ;
}
}
String sql = String . format (
"SELECT hp,pid,roomid,time,round,reason,info FROM group_hp_log %s ORDER BY time desc limit %s,%s" ,
where_sql , limit , num ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
resData . putTArray ( "reward_logs" , arr ) ;
resData . putInt ( "total_num" , total_num ) ;
resData . putInt ( "total_hp" , total_hp ) ;
return resData ;
}
/ * *
* 奖 励 统 计
*
* @param groupId
* @param pid
* @param beginTime
* @param endTime
* @return
* /
public static final ITObject getRewardLogCount ( int groupId , int pid , int beginTime , int endTime ) {
String p_key = pid > 0 ? ( ":p" + pid ) : StringUtil . Empty ;
String valid_key = String . format ( "g%s:valid_room%s" , groupId , p_key ) ;
String round_key = String . format ( "g%s:round%s" , groupId , p_key ) ;
String hp_cost_key = String . format ( "g%s:hp_cost%s" , groupId , p_key ) ;
String hp_reward_key = String . format ( "g%s:hp_reward%s" , groupId , p_key ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
try {
int v_round = _getCountValue ( jedis9 , valid_key , beginTime , endTime ) ;
int round = _getCountValue ( jedis9 , round_key , beginTime , endTime ) ;
int hp_cost = _getCountValue ( jedis9 , hp_cost_key , beginTime , endTime ) ;
int hp_reward = _getCountValue ( jedis9 , hp_reward_key , beginTime , endTime ) ;
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "v_round" , v_round ) ;
resData . putInt ( "round" , round ) ;
resData . putInt ( "hp_cost" , hp_cost ) ;
resData . putInt ( "gains" , hp_cost - hp_reward ) ;
return resData ;
} finally {
jedis9 . close ( ) ;
}
}
/ * *
* 体 力 值 提 取 记 录
*
* @param groupId
* @param tagid
* @param limit
* @param num
* @param beginTime
* @param endTime
* @return
* @throws Exception
* /
public static final ITObject getHpLogTakeInfo ( int groupId , int uid , int tagId , int limit , int num , int beginTime ,
int endTime ) throws Exception {
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
GroupMemberBean uid_bean = GroupCache . getMember ( groupId , uid ) ;
if ( uid_bean = = null ) {
throw new WebException ( ErrorCode . GROUP_NOT_MEMBER ) ;
}
if ( uid_bean . lev > = 3 ) {
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId , tagId , true ) ;
if ( par_list = = null | | ! par_list . contains ( uid ) ) {
throw new WebException ( ErrorCode . GROUP_NOT_PERMISSION ) ;
}
}
} finally {
jedis10 . close ( ) ;
}
String where_sql = String . format ( "WHERE gid = %s and uid=%s and reason = %s and time>=%s and time <=%s" ,
groupId , tagId , ConsumeCode . HP_TAKE_REWARD , beginTime , endTime ) ;
String sql = String . format ( "SELECT hp,time FROM group_hp_log %s ORDER BY time desc limit %s,%s" , where_sql ,
limit , num ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
resData . putTArray ( "hp_logs" , arr ) ;
return resData ;
}
public static final ITObject getHpLogTakeBankInfo ( int groupId , int uid , int tagId , int limit , int num ,
int beginTime , int endTime ) throws Exception {
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
try {
GroupMemberBean uid_bean = GroupCache . getMember ( groupId , uid ) ;
if ( uid_bean = = null ) {
throw new WebException ( ErrorCode . GROUP_NOT_MEMBER ) ;
}
if ( uid_bean . lev > = 3 & & uid ! = tagId ) {
List < Integer > par_list = Utility . getMemberParents ( jedis10 , groupId , tagId , true ) ;
if ( par_list = = null | | ! par_list . contains ( uid ) ) {
throw new WebException ( ErrorCode . GROUP_NOT_PERMISSION ) ;
}
}
} finally {
jedis10 . close ( ) ;
}
String where_sql = String . format (
"WHERE gid = %s and uid=%s and (reason = %s or reason = %s) and time>=%s and time <=%s" , groupId , tagId ,
ConsumeCode . HP_TAKE_BANK , ConsumeCode . HP_SAVE_BANK , beginTime , endTime ) ;
String sql = String . format ( "SELECT hp,time FROM group_hp_log %s ORDER BY time desc limit %s,%s" , where_sql ,
limit , num ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
ITObject resData = TObject . newInstance ( ) ;
resData . putInt ( "limit" , limit ) ;
resData . putTArray ( "hp_logs" , arr ) ;
return resData ;
}
/ * *
* 获 取 消 耗 统 计
*
* @param groupId
* @return
* /
public static final ITArray getCostCount ( int groupId , int uid , int beginTime , int endTime ) {
String gp_key = GroupCache . genPidsKey ( groupId ) ;
Set < String > pids = Redis . use ( "group1_db11" ) . zrangeByScore ( gp_key , 10 , 11 ) ;
GroupMemberBean uid_bean = GroupCache . getMember ( groupId , uid ) ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
ITArray arr = TArray . newInstance ( ) ;
try {
if ( uid_bean . lev < 3 ) {
for ( String pid : pids ) {
ITObject obj = TObject . newInstance ( ) ;
String round_key = String . format ( "g%s:round:p%s" , groupId , pid ) ;
obj . putInt ( "round" , _getCountValue ( jedis9 , round_key , beginTime , endTime ) * 100 ) ;
String valid_key = String . format ( "g%s:valid_room:p%s" , groupId , pid ) ;
obj . putInt ( "valid" , _getCountValue ( jedis9 , valid_key , beginTime , endTime ) * 100 ) ;
String no_valid_key = String . format ( "g%s:no_valid_room:p%s" , groupId , pid ) ;
obj . putInt ( "no_valid" , _getCountValue ( jedis9 , no_valid_key , beginTime , endTime ) * 100 ) ;
String diamo_cost_key = String . format ( "g%s:diamo_cost:p%s" , groupId , pid ) ;
obj . putInt ( "diamo_cost" , _getCountValue ( jedis9 , diamo_cost_key , beginTime , endTime ) * 100 ) ;
obj . putInt ( "pid" , Integer . parseInt ( pid ) ) ;
arr . addTObject ( obj ) ;
}
} else {
for ( String pid : pids ) {
ITObject obj = TObject . newInstance ( ) ;
2026-03-27 16:25:13 +08:00
String round_key = String . format ( "g{%s}:m%s:valid_round2:p%s" , groupId , uid , pid ) ;
2026-01-18 06:48:37 +08:00
int all_round = _getCountValue ( jedis9 , round_key , beginTime , endTime ) ;
2026-05-01 15:25:05 +08:00
obj . putInt ( "round" , all_round * 100 ) ;
2026-01-18 06:48:37 +08:00
String valid_key = String . format ( "g{%s}:m%s:valid_round2:p%s" , groupId , uid , pid ) ;
int valid = _getCountValue ( jedis9 , valid_key , beginTime , endTime ) ;
2026-05-01 15:25:05 +08:00
obj . putInt ( "valid" , valid * 100 ) ;
2026-01-18 06:48:37 +08:00
int no_valid_key = all_round - valid ;
2026-05-01 15:25:05 +08:00
obj . putInt ( "no_valid" , no_valid_key * 100 ) ;
2026-01-18 06:48:37 +08:00
String diamo_cost_key = String . format ( "g{%s}:m%s:valid_diamo:p%s" , groupId , uid , pid ) ;
obj . putInt ( "diamo_cost" , _getCountValue ( jedis9 , diamo_cost_key , beginTime , endTime ) ) ;
obj . putInt ( "pid" , Integer . parseInt ( pid ) ) ;
arr . addTObject ( obj ) ;
}
}
} finally {
jedis9 . close ( ) ;
}
2026-06-01 19:24:36 +08:00
// log.info("玩法统计:" + arr);
2026-01-18 06:48:37 +08:00
return arr ;
}
/ * *
* 获 取 局 数 统 计
*
* @param groupId
* @return
* /
public static final ITArray getRoundCount ( int groupId , int pid ) {
int bengin = DateUtils . getBeginDay ( ) - 29 * 86400 ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
ITArray arr = TArray . newInstance ( ) ;
try {
String p_key = pid > 0 ? ( ":p" + pid ) : StringUtil . Empty ;
for ( int i = 0 ; i < 30 ; + + i ) {
String round_key = String . format ( "g%s:round%s:d%s" , groupId , p_key , bengin ) ;
String r_str = jedis9 . get ( round_key ) ;
ITObject obj = TObject . newInstance ( ) ;
obj . putInt ( "time" , bengin ) ;
int r_num = 0 ;
if ( StringUtil . isNotEmpty ( r_str ) ) {
r_num = Integer . parseInt ( r_str ) ;
}
obj . putInt ( "num" , r_num ) ;
arr . addTObject ( obj ) ;
bengin + = 86400 ;
}
} finally {
jedis9 . close ( ) ;
}
return arr ;
}
/ * *
* 获 取 体 力 值 消 耗 统 计
*
* @param groupId
* @return
* /
public static final ITArray getHpConsumeCount ( int groupId , int uid ) {
int bengin = DateUtils . getBeginDay ( ) - 2 * 86400 ;
2026-03-27 16:25:13 +08:00
Jedis jedis9 = Redis . use ( redisdb ) . getJedis ( ) ;
2026-01-18 06:48:37 +08:00
ITArray arr = TArray . newInstance ( ) ;
try {
String key = String . format ( "g%s:m%s:consume_hp" , groupId , uid ) ;
for ( int i = 0 ; i < 3 ; + + i ) {
String hp_key = String . format ( "%s:d%s" , key , bengin ) ;
String r_str = jedis9 . get ( hp_key ) ;
ITObject obj = TObject . newInstance ( ) ;
obj . putInt ( "time" , bengin ) ;
int r_num = 0 ;
if ( StringUtil . isNotEmpty ( r_str ) ) {
r_num = Integer . parseInt ( r_str ) ;
}
obj . putInt ( "num" , r_num ) ;
arr . addTObject ( obj ) ;
bengin + = 86400 ;
}
} finally {
jedis9 . close ( ) ;
}
return arr ;
}
/ * *
* 获 取 体 力 值 统 计 信 息
*
* @param groupId
* @return
* @throws Exception
* /
public static final ITObject getHpCountInfo ( int groupId ) throws Exception {
String sql = String . format ( "SELECT uid FROM group_member WHERE groupId=%s" + " AND partnerLev >0" , groupId ) ;
ITArray list = DataBase . use ( ) . executeQueryByTArray ( sql ) ;
Jedis jedis10 = Redis . use ( "group1_db10" ) . getJedis ( ) ;
int _t_hp = 0 ;
try {
for ( int i = 0 ; i < list . size ( ) ; + + i ) {
ITObject obj = list . getTObject ( i ) ;
int parentId = obj . getInt ( "uid" ) ;
String key = String . format ( "g{%s}:m%s:reward_hp" , groupId , parentId ) ;
String r_hp = jedis10 . get ( key ) ;
if ( StringUtil . isNotEmpty ( r_hp ) ) {
_t_hp + = Integer . parseInt ( r_hp ) ;
}
}
} finally {
jedis10 . close ( ) ;
}
String where = String . format ( "FROM group_member WHERE groupId = %s" , groupId ) ;
String count_sql = String . format ( "SELECT (SELECT IFNULL(SUM(hp),0) %s AND hp >0) t_hp1,"
+ " (SELECT IFNULL(SUM(ABS(hp)),0) %s AND hp <0) t_hp2" , where , where ) ;
ITArray arr = DataBase . use ( ) . executeQueryByTArray ( count_sql ) ;
ITObject obj1 = TObject . newInstance ( ) ;
if ( arr . size ( ) > 0 ) {
ITObject obj = arr . getTObject ( 0 ) ;
obj1 . putLong ( "hp_num1" , obj . getDouble ( "t_hp1" ) . longValue ( ) ) ;
obj1 . putLong ( "hp_num2" , obj . getDouble ( "t_hp2" ) . longValue ( ) ) ;
} else {
obj1 . putLong ( "hp_num1" , 0 ) ;
obj1 . putLong ( "hp_num2" , 0 ) ;
}
obj1 . putLong ( "hp_num3" , _t_hp ) ;
return obj1 ;
}
}