├── .classpath ├── .factorypath ├── .idea ├── compiler.xml ├── encodings.xml ├── libraries │ ├── Maven__cglib_cglib_nodep_3_2_5.xml │ ├── Maven__ch_qos_logback_logback_access_1_2_3.xml │ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml │ ├── Maven__com_alibaba_druid_1_0_29.xml │ ├── Maven__com_alibaba_fastjson_1_2_54.xml │ ├── Maven__com_baomidou_mybatis_plus_3_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_annotation_3_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_boot_starter_3_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_core_3_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_extension_3_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_generator_3_0_3.xml │ ├── Maven__com_beust_jcommander_1_72.xml │ ├── Maven__com_esotericsoftware_reflectasm_1_11_7.xml │ ├── Maven__com_fasterxml_classmate_1_3_4.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_9_5.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_9_5.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_5.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_5.xml │ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_5.xml │ ├── Maven__com_github_ben_manes_caffeine_caffeine_2_6_2.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_1_2.xml │ ├── Maven__com_github_ulisesbocchio_jasypt_spring_boot_1_14.xml │ ├── Maven__com_github_ulisesbocchio_jasypt_spring_boot_starter_1_14.xml │ ├── Maven__com_google_protobuf_protobuf_java_3_6_1.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml │ ├── Maven__com_jfinal_jfinal_3_5.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__com_zaxxer_HikariCP_2_7_8.xml │ ├── Maven__commons_codec_commons_codec_1_11.xml │ ├── Maven__io_micrometer_micrometer_core_1_0_3.xml │ ├── Maven__javax_annotation_javax_annotation_api_1_3_2.xml │ ├── Maven__javax_validation_validation_api_2_0_1_Final.xml │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__mysql_mysql_connector_java_5_1_46.xml │ ├── Maven__net_bytebuddy_byte_buddy_1_7_11.xml │ ├── Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml │ ├── Maven__net_minidev_accessors_smart_1_2.xml │ ├── Maven__net_minidev_json_smart_2_3.xml │ ├── Maven__net_sf_ehcache_ehcache_2_10_4.xml │ ├── Maven__org_apache_commons_commons_lang3_3_7.xml │ ├── Maven__org_apache_commons_commons_pool2_2_5_0.xml │ ├── Maven__org_apache_extras_beanshell_bsh_2_0b6.xml │ ├── Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml │ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_29.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_29.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_29.xml │ ├── Maven__org_apache_velocity_velocity_engine_core_2_0.xml │ ├── Maven__org_assertj_assertj_core_3_9_1.xml │ ├── Maven__org_freemarker_freemarker_2_3_23.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml │ ├── Maven__org_hdrhistogram_HdrHistogram_2_1_10.xml │ ├── Maven__org_hibernate_validator_hibernate_validator_6_0_9_Final.xml │ ├── Maven__org_jasypt_jasypt_1_9_2.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml │ ├── Maven__org_jboss_netty_netty_3_2_10_Final.xml │ ├── Maven__org_latencyutils_LatencyUtils_2_0_3.xml │ ├── Maven__org_mockito_mockito_core_2_15_0.xml │ ├── Maven__org_mybatis_mybatis_3_4_6.xml │ ├── Maven__org_mybatis_mybatis_spring_1_3_2.xml │ ├── Maven__org_objenesis_objenesis_2_6.xml │ ├── Maven__org_ow2_asm_asm_5_0_4.xml │ ├── Maven__org_projectlombok_lombok_1_18_4.xml │ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml │ ├── Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml │ ├── Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml │ ├── Maven__org_springframework_boot_spring_boot_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_actuator_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_configuration_processor_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_actuator_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_cache_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_data_redis_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_1_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_commons_2_0_6_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_keyvalue_2_0_6_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_redis_2_0_6_RELEASE.xml │ ├── Maven__org_springframework_spring_aop_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_context_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_core_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_jcl_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_oxm_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_test_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_web_5_0_5_RELEASE.xml │ ├── Maven__org_springframework_spring_webmvc_5_0_5_RELEASE.xml │ ├── Maven__org_t_io_tio_core_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_t_io_tio_http_common_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_t_io_tio_http_server_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_t_io_tio_utils_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_t_io_tio_websocket_common_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_t_io_tio_websocket_server_3_2_1_v20181024_RELEASE.xml │ ├── Maven__org_testng_testng_6_14_3.xml │ ├── Maven__org_xmlunit_xmlunit_core_2_5_1.xml │ ├── Maven__org_yaml_snakeyaml_1_19.xml │ └── Maven__redis_clients_jedis_2_9_0.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.apt.core.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.ltk.core.refactoring.prefs ├── org.eclipse.m2e.core.prefs ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.xsl.core.prefs └── org.springframework.ide.eclipse.prefs ├── LICENSE ├── cloudtalk-websocket.iml ├── install.bat ├── pom.xml ├── script └── pkg.xml ├── src └── main │ ├── java │ ├── META-INF │ │ └── MANIFEST.MF │ └── com │ │ └── zhangwuji │ │ └── im │ │ ├── CTServerApplication.java │ │ ├── CodeGenerator.java │ │ ├── StartTioRunner.java │ │ ├── api │ │ ├── common │ │ │ ├── ControllerUtil.java │ │ │ └── JavaBeanUtil.java │ │ ├── config │ │ │ ├── CaseInsensitiveRequestParameterNameFilter.java │ │ │ ├── MybatisPlusConfig.java │ │ │ └── WebConfig.java │ │ ├── controller │ │ │ └── ApiController.java │ │ ├── entity │ │ │ ├── GeoBean.java │ │ │ ├── IMAudio.java │ │ │ ├── IMDepart.java │ │ │ ├── IMDiscovery.java │ │ │ ├── IMGroup.java │ │ │ ├── IMGroupMember.java │ │ │ ├── IMRecentSession.java │ │ │ ├── IMTransmitFile.java │ │ │ ├── IMUser.java │ │ │ ├── IMUserFriends.java │ │ │ ├── IMUserGeoData.java │ │ │ ├── ServerInfoEntity.java │ │ │ └── baseEntity.java │ │ ├── mapper │ │ │ ├── IMAudioMapper.java │ │ │ ├── IMDepartMapper.java │ │ │ ├── IMDiscoveryMapper.java │ │ │ ├── IMGroupMapper.java │ │ │ ├── IMGroupMemberMapper.java │ │ │ ├── IMRecentSessionMapper.java │ │ │ ├── IMTransmitFileMapper.java │ │ │ ├── IMUserFriendsMapper.java │ │ │ ├── IMUserGeoDataMapper.java │ │ │ └── IMUserMapper.java │ │ ├── result │ │ │ ├── ApiResult.java │ │ │ └── userinfoVo.java │ │ └── service │ │ │ ├── IIMAudioService.java │ │ │ ├── IIMDepartService.java │ │ │ ├── IIMDiscoveryService.java │ │ │ ├── IIMGroupMemberService.java │ │ │ ├── IIMGroupService.java │ │ │ ├── IIMRecentSessionService.java │ │ │ ├── IIMTransmitFileService.java │ │ │ ├── IIMUserFriendsService.java │ │ │ ├── IIMUserGeoDataService.java │ │ │ ├── IIMUserService.java │ │ │ └── impl │ │ │ ├── IMAudioServiceImpl.java │ │ │ ├── IMDepartServiceImpl.java │ │ │ ├── IMDiscoveryServiceImpl.java │ │ │ ├── IMGroupMemberServiceImpl.java │ │ │ ├── IMGroupServiceImpl.java │ │ │ ├── IMRecentSessionServiceImpl.java │ │ │ ├── IMTransmitFileServiceImpl.java │ │ │ ├── IMUserFriendsServiceImpl.java │ │ │ ├── IMUserGeoDataServiceImpl.java │ │ │ └── IMUserServiceImpl.java │ │ ├── callback │ │ ├── IMListener.java │ │ ├── ListenerQueue.java │ │ └── Packetlistener.java │ │ ├── config │ │ ├── CorsConfig.java │ │ ├── DBConstant.java │ │ ├── HandlerConstant.java │ │ ├── IntentConstant.java │ │ ├── MessageConstant.java │ │ ├── RedisCacheHelper.java │ │ ├── RedisConfig.java │ │ ├── SysConstant.java │ │ ├── UrlConstant.java │ │ └── packageInfo │ │ ├── protobuf │ │ ├── IMBaseDefine.java │ │ ├── IMBuddy.java │ │ ├── IMFile.java │ │ ├── IMGroup.java │ │ ├── IMLogin.java │ │ ├── IMMessage.java │ │ ├── IMOther.java │ │ ├── IMServer.java │ │ ├── IMSwitchService.java │ │ ├── MessageEntity.java │ │ ├── TextMessage.java │ │ ├── base │ │ │ ├── DataBuffer.java │ │ │ ├── DefaultHeader.java │ │ │ └── Header.java │ │ └── helper │ │ │ ├── Java2ProtoBuf.java │ │ │ ├── MsgAnalyzeEngine.java │ │ │ └── ProtoBuf2JavaBean.java │ │ ├── support │ │ ├── Command.java │ │ ├── ImPacket.java │ │ ├── ImStatus.java │ │ ├── JsonKit.java │ │ ├── MsgServerHandler.java │ │ ├── Protocol.java │ │ ├── RespBody.java │ │ ├── SequenceNumberMaker.java │ │ ├── SocketThread.java │ │ └── Status.java │ │ └── websocket │ │ └── server │ │ ├── IMMsgServerManager.java │ │ ├── IMWebSocketIpStatListener.java │ │ ├── IMWebSocketManager.java │ │ ├── IMWebSocketServerAioListener.java │ │ ├── IMWebSocketServerConfig.java │ │ ├── IMWebSocketStarter.java │ │ └── IMWebSocketWsMsgHandler.java │ └── resources │ ├── app.properties │ ├── application-local.properties │ ├── application-prod.properties │ ├── application-qa.properties │ ├── application.properties │ ├── config │ └── ssl │ │ ├── im.b56.cn.jks │ │ ├── imtt.b56.cn.jks │ │ └── keystore.jks │ ├── ehcache.xml │ ├── logback.properties │ ├── logback.xml │ └── mapper │ └── api │ ├── IMAudioMapper.xml │ ├── IMDepartMapper.xml │ ├── IMDiscoveryMapper.xml │ ├── IMGroupMapper.xml │ ├── IMGroupMemberMapper.xml │ ├── IMRecentSessionMapper.xml │ ├── IMTransmitFileMapper.xml │ ├── IMUserFriendsMapper.xml │ ├── IMUserGeoDataMapper.xml │ └── IMUserMapper.xml └── startup.sh /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__cglib_cglib_nodep_3_2_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_access_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_druid_1_0_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_fastjson_1_2_54.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_annotation_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_boot_starter_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_core_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_extension_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_generator_3_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_beust_jcommander_1_72.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_esotericsoftware_reflectasm_1_11_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_classmate_1_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_6_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_ulisesbocchio_jasypt_spring_boot_1_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_ulisesbocchio_jasypt_spring_boot_starter_1_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_6_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jfinal_jfinal_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_zaxxer_HikariCP_2_7_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_micrometer_micrometer_core_1_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_validation_validation_api_2_0_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_5_1_46.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_7_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_sf_ehcache_ehcache_2_10_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_pool2_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_extras_beanshell_bsh_2_0b6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_assertj_assertj_core_3_9_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_freemarker_freemarker_2_3_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hdrhistogram_HdrHistogram_2_1_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hibernate_validator_hibernate_validator_6_0_9_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jasypt_jasypt_1_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_netty_netty_3_2_10_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_latencyutils_LatencyUtils_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_2_15_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_projectlombok_lombok_1_18_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_configuration_processor_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_actuator_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_cache_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_redis_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_0_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_keyvalue_2_0_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_redis_2_0_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jcl_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_oxm_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_5_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_core_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_http_common_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_http_server_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_utils_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_websocket_common_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_t_io_tio_websocket_server_3_2_1_v20181024_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_testng_testng_6_14_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_5_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__redis_clients_jedis_2_9_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | IMWebsocket-server 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.springframework.ide.eclipse.boot.validation.springbootbuilder 20 | 21 | 22 | 23 | 24 | org.springframework.ide.eclipse.core.springbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.ide.eclipse.core.springnature 36 | org.eclipse.jdt.core.javanature 37 | org.eclipse.m2e.core.maven2Nature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | 40 | 41 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/main/resources/app.properties=UTF-8 5 | encoding//src/main/resources/application-local.properties=UTF-8 6 | encoding//src/main/resources/application-prod.properties=UTF-8 7 | encoding//src/main/resources/application-qa.properties=UTF-8 8 | encoding//src/main/resources/application.properties=UTF-8 9 | encoding//src/main/resources/logback.properties=UTF-8 10 | encoding//src/test/java=UTF-8 11 | encoding/=UTF-8 12 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=true 3 | org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations 4 | org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 13 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 14 | org.eclipse.jdt.core.compiler.release=disabled 15 | org.eclipse.jdt.core.compiler.source=1.8 16 | -------------------------------------------------------------------------------- /.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.xsl.core.prefs: -------------------------------------------------------------------------------- 1 | CHECK_CALL_TEMPLATES=2 2 | CHECK_XPATHS=2 3 | CIRCULAR_REF=2 4 | DUPLICATE_PARAMETER=2 5 | EMPTY_PARAM=1 6 | MISSING_INCLUDE=2 7 | MISSING_PARAM=1 8 | NAME_ATTRIBUTE_EMPTY=2 9 | NAME_ATTRIBUTE_MISSING=2 10 | TEMPLATE_CONFLICT=2 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /.settings/org.springframework.ide.eclipse.prefs: -------------------------------------------------------------------------------- 1 | boot.validation.initialized=true 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /install.bat: -------------------------------------------------------------------------------- 1 | call mvn clean install 2 | 3 | 4 | pause -------------------------------------------------------------------------------- /script/pkg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | dist 4 | 5 | 6 | dir 7 | 8 | 9 | false 10 | 11 | 12 | 13 | 14 | 15 | ${project.basedir}/src/main/resources 16 | config 17 | 18 | 19 | 20 | ${project.basedir} 21 | 22 | 23 | startup.* 24 | debug.* 25 | _cmd.* 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | lib 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: jackson-core-2.9.5.jar commons-pool2-2.5.0.jar slf4j-api-1 3 | .7.25.jar micrometer-core-1.0.3.jar druid-1.0.29.jar spring-jdbc-5.0. 4 | 5.RELEASE.jar LatencyUtils-2.0.3.jar log4j-to-slf4j-2.10.0.jar netty- 5 | 3.2.10.Final.jar logback-classic-1.2.3.jar spring-context-5.0.5.RELEA 6 | SE.jar spring-boot-starter-tomcat-2.0.1.RELEASE.jar reflectasm-1.11.7 7 | .jar mybatis-plus-core-3.0.3.jar tio-websocket-common-3.2.1.v20181024 8 | -RELEASE.jar logback-core-1.2.3.jar spring-data-commons-2.0.6.RELEASE 9 | .jar spring-aop-5.0.5.RELEASE.jar tio-core-3.2.1.v20181024-RELEASE.ja 10 | r javax.annotation-api-1.3.2.jar classmate-1.3.4.jar commons-lang3-3. 11 | 7.jar freemarker-2.3.23.jar spring-boot-starter-json-2.0.1.RELEASE.ja 12 | r tomcat-embed-el-8.5.29.jar spring-tx-5.0.5.RELEASE.jar jcl-over-slf 13 | 4j-1.7.25.jar ehcache-2.10.4.jar jackson-datatype-jsr310-2.9.5.jar sp 14 | ring-oxm-5.0.5.RELEASE.jar commons-codec-1.11.jar logback-access-1.2. 15 | 3.jar mybatis-plus-boot-starter-3.0.3.jar tio-utils-3.2.1.v20181024-R 16 | ELEASE.jar spring-boot-autoconfigure-2.0.1.RELEASE.jar jackson-dataty 17 | pe-jdk8-2.9.5.jar spring-boot-configuration-processor-2.0.1.RELEASE.j 18 | ar log4j-over-slf4j-1.7.25.jar fastjson-1.2.54.jar mysql-connector-ja 19 | va-5.1.46.jar velocity-engine-core-2.0.jar mybatis-3.4.6.jar tio-http 20 | -common-3.2.1.v20181024-RELEASE.jar spring-expression-5.0.5.RELEASE.j 21 | ar mybatis-plus-generator-3.0.3.jar log4j-api-2.10.0.jar spring-boot- 22 | starter-jdbc-2.0.1.RELEASE.jar spring-data-redis-2.0.6.RELEASE.jar sp 23 | ring-core-5.0.5.RELEASE.jar spring-boot-starter-data-redis-2.0.1.RELE 24 | ASE.jar validation-api-2.0.1.Final.jar spring-boot-starter-web-2.0.1. 25 | RELEASE.jar spring-boot-starter-logging-2.0.1.RELEASE.jar spring-boot 26 | -starter-2.0.1.RELEASE.jar HikariCP-2.7.8.jar mybatis-plus-3.0.3.jar 27 | spring-boot-2.0.1.RELEASE.jar mybatis-plus-annotation-3.0.3.jar jfina 28 | l-3.5.jar cglib-nodep-3.2.5.jar jasypt-spring-boot-1.14.jar protobuf- 29 | java-3.6.1.jar spring-boot-starter-cache-2.0.1.RELEASE.jar snakeyaml- 30 | 1.19.jar jsqlparser-1.2.jar HdrHistogram-2.1.10.jar jackson-annotatio 31 | ns-2.9.0.jar spring-beans-5.0.5.RELEASE.jar jackson-databind-2.9.5.ja 32 | r mybatis-spring-1.3.2.jar jul-to-slf4j-1.7.25.jar jackson-module-par 33 | ameter-names-2.9.5.jar caffeine-2.6.2.jar spring-data-keyvalue-2.0.6. 34 | RELEASE.jar tomcat-embed-core-8.5.29.jar spring-jcl-5.0.5.RELEASE.jar 35 | jasypt-1.9.2.jar jasypt-spring-boot-starter-1.14.jar spring-boot-act 36 | uator-2.0.1.RELEASE.jar tio-websocket-server-3.2.1.v20181024-RELEASE. 37 | jar spring-boot-starter-actuator-2.0.1.RELEASE.jar jboss-logging-3.3. 38 | 2.Final.jar spring-context-support-5.0.5.RELEASE.jar tomcat-embed-web 39 | socket-8.5.29.jar spring-boot-actuator-autoconfigure-2.0.1.RELEASE.ja 40 | r spring-web-5.0.5.RELEASE.jar hibernate-validator-6.0.9.Final.jar ti 41 | o-http-server-3.2.1.v20181024-RELEASE.jar mybatis-plus-extension-3.0. 42 | 3.jar spring-webmvc-5.0.5.RELEASE.jar jedis-2.9.0.jar javax.servlet-a 43 | pi-3.0.1.jar 44 | Main-Class: com.zhangwuji.im.CTServerApplication 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/CTServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.web.servlet.ServletComponentScan; 8 | import org.springframework.cache.annotation.EnableCaching; 9 | import org.springframework.context.ConfigurableApplicationContext; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | import com.zhangwuji.im.websocket.server.IMWebSocketServerConfig; 13 | 14 | @SpringBootApplication 15 | @EnableCaching 16 | @Configuration 17 | @ServletComponentScan("com.zhangwuji.im") 18 | @MapperScan("com.zhangwuji.im") 19 | public class CTServerApplication { 20 | 21 | @SuppressWarnings("unused") 22 | public static void main(String[] args) { 23 | ConfigurableApplicationContext context = SpringApplication.run(CTServerApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/StartTioRunner.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.stereotype.Component; 7 | 8 | import com.jfinal.kit.PropKit; 9 | import com.zhangwuji.im.websocket.server.IMMsgServerManager; 10 | import com.zhangwuji.im.websocket.server.IMWebSocketServerConfig; 11 | import com.zhangwuji.im.websocket.server.IMWebSocketStarter; 12 | import com.zhangwuji.im.websocket.server.IMWebSocketWsMsgHandler; 13 | 14 | import javax.annotation.Resource; 15 | 16 | @Component 17 | @Configuration 18 | public class StartTioRunner implements CommandLineRunner { 19 | 20 | private IMWebSocketWsMsgHandler tioWsMsgHandler; 21 | 22 | private IMWebSocketStarter appStarter; 23 | 24 | @Value("${IMAPPID}") 25 | public String IMAPPID; 26 | /* 27 | * HttpMsgServer服务器的ip和端口,一般放在同一服务器最佳 28 | */ 29 | @Value("${HttpMsgServerIp}") 30 | public String HttpMsgServer="127.0.0.1"; 31 | 32 | @Value("${HttpMsgServerPort}") 33 | public int HttpMsgServerPort=9900; 34 | /** 35 | * 监听的ip 36 | */ 37 | @Value("${SERVER_IP}") 38 | public String SERVER_IP = null;//null表示监听所有,并不指定ip 39 | 40 | /** 41 | * 监听端口 对Web开放的端口 ws/wss 42 | */ 43 | @Value("${SERVER_PORT}") 44 | public int SERVER_PORT = 9326; 45 | 46 | 47 | @Override 48 | public void run(String... args) throws Exception { 49 | 50 | // //从配置文件里面读取参数配置 51 | // PropKit.use("app.properties"); 52 | // IMWebSocketServerConfig.instance().SERVER_IP=PropKit.get("SERVER_IP"); 53 | // IMWebSocketServerConfig.instance().SERVER_PORT=PropKit.getInt("SERVER_PORT"); 54 | // IMWebSocketServerConfig.instance().IMAPPID=PropKit.get("IMAPPID"); 55 | // IMWebSocketServerConfig.instance().HttpMsgServer=PropKit.get("HttpMsgServerIp"); 56 | // IMWebSocketServerConfig.instance().HttpMsgServerPort=PropKit.getInt("HttpMsgServerPort"); 57 | 58 | try 59 | { 60 | //从springboot中读取配置文件 61 | IMWebSocketServerConfig.instance().SERVER_IP=SERVER_IP; 62 | IMWebSocketServerConfig.instance().SERVER_PORT=SERVER_PORT; 63 | IMWebSocketServerConfig.instance().IMAPPID=IMAPPID; 64 | IMWebSocketServerConfig.instance().HttpMsgServer=HttpMsgServer; 65 | IMWebSocketServerConfig.instance().HttpMsgServerPort=HttpMsgServerPort; 66 | this.appStarter = new IMWebSocketStarter(IMWebSocketServerConfig.instance().SERVER_PORT, tioWsMsgHandler.me); 67 | appStarter.getWsServerStarter().start(); 68 | 69 | IMMsgServerManager.instance().initConnectHttpServer(); 70 | IMMsgServerManager.instance().initHeartBeat(); 71 | 72 | }catch(Exception e) {} 73 | 74 | 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/common/JavaBeanUtil.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.common; 2 | 3 | import java.beans.BeanInfo; 4 | import java.beans.IntrospectionException; 5 | import java.beans.Introspector; 6 | import java.beans.PropertyDescriptor; 7 | import java.lang.reflect.InvocationTargetException; 8 | import java.lang.reflect.Method; 9 | import java.util.*; 10 | import java.util.Map.Entry; 11 | 12 | import com.zhangwuji.im.api.entity.GeoBean; 13 | import org.springframework.stereotype.Component; 14 | 15 | @Component 16 | public class JavaBeanUtil { 17 | 18 | public List sublist(List clubs,int pageIndex,int pageSize) 19 | { 20 | List geoBeanList =new LinkedList<>(); 21 | int currIdx = (pageIndex > 1 ? (pageIndex -1) * pageSize : 0); 22 | for (int i = 0; i < pageSize && i < clubs.size() - currIdx; i++) { 23 | GeoBean geoBean = clubs.get(currIdx + i); 24 | geoBeanList.add(geoBean); 25 | } 26 | return geoBeanList; 27 | } 28 | 29 | /** 30 | * 使用 Map按value进行排序 31 | * 32 | * @param 33 | * @return 34 | */ 35 | public Map sortMapByValue(Map oriMap) { 36 | if (oriMap == null || oriMap.isEmpty()) { 37 | return null; 38 | } 39 | Map sortedMap = new LinkedHashMap(); 40 | List> entryList = new ArrayList>(oriMap.entrySet()); 41 | 42 | Collections.sort(entryList, new MapValueComparator()); 43 | 44 | Iterator> iter = entryList.iterator(); 45 | Map.Entry tmpEntry = null; 46 | while (iter.hasNext()) { 47 | tmpEntry = iter.next(); 48 | sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue()); 49 | } 50 | return sortedMap; 51 | } 52 | 53 | public class MapValueComparator implements Comparator> { 54 | @Override 55 | public int compare(Entry me1, Entry me2) { 56 | return me1.getValue().toString().compareTo(me2.getValue().toString()); 57 | } 58 | } 59 | 60 | public Object getFirstKeyFromMap(Map map) { 61 | Object obj = null; 62 | for (Entry entry : map.entrySet()) { 63 | obj = entry.getKey(); 64 | if (obj != null) { 65 | break; 66 | } 67 | } 68 | return obj; 69 | } 70 | 71 | public static Map convertBeanToMap(Object bean) { 72 | try { 73 | Class type = bean.getClass(); 74 | Map returnMap = new HashMap(); 75 | BeanInfo beanInfo = Introspector.getBeanInfo(type); 76 | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); 77 | for (int i = 0; i < propertyDescriptors.length; i++) { 78 | PropertyDescriptor descriptor = propertyDescriptors[i]; 79 | String propertyName = descriptor.getName(); 80 | if (!propertyName.equals("class")) { 81 | Method readMethod = descriptor.getReadMethod(); 82 | Object result = readMethod.invoke(bean, new Object[0]); 83 | if (result != null) { 84 | returnMap.put(propertyName, result); 85 | } else { 86 | returnMap.put(propertyName, ""); 87 | } 88 | } 89 | } 90 | return returnMap; 91 | }catch (Exception ee){return null;} 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/config/CaseInsensitiveRequestParameterNameFilter.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.config; 2 | 3 | import java.io.IOException; 4 | import java.util.Collections; 5 | import java.util.Enumeration; 6 | import java.util.Map; 7 | import javax.servlet.FilterChain; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletRequestWrapper; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | import org.springframework.core.annotation.Order; 15 | import org.springframework.util.LinkedCaseInsensitiveMap; 16 | import org.springframework.web.filter.OncePerRequestFilter; 17 | 18 | @Order(1) 19 | @WebFilter(filterName = "caseInsensitiveFilter", urlPatterns = "/*") 20 | public class CaseInsensitiveRequestParameterNameFilter extends OncePerRequestFilter { 21 | 22 | public CaseInsensitiveRequestParameterNameFilter() { 23 | System.out.println("CaseInsensitiveRequestParameterNameFilter.CaseInsensitiveRequestParameterNameFilter()"); 24 | } 25 | 26 | @Override 27 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) 28 | throws ServletException, IOException { 29 | filterChain.doFilter(new CaseInsensitiveParameterNameHttpServletRequest(request), response); 30 | } 31 | 32 | public static class CaseInsensitiveParameterNameHttpServletRequest extends HttpServletRequestWrapper { 33 | private final LinkedCaseInsensitiveMap map = new LinkedCaseInsensitiveMap<>(); 34 | 35 | public CaseInsensitiveParameterNameHttpServletRequest(HttpServletRequest request) { 36 | super(request); 37 | map.putAll(request.getParameterMap()); 38 | } 39 | 40 | @Override 41 | public String getParameter(String name) { 42 | 43 | String[] array = this.map.get(name); 44 | if (array != null && array.length > 0) 45 | return array[0]; 46 | return null; 47 | } 48 | 49 | @Override 50 | public Map getParameterMap() { 51 | return Collections.unmodifiableMap(this.map); 52 | } 53 | 54 | @Override 55 | public Enumeration getParameterNames() { 56 | return Collections.enumeration(this.map.keySet()); 57 | } 58 | 59 | @Override 60 | public String[] getParameterValues(String name) { 61 | return this.map.get(name); 62 | } 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import java.util.Properties; 10 | 11 | @Configuration 12 | //扫描dao或者是Mapper接口 13 | @MapperScan("com.zhangwuji.im.mapper*") 14 | public class MybatisPlusConfig { 15 | /** 16 | * mybatis-plus 分页插件 17 | */ 18 | 19 | @Bean 20 | public PaginationInterceptor paginationInterceptor() { 21 | PaginationInterceptor page = new PaginationInterceptor(); 22 | page.setDialectType("mysql"); 23 | return page; 24 | } 25 | /** 26 | * 打印 sql 27 | */ 28 | @Bean 29 | public PerformanceInterceptor performanceInterceptor() { 30 | PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor(); 31 | //格式化sql语句 32 | Properties properties = new Properties(); 33 | properties.setProperty("format", "true"); 34 | performanceInterceptor.setProperties(properties); 35 | return performanceInterceptor; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.util.AntPathMatcher; 5 | import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | @Configuration 9 | public class WebConfig extends WebMvcConfigurerAdapter { 10 | @Override 11 | public void configurePathMatch(PathMatchConfigurer configurer) { 12 | AntPathMatcher matcher = new AntPathMatcher(); 13 | matcher.setCaseSensitive(false); 14 | configurer.setPathMatcher(matcher); 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/GeoBean.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class GeoBean { 7 | private String key; 8 | private Double dis; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMAudio.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMAudio") 24 | public class IMAudio implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Integer id; 30 | 31 | /** 32 | * 发送者Id 33 | */ 34 | @TableField("fromId") 35 | private Integer fromId; 36 | 37 | /** 38 | * 接收者Id 39 | */ 40 | @TableField("toId") 41 | private Integer toId; 42 | 43 | /** 44 | * 语音存储的地址 45 | */ 46 | private String path; 47 | 48 | /** 49 | * 文件大小 50 | */ 51 | private Integer size; 52 | 53 | /** 54 | * 语音时长 55 | */ 56 | private Integer duration; 57 | 58 | /** 59 | * 创建时间 60 | */ 61 | private Integer created; 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMDepart.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMDepart") 24 | public class IMDepart implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * 部门id 30 | */ 31 | @TableId(value = "id", type = IdType.AUTO) 32 | private Integer id; 33 | 34 | private Integer uid; 35 | 36 | /** 37 | * 部门名称 38 | */ 39 | @TableField("departName") 40 | private String departName; 41 | 42 | /** 43 | * 显示优先级 44 | */ 45 | private Integer priority; 46 | 47 | /** 48 | * 上级部门id 49 | */ 50 | @TableField("parentId") 51 | private Integer parentId; 52 | 53 | /** 54 | * 状态 55 | */ 56 | private Integer status; 57 | 58 | /** 59 | * 创建时间 60 | */ 61 | private Integer created; 62 | 63 | /** 64 | * 更新时间 65 | */ 66 | private Integer updated; 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMDiscovery.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMDiscovery") 24 | public class IMDiscovery implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * id 30 | */ 31 | @TableId(value = "id", type = IdType.AUTO) 32 | private Integer id; 33 | 34 | /** 35 | * 名称 36 | */ 37 | @TableField("itemName") 38 | private String itemName; 39 | 40 | /** 41 | * URL 42 | */ 43 | @TableField("itemUrl") 44 | private String itemUrl; 45 | 46 | /** 47 | * 显示优先级 48 | */ 49 | @TableField("itemPriority") 50 | private Integer itemPriority; 51 | 52 | /** 53 | * 状态 54 | */ 55 | private Integer status; 56 | 57 | /** 58 | * 创建时间 59 | */ 60 | private Integer created; 61 | 62 | /** 63 | * 更新时间 64 | */ 65 | private Integer updated; 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMGroup.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * IM群信息 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMGroup") 24 | public class IMGroup implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Integer id; 30 | 31 | /** 32 | * 群名称 33 | */ 34 | private String name; 35 | 36 | /** 37 | * 群头像 38 | */ 39 | private String avatar; 40 | 41 | /** 42 | * 创建者用户id 43 | */ 44 | private Integer creator; 45 | 46 | /** 47 | * 群组类型,1-固定;2-临时群 48 | */ 49 | private Integer type; 50 | 51 | /** 52 | * 成员人数 53 | */ 54 | @TableField("userCnt") 55 | private Integer userCnt; 56 | 57 | /** 58 | * 是否删除,0-正常,1-删除 59 | */ 60 | private Integer status; 61 | 62 | /** 63 | * 群版本号 64 | */ 65 | private Integer version; 66 | 67 | /** 68 | * 最后聊天时间 69 | */ 70 | @TableField("lastChated") 71 | private Integer lastChated; 72 | 73 | /** 74 | * 更新时间 75 | */ 76 | private Integer updated; 77 | 78 | /** 79 | * 创建时间 80 | */ 81 | private Integer created; 82 | 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMGroupMember.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 用户和群的关系表 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMGroupMember") 24 | public class IMGroupMember implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Integer id; 30 | 31 | /** 32 | * 群Id 33 | */ 34 | @TableField("groupId") 35 | private Integer groupId; 36 | 37 | /** 38 | * 用户id 39 | */ 40 | @TableField("userId") 41 | private Integer userId; 42 | 43 | /** 44 | * 是否退出群,0-正常,1-已退出 45 | */ 46 | private Integer status; 47 | 48 | private String remak; 49 | 50 | /** 51 | * 创建时间 52 | */ 53 | private Integer created; 54 | 55 | /** 56 | * 更新时间 57 | */ 58 | private Integer updated; 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMRecentSession.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMRecentSession") 24 | public class IMRecentSession implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Integer id; 30 | 31 | /** 32 | * 用户id 33 | */ 34 | @TableField("userId") 35 | private Integer userId; 36 | 37 | /** 38 | * 对方id 39 | */ 40 | @TableField("peerId") 41 | private Integer peerId; 42 | 43 | /** 44 | * 类型,1-用户,2-群组 45 | */ 46 | private Boolean type; 47 | 48 | /** 49 | * 用户:0-正常, 1-用户A删除,群组:0-正常, 1-被删除 50 | */ 51 | private Boolean status; 52 | 53 | /** 54 | * 创建时间 55 | */ 56 | private Integer created; 57 | 58 | /** 59 | * 更新时间 60 | */ 61 | private Integer updated; 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMTransmitFile.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMTransmitFile") 24 | public class IMTransmitFile implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Integer id; 30 | 31 | @TableField("fromId") 32 | private Integer fromId; 33 | 34 | @TableField("toId") 35 | private Integer toId; 36 | 37 | @TableField("fileName") 38 | private String fileName; 39 | 40 | private Integer size; 41 | 42 | @TableField("taskId") 43 | private Integer taskId; 44 | 45 | private Integer status; 46 | 47 | private Integer created; 48 | 49 | private Integer updated; 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMUser.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-04 19 | */ 20 | 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @Accessors(chain = true) 24 | @TableName("on_IMUser") 25 | public class IMUser extends baseEntity implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * 用户id 31 | */ 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | 36 | @TableField("appId") 37 | private Integer appId; 38 | 39 | /** 40 | * 用户关联的对外ID。可用于云服务的架构处理 41 | */ 42 | @TableField("outId") 43 | private Integer outId; 44 | 45 | /** 46 | * 用户名 47 | */ 48 | private String username; 49 | 50 | /** 51 | * 密码 52 | */ 53 | private String password; 54 | 55 | /** 56 | * 混淆码 57 | */ 58 | private String salt; 59 | 60 | private String apiToken; 61 | 62 | /** 63 | * 花名,绰号等 64 | */ 65 | private String nickname; 66 | 67 | private String realname; 68 | 69 | /** 70 | * 1男2女0未知 71 | */ 72 | private int sex; 73 | 74 | /** 75 | * 自定义用户头像 76 | */ 77 | private String avatar; 78 | 79 | /** 80 | * 拼音 81 | */ 82 | private String domain; 83 | 84 | /** 85 | * 手机号码 86 | */ 87 | private String phone; 88 | 89 | /** 90 | * email 91 | */ 92 | private String email; 93 | 94 | /** 95 | * 所属部门Id 96 | */ 97 | @TableField("departId") 98 | private Integer departId; 99 | 100 | /** 101 | * 0关闭勿扰 1开启勿扰 102 | */ 103 | private Boolean pushShieldStatus; 104 | 105 | /** 106 | * 个性签名 107 | */ 108 | private String signInfo; 109 | 110 | /** 111 | * 1. 试用期 2. 正式 3. 离职 4.实习 112 | */ 113 | private Integer status; 114 | 115 | /** 116 | * 更新时间 117 | */ 118 | private Integer updated; 119 | 120 | /** 121 | * 创建时间 122 | */ 123 | private Integer created; 124 | 125 | private String dataSign; 126 | 127 | @TableField("Longitude") 128 | private Float Longitude; 129 | 130 | @TableField("Latitude") 131 | private Float Latitude; 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMUserFriends.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | * 14 | * 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-04 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("on_IMUserFriends") 24 | public class IMUserFriends implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Long id; 30 | 31 | private Integer uid; 32 | 33 | private Integer friuid; 34 | 35 | @TableField("friName") 36 | private String friName; 37 | 38 | @TableField("friAvatar") 39 | private String friAvatar; 40 | 41 | private String remark; 42 | 43 | @TableField("groupId") 44 | private Integer groupId; 45 | 46 | private String message; 47 | 48 | private Integer status; 49 | 50 | private Integer role; 51 | 52 | private Integer lv; 53 | 54 | private Integer updated; 55 | 56 | private Integer created; 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/IMUserGeoData.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import java.io.Serializable; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.experimental.Accessors; 10 | 11 | /** 12 | * 13 | * 14 | * 15 | * 16 | * @author cloudtalk 17 | * @since 2019-01-10 18 | */ 19 | @Data 20 | @EqualsAndHashCode(callSuper = false) 21 | @Accessors(chain = true) 22 | @TableName("on_IMUserGeoData") 23 | public class IMUserGeoData implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "id", type = IdType.AUTO) 28 | private Integer id; 29 | 30 | private Integer uid; 31 | 32 | private String city; 33 | 34 | private Double lng; 35 | 36 | private Double lat; 37 | 38 | private String uids; 39 | 40 | private String data; 41 | 42 | private Integer status; 43 | 44 | private Long updated; 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/ServerInfoEntity.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | 8 | @Data 9 | public class ServerInfoEntity { 10 | 11 | public String server_ip=""; 12 | public String server_ip2=""; 13 | public int server_port=8600; 14 | public String msfsPrior=""; 15 | public String msfsBackup=""; 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/entity/baseEntity.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.entity; 2 | 3 | public class baseEntity { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMAudioMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMAudio; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | * 8 | * Mapper 接口 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IMAudioMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMDepartMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMDepart; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * Mapper 接口 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | public interface IMDepartMapper extends BaseMapper { 19 | 20 | @Select("select id as departId,departName,priority,status,created,updated from on_IMDepart where (uid=0 or uid=#{id}) and status=0 ") 21 | List> getMyAllDepart(Integer id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMDiscoveryMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMDiscovery; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | * 8 | * Mapper 接口 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IMDiscoveryMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMGroupMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.zhangwuji.im.api.entity.IMGroup; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import com.zhangwuji.im.api.entity.IMUser; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 14 | * IM群信息 Mapper 接口 15 | * 16 | * 17 | * @author cloudtalk 18 | * @since 2019-01-15 19 | */ 20 | public interface IMGroupMapper extends BaseMapper 21 | { 22 | 23 | List> getGroupList(String[] array); 24 | 25 | 26 | @Select("select * from on_IMGroup where id in(select groupId from on_IMGroupMember where userid=#{id}) or type=3 ") 27 | List> getMyGroupList(Integer id); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMGroupMemberMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMGroupMember; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * 用户和群的关系表 Mapper 接口 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | public interface IMGroupMemberMapper extends BaseMapper { 19 | List> getGroupMemberList(String[] array); 20 | 21 | @Select("select a.id as groupId,u.id,u.id as peerId,u.username,u.nickname,u.realname,u.sex,u.avatar,u.domain,u.phone,u.email,u.sign_info,u.updated,u.created from on_IMGroupMember a LEFT JOIN on_IMUser u ON a.userId=u.id where a.groupId=#{id}") 22 | List> getGroupMemberInfoById(Integer id); 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMRecentSessionMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMRecentSession; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | * 8 | * Mapper 接口 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IMRecentSessionMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMTransmitFileMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMTransmitFile; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | * 8 | * Mapper 接口 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IMTransmitFileMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMUserFriendsMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserFriends; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * Mapper 接口 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-04 17 | */ 18 | public interface IMUserFriendsMapper extends BaseMapper { 19 | 20 | @Select("select user.id,nickname,avatar,friends.remark as displayName,friends.message,friends.status,friends.updated from on_IMUserFriends friends LEFT JOIN on_IMUser user ON user.id = friends.friuid where friends.uid=#{id} order by friends.status desc ") 21 | List> getMyNewFriends(Integer id); 22 | 23 | @Select("select user.id,user.id as peerId,username,nickname,realname,sex,avatar,domain,phone,email,sign_info,user.updated,user.created,friends.groupId as departmentId from on_IMUserFriends friends LEFT JOIN on_IMUser user ON user.id = friends.friuid where friends.uid=#{id} and friends.status=1 ") 24 | List> getMyFriends(Integer id); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMUserGeoDataMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserGeoData; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | * 8 | * Mapper 接口 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-10 13 | */ 14 | public interface IMUserGeoDataMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/mapper/IMUserMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.mapper; 2 | 3 | import com.zhangwuji.im.api.entity.IMUser; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Result; 6 | import org.apache.ibatis.annotations.Results; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.springframework.beans.factory.annotation.Qualifier; 9 | import org.springframework.stereotype.Component; 10 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * 17 | * Mapper 接口 18 | * 19 | * 20 | * @author cloudtalk 21 | * @since 2019-01-04 22 | */ 23 | 24 | @Component 25 | @Qualifier("onImuserMapper") 26 | public interface IMUserMapper extends BaseMapper 27 | { 28 | 29 | List> selectUser2(); 30 | 31 | @Select("select * from on_IMUser where id = #{id}") 32 | @Results({ 33 | @Result(column="id",property="id"), 34 | @Result(column="appId",property="appId"), 35 | @Result(column="outId",property="outId"), 36 | @Result(column="username",property="username"), 37 | @Result(column="apiToken",property="apiToken"), 38 | @Result(column="nickname",property="nickname"), 39 | @Result(column="realname",property="realname"), 40 | @Result(column="sex",property="sex"), 41 | @Result(column="avatar",property="avatar"), 42 | @Result(column="domain",property="domain"), 43 | @Result(column="phone",property="phone"), 44 | @Result(column="email",property="email"), 45 | @Result(column="departId",property="departId"), 46 | @Result(column="signInfo",property="signInfo"), 47 | @Result(column="status",property="status"), 48 | @Result(column="updated",property="updated"), 49 | @Result(column="created",property="created"), 50 | @Result(column="updated",property="updated") 51 | }) 52 | 53 | List findUserById(Integer id); 54 | 55 | @Select("select * from on_IMUser ") 56 | List getAllUserBypage(Page page); 57 | 58 | 59 | List> getUsersInfo(String[] array); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/result/ApiResult.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.result; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ApiResult { 7 | public static final int SUCCESS = 200; 8 | public static final int ERROR = 100; 9 | 10 | /** 11 | * 返回代码 12 | */ 13 | private int code; 14 | /** 15 | * 返回结果 16 | */ 17 | private Object data; 18 | 19 | private String Message; 20 | 21 | public int getCode() { 22 | return code; 23 | } 24 | 25 | public void setCode(int code) { 26 | this.code = code; 27 | } 28 | 29 | public Object getData() { 30 | return data; 31 | } 32 | 33 | public void setData(Object data) { 34 | this.data = data; 35 | } 36 | 37 | public String getMessage() { 38 | return Message; 39 | } 40 | 41 | public void setMessage(String message) { 42 | Message = message; 43 | } 44 | 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/result/userinfoVo.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.result; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.zhangwuji.im.api.entity.baseEntity; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * 16 | * 17 | * 18 | * 19 | * @author cloudtalk 20 | * @since 2019-01-04 21 | */ 22 | 23 | @Data 24 | @EqualsAndHashCode(callSuper = false) 25 | @Accessors(chain = true) 26 | @TableName("on_IMUser") 27 | public class userinfoVo extends baseEntity implements Serializable { 28 | 29 | private static final long serialVersionUID = 1L; 30 | 31 | /** 32 | * 用户id 33 | */ 34 | @TableId(value = "id", type = IdType.AUTO) 35 | private Long id; 36 | 37 | /** 38 | * 用户id 39 | */ 40 | @TableId(value = "id", type = IdType.AUTO) 41 | private Long peerId; 42 | 43 | @TableField("appId") 44 | private Integer appId; 45 | 46 | /** 47 | * 用户关联的对外ID。可用于云服务的架构处理 48 | */ 49 | @TableField("outId") 50 | private Integer outId; 51 | 52 | /** 53 | * 用户名 54 | */ 55 | private String username; 56 | 57 | 58 | private String apiToken; 59 | 60 | /** 61 | * 花名,绰号等 62 | */ 63 | private String nickname; 64 | 65 | private String realname; 66 | 67 | /** 68 | * 1男2女0未知 69 | */ 70 | private Boolean sex; 71 | 72 | /** 73 | * 自定义用户头像 74 | */ 75 | private String avatar; 76 | 77 | /** 78 | * 拼音 79 | */ 80 | private String domain; 81 | 82 | /** 83 | * 手机号码 84 | */ 85 | private String phone; 86 | 87 | /** 88 | * email 89 | */ 90 | private String email; 91 | 92 | /** 93 | * 所属部门Id 94 | */ 95 | @TableField("departId") 96 | private Integer departId; 97 | 98 | /** 99 | * 0关闭勿扰 1开启勿扰 100 | */ 101 | private Boolean pushShieldStatus; 102 | 103 | /** 104 | * 个性签名 105 | */ 106 | private String signInfo; 107 | 108 | /** 109 | * 1. 试用期 2. 正式 3. 离职 4.实习 110 | */ 111 | private Integer status; 112 | 113 | /** 114 | * 更新时间 115 | */ 116 | private Integer updated; 117 | 118 | /** 119 | * 创建时间 120 | */ 121 | private Integer created; 122 | 123 | private String dataSign; 124 | 125 | @TableField("Longitude") 126 | private Float Longitude; 127 | 128 | 129 | @TableField("Latitude") 130 | private Float Latitude; 131 | 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMAudioService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMAudio; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | * 8 | * 服务类 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IIMAudioService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMDepartService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMDepart; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * 11 | * 服务类 12 | * 13 | * 14 | * @author cloudtalk 15 | * @since 2019-01-15 16 | */ 17 | public interface IIMDepartService extends IService { 18 | 19 | List> getMyAllDepart(Integer id); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMDiscoveryService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMDiscovery; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | * 8 | * 服务类 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IIMDiscoveryService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMGroupMemberService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMGroupMember; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * 11 | * 用户和群的关系表 服务类 12 | * 13 | * 14 | * @author cloudtalk 15 | * @since 2019-01-15 16 | */ 17 | public interface IIMGroupMemberService extends IService { 18 | List> getGroupMemberList(String ids); 19 | 20 | List> getGroupMemberInfoById(Integer id); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMGroupService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMGroup; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.zhangwuji.im.api.entity.IMUser; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * IM群信息 服务类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | public interface IIMGroupService extends IService { 19 | 20 | List> getGroupList(String ids); 21 | 22 | List> getMyGroupList(Integer id); 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMRecentSessionService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMRecentSession; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | * 8 | * 服务类 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IIMRecentSessionService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMTransmitFileService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMTransmitFile; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | * 8 | * 服务类 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-15 13 | */ 14 | public interface IIMTransmitFileService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMUserFriendsService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserFriends; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * 11 | * 服务类 12 | * 13 | * 14 | * @author cloudtalk 15 | * @since 2019-01-04 16 | */ 17 | 18 | public interface IIMUserFriendsService extends IService { 19 | 20 | List> getMyNewFriends(Integer id); 21 | List> getMyFriends(Integer id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMUserGeoDataService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserGeoData; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | * 8 | * 服务类 9 | * 10 | * 11 | * @author cloudtalk 12 | * @since 2019-01-10 13 | */ 14 | public interface IIMUserGeoDataService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/IIMUserService.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.zhangwuji.im.api.entity.IMUser; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * 服务类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-04 17 | */ 18 | public interface IIMUserService extends IService { 19 | 20 | List findUserById(Integer id); 21 | List> selectUser2(); 22 | Page getAllUserBypage(Page page); 23 | List> getUsersInfo(String ids); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMAudioServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMAudio; 4 | import com.zhangwuji.im.api.mapper.IMAudioMapper; 5 | import com.zhangwuji.im.api.service.IIMAudioService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 12 | * 服务实现类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | @Service 19 | @Qualifier(value = "IMAudioService") 20 | public class IMAudioServiceImpl extends ServiceImpl implements IIMAudioService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMDepartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMDepart; 4 | import com.zhangwuji.im.api.mapper.IMDepartMapper; 5 | import com.zhangwuji.im.api.service.IIMDepartService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * 15 | * 服务实现类 16 | * 17 | * 18 | * @author cloudtalk 19 | * @since 2019-01-15 20 | */ 21 | @Service 22 | @Qualifier(value = "IMDepartService") 23 | public class IMDepartServiceImpl extends ServiceImpl implements IIMDepartService { 24 | 25 | @Override 26 | public List> getMyAllDepart(Integer id) { 27 | return baseMapper.getMyAllDepart(id); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMDiscoveryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMDiscovery; 4 | import com.zhangwuji.im.api.mapper.IMDiscoveryMapper; 5 | import com.zhangwuji.im.api.service.IIMDiscoveryService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 12 | * 服务实现类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | @Service 19 | @Qualifier(value = "IMDiscoveryService") 20 | public class IMDiscoveryServiceImpl extends ServiceImpl implements IIMDiscoveryService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMGroupMemberServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMGroupMember; 4 | import com.zhangwuji.im.api.mapper.IMGroupMemberMapper; 5 | import com.zhangwuji.im.api.service.IIMGroupMemberService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * 15 | * 用户和群的关系表 服务实现类 16 | * 17 | * 18 | * @author cloudtalk 19 | * @since 2019-01-15 20 | */ 21 | @Service 22 | @Qualifier(value = "IMGroupMemberService") 23 | public class IMGroupMemberServiceImpl extends ServiceImpl implements IIMGroupMemberService { 24 | @Override 25 | public List> getGroupMemberList(String ids) { 26 | return baseMapper.getGroupMemberList(ids.split("\\,")); 27 | } 28 | 29 | @Override 30 | public List> getGroupMemberInfoById(Integer id) { 31 | return baseMapper.getGroupMemberInfoById(id); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMGroupServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMGroup; 4 | import com.zhangwuji.im.api.entity.IMUser; 5 | import com.zhangwuji.im.api.mapper.IMGroupMapper; 6 | import com.zhangwuji.im.api.service.IIMGroupService; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import org.springframework.beans.factory.annotation.Qualifier; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * 16 | * IM群信息 服务实现类 17 | * 18 | * 19 | * @author cloudtalk 20 | * @since 2019-01-15 21 | */ 22 | @Service 23 | @Qualifier(value = "IMGroupService") 24 | public class IMGroupServiceImpl extends ServiceImpl implements IIMGroupService { 25 | @Override 26 | public List> getGroupList(String ids) { 27 | return baseMapper.getGroupList(ids.split("\\,")); 28 | } 29 | 30 | @Override 31 | public List> getMyGroupList(Integer id) 32 | { 33 | return baseMapper.getMyGroupList(id); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMRecentSessionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMRecentSession; 4 | import com.zhangwuji.im.api.mapper.IMRecentSessionMapper; 5 | import com.zhangwuji.im.api.service.IIMRecentSessionService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 12 | * 服务实现类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | @Service 19 | @Qualifier(value = "IMRecentSessionService") 20 | public class IMRecentSessionServiceImpl extends ServiceImpl implements IIMRecentSessionService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMTransmitFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMTransmitFile; 4 | import com.zhangwuji.im.api.mapper.IMTransmitFileMapper; 5 | import com.zhangwuji.im.api.service.IIMTransmitFileService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 12 | * 服务实现类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-15 17 | */ 18 | @Service 19 | @Qualifier(value = "IMTransmitFileService") 20 | public class IMTransmitFileServiceImpl extends ServiceImpl implements IIMTransmitFileService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMUserFriendsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserFriends; 4 | import com.zhangwuji.im.api.mapper.IMUserFriendsMapper; 5 | import com.zhangwuji.im.api.service.IIMUserFriendsService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * 15 | * 服务实现类 16 | * 17 | * 18 | * @author cloudtalk 19 | * @since 2019-01-04 20 | */ 21 | @Service 22 | @Qualifier(value = "IMUserFriendsService") 23 | public class IMUserFriendsServiceImpl extends ServiceImpl implements IIMUserFriendsService { 24 | 25 | public List> getMyNewFriends(Integer id) 26 | { 27 | return baseMapper.getMyNewFriends(id); 28 | } 29 | 30 | @Override 31 | public List> getMyFriends(Integer id) { 32 | return baseMapper.getMyFriends(id); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMUserGeoDataServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.zhangwuji.im.api.entity.IMUserGeoData; 4 | import com.zhangwuji.im.api.mapper.IMUserGeoDataMapper; 5 | import com.zhangwuji.im.api.service.IIMUserGeoDataService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 12 | * 服务实现类 13 | * 14 | * 15 | * @author cloudtalk 16 | * @since 2019-01-10 17 | */ 18 | @Service 19 | @Qualifier(value = "imUserGeoDataService") 20 | public class IMUserGeoDataServiceImpl extends ServiceImpl implements IIMUserGeoDataService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/api/service/impl/IMUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.api.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.zhangwuji.im.api.entity.IMUser; 5 | import com.zhangwuji.im.api.mapper.IMUserMapper; 6 | import com.zhangwuji.im.api.service.IIMUserService; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.zhangwuji.im.api.service.IIMUserFriendsService; 9 | import org.springframework.beans.factory.annotation.Qualifier; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * 18 | * 服务实现类 19 | * 20 | * 21 | * @author cloudtalk 22 | * @since 2019-01-04 23 | */ 24 | @Service 25 | @Qualifier(value = "imUserService") 26 | public class IMUserServiceImpl extends ServiceImpl implements IIMUserService { 27 | 28 | @Resource 29 | @Qualifier(value = "IMUserFriendsService") 30 | private IIMUserFriendsService iOnImuserfriendsService; 31 | 32 | @Override 33 | public List findUserById(Integer id) { 34 | // TODO Auto-generated method stub 35 | return baseMapper.findUserById(id); 36 | } 37 | 38 | //通过映射到mapper.xml的方法 查询部分字段,返回的是list map类型 39 | @Override 40 | public List> selectUser2() { 41 | return baseMapper.selectUser2(); 42 | } 43 | 44 | @Override 45 | public Page getAllUserBypage(Page page) { 46 | return page.setRecords(this.baseMapper.getAllUserBypage(page)); 47 | } 48 | 49 | @Override 50 | public List> getUsersInfo(String ids) { 51 | return baseMapper.getUsersInfo(ids.split("\\,")); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/callback/IMListener.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.callback; 2 | 3 | public interface IMListener { 4 | public abstract void onSuccess(T response); 5 | 6 | public abstract void onFaild(); 7 | 8 | public abstract void onTimeout(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/callback/ListenerQueue.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.callback; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.Timer; 8 | import java.util.TimerTask; 9 | import java.util.concurrent.ConcurrentHashMap; 10 | 11 | public class ListenerQueue { 12 | 13 | private static ListenerQueue listenerQueue = new ListenerQueue(); 14 | public static ListenerQueue instance(){ 15 | return listenerQueue; 16 | } 17 | 18 | private volatile boolean stopFlag = false; 19 | private volatile boolean hasTask = false; 20 | 21 | 22 | //callback 队列 23 | private Map callBackQueue = new ConcurrentHashMap<>(); 24 | // private Handler timerHandler = new Handler(); 25 | Timer timer = new Timer(); 26 | 27 | public void onStart(){ 28 | stopFlag = false; 29 | startTimer(); 30 | } 31 | public void onDestory(){ 32 | callBackQueue.clear(); 33 | stopTimer(); 34 | } 35 | 36 | //以前是TimerTask处理方式 37 | private void startTimer() { 38 | if(!stopFlag && hasTask == false) { 39 | hasTask = true; 40 | // timerHandler.postDelayed(new Runnable() { 41 | // @Override 42 | // public void run() { 43 | // timerImpl(); 44 | // hasTask = false; 45 | // startTimer(); 46 | // } 47 | // }, 5 * 1000); 48 | 49 | timer.schedule(new TimerTask() { 50 | public void run() { 51 | timerImpl(); 52 | hasTask = false; 53 | startTimer(); 54 | } 55 | }, 5 * 1000); 56 | 57 | } 58 | } 59 | 60 | private void stopTimer(){ 61 | stopFlag = true; 62 | } 63 | 64 | private void timerImpl() { 65 | long currentRealtime = System.currentTimeMillis();//SystemClock.elapsedRealtime(); 66 | 67 | for (java.util.Map.Entry entry : callBackQueue.entrySet()) { 68 | 69 | Packetlistener packetlistener = entry.getValue(); 70 | Integer seqNo = entry.getKey(); 71 | long timeRange = currentRealtime - packetlistener.getCreateTime(); 72 | 73 | try { 74 | if (timeRange >= packetlistener.getTimeOut()) { 75 | Packetlistener listener = pop(seqNo); 76 | if (listener != null) { 77 | listener.onTimeout(); 78 | } 79 | } 80 | } catch (Exception e) { 81 | } 82 | } 83 | } 84 | 85 | public void push(int seqNo,Packetlistener packetlistener){ 86 | if(seqNo <=0 || null==packetlistener){ 87 | return; 88 | } 89 | callBackQueue.put(seqNo,packetlistener); 90 | } 91 | 92 | 93 | public Packetlistener pop(int seqNo){ 94 | synchronized (ListenerQueue.this) { 95 | if (callBackQueue.containsKey(seqNo)) { 96 | Packetlistener packetlistener = callBackQueue.remove(seqNo); 97 | return packetlistener; 98 | } 99 | return null; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/callback/Packetlistener.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.callback; 2 | 3 | public abstract class Packetlistener implements IMListener { 4 | private long createTime; 5 | private long timeOut; 6 | public Packetlistener(long timeOut){ 7 | this.timeOut = timeOut; 8 | long now = System.currentTimeMillis(); 9 | createTime = now; 10 | } 11 | 12 | public Packetlistener(){ 13 | this.timeOut = 8*1000; 14 | long now = System.currentTimeMillis(); 15 | createTime = now; 16 | } 17 | 18 | public long getCreateTime() { 19 | return createTime; 20 | } 21 | 22 | public void setCreateTime(long createTime) { 23 | this.createTime = createTime; 24 | } 25 | 26 | public long getTimeOut() { 27 | return timeOut; 28 | } 29 | 30 | public void setTimeOut(long timeOut) { 31 | this.timeOut = timeOut; 32 | } 33 | 34 | public abstract void onSuccess(Object response); 35 | 36 | public abstract void onFaild(); 37 | 38 | public abstract void onTimeout(); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 10 | 11 | @Configuration 12 | public class CorsConfig implements WebMvcConfigurer { 13 | 14 | @Override 15 | public void addCorsMappings(CorsRegistry registry) { 16 | registry.addMapping("/**") 17 | .allowedOrigins("*") 18 | .allowCredentials(true) 19 | .allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS") 20 | .maxAge(3600); 21 | } 22 | 23 | @Bean 24 | public CorsFilter corsFilter() { 25 | final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); 26 | final CorsConfiguration corsConfiguration = new CorsConfiguration(); 27 | corsConfiguration.setAllowCredentials(true); 28 | corsConfiguration.addAllowedOrigin("*"); 29 | corsConfiguration.addAllowedHeader("*"); 30 | corsConfiguration.addAllowedMethod("*"); 31 | urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); 32 | return new CorsFilter(urlBasedCorsConfigurationSource); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/DBConstant.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | public interface DBConstant { 3 | 4 | /**性别 5 | * 1. 男性 2.女性 6 | * */ 7 | public final int SEX_MAILE = 1; 8 | public final int SEX_FEMALE = 2; 9 | 10 | /**msgType*/ 11 | public final int MSG_TYPE_SINGLE_TEXT = 0x01; 12 | public final int MSG_TYPE_SINGLE_AUDIO = 0x02; 13 | public final int MSG_TYPE_GROUP_TEXT = 0x11; 14 | public final int MSG_TYPE_GROUP_AUDIO = 0x12; 15 | 16 | /**msgDisplayType 17 | * 保存在DB中,与服务端一致,图文混排也是一条 18 | * 1. 最基础的文本信息 19 | * 2. 纯图片信息 20 | * 3. 语音 21 | * 4. 图文混排 22 | * */ 23 | public final int SHOW_ORIGIN_TEXT_TYPE = 1; 24 | public final int SHOW_IMAGE_TYPE = 2; 25 | public final int SHOW_AUDIO_TYPE = 3; 26 | public final int SHOW_MIX_TEXT = 4; 27 | public final int SHOW_GIF_TYPE = 5; 28 | 29 | 30 | public final String DISPLAY_FOR_IMAGE = "[图片]"; 31 | public final String DISPLAY_FOR_MIX = "[图文消息]"; 32 | public final String DISPLAY_FOR_AUDIO = "[语音]"; 33 | public final String DISPLAY_FOR_ERROR = "[未知消息]"; 34 | 35 | /**sessionType*/ 36 | public final int SESSION_TYPE_SINGLE = 1; 37 | public final int SESSION_TYPE_GROUP = 2; 38 | public final int SESSION_TYPE_ERROR= 3; 39 | 40 | /**user status 41 | * 1. 试用期 2. 正式 3. 离职 4.实习 42 | * */ 43 | public final int USER_STATUS_PROBATION = 1; 44 | public final int USER_STATUS_OFFICIAL = 2; 45 | public final int USER_STATUS_LEAVE = 3; 46 | public final int USER_STATUS_INTERNSHIP =4; 47 | 48 | /**group type*/ 49 | public final int GROUP_TYPE_NORMAL = 1; 50 | public final int GROUP_TYPE_TEMP = 2; 51 | 52 | /**group status 53 | * 1: shield 0: not shield 54 | * */ 55 | 56 | public final int GROUP_STATUS_ONLINE = 0; 57 | public final int GROUP_STATUS_SHIELD = 1; 58 | 59 | /**group change Type*/ 60 | public final int GROUP_MODIFY_TYPE_ADD= 0; 61 | public final int GROUP_MODIFY_TYPE_DEL =1; 62 | 63 | /**depart status Type*/ 64 | public final int DEPT_STATUS_OK= 0; 65 | public final int DEPT_STATUS_DELETE =1; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/HandlerConstant.java: -------------------------------------------------------------------------------- 1 | 2 | package com.zhangwuji.im.config; 3 | public class HandlerConstant { 4 | 5 | /** 6 | * 消息相关 7 | */ 8 | public static final int HANDLER_RECORD_FINISHED = 0x01; // 录音结束 9 | public static final int HANDLER_STOP_PLAY = 0x02;// Speex 通知主界面停止播放 10 | public static final int RECEIVE_MAX_VOLUME = 0x03; 11 | public static final int RECORD_AUDIO_TOO_LONG = 0x04; 12 | public static final int MSG_RECEIVED_MESSAGE = 0x05; 13 | 14 | 15 | // 通讯录tab “全部/部门” 切换 16 | public static final int HANDLER_CHANGE_CONTACT_TAB = 0x10; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/IntentConstant.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | public class IntentConstant { 3 | 4 | public static final String KEY_AVATAR_URL = "key_avatar_url"; 5 | public static final String KEY_IS_IMAGE_CONTACT_AVATAR = "is_image_contact_avatar"; 6 | public static final String KEY_LOGIN_NOT_AUTO = "login_not_auto"; 7 | public static final String KEY_LOCATE_DEPARTMENT = "key_locate_department"; 8 | public static final String KEY_SESSION_KEY = "chat_session_key"; 9 | public static final String KEY_PEERID = "key_peerid"; 10 | 11 | public static final String PREVIEW_TEXT_CONTENT = "content"; 12 | 13 | 14 | public static final String EXTRA_IMAGE_LIST = "imagelist"; 15 | public static final String EXTRA_ALBUM_NAME = "name"; 16 | public static final String EXTRA_ADAPTER_NAME = "adapter"; 17 | public static final String EXTRA_CHAT_USER_ID = "chat_user_id"; 18 | 19 | public static final String USER_DETAIL_PARAM = "FROM_PAGE"; 20 | public static final String WEBVIEW_URL = "WEBVIEW_URL"; 21 | 22 | 23 | public static final String CUR_MESSAGE = "CUR_MESSAGE"; 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/MessageConstant.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | public interface MessageConstant { 3 | 4 | /**基础消息状态,表示网络层收发成功*/ 5 | public final int MSG_SENDING = 1; 6 | public final int MSG_FAILURE = 2; 7 | public final int MSG_SUCCESS = 3; 8 | 9 | /**图片消息状态,表示下载到本地、上传到服务器的状态*/ 10 | public final int IMAGE_UNLOAD=1; 11 | public final int IMAGE_LOADING=2; 12 | public final int IMAGE_LOADED_SUCCESS =3; 13 | public final int IMAGE_LOADED_FAILURE =4; 14 | 15 | 16 | /**语音状态,未读与已读*/ 17 | public final int AUDIO_UNREAD =1; 18 | public final int AUDIO_READED = 2; 19 | 20 | /**图片消息的前后常量*/ 21 | public final String IMAGE_MSG_START = "&$#@~^@[{:"; 22 | public final String IMAGE_MSG_END = ":}]&$~@#@"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/SysConstant.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | 3 | /** 4 | * 系统的常量类 5 | */ 6 | public interface SysConstant { 7 | 8 | /**头像尺寸大小定义*/ 9 | public static final String AVATAR_APPEND_32 ="_32x32.jpg"; 10 | public static final String AVATAR_APPEND_100 ="_100x100.jpg"; 11 | public static final String AVATAR_APPEND_120 ="_100x100.jpg";//头像120*120的pic 没有 所以统一100 12 | public static final String AVATAR_APPEND_200="_200x200.jpg"; 13 | 14 | /**协议头相关 start*/ 15 | public static final int PROTOCOL_HEADER_LENGTH = 16;// 默认消息头的长度 16 | public static final int PROTOCOL_VERSION = 6; 17 | public static final int PROTOCOL_FLAG = 0; 18 | public static final char PROTOCOL_ERROR = '0'; 19 | public static final char PROTOCOL_RESERVED = '0'; 20 | 21 | 22 | // 读取磁盘上文件, 分支判断其类型 23 | public static final int FILE_SAVE_TYPE_IMAGE = 0X00013; 24 | public static final int FILE_SAVE_TYPE_AUDIO = 0X00014; 25 | 26 | 27 | public static final float MAX_SOUND_RECORD_TIME = 60.0f;// 单位秒 28 | public static final int MAX_SELECT_IMAGE_COUNT = 6; 29 | 30 | 31 | /**表情使用*/ 32 | public static final int pageSize = 21; 33 | public static final int yayaPageSize = 8; 34 | 35 | 36 | // 好像设定了,但是好像没有用 37 | public static final int ALBUM_PREVIEW_BACK = 3; 38 | // resultCode 返回值 39 | public static final int ALBUM_BACK_DATA = 5; 40 | public static final int CAMERA_WITH_DATA = 3023; 41 | 42 | 43 | /** 44 | *1. 配置的全局key 45 | * */ 46 | public static final String SETTING_GLOBAL = "Global"; 47 | public static final String UPLOAD_IMAGE_INTENT_PARAMS = "com.zhangwuji.im.upload.image.intent"; 48 | /** 49 | * event 优先级 50 | * */ 51 | public static final int SERVICE_EVENTBUS_PRIORITY = 10; 52 | public static final int MESSAGE_EVENTBUS_PRIORITY = 100; 53 | 54 | //message 每次拉取的条数 55 | public static final int MSG_CNT_PER_PAGE = 18; 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/UrlConstant.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.config; 2 | 3 | public class UrlConstant { 4 | 5 | // 头像路径前缀 6 | public final static String AVATAR_URL_PREFIX = ""; 7 | // access 地址 8 | public final static String ACCESS_MSG_ADDRESS = ""; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/config/packageInfo: -------------------------------------------------------------------------------- 1 | * todo 文件划分合理 2 | * 能不能放在string 中处理 3 | * 能不能用枚举类型处理 4 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/protobuf/TextMessage.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.protobuf; 2 | 3 | 4 | import com.zhangwuji.im.config.DBConstant; 5 | import com.zhangwuji.im.config.MessageConstant; 6 | import com.zhangwuji.im.support.SequenceNumberMaker; 7 | 8 | import java.io.Serializable; 9 | import java.io.UnsupportedEncodingException; 10 | 11 | /** 12 | * @author : yingmu on 14-12-31. 13 | * @email : yingmu@mogujie.com. 14 | */ 15 | public class TextMessage extends MessageEntity implements Serializable { 16 | 17 | public TextMessage(){ 18 | msgId = SequenceNumberMaker.getInstance().makelocalUniqueMsgId(); 19 | } 20 | 21 | private TextMessage(MessageEntity entity){ 22 | /**父类的id*/ 23 | id = entity.getId(); 24 | msgId = entity.getMsgId(); 25 | fromId = entity.getFromId(); 26 | toId = entity.getToId(); 27 | sessionKey = entity.getSessionKey(); 28 | content=entity.getContent(); 29 | msgType=entity.getMsgType(); 30 | displayType=entity.getDisplayType(); 31 | status = entity.getStatus(); 32 | created = entity.getCreated(); 33 | updated = entity.getUpdated(); 34 | } 35 | 36 | public static TextMessage parseFromNet(MessageEntity entity){ 37 | TextMessage textMessage = new TextMessage(entity); 38 | textMessage.setStatus(MessageConstant.MSG_SUCCESS); 39 | textMessage.setDisplayType(DBConstant.SHOW_ORIGIN_TEXT_TYPE); 40 | return textMessage; 41 | } 42 | 43 | public static TextMessage parseFromDB(MessageEntity entity){ 44 | if(entity.getDisplayType()!=DBConstant.SHOW_ORIGIN_TEXT_TYPE){ 45 | throw new RuntimeException("#TextMessage# parseFromDB,not SHOW_ORIGIN_TEXT_TYPE"); 46 | } 47 | TextMessage textMessage = new TextMessage(entity); 48 | return textMessage; 49 | } 50 | 51 | public static TextMessage buildForSend(String content, int fromId,int toId,int sessionType){ 52 | TextMessage textMessage = new TextMessage(); 53 | int nowTime = (int) (System.currentTimeMillis() / 1000); 54 | textMessage.setFromId(fromId); 55 | textMessage.setToId(toId); 56 | textMessage.setUpdated(nowTime); 57 | textMessage.setCreated(nowTime); 58 | textMessage.setDisplayType(DBConstant.SHOW_ORIGIN_TEXT_TYPE); 59 | textMessage.setGIfEmo(true); 60 | int peerType = sessionType; 61 | int msgType = peerType == DBConstant.SESSION_TYPE_GROUP ? DBConstant.MSG_TYPE_GROUP_TEXT 62 | : DBConstant.MSG_TYPE_SINGLE_TEXT; 63 | textMessage.setMsgType(msgType); 64 | textMessage.setStatus(MessageConstant.MSG_SENDING); 65 | // 内容的设定 66 | textMessage.setContent(content); 67 | textMessage.buildSessionKey(true); 68 | return textMessage; 69 | } 70 | 71 | 72 | /** 73 | * Not-null value. 74 | * DB的时候需要 75 | */ 76 | @Override 77 | public String getContent() { 78 | return content; 79 | } 80 | 81 | @Override 82 | public byte[] getSendContent() { 83 | try { 84 | /** 加密*/ 85 | // String sendContent =new String(Security.getInstance().EncryptMsg(content)); 86 | return content.getBytes("utf-8"); 87 | } catch (UnsupportedEncodingException e) { 88 | e.printStackTrace(); 89 | } 90 | return null; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/protobuf/base/DefaultHeader.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.protobuf.base; 2 | 3 | import com.zhangwuji.im.config.SysConstant; 4 | import com.zhangwuji.im.support.SequenceNumberMaker; 5 | 6 | public class DefaultHeader extends Header { 7 | 8 | public DefaultHeader(int serviceId, int commandId) { 9 | setVersion((short) SysConstant.PROTOCOL_VERSION); 10 | setFlag((short) SysConstant.PROTOCOL_FLAG); 11 | setServiceId((short)serviceId); 12 | setCommandId((short)commandId); 13 | short seqNo = SequenceNumberMaker.getInstance().make(); 14 | setSeqnum(seqNo); 15 | setReserved((short)SysConstant.PROTOCOL_RESERVED); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/protobuf/helper/Java2ProtoBuf.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.protobuf.helper; 2 | 3 | import com.zhangwuji.im.config.DBConstant; 4 | import com.zhangwuji.im.protobuf.IMBaseDefine; 5 | public class Java2ProtoBuf { 6 | /**----enum 转化接口--*/ 7 | public static IMBaseDefine.MsgType getProtoMsgType(int msgType){ 8 | switch (msgType){ 9 | case DBConstant.MSG_TYPE_GROUP_TEXT: 10 | return IMBaseDefine.MsgType.MSG_TYPE_GROUP_TEXT; 11 | case DBConstant.MSG_TYPE_GROUP_AUDIO: 12 | return IMBaseDefine.MsgType.MSG_TYPE_GROUP_AUDIO; 13 | case DBConstant.MSG_TYPE_SINGLE_AUDIO: 14 | return IMBaseDefine.MsgType.MSG_TYPE_SINGLE_AUDIO; 15 | case DBConstant.MSG_TYPE_SINGLE_TEXT: 16 | return IMBaseDefine.MsgType.MSG_TYPE_SINGLE_TEXT; 17 | default: 18 | throw new IllegalArgumentException("msgType is illegal,cause by #getProtoMsgType#" +msgType); 19 | } 20 | } 21 | 22 | 23 | public static IMBaseDefine.SessionType getProtoSessionType(int sessionType){ 24 | switch (sessionType){ 25 | case DBConstant.SESSION_TYPE_SINGLE: 26 | return IMBaseDefine.SessionType.SESSION_TYPE_SINGLE; 27 | case DBConstant.SESSION_TYPE_GROUP: 28 | return IMBaseDefine.SessionType.SESSION_TYPE_GROUP; 29 | default: 30 | throw new IllegalArgumentException("sessionType is illegal,cause by #getProtoSessionType#" +sessionType); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/ImStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.zhangwuji.im.support; 5 | 6 | /** 7 | * 版本: [1.0] 8 | * 功能说明: 9 | * 作者: WChao 创建时间: 2017年7月27日 上午10:33:14 10 | */ 11 | public enum ImStatus implements Status{ 12 | 13 | C10000(10000,"ok","发送成功"), 14 | C10001(10001,"offline","用户不在线"), 15 | C10019(10019,"online","用户在线"), 16 | C10002(10002,"send failed","消息发送失败,数据格式不正确,请参考:{'from':来源ID,'to':目标ID,'cmd':'消息命令码','createTime':消息创建时间(Long型),'msgType':Integer消息类型,'content':内容}"), 17 | C10003(10003,"ok","获取用户信息成功!"), 18 | C10004(10004,"get user failed !","获取用户信息失败!"), 19 | C10005(10005,"ok","获取所有在线用户信息成功!"), 20 | C10006(10006,"ok","获取所有离线用户信息成功!"), 21 | C10007(10007,"ok","登录成功!"), 22 | C10008(10008,"login failed !","登录失败!"), 23 | C10009(10009,"ok","鉴权成功!"), 24 | C10010(10010,"auth failed!","鉴权失败!"), 25 | C10011(10011,"join group ok!","加入群组成功!"), 26 | C10012(10012,"join group failed!","加入群组失败!"), 27 | C10013(10013,"Protocol version number does not match","协议版本号不匹配!"), 28 | C10014(10014,"unsupported cmd command","不支持的cmd命令!"), 29 | C10015(10015,"get user message failed!","获取用户消息失败!"), 30 | C10016(10016,"get user message ok!","获取离线消息成功!"), 31 | C10017(10017,"cmd failed!","未知的cmd命令!"), 32 | C10018(10018,"get user message ok!","获取历史消息成功!"), 33 | C10020(10020,"Invalid verification!","不合法校验"), 34 | C10021(10021,"close ok!","关闭成功"); 35 | 36 | private int status; 37 | 38 | private String description; 39 | 40 | private String text; 41 | 42 | private ImStatus(int status, String description, String text) { 43 | this.status = status; 44 | this.description = description; 45 | this.text = text; 46 | } 47 | 48 | public int getStatus() { 49 | return status; 50 | } 51 | 52 | public String getDescription() { 53 | return description; 54 | } 55 | 56 | public String getText() { 57 | return text; 58 | } 59 | 60 | @Override 61 | public int getCode() { 62 | return this.status; 63 | } 64 | 65 | @Override 66 | public String getMsg() { 67 | return this.getStatus()+" "+this.getDescription()+" "+this.getText(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/MsgServerHandler.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.support; 2 | 3 | import java.io.IOException; 4 | 5 | import org.jboss.netty.buffer.ChannelBuffer; 6 | import org.jboss.netty.buffer.ChannelBufferInputStream; 7 | import org.jboss.netty.channel.ChannelHandlerContext; 8 | import org.jboss.netty.channel.ChannelStateEvent; 9 | import org.jboss.netty.channel.ExceptionEvent; 10 | import org.jboss.netty.channel.MessageEvent; 11 | import org.jboss.netty.channel.SimpleChannelHandler; 12 | 13 | import com.google.protobuf.CodedInputStream; 14 | import com.zhangwuji.im.protobuf.IMBaseDefine; 15 | import com.zhangwuji.im.protobuf.IMMessage; 16 | import com.zhangwuji.im.protobuf.MessageEntity; 17 | import com.zhangwuji.im.protobuf.base.DataBuffer; 18 | import com.zhangwuji.im.protobuf.helper.ProtoBuf2JavaBean; 19 | import com.zhangwuji.im.websocket.server.IMMsgServerManager; 20 | import com.zhangwuji.im.websocket.server.IMWebSocketManager; 21 | 22 | public class MsgServerHandler extends SimpleChannelHandler { 23 | 24 | 25 | @Override 26 | public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) 27 | throws Exception { 28 | 29 | IMWebSocketManager.instance().channelConnectSucc(); 30 | 31 | super.channelConnected(ctx, e); 32 | } 33 | 34 | @Override 35 | public void channelDisconnected(ChannelHandlerContext ctx, 36 | ChannelStateEvent e) throws Exception { 37 | 38 | IMWebSocketManager.instance().channelDisconnected(); 39 | 40 | /** 41 | * 1. 已经与远程主机建立的连接,远程主机主动关闭连接,或者网络异常连接被断开的情况 42 | 2. 已经与远程主机建立的连接,本地客户机主动关闭连接的情况 43 | 3. 本地客户机在试图与远程主机建立连接时,遇到类似与connection refused这样的异常,未能连接成功时 44 | 而只有当本地客户机已经成功的与远程主机建立连接(connected)时,连接断开的时候才会触发channelDisconnected事件,即对应上述的1和2两种情况。 45 | * 46 | **/ 47 | super.channelDisconnected(ctx, e); 48 | 49 | } 50 | 51 | @Override 52 | public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) 53 | throws Exception { 54 | super.messageReceived(ctx, e); 55 | // 重置AlarmManager的时间 56 | ChannelBuffer channelBuffer = (ChannelBuffer) e.getMessage(); 57 | if(null!=channelBuffer) 58 | { 59 | IMMsgServerManager.instance().packetDispatch(channelBuffer); 60 | } 61 | } 62 | 63 | /** 64 | * bug问题点: 65 | * exceptionCaught会调用断开链接, channelDisconnected 也会调用断开链接,事件通知冗余不合理。 66 | * a.另外exceptionCaught 之后channelDisconnected 依旧会被调用。 [切花网络方式] 67 | * b.关闭channel 也可能触发exceptionCaught 68 | * recvfrom failed: ETIMEDOUT (Connection timed out) 没有关闭长连接 69 | * */ 70 | @Override 71 | public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { 72 | super.exceptionCaught(ctx, e); 73 | if(e.getChannel() == null || !e.getChannel().isConnected()){ 74 | // IMSocketManager.instance().onConnectMsgServerFail(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/Protocol.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.support; 2 | 3 | public interface Protocol{ 4 | /** 5 | * 心跳字节 6 | */ 7 | public static final byte HEARTBEAT_BYTE = -128; 8 | 9 | /** 10 | * 握手字节 11 | */ 12 | public static final byte HANDSHAKE_BYTE = -127; 13 | 14 | /** 15 | * 协议版本号 16 | */ 17 | public final static byte VERSION = 0x01; 18 | 19 | public final static String WEBSOCKET = "ws"; 20 | 21 | public final static String HTTP = "http"; 22 | 23 | public final static String TCP = "tcp"; 24 | 25 | public static final String COOKIE_NAME_FOR_SESSION = "jim-s"; 26 | /** 27 | * 消息体最多为多少 28 | */ 29 | public static final int MAX_LENGTH_OF_BODY = (int) (1024 * 1024 * 2.1); //只支持多少M数据 30 | 31 | /** 32 | * 消息头最少为多少个字节 33 | */ 34 | public static final int LEAST_HEADER_LENGHT = 4;//1+1+2 + (2+4) 35 | 36 | /** 37 | * 加密标识位mask,1为加密,否则不加密 38 | */ 39 | public static final byte FIRST_BYTE_MASK_ENCRYPT = -128; 40 | 41 | /** 42 | * 压缩标识位mask,1为压缩,否则不压缩 43 | */ 44 | public static final byte FIRST_BYTE_MASK_COMPRESS = 0B01000000; 45 | 46 | /** 47 | * 是否有同步序列号标识位mask,如果有同步序列号,则消息头会带有同步序列号,否则不带 48 | */ 49 | public static final byte FIRST_BYTE_MASK_HAS_SYNSEQ = 0B00100000; 50 | 51 | /** 52 | * 是否是用4字节来表示消息体的长度 53 | */ 54 | public static final byte FIRST_BYTE_MASK_4_BYTE_LENGTH = 0B00010000; 55 | 56 | /** 57 | * 版本号mask 58 | */ 59 | public static final byte FIRST_BYTE_MASK_VERSION = 0B00001111; 60 | } -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/RespBody.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.zhangwuji.im.support; 5 | 6 | /** 7 | * 版本: [1.0] 8 | * 功能说明: 9 | * 作者: WChao 创建时间: 2017年7月26日 上午11:31:48 10 | */ 11 | public class RespBody{ 12 | 13 | private Integer code;//响应状态码; 14 | 15 | private String msg;//响应状态信息提示; 16 | 17 | private Command command;//响应cmd命令码; 18 | 19 | private Object data;//响应数据; 20 | 21 | public RespBody(){} 22 | public RespBody(Command command){ 23 | this.command = command; 24 | } 25 | public RespBody(Command command,Object data){ 26 | this(command); 27 | this.data = data; 28 | } 29 | public RespBody(Command command , ImStatus status){ 30 | this(command); 31 | this.code = status.getCode(); 32 | this.msg = status.getText(); 33 | } 34 | public RespBody(ImStatus status){ 35 | this.code = status.getCode(); 36 | this.msg = status.getText(); 37 | } 38 | public Integer getCode() { 39 | return code; 40 | } 41 | 42 | public RespBody setCode(Integer code) { 43 | this.code = code; 44 | return this; 45 | } 46 | 47 | public String getMsg() { 48 | return msg; 49 | } 50 | 51 | public RespBody setMsg(String msg) { 52 | this.msg = msg; 53 | return this; 54 | } 55 | 56 | public Command getCommand() { 57 | return command; 58 | } 59 | 60 | public RespBody setCommand(Command command) { 61 | this.command = command; 62 | return this; 63 | } 64 | public Object getData() { 65 | return data; 66 | } 67 | public RespBody setData(Object data) { 68 | this.data = data; 69 | return this; 70 | } 71 | @Override 72 | public String toString() { 73 | return JsonKit.toJSONEnumNoUsingName(this); 74 | } 75 | 76 | public byte[] toByte(){ 77 | return JsonKit.toJSONBytesEnumNoUsingName(this); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/SequenceNumberMaker.java: -------------------------------------------------------------------------------- 1 | 2 | package com.zhangwuji.im.support; 3 | 4 | /** 5 | * 1.专门用来分配序列号 6 | * 2. 本地消息的唯一msgId键值 7 | * todo can use AtomicInteger 8 | */ 9 | public class SequenceNumberMaker { 10 | 11 | private volatile short mSquence = 0; 12 | 13 | private volatile long preMsgId = 0; 14 | 15 | private static SequenceNumberMaker maker = new SequenceNumberMaker(); 16 | 17 | private SequenceNumberMaker() { 18 | } 19 | 20 | public static SequenceNumberMaker getInstance() { 21 | return maker; 22 | } 23 | 24 | public short make() { 25 | synchronized (this) { 26 | mSquence++; 27 | if (mSquence >= Short.MAX_VALUE) 28 | mSquence = 1; 29 | } 30 | return mSquence; 31 | } 32 | 33 | /**依旧比较 Ugly 的解决办法 34 | * 多线程情况下,生成相同的msgId 35 | * */ 36 | public int makelocalUniqueMsgId(){ 37 | synchronized(SequenceNumberMaker.this) { 38 | int timeStamp = (int) (System.currentTimeMillis() % 10000000); 39 | int localId = timeStamp + 90000000; 40 | //logger.e("#yingmu2#之前的msgId:%d",preMsgId); 41 | if (localId == preMsgId) { 42 | localId++; 43 | if (localId >= 100000000) { 44 | localId = 90000000; 45 | } 46 | } 47 | preMsgId = localId; 48 | return localId; 49 | } 50 | } 51 | 52 | /**比较 Ugly 的解决办法,但是比较实用*/ 53 | public boolean isFailure(int msgId){ 54 | if(msgId>=90000000){ 55 | return true; 56 | } 57 | return false; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/support/Status.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.zhangwuji.im.support; 5 | 6 | /** 7 | * 版本: [1.0] 8 | * 功能说明: 9 | * 作者: WChao 创建时间: 2017年7月26日 下午4:09:41 10 | */ 11 | public interface Status { 12 | 13 | public int getCode(); 14 | 15 | public String getMsg(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/websocket/server/IMWebSocketIpStatListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.zhangwuji.im.websocket.server; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.tio.core.ChannelContext; 9 | import org.tio.core.GroupContext; 10 | import org.tio.core.intf.Packet; 11 | import org.tio.core.stat.IpStat; 12 | import org.tio.core.stat.IpStatListener; 13 | import org.tio.utils.json.Json; 14 | 15 | /** 16 | * 17 | * @author tanyaowu 18 | * 19 | */ 20 | public class IMWebSocketIpStatListener implements IpStatListener { 21 | private static Logger log = LoggerFactory.getLogger(IMWebSocketIpStatListener.class); 22 | 23 | public static final IMWebSocketIpStatListener me = new IMWebSocketIpStatListener(); 24 | 25 | /** 26 | * 27 | */ 28 | private IMWebSocketIpStatListener() { 29 | 30 | } 31 | 32 | @Override 33 | public void onExpired(GroupContext groupContext, IpStat ipStat) { 34 | //在这里把统计数据入库中或日志 35 | if (log.isInfoEnabled()) { 36 | //log.info("可以把统计数据入库\r\n{}", Json.toFormatedJson(ipStat)); 37 | } 38 | } 39 | 40 | @Override 41 | public void onAfterConnected(ChannelContext channelContext, boolean isConnected, boolean isReconnect, IpStat ipStat) throws Exception { 42 | if (log.isInfoEnabled()) { 43 | //log.info("onAfterConnected\r\n{}", Json.toFormatedJson(ipStat)); 44 | } 45 | } 46 | 47 | @Override 48 | public void onDecodeError(ChannelContext channelContext, IpStat ipStat) { 49 | if (log.isInfoEnabled()) { 50 | //log.info("onDecodeError\r\n{}", Json.toFormatedJson(ipStat)); 51 | } 52 | } 53 | 54 | @Override 55 | public void onAfterSent(ChannelContext channelContext, Packet packet, boolean isSentSuccess, IpStat ipStat) throws Exception { 56 | if (log.isInfoEnabled()) { 57 | //log.info("onAfterSent\r\n{}\r\n{}", packet.logstr(), Json.toFormatedJson(ipStat)); 58 | } 59 | } 60 | 61 | @Override 62 | public void onAfterDecoded(ChannelContext channelContext, Packet packet, int packetSize, IpStat ipStat) throws Exception { 63 | if (log.isInfoEnabled()) { 64 | //log.info("onAfterDecoded\r\n{}\r\n{}", packet.logstr(), Json.toFormatedJson(ipStat)); 65 | } 66 | } 67 | 68 | @Override 69 | public void onAfterReceivedBytes(ChannelContext channelContext, int receivedBytes, IpStat ipStat) throws Exception { 70 | if (log.isInfoEnabled()) { 71 | //log.info("onAfterReceivedBytes\r\n{}", Json.toFormatedJson(ipStat)); 72 | } 73 | } 74 | 75 | @Override 76 | public void onAfterHandled(ChannelContext channelContext, Packet packet, IpStat ipStat, long cost) throws Exception { 77 | if (log.isInfoEnabled()) { 78 | //log.info("onAfterHandled\r\n{}\r\n{}", packet.logstr(), Json.toFormatedJson(ipStat)); 79 | } 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/websocket/server/IMWebSocketServerAioListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.zhangwuji.im.websocket.server; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Component; 9 | import org.tio.core.Tio; 10 | import org.tio.core.ChannelContext; 11 | import org.tio.core.intf.Packet; 12 | import org.tio.websocket.common.WsResponse; 13 | import org.tio.websocket.common.WsSessionContext; 14 | import org.tio.websocket.server.WsServerAioListener; 15 | 16 | /** 17 | * @author tanyaowu 18 | * 用户根据情况来完成该类的实现 19 | */ 20 | public class IMWebSocketServerAioListener extends WsServerAioListener { 21 | private static Logger log = LoggerFactory.getLogger(IMWebSocketServerAioListener.class); 22 | 23 | public static final IMWebSocketServerAioListener me = new IMWebSocketServerAioListener(); 24 | 25 | private IMWebSocketServerAioListener() { 26 | 27 | } 28 | 29 | @Override 30 | public void onAfterConnected(ChannelContext channelContext, boolean isConnected, boolean isReconnect) throws Exception { 31 | super.onAfterConnected(channelContext, isConnected, isReconnect); 32 | if (log.isInfoEnabled()) { 33 | log.info("onAfterConnected\r\n{}", channelContext); 34 | } 35 | 36 | } 37 | 38 | @Override 39 | public void onAfterSent(ChannelContext channelContext, Packet packet, boolean isSentSuccess) throws Exception { 40 | super.onAfterSent(channelContext, packet, isSentSuccess); 41 | if (log.isInfoEnabled()) { 42 | log.info("onAfterSent\r\n{}\r\n{}", packet.logstr(), channelContext); 43 | } 44 | } 45 | 46 | @Override 47 | public void onBeforeClose(ChannelContext channelContext, Throwable throwable, String remark, boolean isRemove) throws Exception { 48 | super.onBeforeClose(channelContext, throwable, remark, isRemove); 49 | if (log.isInfoEnabled()) { 50 | log.info("onBeforeClose\r\n{}", channelContext); 51 | } 52 | } 53 | 54 | @Override 55 | public void onAfterDecoded(ChannelContext channelContext, Packet packet, int packetSize) throws Exception { 56 | super.onAfterDecoded(channelContext, packet, packetSize); 57 | if (log.isInfoEnabled()) { 58 | //log.info("onAfterDecoded\r\n{}\r\n{}", packet.logstr(), channelContext); 59 | } 60 | } 61 | 62 | @Override 63 | public void onAfterReceivedBytes(ChannelContext channelContext, int receivedBytes) throws Exception { 64 | super.onAfterReceivedBytes(channelContext, receivedBytes); 65 | if (log.isInfoEnabled()) { 66 | log.info("onAfterReceivedBytes\r\n{}", channelContext); 67 | } 68 | } 69 | 70 | @Override 71 | public void onAfterHandled(ChannelContext channelContext, Packet packet, long cost) throws Exception { 72 | super.onAfterHandled(channelContext, packet, cost); 73 | if (log.isInfoEnabled()) { 74 | log.info("onAfterHandled\r\n{}\r\n{}", packet.logstr(), channelContext); 75 | } 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/websocket/server/IMWebSocketServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.websocket.server; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.stereotype.Component; 6 | import org.tio.utils.time.Time; 7 | 8 | @Configuration 9 | public class IMWebSocketServerConfig { 10 | /** 11 | * 协议名字(可以随便取,主要用于开发人员辨识) 12 | */ 13 | public String PROTOCOL_NAME = "cloudtalkwebsocket"; 14 | public String CHARSET = "utf-8"; 15 | /** 16 | * AppID 标识此服务的默认AppId 17 | */ 18 | public String IMAPPID="88888"; 19 | /* 20 | * HttpMsgServer服务器的ip和端口,一般放在同一服务器最佳 21 | */ 22 | public String HttpMsgServer="127.0.0.1"; 23 | 24 | public int HttpMsgServerPort=9900; 25 | /** 26 | * 监听的ip 27 | */ 28 | public String SERVER_IP = null;//null表示监听所有,并不指定ip 29 | /** 30 | * 监听端口 对Web开放的端口 ws/wss 31 | */ 32 | public int SERVER_PORT = 9326; 33 | /** 34 | * 心跳超时时间,单位:毫秒 35 | */ 36 | public int HEARTBEAT_TIMEOUT = 1000 * 10; 37 | 38 | /** 39 | * ip数据监控统计,时间段 40 | * @author tanyaowu 41 | * 42 | */ 43 | public static interface IpStatDuration { 44 | public static final Long DURATION_1 = Time.MINUTE_1 * 5; 45 | public static final Long[] IPSTAT_DURATIONS = new Long[] { DURATION_1 }; 46 | } 47 | private static IMWebSocketServerConfig inst = new IMWebSocketServerConfig(); 48 | public static IMWebSocketServerConfig instance() { 49 | return inst; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/zhangwuji/im/websocket/server/IMWebSocketStarter.java: -------------------------------------------------------------------------------- 1 | package com.zhangwuji.im.websocket.server; 2 | 3 | import java.io.IOException; 4 | 5 | import org.springframework.stereotype.Component; 6 | import org.tio.server.ServerGroupContext; 7 | import org.tio.websocket.server.WsServerStarter; 8 | import com.jfinal.kit.PropKit; 9 | 10 | public class IMWebSocketStarter { 11 | 12 | private WsServerStarter wsServerStarter; 13 | private ServerGroupContext serverGroupContext; 14 | 15 | public IMWebSocketStarter(int port, IMWebSocketWsMsgHandler wsMsgHandler) throws Exception { 16 | wsServerStarter = new WsServerStarter(port, wsMsgHandler); 17 | 18 | serverGroupContext = wsServerStarter.getServerGroupContext(); 19 | serverGroupContext.setName(IMWebSocketServerConfig.instance().PROTOCOL_NAME); 20 | // serverGroupContext.setServerAioListener(IMWebSocketServerAioListener.me); 21 | 22 | //设置ip监控 23 | //serverGroupContext.setIpStatListener(IMWebSocketIpStatListener.me); 24 | //设置ip统计时间段 25 | //serverGroupContext.ipStats.addDurations(IMWebSocketServerConfig.IpStatDuration.IPSTAT_DURATIONS); 26 | 27 | //设置心跳超时时间 28 | serverGroupContext.setHeartbeatTimeout(IMWebSocketServerConfig.instance().HEARTBEAT_TIMEOUT); 29 | //如果你希望通过wss来访问,就加上下面的代码吧,不过首先你得有SSL证书(证书必须和域名相匹配,否则可能访问不了ssl) 30 | String keyStoreFile = "classpath:config/ssl/imtt.b56.cn.jks"; 31 | String trustStoreFile = "classpath:config/ssl/imtt.b56.cn.jks"; 32 | String keyStorePwd = "123456"; 33 | //serverGroupContext.useSsl(keyStoreFile, trustStoreFile, keyStorePwd); 34 | } 35 | 36 | /** 37 | * @param args 38 | * @author tanyaowu 39 | * @throws IOException 40 | */ 41 | public static void start() throws Exception { 42 | IMWebSocketStarter appStarter = new IMWebSocketStarter(IMWebSocketServerConfig.instance().SERVER_PORT, IMWebSocketWsMsgHandler.me); 43 | appStarter.wsServerStarter.start(); 44 | } 45 | 46 | /** 47 | * @return the serverGroupContext 48 | */ 49 | public ServerGroupContext getServerGroupContext() { 50 | return serverGroupContext; 51 | } 52 | 53 | public WsServerStarter getWsServerStarter() { 54 | return wsServerStarter; 55 | } 56 | 57 | public static void main(String[] args) throws Exception { 58 | 59 | //从配置文件里面读取参数配置 60 | PropKit.use("app.properties"); 61 | IMWebSocketServerConfig.instance().SERVER_IP=PropKit.get("SERVER_IP"); 62 | IMWebSocketServerConfig.instance().SERVER_PORT=PropKit.getInt("SERVER_PORT"); 63 | IMWebSocketServerConfig.instance().IMAPPID=PropKit.get("IMAPPID"); 64 | IMWebSocketServerConfig.instance().HttpMsgServer=PropKit.get("HttpMsgServerIp"); 65 | IMWebSocketServerConfig.instance().HttpMsgServerPort=PropKit.getInt("HttpMsgServerPort"); 66 | start(); 67 | IMMsgServerManager.instance().initConnectHttpServer(); 68 | IMMsgServerManager.instance().initHeartBeat(); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/app.properties: -------------------------------------------------------------------------------- 1 | #客户端默认appid 2 | IMAPPID=88888 3 | 4 | #本模块监听的ip与端口 5 | SERVER_IP=0.0.0.0 6 | SERVER_PORT=9326 7 | 8 | #HttpMsgServer服务端的ip.建议放在同一服务器 9 | HttpMsgServerIp=127.0.0.1 10 | HttpMsgServerPort=9900 -------------------------------------------------------------------------------- /src/main/resources/application-local.properties: -------------------------------------------------------------------------------- 1 | #本地环境环境配置文件 2 | server.port = 8080 3 | 4 | #客户端默认appid 5 | IMAPPID=88888 6 | #本模块监听的ip与端口 7 | SERVER_IP=0.0.0.0 8 | SERVER_PORT=9326 9 | #HttpMsgServer服务端的ip.建议放在同一服务器 10 | HttpMsgServerIp=127.0.0.1 11 | HttpMsgServerPort=9900 -------------------------------------------------------------------------------- /src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #生产环境配置文件 2 | 3 | server.port = 8080 4 | ##你生成的证书名字 5 | #server.ssl.key-store=classpath:im.keystore 6 | ##密码 7 | #server.ssl.key-store-password=im 8 | #server.ssl.keyStoreType=JKS 9 | #server.ssl.keyAlias:im 10 | 11 | 12 | #客户端默认appid 13 | IMAPPID=88888 14 | #本模块监听的ip与端口 15 | SERVER_IP=0.0.0.0 16 | SERVER_PORT=9326 17 | 18 | #HttpMsgServer服务端的ip.建议放在同一服务器 19 | HttpMsgServerIp=127.0.0.1 20 | HttpMsgServerPort=9900 -------------------------------------------------------------------------------- /src/main/resources/application-qa.properties: -------------------------------------------------------------------------------- 1 | #测试环境配置文件 2 | server.port = 8080 3 | 4 | #客户端默认appid 5 | IMAPPID=88888 6 | #本模块监听的ip与端口 7 | SERVER_IP=0.0.0.0 8 | SERVER_PORT=9326 9 | 10 | #HttpMsgServer服务端的ip.建议放在同一服务器 11 | HttpMsgServerIp=127.0.0.1 12 | HttpMsgServerPort=9900 -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=local 2 | 3 | ## Spring AOP 4 | spring.aop.auto=true 5 | spring.aop.proxy-target-class=true 6 | 7 | spring.mvc.static-path-pattern=/** 8 | 9 | #热部署生效 10 | spring.devtools.restart.enabled: true 11 | #设置重启的目录 12 | #spring.devtools.restart.additional-paths: src/main/java 13 | #classpath目录下的WEB-INF文件夹内容修改不重启 14 | spring.devtools.restart.exclude: WEB-INF/** 15 | 16 | #上传的文件路径 17 | web.upload-path=/www/wwwroot/imfiles 18 | spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/page/,file:${web.upload-path} 19 | spring.servlet.multipart.max-file-size=300Mb 20 | spring.servlet.multipart.max-request-size=300Mb 21 | 22 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 23 | spring.datasource.url=jdbc:mysql://127.0.0.1:3306/newim?useSSL=false 24 | spring.datasource.username=newim 25 | spring.datasource.password=123456 26 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 27 | 28 | #缓存配置 29 | spring.cache.type=ehcache 30 | spring.cache.ehcache.config=classpath:ehcache.xml 31 | mybatis-plus.mapper-locations=classpath:/mapper/*/*Mapper.xml 32 | mybatis-plus.typeAliasesPackage=com.zhangwuji.im.*.entity 33 | mybatis-plus.global-config.db-config.id-type=AUTO 34 | mybatis-plus.global-config.db-config.field-strategy=not_empty 35 | mybatis-plus.global-config.db-config.logic-delete-value=0 36 | mybatis-plus.global-config.db-config.logic-not-delete-value=1 37 | mybatis-plus.global-config.db-config.db-type=mysql 38 | mybatis-plus.global-config.refresh=true 39 | mybatis-plus.configuration.map-underscore-to-camel-case=true 40 | mybatis-plus.configuration.cache-enabled=false 41 | 42 | # REDIS (RedisProperties) 43 | # Redis服务器地址 44 | spring.redis.host=127.0.0.1 45 | # Redis服务器连接端口 46 | spring.redis.port=6379 47 | # Redis服务器连接密码(默认为空) 48 | spring.redis.password= 49 | # 连接超时时间(毫秒) 50 | spring.redis.timeout=60s 51 | # Redis数据库索引(默认为0) 52 | spring.redis.database=1 53 | spring.redis.jedis.pool.max-idle:500 54 | spring.redis.jedis.pool.min-idle:50 55 | spring.redis.jedis.pool.max-wait:-1s 56 | spring.redis.jedis.pool.max-active:-1 57 | spring.redis.jedis.shutdown-timeout=100 58 | 59 | 60 | #文件服务器 61 | cloudtalk.files.msfsprior=http://im.b56.cn:9701/ 62 | cloudtalk.files.msfspriorbackup=http://im.b56.cn:9701/ 63 | 64 | #cloudtalk http api服务器地址 65 | cloudtalk.api.url=http://127.0.0.1:9400/api/sendmsg 66 | 67 | #云表情key配置 68 | cloudtalk.bqmmplugin.appid=17edd35bcf9d483592bb41ac98293e23 69 | cloudtalk.bqmmplugin.appsecret=2ed3fe6cfed44c04a64c6df1c94bf33e 70 | 71 | -------------------------------------------------------------------------------- /src/main/resources/config/ssl/im.b56.cn.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudtalk-im/cloudtalk-websocket/eea4e2c37d7ced8b69c3798e9ef9e3d7bd0ec395/src/main/resources/config/ssl/im.b56.cn.jks -------------------------------------------------------------------------------- /src/main/resources/config/ssl/imtt.b56.cn.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudtalk-im/cloudtalk-websocket/eea4e2c37d7ced8b69c3798e9ef9e3d7bd0ec395/src/main/resources/config/ssl/imtt.b56.cn.jks -------------------------------------------------------------------------------- /src/main/resources/config/ssl/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudtalk-im/cloudtalk-websocket/eea4e2c37d7ced8b69c3798e9ef9e3d7bd0ec395/src/main/resources/config/ssl/keystore.jks -------------------------------------------------------------------------------- /src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 35 | 36 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/resources/logback.properties: -------------------------------------------------------------------------------- 1 | #http://logback.qos.ch/manual/configuration.html 2 | # resource, file, url (被包含的文件需要满足一定格式) 3 | 4 | context.name=cloudtalk-websocket-server 5 | 6 | log.dir=./logs/cloudtalk-websocket-server 7 | 8 | rolling.policy.file.name.pattern=yyyy-MM-dd HH 9 | max.file.size=100MB 10 | max.history=50 11 | 12 | conversion.pattern=%d %-5level %logger{30}[%line]: %m%n 13 | root.level=error 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMAudioMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMDepartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMDiscoveryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMGroupMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | select * from on_IMGroup where id in 11 | 12 | #{item} 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMGroupMemberMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | select * from on_IMGroupMember where groupId in 11 | 12 | #{item} 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMRecentSessionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMTransmitFileMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMUserFriendsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMUserGeoDataMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/api/IMUserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | select username, nickname, api_token from on_IMUser 24 | 25 | 26 | 27 | 28 | select id,id as peerId,username,nickname,realname,sex,avatar,domain,phone,email,sign_info,updated,created from on_IMUser where id in 29 | 30 | #{item} 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /startup.sh: -------------------------------------------------------------------------------- 1 | #-Xverify:none -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider 2 | #-Xrunjdwp:transport=dt_socket,address=8888,suspend=n,server=y 3 | 4 | nohup java -Xverify:none -Xms64m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Dtio.default.read.buffer.size=2048 -XX:HeapDumpPath=./zhangwuji_imwebsocket-pid.hprof -jar -Dloader.path=.,3rd-lib,config ./cloudtalk-websocket-1.0-SNAPSHOT-classes.jar > ./im.log & --------------------------------------------------------------------------------
14 | * 15 | *
14 | * IM群信息 15 | *
14 | * 用户和群的关系表 15 | *
13 | * 14 | *
8 | * Mapper 接口 9 | *
12 | * Mapper 接口 13 | *
14 | * IM群信息 Mapper 接口 15 | *
12 | * 用户和群的关系表 Mapper 接口 13 | *
17 | * Mapper 接口 18 | *
16 | * 17 | *
8 | * 服务类 9 | *
11 | * 服务类 12 | *
11 | * 用户和群的关系表 服务类 12 | *
12 | * IM群信息 服务类 13 | *
12 | * 服务类 13 | *
12 | * 服务实现类 13 | *
15 | * 服务实现类 16 | *
15 | * 用户和群的关系表 服务实现类 16 | *
16 | * IM群信息 服务实现类 17 | *
18 | * 服务实现类 19 | *