Browse Source

add project

develop
SAM2O2O 2 years ago
commit
c42515bf41
  1. 13
      .gitignore
  2. 201
      LICENSE
  3. 170
      NOTICE
  4. 163
      README.md
  5. 27
      build.sh
  6. 68
      openzaly-admin/pom.xml
  7. 37
      openzaly-admin/src/main/java/com/akaxin/site/web/OpenzalyAdminApplication.java
  8. 92
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/bean/WebMessageBean.java
  9. 22
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/common/MsgUtils.java
  10. 16
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/common/Timeutils.java
  11. 59
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/AbstractController.java
  12. 40
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/CommomController.java
  13. 282
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/ConfigManageController.java
  14. 555
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/GroupManageController.java
  15. 99
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/MonitorController.java
  16. 324
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/PluginManageController.java
  17. 165
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/UICManageController.java
  18. 465
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/UserManageController.java
  19. 145
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/UserSquareController.java
  20. 18
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/exception/ManagerException.java
  21. 12
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/exception/UserPermissionException.java
  22. 27
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IConfigService.java
  23. 32
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IGroupService.java
  24. 20
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IMessageManageService.java
  25. 17
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IMonitorService.java
  26. 19
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IPluginService.java
  27. 13
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IUICService.java
  28. 23
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/IUserService.java
  29. 184
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/ConfigManageService.java
  30. 87
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/GroupManageService.java
  31. 105
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/MessageManageService.java
  32. 47
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/MonitorService.java
  33. 66
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/PluginManageService.java
  34. 54
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/UICManageService.java
  35. 152
      openzaly-admin/src/main/java/com/akaxin/site/web/admin/service/impl/UserManageService.java
  36. 18
      openzaly-admin/src/main/java/com/akaxin/site/web/utils/ArraysUtils.java
  37. 10
      openzaly-admin/src/main/resources/application.properties
  38. 91
      openzaly-admin/src/main/resources/webapp/static/Public/css/style.css
  39. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/group.png
  40. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/invite.png
  41. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/monitor.png
  42. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/plugin.png
  43. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/setting.png
  44. BIN
      openzaly-admin/src/main/resources/webapp/static/Public/images/user.png
  45. 164
      openzaly-admin/src/main/resources/webapp/views/admin.html
  46. 622
      openzaly-admin/src/main/resources/webapp/views/basic/config.html
  47. 67
      openzaly-admin/src/main/resources/webapp/views/error.html
  48. 223
      openzaly-admin/src/main/resources/webapp/views/group/addMember.html
  49. 240
      openzaly-admin/src/main/resources/webapp/views/group/index.html
  50. 251
      openzaly-admin/src/main/resources/webapp/views/group/manage.html
  51. 236
      openzaly-admin/src/main/resources/webapp/views/group/memberList.html
  52. 242
      openzaly-admin/src/main/resources/webapp/views/group/profile.html
  53. 356
      openzaly-admin/src/main/resources/webapp/views/jump/jump.html
  54. 173
      openzaly-admin/src/main/resources/webapp/views/monitor/index.html
  55. 413
      openzaly-admin/src/main/resources/webapp/views/plugin/add.html
  56. 64
      openzaly-admin/src/main/resources/webapp/views/plugin/error.html
  57. 149
      openzaly-admin/src/main/resources/webapp/views/plugin/index.html
  58. 210
      openzaly-admin/src/main/resources/webapp/views/plugin/list.html
  59. 625
      openzaly-admin/src/main/resources/webapp/views/plugin/update.html
  60. 70
      openzaly-admin/src/main/resources/webapp/views/siteMember/error.html
  61. 310
      openzaly-admin/src/main/resources/webapp/views/siteMember/siteMember.html
  62. 141
      openzaly-admin/src/main/resources/webapp/views/uic/index.html
  63. 239
      openzaly-admin/src/main/resources/webapp/views/uic/unused_list.html
  64. 155
      openzaly-admin/src/main/resources/webapp/views/uic/used_list.html
  65. 68
      openzaly-admin/src/main/resources/webapp/views/user/error.html
  66. 238
      openzaly-admin/src/main/resources/webapp/views/user/index.html
  67. 413
      openzaly-admin/src/main/resources/webapp/views/user/profile.html
  68. 130
      openzaly-admin/src/main/resources/webapp/views/webMsg/test.html
  69. 7
      openzaly-boot/.gitignore
  70. 82
      openzaly-boot/openzaly-server.config
  71. 105
      openzaly-boot/pom.xml
  72. 26
      openzaly-boot/src/assembly-zip.xml
  73. 14
      openzaly-boot/src/main/java/com/akaxin/site/boot/config/AkxProject.java
  74. 95
      openzaly-boot/src/main/java/com/akaxin/site/boot/config/ConfigHelper.java
  75. 47
      openzaly-boot/src/main/java/com/akaxin/site/boot/config/ConfigKey.java
  76. 57
      openzaly-boot/src/main/java/com/akaxin/site/boot/config/ConfigListener.java
  77. 30
      openzaly-boot/src/main/java/com/akaxin/site/boot/config/SiteDefaultIcon.java
  78. 329
      openzaly-boot/src/main/java/com/akaxin/site/boot/main/Bootstrap.java
  79. 43
      openzaly-boot/src/main/java/com/akaxin/site/boot/spring/CustomizationWebServerBean.java
  80. 20
      openzaly-boot/src/main/java/com/akaxin/site/boot/spring/OpenzalyConfiguration.java
  81. 45
      openzaly-boot/src/main/java/com/akaxin/site/boot/spring/OpenzalySpringBoot.java
  82. 24
      openzaly-boot/src/main/java/com/akaxin/site/boot/utils/BootLog.java
  83. 241
      openzaly-boot/src/main/java/com/akaxin/site/boot/utils/Helper.java
  84. 94
      openzaly-boot/src/main/java/com/akaxin/site/boot/utils/PropertiesUtils.java
  85. 21
      openzaly-boot/src/main/resources/application.properties
  86. 31
      openzaly-boot/src/main/resources/log4j.properties
  87. 16
      openzaly-boot/src/main/resources/logo.txt
  88. 100
      openzaly-boot/src/main/resources/openzaly-server.config
  89. 17
      openzaly-boot/src/test/java/com/akaxin/site/boot/test/TestDefaultIcon.java
  90. 28
      openzaly-boot/src/test/java/com/akaxin/site/boot/test/TestFile.java
  91. 16
      openzaly-boot/src/test/java/com/akaxin/site/boot/test/TestHttpClient.java
  92. 7
      openzaly-boot/src/test/java/com/akaxin/site/boot/test/TestSystemPro.java
  93. 1
      openzaly-business/.gitignore
  94. 53
      openzaly-business/pom.xml
  95. 10
      openzaly-business/src/main/java/com/akaxin/site/business/api/IRequest.java
  96. 5
      openzaly-business/src/main/java/com/akaxin/site/business/bean/MsgNoticeBean.java
  97. 71
      openzaly-business/src/main/java/com/akaxin/site/business/bean/PlatformPhoneBean.java
  98. 54
      openzaly-business/src/main/java/com/akaxin/site/business/cache/WebSessionCache.java
  99. 6
      openzaly-business/src/main/java/com/akaxin/site/business/constant/AkxProject.java
  100. 22
      openzaly-business/src/main/java/com/akaxin/site/business/constant/GroupConfig.java

