mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
#60 merge
This commit is contained in:
commit
ad78356c4f
38
README.md
38
README.md
@ -59,50 +59,61 @@
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>内容</th>
|
||||
<th>视频地址</th>
|
||||
<th>腾讯视频</th>
|
||||
<th>百度网盘</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 1</td>
|
||||
<td>产品概述</td>
|
||||
<td><a href="https://v.qq.com/x/page/z0776g0osqu.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/z0776g0osqu.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1BzUveFSkCtfyeU1gUIjp1Q" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 2</td>
|
||||
<td>安装部署</td>
|
||||
<td><a href="https://v.qq.com/x/page/b07760u7f8t.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/b07760u7f8t.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1CnZBIIuWpDWATjKTMluzUA" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 3</td>
|
||||
<td>功能演示</td>
|
||||
<td><a href="https://v.qq.com/x/page/h077670ceg2.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/h077670ceg2.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1bCAqUWwk_KQGyfUyvUMt9w" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 4</td>
|
||||
<td>账号体系</td>
|
||||
<td><a href="https://v.qq.com/x/page/b0776jwl6w1.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/b0776jwl6w1.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/18QA9jvXYtwa8Zt78Di9wrg" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 5</td>
|
||||
<td>客户关系管理</td>
|
||||
<td><a href="https://v.qq.com/x/page/d0776p8ghpr.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/d0776p8ghpr.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1stfkufWkF4byWqvF-ch9Dw" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 6</td>
|
||||
<td>即时通信</td>
|
||||
<td><a href="https://v.qq.com/x/page/r0776rdgt6z.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/r0776rdgt6z.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1eYEO5OtVu0gyxDI9a-xqJQ" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 7</td>
|
||||
<td>呼叫中心</td>
|
||||
<td><a href="https://v.qq.com/x/page/i07785u58jm.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/i07785u58jm.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1qQOSNMHgcNdXuq0Xib1wXA" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>No. 8</td>
|
||||
<td>数据报表</td>
|
||||
<td><a href="https://v.qq.com/x/page/e0778ptg6b0.html">链接</a></td>
|
||||
<td><a href="https://v.qq.com/x/page/e0778ptg6b0.html" target="_blank">观看</a></td>
|
||||
<td><a href="https://pan.baidu.com/s/1iQOz9HR3dkO4lgf5VI4CVw" target="_blank">下载</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
[*下载视频合集*](https://pan.baidu.com/s/1YH7d7nMm5wZQp7P8kID3KA)
|
||||
|
||||
## 开发文档
|
||||
|
||||
<p align="center">
|
||||
@ -144,11 +155,14 @@
|
||||
<img src="https://user-images.githubusercontent.com/3538629/44916014-28a5ee80-ad67-11e8-936a-a2cdbe62f529.png" width="900">
|
||||
</p>
|
||||
|
||||
|
||||
## 产品体系
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/3538629/44914271-550b3c00-ad62-11e8-89d4-f17a2186bf90.png" width="900">
|
||||
|
||||
<p align="center">
|
||||
<b>观看视频介绍</b><br>
|
||||
<a href="https://pan.baidu.com/s/1tqxqfYSvtjDGhh6bDQ-Vog" target="_blank">
|
||||
<img src="https://user-images.githubusercontent.com/3538629/45403926-6a039b80-b68f-11e8-86e2-5d1f04e3a7c7.png" width="900">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 鸣谢
|
||||
|
||||
|
44
cc-chatbot/app/.classpath
Normal file
44
cc-chatbot/app/.classpath
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
23
cc-chatbot/app/.project
Normal file
23
cc-chatbot/app/.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>sdk</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
2
cc-chatbot/app/.settings/org.eclipse.jdt.apt.core.prefs
Normal file
2
cc-chatbot/app/.settings/org.eclipse.jdt.apt.core.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.apt.aptEnabled=false
|
7
cc-chatbot/app/.settings/org.eclipse.jdt.core.prefs
Normal file
7
cc-chatbot/app/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
4
cc-chatbot/app/.settings/org.eclipse.m2e.core.prefs
Normal file
4
cc-chatbot/app/.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.chatopera.chatbot</groupId>
|
||||
<artifactId>sdk</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sdk</name>
|
||||
@ -20,16 +20,6 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
|
@ -18,15 +18,12 @@ package com.chatopera.chatbot;
|
||||
import com.mashape.unirest.http.exceptions.UnirestException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ChatbotAPI {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChatbotAPI.class);
|
||||
private String schema;
|
||||
private String hostname;
|
||||
private int port;
|
||||
@ -179,6 +176,7 @@ public class ChatbotAPI {
|
||||
* @throws ChatbotAPIRuntimeException
|
||||
*/
|
||||
public boolean updateByChatbotID(final String chatbotID,
|
||||
final String name,
|
||||
final String description,
|
||||
final String fallback,
|
||||
final String welcome) throws ChatbotAPIRuntimeException {
|
||||
@ -192,6 +190,8 @@ public class ChatbotAPI {
|
||||
body.put("fallback", fallback);
|
||||
if (StringUtils.isNotBlank(welcome))
|
||||
body.put("welcome", welcome);
|
||||
if (StringUtils.isNotBlank(name))
|
||||
body.put("name", name);
|
||||
|
||||
try {
|
||||
JSONObject result = RestAPI.put(this.baseUrl + "/chatbot/" + chatbotID, body, null);
|
||||
@ -275,8 +275,6 @@ public class ChatbotAPI {
|
||||
body.put("textMessage", textMessage);
|
||||
body.put("isDebug", debug);
|
||||
|
||||
logger.info("conversation body {}", body);
|
||||
|
||||
try {
|
||||
JSONObject resp = RestAPI.post(this.getBaseUrl() + "/chatbot/" + chatbotID + "/conversation/query", body);
|
||||
return resp;
|
||||
|
@ -22,8 +22,6 @@ import com.mashape.unirest.http.exceptions.UnirestException;
|
||||
import com.mashape.unirest.request.GetRequest;
|
||||
import com.mashape.unirest.request.HttpRequestWithBody;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -31,7 +29,6 @@ import java.util.HashMap;
|
||||
* RestAPI接口
|
||||
*/
|
||||
public class RestAPI {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RestAPI.class);
|
||||
|
||||
/**
|
||||
* patch headers
|
||||
@ -66,7 +63,6 @@ public class RestAPI {
|
||||
*/
|
||||
public static JSONObject post(final String url, final HashMap<String, Object> body, final HashMap<String, Object> query, HashMap<String, String> headers) throws UnirestException {
|
||||
HttpRequestWithBody request = Unirest.post(url);
|
||||
logger.info("post body {}", body.toString());
|
||||
x(headers);
|
||||
HttpResponse<JsonNode> resp = request
|
||||
.headers(headers)
|
||||
|
@ -19,8 +19,6 @@ import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
@ -29,7 +27,6 @@ import java.net.MalformedURLException;
|
||||
*/
|
||||
public class ChatbotAPITest
|
||||
extends TestCase {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChatbotAPITest.class);
|
||||
private ChatbotAPI cb;
|
||||
|
||||
/**
|
||||
@ -62,7 +59,7 @@ public class ChatbotAPITest
|
||||
public void testGetChatbot() {
|
||||
try {
|
||||
JSONObject resp = this.cb.getChatbot("co_bot_1");
|
||||
logger.info("[testGetChatbot] {}", resp.toString());
|
||||
System.out.println("[testGetChatbot] " + resp.toString());
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -71,7 +68,7 @@ public class ChatbotAPITest
|
||||
public void testGetChatbots() {
|
||||
try {
|
||||
JSONObject resp = this.cb.getChatbots("name chatbotID", null, 0, 10);
|
||||
logger.info("[testGetChatbots] resp {}", resp.toString());
|
||||
System.out.println("[testGetChatbots] resp " + resp.toString());
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -80,7 +77,7 @@ public class ChatbotAPITest
|
||||
public void testConversation() {
|
||||
try {
|
||||
JSONObject resp = this.cb.conversation("co_bot_1", "sdktest", "华夏春松在哪里", false);
|
||||
logger.info("[testConversation] resp {}", resp.toString());
|
||||
System.out.println("[testConversation] resp " + resp.toString());
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -89,7 +86,7 @@ public class ChatbotAPITest
|
||||
public void testFaq() {
|
||||
try {
|
||||
JSONObject resp = this.cb.faq("co_bot_1", "sdktest", "华夏春松在哪里", false);
|
||||
logger.info("[testFaq] resp {}", resp.toString());
|
||||
System.out.print("[testFaq] resp " + resp.toString());
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -98,7 +95,7 @@ public class ChatbotAPITest
|
||||
public void testParseUrl() {
|
||||
try {
|
||||
ChatbotAPI c = new ChatbotAPI("https://local:8000/");
|
||||
logger.info("chatbot baseUrl {}", c.getBaseUrl());
|
||||
System.out.println("chatbot baseUrl " + c.getBaseUrl());
|
||||
assertEquals("https://local:8000/api/v1", c.getBaseUrl());
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
@ -124,7 +121,6 @@ public class ChatbotAPITest
|
||||
"我不了解。",
|
||||
"小云机器人",
|
||||
"你好,我是小云。");
|
||||
logger.info("[testCreateBot] {}", j);
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -312,7 +312,7 @@
|
||||
<dependency>
|
||||
<groupId>com.chatopera.chatbot</groupId>
|
||||
<artifactId>sdk</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.util.aggregation;
|
||||
package com.chatopera.cc.aggregation;
|
||||
|
||||
import com.chatopera.cc.util.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.exception.CallOutRecordException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.util.aggregation;
|
||||
package com.chatopera.cc.aggregation;
|
||||
|
||||
import com.chatopera.cc.util.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.exception.CallOutRecordException;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.util.aggregation;
|
||||
package com.chatopera.cc.aggregation;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -14,14 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.quene;
|
||||
package com.chatopera.cc.aggregation.filter;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hazelcast.mapreduce.KeyPredicate;
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.web.model.UKefuCallOutNames;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.model.UKefuCallOutNames;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AgentCallOutFilter implements KeyPredicate<String>{
|
||||
@ -38,6 +38,6 @@ public class AgentCallOutFilter implements KeyPredicate<String>{
|
||||
}
|
||||
public boolean evaluate(String key) {
|
||||
UKefuCallOutNames ukefuCallOutNames = (UKefuCallOutNames) CacheHelper.getCallOutCacheBean().getCacheObject(key, orgi);
|
||||
return ukefuCallOutNames !=null && !StringUtils.isBlank(orgi) && orgi.equals(ukefuCallOutNames.getOrgi()) && UKDataContext.CallOutType.AGENT.toString().equals(ukefuCallOutNames.getCalltype());
|
||||
return ukefuCallOutNames !=null && !StringUtils.isBlank(orgi) && orgi.equals(ukefuCallOutNames.getOrgi()) && MainContext.CallOutType.AGENT.toString().equals(ukefuCallOutNames.getCalltype());
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.quene;
|
||||
package com.chatopera.cc.aggregation.filter;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.model.AgentStatus;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.model.AgentStatus;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hazelcast.mapreduce.KeyPredicate;
|
@ -14,10 +14,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.quene;
|
||||
package com.chatopera.cc.aggregation.filter;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.model.AgentStatus;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.model.AgentStatus;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hazelcast.mapreduce.KeyPredicate;
|
@ -14,10 +14,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.quene;
|
||||
package com.chatopera.cc.aggregation.filter;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.model.AgentUser;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.model.AgentUser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hazelcast.mapreduce.KeyPredicate;
|
@ -14,14 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.quene;
|
||||
package com.chatopera.cc.aggregation.filter;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.model.UKefuCallOutNames;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.model.UKefuCallOutNames;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hazelcast.mapreduce.KeyPredicate;
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AiCallOutFilter implements KeyPredicate<String>{
|
||||
@ -38,6 +38,6 @@ public class AiCallOutFilter implements KeyPredicate<String>{
|
||||
}
|
||||
public boolean evaluate(String key) {
|
||||
UKefuCallOutNames ukefuCallOutNames = (UKefuCallOutNames) CacheHelper.getCallOutCacheBean().getCacheObject(key, orgi);
|
||||
return ukefuCallOutNames !=null && !StringUtils.isBlank(orgi) && orgi.equals(ukefuCallOutNames.getOrgi()) && UKDataContext.CallOutType.AI.toString().equals(ukefuCallOutNames.getCalltype());
|
||||
return ukefuCallOutNames !=null && !StringUtils.isBlank(orgi) && orgi.equals(ukefuCallOutNames.getOrgi()) && MainContext.CallOutType.AI.toString().equals(ukefuCallOutNames.getCalltype());
|
||||
}
|
||||
}
|
@ -14,11 +14,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim;
|
||||
package com.chatopera.cc.app;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.mobile.MobileNumberUtils;
|
||||
import com.chatopera.cc.webim.config.web.StartedEventListener;
|
||||
import com.chatopera.cc.app.config.StartedEventListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -38,8 +38,8 @@ import javax.servlet.MultipartConfigElement;
|
||||
import java.io.IOException;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableJpaRepositories("com.chatopera.cc.webim.service.repository")
|
||||
@EnableElasticsearchRepositories("com.chatopera.cc.webim.service.es")
|
||||
@EnableJpaRepositories("com.chatopera.cc.app.persistence.repository")
|
||||
@EnableElasticsearchRepositories("com.chatopera.cc.app.persistence.es")
|
||||
@EnableAsync
|
||||
public class Application {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Application.class);
|
||||
@ -56,8 +56,9 @@ public class Application {
|
||||
private String multipartMaxRequest;
|
||||
|
||||
static{
|
||||
UKDataContext.model.put("contacts", true) ;
|
||||
UKDataContext.model.put("sales", true);
|
||||
MainContext.model.put("contacts", true) ;
|
||||
MainContext.model.put("sales", true);
|
||||
MainContext.model.put("chatbot", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +101,7 @@ public class Application {
|
||||
app.setBannerMode(Banner.Mode.OFF);
|
||||
app.setAddCommandLineProperties(false);
|
||||
app.addListeners(new StartedEventListener());
|
||||
UKDataContext.setApplicationContext(app.run(args));
|
||||
MainContext.setApplicationContext(app.run(args));
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim;
|
||||
package com.chatopera.cc.app;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
@ -14,19 +14,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.acd;
|
||||
package com.chatopera.cc.app.algorithm;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.im.client.NettyClients;
|
||||
import com.chatopera.cc.app.im.router.OutMessageRouter;
|
||||
import com.chatopera.cc.app.model.*;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.aggregation.filter.AgentStatusBusyOrgiFilter;
|
||||
import com.chatopera.cc.aggregation.filter.AgentStatusOrgiFilter;
|
||||
import com.chatopera.cc.aggregation.filter.AgentUserOrgiFilter;
|
||||
import com.chatopera.cc.app.persistence.repository.*;
|
||||
import com.chatopera.cc.util.WebIMReport;
|
||||
import com.chatopera.cc.util.client.NettyClients;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.quene.AgentStatusBusyOrgiFilter;
|
||||
import com.chatopera.cc.webim.service.quene.AgentStatusOrgiFilter;
|
||||
import com.chatopera.cc.webim.service.quene.AgentUserOrgiFilter;
|
||||
import com.chatopera.cc.webim.service.repository.*;
|
||||
import com.chatopera.cc.webim.util.router.OutMessageRouter;
|
||||
import com.chatopera.cc.webim.web.model.*;
|
||||
import com.corundumstudio.socketio.SocketIONamespace;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.mapreduce.aggregation.Aggregations;
|
||||
@ -46,8 +46,8 @@ import java.util.concurrent.locks.Lock;
|
||||
* Automatic Call Distribution
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ServiceQuene {
|
||||
private final static Logger logger = LoggerFactory.getLogger(ServiceQuene.class);
|
||||
public class AutomaticServiceDist {
|
||||
private final static Logger logger = LoggerFactory.getLogger(AutomaticServiceDist.class);
|
||||
|
||||
/**
|
||||
* 载入坐席 ACD策略配置
|
||||
@ -57,13 +57,13 @@ public class ServiceQuene {
|
||||
*/
|
||||
public static SessionConfig initSessionConfig(String orgi) {
|
||||
SessionConfig sessionConfig = null;
|
||||
if (UKDataContext.getContext() != null && (sessionConfig = (SessionConfig) CacheHelper.getSystemCacheBean().getCacheObject(UKDataContext.SYSTEM_CACHE_SESSION_CONFIG + "_" + orgi, orgi)) == null) {
|
||||
SessionConfigRepository sessionConfigRes = UKDataContext.getContext().getBean(SessionConfigRepository.class);
|
||||
if (MainContext.getContext() != null && (sessionConfig = (SessionConfig) CacheHelper.getSystemCacheBean().getCacheObject(MainContext.SYSTEM_CACHE_SESSION_CONFIG + "_" + orgi, orgi)) == null) {
|
||||
SessionConfigRepository sessionConfigRes = MainContext.getContext().getBean(SessionConfigRepository.class);
|
||||
sessionConfig = sessionConfigRes.findByOrgi(orgi);
|
||||
if (sessionConfig == null) {
|
||||
sessionConfig = new SessionConfig();
|
||||
} else {
|
||||
CacheHelper.getSystemCacheBean().put(UKDataContext.SYSTEM_CACHE_SESSION_CONFIG + "_" + orgi, sessionConfig, orgi);
|
||||
CacheHelper.getSystemCacheBean().put(MainContext.SYSTEM_CACHE_SESSION_CONFIG + "_" + orgi, sessionConfig, orgi);
|
||||
}
|
||||
}
|
||||
return sessionConfig;
|
||||
@ -78,11 +78,11 @@ public class ServiceQuene {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<SessionConfig> initSessionConfigList() {
|
||||
List<SessionConfig> sessionConfigList = null;
|
||||
if (UKDataContext.getContext() != null && (sessionConfigList = (List<SessionConfig>) CacheHelper.getSystemCacheBean().getCacheObject(UKDataContext.SYSTEM_CACHE_SESSION_CONFIG_LIST, UKDataContext.SYSTEM_ORGI)) == null) {
|
||||
SessionConfigRepository sessionConfigRes = UKDataContext.getContext().getBean(SessionConfigRepository.class);
|
||||
if (MainContext.getContext() != null && (sessionConfigList = (List<SessionConfig>) CacheHelper.getSystemCacheBean().getCacheObject(MainContext.SYSTEM_CACHE_SESSION_CONFIG_LIST, MainContext.SYSTEM_ORGI)) == null) {
|
||||
SessionConfigRepository sessionConfigRes = MainContext.getContext().getBean(SessionConfigRepository.class);
|
||||
sessionConfigList = sessionConfigRes.findAll();
|
||||
if (sessionConfigList != null && sessionConfigList.size() > 0) {
|
||||
CacheHelper.getSystemCacheBean().put(UKDataContext.SYSTEM_CACHE_SESSION_CONFIG_LIST, sessionConfigList, UKDataContext.SYSTEM_ORGI);
|
||||
CacheHelper.getSystemCacheBean().put(MainContext.SYSTEM_CACHE_SESSION_CONFIG_LIST, sessionConfigList, MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
}
|
||||
return sessionConfigList;
|
||||
@ -113,10 +113,10 @@ public class ServiceQuene {
|
||||
* 统计当前服务中的用户数量
|
||||
*/
|
||||
IMap agentUserMap = (IMap<String, Object>) CacheHelper.getAgentUserCacheBean().getCache();
|
||||
Long users = (Long) agentUserMap.aggregate(Supplier.fromKeyPredicate(new AgentUserOrgiFilter(orgi, UKDataContext.AgentUserStatusEnum.INSERVICE.toString())), Aggregations.count());
|
||||
Long users = (Long) agentUserMap.aggregate(Supplier.fromKeyPredicate(new AgentUserOrgiFilter(orgi, MainContext.AgentUserStatusEnum.INSERVICE.toString())), Aggregations.count());
|
||||
report.setUsers(users.intValue());
|
||||
|
||||
Long queneUsers = (Long) agentUserMap.aggregate(Supplier.fromKeyPredicate(new AgentUserOrgiFilter(orgi, UKDataContext.AgentUserStatusEnum.INQUENE.toString())), Aggregations.count());
|
||||
Long queneUsers = (Long) agentUserMap.aggregate(Supplier.fromKeyPredicate(new AgentUserOrgiFilter(orgi, MainContext.AgentUserStatusEnum.INQUENE.toString())), Aggregations.count());
|
||||
report.setInquene(queneUsers.intValue());
|
||||
|
||||
return report;
|
||||
@ -193,29 +193,29 @@ public class ServiceQuene {
|
||||
}
|
||||
agentStatusList.addAll(((IMap<String, AgentUser>) CacheHelper.getAgentUserCacheBean().getCache()).values(pagingPredicate));
|
||||
for (AgentUser agentUser : agentStatusList) {
|
||||
SessionConfig sessionConfig = ServiceQuene.initSessionConfig(orgi);
|
||||
long maxusers = sessionConfig != null ? sessionConfig.getMaxuser() : UKDataContext.AGENT_STATUS_MAX_USER;
|
||||
SessionConfig sessionConfig = AutomaticServiceDist.initSessionConfig(orgi);
|
||||
long maxusers = sessionConfig != null ? sessionConfig.getMaxuser() : MainContext.AGENT_STATUS_MAX_USER;
|
||||
if (agentStatus != null && agentStatus.getUsers() < maxusers) { //坐席未达到最大咨询访客数量
|
||||
CacheHelper.getAgentUserCacheBean().delete(agentUser.getUserid(), orgi); //从队列移除,进入正在处理的队列, 避免使用 分布式锁
|
||||
try {
|
||||
AgentService agentService = processAgentService(agentStatus, agentUser, orgi);
|
||||
|
||||
MessageOutContent outMessage = new MessageOutContent();
|
||||
outMessage.setMessage(ServiceQuene.getSuccessMessage(agentService, agentUser.getChannel(), orgi));
|
||||
outMessage.setMessageType(UKDataContext.MediaTypeEnum.TEXT.toString());
|
||||
outMessage.setCalltype(UKDataContext.CallTypeEnum.IN.toString());
|
||||
outMessage.setMessage(AutomaticServiceDist.getSuccessMessage(agentService, agentUser.getChannel(), orgi));
|
||||
outMessage.setMessageType(MainContext.MediaTypeEnum.TEXT.toString());
|
||||
outMessage.setCalltype(MainContext.CallTypeEnum.IN.toString());
|
||||
outMessage.setNickName(agentStatus.getUsername());
|
||||
outMessage.setCreatetime(UKTools.dateFormate.format(new Date()));
|
||||
outMessage.setCreatetime(MainUtils.dateFormate.format(new Date()));
|
||||
|
||||
if (!StringUtils.isBlank(agentUser.getUserid())) {
|
||||
OutMessageRouter router = null;
|
||||
router = (OutMessageRouter) UKDataContext.getContext().getBean(agentUser.getChannel());
|
||||
router = (OutMessageRouter) MainContext.getContext().getBean(agentUser.getChannel());
|
||||
if (router != null) {
|
||||
router.handler(agentUser.getUserid(), UKDataContext.MessageTypeEnum.MESSAGE.toString(), agentUser.getAppid(), outMessage);
|
||||
router.handler(agentUser.getUserid(), MainContext.MessageTypeEnum.MESSAGE.toString(), agentUser.getAppid(), outMessage);
|
||||
}
|
||||
}
|
||||
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentService.getAgentno(), UKDataContext.MessageTypeEnum.NEW.toString(), agentUser);
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentService.getAgentno(), MainContext.MessageTypeEnum.NEW.toString(), agentUser);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -235,17 +235,17 @@ public class ServiceQuene {
|
||||
public static void serviceFinish(AgentUser agentUser, String orgi) throws Exception {
|
||||
if (agentUser != null) {
|
||||
AgentStatus agentStatus = null;
|
||||
if (UKDataContext.AgentUserStatusEnum.INSERVICE.toString().equals(agentUser.getStatus()) && agentUser.getAgentno() != null) {
|
||||
if (MainContext.AgentUserStatusEnum.INSERVICE.toString().equals(agentUser.getStatus()) && agentUser.getAgentno() != null) {
|
||||
agentStatus = (AgentStatus) CacheHelper.getAgentStatusCacheBean().getCacheObject(agentUser.getAgentno(), orgi);
|
||||
}
|
||||
CacheHelper.getAgentUserCacheBean().delete(agentUser.getUserid(), orgi);
|
||||
|
||||
AgentUserRepository agentUserRepository = UKDataContext.getContext().getBean(AgentUserRepository.class);
|
||||
AgentUserRepository agentUserRepository = MainContext.getContext().getBean(AgentUserRepository.class);
|
||||
|
||||
AgentUser agentUseDataBean = agentUserRepository.findByIdAndOrgi(agentUser.getId(), agentUser.getOrgi());
|
||||
SessionConfig sessionConfig = ServiceQuene.initSessionConfig(orgi);
|
||||
SessionConfig sessionConfig = AutomaticServiceDist.initSessionConfig(orgi);
|
||||
if (agentUseDataBean != null) {
|
||||
agentUseDataBean.setStatus(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
agentUseDataBean.setStatus(MainContext.AgentUserStatusEnum.END.toString());
|
||||
if (agentUser.getServicetime() != null) {
|
||||
agentUseDataBean.setSessiontimes(System.currentTimeMillis() - agentUser.getServicetime().getTime());
|
||||
}
|
||||
@ -255,19 +255,19 @@ public class ServiceQuene {
|
||||
/**
|
||||
* 更新OnlineUser对象,变更为服务中,不可邀请 , WebIM渠道专用
|
||||
*/
|
||||
if (UKDataContext.ChannelTypeEnum.WEBIM.toString().equals(agentUser.getChannel())) {
|
||||
OnlineUserRepository onlineUserRes = UKDataContext.getContext().getBean(OnlineUserRepository.class);
|
||||
if (MainContext.ChannelTypeEnum.WEBIM.toString().equals(agentUser.getChannel())) {
|
||||
OnlineUserRepository onlineUserRes = MainContext.getContext().getBean(OnlineUserRepository.class);
|
||||
List<OnlineUser> onlineUserList = onlineUserRes.findByUseridAndOrgi(agentUser.getUserid(), agentUser.getOrgi());
|
||||
if (onlineUserList.size() > 0) {
|
||||
OnlineUser onlineUser = onlineUserList.get(0);
|
||||
onlineUser.setInvitestatus(UKDataContext.OnlineUserInviteStatus.DEFAULT.toString());
|
||||
onlineUser.setInvitestatus(MainContext.OnlineUserInviteStatus.DEFAULT.toString());
|
||||
onlineUserRes.save(onlineUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final boolean isPhone = UKDataContext.ChannelTypeEnum.PHONE.toString().equals(agentUser.getChannel());
|
||||
AgentServiceRepository agentServiceRes = UKDataContext.getContext().getBean(AgentServiceRepository.class);
|
||||
final boolean isPhone = MainContext.ChannelTypeEnum.PHONE.toString().equals(agentUser.getChannel());
|
||||
AgentServiceRepository agentServiceRes = MainContext.getContext().getBean(AgentServiceRepository.class);
|
||||
AgentService service = null;
|
||||
if (!StringUtils.isBlank(agentUser.getAgentserviceid())) {
|
||||
service = agentServiceRes.findByIdAndOrgi(agentUser.getAgentserviceid(), agentUser.getOrgi());
|
||||
@ -276,13 +276,13 @@ public class ServiceQuene {
|
||||
service = processAgentService(agentStatus, agentUser, orgi, true);
|
||||
}
|
||||
if (service != null) {
|
||||
service.setStatus(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
service.setStatus(MainContext.AgentUserStatusEnum.END.toString());
|
||||
service.setEndtime(new Date());
|
||||
if (service.getServicetime() != null) {
|
||||
service.setSessiontimes(System.currentTimeMillis() - service.getServicetime().getTime());
|
||||
}
|
||||
|
||||
AgentUserTaskRepository agentUserTaskRes = UKDataContext.getContext().getBean(AgentUserTaskRepository.class);
|
||||
AgentUserTaskRepository agentUserTaskRes = MainContext.getContext().getBean(AgentUserTaskRepository.class);
|
||||
List<AgentUserTask> agentUserTaskList = agentUserTaskRes.findByIdAndOrgi(agentUser.getId(), agentUser.getOrgi());
|
||||
if (agentUserTaskList.size() > 0) {
|
||||
AgentUserTask agentUserTask = agentUserTaskList.get(0);
|
||||
@ -300,41 +300,41 @@ public class ServiceQuene {
|
||||
* 启用了质检任务,开启质检
|
||||
*/
|
||||
if (sessionConfig.isQuality() && service.getUserasks() > 0) { //开启了质检,并且是有效对话
|
||||
service.setQualitystatus(UKDataContext.QualityStatus.NODIS.toString()); //未分配质检任务
|
||||
service.setQualitystatus(MainContext.QualityStatus.NODIS.toString()); //未分配质检任务
|
||||
} else {
|
||||
service.setQualitystatus(UKDataContext.QualityStatus.NO.toString()); //未开启质检 或无效对话无需质检
|
||||
service.setQualitystatus(MainContext.QualityStatus.NO.toString()); //未开启质检 或无效对话无需质检
|
||||
}
|
||||
agentServiceRes.save(service);
|
||||
}
|
||||
|
||||
if (isPhone) { // 语音渠道,强制发送
|
||||
NettyClients.getInstance().sendCalloutEventMessage(agentUser.getAgentno(), UKDataContext.MessageTypeEnum.END.toString(), agentUser);
|
||||
NettyClients.getInstance().sendCalloutEventMessage(agentUser.getAgentno(), MainContext.MessageTypeEnum.END.toString(), agentUser);
|
||||
} else {
|
||||
if (agentStatus != null) // WebIM 查看用户状态
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentUser.getAgentno(), UKDataContext.MessageTypeEnum.END.toString(), agentUser);
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentUser.getAgentno(), MainContext.MessageTypeEnum.END.toString(), agentUser);
|
||||
OutMessageRouter router = null;
|
||||
router = (OutMessageRouter) UKDataContext.getContext().getBean(agentUser.getChannel());
|
||||
router = (OutMessageRouter) MainContext.getContext().getBean(agentUser.getChannel());
|
||||
if (router != null) {
|
||||
MessageOutContent outMessage = new MessageOutContent();
|
||||
outMessage.setMessage(ServiceQuene.getServiceFinishMessage(agentUser.getChannel(), orgi));
|
||||
outMessage.setMessageType(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
outMessage.setCalltype(UKDataContext.CallTypeEnum.IN.toString());
|
||||
outMessage.setMessage(AutomaticServiceDist.getServiceFinishMessage(agentUser.getChannel(), orgi));
|
||||
outMessage.setMessageType(MainContext.AgentUserStatusEnum.END.toString());
|
||||
outMessage.setCalltype(MainContext.CallTypeEnum.IN.toString());
|
||||
if (agentStatus != null) {
|
||||
outMessage.setNickName(agentStatus.getUsername());
|
||||
} else {
|
||||
outMessage.setNickName(agentUser.getUsername());
|
||||
}
|
||||
outMessage.setCreatetime(UKTools.dateFormate.format(new Date()));
|
||||
outMessage.setCreatetime(MainUtils.dateFormate.format(new Date()));
|
||||
outMessage.setAgentserviceid(agentUser.getAgentserviceid());
|
||||
|
||||
router.handler(agentUser.getUserid(), UKDataContext.MessageTypeEnum.STATUS.toString(), agentUser.getAppid(), outMessage);
|
||||
router.handler(agentUser.getUserid(), MainContext.MessageTypeEnum.STATUS.toString(), agentUser.getAppid(), outMessage);
|
||||
}
|
||||
}
|
||||
|
||||
if (agentStatus != null) {
|
||||
updateAgentStatus(agentStatus, agentUser, orgi, false);
|
||||
|
||||
long maxusers = sessionConfig != null ? sessionConfig.getMaxuser() : UKDataContext.AGENT_STATUS_MAX_USER;
|
||||
long maxusers = sessionConfig != null ? sessionConfig.getMaxuser() : MainContext.AGENT_STATUS_MAX_USER;
|
||||
if (agentStatus.getUsers() < maxusers) {
|
||||
allotAgent(agentStatus.getAgentno(), orgi);
|
||||
}
|
||||
@ -367,8 +367,8 @@ public class ServiceQuene {
|
||||
/**
|
||||
* 坐席状态改变,通知监测服务
|
||||
*/
|
||||
AgentReport agentReport = ServiceQuene.getAgentReport(orgi);
|
||||
AgentReportRepository agentReportRes = UKDataContext.getContext().getBean(AgentReportRepository.class);
|
||||
AgentReport agentReport = AutomaticServiceDist.getAgentReport(orgi);
|
||||
AgentReportRepository agentReportRes = MainContext.getContext().getBean(AgentReportRepository.class);
|
||||
if (agentReportRes != null) {
|
||||
agentReport.setOrgi(orgi);
|
||||
agentReport.setWorktype(worktype);
|
||||
@ -377,7 +377,7 @@ public class ServiceQuene {
|
||||
|
||||
agentReportRes.save(agentReport);
|
||||
}
|
||||
UKDataContext.getContext().getBean("agentNamespace", SocketIONamespace.class).getBroadcastOperations().sendEvent("status", agentReport);
|
||||
MainContext.getContext().getBean("agentNamespace", SocketIONamespace.class).getBroadcastOperations().sendEvent("status", agentReport);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -390,7 +390,7 @@ public class ServiceQuene {
|
||||
* @param lasttime
|
||||
*/
|
||||
public static void recordAgentStatus(String agent, String username, String extno, String skill, boolean admin, String userid, String status, String current, String worktype, String orgi, Date lasttime) {
|
||||
WorkMonitorRepository workMonitorRes = UKDataContext.getContext().getBean(WorkMonitorRepository.class);
|
||||
WorkMonitorRepository workMonitorRes = MainContext.getContext().getBean(WorkMonitorRepository.class);
|
||||
WorkMonitor workMonitor = new WorkMonitor();
|
||||
if (!StringUtils.isBlank(agent) && !StringUtils.isBlank(status)) {
|
||||
workMonitor.setAgent(agent);
|
||||
@ -403,17 +403,17 @@ public class ServiceQuene {
|
||||
if (lasttime != null) {
|
||||
workMonitor.setDuration((int) (System.currentTimeMillis() - lasttime.getTime()) / 1000);
|
||||
}
|
||||
if (status.equals(UKDataContext.AgentStatusEnum.BUSY.toString())) {
|
||||
if (status.equals(MainContext.AgentStatusEnum.BUSY.toString())) {
|
||||
workMonitor.setBusy(true);
|
||||
}
|
||||
if (status.equals(UKDataContext.AgentStatusEnum.READY.toString())) {
|
||||
int count = workMonitorRes.countByAgentAndDatestrAndStatusAndOrgi(agent, UKTools.simpleDateFormat.format(new Date()), UKDataContext.AgentStatusEnum.READY.toString(), orgi);
|
||||
if (status.equals(MainContext.AgentStatusEnum.READY.toString())) {
|
||||
int count = workMonitorRes.countByAgentAndDatestrAndStatusAndOrgi(agent, MainUtils.simpleDateFormat.format(new Date()), MainContext.AgentStatusEnum.READY.toString(), orgi);
|
||||
if (count == 0) {
|
||||
workMonitor.setFirsttime(true);
|
||||
}
|
||||
}
|
||||
if (current.equals(UKDataContext.AgentStatusEnum.NOTREADY.toString())) {
|
||||
List<WorkMonitor> workMonitorList = workMonitorRes.findByOrgiAndAgentAndDatestrAndFirsttime(orgi, agent, UKTools.simpleDateFormat.format(new Date()), true);
|
||||
if (current.equals(MainContext.AgentStatusEnum.NOTREADY.toString())) {
|
||||
List<WorkMonitor> workMonitorList = workMonitorRes.findByOrgiAndAgentAndDatestrAndFirsttime(orgi, agent, MainUtils.simpleDateFormat.format(new Date()), true);
|
||||
if (workMonitorList.size() > 0) {
|
||||
WorkMonitor firstWorkMonitor = workMonitorList.get(0);
|
||||
if (firstWorkMonitor.getFirsttimes() == 0) {
|
||||
@ -423,7 +423,7 @@ public class ServiceQuene {
|
||||
}
|
||||
}
|
||||
workMonitor.setCreatetime(new Date());
|
||||
workMonitor.setDatestr(UKTools.simpleDateFormat.format(new Date()));
|
||||
workMonitor.setDatestr(MainUtils.simpleDateFormat.format(new Date()));
|
||||
|
||||
workMonitor.setName(agent);
|
||||
workMonitor.setOrgi(orgi);
|
||||
@ -474,14 +474,14 @@ public class ServiceQuene {
|
||||
}
|
||||
try {
|
||||
agentService = processAgentService(agentStatus, agentUser, orgi);
|
||||
if (agentService.getStatus().equals(UKDataContext.AgentUserStatusEnum.INQUENE.toString())) {
|
||||
if (agentService.getStatus().equals(MainContext.AgentUserStatusEnum.INQUENE.toString())) {
|
||||
agentService.setQueneindex(getQueneIndex(agentUser.getAgent(), orgi, agentUser.getSkill()));
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
publishMessage(orgi, "user", agentService != null && agentService.getStatus().equals(UKDataContext.AgentUserStatusEnum.INSERVICE.toString()) ? "inservice" : "inquene", agentUser.getId());
|
||||
publishMessage(orgi, "user", agentService != null && agentService.getStatus().equals(MainContext.AgentUserStatusEnum.INSERVICE.toString()) ? "inservice" : "inquene", agentUser.getId());
|
||||
return agentService;
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ public class ServiceQuene {
|
||||
if (agentStatus != null) {
|
||||
agentService = processAgentService(agentStatus, agentUser, orgi);
|
||||
publishMessage(orgi, "invite", "success", agentno);
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentService.getAgentno(), UKDataContext.MessageTypeEnum.NEW.toString(), agentUser);
|
||||
NettyClients.getInstance().sendAgentEventMessage(agentService.getAgentno(), MainContext.MessageTypeEnum.NEW.toString(), agentUser);
|
||||
} else {
|
||||
agentService = allotAgent(agentUser, orgi);
|
||||
}
|
||||
@ -523,47 +523,44 @@ public class ServiceQuene {
|
||||
/**
|
||||
* 为访客 分配坐席, ACD策略,此处 AgentStatus 是建议 的 坐席, 如果启用了 历史服务坐席 优先策略, 则会默认检查历史坐席是否空闲,如果空闲,则分配,如果不空闲,则 分配当前建议的坐席
|
||||
*
|
||||
* @param agentStatus
|
||||
* @param agentUser
|
||||
* @param orgi
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static AgentService processAiService(AiUser aiUser, String orgi) throws Exception {
|
||||
public static AgentService processChatbotService(final AgentUser agentUser, final String orgi) {
|
||||
AgentService agentService = new AgentService(); //放入缓存的对象
|
||||
AgentServiceRepository agentServiceRes = UKDataContext.getContext().getBean(AgentServiceRepository.class);
|
||||
if (!StringUtils.isBlank(aiUser.getAgentserviceid())) {
|
||||
agentService = agentServiceRes.findByIdAndOrgi(aiUser.getAgentserviceid(), orgi);
|
||||
agentService.setEndtime(new Date());
|
||||
AgentServiceRepository agentServiceRes = MainContext.getContext().getBean(AgentServiceRepository.class);
|
||||
Date now = new Date();
|
||||
if (StringUtils.isNotBlank(agentUser.getAgentserviceid())) {
|
||||
agentService = agentServiceRes.findByIdAndOrgi(agentUser.getAgentserviceid(), orgi);
|
||||
agentService.setEndtime(now);
|
||||
if (agentService.getServicetime() != null) {
|
||||
agentService.setSessiontimes(System.currentTimeMillis() - agentService.getServicetime().getTime());
|
||||
}
|
||||
agentService.setStatus(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
agentService.setStatus(MainContext.AgentUserStatusEnum.END.toString());
|
||||
} else {
|
||||
agentService.setServicetime(new Date());
|
||||
agentService.setLogindate(new Date());
|
||||
agentService.setServicetime(now);
|
||||
agentService.setLogindate(now);
|
||||
agentService.setOrgi(orgi);
|
||||
agentService.setOwner(aiUser.getContextid());
|
||||
agentService.setSessionid(aiUser.getSessionid());
|
||||
if (aiUser.getIpdata() != null) {
|
||||
agentService.setRegion(aiUser.getIpdata().getRegion());
|
||||
}
|
||||
agentService.setOwner(agentUser.getContextid());
|
||||
agentService.setSessionid(agentUser.getSessionid());
|
||||
agentService.setRegion(agentUser.getRegion());
|
||||
agentService.setUsername(agentUser.getUsername());
|
||||
agentService.setChannel(agentUser.getChannel());
|
||||
|
||||
agentService.setUsername(aiUser.getUsername());
|
||||
agentService.setChannel(aiUser.getChannel());
|
||||
|
||||
if (!StringUtils.isBlank(aiUser.getContextid())) {
|
||||
agentService.setContextid(aiUser.getContextid());
|
||||
if (StringUtils.isNotBlank(agentUser.getContextid())) {
|
||||
agentService.setContextid(agentUser.getContextid());
|
||||
} else {
|
||||
agentService.setContextid(aiUser.getSessionid());
|
||||
agentService.setContextid(agentUser.getSessionid());
|
||||
}
|
||||
|
||||
agentService.setUserid(aiUser.getUserid());
|
||||
agentService.setAiid(aiUser.getAiid());
|
||||
agentService.setUserid(agentUser.getUserid());
|
||||
agentService.setAiid(agentUser.getAgentno());
|
||||
agentService.setAiservice(true);
|
||||
agentService.setStatus(UKDataContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
agentService.setStatus(MainContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
|
||||
agentService.setAppid(aiUser.getAppid());
|
||||
agentService.setAppid(agentUser.getAppid());
|
||||
agentService.setLeavemsg(false);
|
||||
}
|
||||
|
||||
@ -587,12 +584,12 @@ public class ServiceQuene {
|
||||
}
|
||||
agentService.setOrgi(orgi);
|
||||
|
||||
UKTools.copyProperties(agentUser, agentService); //复制属性
|
||||
MainUtils.copyProperties(agentUser, agentService); //复制属性
|
||||
|
||||
agentService.setChannel(agentUser.getChannel());
|
||||
|
||||
agentService.setSessionid(agentUser.getSessionid());
|
||||
OnlineUserRepository onlineUserRes = UKDataContext.getContext().getBean(OnlineUserRepository.class);
|
||||
OnlineUserRepository onlineUserRes = MainContext.getContext().getBean(OnlineUserRepository.class);
|
||||
agentUser.setLogindate(new Date());
|
||||
List<OnlineUser> onlineUserList = onlineUserRes.findByUseridAndOrgi(agentUser.getUserid(), agentUser.getOrgi());
|
||||
OnlineUser onlineUser = null;
|
||||
@ -607,7 +604,7 @@ public class ServiceQuene {
|
||||
agentService.setSkill(agentUser.getSkill());
|
||||
|
||||
if (sessionConfig.isLastagent()) { //启用了历史坐席优先 , 查找 历史服务坐席
|
||||
List<WebIMReport> webIMaggList = UKTools.getWebIMDataAgg(onlineUserRes.findByOrgiForDistinctAgent(orgi, agentUser.getUserid()));
|
||||
List<WebIMReport> webIMaggList = MainUtils.getWebIMDataAgg(onlineUserRes.findByOrgiForDistinctAgent(orgi, agentUser.getUserid()));
|
||||
if (webIMaggList.size() > 0) {
|
||||
for (WebIMReport report : webIMaggList) {
|
||||
if (report.getData().equals(agentStatus.getAgentno())) {
|
||||
@ -624,27 +621,27 @@ public class ServiceQuene {
|
||||
}
|
||||
}
|
||||
|
||||
agentUser.setStatus(UKDataContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
agentService.setStatus(UKDataContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
agentUser.setStatus(MainContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
agentService.setStatus(MainContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
|
||||
agentService.setSessiontype(UKDataContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
agentService.setSessiontype(MainContext.AgentUserStatusEnum.INSERVICE.toString());
|
||||
|
||||
agentService.setAgentno(agentStatus.getUserid());
|
||||
agentService.setAgentusername(agentStatus.getUsername()); //agent
|
||||
} else {
|
||||
if (finished == true) {
|
||||
agentUser.setStatus(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
agentService.setStatus(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
agentService.setSessiontype(UKDataContext.AgentUserStatusEnum.END.toString());
|
||||
agentUser.setStatus(MainContext.AgentUserStatusEnum.END.toString());
|
||||
agentService.setStatus(MainContext.AgentUserStatusEnum.END.toString());
|
||||
agentService.setSessiontype(MainContext.AgentUserStatusEnum.END.toString());
|
||||
if (agentStatus == null) {
|
||||
agentService.setLeavemsg(true); //是留言
|
||||
agentService.setLeavemsgstatus(UKDataContext.LeaveMsgStatus.NOTPROCESS.toString()); //未处理的留言
|
||||
agentService.setLeavemsgstatus(MainContext.LeaveMsgStatus.NOTPROCESS.toString()); //未处理的留言
|
||||
}
|
||||
} else {
|
||||
agentUser.setStatus(UKDataContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
agentService.setStatus(UKDataContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
agentUser.setStatus(MainContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
agentService.setStatus(MainContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
|
||||
agentService.setSessiontype(UKDataContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
agentService.setSessiontype(MainContext.AgentUserStatusEnum.INQUENE.toString());
|
||||
}
|
||||
}
|
||||
if (finished || agentStatus != null) {
|
||||
@ -652,7 +649,7 @@ public class ServiceQuene {
|
||||
|
||||
agentService.setAgentuserid(agentUser.getId());
|
||||
|
||||
agentService.setInitiator(UKDataContext.ChatInitiatorType.USER.toString());
|
||||
agentService.setInitiator(MainContext.ChatInitiatorType.USER.toString());
|
||||
|
||||
long waittingtime = 0;
|
||||
if (agentUser.getWaittingtimestart() != null) {
|
||||
@ -669,7 +666,7 @@ public class ServiceQuene {
|
||||
agentService.setTimes(0);
|
||||
agentUser.setAgentno(agentService.getAgentno());
|
||||
|
||||
AgentServiceRepository agentServiceRes = UKDataContext.getContext().getBean(AgentServiceRepository.class);
|
||||
AgentServiceRepository agentServiceRes = MainContext.getContext().getBean(AgentServiceRepository.class);
|
||||
|
||||
if (!StringUtils.isBlank(agentUser.getName())) {
|
||||
agentService.setName(agentUser.getName());
|
||||
@ -714,14 +711,14 @@ public class ServiceQuene {
|
||||
/**
|
||||
* 将 AgentUser 放入到 当前坐席的 服务队列
|
||||
*/
|
||||
AgentUserRepository agentUserRepository = UKDataContext.getContext().getBean(AgentUserRepository.class);
|
||||
AgentUserRepository agentUserRepository = MainContext.getContext().getBean(AgentUserRepository.class);
|
||||
|
||||
/**
|
||||
* 更新OnlineUser对象,变更为服务中,不可邀请
|
||||
*/
|
||||
|
||||
if (onlineUser != null) {
|
||||
onlineUser.setInvitestatus(UKDataContext.OnlineUserInviteStatus.INSERV.toString());
|
||||
onlineUser.setInvitestatus(MainContext.OnlineUserInviteStatus.INSERV.toString());
|
||||
onlineUserRes.save(onlineUser);
|
||||
}
|
||||
|
||||
@ -730,7 +727,7 @@ public class ServiceQuene {
|
||||
*/
|
||||
agentUserRepository.save(agentUser);
|
||||
|
||||
CacheHelper.getAgentUserCacheBean().put(agentUser.getUserid(), agentUser, UKDataContext.SYSTEM_ORGI);
|
||||
CacheHelper.getAgentUserCacheBean().put(agentUser.getUserid(), agentUser, MainContext.SYSTEM_ORGI);
|
||||
|
||||
if (agentStatus != null) {
|
||||
updateAgentStatus(agentStatus, agentUser, orgi, true);
|
||||
@ -742,12 +739,12 @@ public class ServiceQuene {
|
||||
public static AgentUser deleteAgentUser(AgentUser agentUser, String orgi)
|
||||
throws Exception {
|
||||
if (agentUser != null) {
|
||||
if (!UKDataContext.AgentUserStatusEnum.END.toString().equals(
|
||||
if (!MainContext.AgentUserStatusEnum.END.toString().equals(
|
||||
agentUser.getStatus())) {
|
||||
serviceFinish(agentUser, orgi);
|
||||
}
|
||||
if (!StringUtils.isBlank(agentUser.getId())) {
|
||||
AgentUserRepository agentUserRes = UKDataContext.getContext().getBean(AgentUserRepository.class);
|
||||
AgentUserRepository agentUserRes = MainContext.getContext().getBean(AgentUserRepository.class);
|
||||
agentUser = agentUserRes.findByIdAndOrgi(agentUser.getId(), orgi);
|
||||
if (agentUser != null) {
|
||||
agentUserRes.delete(agentUser);
|
||||
@ -764,7 +761,7 @@ public class ServiceQuene {
|
||||
*/
|
||||
public static String getSuccessMessage(AgentService agentService, String channel, String orgi) {
|
||||
String queneTip = "<span id='agentno'>" + agentService.getAgentusername() + "</span>";
|
||||
if (!UKDataContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
if (!MainContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
queneTip = agentService.getAgentusername();
|
||||
}
|
||||
SessionConfig sessionConfig = initSessionConfig(orgi);
|
||||
@ -793,7 +790,7 @@ public class ServiceQuene {
|
||||
queneIndex = 0;
|
||||
}
|
||||
String queneTip = "<span id='queneindex'>" + queneIndex + "</span>";
|
||||
if (!UKDataContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
if (!MainContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
queneTip = String.valueOf(queneIndex);
|
||||
}
|
||||
SessionConfig sessionConfig = initSessionConfig(orgi);
|
||||
@ -807,7 +804,7 @@ public class ServiceQuene {
|
||||
public static String getQueneMessage(int queneIndex, String channel, String orgi) {
|
||||
|
||||
String queneTip = "<span id='queneindex'>" + queneIndex + "</span>";
|
||||
if (!UKDataContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
if (!MainContext.ChannelTypeEnum.WEBIM.toString().equals(channel)) {
|
||||
queneTip = String.valueOf(queneIndex);
|
||||
}
|
||||
SessionConfig sessionConfig = initSessionConfig(orgi);
|
||||
@ -825,13 +822,13 @@ public class ServiceQuene {
|
||||
* @param status
|
||||
*/
|
||||
public static void deleteAgentStatus(String userid, String orgi, boolean isAdmin) {
|
||||
AgentStatusRepository agentStatusRes = UKDataContext.getContext().getBean(AgentStatusRepository.class);
|
||||
AgentStatusRepository agentStatusRes = MainContext.getContext().getBean(AgentStatusRepository.class);
|
||||
List<AgentStatus> agentStatusList = agentStatusRes.findByAgentnoAndOrgi(userid, orgi);
|
||||
for (AgentStatus agentStatus : agentStatusList) {
|
||||
ServiceQuene.recordAgentStatus(agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(), agentStatus.getSkill(), isAdmin, agentStatus.getAgentno(), agentStatus.isBusy() ? UKDataContext.AgentStatusEnum.BUSY.toString() : UKDataContext.AgentStatusEnum.NOTREADY.toString(), UKDataContext.AgentStatusEnum.NOTREADY.toString(), UKDataContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), agentStatus.getUpdatetime());
|
||||
AutomaticServiceDist.recordAgentStatus(agentStatus.getAgentno(), agentStatus.getUsername(), agentStatus.getAgentno(), agentStatus.getSkill(), isAdmin, agentStatus.getAgentno(), agentStatus.isBusy() ? MainContext.AgentStatusEnum.BUSY.toString() : MainContext.AgentStatusEnum.NOTREADY.toString(), MainContext.AgentStatusEnum.NOTREADY.toString(), MainContext.AgentWorkType.MEIDIACHAT.toString(), agentStatus.getOrgi(), agentStatus.getUpdatetime());
|
||||
agentStatusRes.delete(agentStatus);
|
||||
}
|
||||
CacheHelper.getAgentStatusCacheBean().delete(userid, orgi);
|
||||
ServiceQuene.publishMessage(orgi, "agent", "leave", userid);
|
||||
AutomaticServiceDist.publishMessage(orgi, "agent", "leave", userid);
|
||||
}
|
||||
}
|
@ -15,12 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.chatopera.cc.core;
|
||||
package com.chatopera.cc.app.basic;
|
||||
|
||||
import com.chatopera.cc.util.DateConverter;
|
||||
import com.chatopera.cc.webim.service.resource.ActivityResource;
|
||||
import com.chatopera.cc.webim.service.resource.BatchResource;
|
||||
import com.chatopera.cc.webim.web.model.Log;
|
||||
import com.chatopera.cc.app.basic.resource.ActivityResource;
|
||||
import com.chatopera.cc.app.basic.resource.BatchResource;
|
||||
import com.chatopera.cc.app.model.Log;
|
||||
import org.apache.commons.beanutils.ConvertUtils;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
|
||||
@ -30,7 +30,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class UKDataContext {
|
||||
public class MainContext {
|
||||
|
||||
public static final String USER_SESSION_NAME = "user";
|
||||
public static final String GUEST_USER = "guest";
|
||||
@ -39,8 +39,8 @@ public class UKDataContext {
|
||||
public static final String UKEFU_SYSTEM_AUTH_DIC = "com.dic.auth.resource";
|
||||
public static final String UKEFU_SYSTEM_AREA_DIC = "com.dic.address.area";
|
||||
public static final String UKEFU_SYSTEM_ADPOS_DIC = "com.dic.adv.type";
|
||||
public static final String UKEFU_SYSTEM_COMMENT_DIC = "com.dic.webim.comment";
|
||||
public static final String UKEFU_SYSTEM_COMMENT_ITEM_DIC = "com.dic.webim.comment.item";
|
||||
public static final String UKEFU_SYSTEM_COMMENT_DIC = "com.dic.app.comment";
|
||||
public static final String UKEFU_SYSTEM_COMMENT_ITEM_DIC = "com.dic.app.comment.item";
|
||||
|
||||
public static final String UKEFU_SYSTEM_DIS_AI = "ownerai";
|
||||
public static final String UKEFU_SYSTEM_DIS_AGENT = "owneruser";
|
||||
@ -335,6 +335,28 @@ public class UKDataContext {
|
||||
}
|
||||
}
|
||||
|
||||
// 服务处理类型
|
||||
public enum OptTypeEnum {
|
||||
CHATBOT("机器人客服", 1),
|
||||
HUMAN("人工客服", 2);
|
||||
|
||||
private final String name;
|
||||
private final int index;
|
||||
|
||||
private OptTypeEnum(String name, int index) {
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public String toLetters() {
|
||||
return super.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
// 外呼计划状态
|
||||
public enum CallOutDialplanStatusEnum {
|
||||
RUNNING("执行中", 1),
|
||||
@ -486,9 +508,9 @@ public class UKDataContext {
|
||||
}
|
||||
|
||||
|
||||
public enum AiItemType {
|
||||
public enum ChatbotItemType {
|
||||
USERINPUT,
|
||||
AIREPLY;
|
||||
BOTREPLY;
|
||||
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase();
|
||||
@ -705,9 +727,9 @@ public class UKDataContext {
|
||||
IM("/im/user"),
|
||||
AGENT("/im/agent"),
|
||||
ENTIM("/im/ent"),
|
||||
AIIM("/im/ai"),
|
||||
CALLCENTER("/callcenter/event"),
|
||||
CALLOUT("/callout/event");
|
||||
CHATBOT("/im/chatbot"),
|
||||
CALLCENTER("/callcenter/exchange"),
|
||||
CALLOUT("/callout/exchange");
|
||||
|
||||
private String namespace;
|
||||
|
||||
@ -834,7 +856,7 @@ public class UKDataContext {
|
||||
}
|
||||
|
||||
public static void setTemplet(ElasticsearchTemplate templet) {
|
||||
UKDataContext.templet = templet;
|
||||
MainContext.templet = templet;
|
||||
}
|
||||
|
||||
public static int getWebIMPort() {
|
||||
@ -928,7 +950,7 @@ public class UKDataContext {
|
||||
}
|
||||
}
|
||||
|
||||
public enum AiType {
|
||||
public enum ChatbotType {
|
||||
SMARTAI,
|
||||
BUSINESSAI;
|
||||
|
||||
@ -938,7 +960,7 @@ public class UKDataContext {
|
||||
}
|
||||
|
||||
|
||||
public enum AiBussType {
|
||||
public enum ChatbotBussType {
|
||||
SALE,
|
||||
QUESURVEY;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,18 +14,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.util;
|
||||
package com.chatopera.cc.app.basic;
|
||||
|
||||
public class UKView {
|
||||
public class Viewport {
|
||||
private String page ;
|
||||
private String templet;
|
||||
|
||||
public UKView(String templet , String page){
|
||||
public Viewport(String templet , String page){
|
||||
this.templet = templet ;
|
||||
this.page = page ;
|
||||
}
|
||||
|
||||
public UKView(String page){
|
||||
public Viewport(String page){
|
||||
this.page = page ;
|
||||
}
|
||||
|
@ -14,14 +14,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.util.aop;
|
||||
package com.chatopera.cc.app.basic.aop;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.UKeFuList;
|
||||
import com.chatopera.cc.util.event.MultiUpdateEvent;
|
||||
import com.chatopera.cc.webim.service.hibernate.BaseService;
|
||||
import com.chatopera.cc.concurrent.multiupdate.MultiUpdateEvent;
|
||||
import com.chatopera.cc.app.persistence.hibernate.BaseService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@ -29,8 +30,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.web.model.ESBean;
|
||||
import com.chatopera.cc.app.model.ESBean;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@ -62,10 +62,10 @@ public class SyncDatabaseExt {
|
||||
}else if(data instanceof List){
|
||||
List<Object> dataList = (List<Object>)data ;
|
||||
for(Object dbData : dataList){
|
||||
UKTools.multiupdate(new MultiUpdateEvent<Object>(dbData , dbDataRes, UKDataContext.MultiUpdateType.SAVE.toString()));
|
||||
MainUtils.multiupdate(new MultiUpdateEvent<Object>(dbData , dbDataRes, MainContext.MultiUpdateType.SAVE.toString()));
|
||||
}
|
||||
}else{
|
||||
UKTools.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, UKDataContext.MultiUpdateType.SAVE.toString()));
|
||||
MainUtils.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, MainContext.MultiUpdateType.SAVE.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,13 +81,13 @@ public class SyncDatabaseExt {
|
||||
if(data instanceof List){
|
||||
List<Object> dataList = (List<Object>)data ;
|
||||
for(Object dbData : dataList){
|
||||
UKTools.multiupdate(new MultiUpdateEvent<Object>(dbData , dbDataRes, UKDataContext.MultiUpdateType.DELETE.toString()));
|
||||
MainUtils.multiupdate(new MultiUpdateEvent<Object>(dbData , dbDataRes, MainContext.MultiUpdateType.DELETE.toString()));
|
||||
}
|
||||
}else{
|
||||
if(data instanceof ESBean){
|
||||
UKTools.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, UKDataContext.MultiUpdateType.DELETE.toString()));
|
||||
MainUtils.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, MainContext.MultiUpdateType.DELETE.toString()));
|
||||
}else{
|
||||
UKTools.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, UKDataContext.MultiUpdateType.DELETE.toString()));
|
||||
MainUtils.multiupdate(new MultiUpdateEvent<Object>(data, dbDataRes, MainContext.MultiUpdateType.DELETE.toString()));
|
||||
}
|
||||
}
|
||||
}
|
@ -14,35 +14,35 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.resource;
|
||||
package com.chatopera.cc.app.basic.resource;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.chatopera.cc.webim.web.model.JobDetail;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.model.JobDetail;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.es.SearchTools;
|
||||
import com.chatopera.cc.util.es.UKDataBean;
|
||||
import com.chatopera.cc.webim.service.impl.BatchDataProcess;
|
||||
import com.chatopera.cc.webim.service.impl.ESDataExchangeImpl;
|
||||
import com.chatopera.cc.webim.service.repository.CallAgentRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UKefuCallOutFilterRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UKefuCallOutTaskRepository;
|
||||
import com.chatopera.cc.webim.service.repository.FormFilterItemRepository;
|
||||
import com.chatopera.cc.webim.service.repository.FormFilterRepository;
|
||||
import com.chatopera.cc.webim.service.repository.JobDetailRepository;
|
||||
import com.chatopera.cc.webim.service.repository.MetadataRepository;
|
||||
import com.chatopera.cc.webim.web.model.CallAgent;
|
||||
import com.chatopera.cc.webim.web.model.UKefuCallOutFilter;
|
||||
import com.chatopera.cc.webim.web.model.UKefuCallOutTask;
|
||||
import com.chatopera.cc.webim.web.model.FormFilter;
|
||||
import com.chatopera.cc.webim.web.model.FormFilterItem;
|
||||
import com.chatopera.cc.webim.web.model.MetadataTable;
|
||||
import com.chatopera.cc.app.persistence.impl.BatchDataProcess;
|
||||
import com.chatopera.cc.app.persistence.impl.ESDataExchangeImpl;
|
||||
import com.chatopera.cc.app.persistence.repository.CallAgentRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UKefuCallOutFilterRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UKefuCallOutTaskRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.FormFilterItemRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.FormFilterRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.JobDetailRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.MetadataRepository;
|
||||
import com.chatopera.cc.app.model.CallAgent;
|
||||
import com.chatopera.cc.app.model.UKefuCallOutFilter;
|
||||
import com.chatopera.cc.app.model.UKefuCallOutTask;
|
||||
import com.chatopera.cc.app.model.FormFilter;
|
||||
import com.chatopera.cc.app.model.FormFilterItem;
|
||||
import com.chatopera.cc.app.model.MetadataTable;
|
||||
|
||||
public class ActivityResource extends Resource{
|
||||
|
||||
@ -76,13 +76,13 @@ public class ActivityResource extends Resource{
|
||||
|
||||
public ActivityResource(JobDetail jobDetail) {
|
||||
this.jobDetail = jobDetail ;
|
||||
this.formFilterRes = UKDataContext.getContext().getBean(FormFilterRepository.class) ;
|
||||
this.formFilterItemRes = UKDataContext.getContext().getBean(FormFilterItemRepository.class) ;
|
||||
this.callOutTaskRes = UKDataContext.getContext().getBean(UKefuCallOutTaskRepository.class);
|
||||
this.callOutFilterRes = UKDataContext.getContext().getBean(UKefuCallOutFilterRepository.class);
|
||||
this.batchRes = UKDataContext.getContext().getBean(JobDetailRepository.class);
|
||||
this.metadataRes = UKDataContext.getContext().getBean(MetadataRepository.class);
|
||||
this.batchDataProcess = new BatchDataProcess(null , UKDataContext.getContext().getBean(ESDataExchangeImpl.class)) ;
|
||||
this.formFilterRes = MainContext.getContext().getBean(FormFilterRepository.class) ;
|
||||
this.formFilterItemRes = MainContext.getContext().getBean(FormFilterItemRepository.class) ;
|
||||
this.callOutTaskRes = MainContext.getContext().getBean(UKefuCallOutTaskRepository.class);
|
||||
this.callOutFilterRes = MainContext.getContext().getBean(UKefuCallOutFilterRepository.class);
|
||||
this.batchRes = MainContext.getContext().getBean(JobDetailRepository.class);
|
||||
this.metadataRes = MainContext.getContext().getBean(MetadataRepository.class);
|
||||
this.batchDataProcess = new BatchDataProcess(null , MainContext.getContext().getBean(ESDataExchangeImpl.class)) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,7 +91,7 @@ public class ActivityResource extends Resource{
|
||||
formFilter = formFilterRes.findByIdAndOrgi(jobDetail.getFilterid(), this.jobDetail.getOrgi()) ;
|
||||
List<FormFilterItem> formFilterList = formFilterItemRes.findByOrgiAndFormfilterid(this.jobDetail.getOrgi(), jobDetail.getFilterid()) ;
|
||||
if(formFilter!=null && !StringUtils.isBlank(formFilter.getFiltertype())) {
|
||||
if(formFilter.getFiltertype().equals(UKDataContext.FormFilterTypeEnum.BATCH.toString())) {
|
||||
if(formFilter.getFiltertype().equals(MainContext.FormFilterTypeEnum.BATCH.toString())) {
|
||||
batch = batchRes.findByIdAndOrgi(formFilter.getBatid(), this.jobDetail.getOrgi()) ;
|
||||
if(batch!=null && !StringUtils.isBlank(batch.getActid())) {
|
||||
metadataTable = metadataRes.findByTablename(batch.getActid()) ;
|
||||
@ -113,7 +113,7 @@ public class ActivityResource extends Resource{
|
||||
dataList = SearchTools.dissearch(this.jobDetail.getOrgi(), formFilter, formFilterList , metadataTable ,(int) Math.ceil(this.jobDetail.getStartindex()/50000), 50000) ;
|
||||
}
|
||||
}
|
||||
this.callAgentList = UKDataContext.getContext().getBean(CallAgentRepository.class).findByActidAndOrgi(this.jobDetail.getId() , this.jobDetail.getOrgi()) ;
|
||||
this.callAgentList = MainContext.getContext().getBean(CallAgentRepository.class).findByActidAndOrgi(this.jobDetail.getId() , this.jobDetail.getOrgi()) ;
|
||||
/**
|
||||
* 生成 活动任务, 然后完成分配 , 同时还需要生成 筛选表单的筛选记录 , 在后台管理界面上可以看到
|
||||
*/
|
||||
@ -131,15 +131,15 @@ public class ActivityResource extends Resource{
|
||||
}
|
||||
}else {
|
||||
task = new UKefuCallOutTask() ;
|
||||
task.setName(this.jobDetail.getName() + "_" + UKTools.dateFormate.format(new Date()));
|
||||
task.setName(this.jobDetail.getName() + "_" + MainUtils.dateFormate.format(new Date()));
|
||||
task.setBatid(formFilter.getBatid());
|
||||
|
||||
task.setOrgi(this.jobDetail.getOrgi());
|
||||
|
||||
if(this.isRecovery()) {
|
||||
task.setExectype(UKDataContext.ActivityExecType.RECOVERY.toString());
|
||||
task.setExectype(MainContext.ActivityExecType.RECOVERY.toString());
|
||||
}else {
|
||||
task.setExectype(UKDataContext.ActivityExecType.DEFAULT.toString());
|
||||
task.setExectype(MainContext.ActivityExecType.DEFAULT.toString());
|
||||
}
|
||||
|
||||
task.setFilterid(formFilter.getId());
|
||||
@ -161,8 +161,8 @@ public class ActivityResource extends Resource{
|
||||
|
||||
formFilter.setExecnum(formFilter.getExecnum() + 1);
|
||||
|
||||
UKTools.copyProperties(task, filter);
|
||||
filter.setName(this.formFilter.getName() + "_" + UKTools.dateFormate.format(new Date()));
|
||||
MainUtils.copyProperties(task, filter);
|
||||
filter.setName(this.formFilter.getName() + "_" + MainUtils.dateFormate.format(new Date()));
|
||||
filter.setExecnum(formFilter.getExecnum());
|
||||
this.callOutFilterRes.save(filter) ;
|
||||
}
|
||||
@ -246,17 +246,17 @@ public class ActivityResource extends Resource{
|
||||
*/
|
||||
if(this.isRecovery()) {
|
||||
if(!StringUtils.isBlank(this.jobDetail.getExecto())) {
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AGENT, null) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AI, null) ;
|
||||
// meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_ORGAN, this.jobDetail.getExecto()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_TIME, System.currentTimeMillis()) ;
|
||||
meta.getDataBean().getValues().put("status", UKDataContext.NamesDisStatusType.DISORGAN.toString()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AGENT, null) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AI, null) ;
|
||||
// meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_ORGAN, this.jobDetail.getExecto()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_TIME, System.currentTimeMillis()) ;
|
||||
meta.getDataBean().getValues().put("status", MainContext.NamesDisStatusType.DISORGAN.toString()) ;
|
||||
}else {
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AI, null) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AGENT, null) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_ORGAN, null) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_TIME, null) ;
|
||||
meta.getDataBean().getValues().put("status", UKDataContext.NamesDisStatusType.NOT.toString()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AI, null) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AGENT, null) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_ORGAN, null) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_TIME, null) ;
|
||||
meta.getDataBean().getValues().put("status", MainContext.NamesDisStatusType.NOT.toString()) ;
|
||||
}
|
||||
}else {
|
||||
if(this.current!=null && meta!=null && meta.getDataBean()!=null) {
|
||||
@ -264,7 +264,7 @@ public class ActivityResource extends Resource{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_TIME, System.currentTimeMillis()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_TIME, System.currentTimeMillis()) ;
|
||||
|
||||
meta.getDataBean().getValues().put("actid", this.jobDetail.getId()) ;
|
||||
meta.getDataBean().getValues().put("metaid", this.metadataTable.getTablename()) ;
|
||||
@ -287,18 +287,18 @@ public class ActivityResource extends Resource{
|
||||
*/
|
||||
|
||||
if("agent".equals(this.current.getDistype())) {
|
||||
meta.getDataBean().getValues().put("status", UKDataContext.NamesDisStatusType.DISAGENT.toString()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AGENT, this.current.getDistarget()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getOrgan()) ;
|
||||
meta.getDataBean().getValues().put("status", MainContext.NamesDisStatusType.DISAGENT.toString()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AGENT, this.current.getDistarget()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getOrgan()) ;
|
||||
this.assignInt.incrementAndGet() ;
|
||||
}else if("skill".equals(this.current.getDistype())) {
|
||||
meta.getDataBean().getValues().put("status", UKDataContext.NamesDisStatusType.DISORGAN.toString()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getDistarget()) ;
|
||||
meta.getDataBean().getValues().put("status", MainContext.NamesDisStatusType.DISORGAN.toString()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getDistarget()) ;
|
||||
this.assignorganInt.incrementAndGet() ;
|
||||
}else if("ai".equals(this.current.getDistype())) {
|
||||
meta.getDataBean().getValues().put("status", UKDataContext.NamesDisStatusType.DISAI.toString()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_AI, this.current.getDistarget()) ;
|
||||
meta.getDataBean().getValues().put(UKDataContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getOrgan()) ;
|
||||
meta.getDataBean().getValues().put("status", MainContext.NamesDisStatusType.DISAI.toString()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_AI, this.current.getDistarget()) ;
|
||||
meta.getDataBean().getValues().put(MainContext.UKEFU_SYSTEM_DIS_ORGAN, this.current.getOrgan()) ;
|
||||
this.assignAiInt.incrementAndGet() ;
|
||||
}
|
||||
}
|
@ -14,27 +14,27 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.resource;
|
||||
package com.chatopera.cc.app.basic.resource;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.chatopera.cc.webim.service.impl.BatchDataProcess;
|
||||
import com.chatopera.cc.webim.web.model.JobDetail;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.persistence.impl.BatchDataProcess;
|
||||
import com.chatopera.cc.app.model.JobDetail;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.task.DSData;
|
||||
import com.chatopera.cc.util.task.DSDataEvent;
|
||||
import com.chatopera.cc.util.task.ExcelImportProecess;
|
||||
import com.chatopera.cc.webim.service.impl.ESDataExchangeImpl;
|
||||
import com.chatopera.cc.webim.service.repository.MetadataRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ReporterRepository;
|
||||
import com.chatopera.cc.webim.web.model.MetadataTable;
|
||||
import com.chatopera.cc.concurrent.dsdata.DSData;
|
||||
import com.chatopera.cc.concurrent.dsdata.DSDataEvent;
|
||||
import com.chatopera.cc.concurrent.dsdata.ExcelImportProecess;
|
||||
import com.chatopera.cc.app.persistence.impl.ESDataExchangeImpl;
|
||||
import com.chatopera.cc.app.persistence.repository.MetadataRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ReporterRepository;
|
||||
import com.chatopera.cc.app.model.MetadataTable;
|
||||
|
||||
public class BatchResource extends Resource{
|
||||
|
||||
@ -48,9 +48,9 @@ public class BatchResource extends Resource{
|
||||
|
||||
public BatchResource(JobDetail jobDetail) {
|
||||
this.jobDetail = jobDetail ;
|
||||
this.metadataRes = UKDataContext.getContext().getBean(MetadataRepository.class);
|
||||
this.reporterRes = UKDataContext.getContext().getBean(ReporterRepository.class);
|
||||
this.esDataExchange = UKDataContext.getContext().getBean(ESDataExchangeImpl.class);
|
||||
this.metadataRes = MainContext.getContext().getBean(MetadataRepository.class);
|
||||
this.reporterRes = MainContext.getContext().getBean(ReporterRepository.class);
|
||||
this.esDataExchange = MainContext.getContext().getBean(ESDataExchangeImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,18 +59,18 @@ public class BatchResource extends Resource{
|
||||
metadataTable = metadataRes.findByTablename(jobDetail.getActid()) ;
|
||||
}
|
||||
DSDataEvent event = new DSDataEvent();
|
||||
String path = UKDataContext.getContext().getEnvironment().getProperty("web.upload-path") ;
|
||||
String path = MainContext.getContext().getEnvironment().getProperty("web.upload-path") ;
|
||||
File tempFile = null ;
|
||||
if(metadataTable!=null && !StringUtils.isBlank(this.jobDetail.getBatchtype()) && this.jobDetail.getBatchtype().equals("plan")) {
|
||||
if(!StringUtils.isBlank(this.jobDetail.getImptype())) {
|
||||
if(this.jobDetail.getImptype().equals("local")) {
|
||||
tempFile = new File(UKTools.getTemplet(this.jobDetail.getImpurl(), new HashMap<String,Object>()));
|
||||
tempFile = new File(MainUtils.getTemplet(this.jobDetail.getImpurl(), new HashMap<String,Object>()));
|
||||
}else if(this.jobDetail.getImptype().equals("remote")){
|
||||
FileUtils.copyURLToFile(new URL(UKTools.getTemplet(this.jobDetail.getImpurl(), new HashMap<String,Object>())), tempFile = File.createTempFile("UKeFu-CallOut-Temp", ".xls"));
|
||||
FileUtils.copyURLToFile(new URL(MainUtils.getTemplet(this.jobDetail.getImpurl(), new HashMap<String,Object>())), tempFile = File.createTempFile("UKeFu-CallOut-Temp", ".xls"));
|
||||
}
|
||||
}
|
||||
if(tempFile.exists()) {
|
||||
String fileName = "callout/batch/"+UKTools.getUUID() + tempFile.getName().substring(tempFile.getName().lastIndexOf(".")) ;
|
||||
String fileName = "callout/batch/"+ MainUtils.getUUID() + tempFile.getName().substring(tempFile.getName().lastIndexOf(".")) ;
|
||||
File excelFile = new File(path , fileName) ;
|
||||
if(!excelFile.getParentFile().exists()){
|
||||
excelFile.getParentFile().mkdirs() ;
|
||||
@ -91,7 +91,7 @@ public class BatchResource extends Resource{
|
||||
|
||||
event.getDSData().getReport().setOrgi(this.jobDetail.getOrgi());
|
||||
event.getDSData().getReport().setDataid(this.jobDetail.getId());
|
||||
event.getDSData().getReport().setTitle(this.jobDetail.getName() + "_" + UKTools.dateFormate.format(new Date()));
|
||||
event.getDSData().getReport().setTitle(this.jobDetail.getName() + "_" + MainUtils.dateFormate.format(new Date()));
|
||||
}else {
|
||||
event.getDSData().getReport().setError(true);
|
||||
if(tempFile!=null) {
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.resource;
|
||||
package com.chatopera.cc.app.basic.resource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.chatopera.cc.util.es.UKDataBean;
|
||||
import com.chatopera.cc.webim.web.model.JobDetail;
|
||||
import com.chatopera.cc.app.model.JobDetail;
|
||||
|
||||
public class OutputTextFormat {
|
||||
private String id ;
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.resource;
|
||||
package com.chatopera.cc.app.basic.resource;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.chatopera.cc.webim.web.model.JobDetail;
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.model.JobDetail;
|
||||
|
||||
/**
|
||||
* @author jaddy0302 Rivulet Resource.java 2010-3-6
|
||||
@ -90,7 +90,7 @@ public abstract class Resource {
|
||||
public static Resource getResource(JobDetail job)
|
||||
throws Exception{
|
||||
return job != null
|
||||
&& UKDataContext.getResource(job.getTasktype()) != null ? (Resource) UKDataContext
|
||||
&& MainContext.getResource(job.getTasktype()) != null ? (Resource) MainContext
|
||||
.getResource(job.getTasktype()).getConstructor(
|
||||
new Class[] { JobDetail.class }).newInstance(
|
||||
new Object[] { job })
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache;
|
||||
package com.chatopera.cc.app.cache;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
@ -14,9 +14,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache;
|
||||
package com.chatopera.cc.app.cache;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.hazelcast.HazlcastCacheHelper;
|
||||
import com.chatopera.cc.app.cache.hazelcast.HazlcastCacheHelper;
|
||||
|
||||
public class CacheHelper {
|
||||
private static CacheHelper instance = new CacheHelper();
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache;
|
||||
package com.chatopera.cc.app.cache;
|
||||
|
||||
|
||||
public interface CacheInstance {
|
91
contact-center/app/src/main/java/com/chatopera/cc/app/cache/hazelcast/HazlcastCacheHelper.java
vendored
Normal file
91
contact-center/app/src/main/java/com/chatopera/cc/app/cache/hazelcast/HazlcastCacheHelper.java
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2017 优客服-多渠道客服系统
|
||||
* Modifications copyright (C) 2018 Chatopera Inc, <https://www.chatopera.com>
|
||||
*
|
||||
* 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.chatopera.cc.app.cache.hazelcast;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheInstance;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.AgentStatusCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.AgentUserCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.ApiUserCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.CallCenterCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.JobCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.MultiCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.OnlineCache;
|
||||
import com.chatopera.cc.app.cache.hazelcast.impl.SystemCache;
|
||||
/**
|
||||
* Hazlcast缓存处理实例类
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public class HazlcastCacheHelper implements CacheInstance {
|
||||
/**
|
||||
* 服务类型枚举
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public enum CacheServiceEnum{
|
||||
HAZLCAST_CLUSTER_AGENT_USER_CACHE, HAZLCAST_CLUSTER_AGENT_STATUS_CACHE, HAZLCAST_CLUSTER_QUENE_USER_CACHE,HAZLCAST_ONLINE_CACHE , HAZLCAST_CULUSTER_SYSTEM , HAZLCAST_IMR_CACHE , API_USER_CACHE , CALLCENTER_CURRENT_CALL ,CALLCENTER_AGENT,JOB_CACHE,HAZLCAST_CALLOUT_CACHE;
|
||||
public String toString(){
|
||||
return super.toString().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheBean getAgentStatusCacheBean() {
|
||||
// TODO Auto-generated method stub
|
||||
return MainContext.getContext().getBean(AgentStatusCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_CLUSTER_AGENT_STATUS_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getAgentUserCacheBean() {
|
||||
// TODO Auto-generated method stub
|
||||
return MainContext.getContext().getBean(AgentUserCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_CLUSTER_QUENE_USER_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getOnlineCacheBean() {
|
||||
return MainContext.getContext().getBean(OnlineCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_ONLINE_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getSystemCacheBean() {
|
||||
return MainContext.getContext().getBean(SystemCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_CULUSTER_SYSTEM.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getIMRCacheBean() {
|
||||
return MainContext.getContext().getBean(MultiCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_IMR_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getCallCenterCacheBean() {
|
||||
return MainContext.getContext().getBean(CallCenterCache.class).getCacheInstance(CacheServiceEnum.CALLCENTER_CURRENT_CALL.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getCallCenterAgentCacheBean() {
|
||||
return MainContext.getContext().getBean(CallCenterCache.class).getCacheInstance(CacheServiceEnum.CALLCENTER_AGENT.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getApiUserCacheBean() {
|
||||
return MainContext.getContext().getBean(ApiUserCache.class).getCacheInstance(CacheServiceEnum.API_USER_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getJobCacheBean() {
|
||||
return MainContext.getContext().getBean(JobCache.class).getCacheInstance(CacheServiceEnum.JOB_CACHE.toString()) ;
|
||||
}
|
||||
@Override
|
||||
public CacheBean getCallOutCacheBean() {
|
||||
// TODO Auto-generated method stub
|
||||
return MainContext.getContext().getBean(JobCache.class).getCacheInstance(CacheServiceEnum.HAZLCAST_CALLOUT_CACHE.toString()) ;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("agentstatus_cache")
|
||||
public class AgentStatusCache implements CacheBean{
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("agentuser_cache")
|
||||
public class AgentUserCache implements CacheBean{
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("api_user_cache")
|
||||
public class ApiUserCache implements CacheBean{
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("callcenter_current_call")
|
||||
public class CallCenterCache implements CacheBean{
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("job_cache")
|
||||
public class JobCache implements CacheBean{
|
@ -14,12 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
|
||||
@Service("online_cache")
|
||||
public class OnlineCache implements CacheBean{
|
@ -14,12 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.service.cache.hazelcast.impl;
|
||||
package com.chatopera.cc.app.cache.hazelcast.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheBean;
|
||||
import com.chatopera.cc.app.cache.CacheBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -37,7 +37,7 @@ public class ApiConfigure {
|
||||
.groupName("CSKefu")
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.chatopera.cc.webim.web.handler.api.rest"))
|
||||
.apis(RequestHandlerSelectors.basePackage("com.chatopera.cc.app.handler.api.rest"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -27,12 +27,12 @@ import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
|
||||
public class ApiRequestMatchingFilter implements Filter {
|
||||
private RequestMatcher[] ignoredRequests;
|
||||
@ -66,7 +66,7 @@ public class ApiRequestMatchingFilter implements Filter {
|
||||
if(StringUtils.isBlank(authorization)){
|
||||
authorization = request.getParameter("authorization") ;
|
||||
}
|
||||
if(!StringUtils.isBlank(authorization) && CacheHelper.getApiUserCacheBean().getCacheObject(authorization, UKDataContext.SYSTEM_ORGI) != null){
|
||||
if(!StringUtils.isBlank(authorization) && CacheHelper.getApiUserCacheBean().getCacheObject(authorization, MainContext.SYSTEM_ORGI) != null){
|
||||
chain.doFilter(req,resp);
|
||||
}else{
|
||||
response.sendRedirect("/tokens/error");
|
@ -14,11 +14,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.web.model.Favorites;
|
||||
import com.chatopera.cc.webim.web.model.WorkOrders;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.model.Favorites;
|
||||
import com.chatopera.cc.app.model.WorkOrders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
@ -45,6 +45,6 @@ public class ApplicationStartupListener implements ApplicationListener<ContextRe
|
||||
elasticSearchTemplate.putMapping(Favorites.class);
|
||||
elasticSearchTemplate.putMapping(WorkOrders.class);
|
||||
}
|
||||
UKDataContext.setTemplet(elasticSearchTemplate);
|
||||
MainContext.setTemplet(elasticSearchTemplate);
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -27,8 +27,8 @@ import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.catalina.connector.ClientAbortException;
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
|
||||
@ -47,7 +47,7 @@ public class DelegateRequestMatchingFilter implements Filter {
|
||||
matchAnyRoles = true ;
|
||||
}
|
||||
}
|
||||
User user = (User) request.getSession().getAttribute(UKDataContext.USER_SESSION_NAME) ;
|
||||
User user = (User) request.getSession().getAttribute(MainContext.USER_SESSION_NAME) ;
|
||||
if(matchAnyRoles){
|
||||
if(user !=null && "0".equals(user.getUsertype())){
|
||||
chain.doFilter(req,resp);
|
@ -14,22 +14,25 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.chatopera.cc.webim.util.disruptor.multiupdate.MultiUpdateEventFactory;
|
||||
import com.chatopera.cc.webim.util.disruptor.multiupdate.MultiUpdateEventHandler;
|
||||
import com.chatopera.cc.concurrent.chatbot.ChatbotDisruptorExceptionHandler;
|
||||
import com.chatopera.cc.concurrent.chatbot.ChatbotEventFactory;
|
||||
import com.chatopera.cc.concurrent.chatbot.ChatbotEventHandler;
|
||||
import com.chatopera.cc.concurrent.multiupdate.MultiUpdateEventFactory;
|
||||
import com.chatopera.cc.concurrent.multiupdate.MultiUpdateEventHandler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.lmax.disruptor.SleepingWaitStrategy;
|
||||
import com.lmax.disruptor.dsl.Disruptor;
|
||||
import com.lmax.disruptor.dsl.ProducerType;
|
||||
import com.chatopera.cc.util.event.UserDataEvent;
|
||||
import com.chatopera.cc.webim.util.disruptor.UserDataEventFactory;
|
||||
import com.chatopera.cc.webim.util.disruptor.UserEventHandler;
|
||||
import com.chatopera.cc.concurrent.user.UserDataEvent;
|
||||
import com.chatopera.cc.concurrent.user.UserDataEventFactory;
|
||||
import com.chatopera.cc.concurrent.user.UserEventHandler;
|
||||
|
||||
@Component
|
||||
public class DisruptorConfigure {
|
||||
@ -55,5 +58,17 @@ public class DisruptorConfigure {
|
||||
disruptor.setDefaultExceptionHandler(new UKeFuExceptionHandler());
|
||||
disruptor.start();
|
||||
return disruptor;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@Bean(name="chatbot")
|
||||
public Disruptor<UserDataEvent> chatbot() {
|
||||
Executor executor = Executors.newCachedThreadPool();
|
||||
ChatbotEventFactory factory = new ChatbotEventFactory();
|
||||
Disruptor<UserDataEvent> disruptor = new Disruptor<UserDataEvent>(factory, 1024, executor, ProducerType.SINGLE , new SleepingWaitStrategy());
|
||||
disruptor.handleEventsWith(new ChatbotEventHandler());
|
||||
disruptor.setDefaultExceptionHandler(new ChatbotDisruptorExceptionHandler());
|
||||
disruptor.start();
|
||||
return disruptor;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -48,7 +48,7 @@ public class ExecutorConfig {
|
||||
// 线程池维护线程所允许的空闲时间
|
||||
poolTaskExecutor.setKeepAliveSeconds(30000);
|
||||
poolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
poolTaskExecutor.setThreadNamePrefix("CSExecutor-webim-");
|
||||
poolTaskExecutor.setThreadNamePrefix("CSExecutor-app-");
|
||||
|
||||
return poolTaskExecutor;
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -25,6 +25,7 @@ import java.util.Properties;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -34,9 +35,8 @@ import com.corundumstudio.socketio.Configuration;
|
||||
import com.corundumstudio.socketio.HandshakeData;
|
||||
import com.corundumstudio.socketio.SocketIOServer;
|
||||
import com.corundumstudio.socketio.annotation.SpringAnnotationScanner;
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.exception.UCKeFuExceptionListener;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.exception.UCKeFuExceptionListener;
|
||||
|
||||
@org.springframework.context.annotation.Configuration
|
||||
public class IMServerConfiguration
|
||||
@ -61,10 +61,10 @@ public class IMServerConfiguration
|
||||
@Bean(name="webimport")
|
||||
public Integer getWebIMPort() {
|
||||
if(sslPort != null){
|
||||
UKDataContext.setWebIMPort(sslPort);
|
||||
MainContext.setWebIMPort(sslPort);
|
||||
return sslPort;
|
||||
} else {
|
||||
UKDataContext.setWebIMPort(port);
|
||||
MainContext.setWebIMPort(port);
|
||||
return port;
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class IMServerConfiguration
|
||||
sslProperties.load(in);
|
||||
in.close();
|
||||
if(!StringUtils.isBlank(sslProperties.getProperty("key-store")) && !StringUtils.isBlank(sslProperties.getProperty("key-store-password"))){
|
||||
config.setKeyStorePassword(UKTools.decryption(sslProperties.getProperty("key-store-password")));
|
||||
config.setKeyStorePassword(MainUtils.decryption(sslProperties.getProperty("key-store-password")));
|
||||
InputStream stream = new FileInputStream(new File(path , "ssl/"+sslProperties.getProperty("key-store")));
|
||||
config.setKeyStore(stream);
|
||||
}
|
@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import com.chatopera.cc.util.Constants;
|
||||
import com.chatopera.cc.webim.service.task.CallOutWireTask;
|
||||
import com.chatopera.cc.app.schedule.CallOutWireTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
@ -14,30 +14,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.GenerationRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SystemConfigRepository;
|
||||
import com.chatopera.cc.webim.service.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.webim.web.model.Generation;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.GenerationRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SystemConfigRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.app.model.Generation;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.repository.BlackListRepository;
|
||||
import com.chatopera.cc.webim.web.model.BlackEntity;
|
||||
import com.chatopera.cc.webim.web.model.SystemConfig;
|
||||
import com.chatopera.cc.app.persistence.repository.BlackListRepository;
|
||||
import com.chatopera.cc.app.model.BlackEntity;
|
||||
import com.chatopera.cc.app.model.SystemConfig;
|
||||
|
||||
@Component
|
||||
public class StartedEventListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
@ -50,8 +50,8 @@ public class StartedEventListener implements ApplicationListener<ContextRefreshe
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
if(UKDataContext.getContext() == null){
|
||||
UKDataContext.setApplicationContext(event.getApplicationContext());
|
||||
if(MainContext.getContext() == null){
|
||||
MainContext.setApplicationContext(event.getApplicationContext());
|
||||
}
|
||||
sysDicRes = event.getApplicationContext().getBean(SysDicRepository.class) ;
|
||||
blackListRes = event.getApplicationContext().getBean(BlackListRepository.class) ;
|
||||
@ -69,7 +69,7 @@ public class StartedEventListener implements ApplicationListener<ContextRefreshe
|
||||
CacheHelper.getSystemCacheBean().put(dic.getCode(), sysDicItemList, dic.getOrgi());
|
||||
}
|
||||
}
|
||||
List<BlackEntity> blackList = blackListRes.findByOrgi(UKDataContext.SYSTEM_ORGI) ;
|
||||
List<BlackEntity> blackList = blackListRes.findByOrgi(MainContext.SYSTEM_ORGI) ;
|
||||
for(BlackEntity black : blackList){
|
||||
if(!StringUtils.isBlank(black.getUserid())) {
|
||||
if(black.getEndtime()==null || black.getEndtime().after(new Date())){
|
||||
@ -81,19 +81,19 @@ public class StartedEventListener implements ApplicationListener<ContextRefreshe
|
||||
* 加载系统全局配置
|
||||
*/
|
||||
SystemConfigRepository systemConfigRes = event.getApplicationContext().getBean(SystemConfigRepository.class) ;
|
||||
SystemConfig config = systemConfigRes.findByOrgi(UKDataContext.SYSTEM_ORGI) ;
|
||||
SystemConfig config = systemConfigRes.findByOrgi(MainContext.SYSTEM_ORGI) ;
|
||||
if(config != null){
|
||||
CacheHelper.getSystemCacheBean().put("systemConfig", config, UKDataContext.SYSTEM_ORGI);
|
||||
CacheHelper.getSystemCacheBean().put("systemConfig", config, MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
GenerationRepository generationRes = event.getApplicationContext().getBean(GenerationRepository.class) ;
|
||||
List<Generation> generationList = generationRes.findAll() ;
|
||||
for(Generation generation : generationList){
|
||||
CacheHelper.getSystemCacheBean().setAtomicLong(UKDataContext.ModelType.WORKORDERS.toString(), generation.getStartinx());
|
||||
CacheHelper.getSystemCacheBean().setAtomicLong(MainContext.ModelType.WORKORDERS.toString(), generation.getStartinx());
|
||||
}
|
||||
|
||||
UKTools.initSystemArea();
|
||||
MainUtils.initSystemArea();
|
||||
|
||||
UKTools.initSystemSecField(event.getApplicationContext().getBean(TablePropertiesRepository.class));
|
||||
//UKTools.initAdv();//初始化广告位
|
||||
MainUtils.initSystemSecField(event.getApplicationContext().getBean(TablePropertiesRepository.class));
|
||||
//MainUtils.initAdv();//初始化广告位
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
@ -14,15 +14,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import com.chatopera.cc.webim.web.interceptor.LogIntercreptorHandler;
|
||||
import com.chatopera.cc.webim.web.interceptor.UserInterceptorHandler;
|
||||
import com.chatopera.cc.app.interceptor.LogIntercreptorHandler;
|
||||
import com.chatopera.cc.app.interceptor.UserInterceptorHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
import com.chatopera.cc.webim.web.interceptor.CrossInterceptorHandler;
|
||||
import com.chatopera.cc.app.interceptor.CrossInterceptorHandler;
|
||||
|
||||
@Configuration
|
||||
public class UKWebAppConfigurer
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import com.lmax.disruptor.ExceptionHandler;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@ -23,7 +23,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
import org.springframework.web.multipart.support.StandardServletMultipartResolver;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.config.web;
|
||||
package com.chatopera.cc.app.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.coyote.http11.Http11NioProtocol;
|
||||
@ -33,8 +34,6 @@ import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletCon
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
|
||||
@Configuration
|
||||
public class WebServerConfiguration
|
||||
{
|
||||
@ -59,7 +58,7 @@ public class WebServerConfiguration
|
||||
if(!StringUtils.isBlank(sslProperties.getProperty("key-store")) && !StringUtils.isBlank(sslProperties.getProperty("key-store-password"))){
|
||||
Ssl ssl = new Ssl();
|
||||
ssl.setKeyStore(new File(path , "ssl/"+sslProperties.getProperty("key-store")).getAbsolutePath());
|
||||
ssl.setKeyStorePassword(UKTools.decryption(sslProperties.getProperty("key-store-password")));
|
||||
ssl.setKeyStorePassword(MainUtils.decryption(sslProperties.getProperty("key-store-password")));
|
||||
tomcatFactory.setSsl(ssl);
|
||||
}
|
||||
}
|
@ -14,20 +14,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler;
|
||||
package com.chatopera.cc.app.handler;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.algorithm.AutomaticServiceDist;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.service.acd.ServiceQuene;
|
||||
|
||||
@Controller
|
||||
public class ApplicationController extends Handler{
|
||||
|
||||
@ -35,12 +34,12 @@ public class ApplicationController extends Handler{
|
||||
public ModelAndView admin(HttpServletRequest request) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/index"));
|
||||
User user = super.getUser(request) ;
|
||||
view.addObject("agentStatusReport",ServiceQuene.getAgentReport(user.getOrgi())) ;
|
||||
view.addObject("agentStatusReport", AutomaticServiceDist.getAgentReport(user.getOrgi())) ;
|
||||
view.addObject("tenant",super.getTenant(request));
|
||||
view.addObject("istenantshare",super.isEnabletneant());
|
||||
if(super.isEnabletneant()) {
|
||||
//多租户启用 非超级管理员 一定要选择租户才能进入界面
|
||||
if(!user.isSuperuser() && !StringUtils.isBlank(user.getOrgid()) && super.isTenantconsole() &&UKDataContext.SYSTEM_ORGI.equals(user.getOrgi())) {
|
||||
if(!user.isSuperuser() && !StringUtils.isBlank(user.getOrgid()) && super.isTenantconsole() && MainContext.SYSTEM_ORGI.equals(user.getOrgi())) {
|
||||
view = request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index"));
|
||||
}
|
||||
if(StringUtils.isBlank(user.getOrgid())) {
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler;
|
||||
package com.chatopera.cc.app.handler;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termsQuery;
|
||||
@ -24,14 +24,15 @@ import java.text.ParseException;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKView;
|
||||
import com.chatopera.cc.util.exception.CSKefuException;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.TenantRepository;
|
||||
import com.chatopera.cc.webim.web.handler.api.rest.QueryParams;
|
||||
import com.chatopera.cc.webim.web.model.Tenant;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.basic.Viewport;
|
||||
import com.chatopera.cc.exception.CSKefuException;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.TenantRepository;
|
||||
import com.chatopera.cc.app.handler.api.rest.QueryParams;
|
||||
import com.chatopera.cc.app.model.Tenant;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
@ -46,8 +47,7 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.web.model.SystemConfig;
|
||||
import com.chatopera.cc.app.model.SystemConfig;
|
||||
|
||||
|
||||
@Controller
|
||||
@ -66,7 +66,7 @@ public class Handler {
|
||||
private long starttime = System.currentTimeMillis();
|
||||
|
||||
public User getUser(HttpServletRequest request){
|
||||
User user = (User) request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) ;
|
||||
User user = (User) request.getSession(true).getAttribute(MainContext.USER_SESSION_NAME) ;
|
||||
if(user==null){
|
||||
String authorization = request.getHeader("authorization") ;
|
||||
if(StringUtils.isBlank(authorization) && request.getCookies()!=null){
|
||||
@ -77,13 +77,13 @@ public class Handler {
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(authorization)){
|
||||
user = (User) CacheHelper.getApiUserCacheBean().getCacheObject(authorization, UKDataContext.SYSTEM_ORGI) ;
|
||||
user = (User) CacheHelper.getApiUserCacheBean().getCacheObject(authorization, MainContext.SYSTEM_ORGI) ;
|
||||
}
|
||||
if(user==null){
|
||||
user = new User();
|
||||
user.setId(UKTools.getContextID(request.getSession().getId())) ;
|
||||
user.setUsername(UKDataContext.GUEST_USER+"_"+UKTools.genIDByKey(user.getId())) ;
|
||||
user.setOrgi(UKDataContext.SYSTEM_ORGI);
|
||||
user.setId(MainUtils.getContextID(request.getSession().getId())) ;
|
||||
user.setUsername(MainContext.GUEST_USER+"_"+ MainUtils.genIDByKey(user.getId())) ;
|
||||
user.setOrgi(MainContext.SYSTEM_ORGI);
|
||||
user.setSessionid(user.getId()) ;
|
||||
}
|
||||
}else{
|
||||
@ -179,7 +179,7 @@ public class Handler {
|
||||
if(!StringUtils.isBlank(request.getParameter("callbegin"))) {
|
||||
try {
|
||||
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").from(UKTools.dateFormate.parse(request.getParameter("callbegin")).getTime()) ;
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").from(MainUtils.dateFormate.parse(request.getParameter("callbegin")).getTime()) ;
|
||||
} catch (ParseException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
@ -190,9 +190,9 @@ public class Handler {
|
||||
try {
|
||||
|
||||
if(rangeQuery == null) {
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").to(UKTools.dateFormate.parse(request.getParameter("callend")).getTime()) ;
|
||||
rangeQuery = QueryBuilders.rangeQuery("calltime").to(MainUtils.dateFormate.parse(request.getParameter("callend")).getTime()) ;
|
||||
}else {
|
||||
rangeQuery.to(UKTools.dateFormate.parse(request.getParameter("callend")).getTime()) ;
|
||||
rangeQuery.to(MainUtils.dateFormate.parse(request.getParameter("callend")).getTime()) ;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
|
||||
@ -209,7 +209,7 @@ public class Handler {
|
||||
if(!StringUtils.isBlank(request.getParameter("apbegin"))) {
|
||||
try {
|
||||
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").from(UKTools.dateFormate.parse(request.getParameter("apbegin")).getTime()) ;
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").from(MainUtils.dateFormate.parse(request.getParameter("apbegin")).getTime()) ;
|
||||
} catch (ParseException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
@ -220,9 +220,9 @@ public class Handler {
|
||||
try {
|
||||
|
||||
if(rangeQuery == null) {
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").to(UKTools.dateFormate.parse(request.getParameter("apend")).getTime()) ;
|
||||
rangeQuery = QueryBuilders.rangeQuery("aptime").to(MainUtils.dateFormate.parse(request.getParameter("apend")).getTime()) ;
|
||||
}else {
|
||||
rangeQuery.to(UKTools.dateFormate.parse(request.getParameter("apend")).getTime()) ;
|
||||
rangeQuery.to(MainUtils.dateFormate.parse(request.getParameter("apend")).getTime()) ;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
|
||||
@ -265,29 +265,29 @@ public class Handler {
|
||||
}
|
||||
|
||||
public User getIMUser(HttpServletRequest request , String userid , String nickname){
|
||||
User user = (User) request.getSession(true).getAttribute(UKDataContext.IM_USER_SESSION_NAME) ;
|
||||
User user = (User) request.getSession(true).getAttribute(MainContext.IM_USER_SESSION_NAME) ;
|
||||
if(user==null){
|
||||
user = new User();
|
||||
if(!StringUtils.isBlank(userid)){
|
||||
user.setId(userid) ;
|
||||
}else{
|
||||
user.setId(UKTools.getContextID(request.getSession().getId())) ;
|
||||
user.setId(MainUtils.getContextID(request.getSession().getId())) ;
|
||||
}
|
||||
if(!StringUtils.isBlank(nickname)){
|
||||
user.setUsername(nickname);
|
||||
}else{
|
||||
user.setUsername(UKDataContext.GUEST_USER+"_"+UKTools.genIDByKey(user.getId())) ;
|
||||
user.setUsername(MainContext.GUEST_USER+"_"+ MainUtils.genIDByKey(user.getId())) ;
|
||||
}
|
||||
user.setSessionid(user.getId()) ;
|
||||
}else{
|
||||
user.setSessionid(UKTools.getContextID(request.getSession().getId())) ;
|
||||
user.setSessionid(MainUtils.getContextID(request.getSession().getId())) ;
|
||||
}
|
||||
return user ;
|
||||
}
|
||||
|
||||
public void setUser(HttpServletRequest request , User user){
|
||||
request.getSession(true).removeAttribute(UKDataContext.USER_SESSION_NAME) ;
|
||||
request.getSession(true).setAttribute(UKDataContext.USER_SESSION_NAME , user) ;
|
||||
request.getSession(true).removeAttribute(MainContext.USER_SESSION_NAME) ;
|
||||
request.getSession(true).setAttribute(MainContext.USER_SESSION_NAME , user) ;
|
||||
}
|
||||
|
||||
|
||||
@ -296,16 +296,16 @@ public class Handler {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public UKView createAdminTempletResponse(String page) {
|
||||
return new UKView("/admin/include/tpl" , page);
|
||||
public Viewport createAdminTempletResponse(String page) {
|
||||
return new Viewport("/admin/include/tpl" , page);
|
||||
}
|
||||
/**
|
||||
* 创建系统监控的 模板页面
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public UKView createAppsTempletResponse(String page) {
|
||||
return new UKView("/apps/include/tpl" , page);
|
||||
public Viewport createAppsTempletResponse(String page) {
|
||||
return new Viewport("/apps/include/tpl" , page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -313,12 +313,12 @@ public class Handler {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public UKView createEntIMTempletResponse(String page) {
|
||||
return new UKView("/apps/entim/include/tpl" , page);
|
||||
public Viewport createEntIMTempletResponse(String page) {
|
||||
return new Viewport("/apps/entim/include/tpl" , page);
|
||||
}
|
||||
|
||||
public UKView createRequestPageTempletResponse(String page) {
|
||||
return new UKView(page);
|
||||
public Viewport createRequestPageTempletResponse(String page) {
|
||||
return new Viewport(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,7 +326,7 @@ public class Handler {
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView request(UKView data) {
|
||||
public ModelAndView request(Viewport data) {
|
||||
return new ModelAndView(data.getTemplet()!=null ? data.getTemplet(): data.getPage() , "data", data) ;
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ public class Handler {
|
||||
* @return
|
||||
*/
|
||||
public String getOrgiByTenantshare(HttpServletRequest request){
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if(systemConfig!=null&&systemConfig.isEnabletneant()&&systemConfig.isTenantshare()) {
|
||||
User user = this.getUser(request) ;
|
||||
return user.getOrgid();
|
||||
@ -415,7 +415,7 @@ public class Handler {
|
||||
* @return
|
||||
*/
|
||||
public boolean isTenantshare(){
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if(systemConfig!=null&&systemConfig.isEnabletneant()&&systemConfig.isTenantshare()) {
|
||||
return true;
|
||||
}
|
||||
@ -427,7 +427,7 @@ public class Handler {
|
||||
* @return
|
||||
*/
|
||||
public boolean isEnabletneant(){
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if(systemConfig!=null&&systemConfig.isEnabletneant()) {
|
||||
return true;
|
||||
}
|
||||
@ -438,7 +438,7 @@ public class Handler {
|
||||
* @return
|
||||
*/
|
||||
public boolean isTenantconsole(){
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if(systemConfig!=null&&systemConfig.isEnabletneant()&&systemConfig.isTenantconsole()) {
|
||||
return true;
|
||||
}
|
@ -14,18 +14,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler;
|
||||
package com.chatopera.cc.app.handler;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.RoleAuthRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.webim.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.webim.web.model.*;
|
||||
import com.chatopera.cc.app.model.*;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.RoleAuthRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.util.OnlineUserUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -89,7 +89,7 @@ public class LoginController extends Handler {
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ModelAndView login(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value = "referer", required = false) String referer, @Valid String msg) throws NoSuchAlgorithmException {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
if (request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) == null) {
|
||||
if (request.getSession(true).getAttribute(MainContext.USER_SESSION_NAME) == null) {
|
||||
view = request(super.createRequestPageTempletResponse("/login"));
|
||||
if (!StringUtils.isBlank(request.getParameter("referer"))) {
|
||||
referer = request.getParameter("referer");
|
||||
@ -101,8 +101,8 @@ public class LoginController extends Handler {
|
||||
if (cookies != null) {
|
||||
for (Cookie cookie : cookies) {
|
||||
if (cookie != null && !StringUtils.isBlank(cookie.getName()) && !StringUtils.isBlank(cookie.getValue())) {
|
||||
if (cookie.getName().equals(UKDataContext.UKEFU_SYSTEM_COOKIES_FLAG)) {
|
||||
String flagid = UKTools.decryption(cookie.getValue());
|
||||
if (cookie.getName().equals(MainContext.UKEFU_SYSTEM_COOKIES_FLAG)) {
|
||||
String flagid = MainUtils.decryption(cookie.getValue());
|
||||
if (!StringUtils.isBlank(flagid)) {
|
||||
User user = userRepository.findById(flagid);
|
||||
if (user != null) {
|
||||
@ -117,7 +117,7 @@ public class LoginController extends Handler {
|
||||
if (!StringUtils.isBlank(msg)) {
|
||||
view.addObject("msg", msg);
|
||||
}
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (systemConfig != null && systemConfig.isEnableregorgi()) {
|
||||
view.addObject("show", true);
|
||||
}
|
||||
@ -131,18 +131,18 @@ public class LoginController extends Handler {
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ModelAndView login(HttpServletRequest request, HttpServletResponse response, @Valid User user, @Valid String referer, @Valid String sla) throws NoSuchAlgorithmException {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
if (request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) == null) {
|
||||
if (request.getSession(true).getAttribute(MainContext.USER_SESSION_NAME) == null) {
|
||||
if (user != null && user.getUsername() != null) {
|
||||
final User loginUser = userRepository.findByUsernameAndPasswordAndDatastatus(user.getUsername(), UKTools.md5(user.getPassword()), false);
|
||||
final User loginUser = userRepository.findByUsernameAndPasswordAndDatastatus(user.getUsername(), MainUtils.md5(user.getPassword()), false);
|
||||
if (loginUser != null && !StringUtils.isBlank(loginUser.getId())) {
|
||||
view = this.processLogin(request, response, view, loginUser, referer);
|
||||
if (!StringUtils.isBlank(sla) && sla.equals("1")) {
|
||||
Cookie flagid = new Cookie(UKDataContext.UKEFU_SYSTEM_COOKIES_FLAG, UKTools.encryption(loginUser.getId()));
|
||||
Cookie flagid = new Cookie(MainContext.UKEFU_SYSTEM_COOKIES_FLAG, MainUtils.encryption(loginUser.getId()));
|
||||
flagid.setMaxAge(7 * 24 * 60 * 60);
|
||||
response.addCookie(flagid);
|
||||
// add authorization code for rest api
|
||||
String auth = UKTools.getUUID();
|
||||
CacheHelper.getApiUserCacheBean().put(auth, loginUser, UKDataContext.SYSTEM_ORGI);
|
||||
String auth = MainUtils.getUUID();
|
||||
CacheHelper.getApiUserCacheBean().put(auth, loginUser, MainContext.SYSTEM_ORGI);
|
||||
response.addCookie((new Cookie("authorization", auth)));
|
||||
}
|
||||
} else {
|
||||
@ -154,7 +154,7 @@ public class LoginController extends Handler {
|
||||
}
|
||||
}
|
||||
}
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (systemConfig != null && systemConfig.isEnableregorgi()) {
|
||||
view.addObject("show", true);
|
||||
}
|
||||
@ -173,7 +173,7 @@ public class LoginController extends Handler {
|
||||
view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
}
|
||||
//登录成功 判断是否进入多租户页面
|
||||
SystemConfig systemConfig = UKTools.getSystemConfig();
|
||||
SystemConfig systemConfig = MainUtils.getSystemConfig();
|
||||
if (systemConfig != null && systemConfig.isEnabletneant() && systemConfig.isTenantconsole() && !loginUser.isSuperuser()) {
|
||||
view = request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index"));
|
||||
}
|
||||
@ -226,12 +226,12 @@ public class LoginController extends Handler {
|
||||
|
||||
@RequestMapping("/logout")
|
||||
public String logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
request.getSession().removeAttribute(UKDataContext.USER_SESSION_NAME);
|
||||
request.getSession().removeAttribute(MainContext.USER_SESSION_NAME);
|
||||
Cookie[] cookies = request.getCookies();
|
||||
if (cookies != null) {
|
||||
for (Cookie cookie : cookies) {
|
||||
if (cookie != null && !StringUtils.isBlank(cookie.getName()) && !StringUtils.isBlank(cookie.getValue())) {
|
||||
if (cookie.getName().equals(UKDataContext.UKEFU_SYSTEM_COOKIES_FLAG)) {
|
||||
if (cookie.getName().equals(MainContext.UKEFU_SYSTEM_COOKIES_FLAG)) {
|
||||
cookie.setMaxAge(0);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
@ -245,7 +245,7 @@ public class LoginController extends Handler {
|
||||
@Menu(type = "apps", subtype = "user", access = true)
|
||||
public ModelAndView register(HttpServletRequest request, HttpServletResponse response, @Valid String msg) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
if (request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) == null) {
|
||||
if (request.getSession(true).getAttribute(MainContext.USER_SESSION_NAME) == null) {
|
||||
view = request(super.createRequestPageTempletResponse("/register"));
|
||||
}
|
||||
if (!StringUtils.isBlank(msg)) {
|
||||
@ -265,13 +265,13 @@ public class LoginController extends Handler {
|
||||
user.setUname(user.getUsername());
|
||||
user.setUsertype("0");
|
||||
if (!StringUtils.isBlank(user.getPassword())) {
|
||||
user.setPassword(UKTools.md5(user.getPassword()));
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
user.setOrgi(super.getOrgiByTenantshare(request));
|
||||
/*if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
user.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
user.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
user.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}*/
|
||||
userRepository.save(user);
|
||||
OnlineUserUtils.clean(super.getOrgi(request));
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin;
|
||||
package com.chatopera.cc.app.handler.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@ -23,15 +23,18 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.algorithm.AutomaticServiceDist;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.client.NettyClients;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.OnlineUserRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserEventRepository;
|
||||
import com.chatopera.cc.webim.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.im.client.NettyClients;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.OnlineUserRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserEventRepository;
|
||||
import com.chatopera.cc.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -39,11 +42,8 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.acd.ServiceQuene;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@Controller
|
||||
public class AdminController extends Handler{
|
||||
@ -64,7 +64,7 @@ public class AdminController extends Handler{
|
||||
public ModelAndView index(ModelMap map ,HttpServletRequest request) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
User user = super.getUser(request) ;
|
||||
view.addObject("agentStatusReport",ServiceQuene.getAgentReport(user.getOrgi())) ;
|
||||
view.addObject("agentStatusReport", AutomaticServiceDist.getAgentReport(user.getOrgi())) ;
|
||||
view.addObject("agentStatus", CacheHelper.getAgentStatusCacheBean().getCacheObject(user.getId(), user.getOrgi())) ;
|
||||
|
||||
return view;
|
||||
@ -77,28 +77,28 @@ public class AdminController extends Handler{
|
||||
map.put("chatClients", NettyClients.getInstance().size()) ;
|
||||
map.put("systemCaches", CacheHelper.getSystemCacheBean().getSize()) ;
|
||||
|
||||
map.put("agentReport", ServiceQuene.getAgentReport(super.getOrgi(request))) ;
|
||||
map.put("webIMReport", UKTools.getWebIMReport(userEventRes.findByOrgiAndCreatetimeRange(super.getOrgi(request), UKTools.getStartTime() , UKTools.getEndTime()))) ;
|
||||
map.put("agentReport", AutomaticServiceDist.getAgentReport(super.getOrgi(request))) ;
|
||||
map.put("webIMReport", MainUtils.getWebIMReport(userEventRes.findByOrgiAndCreatetimeRange(super.getOrgi(request), MainUtils.getStartTime() , MainUtils.getEndTime()))) ;
|
||||
|
||||
map.put("agents",getAgent(request).size()) ;
|
||||
|
||||
map.put("webIMInvite", UKTools.getWebIMInviteStatus(onlineUserRes.findByOrgiAndStatus(super.getOrgi(request), UKDataContext.OnlineUserOperatorStatus.ONLINE.toString()))) ;
|
||||
map.put("webIMInvite", MainUtils.getWebIMInviteStatus(onlineUserRes.findByOrgiAndStatus(super.getOrgi(request), MainContext.OnlineUserOperatorStatus.ONLINE.toString()))) ;
|
||||
|
||||
map.put("inviteResult", UKTools.getWebIMInviteResult(onlineUserRes.findByOrgiAndAgentnoAndCreatetimeRange(super.getOrgi(request), super.getUser(request).getId() , UKTools.getStartTime() , UKTools.getEndTime()))) ;
|
||||
map.put("inviteResult", MainUtils.getWebIMInviteResult(onlineUserRes.findByOrgiAndAgentnoAndCreatetimeRange(super.getOrgi(request), super.getUser(request).getId() , MainUtils.getStartTime() , MainUtils.getEndTime()))) ;
|
||||
|
||||
map.put("agentUserCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), UKDataContext.AgentUserStatusEnum.INSERVICE.toString(),super.getUser(request).getId() , UKTools.getStartTime() , UKTools.getEndTime())) ;
|
||||
map.put("agentUserCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), MainContext.AgentUserStatusEnum.INSERVICE.toString(),super.getUser(request).getId() , MainUtils.getStartTime() , MainUtils.getEndTime())) ;
|
||||
|
||||
map.put("agentServicesCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), UKDataContext.AgentUserStatusEnum.END.toString(),super.getUser(request).getId() , UKTools.getStartTime() , UKTools.getEndTime())) ;
|
||||
map.put("agentServicesCount", onlineUserRes.countByAgentForAgentUser(super.getOrgi(request), MainContext.AgentUserStatusEnum.END.toString(),super.getUser(request).getId() , MainUtils.getStartTime() , MainUtils.getEndTime())) ;
|
||||
|
||||
map.put("agentServicesAvg", onlineUserRes.countByAgentForAvagTime(super.getOrgi(request), UKDataContext.AgentUserStatusEnum.END.toString(),super.getUser(request).getId() , UKTools.getStartTime() , UKTools.getEndTime())) ;
|
||||
map.put("agentServicesAvg", onlineUserRes.countByAgentForAvagTime(super.getOrgi(request), MainContext.AgentUserStatusEnum.END.toString(),super.getUser(request).getId() , MainUtils.getStartTime() , MainUtils.getEndTime())) ;
|
||||
|
||||
map.put("webInviteReport", UKTools.getWebIMInviteAgg(onlineUserRes.findByOrgiAndCreatetimeRange(super.getOrgi(request) , UKDataContext.ChannelTypeEnum.WEBIM.toString(),UKTools.getLast30Day(), UKTools.getEndTime()))) ;
|
||||
map.put("webInviteReport", MainUtils.getWebIMInviteAgg(onlineUserRes.findByOrgiAndCreatetimeRange(super.getOrgi(request) , MainContext.ChannelTypeEnum.WEBIM.toString(), MainUtils.getLast30Day(), MainUtils.getEndTime()))) ;
|
||||
|
||||
map.put("agentConsultReport", UKTools.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForAgent(super.getOrgi(request), UKTools.getLast30Day(), UKTools.getEndTime()))) ;
|
||||
map.put("agentConsultReport", MainUtils.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForAgent(super.getOrgi(request), MainUtils.getLast30Day(), MainUtils.getEndTime()))) ;
|
||||
|
||||
map.put("clentConsultReport", UKTools.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForClient(super.getOrgi(request), UKTools.getLast30Day(), UKTools.getEndTime() , UKDataContext.ChannelTypeEnum.WEBIM.toString()))) ;
|
||||
map.put("clentConsultReport", MainUtils.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForClient(super.getOrgi(request), MainUtils.getLast30Day(), MainUtils.getEndTime() , MainContext.ChannelTypeEnum.WEBIM.toString()))) ;
|
||||
|
||||
map.put("browserConsultReport", UKTools.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForBrowser(super.getOrgi(request), UKTools.getLast30Day(), UKTools.getEndTime(), UKDataContext.ChannelTypeEnum.WEBIM.toString()))) ;
|
||||
map.put("browserConsultReport", MainUtils.getWebIMDataAgg(onlineUserRes.findByOrgiAndCreatetimeRangeForBrowser(super.getOrgi(request), MainUtils.getLast30Day(), MainUtils.getEndTime(), MainContext.ChannelTypeEnum.WEBIM.toString()))) ;
|
||||
}
|
||||
private List<User> getAgent(HttpServletRequest request){
|
||||
//获取当前产品or租户坐席数
|
||||
@ -127,11 +127,11 @@ public class AdminController extends Handler{
|
||||
@RequestMapping("/admin/auth/infoacq")
|
||||
@Menu(type = "admin" , subtype = "infoacq" , access= false , admin = true)
|
||||
public ModelAndView infoacq(ModelMap map , HttpServletRequest request) {
|
||||
String inacq = (String) request.getSession().getAttribute(UKDataContext.UKEFU_SYSTEM_INFOACQ) ;
|
||||
String inacq = (String) request.getSession().getAttribute(MainContext.UKEFU_SYSTEM_INFOACQ) ;
|
||||
if(!StringUtils.isBlank(inacq)){
|
||||
request.getSession().removeAttribute(UKDataContext.UKEFU_SYSTEM_INFOACQ);
|
||||
request.getSession().removeAttribute(MainContext.UKEFU_SYSTEM_INFOACQ);
|
||||
}else{
|
||||
request.getSession().setAttribute(UKDataContext.UKEFU_SYSTEM_INFOACQ , "true");
|
||||
request.getSession().setAttribute(MainContext.UKEFU_SYSTEM_INFOACQ , "true");
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/"));
|
||||
}
|
||||
@ -142,15 +142,15 @@ public class AdminController extends Handler{
|
||||
map.addAttribute("title", title) ;
|
||||
map.addAttribute("url", url) ;
|
||||
if(!StringUtils.isBlank(iconstr) && !StringUtils.isBlank(icontext)){
|
||||
map.addAttribute("iconstr", iconstr.replaceAll(icontext, "&#x"+UKTools.string2HexString(icontext)+";")) ;
|
||||
map.addAttribute("iconstr", iconstr.replaceAll(icontext, "&#x"+ MainUtils.string2HexString(icontext)+";")) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/auth/event"));
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/auth/exchange"));
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/auth/save")
|
||||
@Menu(type = "admin" , subtype = "authsave")
|
||||
public ModelAndView authsave(ModelMap map , HttpServletRequest request , @Valid String title , @Valid SysDic dic) {
|
||||
SysDic sysDic = sysDicRes.findByCode(UKDataContext.UKEFU_SYSTEM_AUTH_DIC) ;
|
||||
SysDic sysDic = sysDicRes.findByCode(MainContext.UKEFU_SYSTEM_AUTH_DIC) ;
|
||||
boolean newdic = false ;
|
||||
if(sysDic!=null && !StringUtils.isBlank(dic.getName())){
|
||||
if(!StringUtils.isBlank(dic.getParentid())){
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.area;
|
||||
package com.chatopera.cc.app.handler.admin.area;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -23,21 +23,21 @@ import java.util.Date;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.repository.AreaTypeRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.AreaType;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.persistence.repository.AreaTypeRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.AreaType;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -66,12 +66,12 @@ public class AreaController extends Handler{
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "area")
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request) {
|
||||
SysDic sysDic = sysDicRepository.findByCode(UKDataContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
SysDic sysDic = sysDicRepository.findByCode(MainContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
if(sysDic!=null){
|
||||
map.addAttribute("sysarea", sysDic) ;
|
||||
map.addAttribute("areaList", sysDicRepository.findByDicid(sysDic.getId())) ;
|
||||
}
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(MainContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/area/add"));
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class AreaController extends Handler{
|
||||
area.setCreatetime(new Date());
|
||||
area.setCreater(super.getUser(request).getId());
|
||||
areaRepository.save(area) ;
|
||||
UKTools.initSystemArea();
|
||||
MainUtils.initSystemArea();
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/area/index.html"));
|
||||
}
|
||||
@ -94,12 +94,12 @@ public class AreaController extends Handler{
|
||||
public ModelAndView edit(ModelMap map ,HttpServletRequest request , @Valid String id) {
|
||||
map.addAttribute("area", areaRepository.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
|
||||
SysDic sysDic = sysDicRepository.findByCode(UKDataContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
SysDic sysDic = sysDicRepository.findByCode(MainContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
if(sysDic!=null){
|
||||
map.addAttribute("sysarea", sysDic) ;
|
||||
map.addAttribute("areaList", sysDicRepository.findByDicid(sysDic.getId())) ;
|
||||
}
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(MainContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/area/edit"));
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public class AreaController extends Handler{
|
||||
area.setOrgi(super.getOrgi(request));
|
||||
area.setCreater(areaType.getCreater());
|
||||
areaRepository.save(area) ;
|
||||
UKTools.initSystemArea();
|
||||
MainUtils.initSystemArea();
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/area/index.html"));
|
||||
}
|
||||
@ -123,7 +123,7 @@ public class AreaController extends Handler{
|
||||
AreaType areaType = areaRepository.findByIdAndOrgi(area.getId(), super.getOrgi(request)) ;
|
||||
if(areaType!=null){
|
||||
areaRepository.delete(areaType);
|
||||
UKTools.initSystemArea();
|
||||
MainUtils.initSystemArea();
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/area/index.html"));
|
||||
}
|
@ -14,15 +14,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Acl;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Acl;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -30,7 +30,7 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.AclRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.AclRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
@ -14,11 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -26,11 +27,10 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.BlackListRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.BlackEntity;
|
||||
import com.chatopera.cc.app.persistence.repository.BlackListRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.BlackEntity;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@ -63,7 +63,7 @@ public class CallCenterBlackController extends Handler{
|
||||
if(count == 0){
|
||||
BlackEntity be = new BlackEntity();
|
||||
be.setPhone(ph.trim());
|
||||
be.setChannel(UKDataContext.ChannelTypeEnum.PHONE.toString());
|
||||
be.setChannel(MainContext.ChannelTypeEnum.PHONE.toString());
|
||||
be.setOrgi(super.getOrgi(request));
|
||||
be.setCreater(super.getUser(request).getId());
|
||||
blackRes.save(be) ;
|
||||
@ -88,7 +88,7 @@ public class CallCenterBlackController extends Handler{
|
||||
BlackEntity oldBlack = blackRes.findByIdAndOrgi(black.getId(), super.getOrgi(request)) ;
|
||||
if(oldBlack!=null){
|
||||
oldBlack.setPhone(black.getPhone());
|
||||
oldBlack.setChannel(UKDataContext.ChannelTypeEnum.PHONE.toString());
|
||||
oldBlack.setChannel(MainContext.ChannelTypeEnum.PHONE.toString());
|
||||
oldBlack.setOrgi(super.getOrgi(request));
|
||||
blackRes.save(oldBlack);
|
||||
}
|
@ -14,19 +14,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.extra.CallCenterInterface;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.PbxHost;
|
||||
import com.chatopera.cc.exchange.CallCenterInterface;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.PbxHost;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -45,8 +45,8 @@ public class CallCenterController extends Handler {
|
||||
@Menu(type = "callcenter" , subtype = "callcenter" , access = false , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String msg) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request)) ;
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
|
||||
for(PbxHost pbxHost : pbxHostList){
|
||||
if(callCenterImpl!=null){
|
||||
@ -62,8 +62,8 @@ public class CallCenterController extends Handler {
|
||||
@Menu(type = "callcenter" , subtype = "pbxhost" , access = false , admin = true)
|
||||
public ModelAndView pbxhost(ModelMap map , HttpServletRequest request) {
|
||||
List<PbxHost> pbxHostList = pbxHostRes.findByOrgi(super.getOrgi(request)) ;
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
|
||||
for(PbxHost pbxHost : pbxHostList){
|
||||
if(callCenterImpl!=null){
|
||||
@ -92,8 +92,8 @@ public class CallCenterController extends Handler {
|
||||
pbxHost.setOrgi(super.getOrgi(request));
|
||||
pbxHost.setCreater(super.getUser(request).getId());
|
||||
pbxHostRes.save(pbxHost) ;
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
if(callCenterImpl!=null){
|
||||
try{
|
||||
callCenterImpl.init(pbxHost);
|
||||
@ -133,8 +133,8 @@ public class CallCenterController extends Handler {
|
||||
destHost.setPassword(pbxHost.getPassword());
|
||||
}
|
||||
pbxHostRes.save(destHost) ;
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
if(callCenterImpl!=null){
|
||||
try{
|
||||
callCenterImpl.init(destHost);
|
||||
@ -156,8 +156,8 @@ public class CallCenterController extends Handler {
|
||||
public ModelAndView mediadelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
if(!StringUtils.isBlank(id)){
|
||||
pbxHostRes.delete(id);
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
if(callCenterImpl!=null){
|
||||
callCenterImpl.remove(id);
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -23,11 +23,11 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ProductRepository;
|
||||
import com.chatopera.cc.webim.web.model.PbxHost;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ProductRepository;
|
||||
import com.chatopera.cc.app.model.PbxHost;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -36,14 +36,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.freeswitch.model.CallCenterAgent;
|
||||
import com.chatopera.cc.webim.service.impl.CallOutQuene;
|
||||
import com.chatopera.cc.webim.service.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.webim.service.repository.MediaRepository;
|
||||
import com.chatopera.cc.webim.service.repository.QueSurveyProcessRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SipTrunkRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Extention;
|
||||
import com.chatopera.cc.app.persistence.impl.CallOutQuene;
|
||||
import com.chatopera.cc.app.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.MediaRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.QueSurveyProcessRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SipTrunkRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Extention;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -28,10 +28,10 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.webim.service.repository.IvrMenuRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Extention;
|
||||
import com.chatopera.cc.app.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.IvrMenuRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Extention;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -34,11 +34,11 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.repository.MediaRepository;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Media;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.persistence.repository.MediaRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Media;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@ -79,7 +79,7 @@ public class CallCenterMediaController extends Handler{
|
||||
if(!StringUtils.isBlank(media.getName())){
|
||||
int count = mediaRes.countByNameAndOrgi(media.getName(), super.getOrgi(request)) ;
|
||||
if(count == 0){
|
||||
String fileName = "media/"+UKTools.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String fileName = "media/"+ MainUtils.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
|
||||
media.setOrgi(super.getOrgi(request));
|
||||
media.setCreater(super.getUser(request).getId());
|
||||
@ -125,7 +125,7 @@ public class CallCenterMediaController extends Handler{
|
||||
wavFile.deleteOnExit();
|
||||
}
|
||||
|
||||
String fileName = "media/"+UKTools.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String fileName = "media/"+ MainUtils.getUUID()+mediafile.getOriginalFilename().substring(mediafile.getOriginalFilename().lastIndexOf(".")) ;
|
||||
oldMedia.setFilename(fileName);
|
||||
|
||||
if(mediafile!=null && mediafile.getOriginalFilename().lastIndexOf(".") > 0){
|
@ -14,20 +14,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.extra.CallCenterInterface;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.PbxHost;
|
||||
import com.chatopera.cc.exchange.CallCenterInterface;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.PbxHost;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -35,7 +35,7 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ExtentionRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
||||
@ -92,8 +92,8 @@ public class CallCenterResourceController extends Handler {
|
||||
pbxHost.setOrgi(super.getOrgi(request));
|
||||
pbxHostRes.save(pbxHost) ;
|
||||
|
||||
if(UKDataContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) UKDataContext.getContext().getBean("callcenter") ;
|
||||
if(MainContext.model.get("callcenter")!=null){
|
||||
CallCenterInterface callCenterImpl = (CallCenterInterface) MainContext.getContext().getBean("callcenter") ;
|
||||
callCenterImpl.init(pbxHost);
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.web.model.PbxHost;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.model.PbxHost;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -31,9 +31,9 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.RouterRulesRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.RouterRules;
|
||||
import com.chatopera.cc.app.persistence.repository.RouterRulesRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.RouterRules;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
@ -14,15 +14,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.web.model.SipTrunk;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.model.SipTrunk;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -30,8 +30,8 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.SipTrunkRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.persistence.repository.SipTrunkRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/callcenter")
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.callcenter;
|
||||
package com.chatopera.cc.app.handler.admin.callcenter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -23,15 +23,15 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.CallCenterSkillRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.webim.service.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SkillExtentionRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.CallCenterSkill;
|
||||
import com.chatopera.cc.webim.web.model.Extention;
|
||||
import com.chatopera.cc.webim.web.model.PbxHost;
|
||||
import com.chatopera.cc.webim.web.model.SkillExtention;
|
||||
import com.chatopera.cc.app.persistence.repository.CallCenterSkillRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ExtentionRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.PbxHostRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SkillExtentionRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.CallCenterSkill;
|
||||
import com.chatopera.cc.app.model.Extention;
|
||||
import com.chatopera.cc.app.model.PbxHost;
|
||||
import com.chatopera.cc.app.model.SkillExtention;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
@ -13,20 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.channel;
|
||||
package com.chatopera.cc.app.handler.admin.channel;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.Base62;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.exception.CSKefuException;
|
||||
import com.chatopera.cc.webim.service.repository.ConsultInviteRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SecretRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.CousultInvite;
|
||||
import com.chatopera.cc.webim.web.model.SNSAccount;
|
||||
import com.chatopera.cc.webim.web.model.Secret;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.exception.CSKefuException;
|
||||
import com.chatopera.cc.app.persistence.repository.ConsultInviteRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SecretRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.CousultInvite;
|
||||
import com.chatopera.cc.app.model.SNSAccount;
|
||||
import com.chatopera.cc.app.model.Secret;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -56,7 +55,7 @@ public class CalloutChannelController extends Handler {
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "callout" , subtype = "channel" , access = false ,admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String execute) {
|
||||
map.addAttribute("snsAccountList", snsAccountRes.findBySnstypeAndOrgi( UKDataContext.ChannelTypeEnum.PHONE.toString() , super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request)))) ;
|
||||
map.addAttribute("snsAccountList", snsAccountRes.findBySnstypeAndOrgi( MainContext.ChannelTypeEnum.PHONE.toString() , super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request)))) ;
|
||||
List<Secret> secretConfig = secRes.findByOrgi(super.getOrgi(request)) ;
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
map.addAttribute("secret", secretConfig.get(0)) ;
|
||||
@ -81,7 +80,7 @@ public class CalloutChannelController extends Handler {
|
||||
int count = snsAccountRes.countBySnsidAndOrgi(snsAccount.getSnsid() , super.getOrgi(request)) ;
|
||||
if(count == 0){
|
||||
snsAccount.setOrgi(super.getOrgi(request));
|
||||
snsAccount.setSnstype(UKDataContext.ChannelTypeEnum.PHONE.toString());
|
||||
snsAccount.setSnstype(MainContext.ChannelTypeEnum.PHONE.toString());
|
||||
snsAccount.setCreatetime(new Date());
|
||||
snsAccountRes.save(snsAccount) ;
|
||||
|
||||
@ -108,7 +107,7 @@ public class CalloutChannelController extends Handler {
|
||||
@Menu(type = "callout" , subtype = "delete")
|
||||
public ModelAndView delete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String confirm) {
|
||||
boolean execute = false ;
|
||||
if(execute = UKTools.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
if(execute = MainUtils.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
SNSAccount snsAccount = snsAccountRes.findByIdAndOrgi(id , super.getOrgi(request)) ;
|
||||
if(snsAccountRes!=null){
|
||||
snsAccountRes.delete(snsAccount);
|
||||
@ -155,7 +154,7 @@ public class CalloutChannelController extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
oldSnsAccount.setSnstype(UKDataContext.ChannelTypeEnum.PHONE.toString());
|
||||
oldSnsAccount.setSnstype(MainContext.ChannelTypeEnum.PHONE.toString());
|
||||
snsAccountRes.save(oldSnsAccount) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/callout/index.html"));
|
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (C) 2017 优客服-多渠道客服系统
|
||||
* Modifications copyright (C) 2018 Chatopera Inc, <https://www.chatopera.com>
|
||||
*
|
||||
* 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.chatopera.cc.app.handler.admin.channel;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Base62;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.persistence.repository.ConsultInviteRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SecretRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.CousultInvite;
|
||||
import com.chatopera.cc.app.model.SNSAccount;
|
||||
import com.chatopera.cc.app.model.Secret;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/im")
|
||||
public class SNSAccountIMController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private SNSAccountRepository snsAccountRes;
|
||||
|
||||
@Autowired
|
||||
private ConsultInviteRepository invite;
|
||||
|
||||
@Autowired
|
||||
private SecretRepository secRes;
|
||||
|
||||
@Autowired
|
||||
private OrganRepository organRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin", subtype = "im", access = false, admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String execute) {
|
||||
map.addAttribute("snsAccountList", snsAccountRes.findBySnstypeAndOrgi(MainContext.ChannelTypeEnum.WEBIM.toString(), super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request))));
|
||||
List<Secret> secretConfig = secRes.findByOrgi(super.getOrgi(request));
|
||||
if (secretConfig != null && secretConfig.size() > 0) {
|
||||
map.addAttribute("secret", secretConfig.get(0));
|
||||
}
|
||||
if (!StringUtils.isBlank(execute) && execute.equals("false")) {
|
||||
map.addAttribute("execute", execute);
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/channel/im/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin", subtype = "im", access = false, admin = true)
|
||||
public ModelAndView add(ModelMap map, HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/channel/im/add"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin", subtype = "weixin")
|
||||
public ModelAndView save(HttpServletRequest request, @Valid SNSAccount snsAccount) throws NoSuchAlgorithmException {
|
||||
if (!StringUtils.isBlank(snsAccount.getBaseURL())) {
|
||||
snsAccount.setSnsid(Base62.encode(snsAccount.getBaseURL()).toLowerCase());
|
||||
int count = snsAccountRes.countBySnsidAndOrgi(snsAccount.getSnsid(), super.getOrgi(request));
|
||||
if (count == 0) {
|
||||
snsAccount.setOrgi(super.getOrgi(request));
|
||||
snsAccount.setSnstype(MainContext.ChannelTypeEnum.WEBIM.toString());
|
||||
snsAccount.setCreatetime(new Date());
|
||||
User curr = super.getUser(request);
|
||||
snsAccount.setCreater(curr.getId());
|
||||
if (curr.getOrgan() != null) {
|
||||
snsAccount.setOrgan(curr.getOrgan());
|
||||
}
|
||||
|
||||
snsAccountRes.save(snsAccount);
|
||||
|
||||
/**
|
||||
* 同时创建CousultInvite 记录
|
||||
*/
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsAccount.getSnsid(), super.getOrgi(request));
|
||||
if (coultInvite == null) {
|
||||
coultInvite = new CousultInvite();
|
||||
coultInvite.setSnsaccountid(snsAccount.getSnsid());
|
||||
coultInvite.setCreate_time(new Date());
|
||||
coultInvite.setOrgi(super.getOrgi(request));
|
||||
coultInvite.setName(snsAccount.getName());
|
||||
coultInvite.setOwner(snsAccount.getCreater());
|
||||
invite.save(coultInvite);
|
||||
}
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/im/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "weixin", subtype = "delete")
|
||||
public ModelAndView delete(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String confirm) {
|
||||
boolean execute = false;
|
||||
if (execute = MainUtils.secConfirm(secRes, super.getOrgi(request), confirm)) {
|
||||
SNSAccount snsAccount = snsAccountRes.findByIdAndOrgi(id, super.getOrgi(request));
|
||||
if (snsAccountRes != null) {
|
||||
snsAccountRes.delete(snsAccount);
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsAccount.getSnsid(), super.getOrgi(request));
|
||||
if (coultInvite != null) {
|
||||
invite.delete(coultInvite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/im/index.html?execute=" + execute));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin", subtype = "im", access = false, admin = true)
|
||||
public ModelAndView edit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
map.addAttribute("snsAccount", snsAccountRes.findByIdAndOrgi(id, super.getOrgi(request)));
|
||||
return request(super.createRequestPageTempletResponse("/admin/channel/im/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin", subtype = "im", access = false, admin = true)
|
||||
public ModelAndView update(HttpServletRequest request, @Valid SNSAccount snsAccount) throws NoSuchAlgorithmException {
|
||||
SNSAccount oldSnsAccount = snsAccountRes.findByIdAndOrgi(snsAccount.getId(), super.getOrgi(request));
|
||||
if (oldSnsAccount != null) {
|
||||
oldSnsAccount.setName(snsAccount.getName());
|
||||
oldSnsAccount.setBaseURL(snsAccount.getBaseURL());
|
||||
oldSnsAccount.setUpdatetime(new Date());
|
||||
/**
|
||||
* SNSID如果有变更,需要同时变更 CoultInvite 表的 记录
|
||||
*/
|
||||
if (!StringUtils.isBlank(oldSnsAccount.getSnsid())) {
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(oldSnsAccount.getSnsid(), super.getOrgi(request));
|
||||
if (coultInvite == null) {
|
||||
/**
|
||||
* 同时创建CousultInvite 记录
|
||||
*/
|
||||
coultInvite = new CousultInvite();
|
||||
coultInvite.setSnsaccountid(oldSnsAccount.getSnsid());
|
||||
coultInvite.setCreate_time(new Date());
|
||||
coultInvite.setOrgi(super.getOrgi(request));
|
||||
coultInvite.setName(snsAccount.getName());
|
||||
invite.save(coultInvite);
|
||||
}
|
||||
}
|
||||
|
||||
oldSnsAccount.setSnstype(MainContext.ChannelTypeEnum.WEBIM.toString());
|
||||
snsAccountRes.save(oldSnsAccount);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/im/index.html"));
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.channel;
|
||||
package com.chatopera.cc.app.handler.admin.channel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -25,12 +25,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.CousultInvite;
|
||||
import com.chatopera.cc.webim.web.model.Organ;
|
||||
import com.chatopera.cc.webim.web.model.OrgiSkillRel;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.CousultInvite;
|
||||
import com.chatopera.cc.app.model.Organ;
|
||||
import com.chatopera.cc.app.model.OrgiSkillRel;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -42,12 +42,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.ConsultInviteRepository;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.OrgiSkillRelRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.webim.service.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ConsultInviteRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OrgiSkillRelRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.ServiceAiRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/webim")
|
||||
@ -75,7 +75,7 @@ public class WebIMController extends Handler {
|
||||
private SNSAccountRepository snsAccountRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "webim" , subtype = "webim" , admin= true)
|
||||
@Menu(type = "app" , subtype = "app" , admin= true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String snsid) {
|
||||
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsid, super.getOrgi(request)) ;
|
||||
@ -88,11 +88,11 @@ public class WebIMController extends Handler {
|
||||
|
||||
map.addAttribute("snsAccount", snsAccountRes.findBySnsidAndOrgi(snsid, super.getOrgi(request))) ;
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/webim/index"));
|
||||
return request(super.createAdminTempletResponse("/admin/app/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "webim" , admin= true)
|
||||
@Menu(type = "admin" , subtype = "app" , admin= true)
|
||||
public ModelAndView save(HttpServletRequest request , @Valid CousultInvite inviteData , @RequestParam(value = "webimlogo", required = false) MultipartFile webimlogo,@RequestParam(value = "agentheadimg", required = false) MultipartFile agentheadimg) throws IOException {
|
||||
if(!StringUtils.isBlank(inviteData.getSnsaccountid())){
|
||||
CousultInvite tempData = invite.findBySnsaccountidAndOrgi(inviteData.getSnsaccountid() , super.getOrgi(request)) ;
|
||||
@ -131,11 +131,11 @@ public class WebIMController extends Handler {
|
||||
invite.save(inviteData) ;
|
||||
CacheHelper.getSystemCacheBean().put(inviteData.getSnsaccountid(), inviteData, inviteData.getOrgi());
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/webim/index.html?snsid="+inviteData.getSnsaccountid()));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/app/index.html?snsid="+inviteData.getSnsaccountid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/profile")
|
||||
@Menu(type = "webim" , subtype = "profile" , admin= true)
|
||||
@Menu(type = "app" , subtype = "profile" , admin= true)
|
||||
public ModelAndView profile(ModelMap map , HttpServletRequest request , @Valid String snsid) {
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsid, super.getOrgi(request)) ;
|
||||
if(coultInvite!=null){
|
||||
@ -145,7 +145,7 @@ public class WebIMController extends Handler {
|
||||
map.addAttribute("snsAccount", snsAccountRes.findBySnsidAndOrgi(snsid, super.getOrgi(request))) ;
|
||||
|
||||
map.put("serviceAiList",serviceAiRes.findByOrgi(super.getOrgi(request)) ) ;
|
||||
return request(super.createAdminTempletResponse("/admin/webim/profile"));
|
||||
return request(super.createAdminTempletResponse("/admin/app/profile"));
|
||||
}
|
||||
|
||||
@RequestMapping("/profile/save")
|
||||
@ -220,11 +220,11 @@ public class WebIMController extends Handler {
|
||||
invite.save(inviteData) ;
|
||||
}
|
||||
CacheHelper.getSystemCacheBean().put(inviteData.getSnsaccountid(), inviteData, inviteData.getOrgi());
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/webim/profile.html?snsid="+inviteData.getSnsaccountid()));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/app/profile.html?snsid="+inviteData.getSnsaccountid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/invote")
|
||||
@Menu(type = "webim" , subtype = "invote" , admin= true)
|
||||
@Menu(type = "app" , subtype = "invote" , admin= true)
|
||||
public ModelAndView invote(ModelMap map , HttpServletRequest request , @Valid String snsid) {
|
||||
CousultInvite coultInvite = invite.findBySnsaccountidAndOrgi(snsid, super.getOrgi(request)) ;
|
||||
if(coultInvite!=null){
|
||||
@ -232,7 +232,7 @@ public class WebIMController extends Handler {
|
||||
}
|
||||
map.addAttribute("import", request.getServerPort()) ;
|
||||
map.addAttribute("snsAccount", snsAccountRes.findBySnsidAndOrgi(snsid, super.getOrgi(request))) ;
|
||||
return request(super.createAdminTempletResponse("/admin/webim/invote"));
|
||||
return request(super.createAdminTempletResponse("/admin/app/invote"));
|
||||
}
|
||||
|
||||
@RequestMapping("/invote/save")
|
||||
@ -266,7 +266,7 @@ public class WebIMController extends Handler {
|
||||
invite.save(inviteData) ;
|
||||
}
|
||||
CacheHelper.getSystemCacheBean().put(inviteData.getSnsaccountid(), inviteData, inviteData.getOrgi());
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/webim/invote.html?snsid="+inviteData.getSnsaccountid()));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/app/invote.html?snsid="+inviteData.getSnsaccountid()));
|
||||
}
|
||||
|
||||
/**
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.config;
|
||||
package com.chatopera.cc.app.handler.admin.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -28,14 +28,16 @@ import java.util.Properties;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.SecretRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SystemConfigRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SystemMessageRepository;
|
||||
import com.chatopera.cc.webim.service.repository.TemplateRepository;
|
||||
import com.chatopera.cc.webim.web.model.Secret;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.SecretRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SystemConfigRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SystemMessageRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TemplateRepository;
|
||||
import com.chatopera.cc.app.model.Secret;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -49,11 +51,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.corundumstudio.socketio.SocketIOServer;
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.SystemConfig;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.SystemConfig;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/config")
|
||||
@ -85,28 +85,28 @@ public class SystemConfigController extends Handler{
|
||||
@Menu(type = "admin" , subtype = "config" , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String execute) throws SQLException {
|
||||
map.addAttribute("server", server) ;
|
||||
if(UKDataContext.model.get("im")!=null){
|
||||
map.addAttribute("entim", UKDataContext.model.get("im")) ;
|
||||
if(MainContext.model.get("im")!=null){
|
||||
map.addAttribute("entim", MainContext.model.get("im")) ;
|
||||
}
|
||||
if(request.getSession().getAttribute(UKDataContext.UKEFU_SYSTEM_INFOACQ)!=null){
|
||||
map.addAttribute("entim", request.getSession().getAttribute(UKDataContext.UKEFU_SYSTEM_INFOACQ)) ;
|
||||
if(request.getSession().getAttribute(MainContext.UKEFU_SYSTEM_INFOACQ)!=null){
|
||||
map.addAttribute("entim", request.getSession().getAttribute(MainContext.UKEFU_SYSTEM_INFOACQ)) ;
|
||||
}
|
||||
map.addAttribute("server", server) ;
|
||||
map.addAttribute("imServerStatus", UKDataContext.getIMServerStatus()) ;
|
||||
map.addAttribute("imServerStatus", MainContext.getIMServerStatus()) ;
|
||||
List<Secret> secretConfig = secRes.findByOrgi(super.getOrgi(request)) ;
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
map.addAttribute("secret", secretConfig.get(0)) ;
|
||||
}
|
||||
List<SysDic> dicList = UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_DIC) ;
|
||||
List<SysDic> dicList = UKeFuDic.getInstance().getDic(MainContext.UKEFU_SYSTEM_DIC) ;
|
||||
SysDic callCenterDic = null , workOrderDic = null , smsDic = null ;
|
||||
for(SysDic dic : dicList){
|
||||
if(dic.getCode().equals(UKDataContext.UKEFU_SYSTEM_CALLCENTER)){
|
||||
if(dic.getCode().equals(MainContext.UKEFU_SYSTEM_CALLCENTER)){
|
||||
callCenterDic = dic ;
|
||||
}
|
||||
if(dic.getCode().equals(UKDataContext.UKEFU_SYSTEM_WORKORDEREMAIL)){
|
||||
if(dic.getCode().equals(MainContext.UKEFU_SYSTEM_WORKORDEREMAIL)){
|
||||
workOrderDic = dic ;
|
||||
}
|
||||
if(dic.getCode().equals(UKDataContext.UKEFU_SYSTEM_SMSEMAIL)){
|
||||
if(dic.getCode().equals(MainContext.UKEFU_SYSTEM_SMSEMAIL)){
|
||||
smsDic = dic ;
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class SystemConfigController extends Handler{
|
||||
map.addAttribute("smsList", templateRes.findByTemplettypeAndOrgi(smsDic.getId(), super.getOrgi(request))) ;
|
||||
}
|
||||
|
||||
map.addAttribute("sysMessageList", systemMessageRes.findByMsgtypeAndOrgi(UKDataContext.SystemMessageType.EMAIL.toString(), super.getOrgi(request))) ;
|
||||
map.addAttribute("sysMessageList", systemMessageRes.findByMsgtypeAndOrgi(MainContext.SystemMessageType.EMAIL.toString(), super.getOrgi(request))) ;
|
||||
|
||||
if(!StringUtils.isBlank(execute) && execute.equals("false")){
|
||||
map.addAttribute("execute", execute) ;
|
||||
@ -135,9 +135,9 @@ public class SystemConfigController extends Handler{
|
||||
@Menu(type = "admin" , subtype = "stopimserver" , access = false , admin = true)
|
||||
public ModelAndView stopimserver(ModelMap map , HttpServletRequest request , @Valid String confirm) throws SQLException {
|
||||
boolean execute = false ;
|
||||
if(execute = UKTools.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
if(execute = MainUtils.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
server.stop();
|
||||
UKDataContext.setIMServerStatus(false);
|
||||
MainContext.setIMServerStatus(false);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?execute="+execute));
|
||||
}
|
||||
@ -145,14 +145,14 @@ public class SystemConfigController extends Handler{
|
||||
@RequestMapping("/startentim")
|
||||
@Menu(type = "admin" , subtype = "startentim" , access = false , admin = true)
|
||||
public ModelAndView startentim(ModelMap map , HttpServletRequest request) throws SQLException {
|
||||
UKDataContext.model.put("im", true) ;
|
||||
MainContext.model.put("im", true) ;
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/stopentim")
|
||||
@Menu(type = "admin" , subtype = "stopentim" , access = false , admin = true)
|
||||
public ModelAndView stopentim(ModelMap map , HttpServletRequest request) throws SQLException {
|
||||
UKDataContext.model.remove("im") ;
|
||||
MainContext.model.remove("im") ;
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html"));
|
||||
}
|
||||
|
||||
@ -167,9 +167,9 @@ public class SystemConfigController extends Handler{
|
||||
@Menu(type = "admin" , subtype = "stop" , access = false , admin = true)
|
||||
public ModelAndView stop(ModelMap map , HttpServletRequest request , @Valid String confirm) throws SQLException {
|
||||
boolean execute = false ;
|
||||
if(execute = UKTools.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
if(execute = MainUtils.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
server.stop();
|
||||
UKDataContext.setIMServerStatus(false);
|
||||
MainContext.setIMServerStatus(false);
|
||||
System.exit(0);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?execute="+execute));
|
||||
@ -181,8 +181,8 @@ public class SystemConfigController extends Handler{
|
||||
public ModelAndView save(ModelMap map , HttpServletRequest request , @Valid SystemConfig config ,BindingResult result , @RequestParam(value = "keyfile", required = false) MultipartFile keyfile , @RequestParam(value = "loginlogo", required = false) MultipartFile loginlogo , @RequestParam(value = "consolelogo", required = false) MultipartFile consolelogo , @RequestParam(value = "favlogo", required = false) MultipartFile favlogo , @Valid Secret secret) throws SQLException, IOException, NoSuchAlgorithmException {
|
||||
/*SystemConfig systemConfig = systemConfigRes.findByOrgi(super.getOrgi(request)) ;
|
||||
config.setOrgi(super.getOrgi(request));*/
|
||||
SystemConfig systemConfig = systemConfigRes.findByOrgi(UKDataContext.SYSTEM_ORGI) ;
|
||||
config.setOrgi(UKDataContext.SYSTEM_ORGI);
|
||||
SystemConfig systemConfig = systemConfigRes.findByOrgi(MainContext.SYSTEM_ORGI) ;
|
||||
config.setOrgi(MainContext.SYSTEM_ORGI);
|
||||
String msg = "0" ;
|
||||
if(StringUtils.isBlank(config.getJkspassword())){
|
||||
config.setJkspassword(null);
|
||||
@ -192,7 +192,7 @@ public class SystemConfigController extends Handler{
|
||||
config.setCreatetime(new Date());
|
||||
systemConfig = config ;
|
||||
}else{
|
||||
UKTools.copyProperties(config,systemConfig);
|
||||
MainUtils.copyProperties(config,systemConfig);
|
||||
}
|
||||
if(config.isEnablessl()){
|
||||
if(keyfile!=null && keyfile.getBytes()!=null && keyfile.getBytes().length > 0 && keyfile.getOriginalFilename()!=null && keyfile.getOriginalFilename().length() > 0){
|
||||
@ -204,7 +204,7 @@ public class SystemConfigController extends Handler{
|
||||
}
|
||||
Properties prop = new Properties();
|
||||
FileOutputStream oFile = new FileOutputStream(sslFilePath);//true表示追加打开
|
||||
prop.setProperty("key-store-password", UKTools.encryption(systemConfig.getJkspassword())) ;
|
||||
prop.setProperty("key-store-password", MainUtils.encryption(systemConfig.getJkspassword())) ;
|
||||
prop.setProperty("key-store",systemConfig.getJksfile()) ;
|
||||
prop.store(oFile , "SSL Properties File");
|
||||
oFile.close();
|
||||
@ -217,17 +217,17 @@ public class SystemConfigController extends Handler{
|
||||
}
|
||||
|
||||
if(loginlogo!=null && !StringUtils.isBlank(loginlogo.getOriginalFilename()) && loginlogo.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||
String logoFileName = "logo/"+UKTools.md5(loginlogo.getOriginalFilename())+loginlogo.getOriginalFilename().substring(loginlogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String logoFileName = "logo/"+ MainUtils.md5(loginlogo.getOriginalFilename())+loginlogo.getOriginalFilename().substring(loginlogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
FileUtils.writeByteArrayToFile(new File(path ,logoFileName), loginlogo.getBytes());
|
||||
systemConfig.setLoginlogo(logoFileName);
|
||||
}
|
||||
if(consolelogo!=null && !StringUtils.isBlank(consolelogo.getOriginalFilename()) && consolelogo.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||
String consoleLogoFileName = "logo/"+UKTools.md5(consolelogo.getOriginalFilename())+consolelogo.getOriginalFilename().substring(consolelogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String consoleLogoFileName = "logo/"+ MainUtils.md5(consolelogo.getOriginalFilename())+consolelogo.getOriginalFilename().substring(consolelogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
FileUtils.writeByteArrayToFile(new File(path ,consoleLogoFileName), consolelogo.getBytes());
|
||||
systemConfig.setConsolelogo(consoleLogoFileName);
|
||||
}
|
||||
if(favlogo!=null && !StringUtils.isBlank(favlogo.getOriginalFilename()) && consolelogo.getOriginalFilename().lastIndexOf(".") > 0) {
|
||||
String favLogoFileName = "logo/"+UKTools.md5(favlogo.getOriginalFilename())+favlogo.getOriginalFilename().substring(favlogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
String favLogoFileName = "logo/"+ MainUtils.md5(favlogo.getOriginalFilename())+favlogo.getOriginalFilename().substring(favlogo.getOriginalFilename().lastIndexOf(".")) ;
|
||||
FileUtils.writeByteArrayToFile(new File(path ,favLogoFileName), favlogo.getBytes());
|
||||
systemConfig.setFavlogo(favLogoFileName);
|
||||
}
|
||||
@ -239,8 +239,8 @@ public class SystemConfigController extends Handler{
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
Secret tempSecret = secretConfig.get(0) ;
|
||||
String oldpass = request.getParameter("oldpass") ;
|
||||
if(!StringUtils.isBlank(oldpass) && UKTools.md5(oldpass).equals(tempSecret.getPassword())){
|
||||
tempSecret.setPassword(UKTools.md5(secret.getPassword()));
|
||||
if(!StringUtils.isBlank(oldpass) && MainUtils.md5(oldpass).equals(tempSecret.getPassword())){
|
||||
tempSecret.setPassword(MainUtils.md5(secret.getPassword()));
|
||||
msg = "1" ;
|
||||
tempSecret.setEnable(true);
|
||||
secRes.save(tempSecret) ;
|
||||
@ -251,7 +251,7 @@ public class SystemConfigController extends Handler{
|
||||
secret.setOrgi(super.getOrgi(request));
|
||||
secret.setCreater(super.getUser(request).getId());
|
||||
secret.setCreatetime(new Date());
|
||||
secret.setPassword(UKTools.md5(secret.getPassword()));
|
||||
secret.setPassword(MainUtils.md5(secret.getPassword()));
|
||||
secret.setEnable(true);
|
||||
msg = "1" ;
|
||||
secRes.save(secret) ;
|
||||
@ -264,7 +264,7 @@ public class SystemConfigController extends Handler{
|
||||
systemConfigRes.save(systemConfig) ;
|
||||
|
||||
CacheHelper.getSystemCacheBean().put("systemConfig", systemConfig , super.getOrgi(request));
|
||||
map.addAttribute("imServerStatus", UKDataContext.getIMServerStatus()) ;
|
||||
map.addAttribute("imServerStatus", MainContext.getIMServerStatus()) ;
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?msg="+msg));
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.config;
|
||||
package com.chatopera.cc.app.handler.admin.config;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -23,12 +23,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.SystemMessageRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.SystemMessage;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.persistence.repository.SystemMessageRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.SystemMessage;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -37,7 +37,7 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
@ -63,9 +63,9 @@ public class SystemMessageController extends Handler {
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView save(HttpServletRequest request ,@Valid SystemMessage email) throws NoSuchAlgorithmException {
|
||||
email.setOrgi(super.getOrgi(request));
|
||||
email.setMsgtype(UKDataContext.SystemMessageType.EMAIL.toString());
|
||||
email.setMsgtype(MainContext.SystemMessageType.EMAIL.toString());
|
||||
if(!StringUtils.isBlank(email.getSmtppassword())) {
|
||||
email.setSmtppassword(UKTools.encryption(email.getSmtppassword()));
|
||||
email.setSmtppassword(MainUtils.encryption(email.getSmtppassword()));
|
||||
}
|
||||
systemMessageRepository.save(email) ;
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/email/index.html"));
|
||||
@ -85,9 +85,9 @@ public class SystemMessageController extends Handler {
|
||||
if(email!=null) {
|
||||
email.setCreatetime(temp.getCreatetime());
|
||||
email.setOrgi(temp.getOrgi());
|
||||
email.setMsgtype(UKDataContext.SystemMessageType.EMAIL.toString());
|
||||
email.setMsgtype(MainContext.SystemMessageType.EMAIL.toString());
|
||||
if(!StringUtils.isBlank(email.getSmtppassword())) {
|
||||
email.setSmtppassword(UKTools.encryption(email.getSmtppassword()));
|
||||
email.setSmtppassword(MainUtils.encryption(email.getSmtppassword()));
|
||||
}else {
|
||||
email.setSmtppassword(temp.getSmtppassword());
|
||||
}
|
||||
@ -126,9 +126,9 @@ public class SystemMessageController extends Handler {
|
||||
@Menu(type = "admin" , subtype = "sms")
|
||||
public ModelAndView smssave(HttpServletRequest request ,@Valid SystemMessage sms) throws NoSuchAlgorithmException {
|
||||
sms.setOrgi(super.getOrgi(request));
|
||||
sms.setMsgtype(UKDataContext.SystemMessageType.SMS.toString());
|
||||
sms.setMsgtype(MainContext.SystemMessageType.SMS.toString());
|
||||
if(!StringUtils.isBlank(sms.getSmtppassword())) {
|
||||
sms.setSmtppassword(UKTools.encryption(sms.getSmtppassword()));
|
||||
sms.setSmtppassword(MainUtils.encryption(sms.getSmtppassword()));
|
||||
}
|
||||
systemMessageRepository.save(sms) ;
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sms/index.html"));
|
||||
@ -149,9 +149,9 @@ public class SystemMessageController extends Handler {
|
||||
if(sms!=null) {
|
||||
sms.setCreatetime(temp.getCreatetime());
|
||||
sms.setOrgi(temp.getOrgi());
|
||||
sms.setMsgtype(UKDataContext.SystemMessageType.SMS.toString());
|
||||
sms.setMsgtype(MainContext.SystemMessageType.SMS.toString());
|
||||
if(!StringUtils.isBlank(sms.getSmtppassword())) {
|
||||
sms.setSmtppassword(UKTools.encryption(sms.getSmtppassword()));
|
||||
sms.setSmtppassword(MainUtils.encryption(sms.getSmtppassword()));
|
||||
}else {
|
||||
sms.setSmtppassword(temp.getSmtppassword());
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.organ;
|
||||
package com.chatopera.cc.app.handler.admin.organ;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@ -23,11 +23,12 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.util.OnlineUserUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -35,18 +36,17 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.service.repository.AreaTypeRepository;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRoleRepository;
|
||||
import com.chatopera.cc.webim.service.repository.RoleRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.AgentStatus;
|
||||
import com.chatopera.cc.webim.web.model.Organ;
|
||||
import com.chatopera.cc.webim.web.model.OrganRole;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.persistence.repository.AreaTypeRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRoleRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.RoleRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.AgentStatus;
|
||||
import com.chatopera.cc.app.model.Organ;
|
||||
import com.chatopera.cc.app.model.OrganRole;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -137,7 +137,7 @@ public class OrganController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
organ.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
organ.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
organ.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
firstId = organ.getId();
|
||||
|
||||
@ -235,7 +235,7 @@ public class OrganController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
tempOrgan.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
tempOrgan.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
tempOrgan.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
organRepository.save(tempOrgan) ;
|
||||
OnlineUserUtils.clean(super.getOrgi(request));
|
||||
@ -261,7 +261,7 @@ public class OrganController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
tempOrgan.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
tempOrgan.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
tempOrgan.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
organRepository.save(tempOrgan) ;
|
||||
OnlineUserUtils.clean(super.getOrgi(request));
|
||||
@ -277,12 +277,12 @@ public class OrganController extends Handler{
|
||||
@Menu(type = "admin" , subtype = "area")
|
||||
public ModelAndView area(ModelMap map ,HttpServletRequest request , @Valid String id) {
|
||||
|
||||
SysDic sysDic = sysDicRepository.findByCode(UKDataContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
SysDic sysDic = sysDicRepository.findByCode(MainContext.UKEFU_SYSTEM_AREA_DIC) ;
|
||||
if(sysDic!=null){
|
||||
map.addAttribute("sysarea", sysDic) ;
|
||||
map.addAttribute("areaList", sysDicRepository.findByDicid(sysDic.getId())) ;
|
||||
}
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
map.addAttribute("cacheList", UKeFuDic.getInstance().getDic(MainContext.UKEFU_SYSTEM_AREA_DIC)) ;
|
||||
|
||||
map.addAttribute("organData", organRepository.findByIdAndOrgi(id, super.getOrgiByTenantshare(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/organ/area"));
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.role;
|
||||
package com.chatopera.cc.app.handler.admin.role;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -22,10 +22,11 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.RoleAuthRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.RoleAuthRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRoleRepository;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -34,16 +35,15 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.webim.service.repository.RoleRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Role;
|
||||
import com.chatopera.cc.webim.web.model.RoleAuth;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.webim.web.model.UserRole;
|
||||
import com.chatopera.cc.app.persistence.repository.RoleRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Role;
|
||||
import com.chatopera.cc.app.model.RoleAuth;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import com.chatopera.cc.app.model.UserRole;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/role")
|
||||
@ -110,7 +110,7 @@ public class RoleController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
role.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
role.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
role.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
|
||||
roleRepository.save(role) ;
|
||||
@ -184,7 +184,7 @@ public class RoleController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
tempRole.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
tempRole.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
tempRole.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
|
||||
roleRepository.save(tempRole) ;
|
||||
@ -210,7 +210,7 @@ public class RoleController extends Handler{
|
||||
@RequestMapping("/auth")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView auth(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
SysDic sysDic = sysDicRes.findByCode(UKDataContext.UKEFU_SYSTEM_AUTH_DIC) ;
|
||||
SysDic sysDic = sysDicRes.findByCode(MainContext.UKEFU_SYSTEM_AUTH_DIC) ;
|
||||
if(sysDic!=null){
|
||||
map.addAttribute("resourceList", sysDicRes.findByDicid(sysDic.getId())) ;
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.skill;
|
||||
package com.chatopera.cc.app.handler.admin.skill;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -30,9 +30,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.SkillRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.Skill;
|
||||
import com.chatopera.cc.app.persistence.repository.SkillRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.Skill;
|
||||
|
||||
/**
|
||||
*
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.system;
|
||||
package com.chatopera.cc.app.handler.admin.system;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
@ -31,8 +31,8 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import com.google.gson.Gson;
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/monitor")
|
@ -14,11 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.system;
|
||||
package com.chatopera.cc.app.handler.admin.system;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
@ -27,10 +28,9 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.LogRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.persistence.repository.LogRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/log")
|
||||
@ -43,14 +43,14 @@ public class LogController extends Handler{
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "syslog")
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) {
|
||||
map.addAttribute("logList", logRes.findByOrgi(UKDataContext.SYSTEM_ORGI , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createdate")));
|
||||
map.addAttribute("logList", logRes.findByOrgi(MainContext.SYSTEM_ORGI , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createdate")));
|
||||
return request(super.createAdminTempletResponse("/admin/system/log/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/levels")
|
||||
@Menu(type = "admin" , subtype = "levels")
|
||||
public ModelAndView levels(ModelMap map , HttpServletRequest request , @Valid String levels) {
|
||||
map.addAttribute("logList", logRes.findByOrgiAndLevels(UKDataContext.SYSTEM_ORGI , levels , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createdate")));
|
||||
map.addAttribute("logList", logRes.findByOrgiAndLevels(MainContext.SYSTEM_ORGI , levels , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createdate")));
|
||||
map.addAttribute("levels" , levels) ;
|
||||
return request(super.createAdminTempletResponse("/admin/system/log/levels"));
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.system;
|
||||
package com.chatopera.cc.app.handler.admin.system;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@ -28,16 +28,17 @@ import javax.persistence.PersistenceContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.metadata.DatabaseMetaDataHandler;
|
||||
import com.chatopera.cc.util.metadata.UKColumnMetadata;
|
||||
import com.chatopera.cc.util.metadata.UKTableMetaData;
|
||||
import com.chatopera.cc.webim.service.hibernate.BaseService;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.service.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.TableProperties;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.persistence.hibernate.BaseService;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.TableProperties;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.jdbc.Work;
|
||||
@ -50,13 +51,12 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.UKeFuList;
|
||||
import com.chatopera.cc.webim.service.repository.MetadataRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.MetadataTable;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.persistence.repository.MetadataRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.MetadataTable;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/metadata")
|
||||
@ -222,7 +222,7 @@ public class MetadataController extends Handler{
|
||||
//当前记录没有被添加过,进行正常添加
|
||||
metaDataTable.setTablename(table);
|
||||
metaDataTable.setOrgi(user.getOrgi());
|
||||
metaDataTable.setId(UKTools.md5(metaDataTable.getTablename()));
|
||||
metaDataTable.setId(MainUtils.md5(metaDataTable.getTablename()));
|
||||
metaDataTable.setTabledirid("0");
|
||||
metaDataTable.setCreater(user.getId());
|
||||
metaDataTable.setCreatername(user.getUsername());
|
||||
@ -292,7 +292,7 @@ public class MetadataController extends Handler{
|
||||
if(table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||
SysDic dic = UKeFuDic.getInstance().getDicItem(table.getListblocktemplet()) ;
|
||||
if(dic!=null) {
|
||||
Object bean = UKDataContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
Object bean = MainContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
if(bean instanceof ElasticsearchRepository) {
|
||||
ElasticsearchRepository<?, ?> jpa = (ElasticsearchRepository<?, ?>)bean ;
|
||||
jpa.deleteAll();
|
||||
@ -313,7 +313,7 @@ public class MetadataController extends Handler{
|
||||
SysDic dic = UKeFuDic.getInstance().getDicItem(table.getListblocktemplet()) ;
|
||||
|
||||
if(dic!=null) {
|
||||
Object bean = UKDataContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
Object bean = MainContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
if(bean instanceof ElasticsearchRepository) {
|
||||
ElasticsearchRepository jpa = (ElasticsearchRepository)bean ;
|
||||
if(!StringUtils.isBlank(table.getPreviewtemplet())) {
|
||||
@ -344,7 +344,7 @@ public class MetadataController extends Handler{
|
||||
SysDic dic = UKeFuDic.getInstance().getDicItem(table.getListblocktemplet()) ;
|
||||
|
||||
if(dic!=null) {
|
||||
Object bean = UKDataContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
Object bean = MainContext.getContext().getBean(Class.forName(dic.getCode())) ;
|
||||
if(bean instanceof ElasticsearchRepository) {
|
||||
ElasticsearchRepository jpa = (ElasticsearchRepository)bean ;
|
||||
if(!StringUtils.isBlank(table.getPreviewtemplet())) {
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.system;
|
||||
package com.chatopera.cc.app.handler.admin.system;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -22,8 +22,8 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
@ -33,8 +33,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/sysdic")
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.system;
|
||||
package com.chatopera.cc.app.handler.admin.system;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -33,16 +33,16 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.SysDicRepository;
|
||||
import com.chatopera.cc.webim.service.repository.TemplateRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.SysDic;
|
||||
import com.chatopera.cc.webim.web.model.Template;
|
||||
import com.chatopera.cc.webim.web.model.UKeFuDic;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.SysDicRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TemplateRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.SysDic;
|
||||
import com.chatopera.cc.app.model.Template;
|
||||
import com.chatopera.cc.app.model.UKeFuDic;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/template")
|
||||
@ -58,7 +58,7 @@ public class TemplateController extends Handler{
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) {
|
||||
map.addAttribute("sysDicList", UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_DIC));
|
||||
map.addAttribute("sysDicList", UKeFuDic.getInstance().getDic(MainContext.UKEFU_SYSTEM_DIC));
|
||||
return request(super.createAdminTempletResponse("/admin/system/template/index"));
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class TemplateController extends Handler{
|
||||
public void expall(ModelMap map , HttpServletRequest request , HttpServletResponse response) throws Exception {
|
||||
List<Template> templateList = templateRes.findByOrgi(super.getOrgi(request)) ;
|
||||
response.setHeader("content-disposition", "attachment;filename=UCKeFu-Template-Export-"+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+".data");
|
||||
response.getOutputStream().write(UKTools.toBytes(templateList));
|
||||
response.getOutputStream().write(MainUtils.toBytes(templateList));
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class TemplateController extends Handler{
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView impsave(ModelMap map , HttpServletRequest request , @RequestParam(value = "dataFile", required = false) MultipartFile dataFile) throws Exception {
|
||||
if(dataFile!=null && dataFile.getSize() > 0){
|
||||
List<Template> templateList = (List<Template>) UKTools.toObject(dataFile.getBytes()) ;
|
||||
List<Template> templateList = (List<Template>) MainUtils.toObject(dataFile.getBytes()) ;
|
||||
if(templateList!=null && templateList.size() >0){
|
||||
templateRes.deleteInBatch(templateList);
|
||||
for(Template template : templateList){
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.admin.users;
|
||||
package com.chatopera.cc.app.handler.admin.users;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -24,9 +24,11 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.webim.web.model.AgentStatus;
|
||||
import com.chatopera.cc.app.algorithm.AutomaticServiceDist;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.app.model.AgentStatus;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -36,15 +38,13 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.acd.ServiceQuene;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.webim.web.model.UserRole;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import com.chatopera.cc.app.model.UserRole;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -103,14 +103,14 @@ public class UsersController extends Handler{
|
||||
user.setUsertype(null);
|
||||
}
|
||||
if(!StringUtils.isBlank(user.getPassword())){
|
||||
user.setPassword(UKTools.md5(user.getPassword()));
|
||||
user.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
user.setOrgi(super.getOrgiByTenantshare(request));
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
user.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
user.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
user.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
userRepository.save(user) ;
|
||||
OnlineUserUtils.clean(super.getOrgi(request));
|
||||
@ -168,7 +168,7 @@ public class UsersController extends Handler{
|
||||
//切换成非坐席 判断是否坐席 以及 是否有对话
|
||||
if(!user.isAgent()) {
|
||||
AgentStatus agentStatus = (AgentStatus) CacheHelper.getAgentStatusCacheBean().getCacheObject((super.getUser(request)).getId(), super.getOrgi(request));
|
||||
if(!(agentStatus==null && ServiceQuene.getAgentUsers(super.getUser(request).getId(), super.getOrgi(request))==0)) {
|
||||
if(!(agentStatus==null && AutomaticServiceDist.getAgentUsers(super.getUser(request).getId(), super.getOrgi(request))==0)) {
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg=t1"));
|
||||
}
|
||||
}
|
||||
@ -179,12 +179,12 @@ public class UsersController extends Handler{
|
||||
if(!StringUtils.isBlank(super.getUser(request).getOrgid())) {
|
||||
tempUser.setOrgid(super.getUser(request).getOrgid());
|
||||
}else {
|
||||
tempUser.setOrgid(UKDataContext.SYSTEM_ORGI);
|
||||
tempUser.setOrgid(MainContext.SYSTEM_ORGI);
|
||||
}
|
||||
|
||||
tempUser.setCallcenter(user.isCallcenter());
|
||||
if(!StringUtils.isBlank(user.getPassword())){
|
||||
tempUser.setPassword(UKTools.md5(user.getPassword()));
|
||||
tempUser.setPassword(MainUtils.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
if(request.getParameter("admin")!=null){
|
@ -14,13 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api;
|
||||
package com.chatopera.cc.app.handler.api;
|
||||
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.cache.CacheHelper;
|
||||
import com.chatopera.cc.webim.service.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.webim.web.model.UserRole;
|
||||
import com.chatopera.cc.app.cache.CacheHelper;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRoleRepository;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import com.chatopera.cc.app.model.UserRole;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@ -33,8 +34,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -43,10 +42,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tokens")
|
||||
@ -63,7 +61,7 @@ public class ApiLoginController extends Handler{
|
||||
@Menu(type = "apps" , subtype = "token" , access = true)
|
||||
@ApiOperation("登录服务,传入登录账号和密码")
|
||||
public ResponseEntity login(HttpServletRequest request , HttpServletResponse response , @Valid String username, @Valid String password) {
|
||||
User loginUser = userRepository.findByUsernameAndPassword(username , UKTools.md5(password)) ;
|
||||
User loginUser = userRepository.findByUsernameAndPassword(username , MainUtils.md5(password)) ;
|
||||
ResponseEntity entity = null ;
|
||||
if(loginUser!=null && !StringUtils.isBlank(loginUser.getId())){
|
||||
loginUser.setLogin(true);
|
||||
@ -77,8 +75,8 @@ public class ApiLoginController extends Handler{
|
||||
if(!StringUtils.isBlank(loginUser.getId())){
|
||||
userRepository.save(loginUser) ;
|
||||
}
|
||||
String auth = UKTools.getUUID();
|
||||
CacheHelper.getApiUserCacheBean().put(auth, loginUser, UKDataContext.SYSTEM_ORGI);
|
||||
String auth = MainUtils.getUUID();
|
||||
CacheHelper.getApiUserCacheBean().put(auth, loginUser, MainContext.SYSTEM_ORGI);
|
||||
entity = new ResponseEntity<>(auth, HttpStatus.OK) ;
|
||||
response.addCookie(new Cookie("authorization",auth));
|
||||
}else{
|
||||
@ -98,7 +96,7 @@ public class ApiLoginController extends Handler{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@RequestMapping(method = RequestMethod.DELETE)
|
||||
public ResponseEntity logout(HttpServletRequest request , @RequestHeader(value="authorization") String authorization) {
|
||||
CacheHelper.getApiUserCacheBean().delete(authorization, UKDataContext.SYSTEM_ORGI);
|
||||
CacheHelper.getApiUserCacheBean().delete(authorization, MainContext.SYSTEM_ORGI);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api;
|
||||
package com.chatopera.cc.app.handler.api;
|
||||
|
||||
import com.chatopera.cc.webim.util.RestResult;
|
||||
import com.chatopera.cc.util.RestResult;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -28,8 +28,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.util.RestResultType;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.util.RestResultType;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tokens/error")
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.request;
|
||||
|
||||
public class QueryParams {
|
||||
private String begin ;
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -14,13 +14,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.request;
|
||||
package com.chatopera.cc.app.handler.api.request;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RestUtils {
|
||||
public final static String RESP_KEY_RC = "rc";
|
||||
public final static String RESP_KEY_MSG = "msg";
|
@ -14,9 +14,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.webim.util.RestResult;
|
||||
import com.chatopera.cc.util.RestResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@ -33,9 +33,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.service.repository.AgentUserRepository;
|
||||
import com.chatopera.cc.webim.util.RestResultType;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.persistence.repository.AgentUserRepository;
|
||||
import com.chatopera.cc.util.RestResultType;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/agentuser")
|
@ -14,17 +14,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Constants;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.aggregation.MathHelper;
|
||||
import com.chatopera.cc.util.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.webim.service.repository.*;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.webim.web.model.*;
|
||||
import com.chatopera.cc.aggregation.MathHelper;
|
||||
import com.chatopera.cc.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.app.model.*;
|
||||
import com.chatopera.cc.app.persistence.repository.*;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.handler.api.request.RestUtils;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -186,12 +186,12 @@ public class ApiCallMonitorController extends Handler {
|
||||
x.addProperty("name", g.getUname());
|
||||
x.addProperty("organ", getOrganName(g.getOrgan()));
|
||||
|
||||
AgentStatus as = getAgentStatus(g.getId(), UKDataContext.SYSTEM_ORGI);
|
||||
AgentStatus as = getAgentStatus(g.getId(), MainContext.SYSTEM_ORGI);
|
||||
if (as == null) {
|
||||
// 离线客服
|
||||
x.addProperty("web", UKDataContext.AgentStatusEnum.OFFLINE.zh());
|
||||
x.addProperty("web", MainContext.AgentStatusEnum.OFFLINE.zh());
|
||||
} else {
|
||||
x.addProperty("web", as.isBusy() ? UKDataContext.AgentStatusEnum.BUSY.zh() : UKDataContext.AgentStatusEnum.IDLE.zh());
|
||||
x.addProperty("web", as.isBusy() ? MainContext.AgentStatusEnum.BUSY.zh() : MainContext.AgentStatusEnum.IDLE.zh());
|
||||
}
|
||||
|
||||
String sipaccount = g.getSipaccount();
|
||||
@ -201,10 +201,10 @@ public class ApiCallMonitorController extends Handler {
|
||||
x.addProperty("sip", sipaccount);
|
||||
x.addProperty("status", sipstatus);
|
||||
if (Constants.FS_LEG_INCALL_ZH.equals(sipstatus))
|
||||
x.add("current", getStatusEvent(g.getId(), sipaccount, UKDataContext.CallServiceStatus.INCALL.toString()));
|
||||
x.add("current", getStatusEvent(g.getId(), sipaccount, MainContext.CallServiceStatus.INCALL.toString()));
|
||||
} else {
|
||||
x.addProperty("sip", sipaccount);
|
||||
x.addProperty("status", UKDataContext.CallServiceStatus.OFFLINE.toString());
|
||||
x.addProperty("status", MainContext.CallServiceStatus.OFFLINE.toString());
|
||||
}
|
||||
} else {
|
||||
x.addProperty("sip", "未设置");
|
@ -13,26 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Constants;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.aggregation.CallOutHangupAggsResult;
|
||||
import com.chatopera.cc.util.aggregation.CallOutHangupAuditResult;
|
||||
import com.chatopera.cc.util.aggregation.MathHelper;
|
||||
import com.chatopera.cc.util.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.webim.service.repository.StatusEventRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.service.storage.MinioService;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.webim.web.model.Organ;
|
||||
import com.chatopera.cc.webim.web.model.SNSAccount;
|
||||
import com.chatopera.cc.webim.web.model.StatusEvent;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.aggregation.CallOutHangupAggsResult;
|
||||
import com.chatopera.cc.aggregation.CallOutHangupAuditResult;
|
||||
import com.chatopera.cc.aggregation.MathHelper;
|
||||
import com.chatopera.cc.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.StatusEventRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.persistence.storage.MinioService;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.app.model.Organ;
|
||||
import com.chatopera.cc.app.model.SNSAccount;
|
||||
import com.chatopera.cc.app.model.StatusEvent;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -157,8 +157,8 @@ public class ApiCallRecordsController extends Handler {
|
||||
organ,
|
||||
agent,
|
||||
called,
|
||||
UKDataContext.CallTypeEnum.OUT.toString(), // 呼出
|
||||
UKDataContext.CallServiceStatus.HANGUP.toString(), // 挂机
|
||||
MainContext.CallTypeEnum.OUT.toString(), // 呼出
|
||||
MainContext.CallServiceStatus.HANGUP.toString(), // 挂机
|
||||
null, // Dialplan,null代表所有外呼
|
||||
new PageRequest(super.getP(request), super.getPs(request), Sort.Direction.DESC, new String[]{"createtime"}));
|
||||
|
||||
@ -426,7 +426,7 @@ public class ApiCallRecordsController extends Handler {
|
||||
}
|
||||
|
||||
if (j.has("organ")) {
|
||||
if (organRes.findByIdAndOrgi(j.get("organ").getAsString(), UKDataContext.SYSTEM_ORGI) == null)
|
||||
if (organRes.findByIdAndOrgi(j.get("organ").getAsString(), MainContext.SYSTEM_ORGI) == null)
|
||||
return "该部门不存在。";
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ public class ApiCallRecordsController extends Handler {
|
||||
fromdate,
|
||||
enddate,
|
||||
organ,
|
||||
UKDataContext.SYSTEM_ORGI);
|
||||
MainContext.SYSTEM_ORGI);
|
||||
|
||||
// 查询结果序列化为聚合对象
|
||||
final Map<String, CallOutHangupAuditResult> out = new HashMap<String, CallOutHangupAuditResult>();
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.webim.util.RestResult;
|
||||
import com.chatopera.cc.util.RestResult;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@ -31,9 +31,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.chatopera.cc.webim.service.repository.ChatMessageRepository;
|
||||
import com.chatopera.cc.webim.util.RestResultType;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.app.persistence.repository.ChatMessageRepository;
|
||||
import com.chatopera.cc.util.RestResultType;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
@ -13,21 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.webim.service.repository.ChatbotRepository;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.SNSAccountRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.util.chatbot.ChatbotUtils;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.webim.web.model.Chatbot;
|
||||
import com.chatopera.cc.webim.web.model.Organ;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.basic.MainUtils;
|
||||
import com.chatopera.cc.exception.CallOutRecordException;
|
||||
import com.chatopera.cc.app.model.*;
|
||||
import com.chatopera.cc.app.persistence.repository.*;
|
||||
import com.chatopera.cc.util.OnlineUserUtils;
|
||||
import com.chatopera.cc.app.im.util.ChatbotUtils;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.handler.api.request.RestUtils;
|
||||
import com.chatopera.chatbot.ChatbotAPI;
|
||||
import com.chatopera.chatbot.ChatbotAPIRuntimeException;
|
||||
import com.google.gson.JsonArray;
|
||||
@ -57,6 +53,7 @@ import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/chatbot")
|
||||
@ -79,6 +76,9 @@ public class ApiChatbotController extends Handler {
|
||||
@Autowired
|
||||
private OrganRepository organRes;
|
||||
|
||||
@Autowired
|
||||
private ConsultInviteRepository consultInviteRes;
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
@Menu(type = "apps", subtype = "chatbot", access = true)
|
||||
@ApiOperation("聊天机器人")
|
||||
@ -106,6 +106,15 @@ public class ApiChatbotController extends Handler {
|
||||
case "update":
|
||||
json = update(j);
|
||||
break;
|
||||
case "enable":
|
||||
json = enable(j, true);
|
||||
break;
|
||||
case "disable":
|
||||
json = enable(j, false);
|
||||
break;
|
||||
case "vacant":
|
||||
json = vacant(j, curruser.getOrgi(), curruser.isSuperuser(), curruser.getMyorgans());
|
||||
break;
|
||||
default:
|
||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_2);
|
||||
json.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的操作。");
|
||||
@ -114,6 +123,90 @@ public class ApiChatbotController extends Handler {
|
||||
return new ResponseEntity<String>(json.toString(), headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取空缺聊天机器人的网站渠道列表
|
||||
*
|
||||
* @param j
|
||||
* @param orgi
|
||||
* @param myorgans
|
||||
* @return
|
||||
*/
|
||||
private JsonObject vacant(final JsonObject j, String orgi, boolean isSuperuser, final HashSet<String> myorgans) {
|
||||
JsonObject resp = new JsonObject();
|
||||
if ((!isSuperuser) && (myorgans == null || myorgans.size() == 0)) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
|
||||
resp.addProperty(RestUtils.RESP_KEY_ERROR, "您还未属于任何【部门】,不具有访问该资源的权限。");
|
||||
return resp;
|
||||
}
|
||||
|
||||
List<SNSAccount> records = snsAccountRes.findBySnstypeAndOrgiAndOrgans(ChatbotUtils.SNS_TYPE_WEBIM, orgi, myorgans != null ? new ArrayList<String>(myorgans) : null);
|
||||
JsonArray ja = new JsonArray();
|
||||
|
||||
for (SNSAccount r : records) {
|
||||
if (!chatbotRes.existsBySnsAccountIdentifierAndOrgi(r.getSnsid(), orgi)) {
|
||||
JsonObject o = new JsonObject();
|
||||
o.addProperty("id", r.getId());
|
||||
o.addProperty("snsid", r.getSnsid());
|
||||
o.addProperty("snsType", r.getSnstype());
|
||||
ja.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
resp.add("data", ja);
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Chatbot
|
||||
*
|
||||
* @param j
|
||||
* @return
|
||||
*/
|
||||
private JsonObject enable(JsonObject j, boolean isEnabled) {
|
||||
JsonObject resp = new JsonObject();
|
||||
if ((!j.has("id")) || StringUtils.isBlank(j.get("id").getAsString())) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_3);
|
||||
resp.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的操作,id不能为空。");
|
||||
return resp;
|
||||
}
|
||||
|
||||
final String id = j.get("id").getAsString();
|
||||
Chatbot c = chatbotRes.findOne(id);
|
||||
|
||||
if (c == null) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_4);
|
||||
resp.addProperty(RestUtils.RESP_KEY_ERROR, "该聊天机器人不存在。");
|
||||
return resp;
|
||||
}
|
||||
|
||||
try {
|
||||
if (c.getApi().exists(c.getChatbotID())) {
|
||||
c.setEnabled(isEnabled);
|
||||
chatbotRes.save(c);
|
||||
|
||||
// 更新访客网站配置
|
||||
CousultInvite invite = OnlineUserUtils.cousult(c.getSnsAccountIdentifier(), c.getOrgi(), consultInviteRes);
|
||||
invite.setAi(isEnabled);
|
||||
consultInviteRes.save(invite);
|
||||
OnlineUserUtils.cacheCousult(invite);
|
||||
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
|
||||
resp.addProperty(RestUtils.RESP_KEY_DATA, "完成。");
|
||||
} else {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_7);
|
||||
resp.addProperty(RestUtils.RESP_KEY_ERROR, "智能问答引擎不存在该聊天机器人,未能正确设置。");
|
||||
}
|
||||
} catch (ChatbotAPIRuntimeException e) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_5);
|
||||
resp.addProperty(RestUtils.RESP_KEY_DATA, "设置不成功,智能问答引擎服务异常。");
|
||||
} catch (MalformedURLException e) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_6);
|
||||
resp.addProperty(RestUtils.RESP_KEY_DATA, "设置不成功,智能问答引擎地址不合法。");
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新聊天机器人
|
||||
*
|
||||
@ -137,23 +230,31 @@ public class ApiChatbotController extends Handler {
|
||||
return resp;
|
||||
}
|
||||
|
||||
// 更新访客网站配置
|
||||
CousultInvite invite = OnlineUserUtils.cousult(c.getSnsAccountIdentifier(), c.getOrgi(), consultInviteRes);
|
||||
|
||||
if (j.has("workmode") && ChatbotUtils.VALID_WORKMODELS.contains(j.get("workmode").getAsString())) {
|
||||
c.setWorkmode(j.get("workmode").getAsString());
|
||||
}
|
||||
|
||||
if (j.has("enabled")) {
|
||||
c.setEnabled(j.get("enabled").getAsBoolean());
|
||||
invite.setAifirst(StringUtils.equals(ChatbotUtils.CHATBOT_FIRST, c.getWorkmode()));
|
||||
}
|
||||
|
||||
String description = j.has("description") ? j.get("description").getAsString() : null;
|
||||
String fallback = j.has("fallback") ? j.get("fallback").getAsString() : null;
|
||||
String welcome = j.has("welcome") ? j.get("welcome").getAsString() : null;
|
||||
String name = j.has("name") ? j.get("name").getAsString() : null;
|
||||
|
||||
|
||||
if (j.has("enabled")) {
|
||||
boolean enabled = j.get("enabled").getAsBoolean();
|
||||
c.setEnabled(enabled);
|
||||
invite.setAi(enabled);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(description) ||
|
||||
StringUtils.isNotBlank(fallback) ||
|
||||
StringUtils.isNotBlank(welcome)) {
|
||||
try {
|
||||
if (c.getApi().updateByChatbotID(c.getChatbotID(), description, fallback, welcome)) {
|
||||
if (c.getApi().updateByChatbotID(c.getChatbotID(), name, description, fallback, welcome)) {
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
|
||||
resp.addProperty(RestUtils.RESP_KEY_DATA, "更新成功。");
|
||||
} else {
|
||||
@ -172,17 +273,26 @@ public class ApiChatbotController extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(description))
|
||||
if (StringUtils.isNotBlank(description))
|
||||
c.setDescription(description);
|
||||
|
||||
if(StringUtils.isNotBlank(fallback))
|
||||
if (StringUtils.isNotBlank(fallback))
|
||||
c.setFallback(fallback);
|
||||
|
||||
if(StringUtils.isNotBlank(welcome))
|
||||
if (StringUtils.isNotBlank(welcome)) {
|
||||
c.setWelcome(welcome);
|
||||
invite.setAisuccesstip(welcome);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
c.setName(name);
|
||||
invite.setAiname(name);
|
||||
}
|
||||
|
||||
c.setUpdatetime(new Date());
|
||||
chatbotRes.save(c);
|
||||
consultInviteRes.save(invite);
|
||||
OnlineUserUtils.cacheCousult(invite);
|
||||
|
||||
return resp;
|
||||
}
|
||||
@ -248,7 +358,6 @@ public class ApiChatbotController extends Handler {
|
||||
resp.addProperty("totalElements", records.getTotalElements()); // 所有检索结果数量
|
||||
|
||||
return resp;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -278,6 +387,17 @@ public class ApiChatbotController extends Handler {
|
||||
|
||||
try {
|
||||
if (c.getApi().deleteByChatbotID(c.getChatbotID())) {
|
||||
// 更新访客网站配置
|
||||
CousultInvite invite = OnlineUserUtils.cousult(c.getSnsAccountIdentifier(), c.getOrgi(), consultInviteRes);
|
||||
if (invite != null) {
|
||||
invite.setAi(false);
|
||||
invite.setAiname(null);
|
||||
invite.setAisuccesstip(null);
|
||||
invite.setAifirst(false);
|
||||
invite.setAiid(null);
|
||||
consultInviteRes.save(invite);
|
||||
OnlineUserUtils.cacheCousult(invite);
|
||||
}
|
||||
chatbotRes.delete(c);
|
||||
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
|
||||
resp.addProperty(RestUtils.RESP_KEY_DATA, "删除成功。");
|
||||
@ -406,7 +526,7 @@ public class ApiChatbotController extends Handler {
|
||||
if (result.getInt("rc") == 0) {
|
||||
// 创建成功
|
||||
Chatbot c = new Chatbot();
|
||||
c.setId(UKTools.getUUID());
|
||||
c.setId(MainUtils.getUUID());
|
||||
c.setBaseUrl(capi.getBaseUrl());
|
||||
c.setChatbotID(chatbotID);
|
||||
c.setDescription(description);
|
||||
@ -414,9 +534,6 @@ public class ApiChatbotController extends Handler {
|
||||
c.setPrimaryLanguage(primaryLanguage);
|
||||
c.setName(name);
|
||||
c.setWelcome(result.getJSONObject("data").getString("welcome"));
|
||||
|
||||
// 默认不开启
|
||||
c.setEnabled(false);
|
||||
c.setCreater(creater);
|
||||
c.setOrgan(organ);
|
||||
c.setOrgi(orgi);
|
||||
@ -427,6 +544,19 @@ public class ApiChatbotController extends Handler {
|
||||
c.setUpdatetime(dt);
|
||||
c.setWorkmode(workmode);
|
||||
|
||||
// 默认不开启
|
||||
boolean enabled = false;
|
||||
c.setEnabled(enabled);
|
||||
|
||||
// 更新访客网站配置
|
||||
CousultInvite invite = OnlineUserUtils.cousult(c.getSnsAccountIdentifier(), c.getOrgi(), consultInviteRes);
|
||||
invite.setAi(enabled);
|
||||
invite.setAifirst(StringUtils.equals(ChatbotUtils.CHATBOT_FIRST, workmode));
|
||||
invite.setAiid(c.getId());
|
||||
invite.setAiname(c.getName());
|
||||
invite.setAisuccesstip(c.getWelcome());
|
||||
consultInviteRes.save(invite);
|
||||
OnlineUserUtils.cacheCousult(invite);
|
||||
chatbotRes.save(c);
|
||||
|
||||
JsonObject data = new JsonObject();
|
@ -13,23 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Constants;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.exception.CSKefuRestException;
|
||||
import com.chatopera.cc.exception.CSKefuRestException;
|
||||
import com.chatopera.cc.util.json.GsonTools;
|
||||
import com.chatopera.cc.webim.service.es.ContactNotesRepository;
|
||||
import com.chatopera.cc.webim.service.es.ContactsRepository;
|
||||
import com.chatopera.cc.webim.service.repository.OrganRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.webim.web.model.ContactNotes;
|
||||
import com.chatopera.cc.webim.web.model.Contacts;
|
||||
import com.chatopera.cc.webim.web.model.Organ;
|
||||
import com.chatopera.cc.webim.web.model.User;
|
||||
import com.chatopera.cc.app.persistence.es.ContactNotesRepository;
|
||||
import com.chatopera.cc.app.persistence.es.ContactsRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.OrganRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.app.model.ContactNotes;
|
||||
import com.chatopera.cc.app.model.Contacts;
|
||||
import com.chatopera.cc.app.model.Organ;
|
||||
import com.chatopera.cc.app.model.User;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -292,7 +292,7 @@ public class ApiContactNotesController extends Handler {
|
||||
JsonObject json = new JsonObject();
|
||||
HttpHeaders headers = RestUtils.header();
|
||||
j.addProperty("creater", super.getUser(request).getId());
|
||||
j.addProperty("orgi", UKDataContext.SYSTEM_ORGI);
|
||||
j.addProperty("orgi", MainContext.SYSTEM_ORGI);
|
||||
|
||||
if (!j.has("ops")) {
|
||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
@ -14,20 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.chatopera.cc.webim.web.handler.api.rest;
|
||||
package com.chatopera.cc.app.handler.api.rest;
|
||||
|
||||
import com.chatopera.cc.core.UKDataContext;
|
||||
import com.chatopera.cc.app.basic.MainContext;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.UKTools;
|
||||
import com.chatopera.cc.util.exception.CSKefuRestException;
|
||||
import com.chatopera.cc.exception.CSKefuRestException;
|
||||
import com.chatopera.cc.util.json.GsonTools;
|
||||
import com.chatopera.cc.webim.service.repository.TagRelationRepository;
|
||||
import com.chatopera.cc.webim.service.repository.TagRepository;
|
||||
import com.chatopera.cc.webim.service.repository.UserRepository;
|
||||
import com.chatopera.cc.webim.web.handler.Handler;
|
||||
import com.chatopera.cc.webim.web.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.webim.web.model.Tag;
|
||||
import com.chatopera.cc.webim.web.model.TagRelation;
|
||||
import com.chatopera.cc.app.persistence.repository.TagRelationRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.TagRepository;
|
||||
import com.chatopera.cc.app.persistence.repository.UserRepository;
|
||||
import com.chatopera.cc.app.handler.Handler;
|
||||
import com.chatopera.cc.app.handler.api.request.RestUtils;
|
||||
import com.chatopera.cc.app.model.Tag;
|
||||
import com.chatopera.cc.app.model.TagRelation;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -199,7 +198,7 @@ public class ApiContactTagsController extends Handler {
|
||||
JsonObject json = new JsonObject();
|
||||
HttpHeaders headers = RestUtils.header();
|
||||
j.addProperty("creater", super.getUser(request).getId());
|
||||
j.addProperty("orgi", UKDataContext.SYSTEM_ORGI);
|
||||
j.addProperty("orgi", MainContext.SYSTEM_ORGI);
|
||||
|
||||
if (!j.has("ops")) {
|
||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user