一键催办使用线程发送
This commit is contained in:
parent
caa3c109d8
commit
f8ff21cf14
@ -985,49 +985,67 @@ public class DingtalkBusiness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void urging(List<FlowRecord> flowRecords, Map<Long, StaffEntity> mapStaffs, Map<Long, ResultRecord> mapReords) {
|
public void urging(List<FlowRecord> flowRecords, Map<Long, StaffEntity> mapStaffs, Map<Long, ResultRecord> mapReords) {
|
||||||
logger.info("批量催办");
|
ThreadSendUrgingMessage threadSendUrgingMessage = new ThreadSendUrgingMessage(flowRecords, mapReords, mapStaffs);
|
||||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
Thread thread = new Thread(threadSendUrgingMessage);
|
||||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
thread.start();
|
||||||
if(token != null && token.length() > 0){
|
|
||||||
|
|
||||||
for (FlowRecord flowRecord:flowRecords
|
|
||||||
) {
|
|
||||||
ResultRecord record = mapReords.get(flowRecord.getRecordId());
|
|
||||||
StaffEntity info = mapStaffs.get(flowRecord.getApprovalStaffId());
|
|
||||||
if(record != null && info != null){
|
|
||||||
String url = homeUrl;
|
|
||||||
if(url.contains("?")){
|
|
||||||
url += "&halokit=" + System.currentTimeMillis();
|
|
||||||
}else{
|
|
||||||
url += "?halokit=" + System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
url += ("&detail=1&id=" + record.getId());
|
|
||||||
url = URLEncoder.encode(url);
|
|
||||||
|
|
||||||
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
|
||||||
"&container_type=work_platform&app_id=0_" +
|
|
||||||
appid + "&redirect_type=jump&redirect_url=" + url;
|
|
||||||
|
|
||||||
logger.info("发送消息给{},url:{}", info, url);
|
|
||||||
String content = null;
|
|
||||||
if(!record.getStaffName().equals(info.getName())){
|
|
||||||
content = WorkMsgTypeEnum.URGING.getContent().replace("@", record.getStaffName());
|
|
||||||
}else{
|
|
||||||
content = WorkMsgTypeEnum.URGING.getContent().replace("@", "您");
|
|
||||||
}
|
|
||||||
|
|
||||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.URGING.getTitle(),
|
|
||||||
content, WorkMsgTypeEnum.URGING.getBtnText(), url, token);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
logger.info("无对应的record");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
logger.info("token无效"); ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ThreadSendUrgingMessage implements Runnable{
|
||||||
|
List<FlowRecord> flowRecords;
|
||||||
|
Map<Long, ResultRecord> mapReords;
|
||||||
|
Map<Long, StaffEntity> mapStaffs;
|
||||||
|
public ThreadSendUrgingMessage(List<FlowRecord> flowRecords, Map<Long, ResultRecord> mapReords, Map<Long, StaffEntity> mapStaffs){
|
||||||
|
this.flowRecords = flowRecords;
|
||||||
|
this.mapReords = mapReords;
|
||||||
|
this.mapStaffs = mapStaffs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
logger.info("批量催办");
|
||||||
|
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||||
|
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||||
|
if(token != null && token.length() > 0){
|
||||||
|
|
||||||
|
for (FlowRecord flowRecord:flowRecords
|
||||||
|
) {
|
||||||
|
ResultRecord record = mapReords.get(flowRecord.getRecordId());
|
||||||
|
StaffEntity info = mapStaffs.get(flowRecord.getApprovalStaffId());
|
||||||
|
if(record != null && info != null){
|
||||||
|
String url = homeUrl;
|
||||||
|
if(url.contains("?")){
|
||||||
|
url += "&halokit=" + System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
url += "?halokit=" + System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
url += ("&detail=1&id=" + record.getId());
|
||||||
|
url = URLEncoder.encode(url);
|
||||||
|
|
||||||
|
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||||
|
"&container_type=work_platform&app_id=0_" +
|
||||||
|
appid + "&redirect_type=jump&redirect_url=" + url;
|
||||||
|
|
||||||
|
logger.info("发送消息给{},url:{}", info, url);
|
||||||
|
String content = null;
|
||||||
|
if(!record.getStaffName().equals(info.getName())){
|
||||||
|
content = WorkMsgTypeEnum.URGING.getContent().replace("@", record.getStaffName());
|
||||||
|
}else{
|
||||||
|
content = WorkMsgTypeEnum.URGING.getContent().replace("@", "您");
|
||||||
|
}
|
||||||
|
|
||||||
|
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.URGING.getTitle(),
|
||||||
|
content, WorkMsgTypeEnum.URGING.getBtnText(), url, token);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
logger.info("无对应的record");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.info("token无效"); ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ThreadSendMessage implements Runnable{
|
public class ThreadSendMessage implements Runnable{
|
||||||
List<StaffSimpleInfo> toStaffids;
|
List<StaffSimpleInfo> toStaffids;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user