13
.gitignore

@ -0,0 +1,13 @@
*.classpath
*.project
*.settings/
.idea/
*.swp
*.iml
target/
.DS_Store
openzalyDB.sqlite3
stdout.log
openzaly-server.jar
site-file/
site-logs/

201
LICENSE

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

170
NOTICE

@ -0,0 +1,170 @@
Copyright 2018-2028 Akaxin Group.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
========================[Dependencies]===============================
Spring:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://www.springsource.org
Javassist:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://www.jboss.org/javassist
Netty:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://netty.io
Mina:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://mina.apache.org
Grizzly:
* LICENSE:
* http://www.gnu.org/licenses/gpl-2.0.html (General Public License 2.0)
* HOMEPAGE:
* http://grizzly.java.net
HttpClient:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://hc.apache.org
Hessian:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://hessian.caucho.com
XStream:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://xstream.codehaus.org
FastJson:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://code.alibabatech.com/wiki/fastjson
Zookeeper:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://zookeeper.apache.org
Jedis:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://code.google.com/p/jedis
XMemcached:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://code.google.com/p/xmemcached
Jetty:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://jetty.mortbay.org
Thrift:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://thrift.apache.org
CXF:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://cxf.apache.org
ZKClient:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* https://github.com/sgroschupf/zkclient
Curator
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* https://github.com/Netflix/curator
JFreeChart:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://www.jfree.org
HibernateValidator:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://www.hibernate.org/subprojects/validator.html
CommonsLogging:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://commons.apache.org/logging
SLF4J:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://www.slf4j.org
Log4j:
* LICENSE:
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
* HOMEPAGE:
* http://log4j.apache.org

163
README.md

