├── 05-大模型呼叫中心-自助解决问题.pptx ├── 2024-客户大模型呼叫中心测试.mp4 ├── 2024-运营商电话助理测试-带字幕.mp4 ├── LICENSE ├── README.md └── sample ├── common └── src │ └── com │ └── sxx │ └── jcc │ └── common │ ├── action │ ├── BaseAction.java │ └── Message.java │ ├── service │ ├── BaseReportService.java │ ├── BaseService.java │ ├── IBaseReportSevice.java │ └── IBaseService.java │ └── utils │ ├── Base62.java │ ├── BrowserClient.java │ ├── DateJsonValueProcessor.java │ ├── DateUtil.java │ ├── Escape.java │ ├── IdGenerator.java │ ├── JsonUtil.java │ ├── MD5.java │ ├── MD5Encrypt.java │ ├── NameConverter.java │ ├── ReflectionUtils.java │ ├── SpringBeanFactory.java │ ├── XKDataContext.java │ ├── XKTools.java │ ├── disruptor │ ├── UserDataEventFactory.java │ ├── UserDataEventProducer.java │ ├── UserEventHandler.java │ └── multiupdate │ │ └── MultiUpdateEventFactory.java │ └── event │ ├── AiEvent.java │ ├── UserDataEvent.java │ └── UserEvent.java ├── core └── src │ ├── com │ └── sxx │ │ └── jcc │ │ └── core │ │ ├── cache │ │ ├── CacheBean.java │ │ ├── CacheInstance.java │ │ ├── MemCached.java │ │ ├── SystemCache.java │ │ └── WoseqGen.java │ │ ├── chartReport │ │ ├── BarChart.java │ │ └── BaseChart.java │ │ ├── dao │ │ └── hibernate │ │ │ ├── HibernateDao.java │ │ │ ├── Page.java │ │ │ ├── PropertyFilter.java │ │ │ ├── QueryConditionFilter.java │ │ │ ├── QueryParameter.java │ │ │ └── SimpleHibernateDao.java │ │ ├── exception │ │ ├── AppBaseException.java │ │ ├── BaseException.java │ │ ├── LoginException.java │ │ └── UnauthorizedException.java │ │ ├── filter │ │ └── Struts2Filter.java │ │ ├── intereptor │ │ ├── AuthorityInterceptor.java │ │ ├── AuthorizationInterceptor.java │ │ └── ExceptionHandlerInterceptor.java │ │ ├── model │ │ ├── ADBase.java │ │ ├── ADEntity.java │ │ ├── IMClient.java │ │ ├── PageModel.java │ │ └── ReportBase.java │ │ ├── server │ │ ├── DemoSocketServer.java │ │ ├── ServerRunner.java │ │ ├── handler │ │ │ ├── AgentEventHandler.java │ │ │ └── IMEventHandler.java │ │ └── message │ │ │ ├── AgentServiceMessage.java │ │ │ ├── AgentStatusMessage.java │ │ │ ├── ChatObject.java │ │ │ ├── Message.java │ │ │ ├── NewRequestMessage.java │ │ │ ├── OtherMessage.java │ │ │ ├── OtherMessageItem.java │ │ │ └── SessionConfigItem.java │ │ ├── struts │ │ ├── CRUDActionSupport.java │ │ ├── ReportBaseAction.java │ │ └── SimpleActionSupport.java │ │ ├── taglib │ │ ├── bean │ │ │ └── PageTable.java │ │ ├── model │ │ │ └── HtmlColumn.java │ │ └── ui │ │ │ └── pageTableTag.java │ │ ├── utils │ │ ├── BeanUtils.java │ │ ├── Constant.java │ │ ├── DateUtil.java │ │ ├── WebUtils.java │ │ └── tree │ │ │ ├── JQueryTreeUtil.java │ │ │ ├── TreeCompare.java │ │ │ ├── TreeNode.java │ │ │ ├── ZTreeCompare.java │ │ │ ├── ZTreeNode.java │ │ │ └── ZTreeUtil.java │ │ └── view │ │ ├── AbstractExportView.java │ │ ├── AbstractViewExporter.java │ │ ├── ExcelView.java │ │ ├── ExcelViewExporter.java │ │ ├── ExportType.java │ │ ├── View.java │ │ ├── ViewExporter.java │ │ └── utils │ │ ├── BeanUtils.java │ │ ├── ExportUtils.java │ │ └── ItemUtils.java │ ├── memcached.xml │ └── struts.xml ├── temp └── webim └── src └── com └── sxx └── jcc └── webim ├── action ├── AgentController.java └── IMControllerAction.java ├── config ├── DisruptorConfigure.java └── SessionConfigItem.java ├── pojo ├── AgentReport.java ├── AgentServiceSummary.java ├── AgentStatus.java ├── AgentUserTask.java ├── BlackEntity.java ├── ChatMessage.java ├── Contacts.java ├── MessageDataBean.java ├── MessageInContent.java ├── MessageLeave.java ├── MessageOutContent.java ├── OnlineUser.java ├── OnlineUserHis.java ├── QuickReply.java ├── QuickType.java ├── RequestLog.java ├── SNSAccount.java ├── SocketIOMessage.java ├── StatusEvent.java ├── SystemConfig.java ├── UserHistory.java ├── UserTraceHistory.java ├── WorkMonitor.java └── WorkserviceTime.java ├── queue ├── AgentStatusBusyOrgiFilterPredicate.java ├── AgentStatusOrgiFilterPredicate.java └── AgentUserOrgiFilterPredicate.java ├── rpc ├── AgentTopicListener.java ├── ClusterMember.java ├── IMTopicListener.java ├── RPCDataBean.java └── RPCTools.java ├── service ├── IAgentReportService.java ├── IAgentStatusService.java ├── IAgentUserTaskService.java ├── IChatMessageService.java ├── IQuickReplyService.java ├── IQuickTypeService.java ├── ISummaryService.java ├── ISysAgentUserService.java ├── IWorkMonitorService.java ├── ServiceQuene.java └── impl │ ├── AgentReportServiceImpl.java │ ├── AgentStatusServiceImpl.java │ ├── AgentUserTaskServiceImpl.java │ ├── ChatMessageServiceImpl.java │ ├── QuickReplyServiceImpl.java │ ├── QuickTypeServiceImpl.java │ ├── SummaryServiceImpl.java │ ├── SysAgentUserServiceImpl.java │ └── WorkMonitorServiceImpl.java └── util ├── BeanUtils.java ├── IP.java ├── MessageUtils.java ├── NettyAgentClient.java ├── NettyCallCenterClient.java ├── NettyClient.java ├── NettyClients.java ├── NettyIMClient.java ├── OnlineUserUtils.java └── router ├── MessageRouter.java ├── OutMessageRouter.java ├── Router.java ├── RouterHelper.java └── WebIMOutMessageRouter.java /05-大模型呼叫中心-自助解决问题.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeIPCC/FreeIPCC-AiChat/168db1022e1b4d2a2ce34330de3b763f7bce7b87/05-大模型呼叫中心-自助解决问题.pptx -------------------------------------------------------------------------------- /2024-客户大模型呼叫中心测试.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeIPCC/FreeIPCC-AiChat/168db1022e1b4d2a2ce34330de3b763f7bce7b87/2024-客户大模型呼叫中心测试.mp4 -------------------------------------------------------------------------------- /2024-运营商电话助理测试-带字幕.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeIPCC/FreeIPCC-AiChat/168db1022e1b4d2a2ce34330de3b763f7bce7b87/2024-运营商电话助理测试-带字幕.mp4 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 我们采用的是一个简单的许可证协议条款: 2 | 付费购买源代码之后,可自用,可商用,你购买源代码之后,我方会安排对你进行一次源代码培训。 3 | 4 | We adopt a simple terms of license agreement: 5 | After purchasing the source code, you can use it for personal or commercial purposes. Once you have acquired the source code, we will arrange for a source code training session for you. 6 | 7 | Мы используем простые условия лицензионного соглашения: 8 | После оплаты и покупки исходного кода, вы можете использовать его как для личных, так и для коммерческих целей. После покупки исходного кода мы организуем для вас тренинг по использованию исходного кода. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FreeIPCC-AiChat大模型聊天机器人 2 | LLM,Langchain,RAG搜索模块,大模型聊天机器人,大模型客服机器人,在线客服聊天机器人,官网聊天机器人,AI客服,大模型,chatbot,大模型在线客服!!!!!!!!! 3 | 4 | 多渠道回复!!! 5 | 6 | 官方WeChat01: freeipcc 7 | 官方Wechat02: freeaicc 8 | 9 | # 😄我们坚信:软件只有被用起来,才能给用户带去价值,才能让自身产生迭代! 10 | ## 😄代码完整性:前端、后端、数据库,齐全!全开、不设限!不分什么社区版、商业版! 11 | ## 😄功能完整性:话务系统,工单系统,IM在线客服系统,录音系统,功能齐全、不设限! 12 | ## 😄持续性:2014年至今持续迭代,成员来自Cisco、Avaya、大唐电信、华为、FreeSWITCH等生态企业,长期主义! 13 | ## 😄长期目标:疯狂地创造价值,引领呼叫中心行业发展,将大模型呼叫中心能力,赋能1万家集成商,服务120万个客户! 14 | ## 😄大客户案例:电信、华数(广电)、联通,四大运营商已合作三家(移动400业务覆盖有限) 15 | 16 | 17 | 18 | 19 | # 附:团队的开源呼叫中心系统FreeAICC(AI Call Center)的愿景与基础功能阐述 20 | 愿景: 21 | 我们的愿景是打造一个开放、灵活且强大的开源呼叫中心解决方案,赋能全球的企业和组织,无论规模大小,都能轻松构建并运营自己的客户服务体系。我们相信,通过共享源代码、促进技术创新与协作,能够打破传统呼叫中心的壁垒,让每一位开发者、企业主乃至终端用户都能从中受益。我们的目标不仅仅是提供一个工具,而是构建一个生态系统,让不同背景、不同需求的用户能够共同探索、定制并优化呼叫中心的功能与体验,最终推动整个客户服务行业的进步与发展! 22 | 23 | 基础功能: 24 | 1. 多渠道接入:支持电话、短信、社交媒体、电子邮件、网页聊天等多种客户沟通渠道,实现客户需求的无缝对接与统一管理。 25 | 2. 智能路由:基于预设规则或AI算法,自动将客户请求分配给最合适的客服代表或自助服务模块,确保客户问题得到及时、专业的处理。 26 | 3. IVR(交互式语音应答)系统:提供灵活的语音菜单设计,引导客户自助完成查询、报修等常见操作,减轻人工坐席压力,提升服务效率。 27 | 4. 坐席管理:提供全面的坐席管理工具,包括实时监控、录音回放、工单管理、绩效统计等,帮助管理者优化团队运作,提升服务质量。 28 | 5. CRM集成:支持与主流CRM系统无缝集成,自动同步客户信息,实现客户数据的全面整合与利用,为个性化服务提供数据支持。 29 | 6. 数据分析与报表:内置强大的数据分析引擎,自动生成各类服务报表,如通话量统计、客户满意度调查、服务效率分析等,为决策提供数据依据。 30 | 7. 开放API与插件扩展:提供丰富的API接口,支持第三方开发者基于我们的平台进行功能扩展或定制开发,同时,我们也将积极维护一个插件市场,收录优质插件供用户选择。 31 | 8. 云原生架构:采用云原生架构设计,支持快速部署、弹性扩展与自动运维,降低用户的IT成本与维护难度,同时保证系统的高可用性与安全性。 32 | 9. 高度可配置:提供直观的配置界面,让用户无需编程即可根据自身需求调整系统参数、优化工作流程,实现快速定制与部署。 33 | 10. 社区支持与生态共建:建立一个活跃的开源社区,鼓励用户分享经验、提出需求、贡献代码,共同推动项目的持续发展与完善。我们相信,通过社区的力量,我们的开源呼叫中心将不断进化,成为客户服务领域的佼佼者! 34 | 35 | ![image](https://github.com/user-attachments/assets/604a9a46-edc8-4a1f-9f94-a5021f178101) 36 | ![freeipcc14](https://github.com/user-attachments/assets/c1e5a412-6a38-48bc-bbad-2a129af562e7) 37 | ![image](https://github.com/user-attachments/assets/e7fcb31f-530b-4b96-a6e3-e90fb9f5db60) 38 | ![image](https://github.com/user-attachments/assets/52064c20-f502-423a-9546-b865aa2e11ff) 39 | ![image](https://github.com/user-attachments/assets/b68d242e-ca19-4806-b84c-11239ee2d8f6) 40 | ![image](https://github.com/user-attachments/assets/11367dfa-22d2-4976-8ec8-6e3c51b84e46) 41 | ![freeipcc15](https://github.com/user-attachments/assets/a9b20c37-2b29-4a92-b06a-af1fcc5c75ed) 42 | ![05-大模型呼叫中心-自助建工单-自助解决问题-拓扑简图01](https://github.com/user-attachments/assets/0b53f8b5-72f3-4f1f-82d4-cf50f60ad875) 43 | ![image](https://github.com/user-attachments/assets/8bfca84f-996f-4cb3-ae35-88918e99f8f7) 44 | ![image](https://github.com/user-attachments/assets/34ec0973-a012-47ae-b924-3d25a9c65c58) 45 | ![image](https://github.com/user-attachments/assets/dd5ef068-e4cc-48ba-aaa6-074f1eade244) 46 | ![image](https://github.com/user-attachments/assets/7889efb4-85e9-45b2-84a4-ea837dc6b7fd) 47 | ![image](https://github.com/user-attachments/assets/96c81618-9d85-4d32-9f9a-6719426b4640) 48 | ![image](https://github.com/user-attachments/assets/38877999-8119-4bb9-b280-4f0b26a06414) 49 | ![image](https://github.com/user-attachments/assets/5c3f7012-629a-4f4f-a5cf-f4ce72b9a095) 50 | ![image](https://github.com/user-attachments/assets/ecd3785c-499b-4c62-abea-eba066dd6daa) 51 | 52 | ## 🤔工单系统功能列表 53 | 54 | ![image](https://github.com/user-attachments/assets/b3579741-07f2-4f2d-936e-b97bfca38b17) 55 | ![image](https://github.com/user-attachments/assets/c4f7ccb6-02b9-4345-aa53-a1898b2db04c) 56 | 57 | ## 😄每一个用户,都有专属群支持:10人左右,响应更及时 58 | 59 | 下图是随机抽取的需求对接的群: 60 | 61 | ![image](https://github.com/user-attachments/assets/9abb6028-239d-4e17-8314-e0f3258d2395) 62 | ![image](https://github.com/user-attachments/assets/7c358cb1-aa9e-4279-9e09-9b53a2c63a61) 63 | ![image](https://github.com/user-attachments/assets/51e22d52-9d81-4549-a699-4bbf81e21242) 64 | ![image](https://github.com/user-attachments/assets/96fc0164-d3cd-4a7c-bb1c-9f2b49670ec3) 65 | ![image](https://github.com/user-attachments/assets/d973ab28-f83b-4bdd-bf9e-3f0130811eaa) 66 | ![image](https://github.com/user-attachments/assets/71abf504-db94-4618-ab35-725f5de8c8f8) 67 | ![image](https://github.com/user-attachments/assets/a9a519c1-02ba-455c-a53a-bb98de8551c5) 68 | ![image](https://github.com/user-attachments/assets/e28c4c61-9105-4461-ab68-988bcc14736c) 69 | 70 | # 😄再次表达一下价值观:我们坚信,软件只有被用起来,才能给用户带去价值,才能让自身产生迭代!!! 71 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/action/BaseAction.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.action; 2 | 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.Cookie; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import org.apache.commons.lang3.StringUtils; 10 | import org.apache.struts2.ServletActionContext; 11 | import org.apache.struts2.interceptor.ServletRequestAware; 12 | import org.apache.struts2.interceptor.ServletResponseAware; 13 | import org.apache.struts2.interceptor.SessionAware; 14 | 15 | import com.opensymphony.xwork2.ActionSupport; 16 | import com.sxx.jcc.common.utils.Escape; 17 | import com.sxx.jcc.core.dao.hibernate.Page; 18 | 19 | public class BaseAction extends ActionSupport implements SessionAware, 20 | ServletRequestAware, ServletResponseAware { 21 | 22 | private static final long serialVersionUID = BaseAction.class.hashCode(); 23 | protected Map session = null; 24 | protected HttpServletRequest request = null; 25 | protected HttpServletResponse response = null; 26 | private Page page; 27 | protected Message message; 28 | protected String res; 29 | protected String basePath; 30 | 31 | public String getRes() { 32 | return getRequest().getContextPath() + "/resource"; 33 | } 34 | 35 | public void setRes(String res) { 36 | this.res = res; 37 | } 38 | 39 | public String getBasePath() { 40 | return getRequest().getContextPath(); 41 | } 42 | 43 | public void setBasePath(String basePath) { 44 | this.basePath = basePath; 45 | } 46 | 47 | 48 | 49 | public Message getMessage() { 50 | return message; 51 | } 52 | 53 | public void setMessage(Message message) { 54 | this.message = message; 55 | } 56 | 57 | /** IoC注入方式 */ 58 | public void setSession(Map session) { 59 | this.session = session; 60 | } 61 | 62 | /** IoC注入方式 */ 63 | public void setServletRequest(HttpServletRequest request) { 64 | this.request = request; 65 | } 66 | 67 | /** IoC注入方式 */ 68 | public void setServletResponse(HttpServletResponse response) { 69 | this.response = response; 70 | } 71 | 72 | /** 设置上次请求动作防止刷新 */ 73 | protected void setPreAction(String actionName) { 74 | session.put("PreAction", actionName); 75 | } 76 | 77 | /** 取得上次请求动作防止刷新 */ 78 | protected String getPreAction() { 79 | return (String) session.get("PreAction"); 80 | } 81 | 82 | /** 非IoC注入方式 */ 83 | protected HttpServletRequest getRequest() { 84 | return ServletActionContext.getRequest(); 85 | } 86 | 87 | /** 非IoC注入方式 */ 88 | protected HttpServletResponse getResponse() { 89 | return ServletActionContext.getResponse(); 90 | } 91 | 92 | 93 | /** 从Cookie中获取每页显示数量 */ 94 | public int pagesizecol() { 95 | int j = 0; 96 | String pagesizecol = null; 97 | Cookie[] cookies = request.getCookies(); 98 | for (int i = 0; i < cookies.length; i++) { 99 | if ("pagesizecol".equals(cookies[i].getName())) { 100 | pagesizecol = Escape.unescape(cookies[i].getValue()); 101 | } 102 | } 103 | if (StringUtils.isNotBlank(pagesizecol)) { 104 | j = Integer.parseInt(pagesizecol); 105 | } else { 106 | //j = Constants.DEFAULT_PAGE_SIZE; 107 | } 108 | return j; 109 | } 110 | 111 | /** ajax配置response参数 */ 112 | protected void setResponseParas() { 113 | response.setContentType("text/xml;charset=utf-8"); 114 | response.setHeader("Cache-Control", "no-cache, no-store"); 115 | response.setHeader("Expires", "Sun, 19 Nov 1978 05:00:00 GMT"); 116 | response.setHeader("Pragma", "no-cache"); 117 | } 118 | 119 | protected void setResponseJsonParas() { 120 | response.setContentType("text/script;charset=utf-8"); 121 | response.setHeader("Cache-Control", "no-cache, no-store"); 122 | response.setHeader("Expires", "Sun, 19 Nov 1978 05:00:00 GMT"); 123 | response.setHeader("Pragma", "no-cache"); 124 | } 125 | 126 | public Page getPage() { 127 | return page; 128 | } 129 | 130 | public void setPage(Page page) { 131 | this.page = page; 132 | } 133 | 134 | public void setInfoMsg(String text){ 135 | Message msg = new Message(); 136 | msg.setMsgType("I"); 137 | msg.setMsgText(text); 138 | this.message = msg; 139 | } 140 | public void setWarningMsg(String text){ 141 | Message msg = new Message(); 142 | msg.setMsgType("W"); 143 | msg.setMsgText(text); 144 | this.message = msg; 145 | } 146 | public void setNewOrderInfoMsg(String text){ 147 | Message msg = new Message(); 148 | msg.setMsgType("N"); 149 | msg.setMsgText(text); 150 | this.message = msg; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/action/Message.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.action; 2 | 3 | public class Message { 4 | private String msgType; 5 | private String msgText; 6 | public String getMsgType() { 7 | return msgType; 8 | } 9 | public void setMsgType(String msgType) { 10 | this.msgType = msgType; 11 | } 12 | public String getMsgText() { 13 | return msgText; 14 | } 15 | public void setMsgText(String msgText) { 16 | this.msgText = msgText; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/service/BaseReportService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.service; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | import javax.annotation.Resource; 10 | 11 | import org.apache.commons.beanutils.BeanUtils; 12 | import org.apache.commons.beanutils.ConvertUtils; 13 | import org.apache.commons.beanutils.converters.DateConverter; 14 | import org.apache.commons.lang3.StringUtils; 15 | import org.apache.log4j.Logger; 16 | import org.springframework.jdbc.core.JdbcTemplate; 17 | import org.springframework.util.Assert; 18 | 19 | import com.sxx.jcc.common.utils.XKTools; 20 | import com.sxx.jcc.core.dao.hibernate.Page; 21 | 22 | public abstract class BaseReportService { 23 | protected Logger logger = Logger.getLogger(BaseReportService.class.getName()); 24 | 25 | @Resource 26 | private JdbcTemplate informixTemplate; 27 | 28 | public List>queryForMapList(String sql,final Object... objects){ 29 | List> resultList = new ArrayList>(); 30 | try{ 31 | logger.info(sql); 32 | List> result = this.getInformixTemplate().queryForList(sql, objects); 33 | for(Map map : result){ 34 | resultList.add(XKTools.coverMap(map)); 35 | } 36 | }catch(Exception e){ 37 | logger.error(e); 38 | } 39 | return resultList; 40 | } 41 | 42 | public List queryForObjectList(String sql,Class entityClass,final Object... objects){ 43 | List resultList = new ArrayList(); 44 | try{ 45 | List> result = this.getInformixTemplate().queryForList(sql, objects); 46 | Object obj; 47 | for(Map map : result){ 48 | obj = entityClass.getDeclaredConstructor().newInstance(); 49 | ConvertUtils.register(new DateConverter(null), java.util.Date.class); 50 | BeanUtils.populate(obj, XKTools.coverMap(map)); 51 | resultList.add((T)obj); 52 | } 53 | }catch(Exception e){ 54 | logger.error(e); 55 | } 56 | return resultList; 57 | } 58 | 59 | public Page queryForMapPage(String sql,Page pageParm,final Object... objects){ 60 | int totalCount = this.getTotlaCount(sql, objects); 61 | if(totalCount<=0){ 62 | return new Page(); 63 | } 64 | int startIndex = Page.getStartOfPage(pageParm.getPage(), pageParm.getPagesize()); 65 | sql = addOrderByStr(sql,pageParm); 66 | String exeSql = getPageSQL(sql, startIndex, pageParm.getPagesize()); 67 | List> resultMapList =this.queryForMapList(exeSql, objects); 68 | return new Page(pageParm.getPage(),pageParm.getPagesize(),totalCount,resultMapList); 69 | } 70 | 71 | public int getTotlaCount(String sql,final Object... objects){ 72 | String countSqlString = "select count(*) from (" + removeOrders(sql) + ") a"; 73 | return this.getInformixTemplate().queryForInt(countSqlString, objects); 74 | } 75 | 76 | public void excuteProcedure(String sql,final Object... objects){ 77 | //this.getJdbcTemplate().ex 78 | } 79 | 80 | private String addOrderByStr(String sql, Page pageParm){ 81 | String orderbyStr =""; 82 | if(StringUtils.isNotBlank(pageParm.getSortname())){ 83 | orderbyStr = "select * from (" + sql + ") a order by " +pageParm.getSortname()+" "+pageParm.getSortorder(); 84 | //orderbyStr = removeOrders(sql)+" order by " +pageParm.getSortname()+" "+pageParm.getSortorder(); 85 | }else{ 86 | orderbyStr = sql; 87 | } 88 | return orderbyStr; 89 | } 90 | 91 | private String removeOrders(String sql) { 92 | Assert.hasText(sql); 93 | Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE); 94 | Matcher m = p.matcher(sql); 95 | StringBuffer sb = new StringBuffer(); 96 | while (m.find()) { 97 | m.appendReplacement(sb, ""); 98 | } 99 | m.appendTail(sb); 100 | return sb.toString(); 101 | } 102 | 103 | private String getPageSQL(String sql, int startIndex, int pageSize) { 104 | String sql2 = "select * " + " from (select row_.*, rownum rownum_ " + " from (" + sql + ") row_" + " where rownum <= " + (startIndex + pageSize) + ")" + " where rownum_ >" + startIndex; 105 | return sql2; 106 | } 107 | 108 | public JdbcTemplate getInformixTemplate() { 109 | return informixTemplate; 110 | } 111 | 112 | public void setInformixTemplate(JdbcTemplate informixTemplate) { 113 | this.informixTemplate = informixTemplate; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/service/IBaseReportSevice.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.service; 2 | 3 | public interface IBaseReportSevice { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/service/IBaseService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.service; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public interface IBaseService { 7 | public T get(Class entityClass, Serializable id); 8 | 9 | public List getAll(Class entityClass); 10 | 11 | public void save(Object o); 12 | 13 | public void update(Object o); 14 | 15 | public Serializable add(Object o); 16 | 17 | public void delete(Object o); 18 | 19 | public void removeById(Class entityClass, Serializable id); 20 | } 21 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/Base62.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | import org.apache.commons.codec.digest.DigestUtils; 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | public class Base62 { 7 | private static final int BINARY = 0x2; 8 | 9 | private static final int NUMBER_61 = 0x0000003d; 10 | 11 | static final char[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 12 | 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 13 | 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 14 | 'X', 'Y', 'Z' }; 15 | 16 | 17 | public static String encode(long value){ 18 | return encode(String.valueOf(value)).toLowerCase() ; 19 | } 20 | 21 | public static String encode(String str){ 22 | String md5Hex = DigestUtils.md5Hex(str); 23 | // 6 digit binary can indicate 62 letter & number from 0-9a-zA-Z 24 | int binaryLength = 6 * 6; 25 | long binaryLengthFixer = Long.valueOf(StringUtils.repeat("1", binaryLength), BINARY); 26 | for (int i = 0; i < 4;) { 27 | String subString = StringUtils.substring(md5Hex, i * 8, (i + 1) * 8); 28 | subString = Long.toBinaryString(Long.valueOf(subString, 16) & binaryLengthFixer); 29 | subString = StringUtils.leftPad(subString, binaryLength, "0"); 30 | StringBuilder sbBuilder = new StringBuilder(); 31 | for (int j = 0; j < 6; j++) { 32 | String subString2 = StringUtils.substring(subString, j * 6, (j + 1) * 6); 33 | int charIndex = Integer.valueOf(subString2, BINARY) & NUMBER_61; 34 | sbBuilder.append(DIGITS[charIndex]); 35 | } 36 | String shortUrl = sbBuilder.toString(); 37 | if(shortUrl!=null){ 38 | return shortUrl; 39 | } 40 | } 41 | // if all 4 possibilities are already exists 42 | return null; 43 | } 44 | 45 | @SuppressWarnings("unused") 46 | private static void print(Object messagr){ 47 | System.out.println(messagr); 48 | } 49 | } -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/BrowserClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | public class BrowserClient { 4 | private String useragent ; 5 | private String os ; 6 | private String browser ; 7 | private String version ; 8 | private String osversion ; 9 | 10 | public String getUseragent() { 11 | return useragent; 12 | } 13 | public void setUseragent(String useragent) { 14 | this.useragent = useragent; 15 | } 16 | public String getOs() { 17 | return os; 18 | } 19 | public void setOs(String os) { 20 | this.os = os; 21 | } 22 | public String getBrowser() { 23 | return browser; 24 | } 25 | public void setBrowser(String browser) { 26 | this.browser = browser; 27 | } 28 | public String getVersion() { 29 | return version; 30 | } 31 | public void setVersion(String version) { 32 | this.version = version; 33 | } 34 | public String getOsversion() { 35 | return osversion; 36 | } 37 | public void setOsversion(String osversion) { 38 | this.osversion = osversion; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/DateJsonValueProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | import net.sf.json.JsonConfig; 8 | import net.sf.json.processors.JsonValueProcessor; 9 | 10 | public class DateJsonValueProcessor implements JsonValueProcessor { 11 | 12 | 13 | public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd"; 14 | private DateFormat dateFormat; 15 | 16 | 17 | 18 | /** *//** 19 | * 构造方法. 20 | * 21 | * @param datePattern 日期格式 22 | */ 23 | public DateJsonValueProcessor(String datePattern) { 24 | 25 | if( null == datePattern ) 26 | dateFormat = new SimpleDateFormat(DEFAULT_DATE_PATTERN); 27 | else 28 | dateFormat = new SimpleDateFormat(datePattern); 29 | 30 | } 31 | 32 | 33 | 34 | /**//* (非 Javadoc) 35 | * @see net.sf.json.processors.JsonValueProcessor#processArrayValue(java.lang.Object, net.sf.json.JsonConfig) 36 | */ 37 | public Object processArrayValue(Object arg0, JsonConfig arg1) { 38 | // TODO 自动生成方法存根 39 | return process(arg0); 40 | } 41 | 42 | /**//* (非 Javadoc) 43 | * @see net.sf.json.processors.JsonValueProcessor#processObjectValue(java.lang.String, java.lang.Object, net.sf.json.JsonConfig) 44 | */ 45 | public Object processObjectValue(String arg0, Object arg1, JsonConfig arg2) { 46 | // TODO 自动生成方法存根 47 | return process(arg1); 48 | } 49 | 50 | private Object process(Object value) { 51 | if(value==null){ 52 | return ""; 53 | } 54 | return dateFormat.format((Date) value); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/IdGenerator.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | import java.util.Date; 4 | 5 | public class IdGenerator { 6 | private static int num = 100000; 7 | private static int num_ = 100000; 8 | 9 | private IdGenerator(){ 10 | 11 | } 12 | 13 | /** 14 | * get unique user id 15 | * user id range from 100000 to 900000 , each second 16 | * @return a String Object of the unique id 17 | */ 18 | public synchronized static String getUniqueId(){ 19 | String currentDay = DateUtil.format(new Date(),"yyyyMMddHHmmss"); 20 | int cnt = ++num; 21 | if(cnt>900000){ 22 | num=100000; 23 | } 24 | return currentDay+cnt; 25 | } 26 | 27 | public synchronized static String getUniqueIdForOrder(){ 28 | String currentDay = DateUtil.format(new Date(),"yyyyMMddHHmmss"); 29 | int cnt = ++num_; 30 | if(cnt>900000){ 31 | num_=100000; 32 | } 33 | return "D"+currentDay+cnt; 34 | } 35 | public synchronized static String getUniqueIdForService(){ 36 | String currentDay = DateUtil.format(new Date(),"yyyyMMddHHmmss"); 37 | int cnt = ++num_; 38 | if(cnt>900000){ 39 | num_=100000; 40 | } 41 | return "S"+currentDay+cnt; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/MD5Encrypt.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | import java.security.MessageDigest; 4 | /** 5 | * 6 | * @author catv 7 | * 8 | */ 9 | public class MD5Encrypt { 10 | 11 | public MD5Encrypt() { 12 | 13 | } 14 | 15 | private final static String[] hexDigits = { 16 | "0", "1", "2", "3", "4", "5", "6", "7", 17 | "8", "9", "a", "b", "c", "d", "e", "f"}; 18 | 19 | /** 20 | * 转换字节数组为16进制字串 21 | * @param b 字节数组 22 | * @return 16进制字串 23 | */ 24 | public static String byteArrayToString(byte[] b) { 25 | StringBuffer resultSb = new StringBuffer(); 26 | for (int i = 0; i < b.length; i++) { 27 | resultSb.append(byteToHexString(b[i]));//若使用本函数转换则可得到加密结果的16进制表示,即数字字母混合的形式 28 | // resultSb.append(byteToNumString(b[i]));//使用本函数则返回加密结果的10进制数字字串,即全数字形式 29 | } 30 | return resultSb.toString(); 31 | } 32 | 33 | private static String byteToNumString(byte b) { 34 | 35 | int _b = b; 36 | if (_b < 0) { 37 | _b = 256 + _b; 38 | } 39 | 40 | return String.valueOf(_b); 41 | } 42 | 43 | private static String byteToHexString(byte b) { 44 | int n = b; 45 | if (n < 0) { 46 | n = 256 + n; 47 | } 48 | int d1 = n / 16; 49 | int d2 = n % 16; 50 | return hexDigits[d1] + hexDigits[d2]; 51 | } 52 | 53 | public static String MD5Encode(String origin) { 54 | String resultString = null; 55 | 56 | try { 57 | resultString = new String(origin); 58 | MessageDigest md = MessageDigest.getInstance("MD5"); 59 | resultString = byteArrayToString(md.digest(resultString.getBytes())); 60 | } 61 | catch (Exception ex) { 62 | ex.printStackTrace(); 63 | } 64 | return resultString; 65 | } 66 | /** 67 | * 68 | * @param args 69 | */ 70 | public static void main(String[] args) { 71 | System.out.println(MD5Encode("2")); 72 | System.out.println("bjdv:"+MD5Encode("bjdv")); 73 | } 74 | } -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/NameConverter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils; 2 | 3 | import java.util.ArrayList; 4 | import java.util.StringTokenizer; 5 | 6 | /** 7 | * Convert names to specified style
8 | * 2007-5-15 9 | * 10 | * @author wangcl 11 | * 12 | */ 13 | public class NameConverter { 14 | private static NameConverter instance = null; 15 | 16 | private NameConverter() { 17 | } 18 | 19 | public static NameConverter getInstance() { 20 | if (instance == null) { 21 | instance = new NameConverter(); 22 | } 23 | return instance; 24 | } 25 | 26 | /** 27 | * convert database names separated by '_' to java field names
28 | * eg. user_id -> userId 29 | * 30 | * @param dbname 31 | * @return 32 | */ 33 | public String convert(String dbname) { 34 | String name = ""; 35 | StringTokenizer st = new StringTokenizer(dbname, "_"); 36 | if (!st.hasMoreTokens()) { 37 | throw new RuntimeException("name is null"); 38 | } 39 | name += st.nextToken().toLowerCase(); 40 | while (st.hasMoreTokens()) { 41 | String token = st.nextToken(); 42 | if (token.length() == 1) { 43 | name += token.toUpperCase(); 44 | } else { 45 | String first = token.substring(0, 1); 46 | String others = token.substring(1, token.length()); 47 | name += (first.toUpperCase() + others.toLowerCase()); 48 | } 49 | 50 | } 51 | return name; 52 | } 53 | 54 | /** 55 | * convert field names in vo to database column names
56 | * eg. bankBranchId -> BANK_BRANCH_ID 57 | * 58 | * @param voname 59 | * @return 60 | */ 61 | public String convertToDb(String voname) { 62 | String name = ""; 63 | ArrayList positions = new ArrayList(); 64 | positions.add(new Integer(0)); 65 | char[] letters = voname.toCharArray(); 66 | for (int i = 0; i < letters.length; i++) { 67 | char letter = letters[i]; 68 | if (letter > 64 && letter < 91) { // an uppercase letter 69 | positions.add(new Integer(i)); 70 | } 71 | } 72 | positions.add(new Integer(letters.length)); 73 | for (int j = 1; j < positions.size(); j++) { 74 | int from = ((Integer) (positions.get(j - 1))).intValue(); 75 | int to = ((Integer) (positions.get(j))).intValue(); 76 | name += voname.substring(from, to).toUpperCase() + "_"; 77 | } 78 | return name.substring(0, name.length() - 1); 79 | } 80 | public static void main(String []a){ 81 | String str = "CreateDate"; 82 | System.out.println(NameConverter.class.getSimpleName()); 83 | } 84 | /** 85 | * change the first letter of a string to upper case
86 | * eg. userId -> UserId 87 | * 88 | * @param name 89 | * @param caseOfFirstLetter 90 | * @return 91 | */ 92 | public String setUpperCaseForFirstLetter(String name) { 93 | if (name.length() == 1) { 94 | return name.toUpperCase(); 95 | } 96 | String firstLetter = name.substring(0, 1); 97 | String others = name.substring(1, name.length()); 98 | return firstLetter.toUpperCase() + others; 99 | } 100 | public String setLowerCaseForFirstLetter(String name) { 101 | if (name.length() == 1) { 102 | return name.toLowerCase(); 103 | } 104 | String firstLetter = name.substring(0, 1); 105 | String others = name.substring(1, name.length()); 106 | return firstLetter.toLowerCase() + others; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/SpringBeanFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.sxx.jcc.common.utils; 5 | 6 | import org.springframework.context.ApplicationContext; 7 | import org.springframework.context.ApplicationContextAware; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository("SpringBeanFactory") 11 | public class SpringBeanFactory implements ApplicationContextAware { 12 | 13 | private static ApplicationContext context; 14 | 15 | /** 16 | * @return the context 17 | */ 18 | public static ApplicationContext getContext() { 19 | return context; 20 | } 21 | 22 | public void setApplicationContext(ApplicationContext applicationContext){ 23 | context = applicationContext; 24 | XKDataContext.setApplicationContext(applicationContext); 25 | } 26 | 27 | public final static Object getBean(String beanName) { 28 | if(getContext()==null){ 29 | throw new RuntimeException("the springApplicationContext is not exist ! "); 30 | } 31 | return getContext().getBean(beanName); 32 | } 33 | 34 | public final static T getBean(Class requiredType) { 35 | if(getContext()==null){ 36 | throw new RuntimeException("the springApplicationContext is not exist ! "); 37 | } 38 | return getContext().getBean(requiredType); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/disruptor/UserDataEventFactory.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.disruptor; 2 | 3 | import com.lmax.disruptor.EventFactory; 4 | import com.sxx.jcc.common.utils.event.UserDataEvent; 5 | public class UserDataEventFactory implements EventFactory{ 6 | 7 | @Override 8 | public UserDataEvent newInstance() { 9 | return new UserDataEvent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/disruptor/UserDataEventProducer.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.disruptor; 2 | 3 | import com.lmax.disruptor.RingBuffer; 4 | import com.sxx.jcc.common.utils.event.UserDataEvent; 5 | import com.sxx.jcc.common.utils.event.UserEvent; 6 | 7 | public class UserDataEventProducer { 8 | private final RingBuffer ringBuffer; 9 | 10 | public UserDataEventProducer(RingBuffer ringBuffer) 11 | { 12 | this.ringBuffer = ringBuffer; 13 | } 14 | 15 | public void onData(UserEvent userEvent) 16 | { 17 | long id = ringBuffer.next(); // Grab the next sequence 18 | try{ 19 | UserDataEvent event = ringBuffer.get(id); 20 | event.setEvent(userEvent); 21 | }finally{ 22 | ringBuffer.publish(id); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/disruptor/UserEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.disruptor; 2 | 3 | import com.lmax.disruptor.EventHandler; 4 | import com.sxx.jcc.common.utils.event.UserDataEvent; 5 | import com.sxx.jcc.common.utils.mail.Mail; 6 | import com.sxx.jcc.webim.pojo.OnlineUser; 7 | import com.sxx.jcc.webim.pojo.RequestLog; 8 | import com.sxx.jcc.webim.pojo.StatusEvent; 9 | import com.sxx.jcc.webim.pojo.UserHistory; 10 | import com.sxx.jcc.webim.pojo.UserTraceHistory; 11 | 12 | public class UserEventHandler implements EventHandler{ 13 | 14 | @Override 15 | public void onEvent(UserDataEvent arg0, long arg1, boolean arg2) 16 | throws Exception { 17 | if(arg0.getEvent() instanceof UserHistory){ 18 | //UserEventRepository userEventRes = UKDataContext.getContext().getBean(UserEventRepository.class) ; 19 | //userEventRes.save((UserHistory)arg0.getEvent()) ; 20 | }else if(arg0.getEvent() instanceof UserTraceHistory){ 21 | //UserTraceRepository userTraceRes = UKDataContext.getContext().getBean(UserTraceRepository.class) ; 22 | //userTraceRes.save((UserTraceHistory)arg0.getEvent()) ; 23 | }else if(arg0.getEvent() instanceof RequestLog){ 24 | //RequestLogRepository requestLogRes = UKDataContext.getContext().getBean(RequestLogRepository.class) ; 25 | //requestLogRes.save((RequestLog)arg0.getEvent()) ; 26 | }else if(arg0.getEvent() instanceof OnlineUser){ 27 | /**OnlineUserRepository onlineUserRes = UKDataContext.getContext().getBean(OnlineUserRepository.class) ; 28 | OnlineUser onlineUser = (OnlineUser)arg0.getEvent() ; 29 | List onlineUserList = onlineUserRes.findByUseridAndOrgi(onlineUser.getUserid(), onlineUser.getOrgi()) ; 30 | if(onlineUserList.size() == 0){ 31 | onlineUserRes.save(onlineUser) ; 32 | }**/ 33 | }if(arg0.getEvent() instanceof StatusEvent){ 34 | /**StatusEvent statusEvent = (StatusEvent)arg0.getEvent() ; 35 | QualityConfig qConfig = UKTools.initQualityConfig(statusEvent.getOrgi()) ; 36 | if(qConfig.isPhonetic() && !StringUtils.isBlank(qConfig.getEngine())) { 37 | PhoneticTranscription trans = (PhoneticTranscription) UKDataContext.getContext().getBean(qConfig.getEngine()) ; 38 | if(trans!=null) { 39 | File voiceFile = UKTools.crawlVoiceRecord(statusEvent) ; 40 | if(voiceFile != null) { 41 | String taskid = trans.getLfasr(statusEvent.getUserid(), statusEvent.getOrgi(), statusEvent.getOrgan(), statusEvent, voiceFile.getAbsolutePath(), qConfig); 42 | statusEvent.setTranid(taskid); 43 | StatusEventRepository statusEventRes = UKDataContext.getContext().getBean(StatusEventRepository.class) ; 44 | statusEventRes.save(statusEvent) ; 45 | } 46 | } 47 | }**/ 48 | }else if(arg0.getEvent() instanceof Mail){ 49 | /**Mail mail = (Mail)arg0.getEvent() ; 50 | if(null!=mail&&!StringUtils.isBlank(mail.getEmail())) { 51 | UKTools.sendMail(mail.getEmail(), mail.getCc(), mail.getSubject(), mail.getContent(), mail.getFilenames()); 52 | }**/ 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/disruptor/multiupdate/MultiUpdateEventFactory.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.disruptor.multiupdate; 2 | 3 | import com.lmax.disruptor.EventFactory; 4 | import com.sxx.jcc.common.utils.event.UserDataEvent; 5 | 6 | public class MultiUpdateEventFactory implements EventFactory{ 7 | 8 | @Override 9 | public UserDataEvent newInstance() { 10 | return new UserDataEvent(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/event/AiEvent.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.event; 2 | 3 | public class AiEvent { 4 | private long id ; 5 | 6 | private UserEvent event ; 7 | 8 | public long getId() { 9 | return id; 10 | } 11 | 12 | public void setId(long id) { 13 | this.id = id; 14 | } 15 | 16 | public UserEvent getEvent() { 17 | return event; 18 | } 19 | 20 | public void setEvent(UserEvent event) { 21 | this.event = event; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/event/UserDataEvent.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.event; 2 | 3 | public class UserDataEvent{ 4 | private long id ; 5 | 6 | private UserEvent event ; 7 | 8 | public long getId() { 9 | return id; 10 | } 11 | 12 | public void setId(long id) { 13 | this.id = id; 14 | } 15 | 16 | public UserEvent getEvent() { 17 | return event; 18 | } 19 | 20 | public void setEvent(UserEvent event) { 21 | this.event = event; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /sample/common/src/com/sxx/jcc/common/utils/event/UserEvent.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.common.utils.event; 2 | 3 | public interface UserEvent extends java.io.Serializable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/cache/CacheBean.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.cache; 2 | 3 | import java.util.Collection; 4 | import java.util.concurrent.locks.Lock; 5 | 6 | import com.hazelcast.internal.json.JsonObject; 7 | 8 | 9 | public interface CacheBean { 10 | /** 11 | * 12 | */ 13 | public void put(String key , Object value , String orgi) ; 14 | 15 | 16 | /** 17 | * 18 | * @param key 19 | * @param orgi 20 | * @return 21 | */ 22 | public Object getCacheObject(String key, String orgi) ; 23 | 24 | 25 | public CacheBean getCacheInstance(String cacheName); 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/cache/CacheInstance.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.cache; 2 | 3 | 4 | public interface CacheInstance { 5 | /** 6 | * 坐席状态 7 | * @return 8 | */ 9 | public CacheBean getAgentStatusCacheBean() ; 10 | 11 | 12 | /** 13 | * 服务中用户 14 | * @return 15 | */ 16 | public CacheBean getAgentUserCacheBean(); 17 | 18 | 19 | /** 20 | * 在线用户 21 | * @return 22 | */ 23 | public CacheBean getOnlineCacheBean(); 24 | 25 | /** 26 | * 系统缓存 27 | * @return 28 | */ 29 | public CacheBean getSystemCacheBean(); 30 | 31 | 32 | /** 33 | * IMR指令 34 | * @return 35 | */ 36 | public CacheBean getIMRCacheBean(); 37 | 38 | /** 39 | * IMR指令 40 | * @return 41 | */ 42 | public CacheBean getCallCenterCacheBean(); 43 | 44 | /** 45 | * IMR指令 46 | * @return 47 | */ 48 | public CacheBean getCallCenterAgentCacheBean(); 49 | 50 | /** 51 | * IMR指令 52 | * @return 53 | */ 54 | public CacheBean getApiUserCacheBean(); 55 | 56 | /** 57 | * IMR指令 58 | * @return 59 | */ 60 | public CacheBean getJobCacheBean(); 61 | 62 | /** 63 | * 外呼 64 | * @return 65 | */ 66 | public CacheBean getCallOutCacheBean(); 67 | 68 | 69 | /** 70 | * QC队列 71 | * @return 72 | */ 73 | public CacheBean getQcQueueBean() ; 74 | 75 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/cache/MemCached.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.cache; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import com.alisoft.xplatform.asf.cache.ICacheManager; 7 | import com.alisoft.xplatform.asf.cache.IMemcachedCache; 8 | import com.alisoft.xplatform.asf.cache.memcached.CacheUtil; 9 | import com.alisoft.xplatform.asf.cache.memcached.MemcachedCacheManager; 10 | 11 | public class MemCached { 12 | 13 | protected final static Logger logger = LoggerFactory.getLogger(MemCached.class); 14 | 15 | private static MemCached instance; 16 | 17 | private static ICacheManager manager; 18 | 19 | private static IMemcachedCache cache; 20 | 21 | private MemCached() { 22 | manager = CacheUtil.getCacheManager(IMemcachedCache.class, MemcachedCacheManager.class.getName()); 23 | manager.setConfigFile("memcached.xml"); 24 | manager.setResponseStatInterval(0); 25 | manager.start(); 26 | cache = manager.getCache("mclient0"); 27 | } 28 | 29 | public static synchronized MemCached getInstance() { 30 | if (instance == null) { 31 | try { 32 | instance = new MemCached(); 33 | } catch (Exception e) { 34 | logger.error(e.toString()); 35 | } 36 | } 37 | return instance; 38 | } 39 | 40 | public IMemcachedCache getCache() { 41 | return cache; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/cache/SystemCache.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.cache; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.PostConstruct; 8 | 9 | import org.apache.commons.lang3.StringUtils; 10 | import org.apache.log4j.Logger; 11 | import org.springframework.stereotype.Component; 12 | 13 | import com.sxx.jcc.common.utils.XKDataContext; 14 | import com.sxx.jcc.system.pojo.AgentUser; 15 | import com.sxx.jcc.system.pojo.SessionConfig; 16 | import com.sxx.jcc.webim.pojo.AgentStatus; 17 | 18 | @Component 19 | public class SystemCache{ 20 | protected static Logger log = Logger.getLogger(SystemCache.class); 21 | public static enum CacheServiceEnum{ 22 | AGENT_STATUS_CACHE, 23 | QUENE_USER_CACHE, 24 | ONLINE_CACHE , 25 | API_USER_CACHE , 26 | CALLCENTER_CURRENT_CALL , 27 | CALLCENTER_AGENT, 28 | JOB_CACHE, 29 | HAZLCAST_CALLOUT_CACHE , 30 | HAZLCAST_QC_QUEUE; 31 | public String toString(){ 32 | return super.toString().toLowerCase(); 33 | } 34 | } 35 | 36 | @PostConstruct 37 | public void loadDataToCache(){ 38 | log.info("Loading...."); 39 | //MemCached.getInstance().getCache().put(CacheServiceEnum.AGENT_STATUS_CACHE.toString(), "Ready"); 40 | SessionConfig sessionconfig = new SessionConfig(); 41 | sessionconfig.setHourcheck(false); 42 | sessionconfig.setNotinwhmsg("工作时间为09:00-21:00,请谢咨询!"); 43 | sessionconfig.setMaxuser(10); 44 | MemCached.getInstance().getCache().put(XKDataContext.SYSTEM_CACHE_SESSION_CONFIG+"_"+XKDataContext.SYSTEM_ORGI, sessionconfig); 45 | SystemCache.put(XKDataContext.SYSTEM_CACHE_CONFIG, "systemConfig"); 46 | } 47 | 48 | public static Object fetchCacheDate(String key){ 49 | return MemCached.getInstance().getCache().get(key); 50 | } 51 | 52 | public static void put(String key,Object obj){ 53 | MemCached.getInstance().getCache().put(key,obj); 54 | } 55 | 56 | public static void remove(String key){ 57 | MemCached.getInstance().getCache().remove(key); 58 | } 59 | 60 | public static SessionConfig fetchSessionConfig(){ 61 | Object object = fetchCacheDate(XKDataContext.SYSTEM_CACHE_SESSION_CONFIG+"_"+XKDataContext.SYSTEM_ORGI); 62 | if (object != null){ 63 | return (SessionConfig)object; 64 | } 65 | return null; 66 | 67 | } 68 | 69 | public static void putSessionConfigCahced(SessionConfig sessionConfig){ 70 | MemCached.getInstance().getCache().put(XKDataContext.SYSTEM_CACHE_SESSION_CONFIG+"_"+XKDataContext.SYSTEM_ORGI, sessionConfig); 71 | } 72 | 73 | public static Map fetchAgentStatusDate(){ 74 | Object object = MemCached.getInstance().getCache().get(CacheServiceEnum.AGENT_STATUS_CACHE.toString()); 75 | if(object ==null){ 76 | return new HashMap(); 77 | }else{ 78 | return (HashMap)object; 79 | } 80 | } 81 | 82 | public static void putAgentStatus(AgentStatus agentStatus){ 83 | Map agentStatusCached = fetchAgentStatusDate(); 84 | agentStatusCached.put(agentStatus.getAgentno(),agentStatus); 85 | MemCached.getInstance().getCache().put(CacheServiceEnum.AGENT_STATUS_CACHE.toString(), agentStatusCached); 86 | } 87 | 88 | public static void removeAgentStatus(String agentno){ 89 | Map agentStatusCached = fetchAgentStatusDate(); 90 | agentStatusCached.remove(agentno); 91 | MemCached.getInstance().getCache().put(CacheServiceEnum.AGENT_STATUS_CACHE.toString(), agentStatusCached); 92 | } 93 | 94 | public static AgentStatus getCachedAgentStatus(String agentno){ 95 | Map agentStatusCached = fetchAgentStatusDate(); 96 | return agentStatusCached.get(agentno); 97 | } 98 | 99 | public static Map fetchAllAgentUser(){ 100 | Object object = MemCached.getInstance().getCache().get(CacheServiceEnum.QUENE_USER_CACHE.toString()); 101 | if(object ==null){ 102 | return new HashMap(); 103 | }else{ 104 | return (HashMap)object; 105 | } 106 | } 107 | 108 | 109 | public static void putAgentUser(AgentUser agentUser){ 110 | Map agentUsersCached = fetchAllAgentUser(); 111 | agentUsersCached.put(agentUser.getUserid(),agentUser); 112 | MemCached.getInstance().getCache().put(CacheServiceEnum.QUENE_USER_CACHE.toString(), agentUsersCached); 113 | } 114 | 115 | public static void removeAgentUser(AgentUser agentUser){ 116 | Map agentUsersCached = fetchAllAgentUser(); 117 | agentUsersCached.remove(agentUser.getUserid()); 118 | MemCached.getInstance().getCache().put(CacheServiceEnum.QUENE_USER_CACHE.toString(), agentUsersCached); 119 | } 120 | 121 | public static AgentUser getCachedAgentUser(String userid){ 122 | Map agentUsersCached = fetchAllAgentUser(); 123 | return agentUsersCached.get(userid); 124 | } 125 | 126 | public static void refreshCache(String dataType, String objId) { 127 | if (StringUtils.isBlank(dataType) || StringUtils.isBlank(objId)) { 128 | return; 129 | } 130 | /*if (dataType.equals("SYS_METADATA")) { 131 | MetadataInit.loadMetadata2Cache(); 132 | }*/ 133 | 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/cache/WoseqGen.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.cache; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | public class WoseqGen { 6 | 7 | public static void main(String[] args) { 8 | String numStr= "20190821768909"; 9 | System.out.println(numStr.substring(8, numStr.length())); 10 | //System.out.println( StringUtils.leftPad(numStr+"", 6, '0')); 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/chartReport/BarChart.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.chartReport; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.sxx.jcc.report.pojo.ChartInfo; 9 | import com.sxx.jcc.report.pojo.bar.ChartBarSeries; 10 | import com.sxx.jcc.report.pojo.bar.ChartValueInfo; 11 | 12 | public class BarChart extends BaseChart{ 13 | private List labelList = new ArrayList(); 14 | private List categoryList = new ArrayList();//legend 15 | private List categoriesKeyList = new ArrayList(); 16 | private Map relateMap = new HashMap(); 17 | private List> dataList = new ArrayList>(); 18 | 19 | public BarChart(Map categoryMap, Map> dataMap){ 20 | for(Map.Entry> entry : dataMap.entrySet()){ 21 | String mapKey = entry.getKey(); 22 | List mapValue = entry.getValue(); 23 | labelList.add(mapKey); 24 | dataList.add(mapValue); 25 | } 26 | 27 | for(Map.Entry entry : categoryMap.entrySet()){ 28 | String mapKey = entry.getKey(); 29 | String mapValue = entry.getValue(); 30 | categoriesKeyList.add(mapKey); 31 | categoryList.add(mapValue); 32 | relateMap.put(mapKey, new ChartValueInfo(mapValue)); 33 | } 34 | } 35 | 36 | 37 | public Map createBarReport(){ 38 | Map map=new HashMap(); 39 | map.put("label", this.getLabelList()); 40 | map.put("categories", categoryList); 41 | map.put("data", this.createDataSeries()); 42 | return map; 43 | } 44 | 45 | private List createDataSeries(){ 46 | this.genReportData(); 47 | List chatSeriesList = new ArrayList(); 48 | ChartBarSeries serie = null; 49 | for(String key : categoriesKeyList){ 50 | ChartValueInfo valueInfo = this.getRelateMap().get(key); 51 | if(valueInfo!=null){ 52 | serie= new ChartBarSeries(valueInfo.getName()); 53 | serie.setData(valueInfo.getValueList()); 54 | chatSeriesList.add(serie); 55 | } 56 | } 57 | return chatSeriesList; 58 | } 59 | 60 | 61 | private void genReportData(){ 62 | int index=1; 63 | for(List chatInfoList : this.getDataList()){ 64 | for(ChartInfo chart: chatInfoList){ 65 | String name = chart.getName(); 66 | int value = chart.getValue(); 67 | // push data to map 68 | ChartValueInfo chartvalue = this.getRelateMap().get(name); 69 | if(chartvalue != null){ 70 | chartvalue.getValueList().add(value); 71 | continue; 72 | } 73 | //set default value 0 for missing key 74 | setDefaultValue(index++); 75 | } 76 | 77 | 78 | } 79 | } 80 | 81 | /** 82 | * 补填第index项数据 83 | * @param index 84 | */ 85 | private void setDefaultValue(int index){ 86 | for(String key : categoriesKeyList){ 87 | if(this.getRelateMap().get(key).getValueList().size() getLabelList() { 94 | return labelList; 95 | } 96 | 97 | public void setLabelList(List labelList) { 98 | this.labelList = labelList; 99 | } 100 | 101 | public Map getRelateMap() { 102 | return relateMap; 103 | } 104 | 105 | public void setRelateMap(Map relateMap) { 106 | this.relateMap = relateMap; 107 | } 108 | 109 | public List> getDataList() { 110 | return dataList; 111 | } 112 | 113 | public void setDataList(List> dataList) { 114 | this.dataList = dataList; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/chartReport/BaseChart.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.chartReport; 2 | 3 | public abstract class BaseChart { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/dao/hibernate/Page.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.dao.hibernate; 2 | 3 | 4 | import java.util.List; 5 | 6 | import com.sxx.jcc.core.view.ExportType; 7 | 8 | 9 | public class Page extends QueryParameter { 10 | 11 | private List result = null; 12 | 13 | private long totalCount = -1; 14 | 15 | private ExportType exportType; 16 | 17 | public Page() { 18 | } 19 | 20 | public Page(int pagesize) { 21 | this.pagesize = pagesize; 22 | } 23 | 24 | public Page(int startIndex,int pagesize, long totalCount,List result) { 25 | this.page = startIndex; 26 | this.pagesize = pagesize; 27 | this.totalCount = totalCount; 28 | this.result = result; 29 | } 30 | 31 | /** 32 | * 取得倒转的排序方向 33 | */ 34 | public String getInverseOrder() { 35 | if (sortorder.endsWith(DESC)) 36 | return ASC; 37 | else 38 | return DESC; 39 | } 40 | 41 | /** 42 | * 页内的数据列表. 43 | */ 44 | public List getResult() { 45 | return result; 46 | } 47 | 48 | public void setResult(List result) { 49 | this.result = result; 50 | } 51 | 52 | /** 53 | * 总记录数. 54 | */ 55 | public long getTotalCount() { 56 | return totalCount; 57 | } 58 | 59 | public void setTotalCount(long totalCount) { 60 | this.totalCount = totalCount; 61 | } 62 | 63 | /** 64 | * 计算总页数. 65 | */ 66 | public int getTotalPages() { 67 | if (totalCount == -1) 68 | return -1; 69 | 70 | int count = (int) (totalCount / pagesize); 71 | if (totalCount % pagesize > 0) { 72 | count++; 73 | } 74 | return count; 75 | } 76 | 77 | /** 78 | * 是否还有下一页. 79 | */ 80 | public boolean isHasNext() { 81 | return (page + 1 <= getTotalPages()); 82 | } 83 | 84 | /** 85 | * 返回下页的页号,序号从1开始. 86 | */ 87 | public int getNextPage() { 88 | if (isHasNext()) 89 | return page + 1; 90 | else 91 | return page; 92 | } 93 | 94 | /** 95 | * 是否还有上一页. 96 | */ 97 | public boolean isHasPre() { 98 | return (page - 1 >= 1); 99 | } 100 | 101 | /** 102 | * 返回上页的页号,序号从1开始. 103 | */ 104 | public int getPrePage() { 105 | if (isHasPre()) 106 | return page - 1; 107 | else 108 | return page; 109 | } 110 | 111 | public ExportType getExportType() { 112 | return exportType; 113 | } 114 | 115 | public void setExportType(String exportType) { 116 | if ("EXCEL".equalsIgnoreCase(exportType)) { 117 | this.exportType = ExportType.EXCEL; 118 | } 119 | } 120 | public static int getStartOfPage(int pageNo, int pageSize) { 121 | return (pageNo - 1) * pageSize; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/dao/hibernate/PropertyFilter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.dao.hibernate; 2 | 3 | 4 | import java.util.Date; 5 | 6 | import org.apache.commons.lang.StringUtils; 7 | import org.springframework.util.Assert; 8 | 9 | import com.sxx.jcc.common.utils.ReflectionUtils; 10 | 11 | 12 | public class PropertyFilter { 13 | 14 | /** 15 | * 多个属性间OR关系的分隔符. 16 | */ 17 | public static final String OR_SEPARATOR = "_OR_"; 18 | 19 | /** 20 | * 属性比较类型. 21 | */ 22 | public enum MatchType { 23 | EQ, LIKE, LT, GT, LE, GE; 24 | } 25 | 26 | public enum OperatorType { 27 | OR; 28 | } 29 | 30 | public enum OperatorTag { 31 | BEGIN,END; 32 | } 33 | 34 | /** 35 | * 属性数据类型. 36 | */ 37 | public enum PropertyType { 38 | S(String.class), I(Integer.class), L(Long.class), N(Double.class), D(Date.class), B(Boolean.class),F(Float.class); 39 | 40 | private Class clazz; 41 | 42 | PropertyType(Class clazz) { 43 | this.clazz = clazz; 44 | } 45 | 46 | public Class getValue() { 47 | return clazz; 48 | } 49 | } 50 | 51 | private String[] propertyNames = null; 52 | private Class propertyType = null; 53 | private Object propertyValue = null; 54 | private MatchType matchType = null; 55 | 56 | public PropertyFilter() { 57 | } 58 | 59 | /** 60 | * @param filterName 比较属性字符串,含待比较的比较类型、属性值类型及属性列表. 61 | * eg. LIKES_NAME_OR_LOGIN_NAME 62 | * @param value 待比较的值. 63 | */ 64 | public PropertyFilter(final String filterName, final String value) { 65 | 66 | String matchTypeStr = StringUtils.substringBefore(filterName, "_"); 67 | String matchTypeCode = StringUtils.substring(matchTypeStr, 0, matchTypeStr.length() - 1); 68 | String propertyTypeCode = StringUtils.substring(matchTypeStr, matchTypeStr.length() - 1, matchTypeStr.length()); 69 | try { 70 | matchType = Enum.valueOf(MatchType.class, matchTypeCode); 71 | } catch (RuntimeException e) { 72 | throw new IllegalArgumentException("filter名称" + filterName + "没有按规则编写,无法得到属性比较类型.", e); 73 | } 74 | 75 | try { 76 | propertyType = Enum.valueOf(PropertyType.class, propertyTypeCode).getValue(); 77 | } catch (RuntimeException e) { 78 | throw new IllegalArgumentException("filter名称" + filterName + "没有按规则编写,无法得到属性值类型.", e); 79 | } 80 | 81 | String propertyNameStr = StringUtils.substringAfter(filterName, "_"); 82 | if(propertyNameStr.indexOf(PropertyFilter.OR_SEPARATOR) != -1) { 83 | propertyNames = StringUtils.split(propertyNameStr, PropertyFilter.OR_SEPARATOR); 84 | } else { 85 | propertyNames = new String[] {propertyNameStr}; 86 | } 87 | 88 | Assert.isTrue(propertyNames.length > 0, "filter名称" + filterName + "没有按规则编写,无法得到属性名称."); 89 | //按entity property中的类型将字符串转化为实际类型. 90 | this.propertyValue = ReflectionUtils.convertStringToObject(value, propertyType); 91 | } 92 | 93 | /** 94 | * 是否比较多个属性. 95 | */ 96 | public boolean isMultiProperty() { 97 | return (propertyNames.length > 1); 98 | } 99 | 100 | /** 101 | * 获取比较属性名称列表. 102 | */ 103 | public String[] getPropertyNames() { 104 | return propertyNames; 105 | } 106 | 107 | /** 108 | * 获取唯一的比较属性名称. 109 | */ 110 | public String getPropertyName() { 111 | if (propertyNames.length > 1) { 112 | throw new IllegalArgumentException("There are not only one property"); 113 | } 114 | return propertyNames[0]; 115 | } 116 | 117 | /** 118 | * 获取比较值. 119 | */ 120 | public Object getPropertyValue() { 121 | return propertyValue; 122 | } 123 | 124 | /** 125 | * 获取比较值的类型. 126 | */ 127 | public Class getPropertyType() { 128 | return propertyType; 129 | } 130 | 131 | /** 132 | * 获取比较方式类型. 133 | */ 134 | public MatchType getMatchType() { 135 | return matchType; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/dao/hibernate/QueryConditionFilter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.dao.hibernate; 2 | 3 | import com.sxx.jcc.core.dao.hibernate.PropertyFilter.MatchType; 4 | import com.sxx.jcc.core.dao.hibernate.PropertyFilter.OperatorType; 5 | 6 | public class QueryConditionFilter { 7 | private String column; 8 | private Object value; 9 | private MatchType mathType; 10 | private OperatorType operatorType; 11 | 12 | public QueryConditionFilter(String column, Object value) { 13 | this(column,value,MatchType.LIKE,null); 14 | } 15 | 16 | public QueryConditionFilter(String column, Object value, MatchType mathType) { 17 | this(column,value,mathType,null); 18 | } 19 | 20 | public QueryConditionFilter(String column, Object value, MatchType mathType,OperatorType operatorType) { 21 | this.column = column; 22 | this.value = value; 23 | this.mathType = mathType; 24 | this.operatorType = operatorType; 25 | } 26 | 27 | public String getColumn() { 28 | return column; 29 | } 30 | 31 | public void setColumn(String column) { 32 | this.column = column; 33 | } 34 | 35 | public Object getValue() { 36 | return value; 37 | } 38 | 39 | public void setValue(Object value) { 40 | this.value = value; 41 | } 42 | 43 | 44 | public OperatorType getOperatorType() { 45 | return operatorType; 46 | } 47 | 48 | public void setOperatorType(OperatorType operatorType) { 49 | this.operatorType = operatorType; 50 | } 51 | 52 | public MatchType getMathType() { 53 | return mathType; 54 | } 55 | 56 | public void setMathType(MatchType mathType) { 57 | this.mathType = mathType; 58 | } 59 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/dao/hibernate/QueryParameter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.dao.hibernate; 2 | 3 | public class QueryParameter { 4 | 5 | public static final String ASC = "asc"; 6 | public static final String DESC = "desc"; 7 | 8 | protected int page = 1; 9 | protected int pagesize = -1; 10 | protected String sortname = ""; 11 | protected String sortorder = ASC; 12 | protected boolean autoCount = true; 13 | 14 | 15 | /** 16 | * 根据pageNo和pageSize计算当前页第一条记录在总结果集中的位置,序号从0开始. 17 | */ 18 | public int getFirst() { 19 | if (page < 1 || pagesize < 1) 20 | return -1; 21 | else 22 | return ((page - 1) * pagesize); 23 | } 24 | 25 | /** 26 | * 是否已设置第一条记录记录在总结果集中的位置. 27 | */ 28 | public boolean isFirstSetted() { 29 | return (page > 0 && pagesize > 0); 30 | } 31 | 32 | /** 33 | * 是否自动获取总页数,默认为false. 34 | * 注意本属性仅于query by Criteria时有效,query by HQL时本属性无效. 35 | */ 36 | public boolean isAutoCount() { 37 | return autoCount; 38 | } 39 | 40 | public void setAutoCount(boolean autoCount) { 41 | this.autoCount = autoCount; 42 | } 43 | 44 | public int getPage() { 45 | return page; 46 | } 47 | 48 | public void setPage(int page) { 49 | this.page = page; 50 | } 51 | 52 | public int getPagesize() { 53 | return pagesize; 54 | } 55 | 56 | public void setPagesize(int pagesize) { 57 | this.pagesize = pagesize; 58 | } 59 | 60 | public String getSortname() { 61 | return sortname; 62 | } 63 | 64 | public void setSortname(String sortname) { 65 | this.sortname = sortname; 66 | } 67 | 68 | public String getSortorder() { 69 | return sortorder; 70 | } 71 | 72 | public void setSortorder(String sortorder) { 73 | this.sortorder = sortorder; 74 | } 75 | 76 | 77 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/dao/hibernate/SimpleHibernateDao.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.dao.hibernate; 2 | 3 | import org.apache.log4j.Logger; 4 | import org.hibernate.SessionFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.orm.hibernate3.support.HibernateDaoSupport; 7 | 8 | 9 | public class SimpleHibernateDao extends HibernateDaoSupport { 10 | Logger logger = Logger.getLogger(SimpleHibernateDao.class.getName()); 11 | 12 | @Autowired 13 | public void setSuperSessionFactory(SessionFactory sessionFactory) { 14 | super.setSessionFactory(sessionFactory); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/exception/AppBaseException.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.exception; 2 | 3 | public class AppBaseException extends BaseException { 4 | 5 | private static final long serialVersionUID = AppBaseException.class.hashCode(); 6 | 7 | public AppBaseException(){ 8 | super(); 9 | } 10 | 11 | public AppBaseException(int code, String message) { 12 | super(code, message); 13 | } 14 | 15 | public AppBaseException(String message) { 16 | super(message); 17 | } 18 | 19 | public AppBaseException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | 23 | public AppBaseException(Throwable cause) { 24 | super(cause); 25 | } 26 | 27 | public AppBaseException(int code, String message, Throwable cause) { 28 | super(code,message,cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/exception/BaseException.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.exception; 2 | 3 | public abstract class BaseException extends Exception { 4 | 5 | public static final int NO_ERROR = 0; 6 | 7 | private static final long serialVersionUID = BaseException.class.hashCode(); 8 | int errorCode; 9 | String _err_string; 10 | 11 | public BaseException() { 12 | super(); 13 | } 14 | 15 | /** 16 | * @param message 17 | */ 18 | public BaseException(String message) { 19 | super(message); 20 | _err_string = message; 21 | } 22 | 23 | public BaseException(int code) { 24 | errorCode = code; 25 | } 26 | 27 | /** 28 | * @param cause 29 | */ 30 | public BaseException(Throwable cause) { 31 | super(cause); 32 | } 33 | 34 | /** 35 | * Construct with error code and message 36 | * 37 | * @param code 38 | * @param message 39 | */ 40 | public BaseException(int code, String message) { 41 | super(message); 42 | this.errorCode = code; 43 | _err_string = message; 44 | } 45 | 46 | /** 47 | * Construct with error code, message and an exception that caused 48 | * 49 | * @param code 50 | * @param message 51 | * @param cause 52 | */ 53 | public BaseException(int code, String message, Throwable cause) { 54 | super(message, cause); 55 | this.errorCode = code; 56 | _err_string = message; 57 | } 58 | 59 | public BaseException(String message, Throwable cause) { 60 | super(message, cause); 61 | } 62 | 63 | public int getCode() { 64 | return this.errorCode; 65 | } 66 | 67 | public String getMesg() { 68 | return _err_string; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/exception/LoginException.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.exception; 2 | 3 | public class LoginException extends AppBaseException{ 4 | 5 | private static final long serialVersionUID = LoginException.class.hashCode(); 6 | public LoginException(){ 7 | super(); 8 | } 9 | 10 | public LoginException(int code, String message) { 11 | super(code, message); 12 | } 13 | 14 | public LoginException(String message) { 15 | super(message); 16 | } 17 | 18 | public LoginException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public LoginException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public LoginException(int code, String message, Throwable cause) { 27 | super(code,message,cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/exception/UnauthorizedException.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.exception; 2 | 3 | public class UnauthorizedException extends AppBaseException { 4 | private static final long serialVersionUID = UnauthorizedException.class.hashCode(); 5 | 6 | public UnauthorizedException() { 7 | super(); 8 | } 9 | 10 | public UnauthorizedException(int code, String message) { 11 | super(code, message); 12 | } 13 | 14 | public UnauthorizedException(String message) { 15 | super(message); 16 | } 17 | 18 | public UnauthorizedException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public UnauthorizedException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public UnauthorizedException(int code, String message, Throwable cause) { 27 | super(code, message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/filter/Struts2Filter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.filter; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.FilterChain; 5 | import javax.servlet.ServletException; 6 | import javax.servlet.ServletRequest; 7 | import javax.servlet.ServletResponse; 8 | import javax.servlet.http.HttpServletRequest; 9 | import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter; 10 | 11 | 12 | public class Struts2Filter extends StrutsPrepareAndExecuteFilter { 13 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { 14 | HttpServletRequest request = (HttpServletRequest) req; 15 | // 不过滤的url 16 | String url = request.getRequestURI(); 17 | if (url.indexOf("imageUp.jsp") != -1 || url.indexOf("fileUp.jsp") != -1) { 18 | chain.doFilter(req, res); 19 | } else { 20 | // System.out.println("使用默认的过滤器"); 21 | super.doFilter(req, res, chain); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/intereptor/AuthorityInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.intereptor; 2 | 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | import org.apache.struts2.ServletActionContext; 8 | 9 | import com.opensymphony.xwork2.ActionContext; 10 | import com.opensymphony.xwork2.ActionInvocation; 11 | import com.opensymphony.xwork2.interceptor.AbstractInterceptor; 12 | import com.sxx.jcc.common.utils.XKDataContext; 13 | 14 | 15 | @SuppressWarnings("serial") 16 | public class AuthorityInterceptor extends AbstractInterceptor { 17 | 18 | public String intercept(ActionInvocation invocation) throws Exception { 19 | Map session = ActionContext.getContext().getSession(); 20 | Object staff = session.get(XKDataContext.STAFF_SESSION); 21 | if (staff == null) { 22 | HttpServletRequest request = ServletActionContext.getRequest(); 23 | String ivrMark = request.getParameter("ivrMark"); 24 | if ("0".equals(ivrMark)) { 25 | return invocation.invoke(); 26 | } 27 | return "login"; 28 | } else { 29 | return invocation.invoke(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/intereptor/AuthorizationInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.intereptor; 2 | 3 | import com.opensymphony.xwork2.ActionInvocation; 4 | import com.opensymphony.xwork2.interceptor.Interceptor; 5 | 6 | public class AuthorizationInterceptor implements Interceptor{ 7 | private static final long serialVersionUID = AuthorizationInterceptor.class.hashCode(); 8 | 9 | public void destroy() { 10 | // TODO Auto-generated method stub 11 | 12 | } 13 | 14 | public void init() { 15 | // TODO Auto-generated method stub 16 | 17 | } 18 | 19 | public String intercept(ActionInvocation arg0) throws Exception { 20 | // TODO Auto-generated method stub 21 | return null; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/intereptor/ExceptionHandlerInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.intereptor; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.logging.Log; 7 | import org.apache.commons.logging.LogFactory; 8 | import org.apache.struts2.ServletActionContext; 9 | 10 | import com.opensymphony.xwork2.ActionInvocation; 11 | import com.opensymphony.xwork2.interceptor.Interceptor; 12 | import com.sxx.jcc.core.exception.BaseException; 13 | import com.sxx.jcc.core.struts.CRUDActionSupport; 14 | import com.sxx.jcc.core.struts.SimpleActionSupport; 15 | import com.sxx.jcc.core.utils.Constant; 16 | 17 | 18 | public class ExceptionHandlerInterceptor implements Interceptor { 19 | 20 | private static final long serialVersionUID = ExceptionHandlerInterceptor.class.hashCode(); 21 | protected final Log logger = LogFactory.getLog(getClass()); 22 | public static final String exceptionAttribute = "exception"; 23 | 24 | public static final String exceptionTraceAttribute = "exceptionTrace"; 25 | 26 | private List exceptionDealList; 27 | 28 | /** 29 | * Invoke action and if an exception occurs, route it to the mapped result. 30 | */ 31 | public String intercept(ActionInvocation invocation) throws Exception { 32 | String result = null; 33 | try { 34 | result = invocation.invoke(); 35 | } catch (Exception ex) { 36 | ex.printStackTrace(); 37 | logger.error(ex); 38 | if (this.exceptionDealList != null) { 39 | for (int i = 0; i < exceptionDealList.size(); i++) { 40 | ExceptionDealBean exceptionDealBean = (ExceptionDealBean) exceptionDealList.get(i); 41 | if (exceptionDealBean.exceptionClass.isInstance(ex)) { 42 | result = exceptionDealBean.exceptionDealResult; 43 | if(BaseException.class.isInstance(ex)){ 44 | SimpleActionSupport baseAction = (SimpleActionSupport) invocation.getAction(); 45 | baseAction.getSessionMap().put(Constant.APP_EXCEPTION_MSG, ex.getMessage()); 46 | } 47 | ServletActionContext.getRequest().setAttribute( 48 | exceptionAttribute, ex); 49 | ServletActionContext.getRequest().setAttribute( 50 | exceptionTraceAttribute, getStackTrace(ex)); 51 | break; 52 | } 53 | } 54 | } 55 | } 56 | return result; 57 | } 58 | 59 | public void destroy() { 60 | } 61 | 62 | public void init() { 63 | exceptionDealList = new ArrayList(); 64 | exceptionDealList.add(new ExceptionDealBean( 65 | AuthorizationInterceptor.class, "pageError")); 66 | exceptionDealList.add(new ExceptionDealBean(BaseException.class,CRUDActionSupport.APPERROR)); 67 | exceptionDealList.add(new ExceptionDealBean( 68 | org.springframework.dao.DataAccessException.class, 69 | "dataAccessFailure")); 70 | exceptionDealList.add(new ExceptionDealBean( 71 | java.lang.RuntimeException.class, "runtimeError")); 72 | 73 | exceptionDealList.add(new ExceptionDealBean(java.lang.Exception.class, 74 | "unkownError")); 75 | } 76 | 77 | public static String getStackTrace(Exception ex) { 78 | StringBuffer sb = new StringBuffer(); 79 | for (int i = 0; i < ex.getStackTrace().length; i++) { 80 | sb.append((StackTraceElement) ex.getStackTrace()[i]); 81 | } 82 | return String.valueOf(sb); 83 | } 84 | 85 | /** 86 | * 87 | * @author Andy_shao 88 | * 89 | */ 90 | class ExceptionDealBean { 91 | public ExceptionDealBean(Class exceptionClass, 92 | String exceptionDealResult) { 93 | this.exceptionClass = exceptionClass; 94 | this.exceptionDealResult = exceptionDealResult; 95 | } 96 | 97 | public Class exceptionClass; 98 | 99 | public String exceptionDealResult; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/model/ADBase.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.MappedSuperclass; 10 | import javax.persistence.SequenceGenerator; 11 | 12 | @MappedSuperclass 13 | @SuppressWarnings("serial") 14 | public abstract class ADBase implements Serializable, Cloneable{ 15 | @Id 16 | @SequenceGenerator(name = "OBJECT_ID", sequenceName = "OBJECT_ID", allocationSize = 1) 17 | @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="OBJECT_ID") 18 | @Column(name = "OBJECT_ID") 19 | private Long objectId; 20 | 21 | @Column(name="IS_ACTIVE") 22 | protected String isActive="Y"; 23 | 24 | public Long getObjectId() { 25 | return objectId; 26 | } 27 | 28 | public void setObjectId(Long objectId) { 29 | this.objectId = objectId; 30 | } 31 | 32 | public void setIsActive(Boolean isActive) { 33 | this.isActive = isActive ? "Y" : "N"; 34 | } 35 | 36 | public Boolean getIsActive(){ 37 | return "Y".equalsIgnoreCase(this.isActive) ? true : false; 38 | } 39 | 40 | @Override 41 | public boolean equals(Object obj) { 42 | if (obj == null) return false; 43 | if (obj == this) return true; 44 | if (this.getObjectId() == null) return super.equals(obj); 45 | if (!(obj instanceof ADBase)) return false; 46 | ADBase o = (ADBase) obj; 47 | return this.getObjectId().equals(o.getObjectId()); 48 | } 49 | 50 | @Override 51 | public Object clone() throws CloneNotSupportedException { 52 | ADBase base = (ADBase) super.clone(); 53 | base.setObjectId(null); 54 | return base; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/model/ADEntity.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.model; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.MappedSuperclass; 7 | import javax.persistence.PrePersist; 8 | import javax.persistence.PreUpdate; 9 | import javax.persistence.Version; 10 | 11 | @MappedSuperclass 12 | @SuppressWarnings("serial") 13 | public abstract class ADEntity extends ADBase{ 14 | @Column(name="CREATED") 15 | protected Date created; 16 | 17 | @Column(name="CREATED_BY") 18 | protected Long createdBy; 19 | 20 | @Column(name="UPDATED") 21 | protected Date updated; 22 | 23 | @Column(name="UPDATED_BY") 24 | protected Long updatedBy; 25 | 26 | @Version 27 | @Column(name="LOCK_VERSION") 28 | private Long lockVersion = 1l; 29 | 30 | public void setCreated(Date created) { 31 | this.created = created; 32 | } 33 | 34 | public Date getCreated() { 35 | return created; 36 | } 37 | 38 | public void setCreatedBy(Long createdBy) { 39 | this.createdBy = createdBy; 40 | } 41 | 42 | public Long getCreatedBy() { 43 | return createdBy; 44 | } 45 | 46 | public void setUpdated(Date updated) { 47 | this.updated = updated; 48 | } 49 | 50 | public Date getUpdated() { 51 | return updated; 52 | } 53 | 54 | public void setUpdatedBy(Long updatedBy) { 55 | this.updatedBy = updatedBy; 56 | } 57 | 58 | public Long getUpdatedBy() { 59 | return updatedBy; 60 | } 61 | 62 | public void setLockVersion(Long lockVersion) { 63 | this.lockVersion = lockVersion; 64 | } 65 | 66 | public Long getLockVersion() { 67 | return lockVersion; 68 | } 69 | 70 | @PrePersist 71 | @PreUpdate 72 | private void setupUpdated() { 73 | updated = new Date(); 74 | } 75 | 76 | @Override 77 | public Object clone() throws CloneNotSupportedException { 78 | return super.clone(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/model/IMClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.model; 2 | 3 | public class IMClient { 4 | private String user ; 5 | private String orgi ; 6 | private String session ; 7 | private String appid ; 8 | 9 | private String aiid ; 10 | 11 | private String agent ; 12 | private String skill ; 13 | 14 | private String title ; 15 | private String url ; 16 | private String traceid ; 17 | 18 | private String nickname ; 19 | private String osname; 20 | private String browser; 21 | 22 | public String getUser() { 23 | return user; 24 | } 25 | 26 | public void setUser(String user) { 27 | this.user = user; 28 | } 29 | 30 | public String getOrgi() { 31 | return orgi; 32 | } 33 | 34 | public void setOrgi(String orgi) { 35 | this.orgi = orgi; 36 | } 37 | 38 | public String getSession() { 39 | return session; 40 | } 41 | 42 | public void setSession(String session) { 43 | this.session = session; 44 | } 45 | 46 | public String getAppid() { 47 | return appid; 48 | } 49 | 50 | public void setAppid(String appid) { 51 | this.appid = appid; 52 | } 53 | 54 | public String getAgent() { 55 | return agent; 56 | } 57 | 58 | public void setAgent(String agent) { 59 | this.agent = agent; 60 | } 61 | 62 | public String getSkill() { 63 | return skill; 64 | } 65 | 66 | public void setSkill(String skill) { 67 | this.skill = skill; 68 | } 69 | 70 | public String getTitle() { 71 | return title; 72 | } 73 | 74 | public void setTitle(String title) { 75 | this.title = title; 76 | } 77 | 78 | public String getUrl() { 79 | return url; 80 | } 81 | 82 | public void setUrl(String url) { 83 | this.url = url; 84 | } 85 | 86 | public String getTraceid() { 87 | return traceid; 88 | } 89 | 90 | public void setTraceid(String traceid) { 91 | this.traceid = traceid; 92 | } 93 | 94 | public String getNickname() { 95 | return nickname; 96 | } 97 | 98 | public void setNickname(String nickname) { 99 | this.nickname = nickname; 100 | } 101 | 102 | public String getOsname() { 103 | return osname; 104 | } 105 | 106 | public void setOsname(String osname) { 107 | this.osname = osname; 108 | } 109 | 110 | public String getBrowser() { 111 | return browser; 112 | } 113 | 114 | public void setBrowser(String browser) { 115 | this.browser = browser; 116 | } 117 | 118 | public String getAiid() { 119 | return aiid; 120 | } 121 | 122 | public void setAiid(String aiid) { 123 | this.aiid = aiid; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/model/PageModel.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.model; 2 | 3 | 4 | import java.util.List; 5 | 6 | @SuppressWarnings("unchecked") 7 | public class PageModel { 8 | 9 | public static int pageItems = 100; 10 | 11 | private int total; 12 | 13 | private List datas; 14 | 15 | public int getTotal() { 16 | return total; 17 | } 18 | 19 | public void setTotal(int total) { 20 | this.total = total; 21 | } 22 | 23 | public List getDatas() { 24 | return datas; 25 | } 26 | 27 | public void setDatas(List datas) { 28 | this.datas = datas; 29 | } 30 | 31 | 32 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/model/ReportBase.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.MappedSuperclass; 10 | import javax.persistence.SequenceGenerator; 11 | 12 | @MappedSuperclass 13 | @SuppressWarnings("serial") 14 | public abstract class ReportBase implements Serializable, Cloneable{ 15 | @Id 16 | @SequenceGenerator(name = "OBJECT_ID", sequenceName = "OBJECT_ID", allocationSize = 1) 17 | @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="OBJECT_ID") 18 | @Column(name = "OBJECT_ID") 19 | private Long objectId; 20 | 21 | public Long getObjectId() { 22 | return objectId; 23 | } 24 | 25 | public void setObjectId(Long objectId) { 26 | this.objectId = objectId; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/DemoSocketServer.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server; 2 | 3 | import com.corundumstudio.socketio.Configuration; 4 | import com.corundumstudio.socketio.SocketIOClient; 5 | import com.corundumstudio.socketio.SocketIONamespace; 6 | import com.corundumstudio.socketio.SocketIOServer; 7 | import com.corundumstudio.socketio.listener.ConnectListener; 8 | import com.sxx.jcc.common.utils.XKDataContext; 9 | import com.sxx.jcc.webim.pojo.SocketIOMessage; 10 | 11 | public class DemoSocketServer { 12 | 13 | public static void main(String[] args) throws InterruptedException { 14 | 15 | Configuration config = new Configuration(); 16 | config.setHostname("localhost"); 17 | config.setPort(9092); 18 | 19 | SocketIOServer server = new SocketIOServer(config); 20 | SocketIONamespace imSocketNameSpace = server.addNamespace(XKDataContext.NameSpaceEnum.IM.getNamespace()); 21 | imSocketNameSpace.addConnectListener(new ConnectListener() { 22 | @Override 23 | public void onConnect(SocketIOClient client) { 24 | System.out.println("========================00000"); 25 | SocketIOMessage message = new SocketIOMessage(); 26 | message.setMessage("测试"); 27 | 28 | client.sendEvent(XKDataContext.MessageTypeEnum.STATUS.toString(), message); 29 | } 30 | }); 31 | SocketIONamespace agentSocketIONameSpace = server.addNamespace(XKDataContext.NameSpaceEnum.AGENT.getNamespace()) ; 32 | agentSocketIONameSpace.addConnectListener(new ConnectListener() { 33 | @Override 34 | public void onConnect(SocketIOClient client) { 35 | SocketIOMessage message = new SocketIOMessage(); 36 | message.setMessage("测2试"); 37 | 38 | client.sendEvent(XKDataContext.MessageTypeEnum.STATUS.toString(), message); 39 | System.out.println("+++++++++++++++++++++++++++9999"); 40 | } 41 | }); 42 | server.start(); 43 | Thread.sleep(Integer.MAX_VALUE); 44 | server.stop(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/ServerRunner.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server; 2 | 3 | import org.springframework.context.ApplicationListener; 4 | import org.springframework.context.event.ContextRefreshedEvent; 5 | import org.springframework.stereotype.Component; 6 | 7 | import com.corundumstudio.socketio.Configuration; 8 | import com.corundumstudio.socketio.SocketIONamespace; 9 | import com.corundumstudio.socketio.SocketIOServer; 10 | import com.sxx.jcc.common.utils.XKDataContext; 11 | import com.sxx.jcc.core.server.handler.AgentEventHandler; 12 | import com.sxx.jcc.core.server.handler.IMEventHandler; 13 | 14 | @Component("BeanDefineConfigue") 15 | public class ServerRunner implements ApplicationListener{ 16 | 17 | private SocketIOServer server; 18 | private SocketIONamespace imSocketNameSpace ; 19 | private SocketIONamespace agentSocketIONameSpace ; 20 | 21 | public SocketIONamespace getIMSocketIONameSpace(){ 22 | //imSocketNameSpace.addListeners(new IMEventHandler(server)); 23 | return imSocketNameSpace; 24 | } 25 | 26 | 27 | public SocketIONamespace getAgentSocketIONameSpace(){ 28 | //agentSocketIONameSpace.addListeners(new AgentEventHandler(server)); 29 | return agentSocketIONameSpace; 30 | } 31 | 32 | @Override 33 | public void onApplicationEvent(ContextRefreshedEvent arg0) { 34 | /**System.out.println("---------------init socket!"); 35 | Configuration config = new Configuration(); 36 | config.setHostname("localhost"); 37 | config.setPort(UKDataContext.getWebIMPort()); 38 | server = new SocketIOServer(config); 39 | 40 | System.out.println("start****************************server**************************end"); 41 | imSocketNameSpace = server.addNamespace(UKDataContext.NameSpaceEnum.IM.getNamespace()); 42 | imSocketNameSpace.addListeners(new IMEventHandler(server)); 43 | agentSocketIONameSpace = server.addNamespace(UKDataContext.NameSpaceEnum.AGENT.getNamespace()) ; 44 | agentSocketIONameSpace.addListeners(new AgentEventHandler(server)); 45 | server.start(); 46 | UKDataContext.setIMServerStatus(true); //IMServer 启动成功 47 | System.out.println("start****************************namespace**************************end");**/ 48 | Configuration config = new Configuration(); 49 | 50 | //config.setPort(9094); 51 | 52 | config.setHostname("localhost"); 53 | //config.setHostname("10.20.3.200"); 54 | config.setPort(9093); 55 | 56 | server = new SocketIOServer(config); 57 | imSocketNameSpace = server.addNamespace(XKDataContext.NameSpaceEnum.IM.getNamespace()); 58 | imSocketNameSpace.addListeners(new IMEventHandler(server)); 59 | agentSocketIONameSpace = server.addNamespace(XKDataContext.NameSpaceEnum.AGENT.getNamespace()); 60 | agentSocketIONameSpace.addListeners(new AgentEventHandler(server)); 61 | 62 | /**SocketIONamespace imSocketNameSpace = server.addNamespace(UKDataContext.NameSpaceEnum.IM.getNamespace()); 63 | imSocketNameSpace.addConnectListener(new ConnectListener() { 64 | @Override 65 | public void onConnect(SocketIOClient client) { 66 | client.sendEvent("advert_info","客户端你好,我是服务端,有什么能帮助你"); 67 | System.out.println("=============server1==========="); 68 | } 69 | }); 70 | SocketIONamespace agentSocketIONameSpace = server.addNamespace(UKDataContext.NameSpaceEnum.AGENT.getNamespace()) ; 71 | agentSocketIONameSpace.addConnectListener(new ConnectListener() { 72 | @Override 73 | public void onConnect(SocketIOClient client) { 74 | System.out.println("+++++++++++++++server2++++++++++++"); 75 | client.sendEvent("advert_info","客户端你好,我是服务端,有什么能帮助你"); 76 | 77 | } 78 | });**/ 79 | server.start(); 80 | System.out.println("start****************************namespace**************************"+config.getHostname()+":"+config.getPort()); 81 | } 82 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/AgentServiceMessage.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | import com.sxx.jcc.common.utils.XKTools; 4 | 5 | 6 | 7 | public class AgentServiceMessage extends Message{ 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = 3520656734252136303L; 12 | 13 | private String type ; 14 | private String id = XKTools.getUUID(); 15 | 16 | public String getType() { 17 | return type; 18 | } 19 | 20 | public void setType(String type) { 21 | this.type = type; 22 | } 23 | 24 | public String getId() { 25 | return id; 26 | } 27 | 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/AgentStatusMessage.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | import com.sxx.jcc.common.utils.XKTools; 4 | 5 | 6 | 7 | public class AgentStatusMessage extends Message{ 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = 3520656734252136303L; 12 | 13 | private String type ; 14 | private String id = XKTools.getUUID(); 15 | 16 | public String getType() { 17 | return type; 18 | } 19 | 20 | public void setType(String type) { 21 | this.type = type; 22 | } 23 | 24 | public String getId() { 25 | return id; 26 | } 27 | 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/ChatObject.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | public class ChatObject { 4 | private String userName; 5 | private String message; 6 | 7 | public ChatObject() { 8 | } 9 | 10 | public ChatObject(String userName, String message) { 11 | super(); 12 | this.userName = userName; 13 | this.message = message; 14 | } 15 | 16 | public String getUserName() { 17 | return userName; 18 | } 19 | 20 | public void setUserName(String userName) { 21 | this.userName = userName; 22 | } 23 | 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | public void setMessage(String message) { 29 | this.message = message; 30 | } 31 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/Message.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | import com.sxx.jcc.common.utils.XKTools; 4 | 5 | 6 | 7 | 8 | public abstract class Message implements java.io.Serializable{ 9 | 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = 1872188129813937898L; 14 | private String id = XKTools.getUUID(); 15 | private String appid ; 16 | private String userid ; 17 | private String username ; 18 | 19 | private String touser ; 20 | private String tousername ; 21 | private String session ; 22 | private String sign ; 23 | private String message ; 24 | private String orgi ; 25 | private String agentserviceid ; 26 | private String channel ; 27 | 28 | public abstract String getType() ; 29 | 30 | public String getAppid() { 31 | return appid; 32 | } 33 | public void setAppid(String appid) { 34 | this.appid = appid; 35 | } 36 | public String getUserid() { 37 | return userid; 38 | } 39 | public void setUserid(String userid) { 40 | this.userid = userid; 41 | } 42 | public String getSession() { 43 | return session; 44 | } 45 | public void setSession(String session) { 46 | this.session = session; 47 | } 48 | public String getSign() { 49 | return sign; 50 | } 51 | public void setSign(String sign) { 52 | this.sign = sign; 53 | } 54 | public String getMessage() { 55 | return message; 56 | } 57 | public void setMessage(String message) { 58 | this.message = message; 59 | } 60 | 61 | public String getOrgi() { 62 | return orgi; 63 | } 64 | 65 | public void setOrgi(String orgi) { 66 | this.orgi = orgi; 67 | } 68 | 69 | public String getTouser() { 70 | return touser; 71 | } 72 | 73 | public void setTouser(String touser) { 74 | this.touser = touser; 75 | } 76 | 77 | public String getUsername() { 78 | return username; 79 | } 80 | 81 | public void setUsername(String username) { 82 | this.username = username; 83 | } 84 | 85 | public String getTousername() { 86 | return tousername; 87 | } 88 | 89 | public void setTousername(String tousername) { 90 | this.tousername = tousername; 91 | } 92 | 93 | public String getChannel() { 94 | return channel; 95 | } 96 | 97 | public void setChannel(String channel) { 98 | this.channel = channel; 99 | } 100 | 101 | public String getId() { 102 | return id; 103 | } 104 | 105 | public void setId(String id) { 106 | this.id = id; 107 | } 108 | 109 | public String getAgentserviceid() { 110 | return agentserviceid; 111 | } 112 | 113 | public void setAgentserviceid(String agentserviceid) { 114 | this.agentserviceid = agentserviceid; 115 | } 116 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/NewRequestMessage.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | import com.sxx.jcc.common.utils.XKTools; 4 | 5 | 6 | public class NewRequestMessage extends Message{ 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 3520656734252136303L; 11 | private String id = XKTools.getUUID(); 12 | private String type ; 13 | private boolean noagent ; 14 | private int queueindex =0; 15 | 16 | public String getType() { 17 | return type; 18 | } 19 | 20 | public void setType(String type) { 21 | this.type = type; 22 | } 23 | 24 | public String getId() { 25 | return id; 26 | } 27 | 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | 32 | public boolean isNoagent() { 33 | return noagent; 34 | } 35 | 36 | public void setNoagent(boolean noagent) { 37 | this.noagent = noagent; 38 | } 39 | 40 | public int getQueueindex() { 41 | return queueindex; 42 | } 43 | 44 | public void setQueueindex(int queueindex) { 45 | this.queueindex = queueindex; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/OtherMessage.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | import java.util.List; 4 | 5 | public class OtherMessage implements java.io.Serializable{ 6 | /** 7 | * 8 | */ 9 | private static final long serialVersionUID = 3520656734252136303L; 10 | 11 | private String msgtype ; 12 | private String title; 13 | private String message ; 14 | private String type ; 15 | private String id ; 16 | private boolean trans; 17 | private String code ; 18 | private String score ; 19 | private boolean detail ; 20 | private String matchtype ; 21 | 22 | private String ckind ; 23 | private String ckindname ; 24 | 25 | private String clabel ; 26 | private String clabelname ; 27 | 28 | private int duration ; 29 | 30 | private List items ; 31 | 32 | public String getMsgtype() { 33 | return msgtype; 34 | } 35 | public void setMsgtype(String msgtype) { 36 | this.msgtype = msgtype; 37 | } 38 | public String getTitle() { 39 | return title; 40 | } 41 | public void setTitle(String title) { 42 | this.title = title; 43 | } 44 | public List getItems() { 45 | return items; 46 | } 47 | public void setItems(List items) { 48 | this.items = items; 49 | } 50 | public String getMessage() { 51 | return message; 52 | } 53 | public void setMessage(String message) { 54 | this.message = message; 55 | } 56 | public String getId() { 57 | return id; 58 | } 59 | public void setId(String id) { 60 | this.id = id; 61 | } 62 | public boolean isDetail() { 63 | return detail; 64 | } 65 | public void setDetail(boolean detail) { 66 | this.detail = detail; 67 | } 68 | public String getCode() { 69 | return code; 70 | } 71 | public void setCode(String code) { 72 | this.code = code; 73 | } 74 | public String getScore() { 75 | return score; 76 | } 77 | public void setScore(String score) { 78 | this.score = score; 79 | } 80 | public boolean isTrans() { 81 | return trans; 82 | } 83 | public void setTrans(boolean trans) { 84 | this.trans = trans; 85 | } 86 | public int getDuration() { 87 | return duration; 88 | } 89 | public void setDuration(int duration) { 90 | this.duration = duration; 91 | } 92 | public String getType() { 93 | return type; 94 | } 95 | public void setType(String type) { 96 | this.type = type; 97 | } 98 | public String getMatchtype() { 99 | return matchtype; 100 | } 101 | public void setMatchtype(String matchtype) { 102 | this.matchtype = matchtype; 103 | } 104 | public String getCkind() { 105 | return ckind; 106 | } 107 | public void setCkind(String ckind) { 108 | this.ckind = ckind; 109 | } 110 | public String getCkindname() { 111 | return ckindname; 112 | } 113 | public void setCkindname(String ckindname) { 114 | this.ckindname = ckindname; 115 | } 116 | public String getClabel() { 117 | return clabel; 118 | } 119 | public void setClabel(String clabel) { 120 | this.clabel = clabel; 121 | } 122 | public String getClabelname() { 123 | return clabelname; 124 | } 125 | public void setClabelname(String clabelname) { 126 | this.clabelname = clabelname; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/OtherMessageItem.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | 4 | public class OtherMessageItem implements java.io.Serializable{ 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 3520656734252136303L; 9 | 10 | private String msgtype ; 11 | private String title; 12 | private String id ; 13 | private String content ; 14 | private String headimg ; //图文消息 15 | private String type ; //图文消息类型 16 | private String url ; //图文消息跳转URL 17 | 18 | 19 | private String ckind ; 20 | private String ckindname ; 21 | 22 | private String clabel ; 23 | private String clabelname ; 24 | 25 | private int duration ; 26 | 27 | public String getMsgtype() { 28 | return msgtype; 29 | } 30 | public void setMsgtype(String msgtype) { 31 | this.msgtype = msgtype; 32 | } 33 | public String getTitle() { 34 | return title; 35 | } 36 | public void setTitle(String title) { 37 | this.title = title; 38 | } 39 | public String getId() { 40 | return id != null ? id : ""; 41 | } 42 | public void setId(String id) { 43 | this.id = id; 44 | } 45 | public String getContent() { 46 | return content; 47 | } 48 | public void setContent(String content) { 49 | this.content = content; 50 | } 51 | public String getHeadimg() { 52 | return headimg; 53 | } 54 | public void setHeadimg(String headimg) { 55 | this.headimg = headimg; 56 | } 57 | public String getType() { 58 | return type; 59 | } 60 | public void setType(String type) { 61 | this.type = type; 62 | } 63 | public String getUrl() { 64 | return url; 65 | } 66 | public void setUrl(String url) { 67 | this.url = url; 68 | } 69 | public int getDuration() { 70 | return duration; 71 | } 72 | public void setDuration(int duration) { 73 | this.duration = duration; 74 | } 75 | public String getCkind() { 76 | return ckind; 77 | } 78 | public void setCkind(String ckind) { 79 | this.ckind = ckind; 80 | } 81 | public String getCkindname() { 82 | return ckindname; 83 | } 84 | public void setCkindname(String ckindname) { 85 | this.ckindname = ckindname; 86 | } 87 | public String getClabel() { 88 | return clabel; 89 | } 90 | public void setClabel(String clabel) { 91 | this.clabel = clabel; 92 | } 93 | public String getClabelname() { 94 | return clabelname; 95 | } 96 | public void setClabelname(String clabelname) { 97 | this.clabelname = clabelname; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/server/message/SessionConfigItem.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.server.message; 2 | 3 | public class SessionConfigItem implements java.io.Serializable{ 4 | /** 5 | * 存放客服服务时间段 6 | */ 7 | private static final long serialVersionUID = 3520656734252136303L; 8 | 9 | private String workinghours ; 10 | private String type; 11 | private String worktype; 12 | public String getWorkinghours() { 13 | return workinghours; 14 | } 15 | public void setWorkinghours(String workinghours) { 16 | this.workinghours = workinghours; 17 | } 18 | public String getType() { 19 | return type; 20 | } 21 | public void setType(String type) { 22 | this.type = type; 23 | } 24 | public String getWorktype() { 25 | return worktype; 26 | } 27 | public void setWorktype(String worktype) { 28 | this.worktype = worktype; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/struts/CRUDActionSupport.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.struts; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import com.sxx.jcc.core.dao.hibernate.Page; 8 | import com.sxx.jcc.core.exception.AppBaseException; 9 | import com.sxx.jcc.core.taglib.model.HtmlColumn; 10 | import com.sxx.jcc.core.utils.Constant; 11 | import com.sxx.jcc.core.view.ExcelView; 12 | import com.sxx.jcc.core.view.ExcelViewExporter; 13 | import com.sxx.jcc.core.view.ExportType; 14 | import com.sxx.jcc.core.view.View; 15 | 16 | @SuppressWarnings("serial") 17 | public abstract class CRUDActionSupport extends SimpleActionSupport { 18 | 19 | 20 | public static final String RELOAD = "reload"; 21 | public static final String APPERROR = "appError"; 22 | 23 | protected List columns; 24 | 25 | protected String exportName; 26 | 27 | 28 | private Long id; 29 | 30 | //public abstract String input() throws Exception; 31 | 32 | 33 | public abstract String save() throws Exception; 34 | 35 | 36 | public abstract String delete() throws Exception; 37 | 38 | 39 | protected void renderExport(View view,ExportType exportType) { 40 | try { 41 | if (exportType == ExportType.EXCEL) { 42 | new ExcelViewExporter(view, super.getRespose(), exportName).export(); 43 | } 44 | } catch (Exception e) { 45 | logger.error("Not able to perform the " + exportType + " export."); 46 | } 47 | } 48 | 49 | protected abstract void initColumns(); 50 | 51 | public List getColumns() { 52 | return columns; 53 | } 54 | 55 | public Long getId() { 56 | return id; 57 | } 58 | 59 | public void setId(Long id) { 60 | this.id = id; 61 | } 62 | 63 | 64 | 65 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/struts/ReportBaseAction.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.struts; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.opensymphony.xwork2.ModelDriven; 7 | import com.opensymphony.xwork2.Preparable; 8 | 9 | @SuppressWarnings("serial") 10 | public abstract class ReportBaseAction extends SimpleActionSupport implements 11 | ModelDriven, Preparable { 12 | private List resultList = new ArrayList(); 13 | @Override 14 | public String execute() throws Exception { 15 | into(); 16 | return SUCCESS; 17 | } 18 | 19 | public abstract String into() throws Exception; 20 | 21 | public abstract String show() throws Exception; 22 | 23 | public void prepare() throws Exception { 24 | } 25 | 26 | public void prepareShow() throws Exception { 27 | prepareModel(); 28 | } 29 | 30 | protected abstract void prepareModel() throws Exception; 31 | 32 | public List getResultList() { 33 | return resultList; 34 | } 35 | 36 | public void setResultList(List resultList) { 37 | this.resultList = resultList; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/struts/SimpleActionSupport.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.struts; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.apache.commons.lang.StringUtils; 11 | import org.apache.log4j.Logger; 12 | import org.apache.struts2.ServletActionContext; 13 | import org.apache.struts2.interceptor.SessionAware; 14 | 15 | import com.opensymphony.xwork2.ActionSupport; 16 | import com.sxx.jcc.core.utils.Constant; 17 | 18 | @SuppressWarnings( { "serial" }) 19 | public class SimpleActionSupport extends ActionSupport implements SessionAware{ 20 | 21 | protected Logger logger = Logger.getLogger(SimpleActionSupport.class.getName()); 22 | private Map session; 23 | private String propMsg; 24 | public String getPropMsg() { 25 | return propMsg; 26 | } 27 | 28 | public void setPropMsg(String propMsg) { 29 | this.propMsg = propMsg; 30 | } 31 | 32 | protected String render(String text, String contentType) { 33 | try { 34 | HttpServletResponse response = ServletActionContext.getResponse(); 35 | response.setContentType(contentType); 36 | response.getWriter().write(text); 37 | } catch (IOException e) { 38 | logger.error(e.getMessage(), e); 39 | } 40 | return null; 41 | } 42 | 43 | 44 | protected String renderText(String text) { 45 | return render(text, "text/plain;charset=UTF-8"); 46 | } 47 | 48 | 49 | protected String renderHtml(String html) { 50 | return render(html, "text/html;charset=UTF-8"); 51 | } 52 | 53 | 54 | protected String renderXML(String xml) { 55 | return render(xml, "text/xml;charset=UTF-8"); 56 | } 57 | 58 | 59 | /** 60 | * 61 | * @return httpServletRequest 62 | */ 63 | protected HttpServletRequest getRequest(){ 64 | return ServletActionContext.getRequest(); 65 | } 66 | 67 | /** 68 | * 69 | * @return response 70 | */ 71 | protected HttpServletResponse getRespose(){ 72 | return ServletActionContext.getResponse(); 73 | } 74 | 75 | /** 76 | * Gets the Map of HttpSession values when in a servlet environment or a 77 | * generic session map otherwise. 78 | * 79 | * @return the Map of HttpSession values when in a servlet environment or a 80 | * generic session map otherwise. 81 | */ 82 | public Map getSessionMap() { 83 | return this.session; 84 | } 85 | 86 | public void setSession(Map session) { 87 | this.session=session; 88 | } 89 | 90 | public void doPutSessionObject(String key, Object value) { 91 | this.getSessionMap().put(key, value); 92 | } 93 | 94 | public void putPopMsg(String msg) { 95 | if(StringUtils.isNotEmpty(msg)){ 96 | doPutSessionObject(Constant.PROP_MSG_KEY,msg); 97 | } 98 | } 99 | 100 | public void removeSessionObject(Object key) { 101 | this.getSessionMap().remove(key); 102 | } 103 | 104 | public void removeSessionPopMsg(String key){ 105 | Object sessionObj = this.getSessionMap().get(key); 106 | if(sessionObj!=null){ 107 | this.setPropMsg((String)this.getSessionMap().get(key)); 108 | this.getSessionMap().remove(key); 109 | } 110 | } 111 | 112 | public void saveSuccessMessage(String message) { 113 | if(this.getRequest().getAttribute("_EVENT_MESSAGE_") != null) { 114 | message = this.getRequest().getAttribute("_EVENT_MESSAGE_").toString() + "
" + message; 115 | } 116 | this.getRequest().setAttribute("_EVENT_MESSAGE_", message); 117 | } 118 | 119 | public void saveErrorMessage(String message) { 120 | if(this.getRequest().getAttribute("_ERROR_MESSAGE_") != null) { 121 | message = this.getRequest().getAttribute("_ERROR_MESSAGE_").toString() + "
" + message; 122 | } 123 | this.getRequest().setAttribute("_ERROR_MESSAGE_", message); 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/taglib/model/HtmlColumn.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.taglib.model; 2 | 3 | public class HtmlColumn { 4 | private String column; 5 | private String title; 6 | private String width; 7 | private String link; 8 | private String dateFormate; 9 | 10 | public String getDateFormate() { 11 | return dateFormate; 12 | } 13 | 14 | public void setDateFormate(String dateFormate) { 15 | this.dateFormate = dateFormate; 16 | } 17 | 18 | public String getLink() { 19 | return link; 20 | } 21 | 22 | public void setLink(String link) { 23 | this.link = link; 24 | } 25 | 26 | public String getColumn() { 27 | return column; 28 | } 29 | 30 | public void setColumn(String column) { 31 | this.column = column; 32 | } 33 | 34 | public String getTitle() { 35 | return title; 36 | } 37 | 38 | public void setTitle(String title) { 39 | this.title = title; 40 | } 41 | 42 | public String getWidth() { 43 | return width; 44 | } 45 | 46 | public void setWidth(String width) { 47 | this.width = width; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/taglib/ui/pageTableTag.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.taglib.ui; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.apache.struts2.components.Component; 7 | import org.apache.struts2.views.jsp.ui.AbstractUITag; 8 | 9 | import com.sxx.jcc.core.taglib.bean.PageTable; 10 | import com.opensymphony.xwork2.util.ValueStack; 11 | 12 | public class pageTableTag extends AbstractUITag { 13 | 14 | private static final long serialVersionUID = pageTableTag.class.hashCode(); 15 | // core attributes 16 | private String caption; 17 | private String captionKey; 18 | private String action; 19 | 20 | 21 | // style attributes 22 | private String tableRenderer; 23 | private String width; 24 | private String border; 25 | private String columns; 26 | private String results; 27 | private String exports; 28 | private String selectType; 29 | private String deleteDisable; 30 | private String operatorDisable; 31 | 32 | 33 | public Component getBean(ValueStack stack, HttpServletRequest req, 34 | HttpServletResponse res) { 35 | return new PageTable(stack, req, res); 36 | } 37 | 38 | /* (non-Javadoc) 39 | * @see org.apache.struts2.views.jsp.ui.AbstractUITag#populateParams() 40 | */ 41 | protected void populateParams() { 42 | super.populateParams(); 43 | 44 | PageTable pageTable = ((PageTable) component); 45 | pageTable.setCaption(caption); 46 | pageTable.setCssClass(cssClass); 47 | pageTable.setCaptionKey(captionKey); 48 | pageTable.setAction(action); 49 | pageTable.setId(id); 50 | pageTable.setTableRenderer(tableRenderer); 51 | pageTable.setWidth(width); 52 | pageTable.setBorder(border); 53 | pageTable.setName(name); 54 | pageTable.setColumns(columns); 55 | pageTable.setResults(results); 56 | pageTable.setExports(exports); 57 | pageTable.setSelectType(selectType); 58 | pageTable.setDeleteDisable(deleteDisable); 59 | pageTable.setOperatorDisable(operatorDisable); 60 | } 61 | 62 | public String getExports() { 63 | return exports; 64 | } 65 | 66 | public void setExports(String exports) { 67 | this.exports = exports; 68 | } 69 | 70 | public String getCaption() { 71 | return caption; 72 | } 73 | 74 | public void setCaption(String caption) { 75 | this.caption = caption; 76 | } 77 | 78 | public String getCaptionKey() { 79 | return captionKey; 80 | } 81 | 82 | public void setCaptionKey(String captionKey) { 83 | this.captionKey = captionKey; 84 | } 85 | 86 | public String getAction() { 87 | return action; 88 | } 89 | 90 | public void setAction(String action) { 91 | this.action = action; 92 | } 93 | 94 | public String getTableRenderer() { 95 | return tableRenderer; 96 | } 97 | 98 | public void setTableRenderer(String tableRenderer) { 99 | this.tableRenderer = tableRenderer; 100 | } 101 | 102 | public String getWidth() { 103 | return width; 104 | } 105 | 106 | public void setWidth(String width) { 107 | this.width = width; 108 | } 109 | 110 | public String getBorder() { 111 | return border; 112 | } 113 | 114 | public void setBorder(String border) { 115 | this.border = border; 116 | } 117 | 118 | public String getColumns() { 119 | return columns; 120 | } 121 | 122 | public void setColumns(String columns) { 123 | this.columns = columns; 124 | } 125 | 126 | public String getResults() { 127 | return results; 128 | } 129 | 130 | public void setResults(String results) { 131 | this.results = results; 132 | } 133 | 134 | public String getSelectType() { 135 | return selectType; 136 | } 137 | 138 | public void setSelectType(String selectType) { 139 | this.selectType = selectType; 140 | } 141 | 142 | public String getDeleteDisable() { 143 | return deleteDisable; 144 | } 145 | 146 | public void setDeleteDisable(String deleteDisable) { 147 | this.deleteDisable = deleteDisable; 148 | } 149 | 150 | public String getOperatorDisable() { 151 | return operatorDisable; 152 | } 153 | 154 | public void setOperatorDisable(String operatorDisable) { 155 | this.operatorDisable = operatorDisable; 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/BeanUtils.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils; 2 | 3 | import java.lang.reflect.Field; 4 | 5 | 6 | import org.apache.log4j.Logger; 7 | import org.springframework.util.Assert; 8 | 9 | public class BeanUtils { 10 | 11 | protected static Logger logger = Logger.getLogger(BeanUtils.class.getName()); 12 | 13 | private BeanUtils() { 14 | } 15 | 16 | 17 | public static Object getFieldValue(Object object, String fieldName) throws NoSuchFieldException { 18 | Field field = getDeclaredField(object, fieldName); 19 | if (!field.isAccessible()) { 20 | field.setAccessible(true); 21 | } 22 | 23 | Object result = null; 24 | try { 25 | result = field.get(object); 26 | } catch (IllegalAccessException e) { 27 | logger.error(e.getMessage(), e); 28 | } 29 | return result; 30 | } 31 | 32 | 33 | public static void setFieldValue(Object object, String fieldName, Object value) throws NoSuchFieldException { 34 | Field field = getDeclaredField(object, fieldName); 35 | if (!field.isAccessible()) { 36 | field.setAccessible(true); 37 | } 38 | try { 39 | field.set(object, value); 40 | } catch (IllegalAccessException e) { 41 | logger.error(e.getMessage(), e); 42 | } 43 | } 44 | 45 | 46 | public static Field getDeclaredField(Object object, String fieldName) throws NoSuchFieldException { 47 | Assert.notNull(object); 48 | return getDeclaredField(object.getClass(), fieldName); 49 | } 50 | 51 | 52 | @SuppressWarnings("unchecked") 53 | public static Field getDeclaredField(Class clazz, String fieldName) throws NoSuchFieldException { 54 | Assert.notNull(clazz); 55 | Assert.hasText(fieldName); 56 | for (Class superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) { 57 | try { 58 | return superClass.getDeclaredField(fieldName); 59 | } catch (NoSuchFieldException e) { 60 | } 61 | } 62 | throw new NoSuchFieldException("No such field: " + clazz.getName() + '.' + fieldName); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/Constant.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils; 2 | 3 | public class Constant { 4 | public static String PROP_MSG_KEY="propMsg"; 5 | public static String LOGIN_USER_KEY="loginUser"; 6 | public static String APP_EXCEPTION_MSG="appMsg"; 7 | public static int PAGE_SIZE_MAX=50000; 8 | public static String PRIVS_STRING = "privsString"; 9 | } 10 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/WebUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2005-2009 springside.org.cn 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * 6 | * $Id: WebUtils.java 763 2009-12-27 18:36:21Z calvinxiu $ 7 | */ 8 | package com.sxx.jcc.core.utils; 9 | 10 | import java.io.IOException; 11 | import java.io.OutputStream; 12 | import java.util.Map; 13 | import java.util.StringTokenizer; 14 | import java.util.zip.GZIPOutputStream; 15 | 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | 19 | import org.apache.commons.lang.StringUtils; 20 | 21 | public class WebUtils { 22 | 23 | public static final long ONE_YEAR_SECONDS = 60 * 60 * 24 * 365; 24 | 25 | 26 | public static void setExpiresHeader(HttpServletResponse response, long expiresSeconds) { 27 | //Http 1.0 header 28 | response.setDateHeader("Expires", System.currentTimeMillis() + expiresSeconds * 1000); 29 | //Http 1.1 header 30 | response.setHeader("Cache-Control", "max-age=" + expiresSeconds); 31 | } 32 | 33 | 34 | public static void setNoCacheHeader(HttpServletResponse response) { 35 | //Http 1.0 header 36 | response.setDateHeader("Expires", 0); 37 | //Http 1.1 header 38 | response.setHeader("Cache-Control", "no-cache"); 39 | } 40 | 41 | /** 42 | * 设置LastModified Header. 43 | */ 44 | public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedDate) { 45 | response.setDateHeader("Last-Modified", lastModifiedDate); 46 | } 47 | 48 | /** 49 | * 设置Etag Header. 50 | */ 51 | public static void setEtag(HttpServletResponse response, String etag) { 52 | response.setHeader("ETag", etag); 53 | } 54 | 55 | /** 56 | * 根据浏览器If-Modified-Since Header, 计算文件是否已被修改. 57 | * 58 | * 如果无修�? checkIfModify返回false ,设置304 not modify status. 59 | * 60 | * @param lastModified 内容的最后修改时�? 61 | */ 62 | public static boolean checkIfModifiedSince(HttpServletRequest request, HttpServletResponse response, 63 | long lastModified) { 64 | long ifModifiedSince = request.getDateHeader("If-Modified-Since"); 65 | if ((ifModifiedSince != -1) && (lastModified < ifModifiedSince + 1000)) { 66 | response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); 67 | return false; 68 | } 69 | return true; 70 | } 71 | 72 | /** 73 | * 根据浏览�?If-None-Match Header, 计算Etag是否已无�? 74 | * 75 | * 如果Etag有效, checkIfNoneMatch返回false, 设置304 not modify status. 76 | * 77 | * @param etag 内容的ETag. 78 | */ 79 | public static boolean checkIfNoneMatchEtag(HttpServletRequest request, HttpServletResponse response, String etag) { 80 | String headerValue = request.getHeader("If-None-Match"); 81 | if (headerValue != null) { 82 | boolean conditionSatisfied = false; 83 | if (!"*".equals(headerValue)) { 84 | StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); 85 | 86 | while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) { 87 | String currentToken = commaTokenizer.nextToken(); 88 | if (currentToken.trim().equals(etag)) { 89 | conditionSatisfied = true; 90 | } 91 | } 92 | } else { 93 | conditionSatisfied = true; 94 | } 95 | 96 | if (conditionSatisfied) { 97 | response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); 98 | response.setHeader("ETag", etag); 99 | return false; 100 | } 101 | } 102 | return true; 103 | } 104 | 105 | /** 106 | * �?��浏览器客户端是否支持gzip编码. 107 | */ 108 | public static boolean checkAccetptGzip(HttpServletRequest request) { 109 | //Http1.1 header 110 | String acceptEncoding = request.getHeader("Accept-Encoding"); 111 | 112 | if (StringUtils.contains(acceptEncoding, "gzip")) { 113 | return true; 114 | } else { 115 | return false; 116 | } 117 | } 118 | 119 | /** 120 | * 设置Gzip Header并返回GZIPOutputStream. 121 | */ 122 | public static OutputStream buildGzipOutputStream(HttpServletResponse response) throws IOException { 123 | response.setHeader("Content-Encoding", "gzip"); 124 | response.setHeader("Vary", "Accept-Encoding"); 125 | return new GZIPOutputStream(response.getOutputStream()); 126 | } 127 | 128 | /** 129 | * 设置让浏览器弹出下载对话框的Header. 130 | * 131 | * @param fileName 下载后的文件�? 132 | */ 133 | public static void setDownloadableHeader(HttpServletResponse response, String fileName) { 134 | response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); 135 | } 136 | 137 | /** 138 | * 取得带相同前�?��Request Parameters. 139 | * 140 | * 返回的结果Parameter名已去除前缀. 141 | */ 142 | @SuppressWarnings("unchecked") 143 | public static Map getParametersStartingWith(HttpServletRequest request, String prefix) { 144 | return org.springframework.web.util.WebUtils.getParametersStartingWith(request, prefix); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/tree/TreeCompare.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils.tree; 2 | 3 | import java.util.Comparator; 4 | 5 | public class TreeCompare implements Comparator { 6 | 7 | public int compare(Object o1, Object o2) { 8 | TreeNode node1 = (TreeNode) o1; 9 | TreeNode node2 = (TreeNode) o2; 10 | int result = node1.getId().compareTo(node2.getId()); 11 | return result; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/tree/TreeNode.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils.tree; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class TreeNode implements Comparable { 7 | // 节点ID 8 | private String id; 9 | // 节点父ID 10 | private String pid; 11 | // 节点显示名称 12 | private String text; 13 | 14 | private String value; 15 | 16 | private String url; 17 | private String childNum; 18 | private String val1; 19 | private String val2; 20 | private String val3; 21 | private String val4; 22 | private String val5; 23 | private String val6; 24 | private String val7; 25 | private String checkState; 26 | private boolean showCheck = true; 27 | private boolean isExpand; 28 | private boolean hasChildren = true; 29 | private List childNodes; 30 | private String id_temp; 31 | 32 | public TreeNode() { 33 | childNodes = new ArrayList(); 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | public String getText() { 45 | return text; 46 | } 47 | 48 | public void setText(String text) { 49 | this.text = text; 50 | } 51 | 52 | public String getValue() { 53 | return value; 54 | } 55 | 56 | public void setValue(String value) { 57 | this.value = value; 58 | } 59 | 60 | public String getCheckState() { 61 | return checkState; 62 | } 63 | 64 | public void setCheckState(String checkState) { 65 | this.checkState = checkState; 66 | } 67 | 68 | public boolean isShowCheck() { 69 | return showCheck; 70 | } 71 | 72 | public void setShowCheck(boolean showCheck) { 73 | this.showCheck = showCheck; 74 | } 75 | 76 | public boolean isExpand() { 77 | return isExpand; 78 | } 79 | 80 | public void setExpand(boolean isExpand) { 81 | this.isExpand = isExpand; 82 | } 83 | 84 | public boolean isHasChildren() { 85 | return hasChildren; 86 | } 87 | 88 | public void setHasChildren(boolean hasChildren) { 89 | this.hasChildren = hasChildren; 90 | } 91 | 92 | public List getChildNodes() { 93 | return childNodes; 94 | } 95 | 96 | public void setChildNodes(List childNodes) { 97 | this.childNodes = childNodes; 98 | } 99 | 100 | public String getPid() { 101 | return pid; 102 | } 103 | 104 | public void setPid(String pid) { 105 | this.pid = pid; 106 | } 107 | 108 | public int compareTo(Object o) { 109 | // TODO Auto-generated method stub 110 | return 0; 111 | } 112 | 113 | public String getUrl() { 114 | return url; 115 | } 116 | 117 | public void setUrl(String url) { 118 | this.url = url; 119 | } 120 | 121 | public String getVal1() { 122 | return val1; 123 | } 124 | 125 | public void setVal1(String val1) { 126 | this.val1 = val1; 127 | } 128 | 129 | public String getVal2() { 130 | return val2; 131 | } 132 | 133 | public void setVal2(String val2) { 134 | this.val2 = val2; 135 | } 136 | 137 | public String getVal3() { 138 | return val3; 139 | } 140 | 141 | public void setVal3(String val3) { 142 | this.val3 = val3; 143 | } 144 | 145 | public String getVal4() { 146 | return val4; 147 | } 148 | 149 | public void setVal4(String val4) { 150 | this.val4 = val4; 151 | } 152 | 153 | public String getVal5() { 154 | return val5; 155 | } 156 | 157 | public void setVal5(String val5) { 158 | this.val5 = val5; 159 | } 160 | 161 | public String getVal6() { 162 | return val6; 163 | } 164 | 165 | public void setVal6(String val6) { 166 | this.val6 = val6; 167 | } 168 | 169 | public String getChildNum() { 170 | return childNum; 171 | } 172 | 173 | public void setChildNum(String childNum) { 174 | this.childNum = childNum; 175 | } 176 | 177 | public String getVal7() { 178 | return val7; 179 | } 180 | 181 | public void setVal7(String val7) { 182 | this.val7 = val7; 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/tree/ZTreeCompare.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils.tree; 2 | 3 | import java.util.Comparator; 4 | 5 | public class ZTreeCompare implements Comparator { 6 | 7 | public int compare(Object o1, Object o2) { 8 | ZTreeNode node1 = (ZTreeNode) o1; 9 | ZTreeNode node2 = (ZTreeNode) o2; 10 | int result = node1.getDisporder() - node2.getDisporder(); 11 | return result; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/utils/tree/ZTreeNode.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.utils.tree; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class ZTreeNode implements java.io.Serializable{ 7 | private String id; 8 | private String pid; 9 | private String name; 10 | private String value; 11 | private boolean isParent = false; 12 | private String icon; 13 | private String iconSkin; 14 | private boolean open; 15 | private String url; 16 | private boolean checked; 17 | private boolean nocheck; 18 | private boolean chkDisabled; 19 | private boolean doCheck; 20 | private int disporder = 0; 21 | private List childNodes; 22 | private String val1; 23 | private String val2; 24 | private String val3; 25 | private String val4; 26 | private String val5; 27 | private String val6; 28 | 29 | public ZTreeNode() { 30 | childNodes = new ArrayList(); 31 | } 32 | 33 | public String getId() { 34 | return id; 35 | } 36 | 37 | public void setId(String id) { 38 | this.id = id; 39 | } 40 | 41 | public String getPid() { 42 | return pid; 43 | } 44 | 45 | public void setPid(String pid) { 46 | this.pid = pid; 47 | } 48 | 49 | public String getName() { 50 | return name; 51 | } 52 | 53 | public void setName(String name) { 54 | this.name = name; 55 | } 56 | 57 | public String getValue() { 58 | return value; 59 | } 60 | 61 | public void setValue(String value) { 62 | this.value = value; 63 | } 64 | 65 | public boolean isParent() { 66 | return isParent; 67 | } 68 | 69 | public void setParent(boolean isParent) { 70 | this.isParent = isParent; 71 | } 72 | 73 | public String getIcon() { 74 | return icon; 75 | } 76 | 77 | public void setIcon(String icon) { 78 | this.icon = icon; 79 | } 80 | 81 | public String getIconSkin() { 82 | return iconSkin; 83 | } 84 | 85 | public void setIconSkin(String iconSkin) { 86 | this.iconSkin = iconSkin; 87 | } 88 | 89 | public boolean isOpen() { 90 | return open; 91 | } 92 | 93 | public void setOpen(boolean open) { 94 | this.open = open; 95 | } 96 | 97 | public String getUrl() { 98 | return url; 99 | } 100 | 101 | public void setUrl(String url) { 102 | this.url = url; 103 | } 104 | 105 | public boolean isChecked() { 106 | return checked; 107 | } 108 | 109 | public void setChecked(boolean checked) { 110 | this.checked = checked; 111 | } 112 | 113 | public boolean isNocheck() { 114 | return nocheck; 115 | } 116 | 117 | public void setNocheck(boolean nocheck) { 118 | this.nocheck = nocheck; 119 | } 120 | 121 | public boolean isChkDisabled() { 122 | return chkDisabled; 123 | } 124 | 125 | public void setChkDisabled(boolean chkDisabled) { 126 | this.chkDisabled = chkDisabled; 127 | } 128 | 129 | public boolean isDoCheck() { 130 | return doCheck; 131 | } 132 | 133 | public void setDoCheck(boolean doCheck) { 134 | this.doCheck = doCheck; 135 | } 136 | 137 | public List getChildNodes() { 138 | return childNodes; 139 | } 140 | 141 | public void setChildNodes(List childNodes) { 142 | this.childNodes = childNodes; 143 | } 144 | 145 | public String getVal1() { 146 | return val1; 147 | } 148 | 149 | public void setVal1(String val1) { 150 | this.val1 = val1; 151 | } 152 | 153 | public String getVal2() { 154 | return val2; 155 | } 156 | 157 | public void setVal2(String val2) { 158 | this.val2 = val2; 159 | } 160 | 161 | public String getVal3() { 162 | return val3; 163 | } 164 | 165 | public void setVal3(String val3) { 166 | this.val3 = val3; 167 | } 168 | 169 | public String getVal4() { 170 | return val4; 171 | } 172 | 173 | public void setVal4(String val4) { 174 | this.val4 = val4; 175 | } 176 | 177 | public String getVal5() { 178 | return val5; 179 | } 180 | 181 | public void setVal5(String val5) { 182 | this.val5 = val5; 183 | } 184 | 185 | public String getVal6() { 186 | return val6; 187 | } 188 | 189 | public void setVal6(String val6) { 190 | this.val6 = val6; 191 | } 192 | 193 | public int getDisporder() { 194 | return disporder; 195 | } 196 | 197 | public void setDisporder(int disporder) { 198 | this.disporder = disporder; 199 | } 200 | 201 | } 202 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/AbstractExportView.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.core.taglib.model.HtmlColumn; 6 | 7 | 8 | public abstract class AbstractExportView implements View { 9 | private String caption; 10 | private List items; 11 | private List columns; 12 | 13 | protected AbstractExportView(String caption, List items,List columns) { 14 | this.caption = caption; 15 | this.items = items; 16 | this.columns=columns; 17 | } 18 | 19 | public List getColumns() { 20 | return columns; 21 | } 22 | 23 | public void setColumns(List columns) { 24 | this.columns = columns; 25 | } 26 | 27 | public String getCaption() { 28 | return caption; 29 | } 30 | 31 | public void setCaption(String caption) { 32 | this.caption = caption; 33 | } 34 | 35 | public List getItems() { 36 | return items; 37 | } 38 | 39 | public void setItems(List items) { 40 | this.items = items; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/AbstractViewExporter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | import javax.servlet.http.HttpServletResponse; 4 | 5 | import com.sxx.jcc.core.view.utils.ExportUtils; 6 | 7 | 8 | public abstract class AbstractViewExporter implements ViewExporter { 9 | private View view; 10 | private HttpServletResponse response; 11 | private String fileName; 12 | 13 | public AbstractViewExporter(View view, HttpServletResponse response, 14 | String fileName) { 15 | this.view = view; 16 | this.response = response; 17 | this.fileName = fileName; 18 | if (fileName == null) { 19 | this.fileName = ExportUtils.exportFileName(view, getExtensionName()); 20 | }else{ 21 | this.fileName = fileName+"."+getExtensionName(); 22 | } 23 | } 24 | 25 | public void responseHeaders(HttpServletResponse response) throws Exception { 26 | response.setContentType(getContextType()); 27 | //String encoding = Charset.defaultCharset().name(); 28 | //String fn = new String(fileName.getBytes(encoding), encoding); 29 | response.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("gb2312"),"ISO8859-1") + "\""); 30 | response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0"); 31 | response.setHeader("Pragma", "public"); 32 | response.setDateHeader("Expires", (System.currentTimeMillis() + 1000)); 33 | } 34 | 35 | public abstract String getContextType(); 36 | 37 | public abstract String getExtensionName(); 38 | 39 | public View getView() { 40 | return view; 41 | } 42 | 43 | public void setView(View view) { 44 | this.view = view; 45 | } 46 | 47 | public HttpServletResponse getResponse() { 48 | return response; 49 | } 50 | 51 | public void setResponse(HttpServletResponse response) { 52 | this.response = response; 53 | } 54 | 55 | public String getFileName() { 56 | return fileName; 57 | } 58 | 59 | public void setFileName(String fileName) { 60 | this.fileName = fileName; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/ExcelView.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | import org.apache.poi.hssf.usermodel.HSSFCell; 7 | import org.apache.poi.hssf.usermodel.HSSFRichTextString; 8 | import org.apache.poi.hssf.usermodel.HSSFRow; 9 | import org.apache.poi.hssf.usermodel.HSSFSheet; 10 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; 11 | 12 | import com.sxx.jcc.core.taglib.model.HtmlColumn; 13 | import com.sxx.jcc.core.view.utils.ItemUtils; 14 | 15 | public class ExcelView extends AbstractExportView{ 16 | 17 | public ExcelView(String caption, List items,List columns) { 18 | super(caption, items,columns); 19 | } 20 | 21 | public Object render() { 22 | HSSFWorkbook workbook = new HSSFWorkbook(); 23 | String caption = getCaption(); 24 | if (StringUtils.isEmpty(caption)) { 25 | caption = "Export"; 26 | } 27 | HSSFSheet sheet = workbook.createSheet(caption); 28 | 29 | // renderer header 30 | HSSFRow hssfRow = sheet.createRow(0); 31 | int columncount = 0; 32 | for (HtmlColumn col : getColumns()) { 33 | HSSFCell cell = hssfRow.createCell(columncount++); 34 | cell.setCellValue(new HSSFRichTextString(col.getTitle())); 35 | } 36 | 37 | // renderer body 38 | List items = getItems(); 39 | int rowcount = 1; 40 | for (Object item : items) { 41 | HSSFRow r = sheet.createRow(rowcount++); 42 | columncount = 0; 43 | for (HtmlColumn col : getColumns()) { 44 | HSSFCell cell = r.createCell(columncount++); 45 | Object value = ItemUtils.getItemValue(item, col.getColumn()); 46 | if (value == null) { 47 | value = ""; 48 | } 49 | 50 | if (value instanceof Number) { 51 | Double number = Double.valueOf(value.toString()); 52 | cell.setCellValue(number); 53 | } else { 54 | cell.setCellValue(new HSSFRichTextString(value.toString())); 55 | } 56 | } 57 | } 58 | return workbook; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/ExcelViewExporter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | import javax.servlet.ServletOutputStream; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; 7 | 8 | 9 | public class ExcelViewExporter extends AbstractViewExporter { 10 | 11 | public ExcelViewExporter(View view, HttpServletResponse response, 12 | String fileName) { 13 | super(view, response, fileName); 14 | } 15 | 16 | @Override 17 | public String getContextType() { 18 | return "application/vnd.ms-excel;charset=UTF-8"; 19 | } 20 | 21 | @Override 22 | public String getExtensionName() { 23 | return "xls"; 24 | } 25 | 26 | public void export() throws Exception { 27 | HttpServletResponse response = super.getResponse(); 28 | HSSFWorkbook workbook = (HSSFWorkbook) this.getView().render(); 29 | responseHeaders(response); 30 | ServletOutputStream out=response.getOutputStream(); 31 | workbook.write(out); 32 | out.flush(); 33 | out.close(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/ExportType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sxx.jcc.core.view; 17 | 18 | /** 19 | *

20 | * The export types for the table. 21 | *

22 | * 23 | * @since 2.0 24 | * @author Jeff Johnston 25 | */ 26 | public enum ExportType { 27 | CSV, EXCEL, JEXCEL, PDF, PDFP; 28 | 29 | public String toParam() { 30 | switch (this) { 31 | case CSV: 32 | return "csv"; 33 | case EXCEL: 34 | return "excel"; 35 | case JEXCEL: 36 | return "jexcel"; 37 | case PDF: 38 | return "pdf"; 39 | case PDFP: 40 | return "pdfp"; 41 | default: 42 | return ""; 43 | } 44 | } 45 | 46 | public static ExportType valueOfParam(String param) { 47 | for (ExportType exportType : ExportType.values()) { 48 | if (exportType.toParam().equals(param)) { 49 | return exportType; 50 | } 51 | } 52 | 53 | return null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/View.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | public interface View { 4 | public String getCaption(); 5 | public Object render(); 6 | } 7 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/ViewExporter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.core.view; 2 | 3 | 4 | public interface ViewExporter { 5 | public View getView(); 6 | 7 | public void setView(View view); 8 | 9 | public void export() throws Exception; 10 | } 11 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/utils/BeanUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sxx.jcc.core.view.utils; 17 | 18 | import java.lang.reflect.Method; 19 | 20 | import org.apache.log4j.Logger; 21 | 22 | /** 23 | * Utilities for java bean. 24 | * 25 | * @author wliu 26 | */ 27 | public class BeanUtils { 28 | 29 | private static final Logger logger = Logger.getLogger(BeanUtils.class); 30 | 31 | /** 32 | * the possible prefixes for read method 33 | */ 34 | private static final String[] getterPrefixes = { "get", "is"}; 35 | 36 | /** 37 | * Gets the type of a property of an object. 38 | * 39 | * @param object The object that the property belongs to, cannot be null. 40 | * @param property The property to get type, can be nested. for example, 'foo.bar.baz'. 41 | * @return The type of the property. If the property doesn't exists in the object, returns null. 42 | */ 43 | public static Class getPropertyType(Object object, String property) { 44 | if (object == null) { 45 | throw new IllegalArgumentException("Object cannot be null."); 46 | } 47 | return getPropertyType(object.getClass(), property); 48 | } 49 | 50 | /** 51 | * Gets the type of a property of a class. 52 | * 53 | * @param clazz The class that the property belongs to, cannot be null. 54 | * @param property The property to get type, can be nested. for example, 'foo.bar.baz'. 55 | * @return The type of the property. If the property doesn't exists in the clazz, returns null. 56 | */ 57 | public static Class getPropertyType(Class clazz, String property) { 58 | if (clazz == null) { 59 | throw new IllegalArgumentException("Clazz cannot be null."); 60 | } 61 | 62 | if (property == null) { 63 | throw new IllegalArgumentException("Property cannot be null."); 64 | } 65 | 66 | int dotIndex = property.lastIndexOf('.'); 67 | 68 | if (dotIndex == -1) { 69 | Method method = getReadMethod(clazz, property); 70 | return method == null ? null : method.getReturnType(); 71 | } 72 | 73 | String deepestProperty = property.substring(dotIndex + 1); 74 | String parentProperty = property.substring(0, dotIndex); 75 | return getPropertyType(getPropertyType(clazz, parentProperty), deepestProperty); 76 | } 77 | 78 | /** 79 | * Gets the read method for a property in a class. 80 | * 81 | * for example: 82 | * class Foo { 83 | * public String getBar() { return "bar"; } 84 | * public Boolean isBaz() { return false; } 85 | * } 86 | * 87 | * BeanUtils.getReadMethod(Foo.class, "bar"); // return Foo#getBar() 88 | * BeanUtils.getReadMethod(Foo.class, "baz"); // return Foo#isBaz() 89 | * BeanUtils.getReadMethod(Foo.class, "baa"); // return null 90 | * 91 | * 92 | * @param clazz The class to get read method. 93 | * @param property The property to get read method for, can NOT be nested. 94 | * @return The read method (getter) for the property, if there is no read method for 95 | * the property, returns null. 96 | */ 97 | public static Method getReadMethod(Class clazz, String property) { 98 | // Capitalize the property 99 | StringBuffer buf = new StringBuffer(); 100 | buf.append(property.substring(0, 1).toUpperCase()); 101 | if (property.length() > 1) { 102 | buf.append(property.substring(1)); 103 | } 104 | 105 | Method method = null; 106 | for (String prefix : getterPrefixes) { 107 | String methodName = prefix + buf.toString(); 108 | try { 109 | method = clazz.getMethod(methodName); 110 | 111 | // Once get method successfully, jump out the loop. 112 | break; 113 | } catch (NoSuchMethodException e) { 114 | // do nothing but logging 115 | logger.debug("No such read method '" + methodName + "()' in class '" + 116 | clazz.getName() + "'."); 117 | } catch (SecurityException e) { 118 | // do nothing but logging 119 | logger.debug("Error occurs while getting read method '" + methodName + "()' in class '" + 120 | clazz.getName() + "'."); 121 | } 122 | } 123 | 124 | return method; 125 | } 126 | } -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/utils/ExportUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sxx.jcc.core.view.utils; 17 | 18 | import org.apache.commons.lang.StringUtils; 19 | 20 | import com.sxx.jcc.core.view.View; 21 | 22 | 23 | /** 24 | *

25 | * Utility class to work with the Exports. 26 | *

27 | * 28 | * @since 2.2 29 | * @author Jeff Johnston 30 | */ 31 | public class ExportUtils { 32 | 33 | /** 34 | * Use the view caption for the export. If the caption is not defined then use a default. 35 | * 36 | * @param view The view to export. 37 | * @param exportType The type of view to export. 38 | * @return The file name of export. 39 | */ 40 | public static String exportFileName(View view, String exportType) { 41 | String caption = view.getCaption(); 42 | if (StringUtils.isNotBlank(caption)) { 43 | StringUtils.replace(caption, " ", "_"); 44 | return caption.toLowerCase() + "." + exportType; 45 | } 46 | return "table-data." + exportType; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sample/core/src/com/sxx/jcc/core/view/utils/ItemUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sxx.jcc.core.view.utils; 17 | 18 | import java.util.Collection; 19 | import java.util.Map; 20 | 21 | import org.apache.commons.beanutils.PropertyUtils; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | /** 26 | * General utilities to process the Collecton of Beans or the Collection of 27 | * Maps. Most methods wrap or add value to the commons Beanutils. 28 | * 29 | * @since 2.1 30 | * @author Jeff Johnston 31 | */ 32 | public class ItemUtils { 33 | 34 | private static final Logger logger = LoggerFactory.getLogger(ItemUtils.class); 35 | public static final String JMESA_ITEM = "jmesa-item"; 36 | 37 | private ItemUtils() { 38 | // hide constructor 39 | } 40 | 41 | /** 42 | * Get the value from the Bean or Map by property. 43 | * 44 | * @param item The Bean or Map. 45 | * @param property The Bean attribute or Map key. 46 | * @return The value from the Bean or Map. 47 | */ 48 | public static Object getItemValue(Object item, String property) { 49 | Object itemValue = null; 50 | 51 | try { 52 | if (item instanceof Map) { 53 | itemValue = ((Map) item).get(property); 54 | if (itemValue != null) { 55 | return itemValue; 56 | } 57 | 58 | // ports such as the tags will store the original bean 59 | Object bean = ((Map) item).get(JMESA_ITEM); 60 | 61 | if (bean == null) { 62 | logger.debug("the map does not have property " + property); 63 | return null; 64 | } 65 | 66 | itemValue = getItemValue(bean, property); 67 | } else { 68 | itemValue = PropertyUtils.getProperty(item, property); 69 | } 70 | } catch (Exception e) { 71 | logger.debug("item class " + item.getClass().getName() + " does not have property " + property); 72 | } 73 | 74 | return itemValue; 75 | } 76 | 77 | /** 78 | * Get the Class for the property. 79 | * 80 | * @param items The Collection of Beans or Maps. 81 | * @param property The Bean attribute or Map key. 82 | * @return The Class for the property. 83 | */ 84 | public static Class getPropertyClassType(Collection items, String property) 85 | throws Exception { 86 | 87 | Object item = items.iterator().next(); 88 | 89 | if (item instanceof Map) { 90 | for (Object object : items) { 91 | Map map = (Map) object; 92 | Object val = map.get(property); 93 | 94 | if (val == null) { 95 | continue; 96 | } 97 | 98 | return val.getClass(); 99 | } 100 | } 101 | 102 | Class type = null; 103 | try { 104 | type = PropertyUtils.getPropertyType(item, property); 105 | } catch (Exception e) { 106 | if (logger.isDebugEnabled()) { 107 | logger.debug("Had problems getting property type by object, trying reflection..."); 108 | } 109 | type = BeanUtils.getPropertyType(item, property); 110 | } 111 | return type; 112 | } 113 | } -------------------------------------------------------------------------------- /sample/core/src/memcached.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.alisoft.xplatform.asf.cache.memcached.MemcachedErrorHandler 5 | 6 | 7 | com.alisoft.xplatform.asf.cache.memcached.MemcachedErrorHandler 8 | 9 | 11 | 127.0.0.1:11211 12 | 13 | 15 | 127.0.0.1:11211 16 | 17 | 18 | mclient0 19 | 20 | -------------------------------------------------------------------------------- /sample/core/src/struts.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | exceptionAction 34 | /redirect.jsp 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /sample/temp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/config/DisruptorConfigure.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.config; 2 | 3 | import java.util.concurrent.Executor; 4 | import java.util.concurrent.Executors; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.stereotype.Component; 8 | 9 | import com.lmax.disruptor.BlockingWaitStrategy; 10 | import com.lmax.disruptor.dsl.Disruptor; 11 | import com.lmax.disruptor.dsl.ProducerType; 12 | import com.sxx.jcc.common.utils.disruptor.UserDataEventFactory; 13 | import com.sxx.jcc.common.utils.disruptor.UserEventHandler; 14 | import com.sxx.jcc.common.utils.event.UserDataEvent; 15 | 16 | @Component 17 | public class DisruptorConfigure { 18 | @SuppressWarnings({ "unchecked"}) 19 | @Bean(name="disruptor") 20 | public Disruptor disruptor() { 21 | Executor executor = Executors.newCachedThreadPool(); 22 | UserDataEventFactory factory = new UserDataEventFactory(); 23 | Disruptor disruptor = new Disruptor(factory, 1024, executor, ProducerType.MULTI , new BlockingWaitStrategy()); 24 | disruptor.handleEventsWith(new UserEventHandler()); 25 | disruptor.start(); 26 | return disruptor; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/config/SessionConfigItem.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.config; 2 | 3 | public class SessionConfigItem implements java.io.Serializable{ 4 | /** 5 | * 存放客服服务时间段 6 | */ 7 | private static final long serialVersionUID = 3520656734252136303L; 8 | 9 | private String workinghours ; 10 | private String type; 11 | private String worktype; 12 | public String getWorkinghours() { 13 | return workinghours; 14 | } 15 | public void setWorkinghours(String workinghours) { 16 | this.workinghours = workinghours; 17 | } 18 | public String getType() { 19 | return type; 20 | } 21 | public void setType(String type) { 22 | this.type = type; 23 | } 24 | public String getWorktype() { 25 | return worktype; 26 | } 27 | public void setWorktype(String worktype) { 28 | this.worktype = worktype; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/AgentReport.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.Id; 10 | import javax.persistence.Table; 11 | 12 | import org.hibernate.annotations.GenericGenerator; 13 | 14 | import com.sxx.jcc.common.utils.XKTools; 15 | 16 | 17 | @Entity 18 | @Table(name = "xk_webim_monitor") 19 | public class AgentReport implements java.io.Serializable{ 20 | 21 | /** 22 | * 23 | */ 24 | private static final long serialVersionUID = 5931219598388385394L; 25 | 26 | private String id ; 27 | private Date createtime = new Date(); 28 | private int agents ; //坐席数量 29 | private int readyagents ; //就绪坐席 30 | private int incall; //通话中 31 | private int users ; //服务中的用户 32 | private int inquene ; //队列中的用户 33 | private int busy ; //队列中忙的坐席 34 | private String orgi; 35 | 36 | private String worktype ; 37 | private String workresult ; 38 | private String dataid ; 39 | 40 | private String datestr = XKTools.simpleDateFormat.format(new Date()); 41 | private String hourstr = new SimpleDateFormat("HH").format(new Date()); 42 | private String datehourstr = new SimpleDateFormat("yyyy-MM-dd HH").format(new Date()); 43 | public String getOrgi() { 44 | return orgi; 45 | } 46 | public void setOrgi(String orgi) { 47 | this.orgi = orgi; 48 | } 49 | private String type = "status"; //坐席状态 50 | 51 | public int getAgents() { 52 | return agents; 53 | } 54 | public void setAgents(int agents) { 55 | this.agents = agents; 56 | } 57 | public int getUsers() { 58 | return users; 59 | } 60 | public void setUsers(int users) { 61 | this.users = users; 62 | } 63 | public int getInquene() { 64 | return inquene; 65 | } 66 | public void setInquene(int inquene) { 67 | this.inquene = inquene; 68 | } 69 | public String getType() { 70 | return type; 71 | } 72 | public void setType(String type) { 73 | this.type = type; 74 | } 75 | public int getBusy() { 76 | return busy; 77 | } 78 | public void setBusy(int busy) { 79 | this.busy = busy; 80 | } 81 | @Id 82 | @Column(length = 32) 83 | @GeneratedValue(generator = "system-uuid") 84 | @GenericGenerator(name = "system-uuid", strategy = "uuid") 85 | public String getId() { 86 | return id; 87 | } 88 | public void setId(String id) { 89 | this.id = id; 90 | } 91 | public Date getCreatetime() { 92 | return createtime; 93 | } 94 | public void setCreatetime(Date createtime) { 95 | this.createtime = createtime; 96 | } 97 | public String getDatestr() { 98 | return datestr; 99 | } 100 | public void setDatestr(String datestr) { 101 | this.datestr = datestr; 102 | } 103 | public String getHourstr() { 104 | return hourstr; 105 | } 106 | public void setHourstr(String hourstr) { 107 | this.hourstr = hourstr; 108 | } 109 | public String getDatehourstr() { 110 | return datehourstr; 111 | } 112 | public void setDatehourstr(String datehourstr) { 113 | this.datehourstr = datehourstr; 114 | } 115 | public String getWorktype() { 116 | return worktype; 117 | } 118 | public void setWorktype(String worktype) { 119 | this.worktype = worktype; 120 | } 121 | public String getWorkresult() { 122 | return workresult; 123 | } 124 | public void setWorkresult(String workresult) { 125 | this.workresult = workresult; 126 | } 127 | public String getDataid() { 128 | return dataid; 129 | } 130 | public void setDataid(String dataid) { 131 | this.dataid = dataid; 132 | } 133 | public int getReadyagents() { 134 | return readyagents; 135 | } 136 | public void setReadyagents(int readyagents) { 137 | this.readyagents = readyagents; 138 | } 139 | public int getIncall() { 140 | return incall; 141 | } 142 | public void setIncall(int incall) { 143 | this.incall = incall; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/BlackEntity.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | 11 | import org.hibernate.annotations.GenericGenerator; 12 | 13 | @Entity 14 | @Table(name = "xk_blacklist") 15 | public class BlackEntity implements java.io.Serializable{ 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = 7852633351774613958L; 20 | private String id ; 21 | private String orgi ; //orgi 22 | private String userid ; //加黑用户ID 23 | private String contactid ; //联系人ID 24 | private String sessionid ; //当前会话 25 | private Date createtime = new Date() ; //加黑时间 26 | 27 | private int controltime ; //加黑时间,1小时~N小时 28 | private Date endtime ; //结束时间 29 | 30 | private String agentuser ; //用户名 31 | 32 | private String channel ; //渠道 33 | private String creater ; //创建人,和 加黑坐席同一个人 34 | private String agentid ; //加黑坐席 35 | private String phone ; //用户电话 36 | private String openid ; //用户openid 37 | private String agentserviceid ; //agent service id 38 | private String description ; //备注黑名单原因 39 | private int times ; //对话次数 40 | private int chattime ; //最后一次对话时长 41 | 42 | @Id 43 | @Column(length = 32) 44 | @GeneratedValue(generator = "system-uuid") 45 | @GenericGenerator(name = "system-uuid", strategy = "uuid") 46 | public String getId() { 47 | return id; 48 | } 49 | public void setId(String id) { 50 | this.id = id; 51 | } 52 | public String getOrgi() { 53 | return orgi; 54 | } 55 | public void setOrgi(String orgi) { 56 | this.orgi = orgi; 57 | } 58 | public String getUserid() { 59 | return userid; 60 | } 61 | public void setUserid(String userid) { 62 | this.userid = userid; 63 | } 64 | public String getContactid() { 65 | return contactid; 66 | } 67 | public void setContactid(String contactid) { 68 | this.contactid = contactid; 69 | } 70 | public String getSessionid() { 71 | return sessionid; 72 | } 73 | public void setSessionid(String sessionid) { 74 | this.sessionid = sessionid; 75 | } 76 | public Date getCreatetime() { 77 | return createtime; 78 | } 79 | public void setCreatetime(Date createtime) { 80 | this.createtime = createtime; 81 | } 82 | public String getChannel() { 83 | return channel; 84 | } 85 | public void setChannel(String channel) { 86 | this.channel = channel; 87 | } 88 | public String getCreater() { 89 | return creater; 90 | } 91 | public void setCreater(String creater) { 92 | this.creater = creater; 93 | } 94 | public String getAgentid() { 95 | return agentid; 96 | } 97 | public void setAgentid(String agentid) { 98 | this.agentid = agentid; 99 | } 100 | public String getPhone() { 101 | return phone; 102 | } 103 | public void setPhone(String phone) { 104 | this.phone = phone; 105 | } 106 | public String getOpenid() { 107 | return openid; 108 | } 109 | public void setOpenid(String openid) { 110 | this.openid = openid; 111 | } 112 | public String getDescription() { 113 | return description; 114 | } 115 | public void setDescription(String description) { 116 | this.description = description; 117 | } 118 | public String getAgentserviceid() { 119 | return agentserviceid; 120 | } 121 | public void setAgentserviceid(String agentserviceid) { 122 | this.agentserviceid = agentserviceid; 123 | } 124 | public int getTimes() { 125 | return times; 126 | } 127 | public void setTimes(int times) { 128 | this.times = times; 129 | } 130 | public int getChattime() { 131 | return chattime; 132 | } 133 | public void setChattime(int chattime) { 134 | this.chattime = chattime; 135 | } 136 | public int getControltime() { 137 | return controltime; 138 | } 139 | public void setControltime(int controltime) { 140 | this.controltime = controltime; 141 | } 142 | public Date getEndtime() { 143 | return endtime; 144 | } 145 | public void setEndtime(Date endtime) { 146 | this.endtime = endtime; 147 | } 148 | public String getAgentuser() { 149 | return agentuser; 150 | } 151 | public void setAgentuser(String agentuser) { 152 | this.agentuser = agentuser; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/MessageDataBean.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import com.sxx.jcc.system.pojo.AgentUser; 4 | 5 | 6 | public interface MessageDataBean { 7 | 8 | public String getId() ; 9 | 10 | public String getNickName(); 11 | 12 | 13 | public String getOrgi() ; 14 | 15 | /** 16 | * 对话的文本内容 17 | * @return 18 | */ 19 | public String getMessage() ; 20 | 21 | /** 22 | * 消息类型 23 | * @return 24 | */ 25 | public String getMessageType() ; 26 | 27 | /** 28 | * 来源用户 29 | * @return 30 | */ 31 | public String getFromUser() ; 32 | 33 | /** 34 | * 目标用户 35 | * @return 36 | */ 37 | public String getToUser(); 38 | /** 39 | * 渠道信息 40 | * @return 41 | */ 42 | public SNSAccount getSnsAccount(); 43 | /** 44 | * 坐席用户信息 45 | * @return 46 | */ 47 | public AgentUser getAgentUser() ; 48 | 49 | /** 50 | * 获取渠道来源的消息信息 51 | * @return 52 | */ 53 | public Object getChannelMessage() ; 54 | 55 | /** 56 | * 渠道上对应的用户信息 57 | * @return 58 | */ 59 | public Object getUser(); 60 | 61 | 62 | public void setContextid(String contextid) ; 63 | 64 | public String getContextid() ; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/MessageInContent.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import com.sxx.jcc.common.utils.XKDataContext; 4 | import com.sxx.jcc.system.pojo.AgentUser; 5 | 6 | 7 | 8 | 9 | public class MessageInContent implements MessageDataBean,java.io.Serializable{ 10 | 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 1L; 15 | public String id ; 16 | private String nickName; 17 | private String orgi ; 18 | private String message ; 19 | private String filename ; 20 | private int filesize ; 21 | private String messageType; 22 | private String fromUser; 23 | private String calltype = XKDataContext.CallTypeEnum.IN.toString() ; 24 | private String toUser; 25 | private SNSAccount snsAccount ; 26 | private AgentUser agentUser ; 27 | private Object channelMessage ; 28 | private String agentserviceid ; 29 | 30 | private boolean topic ; 31 | 32 | private int duration ; //音频时长 33 | 34 | private String attachmentid ; 35 | 36 | private boolean noagent ; 37 | 38 | private boolean quickagent ; 39 | 40 | private Object user ; 41 | private String contextid ; 42 | private String createtime ; 43 | 44 | public String getId() { 45 | return id; 46 | } 47 | public void setId(String id) { 48 | this.id = id; 49 | } 50 | public String getNickName() { 51 | return nickName; 52 | } 53 | public void setNickName(String nickName) { 54 | this.nickName = nickName; 55 | } 56 | public String getOrgi() { 57 | return orgi; 58 | } 59 | public void setOrgi(String orgi) { 60 | this.orgi = orgi; 61 | } 62 | public String getMessage() { 63 | return message; 64 | } 65 | public void setMessage(String message) { 66 | this.message = message; 67 | } 68 | public String getMessageType() { 69 | return messageType; 70 | } 71 | public void setMessageType(String messageType) { 72 | this.messageType = messageType; 73 | } 74 | public String getFromUser() { 75 | return fromUser; 76 | } 77 | public void setFromUser(String fromUser) { 78 | this.fromUser = fromUser; 79 | } 80 | public String getToUser() { 81 | return toUser; 82 | } 83 | public void setToUser(String toUser) { 84 | this.toUser = toUser; 85 | } 86 | public SNSAccount getSnsAccount() { 87 | return snsAccount; 88 | } 89 | public void setSnsAccount(SNSAccount snsAccount) { 90 | this.snsAccount = snsAccount; 91 | } 92 | public AgentUser getAgentUser() { 93 | return agentUser; 94 | } 95 | public void setAgentUser(AgentUser agentUser) { 96 | this.agentUser = agentUser; 97 | } 98 | public Object getChannelMessage() { 99 | return channelMessage; 100 | } 101 | public void setChannelMessage(Object channelMessage) { 102 | this.channelMessage = channelMessage; 103 | } 104 | public Object getUser() { 105 | return user; 106 | } 107 | public void setUser(Object user) { 108 | this.user = user; 109 | } 110 | public String getContextid() { 111 | return contextid; 112 | } 113 | public void setContextid(String contextid) { 114 | this.contextid = contextid; 115 | } 116 | public String getCalltype() { 117 | return calltype; 118 | } 119 | public void setCalltype(String calltype) { 120 | this.calltype = calltype; 121 | } 122 | public String getCreatetime() { 123 | return createtime; 124 | } 125 | public void setCreatetime(String createtime) { 126 | this.createtime = createtime; 127 | } 128 | public String getFilename() { 129 | return filename; 130 | } 131 | public void setFilename(String filename) { 132 | this.filename = filename; 133 | } 134 | public int getFilesize() { 135 | return filesize; 136 | } 137 | public void setFilesize(int filesize) { 138 | this.filesize = filesize; 139 | } 140 | public String getAgentserviceid() { 141 | return agentserviceid; 142 | } 143 | public void setAgentserviceid(String agentserviceid) { 144 | this.agentserviceid = agentserviceid; 145 | } 146 | public String getAttachmentid() { 147 | return attachmentid; 148 | } 149 | public void setAttachmentid(String attachmentid) { 150 | this.attachmentid = attachmentid; 151 | } 152 | public boolean isNoagent() { 153 | return noagent; 154 | } 155 | public void setNoagent(boolean noagent) { 156 | this.noagent = noagent; 157 | } 158 | public boolean isTopic() { 159 | return topic; 160 | } 161 | public void setTopic(boolean topic) { 162 | this.topic = topic; 163 | } 164 | public boolean isQuickagent() { 165 | return quickagent; 166 | } 167 | public void setQuickagent(boolean quickagent) { 168 | this.quickagent = quickagent; 169 | } 170 | public int getDuration() { 171 | return duration; 172 | } 173 | public void setDuration(int duration) { 174 | this.duration = duration; 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/MessageLeave.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.Id; 10 | import javax.persistence.Table; 11 | 12 | import org.hibernate.annotations.GenericGenerator; 13 | import org.hibernate.annotations.Proxy; 14 | 15 | @Entity 16 | @Table(name = "xk_message_leave") 17 | @Proxy(lazy = false) 18 | public class MessageLeave implements Serializable{ 19 | /** 20 | * 21 | */ 22 | private static final long serialVersionUID = MessageLeave.class.hashCode(); 23 | private String appid; 24 | private String id; 25 | private String msgDetail; 26 | private String msgEmail; 27 | private String userid; 28 | private Date createDate; 29 | 30 | @Id 31 | @Column(length = 32) 32 | @GeneratedValue(generator = "system-uuid") 33 | @GenericGenerator(name = "system-uuid", strategy = "uuid") 34 | public String getId() { 35 | return id; 36 | } 37 | 38 | public String getAppid() { 39 | return appid; 40 | } 41 | 42 | public void setAppid(String appid) { 43 | this.appid = appid; 44 | } 45 | 46 | public void setId(String id) { 47 | this.id = id; 48 | } 49 | 50 | public String getMsgDetail() { 51 | return msgDetail; 52 | } 53 | 54 | public void setMsgDetail(String msgDetail) { 55 | this.msgDetail = msgDetail; 56 | } 57 | 58 | public String getMsgEmail() { 59 | return msgEmail; 60 | } 61 | 62 | public void setMsgEmail(String msgEmail) { 63 | this.msgEmail = msgEmail; 64 | } 65 | 66 | public String getUserid() { 67 | return userid; 68 | } 69 | 70 | public void setUserid(String userid) { 71 | this.userid = userid; 72 | } 73 | 74 | public Date getCreateDate() { 75 | return createDate; 76 | } 77 | 78 | public void setCreateDate(Date createDate) { 79 | this.createDate = createDate; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/MessageOutContent.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.core.server.message.OtherMessageItem; 6 | 7 | public class MessageOutContent extends MessageInContent{ 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = 1L; 12 | private List suggest = null ; 13 | 14 | public List getSuggest() { 15 | return suggest; 16 | } 17 | 18 | public void setSuggest(List suggest) { 19 | this.suggest = suggest; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/QuickReply.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | 11 | import org.hibernate.annotations.GenericGenerator; 12 | 13 | import com.sxx.jcc.common.utils.XKTools; 14 | 15 | @Entity 16 | @Table(name = "uk_quickreply") 17 | public class QuickReply { 18 | 19 | private String id = XKTools.getUUID(); 20 | 21 | private String title ; //标题 22 | private String content ; //内容 23 | 24 | private String type ; //公用 /私有 25 | private String creater; //创建人 26 | private Date createtime = new Date(); //创建时间 27 | 28 | private String orgi ; // 29 | 30 | private String cate ; //所属分类 31 | 32 | 33 | @Id 34 | @Column(length = 32) 35 | @GeneratedValue(generator = "system-uuid") 36 | @GenericGenerator(name = "system-uuid", strategy = "assigned") 37 | public String getId() { 38 | return id; 39 | } 40 | 41 | public void setId(String id) { 42 | this.id = id; 43 | } 44 | 45 | public String getTitle() { 46 | return title; 47 | } 48 | 49 | public void setTitle(String title) { 50 | this.title = title; 51 | } 52 | 53 | public String getContent() { 54 | return content; 55 | } 56 | 57 | public void setContent(String content) { 58 | this.content = content; 59 | } 60 | 61 | public String getType() { 62 | return type; 63 | } 64 | 65 | public void setType(String type) { 66 | this.type = type; 67 | } 68 | 69 | public String getCreater() { 70 | return creater; 71 | } 72 | 73 | public void setCreater(String creater) { 74 | this.creater = creater; 75 | } 76 | 77 | public Date getCreatetime() { 78 | return createtime; 79 | } 80 | 81 | public void setCreatetime(Date createtime) { 82 | this.createtime = createtime; 83 | } 84 | 85 | public String getCate() { 86 | return cate; 87 | } 88 | 89 | public void setCate(String cate) { 90 | this.cate = cate; 91 | } 92 | 93 | public String getOrgi() { 94 | return orgi; 95 | } 96 | 97 | public void setOrgi(String orgi) { 98 | this.orgi = orgi; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/QuickType.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | 11 | import org.hibernate.annotations.GenericGenerator; 12 | 13 | @Entity 14 | @Table(name = "uk_quick_type") 15 | public class QuickType implements java.io.Serializable{ 16 | 17 | /** 18 | * 19 | */ 20 | private static final long serialVersionUID = 1115593425069549681L; 21 | 22 | private String id ; 23 | private String name ; 24 | private String code ; 25 | 26 | private int inx; //知识分类排序位置 27 | 28 | private String quicktype ; //个人/公共 29 | private Date createtime ; 30 | private String creater; 31 | private String username ; 32 | 33 | private Date startdate; //有效期开始 34 | private Date enddate ; //有效期结束 35 | 36 | private boolean enable ; //状态是否可用 37 | 38 | private String description ;//分类备注描述信息 39 | 40 | private Date updatetime ; 41 | private String parentid ; //父级ID 42 | private String orgi ; 43 | 44 | @Id 45 | @Column(length = 32) 46 | @GeneratedValue(generator = "system-uuid") 47 | @GenericGenerator(name = "system-uuid", strategy = "uuid") 48 | public String getId() { 49 | return id; 50 | } 51 | public void setId(String id) { 52 | this.id = id; 53 | } 54 | public String getName() { 55 | return name; 56 | } 57 | public void setName(String name) { 58 | this.name = name; 59 | } 60 | public String getCode() { 61 | return code; 62 | } 63 | public void setCode(String code) { 64 | this.code = code; 65 | } 66 | public int getInx() { 67 | return inx; 68 | } 69 | public void setInx(int inx) { 70 | this.inx = inx; 71 | } 72 | public String getQuicktype() { 73 | return quicktype; 74 | } 75 | public void setQuicktype(String quicktype) { 76 | this.quicktype = quicktype; 77 | } 78 | public Date getCreatetime() { 79 | return createtime; 80 | } 81 | public void setCreatetime(Date createtime) { 82 | this.createtime = createtime; 83 | } 84 | public String getCreater() { 85 | return creater; 86 | } 87 | public void setCreater(String creater) { 88 | this.creater = creater; 89 | } 90 | public String getUsername() { 91 | return username; 92 | } 93 | public void setUsername(String username) { 94 | this.username = username; 95 | } 96 | public Date getStartdate() { 97 | return startdate; 98 | } 99 | public void setStartdate(Date startdate) { 100 | this.startdate = startdate; 101 | } 102 | public Date getEnddate() { 103 | return enddate; 104 | } 105 | public void setEnddate(Date enddate) { 106 | this.enddate = enddate; 107 | } 108 | public boolean isEnable() { 109 | return enable; 110 | } 111 | public void setEnable(boolean enable) { 112 | this.enable = enable; 113 | } 114 | public String getDescription() { 115 | return description; 116 | } 117 | public void setDescription(String description) { 118 | this.description = description; 119 | } 120 | public Date getUpdatetime() { 121 | return updatetime; 122 | } 123 | public void setUpdatetime(Date updatetime) { 124 | this.updatetime = updatetime; 125 | } 126 | public String getParentid() { 127 | return parentid; 128 | } 129 | public void setParentid(String parentid) { 130 | this.parentid = parentid; 131 | } 132 | public String getOrgi() { 133 | return orgi; 134 | } 135 | public void setOrgi(String orgi) { 136 | this.orgi = orgi; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/SocketIOMessage.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | public class SocketIOMessage { 4 | private String message; 5 | 6 | public String getMessage() { 7 | return message; 8 | } 9 | 10 | public void setMessage(String message) { 11 | this.message = message; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/UserTraceHistory.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | 11 | import org.hibernate.annotations.GenericGenerator; 12 | import org.hibernate.annotations.Proxy; 13 | 14 | import com.sxx.jcc.common.utils.event.UserEvent; 15 | 16 | 17 | @Entity 18 | @Table(name="xk_userevent") 19 | public class UserTraceHistory implements UserEvent { 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = -9167939944520945485L; 24 | private String id; 25 | private String orgi; 26 | private String username ; 27 | private String title ; 28 | private Date updatetime = new Date(); 29 | private String url ; 30 | 31 | @Id 32 | @Column(length=32) 33 | @GeneratedValue(generator="system-uuid") 34 | @GenericGenerator(name="system-uuid", strategy="assigned") 35 | public String getId() { 36 | return id; 37 | } 38 | public void setId(String id) { 39 | this.id = id; 40 | } 41 | public String getOrgi() { 42 | return orgi; 43 | } 44 | public void setOrgi(String orgi) { 45 | this.orgi = orgi; 46 | } 47 | public String getTitle() { 48 | return title; 49 | } 50 | public void setTitle(String title) { 51 | this.title = title; 52 | } 53 | public Date getUpdatetime() { 54 | return updatetime; 55 | } 56 | public void setUpdatetime(Date updatetime) { 57 | this.updatetime = updatetime; 58 | } 59 | public String getUrl() { 60 | return url; 61 | } 62 | public void setUrl(String url) { 63 | this.url = url; 64 | } 65 | public String getUsername() { 66 | return username; 67 | } 68 | public void setUsername(String username) { 69 | this.username = username; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/pojo/WorkserviceTime.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.pojo; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | 11 | import org.hibernate.annotations.GenericGenerator; 12 | 13 | @Entity 14 | @Table(name = "xk_workservice_time") 15 | public class WorkserviceTime implements java.io.Serializable{ 16 | 17 | /** 18 | * 19 | */ 20 | private static final long serialVersionUID = 1115593425069549681L; 21 | 22 | private String id ; 23 | private String timetype ;//日期类型(字典项 com.dic.workservice.time) 24 | private String scope ; //日期范围类型(单天 one/范围 more/ 星期 week) 25 | private String begin ; //日期开始 格式 2018-9-3 26 | private String end ; //日期结束 格式 2018-9-3 27 | private Date createtime ; 28 | private String creater; 29 | private Date updatetime ; 30 | private String orgi ; 31 | private String apply;//适用场景(文字客服 webim / 排班 sche) 32 | private String week; 33 | 34 | public WorkserviceTime(){} 35 | 36 | public WorkserviceTime(String id){ 37 | this.id = id ; 38 | } 39 | @Id 40 | @Column(length = 32) 41 | @GeneratedValue(generator = "system-uuid") 42 | @GenericGenerator(name = "system-uuid", strategy = "uuid") 43 | public String getId() { 44 | return id; 45 | } 46 | public void setId(String id) { 47 | this.id = id; 48 | } 49 | 50 | public String getTimetype() { 51 | return timetype; 52 | } 53 | 54 | public void setTimetype(String timetype) { 55 | this.timetype = timetype; 56 | } 57 | 58 | public String getScope() { 59 | return scope; 60 | } 61 | 62 | public void setScope(String scope) { 63 | this.scope = scope; 64 | } 65 | 66 | public String getBegin() { 67 | return begin; 68 | } 69 | 70 | public void setBegin(String begin) { 71 | this.begin = begin; 72 | } 73 | 74 | public String getEnd() { 75 | return end; 76 | } 77 | 78 | public void setEnd(String end) { 79 | this.end = end; 80 | } 81 | 82 | public Date getCreatetime() { 83 | return createtime; 84 | } 85 | 86 | public void setCreatetime(Date createtime) { 87 | this.createtime = createtime; 88 | } 89 | 90 | public String getCreater() { 91 | return creater; 92 | } 93 | 94 | public void setCreater(String creater) { 95 | this.creater = creater; 96 | } 97 | 98 | public Date getUpdatetime() { 99 | return updatetime; 100 | } 101 | 102 | public void setUpdatetime(Date updatetime) { 103 | this.updatetime = updatetime; 104 | } 105 | 106 | public String getOrgi() { 107 | return orgi; 108 | } 109 | 110 | public void setOrgi(String orgi) { 111 | this.orgi = orgi; 112 | } 113 | 114 | public String getApply() { 115 | return apply; 116 | } 117 | 118 | public void setApply(String apply) { 119 | this.apply = apply; 120 | } 121 | 122 | public String getWeek() { 123 | return week; 124 | } 125 | 126 | public void setWeek(String week) { 127 | this.week = week; 128 | } 129 | 130 | 131 | 132 | } 133 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/queue/AgentStatusBusyOrgiFilterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.queue; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import com.hazelcast.query.Predicate; 8 | import com.sxx.jcc.webim.pojo.AgentStatus; 9 | 10 | public class AgentStatusBusyOrgiFilterPredicate implements Predicate { 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 1236581634096258855L; 15 | private String orgi ; 16 | /** 17 | * 18 | */ 19 | public AgentStatusBusyOrgiFilterPredicate(String orgi){ 20 | this.orgi = orgi ; 21 | } 22 | public boolean apply(Map.Entry mapEntry) { 23 | return mapEntry.getValue()!=null && !StringUtils.isBlank(orgi) && orgi.equals(mapEntry.getValue().getOrgi()) && mapEntry.getValue().isBusy(); 24 | } 25 | } -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/queue/AgentStatusOrgiFilterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.queue; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import com.hazelcast.query.Predicate; 8 | import com.sxx.jcc.webim.pojo.AgentStatus; 9 | 10 | public class AgentStatusOrgiFilterPredicate implements Predicate { 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 1236581634096258855L; 15 | private String orgi ; 16 | /** 17 | * 18 | */ 19 | public AgentStatusOrgiFilterPredicate(String orgi){ 20 | this.orgi = orgi ; 21 | } 22 | 23 | public boolean apply(Map.Entry mapEntry) { 24 | return mapEntry.getValue()!=null && !StringUtils.isBlank(orgi) && orgi.equals(mapEntry.getValue().getOrgi()); 25 | } 26 | } -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/queue/AgentUserOrgiFilterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.queue; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import com.hazelcast.query.Predicate; 8 | import com.sxx.jcc.system.pojo.AgentUser; 9 | /** 10 | * @author liuyonghong 11 | * 12 | */ 13 | public class AgentUserOrgiFilterPredicate implements Predicate { 14 | 15 | private static final long serialVersionUID = 1236581634096258855L; 16 | private String orgi; 17 | private String status; 18 | 19 | public AgentUserOrgiFilterPredicate() { 20 | } 21 | 22 | public AgentUserOrgiFilterPredicate(String orgi, String status) { 23 | this.orgi = orgi; 24 | this.status = status; 25 | } 26 | 27 | @Override 28 | public boolean apply(Map.Entry mapEntry) { 29 | return mapEntry.getValue()!=null && mapEntry.getValue().getStatus()!=null && !StringUtils.isBlank(orgi) && orgi.equals(mapEntry.getValue().getOrgi()) && mapEntry.getValue().getStatus()!=null && mapEntry.getValue().getStatus().equals(status); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/rpc/AgentTopicListener.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.rpc; 2 | 3 | import com.hazelcast.core.Message; 4 | import com.hazelcast.core.MessageListener; 5 | public class AgentTopicListener implements MessageListener{ 6 | @Override 7 | public void onMessage(Message message) { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/rpc/ClusterMember.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.rpc; 2 | 3 | import com.hazelcast.core.HazelcastInstance; 4 | import com.hazelcast.core.MemberAttributeEvent; 5 | import com.hazelcast.core.MembershipEvent; 6 | import com.hazelcast.core.MembershipListener; 7 | import com.sxx.jcc.common.utils.XKTools; 8 | 9 | public class ClusterMember implements MembershipListener{ 10 | 11 | private HazelcastInstance hazelcastInstance ; 12 | 13 | public ClusterMember(HazelcastInstance hazelcastInstance) { 14 | this.hazelcastInstance = hazelcastInstance ; 15 | } 16 | @Override 17 | public void memberAdded(MembershipEvent membershipEvent) { 18 | XKTools.voteMaster(hazelcastInstance); 19 | } 20 | 21 | @Override 22 | public void memberRemoved(MembershipEvent membershipEvent) { 23 | XKTools.voteMaster(hazelcastInstance); 24 | } 25 | 26 | @Override 27 | public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/rpc/IMTopicListener.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.rpc; 2 | 3 | import com.hazelcast.core.Message; 4 | import com.hazelcast.core.MessageListener; 5 | 6 | public class IMTopicListener implements MessageListener{ 7 | @Override 8 | public void onMessage(Message message) { 9 | RPCDataBean rpcDataBean = (RPCDataBean) message.getMessageObject() ; 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/rpc/RPCDataBean.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.rpc; 2 | 3 | import java.io.Serializable; 4 | 5 | public class RPCDataBean implements Serializable{ 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 1L; 11 | 12 | private String id ; 13 | 14 | private String event ; 15 | 16 | private Object data ; 17 | 18 | private long start ; 19 | 20 | private String host ; 21 | 22 | private int port ; 23 | 24 | public RPCDataBean(String id , String event , Object data) { 25 | this.id = id ; 26 | this.event = event ; 27 | this.data = data ; 28 | } 29 | 30 | public RPCDataBean(String id , String host , int port , long start) { 31 | this.host = host; 32 | this.port = port; 33 | this.start = start ; 34 | this.id = id ; 35 | } 36 | 37 | public String getId() { 38 | return id; 39 | } 40 | 41 | public void setId(String id) { 42 | this.id = id; 43 | } 44 | 45 | public String getEvent() { 46 | return event; 47 | } 48 | 49 | public void setEvent(String event) { 50 | this.event = event; 51 | } 52 | 53 | public Object getData() { 54 | return data; 55 | } 56 | 57 | public void setData(Object data) { 58 | this.data = data; 59 | } 60 | 61 | public long getStart() { 62 | return start; 63 | } 64 | 65 | public void setStart(long start) { 66 | this.start = start; 67 | } 68 | 69 | public String getHost() { 70 | return host; 71 | } 72 | 73 | public void setHost(String host) { 74 | this.host = host; 75 | } 76 | 77 | public int getPort() { 78 | return port; 79 | } 80 | 81 | public void setPort(int port) { 82 | this.port = port; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/rpc/RPCTools.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.rpc; 2 | 3 | import com.hazelcast.core.HazelcastInstance; 4 | import com.sxx.jcc.common.utils.XKDataContext; 5 | 6 | /** 7 | * 本来下面的四个方法可以合并成一个,通过传入订阅的主题名称来区分,但是,不同的主题的消息数量和负载不一样, 8 | * IM的负载和EntIM的负载明显会高于另外两类主题,所以,分开处理的目的是为了将来能够更方便的扩展, 按照负载要求不一样,提供多种订阅模式 9 | * 和实现方式 10 | * @author iceworld 11 | * 12 | */ 13 | public class RPCTools { 14 | /** 15 | * 16 | * @param id 17 | * @param event 18 | * @param data 19 | */ 20 | public static void sendIMEventMessage(String id , String event , Object data){ 21 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.TOPIC_IM.toString()).publish(new RPCDataBean(id, event, data)); 22 | } 23 | /** 24 | * 25 | * @param id 26 | * @param event 27 | * @param data 28 | */ 29 | public static void sendEntIMEventMessage(String id , String event , Object data){ 30 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.TOPIC_ENTIM.toString()).publish(new RPCDataBean(id, event, data)); 31 | } 32 | /** 33 | * 34 | * @param id 35 | * @param event 36 | * @param data 37 | */ 38 | public static void sendAgentEventMessage(String id , String event , Object data){ 39 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.TOPIC_AGENT.toString()).publish(new RPCDataBean(id, event, data)); 40 | } 41 | /** 42 | * 43 | * @param id 44 | * @param event 45 | * @param data 46 | */ 47 | public static void sendCallCenterMessage(String id , String event , Object data){ 48 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.TOPIC_CALLCENTER.toString()).publish(new RPCDataBean(id, event, data)); 49 | } 50 | 51 | 52 | /** 53 | * 54 | * @param id 55 | * @param event 56 | * @param data 57 | */ 58 | public static void sendJobDetailMessage(String id , String event , Object data){ 59 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.TOPIC_JOBDETAIL.toString()).publish(new RPCDataBean(id, event, data)); 60 | } 61 | 62 | /** 63 | * 64 | * @param id 65 | * @param event 66 | * @param data 67 | */ 68 | public static void published(String name , String event , Object data){ 69 | XKDataContext.getContext().getBean(HazelcastInstance.class).getTopic(XKDataContext.UCKeFuTopic.NAMESPACE.toString()).publish(new RPCDataBean(name, event, data)); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IAgentReportService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import com.sxx.jcc.common.service.IBaseService; 4 | 5 | public interface IAgentReportService extends IBaseService{ 6 | 7 | } 8 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IAgentStatusService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.AgentStatus; 7 | 8 | public interface IAgentStatusService extends IBaseService{ 9 | public List findByAgentnoAndOrgi(String wcode); 10 | public int countByAgentnoAndStatusAndOrgi(Long staffId, String agentUserStatus); 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IAgentUserTaskService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.AgentUserTask; 7 | 8 | public interface IAgentUserTaskService extends IBaseService{ 9 | public List findAgentUserId(String agentUserid); 10 | public AgentUserTask getAgentUserTask(String agentUserid); 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IChatMessageService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.ChatMessage; 7 | 8 | public interface IChatMessageService extends IBaseService{ 9 | List findChatMessageList(String userid,String rownum); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IQuickReplyService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.QuickReply; 7 | 8 | public interface IQuickReplyService extends IBaseService{ 9 | public List findByOrgiAndCreater(Long userId); 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IQuickTypeService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.QuickType; 7 | 8 | public interface IQuickTypeService extends IBaseService{ 9 | public List findByOrgiAndQuicktype(String quickType); 10 | public List findByOrgiAndQuicktypeAndCreater(String quickType,Long staffId); 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/ISummaryService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import com.sxx.jcc.common.service.IBaseService; 4 | 5 | public interface ISummaryService extends IBaseService{ 6 | 7 | } 8 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/ISysAgentUserService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.core.dao.hibernate.Page; 7 | import com.sxx.jcc.system.pojo.AgentUser; 8 | 9 | public interface ISysAgentUserService extends IBaseService{ 10 | public AgentUser findAgentUserById(String id); 11 | public AgentUser findAgentUserByuserId(String userid); 12 | public List findByAgentnoAndStatusAndOrgi(String wcode,String agentUserStatus); 13 | public Page findAgentUsersPage(String startdate,String enddate,Page page) ; 14 | } 15 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/IWorkMonitorService.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service; 2 | 3 | import java.util.List; 4 | 5 | import com.sxx.jcc.common.service.IBaseService; 6 | import com.sxx.jcc.webim.pojo.WorkMonitor; 7 | 8 | public interface IWorkMonitorService extends IBaseService{ 9 | public int countByAgentAndDatestrAndStatusAndOrgi(String wcode, String date, String agentStatusEnum, String orgi); 10 | List findByOrgiAndAgentAndDatestrAndFirsttime(String orgi , String wcode , String date); 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/AgentReportServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import com.sxx.jcc.common.service.BaseService; 6 | import com.sxx.jcc.webim.service.IAgentReportService; 7 | 8 | @Service 9 | public class AgentReportServiceImpl extends BaseService implements IAgentReportService{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/AgentStatusServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.sxx.jcc.common.service.BaseService; 10 | import com.sxx.jcc.webim.pojo.AgentStatus; 11 | import com.sxx.jcc.webim.service.IAgentStatusService; 12 | @Service 13 | public class AgentStatusServiceImpl extends BaseService implements IAgentStatusService{ 14 | 15 | @Override 16 | public List findByAgentnoAndOrgi(String wcode) { 17 | if (StringUtils.isBlank(wcode)) { 18 | return null; 19 | } else { 20 | String sql = "select * from xk_agentstatus where agentno = ? "; 21 | List paramList = new ArrayList(); 22 | paramList.add(wcode); 23 | return this.queryForObjectList(sql, AgentStatus.class,paramList.toArray()); 24 | } 25 | } 26 | 27 | @Override 28 | public int countByAgentnoAndStatusAndOrgi(Long staffId, String agentUserStatus) { 29 | // TODO Auto-generated method stub 30 | return 0; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/AgentUserTaskServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.sxx.jcc.common.service.BaseService; 9 | import com.sxx.jcc.webim.pojo.AgentUserTask; 10 | import com.sxx.jcc.webim.service.IAgentUserTaskService; 11 | 12 | @Service 13 | public class AgentUserTaskServiceImpl extends BaseService implements IAgentUserTaskService{ 14 | 15 | @Override 16 | public List findAgentUserId(String agentUserid) { 17 | // TODO Auto-generated method stub 18 | return null; 19 | } 20 | 21 | @Override 22 | public AgentUserTask getAgentUserTask(String agentUserid) { 23 | try{ 24 | String sql =" select * from xk_agentuser where id =?"; 25 | List paramList = new ArrayList(); 26 | paramList.add(agentUserid); 27 | return this.queryForObject(sql, AgentUserTask.class, paramList.toArray()); 28 | }catch(Exception e){ 29 | return null; 30 | } 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/ChatMessageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.sxx.jcc.common.service.BaseService; 10 | import com.sxx.jcc.webim.pojo.ChatMessage; 11 | import com.sxx.jcc.webim.service.IChatMessageService; 12 | 13 | @Service 14 | public class ChatMessageServiceImpl extends BaseService implements IChatMessageService{ 15 | 16 | @Override 17 | public List findChatMessageList(String userid,String rownum) { 18 | List paramList = new ArrayList(); 19 | String sql = "select * from (select * from xk_chat_message where userid=? or touser=? order by updatetime desc ) where 1=1 "; 20 | paramList.add(userid); 21 | paramList.add(userid); 22 | if(StringUtils.isNotBlank(rownum) && !"-1".equals(rownum)){ 23 | sql+= " and rownum<=?"; 24 | paramList.add(rownum); 25 | }else{ 26 | sql+= " and updatetime>=updatetime-5"; 27 | } 28 | sql+=" order by updatetime"; 29 | return this.queryForObjectList(sql, ChatMessage.class, paramList.toArray()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/QuickReplyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | import com.sxx.jcc.common.service.BaseService; 8 | import com.sxx.jcc.webim.pojo.QuickReply; 9 | import com.sxx.jcc.webim.service.IQuickReplyService; 10 | @Service 11 | public class QuickReplyServiceImpl extends BaseService implements IQuickReplyService{ 12 | 13 | @Override 14 | public List findByOrgiAndCreater(Long userId) { 15 | // TODO Auto-generated method stub 16 | return null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/QuickTypeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | import com.sxx.jcc.common.service.BaseService; 8 | import com.sxx.jcc.webim.pojo.QuickType; 9 | import com.sxx.jcc.webim.service.IQuickTypeService; 10 | @Service 11 | public class QuickTypeServiceImpl extends BaseService implements IQuickTypeService{ 12 | 13 | @Override 14 | public List findByOrgiAndQuicktype(String quickType) { 15 | // TODO Auto-generated method stub 16 | return null; 17 | } 18 | 19 | @Override 20 | public List findByOrgiAndQuicktypeAndCreater(String quickType, Long staffId) { 21 | // TODO Auto-generated method stub 22 | return null; 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/SummaryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import com.sxx.jcc.common.service.BaseService; 6 | import com.sxx.jcc.webim.service.ISummaryService; 7 | @Service 8 | public class SummaryServiceImpl extends BaseService implements ISummaryService{ 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/SysAgentUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.collections.CollectionUtils; 7 | import org.apache.commons.lang3.StringUtils; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.sxx.jcc.common.service.BaseService; 11 | import com.sxx.jcc.core.dao.hibernate.Page; 12 | import com.sxx.jcc.system.pojo.AgentUser; 13 | import com.sxx.jcc.system.pojo.CallDetail; 14 | import com.sxx.jcc.webim.service.ISysAgentUserService; 15 | 16 | @Service 17 | public class SysAgentUserServiceImpl extends BaseService implements ISysAgentUserService{ 18 | 19 | @Override 20 | public AgentUser findAgentUserById(String id) { 21 | List paramList = new ArrayList(); 22 | String sql="select * from xk_agentuser where id=?"; 23 | paramList.add(id); 24 | return this.queryForObject(sql, AgentUser.class, paramList.toArray()); 25 | } 26 | 27 | @Override 28 | public List findByAgentnoAndStatusAndOrgi(String wcode, String agentUserStatus) { 29 | List paramList = new ArrayList(); 30 | String sql =" select ag.id,au.username,au.agentno,au.userid,au.createtime,ag.status"; 31 | sql += " from (select distinct username,agentno,userid,(select max(createtime) from xk_agentuser a where a.userid=xa.userid and agentno=? and status!='end') createtime from xk_agentuser xa ) au,xk_agentuser ag "; 32 | sql+= " where ag.agentno=? and au.agentno=ag.agentno and au.createtime=ag.createtime and au.userid= ag.userid"; 33 | paramList.add(wcode); 34 | paramList.add(wcode); 35 | if(StringUtils.isNotBlank(agentUserStatus)){ 36 | sql+=" and ag.status=?"; 37 | paramList.add(agentUserStatus); 38 | } 39 | sql+= " order by createtime desc"; 40 | return this.queryForObjectList(sql, AgentUser.class, paramList.toArray()); 41 | } 42 | 43 | @Override 44 | public Page findAgentUsersPage(String startdate,String enddate,Page page) { 45 | List paramList = new ArrayList(); 46 | String sql = "select a.*,s.name agentname,to_char(a.logindate,'yyyy/MM/dd hh24:mi:ss') start_time,to_char(a.lastmessage,'yyyy/MM/dd hh24:mi:ss') end_time from xk_agentuser a,sys_staff s where a.agentno = s.wcode(+) "; 47 | //来电时间起 48 | if(StringUtils.isNotBlank(startdate)){ 49 | sql += " and a.LOGINDATE >= to_date('"+startdate+"','yyyy-MM-dd hh24:mi:ss')"; 50 | } 51 | //来电时间止 52 | if(StringUtils.isNotBlank(enddate)){ 53 | sql += " and a.LOGINDATE <= to_date('"+enddate+"','yyyy-MM-dd hh24:mi:ss')"; 54 | } 55 | sql += " order by a.logindate desc"; 56 | return this.queryForMapPage(sql, page, paramList.toArray()); 57 | } 58 | 59 | @Override 60 | public AgentUser findAgentUserByuserId(String userid) { 61 | List paramList = new ArrayList(); 62 | String sql="select * from xk_agentuser where userid=? order by createtime desc"; 63 | paramList.add(userid); 64 | List agentuserlist = this.queryForObjectList(sql, AgentUser.class, paramList.toArray()); 65 | AgentUser agentUser = null; 66 | if(CollectionUtils.isNotEmpty(agentuserlist) && agentuserlist.size()>0){ 67 | agentUser = agentuserlist.get(0); 68 | } 69 | return agentUser; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/service/impl/WorkMonitorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | import com.sxx.jcc.common.service.BaseService; 8 | import com.sxx.jcc.webim.pojo.WorkMonitor; 9 | import com.sxx.jcc.webim.service.IWorkMonitorService; 10 | @Service 11 | public class WorkMonitorServiceImpl extends BaseService implements IWorkMonitorService{ 12 | 13 | @Override 14 | public int countByAgentAndDatestrAndStatusAndOrgi(String wcode, String date, String agentStatusEnum, String orgi) { 15 | // TODO Auto-generated method stub 16 | return 0; 17 | } 18 | 19 | @Override 20 | public List findByOrgiAndAgentAndDatestrAndFirsttime(String orgi, String wcode, String date) { 21 | // TODO Auto-generated method stub 22 | return null; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/IP.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | public class IP implements java.io.Serializable{ 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -421278423658892060L; 9 | private String country ; 10 | private String province ; 11 | private String city ; 12 | private String isp ; 13 | private String region ; 14 | public String getCountry() { 15 | return country; 16 | } 17 | public void setCountry(String country) { 18 | this.country = country; 19 | } 20 | public String getProvince() { 21 | return province; 22 | } 23 | public void setProvince(String province) { 24 | this.province = province; 25 | } 26 | public String getCity() { 27 | return city; 28 | } 29 | public void setCity(String city) { 30 | this.city = city; 31 | } 32 | public String getIsp() { 33 | return isp; 34 | } 35 | public void setIsp(String isp) { 36 | this.isp = isp; 37 | } 38 | public String getRegion() { 39 | return region; 40 | } 41 | public void setRegion(String region) { 42 | this.region = region; 43 | } 44 | 45 | public String toString(){ 46 | return "0".equals(this.province) || "0".equals(this.city) ? this.country : this.province!=null || this.city!=null ? (this.province!=null ? this.province : "" + this.city!=null ? this.city : "") : this.getRegion()!=null ? this.getRegion() : "未知" ; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/NettyAgentClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | /** 4 | * 坐席端 5 | * @author iceworld 6 | * 7 | */ 8 | public class NettyAgentClient extends NettyClient{ 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/NettyCallCenterClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | /** 4 | * 呼叫中心登录坐席 5 | * @author iceworld 6 | * 7 | */ 8 | public class NettyCallCenterClient extends NettyClient{ 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/NettyClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | import java.util.List; 4 | 5 | import com.corundumstudio.socketio.SocketIOClient; 6 | import com.google.common.collect.ArrayListMultimap; 7 | import com.sxx.jcc.common.utils.XKTools; 8 | 9 | public abstract class NettyClient { 10 | 11 | protected ArrayListMultimap clientsMap = ArrayListMultimap.create(); 12 | 13 | public int size() { 14 | return clientsMap.size() ; 15 | } 16 | 17 | public List getClients(String key){ 18 | return clientsMap.get(key) ; 19 | } 20 | 21 | public void putClient(String key , SocketIOClient client) { 22 | clientsMap.put(key, client) ; 23 | } 24 | 25 | public void removeClient(String key , String id) { 26 | List keyClients = this.getClients(key) ; 27 | for(SocketIOClient client : keyClients){ 28 | if(XKTools.getContextID(client.getSessionId().toString()).equals(id)){ 29 | keyClients.remove(client) ; 30 | break ; 31 | } 32 | } 33 | if(keyClients.size() == 0){ 34 | clientsMap.removeAll(key) ; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/NettyClients.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | import java.util.List; 4 | 5 | import com.corundumstudio.socketio.SocketIOClient; 6 | import com.corundumstudio.socketio.SocketIONamespace; 7 | import com.sxx.jcc.common.utils.XKDataContext; 8 | import com.sxx.jcc.common.utils.XKTools; 9 | import com.sxx.jcc.core.server.ServerRunner; 10 | 11 | 12 | 13 | public class NettyClients { 14 | 15 | private static NettyClients clients = new NettyClients(); 16 | 17 | private NettyIMClient imClients = new NettyIMClient(); 18 | private NettyAgentClient agentClients = new NettyAgentClient(); 19 | private NettyIMClient entIMClients = new NettyIMClient(); 20 | private NettyCallCenterClient callCenterClients = new NettyCallCenterClient(); 21 | 22 | public int size(){ 23 | return imClients.size(); 24 | } 25 | 26 | public static NettyClients getInstance(){ 27 | return clients ; 28 | } 29 | 30 | /** 31 | * 放入开始 32 | * @param id 33 | * @param userClient 34 | */ 35 | public void putIMEventClient(String id , SocketIOClient userClient){ 36 | imClients.putClient(id, userClient); 37 | } 38 | public void putAgentEventClient(String id , SocketIOClient agentClient){ 39 | agentClients.putClient(id, agentClient); 40 | } 41 | public void putEntIMEventClient(String id , SocketIOClient userClient){ 42 | entIMClients.putClient(id, userClient); 43 | } 44 | public void putCallCenterEventClient(String id , SocketIOClient userClient){ 45 | callCenterClients.putClient(id, userClient); 46 | } 47 | /** 48 | * 放入结束 49 | * @return 50 | */ 51 | 52 | 53 | public NettyCallCenterClient getCallCenterClients(){ 54 | return this.callCenterClients ; 55 | } 56 | 57 | public NettyIMClient getIMClients(){ 58 | return this.imClients ; 59 | } 60 | 61 | public NettyIMClient getEntIMClients(){ 62 | return this.entIMClients; 63 | } 64 | public NettyAgentClient getAgentClients(){ 65 | return this.agentClients; 66 | } 67 | 68 | 69 | public void setImClients(NettyIMClient imClients) { 70 | this.imClients = imClients; 71 | } 72 | 73 | public void closeIMEventClient(String id , String sessionid, String orgi){ 74 | List userClients = imClients.getClients(id) ; 75 | for(SocketIOClient userClient : userClients){ 76 | if(XKTools.getContextID(userClient.getSessionId().toString()).equals(sessionid)){ 77 | userClient.disconnect(); 78 | } 79 | } 80 | } 81 | 82 | public void removeAgentEventClient(String id , String sessionid){ 83 | agentClients.removeClient(id, sessionid); 84 | } 85 | public void removeEntIMEventClient(String id , String sessionid){ 86 | entIMClients.removeClient(id, sessionid); 87 | } 88 | public void removeIMEventClient(String id , String sessionid){ 89 | imClients.removeClient(id, sessionid); 90 | } 91 | public void removeCallCenterClient(String id , String sessionid){ 92 | callCenterClients.removeClient(id, sessionid); 93 | } 94 | 95 | /** 96 | * HA支持 97 | * @param id 98 | * @param event 99 | * @param data 100 | */ 101 | public void sendAgentEventMessage(String id , String event , Object data){ 102 | List agents = agentClients.getClients(id) ; 103 | if(agents.size() > 0) { 104 | for(SocketIOClient agentClient : agents){ 105 | agentClient.sendEvent(event, data); 106 | } 107 | } 108 | } 109 | 110 | /** 111 | * HA支持 112 | * @param id 113 | * @param event 114 | * @param data 115 | */ 116 | public void sendIMEventMessage(String id , String event , Object data){ 117 | List userClients = imClients.getClients(id) ; 118 | if(userClients.size() > 0) { 119 | for(SocketIOClient userClient : userClients){ 120 | userClient.sendEvent(event, data); 121 | } 122 | } 123 | } 124 | 125 | /** 126 | * HA支持 127 | * @param id 128 | * @param event 129 | * @param data 130 | */ 131 | public void published(String name , String event , Object data){ 132 | if("agentNamespace".equalsIgnoreCase(name)){ 133 | XKDataContext.getContext().getBean(ServerRunner.class).getAgentSocketIONameSpace().getBroadcastOperations().sendEvent(event, data); 134 | }else{ 135 | XKDataContext.getContext().getBean(ServerRunner.class).getIMSocketIONameSpace().getBroadcastOperations().sendEvent(event, data); 136 | } 137 | 138 | //XKDataContext.getContext().getBean(name , SocketIONamespace.class).getBroadcastOperations(). 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/NettyIMClient.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util; 2 | 3 | /** 4 | * 访客端 5 | * @author iceworld 6 | * 7 | */ 8 | public class NettyIMClient extends NettyClient{ 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/router/MessageRouter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util.router; 2 | 3 | import com.sxx.jcc.common.utils.XKDataContext; 4 | import com.sxx.jcc.common.utils.XKTools; 5 | import com.sxx.jcc.system.pojo.AgentService; 6 | import com.sxx.jcc.webim.pojo.MessageDataBean; 7 | import com.sxx.jcc.webim.pojo.MessageOutContent; 8 | import com.sxx.jcc.webim.service.ServiceQuene; 9 | import com.sxx.jcc.webim.util.NettyClients; 10 | 11 | public class MessageRouter extends Router{ 12 | 13 | @Override 14 | public MessageDataBean handler(MessageDataBean inMessage) { 15 | MessageOutContent outMessage = new MessageOutContent() ; 16 | try { 17 | outMessage.setOrgi(inMessage.getOrgi()); 18 | outMessage.setFromUser(inMessage.getToUser()); 19 | outMessage.setToUser(inMessage.getFromUser()); 20 | outMessage.setId(XKTools.genID()); 21 | outMessage.setMessageType(inMessage.getMessageType()); 22 | outMessage.setUser(inMessage.getUser()); 23 | outMessage.setAgentUser(inMessage.getAgentUser()); 24 | /** 25 | * 首先交由 IMR处理 MESSAGE指令 , 如果当前用户是在 坐席对话列表中, 则直接推送给坐席,如果不在,则执行 IMR 26 | */ 27 | if(outMessage.getAgentUser()!=null && outMessage.getAgentUser().getStatus()!=null){ 28 | System.out.println("--------------------------inqueue"); 29 | if(outMessage.getAgentUser().getStatus().equals(XKDataContext.AgentUserStatusEnum.INQUENE.toString())){ 30 | int queneIndex = ServiceQuene.getQueneIndex(inMessage.getAgentUser().getAgent() , inMessage.getOrgi(), inMessage.getAgentUser().getSkill()) ; 31 | if(XKDataContext.AgentUserStatusEnum.INQUENE.toString().equals(outMessage.getAgentUser().getStatus())){ 32 | outMessage.setMessage(ServiceQuene.getQueneMessage(queneIndex , outMessage.getAgentUser().getChannel(),inMessage.getOrgi())); 33 | } 34 | }else if(outMessage.getAgentUser().getStatus().equals(XKDataContext.AgentUserStatusEnum.INSERVICE.toString())){ 35 | 36 | } 37 | }else if(XKDataContext.MessageTypeEnum.NEW.toString().equals(inMessage.getMessageType())){ 38 | /** 39 | * 找到空闲坐席,如果未找到坐席, 则将该用户放入到 排队队列 40 | * 41 | */ 42 | System.out.println("--------------------------new"); 43 | AgentService agentService = ServiceQuene.allotAgent(inMessage.getAgentUser(), inMessage.getOrgi()) ; 44 | if(agentService!=null && XKDataContext.AgentUserStatusEnum.INSERVICE.toString().equals(agentService.getStatus())){ 45 | outMessage.setMessage(ServiceQuene.getSuccessMessage(agentService , inMessage.getAgentUser().getChannel(),inMessage.getOrgi())); 46 | NettyClients.getInstance().sendAgentEventMessage(agentService.getAgentno(), XKDataContext.MessageTypeEnum.NEW.toString(), inMessage.getAgentUser());//send to agnet 47 | }else{ 48 | if(agentService!=null && agentService.getQueneindex() > 0){ //当前有坐席 49 | outMessage.setMessage(ServiceQuene.getQueneMessage(agentService.getQueneindex(), inMessage.getAgentUser().getChannel(), inMessage.getOrgi())); 50 | }else{ 51 | outMessage.setMessage(ServiceQuene.getNoAgentMessage(agentService.getQueneindex(), inMessage.getAgentUser().getChannel(), inMessage.getOrgi())); 52 | } 53 | } 54 | } 55 | } catch (Exception e1) { 56 | e1.printStackTrace(); 57 | } 58 | return outMessage ; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/router/OutMessageRouter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util.router; 2 | 3 | import com.sxx.jcc.webim.pojo.MessageOutContent; 4 | 5 | public interface OutMessageRouter { 6 | 7 | public void handler(String touser, String msgtype , String appid , MessageOutContent outMessage) ; 8 | } 9 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/router/Router.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util.router; 2 | 3 | import com.sxx.jcc.webim.pojo.MessageDataBean; 4 | 5 | 6 | public abstract class Router { 7 | 8 | public abstract MessageDataBean handler(MessageDataBean message) ; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/router/RouterHelper.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util.router; 2 | 3 | public class RouterHelper { 4 | private static Router router = new MessageRouter(); 5 | 6 | public static Router getRouteInstance(){ 7 | return router ; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /sample/webim/src/com/sxx/jcc/webim/util/router/WebIMOutMessageRouter.java: -------------------------------------------------------------------------------- 1 | package com.sxx.jcc.webim.util.router; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.stereotype.Component; 5 | 6 | import com.sxx.jcc.webim.pojo.MessageOutContent; 7 | import com.sxx.jcc.webim.util.NettyClients; 8 | 9 | @Component 10 | public class WebIMOutMessageRouter implements OutMessageRouter{ 11 | 12 | @Bean(name="webim") 13 | public WebIMOutMessageRouter initWebIMessageRouter(){ 14 | return new WebIMOutMessageRouter() ; 15 | } 16 | @Override 17 | public void handler(String touser, String msgtype, String appid, 18 | MessageOutContent outMessage) { 19 | NettyClients.getInstance().sendIMEventMessage(touser, msgtype, outMessage); 20 | } 21 | 22 | } 23 | --------------------------------------------------------------------------------