|
|
@ -1,27 +1,12 @@
|
|
|
|
package com.weaver.seconddev.interfaces.workflow.controller;
|
|
|
|
package com.weaver.seconddev.interfaces.workflow.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
import com.weaver.common.base.entity.result.WeaResult;
|
|
|
|
import com.weaver.common.base.entity.result.WeaResult;
|
|
|
|
import com.weaver.common.distribution.lock.DistributionLockInterface;
|
|
|
|
import com.weaver.common.distribution.lock.DistributionLockInterface;
|
|
|
|
import com.weaver.common.i18n.tool.util.I18nContextUtil;
|
|
|
|
import com.weaver.common.i18n.tool.util.I18nContextUtil;
|
|
|
|
import com.weaver.custom.configcenter.htsysjcmtConfig;
|
|
|
|
|
|
|
|
import com.weaver.ecode.api.rpc.EcodeService;
|
|
|
|
import com.weaver.ecode.api.rpc.EcodeService;
|
|
|
|
import com.weaver.emonitor.util.Util;
|
|
|
|
|
|
|
|
import com.weaver.framework.rpc.annotation.RpcReference;
|
|
|
|
import com.weaver.framework.rpc.annotation.RpcReference;
|
|
|
|
import com.weaver.framework.rpc.context.impl.TenantRpcContext;
|
|
|
|
import com.weaver.framework.rpc.context.impl.TenantRpcContext;
|
|
|
|
import com.weaver.openapi.pojo.ApiResult;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.auth.params.AccessTokenParam;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.auth.params.CodeParam;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.auth.res.AccessToken;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.auth.res.Code;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.message.params.MessageVo;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.message.params.vo.MessageEntity;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.message.params.vo.MessageReciver;
|
|
|
|
|
|
|
|
import com.weaver.openapi.pojo.message.params.vo.MessageSender;
|
|
|
|
|
|
|
|
import com.weaver.openapi.service.AuthService;
|
|
|
|
|
|
|
|
import com.weaver.openapi.service.MessageService;
|
|
|
|
|
|
|
|
import com.weaver.seconddev.interfaces.prop.ConfigProp;
|
|
|
|
import com.weaver.seconddev.interfaces.prop.ConfigProp;
|
|
|
|
import com.weaver.verupgrade.conn.RecordSet;
|
|
|
|
|
|
|
|
import com.weaver.verupgrade.hrm.resource.ResourceComInfo;
|
|
|
|
import com.weaver.verupgrade.hrm.resource.ResourceComInfo;
|
|
|
|
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
|
|
|
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -30,7 +15,6 @@ import org.apache.axis.client.Service;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
@ -39,7 +23,6 @@ import javax.xml.rpc.ServiceException;
|
|
|
|
import javax.xml.rpc.encoding.XMLType;
|
|
|
|
import javax.xml.rpc.encoding.XMLType;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
|
|
|
import java.rmi.RemoteException;
|
|
|
|
import java.rmi.RemoteException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
@ -47,14 +30,7 @@ import java.util.*;
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@RequestMapping({"/papi/secondev/message"})
|
|
|
|
@RequestMapping({"/papi/secondev/message"})
|
|
|
|
//@WeaPermission
|
|
|
|
|
|
|
|
public class MessageSubscriptionController {
|
|
|
|
public class MessageSubscriptionController {
|
|
|
|
|
|
|
|
|
|
|
|
// api 需要用户会话,e10入口地址访问
|
|
|
|
|
|
|
|
// papi 任何人都可以直接访问 public api,e10入口地址访问
|
|
|
|
|
|
|
|
// sapi 服务内部通信的接口路由前缀 /sapi/secondev,e10入口地址访问不了
|
|
|
|
|
|
|
|
// 二开服务新接口:/api/secondev,/papi/secondev
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RpcReference(timeout = 10000)
|
|
|
|
@RpcReference(timeout = 10000)
|
|
|
|
EcodeService ecodeService;
|
|
|
|
EcodeService ecodeService;
|
|
|
|
@RpcReference(timeout = 2000, group = "workflow")
|
|
|
|
@RpcReference(timeout = 2000, group = "workflow")
|
|
|
@ -68,24 +44,16 @@ public class MessageSubscriptionController {
|
|
|
|
public WeaResult<String> subscription(@RequestParam Map<String,Object> param, @RequestBody Map<String,Object> params ) throws ServiceException, RemoteException, MalformedURLException {
|
|
|
|
public WeaResult<String> subscription(@RequestParam Map<String,Object> param, @RequestBody Map<String,Object> params ) throws ServiceException, RemoteException, MalformedURLException {
|
|
|
|
logger.error("MessageSubscriptionController Start " );
|
|
|
|
logger.error("MessageSubscriptionController Start " );
|
|
|
|
String jtzhkey = "t6kj9c07jr";
|
|
|
|
String jtzhkey = "t6kj9c07jr";
|
|
|
|
// String jtzhadmin = configProp.getJtzhadmin();
|
|
|
|
|
|
|
|
// log.error("jtzhkey:"+jtzhkey+" jtzhadmin:"+itzhadmin);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TenantRpcContext.setTargetTenantKey(jtzhkey);
|
|
|
|
TenantRpcContext.setTargetTenantKey(jtzhkey);
|
|
|
|
// TenantRpcContext.setTargetEmployeeId(jtzhadmin);
|
|
|
|
|
|
|
|
Map<String ,String > map = new HashMap<>();
|
|
|
|
Map<String ,String > map = new HashMap<>();
|
|
|
|
RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.error("params == " + params);
|
|
|
|
|
|
|
|
sendMsg(params);
|
|
|
|
sendMsg(params);
|
|
|
|
|
|
|
|
|
|
|
|
logger.error("subscription 推送成功");
|
|
|
|
logger.error("subscription 推送成功");
|
|
|
|
map.put("msg","推送成功");
|
|
|
|
map.put("msg","推送成功");
|
|
|
|
return WeaResult.success(map.toString());
|
|
|
|
return WeaResult.success(map.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void sendMsg(Map<String,Object> params) throws RemoteException, ServiceException, MalformedURLException {
|
|
|
|
private void sendMsg(Map<String,Object> params) throws RemoteException, ServiceException, MalformedURLException {
|
|
|
|
// logger.error("sendMsg params " + params);
|
|
|
|
logger.error("sendMsg params " + params);
|
|
|
|
String systemId = "SYS006";
|
|
|
|
String systemId = "SYS006";
|
|
|
|
String password = "123456";
|
|
|
|
String password = "123456";
|
|
|
|
String moudule = "流程待办";
|
|
|
|
String moudule = "流程待办";
|
|
|
@ -93,36 +61,27 @@ public class MessageSubscriptionController {
|
|
|
|
String content = String.valueOf(params.get("content"));
|
|
|
|
String content = String.valueOf(params.get("content"));
|
|
|
|
String url = String.valueOf(params.get("pcUrl"));
|
|
|
|
String url = String.valueOf(params.get("pcUrl"));
|
|
|
|
String mobileurl = String.valueOf(params.get("h5Url"));
|
|
|
|
String mobileurl = String.valueOf(params.get("h5Url"));
|
|
|
|
// String pcurl = configProp.getPc_url()+ URLEncoder.encode(url);
|
|
|
|
|
|
|
|
// String msgurl = configProp.getPc_url()+ URLEncoder.encode(mobileurl);
|
|
|
|
|
|
|
|
String pcurl = configProp.getHtportaloaUrl_pc_url()+new URL(url).getPath();
|
|
|
|
String pcurl = configProp.getHtportaloaUrl_pc_url()+new URL(url).getPath();
|
|
|
|
String msgurl = configProp.getHtportaloaUrl_pc_url()+new URL(mobileurl).getPath();
|
|
|
|
String msgurl = configProp.getHtportaloaUrl_pc_url()+new URL(mobileurl).getPath();
|
|
|
|
|
|
|
|
|
|
|
|
logger.error(" url: " + url);
|
|
|
|
logger.error(" url: " + url);
|
|
|
|
logger.error(" pcurl: " + pcurl);
|
|
|
|
logger.error(" pcurl: " + pcurl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String m_msgtitle = String.valueOf(params.get("title"));
|
|
|
|
String m_msgtitle = String.valueOf(params.get("title"));
|
|
|
|
String sendid = String.valueOf(params.get("senderId"));
|
|
|
|
String sendid = String.valueOf(params.get("senderId"));
|
|
|
|
|
|
|
|
|
|
|
|
String receivers = String.valueOf(params.get("receivers")) ;
|
|
|
|
String receivers = String.valueOf(params.get("receivers")) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// logger.error(" receivers: " + receivers);
|
|
|
|
|
|
|
|
// logger.error(" moudule: " + moudule);
|
|
|
|
|
|
|
|
// logger.error(" pcurl: " + pcurl);
|
|
|
|
|
|
|
|
// logger.error(" msgurl: " + msgurl);
|
|
|
|
|
|
|
|
// logger.error(" m_msgtitle: " + m_msgtitle);
|
|
|
|
|
|
|
|
// logger.error(" moudule: " + moudule);
|
|
|
|
|
|
|
|
// logger.error(" sendid: " + sendid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String sendname = "系统管理员";
|
|
|
|
String sendname = "系统管理员";
|
|
|
|
String userid = "1";
|
|
|
|
String userid = "1";
|
|
|
|
ResourceComInfo rc = I18nContextUtil.getBean(ResourceComInfo.class);
|
|
|
|
ResourceComInfo rc = I18nContextUtil.getBean(ResourceComInfo.class);
|
|
|
|
if (sendid != "1") {
|
|
|
|
if (sendid != "1") {
|
|
|
|
sendname = rc.getLastname(sendid + "");
|
|
|
|
if(sendid.length()<18){
|
|
|
|
userid = rc.getWorkcode(sendid + "");
|
|
|
|
sendname = "系统提示";
|
|
|
|
|
|
|
|
userid = "-";
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
sendname = rc.getLastname(sendid + "");
|
|
|
|
|
|
|
|
userid = rc.getWorkcode(sendid + "");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String pre = "";
|
|
|
|
String pre = "";
|
|
|
|
String msgtt = m_msgtitle;
|
|
|
|
String msgtt = m_msgtitle;
|
|
|
@ -145,35 +104,22 @@ public class MessageSubscriptionController {
|
|
|
|
msgtt = refurl + ":" + msgtt;
|
|
|
|
msgtt = refurl + ":" + msgtt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// logger.error(" content: " + content);
|
|
|
|
|
|
|
|
// logger.error(" msgtt: " + msgtt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refurl = msgurl;
|
|
|
|
refurl = msgurl;
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
String msgtime = df.format(new Date());
|
|
|
|
String msgtime = df.format(new Date());
|
|
|
|
String target = "2";
|
|
|
|
String target = "2";
|
|
|
|
String extdata = "";
|
|
|
|
String extdata = "";
|
|
|
|
// Set<String> useridset = msg.getRecivers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 去除字符串两端的方括号
|
|
|
|
// 去除字符串两端的方括号
|
|
|
|
String trimmed = receivers.substring(1, receivers.length() - 1);
|
|
|
|
String trimmed = receivers.substring(1, receivers.length() - 1);
|
|
|
|
// 使用逗号和空格作为分隔符将字符串拆分成多个子字符串
|
|
|
|
|
|
|
|
String[] strArray = trimmed.split(", ");
|
|
|
|
String[] strArray = trimmed.split(", ");
|
|
|
|
// List<String> useridset = Collections.singletonList(String.valueOf(params.get("receivers")));
|
|
|
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
// 遍历数组,将每个元素添加到 ArrayList 中
|
|
|
|
|
|
|
|
for (String num : strArray) {
|
|
|
|
for (String num : strArray) {
|
|
|
|
if(StringUtils.isNotEmpty(num)){
|
|
|
|
if(StringUtils.isNotEmpty(num)){
|
|
|
|
list.add(num);
|
|
|
|
list.add(num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object[] arr = list.toArray();
|
|
|
|
Object[] arr = list.toArray();
|
|
|
|
for (int i = 0; i < arr.length; i += 100) {
|
|
|
|
for (int i = 0; i < arr.length; i += 100) {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
@ -182,7 +128,6 @@ public class MessageSubscriptionController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String user = sb.toString().substring(0, sb.length() - 1);
|
|
|
|
String user = sb.toString().substring(0, sb.length() - 1);
|
|
|
|
|
|
|
|
|
|
|
|
// logger.error(" user: " + user);
|
|
|
|
|
|
|
|
String msgid = "MsgSYS006" + userid + (new Date()).getTime();
|
|
|
|
String msgid = "MsgSYS006" + userid + (new Date()).getTime();
|
|
|
|
messages = messages + "<message>";
|
|
|
|
messages = messages + "<message>";
|
|
|
|
messages = messages + "<MSG_ID>" + msgid + "</MSG_ID><PRE_MSG_ID>" + pre + "</PRE_MSG_ID><USER_ID>" + user + "</USER_ID><MSG_TITLE>" + msgtt + "</MSG_TITLE><MSG_CONTENT>" + msgtt + "</MSG_CONTENT><SENDER_NAME>" + sendname + "</SENDER_NAME><REF_URL>" + refurl + "</REF_URL><MSG_TIME>" + msgtime + "</MSG_TIME><TARGET>" + target + "</TARGET><EXT_DATA>" + extdata + "</EXT_DATA>";
|
|
|
|
messages = messages + "<MSG_ID>" + msgid + "</MSG_ID><PRE_MSG_ID>" + pre + "</PRE_MSG_ID><USER_ID>" + user + "</USER_ID><MSG_TITLE>" + msgtt + "</MSG_TITLE><MSG_CONTENT>" + msgtt + "</MSG_CONTENT><SENDER_NAME>" + sendname + "</SENDER_NAME><REF_URL>" + refurl + "</REF_URL><MSG_TIME>" + msgtime + "</MSG_TIME><TARGET>" + target + "</TARGET><EXT_DATA>" + extdata + "</EXT_DATA>";
|
|
|
@ -224,8 +169,6 @@ public class MessageSubscriptionController {
|
|
|
|
headers.put("Authorization", configProp.getUrl_password());
|
|
|
|
headers.put("Authorization", configProp.getUrl_password());
|
|
|
|
|
|
|
|
|
|
|
|
logger.error(" Url_password(): " + configProp.getUrl_password());
|
|
|
|
logger.error(" Url_password(): " + configProp.getUrl_password());
|
|
|
|
logger.error(" systemId: " + systemId);
|
|
|
|
|
|
|
|
logger.error(" password: " + password);
|
|
|
|
|
|
|
|
logger.error(" moudule: " + moudule);
|
|
|
|
logger.error(" moudule: " + moudule);
|
|
|
|
logger.error(" messages: " + messages);
|
|
|
|
logger.error(" messages: " + messages);
|
|
|
|
|
|
|
|
|
|
|
@ -233,7 +176,6 @@ public class MessageSubscriptionController {
|
|
|
|
String obj = (String) call.invoke(val);
|
|
|
|
String obj = (String) call.invoke(val);
|
|
|
|
|
|
|
|
|
|
|
|
logger.error(" obj: " + String.valueOf(obj));
|
|
|
|
logger.error(" obj: " + String.valueOf(obj));
|
|
|
|
logger.error(String.valueOf("----onMessage--<\n"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|