@ -0,0 +1,163 @@
<p align="right">
<a href="https://www.akaxin.com/">
<img
alt="Akaxin"
src="https://avatars3.githubusercontent.com/u/32624098?s=200&v=4"
width="128"
/>
</a>
</p>
[Akaxin](https://www.akaxin.com)
====
[![License](https://img.shields.io/badge/license-apache2-blue.svg)](LICENSE)
**源码仓库**
> * **Github**: https://github.com/akaxincom/openzaly
> * `国内快` Gitee: https://gitee.com/akaxin/openzaly
_
**向我们提问**
> QQ群:`655249600`
简介
----
Akaxin 是一款开源免费的私有聊天软件,可以部署在任意服务器上,搭建自己的聊天服务器,供自己与朋友、用户使用。
特性:
* 单聊、群聊(含文字、图片、语音等)
* 端到端的加密消息(服务端不可解密,服务器可通过配置关闭此特性)
* 匿名注册、实名注册,以及注册邀请码机制(只允许特定用户注册)
* 扩展机制
* 等
<p align="center">
<img align="center" src="https://is1-ssl.mzstatic.com/image/thumb/Purple118/v4/5f/56/82/5f56825f-5a1d-751a-76ee-e4af3337133c/pr_source.png/0x0ss.jpg" width="200" /> &nbsp; <img align="center" src="https://is1-ssl.mzstatic.com/image/thumb/Purple128/v4/0a/13/7f/0a137f45-a89e-57d6-3135-5c72b219b28d/pr_source.png/0x0ss.jpg" width="200" /> &nbsp; <img align="center" src="https://is1-ssl.mzstatic.com/image/thumb/Purple128/v4/45/ec/0a/45ec0a96-6683-049e-139b-f11aaea306c8/pr_source.png/0x0ss.jpg" width="200" /> &nbsp;
</p>
一、快速体验
----
**1. 启动服务器**
* **最新版本: openzaly 1.0.7**
* 国内镜像:https://cdn-akaxin-1255552447.cos.ap-beijing.myqcloud.com/openzaly/openzaly-server.jar
* Github下载: https://github.com/akaxincom/openzaly/releases/
* **Changelog**
* openzaly发布team版本,同时支持个人版与team版。
* team 版本支持使用mysql数据库,并且可配置主从库。
* openzaly使用ssl与平台交互增加了信息传输的安全性。
openzlay 0.10.6开始支持personal(个人版)与team版,默认状态下使用personal
支持的启动参数:`java -jar openzaly-server.jar -h`
openzaly Personal版本 命令:
* 版本升级:`java -jar openzaly-server.jar -upgrade` ,此命令在服务与sqlite数据库版本不一致时执行,正常情况无需执行
* 启动命令:`java -jar openzaly-server.jar`
openzaly Team版本 命令:
* 生成Team版本所需配置模版:`java -jar openzaly-server.jar -team`
* 修改配置文件: 上一步会生成 openzaly-server.config 使用mysql数据库需在openzaly-server.config配置文件中配置mysql参数:
主库(数据库编码需要设置utf8mb4):
openzaly.mysql.host=localhost //数据库的地址
openzaly.mysql.port=3306 //数据库端口
openzaly.mysql.database=openzaly //数据库名称
openzaly.mysql.username=root //mysql数据库访问用户
openzaly.mysql.password=1234567890 //mysql数据库密码
从库(如果需要使用主从模式,配置这里,不需要从库则不需要配置)数据库编码需要设置utf8mb4:
openzaly.mysql.slave.host=localhost
openzaly.mysql.slave.port=3306
openzaly.mysql.slave.database=openzaly
openzaly.mysql.slave.username=root
openzaly.mysql.slave.password=1234567890
其他mysql参数为使用mysql连接池的配置参数,如若涉及性能优化可开启配置项。
* 迁移数据库命令:openzaly支持使用者把Personal版本的sqlite中的数据迁移到Team版本的mysql数据库
如果执行这一步需要在openzaly-server.config配置文件中配置:
`openzaly.sqlite.url=openzalyDB.sqlite3` 这里指定sqlite数据库文件的位置
继续执行迁移命令:
`java -jar openzaly-server.jar -migrate`
* 启动命令:`java -jar openzaly-server.jar`
**2. 下载客户端**
> * [iOS](https://itunes.apple.com/cn/app/%E9%98%BF%E5%8D%A1%E4%BF%A1/id1346971087?mt=8)
> * [Android](https://www.akaxin.com)
**3. 访问站点**
> * 生成账号(手机账号与匿名均可)
> * 输入站点服务器
> * 首次登陆为管理员,邀请码:000000
> * 别的用户登陆后可以互加好友,开始聊天。
* 匿名账号,账号保存在设备本地,用户不会填写手机信息,任何地方都获取不到。
> **站点注册方式默认为匿名,进入站点后,请根据情况第一时间修改为 实名 或者 开启邀请码,防止恶意用户进入**
二、源码编译安装
----
需要本地有mvn,直接使用mvn编译即可。
三、扩展开发
----
Akaxin 具有灵活、强大的扩展机制 `(“管理平台” 就是一个扩展)`。通过嵌入WEB页面,与后端的扩展API进行交互, 可以很轻松的构建丰富的业务功能,如:
* 附近交友
* 店铺点评
* 在线游戏
* 等等等等
你的聊天服务器,将摇身一变,成为一个强大的社交软件平台。
> 扩展机制处于技术预览阶段,如果你希望在自己的业务中开发自己的扩展,可以联系我们( mail: hi@akaxin.xyz ),我们将免费提供文档与技术答疑。
以下是我们开发的一个 “校园社交” 的扩展,截图如下:
<p align="center">
<img align="center" src="https://raw.githubusercontent.com/akaxincom/faq/master/app_pic/plugin.1.jpeg" width="200" /> &nbsp; <img align="center" src="https://raw.githubusercontent.com/akaxincom/faq/master/app_pic/plugin.2.jpeg" width="200" /> &nbsp; <img align="center" src="https://raw.githubusercontent.com/akaxincom/faq/master/app_pic/plugin.3.jpeg" width="200" /> &nbsp;
</p>
> 大家可以去 demo.akaxin.com 体验。
四、技术贡献者
----
> 以加入时间排序
* sisishiliu
* SAM2O2O
* childeYin
* yi.chao
* lei.yu
* cuikun
* alexfanchina
* Mino0885
* 505541778

27
build.sh

@ -0,0 +1,27 @@
#!/bin/bash
# ----------------------------------------------------------------------------
# Copyright 2018-2028 Akaxin Group
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
cd `dirname $0`
mvn -T 2C clean package
cp openzaly-boot/target/openzaly-boot-*-SNAPSHOT.jar openzaly-server.jar

68
openzaly-admin/pom.xml

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.akaxin</groupId>
<artifactId>openzaly-parent</artifactId>
<version>0.0.1</version>
</parent>
<groupId>com.akaxin.site</groupId>
<artifactId>openzaly-admin</artifactId>
<version>0.0.1-RELEASE</version>
<packaging>jar</packaging>
<name>openzaly-admin</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.akaxin.site</groupId>
<artifactId>openzaly-business</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.2.RELEASE</version>
<!-- <configuration>
指定该Main Class为全局的唯一入口
<mainClass>com.akaxin.admin.OpenzalyAdminApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions> -->
</plugin>
</plugins>
</build>
</project>

37
openzaly-admin/src/main/java/com/akaxin/site/web/OpenzalyAdminApplication.java

@ -0,0 +1,37 @@
/**
* Copyright 2018-2028 Akaxin Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.akaxin.site.web;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* springboot的支持放在openzaly-boot中
*
* @author Sam{@link an.guoyue254@gmail.com}
* @since 2018-06-05 19:31:16
*/
@Deprecated
@SpringBootApplication
public class OpenzalyAdminApplication {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(OpenzalyAdminApplication.class);
application.setBannerMode(Banner.Mode.OFF);
application.run(args);
}
}

92
openzaly-admin/src/main/java/com/akaxin/site/web/admin/bean/WebMessageBean.java

@ -0,0 +1,92 @@
package com.akaxin.site.web.admin.bean;
import com.akaxin.common.utils.GsonUtils;
public class WebMessageBean {
private String siteUserId;
private String siteFriendId;
private String siteGroupId;
private String msgId;
private String webCode;
private int width;
private int height;
private String hrefUrl;
private long msgTime;
public String getSiteUserId() {
return siteUserId;
}
public void setSiteUserId(String siteUserId) {
this.siteUserId = siteUserId;
}
public String getSiteFriendId() {
return siteFriendId;
}
public void setSiteFriendId(String siteFriendId) {
this.siteFriendId = siteFriendId;
}
public String getWebCode() {
return webCode;
}
public void setWebCode(String webCode) {
this.webCode = webCode;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public long getMsgTime() {
return msgTime;
}
public void setMsgTime(long msgTime) {
this.msgTime = msgTime;
}
public String getSiteGroupId() {
return siteGroupId;
}
public void setSiteGroupId(String siteGroupId) {
this.siteGroupId = siteGroupId;
}
public String getHrefUrl() {
return hrefUrl;
}
public void setHrefUrl(String hrefUrl) {
this.hrefUrl = hrefUrl;
}
public String toString() {
return GsonUtils.toJson(this);
}
}

22
openzaly-admin/src/main/java/com/akaxin/site/web/admin/common/MsgUtils.java

@ -0,0 +1,22 @@
package com.akaxin.site.web.admin.common;
import org.apache.commons.lang3.StringUtils;
/**
* 消息工具类
*
* @author Sam{@link an.guoyue254@gmail.com}
* @since 2018-04-25 11:49:21
*/
public class MsgUtils {
public static String buildU2MsgId(String siteUserid) {
StringBuilder sb = new StringBuilder("U2-");
if (StringUtils.isNotEmpty(siteUserid)) {
int len = siteUserid.length();
sb.append(siteUserid.substring(0, len >= 8 ? 8 : len));
sb.append("-");
}
sb.append(System.currentTimeMillis());
return sb.toString();
}
}

16
openzaly-admin/src/main/java/com/akaxin/site/web/admin/common/Timeutils.java

@ -0,0 +1,16 @@
package com.akaxin.site.web.admin.common;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class Timeutils {
//返回前num天的日期
public static String getDate(Integer num) {
if (num != null && num >= 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return simpleDateFormat.format(new Date(System.currentTimeMillis()-TimeUnit.DAYS.toMillis(num)));
}
return null;
}
}

59
openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/AbstractController.java

@ -0,0 +1,59 @@
/**
* Copyright 2018-2028 Akaxin Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.akaxin.site.web.admin.controller;
import java.util.Map;
import com.akaxin.common.utils.GsonUtils;
import com.akaxin.proto.core.PluginProto;
import com.akaxin.site.business.impl.site.SiteConfig;
public class AbstractController {
protected final int PAGE_SIZE = 20;
protected final String SUCCESS = "success";
protected final String ERROR = "error";
protected final String NO_PERMISSION = "no-permission";
public boolean isManager(String siteUserId) {
return SiteConfig.isSiteManager(siteUserId);
}
public boolean isAdmin(String siteUserId) {
return SiteConfig.isSiteSuperAdmin(siteUserId);
}
public String getRequestSiteUserId(PluginProto.ProxyPluginPackage pluginPackage) {
Map<Integer, String> headerMap = pluginPackage.getPluginHeaderMap();
return headerMap.get(PluginProto.PluginHeaderKey.CLIENT_SITE_USER_ID_VALUE);
}
@SuppressWarnings("unchecked")
public Map<String, String> getRequestDataMap(PluginProto.ProxyPluginPackage pluginPackage) {
return GsonUtils.fromJson(pluginPackage.getData(), Map.class);
}
public String trim(String parameter) {
if (parameter == null) {
return parameter;
}
String trim = parameter.replaceAll("[  ]", "");
return trim;
}
}

40
openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/CommomController.java

@ -0,0 +1,40 @@
/**
* Copyright 2018-2028 Akaxin Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.akaxin.site.web.admin.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("common")
public class CommomController {
@RequestMapping("success")
public String toSuccessPage() {
return "success";
}
@RequestMapping("nopermission")
public String toNoPermissionPage() {
return "success";
}
@RequestMapping("error")
public String toErrorPage() {
return "error";
}
}

282
openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/ConfigManageController.java

@ -0,0 +1,282 @@
/**
* Copyright 2018-2028 Akaxin Group
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.akaxin.site.web.admin.controller;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.akaxin.common.logs.AkxLog4jManager;
import com.akaxin.common.utils.GsonUtils;
import com.akaxin.proto.core.ConfigProto;
import com.akaxin.proto.core.ConfigProto.ConfigKey;
import com.akaxin.proto.core.PluginProto;
import com.akaxin.site.business.impl.site.SiteConfig;
import com.akaxin.site.web.admin.exception.UserPermissionException;
import com.akaxin.site.web.admin.service.IConfigService;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* 阿卡信 - 后台管理 - 站点设置
*
* akaxin 后台管理配置
*
* @author Sam{@link an.guoyue254@gmail.com} ,Mino
* @since 2018-05-28 14:10:05
*/
@Controller
@RequestMapping("manage")
public class ConfigManageController extends AbstractController {
private static final Logger logger = LoggerFactory.getLogger(UserManageController.class);
@Autowired
private IConfigService configManageService;
@RequestMapping("/index")
public String homePage(@RequestBody byte[] bodyParam) {
PluginProto.ProxyPluginPackage pluginPackage = null;
try {
pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam);
String siteUserId = getRequestSiteUserId(pluginPackage);
boolean isManager = SiteConfig.isSiteManager(siteUserId);
if (!isManager) {
throw new UserPermissionException("Current user is not a manager");
}
return "admin";
} catch (InvalidProtocolBufferException e) {
logger.error("to basic manage error", e);
} catch (UserPermissionException u) {
logger.error("to basic manage error : " + u.getMessage());
}
return "error";
}
// 获取站点配置信息
@RequestMapping("/basicConfig")
public ModelAndView toSiteConfigPage(@RequestBody byte[] bodyParam) {
ModelAndView modelAndView = new ModelAndView("basic/config");
Map<String, Object> model = modelAndView.getModel();
// 设置默认属性
PluginProto.ProxyPluginPackage pluginPackage = null;
try {
pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
if (isAdmin(siteUserId)) {
model.put("manager_type", "admin");
} else if (isManager(siteUserId)) {
model.put("manager_type", "site_manager");
}
// 设置默认值
model.put("uic_status", "0");
model.put("pic_size", "1");
model.put("pic_path", "/akaxin");
model.put("group_members_count", "100");
model.put("u2_encryption_status", "1");
model.put("push_client_status", "0");
model.put("log_level", "INFO");
model.put("add_friends_status", "0");// 0表示允许
model.put("create_groups_status", "0");// 0默认为允许
model.put("group_qrcode_expire_time", "14");// 群二维码默认两周
Map<Integer, String> map = configManageService.getSiteConfig();
Set<Integer> integers = map.keySet();
String site_prot = "";
String site_address = "";
String http_prot = "";
String http_address = "";
for (Integer integer : integers) {
String res = map.get(integer);
switch (integer) {
case ConfigKey.SITE_NAME_VALUE:
model.put("site_name", res);
break;
case ConfigKey.SITE_ADDRESS_VALUE:
site_address = res;
break;
case ConfigKey.SITE_PORT_VALUE:
site_prot = res;
break;
case ConfigKey.SITE_HTTP_ADDRESS_VALUE:
http_address = res;
break;
case ConfigKey.SITE_HTTP_PORT_VALUE:
http_prot = res;
break;
case ConfigKey.SITE_LOGO_VALUE:
model.put("site_logo", res);
break;
case ConfigKey.SITE_INTRODUCTION_VALUE:
model.put("site_desc", res);
break;
case ConfigKey.REALNAME_STATUS_VALUE:
model.put("realName_status", res);
break;
case ConfigKey.INVITE_CODE_STATUS_VALUE:
model.put("uic_status", res);
break;
case ConfigKey.PIC_SIZE_VALUE:
model.put("pic_size", res);
break;
case ConfigKey.PIC_PATH_VALUE:
model.put("pic_path", res);
break;
case ConfigKey.GROUP_MEMBERS_COUNT_VALUE:
model.put("group_members_count", res);
break;
case ConfigKey.U2_ENCRYPTION_STATUS_VALUE:
model.put("u2_encryption_status", res);
break;
case ConfigKey.PUSH_CLIENT_STATUS_VALUE:
model.put("push_client_status", res);
break;
case ConfigKey.LOG_LEVEL_VALUE:
model.put("log_level", res);
break;
case ConfigKey.SITE_MANAGER_VALUE:
model.put("subgenus_admin", res);
break;
case ConfigKey.CONFIG_FRIEND_REQUEST_VALUE:
model.put("add_friends_status", res);
break;
case ConfigKey.CONFIG_CREATE_GROUP_VALUE:
model.put("create_groups_status", res);
break;
case ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE:
model.put("group_qrcode_expire_time", res);
break;
}
}
model.put("siteAddressAndPort", site_address + ":" + site_prot);
model.put("httpAddressAndPort", http_address + ":" + http_prot);
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to basic config page error", e);
} catch (UserPermissionException u) {
logger.error("to basic config page error : " + u.getMessage());
}
return new ModelAndView("error");
}
// 更新站点配置信息
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.POST, value = "/updateConfig")
@ResponseBody
public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) {
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class);
logger.info("siteUserId={} update config={}", siteUserId, dataMap);
Map<Integer, String> configMap = new HashMap<Integer, String>();
if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) {
configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name")));
}
if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) {
configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address")));
}
if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) {
configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port")));
}
if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) {
configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE,
trim(dataMap.get("group_members_count")));
}
if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) {
configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path")));
}
if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) {
configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo"));
}
if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) {
configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) {
configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) {
configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("add_friends_status"))) {
configMap.put(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE, dataMap.get("add_friends_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("create_groups_status"))) {
configMap.put(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE, dataMap.get("create_groups_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("group_qrcode_expire_time"))) {
configMap.put(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE,
dataMap.get("group_qrcode_expire_time"));
}
if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) {
configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status"));
}
if (StringUtils.isNotEmpty(dataMap.get("log_level"))) {
String logLevel = dataMap.get("log_level");
configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel);
Level level = Level.INFO;
if ("DEBUG".equalsIgnoreCase(logLevel)) {
level = Level.DEBUG;
} else if ("ERROR".equalsIgnoreCase(logLevel)) {
level = Level.ERROR;
}
// 更新日志级别
AkxLog4jManager.setLogLevel(level);
}
// 普通管理员无权限
if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) {
configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager")));
}
if (configManageService.updateSiteConfig(siteUserId, configMap)) {
return SUCCESS;
}
} catch (InvalidProtocolBufferException e) {
logger.error("update site config error", e);
} catch (UserPermissionException u) {
logger.error("update site config error : " + u.getMessage());
return NO_PERMISSION;
}
return ERROR;
}
}

