changhongserver/web_group/src/main/java/com/group/controller/GroupLogController.java

664 lines
21 KiB
Java

package com.group.controller;
import com.data.bean.AccountBean;
import com.data.bean.GroupMemberBean;
import com.data.cache.AccountCache;
import com.data.cache.GroupCache;
import com.data.util.ErrorCode;
import com.data.util.Utility;
import com.group.Protocol;
import com.group.WebInterceptor;
import com.group.service.GroupLogService;
import com.taurus.core.entity.ITArray;
import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TObject;
import com.taurus.core.plugin.redis.Redis;
import com.taurus.core.routes.ActionKey;
import com.taurus.web.Controller;
import com.taurus.web.WebException;
import redis.clients.jedis.Jedis;
import java.util.List;
import javax.xml.bind.annotation.XmlElementDecl.GLOBAL;
import org.eclipse.jetty.util.log.Log;
public class GroupLogController extends Controller{
/**
* 获取奖励日志
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_REWARD_LOG, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getRewardLog() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
Jedis jedis10 = Redis.use("group1_db10").getJedis();
try {
GroupMemberBean uid_bean = GroupCache.getMember(groupId, acc.id);
if (uid_bean == null) {
throw new WebException(ErrorCode.GROUP_NOT_MEMBER);
}
if (uid_bean.lev >= 3 && acc.id != tagId)
{
List<Integer> par_list = Utility.getMemberParents(jedis10, groupId, tagId, true);
if (par_list == null || !par_list.contains(acc.id)) {
throw new WebException(ErrorCode.GROUP_NOT_PERMISSION);
}
}
}
finally {
jedis10.close();
}
ITObject resData = GroupLogService.getRewardLog(groupId, tagId, limit, num, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取奖励统计
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_REWARD_COUNT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_OWNER)
public final void getRewardLogCount() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
ITObject resData = GroupLogService.getRewardLogCount(groupId,pid, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取体力值管理统计数据
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_MGR, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getHpLogMgr() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
AccountBean acc = AccountCache.getAccount(session);
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
// 类型 type 1上分 2下分 3合伙人上分 4合伙人下分
int type = reqData.getInt("type");
int qid = reqData.getInt("qid");
String tagName = reqData.getUtfString("tagName");
ITObject resData = GroupLogService.getHpLogMgr(groupId, acc.id, limit, num, type, qid, tagName);
sendResponse(0, resData);
}
/**
* 获取体力值管理统计数据
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_MGR_COUNT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
public final void getHpLogMgrCount() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
ITObject resData = GroupLogService.getHpLogMgrCount(groupId);
sendResponse(0, resData);
}
/**
* 获取体力值管理员详细信息
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_MGR_INFO, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getHpLogMgrInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
//1 管理员 2合伙人
int type = reqData.getInt("type");
ITArray arr = GroupLogService.getHpLogMgrInfo(groupId,acc.id,beginTime,endTime,type);
ITObject resData = TObject.newInstance();
resData.putTArray("infos", arr);
sendResponse(0, resData);
}
/**
* 获取玩家体力值详细
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_INFO, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getHpLogInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int tagId = reqData.getInt("tagId");
int endTime = reqData.getInt("endTime");
int beginTime = reqData.getInt("beginTime");
// 筛选
int choose = reqData.getInt("choose");
AccountBean acc = AccountCache.getAccount(session);
Jedis jedis10 = Redis.use("group1_db10").getJedis();
try {
GroupMemberBean uid_bean = GroupCache.getMember(groupId, acc.id);
if (uid_bean == null) {
throw new WebException(ErrorCode.GROUP_NOT_MEMBER);
}
if (uid_bean.lev >= 3 && acc.id != tagId)
{
List<Integer> par_list = Utility.getMemberParents(jedis10, groupId, tagId, true);
if (par_list == null || !par_list.contains(acc.id)) {
throw new WebException(ErrorCode.GROUP_NOT_PERMISSION);
}
}
}
finally {
jedis10.close();
}
ITObject resData = GroupLogService.getHpLogInfo(groupId, tagId, limit, num, choose,beginTime,endTime);
logger.info("get_hplog_info:"+resData);
sendResponse(0, resData);
}
/**
* 获取玩家体力值详细
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_DETAIL_INFO, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getHpLogDetailInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
String roomId = reqData.getUtfString("roomId");
int time = reqData.getInt("time");
AccountBean acc = AccountCache.getAccount(session);
Jedis jedis10 = Redis.use("group1_db10").getJedis();
try {
GroupMemberBean uid_bean = GroupCache.getMember(groupId, acc.id);
if (uid_bean == null) {
throw new WebException(ErrorCode.GROUP_NOT_MEMBER);
}
if (uid_bean.lev >= 3 && acc.id != tagId)
{
List<Integer> par_list = Utility.getMemberParents(jedis10, groupId, tagId, true);
if (par_list == null || !par_list.contains(acc.id)) {
throw new WebException(ErrorCode.GROUP_NOT_PERMISSION);
}
}
}
finally {
jedis10.close();
}
ITObject resData = GroupLogService.getHpLogDetailInfo(groupId, tagId, roomId, time);
sendResponse(0, resData);
}
/**
* 获取抽水体力值详细
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HPLOG_PUMP, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
public final void getHpLogPumpInfo() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
ITObject resData = GroupLogService.getHpLogPumpInfo(groupId,acc.id, limit, num, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取玩法局数统计
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_MEMBER_RANK, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
public final void getMemberRank() throws Exception {
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
int type = 0;
if (reqData.containsKey("type"))
{
try {
type = reqData.getInt("type");
}
catch (Exception e)
{
}
}
ITObject resData = GroupLogService.getMemberRank(groupId, acc.id, pid, type, limit, num, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_GET_MEMBER_STAT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getMemberStat() throws Exception {
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int qid = reqData.getInt("qid");
int partnerId = reqData.getInt("partner_id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 3) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
int sortType = reqData.getInt("sortType");
ITObject resData = GroupLogService.getMemberStat(groupId,acc.id,qid,partnerId, limit, num, tt, beginTime, endTime,sortType);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_GET_PARTNER_STAT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getPartnerStat() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int tt = reqData.getInt("tt");
//tt = 1;
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.getPartnerStat(groupId, acc.id,limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_FIND_PARTNER_STAT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void findPartnerStat() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.findPartnerStat(groupId, acc.id, tagId, limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_GET_PARTNER_STAT_MEMBER, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getPartnerStatMember() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int uid = reqData.getInt("uid");
int rootUid = reqData.getInt("root_uid");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.getPartnerStatMember(groupId, uid, rootUid, limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_FIND_PARTNER_STAT_MEMBER, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void findPartnerStatMember() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int uid = reqData.getInt("uid");
int rootUid = reqData.getInt("root_uid");
int tagId = reqData.getInt("tagId");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.findPartnerStatMember(groupId, uid, rootUid, tagId, limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_GET_DIRECT_STAT_MEMBER, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getDirectStatMember() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int uid = reqData.getInt("uid");
int rootUid = reqData.getInt("root_uid");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.getDirectStatMember(groupId, uid, rootUid, limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
@ActionKey(value = Protocol.GROUP_GET_PARTNER_STAT_PLAY, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getPartnerStatPlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int uid = reqData.getInt("uid");
int parent_id = reqData.getInt("parent_id");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.getPartnerStatPlay(groupId, uid,parent_id,limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取消耗统计
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_COST_COUNT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getCostCount() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int uid = AccountCache.getAccount(session).id;
int groupId = reqData.getInt("id");
int beginTime = 0;
int endTime = 0;
try {
beginTime = reqData.getInt("beginTime");
endTime = reqData.getInt("endTime");
}
catch (Exception e)
{
}
ITObject resData = TObject.newInstance();
resData.putTArray("cosume_logs", GroupLogService.getCostCount(groupId, uid, beginTime, endTime));
sendResponse(0, resData);
}
/**
* 获取消耗统计
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_ROUND_COUNT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
public final void getRoundCount() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
ITArray arr = GroupLogService.getRoundCount(groupId,pid);
ITObject resData = TObject.newInstance();
resData.putTArray("rounds", arr);
sendResponse(0, resData);
}
/**
* 获取消耗统计
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_HPCONSUME_COUNT, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
public final void getHpConsumeCount() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int tag = reqData.getInt("tagId");
ITArray arr = GroupLogService.getHpConsumeCount(groupId,tag);
ITObject resData = TObject.newInstance();
resData.putTArray("list", arr);
sendResponse(0, resData);
}
/**
* 获取战绩列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_RECORDS, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getRecords() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int uid = AccountCache.getAccount(session).id;
String platform = reqData.getString("platform");
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int qid = reqData.getInt("qid");
int includeMembers = reqData.containsKey("includeMembers") ? reqData.getInt("includeMembers") : 0;
int tt = -1;
int beginTime = 0;
int endTime = 0;
if(reqData.containsKey("tt")) {
tt = reqData.getInt("tt");
if(tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
}
ITObject resData =GroupLogService.getRecords(platform, groupId, limit, num,qid,uid,includeMembers,tt,beginTime,endTime);
sendResponse(0, resData);
}
/**
* 获取战绩列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_PERSON_RECORDS, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
public final void getPersonRecords() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int uid = AccountCache.getAccount(session).id;
String platform = reqData.getString("platform");
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int qid = reqData.getInt("qid");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if(tt == 3) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData =GroupLogService.getPersonRecords(platform, groupId, tt, beginTime, endTime, limit, num, qid, uid);
sendResponse(0, resData);
}
/**
* 根据房间ID查询战绩
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_FIND_RECORD_ROOM, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void findRecordByRoom() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int uid = AccountCache.getAccount(session).id;
String platform = reqData.getString("platform");
int groupId = reqData.getInt("id");
String roomid = reqData.getString("roomid");
ITArray data = GroupLogService.findRecordByRoom(platform, groupId, roomid,uid);
ITObject resData = TObject.newInstance();
resData.putBoolean("is_rec", data!=null && data.size() != 0);
if(data != null) {
resData.putTArray("rec", data);
}
sendResponse(0, resData);
}
/**
* 获取提取体力值详细
* @throws Exception
*/
@ActionKey(value = Protocol.GET_TAKE_LOG, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_OWNER_OR_MGR_OR_PARTNER)
public final void getHpLogTakeInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
}
catch(Exception e) {
}
if (tagId == 0)
{
tagId = acc.id;
}
ITObject resData = GroupLogService.getHpLogTakeInfo(groupId, acc.id, tagId, limit, num, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取提取体力值详细
* @throws Exception
*/
@ActionKey(value = Protocol.GET_BANK_LOG, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP/*|WebInterceptor.V_GROUP_PARTNER*/)
public final void getHpLogTakeBankInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
// 数量
int num = reqData.getInt("num");
int beginTime = reqData.getInt("beginTime");
int endTime = reqData.getInt("endTime");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
}
catch(Exception e) {
}
if (tagId == 0)
{
tagId = acc.id;
}
ITObject resData = GroupLogService.getHpLogTakeBankInfo(groupId, acc.id, tagId, limit, num, beginTime, endTime);
sendResponse(0, resData);
}
/**
* 获取体力值统计信息
*/
@ActionKey(value = Protocol.GET_HP_COUNT_INFO, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
public final void getHpCountInfo() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
ITObject resData =GroupLogService.getHpCountInfo(groupId);
sendResponse(0, resData);
}
}