/** 一下是同步功能 * */ public void synDeleteAll(Integer activityId) { LogSystem.info("累积充值模块 同步删除-system_total_pay_reward开始"); totalPayRewardDao.closeSession(DBSource.CFG); totalPayRewardDao.executeSQL_( "delete from system_total_pay_reward where activity_id = " + activityId); LogSystem.info("累积充值模块 同步删除-system_total_pay_reward结束"); }
@Override public void run() { LogSystem.info("服务器 " + sysNum + "的日统计线程开始-----------------------------------"); CustomerContextHolder.setSystemNum(sysNum); InvocationCollector invocationCollector = (InvocationCollector) ServiceCacheFactory.getServiceCache().getBeanById("dayInvocationCollector"); invocationCollector.invoke(date); LogSystem.info("服务器 " + sysNum + "的日统计线程结束-----------------------------------"); }
/** 采集数据调度入口 */ @Override public void executeJob(JobExecutionContext jobExecutionContext) throws JobExecutionException { LogSystem.info("日统计开始 " + jobExecutionContext.getJobDetail().getName()); // CronTrigger cronTrigger= (CronTrigger)jobExecutionContext.getTrigger(); // String[] serverIdsArr = ((String)cronTrigger.getJobDataMap().get("serverIds")).split(","); // // 已经修正 Map<Integer, TGameServer> gameServerMap = DataSourceManager.getInstatnce().getGameServerMap(); StringBuilder serverName = new StringBuilder(); Iterator<Integer> iter = gameServerMap.keySet().iterator(); while (iter.hasNext()) { Integer key = iter.next(); TGameServer value = gameServerMap.get(key); LogSystem.info("print key = " + key + " value = " + value); serverName.append(value.getServerId() + ","); } String[] serverIdsArr = serverName.toString().split(","); Date date = new Date(); for (int i = 0; i < serverIdsArr.length; i++) { CustomerContextHolder.setSystemNum(Integer.valueOf(serverIdsArr[i])); LogSystem.info("serverId:" + serverIdsArr[i]); // LogSystem.info("cronTrigger.timezone:"+cronTrigger.getTimeZone().getID()); LogSystem.info("管理后台的时间:" + date.toString()); Date nowServerTime = DateUtil.getNowDateBySystemNum(); LogSystem.info("游戏服务器时间:" + nowServerTime.toString()); // 开服过后一天才统计数据(已经修正) Date serverOpernTime = DataSourceManager.getInstatnce() .getGameServerMap() .get(CustomerContextHolder.getSystemNum()) .getServerOpernTime(); // Date d = new Date(serverOpernTime.getTime()+24*60*60*1000); Date d = new Date(serverOpernTime.getTime()); if (nowServerTime.getTime() < d.getTime()) { LogSystem.info("还木有开服,不统计!"); continue; } // InvocationCollector invocationCollector = (InvocationCollector) // ServiceCacheFactory.getServiceCache().getBeanById("dayInvocationCollector"); // invocationCollector.invoke(date); executeOneServer(date, Integer.valueOf(serverIdsArr[i])); LogSystem.info("日统计完毕 " + jobExecutionContext.getJobDetail().getName()); } }
public String sayHi(String text) { // TODO Auto-generated method stub text = text + "ggg"; LogSystem.info(text); return text; }
@Override public void execute(Date date) throws Exception { LogSystem.info("VIP 玩家元宝统计 Collector开始"); UserGoldLogService userGoldLogService = ServiceCacheFactory.getServiceCache().getService(UserGoldLogService.class); UserService userService = ServiceCacheFactory.getServiceCache().getService(UserService.class); VipUserDiamondStatsService vipUserDiamondStatsService = ServiceCacheFactory.getServiceCache().getService(VipUserDiamondStatsService.class); String[] dates = DateUtil.getOneDayStrArr(SystemStatsDate.YESTERDAY); List<Object> tempList = userService.findVipUser(); List<String> userList = new ArrayList<String>(); for (int i = 0; i < tempList.size(); i++) { Object objArr = (Object) tempList.get(i); Character[] cc = (Character[]) objArr; StringBuilder sb = new StringBuilder(); for (int j = 0; j < cc.length; j++) { Character c = cc[j]; sb.append(c); } userList.add(sb.toString()); } int actityCount = userService.findActityVipUser(dates, userList); Map<Integer, Integer> map1 = userGoldLogService.findEveryTypeAmountVIP(UserGoldLogCategory.RECEIVE, dates, userList); Map<Integer, Integer> map2 = userGoldLogService.findEveryTypeAmountVIP(UserGoldLogCategory.CONSUME, dates, userList); List<VipUserDiamondStats> resultList = new ArrayList<VipUserDiamondStats>(); Iterator<Integer> key1 = map1.keySet().iterator(); while (key1.hasNext()) { Integer k = key1.next(); Integer value = map1.get(k); VipUserDiamondStats stats = new VipUserDiamondStats(); stats.setSysNum(CustomerContextHolder.getSystemNum()); stats.setDate(DateUtil.getSomeDaysDiffDate(SystemStatsDate.YESTERDAY)); stats.setCount(tempList.size()); stats.setType(k); stats.setCaterory(UserGoldLogCategory.RECEIVE); stats.setDiamond(value); stats.setActityCount(actityCount); resultList.add(stats); } Iterator<Integer> key2 = map2.keySet().iterator(); while (key2.hasNext()) { Integer k = key2.next(); Integer value = map2.get(k); VipUserDiamondStats stats = new VipUserDiamondStats(); stats.setSysNum(CustomerContextHolder.getSystemNum()); stats.setDate(DateUtil.getSomeDaysDiffDate(SystemStatsDate.YESTERDAY)); stats.setCount(tempList.size()); stats.setType(k); stats.setDiamond(value); stats.setCaterory(UserGoldLogCategory.CONSUME); stats.setActityCount(actityCount); resultList.add(stats); } vipUserDiamondStatsService.saveBatch(resultList); LogSystem.info("VIP 玩家元宝统计 Collector结束"); }
public void synSaveAll(List<TotalPayReward> list) { LogSystem.info("累积充值模块 同步保存-system_total_pay_reward开始"); totalPayRewardDao.saveBatch(list, DBSource.CFG); LogSystem.info("累积充值模块 同步保存-system_total_pay_reward结束"); }