555
openzaly-admin/src/main/java/com/akaxin/site/web/admin/controller/GroupManageController.java

@ -0,0 +1,555 @@
/**
* Copyright 2018-2028 Akaxin Group
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.akaxin.site.web.admin.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.akaxin.common.utils.GsonUtils;
import com.akaxin.proto.core.PluginProto;
import com.akaxin.site.business.dao.UserProfileDao;
import com.akaxin.site.storage.bean.GroupMemberBean;
import com.akaxin.site.storage.bean.GroupProfileBean;
import com.akaxin.site.storage.bean.SimpleGroupBean;
import com.akaxin.site.storage.bean.UserProfileBean;
import com.akaxin.site.web.admin.exception.UserPermissionException;
import com.akaxin.site.web.admin.service.IConfigService;
import com.akaxin.site.web.admin.service.IGroupService;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* 群组管理控制器
*
* @author Sam{@link an.guoyue254@gmail.com}
* @since 2018-04-17 18:03:07
*/
@Controller
@RequestMapping("group")
public class GroupManageController extends AbstractController {
private static final Logger logger = LoggerFactory.getLogger(UserManageController.class);
@Resource(name = "groupManageService")
private IGroupService groupService;
@Autowired
private IConfigService configService;
// admin.html 为群列表页
@RequestMapping("/index")
public ModelAndView toGroupIndex(@RequestBody byte[] bodyParam) {
ModelAndView modelAndView = new ModelAndView("group/index");
PluginProto.ProxyPluginPackage pluginPackage = null;
try {
pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
List<String> defaultGroupList = configService.getUserDefaultGroupList();
ArrayList<GroupProfileBean> groupProfileBeans = new ArrayList<>();
modelAndView.addObject("groupDefaultSize", "0");
if (defaultGroupList != null && defaultGroupList.size() > 0) {
for (String s : defaultGroupList) {
GroupProfileBean groupProfile = groupService.getGroupProfile(s);
groupProfileBeans.add(groupProfile);
}
modelAndView.addObject("groupList", groupProfileBeans);
modelAndView.addObject("groupDefaultSize", String.valueOf(defaultGroupList.size()));
}
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to group index error", e);
} catch (UserPermissionException e) {
logger.error("to group index error : " + e.getMessage());
}
return new ModelAndView("error");
}
@SuppressWarnings("unchecked")
public Map<String, Object> getRequestDataMapObj(PluginProto.ProxyPluginPackage pluginPackage) {
return GsonUtils.fromJson(pluginPackage.getData(), Map.class);
}
// 跳转到manage界面
@RequestMapping("manage")
public ModelAndView toManage(@RequestBody byte[] bodyParams) {
ModelAndView modelAndView = new ModelAndView("group/manage");
Map<String, Object> model = modelAndView.getModel();
PluginProto.ProxyPluginPackage pluginPackage = null;
try {
pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
GroupProfileBean groupProfile = groupService.getGroupProfile(siteGroupId);
model.put("group_id", siteGroupId);
model.put("defaultState", groupProfile.getDefaultState());
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to group manage error", e);
} catch (UserPermissionException e) {
logger.error("to group manage error : " + e.getMessage());
}
return new ModelAndView("error");
}
// 跳转到添加群成员界面
@RequestMapping("/siteUser")
public ModelAndView toAddMember(@RequestBody byte[] bodyParams) {
ModelAndView modelAndView = new ModelAndView("group/addMember");
Map<String, Object> model = modelAndView.getModel();
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
model.put("siteGroupId", siteGroupId);
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to group add error", e);
} catch (UserPermissionException e) {
logger.error("to group add error : " + e.getMessage());
}
return new ModelAndView("error");
}
/**
* 设置用户的默认群组
*
* @param bodyParams
* @return
*/
@RequestMapping("/setUserDefaultGroup")
@ResponseBody
public String setUserDefaultGroup(@RequestBody byte[] bodyParams) {
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String requestSiteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(requestSiteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
boolean flag = configService.setUserDefaultGroups(siteGroupId);
if (flag) {
return SUCCESS;
}
} catch (InvalidProtocolBufferException e) {
logger.error("to group add error", e);
} catch (UserPermissionException e) {
logger.error("to group add error : " + e.getMessage());
return NO_PERMISSION;
}
return ERROR;
}
@RequestMapping("/deleteUserDefaultGroup")
@ResponseBody
public String deleteUserDefaultGroup(@RequestBody byte[] bodyParams) {
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
boolean flag = configService.deleteUserDefaultGroup(siteGroupId);
if (flag) {
return SUCCESS;
}
} catch (InvalidProtocolBufferException e) {
logger.error("del group default error", e);
} catch (UserPermissionException e) {
logger.error("del group default error : " + e.getMessage());
return NO_PERMISSION;
}
return ERROR;
}
@RequestMapping("toMemberList")
public ModelAndView toMemberList(@RequestBody byte[] bodyParams) {
ModelAndView modelAndView = new ModelAndView("group/memberList");
Map<String, Object> model = modelAndView.getModel();
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
// 增加权限校验
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
model.put("siteGroupId", siteGroupId);
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to group add error", e);
} catch (UserPermissionException e) {
logger.error("to group add error : " + e.getMessage());
}
return new ModelAndView("error");
}
// 跳转群组资料(群信息页面,修改群信息页面)
@RequestMapping("/profile")
public ModelAndView toGroupProfile(HttpServletRequest request, @RequestBody byte[] bodyParams) {
ModelAndView modelAndView = new ModelAndView("group/profile");
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
String siteGroupId = reqMap.get("group_id");
GroupProfileBean bean = groupService.getGroupProfile(siteGroupId);
modelAndView.addObject("siteGroupId", bean.getGroupId());
modelAndView.addObject("groupName", bean.getGroupName());
modelAndView.addObject("groupPhoto", bean.getGroupPhoto());
modelAndView.addObject("ownerUserId", bean.getCreateUserId());
modelAndView.addObject("groupNotice", bean.getGroupNotice());
modelAndView.addObject("groupStatus", bean.getGroupStatus());
modelAndView.addObject("createTime", bean.getCreateTime());
return modelAndView;
} catch (InvalidProtocolBufferException e) {
logger.error("to group profile error", e);
} catch (UserPermissionException e) {
logger.error("to group profile error : " + e.getMessage());
}
return new ModelAndView("error");
}
@RequestMapping("/refresh")
@ResponseBody
public Map<String, Object> refreshPage(@RequestBody byte[] bodyParams) {
HashMap<String, Object> dataMap = new HashMap<>();
PluginProto.ProxyPluginPackage pluginPackage = null;
try {
pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
List<String> defaultGroupList = configService.getUserDefaultGroupList();
if (defaultGroupList == null || defaultGroupList.size() <= 0) {
dataMap.put("size", 0);
return dataMap;
}
ArrayList<Map<String, Object>> data = new ArrayList<>();
for (String s : defaultGroupList) {
GroupProfileBean bean = groupService.getGroupProfile(s);
HashMap<String, Object> groupMap = new HashMap<>();
groupMap.put("siteGroupId", bean.getGroupId());
groupMap.put("groupName", bean.getGroupName());
groupMap.put("groupPhoto", bean.getGroupPhoto());
data.add(groupMap);
}
dataMap.put("size", data.size());
dataMap.put("data", data);
} catch (InvalidProtocolBufferException e) {
logger.error("refresh group list error", e);
} catch (UserPermissionException e) {
logger.error("refresh group list error : " + e.getMessage());
}
return dataMap;
}
@RequestMapping(method = RequestMethod.POST, value = "/list")
@ResponseBody
public Map<String, Object> getGroupList(HttpServletRequest request, @RequestBody byte[] bodyParams) {
Map<String, Object> results = new HashMap<String, Object>();
boolean nodata = true;
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
int pageNum = Integer.valueOf(reqMap.get("page"));
List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
List<SimpleGroupBean> groupList = groupService.getGroupList(pageNum, PAGE_SIZE);
if (groupList != null && groupList.size() > 0) {
nodata = false;
List<String> defaultGroupList = configService.getUserDefaultGroupList();
for (SimpleGroupBean bean : groupList) {
if (defaultGroupList != null && defaultGroupList.size() > 0) {
boolean contains = defaultGroupList.contains(bean.getGroupId());
if (contains) {
continue;
}
}
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put("siteGroupId", bean.getGroupId());
groupMap.put("groupName", bean.getGroupName());
groupMap.put("groupPhoto", bean.getGroupPhoto());
data.add(groupMap);
}
}
results.put("groupData", data);
} catch (InvalidProtocolBufferException e) {
logger.error("get group list error", e);
} catch (UserPermissionException e) {
logger.error("get group list error : " + e.getMessage());
}
results.put("loading", nodata);
return results;
}
@RequestMapping(method = RequestMethod.POST, value = "/updateProfile")
@ResponseBody
public String updateGroupProfile(HttpServletRequest request, @RequestBody byte[] bodyParams) {
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!isManager(siteUserId)) {
throw new UserPermissionException("Current user is not a manager");
}
Map<String, String> reqMap = getRequestDataMap(pluginPackage);
GroupProfileBean bean = new GroupProfileBean();
bean.setGroupId(trim(reqMap.get("siteGroupId")));
bean.setGroupName(trim(reqMap.get("groupName")));
bean.setGroupPhoto(trim(reqMap.get("groupPhoto")));
bean.setGroupNotice(trim(reqMap.get("groupNotice")));
if (groupService.updateGroupProfile(bean)) {
return SUCCESS;
}
} catch (InvalidProtocolBufferException e) {
logger.error("update group profile error", e);
} catch (UserPermissionException e) {
logger.error("update group profile error : " + e.getMessage());
return NO_PERMISSION;
}
return ERROR;
}
@RequestMapping(method = RequestMethod.POST, value = "/groupMember")
@ResponseBody
public Map<String, Object> getGroupMembers(HttpServletRequest request, @RequestBody byte[] bodyParams) {
Map<String, Object> results = new HashMap<String, Object>();
boolean nodata = true;
try {
PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParams);
String siteUserId = getRequestSiteUserId(pluginPackage);
if (!