commit
c42515bf41
@ -0,0 +1,13 @@
|
||||
*.classpath
|
||||
*.project
|
||||
*.settings/
|
||||
.idea/
|
||||
*.swp
|
||||
*.iml
|
||||
target/
|
||||
.DS_Store
|
||||
openzalyDB.sqlite3
|
||||
stdout.log
|
||||
openzaly-server.jar
|
||||
site-file/
|
||||
site-logs/
|
@ -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.
|
@ -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
|
@ -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
|
@ -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>
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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( |