From 175535eab18d9e5dd5180e4c09668254c8d0b2d8 Mon Sep 17 00:00:00 2001 From: lxr <418982099@qq.com> Date: Fri, 20 Dec 2024 11:23:38 +0800 Subject: [PATCH] delete not use package --- README.md | 6 +- .../java/yuelj/MasterDataSourceConfig.java | 47 - src/main/java/yuelj/TexasApplication.java | 10 - .../java/yuelj/action/websocket/TexasWS.java | 215 --- .../action/websocket/WebSocketConfig.java | 14 - .../yuelj/action/websocket/WebSocketUtil.java | 8 - src/main/java/yuelj/cardUtils/CardGroup.java | 85 -- src/main/java/yuelj/cardUtils/CardUtil.java | 1015 ------------- src/main/java/yuelj/cardUtils/PRandom.java | 148 -- .../yuelj/cardUtils/ProbabilityEntity.java | 68 - .../yuelj/cardUtils/ThreeCardCompareUtil.java | 356 ----- src/main/java/yuelj/constants/CacheKeys.java | 20 - .../java/yuelj/constants/ParamsAndURL.java | 48 - .../java/yuelj/constants/RoomTypeList.java | 122 -- src/main/java/yuelj/constants/Types.java | 54 - src/main/java/yuelj/controller/Hello.java | 12 - .../yuelj/controller/RoomInfoController.java | 57 - src/main/java/yuelj/dao/GameLogDao.java | 13 - src/main/java/yuelj/dao/PlayerDao.java | 21 - src/main/java/yuelj/dao/SystemLogDao.java | 13 - src/main/java/yuelj/dao/UserDao.java | 28 - src/main/java/yuelj/dao/UserMachineDao.java | 15 - src/main/java/yuelj/dao/base/BaseDao.java | 108 -- .../java/yuelj/dao/impl/GameLogDaoImpl.java | 36 - src/main/java/yuelj/dao/impl/PlayerImpl.java | 79 - .../java/yuelj/dao/impl/SystemLogImpl.java | 28 - src/main/java/yuelj/dao/impl/UserImpl.java | 92 -- .../yuelj/dao/impl/UserMachineDaoImpl.java | 39 - .../yuelj/entity/AlipayCallBackEntity.java | 78 - src/main/java/yuelj/entity/BaseEntity.java | 31 - src/main/java/yuelj/entity/BetPlayer.java | 71 - src/main/java/yuelj/entity/ClientPlayer.java | 61 - src/main/java/yuelj/entity/GameLog.java | 242 --- src/main/java/yuelj/entity/ListPo.java | 35 - .../java/yuelj/entity/MessageParmsEntity.java | 88 -- .../java/yuelj/entity/MessagePushEntity.java | 40 - src/main/java/yuelj/entity/NextIdEntity.java | 15 - src/main/java/yuelj/entity/PageEntity.java | 122 -- src/main/java/yuelj/entity/Player.java | 204 --- src/main/java/yuelj/entity/PlayerOpt.java | 104 -- src/main/java/yuelj/entity/PlayerPrivate.java | 21 - src/main/java/yuelj/entity/PrivateRoom.java | 181 --- src/main/java/yuelj/entity/QQInfoEntity.java | 62 - src/main/java/yuelj/entity/Result.java | 69 - src/main/java/yuelj/entity/RetMsg.java | 52 - .../java/yuelj/entity/SystemLogEntity.java | 154 -- .../yuelj/entity/UcenterMembersEntity.java | 130 -- src/main/java/yuelj/entity/UserEntity.java | 344 ----- .../java/yuelj/entity/UserMachineEntity.java | 113 -- .../java/yuelj/entity/UserTokenEntity.java | 40 - .../java/yuelj/service/GameLogService.java | 13 - src/main/java/yuelj/service/LobbyService.java | 7 - .../java/yuelj/service/PlayerService.java | 73 - src/main/java/yuelj/service/RoomService.java | 18 - .../java/yuelj/service/SystemLogService.java | 13 - .../yuelj/service/UserMachineService.java | 15 - src/main/java/yuelj/service/UserService.java | 54 - .../service/impl/GameLogServiceImpl.java | 25 - .../yuelj/service/impl/LobbyServiceImpl.java | 94 -- .../yuelj/service/impl/PlayerServiceImpl.java | 173 --- .../yuelj/service/impl/RoomServiceImpl.java | 50 - .../service/impl/SystemLogServiceImpl.java | 25 - .../service/impl/UserMachineServiceImpl.java | 32 - .../yuelj/service/impl/UserServiceImpl.java | 122 -- src/main/java/yuelj/texas/BeanUtil.java | 51 - src/main/java/yuelj/texas/BetPool.java | 43 - src/main/java/yuelj/texas/CtrlList.java | 32 - src/main/java/yuelj/texas/Room.java | 1337 ----------------- src/main/java/yuelj/texas/TexasStatic.java | 30 - src/main/java/yuelj/texas/TexasUtil.java | 780 ---------- .../java/yuelj/texas/robot/RobotManager.java | 59 - .../texas/robot/RobotOperationsUtil.java | 320 ---- .../java/yuelj/texas/robot/RobotPlayer.java | 102 -- .../java/yuelj/texas/robot/RobotWsClient.java | 156 -- .../yuelj/texas/threeCard/ThreeCardRoom.java | 602 -------- .../yuelj/texas/threeCard/ThreeCardsUtil.java | 126 -- src/main/java/yuelj/utils/HttpTool.java | 418 ------ src/main/java/yuelj/utils/NextId.java | 37 - src/main/java/yuelj/utils/NextIdDao.java | 7 - src/main/java/yuelj/utils/RandomNumUtil.java | 216 --- .../utils/SensitiveWord/TabooedTools.java | 224 --- .../utils/SensitiveWord/TabooedUtils.java | 84 -- .../utils/SensitiveWord/TabooedUtilsTest.java | 121 -- .../utils/SensitiveWord/TabooedWords.java | 73 - .../yuelj/utils/SensitiveWord/tabooed.words | 816 ---------- src/main/java/yuelj/utils/SessionUtil.java | 44 - src/main/java/yuelj/utils/SpringUtil.java | 34 - src/main/java/yuelj/utils/StringUtil.java | 370 ----- .../yuelj/utils/cache/MemCacheOcsUtils.java | 148 -- .../java/yuelj/utils/dateTime/ChinaDate.java | 417 ----- .../java/yuelj/utils/dateTime/DateUtil.java | 407 ----- .../java/yuelj/utils/filters/FilterUtil.java | 30 - .../java/yuelj/utils/filters/LogFilter.java | 152 -- .../yuelj/utils/filters/OperatorFilter.java | 34 - .../yuelj/utils/filters/UserLoginFilter.java | 48 - src/main/java/yuelj/utils/gsonExt/Foo.java | 12 - .../utils/gsonExt/MyExclusionStrategy.java | 20 - .../interceptors/ExceptionInterceptor.java | 48 - src/main/java/yuelj/utils/logs/LogThread.java | 21 - src/main/java/yuelj/utils/md5encrypt/Md5.java | 62 - .../utils/md5encrypt/Md5PwdExhaustive.java | 52 - .../java/yuelj/utils/serialize/JsonUtils.java | 38 - .../yuelj/utils/serialize/KryoSerializer.java | 71 - 103 files changed, 3 insertions(+), 13367 deletions(-) delete mode 100644 src/main/java/yuelj/MasterDataSourceConfig.java delete mode 100644 src/main/java/yuelj/TexasApplication.java delete mode 100644 src/main/java/yuelj/action/websocket/TexasWS.java delete mode 100644 src/main/java/yuelj/action/websocket/WebSocketConfig.java delete mode 100644 src/main/java/yuelj/action/websocket/WebSocketUtil.java delete mode 100644 src/main/java/yuelj/cardUtils/CardGroup.java delete mode 100644 src/main/java/yuelj/cardUtils/CardUtil.java delete mode 100644 src/main/java/yuelj/cardUtils/PRandom.java delete mode 100644 src/main/java/yuelj/cardUtils/ProbabilityEntity.java delete mode 100644 src/main/java/yuelj/cardUtils/ThreeCardCompareUtil.java delete mode 100644 src/main/java/yuelj/constants/CacheKeys.java delete mode 100644 src/main/java/yuelj/constants/ParamsAndURL.java delete mode 100644 src/main/java/yuelj/constants/RoomTypeList.java delete mode 100644 src/main/java/yuelj/constants/Types.java delete mode 100644 src/main/java/yuelj/controller/Hello.java delete mode 100644 src/main/java/yuelj/controller/RoomInfoController.java delete mode 100644 src/main/java/yuelj/dao/GameLogDao.java delete mode 100644 src/main/java/yuelj/dao/PlayerDao.java delete mode 100644 src/main/java/yuelj/dao/SystemLogDao.java delete mode 100644 src/main/java/yuelj/dao/UserDao.java delete mode 100644 src/main/java/yuelj/dao/UserMachineDao.java delete mode 100644 src/main/java/yuelj/dao/base/BaseDao.java delete mode 100644 src/main/java/yuelj/dao/impl/GameLogDaoImpl.java delete mode 100644 src/main/java/yuelj/dao/impl/PlayerImpl.java delete mode 100644 src/main/java/yuelj/dao/impl/SystemLogImpl.java delete mode 100644 src/main/java/yuelj/dao/impl/UserImpl.java delete mode 100644 src/main/java/yuelj/dao/impl/UserMachineDaoImpl.java delete mode 100644 src/main/java/yuelj/entity/AlipayCallBackEntity.java delete mode 100644 src/main/java/yuelj/entity/BaseEntity.java delete mode 100644 src/main/java/yuelj/entity/BetPlayer.java delete mode 100644 src/main/java/yuelj/entity/ClientPlayer.java delete mode 100644 src/main/java/yuelj/entity/GameLog.java delete mode 100644 src/main/java/yuelj/entity/ListPo.java delete mode 100644 src/main/java/yuelj/entity/MessageParmsEntity.java delete mode 100644 src/main/java/yuelj/entity/MessagePushEntity.java delete mode 100644 src/main/java/yuelj/entity/NextIdEntity.java delete mode 100644 src/main/java/yuelj/entity/PageEntity.java delete mode 100644 src/main/java/yuelj/entity/Player.java delete mode 100644 src/main/java/yuelj/entity/PlayerOpt.java delete mode 100644 src/main/java/yuelj/entity/PlayerPrivate.java delete mode 100644 src/main/java/yuelj/entity/PrivateRoom.java delete mode 100644 src/main/java/yuelj/entity/QQInfoEntity.java delete mode 100644 src/main/java/yuelj/entity/Result.java delete mode 100644 src/main/java/yuelj/entity/RetMsg.java delete mode 100644 src/main/java/yuelj/entity/SystemLogEntity.java delete mode 100644 src/main/java/yuelj/entity/UcenterMembersEntity.java delete mode 100644 src/main/java/yuelj/entity/UserEntity.java delete mode 100644 src/main/java/yuelj/entity/UserMachineEntity.java delete mode 100644 src/main/java/yuelj/entity/UserTokenEntity.java delete mode 100644 src/main/java/yuelj/service/GameLogService.java delete mode 100644 src/main/java/yuelj/service/LobbyService.java delete mode 100644 src/main/java/yuelj/service/PlayerService.java delete mode 100644 src/main/java/yuelj/service/RoomService.java delete mode 100644 src/main/java/yuelj/service/SystemLogService.java delete mode 100644 src/main/java/yuelj/service/UserMachineService.java delete mode 100644 src/main/java/yuelj/service/UserService.java delete mode 100644 src/main/java/yuelj/service/impl/GameLogServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/LobbyServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/PlayerServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/RoomServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/SystemLogServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/UserMachineServiceImpl.java delete mode 100644 src/main/java/yuelj/service/impl/UserServiceImpl.java delete mode 100644 src/main/java/yuelj/texas/BeanUtil.java delete mode 100644 src/main/java/yuelj/texas/BetPool.java delete mode 100644 src/main/java/yuelj/texas/CtrlList.java delete mode 100644 src/main/java/yuelj/texas/Room.java delete mode 100644 src/main/java/yuelj/texas/TexasStatic.java delete mode 100644 src/main/java/yuelj/texas/TexasUtil.java delete mode 100644 src/main/java/yuelj/texas/robot/RobotManager.java delete mode 100644 src/main/java/yuelj/texas/robot/RobotOperationsUtil.java delete mode 100644 src/main/java/yuelj/texas/robot/RobotPlayer.java delete mode 100644 src/main/java/yuelj/texas/robot/RobotWsClient.java delete mode 100644 src/main/java/yuelj/texas/threeCard/ThreeCardRoom.java delete mode 100644 src/main/java/yuelj/texas/threeCard/ThreeCardsUtil.java delete mode 100644 src/main/java/yuelj/utils/HttpTool.java delete mode 100644 src/main/java/yuelj/utils/NextId.java delete mode 100644 src/main/java/yuelj/utils/NextIdDao.java delete mode 100644 src/main/java/yuelj/utils/RandomNumUtil.java delete mode 100644 src/main/java/yuelj/utils/SensitiveWord/TabooedTools.java delete mode 100644 src/main/java/yuelj/utils/SensitiveWord/TabooedUtils.java delete mode 100644 src/main/java/yuelj/utils/SensitiveWord/TabooedUtilsTest.java delete mode 100644 src/main/java/yuelj/utils/SensitiveWord/TabooedWords.java delete mode 100644 src/main/java/yuelj/utils/SensitiveWord/tabooed.words delete mode 100644 src/main/java/yuelj/utils/SessionUtil.java delete mode 100644 src/main/java/yuelj/utils/SpringUtil.java delete mode 100644 src/main/java/yuelj/utils/StringUtil.java delete mode 100644 src/main/java/yuelj/utils/cache/MemCacheOcsUtils.java delete mode 100644 src/main/java/yuelj/utils/dateTime/ChinaDate.java delete mode 100644 src/main/java/yuelj/utils/dateTime/DateUtil.java delete mode 100644 src/main/java/yuelj/utils/filters/FilterUtil.java delete mode 100644 src/main/java/yuelj/utils/filters/LogFilter.java delete mode 100644 src/main/java/yuelj/utils/filters/OperatorFilter.java delete mode 100644 src/main/java/yuelj/utils/filters/UserLoginFilter.java delete mode 100644 src/main/java/yuelj/utils/gsonExt/Foo.java delete mode 100644 src/main/java/yuelj/utils/gsonExt/MyExclusionStrategy.java delete mode 100644 src/main/java/yuelj/utils/interceptors/ExceptionInterceptor.java delete mode 100644 src/main/java/yuelj/utils/logs/LogThread.java delete mode 100644 src/main/java/yuelj/utils/md5encrypt/Md5.java delete mode 100644 src/main/java/yuelj/utils/md5encrypt/Md5PwdExhaustive.java delete mode 100644 src/main/java/yuelj/utils/serialize/JsonUtils.java delete mode 100644 src/main/java/yuelj/utils/serialize/KryoSerializer.java diff --git a/README.md b/README.md index 167ae05..dee8c11 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ #### 介绍 一个德州扑克游戏 -pc前端用html+js+canvas,服务端java13 springboot2.2 websocket -查看效果访问http://120.26.217.116:8080/texas/texasIndex.html +pc前端用html+js+canvas,服务端java13 springboot 3.3.5 websocket +查看效果访问http://127.0.0.1:8080/texas/texasIndex.html #### 软件架构 -1服务端java13 springboot2.2 websocket +1服务端java13 springboot3.3.5 websocket 2前端pcweb html+js+canvas 3数据库mysql 4缓存memcache diff --git a/src/main/java/yuelj/MasterDataSourceConfig.java b/src/main/java/yuelj/MasterDataSourceConfig.java deleted file mode 100644 index 3de65f4..0000000 --- a/src/main/java/yuelj/MasterDataSourceConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -package yuelj; - -import javax.sql.DataSource; - -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; - -@Configuration -@MapperScan(basePackages = "yuelj.dao", sqlSessionFactoryRef = "masterSqlSessionFactory") -public class MasterDataSourceConfig { - // 精确到 master 目录,以便跟其他数据源隔离 - static final String MAPPER_LOCATION = "classpath:mapper/*.xml"; - static final String TYPE_ALIAS_PACKAGE = "yuelj.entity"; - - /** - * 创建test1的DataSource实例 - * - * @return - */ - @Primary // 配置一个主连接 - @Bean(name = "masterDataSource") - @Qualifier("masterDataSource") - @ConfigurationProperties(prefix = "texas.spring.datasource") - public DataSource masterDataSource() { - return DataSourceBuilder.create().build(); - } - - @Bean(name = "masterSqlSessionFactory") - @Primary - public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) - throws Exception { - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(masterDataSource); - sessionFactory.setMapperLocations( - new PathMatchingResourcePatternResolver().getResources(MasterDataSourceConfig.MAPPER_LOCATION)); - sessionFactory.setTypeAliasesPackage(TYPE_ALIAS_PACKAGE); - return sessionFactory.getObject(); - } -} diff --git a/src/main/java/yuelj/TexasApplication.java b/src/main/java/yuelj/TexasApplication.java deleted file mode 100644 index 70a8c77..0000000 --- a/src/main/java/yuelj/TexasApplication.java +++ /dev/null @@ -1,10 +0,0 @@ -package yuelj; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class TexasApplication { - public static void main(String[] args) { - SpringApplication.run(TexasApplication.class, args); - } -} \ No newline at end of file diff --git a/src/main/java/yuelj/action/websocket/TexasWS.java b/src/main/java/yuelj/action/websocket/TexasWS.java deleted file mode 100644 index 7f3931b..0000000 --- a/src/main/java/yuelj/action/websocket/TexasWS.java +++ /dev/null @@ -1,215 +0,0 @@ -package yuelj.action.websocket; - -import java.io.IOException; - -import javax.websocket.OnClose; -import javax.websocket.OnError; -import javax.websocket.OnMessage; -import javax.websocket.OnOpen; -import javax.websocket.Session; -import javax.websocket.server.ServerEndpoint; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.stereotype.Component; - -import yuelj.entity.BaseEntity; -import yuelj.entity.Player; -import yuelj.entity.SystemLogEntity; -import yuelj.service.LobbyService; -import yuelj.service.PlayerService; -import yuelj.service.RoomService; -import yuelj.service.SystemLogService; -import yuelj.texas.BeanUtil; -import yuelj.texas.CtrlList; -import yuelj.texas.TexasStatic; -import yuelj.utils.SpringUtil; -import yuelj.utils.serialize.JsonUtils; - -/** - * 德州入口 - * - * @author lxr - * - */ -@ServerEndpoint("/ws/texas") -@Component -public class TexasWS { - // 缓冲区最大大小 - static final int maxSize = 256;// 1 * 1024;// 1K - - private Logger logger = LogManager.getLogger(TexasWS.class); - - @OnMessage - public void onMessage(String message, Session session) throws IOException, InterruptedException { - logger.info("onMessage:" + message); - // onMessageDoReflect(message, session); - onMessageDo(message, session); - } - - public void onMessageDo(String message, Session session) { - BaseEntity be = JsonUtils.fromJson(message, BaseEntity.class); - int c = be.getC(); - try { - switch (c) { - case 0:// 0注册 - ((PlayerService) SpringUtil.getBean("playerService")).register(session, message); - break; - case 1:// 1登录 - ((PlayerService) SpringUtil.getBean("playerService")).login(session, message); - break; - case 2:// 2进入房间 - ((RoomService) SpringUtil.getBean("roomService")).inRoom(session, message); - break; - case 3:// 3退出房间 - ((RoomService) SpringUtil.getBean("roomService")).outRoom(session, message); - break; - case 4:// 4坐下 - ((PlayerService) SpringUtil.getBean("playerService")).sitDown(session, message); - break; - case 5:// 5站起 - ((PlayerService) SpringUtil.getBean("playerService")).standUp(session, message); - break; - case 6:// 6过牌 - ((PlayerService) SpringUtil.getBean("playerService")).check(session, message); - break; - case 7:// 7下注 - ((PlayerService) SpringUtil.getBean("playerService")).betChips(session, message); - break; - case 8:// 8弃牌 - ((PlayerService) SpringUtil.getBean("playerService")).fold(session, message); - break; - case 9:// 9获取排行榜 - ((LobbyService) SpringUtil.getBean("lobbyService")).getRankList(session, message); - break; - case 10:// 10查看自己的手牌(拼三张) - ((RoomService) SpringUtil.getBean("roomService")).lookCards(session, message); - break; - case 11:// 11和下家比牌(拼三张) - ((RoomService) SpringUtil.getBean("roomService")).compareCards(session, message); - break; - case 12:// 12发送表情或消息 - ((RoomService) SpringUtil.getBean("roomService")).sendMessage(session, message); - break; - } - - } catch (Exception e) { - e.printStackTrace(); - SystemLogService syslogService = (SystemLogService) SpringUtil.getBean("SystemLogServiceImpl"); - SystemLogEntity entity = new SystemLogEntity(); - entity.setType(c + ""); - entity.setOperation(message); - StackTraceElement[] eArray = e.getCause().getStackTrace(); - String errorMessage = ""; - for (int i = 0; i < eArray.length; i++) { - String className = e.getCause().getStackTrace()[i].getClassName(); - String MethodName = e.getCause().getStackTrace()[i].getMethodName(); - int LineNumber = e.getCause().getStackTrace()[i].getLineNumber(); - errorMessage = errorMessage + "\n---" + className + "." + MethodName + ",line:" + LineNumber; - } - entity.setContent(e.getCause() + errorMessage); - entity.setDatetime(yuelj.utils.dateTime.DateUtil.nowDatetime()); - syslogService.insertSystemLog(entity); - String retMsg = "{\"c\":\"onException\",\"state\":0,\"message\":\"系统异常" + errorMessage + "\"}"; - sendText(session, retMsg); - logger.info(e.getCause() + errorMessage); - } - } - - public void onMessageDoReflect(String message, Session session) { - String ctrl[] = getCtrl(message); - try { - BeanUtil.invokeMethod(SpringUtil.getBean(ctrl[0]), ctrl[1], session, message); - } catch (Exception e) { - e.printStackTrace(); - SystemLogService syslogService = (SystemLogService) SpringUtil.getBean("SystemLogServiceImpl"); - SystemLogEntity entity = new SystemLogEntity(); - entity.setType(ctrl[1]); - entity.setOperation(message); - StackTraceElement[] eArray = e.getCause().getStackTrace(); - String errorMessage = ""; - for (int i = 0; i < eArray.length; i++) { - String className = e.getCause().getStackTrace()[i].getClassName(); - String MethodName = e.getCause().getStackTrace()[i].getMethodName(); - int LineNumber = e.getCause().getStackTrace()[i].getLineNumber(); - errorMessage = errorMessage + "\n---" + className + "." + MethodName + ",line:" + LineNumber; - } - entity.setContent(e.getCause() + errorMessage); - entity.setDatetime(yuelj.utils.dateTime.DateUtil.nowDatetime()); - syslogService.insertSystemLog(entity); - String retMsg = "{\"c\":\"onException\",\"state\":0,\"message\":\"系统异常" + errorMessage + "\"}"; - sendText(session, retMsg); - logger.info(e.getCause() + errorMessage); - } - } - - @OnOpen - public void onOpen(Session session) { - logger.info("onOpen"); - // 可以缓冲的传入二进制消息的最大长度 - session.setMaxBinaryMessageBufferSize(maxSize); - // 可以缓冲的传入文本消息的最大长度 - session.setMaxTextMessageBufferSize(maxSize); - - } - - @OnClose - public void onClose(Session session) { - onConnectLost(session); - logger.info(" connection closed "); - } - - @OnError - public void onError(Session session, Throwable e) { - onConnectLost(session); - logger.info(" connection error: " + e.getMessage()); - e.printStackTrace(); - } - - public void onConnectLost(Session session) { - Player p = TexasStatic.loginPlayerMap.get(session.getId()); - // 从登录玩家列表中移除玩家信息 - if (p != null && p.getRoom() != null) { - RoomService roomService = (RoomService) SpringUtil.getBean("roomService"); - roomService.outRoom(session, "", false); - } - TexasStatic.loginPlayerMap.remove(session.getId()); - TexasStatic.playerSessionMap.remove(p.getId()); - } - - /** - * 发送文本消息 - * - * @param session - * @param text - */ - public static void sendText(Session session, String text) { - if (session == null) { - return; - } - synchronized (session) { - if (session.isOpen()) { - try { - session.getBasicRemote().sendText(text); - // logger.info(text); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - - /** - * [类的别名 ,方法名] - * - * @param message - * @return - */ - private String[] getCtrl(String message) { - BaseEntity be = JsonUtils.fromJson(message, BaseEntity.class); - int c = be.getC(); - return CtrlList.clist.get(c); - } - -} diff --git a/src/main/java/yuelj/action/websocket/WebSocketConfig.java b/src/main/java/yuelj/action/websocket/WebSocketConfig.java deleted file mode 100644 index 7bf6e52..0000000 --- a/src/main/java/yuelj/action/websocket/WebSocketConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package yuelj.action.websocket; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.socket.server.standard.ServerEndpointExporter; - -//配置类 -@Configuration -public class WebSocketConfig { - @Bean - public ServerEndpointExporter serverEndpointExporter() { - return new ServerEndpointExporter(); - } -} diff --git a/src/main/java/yuelj/action/websocket/WebSocketUtil.java b/src/main/java/yuelj/action/websocket/WebSocketUtil.java deleted file mode 100644 index 2dc45b1..0000000 --- a/src/main/java/yuelj/action/websocket/WebSocketUtil.java +++ /dev/null @@ -1,8 +0,0 @@ -package yuelj.action.websocket; - -public class WebSocketUtil { - /** - * 发送定时消息的时间间隔ms - */ - public final static int INTERVAL_TIME = 800; -} diff --git a/src/main/java/yuelj/cardUtils/CardGroup.java b/src/main/java/yuelj/cardUtils/CardGroup.java deleted file mode 100644 index b74bf74..0000000 --- a/src/main/java/yuelj/cardUtils/CardGroup.java +++ /dev/null @@ -1,85 +0,0 @@ -package yuelj.cardUtils; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Random; - -public class CardGroup { - /** - * 获取0到52的list代表一副牌 - * - * @return - */ - public static ArrayList getInitialCards() { - ArrayList cardsList = new ArrayList(52); - for (int i = 0; i < 52; i++) { - cardsList.add(i); - } - return cardsList; - } - - /** - * 获取随机卡组,范围0到52,0到3代表黑A红A梅A方A - * - * @return - */ - public static ArrayList getRandomCards() { - ArrayList src = getInitialCards(); - ArrayList cardsList = new ArrayList(52); - while (src.size() > 0) { - int size = src.size(); - Random r = new Random(); - int index = r.nextInt(size); - - cardsList.add(src.get(index)); - src.remove(index); - } - return cardsList; - } - - public static ArrayList getRandomCardsByReplace() { - ArrayList cardsList = getInitialCards(); - int one = 0; - for (int i = 0; i < cardsList.size(); i++) { - Random r = new Random(); - int index = r.nextInt(cardsList.size()); - one = cardsList.get(i); - cardsList.set(i, cardsList.get(index)); - cardsList.set(index, one); - } - return cardsList; - } - - public static void main(String[] args) { - Date start = new Date(); - for (int i = 0; i < 4000000; i++) { - getRandomCardsByReplace(); - } - Date end = new Date(); - Date start2 = new Date(); - for (int i = 0; i < 4000000; i++) { - getRandomCards(); - } - Date end2 = new Date(); - - System.out.println((end2.getTime() - start2.getTime()) / 1000); - System.out.println((end.getTime() - start.getTime()) / 1000); - -// ArrayList countList = new ArrayList<>(); -// for (int i = 0; i < 52; i++) { -// countList.add(0); -// } -// for (int i = 0; i < 100000; i++) { -// ArrayList cardsList = getRandomCards(); -// List p1cards = cardsList.subList(0, 3); -// cardsList.remove(0); -// cardsList.remove(0); -// cardsList.remove(0); -// List pcards = cardsList.subList(0, 3); -// countList.set(pcards.get(0), countList.get(pcards.get(0)) + 1); -// } -// Arrays.asList(countList).forEach(times -> { -// System.out.println(times); -// }); - } -} diff --git a/src/main/java/yuelj/cardUtils/CardUtil.java b/src/main/java/yuelj/cardUtils/CardUtil.java deleted file mode 100644 index 42fcef3..0000000 --- a/src/main/java/yuelj/cardUtils/CardUtil.java +++ /dev/null @@ -1,1015 +0,0 @@ -package yuelj.cardUtils; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class CardUtil { - private static Logger logger = LogManager.getLogger(CardUtil.class); - public static String getType(int i) { - String str = null; - switch (i) { - case 0: - str = "D";// 方块 - break; - case 1: - str = "C";// 梅花 - break; - case 2: - str = "H";// 红桃 - break; - case 3: - str = "S";// 黑桃 - break; - } - return str; - } - - /* - * 获得最大牌组,判断牌型并将牌型编号加在数组最后一位 - */ - public static List getMaxCardsGroup(List list) { - if (isThuaShun(list)) {// 同花顺 - getMaxThuaShun(list); - - if (list.get(0) - list.get(1) == -48) { - list.add(10);// 判断级别 - } else { - list.add(9);// 判断级别 - } - } else if (isSiTiao(list)) {// 四条 - getMaxSiTiao(list); - - list.add(8);// 判断级别 - } else if (isHuLu(list)) {// 葫芦 - getMaxHuLu(list); - - list.add(7);// 判断级别 - } else if (isThua(list)) {// 同花 - getMaxThua(list); - - list.add(6);// 判断级别 - } else if (isShunZi_Card(list)) {// 顺子 - getMaxShunZi_Card(list); - - list.add(5);// 判断级别 - } else if (isSanTiao(list)) {// 三条 - getMaxSanTiao(list); - - list.add(4);// 判断级别 - } else if (isLDui(list)) {// 两对 - getMaxLDui(list); - - list.add(3);// 判断级别 - } else if (isDuiZi(list)) {// 一对 - getMaxDuiZi(list); - - list.add(2);// 判断级别 - } else {// 单张 - getMaxDZhang(list); - - list.add(1);// 判断级别 - } - List listnew = new ArrayList(); - for (Integer i : list) { - listnew.add(i); - } - return listnew; - } - - /* - * List1,List2比较大小 List1>List2返回1、List1等于List2返回0、List1 listnew, List listold) { - // getMaxCardsGroup(list1); - // getMaxCardsGroup(list2); - List list1 = new ArrayList(); - List list2 = new ArrayList(); - list1.addAll(listnew); - list2.addAll(listold); - - if (list1.get(list1.size() - 1) - list2.get(list2.size() - 1) > 0) { - return 1; - } - - if (list1.get(list1.size() - 1) - list2.get(list2.size() - 1) < 0) { - return -1; - } - - if (list1.get(list1.size() - 1) - list2.get(list2.size() - 1) == 0) { - for (int i = 0; i < 5; i++) { - if (list1.get(i) / 4 == 0) { - list1.set(i, 52); - } - if (list2.get(i) / 4 == 0) { - list2.set(i, 52); - } - } - switch (list1.get(list1.size() - 1)) { - case 10: - return 0; - case 9: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) - return 0; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - break; - case 8: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) { - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) - return 0; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - } - break; - case 7: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) { - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) - return 0; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - } - break; - case 6: - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) { - if (list1.get(3) / 4 - list2.get(3) / 4 > 0) - return 1; - if (list1.get(3) / 4 - list2.get(3) / 4 < 0) - return -1; - if (list1.get(3) / 4 - list2.get(3) / 4 == 0) { - if (list1.get(2) / 4 - list2.get(2) / 4 > 0) - return 1; - if (list1.get(2) / 4 - list2.get(2) / 4 < 0) - return -1; - if (list1.get(2) / 4 - list2.get(2) / 4 == 0) { - if (list1.get(1) / 4 - list2.get(1) / 4 > 0) - return 1; - if (list1.get(1) / 4 - list2.get(1) / 4 < 0) - return -1; - if (list1.get(1) / 4 - list2.get(1) / 4 == 0) { - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) - return 0; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - } - } - } - } - break; - case 5: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) - return 0; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - break; - case 4: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) { - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) { - if (list1.get(3) / 4 - list2.get(3) / 4 > 0) - return 1; - if (list1.get(3) / 4 - list2.get(3) / 4 == 0) - return 0; - if (list1.get(3) / 4 - list2.get(3) / 4 < 0) - return -1; - } - } - break; - case 3: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) { - if (list1.get(2) / 4 - list2.get(2) / 4 > 0) - return 1; - if (list1.get(2) / 4 - list2.get(2) / 4 < 0) - return -1; - if (list1.get(2) / 4 - list2.get(2) / 4 == 0) { - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) - return 0; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - } - } - break; - case 2: - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) { - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) { - if (list1.get(3) / 4 - list2.get(3) / 4 > 0) - return 1; - if (list1.get(3) / 4 - list2.get(3) / 4 < 0) - return -1; - if (list1.get(3) / 4 - list2.get(3) / 4 == 0) { - if (list1.get(2) / 4 - list2.get(2) / 4 > 0) - return 1; - if (list1.get(2) / 4 - list2.get(2) / 4 == 0) - return 0; - if (list1.get(2) / 4 - list2.get(2) / 4 < 0) - return -1; - } - } - } - break; - case 1: - if (list1.get(4) / 4 - list2.get(4) / 4 > 0) - return 1; - if (list1.get(4) / 4 - list2.get(4) / 4 < 0) - return -1; - if (list1.get(4) / 4 - list2.get(4) / 4 == 0) { - if (list1.get(3) / 4 - list2.get(3) / 4 > 0) - return 1; - if (list1.get(3) / 4 - list2.get(3) / 4 < 0) - return -1; - if (list1.get(3) / 4 - list2.get(3) / 4 == 0) { - if (list1.get(2) / 4 - list2.get(2) / 4 > 0) - return 1; - if (list1.get(2) / 4 - list2.get(2) / 4 < 0) - return -1; - if (list1.get(2) / 4 - list2.get(2) / 4 == 0) { - if (list1.get(1) / 4 - list2.get(1) / 4 > 0) - return 1; - if (list1.get(1) / 4 - list2.get(1) / 4 < 0) - return -1; - if (list1.get(1) / 4 - list2.get(1) / 4 == 0) { - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) - return 1; - if (list1.get(0) / 4 - list2.get(0) / 4 == 0) - return 0; - if (list1.get(0) / 4 - list2.get(0) / 4 < 0) - return -1; - } - } - } - } - break; - } - } - return null; - } - - /* - * 从小到大排列 - */ - public static List getOrderList(List list) { - int tmp = 0; - for (int i = 0; i < list.size(); i++) { - for (int j = i + 1; j < list.size(); j++) { - if (list.get(j) < list.get(i)) { - tmp = list.get(i); - list.set(i, list.get(j)); - list.set(j, tmp); - } - } - } - return list; - } - - /* - * 判断是否是顺子_通用 - */ - public static boolean isShunZi(List list) { - List maxList = new ArrayList(); - for (int i = 0; i < 4; i++) { - maxList.add(i + 10); - } - maxList.add(1); - - if (list.containsAll(maxList)) { - return true; - } else { - maxList.clear(); - for (int a = list.size() - 1; a >= 0; a--) { - int v = list.get(a); - maxList.clear(); - for (int j = 0; j < 5; j++, v--) { - maxList.add(v); - } - if (list.containsAll(maxList)) { - return true; - } - } - } - return false; - } - - /* - * 得到最大的顺子_通用(参数List需从小到大排好序) - */ - public static List getMaxShunZi(List list) { - List maxList = new ArrayList(); - - maxList.add(1); - for (int i = 0; i < 4; i++) { - maxList.add(13 - i); - } - - if (!list.containsAll(maxList)) { - maxList.clear(); - for (int a = list.size() - 1; a >= 0; a--) { - int v = list.get(a); - maxList.clear(); - for (int j = 0; j < 5; j++, v--) { - maxList.add(v); - } - if (list.containsAll(maxList)) { - break; - } - } - } - return maxList; - } - - // -------------------------------------------------------------------------- - /* - * 判断是否是同花顺 - */ - public static boolean isThuaShun(List list) { - List list1 = new ArrayList();// <方块> - List list2 = new ArrayList();// <梅花> - List list3 = new ArrayList();// <红桃> - List list4 = new ArrayList();// <黑桃> - - for (int i = 0; i < list.size(); i++) { - switch (list.get(i) % 4 + 1) { - case 1: - list1.add(list.get(i) / 4 + 1); - break; - case 2: - list2.add(list.get(i) / 4 + 1); - break; - case 3: - list3.add(list.get(i) / 4 + 1); - break; - case 4: - list4.add(list.get(i) / 4 + 1); - break; - } - } - if (list1.size() >= 5) { - getOrderList(list1); - if (isShunZi(list1)) { - return true; - } - } else if (list2.size() >= 5) { - getOrderList(list2); - if (isShunZi(list2)) { - return true; - } - } else if (list3.size() >= 5) { - getOrderList(list3); - if (isShunZi(list3)) { - return true; - } - } else if (list4.size() >= 5) { - getOrderList(list4); - if (isShunZi(list4)) { - return true; - } - } - return false; - } - - /* - * 得到最大同花顺 - */ - public static void getMaxThuaShun(List list) { - List list1 = new ArrayList();// <方块> - List list2 = new ArrayList();// <梅花> - List list3 = new ArrayList();// <红桃> - List list4 = new ArrayList();// <黑桃> - - for (int i = 0; i < list.size(); i++) { - switch (list.get(i) % 4 + 1) { - case 1: - list1.add(list.get(i) / 4 + 1); - break; - case 2: - list2.add(list.get(i) / 4 + 1); - break; - case 3: - list3.add(list.get(i) / 4 + 1); - break; - case 4: - list4.add(list.get(i) / 4 + 1); - break; - } - } - - list.clear(); - if (list1.size() >= 5) { - getOrderList(list1); - for (int i : getMaxShunZi(list1)) { - list.add((i - 1) * 4); - } - } - if (list2.size() >= 5) { - getOrderList(list2); - for (int i : getMaxShunZi(list2)) { - list.add((i - 1) * 4 + 1); - } - } - if (list3.size() >= 5) { - getOrderList(list3); - for (int i : getMaxShunZi(list3)) { - list.add((i - 1) * 4 + 2); - } - } - if (list4.size() >= 5) { - getOrderList(list4); - for (int i : getMaxShunZi(list4)) { - list.add((i - 1) * 4 + 3); - } - } - } - - // ---------------------------------------------------------------- - /* - * 判断是否是四条 - */ - public static boolean isSiTiao(List list) { - List valueList = new ArrayList(); - getOrderList(list); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 3) { - return true; - } - } - - return false; - } - - /* - * 得到最大的四条 - */ - public static void getMaxSiTiao(List list) { - List valueList = new ArrayList(); - getOrderList(list); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 3) { - valueList.clear(); - valueList.addAll(list.subList(i, i + 4)); - list.removeAll(valueList); - break; - } - } - - if (list.get(0) / 4 == 0) { - valueList.add(list.get(0)); - } else { - valueList.add(list.get(list.size() - 1)); - } - - list.clear(); - for (int i : valueList) { - list.add(i); - } - - } - - // ---------------------------------------------------------------- - /* - * 判断是否是葫芦 - */ - public static boolean isHuLu(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - boolean flag = false; - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 2) { - ls.addAll(valueList.subList(i, i + 3)); - valueList.removeAll(ls); - flag = true; - break; - } - } - if (flag) { - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i >= 1) { - return true; - } - } - } - return false; - } - - /* - * 得到最大葫芦 - */ - public static void getMaxHuLu(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - boolean flag = false; - - for (int i = 0; i < list.size(); i++) { - if (list.get(i) / 4 == 0) { - valueList.add(14); - } else { - valueList.add(list.get(i) / 4 + 1); - } - } - getOrderList(valueList); - - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) == 2) { - ls.addAll(valueList.subList(i - 2, i + 1)); - valueList.removeAll(ls); - flag = true; - break; - } - } - if (flag) { - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) >= 1) { - ls.addAll(valueList.subList(i - 1, i + 1)); - break; - } - } - - valueList.clear(); - for (int i = 0; i < ls.size(); i++) { - if (ls.get(i) == 14) { - ls.set(i, 1); - } - valueList.add(ls.get(i)); - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - int value = iter.next() / 4 + 1; - if (ls.contains(value)) { - for (int j = 0; j < ls.size(); j++) { - if (ls.get(j) == value) { - ls.set(j, 0); - break; - } - } - continue; - } else { - iter.remove(); - } - } - } - inOrderList(list, valueList); - } - - // ------------------------------------------------------- - /* - * 判断是否是同花 - */ - public static boolean isThua(List list) { - List valueList = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) % 4 + 1); - } - - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i >= 4) { - return true; - } - } - - return false; - } - - /* - * 得到最大同花 - */ - public static void getMaxThua(List list) { - List valueList = new ArrayList(); - int value = 0; - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) % 4 + 1); - } - - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i >= 4) { - value = valueList.get(i); - break; - } - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - if (iter.next() % 4 + 1 != value) { - iter.remove(); - } - } - - getOrderList(list); - if (list.get(0) / 4 == 0) { - list.add(list.get(0)); - } - - list.subList(0, list.size() - 5).clear(); - - } - - // --------------------------------------------------------------- - /* - * 判断是否是顺子 - */ - public static boolean isShunZi_Card(List list) { - List valueList = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - - return isShunZi(valueList); - } - - /* - * 得到最大顺子 - */ - public static void getMaxShunZi_Card(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - valueList = getMaxShunZi(valueList); - for (int i : valueList) { - ls.add(i); - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - int value = iter.next() / 4 + 1; - if (valueList.contains(value)) { - for (int j = 0; j < valueList.size(); j++) { - if (valueList.get(j) == value) { - valueList.set(j, 0); - break; - } - } - continue; - } else { - iter.remove(); - } - } - - inOrderList(list, ls); - } - - // ----------------------------------------------- - /* - * 判断是否是三条 - */ - public static boolean isSanTiao(List list) { - List valueList = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 2) { - return true; - } - } - return false; - } - - /* - * 得到最大三条 - */ - public static void getMaxSanTiao(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - if (list.get(i) / 4 == 0) { - valueList.add(14); - } else { - valueList.add(list.get(i) / 4 + 1); - } - } - getOrderList(valueList); - - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) == 2) { - ls.addAll(valueList.subList(i - 2, i + 1)); - valueList.removeAll(ls); - break; - } - } - - ls.addAll(valueList.subList(valueList.size() - 2, valueList.size())); - - valueList.clear(); - for (int i = 0; i < ls.size(); i++) { - if (ls.get(i) == 14) { - ls.set(i, 1); - } - valueList.add(ls.get(i)); - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - int value = iter.next() / 4 + 1; - if (ls.contains(value)) { - for (int j = 0; j < ls.size(); j++) { - if (ls.get(j) == value) { - ls.set(j, 0); - break; - } - } - continue; - } else { - iter.remove(); - } - } - - inOrderList(list, valueList); - } - - // ----------------------------------------------------- - /* - * 判断是否是两对 - */ - public static boolean isLDui(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - boolean flag = false; - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 1) { - ls.addAll(valueList.subList(i, i + 2)); - valueList.removeAll(ls); - flag = true; - break; - } - } - if (flag) { - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i >= 1) { - return true; - } - } - } - return false; - } - - /* - * 得到最大两对 - */ - public static void getMaxLDui(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - boolean flag = false; - - for (int i = 0; i < list.size(); i++) { - if (list.get(i) / 4 == 0) { - valueList.add(14); - } else { - valueList.add(list.get(i) / 4 + 1); - } - } - getOrderList(valueList); - - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) == 1) { - ls.addAll(valueList.subList(i - 1, i + 1)); - valueList.removeAll(ls); - flag = true; - break; - } - } - if (flag) { - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) >= 1) { - ls.addAll(valueList.subList(i - 1, i + 1)); - valueList.removeAll(ls); - break; - } - } - - ls.add(valueList.get(valueList.size() - 1)); - - valueList.clear(); - for (int i = 0; i < ls.size(); i++) { - if (ls.get(i) == 14) { - ls.set(i, 1); - } - valueList.add(ls.get(i)); - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - int value = iter.next() / 4 + 1; - if (ls.contains(value)) { - for (int j = 0; j < ls.size(); j++) { - if (ls.get(j) == value) { - ls.set(j, 0); - break; - } - } - continue; - } else { - iter.remove(); - } - } - } - - inOrderList(list, valueList); - } - - // -------------------------------------------------------- - /* - * 判断是否是一对 - */ - public static boolean isDuiZi(List list) { - List valueList = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - getOrderList(valueList); - - for (int i = 0; i < valueList.size(); i++) { - if (valueList.lastIndexOf(valueList.get(i)) - i == 1) { - return true; - } - } - return false; - } - - /* - * 得到最大对子 - */ - public static void getMaxDuiZi(List list) { - List valueList = new ArrayList(); - List ls = new ArrayList(); - - for (int i = 0; i < list.size(); i++) { - if (list.get(i) / 4 == 0) { - valueList.add(14); - } else { - valueList.add(list.get(i) / 4 + 1); - } - } - getOrderList(valueList); - - for (int i = valueList.size() - 1; i >= 0; i--) { - if (i - valueList.indexOf(valueList.get(i)) == 1) { - ls.addAll(valueList.subList(i - 1, i + 1)); - valueList.removeAll(ls); - break; - } - } - if (valueList.size() >= 3) { - ls.addAll(valueList.subList(valueList.size() - 3, valueList.size())); - } else { - ls.addAll(valueList); - } - - valueList.clear(); - for (int i = 0; i < ls.size(); i++) { - if (ls.get(i) == 14) { - ls.set(i, 1); - } - valueList.add(ls.get(i)); - } - - Iterator iter = list.iterator(); - while (iter.hasNext()) { - int value = iter.next() / 4 + 1; - if (ls.contains(value)) { - for (int j = 0; j < ls.size(); j++) { - if (ls.get(j) == value) { - ls.set(j, 0); - break; - } - } - continue; - } else { - iter.remove(); - } - } - - inOrderList(list, valueList); - } - - // -------------------------------------------------- - /* - * 得到最大单张 - */ - public static void getMaxDZhang(List list) { - getOrderList(list); - if (list.get(0) / 4 == 0) { - list.add(list.get(0)); - } - if (list.size() >= 5) { - list.subList(0, list.size() - 5).clear(); - } - } - - /* - * 将List按照指定的顺序排列 - */ - public static List inOrderList(List list, List valueList) { - List tempList = new ArrayList(); - - for (int i : valueList) { - for (int j = 0; j < list.size(); j++) { - if (list.get(j) / 4 + 1 == i && !tempList.contains(list.get(j))) { - tempList.add(list.get(j)); - break; - } - } - } - list.clear(); - for (int i : tempList) { - list.add(i); - } - - return list; - } - - public static void main(String[] args) { - List listnew = new ArrayList<>(); - int[] newcards = { 40, 39, 32, 28, 26, 5 }; - for (int i = 0; i < newcards.length; i++) { - listnew.add(newcards[i]); - } - List listold = new ArrayList<>(); - int[] oldcards = { 12, 14, 39, 40, 51, 2 }; - for (int i = 0; i < oldcards.length; i++) { - listold.add(oldcards[i]); - } - Integer result = compareValue(listnew, listold); - logger.info(result); - } -} \ No newline at end of file diff --git a/src/main/java/yuelj/cardUtils/PRandom.java b/src/main/java/yuelj/cardUtils/PRandom.java deleted file mode 100644 index ddc7021..0000000 --- a/src/main/java/yuelj/cardUtils/PRandom.java +++ /dev/null @@ -1,148 +0,0 @@ -package yuelj.cardUtils; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Random; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * 伪随机算法 - * - * @author lixiaoran - * - */ -public class PRandom { - private static Logger logger = LogManager.getLogger(PRandom.class); - public static void main(String[] args) { - long start = new Date().getTime(); - generateListTest(); - long end = new Date().getTime(); - logger.info(end - start); - } - - private static void generateListTest() { - int[] resultConfigList = { 16000, 24000, 32000, 40000, 64000, 80000, 120000, 160000, 200000, 400000 }; - float[] probList = { 0.71535f, 0.1477f, 0.0589f, 0.0368f, 0.02f, 0.01f, 0.00488f, 0.00316f, 0.00216f, - 0.00105f }; - ArrayList probabilityList = new ArrayList<>(); - for (int i = 0; i < resultConfigList.length; i++) { - ProbabilityEntity p = new ProbabilityEntity(); - p.setResult(resultConfigList[i]); - p.setProbability(probList[i]); - probabilityList.add(p); - } - // calculateProbabilityByWeight(probabilityList); - ArrayList resultList = getRandmValueList(80000, probabilityList); - // for (int i : resultList) { - // logger.info(i); - // } - ArrayList timesList = new ArrayList<>(10); - for (int i = 0; i < 10; i++) { - timesList.add(i, 0); - } - for (int i : resultList) { - timesList.set(i, timesList.get(i) + 1); - } - for (int i : timesList) { - logger.info(i); - } - for (ProbabilityEntity i : probabilityList) { - logger.info(i.getProbability()); - } - } - - /** - * 生成正态分布的值列表 - * - * @param length - * 值列表长度 - * @param probabilityList - * 概率值,中签返回值列表 - * @return - * @throws Exception - */ - public static ArrayList getRandmValueList(int length, ArrayList probabilityList) { - ArrayList resultList = new ArrayList(length); - // 根据正态分布生成概率列表p - ArrayList p = new ArrayList(); - for (ProbabilityEntity e : probabilityList) { - // 求期望分布间隔 - double mean = 1.0 / e.getProbability(); - double ef = getNumberInNormalDistribution(mean, mean / 3.0); - p.add(ef); - } - // 生成的结果集总长度length - for (int i = 0; i < length; i++) { - // 最小概率值 - double minp = 9999999999f; - // 索引 - int minj = -1; - // 找到最小概率 - for (int j = 0; j < p.size(); j++) { - if (p.get(j) < minp) { - minp = p.get(j); - minj = j; - } - } - // 生成一条结果 - resultList.add(minj); - // 对p进行变换 - for (int j = 0; j < p.size(); j++) { - double newpVal = p.get(j) - minp; - p.set(j, newpVal); - } - // 对p中最小概率重新正态分布随机 - double minmean = 1.0 / probabilityList.get(minj).getProbability(); - double newMean = getNumberInNormalDistribution(minmean, minmean / 3); - p.set(minj, newMean); - } - return resultList; - } - - /** - * 根据权重计算概率 - */ - private static void calculateProbabilityByWeight(ArrayList probabilityList) { - double weightSum = 0; - // 计算总权重 - for (ProbabilityEntity e : probabilityList) { - weightSum = weightSum + e.getWeight(); - } - // 计算每种情况的概率 - for (ProbabilityEntity e : probabilityList) { - e.setProbability(e.getWeight() / weightSum); - } - for (ProbabilityEntity e : probabilityList) { - e.setMean(1 / e.getProbability()); - } - } - - /** - * 正态分布模拟函数 - * - * @param mean - * 期望分布间隔 - * @param std_dev - * 标准差 - * @return 数组下标 - */ - public static double getNumberInNormalDistribution(double mean, double std_dev) { - return mean + uniform2NormalDistribution() * std_dev; - } - - /** - * 供正态分布模拟使用的偏差计算 - * - * @return - */ - public static double uniform2NormalDistribution() { - double sum = 0; - Random r = new Random(); - for (int i = 0; i < 12; i++) { - sum = sum + r.nextDouble(); - } - return sum - 6.0; - } -} diff --git a/src/main/java/yuelj/cardUtils/ProbabilityEntity.java b/src/main/java/yuelj/cardUtils/ProbabilityEntity.java deleted file mode 100644 index a2020bc..0000000 --- a/src/main/java/yuelj/cardUtils/ProbabilityEntity.java +++ /dev/null @@ -1,68 +0,0 @@ -package yuelj.cardUtils; - -/** - * 概率对象 - * - * @author lixiaoran - * - */ -public class ProbabilityEntity { - public ProbabilityEntity() { - } - - public ProbabilityEntity(int weightVal) { - this.weight = weightVal; - } - - /** - * 概率值 - */ - private double probability; - - /** - * 权重 - */ - private int weight; - - /** - * 中签后的返回结果 - */ - private int result; - - /** - * 期望中签间隔次数 - */ - private double mean; - - public double getMean() { - return mean; - } - - public void setMean(double mean) { - this.mean = mean; - } - - public int getWeight() { - return weight; - } - - public void setWeight(int weight) { - this.weight = weight; - } - - public int getResult() { - return result; - } - - public void setResult(int result) { - this.result = result; - } - - public double getProbability() { - return probability; - } - - public void setProbability(double probability) { - this.probability = probability; - } -} diff --git a/src/main/java/yuelj/cardUtils/ThreeCardCompareUtil.java b/src/main/java/yuelj/cardUtils/ThreeCardCompareUtil.java deleted file mode 100644 index 8365b5f..0000000 --- a/src/main/java/yuelj/cardUtils/ThreeCardCompareUtil.java +++ /dev/null @@ -1,356 +0,0 @@ -package yuelj.cardUtils; - -import java.util.ArrayList; -import java.util.List; - -public class ThreeCardCompareUtil { - /** - * 获取欢乐拼三张的牌型,写在数组最后一位 - * - * @param list - * @return - */ - public static List getCardsGroupType(List listOld) { - List list = new ArrayList(); - for (Integer i : listOld) { - list.add(i); - } - if (isThuaShun(list)) { - // 同花顺9 - list.add(9); - } else if (isThua(list)) { - // 同花6 - list.add(6); - } else if (isShunZi_Card(list)) { - // 顺子7 - list.add(7); - } else if (isSanTiao(list)) { - // 豹子三条10 - list.add(10); - } else if (isDuiZi(list)) { - // 一对3 - list.add(3); - // } else if (isSpecial235(list)) { - // 235 - // list.add(1); - } else { - // 单张2 - list.add(2);// 判断级别 - } - return list; - } - - /** - * 判断欢乐拼三张牌型大小, - * - * @param listnew - * @param listold - * @return 返回1,listnew>listold,返回0,listnew=listold,返回-1,listnew listnew, List listold) { - // 判断牌型并将牌型编号加在数组最后一位 - List list1 = new ArrayList<>(); - List list2 = new ArrayList<>(); - list1.addAll(listnew); - list2.addAll(listold); - // 现根据牌型比较 - int type1 = list1.get(list1.size() - 1); - int type2 = list2.get(list2.size() - 1); - int typeMinus = type1 - type2; - if (typeMinus > 0) { - return 1; - } - if (typeMinus < 0) { - return -1; - } - // 若牌型相同 - if (typeMinus == 0) { - // 将A的值从0.1.2.3设为52 - for (int i = 0; i < 3; i++) { - if (list1.get(i) / 4 == 0) { - list1.set(i, 52); - } - if (list2.get(i) / 4 == 0) { - list2.set(i, 52); - } - } - // 去除牌型标志并排序 - list1 = list1.subList(0, 3); - list1 = getOrderList(list1); - list2 = list2.subList(0, 3); - list2 = getOrderList(list2); - switch (type1) { - case 9:// 同花顺 - return getCompareFirstCard(list1, list2); - case 7:// 顺子 - return getCompareFirstCard(list1, list2); - case 6:// 同花 - return getCompareOneByOne(list1, list2); - case 10:// 三条 - return getCompareFirstCard(list1, list2); - case 3:// 一对 - // 对子牌的值 - int doubleMinus = getDoubleCard(list1) / 4 - getDoubleCard(list2) / 4; - if (doubleMinus > 0) - return 1; - else if (doubleMinus < 0) - return -1; - else { - int singleMinus = getSingleCard(list1) / 4 - getSingleCard(list2) / 4; - if (singleMinus > 0) - return 1; - else if (singleMinus < 0) - return -1; - else { - return 0; - } - } - case 2:// 除235外的普通牌 - return getCompareOneByOne(list1, list2); - // case 1:// 除同花的235 - // return 0; - } - } - return null; - } - - /** - * 若传入带有对子的3张牌,返回对子的值 - * - * @param list1 - * @return - */ - public static int getDoubleCard(List list1) { - if (list1.get(0) == list1.get(1) || list1.get(0) == list1.get(2)) { - return list1.get(0); - } else { - return list1.get(1); - } - } - - /** - * 若传入带有对子的3张牌,返回单张的牌 - * - * @param list1 - * @return - */ - public static int getSingleCard(List list1) { - if (list1.get(0) == list1.get(1)) { - return list1.get(2); - } else if (list1.get(0) == list1.get(2)) { - return list1.get(1); - } else { - return list1.get(0); - } - } - - /** - * 对比第一张牌,返回列表大小 - * - * @param list1 - * @param list2 - * @return - */ - public static int getCompareFirstCard(List list1, List list2) { - int minus = list1.get(0) / 4 - list2.get(0) / 4; - if (minus > 0) - return 1; - else if (minus < 0) - return -1; - else - return 0; - } - - /** - * 一张张对比,返回列表大小 - * - * @param list1 - * @param list2 - * @return - */ - public static int getCompareOneByOne(List list1, List list2) { - if (list1.get(2) / 4 - list2.get(2) / 4 > 0) { - return 1; - } else if (list1.get(2) / 4 - list2.get(2) / 4 < 0) { - return -1; - } else { - if (list1.get(1) / 4 - list2.get(1) / 4 > 0) { - return 1; - } else if (list1.get(1) / 4 - list2.get(1) / 4 < 0) { - return -1; - } else { - if (list1.get(0) / 4 - list2.get(0) / 4 > 0) { - return 1; - } else if (list1.get(0) / 4 - list2.get(0) / 4 < 0) { - return -1; - } else { - return 0; - } - } - } - } - - /** - * 非同花色的235,比豹子大 - * - * @param list - * @return - */ - // public static boolean isSpecial235(List list) { - // if (list.get(0) / 4 == 1 && list.get(1) / 4 == 2 && list.get(2) / 4 == 4) - // { - // return true; - // } - // return false; - // } - - /* - * 根据1到13的牌数字,判断是否是顺子 - */ - public static boolean isShunZi(List list) { - List maxList = new ArrayList(); - //Q,K - for (int i = 2; i < 4; i++) { - maxList.add(i + 10); - } - //A - maxList.add(1); - - if (list.containsAll(maxList)) { - return true; - } else { - maxList.clear(); - for (int a = list.size() - 1; a >= 0; a--) { - int v = list.get(a); - maxList.clear(); - for (int j = 0; j < 3; j++, v--) { - maxList.add(v); - } - if (list.containsAll(maxList)) { - return true; - } - } - } - return false; - } - - // -------------------------------------------------------------------------- - /* - * 判断是否是同花顺 - */ - public static boolean isThuaShun(List list) { - List list1 = new ArrayList();// <方块> - List list2 = new ArrayList();// <梅花> - List list3 = new ArrayList();// <红桃> - List list4 = new ArrayList();// <黑桃> - for (int i = 0; i < list.size(); i++) { - switch (list.get(i) % 4 + 1) { - case 1: - list1.add(list.get(i) / 4 + 1); - break; - case 2: - list2.add(list.get(i) / 4 + 1); - break; - case 3: - list3.add(list.get(i) / 4 + 1); - break; - case 4: - list4.add(list.get(i) / 4 + 1); - break; - } - } - if (list1.size() >= 3) { - getOrderList(list1); - if (isShunZi(list1)) { - return true; - } - } else if (list2.size() >= 3) { - getOrderList(list2); - if (isShunZi(list2)) { - return true; - } - } else if (list3.size() >= 3) { - getOrderList(list3); - if (isShunZi(list3)) { - return true; - } - } else if (list4.size() >= 3) { - getOrderList(list4); - if (isShunZi(list4)) { - return true; - } - } - return false; - } - - // ------------------------------------------------------- - /* - * 判断是否是同花 - */ - public static boolean isThua(List list) { - if ((list.get(0) % 4) == (list.get(1) % 4) && (list.get(1) % 4) == (list.get(2) % 4)) { - return true; - } - return false; - } - - // --------------------------------------------------------------- - /* - * 判断是否是顺子 - */ - public static boolean isShunZi_Card(List list) { - List valueList = new ArrayList(); - // 全部0到51不分花色,转换为1到13 - for (int i = 0; i < list.size(); i++) { - valueList.add(list.get(i) / 4 + 1); - } - return isShunZi(valueList); - } - - // ----------------------------------------------- - /* - * 判断是否是三条 - */ - public static boolean isSanTiao(List list) { - if ((list.get(0) / 4) == (list.get(1) / 4) && (list.get(1) / 4) == (list.get(2) / 4)) { - return true; - } - return false; - } - - // -------------------------------------------------------- - /* - * 判断是否是一对 - */ - public static boolean isDuiZi(List list) { - if ((list.get(0) / 4) == (list.get(1) / 4) || (list.get(1) / 4) == (list.get(2) / 4) - || (list.get(0) / 4) == (list.get(2) / 4)) { - return true; - } - return false; - } - - /* - * 从小到大排列 - */ - public static List getOrderList(List list) { - int tmp = 0; - for (int i = 0; i < list.size(); i++) { - for (int j = i + 1; j < list.size(); j++) { - if (list.get(j) < list.get(i)) { - tmp = list.get(i); - list.set(i, list.get(j)); - list.set(j, tmp); - } - } - } - return list; - } - public static void main(String[] args) { - List list=new ArrayList<>(); - list.add(1); - list.add(13); - list.add(12); - System.out.println(isShunZi(list));; - } -} diff --git a/src/main/java/yuelj/constants/CacheKeys.java b/src/main/java/yuelj/constants/CacheKeys.java deleted file mode 100644 index 0271d9c..0000000 --- a/src/main/java/yuelj/constants/CacheKeys.java +++ /dev/null @@ -1,20 +0,0 @@ -package yuelj.constants; - -/** - * 缓存key的常量类 - * - * @author lixiaoran - * - */ -public class CacheKeys { - /** - * 键:app登录uid - * 值:token - */ - public static final String APP_TOKEN = "app_token_"; - /** - * 键:app登录token - * 值:uid - */ - public static final String APP_TOKEN_UID = "app_token_uid_"; -} diff --git a/src/main/java/yuelj/constants/ParamsAndURL.java b/src/main/java/yuelj/constants/ParamsAndURL.java deleted file mode 100644 index 7f92312..0000000 --- a/src/main/java/yuelj/constants/ParamsAndURL.java +++ /dev/null @@ -1,48 +0,0 @@ -package yuelj.constants; - -import java.lang.reflect.Field; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class ParamsAndURL { - private static Logger logger = LogManager.getLogger(ParamsAndURL.class); - /** - * 设置当前所在的环境ONLINE线上,TEST测试环境 - */ - public static final String TEST_OR_ONLINE = "TEST"; - - // memcache缓存 - public static final String MEMCACHE_host_TEST = "127.0.0.1"; - public static final String MEMCACHE_host_ONLINE = "44478f99146944ea.m.cnhzalicm10pub001.ocs.aliyuncs.com"; - // 是否开启日志 - public static final boolean OPEN_LOG = true; - - /** - * 获取连接参数 - * - * @param key - * 参数名 - * @return - */ - public static Object getParam(String key) { - return getProperty(key + "_" + TEST_OR_ONLINE); - } - - private static Object getProperty(String key) { - Object ret = ""; - try { - Field f = ParamsAndURL.class.getDeclaredField(key); - // 写数据 - ret = f.get(key); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return ret; - } - - public static void main(String[] args) { - logger.info(getParam("WSTOCK_ACC")); - } -} diff --git a/src/main/java/yuelj/constants/RoomTypeList.java b/src/main/java/yuelj/constants/RoomTypeList.java deleted file mode 100644 index 9246a64..0000000 --- a/src/main/java/yuelj/constants/RoomTypeList.java +++ /dev/null @@ -1,122 +0,0 @@ -package yuelj.constants; - -import java.util.HashMap; -import java.util.Map; -import java.util.Stack; - -import yuelj.texas.Room; -import yuelj.texas.threeCard.ThreeCardRoom; - -/** - * 房间类型列表 - * - * @author Ming - * - */ -public class RoomTypeList { - public static Map roomTypeMap = new HashMap(); - public static Map threeCardRoomTypeMap = new HashMap(); - static { - roomTypeMap.put(0, getNewRoom(0)); - roomTypeMap.put(1, getNewRoom(1)); - roomTypeMap.put(2, getNewRoom(2)); - threeCardRoomTypeMap.put(0, getThreeCardRoom(0)); - threeCardRoomTypeMap.put(1, getThreeCardRoom(1)); - threeCardRoomTypeMap.put(2, getThreeCardRoom(2)); - } - - /** - * 根据级别获取德州扑克房间 - * - * @param level - * @return - */ - public static Room getNewRoom(int level) { - Room room = new Room(); - int jMaxPlayer = 6; - room.setMaxPlayers(6); - room.setMinPlayers(2); - room.setDealer(1); - room.setRoomstate(1); - room.setFreeSeatStack(getStack(jMaxPlayer)); - room.setOptTimeout(10 * 1000); - room.setRestBetweenGame(8 * 1000); - if (level == 0) { - room.setLevel(0); - room.setMaxChips(10000); - room.setMinChips(100); - room.setBigBet(100); - room.setSmallBet(50); - } else if (level == 1) { - room.setLevel(1); - room.setMaxChips(20000); - room.setMinChips(20000); - room.setBigBet(200); - room.setSmallBet(100); - } else if (level == 2) { - room.setLevel(2); - room.setMaxChips(50000); - room.setMinChips(50000); - room.setBigBet(500); - room.setSmallBet(250); - } - return room; - } - - /** - * 获取欢乐拼三张的房间 - * - * @param level - * @return - */ - public static ThreeCardRoom getThreeCardRoom(int level) { - ThreeCardRoom room = new ThreeCardRoom(); - int jMaxPlayer = 6; - room.setMaxPlayers(6); - room.setMinPlayers(2); - room.setDealer(1); - room.setRoomstate(1); - room.setFreeSeatStack(getStack(jMaxPlayer)); - room.setOptTimeout(10 * 1000); - room.setRestBetweenGame(8 * 1000); - //每人回收的台费 - room.setTableFeeBet(20); - if (level == 0) { - room.setLevel(0); - //封顶带入 - room.setMaxChips(3000); - //最小带入 - room.setMinChips(500); - //三种看牌下注额度,小50,大100,双倍大200 - room.setDoubleBigBet(200); - room.setBigBet(100); - room.setSmallBet(50); - //三种暗牌下注额度,小20,大40,双倍大80 - room.setSmallBlindBet(20); - room.setBigBlindBet(40); - room.setDoubleBigBlindBet(80); - } else if (level == 1) { - room.setLevel(1); - room.setMaxChips(20000); - room.setMinChips(20000); - room.setBigBet(200); - room.setSmallBet(100); - } else if (level == 2) { - room.setLevel(2); - room.setMaxChips(50000); - room.setMinChips(50000); - room.setBigBet(500); - room.setSmallBet(250); - } - return room; - } - - public static Stack getStack(int maxPlayer) { - Stack stack = new Stack(); - for (int i = 0; i < maxPlayer; i++) { - stack.push(i); - } - return stack; - } - -} diff --git a/src/main/java/yuelj/constants/Types.java b/src/main/java/yuelj/constants/Types.java deleted file mode 100644 index 2b11693..0000000 --- a/src/main/java/yuelj/constants/Types.java +++ /dev/null @@ -1,54 +0,0 @@ -package yuelj.constants; - -/** - * 类型常量 - * - * @author lxr 2015年6月23日 下午5:17:40 - */ -public class Types { - - /** - * 付款类型---支付宝 - */ - public static final String INN_ACCOUT_TYPE_ALIPAY = "alipay"; - - /** - * 成功 - */ - public static final int SUCCESS = 1; - /** - * 失败 - */ - public static final int FAIL = 0; - - /** - * 0删除,1启用,2不启用 - */ - public static final int ROOM_TYPE_STATE_OPEN = 1; - - public static final int ROOM_TYPE_STATE_CLOSED = 2; - - public static final int ROOM_TYPE_STATE_DEL = 0; - - - /** - * 正常 - */ - public static final int YLJ_NORMAL = 1; - - /** - * 失效 - */ - public static final int YLJ_EXPIRE = 0; - - /** - * 渠道--默认 - */ - public static final String CHANNEL_DEFAULT = "default"; - - /** - * 黑名单 - */ - public static final String GUEST_BLACK = "2"; - -} diff --git a/src/main/java/yuelj/controller/Hello.java b/src/main/java/yuelj/controller/Hello.java deleted file mode 100644 index 5255478..0000000 --- a/src/main/java/yuelj/controller/Hello.java +++ /dev/null @@ -1,12 +0,0 @@ -package yuelj.controller; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class Hello { - @RequestMapping("/hello") - public String hello() { - return "hello"; - } -} diff --git a/src/main/java/yuelj/controller/RoomInfoController.java b/src/main/java/yuelj/controller/RoomInfoController.java deleted file mode 100644 index 250ec0c..0000000 --- a/src/main/java/yuelj/controller/RoomInfoController.java +++ /dev/null @@ -1,57 +0,0 @@ -package yuelj.controller; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import yuelj.texas.TexasStatic; -import yuelj.utils.serialize.JsonUtils; - -@RestController -public class RoomInfoController { - @RequestMapping("/roomList") - public String roomList() { - return JsonUtils.toListJson(TexasStatic.roomList); - } - - @RequestMapping("/roomCount") - public String roomCount() { - return TexasStatic.roomList.size() + ""; - } - - @RequestMapping("/roomPlayers") - public AtomicInteger roomPlayers() { - AtomicInteger players = new AtomicInteger(0); - TexasStatic.roomList.parallelStream().forEach(room -> { - players.getAndAdd(room.getIngamePlayers().size()); - }); - return players; - } - - @RequestMapping("/statistics") - public Map statistics() { - Map map = new HashMap(); - //总房间数量 - map.put("roomCount", TexasStatic.roomList.size() + ""); - //游戏中玩家数量 - AtomicInteger ingamePlayers = new AtomicInteger(0); - TexasStatic.roomList.parallelStream().forEach(room -> { - ingamePlayers.getAndAdd(room.getIngamePlayers().size()); - }); - map.put("ingamePlayers", ingamePlayers.toString()); - //等待开局玩家数量 - AtomicInteger waitPlayers = new AtomicInteger(0); - TexasStatic.roomList.parallelStream().forEach(room -> { - waitPlayers.getAndAdd(room.getWaitPlayers().size()); - }); - map.put("waitPlayers", waitPlayers.toString()); - //总在线玩家数 - map.put("playersCount", TexasStatic.playerSessionMap.size()+""); - map.put("loginPlayerMap", TexasStatic.loginPlayerMap.size()+""); - - return map; - } -} diff --git a/src/main/java/yuelj/dao/GameLogDao.java b/src/main/java/yuelj/dao/GameLogDao.java deleted file mode 100644 index 39d1e48..0000000 --- a/src/main/java/yuelj/dao/GameLogDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package yuelj.dao; - -import java.util.List; - -import yuelj.entity.GameLog; - -public interface GameLogDao { - - List selectGameLog(GameLog entity); - - void insertGameLog(GameLog entity); - -} diff --git a/src/main/java/yuelj/dao/PlayerDao.java b/src/main/java/yuelj/dao/PlayerDao.java deleted file mode 100644 index 89ea9bc..0000000 --- a/src/main/java/yuelj/dao/PlayerDao.java +++ /dev/null @@ -1,21 +0,0 @@ -package yuelj.dao; - -import java.util.List; - -import yuelj.entity.PageEntity; -import yuelj.entity.Player; - -public interface PlayerDao { - public List selectPlayers(Player player); - public List selectLoginPlayer(Player player); - public String selectPlayersCount(Player player) ; - public void insertPlayer(Player player); - - public void updatePlayer(Player player); - - - public void updatePlayerPassword(Player player); - public List selectPlayersPage(Player player, PageEntity page); - void updatePlayerCache(Player player); - -} diff --git a/src/main/java/yuelj/dao/SystemLogDao.java b/src/main/java/yuelj/dao/SystemLogDao.java deleted file mode 100644 index fccfeac..0000000 --- a/src/main/java/yuelj/dao/SystemLogDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package yuelj.dao; - -import java.util.List; - -import yuelj.entity.SystemLogEntity; - -public interface SystemLogDao { - - List selectSystemLog(SystemLogEntity entity); - - void insertSystemLog(SystemLogEntity entity); - -} diff --git a/src/main/java/yuelj/dao/UserDao.java b/src/main/java/yuelj/dao/UserDao.java deleted file mode 100644 index ccc5e80..0000000 --- a/src/main/java/yuelj/dao/UserDao.java +++ /dev/null @@ -1,28 +0,0 @@ -package yuelj.dao; - -import java.util.List; - -import yuelj.entity.PageEntity; -import yuelj.entity.UserEntity; - -public interface UserDao { - public List selectUsers(UserEntity user); - public List selectLoginUser(UserEntity user); - public String selectUsersCount(UserEntity user) ; - public void insertUser(UserEntity user); - - public void updateUser(UserEntity user); - - public void updateUserState(UserEntity user); - - public void updateUserPassword(UserEntity user); - public List selectUsersPage(UserEntity user, PageEntity page); - - /** - * 账号和手机号去重 - * @param user - * @return - */ - UserEntity checkAccountOrMobile(UserEntity user); - void updateUserCache(UserEntity user); -} diff --git a/src/main/java/yuelj/dao/UserMachineDao.java b/src/main/java/yuelj/dao/UserMachineDao.java deleted file mode 100644 index 2bcf841..0000000 --- a/src/main/java/yuelj/dao/UserMachineDao.java +++ /dev/null @@ -1,15 +0,0 @@ -package yuelj.dao; - -import java.util.List; - -import yuelj.entity.UserMachineEntity; - -public interface UserMachineDao { - - void addUserMachine(UserMachineEntity UserMachine); - - void updateUserMachine(UserMachineEntity UserMachine); - - List getUserMachine(UserMachineEntity UserMachine); - -} diff --git a/src/main/java/yuelj/dao/base/BaseDao.java b/src/main/java/yuelj/dao/base/BaseDao.java deleted file mode 100644 index 127d5e8..0000000 --- a/src/main/java/yuelj/dao/base/BaseDao.java +++ /dev/null @@ -1,108 +0,0 @@ -package yuelj.dao.base; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.support.SqlSessionDaoSupport; -import org.springframework.beans.factory.annotation.Autowired; - -import yuelj.entity.BaseEntity; -import yuelj.utils.cache.MemCacheOcsUtils; -import yuelj.utils.serialize.JsonUtils; - -public class BaseDao extends SqlSessionDaoSupport { - @Autowired - public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { - super.setSqlSessionFactory(sqlSessionFactory); - } - - public final static boolean useMemcache = false; - - @SuppressWarnings("unchecked") - public List selectList(String sqlmap, T ob) { - List list = new ArrayList(); - SqlSession session = getSqlSession(); - T be = (T) ob; - if (ob != null && be.getId() != null && useMemcache) { - // 从缓存中获取 - String json = MemCacheOcsUtils.getData(sqlmap.split("\\.")[0] + be.getId()); - if (json == null || json.length() == 0) { - list = session.selectList(sqlmap, ob); - - if (list != null && list.size() == 1) { - MemCacheOcsUtils.setData(sqlmap.split("\\.")[0] + be.getId(), - JsonUtils.toJson(list.get(0), ob.getClass())); - } - } else { - ob = (T) JsonUtils.fromJson(json, ob.getClass()); - list.add(ob); - } - } else { - list = session.selectList(sqlmap, ob); - } - return list; - } - - /** - * 只更新entity部分信息,为空的不变 - * - * @param sqlmap - * @param ob - */ - public void updateEntity(String sqlmap, T ob) { - SqlSession session = getSqlSession(); - session.update(sqlmap, ob); - delCache(sqlmap, ob); - } - - public void updateEntityCache(String sqlmap, T ob) { - updateCache(sqlmap, ob); - } - - public void getEntityCache(String sqlmap, T ob) { - getCache(sqlmap, ob); - } - - public String insertEntity(String sqlmap, T ob) { - SqlSession session = getSqlSession(); - String ret = session.insert(sqlmap, ob) + ""; - return ret; - } - - public void deleteEntity(String sqlmap, String id) { - SqlSession session = getSqlSession(); - session.delete(sqlmap, Integer.parseInt(id)); - delCache(sqlmap, id); - } - - private static void updateCache(String sqlmap, T be) { - if (be.getId() != null && useMemcache) { - // 更新缓存 - String value = JsonUtils.toJson(be, be.getClass()); - MemCacheOcsUtils.setData(sqlmap.split("\\.")[0] + be.getId(), value); - } - } - - private static void getCache(String sqlmap, T ob) { - BaseEntity be = (BaseEntity) ob; - if (be.getId() != null && useMemcache) { - String json = MemCacheOcsUtils.getData(sqlmap.split("\\.")[0] + be.getId()); - ob = (T) JsonUtils.fromJson(json, ob.getClass()); - } - } - - private static void delCache(String sqlmap, String id) { - if (useMemcache) - // 删除缓存 - MemCacheOcsUtils.setData(sqlmap.split("\\.")[0] + id, ""); - } - - private static void delCache(String sqlmap, T be) { - if (be.getId() != null && useMemcache) { - delCache(sqlmap, be.getId()); - } - } - -} diff --git a/src/main/java/yuelj/dao/impl/GameLogDaoImpl.java b/src/main/java/yuelj/dao/impl/GameLogDaoImpl.java deleted file mode 100644 index f1ff6c9..0000000 --- a/src/main/java/yuelj/dao/impl/GameLogDaoImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package yuelj.dao.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -import yuelj.dao.GameLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.GameLog; - -import java.util.List; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import yuelj.dao.SystemLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.SystemLogEntity; -@Primary -@Repository -public class GameLogDaoImpl extends BaseDao implements GameLogDao { - - @Override - public List selectGameLog(GameLog entity) { - List list = new ArrayList(); - list = selectList("GameLogMapper.selectGameLog", entity); - return list; - } - - @Override - public void insertGameLog(GameLog entity) { - insertEntity("GameLogMapper.insertGameLog", entity); - } - -} diff --git a/src/main/java/yuelj/dao/impl/PlayerImpl.java b/src/main/java/yuelj/dao/impl/PlayerImpl.java deleted file mode 100644 index 2604f19..0000000 --- a/src/main/java/yuelj/dao/impl/PlayerImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -package yuelj.dao.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.stereotype.Repository; - -import yuelj.dao.PlayerDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.PageEntity; -import yuelj.entity.Player; - -import java.util.List; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import yuelj.dao.SystemLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.SystemLogEntity; -@Primary -@Repository -public class PlayerImpl extends BaseDao implements PlayerDao { - - @Override - public List selectPlayers(Player player) { - List list = new ArrayList(); - list = selectList("PlayerMapper.selectPlayer", player); - return list; - } - - @Override - public List selectLoginPlayer(Player player) { - List list = new ArrayList(); - list = selectList("PlayerMapper.selectLoginPlayer", player); - return list; - } - - @Override - public String selectPlayersCount(Player player) { - String count = this.getSqlSession().selectOne("PlayerMapper.selectPlayerCount", player); - return count; - } - - @Override - public void insertPlayer(Player player) { - insertEntity("PlayerMapper.insertPlayer", player); - } - - @Override - public void updatePlayer(Player player) { - updateEntity("PlayerMapper.updatePlayer", player); - } - - @Override - public void updatePlayerCache(Player player) { - updateEntityCache("PlayerMapper.cache", player); - } - - @Override - public void updatePlayerPassword(Player player) { - updateEntity("PlayerMapper.updatePlayerPassword", player); - } - - @Override - public List selectPlayersPage(Player player, PageEntity page) { - List list = new ArrayList(); - Map map = new HashMap(); - map.put("Player", player); - map.put("page", page); - String count = this.getSqlSession().selectOne("PlayerMapper.selectPlayerCount", player); - page.setTotalCount(count); - list = this.getSqlSession().selectList("PlayerMapper.selectPlayerPage", map); - return list; - } - -} diff --git a/src/main/java/yuelj/dao/impl/SystemLogImpl.java b/src/main/java/yuelj/dao/impl/SystemLogImpl.java deleted file mode 100644 index a3cfed6..0000000 --- a/src/main/java/yuelj/dao/impl/SystemLogImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package yuelj.dao.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import yuelj.dao.SystemLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.SystemLogEntity; -@Primary -@Repository -public class SystemLogImpl extends BaseDao implements SystemLogDao { - - @Override - public List selectSystemLog(SystemLogEntity entity) { - List list = new ArrayList(); - list = selectList("LogMapper.selectSystemLog", entity); - return list; - } - - @Override - public void insertSystemLog(SystemLogEntity entity) { - insertEntity("LogMapper.insertSystemLog", entity); - } - -} diff --git a/src/main/java/yuelj/dao/impl/UserImpl.java b/src/main/java/yuelj/dao/impl/UserImpl.java deleted file mode 100644 index 292337d..0000000 --- a/src/main/java/yuelj/dao/impl/UserImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -package yuelj.dao.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.stereotype.Repository; - -import yuelj.dao.UserDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.PageEntity; -import yuelj.entity.UserEntity; - -import java.util.List; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import yuelj.dao.SystemLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.SystemLogEntity; -@Primary -@Repository -public class UserImpl extends BaseDao implements UserDao { - - @Override - public List selectUsers(UserEntity user) { - List list = new ArrayList(); - list = selectList("UserMapper.selectUser", user); - return list; - } - - @Override - public List selectLoginUser(UserEntity user) { - List list = new ArrayList(); - list = selectList("UserMapper.selectLoginUser", user); - return list; - } - - @Override - public String selectUsersCount(UserEntity user) { - String count = this.getSqlSession().selectOne("UserMapper.selectUserCount", user); - return count; - } - - @Override - public void insertUser(UserEntity user) { - insertEntity("UserMapper.insertUser", user); - } - - @Override - public void updateUser(UserEntity user) { - updateEntity("UserMapper.updateUser", user); - } - - @Override - public void updateUserCache(UserEntity user) { - updateEntityCache("UserMapper.cache", user); - } - - @Override - public void updateUserState(UserEntity user) { - updateEntity("UserMapper.updateUserState", user); - } - - @Override - public void updateUserPassword(UserEntity user) { - updateEntity("UserMapper.updateUserPassword", user); - } - - @Override - public List selectUsersPage(UserEntity user, PageEntity page) { - List list = new ArrayList(); - Map map = new HashMap(); - map.put("user", user); - map.put("page", page); - String count = this.getSqlSession().selectOne("UserMapper.selectUserCount", user); - page.setTotalCount(count); - list = this.getSqlSession().selectList("UserMapper.selectUserPage", map); - return list; - } - - @Override - public UserEntity checkAccountOrMobile(UserEntity user) { - List list = this.getSqlSession().selectList("UserMapper.checkAccountAndMobile", user); - if (null != list && list.size() > 0) { - return (UserEntity) list.get(0); - } - return null; - } -} diff --git a/src/main/java/yuelj/dao/impl/UserMachineDaoImpl.java b/src/main/java/yuelj/dao/impl/UserMachineDaoImpl.java deleted file mode 100644 index 619ba83..0000000 --- a/src/main/java/yuelj/dao/impl/UserMachineDaoImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package yuelj.dao.impl; - -import java.util.List; - -import org.springframework.stereotype.Repository; - -import yuelj.dao.UserMachineDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.UserMachineEntity; - -import java.util.List; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import yuelj.dao.SystemLogDao; -import yuelj.dao.base.BaseDao; -import yuelj.entity.SystemLogEntity; -@Primary -@Repository -public class UserMachineDaoImpl extends BaseDao implements UserMachineDao { - @Override - public void addUserMachine(UserMachineEntity UserMachine) { - this.getSqlSession().insert("UserMachineMapper.addUserMachine", - UserMachine); - } - - @Override - public void updateUserMachine(UserMachineEntity UserMachine) { - this.getSqlSession().update("UserMachineMapper.updateUserMachine", - UserMachine); - } - - @Override - public List getUserMachine(UserMachineEntity UserMachine) { - return this.getSqlSession().selectList( - "UserMachineMapper.queryUserMachine", UserMachine); - } -} diff --git a/src/main/java/yuelj/entity/AlipayCallBackEntity.java b/src/main/java/yuelj/entity/AlipayCallBackEntity.java deleted file mode 100644 index 209e83b..0000000 --- a/src/main/java/yuelj/entity/AlipayCallBackEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -package yuelj.entity; - -public class AlipayCallBackEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - /** - * 商户订单号 - */ - private String out_trade_no; - /** - * 支付宝交易号 - */ - private String trade_no; - /** - * 交易状态 - */ - private String trade_status; - /** - * 买家支付宝用户号 - */ - private String buyer_id; - /** - * 买家支付宝账号 - */ - private String buyer_email; - /** - * 交易金额 - */ - private String total_fee; - - public String getOut_trade_no() { - return out_trade_no; - } - - public void setOut_trade_no(String out_trade_no) { - this.out_trade_no = out_trade_no; - } - - public String getTrade_no() { - return trade_no; - } - - public void setTrade_no(String trade_no) { - this.trade_no = trade_no; - } - - public String getTrade_status() { - return trade_status; - } - - public void setTrade_status(String trade_status) { - this.trade_status = trade_status; - } - - public String getBuyer_id() { - return buyer_id; - } - - public void setBuyer_id(String buyer_id) { - this.buyer_id = buyer_id; - } - - public String getBuyer_email() { - return buyer_email; - } - - public void setBuyer_email(String buyer_email) { - this.buyer_email = buyer_email; - } - - public String getTotal_fee() { - return total_fee; - } - - public void setTotal_fee(String total_fee) { - this.total_fee = total_fee; - } -} diff --git a/src/main/java/yuelj/entity/BaseEntity.java b/src/main/java/yuelj/entity/BaseEntity.java deleted file mode 100644 index c30941c..0000000 --- a/src/main/java/yuelj/entity/BaseEntity.java +++ /dev/null @@ -1,31 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; - -import com.google.gson.annotations.Expose; - -public class BaseEntity implements Serializable { - private static final long serialVersionUID = -4908632621737577454L; - @Expose - public String id; - - @Expose - public int c; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getC() { - return c; - } - - public void setC(int c) { - this.c = c; - } - -} diff --git a/src/main/java/yuelj/entity/BetPlayer.java b/src/main/java/yuelj/entity/BetPlayer.java deleted file mode 100644 index ef5ae2e..0000000 --- a/src/main/java/yuelj/entity/BetPlayer.java +++ /dev/null @@ -1,71 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; - -import com.google.gson.annotations.Expose; - -/** - * 玩家下注信息 - * - * @author Ming - * - */ -public class BetPlayer extends BaseEntity implements Serializable { - - private static final long serialVersionUID = 1L; - /** - * 座位号,从0开始算,没有座位-1 - */ - @Expose - private int seatNum = -1; - - /** - * 筹码(身上所携带的筹码,游戏中可以用来下注的筹码) - */ - @Expose - private long bodyChips; - /** - * 在一局中下注的次数 - */ - @Expose - private int betTimes; - - /** - * 下注筹码(本轮下注筹码) - */ - @Expose - private int inChips; - - public int getBetTimes() { - return betTimes; - } - - public void setBetTimes(int betTimes) { - this.betTimes = betTimes; - } - - public int getSeatNum() { - return seatNum; - } - - public void setSeatNum(int seatNum) { - this.seatNum = seatNum; - } - - public long getBodyChips() { - return bodyChips; - } - - public void setBodyChips(long bodyChips) { - this.bodyChips = bodyChips; - } - - public int getInChips() { - return inChips; - } - - public void setInChips(int inChips) { - this.inChips = inChips; - } - -} diff --git a/src/main/java/yuelj/entity/ClientPlayer.java b/src/main/java/yuelj/entity/ClientPlayer.java deleted file mode 100644 index 721f211..0000000 --- a/src/main/java/yuelj/entity/ClientPlayer.java +++ /dev/null @@ -1,61 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; - -import com.google.gson.annotations.Expose; -/** - * 玩家实体 - * @author Ming - * - */ -public class ClientPlayer extends BaseEntity implements Serializable { - - private static final long serialVersionUID = 1L; - /** - * 账号 - */ - @Expose - private String username; - /** - * 昵称 - */ - @Expose - private String nickname; - /** - * 邮箱 - */ - @Expose - private String email; - /** - * 手机 - */ - @Expose - private String phone; - - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - public String getNickname() { - return nickname; - } - public void setNickname(String nickname) { - this.nickname = nickname; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - -} diff --git a/src/main/java/yuelj/entity/GameLog.java b/src/main/java/yuelj/entity/GameLog.java deleted file mode 100644 index 6a57a51..0000000 --- a/src/main/java/yuelj/entity/GameLog.java +++ /dev/null @@ -1,242 +0,0 @@ -package yuelj.entity; - -/** - * 每盘结算时记录日志 - * - * @author Ming - * - */ -public class GameLog extends BaseEntity { - private static final long serialVersionUID = 1L; - /** - * id作为游戏编号,第多少局游戏 - */ - - /** - * 房间信息(普通场) - */ - private String roomType; - /** - * 房间信息(级别) - */ - private int roomLevel; - /** - * 庄家 - */ - private String dealer; - /** - * 小盲 - */ - private String smallBet; - /** - * 大盲 - */ - private String bigBet; - /** - * 第一圈(底牌圈),翻牌圈信息,转牌圈信息,河牌圈信息,比牌圈(脚牌,亮牌)信息 - * - *
-	 * 

- * 发牌给 playerNickName[6h Tc] - *

- * playerNickName 操作 操作筹码 remark - *

- * playerNickName 跟注 1067 全下 - *

- * playerNickName 跟注 1067 - */ - private String roundInfo; - - /** - * 游戏开始时间 - */ - private String startTime; - /** - * 游戏结算时间 - */ - private String endTime; - /** - * 底池 - */ - private long countBetpool; - /** - * 奖池信息 - * - *

-	 * 

- * playerNickName 从 主底池中赢得 11742 - *

- * playerNickName 从 额外底池中赢得 10667 - */ - private String betpoolInfo; - /** - * 抽成 - */ - private long cut; - - /** - * 公共牌[7s Jh 5d 8h ..] - */ - private String communityCards; - /** - * 房间中玩家的初始信息 - * - *

-	 * 

- * 第1号座位:playerNickName (9600筹码) - *

- * 第2号座位:playerNickName (8158筹码) - *

- * 第3号座位:playerNickName (18349筹码) - *

- * 第4号座位:playerNickName (22975筹码) - *

- * 第5号座位:playerNickName (15494筹码) - *

- * 第6号座位:playerNickName (4015筹码) - */ - private String playersInitInfo; - /** - * 房间中玩家的最终信息 - * - *

-	 * 

- * 第1号座位:playerNickName (remark) 亮出底牌:[Js Kc],胜出(胜出所得筹码) 其获胜牌组:一对J - *

- * 第2号座位:playerNickName (小盲) 盖牌 早于 翻盘 - *

- * 第3号座位:playerNickName (大盲) 盖牌 早于 翻盘 - *

- * 第4号座位:playerNickName (remark) 亮出底牌:[2d Kd],败北 其获胜牌组:散牌K - *

- * 第5号座位:playerNickName (remark) 盖牌 早于 翻盘 - *

- * 第6号座位:playerNickName (remark) 亮出底牌:[6h Tc],败北 其获胜牌组:一对10 - */ - private String playersFinalInfo; - /** - * 获胜玩家和对应所赢筹码信息 - */ - private String winnersInfo; - - public String getRoomType() { - return roomType; - } - - public void setRoomType(String roomType) { - this.roomType = roomType; - } - - public int getRoomLevel() { - return roomLevel; - } - - public void setRoomLevel(int roomLevel) { - this.roomLevel = roomLevel; - } - - public String getDealer() { - return dealer; - } - - public void setDealer(String dealer) { - this.dealer = dealer; - } - - public String getSmallBet() { - return smallBet; - } - - public void setSmallBet(String smallBet) { - this.smallBet = smallBet; - } - - public String getBigBet() { - return bigBet; - } - - public void setBigBet(String bigBet) { - this.bigBet = bigBet; - } - - public String getRoundInfo() { - return roundInfo; - } - - public void setRoundInfo(String roundInfo) { - this.roundInfo = roundInfo; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getEndTime() { - return endTime; - } - - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - public long getCountBetpool() { - return countBetpool; - } - - public void setCountBetpool(long countBetpool) { - this.countBetpool = countBetpool; - } - - public String getBetpoolInfo() { - return betpoolInfo; - } - - public void setBetpoolInfo(String betpoolInfo) { - this.betpoolInfo = betpoolInfo; - } - - public long getCut() { - return cut; - } - - public void setCut(long cut) { - this.cut = cut; - } - - public String getCommunityCards() { - return communityCards; - } - - public void setCommunityCards(String communityCards) { - this.communityCards = communityCards; - } - - public String getPlayersInitInfo() { - return playersInitInfo; - } - - public void setPlayersInitInfo(String playersInitInfo) { - this.playersInitInfo = playersInitInfo; - } - - public String getPlayersFinalInfo() { - return playersFinalInfo; - } - - public void setPlayersFinalInfo(String playersFinalInfo) { - this.playersFinalInfo = playersFinalInfo; - } - - public String getWinnersInfo() { - return winnersInfo; - } - - public void setWinnersInfo(String winnersInfo) { - this.winnersInfo = winnersInfo; - } - -} diff --git a/src/main/java/yuelj/entity/ListPo.java b/src/main/java/yuelj/entity/ListPo.java deleted file mode 100644 index 3243963..0000000 --- a/src/main/java/yuelj/entity/ListPo.java +++ /dev/null @@ -1,35 +0,0 @@ -package yuelj.entity; - -import java.util.List; - -public class ListPo { - - public List list; - public PageEntity page; - public String data; - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public PageEntity getPage() { - return page; - } - - public void setPage(PageEntity page) { - this.page = page; - } - -} diff --git a/src/main/java/yuelj/entity/MessageParmsEntity.java b/src/main/java/yuelj/entity/MessageParmsEntity.java deleted file mode 100644 index 507a953..0000000 --- a/src/main/java/yuelj/entity/MessageParmsEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package yuelj.entity; - -/* - * 短信模板填充参数 - */ -public class MessageParmsEntity { - private String parm1; - private String parm2; - private String parm3; - private String parm4; - private String parm5; - private String parm6; - private String parm7; - private String parm8; - private String parm9; - - public String getparm1() { - return parm1; - } - - public void setparm1(String parm1) { - this.parm1 = parm1; - } - - public String getparm2() { - return parm2; - } - - public void setparm2(String parm2) { - this.parm2 = parm2; - } - - public String getparm3() { - return parm3; - } - - public void setparm3(String parm3) { - this.parm3 = parm3; - } - - public String getparm4() { - return parm4; - } - - public void setparm4(String parm4) { - this.parm4 = parm4; - } - - public String getparm5() { - return parm5; - } - - public void setparm5(String parm5) { - this.parm5 = parm5; - } - - public String getparm6() { - return parm6; - } - - public void setparm6(String parm6) { - this.parm6 = parm6; - } - - public String getparm7() { - return parm7; - } - - public void setparm7(String parm7) { - this.parm7 = parm7; - } - - public String getparm8() { - return parm8; - } - - public void setparm8(String parm8) { - this.parm8 = parm8; - } - - public String getparm9() { - return parm9; - } - - public void setparm9(String parm9) { - this.parm9 = parm9; - } -} diff --git a/src/main/java/yuelj/entity/MessagePushEntity.java b/src/main/java/yuelj/entity/MessagePushEntity.java deleted file mode 100644 index da14a82..0000000 --- a/src/main/java/yuelj/entity/MessagePushEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package yuelj.entity; - -public class MessagePushEntity { - private String informtype; - private String informid; - private String title; - private String content; - - public String getInformtype() { - return informtype; - } - - public void setInformtype(String informtype) { - this.informtype = informtype; - } - - public String getInformid() { - return informid; - } - - public void setInformid(String informid) { - this.informid = informid; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } -} diff --git a/src/main/java/yuelj/entity/NextIdEntity.java b/src/main/java/yuelj/entity/NextIdEntity.java deleted file mode 100644 index 386d4f1..0000000 --- a/src/main/java/yuelj/entity/NextIdEntity.java +++ /dev/null @@ -1,15 +0,0 @@ -package yuelj.entity; - -public class NextIdEntity extends BaseEntity { - - private static final long serialVersionUID = -7534575229439466870L; - private String idnow; - - public String getIdnow() { - return idnow; - } - - public void setIdnow(String idnow) { - this.idnow = idnow; - } -} diff --git a/src/main/java/yuelj/entity/PageEntity.java b/src/main/java/yuelj/entity/PageEntity.java deleted file mode 100644 index 9cfdeec..0000000 --- a/src/main/java/yuelj/entity/PageEntity.java +++ /dev/null @@ -1,122 +0,0 @@ -package yuelj.entity; - -public class PageEntity { - /** - * 总条数 - */ - private String totalCount; - /** - * 当前页码 - */ - private String pageNum; - /** - * 每页条数 - */ - private int ipageSize; - - private String pageSize; - /** - * 总页数 - */ - private String pageCount; - /** - * 起始位置 - */ - private String from; - /** - * 排序 - */ - private String order; - - private int ifrom; - - public static PageEntity getDefaultPage() { - PageEntity page = new PageEntity(); - page.setPageNum("1"); - page.setPageSize("20"); - return page; - } - - public static PageEntity getDefaultPage(String size) { - PageEntity page = new PageEntity(); - page.setPageNum("1"); - page.setPageSize(size); - return page; - } - - public String getOrder() { - return order; - } - - public void setOrder(String order) { - this.order = order; - } - - public int getIpageSize() { - return ipageSize; - } - - public void setIpageSize(int ipageSize) { - this.ipageSize = ipageSize; - } - - public int getIfrom() { - return ifrom; - } - - public void setIfrom(int ifrom) { - this.ifrom = ifrom; - } - - public String getTotalCount() { - return totalCount; - } - - public void setTotalCount(String totalCount) { - this.totalCount = totalCount; - if (ipageSize != 0) { - pageCount = getTotalPage() + ""; - } - } - - public int getTotalPage() { - return Integer.parseInt(getTotalCount()) % Integer.parseInt(getPageSize()) > 0 - ? Integer.parseInt(getTotalCount()) / Integer.parseInt(getPageSize()) + 1 - : Integer.parseInt(getTotalCount()) / Integer.parseInt(getPageSize()); - } - - public String getPageNum() { - return pageNum; - } - - public void setPageNum(String pageNum) { - this.pageNum = pageNum; - } - - public String getPageSize() { - return pageSize; - } - - public void setPageSize(String pageSize) { - this.pageSize = pageSize; - this.ipageSize = Integer.parseInt(pageSize); - } - - public String getPageCount() { - return pageCount; - } - - public void setPageCount(String pageCount) { - this.pageCount = pageCount; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - this.ifrom = Integer.parseInt(from); - } - -} diff --git a/src/main/java/yuelj/entity/Player.java b/src/main/java/yuelj/entity/Player.java deleted file mode 100644 index aa54f21..0000000 --- a/src/main/java/yuelj/entity/Player.java +++ /dev/null @@ -1,204 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; - -import javax.websocket.Session; - -import com.google.gson.annotations.Expose; - -import yuelj.texas.Room; - -/** - * 玩家实体 - * - * @author Ming - * - */ -public class Player extends BetPlayer implements Serializable { - - private static final long serialVersionUID = 1L; - /** - * 账号 - */ - @Expose - private String username; - /** - * 昵称 - */ - @Expose - private String nickname; - /** - * 邮箱 - */ - @Expose - private String email; - /** - * 手机 - */ - @Expose - private String phone; - /** - * 用户密码 - */ - @Expose(serialize = false, deserialize = true) - private String userpwd; - /** - * 用户Session - */ - @Expose(serialize = false, deserialize = false) - private Session session; - /** - * 头像 - */ - @Expose - private int pic; - /** - * 筹码(用户所拥有的总筹码) - */ - @Expose - private long chips; - - /** - * 用户状态 - */ - @Expose(serialize = false, deserialize = false) - private int state; - /** - * 注册日期 - */ - @Expose(serialize = false, deserialize = false) - private String regdate; - - /** - * 用户所在房间 - */ - @Expose(serialize = false, deserialize = false) - private Room room; - /** - * 是否已经弃牌 - */ - @Expose - private boolean isFold = true; - /** - * 手牌 - */ - private int[] handPokers; - /** - * 是否已经看牌(拼三张) - */ - @Expose - private boolean isLook = false; - - public boolean isLook() { - return isLook; - } - - public void setLook(boolean isLook) { - this.isLook = isLook; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getNickname() { - return nickname; - } - - public void setNickname(String nickname) { - this.nickname = nickname; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getUserpwd() { - return userpwd; - } - - public void setUserpwd(String userpwd) { - this.userpwd = userpwd; - } - - public Session getSession() { - return session; - } - - public void setSession(Session session) { - this.session = session; - } - - public int getPic() { - return pic; - } - - public void setPic(int pic) { - this.pic = pic; - } - - public long getChips() { - return chips; - } - - public void setChips(long chips) { - this.chips = chips; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public String getRegdate() { - return regdate; - } - - public void setRegdate(String regdate) { - this.regdate = regdate; - } - - public Room getRoom() { - return room; - } - - public void setRoom(Room room) { - this.room = room; - } - - public int[] getHandPokers() { - return handPokers; - } - - public void setHandPokers(int[] handPokers) { - this.handPokers = handPokers; - } - - public boolean isFold() { - return isFold; - } - - public void setFold(boolean fold) { - this.isFold = fold; - } - -} diff --git a/src/main/java/yuelj/entity/PlayerOpt.java b/src/main/java/yuelj/entity/PlayerOpt.java deleted file mode 100644 index 08fe635..0000000 --- a/src/main/java/yuelj/entity/PlayerOpt.java +++ /dev/null @@ -1,104 +0,0 @@ -package yuelj.entity; - -import com.google.gson.annotations.Expose; - -/** - * 玩家操作 - * @author Ming - * - */ -public class PlayerOpt { - - /** - * 玩家ID - */ - @Expose - private String playerId; - /** - * 操作类型 - */ - @Expose - private String optType; - /** - * 操作筹码 - */ - @Expose - private int optChips; - /** - * 第几轮 - */ - @Expose - private int round; - /** - * 备注 - */ - @Expose - private String remark; - /** - * 操作时间 - */ - @Expose - private String optTime; - /** - * 玩家座位号 - */ - @Expose - private int seatNum; - - public String getPlayerId() { - return playerId; - } - - public void setPlayerId(String playerId) { - this.playerId = playerId; - } - - public String getOptType() { - return optType; - } - - public void setOptType(String optType) { - this.optType = optType; - } - - public int getOptChips() { - return optChips; - } - - public void setOptChips(int optChips) { - this.optChips = optChips; - } - - public int getRound() { - return round; - } - - public void setRound(int round) { - this.round = round; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public String getOptTime() { - return optTime; - } - - public void setOptTime(String optTime) { - this.optTime = optTime; - } - - public int getSeatNum() { - return seatNum; - } - - public void setSeatNum(int seatNum) { - this.seatNum = seatNum; - } - -} diff --git a/src/main/java/yuelj/entity/PlayerPrivate.java b/src/main/java/yuelj/entity/PlayerPrivate.java deleted file mode 100644 index 7b6fe05..0000000 --- a/src/main/java/yuelj/entity/PlayerPrivate.java +++ /dev/null @@ -1,21 +0,0 @@ -package yuelj.entity; - -import com.google.gson.annotations.Expose; - -public class PlayerPrivate extends Player { - private static final long serialVersionUID = -7275579813476459537L; - - /** - * 手牌 - */ - @Expose - private int[] handPokers; - - public int[] getHandPokers() { - return handPokers; - } - - public void setHandPokers(int[] handPokers) { - this.handPokers = handPokers; - } -} diff --git a/src/main/java/yuelj/entity/PrivateRoom.java b/src/main/java/yuelj/entity/PrivateRoom.java deleted file mode 100644 index 5396cdb..0000000 --- a/src/main/java/yuelj/entity/PrivateRoom.java +++ /dev/null @@ -1,181 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; - -import com.google.gson.annotations.Expose; - -import yuelj.texas.Room; - -/** - * 私有房间信息(包含自己的手牌) - * - * @author Ming - * - */ -public class PrivateRoom implements Serializable { - - private static final long serialVersionUID = 1L; - @Expose - private int[] handPokers; - /** - * 公共牌 - */ - @Expose - protected List communityCards = new ArrayList(); - /** - * 奖池,下注总额 - */ - @Expose - protected long betAmount; - /** - * 操作超时时间,单位毫秒(玩家在规定时间内没有完成操作,则系统自动帮其弃牌) - */ - @Expose - private int optTimeout = 10000; - /** - * 大盲下注筹码 - */ - @Expose - private int bigBet; - @Expose - private int roundMaxBet; - @Expose - private int nextturn; - @Expose - private int dealer; - - /** - * 每轮第一个行动的玩家 - */ - protected int roundturn = 0; - - /** - * 房间中处于等待状态的玩家列表 - */ - @Expose - private List waitPlayers = new CopyOnWriteArrayList(); - /** - * 房间中处于游戏状态的玩家列表 - */ - @Expose - protected List ingamePlayers = new CopyOnWriteArrayList(); - /** - * 在一回合中,每个玩家下的注[座位号,本轮下注额] - */ - @Expose - protected Map betRoundMap = new LinkedHashMap<>(); - - public void setRoom(Room room) { - setBetRoundMap(room.getBetMap()); - setBigBet(room.getBigBet()); - setIngamePlayers(room.getIngamePlayers()); - setWaitPlayers(room.getWaitPlayers()); - setNextturn(room.getNextturn()); - setCommunityCards(room.getCommunityCards()); - setBetAmount(room.getBetAmount()); - setOptTimeout(room.getOptTimeout()); - setRoundMaxBet(room.getRoundMaxBet()); - } - - - public int getRoundMaxBet() { - return roundMaxBet; - } - - public void setRoundMaxBet(int roundMaxBet) { - this.roundMaxBet = roundMaxBet; - } - public int getRoundturn() { - return roundturn; - } - - public void setRoundturn(int roundturn) { - this.roundturn = roundturn; - } - - public List getCommunityCards() { - return communityCards; - } - - public void setCommunityCards(List communityCards) { - this.communityCards = communityCards; - } - - public long getBetAmount() { - return betAmount; - } - - public void setBetAmount(long betAmount) { - this.betAmount = betAmount; - } - - public int getOptTimeout() { - return optTimeout; - } - - public void setOptTimeout(int optTimeout) { - this.optTimeout = optTimeout; - } - - public int getDealer() { - return dealer; - } - - public void setDealer(int dealer) { - this.dealer = dealer; - } - - public int getNextturn() { - return nextturn; - } - - public void setNextturn(int nextturn) { - this.nextturn = nextturn; - } - - public int getBigBet() { - return bigBet; - } - - public void setBigBet(int bigBet) { - this.bigBet = bigBet; - } - - public Map getBetRoundMap() { - return betRoundMap; - } - - public void setBetRoundMap(Map betRoundMap) { - this.betRoundMap = betRoundMap; - } - - public List getWaitPlayers() { - return waitPlayers; - } - - public void setWaitPlayers(List waitPlayers) { - this.waitPlayers = waitPlayers; - } - - public List getIngamePlayers() { - return ingamePlayers; - } - - public void setIngamePlayers(List ingamePlayers) { - this.ingamePlayers = ingamePlayers; - } - - public int[] getHandPokers() { - return handPokers; - } - - public void setHandPokers(int[] handPokers) { - this.handPokers = handPokers; - } - -} diff --git a/src/main/java/yuelj/entity/QQInfoEntity.java b/src/main/java/yuelj/entity/QQInfoEntity.java deleted file mode 100644 index 90f9c35..0000000 --- a/src/main/java/yuelj/entity/QQInfoEntity.java +++ /dev/null @@ -1,62 +0,0 @@ -package yuelj.entity; -/** - * qq第三方登录信息 - * @author lxr - * - */ -public class QQInfoEntity { - private String nickname; - private String gender; - private String figureurl_qq_2; - private String province; - private String city; - private String year; - - public String getNickname() { - return nickname; - } - - public void setNickname(String nickname) { - this.nickname = nickname; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public String getFigureurl_qq_2() { - return figureurl_qq_2; - } - - public void setFigureurl_qq_2(String figureurl_qq_2) { - this.figureurl_qq_2 = figureurl_qq_2; - } - - public String getProvince() { - return province; - } - - public void setProvince(String province) { - this.province = province; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getYear() { - return year; - } - - public void setYear(String year) { - this.year = year; - } -} diff --git a/src/main/java/yuelj/entity/Result.java b/src/main/java/yuelj/entity/Result.java deleted file mode 100644 index 3f895d3..0000000 --- a/src/main/java/yuelj/entity/Result.java +++ /dev/null @@ -1,69 +0,0 @@ -package yuelj.entity; - -public class Result extends BaseEntity { - /** - * - */ - private static final long serialVersionUID = 1L; - private int state;// 1:表示成功;0:表示失败 - private String message; - private String uri; - private Object data; - private String datastr; - - public String getDatastr() { - return datastr; - } - - public void setDatastr(String datastr) { - this.datastr = datastr; - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Result() { - } - - /** - * 结果对象 - * - * @param state - * 1 成功, 0 失败 - * @param message - * 提示信息 - */ - public Result(int state, String message) { - this.state = state; - this.message = message; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/yuelj/entity/RetMsg.java b/src/main/java/yuelj/entity/RetMsg.java deleted file mode 100644 index 48f96ad..0000000 --- a/src/main/java/yuelj/entity/RetMsg.java +++ /dev/null @@ -1,52 +0,0 @@ -package yuelj.entity; - -import java.io.Serializable; - -import com.google.gson.annotations.Expose; - -public class RetMsg implements Serializable{ - private static final long serialVersionUID = 1L; - /** - * 类型 - * onPlayerSit 玩家入局 - * onPlayerUp 玩家离开 - * onGameStart 游戏开始 - * onGameEnd 游戏结束 - * onPlayerMove 其他玩家操作 - * onMessage 其他玩家发消息 - * - */ - @Expose - private String c; - /** - * 状态 - * 0失败 - * 1成功 - */ - @Expose - private int state; - /** - * 消息 - */ - @Expose - private String message; - - public String getC() { - return c; - } - public void setC(String c) { - this.c = c; - } - public int getState() { - return state; - } - public void setState(int state) { - this.state = state; - } - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/yuelj/entity/SystemLogEntity.java b/src/main/java/yuelj/entity/SystemLogEntity.java deleted file mode 100644 index 2a5e99d..0000000 --- a/src/main/java/yuelj/entity/SystemLogEntity.java +++ /dev/null @@ -1,154 +0,0 @@ -package yuelj.entity; - -/** - * 操作日志 - * - * @author lixiaoran - * - */ -public class SystemLogEntity extends BaseEntity { - private static final long serialVersionUID = -7834723623609511634L; - /** - * 用户id - */ - private String userid; - /** - * 操作类型 - */ - private String type; - /** - * 操作 - */ - private String operation; - /** - * ip地址 - */ - private String ip; - /** - * 操作内容 - */ - private String content; - /** - * 操作时间 - */ - private String datetime; - - /** - * 操作时间开始 - */ - private String datetimeStart; - - /** - * 操作时间结束 - */ - private String datetimeEnd; - /** - * 机器码 - */ - private String machine; - /** - * 设备类型ios1,安卓2 - */ - private String clienttype; - private String token; - /** - * app版本 - */ - private String appversion; - - public String getMachine() { - return machine; - } - - public void setMachine(String machine) { - this.machine = machine; - } - - public String getClienttype() { - return clienttype; - } - - public void setClienttype(String clienttype) { - this.clienttype = clienttype; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getAppversion() { - return appversion; - } - - public void setAppversion(String appversion) { - this.appversion = appversion; - } - - public String getDatetimeStart() { - return datetimeStart; - } - - public void setDatetimeStart(String datetimeStart) { - this.datetimeStart = datetimeStart; - } - - public String getDatetimeEnd() { - return datetimeEnd; - } - - public void setDatetimeEnd(String datetimeEnd) { - this.datetimeEnd = datetimeEnd; - } - - public String getUserid() { - return userid; - } - - public void setUserid(String userid) { - this.userid = userid; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getDatetime() { - return datetime; - } - - public void setDatetime(String datetime) { - this.datetime = datetime; - } -} diff --git a/src/main/java/yuelj/entity/UcenterMembersEntity.java b/src/main/java/yuelj/entity/UcenterMembersEntity.java deleted file mode 100644 index ac0322d..0000000 --- a/src/main/java/yuelj/entity/UcenterMembersEntity.java +++ /dev/null @@ -1,130 +0,0 @@ -package yuelj.entity; - -import com.google.gson.annotations.Expose; - -public class UcenterMembersEntity { - /** - * 账号 - */ - @Expose - private String username; - @Expose - private String uid; - @Expose - private String password; - @Expose - private String salt; - @Expose - private String email; - @Expose - private String myidkey; - @Expose - private String regdate; - @Expose - private String regip; - @Expose - private String lastloginip; - @Expose - private String lastlogintime; - @Expose - private String secques; - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getMyidkey() { - return myidkey; - } - - public void setMyidkey(String myidkey) { - this.myidkey = myidkey; - } - - public String getRegdate() { - return regdate; - } - - public void setRegdate(String regdate) { - this.regdate = regdate; - } - - public String getRegip() { - return regip; - } - - public void setRegip(String regip) { - this.regip = regip; - } - - public String getLastloginip() { - return lastloginip; - } - - public void setLastloginip(String lastloginip) { - this.lastloginip = lastloginip; - } - - public String getLastlogintime() { - return lastlogintime; - } - - public void setLastlogintime(String lastlogintime) { - this.lastlogintime = lastlogintime; - } - - public String getSecques() { - return secques; - } - - public void setSecques(String secques) { - this.secques = secques; - } - - public String getSalt() { - return salt; - } - - public void setSalt(String salt) { - this.salt = salt; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getMyid() { - return myid; - } - - public void setMyid(String myid) { - this.myid = myid; - } - - @Expose - private String myid; -} diff --git a/src/main/java/yuelj/entity/UserEntity.java b/src/main/java/yuelj/entity/UserEntity.java deleted file mode 100644 index 38012a0..0000000 --- a/src/main/java/yuelj/entity/UserEntity.java +++ /dev/null @@ -1,344 +0,0 @@ -package yuelj.entity; - -/** - * 用户 - * - * @author lixiaoran - * - */ -public class UserEntity extends BaseEntity { - - private static final long serialVersionUID = 8711509967340105161L; - /** - * 第三方openid - */ - private String oauthid; - /** - * 用户昵称 - */ - private String name; - /** - * 密码 - */ - private String password; - /** - * 电话号码 - */ - private String phone; - /** - * 邮箱 - */ - private String email; - - /** - * 头像 - */ - private String pic; - /** - * 图片url - */ - private String picurl; - /** - * 1普通,2草根高手,3后台管理员 - */ - private String usertype; - /** - * 登录类型,1phone,2qq,3weixin,4sina等 - */ - private String logintype; - - /** - * 用户状态 0审核中,1正常,2冻结 - */ - private String status; - /** - * 用于app登录验证的token - */ - private String token; - /** - * 短信验证码 - */ - private String validateCode; - /** - * 是否在本平台开户 - */ - private String isopenhere; - /** - * vip等级 - */ - private String viplevel; - /** - * 积分 - */ - private String score; - - /** - * 描述 - */ - private String description; - /** - * 注册时间 - */ - private String regdate; - /** - * 用于第三方登录 - */ - private String accesstoken; - /** - * 证件类型 1身份证,2军官证 - */ - private String cardtype; - /** - * 证件号 - */ - private String cardid; - /** - * 真实姓名 - */ - private String realname; - /** - * 微博被点赞数量,缓存存放 - */ - private String likecount; - /** - * 评论数,缓存存放 - */ - private String commentcount; - /** - * 发帖数,缓存存放 - */ - private String microblogcount; - - /** - * 被关注数,缓存存放 - */ - private String followcount; - /** - * 已关注 - */ - private String isfollow; - /** - * 已拉黑 - */ - private String isblack; - - public String getIsfollow() { - return isfollow; - } - - public void setIsfollow(String isfollow) { - this.isfollow = isfollow; - } - - public String getIsblack() { - return isblack; - } - - public void setIsblack(String isblack) { - this.isblack = isblack; - } - - public String getMicroblogcount() { - return microblogcount; - } - - public void setMicroblogcount(String microblogcount) { - this.microblogcount = microblogcount; - } - - public String getFollowcount() { - return followcount; - } - - public void setFollowcount(String followcount) { - this.followcount = followcount; - } - - public String getCommentcount() { - return commentcount; - } - - public void setCommentcount(String commentcount) { - this.commentcount = commentcount; - } - - public String getCardtype() { - return cardtype; - } - - public void setCardtype(String cardtype) { - this.cardtype = cardtype; - } - - public String getCardid() { - return cardid; - } - - public void setCardid(String cardid) { - this.cardid = cardid; - } - - public String getRealname() { - return realname; - } - - public void setRealname(String realname) { - this.realname = realname; - } - - public String getLikecount() { - return likecount; - } - - public void setLikecount(String likecount) { - this.likecount = likecount; - } - - public String getAccesstoken() { - return accesstoken; - } - - public void setAccesstoken(String accesstoken) { - this.accesstoken = accesstoken; - } - - public String getLogintype() { - return logintype; - } - - public void setLogintype(String logintype) { - this.logintype = logintype; - } - - public String getRegdate() { - return regdate; - } - - public void setRegdate(String regdate) { - this.regdate = regdate; - } - - public String getIsopenhere() { - return isopenhere; - } - - public void setIsopenhere(String isopenhere) { - this.isopenhere = isopenhere; - } - - public String getViplevel() { - return viplevel; - } - - public void setViplevel(String viplevel) { - this.viplevel = viplevel; - } - - public String getScore() { - return score; - } - - public void setScore(String score) { - this.score = score; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOauthid() { - return oauthid; - } - - public void setOauthid(String oauthid) { - this.oauthid = oauthid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPic() { - return pic; - } - - public void setPic(String pic) { - this.pic = pic; - } - - public String getPicurl() { - return picurl; - } - - public void setPicurl(String picurl) { - this.picurl = picurl; - } - - public String getUsertype() { - return usertype; - } - - public void setUsertype(String usertype) { - this.usertype = usertype; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getValidateCode() { - return validateCode; - } - - public void setValidateCode(String validateCode) { - this.validateCode = validateCode; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } -} diff --git a/src/main/java/yuelj/entity/UserMachineEntity.java b/src/main/java/yuelj/entity/UserMachineEntity.java deleted file mode 100644 index dd57600..0000000 --- a/src/main/java/yuelj/entity/UserMachineEntity.java +++ /dev/null @@ -1,113 +0,0 @@ -package yuelj.entity; - -public class UserMachineEntity extends BaseEntity { - private static final long serialVersionUID = 4713222624507729776L; - /** - * 用户id - */ - private String uid; - /** - * 用户设备号 - */ - private String machine; - /** - * 用户系统版本 - */ - private String systemversion; - /** - * 用户设备 - */ - private String deviceversion; - /** - * ios或android - */ - private String devicetype; - /** - * 个推id - */ - private String getuiid; - /** - * 小米id - */ - private String xiaomiid; - /** - * 其他id1 - */ - private String otherid1; - /** - * 其他id2 - */ - private String otherid2; - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getMachine() { - return machine; - } - - public void setMachine(String machine) { - this.machine = machine; - } - - public String getSystemversion() { - return systemversion; - } - - public void setSystemversion(String systemversion) { - this.systemversion = systemversion; - } - - public String getDeviceversion() { - return deviceversion; - } - - public void setDeviceversion(String deviceversion) { - this.deviceversion = deviceversion; - } - - public String getDevicetype() { - return devicetype; - } - - public void setDevicetype(String devicetype) { - this.devicetype = devicetype; - } - - public String getGetuiid() { - return getuiid; - } - - public void setGetuiid(String getuiid) { - this.getuiid = getuiid; - } - - public String getXiaomiid() { - return xiaomiid; - } - - public void setXiaomiid(String xiaomiid) { - this.xiaomiid = xiaomiid; - } - - public String getOtherid1() { - return otherid1; - } - - public void setOtherid1(String otherid1) { - this.otherid1 = otherid1; - } - - public String getOtherid2() { - return otherid2; - } - - public void setOtherid2(String otherid2) { - this.otherid2 = otherid2; - } -} diff --git a/src/main/java/yuelj/entity/UserTokenEntity.java b/src/main/java/yuelj/entity/UserTokenEntity.java deleted file mode 100644 index 2477572..0000000 --- a/src/main/java/yuelj/entity/UserTokenEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package yuelj.entity; - -public class UserTokenEntity { - private String id; - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - private String token; - private String name; - private String pic; - - public String getPic() { - return pic; - } - - public void setPic(String pic) { - this.pic = pic; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } -} diff --git a/src/main/java/yuelj/service/GameLogService.java b/src/main/java/yuelj/service/GameLogService.java deleted file mode 100644 index 213c00a..0000000 --- a/src/main/java/yuelj/service/GameLogService.java +++ /dev/null @@ -1,13 +0,0 @@ -package yuelj.service; - -import java.util.List; - -import yuelj.entity.GameLog; - -public interface GameLogService { - - List selectGameLog(GameLog entity); - - void insertGameLog(GameLog entity); - -} diff --git a/src/main/java/yuelj/service/LobbyService.java b/src/main/java/yuelj/service/LobbyService.java deleted file mode 100644 index 81a14f4..0000000 --- a/src/main/java/yuelj/service/LobbyService.java +++ /dev/null @@ -1,7 +0,0 @@ -package yuelj.service; - -import javax.websocket.Session; - -public interface LobbyService { - public void getRankList(Session session, String message); -} diff --git a/src/main/java/yuelj/service/PlayerService.java b/src/main/java/yuelj/service/PlayerService.java deleted file mode 100644 index f80b5a4..0000000 --- a/src/main/java/yuelj/service/PlayerService.java +++ /dev/null @@ -1,73 +0,0 @@ -package yuelj.service; - -import java.util.List; - -import javax.websocket.Session; - -import yuelj.entity.PageEntity; -import yuelj.entity.Player; -/** - * 玩家业务逻辑 - * @author Ming - * - */ -public interface PlayerService { - public List selectPlayers(Player player); - - public List selectLoginPlayer(Player player); - - public String selectPlayersCount(Player player); - - public void insertPlayer(Player player); - - public void updatePlayer(Player player); - - public Player selectPlayer(Player player); - - public List selectPlayersPage(Player player, PageEntity page); - /** - * 玩家登录 - * @param session - * @param message - * @return - */ - public void login(Session session,String message); - /** - * 玩家注册 - * @param session - * @param message - * @return - */ - public void register(Session session,String message); - /** - * 下注 - * @param session - * @param message - */ - public void betChips(Session session,String message); - /** - * 弃牌(玩家主动弃牌) - * @param session - * @param message - */ - public void fold(Session session,String message); - /** - * 过牌 - * @param session - * @param message - */ - public void check(Session session,String message); - /** - * 站起 - * @param session - * @param message - */ - public void standUp(Session session,String message); - /** - * 坐下 - * @param session - * @param message - */ - public void sitDown(Session session,String message); - -} diff --git a/src/main/java/yuelj/service/RoomService.java b/src/main/java/yuelj/service/RoomService.java deleted file mode 100644 index 1c3114f..0000000 --- a/src/main/java/yuelj/service/RoomService.java +++ /dev/null @@ -1,18 +0,0 @@ -package yuelj.service; - -import javax.websocket.Session; - -public interface RoomService { - - public void inRoom(Session session, String message); - - public void outRoom(Session session, String message, boolean sendOrNot); - - public void outRoom(Session session, String message); - - public void lookCards(Session session, String message); - - public void compareCards(Session session, String message); - - public void sendMessage(Session session, String message); -} diff --git a/src/main/java/yuelj/service/SystemLogService.java b/src/main/java/yuelj/service/SystemLogService.java deleted file mode 100644 index 8ffed02..0000000 --- a/src/main/java/yuelj/service/SystemLogService.java +++ /dev/null @@ -1,13 +0,0 @@ -package yuelj.service; - -import java.util.List; - -import yuelj.entity.SystemLogEntity; - -public interface SystemLogService { - - List selectSystemLog(SystemLogEntity entity); - - void insertSystemLog(SystemLogEntity entity); - -} diff --git a/src/main/java/yuelj/service/UserMachineService.java b/src/main/java/yuelj/service/UserMachineService.java deleted file mode 100644 index 653819a..0000000 --- a/src/main/java/yuelj/service/UserMachineService.java +++ /dev/null @@ -1,15 +0,0 @@ -package yuelj.service; - -import java.util.List; - -import yuelj.entity.UserMachineEntity; - -public interface UserMachineService { - - void addUserMachine(UserMachineEntity info); - - void updateUserMachine(UserMachineEntity info); - - List queryUserMachine(UserMachineEntity info); - -} diff --git a/src/main/java/yuelj/service/UserService.java b/src/main/java/yuelj/service/UserService.java deleted file mode 100644 index 7b8a344..0000000 --- a/src/main/java/yuelj/service/UserService.java +++ /dev/null @@ -1,54 +0,0 @@ -package yuelj.service; - -import java.util.List; - -import yuelj.entity.PageEntity; -import yuelj.entity.UserEntity; - -public interface UserService { - public List selectUsers(UserEntity user); - - public UserEntity selectLoginUser(UserEntity user); - - public String selectUsersCount(UserEntity user); - - public void insertUser(UserEntity user); - - public void updateUser(UserEntity user); - - public void updateUserState(UserEntity user); - - public UserEntity selectUser(UserEntity user); - - public List selectUsersPage(UserEntity user, PageEntity page); - - /** - * 检查账号和手机号是否重复 - * - * @param user - */ - UserEntity checkAccountAndMobile(UserEntity user); - - /** - * 更新密码 - * - * @param user - */ - void updateUserPassword(UserEntity user); - - /** - * 冻结用户 - * - * @param user - */ - void freezeUser(UserEntity user); - - /** - * 增加用户被赞数 - * - * @param user - * @param plus - */ - void plusUserFollow(UserEntity user, int plus); - -} diff --git a/src/main/java/yuelj/service/impl/GameLogServiceImpl.java b/src/main/java/yuelj/service/impl/GameLogServiceImpl.java deleted file mode 100644 index 1be9db4..0000000 --- a/src/main/java/yuelj/service/impl/GameLogServiceImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package yuelj.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.dao.GameLogDao; -import yuelj.entity.GameLog; -import yuelj.service.GameLogService; - -@Service("gameLogService") -public class GameLogServiceImpl implements GameLogService { - @Autowired - private GameLogDao dao; - - public List selectGameLog(GameLog entity) { - List list = this.dao.selectGameLog(entity); - return list; - } - - public void insertGameLog(GameLog entity) { - this.dao.insertGameLog(entity); - } -} diff --git a/src/main/java/yuelj/service/impl/LobbyServiceImpl.java b/src/main/java/yuelj/service/impl/LobbyServiceImpl.java deleted file mode 100644 index 4a76bbd..0000000 --- a/src/main/java/yuelj/service/impl/LobbyServiceImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -package yuelj.service.impl; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import javax.websocket.Session; - -import org.springframework.stereotype.Service; - -import yuelj.entity.Player; -import yuelj.entity.RetMsg; -import yuelj.service.LobbyService; -import yuelj.texas.TexasUtil; -import yuelj.utils.serialize.JsonUtils; - -@Service("lobbyService") -public class LobbyServiceImpl implements LobbyService { - /** - * 玩家根据筹码数量的排行榜 - */ - public static List rankList = new CopyOnWriteArrayList(); - /** - * 排行榜中最后一名的筹码数 - */ - public static Long minChips = 0l; - /** - * 排行榜的大小 - */ - public static int rankSize = 50;; - - @Override - public void getRankList(Session session, String message) { - int size = 10; - int realSize = rankList.size(); - if (realSize < size) { - size = realSize; - } - String msg = JsonUtils.toJson(rankList.subList(0, size), rankList.getClass()); - RetMsg rm = new RetMsg(); - rm.setC("onGetRankList"); - rm.setState(1); - rm.setMessage(msg); - String retMsg = JsonUtils.toJson(rm, RetMsg.class); - TexasUtil.sendMsgToOne(session, retMsg); - } - - /** - * 更新排行榜 - * - * @param p - */ - public static void updateRankList(Player p) { - // 机器人不加入排行榜 - if (p.getUsername().contains("robot")) { - return; - } - long chips = p.getChips() + p.getBodyChips(); - // 新增排行榜玩家信息 - Player rankPlayer = new Player(); - rankPlayer.setId(p.getId()); - rankPlayer.setChips(chips); - rankPlayer.setUsername(p.getUsername()); - if (chips < minChips && rankList.size() >= rankSize) { - return; - } - synchronized (rankList) { - boolean hasInRank = false; - for (Player player : rankList) { - if (player.getId().equals(rankPlayer.getId())) { - player.setChips(chips); - hasInRank = true; - } - } - if (!hasInRank) { - rankList.add(rankPlayer); - } - Collections.sort(rankList, new Comparator() { - public int compare(Player entry1, Player entry2) { - Long value1 = 0l, value2 = 0l; - value1 = entry1.getChips(); - value2 = entry2.getChips(); - return value2.compareTo(value1); - } - }); - if (rankList.size() > rankSize) { - rankList = rankList.subList(0, rankSize); - } - minChips = rankList.get(rankList.size() - 1).getChips(); - } - } - -} diff --git a/src/main/java/yuelj/service/impl/PlayerServiceImpl.java b/src/main/java/yuelj/service/impl/PlayerServiceImpl.java deleted file mode 100644 index 58c7181..0000000 --- a/src/main/java/yuelj/service/impl/PlayerServiceImpl.java +++ /dev/null @@ -1,173 +0,0 @@ -package yuelj.service.impl; - -import java.util.List; - -import javax.websocket.Session; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.dao.PlayerDao; -import yuelj.entity.BetPlayer; -import yuelj.entity.PageEntity; -import yuelj.entity.Player; -import yuelj.entity.RetMsg; -import yuelj.service.PlayerService; -import yuelj.texas.TexasStatic; -import yuelj.texas.TexasUtil; -import yuelj.utils.SpringUtil; -import yuelj.utils.md5encrypt.Md5; -import yuelj.utils.serialize.JsonUtils; - -@Service("playerService") -public class PlayerServiceImpl implements PlayerService { - @Autowired - private PlayerDao playerDao; - - @Override - public List selectPlayers(Player player) { - return playerDao.selectPlayers(player); - } - - @Override - public List selectLoginPlayer(Player player) { - return playerDao.selectLoginPlayer(player); - } - - @Override - public String selectPlayersCount(Player player) { - return playerDao.selectPlayersCount(player); - } - - @Override - public void insertPlayer(Player player) { - playerDao.insertPlayer(player); - } - - @Override - public void updatePlayer(Player player) { - playerDao.updatePlayer(player); - } - - @Override - public Player selectPlayer(Player player) { - List list = playerDao.selectPlayers(player); - if (list.size() == 0) { - return null; - } - return list.get(0); - } - - @Override - public List selectPlayersPage(Player player, PageEntity page) { - return playerDao.selectPlayersPage(player, page); - } - - @Override - public void login(Session session, String message) { - Player player = new Player(); - player = JsonUtils.fromJson(message, Player.class); - player.setUserpwd(Md5.GetMD5Code(player.getUserpwd())); - - PlayerService playerService = (PlayerService) SpringUtil.getBean("playerService"); - Player currPlayer = playerService.selectPlayer(player); - RetMsg rm = new RetMsg(); - rm.setC("onLogin"); - if (currPlayer == null) { - rm.setState(0); - rm.setMessage("登录失败"); - } else { - rm.setState(1); - rm.setMessage(JsonUtils.toJson(currPlayer, Player.class)); - // 保存玩家sessionId,以便给玩家发送消息 - currPlayer.setSession(session); - TexasStatic.loginPlayerMap.put(session.getId(), currPlayer); - // - String oldsessionId = TexasStatic.playerSessionMap.get(currPlayer.getId()); - if (oldsessionId != null) { - Player oldPlayer = TexasStatic.loginPlayerMap.get(oldsessionId); - TexasUtil.outRoom(oldPlayer); - TexasStatic.loginPlayerMap.remove(oldsessionId); - try { - if (oldPlayer != null && oldPlayer.getSession() != null) { - oldPlayer.getSession().close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - TexasStatic.playerSessionMap.put(currPlayer.getId(), session.getId()); - - } - String retMsg = JsonUtils.toJson(rm, RetMsg.class); - TexasUtil.sendMsgToOne(session, retMsg); - } - - @Override - public void register(Session session, String message) { - PlayerService playerService = (PlayerService) SpringUtil.getBean("playerService"); - RetMsg rm = new RetMsg(); - rm.setC("onRegister"); - Player player = new Player(); - player = JsonUtils.fromJson(message, Player.class); - player.setUserpwd(Md5.GetMD5Code(player.getUserpwd())); - Player playerTemp = new Player(); - playerTemp.setUsername(player.getUsername()); - if (playerService.selectPlayer(playerTemp) == null) { - playerService.insertPlayer(player); - rm.setState(1); - rm.setMessage("注册成功"); - } else { - rm.setState(0); - rm.setMessage("用户已存在"); - } - player.setSession(session); - String retMsg = JsonUtils.toJson(rm, RetMsg.class); - TexasUtil.sendMsgToOne(player, retMsg); - } - - @Override - public void betChips(Session session, String message) { - - BetPlayer bp = JsonUtils.fromJson(message, BetPlayer.class); - Player p = TexasUtil.getPlayerBySessionId(session.getId()); - // 玩家本次操作所下的筹码 - int chip = bp.getInChips(); - - if (p != null && p.getRoom() != null) { - p.getRoom().betchipIn(p, chip, true); - } - } - - @Override - public void fold(Session session, String message) { - // 弃牌 Fold,放弃本局游戏,并放弃所有已下的筹码。 - Player p = TexasUtil.getPlayerBySessionId(session.getId()); - if (p != null && p.getRoom() != null) { - p.getRoom().fold(p); - } - } - - @Override - public void check(Session session, String message) { - // 过牌 - // Check,不做任何操作过牌到下一个人,并保留下注的权利。过牌必须是在无需跟注的情况下使用,比如前面所有玩家都过牌或弃牌的情况。若前面的玩家一旦有人有下则不允许使用过牌。 - Player p = TexasUtil.getPlayerBySessionId(session.getId()); - if (p != null && p.getRoom() != null) { - p.getRoom().check(p, true); - } - } - - @Override - public void standUp(Session session, String message) { - // 站起 - - } - - @Override - public void sitDown(Session session, String message) { - // 坐下 - - } - -} diff --git a/src/main/java/yuelj/service/impl/RoomServiceImpl.java b/src/main/java/yuelj/service/impl/RoomServiceImpl.java deleted file mode 100644 index ecc7408..0000000 --- a/src/main/java/yuelj/service/impl/RoomServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package yuelj.service.impl; - -import javax.websocket.Session; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.service.RoomService; -import yuelj.texas.TexasUtil; -import yuelj.texas.threeCard.ThreeCardsUtil; - -@Service("roomService") -public class RoomServiceImpl implements RoomService { - - @Override - public void inRoom(Session session, String message) { - TexasUtil.inRoom(session, message); - } - - - @Override - public void outRoom(Session session, String message, boolean sendOrNot) { - TexasUtil.outRoom(session, message, sendOrNot); - } - @Override - public void outRoom(Session session, String message) { - TexasUtil.outRoom(session, message, true); - } - - public int getRoomLevel(String message) { - return TexasUtil.getRoomMessage(message).getLevel(); - } - - @Override - public void lookCards(Session session, String message) { - ThreeCardsUtil.lookCards(session, message); - } - - @Override - public void compareCards(Session session, String message) { - ThreeCardsUtil.compareCards(session, message); - } - - - @Override - public void sendMessage(Session session, String message) { - TexasUtil.sendMessage(session, message); - } - -} diff --git a/src/main/java/yuelj/service/impl/SystemLogServiceImpl.java b/src/main/java/yuelj/service/impl/SystemLogServiceImpl.java deleted file mode 100644 index c1d655f..0000000 --- a/src/main/java/yuelj/service/impl/SystemLogServiceImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package yuelj.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.dao.SystemLogDao; -import yuelj.entity.SystemLogEntity; -import yuelj.service.SystemLogService; - -@Service("SystemLogServiceImpl") -public class SystemLogServiceImpl implements SystemLogService { - @Autowired - private SystemLogDao dao; - - public List selectSystemLog(SystemLogEntity entity) { - List list = this.dao.selectSystemLog(entity); - return list; - } - - public void insertSystemLog(SystemLogEntity entity) { - this.dao.insertSystemLog(entity); - } -} diff --git a/src/main/java/yuelj/service/impl/UserMachineServiceImpl.java b/src/main/java/yuelj/service/impl/UserMachineServiceImpl.java deleted file mode 100644 index e667e0f..0000000 --- a/src/main/java/yuelj/service/impl/UserMachineServiceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package yuelj.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.dao.UserMachineDao; -import yuelj.entity.UserMachineEntity; -import yuelj.service.UserMachineService; - -@Service("UserMachineService") -public class UserMachineServiceImpl implements UserMachineService { - @Autowired - private UserMachineDao userMachineDao; - - @Override - public void addUserMachine(UserMachineEntity info) { - userMachineDao.addUserMachine(info); - } - - @Override - public void updateUserMachine(UserMachineEntity info) { - userMachineDao.updateUserMachine(info); - } - - @Override - public List queryUserMachine(UserMachineEntity info) { - List cList = userMachineDao.getUserMachine(info); - return cList; - } -} diff --git a/src/main/java/yuelj/service/impl/UserServiceImpl.java b/src/main/java/yuelj/service/impl/UserServiceImpl.java deleted file mode 100644 index 9b05bf3..0000000 --- a/src/main/java/yuelj/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -package yuelj.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import yuelj.dao.UserDao; -import yuelj.entity.PageEntity; -import yuelj.entity.UserEntity; -import yuelj.service.UserService; -import yuelj.utils.SensitiveWord.TabooedUtils; - -@Service -public class UserServiceImpl implements UserService { - @Autowired - private UserDao userDao; - - public List selectUsers(UserEntity user) { - List list = this.userDao.selectUsers(user); - clearPassword(list); - return list; - - } - - public UserEntity selectLoginUser(UserEntity user) { - List list = this.userDao.selectLoginUser(user); - if (list != null && list.size() == 1) { - return list.get(0); - } else { - return null; - } - } - - public String selectUsersCount(UserEntity user) { - String list = this.userDao.selectUsersCount(user); - return list; - } - - public UserEntity selectUser(UserEntity user) { - List list = this.userDao.selectUsers(user); - if (list != null && list.size() == 1) { - return list.get(0); - } else { - return null; - } - } - - public void updateUser(UserEntity user) { - - if (user.getName() != null && user.getName().length() != 0) { - // 敏感词过滤 - String name = TabooedUtils.getTabooedWords(user.getName(), "**"); - user.setName(name); - } - this.userDao.updateUser(user); - } - - public void updateUserState(UserEntity user) { - this.userDao.updateUserState(user); - } - - public void insertUser(UserEntity user) { - if (user.getName() != null && user.getName().length() != 0) { - // 敏感词过滤 - String name = TabooedUtils.getTabooedWords(user.getName(), "**"); - user.setName(name); - } - this.userDao.insertUser(user); - } - - @Override - public List selectUsersPage(UserEntity user, PageEntity page) { - List list = this.userDao.selectUsersPage(user, page); - clearPassword(list); - return list; - } - - private void clearPassword(List list) { - for (UserEntity u : list) { - u.setPassword(null); - } - } - - @Override - public void plusUserFollow(UserEntity user, int plus) { - List list = this.userDao.selectUsers(user); - if (list != null && list.size() != 0) { - int count = 0; - if (list.get(0).getLikecount() == null - || list.get(0).getLikecount().length() == 0) { - - } else { - count = Integer.parseInt(list.get(0).getLikecount()) + plus; - } - if (count >= 0) { - list.get(0).setLikecount(count + ""); - } - } - - } - - @Override - public UserEntity checkAccountAndMobile(UserEntity user) { - return userDao.checkAccountOrMobile(user); - } - - @Override - public void updateUserPassword(UserEntity user) { - userDao.updateUserPassword(user); - } - - @Override - public void freezeUser(UserEntity user) { - if (user.getId() != null && user.getId().length() != 0) { - user.setStatus("2"); - userDao.updateUserState(user); - - } - } - -} diff --git a/src/main/java/yuelj/texas/BeanUtil.java b/src/main/java/yuelj/texas/BeanUtil.java deleted file mode 100644 index 5248e77..0000000 --- a/src/main/java/yuelj/texas/BeanUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -package yuelj.texas; - -import java.lang.reflect.Method; - -import javax.websocket.Session; - -public class BeanUtil { - - /** - * 执行某对象方法 - * - * @param owner 对象 - * @param methodName 方法名 - * @param args 参数 - * @return 方法返回值 - * @throws Exception - */ - public static Object invokeMethod(Object owner, String methodName, Session session, String message) - throws Exception { - Class ownerClass = owner.getClass(); - Class[] argsClass = new Class[2]; - argsClass[0] = Session.class; - argsClass[1] = String.class; - Method method = ownerClass.getMethod(methodName, argsClass); - return method.invoke(owner, new Object[] { session, message }); - } - - /** - * 执行某类的静态方法 - * - * @param className 类名 - * @param methodName 方法名 - * @param args 参数数组 - * @return 执行方法返回的结果 - * @throws Exception - */ - @SuppressWarnings("rawtypes") - public static Object invokeStaticMethod(String className, String methodName, Object[] args) throws Exception { - Class ownerClass = Class.forName(className); - - Class[] argsClass = new Class[args.length]; - - for (int i = 0, j = args.length; i < j; i++) { - argsClass[i] = args[i].getClass(); - } - - Method method = ownerClass.getMethod(methodName, argsClass); - - return method.invoke(null, args); - } -} diff --git a/src/main/java/yuelj/texas/BetPool.java b/src/main/java/yuelj/texas/BetPool.java deleted file mode 100644 index 6c83c30..0000000 --- a/src/main/java/yuelj/texas/BetPool.java +++ /dev/null @@ -1,43 +0,0 @@ -package yuelj.texas; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.Expose; - -import yuelj.entity.Player; - -/** - * 奖池计算 - * - * @author lixiaoran - * - */ -public class BetPool { - /** - * 该分池总金额 - */ - @Expose - private long betSum; - /** - * 该分池的玩家列表 - */ - @Expose - private List betPlayerList = new ArrayList<>(); - - public long getBetSum() { - return betSum; - } - - public void setBetSum(long betSum) { - this.betSum = betSum; - } - - public List getBetPlayerList() { - return betPlayerList; - } - - public void setBetPlayerList(List betPlayerList) { - this.betPlayerList = betPlayerList; - } -} diff --git a/src/main/java/yuelj/texas/CtrlList.java b/src/main/java/yuelj/texas/CtrlList.java deleted file mode 100644 index 52976bf..0000000 --- a/src/main/java/yuelj/texas/CtrlList.java +++ /dev/null @@ -1,32 +0,0 @@ -package yuelj.texas; - -import java.util.ArrayList; -import java.util.List; - -/** - * 接口对应关系类 - * - * @author ausu - * - */ -public class CtrlList { - public static List clist; - - static { - clist = new ArrayList(); - clist.add(new String[] { "playerService", "register" });// 0注册 - clist.add(new String[] { "playerService", "login" });// 1登录 - clist.add(new String[] { "roomService", "inRoom" });// 2进入房间 - clist.add(new String[] { "roomService", "outRoom" });// 3退出房间 - clist.add(new String[] { "playerService", "sitDown" });// 4坐下 - clist.add(new String[] { "playerService", "standUp" });// 5站起 - clist.add(new String[] { "playerService", "check" });// 6过牌 - clist.add(new String[] { "playerService", "betChips" });// 7下注 - clist.add(new String[] { "playerService", "fold" });// 8弃牌 - clist.add(new String[] { "lobbyService", "getRankList" });// 9获取排行榜 - clist.add(new String[] { "roomService", "lookCards" });// 10查看自己的手牌(拼三张) - clist.add(new String[] { "roomService", "compareCards" });// 11和下家比牌(拼三张) - clist.add(new String[] { "roomService", "sendMessage" });// 12发送表情或消息 - } - -} diff --git a/src/main/java/yuelj/texas/Room.java b/src/main/java/yuelj/texas/Room.java deleted file mode 100644 index e3dc9b3..0000000 --- a/src/main/java/yuelj/texas/Room.java +++ /dev/null @@ -1,1337 +0,0 @@ -package yuelj.texas; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Stack; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.google.gson.annotations.Expose; - -import yuelj.cardUtils.CardGroup; -import yuelj.cardUtils.CardUtil; -import yuelj.entity.BetPlayer; -import yuelj.entity.GameLog; -import yuelj.entity.Player; -import yuelj.entity.PlayerOpt; -import yuelj.entity.PrivateRoom; -import yuelj.entity.RetMsg; -import yuelj.entity.SystemLogEntity; -import yuelj.service.GameLogService; -import yuelj.service.PlayerService; -import yuelj.service.SystemLogService; -import yuelj.service.impl.LobbyServiceImpl; -import yuelj.utils.SpringUtil; -import yuelj.utils.dateTime.DateUtil; -import yuelj.utils.serialize.JsonUtils; - -/** - * 房间实体 - * - * @author Ming - * - */ -@Component -public class Room { - private static Logger logger = LogManager.getLogger(Room.class); - /** - * 设置初始化房间数量 - */ - private static final int INIT_ROOM_COUNT = 20; - static { - // 初始化创建20个房间 - for (int i = 0; i < INIT_ROOM_COUNT; i++) { - TexasUtil.createRoom(0); - } - } - /** - * 游戏日志 - */ - protected GameLog gameLog = new GameLog(); - protected List opts = new ArrayList();; - /** - * 房间id - */ - @Expose - private int id; - /** - * 房间级别 - */ - @Expose - private int level; - /** - * 房间类型,0德州,1三张牌 - */ - @Expose - private int type; - - /** - * 允许带入的最大筹码 - */ - @Expose - private int maxChips; - /** - * 允许带入的最小筹码 - */ - @Expose - private int minChips; - /** - * 大盲下注筹码 - */ - @Expose - private int bigBet; - /** - * 小盲下注筹码 - */ - @Expose - private int smallBet; - /** - * 最大玩家数 - */ - @Expose - private int maxPlayers; - /** - * 最小玩家数 - */ - @Expose - private int minPlayers; - /** - * D,最佳座位,庄家(座位号) - */ - @Expose - private int dealer; - /** - * 小盲玩家座位号 - */ - @Expose - private int smallBetSeatNum; - /** - * 大盲玩家座位号 - */ - @Expose - private int bigBetSeatNum; - /** - * 游戏状态(0,等待;1,游戏,2结算中) - */ - @Expose - private AtomicInteger gamestate = new AtomicInteger(0); - /** - * 房间状态(0,不可加入;1,可加入) - */ - private volatile int roomstate = 1; - /** - * 房间中处于等待状态的玩家列表 - */ - @Expose - private List waitPlayers = new CopyOnWriteArrayList(); - /** - * 房间中处于游戏状态的玩家列表 - */ - @Expose - protected List ingamePlayers = new CopyOnWriteArrayList(); - /** - * 一局的牌组 - */ - protected ArrayList cardList = CardGroup.getRandomCards(); - /** - * 公共牌 - */ - @Expose - protected List communityCards = new ArrayList(); - /** - * 奖池,下注总额 - */ - @Expose - protected long betAmount; - /** - * 每个玩家下的注,玩家和其本局游戏下注的总额 - */ - protected Map betMap = new LinkedHashMap<>(); - - /** - * 在一回合中,每个玩家下的注[座位号,本轮下注额] - */ - @Expose - protected Map betRoundMap = new LinkedHashMap<>(); - - /** - * 操作过的玩家列表 - */ - public List donePlayerList = new ArrayList(); - - /** - * 下一个行动的玩家id - */ - @Expose - protected volatile int nextturn = 0;// next player - /** - * 每轮第一个行动的玩家 - */ - protected volatile int roundturn = 0; - /** - * 本轮游戏玩家下的最大注倍数,第一轮为1,一共3种,1,2,4 - */ - protected int roundMaxBet = bigBet; - /** - * 存放座位号的栈(空闲座位) - */ - @Expose - private Stack freeSeatStack; - /** - * 两局之间的间隔时间,秒 - */ - @Expose - private int restBetweenGame = 5000; - - /** - * 操作超时时间,单位毫秒(玩家在规定时间内没有完成操作,则系统自动帮其弃牌) - */ - @Expose - private int optTimeout = 10000; - - /** - * 房间中等待操作的计时器(一个房间中不允许同时生成多个计时器) - */ - private Timer timer = new Timer(); - /** - * 游戏中玩家成手牌列表 - */ - @Expose - protected Map> finalCardsMap = new HashMap>(); - /** - * 最后亮牌玩家手牌列表 - */ - @Expose - protected Map> handCardsMap = new HashMap>(); - /** - * 所有获胜玩家列表 - */ - @Expose - protected Map winPlayersMap = new HashMap(); - - /** - * - * 开始游戏 - * - *

-	 * 游戏状态变更为游戏中,等待中的玩家移动到游戏中列表
-	 * 
-	 * @param room
-	 */
-	public void startGame() {
-		if (this.getGamestate().compareAndSet(0, 1)) {
-			// 游戏日志-玩家操作信息
-			opts.clear();
-
-			// 由于需要通知在结束阶段进入的玩家牌局信息
-			// 因此延迟到下局开始清除上局信息
-			finalCardsMap.clear();
-			handCardsMap.clear();
-			winPlayersMap.clear();
-			// 重新补筹码
-			for (Player p : getWaitPlayers()) {
-				if (p.getBodyChips() == 0) {
-					assignChipsForInRoom(p);
-				}
-			}
-			// 总筹码不足一个大盲注的不能进行游戏,踢出房间
-			getWaitPlayers().parallelStream().filter(p -> p.getBodyChips() <= this.getBigBet())
-					.forEach(p -> TexasUtil.outRoom(p));
-			// 转移等待列表的玩家进入游戏中玩家列表
-			TexasUtil.movePlayers(this.getWaitPlayers(), this.getIngamePlayers());
-			// 记录玩家座位号
-			for (Player p : getIngamePlayers()) {
-				p.setFold(false);// 设定为未弃牌
-			}
-			// 更新下一个dealer
-			TexasUtil.updateNextDealer(this);
-			// 得到一副洗好的牌(随机卡组)
-			this.setCardList(CardGroup.getRandomCards());
-			// 确定大小盲主,并分配筹码到奖池
-			// 最佳位置
-			int dealer = getDealer();
-			// 小盲注
-			int smallBet = getSmallBet();
-			// 大盲注
-			int bigBet = getBigBet();
-			// 小盲位置
-			int smallBetSeat = TexasUtil.getNextSeatNum(dealer, this);
-			// 当只有2个玩家时,dealer才是小盲
-			if (getIngamePlayers().size() == 2) {
-				smallBetSeat = dealer;
-			}
-			this.setSmallBetSeatNum(smallBetSeat);
-			// 大盲位置
-			int bigBetSeat = TexasUtil.getNextSeatNum(smallBetSeat, this);
-			this.setBigBetSeatNum(bigBetSeat);
-			// 小盲玩家
-			Player smallBetPlayer = TexasUtil.getPlayerBySeatNum(smallBetSeat, getIngamePlayers());
-			// 大盲玩家
-			Player bigBetPlayer = TexasUtil.getPlayerBySeatNum(bigBetSeat, getIngamePlayers());
-			// 小盲玩家下小盲注
-			betchipIn(smallBetPlayer, smallBet, false);
-			// 大盲玩家下大盲注
-			betchipIn(bigBetPlayer, bigBet, false);
-			// 更新下一个该操作的玩家
-			nextturn = TexasUtil.getNextSeatNum(bigBetSeat, this);
-			// 更新下一轮该操作的玩家为小盲位置
-			roundturn = smallBetSeat;
-			// 当只有2个玩家时,第一轮Dealer(同时也是小盲)先操作
-			// 第二轮开始大盲先操作
-			if (getIngamePlayers().size() == 2) {
-				roundturn = bigBetSeat;
-			}
-			// 分发手牌
-			TexasUtil.assignHandPokerByRoom(this);
-			// 通知房间中在游戏中的玩家此刻的房间(包含私有信息【公共牌+手牌】的房间)状态信息
-			for (Player p : getIngamePlayers()) {
-				PrivateRoom pRoom = new PrivateRoom();
-				pRoom.setRoom(this);
-				// 私有房间信息(手牌)
-				pRoom.setHandPokers(p.getHandPokers());
-				String msg = JsonUtils.toJson(pRoom, PrivateRoom.class);
-				RetMsg retMsg = new RetMsg();
-				retMsg.setC("onGameStart");
-				retMsg.setState(1);
-				retMsg.setMessage(msg);
-				TexasUtil.sendMsgToOne(p, JsonUtils.toJson(retMsg, RetMsg.class));
-			}
-			startTimer(this);// 开始计时
-			// 游戏日志
-			gameLog.setStartTime(DateUtil.nowDatetime());
-			String initInfo = JsonUtils.toJson(this.getIngamePlayers(), this.getIngamePlayers().getClass());
-			gameLog.setPlayersInitInfo(initInfo);
-			gameLog.setRoomLevel(this.getLevel());
-			gameLog.setRoomType("普通场");//
-			gameLog.setBigBet(JsonUtils.toJson(bigBetPlayer, Player.class));
-			gameLog.setSmallBet(JsonUtils.toJson(smallBetPlayer, Player.class));
-			gameLog.setDealer(
-					JsonUtils.toJson(TexasUtil.getPlayerBySeatNum(dealer, this.getIngamePlayers()), Player.class));
-			GameLogService gameLogService = (GameLogService) SpringUtil.getBean("gameLogService");
-			gameLogService.insertGameLog(gameLog);
-
-		}
-	}
-
-	/**
-	 * 结束游戏
-	 * 
-	 * 
-	 * 游戏状态变更为等待,游戏中的玩家移动到等待列表
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public void endGame() {
-		Date now = new Date();
-		// 尝试更新游戏状态为2:结算中
-		if (this.getGamestate().compareAndSet(1, 2)) {
-			long cut = 0;// 本局游戏的系统抽成筹码
-			logger.info("endGame begin");
-			int allinCount = 0;
-			// 统计allin玩家数
-			for (Player p : getIngamePlayers()) {
-				if (p.getBodyChips() == 0) {
-					allinCount++;
-				}
-			}
-			// 如果公共牌没有发完,且allin人数大于等于2,则先发完公共牌
-			if (communityCards.size() < 5 && allinCount >= 2) {
-				logger.info("communityCards.size() < 5 && allinCount >= 2");
-				// 发公共牌
-				int assignCardCount = 5 - communityCards.size();
-				TexasUtil.assignCommonCardByNum(this, assignCardCount);
-			}
-			int timeBetween = getRestBetweenGame();
-			if (communityCards.size() == 5) {
-				// 成手牌列表
-				for (Player p : getIngamePlayers()) {
-					List hankPoker = new ArrayList();
-					List hankPokerAndCommonCard = new ArrayList();
-					hankPokerAndCommonCard.addAll(getCommunityCards());
-					for (int i = 0; i < p.getHandPokers().length; i++) {
-						hankPokerAndCommonCard.add(p.getHandPokers()[i]);
-						hankPoker.add(p.getHandPokers()[i]);
-					}
-					// 判断牌型并将牌型编号加在数组最后一位
-					List maxCardsGroup = CardUtil.getMaxCardsGroup(hankPokerAndCommonCard);
-					// 加入成手牌列表
-					finalCardsMap.put(p.getSeatNum(), maxCardsGroup);
-					// 加入互相可见的手牌列表
-					handCardsMap.put(p.getSeatNum(), hankPoker);
-				}
-			}
-			// 奖池列表
-			List betPoolList = new ArrayList();
-			// 计算betpool
-			logger.info("sumBetPoolList begin");
-			sumBetPoolList(betPoolList, betMap, ingamePlayers);
-			// 对每个分池结算
-			for (BetPool betpool : betPoolList) {
-				// 单个分池中的获胜玩家列表
-				List winPlayerList = new ArrayList<>();
-				// 本分池的玩家列表
-				List poolPlayers = betpool.getBetPlayerList();
-				if (finalCardsMap.size() > 0) {
-					// 获取本分池获胜玩家
-					logger.info("compareCardsToWinList begin");
-					winPlayerList = compareCardsToWinList(poolPlayers, finalCardsMap);
-				}
-				// 没有则认为第一个获胜,若公共牌未发完结束游戏,存在该情况
-				if (winPlayerList.size() == 0) {
-					for (Player p : poolPlayers) {
-						if (p != null && !p.isFold()) {
-							winPlayerList.add(p);
-							break;
-						}
-					}
-				}
-				Long win = 0l;
-				if (winPlayerList.size() != 0) {
-					// 本次分池获胜的玩家分筹码
-					win = (Long) (betpool.getBetSum() / winPlayerList.size());
-				}
-				for (Player p : winPlayerList) {
-					TexasUtil.changePlayerChips(p, win);
-					// 在上个分池中已经赢的筹码,需要合并计算,加入winPlayersMap
-					Long lastPoolWin = winPlayersMap.get(p.getSeatNum());
-					if (lastPoolWin != null) {
-						win = win + lastPoolWin;
-					}
-					winPlayersMap.put(p.getSeatNum(), win);
-					LobbyServiceImpl.updateRankList(p);
-					logger.info("winPlayersMap.put :" + p.getSeatNum() + " thisPoolWin:" + win + "poolplayerssize:"
-							+ betpool.getBetPlayerList().size());
-				}
-			}
-
-			// 发送结算消息给玩家
-			String msg = JsonUtils.toJson(this, Room.class);
-			RetMsg retMsg = new RetMsg();
-			retMsg.setC("onGameEnd");
-			retMsg.setState(1);
-			retMsg.setMessage(msg);
-			TexasUtil.sendMsgToPlayerByRoom(this, JsonUtils.toJson(retMsg, RetMsg.class));
-			// 清除本局状态信息
-			betMap.clear();
-			// 清除betRoundMap
-			betRoundMap.clear();
-			// 每局开始最大下注为一个大盲
-			roundMaxBet = bigBet;
-			// 清除手牌
-			for (Player p : ingamePlayers) {
-				p.setHandPokers(null);
-			}
-			// 清除已经操作的玩家列表
-			donePlayerList.clear();
-			// 清除总下注
-			betAmount = 0;
-			// 清除公共牌
-			communityCards.clear();
-			// 清除牌堆
-			cardList.clear();
-			// 将玩家都移入等待列表
-			TexasUtil.movePlayers(getIngamePlayers(), getWaitPlayers());
-
-			// 更新玩家筹码数到数据库
-			PlayerService pservice = (PlayerService) SpringUtil.getBean("playerService");
-			logger.info("updatePlayer ingamePlayers begin size:" + ingamePlayers.size());
-			for (Player p : getWaitPlayers()) {
-				Player playerData = new Player();
-				playerData.setId(p.getId());
-				synchronized (p) {
-					// 当前筹码数等于桌上筹码+身上筹码
-					playerData.setChips(p.getChips() + p.getBodyChips());
-					pservice.updatePlayer(playerData);
-				}
-				logger.info(
-						"updatePlayer ingamePlayers begin p:" + p.getUsername() + " chips:" + playerData.getChips());
-			}
-
-			Date costEnd = new Date();
-			long cost = costEnd.getTime() - now.getTime();
-			if (cost > 500) {
-				logger.error("endGame:" + " cost Millisecond" + cost);
-			}
-			// 尝试更新游戏状态为0:等待开始
-			this.getGamestate().compareAndSet(2, 0);
-			// 判断是否可以开始下一局
-			checkStart(timeBetween);
-		}
-	}
-
-	/**
-	 * 计算奖池分池
-	 * 
-	 * @param betPoolList
-	 * @param betMap
-	 * @param ingamePlayers
-	 */
-	public void sumBetPoolList(List betPoolList, Map betMap, List ingamePlayers) {
-		// 对map按照值排序
-		betMap = TexasUtil.sortMapByValue(betMap);
-		boolean complete = false;
-		while (!complete) {
-			complete = true;
-			// 该分池总金额
-			Long betSum = 0l;
-			// 该分池单个金额
-			Long thisBet = 0l;
-			BetPool pool = new BetPool();
-			for (Entry e : betMap.entrySet()) {
-				// 发现不为0的下注,则继续新的分池
-				if (e.getValue() != 0) {
-					complete = false;
-					if (thisBet == 0) {
-						thisBet = e.getValue();
-					}
-					betSum = betSum + thisBet;
-					if (e.getValue() - thisBet < 0) {
-						System.out.println("betMap计算错误!下注排序从小到大");
-					}
-					// 减去本轮分池单个金额
-					e.setValue(e.getValue() - thisBet);
-					// 加入betpool
-					Player p = TexasUtil.getPlayerBySeatNum(e.getKey(), ingamePlayers);
-					if (p != null) {
-						pool.getBetPlayerList().add(p);
-					}
-				}
-			}
-			pool.setBetSum(betSum);
-			if (pool.getBetSum() != 0) {
-				betPoolList.add(pool);
-			}
-		}
-		betMap.clear();
-	}
-
-	/**
-	 * 根据单个奖池玩家列表,最终成牌列表,计算获胜玩家列表
-	 * 
-	 * @param poolPlayers
-	 * @param finalCardsMap
-	 * @return
-	 */
-	public List compareCardsToWinList(List poolPlayers, Map> finalCardsMap) {
-		List winPlayerList = new ArrayList<>();
-		List listold = null;
-		if (finalCardsMap.size() == 0) {
-			logger.info("finalCardsMap.size()==0 can not compareCardsToWinList");
-			return null;
-		}
-		for (Entry> e : finalCardsMap.entrySet()) {
-			// 判断是否在本分池内
-			boolean inThisPool = false;
-			for (Player p : poolPlayers) {
-				if (p != null && !p.isFold() && e.getKey() == p.getSeatNum()) {
-					inThisPool = true;
-					break;
-				}
-			}
-			// 不在分池内
-			if (!inThisPool) {
-				continue;
-			}
-			logger.info("compareCardsToWinList inThisPool:" + inThisPool);
-			// 旧卡组为空,则加入
-			if (listold == null) {
-				listold = e.getValue();
-				logger.info("getPlayerBySeatNum begin seatNum:" + e.getKey() + " poolPlayers:"
-						+ JsonUtils.toJson(poolPlayers, poolPlayers.getClass()));
-				Player wp = TexasUtil.getPlayerBySeatNum(e.getKey(), poolPlayers);
-				if (wp != null) {
-					winPlayerList.add(wp);
-				} else {
-					logger.info("winPlayerList.add e.getKey():" + e.getKey() + "wp not in poolPlayers");
-				}
-				logger.info("winPlayerList.add e.getKey():" + e.getKey());
-			} else {
-				List listNew = e.getValue();
-				// 比较新旧卡组,大或相等则清空winPlayerList,加入新卡组的玩家
-				logger.info("compareCardsToWinList CardUtil.compareValue listNew:" + listNew + " listold" + listold);
-				int result = CardUtil.compareValue(e.getValue(), listold);
-				logger.info("compareCardsToWinList CardUtil.compareValue result:" + result);
-				if (result == 1) {
-					winPlayerList.clear();
-					winPlayerList.add(TexasUtil.getPlayerBySeatNum(e.getKey(), poolPlayers));
-					listold = listNew;
-				} else if (result == 0) {
-					winPlayerList.add(TexasUtil.getPlayerBySeatNum(e.getKey(), poolPlayers));
-				}
-			}
-		}
-		return winPlayerList;
-	}
-
-	/**
-	 * 判断游戏是否可以开始
-	 * 
-	 */
-	public void checkStart(int milsecond) {
-		try {
-			Thread.sleep(milsecond);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		// 不在等待开始,则返回
-		if (!(getGamestate().get() == 0)) {
-			return;
-		}
-		// 玩家数大于等于最小开始游戏玩家,则开始
-		if (getWaitPlayers().size() >= getMinPlayers()) {
-			startGame();
-		}
-	}
-
-	/**
-	 * 为进入房间的用户分配筹码
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public void assignChipsForInRoom(Player player) {
-		long takeChip = getMaxChips();
-		// 如果玩家的所剩筹码不超过房间规定的最大带入筹码,则该玩家筹码全部带入
-		if (player.getChips() < takeChip) {
-			takeChip = player.getChips();
-		}
-		synchronized (player) {
-			player.setChips(player.getChips() - takeChip);
-			player.setBodyChips(takeChip);
-		}
-	}
-
-	/**
-	 * 为用户初始化为房间最大带入
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public void assignChipsToRoomMax(Player player) {
-		// 玩家的钱多退少补,使其等于房间最大带入
-		long takeChip = getMaxChips() - player.getBodyChips();
-		// 如果玩家的所剩筹码不超过需要补足的,则带入所有
-		if (player.getChips() < takeChip) {
-			takeChip = player.getChips();
-		}
-		synchronized (player) {
-			player.setChips(player.getChips() - takeChip);
-			player.setBodyChips(takeChip + player.getBodyChips());
-		}
-	}
-
-	/**
-	 * 为退出房间的用户分配筹码,并入库
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public void assignChipsForOutRoom(Player player) {
-		synchronized (player) {
-			// 当前筹码数等于桌上筹码+身上筹码
-			player.setChips(player.getChips() + player.getBodyChips());
-			player.setBodyChips(0);
-			// 玩家筹码信息入库
-			PlayerService playerService = (PlayerService) SpringUtil.getBean("playerService");
-			playerService.updatePlayer(player);
-		}
-	}
-
-	/**
-	 * 玩家弃牌
-	 * 
-	 * @param player
-	 */
-	public void fold(Player player) {
-		// 房间状态游戏中
-		if (player.getRoom().getGamestate().get() != 1) {
-			return;
-		}
-		if (player.getSeatNum() != nextturn) {
-			return;
-		}
-		try {
-			// 检测到玩家操作,计时取消
-			cancelTimer();
-			synchronized (player) {
-				// 弃牌
-				player.setFold(true);
-			}
-			// 发送弃牌消息给玩家
-			String msg = JsonUtils.toJson(player, Player.class);
-			RetMsg retMsg = new RetMsg();
-			retMsg.setC("onPlayerFold");
-			retMsg.setState(1);
-			retMsg.setMessage(msg);
-			TexasUtil.sendMsgToPlayerByRoom(this, JsonUtils.toJson(retMsg, RetMsg.class));
-			// 将玩家移动到等待列表
-			TexasUtil.removeIngamePlayer(player);
-			int index = donePlayerList.indexOf(player.getSeatNum());
-			// 玩家在donePlayerList,则移除
-			if (index != -1) {
-				donePlayerList.remove(index);
-			}
-			getWaitPlayers().add(player);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		// 判断下一步是否round结束,endgame或下个玩家操作nextturn
-		endRoundOrNextTurn();
-		// 记录日志
-		PlayerOpt opt = new PlayerOpt();
-		opt.setOptTime(DateUtil.nowDatetime());
-		opt.setOptType("fold");// 操作类型(跟注、加注、弃牌、全下)
-		opt.setRemark("");// 备注
-		opt.setPlayerId(player.getId());
-		opt.setSeatNum(player.getSeatNum());
-		opts.add(opt);
-	}
-
-	/**
-	 * 判断下一步是否round结束,endgame或下个玩家操作nextturn
-	 */
-	public void endRoundOrNextTurn() {
-		// 判断是否可以结束本轮
-		boolean roundEnd = checkRoundEnd();
-		if (!roundEnd) {
-			// 更新nextturn
-			TexasUtil.updateNextTurn(this);
-			// 发送轮到某玩家操作的消息
-			sendNextTurnMessage();
-		}
-	}
-
-	public void check(Player player, boolean playerOpt) {
-		// 房间状态游戏中
-		if (player.getRoom().getGamestate().get() != 1) {
-			return;
-		}
-		// 是否轮到该玩家操作
-		if (player.getSeatNum() != nextturn) {
-			return;
-		}
-		// 玩家此次操作之前的本轮下注额
-		long oldBetThisRound = 0;
-		if (getBetRoundMap().get(player.getSeatNum()) != null) {
-			oldBetThisRound = getBetRoundMap().get(player.getSeatNum());
-		}
-		// 小于最大下注,不能check
-		if (oldBetThisRound < getRoundMaxBet()) {
-			logger.info("can not check, bet:" + oldBetThisRound + " getRoundMaxBet:" + getRoundMaxBet());
-			return;
-		}
-		try {
-			// 检测到玩家操作,计时取消
-			cancelTimer();
-			// 记录当前轮已经操作过的玩家
-			if (!donePlayerList.contains(player.getSeatNum())) {
-				donePlayerList.add(player.getSeatNum());
-			}
-			// 发送过牌消息给玩家
-			String msg = JsonUtils.toJson(player, Player.class);
-			RetMsg retMsg = new RetMsg();
-			retMsg.setC("onPlayerCheck");
-			retMsg.setState(1);
-			retMsg.setMessage(msg);
-			TexasUtil.sendMsgToPlayerByRoom(this, JsonUtils.toJson(retMsg, RetMsg.class));
-
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		// 判断下一步是否round结束,endgame或下个玩家操作nextturn
-		endRoundOrNextTurn();
-	}
-
-	/**
-	 * 下注
-	 * 
-	 * @param player    下注的玩家
-	 * @param chip      下注的筹码
-	 * @param palyerOpt 认为玩家操作过true
-	 */
-	public boolean betchipIn(Player player, int chip, boolean playerOpt) {
-		if (player == null) {
-			return false;
-		}
-		if (playerOpt && player.getSeatNum() != nextturn) {
-			return false;
-		}
-		Room thisRoom = player.getRoom();
-
-		PlayerOpt opt = new PlayerOpt();
-		opt.setOptChips(chip);
-		opt.setOptTime(DateUtil.nowDatetime());
-		opt.setOptType("");// 操作类型(跟注、加注、弃牌、全下)
-		// 第几轮
-		int rd = Math.abs(thisRoom.getCommunityCards().size() - 1);
-		opt.setRound(rd);
-		opt.setRemark("");// 备注
-		opt.setPlayerId(player.getId());
-		opt.setSeatNum(player.getSeatNum());
-		opts.add(opt);
-
-		// 玩家此次操作之前的本轮下注额
-		long oldBetThisRound = 0;
-		if (thisRoom.getBetRoundMap().get(player.getSeatNum()) != null) {
-			oldBetThisRound = thisRoom.getBetRoundMap().get(player.getSeatNum());
-		}
-		// 无效下注额,1筹码不足
-		if (chip <= 0 || chip > player.getBodyChips()) {
-			logger.error("betchipIn error not enough chips:" + chip + " getBodyChips():" + player.getBodyChips());
-			return false;
-		}
-		if (playerOpt) {
-			// 2.在没有allin的情况下,如果不是跟注,则下注必须是大盲的整数倍
-			if (chip < player.getBodyChips()) {
-				//2.1跟注-- 不能小于之前下注,否则强制增加到跟注筹码,不够则allin
-				if ((chip + oldBetThisRound) < thisRoom.getRoundMaxBet()) {
-					logger.error("betchipIn error < getRoundMaxBet() chip:" + chip + "oldBetThisRound:"
-							+ oldBetThisRound + " max:" + thisRoom.getRoundMaxBet());
-					if (thisRoom.getRoundMaxBet() - oldBetThisRound < player.getBodyChips()) {
-						chip = (int) (thisRoom.getRoundMaxBet() - oldBetThisRound);
-					} else {
-						chip = (int) player.getBodyChips();
-					}
-				}
-				//2.2加注,反加-- 
-				if ((chip + oldBetThisRound) != thisRoom.getRoundMaxBet()) {
-					// 本轮已经下注+当前加注-本轮最大下注,必须=大盲注的整数倍
-					if ((chip + oldBetThisRound - thisRoom.getRoundMaxBet()) % thisRoom.getBigBet() != 0) {
-						logger.error("betchipIn error % bigbet != 0:" + chip + "oldBetThisRound:" + oldBetThisRound
-								+ ",max:" + thisRoom.getRoundMaxBet());
-						return false;
-					}
-				}
-			}
-
-		}
-		try {
-			if (playerOpt) {
-				// 检测到玩家操作,计时取消
-				cancelTimer();
-			}
-			// 设置本轮最大加注
-			if ((int) (chip + oldBetThisRound) > thisRoom.getRoundMaxBet()) {
-				thisRoom.setRoundMaxBet((int) (chip + oldBetThisRound));
-				// 加注额大于之前,则所有玩家重新加注
-				donePlayerList.clear();
-			}
-			// 总奖池
-			thisRoom.setBetAmount(getBetAmount() + chip);
-			// 记录当前轮已经操作过的玩家
-			if (!thisRoom.donePlayerList.contains(player.getSeatNum()) && playerOpt) {
-				thisRoom.donePlayerList.add(player.getSeatNum());
-			}
-			// 刷新下注列表
-			Long beforeBet = 0l;
-			if (thisRoom.getBetMap().get(player.getSeatNum()) != null) {
-				beforeBet = thisRoom.getBetMap().get(player.getSeatNum());
-			}
-			// 加入玩家总下注map
-			thisRoom.getBetMap().put(player.getSeatNum(), beforeBet + chip);
-			// 加入玩家本轮下注
-			thisRoom.getBetRoundMap().put(player.getSeatNum(), chip + oldBetThisRound);
-			// 筹码入池,所带筹码扣除
-			player.setBodyChips(player.getBodyChips() - chip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		if (playerOpt) {
-			try {
-				BetPlayer bp = new BetPlayer();
-				bp.setBodyChips(player.getBodyChips());
-				bp.setInChips(chip);
-				bp.setSeatNum(player.getSeatNum());
-				String message = JsonUtils.toJson(bp, BetPlayer.class);
-				RetMsg retMsg = new RetMsg();
-				retMsg.setC("onPlayerBet");// 告诉前台有玩家下注了
-				retMsg.setState(1);
-				retMsg.setMessage(message);
-				String msg = JsonUtils.toJson(retMsg, RetMsg.class);
-				// 通知房间中玩家有人下注了
-				TexasUtil.sendMsgToPlayerByRoom(thisRoom, msg);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			// 判断下一步是否round结束,endgame或下个玩家操作nextturn
-			endRoundOrNextTurn();
-		}
-		return true;
-	}
-
-	/**
-	 * 判断本轮是否可以结束
-	 */
-	public boolean checkRoundEnd() {
-		// 判断本轮是否可以结束
-		boolean canEndRound = true;
-		if (getIngamePlayers().size() == 1) {
-			// 结算游戏
-			logger.info("only one IngamePlayers endgame start");
-			endGame();
-			return true;
-		}
-		// 将已经allin的玩家加入已操作列表
-		for (Player p : getIngamePlayers()) {
-			if (p.getBodyChips() == 0) {
-				donePlayerList.add(p.getSeatNum());
-			}
-		}
-		// 所有人都已经操作过
-		if (donePlayerList.size() >= getIngamePlayers().size()) {
-			long betMax = 0l;// 以最大下注作为参照筹码
-			for (int i = 0; i < getIngamePlayers().size(); i++) {
-				Player p = getIngamePlayers().get(i);
-				// 为betMax赋初始值
-				if (getBetMap().get(p.getSeatNum()) != null && getBetMap().get(p.getSeatNum()) > betMax) {
-					betMax = getBetMap().get(p.getSeatNum());
-				}
-			}
-			logger.info("checkRoundEnd betMax:" + betMax);
-			for (int i = 0; i < getIngamePlayers().size(); i++) {
-				Player p = getIngamePlayers().get(i);
-				// 已经弃牌的排除在外
-				if (p == null || p.isFold()) {
-					continue;
-				}
-				if (getBetMap().get(p.getSeatNum()) == null) {
-					// 存在没有下注的玩家
-					logger.info("checkRoundEnd no bet seatNum:" + p.getSeatNum());
-					canEndRound = false;
-					break;
-				}
-				// 没有allin的玩家中
-				if (p.getBodyChips() > 0) {
-					// 没有弃牌的玩家中,存在下注额度小于betMax,则本轮不能结束
-					if (betMax > getBetMap().get(p.getSeatNum())) {
-						logger.info("not allin bet getWaitPlayers() {
-		return waitPlayers;
-	}
-
-	public void setWaitPlayers(List waitPlayers) {
-		this.waitPlayers = waitPlayers;
-	}
-
-	public List getIngamePlayers() {
-		return ingamePlayers;
-	}
-
-	public void setIngamePlayers(List ingamePlayers) {
-		this.ingamePlayers = ingamePlayers;
-	}
-
-	public ArrayList getCardList() {
-		return cardList;
-	}
-
-	public void setCardList(ArrayList cardList) {
-		this.cardList = cardList;
-	}
-
-	public List getCommunityCards() {
-		return communityCards;
-	}
-
-	public void setCommunityCards(List communityCards) {
-		this.communityCards = communityCards;
-	}
-
-	public int getNextturn() {
-		return nextturn;
-	}
-
-	public void setNextturn(int nextturn) {
-		this.nextturn = nextturn;
-	}
-
-	public Stack getFreeSeatStack() {
-		return freeSeatStack;
-	}
-
-	public void setFreeSeatStack(Stack freeSeatStack) {
-		this.freeSeatStack = freeSeatStack;
-	}
-
-	public long getBetAmount() {
-		return betAmount;
-	}
-
-	public void setBetAmount(long betAmount) {
-		this.betAmount = betAmount;
-	}
-
-	public Map getBetRoundMap() {
-		return betRoundMap;
-	}
-
-	public void setBetRoundMap(Map betRoundMap) {
-		this.betRoundMap = betRoundMap;
-	}
-
-	public int getOptTimeout() {
-		return optTimeout;
-	}
-
-	public void setOptTimeout(int optTimeout) {
-		this.optTimeout = optTimeout;
-	}
-
-	public Map getWinPlayersMap() {
-		return winPlayersMap;
-	}
-
-	public void setWinPlayersMap(Map winPlayersMap) {
-		this.winPlayersMap = winPlayersMap;
-	}
-
-	public int getSmallBetSeatNum() {
-		return smallBetSeatNum;
-	}
-
-	public void setSmallBetSeatNum(int smallBetSeatNum) {
-		this.smallBetSeatNum = smallBetSeatNum;
-	}
-
-	public int getBigBetSeatNum() {
-		return bigBetSeatNum;
-	}
-
-	public void setBigBetSeatNum(int bigBetSeatNum) {
-		this.bigBetSeatNum = bigBetSeatNum;
-	}
-
-	public Map> getFinalCardsMap() {
-		return finalCardsMap;
-	}
-
-	public void setFinalCardsMap(Map> finalCardsMap) {
-		this.finalCardsMap = finalCardsMap;
-	}
-
-	public int getRoundMaxBet() {
-		return roundMaxBet;
-	}
-
-	public void setRoundMaxBet(int roundMaxBet) {
-		this.roundMaxBet = roundMaxBet;
-	}
-
-	public Map getBetMap() {
-		return betMap;
-	}
-
-	public void setBetMap(Map betMap) {
-		this.betMap = betMap;
-	}
-
-	public int getType() {
-		return type;
-	}
-
-	public void setType(int type) {
-		this.type = type;
-	}
-
-//	public static void main(String[] args) {
-//		testSumBetPool();
-//		// testCompareCardsToWinList();
-//	}
-//
-//	public static void testSumBetPool() {
-//		// 奖池列表
-//		List betPoolList = new ArrayList();
-//		Map betMap = new LinkedHashMap<>();
-//		List ingamePlayers = new ArrayList();
-//		for (int i = 0; i < 10; i++) {
-//			Player p = new Player();
-//			p.setSeatNum(i);
-//			betMap.put(i, 100l);
-//			if (i < 3) {
-//				betMap.put(i, 2000l + i * 100);
-//			} else {
-//				betMap.put(i, 200l + i * 10);
-//			}
-//			ingamePlayers.add(p);
-//		}
-//		sumBetPoolList(betPoolList, betMap, ingamePlayers);
-//		logger.info(JsonUtils.toJson(betMap, betMap.getClass()));
-//		for (BetPool pool : betPoolList) {
-//			logger.info("pool:" + pool.getBetSum());
-//			logger.info("size:" + pool.getBetPlayerList().size());
-//			logger.info(JsonUtils.toJson(pool.getBetPlayerList(), pool.getBetPlayerList().getClass()));
-//		}
-//		logger.info("poolSize:" + betPoolList.size());
-//	}
-//
-//	public static void testCompareCardsToWinList() {
-//		List poolPlayers = new ArrayList<>();
-//		Map> finalCardsMap = new HashMap>();
-//
-//		poolPlayers.add(null);
-//		for (int i = 1; i < 6; i++) {
-//			Player p = new Player();
-//			p.setSeatNum(i);
-//			p.setFold(false);
-//			poolPlayers.add(p);
-//		}
-//		finalCardsMap.put(1, new ArrayList(Arrays.asList(24, 28, 39, 40, 51, 1)));
-//		finalCardsMap.put(2, new ArrayList(Arrays.asList(36, 39, 28, 40, 51, 2)));
-//		finalCardsMap.put(3, new ArrayList(Arrays.asList(40, 39, 32, 28, 26, 5)));
-//		finalCardsMap.put(4, new ArrayList(Arrays.asList(50, 51, 40, 41, 39, 3)));
-//		finalCardsMap.put(5, new ArrayList(Arrays.asList(12, 14, 39, 40, 51, 2)));
-//		// "finalCardsMap\":{\"1\":,\"2\":[],\"3\":[],\"4\":[],\"5\":[]}
-//		List winPlayerList = compareCardsToWinList(poolPlayers, finalCardsMap);
-//		logger.info(JsonUtils.toJson(poolPlayers, poolPlayers.getClass()));
-//		logger.info(JsonUtils.toJson(winPlayerList, winPlayerList.getClass()));
-//	}
-}
diff --git a/src/main/java/yuelj/texas/TexasStatic.java b/src/main/java/yuelj/texas/TexasStatic.java
deleted file mode 100644
index a46a6b5..0000000
--- a/src/main/java/yuelj/texas/TexasStatic.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package yuelj.texas;
-
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import yuelj.entity.Player;
-import yuelj.texas.threeCard.ThreeCardRoom;
-
-public class TexasStatic {
-	/**
-	 * 登录玩家列表
-	 */
-	public static ConcurrentMap loginPlayerMap = new ConcurrentHashMap();
-	/**
-	 * 登录玩家列表
-	 */
-	public static ConcurrentMap playerSessionMap = new ConcurrentHashMap();
-
-	/**
-	 * 房间列表,德州扑克
-	 */
-	public static List roomList=new CopyOnWriteArrayList();
-	/**
-	 * 房间列表,拼三张
-	 */
-	public static List threeCardRoomList=new CopyOnWriteArrayList();
-
-}
diff --git a/src/main/java/yuelj/texas/TexasUtil.java b/src/main/java/yuelj/texas/TexasUtil.java
deleted file mode 100644
index 2144754..0000000
--- a/src/main/java/yuelj/texas/TexasUtil.java
+++ /dev/null
@@ -1,780 +0,0 @@
-package yuelj.texas;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-
-import javax.websocket.Session;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import yuelj.action.websocket.TexasWS;
-import yuelj.constants.RoomTypeList;
-import yuelj.entity.Player;
-import yuelj.entity.PrivateRoom;
-import yuelj.entity.RetMsg;
-import yuelj.service.PlayerService;
-import yuelj.texas.robot.RobotManager;
-import yuelj.texas.threeCard.ThreeCardRoom;
-import yuelj.utils.SpringUtil;
-import yuelj.utils.serialize.JsonUtils;
-
-public class TexasUtil {
-	private static Logger logger = LogManager.getLogger(TexasUtil.class);
-
-	/**
-	 * 获取一个对应级别的可用房间,直接进入
-	 * 
-	 * @param level
-	 * @return
-	 */
-	public static Room getUsableRoomThenIn(int level, Player p) {
-		for (int i = 0; i < TexasStatic.roomList.size(); i++) {
-			int roomstate = TexasStatic.roomList.get(i).getRoomstate();
-			if (roomstate == 1 && TexasStatic.roomList.get(i).getLevel() == level) {
-				boolean success = inRoom(TexasStatic.roomList.get(i), p);
-				if (success) {
-					return TexasStatic.roomList.get(i);
-				}
-			}
-		}
-		return createRoomByPlayer(level, p);
-	}
-
-	/**
-	 * 获取可用房间类型
-	 * 
-	 * @param level
-	 * @param p
-	 * @param type  1宝鸡拼三张,不传默认德州扑克
-	 * @return
-	 */
-	public static Room getUsableRoomThenIn(int level, Player p, int type) {
-		// 加入游戏类型,1宝鸡拼三张,不传默认德州扑克
-		if (type == 1) {
-			ThreeCardRoom usableroom = null;
-			ThreeCardRoom roomConfig = RoomTypeList.threeCardRoomTypeMap.get(level);
-			if (p.getChips() < roomConfig.getMinChips()) {
-				return null;
-			}
-			for (int i = 0; i < TexasStatic.threeCardRoomList.size(); i++) {
-				int roomstate = TexasStatic.threeCardRoomList.get(i).getRoomstate();
-				if (roomstate == 1 && TexasStatic.threeCardRoomList.get(i).getLevel() == level) {
-					usableroom = TexasStatic.threeCardRoomList.get(i);
-					break;
-				}
-			}
-			if (usableroom == null) {
-				usableroom = createThreeCardRoomRoom(level);
-			}
-			return usableroom;
-		} else {
-			return getUsableRoomThenIn(level, p);
-		}
-	}
-
-	public static Room createRoomThenIn(int level, Player player, int type) {
-		if (type == 1) {
-			ThreeCardRoom newRoom = createThreeCardRoomRoom(level);
-			inRoom(newRoom, player);
-			TexasStatic.threeCardRoomList.add(newRoom);
-			return newRoom;
-		} else {
-			return createRoomByPlayer(level, player);
-		}
-	}
-
-	/**
-	 * 进入房间
-	 * 
-	 * 
-	 * 1,检查房间是否还可加入 2,加入房间/重新查找可以进入的房间 3,改变房间状态
-	 */
-	public static boolean inRoom(Room room, Player player) {
-		if (room == null || player == null) {
-			return false;
-		}
-		// 如果玩家已在房间中,则先出房间
-		outRoom(player);
-		if (room.getRoomstate() == 0) {
-			return false;
-		}
-		// 房间加锁
-		synchronized (room.getFreeSeatStack()) {
-			// 房间满人,修改状态为不可加入, 加入房间失败
-			if (room.getFreeSeatStack().isEmpty()) {
-				room.setRoomstate(0);
-				return false;
-			}
-			room.getWaitPlayers().add(player);
-			// 设定座位号
-			int seatNum = room.getFreeSeatStack().pop();// 从空闲座位的栈中取出一个座位
-			player.setSeatNum(seatNum);
-			if (room.getFreeSeatStack().isEmpty()) {
-				// 房间满人,修改状态为不可加入
-				room.setRoomstate(0);
-			}
-			room.assignChipsForInRoom(player);
-			// 成功则设置房间
-			player.setRoom(room);
-		}
-		return true;
-	}
-
-	/**
-	 * 退出房间
-	 */
-	public static void outRoom(Player player) {
-		if (player == null || player.getRoom() == null) {
-			return;
-		}
-		synchronized (player.getRoom().getFreeSeatStack()) {
-			Room room = player.getRoom();
-			// 通知所有房间内玩家,有玩家离开
-			sendPlayerToOthers(player, room, "onPlayerLeaveRoom");
-			removeWaitOrInGamePlayer(player);
-			// 成功则设置房间
-			int index = room.donePlayerList.indexOf(player.getSeatNum());
-			if (index != -1) {
-				room.donePlayerList.remove(index);
-			}
-			// 记录玩家的筹码变化
-			room.assignChipsForOutRoom(player);
-			// 还座位号
-			if (player.getSeatNum() != -1) {
-				room.getFreeSeatStack().push(player.getSeatNum());
-				player.setSeatNum(-1);
-			}
-			// 修改房间状态为可加入
-			room.setRoomstate(1);
-			// 在游戏中的玩家数少于最低玩家数时结束游戏
-			room.checkEnd();
-		}
-	}
-
-	/**
-	 * 移除等待或游戏中的玩家
-	 * 
-	 * @param player
-	 */
-	public static void removeWaitOrInGamePlayer(Player player) {
-		removeWaitPlayer(player);
-		removeIngamePlayer(player);
-	}
-
-	public static boolean removeWaitPlayer(Player player) {
-		boolean success = false;
-		Player ret = null;
-		if (player != null && player.getRoom() != null) {
-			Room room = player.getRoom();
-			// 等待中的玩家退出房间
-			for (int i = 0; i < room.getWaitPlayers().size(); i++) {
-				Player p = room.getWaitPlayers().get(i);
-				if (p.getId().equals(player.getId())) {
-					ret = room.getWaitPlayers().remove(i);
-				}
-			}
-		}
-		if (ret != null) {
-			success = true;
-		}
-		return success;
-	}
-
-	public static boolean removeIngamePlayer(Player player) {
-		boolean success = false;
-		Player ret = null;
-		if (player != null && player.getRoom() != null) {
-			Room room = player.getRoom();
-			// 等待中的玩家退出房间
-			for (int i = 0; i < room.getIngamePlayers().size(); i++) {
-				Player p = room.getIngamePlayers().get(i);
-				if (p.getId().equals(player.getId())) {
-					ret = room.getIngamePlayers().remove(i);
-				}
-			}
-		}
-		if (ret != null) {
-			success = true;
-		}
-		return success;
-	}
-
-	/**
-	 * 为房间中正在游戏的玩家分配手牌
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public static void assignHandPokerByRoom(Room room) {
-		List cardList = room.getCardList();
-		for (Player p : room.getIngamePlayers()) {
-			int[] hankPoker = { cardList.get(0), cardList.get(1) };
-			cardList.remove(0);
-			cardList.remove(0);
-			// 玩家手牌
-			p.setHandPokers(hankPoker);
-		}
-	}
-
-	/**
-	 * 发公共牌
-	 * 
-	 * @param room 房间
-	 * @param num  数量
-	 */
-	public static void assignCommonCardByNum(Room room, int num) {
-		List cardList = room.getCardList();
-		for (int i = 0; i < num; i++) {
-			room.getCommunityCards().add(cardList.get(0));
-			cardList.remove(0);
-		}
-		// 通知房间中的每个玩家
-		RetMsg retMsg = new RetMsg();
-		retMsg.setC("onAssignCommonCard");
-		retMsg.setState(1);
-		// 所有公共牌
-		String message = JsonUtils.toJson(room.getCommunityCards(), room.getCommunityCards().getClass());
-		retMsg.setMessage(message);
-		String msg = JsonUtils.toJson(retMsg, RetMsg.class);
-		sendMsgToPlayerByRoom(room, msg);
-	}
-
-	/**
-	 * 将一个玩家列表中的玩家全部移动到另一个玩家列表中
-	 * 
-	 * @param from
-	 * @param to
-	 */
-	public static void movePlayers(List from, List to) {
-		while (from.size() > 0) {
-			to.add(from.get(0));// 添加来源列表的首位到目标列表
-			from.remove(0);// 移除来源列表的首位
-		}
-	}
-
-	/**
-	 * 获取房间中的玩家数量
-	 * 
-	 * @param room
-	 * @return
-	 */
-	public static int getRoomPlayerCount(Room room) {
-		int playerCount = room.getWaitPlayers().size() + room.getIngamePlayers().size();
-		return playerCount;
-	}
-
-	/**
-	 * 创建一个相应级别的房间
-	 * 
-	 * @param level
-	 */
-	public static Room createRoom(int level) {
-		Room room = RoomTypeList.getNewRoom(level);
-		TexasStatic.roomList.add(room);
-		return room;
-	}
-
-	/**
-	 * 创建一个相应级别的房间,玩家直接进入
-	 * 
-	 * @param level
-	 */
-	public static Room createRoomByPlayer(int level, Player player) {
-		Room room = RoomTypeList.getNewRoom(level);
-		inRoom(room, player);
-		TexasStatic.roomList.add(room);
-		return room;
-	}
-
-	public static ThreeCardRoom createThreeCardRoomRoom(int level) {
-		ThreeCardRoom room = null;
-		room = RoomTypeList.getThreeCardRoom(level);
-		TexasStatic.threeCardRoomList.add((ThreeCardRoom) room);
-		return room;
-	}
-
-	/**
-	 * 移除没有玩家的空房间
-	 */
-	public static void removeEmptyRoom() {
-		for (int i = 0; i < TexasStatic.roomList.size(); i++) {
-			Room room = TexasStatic.roomList.get(i);
-			int count = room.getIngamePlayers().size() + room.getWaitPlayers().size();
-			if (count == 0) {
-				TexasStatic.roomList.remove(i);
-			}
-		}
-	}
-
-	/**
-	 * 发送表情或文字
-	 * 
-	 * @param room
-	 * @param msg
-	 */
-	public static void sendMessage(Session session, String message) {
-		Player p = getPlayerBySessionId(session.getId());
-		if (p != null) {
-			RetMsg retMsg = new RetMsg();
-			retMsg.setMessage(message);
-			retMsg.setC("onPlayerSendMessage");
-			retMsg.setState(1);
-			String msg = JsonUtils.toJson(retMsg, RetMsg.class);
-			sendMsgToPlayerByRoom(p.getRoom(), msg);
-		}
-	}
-
-	/**
-	 * 给房间中正在游戏的玩家发送消息
-	 * 
-	 * @param room
-	 * @param msg
-	 */
-	public static void sendMsgToIngamePlayerByRoom(Room room, String msg) {
-		sendMsgToList(room.getIngamePlayers(), msg);
-	}
-
-	/**
-	 * 给房间中处于等待状态的玩家发消息
-	 * 
-	 * @param room
-	 * @param msg
-	 */
-	public static void sendMsgToWaitPlayerByRoom(Room room, String msg) {
-		sendMsgToList(room.getWaitPlayers(), msg);
-	}
-
-	/**
-	 * 给房间中的每一个玩家发消息
-	 * 
-	 * @param room
-	 * @param msg
-	 */
-	public static void sendMsgToPlayerByRoom(Room room, String msg) {
-		sendMsgToIngamePlayerByRoom(room, msg);
-		sendMsgToWaitPlayerByRoom(room, msg);
-	}
-
-	/**
-	 * 给一组玩家发消息
-	 * 
-	 * @param playerList
-	 * @param msg
-	 */
-	public static void sendMsgToList(List playerList, String msg) {
-		playerList.parallelStream().forEach(player -> sendMsgToPlayer(player, msg));
-		logger.info("toAllPlayers:" + msg);
-	}
-
-	/**
-	 * 给一个玩家发消息,批量发送调用
-	 * 
-	 * @param player
-	 * @param msg
-	 */
-	public static void sendMsgToPlayer(Player player, String msg) {
-		if (player != null && player.getSession() != null) {
-			TexasWS.sendText(player.getSession(), msg);
-		}
-	}
-
-	public static void sendMsgToOne(Player p, String msg) {
-		if (p != null) {
-			Session session = p.getSession();
-			if (session != null) {
-				TexasWS.sendText(session, msg);
-				logger.info("toOne:" + msg);
-			}
-		}
-	}
-
-	public static void sendMsgToOne(Session session, String msg) {
-		if (session != null) {
-			TexasWS.sendText(session, msg);
-			logger.info("toOne:" + msg);
-		}
-	}
-
-	public static Player getPlayerBySessionId(String sessionId) {
-		Player p = TexasStatic.loginPlayerMap.get(sessionId);
-		return p;
-	}
-
-	public static Session getSessionByPlayer(Player p) {
-		Session session = p.getSession();
-		return session;
-	}
-
-	/**
-	 * 更新下一个轮到的玩家
-	 * 
-	 * @param room
-	 * @return
-	 */
-	public static void updateNextTurn(Room room) {
-		int thisturn = room.getNextturn();
-		// TODO 特殊判断。。。
-		thisturn = getNextSeatNum(thisturn, room, true);
-		room.setNextturn(thisturn);
-	}
-
-	/**
-	 * 更新下一个轮到的玩家
-	 * 
-	 * @param clockwise 是否顺时针
-	 * @param room
-	 * @return
-	 */
-	public static void updateNextTurn(Room room, boolean clockwise) {
-		int thisturn = room.getNextturn();
-		thisturn = getNextSeatNum(thisturn, room, clockwise);
-		room.setNextturn(thisturn);
-	}
-
-	/**
-	 * 获取下一个可操作玩家的座位号
-	 * 
-	 * @param p
-	 */
-	public static int getNextSeatNum(int seatNum, Room room) {
-		int begin = seatNum;
-		while (true) {
-			seatNum = getNextNum(seatNum, room);
-			Player pi = getPlayerBySeatNum(seatNum, room.getIngamePlayers());
-			if (pi != null && !pi.isFold() && pi.getBodyChips() != 0) {
-				break;
-			}
-			// 已经循环一圈
-			if (begin == seatNum) {
-				break;
-			}
-		}
-		return seatNum;
-	}
-
-	/**
-	 * 获取下一个可操作玩家的座位号
-	 * 
-	 * @param clockwise 是否顺时针
-	 * @param p
-	 */
-	public static int getNextSeatNum(int seatNum, Room room, boolean clockwise) {
-		int begin = seatNum;
-		while (true) {
-			seatNum = getNextNum(seatNum, room, clockwise);
-			Player pi = getPlayerBySeatNum(seatNum, room.getIngamePlayers());
-			if (pi != null && !pi.isFold() && pi.getBodyChips() != 0) {
-				break;
-			}
-			// 已经循环一圈
-			if (begin == seatNum) {
-				break;
-			}
-		}
-		return seatNum;
-	}
-
-	/**
-	 * 获取下一个玩家座位号,得到下一个dealer使用
-	 * 
-	 * @param p
-	 */
-	public static int getNextSeatNumDealer(int seatNum, Room room) {
-		boolean finded = false;
-		int begin = seatNum;
-		while (!finded) {
-			seatNum = getNextNum(seatNum, room);
-			for (Player pw : room.getWaitPlayers()) {
-				if (pw.getSeatNum() == seatNum) {
-					finded = true;
-					break;
-				}
-			}
-			for (Player pi : room.getIngamePlayers()) {
-				if (pi.getSeatNum() == seatNum) {
-					finded = true;
-					break;
-				}
-			}
-			// 已经循环一圈
-			if (begin == seatNum) {
-				break;
-			}
-		}
-		return seatNum;
-	}
-
-	/**
-	 * 
-	 * 返回下一个座位号
-	 * 
-	 * @param seatNum
-	 * @param room
-	 * @return
-	 */
-	private static int getNextNum(int seatNum, Room room) {
-		int nextSeatNum = seatNum + 1;
-		if (nextSeatNum >= room.getMaxPlayers()) {
-			nextSeatNum = 0;
-		}
-		return nextSeatNum;
-	}
-
-	/**
-	 * 
-	 * 返回下一个座位号
-	 * 
-	 * @param clockwise 是否顺时针
-	 * @param seatNum
-	 * @param room
-	 * @return
-	 */
-	private static int getNextNum(int seatNum, Room room, boolean clockwise) {
-		if (clockwise) {
-			return getNextNum(seatNum, room);
-		} else {
-			int nextSeatNum = seatNum - 1;
-			if (nextSeatNum < 0) {
-				nextSeatNum = room.getMaxPlayers() - 1;
-			}
-			return nextSeatNum;
-		}
-	}
-
-	/**
-	 * 根据座位号返回玩家
-	 * 
-	 * @param seatNum
-	 * @param room
-	 * @return
-	 */
-	public static Player getPlayerBySeatNum(int seatNum, List playerList) {
-		Optional player = null;
-		player = playerList.parallelStream().filter(p -> p.getSeatNum() == seatNum).findFirst();
-		if (player.isPresent()) {
-			return player.get();
-		} else {
-			return null;
-		}
-	}
-
-	/**
-	 * 每局开始时更新下一个dealer
-	 * 
-	 * @param room
-	 * @return
-	 */
-	public static void updateNextDealer(Room room) {
-		int d = room.getDealer();
-		d = getNextSeatNumDealer(d, room);
-		room.setDealer(d);
-	}
-
-	/**
-	 * 改变玩家chips的方法
-	 * 
-	 * @param p
-	 * @param chips
-	 */
-	public static void changePlayerChips(Player p, Long chips) {
-		synchronized (p) {
-			p.setBodyChips(p.getBodyChips() + chips);
-		}
-	}
-
-	/**
-	 * 按值排序一个map
-	 * 
-	 * @param oriMap
-	 * @return
-	 */
-	public static Map sortMapByValue(Map oriMap) {
-		Map sortedMap = new LinkedHashMap();
-		if (oriMap != null && !oriMap.isEmpty()) {
-			List> entryList = new ArrayList>(oriMap.entrySet());
-			Collections.sort(entryList, new Comparator>() {
-				public int compare(Entry entry1, Entry entry2) {
-					Long value1 = 0l, value2 = 0l;
-					value1 = entry1.getValue();
-					value2 = entry2.getValue();
-					return value1.compareTo(value2);
-				}
-			});
-			Iterator> iter = entryList.iterator();
-			Map.Entry tmpEntry = null;
-			while (iter.hasNext()) {
-				tmpEntry = iter.next();
-				sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue());
-			}
-		}
-		oriMap.clear();
-		return sortedMap;
-	}
-
-	/**
-	 * 求Map中Value(值)的最大值
-	 * 
-	 * @param map
-	 * @return
-	 */
-	public static Long getMaxValue(Map map) {
-		if (map == null)
-			return null;
-		Collection c = map.values();
-		Object[] obj = c.toArray();
-		Arrays.sort(obj);
-		return (Long) obj[obj.length - 1];
-	}
-
-	/**
-	 * 进入房间
-	 * 
-	 * @param session
-	 * @param message
-	 */
-	public static void inRoom(Session session, String message) {
-		Room roomMessage = getRoomMessage(message);
-		RetMsg rm = new RetMsg();
-		rm.setC("onEnterRoom");
-		rm.setState(1);
-		Player currPlayer = getPlayerBySessionId(session.getId());
-		if (currPlayer == null) {
-			rm.setState(0);
-			String retMsg = JsonUtils.toJson(rm, RetMsg.class);
-			rm.setMessage("请先登录");
-			sendMsgToOne(currPlayer, retMsg);
-			return;
-		}
-		// 进入房间一个非机器人,则进入机器人陪玩
-		if (!currPlayer.getUsername().contains("robot")) {
-			Date now = new Date();
-			//// 创建机器人
-			RobotManager.init(RobotManager.MAX_ROBOT_COUNT);
-			Date costEnd = new Date();
-			long cost = costEnd.getTime() - now.getTime();
-			if (cost > 100) {
-				logger.error("add robot:" + message + " cost Millisecond" + cost);
-			}
-		}
-
-		// 从数据库重新更新玩家筹码
-
-		Player upPlayer = new Player();
-		upPlayer.setId(currPlayer.getId());
-		PlayerService pservice = (PlayerService) SpringUtil.getBean("playerService");
-		upPlayer = pservice.selectPlayer(upPlayer);
-		long bodyChips = currPlayer.getBodyChips();
-		long restChips = upPlayer.getChips() - bodyChips;
-		currPlayer.setChips(restChips);
-
-		Room roomConfig = RoomTypeList.roomTypeMap.get(roomMessage.getLevel());
-
-		if (currPlayer.getChips() < roomConfig.getMinChips()) {
-			rm.setState(0);
-			rm.setMessage("筹码不足");
-			String retMsg = JsonUtils.toJson(rm, RetMsg.class);
-			sendMsgToOne(currPlayer, retMsg);
-			return;
-		}
-		// 查找空房间,没有则创建新房间
-		Room usableRoom = getUsableRoomThenIn(roomMessage.getLevel(), currPlayer, roomMessage.getType());
-		PrivateRoom pRoom=new PrivateRoom();
-		pRoom.setRoom(usableRoom);
-		String roominfo = JsonUtils.toJson(pRoom, PrivateRoom.class);
-		rm.setMessage(roominfo);
-		// 通知玩家加入房间成功
-		String retMsg = JsonUtils.toJson(rm, RetMsg.class);
-		sendMsgToOne(currPlayer, retMsg);
-		// 通知所有房间内玩家,有玩家加入
-		sendPlayerToOthers(currPlayer, usableRoom, "onPlayerEnterRoom");
-		// 检查房间是否可以开始游戏,一秒等待
-		usableRoom.checkStart(800);
-	}
-
-	/**
-	 * 退出房间
-	 * 
-	 * @param session
-	 * @param message
-	 * @param sendOrNot 是否向退出房间的玩家发送退出成功消息
-	 */
-	public static void outRoom(Session session, String message, boolean sendOrNot) {
-		Player p = TexasStatic.loginPlayerMap.get(session.getId());
-
-		if (sendOrNot) {
-			// 告诉自己离开
-			RetMsg rm = new RetMsg();
-			rm.setC("onOutRoom");
-			rm.setState(1);
-			rm.setMessage(JsonUtils.toJson(p, Player.class));
-			String retMsg = JsonUtils.toJson(rm, RetMsg.class);
-			sendMsgToOne(p, retMsg);
-		}
-		// 告诉其他玩家有人离开
-		outRoom(p);
-
-	}
-
-	public static Room getRoomMessage(String message) {
-		Room room = JsonUtils.fromJson(message, Room.class);
-		return room;
-	}
-
-	/**
-	 * 向除currPlayer之外的玩家发送currPlayer玩家信息
-	 * 
-	 * @param currPlayer
-	 * @param room
-	 * @param c
-	 */
-	public static void sendPlayerToOthers(Player currPlayer, Room room, String c) {
-		String currPlayerInfo = JsonUtils.toJson(currPlayer, Player.class);
-		RetMsg rm_inRoom = new RetMsg();
-		rm_inRoom.setC(c);
-		rm_inRoom.setState(1);
-		rm_inRoom.setMessage(currPlayerInfo);
-		String inRoomMessage = JsonUtils.toJson(rm_inRoom, RetMsg.class);
-		sendMessageToOtherPlayers(currPlayer.getId(), room, inRoomMessage);
-	}
-
-	/**
-	 * 向除currPlayer之外的玩家发送message
-	 * 
-	 * @param selfId
-	 * @param room
-	 * @param message
-	 */
-	public static void sendMessageToOtherPlayers(String selfId, Room room, String message) {
-		if (room == null) {
-			return;
-		}
-		// 通知其他玩家
-		List waitPlayers = room.getWaitPlayers();
-		for (Player p : waitPlayers) {
-			if (p != null && p.getId() != selfId) {
-				Session _session = getSessionByPlayer(p);
-				TexasWS.sendText(_session, message);
-			}
-
-		}
-		List ingamePlayers = room.getIngamePlayers();
-		for (Player p : ingamePlayers) {
-			if (p != null && p.getId() != selfId) {
-				Session _session = getSessionByPlayer(p);
-				TexasWS.sendText(_session, message);
-			}
-
-		}
-	}
-}
diff --git a/src/main/java/yuelj/texas/robot/RobotManager.java b/src/main/java/yuelj/texas/robot/RobotManager.java
deleted file mode 100644
index 9bc60bb..0000000
--- a/src/main/java/yuelj/texas/robot/RobotManager.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package yuelj.texas.robot;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-public class RobotManager implements Runnable {
-	private int number;
-
-	/**
-	 * 机器人列表
-	 */
-	private static List robotClientList = new CopyOnWriteArrayList<>();
-	/**
-	 * 最多允许的机器人个数
-	 */
-	public static final int MAX_ROBOT_COUNT = 100;
-	
-	RobotManager(int number) {
-		this.number = number;
-	}
-
-	public void run() {
-		if (robotClientList.size() < MAX_ROBOT_COUNT) {
-			for (int i = 0; i < number; i++) {
-				RobotWsClient client = new RobotWsClient(true);
-				robotClientList.add(client);
-				try {
-					Thread.sleep(10l);
-				} catch (InterruptedException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
-
-	public synchronized static void init(int number) {
-		// 创建机器人线程
-		RobotManager m1 = new RobotManager(number);
-		Thread t1 = new Thread(m1);
-		t1.start();
-	}
-
-	public static void main(String[] args) {
-		RobotWsClient client = new RobotWsClient(true);
-		robotClientList.add(client);
-		try {
-			new BufferedReader(new InputStreamReader(System.in)).readLine();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-}
diff --git a/src/main/java/yuelj/texas/robot/RobotOperationsUtil.java b/src/main/java/yuelj/texas/robot/RobotOperationsUtil.java
deleted file mode 100644
index bbd1d14..0000000
--- a/src/main/java/yuelj/texas/robot/RobotOperationsUtil.java
+++ /dev/null
@@ -1,320 +0,0 @@
-package yuelj.texas.robot;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import yuelj.entity.BetPlayer;
-import yuelj.entity.Player;
-import yuelj.entity.PrivateRoom;
-import yuelj.entity.RetMsg;
-import yuelj.utils.RandomNumUtil;
-import yuelj.utils.serialize.JsonUtils;
-
-public class RobotOperationsUtil {
-	private static Logger logger = LogManager.getLogger(RobotOperationsUtil.class);
-	// 机器人账号的前缀
-	private static final String robotAccountPre = "robot";
-	// 机器人密码的前缀
-	private static final String robotAccountPasswordPre = "A0858374F309F2DFA1F46EC94DEA6EBE";
-	private static ConcurrentLinkedQueue robotAccountQueue = new ConcurrentLinkedQueue();
-	static {
-		// 初始化2000个机器人id
-		for (int i = 0; i < 2000; i++) {
-			robotAccountQueue.offer(i);
-		}
-	}
-
-	/**
-	 * 机器人注册
-	 * 
-	 * @param robotClient
-	 */
-	public static void robotRegist(RobotWsClient robotClient) {
-		RobotPlayer robotPlayer = new RobotPlayer();
-		robotPlayer.setC(0);
-		robotPlayer.setUsername(robotAccountPre + robotAccountQueue.poll());
-		robotPlayer.setUserpwd(robotAccountPasswordPre + robotPlayer.getUsername());
-		robotClient.player = robotPlayer;
-		robotClient.sendText(JsonUtils.toJson(robotPlayer, RobotPlayer.class));
-	}
-
-	/**
-	 * 机器人登陆
-	 * 
-	 * @param robotClient
-	 */
-	public static void robotLogin(RobotWsClient robotClient) {
-		RobotPlayer robotPlayer = new RobotPlayer();
-		robotPlayer.setC(1);
-		int id = robotAccountQueue.poll();
-		robotPlayer.setRobotAccountId(id);
-		robotPlayer.setUsername(robotAccountPre + id);
-		robotPlayer.setUserpwd(robotAccountPasswordPre + robotPlayer.getUsername());
-		robotPlayer.setRobotStart(new Date());
-		robotClient.player = robotPlayer;
-		robotClient.sendText(JsonUtils.toJson(robotPlayer, RobotPlayer.class));
-	}
-
-	/**
-	 * 机器人加入房间
-	 * 
-	 * @param robotClient
-	 */
-	public static void robotEntorRoom(RobotWsClient robotClient) {
-		RobotPlayer robotPlayer = new RobotPlayer();
-		robotPlayer.setC(2);
-		// 要加入的房间级别
-		robotPlayer.setLevel("0");
-		robotClient.sendText(JsonUtils.toJson(robotPlayer, RobotPlayer.class));
-	}
-
-	/**
-	 * 机器人退出
-	 * 
-	 * @param robotClient
-	 */
-	public static void robotOut(RobotWsClient robotClient) {
-		RobotPlayer robotPlayer = robotClient.player;
-		// 退出房间
-		robotPlayer.setC(3);
-		robotClient.sendText(JsonUtils.toJson(robotPlayer, RobotPlayer.class));
-		// 关闭连接
-		try {
-			robotClient.session.close();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		// 归还robotId
-		int id = robotPlayer.getRobotAccountId();
-		robotAccountQueue.offer(id);
-	}
-
-	public static void onLogin(RobotWsClient robotClient, RetMsg retMsg) {
-		// 登陆成功则加入房间
-		if (retMsg.getState() == 1) {
-			String myInfo = retMsg.getMessage();
-			robotClient.player = JsonUtils.fromJson(myInfo, RobotPlayer.class);
-			robotEntorRoom(robotClient);
-		}
-	}
-
-	public static void onEnterRoom(RobotWsClient robotClient, RetMsg retMsg) {
-		// 成功加入房间
-		if (retMsg.getState() == 1) {
-			String roominfo = retMsg.getMessage();
-			robotClient.roomInfo = JsonUtils.fromJson(roominfo, PrivateRoom.class);
-			// 设置座位号
-			for (Player p : robotClient.roomInfo.getWaitPlayers()) {
-				if (p.getId().equals(robotClient.player.getId())) {
-					robotClient.player.setSeatNum(p.getSeatNum());
-				}
-			}
-			for (Player p : robotClient.roomInfo.getIngamePlayers()) {
-				if (p.getId().equals(robotClient.player.getId())) {
-					robotClient.player.setSeatNum(p.getSeatNum());
-				}
-			}
-		}
-	}
-
-	/**
-	 * 接收开始游戏消息
-	 * 
-	 * @param robotClient
-	 * @param retMsg
-	 */
-	public static void onGameStart(RobotWsClient robotClient, RetMsg retMsg) {
-		// 游戏开始
-		if (retMsg.getState() == 1) {
-			String roomInfoStr = retMsg.getMessage();
-			PrivateRoom roomInfo = JsonUtils.fromJson(roomInfoStr, PrivateRoom.class);
-			robotClient.setRoomInfo(roomInfo);
-			// 手牌
-			robotClient.player.setHandPokers(roomInfo.getHandPokers());
-			// 身上筹码
-			for (Player p : roomInfo.getIngamePlayers()) {
-				if (p.getId().equals(robotClient.player.getId())) {
-					robotClient.player.setBodyChips(p.getBodyChips());
-				}
-			}
-			// 房间信息
-			int turn = roomInfo.getNextturn();
-			if (turn == robotClient.player.getSeatNum()) {
-				robotOpt(robotClient);
-			}
-		}
-	}
-
-	/**
-	 * 轮到某个玩家
-	 * 
-	 * @param robotClient
-	 * @param retMsg
-	 */
-	public static void onPlayerTurn(RobotWsClient robotClient, RetMsg retMsg) {
-		// 轮到某个玩家操作
-		if (retMsg.getState() == 1) {
-			// 轮到我操作
-			if (retMsg.getMessage().equals(robotClient.player.getSeatNum() + "")) {
-				robotOpt(robotClient);
-			}
-		}
-	}
-
-	/**
-	 * 有玩家下注
-	 * 
-	 * @param robotClient
-	 * @param retMsg
-	 */
-	public static void onPlayerBet(RobotWsClient robotClient, RetMsg retMsg) {
-		// 轮到某个玩家操作
-		if (retMsg.getState() == 1) {
-			BetPlayer bp = new BetPlayer();
-			bp = JsonUtils.fromJson(retMsg.getMessage(), BetPlayer.class);
-			Long oldBet = 0l;
-			if (bp == null) {
-				return;
-			}
-			if (robotClient != null && robotClient.roomInfo != null
-					&& robotClient.roomInfo.getBetRoundMap().get(bp.getSeatNum()) != null) {
-				oldBet = robotClient.roomInfo.getBetRoundMap().get(bp.getSeatNum());
-			}
-			Long chips = oldBet + bp.getInChips();
-			robotClient.getRoomInfo().getBetRoundMap().put(bp.getSeatNum(), chips);
-			// 设置本轮最大加注
-			if (chips > robotClient.getRoomInfo().getRoundMaxBet()) {
-				robotClient.getRoomInfo().setRoundMaxBet(chips.intValue());
-			}
-			for (Player p : robotClient.roomInfo.getIngamePlayers()) {
-				if (p.getSeatNum() == bp.getSeatNum()) {
-					p.setBodyChips(p.getBodyChips() - bp.getInChips());
-					break;
-				}
-			}
-		}
-	}
-
-	/**
-	 * 游戏结束时,判断自己是否该退出房间了
-	 * 
-	 * @param robotClient
-	 * @param retMsg
-	 */
-	public static void onGameEnd(RobotWsClient robotClient, RetMsg retMsg) {
-		// 当该机器人的退出时间到,则退出房间
-		if (robotClient.getLogOutTime().before(new Date())) {
-			robotOut(robotClient);
-		}
-	}
-
-	/**
-	 * 轮到机器人操作
-	 * 
-	 * @param robotClient
-	 */
-	public static void robotOpt(RobotWsClient robotClient) {
-		Random r = new Random();
-		// 思考时间,1到2秒
-		int second = r.nextInt(1) + 1;
-		try {
-			Thread.sleep(second * 1000);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		long callNeed = 0;
-		long maxBet = robotClient.getRoomInfo().getRoundMaxBet();
-		long mybet = 0;
-		long bigbet = robotClient.getRoomInfo().getBigBet();
-		// 计算call或check需要的下注
-		for (Map.Entry entry : robotClient.roomInfo.getBetRoundMap().entrySet()) {
-			if (entry.getKey().equals(robotClient.player.getSeatNum())) {
-				if (entry.getValue() != null) {
-					mybet = entry.getValue();
-				}
-			}
-		}
-		callNeed = maxBet - mybet;
-		logger.info("callNeed:" + callNeed + "maxBet:" + maxBet + "myBet:" + mybet);
-		// 获取10到99随机数
-		int randomNum = RandomNumUtil.getNextInt(2);
-		// 一定概率加注2倍bigbet
-		int followBet = (int) callNeed;
-		int addBet = (int) ((bigbet * 2 + callNeed) );
-		if (randomNum < 40 && callNeed > 0) {
-			// 一定概率fold
-			fold(robotClient);
-		} else if (randomNum < 80) {
-			if (followBet > 0) {
-				// logger.error("callNeed:" + callNeed + "maxBet:" + maxBet + "myBet:" +
-				// mybet+",followBet:"+followBet);
-				// 可以跟注,跟注
-				betChips(robotClient, followBet);
-			} else {
-				// 可以check的情况下
-				check(robotClient);
-			}
-		} else if (randomNum < 96) {
-			if (addBet > 0) {
-				// logger.error("callNeed:" + callNeed + "maxBet:" + maxBet + "myBet:" +
-				// mybet+",addBet:"+addBet);
-				betChips(robotClient, addBet);
-			} else {
-				// 可以check的情况下
-				check(robotClient);
-			}
-		} else {
-			// 一定概率allin
-			addBet = (int) robotClient.player.getBodyChips();
-			betChips(robotClient, addBet);
-		}
-	}
-
-	public static void fold(RobotWsClient robotClient) {
-		Player ret = new Player();
-		ret.setC(8);
-		robotClient.sendText(JsonUtils.toJson(ret, Player.class));
-	}
-
-	public static void check(RobotWsClient robotClient) {
-		Player ret = new Player();
-		ret.setC(6);
-		robotClient.sendText(JsonUtils.toJson(ret, Player.class));
-	}
-
-	/**
-	 * 下注
-	 * 
-	 * @param robotClient
-	 * @param chips
-	 */
-	public static void betChips(RobotWsClient robotClient, int chips) {
-		// 当call需要的值大于身上携带
-		if (chips > robotClient.player.getBodyChips()) {
-			logger.info("chips > robotClient.player.getBodyChips()  getBodyChips:" + robotClient.player.getBodyChips()
-					+ "chips" + chips);
-			chips = (int) robotClient.player.getBodyChips();
-		}
-		// 下注时减少自己身上的筹码
-		int leftChips = (int) (robotClient.player.getBodyChips() - chips);
-		robotClient.player.setBodyChips(leftChips);
-		Player ret = new Player();
-		ret.setC(7);
-		ret.setInChips(chips);
-		robotClient.sendText(JsonUtils.toJson(ret, Player.class));
-	}
-
-	public static void main(String[] args) {
-		// 机器人注册
-		for (int i = 0; i < 2000; i++) {
-			RobotWsClient client = new RobotWsClient(false);
-			robotRegist(client);
-		}
-	}
-}
diff --git a/src/main/java/yuelj/texas/robot/RobotPlayer.java b/src/main/java/yuelj/texas/robot/RobotPlayer.java
deleted file mode 100644
index 2275fa6..0000000
--- a/src/main/java/yuelj/texas/robot/RobotPlayer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package yuelj.texas.robot;
-
-import java.util.Date;
-
-import com.google.gson.annotations.Expose;
-
-import yuelj.entity.BetPlayer;
-
-public class RobotPlayer extends BetPlayer {
-	private static final long serialVersionUID = 8177609408282689534L;
-	/**
-	 * 账号
-	 */
-	@Expose
-	private String username;
-
-	/**
-	 * 要加入的房间级别
-	 */
-	@Expose
-	private String level;
-
-	/**
-	 * 用户密码
-	 */
-	@Expose
-	private String userpwd;
-	/**
-	 * 从ConcurrentLinkedQueue robotAccount拿出的id
-	 */
-	private int robotAccountId;
-	/**
-	 * 机器人开始上线时间
-	 */
-	private Date robotStart;
-
-	/**
-	 * 是否已经弃牌
-	 */
-	@Expose
-	private boolean isFold = true;
-	/**
-	 * 手牌
-	 */
-	private int[] handPokers;
-
-	public String getUsername() {
-		return username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-	public boolean isFold() {
-		return isFold;
-	}
-
-	public void setFold(boolean isFold) {
-		this.isFold = isFold;
-	}
-
-	public int[] getHandPokers() {
-		return handPokers;
-	}
-
-	public void setHandPokers(int[] handPokers) {
-		this.handPokers = handPokers;
-	}
-
-	public Date getRobotStart() {
-		return robotStart;
-	}
-
-	public void setRobotStart(Date robotStart) {
-		this.robotStart = robotStart;
-	}
-
-	public int getRobotAccountId() {
-		return robotAccountId;
-	}
-
-	public void setRobotAccountId(int robotAccountId) {
-		this.robotAccountId = robotAccountId;
-	}
-
-	public String getUserpwd() {
-		return userpwd;
-	}
-
-	public void setUserpwd(String userpwd) {
-		this.userpwd = userpwd;
-	}
-
-	public String getLevel() {
-		return level;
-	}
-
-	public void setLevel(String level) {
-		this.level = level;
-	}
-
-}
diff --git a/src/main/java/yuelj/texas/robot/RobotWsClient.java b/src/main/java/yuelj/texas/robot/RobotWsClient.java
deleted file mode 100644
index 8fb23be..0000000
--- a/src/main/java/yuelj/texas/robot/RobotWsClient.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package yuelj.texas.robot;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
-import java.util.Random;
-
-import javax.websocket.ClientEndpoint;
-import javax.websocket.ContainerProvider;
-import javax.websocket.OnError;
-import javax.websocket.OnMessage;
-import javax.websocket.OnOpen;
-import javax.websocket.Session;
-import javax.websocket.WebSocketContainer;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import yuelj.entity.PrivateRoom;
-import yuelj.entity.RetMsg;
-import yuelj.utils.serialize.JsonUtils;
-
-@ClientEndpoint
-public class RobotWsClient {
-	private Logger logger = LogManager.getLogger(RobotWsClient.class);
-	// 缓冲区最大大小
-	static final int maxSize = 4 * 1024;// ;// 1K
-	static final String urlServer = "ws://127.0.0.1:8080/texas/ws/texas";
-	private static URI uri;
-	static {
-		try {
-			uri = new URI(urlServer);
-		} catch (URISyntaxException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	public Session session;
-	public RobotPlayer player;
-	public PrivateRoom roomInfo;
-	//设定机器人的退出时间为1到15分钟随机
-	Random random = new Random();
-	public Date logOutTime = new Date(new Date().getTime() + random.nextInt(15) * 60 * 1000l);
-
-	public boolean loginOnConnect;
-
-	public RobotWsClient(boolean loginOnConnect) {
-		this.loginOnConnect = loginOnConnect;
-		try {
-			// 获取WebSocket连接器,
-			WebSocketContainer container = ContainerProvider.getWebSocketContainer();
-			// 连接会话
-			session = container.connectToServer(this, uri);// 可以缓冲的传入二进制消息的最大长度
-			session.setMaxBinaryMessageBufferSize(maxSize);
-			// 可以缓冲的传入文本消息的最大长度
-			session.setMaxTextMessageBufferSize(maxSize);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	public void sendText(String message) {
-		// 发送文本消息
-		try {
-			session.getBasicRemote().sendText(message);
-		} catch (java.lang.IllegalStateException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	@OnOpen
-	public void onOpen(Session session) {
-		this.session = session;
-		logger.info("Robot Connected to endpoint: " + session.getBasicRemote());
-		if (loginOnConnect) {
-			RobotOperationsUtil.robotLogin(this);
-		}
-	}
-
-	@OnMessage
-	public void onMessage(String message) {
-		try {
-			RetMsg retMsg = JsonUtils.fromJson(message, RetMsg.class);
-			if (retMsg.getC().equals("onLogin")) {
-				RobotOperationsUtil.onLogin(this, retMsg);
-			}
-			if (retMsg.getC().equals("onEnterRoom")) {
-				RobotOperationsUtil.onEnterRoom(this, retMsg);
-			}
-			if (retMsg.getC().equals("onGameStart")) {
-				RobotOperationsUtil.onGameStart(this, retMsg);
-			}
-			if (retMsg.getC().equals("onPlayerTurn")) {
-				RobotOperationsUtil.onPlayerTurn(this, retMsg);
-			}
-			if (retMsg.getC().equals("onPlayerBet")) {
-				RobotOperationsUtil.onPlayerBet(this, retMsg);
-			}
-			if (retMsg.getC().equals("onGameEnd")) {
-				RobotOperationsUtil.onGameEnd(this, retMsg);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@OnError
-	public void onError(Throwable e) {
-		e.printStackTrace();
-	}
-
-	public PrivateRoom getRoomInfo() {
-		return roomInfo;
-	}
-
-	public void setRoomInfo(PrivateRoom roomInfo) {
-		this.roomInfo = roomInfo;
-	}
-
-	public Session getSession() {
-		return session;
-	}
-
-	public void setSession(Session session) {
-		this.session = session;
-	}
-
-	public RobotPlayer getPlayer() {
-		return player;
-	}
-
-	public void setPlayer(RobotPlayer player) {
-		this.player = player;
-	}
-
-	public boolean isLoginOnConnect() {
-		return loginOnConnect;
-	}
-
-	public void setLoginOnConnect(boolean loginOnConnect) {
-		this.loginOnConnect = loginOnConnect;
-	}
-
-	public Date getLogOutTime() {
-		return logOutTime;
-	}
-
-	public void setLogOutTime(Date logOutTime) {
-		this.logOutTime = logOutTime;
-	}
-}
diff --git a/src/main/java/yuelj/texas/threeCard/ThreeCardRoom.java b/src/main/java/yuelj/texas/threeCard/ThreeCardRoom.java
deleted file mode 100644
index b77cca2..0000000
--- a/src/main/java/yuelj/texas/threeCard/ThreeCardRoom.java
+++ /dev/null
@@ -1,602 +0,0 @@
-package yuelj.texas.threeCard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import com.google.gson.Gson;
-import com.google.gson.annotations.Expose;
-
-import yuelj.cardUtils.CardGroup;
-import yuelj.entity.BetPlayer;
-import yuelj.entity.GameLog;
-import yuelj.entity.Player;
-import yuelj.entity.PlayerOpt;
-import yuelj.entity.PlayerPrivate;
-import yuelj.entity.PrivateRoom;
-import yuelj.entity.RetMsg;
-import yuelj.service.GameLogService;
-import yuelj.service.PlayerService;
-import yuelj.service.impl.LobbyServiceImpl;
-import yuelj.texas.BetPool;
-import yuelj.texas.Room;
-import yuelj.texas.TexasUtil;
-import yuelj.utils.SpringUtil;
-import yuelj.utils.dateTime.DateUtil;
-import yuelj.utils.serialize.JsonUtils;
-
-public class ThreeCardRoom extends Room {
-	private static Logger logger = LogManager.getLogger(ThreeCardRoom.class);
-	/**
-	 * 初始锅底,回收的筹码
-	 */
-	@Expose
-	private int tableFeeBet;
-	/**
-	 * 2倍大下注,例如:5,10,20中的20
-	 */
-	@Expose
-	private int doubleBigBet;
-	/**
-	 * 小暗注
-	 */
-	@Expose
-	private int smallBlindBet;
-	/**
-	 * 大暗注
-	 */
-	@Expose
-	private int bigBlindBet;
-	/**
-	 * 2倍大暗注
-	 */
-	@Expose
-	private int doubleBigBlindBet;
-	/**
-	 * 在结束前不发送的手牌
-	 */
-	protected Map> handCardsMapPrivate = new HashMap>();
-
-	/**
-	 * 
-	 * 开始游戏
-	 * 
-	 * 
-	 * 游戏状态变更为游戏中,等待中的玩家移动到游戏中列表
-	 * 
-	 * @param room
-	 */
-	@Override
-	public void startGame() {
-		// 本轮最大下注初始为1倍下注基数
-		roundMaxBet = 1;
-		// 总筹码不足500的不能进行游戏,踢出房间
-		getWaitPlayers().parallelStream().filter(p -> p.getBodyChips() < 500).forEach(p -> {
-			TexasUtil.outRoom(p.getSession(), "", true);
-		});
-		if (getWaitPlayers().size() < this.getMinPlayers()) {
-			return;
-		}
-		if (this.getGamestate().compareAndSet(0, 1)) {
-			// 游戏日志-玩家操作信息
-			opts = new ArrayList();
-			// 由于需要通知在结束阶段进入的玩家牌局信息
-			handCardsMap.clear();
-			winPlayersMap.clear();
-			for (Player p : getWaitPlayers()) {
-				// 清除下注次数
-				p.setBetTimes(0);
-				// 重新补筹码
-				if (p.getBodyChips() != this.getMaxChips()) {
-					assignChipsToRoomMax(p);
-				}
-			}
-			// 转移等待列表的玩家进入游戏中玩家列表
-			TexasUtil.movePlayers(this.getWaitPlayers(), this.getIngamePlayers());
-			// 记录玩家座位号
-			for (Player p : getIngamePlayers()) {
-				// 设定为未弃牌
-				p.setFold(false);
-				// 看牌标志重置
-				p.setLook(false);
-				// 所有玩家下锅底
-				betchipIn(p, tableFeeBet, false);
-			}
-			// 得到一副洗好的牌(随机卡组)
-			this.setCardList(CardGroup.getRandomCards());
-			// 最佳位置
-			int dealer = getDealer();
-			// 更新下一个该操作的玩家
-			nextturn = TexasUtil.getNextSeatNum(dealer, this, false);
-			// 分发手牌
-			ThreeCardsUtil.assignHandPokerByRoom(this);
-			// 通知房间中在游戏中的玩家此刻的房间信息
-			for (Player p : getIngamePlayers()) {
-				PrivateRoom pRoom = new PrivateRoom();
-				pRoom.setRoom(this);
-				String msg = JsonUtils.toJson(pRoom, PrivateRoom.class);
-				RetMsg retMsg = new RetMsg();
-				retMsg.setC("onGameStart");
-				retMsg.setState(1);
-				retMsg.setMessage(msg);
-				TexasUtil.sendMsgToOne(p, JsonUtils.toJson(retMsg, RetMsg.class));
-			}
-			startTimer(this);// 开始计时
-			// 游戏日志
-			this.gameLog = new GameLog();
-			this.gameLog.setStartTime(DateUtil.nowDatetime());
-			List listtype = new ArrayList();
-			for (Player p : this.getIngamePlayers()) {
-				PlayerPrivate pp = new PlayerPrivate();
-				pp.setId(p.getId());
-				pp.setBodyChips(p.getBodyChips());
-				pp.setChips(p.getChips());
-				pp.setSeatNum(p.getSeatNum());
-				pp.setHandPokers(p.getHandPokers());
-				pp.setUsername(p.getUsername());
-				listtype.add(pp);
-			}
-			String initInfo = JsonUtils.toJson(listtype, listtype.getClass());
-			this.gameLog.setPlayersInitInfo(initInfo);
-			this.gameLog.setRoomLevel(this.getLevel());
-			this.gameLog.setRoomType("拼三张普通场");
-			this.gameLog.setDealer(JsonUtils.toJson(TexasUtil.getPlayerBySeatNum(dealer, this.getIngamePlayers()), Player.class));
-		}
-	}
-
-	/**
-	 * 下注
-	 * 
-	 * @param player
-	 *            下注的玩家
-	 * @param chip
-	 *            下注的筹码
-	 * @param palyerOpt
-	 *            认为玩家操作过true
-	 */
-	@Override
-	public boolean betchipIn(Player player, int chip, boolean playerOpt) {
-		// 房间状态游戏中
-		if (player.getRoom().getGamestate().get() != 1) {
-			return false;
-		}
-		Room thisRoom = player.getRoom();
-
-		PlayerOpt opt = new PlayerOpt();
-		opt.setOptChips(chip);
-		opt.setOptTime(DateUtil.nowDatetime());
-		opt.setOptType("betchipIn");// 操作类型(跟注、加注、弃牌、全下)
-		opt.setRemark("");// 备注
-		opt.setPlayerId(player.getId());
-		opt.setSeatNum(player.getSeatNum());
-		opts.add(opt);
-
-		if (playerOpt && player.getSeatNum() != nextturn) {
-			return false;
-		}
-		// 玩家是否看过牌
-		boolean lookCard = true;
-		synchronized (player) {
-			lookCard = player.isLook();
-		}
-		// 玩家此次操作之前的本轮下注额
-		long oldBetThisRound = 0;
-		if (thisRoom.getBetRoundMap().get(player.getSeatNum()) != null) {
-			oldBetThisRound = thisRoom.getBetRoundMap().get(player.getSeatNum());
-		}
-		if (playerOpt) {
-			// 无效下注额,筹码不足
-			if (chip <= 0 || chip > player.getBodyChips()) {
-				logger.info("not enough chips:" + chip + " getBodyChips():" + player.getBodyChips());
-				return false;
-			}
-			int betBase = 0;
-			// 看牌下注基数和暗牌下注基数不同
-			if (lookCard) {
-				betBase = this.getSmallBet();
-			} else {
-				betBase = this.getSmallBlindBet();
-			}
-			// 不能小于之前下注倍数
-			if (chip / betBase < thisRoom.getRoundMaxBet()) {
-				logger.info("< getRoundMaxBet() chip:" + chip + "oldBetThisRound:" + oldBetThisRound + " max:"
-						+ thisRoom.getRoundMaxBet());
-				return false;
-			}
-			// 下注必须是最小基数的整数倍
-			if (chip % betBase != 0) {
-				logger.info("% betBase != 0:" + chip + "betBase:" + betBase);
-				return false;
-			}
-
-			// 设置本轮最大加注是基础加注的倍数
-			if (chip / betBase > thisRoom.getRoundMaxBet()) {
-				thisRoom.setRoundMaxBet(chip / betBase);
-			}
-		}
-		if (playerOpt) {
-			cancelTimer();// 检测到玩家操作,计时取消
-		}
-		// 总奖池
-		thisRoom.setBetAmount(getBetAmount() + chip);
-		// 刷新下注列表
-		Long beforeBet = 0l;
-		if (thisRoom.getBetMap().get(player.getSeatNum()) != null) {
-			beforeBet = thisRoom.getBetMap().get(player.getSeatNum());
-		}
-		// 加入玩家总下注map
-		thisRoom.getBetMap().put(player.getSeatNum(), beforeBet + chip);
-		// 加入玩家本轮下注
-		thisRoom.getBetRoundMap().put(player.getSeatNum(), chip + oldBetThisRound);
-		// 筹码入池,所带筹码扣除
-		player.setBodyChips(player.getBodyChips() - chip);
-
-		if (playerOpt) {
-			BetPlayer bp = new BetPlayer();
-			bp.setBodyChips(player.getBodyChips());
-			bp.setInChips(chip);
-			bp.setSeatNum(player.getSeatNum());
-			String message = JsonUtils.toJson(bp, BetPlayer.class);
-			RetMsg retMsg = new RetMsg();
-			retMsg.setC("onPlayerBet");// 告诉前台有玩家下注了
-			retMsg.setState(1);
-			retMsg.setMessage(message);
-			String msg = JsonUtils.toJson(retMsg, RetMsg.class);
-			// 通知房间中玩家有人下注了
-			TexasUtil.sendMsgToPlayerByRoom(thisRoom, msg);
-			// 判断下一步是否round结束,endgame或下个玩家操作nextturn
-			endRoundOrNextTurn();
-		}
-		player.setBetTimes(player.getBetTimes() + 1);
-		return true;
-	}
-
-	/**
-	 * 玩家比牌下注
-	 * 
-	 * @param player
-	 * @param chip
-	 * @return
-	 */
-	public boolean betCompareCard(Player player, int chip) {
-		// 房间状态游戏中
-		if (player.getRoom().getGamestate().get() != 1) {
-			return false;
-		}
-		Room thisRoom = player.getRoom();
-
-		PlayerOpt opt = new PlayerOpt();
-		opt.setOptChips(chip);
-		opt.setOptTime(DateUtil.nowDatetime());
-		opt.setOptType("betCompareCard");// 操作类型(跟注、加注、弃牌、比牌下注)
-		opt.setRemark("");// 备注
-		opt.setPlayerId(player.getId());
-		opt.setSeatNum(player.getSeatNum());
-		opts.add(opt);
-
-		if (player.getSeatNum() != nextturn) {
-			return false;
-		}
-		// 玩家是否看过牌
-		boolean lookCard = true;
-		synchronized (player) {
-			lookCard = player.isLook();
-		}
-		// 玩家此次操作之前的本轮下注额
-		long oldBetThisRound = 0;
-		if (thisRoom.getBetRoundMap().get(player.getSeatNum()) != null) {
-			oldBetThisRound = thisRoom.getBetRoundMap().get(player.getSeatNum());
-		}
-
-		// 无效下注额,筹码不足
-		if (chip <= 0 || chip > player.getBodyChips()) {
-			logger.info("not enough chips:" + chip + " getBodyChips():" + player.getBodyChips());
-			return false;
-		}
-		// 检测到玩家操作,计时取消
-		cancelTimer();
-		boolean fold = false;
-		synchronized (player) {
-			// 判斷是否弃牌
-			fold = player.isFold();
-		}
-		if (fold) {
-			return false;
-		}
-		int betBase = 0;
-		// 看牌下注基数和暗牌下注基数不同
-		if (lookCard) {
-			betBase = this.getSmallBet();
-		} else {
-			betBase = this.getSmallBlindBet();
-		}
-		// 设置本轮最大加注是基础加注的倍数
-		if (chip / betBase > thisRoom.getRoundMaxBet()) {
-			thisRoom.setRoundMaxBet(chip / betBase);
-		}
-		// 总奖池
-		thisRoom.setBetAmount(getBetAmount() + chip);
-		// 刷新下注列表
-		Long beforeBet = 0l;
-		if (thisRoom.getBetMap().get(player.getSeatNum()) != null) {
-			beforeBet = thisRoom.getBetMap().get(player.getSeatNum());
-		}
-		// 加入玩家总下注map
-		thisRoom.getBetMap().put(player.getSeatNum(), beforeBet + chip);
-		// 加入玩家本轮下注
-		thisRoom.getBetRoundMap().put(player.getSeatNum(), chip + oldBetThisRound);
-		// 筹码入池,所带筹码扣除
-		player.setBodyChips(player.getBodyChips() - chip);
-
-		// 通知
-		BetPlayer bp = new BetPlayer();
-		bp.setBodyChips(player.getBodyChips());
-		bp.setInChips(chip);
-		bp.setSeatNum(player.getSeatNum());
-		String message = JsonUtils.toJson(bp, BetPlayer.class);
-		RetMsg retMsg = new RetMsg();
-		retMsg.setC("onPlayerBet");// 告诉前台有玩家下注了
-		retMsg.setState(1);
-		retMsg.setMessage(message);
-		String msg = JsonUtils.toJson(retMsg, RetMsg.class);
-		// 通知房间中玩家有人下注了
-		TexasUtil.sendMsgToPlayerByRoom(thisRoom, msg);
-		// 下注次数加一
-		player.setBetTimes(player.getBetTimes() + 1);
-		return true;
-	}
-
-	/**
-	 * 判断下一步是否round结束,endgame或下个玩家操作nextturn
-	 */
-	public void endRoundOrNextTurn() {
-		// 判断是否可以结束本轮
-		boolean roundEnd = checkRoundEnd();
-		if (!roundEnd) {
-			// 更新nextturn
-			TexasUtil.updateNextTurn(this, false);
-			// 发送轮到某玩家操作的消息
-			sendNextTurnMessage();
-		}
-	}
-
-	/**
-	 * 判断本轮是否可以结束
-	 */
-	@Override
-	public boolean checkRoundEnd() {
-		// 判断本轮是否可以结束
-		boolean canEndRound = false;
-		if (getIngamePlayers().size() == 1) {
-			// 结算游戏
-			logger.info("threeCard only one IngamePlayers endgame start");
-			endGame();
-			return true;
-		}
-		// 如果下一个可以操作的玩家无法更新,游戏结束
-		int turn = TexasUtil.getNextSeatNum(nextturn, this, false);
-		if (turn == nextturn) {
-			canEndRound = true;
-		}
-		if (canEndRound) {
-			// 结算游戏
-			endGame();
-		}
-		return canEndRound;
-	}
-
-	/**
-	 * 结束游戏
-	 * 
-	 * 
-	 * 游戏状态变更为等待,游戏中的玩家移动到等待列表
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	@Override
-	public void endGame() {
-		// 尝试更新游戏状态为2:结算中
-		if (this.getGamestate().compareAndSet(1, 2)) {
-			long cut = 0;// 本局游戏的系统抽成筹码
-			logger.info("endGame begin");
-			// 手牌列表
-			for (Player p : getIngamePlayers()) {
-				List hankPoker = new ArrayList();
-				for (int i = 0; i < p.getHandPokers().length; i++) {
-					hankPoker.add(p.getHandPokers()[i]);
-				}
-				handCardsMapPrivate.put(p.getSeatNum(), hankPoker);
-			}
-			// 加入互相可见的手牌列表
-			handCardsMap = handCardsMapPrivate;
-			// 奖池
-			BetPool betPool = new BetPool();
-			long betSum = 0;
-			for (Entry e : betMap.entrySet()) {
-				if (e.getValue() != 0) {
-					// 每个人下注,减去台费
-					betSum = betSum + e.getValue() - tableFeeBet;
-					cut = cut + tableFeeBet;
-				}
-			}
-			betPool.setBetSum(betSum);
-			// 获胜玩家列表
-			Player winPlayer = null;
-			// 最后剩余的一个玩家是胜者
-			if (getIngamePlayers().size() > 0) {
-				winPlayer = getIngamePlayers().get(0);
-			}
-			if (winPlayer != null) {
-				Long win = 0l;
-				// 获胜的玩家分筹码
-				win = (Long) (betPool.getBetSum());
-				// 给玩家加筹码
-				TexasUtil.changePlayerChips(winPlayer, win);
-				// 加入获胜列表
-				winPlayersMap.put(winPlayer.getSeatNum(), win);
-				// 更新下一局庄家为本次获胜玩家
-				this.setDealer(winPlayer.getSeatNum());
-				// 更新排行榜
-				LobbyServiceImpl.updateRankList(winPlayer);
-				logger.info("winPlayersMap.put :" + winPlayer.getSeatNum() + " thisPoolWin:" + win);
-
-				// 游戏日志
-				this.gameLog.setEndTime(DateUtil.nowDatetime());
-				String finalInfo = JsonUtils.toJson(this.getIngamePlayers(), this.getIngamePlayers().getClass());
-				this.gameLog.setPlayersFinalInfo(finalInfo);
-				String comCards = JsonUtils.toJson(this.getCommunityCards(), this.getCommunityCards().getClass());
-				this.gameLog.setCommunityCards(comCards);
-				this.gameLog.setCountBetpool(this.getBetAmount());
-				this.gameLog.setBetpoolInfo(JsonUtils.toJson(betPool, betPool.getClass()));
-				this.gameLog.setCut(cut);
-				Gson gson = new Gson();
-				this.gameLog.setRoundInfo(gson.toJson(opts));
-			}
-			// 发送结算消息给玩家
-			String msg = JsonUtils.toJson(this, Room.class);
-			RetMsg retMsg = new RetMsg();
-			retMsg.setC("onGameEnd");
-			retMsg.setState(1);
-			retMsg.setMessage(msg);
-			TexasUtil.sendMsgToPlayerByRoom(this, JsonUtils.toJson(retMsg, RetMsg.class));
-			// 清除本局状态信息
-			betMap.clear();
-			// 清除betRoundMap
-			betRoundMap.clear();
-			// 清除每轮最大加注
-			roundMaxBet = 0;
-			// 清除手牌
-			for (Player p : ingamePlayers) {
-				p.setHandPokers(null);
-			}
-			// 清除总下注
-			betAmount = 0;
-			// 清除公共牌
-			communityCards.clear();
-			// 清除牌堆
-			cardList.clear();
-			// 更新玩家筹码数到数据库
-			PlayerService pservice = (PlayerService) SpringUtil.getBean("playerService");
-			logger.info("updatePlayer ingamePlayers begin size:" + ingamePlayers.size());
-
-			// 将玩家都移入等待列表
-			TexasUtil.movePlayers(getIngamePlayers(), getWaitPlayers());
-			for (Player p : getWaitPlayers()) {
-				Player playerData = new Player();
-				playerData.setId(p.getId());
-				synchronized (p) {
-					// 当前筹码数等于桌上筹码+身上筹码
-					playerData.setChips(p.getChips() + p.getBodyChips());
-					pservice.updatePlayer(playerData);
-				}
-				logger.info(
-						"updatePlayer ingamePlayers begin p:" + p.getUsername() + " chips:" + playerData.getChips());
-			}
-			// 记录游戏日志
-			GameLogService gameLogService = (GameLogService) SpringUtil.getBean("gameLogService");
-			gameLogService.insertGameLog(this.gameLog);
-			// 尝试更新游戏状态为0:等待开始
-			this.getGamestate().compareAndSet(2, 0);
-			try {
-				// 等待一段时间
-				Thread.sleep(getRestBetweenGame());
-				// 判断是否可以开始下一局
-				checkStart(1000);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-
-		}
-	}
-
-	/**
-	 * 玩家比牌失败
-	 * 
-	 * @param player
-	 */
-	public void loseCompareCards(Player player) {
-		// 弃牌
-		player.setFold(true);
-		// 发送比牌输给玩家
-		String msg = JsonUtils.toJson(player, Player.class);
-		RetMsg retMsg = new RetMsg();
-		retMsg.setC("onPlayerLoseCompare");
-		retMsg.setState(1);
-		retMsg.setMessage(msg);
-		TexasUtil.sendMsgToPlayerByRoom(this, JsonUtils.toJson(retMsg, RetMsg.class));
-		// 将玩家移动到等待列表
-		TexasUtil.removeIngamePlayer(player);
-		getWaitPlayers().add(player);
-
-		// 加入互相可见的手牌列表
-		handCardsMapPrivate.put(player.getSeatNum(),
-				Arrays.stream(player.getHandPokers()).boxed().collect(Collectors.toList()));
-
-		//日志记录
-		PlayerOpt opt = new PlayerOpt();
-		opt.setOptTime(DateUtil.nowDatetime());
-		opt.setOptType("loseCompare");// 操作类型(跟注、加注、弃牌、比牌败)
-		opt.setRemark("");// 备注
-		opt.setPlayerId(player.getId());
-		opt.setSeatNum(player.getSeatNum());
-		opts.add(opt);
-		// 判断下一步是否round结束,endgame或下个玩家操作nextturn
-		endRoundOrNextTurn();
-	}
-
-	public int getSmallBlindBet() {
-		return smallBlindBet;
-	}
-
-	public void setSmallBlindBet(int smallBlindBet) {
-		this.smallBlindBet = smallBlindBet;
-	}
-
-	public int getBigBlindBet() {
-		return bigBlindBet;
-	}
-
-	public void setBigBlindBet(int bigBlindBet) {
-		this.bigBlindBet = bigBlindBet;
-	}
-
-	public int getDoubleBigBlindBet() {
-		return doubleBigBlindBet;
-	}
-
-	public void setDoubleBigBlindBet(int doubleBigBlindBet) {
-		this.doubleBigBlindBet = doubleBigBlindBet;
-	}
-
-	public int getDoubleBigBet() {
-		return doubleBigBet;
-	}
-
-	public void setDoubleBigBet(int doubleBigBet) {
-		this.doubleBigBet = doubleBigBet;
-	}
-
-	public int getTableFeeBet() {
-		return tableFeeBet;
-	}
-
-	public void setTableFeeBet(int tableFeeBet) {
-		this.tableFeeBet = tableFeeBet;
-	}
-
-	public Map> getHandCardsMapPrivate() {
-		return handCardsMapPrivate;
-	}
-
-	public void setHandCardsMapPrivate(Map> handCardsMapPrivate) {
-		this.handCardsMapPrivate = handCardsMapPrivate;
-	}
-}
diff --git a/src/main/java/yuelj/texas/threeCard/ThreeCardsUtil.java b/src/main/java/yuelj/texas/threeCard/ThreeCardsUtil.java
deleted file mode 100644
index 2436033..0000000
--- a/src/main/java/yuelj/texas/threeCard/ThreeCardsUtil.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package yuelj.texas.threeCard;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.websocket.Session;
-
-import yuelj.cardUtils.ThreeCardCompareUtil;
-import yuelj.entity.Player;
-import yuelj.entity.PrivateRoom;
-import yuelj.entity.RetMsg;
-import yuelj.texas.Room;
-import yuelj.texas.TexasUtil;
-import yuelj.utils.serialize.JsonUtils;
-
-/**
- * 欢乐拼三张工具类
- * 
- * @author ausu
- *
- */
-public class ThreeCardsUtil {
-
-	/**
-	 * 看自己的手牌
-	 * 
-	 * @param session
-	 * @param message
-	 */
-	public static void lookCards(Session session, String message) {
-		Player currPlayer = TexasUtil.getPlayerBySessionId(session.getId());
-		// 判断是否轮到当前玩家操作
-		if (currPlayer == null || currPlayer.getRoom() == null
-				|| currPlayer.getSeatNum() != currPlayer.getRoom().getNextturn()) {
-			return;
-		}
-		if (currPlayer.getRoom().getGamestate().get() != 1) {
-			return;
-		}
-		synchronized (currPlayer) {
-			// 设置已看牌
-			currPlayer.setLook(true);
-			// 私有房间信息(手牌)
-			PrivateRoom pRoom = new PrivateRoom();
-			pRoom.setRoom(currPlayer.getRoom());
-			pRoom.setHandPokers(currPlayer.getHandPokers());
-			String msg = JsonUtils.toJson(pRoom, PrivateRoom.class);
-			RetMsg rm = new RetMsg();
-			rm.setC("onLookCards");
-			rm.setState(1);
-			rm.setMessage(msg);
-			// 发送玩家私有信息,手牌
-			String retMsg = JsonUtils.toJson(rm, RetMsg.class);
-			TexasUtil.sendMsgToOne(currPlayer, retMsg);
-			// 通知所有房间内玩家,有玩家看牌
-			TexasUtil.sendPlayerToOthers(currPlayer, currPlayer.getRoom(), "onPlayerLookCards");
-		}
-	}
-
-	/**
-	 * 比牌,和下家比牌 如果只剩余2个玩家,则比牌并结束游戏
-	 * 
-	 * @param session
-	 * @param message
-	 */
-	public static void compareCards(Session session, String message) {
-		Player currPlayer = TexasUtil.getPlayerBySessionId(session.getId());
-		// 判断是否轮到自己
-		if (currPlayer == null || currPlayer.getRoom() == null
-				|| currPlayer.getSeatNum() != currPlayer.getRoom().getNextturn()) {
-			return;
-		}
-		if (currPlayer.getRoom().getGamestate().get() != 1) {
-			return;
-		}
-		ThreeCardRoom room = (ThreeCardRoom) currPlayer.getRoom();
-		int betBase = 0;
-		// 看牌下注基数和暗牌下注基数不同
-		if (currPlayer.isLook()) {
-			betBase = room.getSmallBet();
-		} else {
-			betBase = room.getSmallBlindBet();
-		}
-		// 比牌所需筹码
-		int chip = room.getRoundMaxBet() * betBase;
-		// 帮玩家下比牌所需筹码
-		boolean success = room.betCompareCard(currPlayer, chip);
-		if (!success) {
-			return;
-		}
-		int nextPlayerSeatNum = TexasUtil.getNextSeatNum(currPlayer.getSeatNum(), currPlayer.getRoom(), false);
-		Player nextPlayer = TexasUtil.getPlayerBySeatNum(nextPlayerSeatNum, currPlayer.getRoom().getIngamePlayers());
-		// 判断和下家哪个人牌大
-		List listnew = Arrays.stream(currPlayer.getHandPokers()).boxed().collect(Collectors.toList());
-		List listold = Arrays.stream(nextPlayer.getHandPokers()).boxed().collect(Collectors.toList());
-		int result = ThreeCardCompareUtil.compareValue(listnew, listold);
-		Player losePlayer = currPlayer;
-		if (result == 1) {
-			losePlayer = nextPlayer;
-		}
-		// 牌小的自动弃牌出局
-		room.loseCompareCards(losePlayer);
-	}
-
-	/**
-	 * 为房间中正在游戏的玩家分配手牌
-	 * 
-	 * @param room
-	 * @param player
-	 */
-	public static void assignHandPokerByRoom(Room room) {
-		List cardList = room.getCardList();
-		for (Player p : room.getIngamePlayers()) {
-			List pCards = cardList.subList(0, 3);
-			pCards = ThreeCardCompareUtil.getCardsGroupType(pCards);
-			// 三张牌和牌型
-			int[] hankPoker = { pCards.get(0), pCards.get(1), pCards.get(2), pCards.get(3) };
-			cardList.remove(0);
-			cardList.remove(0);
-			cardList.remove(0);
-			// 玩家手牌
-			p.setHandPokers(hankPoker);
-		}
-	}
-}
diff --git a/src/main/java/yuelj/utils/HttpTool.java b/src/main/java/yuelj/utils/HttpTool.java
deleted file mode 100644
index 688916a..0000000
--- a/src/main/java/yuelj/utils/HttpTool.java
+++ /dev/null
@@ -1,418 +0,0 @@
-package yuelj.utils;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-public final class HttpTool {
-	private static Logger logger = LogManager.getLogger(HttpTool.class);
-
-	public static String doPostHttp(String reqUrl, Map parameters) {
-		HttpURLConnection urlConn = null;
-		try {
-			urlConn = sendPostHttp(reqUrl, parameters);
-			String responseContent = getContentHttp(urlConn);
-			return responseContent.trim();
-		} finally {
-			if (urlConn != null) {
-				urlConn.disconnect();
-				urlConn = null;
-			}
-		}
-	}
-
-	public static String doPostHttps(String reqUrl, Map parameters) {
-		HttpsURLConnection urlConn = null;
-		try {
-			urlConn = sendPostHttps(reqUrl, parameters);
-			String responseContent = getContentHttps(urlConn);
-			return responseContent.trim();
-		} finally {
-			if (urlConn != null) {
-				urlConn.disconnect();
-				urlConn = null;
-			}
-		}
-	}
-
-	public static String doUploadFile(String reqUrl, Map parameters, String fileParamName,
-			String filename, String contentType, byte[] data) {
-		HttpURLConnection urlConn = null;
-		try {
-			urlConn = sendFormdata(reqUrl, parameters, fileParamName, filename, contentType, data);
-			String responseContent = new String(getBytes(urlConn));
-			return responseContent.trim();
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		} finally {
-			if (urlConn != null) {
-				urlConn.disconnect();
-			}
-		}
-	}
-
-	private static HttpURLConnection sendFormdata(String reqUrl, Map parameters, String fileParamName,
-			String filename, String contentType, byte[] data) {
-		HttpURLConnection urlConn = null;
-		try {
-			URL url = new URL(reqUrl);
-			urlConn = (HttpURLConnection) url.openConnection();
-			urlConn.setRequestMethod("POST");
-			urlConn.setConnectTimeout(5000);// (单位:毫秒)jdk
-			urlConn.setReadTimeout(5000);// (单位:毫秒)jdk 1.5换成这个,读操作超时
-			urlConn.setDoOutput(true);
-
-			urlConn.setRequestProperty("connection", "keep-alive");
-
-			String boundary = "-----------------------------114975832116442893661388290519"; // 分隔符
-			urlConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
-
-			boundary = "--" + boundary;
-			StringBuffer params = new StringBuffer();
-			if (parameters != null) {
-				for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
-					String name = iter.next();
-					String value = parameters.get(name);
-					params.append(boundary + "\r\n");
-					params.append("Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n");
-					// params.append(URLEncoder.encode(value, "UTF-8"));
-					params.append(value);
-					params.append("\r\n");
-				}
-			}
-
-			StringBuilder sb = new StringBuilder();
-			// sb.append("\r\n");
-			sb.append(boundary);
-			sb.append("\r\n");
-			sb.append("Content-Disposition: form-data; name=\"" + fileParamName + "\"; filename=\"" + filename
-					+ "\"\r\n");
-			sb.append("Content-Type: " + contentType + "\r\n\r\n");
-			byte[] fileDiv = sb.toString().getBytes("UTF-8");
-			byte[] endData = ("\r\n" + boundary + "--\r\n").getBytes("UTF-8");
-			byte[] ps = params.toString().getBytes("UTF-8");
-
-			OutputStream os = urlConn.getOutputStream();
-			os.write(ps);
-			os.write(fileDiv);
-			os.write(data);
-			os.write(endData);
-
-			os.flush();
-			os.close();
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-		return urlConn;
-	}
-
-	private static String getContentHttps(HttpsURLConnection urlConn) {
-		try {
-			String responseContent = null;
-			InputStream in = urlConn.getInputStream();
-			BufferedReader rd = new BufferedReader(new InputStreamReader(in, "UTF-8"));
-			String tempLine = rd.readLine();
-			StringBuffer tempStr = new StringBuffer();
-			String crlf = System.getProperty("line.separator");
-			while (tempLine != null) {
-				tempStr.append(tempLine);
-				tempStr.append(crlf);
-				tempLine = rd.readLine();
-			}
-			responseContent = tempStr.toString();
-			rd.close();
-			in.close();
-			return responseContent;
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-	}
-
-	private static String getContentHttp(HttpURLConnection urlConn) {
-		try {
-			String responseContent = null;
-			InputStream in = urlConn.getInputStream();
-			BufferedReader rd = new BufferedReader(new InputStreamReader(in, "UTF-8"));
-			String tempLine = rd.readLine();
-			StringBuffer tempStr = new StringBuffer();
-			String crlf = System.getProperty("line.separator");
-			while (tempLine != null) {
-				tempStr.append(tempLine);
-				tempStr.append(crlf);
-				tempLine = rd.readLine();
-			}
-			responseContent = tempStr.toString();
-			rd.close();
-			in.close();
-			return responseContent;
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-	}
-
-	public static byte[] getBytes(String reqUrl) {
-		return getBytes(reqUrl, null);
-	}
-
-	public static byte[] getBytes(String reqUrl, Map parameters) {
-		HttpURLConnection conn = sendGet(reqUrl, parameters);
-		return getBytes(conn);
-	}
-
-	private static byte[] getBytes(HttpURLConnection urlConn) {
-		try {
-			InputStream in = urlConn.getInputStream();
-			ByteArrayOutputStream os = new ByteArrayOutputStream();
-			byte[] buf = new byte[1024];
-			for (int i = 0; (i = in.read(buf)) > 0;)
-				os.write(buf, 0, i);
-			in.close();
-			return os.toByteArray();
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-	}
-
-	private static HttpURLConnection sendPostHttp(String reqUrl, Map parameters) {
-		HttpURLConnection urlConn = null;
-		try {
-			String params = generatorParamString(parameters);
-			URL url = new URL(reqUrl);
-
-			urlConn = (HttpURLConnection) url.openConnection();
-			urlConn.setRequestMethod("POST");
-			urlConn.setRequestProperty("User-Agent",
-					"Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3");
-			urlConn.setConnectTimeout(5000);// (单位:毫秒)jdk
-			urlConn.setReadTimeout(5000);// (单位:毫秒)jdk 1.5换成这个,读操作超时
-			urlConn.setDoOutput(true);
-			byte[] b = params.getBytes("UTF-8");
-			urlConn.getOutputStream().write(b, 0, b.length);
-			urlConn.getOutputStream().flush();
-			urlConn.getOutputStream().close();
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-		return urlConn;
-	}
-
-	/**
-	 * 忽视证书HostName
-	 */
-	private static HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() {
-		public boolean verify(String s, SSLSession sslsession) {
-			logger.info("WARNING: Hostname is not matched for cert.");
-			return true;
-		}
-	};
-
-	/**
-	 * Ignore Certification
-	 */
-	private static TrustManager ignoreCertificationTrustManger = new X509TrustManager() {
-
-		private X509Certificate[] certificates;
-
-		@Override
-		public void checkClientTrusted(X509Certificate certificates[], String authType) throws CertificateException {
-			if (this.certificates == null) {
-				this.certificates = certificates;
-			}
-
-		}
-
-		@Override
-		public void checkServerTrusted(X509Certificate[] ax509certificate, String s) throws CertificateException {
-			if (this.certificates == null) {
-				this.certificates = ax509certificate;
-			}
-		}
-
-		@Override
-		public X509Certificate[] getAcceptedIssuers() {
-			return null;
-		}
-
-	};
-
-	/**
-	 * 无视证书 参考地址
-	 * http://li3huo.com/2009/09/https-certificates-are-ignoring-the-right-java-http-client/
-	 * 
-	 * @param reqUrl
-	 * @param parameters
-	 * @return
-	 */
-	private static HttpsURLConnection sendPostHttps(String reqUrl, Map parameters) {
-		HttpsURLConnection urlConn = null;
-		try {
-			String params = generatorParamString(parameters);
-			URL url = new URL(reqUrl);
-
-			HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier);
-			urlConn = (HttpsURLConnection) url.openConnection();
-
-			// Prepare SSL Context
-			TrustManager[] tm = { ignoreCertificationTrustManger };
-			SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
-			sslContext.init(null, tm, new java.security.SecureRandom());
-
-			// 从上述SSLContext对象中得到SSLSocketFactory对象
-			SSLSocketFactory ssf = sslContext.getSocketFactory();
-			((HttpsURLConnection) urlConn).setSSLSocketFactory(ssf);
-
-			urlConn.setRequestMethod("POST");
-			// urlConn
-			// .setRequestProperty(
-			// "User-Agent",
-			// "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.3)
-			// Gecko/20100401 Firefox/3.6.3");
-			urlConn.setConnectTimeout(50000);// (单位:毫秒)jdk
-			urlConn.setReadTimeout(50000);// (单位:毫秒)jdk 1.5换成这个,读操作超时
-			urlConn.setDoOutput(true);
-			byte[] b = params.getBytes("UTF-8");
-			urlConn.getOutputStream().write(b, 0, b.length);
-			urlConn.getOutputStream().flush();
-			urlConn.getOutputStream().close();
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-		return urlConn;
-	}
-
-	private static HttpURLConnection sendGet(String reqUrl, Map parameters) {
-		HttpURLConnection urlConn = null;
-		try {
-			String params = generatorParamString(parameters);
-			URL url = new URL(reqUrl);
-			urlConn = (HttpURLConnection) url.openConnection();
-			urlConn.setRequestMethod("GET");
-			// urlConn
-			// .setRequestProperty(
-			// "User-Agent",
-			// "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.3)
-			// Gecko/20100401 Firefox/3.6.3");
-			urlConn.setConnectTimeout(5000);// (单位:毫秒)jdk
-			urlConn.setReadTimeout(5000);// (单位:毫秒)jdk 1.5换成这个,读操作超时
-			urlConn.setDoOutput(true);
-			if (params != null && !"".equals(params)) {
-				byte[] b = params.getBytes();
-				urlConn.getOutputStream().write(b, 0, b.length);
-				urlConn.getOutputStream().flush();
-				urlConn.getOutputStream().close();
-			}
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		}
-		return urlConn;
-	}
-
-	/**
-	 * 将parameters中数据转换成用"&"链接的http请求参数形式
-	 * 
-	 * @param parameters
-	 * @return
-	 */
-	public static String generatorParamString(Map parameters) {
-		StringBuffer params = new StringBuffer();
-		if (parameters != null) {
-			for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
-				String name = iter.next();
-				String value = parameters.get(name);
-				params.append(name + "=");
-				try {
-					params.append(URLEncoder.encode(value, "UTF-8"));
-				} catch (UnsupportedEncodingException e) {
-					throw new RuntimeException(e.getMessage(), e);
-				} catch (Exception e) {
-					String message = String.format("'%s'='%s'", name, value);
-					throw new RuntimeException(message, e);
-				}
-				if (iter.hasNext())
-					params.append("&");
-			}
-		}
-		return params.toString();
-	}
-
-	/**
-	 * 
-	 * @param link
-	 * @param charset
-	 * @return
-	 */
-	public static String doGet(String link, String charset) {
-		BufferedInputStream in = null;
-		ByteArrayOutputStream out = null;
-		try {
-			URL url = new URL(link);
-			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-			conn.setRequestMethod("GET");
-			conn.setRequestProperty("User-Agent", "Mozilla/5.0");
-			in = new BufferedInputStream(conn.getInputStream());
-			out = new ByteArrayOutputStream();
-			byte[] buf = new byte[1024];
-			for (int i = 0; (i = in.read(buf)) > 0;) {
-				out.write(buf, 0, i);
-			}
-			out.flush();
-			String s = new String(out.toByteArray(), charset);
-			return s;
-		} catch (Exception e) {
-			throw new RuntimeException(e.getMessage(), e);
-		} finally {
-			if (in != null)
-				try {
-					in.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			if (out != null)
-				try {
-					out.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-		}
-	}
-
-	/**
-	 * UTF-8编码
-	 * 
-	 * @param link
-	 * @return
-	 */
-	public static String doGet(String link) {
-		return doGet(link, "UTF-8");
-	}
-
-	public static int getIntResponse(String link) {
-		String str = doGet(link);
-		return Integer.parseInt(str.trim());
-
-	}
-
-}
diff --git a/src/main/java/yuelj/utils/NextId.java b/src/main/java/yuelj/utils/NextId.java
deleted file mode 100644
index 371419c..0000000
--- a/src/main/java/yuelj/utils/NextId.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package yuelj.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import org.springframework.stereotype.Repository;
-
-import yuelj.dao.base.BaseDao;
-import yuelj.entity.NextIdEntity;
-
-@Repository("NextIdDao")
-public class NextId extends BaseDao implements NextIdDao {
-	public static Random r = new Random();
-
-	public synchronized String getNextId() {
-		NextIdEntity be = new NextIdEntity();
-		List list = new ArrayList();
-		list = selectList("IdMapper.selectId", be);
-		if (list.size() == 0) {
-			insertEntity("IdMapper.insertId", be);
-			list = selectList("IdMapper.selectId", be);
-		} else {
-			be.setIdnow((Integer.parseInt(list.get(0).getIdnow()) + 1) + "");
-			updateEntity("IdMapper.updateId", be);
-		}
-		String num = list.get(0).getIdnow();
-		return num;
-	}
-
-	public  String getNextId(int end) {
-		String num = getNextId();
-		end = r.nextInt(end);
-		return num + end;
-	}
-
-}
diff --git a/src/main/java/yuelj/utils/NextIdDao.java b/src/main/java/yuelj/utils/NextIdDao.java
deleted file mode 100644
index 4686910..0000000
--- a/src/main/java/yuelj/utils/NextIdDao.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package yuelj.utils;
-
-public interface NextIdDao {
-	public String getNextId();
-
-	public String getNextId(int end);
-}
diff --git a/src/main/java/yuelj/utils/RandomNumUtil.java b/src/main/java/yuelj/utils/RandomNumUtil.java
deleted file mode 100644
index 512660f..0000000
--- a/src/main/java/yuelj/utils/RandomNumUtil.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package yuelj.utils;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Date;
-import java.util.Random;
-
-import javax.imageio.ImageIO;
-import javax.imageio.stream.ImageOutputStream;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-public class RandomNumUtil {
-	private static Logger logger = LogManager.getLogger(RandomNumUtil.class);
-	private ByteArrayInputStream image;// 图像
-	private String str;// 验证码
-	private static Random random = new Random();
-
-	private RandomNumUtil() {
-		init();// 初始化属性
-	}
-
-	/*
-	 * 取得RandomNumUtil实例
-	 */
-	public static RandomNumUtil Instance() {
-		return new RandomNumUtil();
-	}
-
-	/*
-	 * 取得验证码图片
-	 */
-	public ByteArrayInputStream getImage() {
-		return this.image;
-	}
-
-	/*
-	 * 取得图片的验证码
-	 */
-	public String getString() {
-		return this.str;
-	}
-
-	private void init() {
-		// 在内存中创建图象
-		int width = 55, height = 20;
-		BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-		// 获取图形上下文
-		Graphics g = image.getGraphics();
-		// 生成随机类
-		Random random = new Random();
-		// 设定背景色
-		g.setColor(getRandColor(200, 250));
-		g.fillRect(0, 0, width, height);
-		// 设定字体
-		g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
-		// 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
-		g.setColor(getRandColor(160, 200));
-		for (int i = 0; i < 155; i++) {
-			int x = random.nextInt(width);
-			int y = random.nextInt(height);
-			int xl = random.nextInt(12);
-			int yl = random.nextInt(12);
-			g.drawLine(x, y, x + xl, y + yl);
-		}
-		// 取随机产生的认证码(6位数字)
-		String sRand = "";
-		for (int i = 0; i < 4; i++) {
-			String rand = String.valueOf(random.nextInt(10));
-			sRand += rand;
-			// 将认证码显示到图象中
-			g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
-			// 调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
-			g.drawString(rand, 13 * i + 6, 16);
-		}
-		// 赋值验证码
-		this.str = sRand;
-
-		// 图象生效
-		g.dispose();
-		ByteArrayInputStream input = null;
-		ByteArrayOutputStream output = new ByteArrayOutputStream();
-		try {
-			ImageOutputStream imageOut = ImageIO.createImageOutputStream(output);
-			ImageIO.write(image, "JPEG", imageOut);
-			imageOut.close();
-			input = new ByteArrayInputStream(output.toByteArray());
-		} catch (Exception e) {
-			logger.info("验证码图片产生出现错误:" + e.toString());
-		}
-
-		this.image = input;/* 赋值图像 */
-	}
-
-	/*
-	 * 给定范围获得随机颜色
-	 */
-	private Color getRandColor(int fc, int bc) {
-		Random random = new Random();
-		if (fc > 255)
-			fc = 255;
-		if (bc > 255)
-			bc = 255;
-		int r = fc + random.nextInt(bc - fc);
-		int g = fc + random.nextInt(bc - fc);
-		int b = fc + random.nextInt(bc - fc);
-		return new Color(r, g, b);
-	}
-
-	/**
-	 * 获取n位随机数
-	 * 
-	 * @param n
-	 * @return
-	 */
-	public static int getNextInt(int n) {
-		int bound = (int) (Math.pow(10, n) * 0.9 - 1);
-		int r = (int) (random.nextInt(bound) + Math.pow(10, n) * 0.1);
-		return r;
-	}
-
-	/**
-	 * 邀请码生成器,算法原理:
- * 1) 获取id: 1127738
- * 2) 使用自定义进制转为:gpm6
- * 3) 转为字符串,并在后面加'o'字符:gpm6o
- * 4)在后面随机产生若干个随机数字字符:gpm6o7
- * 转为自定义进制后就不会出现o这个字符,然后在后面加个'o',这样就能确定唯一性。最后在后面产生一些随机字符进行补全。
- * - */ - - /** 自定义进制(0,1没有加入,容易与o,l混淆) */ - private static final char[] r = new char[] { 'q', 'w', 'e', '8', 'a', 's', '2', 'd', 'z', 'x', '9', 'c', '7', 'p', - '5', 'i', 'k', '3', 'm', 'j', 'u', 'f', 'r', '4', 'v', 'y', 'l', 't', 'n', '6', 'b', 'g', 'h' }; - - /** (不能与自定义进制有重复) */ - private static final char b = 'o'; - - /** 进制长度 */ - private static final int binLen = r.length; - - /** 序列最小长度 */ - private static final int s = 6; - - /** - * 根据ID生成六位随机码 - * - * @param id ID - * @return 随机码 - */ - public static String toSerialCode(long id) { - char[] buf = new char[32]; - int charPos = 32; - - while ((id / binLen) > 0) { - int ind = (int) (id % binLen); - // logger.info(num + "-->" + ind); - buf[--charPos] = r[ind]; - id /= binLen; - } - buf[--charPos] = r[(int) (id % binLen)]; - // logger.info(num + "-->" + num % binLen); - String str = new String(buf, charPos, (32 - charPos)); - // 不够长度的自动随机补全 - if (str.length() < s) { - StringBuilder sb = new StringBuilder(); - sb.append(b); - Random rnd = new Random(); - for (int i = 1; i < s - str.length(); i++) { - sb.append(r[rnd.nextInt(binLen)]); - } - str += sb.toString(); - } - return str; - } - - /** - * 根据邀请码获取id - * - * @param id ID - * @return 随机码 - */ - public static long codeToId(String code) { - char chs[] = code.toCharArray(); - long res = 0L; - for (int i = 0; i < chs.length; i++) { - int ind = 0; - for (int j = 0; j < binLen; j++) { - if (chs[i] == r[j]) { - ind = j; - break; - } - } - if (chs[i] == b) { - break; - } - if (i > 0) { - res = res * binLen + ind; - } else { - res = ind; - } - logger.info(ind + "-->" + res); - } - return res; - } - - public static void main(String[] args) { - Random random = new Random(); - System.out.println(new Date().getTime() + "," + random.nextInt(100) * 60 * 1000l); - } -} diff --git a/src/main/java/yuelj/utils/SensitiveWord/TabooedTools.java b/src/main/java/yuelj/utils/SensitiveWord/TabooedTools.java deleted file mode 100644 index 566c5a0..0000000 --- a/src/main/java/yuelj/utils/SensitiveWord/TabooedTools.java +++ /dev/null @@ -1,224 +0,0 @@ -package yuelj.utils.SensitiveWord; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 敏感词汇过滤工具类,使用了 DFA 算法来实现词汇过滤。 - * - * @author lxr - */ -public class TabooedTools { - - private static final TabooedTools instance = new TabooedTools(); - - private Collection tabooedWords; - private final Node rootNode = new Node('R'); - - private TabooedTools() { - initialize(); - } - - public static TabooedTools getInstance() { - return instance; - } - - public synchronized void setTabooedWords(Collection tabooedWords) { - this.tabooedWords = tabooedWords; - claerNode(); - // 创建字符节点树 - createNodeTree(); - - } - - public synchronized void initialize() { - TabooedWords tws = new TabooedWords(); - tws.initialize(); - tabooedWords = tws.getTabooedWords(); - - // 创建字符节点树 - createNodeTree(); - } - - public List getTabooedWords(String content) { - Set tabooedWords4Content = new LinkedHashSet(); - searchWord(content, tabooedWords4Content); - return new ArrayList(tabooedWords4Content); - } - - private void searchWord(String content, Set tabooedWords4Content) { - // 这个是检测的中间状态列表 - List tempWords = new ArrayList(); - - int index = 0; - Node node = rootNode; - char[] chars = content.toCharArray(); - while (index < chars.length) { - char currentChar = chars[index]; - - node = findNode(node, currentChar); - if (node == null) { // 如果找不到后续节点则进行回溯 - node = rootNode; - index = index - tempWords.size(); - tempWords.clear(); - } - else if (isNodeFinish(node, index, chars, tempWords.size())) { - // 如果节点终结的话, 就将敏感词汇保存到结果集中 - StringBuilder sb = new StringBuilder(); - tempWords.add(currentChar); - for (char c : tempWords) { - sb.append(c); - } - tabooedWords4Content.add(sb.toString()); - - index = index - tempWords.size() + 1; - tempWords.clear(); - node = rootNode; - } - else { // 找到匹配的敏感字符后将当前字符保存到临时列表中 - tempWords.add(currentChar); - } - - index++; - } - } - - /** - * 判断字符节点是否终结. - * - * @param node - * @param index - * @param chars - * @param matchCount - * @return true/false - */ - private boolean isNodeFinish(Node node, int index, char[] chars, int matchCount) { - boolean isFinish = (node.flag == Node.FLAG_FINISH); - if (!isFinish) - return false; - - isFinish = (index == chars.length - 1 || !isAlpha(chars[index + 1])); - if (!isFinish) - return false; - - if (index - 1 - matchCount < 0) - return true; - - return (index == 1 || !isAlpha(chars[index - 1 - matchCount])); - } - - /** - * 创建敏感字符的节点树 - */ - private void createNodeTree() { - for (String str : tabooedWords) { - char[] chars = str.toCharArray(); - if (chars.length > 0) - insertNode(rootNode, chars, 0); - } - } - - /** - * 插入字符节点. - * - * @param parent - * 父节点 - * @param chars - * 过滤字符串的char数组 - * @param index - * 待插入字符的索引 - */ - private void insertNode(Node parent, char[] chars, int index) { - Node node = findNode(parent, chars[index]); - - // 如果找不到已经存在的节点, 则创建一个节点 - if (node == null) { - node = new Node(chars[index]); - parent.addChild(node); - } - - // 如果是最后一个字符, 则将节点标记为结束 - if (index == (chars.length - 1)) - node.flag = Node.FLAG_FINISH; - else { - insertNode(node, chars, ++index); - } - } - - /** - * 清除根节点的子节点 - */ - private void claerNode() { - rootNode.getChilds().clear(); - } - - /** - * 查找字符节点. - * - * @param parent - * 父节点 - * @param c - * 字符 - * @return 返回和字符所匹配的节点 - */ - private Node findNode(Node parent, char c) { - if (c >= 'A' && c <= 'Z') { - c = (char) (c + 32); - } - - Node node = parent.getChild(c); - return node; - } - - /** - * 判断字符是否是英文字母. - * - * @param c - * 字符 - * @return true/false - */ - private static boolean isAlpha(char c) { - return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; - } - - /** - * 表示一个字符节点的类. - */ - private static class Node { - - static final int FLAG_CONTINUE = 0; // 标记敏感字符延续 - static final int FLAG_FINISH = 1; // 标记敏感字符终结 - - char c; - int flag; - - Map nodeMap = new HashMap(); - - Node(char c) { - this(c, FLAG_CONTINUE); - } - - Node(char c, int flag) { - this.c = c; - this.flag = flag; - } - - void addChild(Node node) { - nodeMap.put(node.c, node); - } - - Node getChild(char c) { - return nodeMap.get(c); - } - - Map getChilds() { - return nodeMap; - } - } - -} diff --git a/src/main/java/yuelj/utils/SensitiveWord/TabooedUtils.java b/src/main/java/yuelj/utils/SensitiveWord/TabooedUtils.java deleted file mode 100644 index e1df919..0000000 --- a/src/main/java/yuelj/utils/SensitiveWord/TabooedUtils.java +++ /dev/null @@ -1,84 +0,0 @@ -package yuelj.utils.SensitiveWord; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * 对文本内容进行敏感词汇过滤的工具类。 - * - * @author lxr - * - */ -public abstract class TabooedUtils { - - // private static final Logger logger = - // LoggerFactory.getLogger(TabooedUtils.class); - - private static final TabooedTools tabooedTools = TabooedTools.getInstance(); - - /** - * 对文本内容进行过滤,获取所有存在的敏感词汇。 - * - * @param content - * 需要进行过滤的内容 - * @return 过滤的敏感词汇列表 - */ - public static List getTabooedWords(String content) { - if (content == null || content.length() == 0) { - return Collections.emptyList(); - } - - return tabooedTools.getTabooedWords(content); - } - - /** - * 对文本内容进行过滤,获取所有存在的敏感词汇。 - * - * @param content - * 需要进行过滤的内容 - * @param replaceto - * 替换为**等 - * @return 过滤的敏感词汇列表 - */ - public static String getTabooedWords(String content, String replaceto) { - if (content == null || content.length() == 0) { - return ""; - } - String retcontent = content; - List badwordlist = tabooedTools.getTabooedWords(content); - for (String badword : badwordlist) { - retcontent = retcontent.replace(badword, replaceto); - } - return retcontent; - } - - /** - * 对文本内容进行检查,验证是否存在敏感词汇。 - * - * @param content - * 需要进行检查的内容 - * @return 如果存在敏感词汇返回 true,否则返回 false。 - */ - public static boolean isTabooed(String content) { - return !getTabooedWords(content).isEmpty(); - } - - /** - * 此方法可以实现在不重启JVM的情况下重新加载存放敏感词汇的资源文件。 - */ - public static void reloadTabooedWords() { - // logger.info("Reloading tabooed words resource..."); - tabooedTools.initialize(); - } - - /** - * 此方法用于加载应用程序外部的敏感词汇库,比如数据库里存储的词库(使用该方法后tabooed.words里面的词汇无效) - * - * @param tabooedWords - */ - public static void setTabooedWordsResource(Collection tabooedWords) { - tabooedTools.setTabooedWords(tabooedWords); - } - -} diff --git a/src/main/java/yuelj/utils/SensitiveWord/TabooedUtilsTest.java b/src/main/java/yuelj/utils/SensitiveWord/TabooedUtilsTest.java deleted file mode 100644 index 735ff17..0000000 --- a/src/main/java/yuelj/utils/SensitiveWord/TabooedUtilsTest.java +++ /dev/null @@ -1,121 +0,0 @@ -package yuelj.utils.SensitiveWord; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.util.StopWatch; - -import yuelj.utils.HttpTool; - -/** - * @author lxr - */ -public class TabooedUtilsTest { - private static Logger logger = LogManager.getLogger(TabooedUtilsTest.class); - public static void main(String[] args) { - testGetTabooedWords(); - } - - public static void testGetTabooedWords() { - String content = "DY 我靠 , 我 靠, 我靠 18DY卖车办证我这些18test都很再擦倒萨,伟大撒旦撒台湾18DY电影 " - + "飞shit飞 have DY hav深咖啡阿斯顿发率快递费AV就Av历史aV库大房间 hav1av"; - String result = TabooedUtils.getTabooedWords(content, "**"); - //logger.info(result); - System.out.println(result); - } - - public static void testReloadTabooedWords() throws IOException { - TabooedUtils.reloadTabooedWords(); - - final StringBuilder sb = new StringBuilder(); - InputStream in = TabooedWords.class.getClassLoader().getResourceAsStream("tabooed_test_file.txt"); - BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); - for (String line = reader.readLine(); line != null; line = reader.readLine()) { - sb.append(line); - } - logger.info("File Length: " + sb.length()); - logger.info("File Content:\n" + sb); - - List result = null; - StopWatch stopWatch = new StopWatch("Tabooed Filter Test"); - stopWatch.start("getTabooedWords()"); - int n = 1000; - for (int i = 0; i < n; i++) { - result = TabooedUtils.getTabooedWords(sb.toString()); - } - stopWatch.stop(); - - logger.info(stopWatch.prettyPrint()); - logger.info(result); - - n = Runtime.getRuntime().availableProcessors() + 1; - final CountDownLatch countDownLatch = new CountDownLatch(n); - ExecutorService executor = Executors.newFixedThreadPool(n); - - for (int i = 0; i < n; i++) { - executor.execute(new Runnable() { - @Override - public void run() { - StopWatch stopWatch = new StopWatch("Tabooed Filter Test(" + Thread.currentThread() + ")"); - stopWatch.start("getTabooedWords()"); - - TabooedUtils.getTabooedWords(sb.toString()); - - stopWatch.stop(); - logger.info(stopWatch.shortSummary()); - - countDownLatch.countDown(); - } - }); - } - - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - executor.shutdown(); - } - - public static void testSetTabooedWordsResource() throws Exception { - - String content = "av 不是敏感词吧, 法轮功,abcabc,shit"; - StringBuilder sb = new StringBuilder(); - InputStream in = TabooedWords.class.getClassLoader().getResourceAsStream("tabooed_test_file.txt"); - BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); - for (String line = reader.readLine(); line != null; line = reader.readLine()) { - sb.append(line); - } - content = sb.toString(); - List list = new ArrayList(); - List result = new ArrayList(); - for (int i = 0; i < 1000; i++) { - list.add("test" + i); - } - list.add("shit"); - list.add("smmm"); - list.add("abc"); - list.add("敏感词"); - list.add("法轮功"); - StopWatch stopWatch = new StopWatch("Test SetTabooedWordsResource"); - stopWatch.start("start SetTabooedWordsResource"); - TabooedUtils.setTabooedWordsResource(list); - for (int i = 0; i < 1000; i++) { - result = TabooedUtils.getTabooedWords(content); - } - stopWatch.stop(); - logger.info(stopWatch.prettyPrint()); - logger.info(result); - - } -} diff --git a/src/main/java/yuelj/utils/SensitiveWord/TabooedWords.java b/src/main/java/yuelj/utils/SensitiveWord/TabooedWords.java deleted file mode 100644 index a40a636..0000000 --- a/src/main/java/yuelj/utils/SensitiveWord/TabooedWords.java +++ /dev/null @@ -1,73 +0,0 @@ -package yuelj.utils.SensitiveWord; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Collection; -import java.util.HashSet; - -/** - * 敏感词汇类. 此类会读取资源文件(默认为tabooed.words)中的词汇. - * - * @author lxr - */ -public class TabooedWords { - - // private static final Logger logger = - // LoggerFactory.getLogger(TabooedWords.class); - - private final Collection tabooedWords = new HashSet(); - - /** - * 从默认的敏感词汇文件中读取词汇, 初始化敏感词汇列表. - */ - public synchronized void initialize() { - InputStream in = TabooedWords.class.getClassLoader().getResourceAsStream("yuelj/utils/SensitiveWord/tabooed.words"); - initialize(in, "UTF-8"); - } - - /** - * 从指定的敏感词汇输入流中读取词汇, 初始化敏感词汇列表. - * - * @param in - * 敏感词汇输入流 - * @param charset - * 编码方式 - */ - public synchronized void initialize(InputStream in, String charset) { - // logger.debug("Initializing tabooed words..."); - - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(in, charset)); - for (String line = reader.readLine(); line != null; line = reader.readLine()) { - if (line != null && line.length() != 0) { - tabooedWords.add(line.toLowerCase()); - } - } - // logger.info("Loaded {} tabooed words", tabooedWords.size()); - } catch (Exception e) { - // logger.error("Could not read tabooed.words", e); - } finally { - try { - if (reader != null) - reader.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // FileUtils.close(reader); - } - } - - /** - * 获取所有读取到的敏感词汇. - * - * @return 敏感词汇 - */ - public Collection getTabooedWords() { - return tabooedWords; - } - -} diff --git a/src/main/java/yuelj/utils/SensitiveWord/tabooed.words b/src/main/java/yuelj/utils/SensitiveWord/tabooed.words deleted file mode 100644 index fa7dbb7..0000000 --- a/src/main/java/yuelj/utils/SensitiveWord/tabooed.words +++ /dev/null @@ -1,816 +0,0 @@ -bitch -shit -falun -sex -tianwang -cdjp -av -bignews -boxun -chinaliberal -chinamz -chinesenewsnet -cnd -creaders -dafa -dajiyuan -dfdz -dpp -falu -falundafa -flg -freechina -freedom -freenet -fuck -GCD -gcd -hongzhi -hrichina -huanet -hypermart -incest -jiangdongriji -lihongzhi -making -minghui -minghuinews -nacb -naive -nmis -paper -peacehall -playboy -renminbao -renmingbao -rfa -safeweb -simple -svdc -taip -tibetalk -triangle -triangleboy -UltraSurf -unixbox -ustibet -voa -voachinese -wangce -wstaiji -xinsheng -yuming -zhengjian -zhengjianwang -zhenshanren -zhuanfalun -三个代表 -一党 -多党 -民主 -专政 -行房 -自慰 -吹箫 -色狼 -胸罩 -内裤 -底裤 -私处 -爽死 -变态 -妹疼 -妹痛 -弟疼 -弟痛 -姐疼 -姐痛 -哥疼 -哥痛 -同房 -打炮 -造爱 -性交 -性爱 -作爱 -做爱 -操你 -日你 -日批 -日逼 -鸡巴 -我靠 -我操 -操死 -乳房 -阴茎 -阳具 -开苞 -肛门 -阴道 -阴蒂 -肉棍 -肉棒 -肉洞 -荡妇 -阴囊 -睾丸 -捅你 -捅我 -插我 -插你 -插她 -插他 -干你 -干她 -干他 -妓女 -射精 -口交 -手淫 -口淫 -屁眼 -阴户 -阴门 -下体 -龟头 -阴毛 -避孕套 -你妈逼 -大鸡巴 -性高潮 -性虐待 -大法 -弟子 -大纪元 -真善忍 -明慧 -洪志 -红志 -洪智 -红智 -法轮 -法论 -法沦 -法伦 -发轮 -发论 -发沦 -发伦 -轮功 -轮公 -轮攻 -沦功 -沦公 -沦攻 -论攻 -论功 -论公 -伦攻 -伦功 -伦公 -打倒 -民运 -六四 -台独 -王丹 -柴玲 -李鹏 -天安门 -江泽民 -朱容基 -朱镕基 -李长春 -李瑞环 -胡锦涛 -魏京生 -台湾独立 -藏独 -西藏独立 -疆独 -新疆独立 -警察 -民警 -公安 -邓小平 -嫖 -大盖帽 -革命 -武警 -黑社会 -交警 -消防队 -刑警 -夜总会 -妈个 -公款 -首长 -书记 -坐台 -腐败 -城管 -暴动 -暴乱 -李远哲 -司法警官 -高干 -高干子弟 -高干子女 -人大 -尉健行 -李岚清 -黄丽满 -于幼军 -文字狱 -宋祖英 -自焚 -骗局 -猫肉 -吸储 -张五常 -张丕林 -空难 -温家宝 -吴邦国 -曾庆红 -黄菊 -罗干 -吴官正 -贾庆林 -专制 -卖淫 -吹萧 -朱熔基 -於幼军 -八九 -八老 -巴赫 -白立朴 -白梦 -白皮书 -保钓 -鲍戈 -鲍彤 -暴政 -北大三角地论坛 -北韩 -北京当局 -北京之春 -北美自由论坛 -博讯 -蔡崇国 -曹长青 -曹刚川 -常劲 -陈炳基 -陈军 -陈蒙 -陈破空 -陈希同 -陈小同 -陈宣良 -陈一谘 -陈总统 -程凯 -程铁军 -程真 -迟浩田 -持不同政见 -赤匪 -赤化 -春夏自由论坛 -达赖 -大参考 -大纪元新闻网 -大纪园 -大家论坛 -大史 -大史记 -大史纪 -大中国论坛 -大中华论坛 -大众真人真事 -戴相龙 -弹劾 -登辉 -邓笑贫 -迪里夏提 -地下教会 -地下刊物 -第四代 -电视流氓 -钓鱼岛 -丁关根 -丁元 -丁子霖 -东北独立 -东方红时空 -东方时空 -东南西北论谈 -东社 -东土耳其斯坦 -东西南北论坛 -动乱 -独裁 -独裁政治 -独夫 -独立台湾会 -杜智富 -多维 -屙民 -俄国 -发愣 -发正念 -法愣 -法抡 -法仑 -法十轮十功 -法谪 -法谪功 -反封锁技术 -反腐败论坛 -反攻 -反共 -反人类 -反社会 -方励之 -方舟子 -飞扬论坛 -斐得勒 -费良勇 -分家在 -分裂 -粉饰太平 -风雨神州 -风雨神州论坛 -封从德 -封杀 -冯东海 -冯素英 -佛展千手法 -付申奇 -傅申奇 -傅志寰 -高官 -高文谦 -高薪养廉 -高瞻 -高自联 -戈扬 -鸽派 -歌功颂德 -蛤蟆 -个人崇拜 -工自联 -功法 -共党 -共匪 -共狗 -共军 -关卓中 -贯通两极法 -广闻 -郭伯雄 -郭罗基 -郭平 -郭岩华 -国家安全 -国家机密 -国军 -国贼 -韩东方 -韩联潮 -汉奸 -何德普 -何勇 -河殇 -红灯区 -红色恐怖 -宏法 -洪传 -洪吟 -洪哲胜 -胡紧掏 -胡锦滔 -胡锦淘 -胡景涛 -胡平 -胡总书记 -护法 -花花公子 -华建敏 -华通时事论坛 -华夏文摘 -华语世界论坛 -华岳时事论坛 -黄慈萍 -黄祸 -黄菊  -黄翔 -回民暴动 -悔过书 -鸡毛信文汇 -姬胜德 -积克馆 -基督 -贾廷安 -贾育台 -建国党 -江core -江八点 -江流氓 -江罗 -江绵恒 -江青 -江戏子 -江则民 -江泽慧 -江贼 -江贼民 -江折民 -江猪 -江猪媳 -江主席 -姜春云 -将则民 -僵贼 -僵贼民 -讲法 -酱猪媳 -交班 -教养院 -接班 -揭批书 -金尧如 -锦涛 -禁看 -经文 -开放杂志 -看中国 -抗议 -邝锦文 -劳动教养所 -劳改 -劳教 -老江 -老毛 -老人政治 -黎安友 -李大师 -李登辉 -李红痔 -李宏志 -李洪宽 -李继耐 -李兰菊 -李老师 -李录 -李禄 -李少民 -李淑娴 -李旺阳 -李文斌 -李小朋 -李小鹏 -李月月鸟 -李志绥 -李总理 -李总统 -连胜德 -联总 -廉政大论坛 -炼功 -梁光烈 -梁擎墩 -两岸关系 -两岸三地论坛 -两个中国 -两会 -两会报道 -两会新闻 -廖锡龙 -林保华 -林长盛 -林樵清 -林慎立 -凌锋 -刘宾深 -刘宾雁 -刘刚 -刘国凯 -刘华清 -刘俊国 -刘凯中 -刘千石 -刘青 -刘山青 -刘士贤 -刘文胜 -刘晓波 -刘晓竹 -刘永川 -流亡 -龙虎豹 -陆委会 -吕京花 -吕秀莲 -抡功 -轮大 -轮奸 -罗礼诗 -马大维 -马良骏 -马三家 -马时敏 -卖国 -毛厕洞 -毛片 -毛贼东 -美国参考 -美国之音 -蒙独 -蒙古独立 -密穴 -绵恒 -民国 -民进党 -民联 -民意 -民意论坛 -民阵 -民猪 -民主墙 -民族矛盾 -莫伟强 -木犀地 -木子论坛 -南大自由论坛 -闹事 -倪育贤 -你说我说论坛 -潘国平 -泡沫经济 -迫害 -祁建 -齐墨 -钱达 -钱国梁 -钱其琛 -抢粮记 -乔石 -亲美 -亲日 -钦本立 -秦晋 -青天白日旗 -轻舟快讯 -情妇 -庆红 -全国两会 -热比娅 -热站政论网 -人民报 -人民内情真相 -人民真实 -人民之声论坛 -人权 -忍 -日内瓦金融 -瑞士金融大学 -色情 -善恶有报 -上海帮 -上海孤儿院 -邵家健 -神通加持法 -沈彤 -升天 -盛华仁 -盛雪 -师父 -石戈 -时代论坛 -时事论坛 -世界经济导报 -事实独立 -双十节 -水扁 -税力 -司马晋 -司马璐 -司徒华 -斯诺 -四川独立 -宋xx -宋平 -宋书元 -苏绍智 -苏晓康 -台盟 -台湾狗 -台湾建国运动组织 -台湾青年独立联盟 -台湾政论区 -台湾自由联盟 -太子党 -汤光中 -唐柏桥 -唐捷 -滕文生 -天安门录影带 -天安门事件 -天安门屠杀 -天安门一代 -天怒 -天葬 -童屹 -统独 -统独论坛 -统战 -屠杀 -外交论坛 -外交与方略 -万润南 -万维读者论坛 -万晓东 -汪岷 -王宝森 -王炳章 -王策 -王超华 -王辅臣 -王刚 -王涵万 -王沪宁 -王军涛 -王力雄 -王瑞林 -王润生 -王若望 -王希哲 -王秀丽 -王冶坪 -网特 -魏新生 -温元凯 -文革 -无界浏览器 -吴百益 -吴方城 -吴弘达 -吴宏达 -吴仁华 -吴学灿 -吴学璨 -吾尔开希 -五不 -伍凡 -西藏 -洗脑 -项怀诚 -项小吉 -小参考 -肖强 -邪恶 -谢长廷 -谢选骏 -谢中之 -辛灏年 -新观察论坛 -新华举报 -新华内情 -新华通论坛 -新生网 -新闻封锁 -新语丝 -信用危机 -邢铮 -熊炎 -熊焱 -修炼 -徐邦秦 -徐才厚 -徐匡迪 -徐水良 -许家屯 -薛伟 -学潮 -学联 -学习班 -学运 -学自联 -雪山狮子 -严家其 -严家祺 -阎明复 -颜射 -央视内部晚会 -杨怀安 -杨建利 -杨巍 -杨月清 -杨周 -姚月谦 -夜话紫禁城 -一中一台 -义解 -亦凡 -异见人士 -异议人士 -易丹轩 -易志熹 -淫穴 -尹庆民 -由喜贵 -游行 -幼齿 -幼女 -于大海 -于浩成 -余英时 -舆论 -舆论反制 -宇明网 -圆满 -远志明 -岳武 -在十月 -则民 -择民 -泽民 -贼民 -曾培炎 -张伯笠 -张钢 -张宏堡 -张健 -张林 -张万年 -张伟国 -张昭富 -张志清 -赵海青 -赵南 -赵品潞 -赵晓微 -赵紫阳 -哲民 -真相 -真象 -镇压 -争鸣论坛 -正见网 -正义党论坛 -郑义 -郑源 -政权 -政治反对派 -政治犯 -支那 -指点江山论坛 -中俄边界 -中功 -中共 -中国复兴论坛 -中国孤儿院 -中国和平 -中国论坛 -中国社会进步党 -中国社会论坛 -中国威胁论 -中国问题论坛 -中国真实内容 -中国之春 -中国猪 -中华大地 -中华大众 -中华讲清 -中华民国 -中华人民实话实说 -中华人民正邪 -中华时事 -中华养生益智功 -中华真实报道 -钟山风雨论坛 -晚年周恩来 -周锋锁 -周天法 -周旋 -朱嘉明 -朱琳 -朱毛 -朱溶剂 -猪聋畸 -猪毛 -主义 -转化 -自民党 -自已的故事 -自由 -自由民主论坛 -走私 -作秀 -收容所 -世纪中国基金会 -台湾18DY电影 -习近平 diff --git a/src/main/java/yuelj/utils/SessionUtil.java b/src/main/java/yuelj/utils/SessionUtil.java deleted file mode 100644 index 4efb897..0000000 --- a/src/main/java/yuelj/utils/SessionUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package yuelj.utils; - -import javax.servlet.http.HttpServletRequest; - -import yuelj.entity.UserEntity; - -public class SessionUtil { - - /** - * 用户信息 - */ - public static final String SESSION_LOGIN_KEY = "SESSION_LOGIN_INFO"; - - - private SessionUtil() { - - } - - public static void setUser(HttpServletRequest req, UserEntity user) { - req.getSession().setAttribute(SESSION_LOGIN_KEY, user); - } - - public static UserEntity getUser(HttpServletRequest req) { - - Object object = req.getSession().getAttribute(SESSION_LOGIN_KEY); - if (null == object) { - return null; - } - return (UserEntity) object; - } - - - public static boolean invalidSession(HttpServletRequest req) { - if (null != req) { - req.getSession().invalidate(); - if (null == getUser(req)) { - return true; - } - return false; - } - return false; - } - -} diff --git a/src/main/java/yuelj/utils/SpringUtil.java b/src/main/java/yuelj/utils/SpringUtil.java deleted file mode 100644 index 53d0bcb..0000000 --- a/src/main/java/yuelj/utils/SpringUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package yuelj.utils; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -/** - * - * @author lxr - * 2015年8月4日 上午11:27:33 - */ -@Component -public class SpringUtil implements ApplicationContextAware { - static ApplicationContext context ; - - @Autowired - public static void setContext(ApplicationContext appcontext) { - context = appcontext; - } - public void setApplicationContext(ApplicationContext appcontext) throws BeansException { - context = appcontext; - } - - public static ApplicationContext getContext() { - return context; - } - - - public static Object getBean(String beanName){ - return context.getBean(beanName); - } -} \ No newline at end of file diff --git a/src/main/java/yuelj/utils/StringUtil.java b/src/main/java/yuelj/utils/StringUtil.java deleted file mode 100644 index ecd3788..0000000 --- a/src/main/java/yuelj/utils/StringUtil.java +++ /dev/null @@ -1,370 +0,0 @@ -package yuelj.utils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * 字符串工具类 - * - * @author lxr 2015年6月25日 下午3:31:03 - */ -public class StringUtil { - private static Logger logger = LogManager.getLogger(StringUtil.class); - - /** - * 判断字符串是否为空 - * - * @param str - * @return - */ - public static boolean isEmpty(String str) { - if (null == str || str.equals("")) { - return true; - } - return false; - } - - public static String toView(String str) { - if (str == null) { - return ""; - } - return str; - } - - public static String trim(String str) { - if (null == str) { - str = ""; - } - - return str.trim(); - } - - public static String trim(Object str) { - if (null == str) { - str = ""; - } - - return trim(str.toString()); - } - - /** - * 判断字符是否匹配多个字符串中的任意一个 - * - * @param src - * @param matchs - * @return - */ - public static boolean matchs(String src, String[] matchs) { - if (isEmpty(src) || null == matchs || matchs.length == 0) { - return false; - } else if (Arrays.asList(matchs).contains(src)) { - return true; - } - return false; - } - - /** - * 字符串转换为整形值,异常时使用默认值 - * - * @param src - * @param defaultValue - * @return - */ - public static int toIntDefValue(String src, int defaultValue) { - int intValue = 0; - try { - intValue = Integer.parseInt(src); - } catch (NumberFormatException e) { - return defaultValue; - } - return intValue; - } - - /** - * 字符串转换为长整形值,异常时使用默认值 - * - * @param src - * @param defaultValue - * @return - */ - public static Long toLongDefValue(String src, Long defaultValue) { - Long intValue = 0l; - try { - intValue = Long.parseLong(src); - } catch (NumberFormatException e) { - return defaultValue; - } - return intValue; - } - - public static Double toDoubleDefValue(String src, Double defaultValue) { - Double dvalue = 0d; - try { - dvalue = Double.parseDouble(src); - } catch (NumberFormatException e) { - return defaultValue; - } - return dvalue; - } - - public static Double toDoubleWithExeption(String src) { - Double dvalue = 0d; - try { - dvalue = Double.parseDouble(src); - } catch (NumberFormatException e) { - throw e; - } - return dvalue; - } - - /** - * 字符串转换为整形值,异常时抛出异常 - * - * @param src - * @param defaultValue - * @return - */ - public static int toIntWithException(String src) { - int intValue = 0; - try { - intValue = Integer.parseInt(src); - } catch (NumberFormatException e) { - throw e; - } - return intValue; - } - - /** - * 字符串转换为长整形值,异常时抛出异常 - * - * @param src - * @param defaultValue - * @return - */ - public static Long toLongWithException(String src) { - Long intValue = 0l; - try { - intValue = Long.parseLong(src); - - } catch (NumberFormatException e) { - throw e; - } - return intValue; - } - - /** - * 正则校验 - * - * @param str - * @param pattern - * @return - */ - public static boolean regix(String str, String pattern) { - Pattern p = Pattern.compile(pattern); - Matcher m = p.matcher(str); - return m.matches(); - } - - /** - * 比较整形数值与字符串是否相等 - * - * @param a - * @param b - * @return - */ - public static boolean isEq(int a, String b) { - if (null == b) { - return false; - } - return String.valueOf(a).equals(b); - } - - /** - * 比较两个字符串是否相等 - * - * @param a - * @param b - * @return - */ - public static boolean isEq(String a, String b) { - if (null == a || null == b) { - return false; - } - return a.equals(b); - } - - public static String subStr(String str, int length, int isEnd) { - String resultStr = ""; - char[] ch = str.toCharArray(); - int count = ch.length; - for (int i = 0; i < count; i++) { - resultStr += ch[i]; - if (isEnd == 1) { - if (resultStr.getBytes().length >= length - 3) { - resultStr += "..."; - break; - } - } else { - if (resultStr.getBytes().length >= length) { - break; - } - } - - } - return resultStr; - } - - /** - * 十六进制字符串到字节数组的转换 - * - * @param s 十六进制字符串 - * @return 字节数组 - */ - public static byte[] hexStringToByteArray(String s) { - byte[] buf = new byte[s.length() / 2]; - for (int i = 0; i < buf.length; i++) { - buf[i] = (byte) (chr2hex(s.substring(i * 2, i * 2 + 1)) * 0x10 - + chr2hex(s.substring(i * 2 + 1, i * 2 + 2))); - } - return buf; - } - - /** - * 十六进制字符到字节类型数据的转换 - * - * @param chr 十六进制字符 - * @return 字节类型数据 - */ - private static byte chr2hex(String chr) { - if ("0".equals(chr)) { - return 0x00; - } else if ("1".equals(chr)) { - return 0x01; - } else if ("2".equals(chr)) { - return 0x02; - } else if ("3".equals(chr)) { - return 0x03; - } else if ("4".equals(chr)) { - return 0x04; - } else if ("5".equals(chr)) { - return 0x05; - } else if ("6".equals(chr)) { - return 0x06; - } else if ("7".equals(chr)) { - return 0x07; - } else if ("8".equals(chr)) { - return 0x08; - } else if ("9".equals(chr)) { - return 0x09; - } else if ("A".equals(chr)) { - return 0x0a; - } else if ("B".equals(chr)) { - return 0x0b; - } else if ("C".equals(chr)) { - return 0x0c; - } else if ("D".equals(chr)) { - return 0x0d; - } else if ("E".equals(chr)) { - return 0x0e; - } else if ("F".equals(chr)) { - return 0x0f; - } else { - return 0x00; - } - } - - public static byte[] ivGeneration(String ivString) { - byte[] ivBytes = new byte[ivString.length()]; - for (int i = 0; i < ivString.length(); i++) { - ivBytes[i] = Byte.parseByte(ivString.substring(i, i + 1)); - } - return ivBytes; - } - - /** - * 格式化HTML文本 - * - * @param content - * @return - */ - public static String htmlToStr(String content) { - if (content == null) - return ""; - content = content.replaceAll("'", "'"); - content = content.replaceAll("\"", """); - content = content.replaceAll("\t", "  ");// 替换跳格 - content = content.replaceAll("<", "<"); - content = content.replaceAll(">", ">"); - return content; - } - - /** - * - * - * @param url - * @param paramName - * @author Administrator - * @time May 31, 2013 9:28:58 AM - */ - public static String parseUrl(String url, String paramName) { - if (isEmpty(url) || isEmpty(paramName)) { - return ""; - } - String[] array = url.split("\\?"); - String[] array2 = array[1].split("\\&"); - for (String arr : array2) { - String[] array3 = arr.split("="); - if (isEq(array3[0], paramName)) { - return array3[1]; - } - } - return ""; - } - - /** - * inputstream convert to string - * - * @param is - * @return - * @author Administrator - * @time May 31, 2013 9:48:28 AM - */ - public static String streamToStr(InputStream is) { - String str = ""; - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8")); - String tempBf = null; - while (null != (tempBf = reader.readLine())) { - str += tempBf; - } - } catch (UnsupportedEncodingException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return str; - } - - public static String unescapeUnicode(String str) { - - try { - return java.net.URLDecoder.decode(str, "UTF-8"); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return ""; - } - } - -} diff --git a/src/main/java/yuelj/utils/cache/MemCacheOcsUtils.java b/src/main/java/yuelj/utils/cache/MemCacheOcsUtils.java deleted file mode 100644 index c971897..0000000 --- a/src/main/java/yuelj/utils/cache/MemCacheOcsUtils.java +++ /dev/null @@ -1,148 +0,0 @@ -package yuelj.utils.cache; - -import java.io.IOException; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import net.spy.memcached.AddrUtil; -import net.spy.memcached.BinaryConnectionFactory; -import net.spy.memcached.MemcachedClient; -import yuelj.constants.ParamsAndURL; - -public class MemCacheOcsUtils { - private static Logger logger = LogManager.getLogger(MemCacheOcsUtils.class); - public static final String host = (String) ParamsAndURL.getParam("MEMCACHE_host"); - public static final String port = "11211"; // 默认端口 11211,不用改 - public static MemcachedClient cache; - - public static MemcachedClient getCache() { - if (cache == null) { - try { - cache = new MemcachedClient(new BinaryConnectionFactory(), AddrUtil.getAddresses(host + ":" + port)); - } catch (IOException e) { - e.printStackTrace(); - } - } - return cache; - } - - /** - * 设置缓存 - * - * @param key - * @param value - */ - public static void setData(String key, String value) { - try { - cache = getCache(); - // 执行set操作,向缓存中存数据 - cache.set(key, 60 * 60 * 24 * 30, value); - String logstr = value; - if (value.length() >= 100) { - logstr = value.substring(0, 100); - } - logger.error("memcached set key:" + key + ",value:" + logstr); - } catch (Exception e) { - logger.error("memcached error set key:" + key + ",value:" + value); - e.printStackTrace(); - cache = null; - } - } - - /** - * 设置带有过期时间的缓存 - * - * @param key - * @param value - * @param time - * 过期时间距离当前时间的时长,大于30天变为过期时间戳,秒 - */ - public static void setDataTime(String key, String value, int time) { - // Date d = new Date(); - if (time > 60 * 60 * 24 * 30) { - // time = time + (int) d.getTime() / 1000; - time = 60 * 60 * 24 * 30; - } - try { - // cache = getCache(); - // 执行set操作,向缓存中存数据 - // cache.set(key, time, value); - // log打印 - // String logstr = value; - // if (value.length() >= 100) { - // logstr = value.substring(0, 100); - // } - // logger.error("memcached set key:" + key + ",value:" + - // logstr + "time:" + time); - } catch (Exception e) { - logger.error("memcached error set key:" + key + ",value:" + value); - e.printStackTrace(); - cache = null; - } - } - - /** - * 获取缓存 - * - * @param key - * @return - */ - public static String getData(String key) { - String value = null; - logger.error("from memcachekey:" + key); - try { - cache = getCache(); - // 执行get操作,从缓存中读数据,读取key为"ocs"的数据 - Object ob = cache.get(key); - if (ob != null) { - value = ob.toString(); - int length = value.length(); - if (length > 100) { - length = 100; - } - // logger.error("Hit from memcache key:" + key + "val:" + - // value.substring(0, length)); - } - } catch (Exception e) { - cache.set(key, 0, ""); - e.printStackTrace(); - cache = null; - return null; - } - return value; - } - - /** - * 测试代码 - * - * @param args - */ - public static void main(String[] args) { - - MemcachedClient cache = null; - try { - - cache = new MemcachedClient(new BinaryConnectionFactory(), AddrUtil.getAddresses(host + ":" + port)); - - // 向OCS中存若干个数据,随后可以在OCS控制台监控上看到统计信息 - for (int i = 0; i < 100; i++) { - String key = "key-" + i; - String value = "value-" + i; - - // 执行set操作,向缓存中存数据 - cache.set(key, 1000, value); - } - - // 执行get操作,从缓存中读数据,读取key为"ocs"的数据 - logger.error("Get memcache:" + cache.get("key-1")); - - } catch (Exception e) { - e.printStackTrace(); - } - if (cache != null) { - cache.shutdown(); - } - - } -} diff --git a/src/main/java/yuelj/utils/dateTime/ChinaDate.java b/src/main/java/yuelj/utils/dateTime/ChinaDate.java deleted file mode 100644 index 8ce6070..0000000 --- a/src/main/java/yuelj/utils/dateTime/ChinaDate.java +++ /dev/null @@ -1,417 +0,0 @@ -package yuelj.utils.dateTime; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Locale; - -/** - * 中国的农历转公历 - * - * @author lxr 2015年10月9日 下午6:08:13 - */ -public class ChinaDate { - final private static long[] lunarInfo = new long[] { 0x04bd8, 0x04ae0, - 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, - 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, - 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, - 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, - 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, - 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, - 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, - 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, - 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, - 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, - 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, - 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, - 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, - 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, - 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, - 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, - 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, - 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, - 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, - 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, - 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, - 0x0ada0 }; - final private static int[] year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, - 1, 2, 1 }; - final private static int[] year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, - 0, 1, 0 }; - final private static int[] year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, - 2, 1, 2, 1 }; - public final static String[] nStr1 = new String[] { "", "正", "二", "三", "四", - "五", "六", "七", "八", "九", "十", "冬月", "腊月" }; - private final static String[] Gan = new String[] { "甲", "乙", "丙", "丁", "戊", - "己", "庚", "辛", "壬", "癸" }; - private final static String[] Zhi = new String[] { "子", "丑", "寅", "卯", "辰", - "巳", "午", "未", "申", "酉", "戌", "亥" }; - private final static String[] Animals = new String[] { "鼠", "牛", "虎", "兔", - "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" }; - - private final static String[] solarTerm = new String[] { "小寒", "大寒", "立春", - "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", - "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }; - private final static String[] sFtv = new String[] { "0101*元旦", "0214 情人节", - "0308 妇女节", "0312 植树节", "0315 消费者权益日", "0401 愚人节", "0501 劳动节", - "0504 青年节", "0512 护士节", "0601 儿童节", "0701 建党节", "0801 建军节", - "0808 父亲节", "0909 mzd逝世纪念", "0910 教师节", "0928 孔子诞辰", "1001*国庆节", - "1006 老人节", "1024 联合国日", "1112 孙中山诞辰", "1220 澳门回归", "1225 圣诞节", - "1226 mzd诞辰" }; - private final static String[] lFtv = new String[] { "0101*农历春节", - "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", - "1208 腊八节", "1224 小年", "0100*除夕" }; - - /** - * 传回农历 y年的总天数 - * - * @param y - * @return - */ - final private static int lYearDays(int y) { - int i, sum = 348; - for (i = 0x8000; i > 0x8; i >>= 1) { - if ((lunarInfo[y - 1900] & i) != 0) - sum += 1; - } - return (sum + leapDays(y)); - } - - /** - * 传回农历 y年闰月的天数 - * - * @param y - * @return - */ - final private static int leapDays(int y) { - if (leapMonth(y) != 0) { - if ((lunarInfo[y - 1900] & 0x10000) != 0) - return 30; - else - return 29; - } else - return 0; - } - - /** - * 传回农历 y年闰哪个月 1-12 , 没闰传回 0 - * - * @param y - * @return - */ - final private static int leapMonth(int y) { - return (int) (lunarInfo[y - 1900] & 0xf); - } - - /** - * 传回农历 y年m月的总天数 - * - * @param y - * @param m - * @return - */ - final private static int monthDays(int y, int m) { - if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0) - return 29; - else - return 30; - } - - /** - * 传回农历 y年的生肖 - * - * @param y - * @return - */ - final public static String AnimalsYear(int y) { - return Animals[(y - 4) % 12]; - } - - /** - * 传入 月日的offset 传回干支,0=甲子 - * - * @param num - * @return - */ - final private static String cyclicalm(int num) { - return (Gan[num % 10] + Zhi[num % 12]); - } - - /** - * 传入 offset 传回干支, 0=甲子 - * - * @param y - * @return - */ - final public static String cyclical(int y) { - int num = y - 1900 + 36; - return (cyclicalm(num)); - } - - /** - * 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 - * - * @param y - * @param m - * @return - */ - final private long[] Lunar(int y, int m) { - long[] nongDate = new long[7]; - int i = 0, temp = 0, leap = 0; - Date baseDate = new GregorianCalendar(1900 + 1900, 1, 31).getTime(); - Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime(); - long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L; - if (y < 2000) - offset += year19[m - 1]; - if (y > 2000) - offset += year20[m - 1]; - if (y == 2000) - offset += year2000[m - 1]; - nongDate[5] = offset + 40; - nongDate[4] = 14; - for (i = 1900; i < 2050 && offset > 0; i++) { - temp = lYearDays(i); - offset -= temp; - nongDate[4] += 12; - } - if (offset < 0) { - offset += temp; - i--; - nongDate[4] -= 12; - } - nongDate[0] = i; - nongDate[3] = i - 1864; - leap = leapMonth(i); // 闰哪个月 - nongDate[6] = 0; - for (i = 1; i < 13 && offset > 0; i++) { - // 闰月 - if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { - --i; - nongDate[6] = 1; - temp = leapDays((int) nongDate[0]); - } else { - temp = monthDays((int) nongDate[0], i); - } - // 解除闰月 - if (nongDate[6] == 1 && i == (leap + 1)) - nongDate[6] = 0; - offset -= temp; - if (nongDate[6] == 0) - nongDate[4]++; - } - if (offset == 0 && leap > 0 && i == leap + 1) { - if (nongDate[6] == 1) { - nongDate[6] = 0; - } else { - nongDate[6] = 1; - --i; - --nongDate[4]; - } - } - if (offset < 0) { - offset += temp; - --i; - --nongDate[4]; - } - nongDate[1] = i; - nongDate[2] = offset + 1; - return nongDate; - } - - /** - * 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 - * - * @param y - * @param m - * @param d - * @return - */ - final public static long[] calElement(int y, int m, int d) { - long[] nongDate = new long[7]; - int i = 0, temp = 0, leap = 0; - Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime(); - Date objDate = new GregorianCalendar(y, m - 1, d).getTime(); - long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L; - nongDate[5] = offset + 40; - nongDate[4] = 14; - for (i = 1900; i < 2050 && offset > 0; i++) { - temp = lYearDays(i); - offset -= temp; - nongDate[4] += 12; - } - if (offset < 0) { - offset += temp; - i--; - nongDate[4] -= 12; - } - nongDate[0] = i; - nongDate[3] = i - 1864; - leap = leapMonth(i); // 闰哪个月 - nongDate[6] = 0; - for (i = 1; i < 13 && offset > 0; i++) { - // 闰月 - if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { - --i; - nongDate[6] = 1; - temp = leapDays((int) nongDate[0]); - } else { - temp = monthDays((int) nongDate[0], i); - } - // 解除闰月 - if (nongDate[6] == 1 && i == (leap + 1)) - nongDate[6] = 0; - offset -= temp; - if (nongDate[6] == 0) - nongDate[4]++; - } - if (offset == 0 && leap > 0 && i == leap + 1) { - if (nongDate[6] == 1) { - nongDate[6] = 0; - } else { - nongDate[6] = 1; - --i; - --nongDate[4]; - } - } - if (offset < 0) { - offset += temp; - --i; - --nongDate[4]; - } - nongDate[1] = i; - nongDate[2] = offset + 1; - return nongDate; - } - - public final static String getChinaDate(int day) { - String a = ""; - if (day == 10) - return "初十"; - if (day == 20) - return "二十"; - if (day == 30) - return "三十"; - int two = (int) ((day) / 10); - if (two == 0) - a = "初"; - if (two == 1) - a = "十"; - if (two == 2) - a = "廿"; - if (two == 3) - a = "三"; - int one = (int) (day % 10); - switch (one) { - case 1: - a += "一"; - break; - case 2: - a += "二"; - break; - case 3: - a += "三"; - break; - case 4: - a += "四"; - break; - case 5: - a += "五"; - break; - case 6: - a += "六"; - break; - case 7: - a += "七"; - break; - case 8: - a += "八"; - break; - case 9: - a += "九"; - break; - } - return a; - } - - public static String today() { - Calendar today = Calendar.getInstance(Locale.SIMPLIFIED_CHINESE); - int year = today.get(Calendar.YEAR); - int month = today.get(Calendar.MONTH) + 1; - int date = today.get(Calendar.DATE); - long[] l = calElement(year, month, date); - StringBuffer sToday = new StringBuffer(); - try { - sToday.append(sdf.format(today.getTime())); - sToday.append(" 农历"); - sToday.append(cyclical(year)); - sToday.append('('); - sToday.append(AnimalsYear(year)); - sToday.append(")年"); - sToday.append(nStr1[(int) l[1]]); - sToday.append("月"); - sToday.append(getChinaDate((int) (l[2]))); - return sToday.toString(); - } finally { - sToday = null; - } - } - - /** - * 判断传入的yyyy-mm-dd是否是春节,大年初一期间 - * - * @param dateStr - * @param days 放假天数 - * @return - */ - public static boolean isSpringFest(String dateStr, int days) { - Date date = DateUtil.parseDateStr(dateStr); - Calendar dateC = Calendar.getInstance(); - dateC.setTime(date); - int year = dateC.get(Calendar.YEAR); - int month = dateC.get(Calendar.MONTH) + 1; - int day = dateC.get(Calendar.DATE); - long[] l = calElement(year, month, day); - int nmonth = (int) l[1]; - int nday = (int) l[2]; - if (nmonth == 1 && nday >= 1 && nday <= days) { - return true; - } else { - return false; - } - } - - public static String oneDay(int year, int month, int day) { - Calendar today = Calendar.getInstance(Locale.SIMPLIFIED_CHINESE); - long[] l = calElement(year, month, day); - StringBuffer sToday = new StringBuffer(); - try { - sToday.append(sdf.format(today.getTime())); - sToday.append(" 农历"); - sToday.append(cyclical(year)); - sToday.append('('); - sToday.append(AnimalsYear(year)); - sToday.append(")年"); - sToday.append(nStr1[(int) l[1]]); - sToday.append("月"); - sToday.append(getChinaDate((int) (l[2]))); - return sToday.toString(); - } finally { - sToday = null; - } - } - - private static SimpleDateFormat sdf = new SimpleDateFormat( - "yyyy年M月d日 EEEEE"); - - /** - * 农历日历工具使用演示 - * - * @param args - */ - // public static void main(String[] args) { - // long[] l = calElement(2016, 2, 8); - // logger.info("农历"+l[0]+"年"+l[1]+"月"+l[2]+"号"); - // logger.info(nStr1[(int) l[1]]+"月"+getChinaDate((int) (l[2]))); - // } -} \ No newline at end of file diff --git a/src/main/java/yuelj/utils/dateTime/DateUtil.java b/src/main/java/yuelj/utils/dateTime/DateUtil.java deleted file mode 100644 index ff4f819..0000000 --- a/src/main/java/yuelj/utils/dateTime/DateUtil.java +++ /dev/null @@ -1,407 +0,0 @@ -package yuelj.utils.dateTime; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class DateUtil { - private static Logger logger = LogManager.getLogger(DateUtil.class); - - /** - * 获取当前时间 - *
YYYY-MM-dd HH:mm:ss
-	 * @return
-	 */
-	public static String nowDatetime(){
-		return getDateTimeString(new Date());
-	}
-	/**
-	 * 6位随机数
-	 * 
-	 * @return
-	 */
-	public static String getRandomNum() {
-		Calendar ca = Calendar.getInstance();
-		String la = "" + ca.getTimeInMillis();
-		return la.substring(0, 10);
-	}
-
-	/**
-	 * 星期几
-	 * 
-	 * @return 0星期天,1星期一,2星期二 ... 6星期六
-	 */
-	public static int getWeekDay(Date date) {
-		Calendar c = Calendar.getInstance();
-		c.setTime(date);
-		// int hour=c.get(Calendar.DAY_OF_WEEK);
-		// hour中存的就是星期几了,其范围 1~7
-		// 1=星期日 7=星期六,其他类推
-		return c.get(Calendar.DAY_OF_WEEK) - 1;
-	}
-
-	/**
-	 * 得到小时
-	 * 
-	 * @return 24小时制
-	 */
-	public static int getDayHour() {
-		Calendar c = Calendar.getInstance();
-		c.setTime(new Date());
-		return c.get(Calendar.HOUR_OF_DAY);
-	}
-
-	/**
-	 * 获得当前日期前几天
-	 * 
-	 * @param day
-	 *            提前的天数
-	 * @return String yyyy-MM-dd HH:mm:ss
-	 */
-	public static String getTimeStr(int day) {
-		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		String resultDay = df.format(getTimeDate(day));
-		return resultDay;
-	}
-
-	/**
-	 * 获得当前日期前几天
-	 * 
-	 * @param day
-	 *            提前的天数
-	 * @return Date
-	 */
-	public static Date getTimeDate(int day) {
-		Date d = new Date();
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(d);
-		cal.add(Calendar.DATE, -day);
-		return cal.getTime();
-	}
-
-	/**
-	 * 获取当前时间的前几分钟
-	 * 
-	 * @param minute
-	 *            前几分钟
-	 * @return
-	 */
-	public static String getMinuteStr(int minute) {
-		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		String resultDay = df.format(getMinuteDate(minute));
-		return resultDay;
-	}
-
-	private static Date getMinuteDate(int minute) {
-		Date d = new Date();
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(d);
-		cal.add(Calendar.MINUTE, -minute);
-		return cal.getTime();
-	}
-
-	public static long getHowManyDay(String t) throws ParseException {
-		DateFormat df = DateFormat.getDateInstance();
-		Date date = df.parse(t);
-		Calendar othercal = Calendar.getInstance();
-		othercal.setTime(date);
-		Calendar cal = Calendar.getInstance();
-		long m = cal.getTimeInMillis() - othercal.getTimeInMillis();
-		return ((m / 1000) / 3600) / 24;
-
-	}
-
-	public static long getHowManyMinute(String t) throws ParseException {
-		if (t.contains(".")) {
-			String[] b = t.split("\\.");
-			t = b[0];
-			logger.info(t);
-		}
-		SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		Date date = formatDate.parse(t);
-		Calendar othercal = Calendar.getInstance();
-		othercal.setTime(date);
-		Calendar cal = Calendar.getInstance();
-		long m = cal.getTimeInMillis() - othercal.getTimeInMillis();
-		return (m / 1000) / 60;
-
-	}
-
-	/**
-	 * 以2015-02-09的形式获取今天的日期
-	 * 
-	 * @return
-	 */
-	public static String getTodayStr() {
-		Calendar ca = Calendar.getInstance();
-		String month = ca.get(ca.MONTH) + 1 + "";
-		if (month.length() == 1) {
-			month = "0" + month;
-		}
-		String date = ca.get(ca.DATE) + "";
-		if (date.length() == 1) {
-			date = "0" + date;
-		}
-		return ca.get(ca.YEAR) + "-" + month + "-" + date;
-	}
-
-	/**
-	 * 以2015-02-09的形式获取今天以后day天,day正数表示+负数减
-	 * 
-	 * @return
-	 */
-	public static String getTodayPastStr(int day) {
-		Calendar ca = Calendar.getInstance();
-		ca.add(Calendar.DAY_OF_MONTH, day);
-		String month = ca.get(ca.MONTH) + 1 + "";
-		if (month.length() == 1) {
-			month = "0" + month;
-		}
-		String date = ca.get(ca.DATE) + "";
-		if (date.length() == 1) {
-			date = "0" + date;
-		}
-		return ca.get(ca.YEAR) + "-" + month + "-" + date;
-	}
-
-	public static String getDatePastStr(Date newdate, int day) {
-		Calendar ca = Calendar.getInstance();
-		ca.setTime(newdate);
-		ca.add(Calendar.DAY_OF_MONTH, day);
-		String month = ca.get(ca.MONTH) + 1 + "";
-		if (month.length() == 1) {
-			month = "0" + month;
-		}
-		String date = ca.get(ca.DATE) + "";
-		if (date.length() == 1) {
-			date = "0" + date;
-		}
-		return ca.get(ca.YEAR) + "-" + month + "-" + date;
-	}
-
-	public static String getDateTimePastStr(Date datetime, int day) {
-		Calendar ca = Calendar.getInstance();
-		ca.setTime(datetime);
-		ca.add(Calendar.DAY_OF_MONTH, day);
-		String month = ca.get(ca.MONTH) + 1 + "";
-		if (month.length() == 1) {
-			month = "0" + month;
-		}
-		String date = ca.get(ca.DATE) + "";
-		if (date.length() == 1) {
-			date = "0" + date;
-		}
-		return ca.get(ca.YEAR) + "-" + month + "-" + date;
-	}
-
-	/**
-	 * 返回min分钟后
-	 * 
-	 * @param datetime
-	 * @param min
-	 * @return
-	 */
-	public static Date getDateTimePastMin(Date datetime, int min) {
-		Calendar ca = Calendar.getInstance();
-		ca.setTime(datetime);
-		ca.add(Calendar.MINUTE, min);
-		return ca.getTime();
-	}
-
-	public static Date getTodayPast(int day) {
-		Calendar ca = Calendar.getInstance();
-		ca.add(Calendar.DAY_OF_MONTH, day);
-		return ca.getTime();
-	}
-
-	/**
-	 * 将时间转换为“2014-10-29”的字符串形式
-	 * 
-	 * @param date
-	 * @return
-	 */
-	public static String GetDateString(Date date) {
-		Calendar ca = Calendar.getInstance();
-		ca.setTime(date);
-		String month = ca.get(ca.MONTH) + 1 + "";
-		if (month.length() == 1) {
-			month = "0" + month;
-		}
-		String day = ca.get(ca.DATE) + "";
-		if (day.length() == 1) {
-			day = "0" + day;
-		}
-		return ca.get(ca.YEAR) + "-" + month + "-" + day;
-	}
-
-	/**
-	 * 返回day1-day2的天数差
-	 * 
-	 * @param day1
-	 *            形式 "2004-01-02 11:30:24"
-	 * @param day2
-	 * @return
-	 */
-	public static int getDayMinus(String day1, String day2) {
-		long days = 0;
-		try {
-			DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-			Date d1 = df.parse(day1);
-			Date d2 = df.parse(day2);
-			long diff = d1.getTime() - d2.getTime();
-			days = diff / (1000 * 60 * 60 * 24);
-		} catch (Exception e) {
-		}
-		return (int) Math.ceil(days);
-	}
-
-	/**
-	 * 将时间转换为“2014-10-29 17:33:30”的字符串形式
-	 * 
-	 * @param date
-	 * @return
-	 */
-	public static String getDateTimeString(Date date) {
-		String dateStr = "";
-		DateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		try {
-			dateStr = sdf2.format(date);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return dateStr;
-	}
-
-	/**
-	 * 将时间转换为“ 173330”的字符串形式
-	 * 
-	 * @param date
-	 * @return
-	 */
-	public static String getTimeString(Date date) {
-		String dateStr = "";
-		DateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
-		try {
-			dateStr = sdf2.format(date);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return dateStr;
-	}
-
-	/**
-	 * 根据字符串yyyy-MM-dd HH:mm:ss型时间转型为date
-	 * 
-	 * @param dateStr
-	 * @return
-	 * @throws ParseException
-	 */
-	public static Date parseDateTimeStr(String dateStr) {
-		Date d1 = null;
-		try {
-			DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-			d1 = df.parse(dateStr);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return d1;
-	}
-
-	/**
-	 * 根据字符串型yyyy-MM-dd时间转型为date
-	 * 
-	 * @param dateStr
-	 * @return
-	 * @throws ParseException
-	 */
-	public static Date parseDateStr(String dateStr) {
-		Date d1 = null;
-		try {
-			DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-			d1 = df.parse(dateStr);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return d1;
-	}
-
-	/**
-	 * 计算日期差
-	 * 
-	 * @param now
-	 * @param returnDate
-	 * @return
-	 */
-	public static int daysBetween(Date now, Date returnDate) {
-		Calendar cReturnDate = Calendar.getInstance();
-		Calendar cNow = Calendar.getInstance();
-		cNow.setTime(returnDate);
-		cReturnDate.setTime(now);
-		setTimeToMidnight(cNow);
-		setTimeToMidnight(cReturnDate);
-		long todayMs = cNow.getTimeInMillis();
-		long returnMs = cReturnDate.getTimeInMillis();
-		long intervalMs = todayMs - returnMs;
-		return millisecondsToDays(intervalMs) + 1;
-	}
-
-	/**
-	 * 计算日期差
-	 * 
-	 * @param now
-	 * @param returnDate
-	 * @return
-	 */
-	public static int daysBetween(String nowStr, String returnDateStr) {
-		Calendar cReturnDate = Calendar.getInstance();
-		Calendar cNow = Calendar.getInstance();
-		Date returnDate = DateUtil.parseDateStr(returnDateStr);
-		Date now = DateUtil.parseDateStr(nowStr);
-		cNow.setTime(returnDate);
-		cReturnDate.setTime(now);
-		setTimeToMidnight(cNow);
-		setTimeToMidnight(cReturnDate);
-		long todayMs = cNow.getTimeInMillis();
-		long returnMs = cReturnDate.getTimeInMillis();
-		long intervalMs = todayMs - returnMs;
-		return millisecondsToDays(intervalMs) + 1;
-	}
-
-	public static void main(String[] args) {
-
-		Date startdate = DateUtil.parseDateStr("2015-10-14");
-		Date enddate = DateUtil.parseDateStr("2015-10-15");
-		String a = daysBetween(startdate, enddate) + "";
-		logger.info(a);
-	}
-
-	private static int millisecondsToDays(long intervalMs) {
-		return (int) (intervalMs / (1000 * 86400));
-	}
-
-	private static void setTimeToMidnight(Calendar calendar) {
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-	}
-
-	/**
-	 * 判断是否是周末
-	 * 
-	 * @return
-	 */
-	public static boolean isWeekEnd() {
-		Calendar cal = Calendar.getInstance();
-		if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
-			return true;
-		}
-		return false;
-	}
-}
diff --git a/src/main/java/yuelj/utils/filters/FilterUtil.java b/src/main/java/yuelj/utils/filters/FilterUtil.java
deleted file mode 100644
index 6975de2..0000000
--- a/src/main/java/yuelj/utils/filters/FilterUtil.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package yuelj.utils.filters;
-
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServletResponse;
-
-public class FilterUtil {
-	private static final String CONTENT_TYPE = "application/json;charset=UTF-8";
-
-	public static void setResponse(String json, HttpServletResponse response) {
-		response.setContentType(CONTENT_TYPE);
-		response.setCharacterEncoding("UTF-8");
-		PrintWriter pw = null;
-		try {
-			pw = response.getWriter();
-			pw.write(json);
-			pw.flush();
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			try {
-				if (pw != null)
-					pw.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-
-	}
-}
diff --git a/src/main/java/yuelj/utils/filters/LogFilter.java b/src/main/java/yuelj/utils/filters/LogFilter.java
deleted file mode 100644
index 2f6f82d..0000000
--- a/src/main/java/yuelj/utils/filters/LogFilter.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package yuelj.utils.filters;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-
-import yuelj.entity.SystemLogEntity;
-import yuelj.entity.UserMachineEntity;
-import yuelj.service.SystemLogService;
-import yuelj.service.UserMachineService;
-import yuelj.utils.dateTime.DateUtil;
-import yuelj.utils.logs.LogThread;
-
-/**
- * 日志记录过滤器
- * 
- * @author lxr
- *
- */
-@Controller
-public class LogFilter implements Filter {
-	private static final long serialVersionUID = -4220585371840995250L;
-	@Autowired
-	SystemLogService logservice;
-	@Autowired
-	UserMachineService userMachineS;
-
-	public void destroy() {
-
-	}
-
-	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-			throws IOException, ServletException {
-		chain.doFilter(request, response);
-		HttpServletRequest req = (HttpServletRequest) request;
-		HttpServletResponse resp = (HttpServletResponse) response;
-		HttpSession session = req.getSession(false);
-		// uri
-		String uri = req.getRequestURI();
-
-		String message = "";
-		SystemLogEntity log = new SystemLogEntity();
-		String parm = "";
-		Map properties = request.getParameterMap();
-		// 返回值Map
-		Iterator entries = properties.entrySet().iterator();
-		Map.Entry entry;
-		String name = "";
-		String value = "";
-		String uid = null;
-		while (entries.hasNext()) {
-			entry = (Map.Entry) entries.next();
-			name = (String) entry.getKey();
-			Object valueObj = entry.getValue();
-			if (null == valueObj) {
-				value = "";
-			} else if (valueObj instanceof String[]) {
-				String[] values = (String[]) valueObj;
-				for (int i = 0; i < values.length; i++) {
-					value = values[i] + ",";
-				}
-				value = value.substring(0, value.length() - 1);
-			} else {
-				value = valueObj.toString();
-			}
-			parm = parm + name + ":" + value + ",";
-		}
-		uid = req.getParameter("uid");
-		
-			if (uid != null && uid.length() != 0) {
-				log.setUserid(uid);
-			}
-			String token = req.getParameter("token");
-			if (token != null && token.length() != 0) {
-				log.setToken(token);
-			}
-			message = "匿名访问:" + req.getRequestURI() + ",参数:" + parm;
-		String machine = req.getParameter("machineid");
-		if (machine != null && machine.length() != 0) {
-			log.setMachine(machine);
-		}
-		String devicetype = req.getParameter("devicetype");
-		if (devicetype != null && devicetype.length() != 0) {
-			log.setClienttype(devicetype);
-		}
-		String appversion = req.getParameter("appversion");
-		if (appversion != null && appversion.length() != 0) {
-			log.setAppversion(appversion);
-		}
-
-		log.setContent(message);
-		log.setIp(req.getRemoteAddr());
-		// nginx转发获取ip
-		if (req.getHeader("X-real-ip") != null) {
-			log.setIp(req.getHeader("X-real-ip").toString());
-		}
-		log.setOperation(req.getRequestURI());
-		log.setDatetime(DateUtil.getDateTimeString(new Date()));
-
-		if (!uri.contains("uploadImg") && !uri.contains("selectStock")) {// 加入系统访问日志
-			LogThread logt = new LogThread(log, logservice);
-			Thread logtt = new Thread(logt);
-			logtt.start();
-		}
-		// 记录用户的machine,用于推送等
-		if (machine != null && machine.length() != 0) {
-			UserMachineEntity machineinfo = new UserMachineEntity();
-			machineinfo.setMachine(machine);
-			List mlist = userMachineS.queryUserMachine(machineinfo);
-			if (uid != null && uid.length() != 0) {
-				machineinfo.setUid(uid);
-			} else {
-				machineinfo.setUid("0");
-			}
-			String xiaomiid = req.getParameter("xiaomiid");
-			if (xiaomiid != null && xiaomiid.length() != 0) {
-				machineinfo.setXiaomiid(xiaomiid.replace(" ", "+"));
-			}
-			String otherid1 = req.getParameter("otherid1");
-			if (otherid1 != null && otherid1.length() != 0) {
-				machineinfo.setOtherid1(otherid1);
-			}
-			if (devicetype != null && devicetype.length() != 0) {
-				machineinfo.setDevicetype(devicetype);
-			}
-			if (mlist.size() == 0) {
-				userMachineS.addUserMachine(machineinfo);
-			} else {
-				userMachineS.updateUserMachine(machineinfo);
-			}
-		}
-	}
-
-	public void init(FilterConfig config) throws ServletException {
-
-	}
-}
diff --git a/src/main/java/yuelj/utils/filters/OperatorFilter.java b/src/main/java/yuelj/utils/filters/OperatorFilter.java
deleted file mode 100644
index d7add39..0000000
--- a/src/main/java/yuelj/utils/filters/OperatorFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package yuelj.utils.filters;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-public class OperatorFilter implements Filter {
-	public void destroy() {
-
-	}
-
-	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-			throws IOException, ServletException {
-		HttpServletRequest req = (HttpServletRequest) request;
-		HttpServletResponse resp = (HttpServletResponse) response;
-		HttpSession session = req.getSession(false);
-		// uri
-		String uri = req.getRequestURI();
-
-
-	}
-
-	public void init(FilterConfig config) throws ServletException {
-
-	}
-}
diff --git a/src/main/java/yuelj/utils/filters/UserLoginFilter.java b/src/main/java/yuelj/utils/filters/UserLoginFilter.java
deleted file mode 100644
index 6003ae0..0000000
--- a/src/main/java/yuelj/utils/filters/UserLoginFilter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package yuelj.utils.filters;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import yuelj.constants.CacheKeys;
-import yuelj.utils.StringUtil;
-import yuelj.utils.cache.MemCacheOcsUtils;
-
-public class UserLoginFilter implements Filter {
-
-	public void destroy() {
-
-	}
-
-	public void doFilter(ServletRequest request, ServletResponse response,
-			FilterChain chain) throws IOException, ServletException {
-		HttpServletRequest req = (HttpServletRequest) request;
-		HttpServletResponse resp = (HttpServletResponse) response;
-		HttpSession session = req.getSession(false);
-		// String uri = req.getRequestURI();
-		// 通过token值判断是否需要重新登录
-		String uid = req.getParameter("uid");
-		String token = req.getParameter("token");
-		String servertoken = MemCacheOcsUtils
-				.getData(CacheKeys.APP_TOKEN + uid);
-		if (!StringUtil.isEmpty(servertoken) && !StringUtil.isEmpty(token)
-				&& servertoken.equals(token)) {
-			chain.doFilter(request, response);
-			return;
-		}
-
-	}
-
-	public void init(FilterConfig config) throws ServletException {
-
-	}
-
-}
diff --git a/src/main/java/yuelj/utils/gsonExt/Foo.java b/src/main/java/yuelj/utils/gsonExt/Foo.java
deleted file mode 100644
index 450c738..0000000
--- a/src/main/java/yuelj/utils/gsonExt/Foo.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package yuelj.utils.gsonExt;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD})
-public @interface Foo {
-  // Field tag only annotation
-}
diff --git a/src/main/java/yuelj/utils/gsonExt/MyExclusionStrategy.java b/src/main/java/yuelj/utils/gsonExt/MyExclusionStrategy.java
deleted file mode 100644
index 1102ccc..0000000
--- a/src/main/java/yuelj/utils/gsonExt/MyExclusionStrategy.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package yuelj.utils.gsonExt;
-
-import com.google.gson.ExclusionStrategy;
-import com.google.gson.FieldAttributes;
-
-public class MyExclusionStrategy implements ExclusionStrategy {
-	private final Class typeToSkip;
-
-	public MyExclusionStrategy(Class typeToSkip) {
-		this.typeToSkip = typeToSkip;
-	}
-
-	public boolean shouldSkipClass(Class clazz) {
-		return (clazz == typeToSkip);
-	}
-
-	public boolean shouldSkipField(FieldAttributes f) {
-		return f.getAnnotation(Foo.class) != null;
-	}
-}
\ No newline at end of file
diff --git a/src/main/java/yuelj/utils/interceptors/ExceptionInterceptor.java b/src/main/java/yuelj/utils/interceptors/ExceptionInterceptor.java
deleted file mode 100644
index c1b9ea6..0000000
--- a/src/main/java/yuelj/utils/interceptors/ExceptionInterceptor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package yuelj.utils.interceptors;
-
-import java.util.Properties;
-
-import org.apache.ibatis.plugin.Interceptor;
-import org.apache.ibatis.plugin.Invocation;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-public class ExceptionInterceptor implements Interceptor {
-	private static Logger logger = LogManager.getLogger(ExceptionInterceptor.class);
-	private static final long serialVersionUID = -4654850207254592726L;
-
-	public void destroy() {
-
-	}
-
-	public void init() {
-
-	}
-
-	@Override
-	public Object intercept(Invocation actionInvocation) throws Throwable {
-		String methodName = actionInvocation.getMethod().getName();
-		String className = actionInvocation.getClass().getName();
-		String result = "";
-		try {
-			if (actionInvocation != null) {
-				actionInvocation.proceed();
-			}
-		} catch (Exception e) {
-			logger.info("method:" + methodName + ",in class:" + className + ",exception :" + e);
-		}
-		return result;
-	}
-
-	@Override
-	public Object plugin(Object target) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void setProperties(Properties properties) {
-		// TODO Auto-generated method stub
-
-	}
-}
diff --git a/src/main/java/yuelj/utils/logs/LogThread.java b/src/main/java/yuelj/utils/logs/LogThread.java
deleted file mode 100644
index 1dbd3f8..0000000
--- a/src/main/java/yuelj/utils/logs/LogThread.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package yuelj.utils.logs;
-
-import yuelj.entity.SystemLogEntity;
-import yuelj.service.SystemLogService;
-
-public class LogThread implements Runnable {
-	private SystemLogService logservice;
-	private SystemLogEntity log;
-
-	public LogThread(SystemLogEntity log, SystemLogService logservice) {
-		this.log = log;
-		this.logservice = logservice;
-	}
-
-	@Override
-	public void run() {
-		// 加入系统访问日志
-		logservice.insertSystemLog(log);
-	}
-
-}
diff --git a/src/main/java/yuelj/utils/md5encrypt/Md5.java b/src/main/java/yuelj/utils/md5encrypt/Md5.java
deleted file mode 100644
index d3893ee..0000000
--- a/src/main/java/yuelj/utils/md5encrypt/Md5.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package yuelj.utils.md5encrypt;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/*
- * MD5 算法
- */
-public class Md5 {
-
-	// 全局数组
-	private final static String[] strDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d",
-			"e", "f" };
-
-	public Md5() {
-	}
-
-	// 返回形式为数字跟字符串
-	private static String byteToArrayString(byte bByte) {
-		int iRet = bByte;
-		// logger.info("iRet="+iRet);
-		if (iRet < 0) {
-			iRet += 256;
-		}
-		int iD1 = iRet / 16;
-		int iD2 = iRet % 16;
-		return strDigits[iD1] + strDigits[iD2];
-	}
-
-	// 转换字节数组为16进制字串
-	private static String byteToString(byte[] bByte) {
-		StringBuffer sBuffer = new StringBuffer();
-		for (int i = 0; i < bByte.length; i++) {
-			sBuffer.append(byteToArrayString(bByte[i]));
-		}
-		return sBuffer.toString();
-	}
-
-	/**
-	 * 普通的md5加密
-	 * 
-	 * @param strObj
-	 * @return
-	 */
-	public static String GetMD5Code(String strObj) {
-		String resultString = null;
-		try {
-			resultString = new String(strObj);
-			MessageDigest md = MessageDigest.getInstance("MD5");
-			// md.digest() 该函数返回值为存放哈希值结果的byte数组
-			resultString = byteToString(md.digest(strObj.getBytes()));
-		} catch (NoSuchAlgorithmException ex) {
-			ex.printStackTrace();
-		}
-		return resultString;
-	}
-
-	public static void main(String[] args) {
-		String pwd = "2ac4780bfb6c4d55edb037a162d54066";
-		String salt = "w0XnYY";
-	}
-}
\ No newline at end of file
diff --git a/src/main/java/yuelj/utils/md5encrypt/Md5PwdExhaustive.java b/src/main/java/yuelj/utils/md5encrypt/Md5PwdExhaustive.java
deleted file mode 100644
index d60b27a..0000000
--- a/src/main/java/yuelj/utils/md5encrypt/Md5PwdExhaustive.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package yuelj.utils.md5encrypt;
-
-public class Md5PwdExhaustive {
-	// 密码可能会包含的字符集合
-	static char[] charSource = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
-			'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
-	static int sLength = charSource.length; // 字符集长度
-
-	public static void main(String[] args) {
-		long beginMillis = System.currentTimeMillis();
-		System.out.println("开始");
-		 // 设置可能最长的密码长度
-		int maxLength = 6;
-		CrackPass(maxLength);
-		long endMillis = System.currentTimeMillis();
-		System.out.println("结束,耗时:" +(float) (endMillis - beginMillis) / 1000 + "秒");
-	}
-
-	// 得到密码长度从 1到maxLength的所有不同长的密码集合
-	public static void CrackPass(int maxLength) {
-		for (int i = 1; i <= maxLength; i++) {
-			char[] list = new char[i];
-			Crack(list, i);
-		}
-
-	}
-
-	// 得到长度为len所有的密码组合,在字符集charSource中
-	// 递归表达式:fn(n)=fn(n-1)*sLenght; 大致是这个意思吧
-	private static void Crack(char[] list, int len) {
-		if (len == 0) { // 递归出口,list char[] 转换为字符串,并打印
-			//System.out.println(ArrayToString(list));
-		} else {
-			for (int i = 0; i < sLength; i++) {
-				list[len - 1] = charSource[i];
-				Crack(list, len - 1);
-			}
-		}
-	}
-
-	// list char[] 转换为字符串
-	private static String ArrayToString(char[] list) {
-		if (list == null || list.length == 0)
-			return "";
-		StringBuilder buider = new StringBuilder(list.length * 2);
-		for (int i = 0; i < list.length; i++) {
-			buider.append(list[i]);
-		}
-		return buider.toString();
-
-	}
-}
diff --git a/src/main/java/yuelj/utils/serialize/JsonUtils.java b/src/main/java/yuelj/utils/serialize/JsonUtils.java
deleted file mode 100644
index fb48af9..0000000
--- a/src/main/java/yuelj/utils/serialize/JsonUtils.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package yuelj.utils.serialize;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
-
-import yuelj.entity.ListPo;
-
-public class JsonUtils {
-
-	private static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
-	private static Gson gsonAll = new GsonBuilder().create();
-
-	public static String toJson(Object src, Type typeOfSrc) {
-		return gson.toJson(src, typeOfSrc);
-	}
-	public static String toJsonAll(Object src, Type typeOfSrc) {
-		return gsonAll.toJson(src, typeOfSrc);
-	}
-	public static  T fromJson(String json, Class classOfT) {
-		return (T) gson.fromJson(json, classOfT);
-	}
-
-	public static  String toListJson(List list) {
-		ListPo listpo = new ListPo();
-		listpo.setList(list);
-		return gson.toJson(listpo, new TypeToken>() {
-		}.getType());
-	}
-
-	public static  ListPo fromListJson(String json, Type t) {
-		return gson.fromJson(json, t);
-	}
-
-}
diff --git a/src/main/java/yuelj/utils/serialize/KryoSerializer.java b/src/main/java/yuelj/utils/serialize/KryoSerializer.java
deleted file mode 100644
index 49dd15b..0000000
--- a/src/main/java/yuelj/utils/serialize/KryoSerializer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package yuelj.utils.serialize;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-/**
- * Kryo序列化和反序列化
- * 
- * @author lilm8
- *
- * @param 
- */
-public class KryoSerializer {
-
-	private Kryo kryo = new Kryo();
-
-	public byte[] serialize(Object t) throws IOException {
-		byte[] buffer = new byte[toByteArray(t).length];
-		Output output = new Output(buffer);
-		kryo.writeClassAndObject(output, t);
-		return output.toBytes();
-
-	}
-
-	public T deserialize(byte[] bytes) {
-		Input input = new Input(bytes);
-		@SuppressWarnings("unchecked")
-		T t = (T) kryo.readClassAndObject(input);
-		return t;
-	}
-
-	/**
-	 * Object to Byte
-	 * 
-	 * @param obj
-	 * @return
-	 * @throws IOException
-	 */
-	private byte[] toByteArray(Object obj) throws IOException {
-		byte[] bytes = null;
-		ByteArrayOutputStream bos = null;
-		ObjectOutputStream oos = null;
-		try {
-			bos = new ByteArrayOutputStream();
-			oos = new ObjectOutputStream(bos);
-			oos.writeObject(obj);
-			oos.flush();
-			bytes = bos.toByteArray();
-			oos.close();
-			oos = null;
-			bos.close();
-			bos = null;
-		} catch (IOException ex) {
-			ex.printStackTrace();
-		} finally {
-			if (oos != null) {
-				oos.close();
-			}
-			if (bos != null) {
-				bos.close();
-			}
-		}
-		return bytes;
-	}
-
-}