#chabaodao-4# 群杰集成
This commit is contained in:
parent
58976e9142
commit
87e19b2797
|
|
@ -25,30 +25,35 @@ public class WorkflowBotMessageDao {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> queryUserBotMessageId(String requestid,String nodeid,String operatorid){
|
||||
public String queryUserBotMessageId(String requestid,String nodeid,String operatorid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
String message_id = "";
|
||||
try{
|
||||
String dataSql =" select czzid,message_id \n" +
|
||||
" from uf_bot_message \n" +
|
||||
" where lcid= ? and jdid = ? and czzid in ("+operatorid+")" +
|
||||
" and delete_type = 0 and tenant_key = ? " ;
|
||||
" where lcid= ? and jdid = ? and czzid = ? " +
|
||||
" and delete_type = 0 and tenant_key = ? " +
|
||||
" order by create_time desc " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(requestid);
|
||||
paramList.add(nodeid);
|
||||
paramList.add(operatorid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
message_id = String.valueOf(recordList.get(0).get("message_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
return message_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuBotCreateTodoAction")
|
||||
|
|
@ -33,34 +31,19 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestName = String.valueOf(params.get("requestName"));
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestName:{}",requestName);
|
||||
|
||||
String mobileurl = String.valueOf(params.get("mobileurl"));
|
||||
String pcurl = String.valueOf(params.get("pcurl"));
|
||||
String creatorid = String.valueOf(params.get("creatorid"));
|
||||
String creatorname = "";
|
||||
|
||||
String senderid = String.valueOf(params.get("senderid"));
|
||||
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
String requestmark = String.valueOf(params.get("requestmark"));
|
||||
if("null".equals(requestmark) || requestmark == null){
|
||||
requestmark = "";
|
||||
}
|
||||
String msgType = String.valueOf(params.get("msgType"));
|
||||
|
||||
String nodeid = String.valueOf(params.get("nodeid"));
|
||||
|
||||
log.error("msgType:{}",msgType);
|
||||
log.error("mobileurl:{}",mobileurl);
|
||||
log.error("pcurl:{}",pcurl);
|
||||
log.error("operatorid:{}",operatorid);
|
||||
log.error("requestmark:{}",requestmark);
|
||||
log.error("creatorid:{}",creatorid);
|
||||
|
||||
String message_ids = "";
|
||||
|
||||
if("0".equals(msgType)){
|
||||
String senderMobile ="";
|
||||
if(StringUtils.isNotBlank(senderid)){
|
||||
|
|
@ -74,11 +57,9 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> creatorMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
|
|
@ -91,43 +72,29 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
send_open_id = String.valueOf(senderMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
String operator_open_id = "";
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
}
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
operator_open_id = String.valueOf(userMap.get(userMobile));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.error("operator_open_id:{}",operator_open_id);
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(send_open_id)){
|
||||
if(todoOpenIdList.size() > 0){
|
||||
if("0".equals(msgType)){
|
||||
message_ids = esb2FeishuBotCreateTodoUtil.senBotTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
create_open_id,send_open_id,todoOpenIdList,
|
||||
mobileurl,pcurl
|
||||
);
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
|
||||
message_ids = esb2FeishuBotCreateTodoUtil.senBotTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
create_open_id,send_open_id,operator_open_id,
|
||||
mobileurl,pcurl
|
||||
);
|
||||
|
||||
}else{
|
||||
log.error("send_open_id:{}","获取待办人员为空");
|
||||
}
|
||||
|
|
@ -138,7 +105,9 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("message","成功");
|
||||
actionMap.put("data",message_ids);
|
||||
|
||||
actionMap.put("messageid",message_ids);
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("requestname",requestName);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.dao.WorkflowBotMessageDao;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuBotDeleteTodoUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuBotDteleteTodoAction")
|
||||
public class Esb2FeishuBotDeleteTodoAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2FeishuBotDeleteTodoAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuBotDeleteTodoUtil esb2FeishuBotDeleteTodoUtil;
|
||||
|
||||
@Autowired
|
||||
WorkflowBotMessageDao workflowBotMessageDao;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestName = String.valueOf(params.get("requestName"));
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestName:{}",requestName);
|
||||
String nodeid = String.valueOf(params.get("nodeid"));
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
String msgType = String.valueOf(params.get("msgType"));
|
||||
|
||||
|
||||
log.error("msgType:{}",msgType);
|
||||
log.error("operatorid:{}",operatorid);
|
||||
|
||||
String update_message_id = "";
|
||||
String message_id = "";
|
||||
if("2".equals(msgType)){
|
||||
String status = "DELETED";
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
message_id = workflowBotMessageDao.queryUserBotMessageId(requestid,nodeid,operatorid);
|
||||
}
|
||||
log.error("message_id:{}",message_id);
|
||||
if(StringUtils.isNotBlank(message_id)){
|
||||
update_message_id = esb2FeishuBotDeleteTodoUtil.deleteBotTodoMessage(status,message_id);
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("message","成功");
|
||||
actionMap.put("data",update_message_id);
|
||||
actionMap.put("messageid",message_id);
|
||||
actionMap.put("updatemessageid",update_message_id);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.dao.WorkflowTableDao;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuBotCreateTodoUtil;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuOpenIdUtil;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuDteleteBotTodoAction")
|
||||
public class Esb2FeishuBotDteleteTodoAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2FeishuBotDteleteTodoAction.class);
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuOpenIdUtil esb2FeishuOpenIdUtil;
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuBotCreateTodoUtil esb2FeishuBotTodoUtil;
|
||||
|
||||
@Autowired
|
||||
WorkflowTableDao workflowTableDao;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2FeishuSendTodoAction start");
|
||||
|
||||
String workflowid = String.valueOf(params.get("workflowid"));
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestName = String.valueOf(params.get("requestName"));
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestName:{}",requestName);
|
||||
|
||||
String mobileurl = String.valueOf(params.get("mobileurl"));
|
||||
String pcurl = String.valueOf(params.get("pcurl"));
|
||||
String creatorid = String.valueOf(params.get("creatorid"));
|
||||
String creatorname = "";
|
||||
|
||||
String senderid = String.valueOf(params.get("senderid"));
|
||||
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
String requestmark = String.valueOf(params.get("requestmark"));
|
||||
if("null".equals(requestmark) || requestmark == null){
|
||||
requestmark = "";
|
||||
}
|
||||
String msgType = String.valueOf(params.get("msgType"));
|
||||
|
||||
log.error("msgType:{}",msgType);
|
||||
log.error("mobileurl:{}",mobileurl);
|
||||
log.error("pcurl:{}",pcurl);
|
||||
log.error("operatorid:{}",operatorid);
|
||||
log.error("requestmark:{}",requestmark);
|
||||
log.error("creatorid:{}",creatorid);
|
||||
String senderMobile ="";
|
||||
if(StringUtils.isNotBlank(senderid)){
|
||||
Long sender_id = Long.parseLong(senderid);
|
||||
SimpleEmployee senderEmployee = hrmCommonUtil.getSimpleEmployee(sender_id);
|
||||
senderMobile = senderEmployee.getMobile();
|
||||
}
|
||||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> creatorMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(creatorMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
String send_open_id = "";
|
||||
if(StringUtils.isNotBlank(senderMobile)){
|
||||
Map<String, Object> senderMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(senderMobile);
|
||||
send_open_id = String.valueOf(senderMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
String formTable = "";
|
||||
if(StringUtils.isNotBlank(workflowid)){
|
||||
formTable = workflowTableDao.queryWorkflowTable(workflowid);
|
||||
}
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String message_ids = "";
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(send_open_id)){
|
||||
if(todoOpenIdList.size() > 0){
|
||||
if("1".equals(msgType)){
|
||||
message_ids = esb2FeishuBotTodoUtil.senBotTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
create_open_id,send_open_id,todoOpenIdList,
|
||||
mobileurl,pcurl
|
||||
);
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
}else{
|
||||
log.error("send_open_id:{}","获取待办人员为空");
|
||||
}
|
||||
}else{
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("message_ids",message_ids);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuBotUpdateTodoAction")
|
||||
|
|
@ -29,24 +26,26 @@ public class Esb2FeishuBotUpdateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestName = String.valueOf(params.get("requestName"));
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestName:{}",requestName);
|
||||
|
||||
String nodeid = String.valueOf(params.get("nodeid"));
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
String msgType = String.valueOf(params.get("msgType"));
|
||||
|
||||
log.error("requestName:{}",requestName);
|
||||
|
||||
log.error("msgType:{}",msgType);
|
||||
log.error("operatorid:{}",operatorid);
|
||||
|
||||
String update_message_id = "";
|
||||
if("1".equals(msgType)){
|
||||
String message_id = "";
|
||||
if("1".equals(msgType) || "5".equals(msgType)){
|
||||
String status = "PROCESSED";
|
||||
List<Map<String,Object>> todoMessageIdList = new ArrayList<Map<String,Object>>();
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
todoMessageIdList = workflowBotMessageDao.queryUserBotMessageId(requestid,nodeid,operatorid);
|
||||
message_id = workflowBotMessageDao.queryUserBotMessageId(requestid,nodeid,operatorid);
|
||||
}
|
||||
log.error("todoMessageIdList:{}",todoMessageIdList.size());
|
||||
if(todoMessageIdList.size() > 0){
|
||||
update_message_id = esb2FeishuBotUpdateTodoUtil.senBotTodoMessage(status,todoMessageIdList);
|
||||
log.error("message_id:{}",message_id);
|
||||
if(StringUtils.isNotBlank(message_id)){
|
||||
update_message_id = esb2FeishuBotUpdateTodoUtil.updateBotTodoMessage(status,message_id);
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
|
|
@ -54,8 +53,9 @@ public class Esb2FeishuBotUpdateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("messageid",update_message_id);
|
||||
actionMap.put("message","成功");
|
||||
actionMap.put("data",update_message_id);
|
||||
actionMap.put("messageid",message_id);
|
||||
actionMap.put("updatemessageid",update_message_id);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
|
|
|
|||
|
|
@ -88,76 +88,77 @@ public class Esb2FeishuSendDeleteAction implements EsbServerlessRpcRemoteInterfa
|
|||
log.error("creatorid:{}",creatorid);
|
||||
log.error("recepttime:{}",recepttime);
|
||||
|
||||
String cid = String.valueOf(params.get("cid"));
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},todo",requestid,nodeId,operatorid,cid,msgType);
|
||||
|
||||
String code = "";
|
||||
|
||||
String creatorname = "";
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
if("2".equals(msgType)){
|
||||
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
String creatorname = "";
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
operator_open_id = String.valueOf(userMap.get(userMobile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(todoOpenIdList.size() >0){
|
||||
if("2".equals(msgType)){
|
||||
log.error("operator_open_id:{}",operator_open_id);
|
||||
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(operator_open_id)){
|
||||
String status = "DELETED";
|
||||
code = esb2FeishuSendDeleteUtil.senTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
creatorname,createTime,
|
||||
nodeId,nodeName,
|
||||
archivingTime,
|
||||
degree,mobileurl,pcurl,create_open_id,todoOpenIdList,
|
||||
recepttime,status
|
||||
degree,mobileurl,pcurl,create_open_id,operator_open_id,
|
||||
recepttime,status,cid
|
||||
);
|
||||
if(!"0".equals(code)){
|
||||
log.error("todoOpenIdList:{}","创建飞书待办异常");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
}else{
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("data",requestid+"_"+operatorid);
|
||||
actionMap.put("status",code);
|
||||
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("nodeid",nodeId);
|
||||
actionMap.put("operatorid",operatorid);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ public class Esb2FeishuSendDoneAction implements EsbServerlessRpcRemoteInterface
|
|||
log.error("creatorid:{}",creatorid);
|
||||
log.error("recepttime:{}",recepttime);
|
||||
|
||||
String cid = String.valueOf(params.get("cid"));
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},todo",requestid,nodeId,operatorid,cid,msgType);
|
||||
|
||||
String code = "";
|
||||
if("1".equals(msgType)){
|
||||
String status = "APPROVED";
|
||||
|
|
@ -109,37 +112,28 @@ public class Esb2FeishuSendDoneAction implements EsbServerlessRpcRemoteInterface
|
|||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
}
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
operator_open_id = String.valueOf(userMap.get(userMobile));
|
||||
}
|
||||
}
|
||||
log.error("operator_open_id:{}",operator_open_id);
|
||||
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(todoOpenIdList.size()>0){
|
||||
if(StringUtils.isNotBlank(operator_open_id)){
|
||||
code = esb2FeishuSendDoneUtil.senTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
creatorname,createTime,
|
||||
nodeId,nodeName,
|
||||
archivingTime,
|
||||
degree,mobileurl,pcurl,create_open_id,todoOpenIdList,
|
||||
recepttime,status
|
||||
degree,mobileurl,pcurl,create_open_id,operator_open_id,
|
||||
recepttime,status,cid
|
||||
);
|
||||
if(!"0".equals(code)){
|
||||
log.error("todoOpenIdList:{}","创建飞书待办异常");
|
||||
|
|
@ -155,8 +149,11 @@ public class Esb2FeishuSendDoneAction implements EsbServerlessRpcRemoteInterface
|
|||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("data",requestid+"_"+operatorid);
|
||||
actionMap.put("status",code);
|
||||
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("nodeid",nodeId);
|
||||
actionMap.put("operatorid",operatorid);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,74 +90,72 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
|
|||
log.error("creatorid:{}",creatorid);
|
||||
log.error("recepttime:{}",recepttime);
|
||||
|
||||
String cid = String.valueOf(params.get("cid"));
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},todo",requestid,nodeId,operatorid,cid,msgType);
|
||||
|
||||
String code = "";
|
||||
if("5".equals(msgType)){
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)) {
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
operator_open_id = String.valueOf(userMap.get(userMobile));
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("operator_open_id:{}",operator_open_id);
|
||||
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(todoOpenIdList.size() >0){
|
||||
if("5".equals(msgType)){
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(operator_open_id)){
|
||||
String status = "TERMINATED";
|
||||
code = esb2FeishuSendFinishUtil.senTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
creatorname,createTime,
|
||||
nodeId,nodeName,
|
||||
archivingTime,
|
||||
degree,mobileurl,pcurl,create_open_id,todoOpenIdList,
|
||||
recepttime,status
|
||||
degree,mobileurl,pcurl,create_open_id,operator_open_id,
|
||||
recepttime,status,cid
|
||||
);
|
||||
if(!"0".equals(code)){
|
||||
log.error("todoOpenIdList:{}","创建飞书待办异常");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
}else{
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("data",requestid+"_"+operatorid);
|
||||
actionMap.put("status",code);
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("nodeid",nodeId);
|
||||
actionMap.put("operatorid",operatorid);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ public class Esb2FeishuSendTodoAction implements EsbServerlessRpcRemoteInterface
|
|||
log.error("nodeId:{}",nodeId);
|
||||
log.error("nodeName:{}",nodeName);
|
||||
log.error("degree:{}",degree);
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
|
||||
|
||||
|
||||
|
||||
String mobileurl = String.valueOf(params.get("mobileurl"));
|
||||
String pcurl = String.valueOf(params.get("pcurl"));
|
||||
|
|
@ -65,7 +69,7 @@ public class Esb2FeishuSendTodoAction implements EsbServerlessRpcRemoteInterface
|
|||
String creatorname = "";
|
||||
|
||||
String approvestatus = String.valueOf(params.get("approvestatus"));
|
||||
String operatorid = String.valueOf(params.get("operatorid"));
|
||||
|
||||
String requestmark = String.valueOf(params.get("requestmark"));
|
||||
if("null".equals(requestmark) || requestmark == null){
|
||||
requestmark = "";
|
||||
|
|
@ -89,75 +93,74 @@ public class Esb2FeishuSendTodoAction implements EsbServerlessRpcRemoteInterface
|
|||
log.error("sendtime:{}",sendtime);
|
||||
log.error("creatorid:{}",creatorid);
|
||||
log.error("recepttime:{}",recepttime);
|
||||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
|
||||
List<String> todoOpenIdList = new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
String[] todoUserids = operatorid.split(",");
|
||||
for(int i=0;i<todoUserids.length;i++){
|
||||
String todoUserid = todoUserids[i];
|
||||
log.error("todoUserid:{}",todoUserid);
|
||||
if(StringUtils.isNotBlank(todoUserid)){
|
||||
Long userid = Long.parseLong(todoUserid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
String user_open_id = String.valueOf(userMap.get(userMobile));
|
||||
log.error("user_open_id:{}",user_open_id);
|
||||
todoOpenIdList.add(user_open_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String code = "";
|
||||
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(todoOpenIdList.size() > 0){
|
||||
if("0".equals(msgType)){
|
||||
String cid = String.valueOf(params.get("cid"));
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},todo",requestid,nodeId,operatorid,cid,msgType);
|
||||
|
||||
if("0".equals(msgType)){
|
||||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
}
|
||||
|
||||
String create_open_id = "";
|
||||
if(StringUtils.isNotBlank(creatorMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(creatorMobile);
|
||||
create_open_id = String.valueOf(userMap.get(creatorMobile));
|
||||
}
|
||||
log.error("create_open_id:{}",create_open_id);
|
||||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
if(StringUtils.isNotBlank(userMobile)){
|
||||
Map<String, Object> userMap = esb2FeishuOpenIdUtil.queryFeishuOpenIdByMobiles(userMobile);
|
||||
operator_open_id = String.valueOf(userMap.get(userMobile));
|
||||
}
|
||||
}
|
||||
|
||||
log.error("operator_open_id:{}",operator_open_id);
|
||||
|
||||
log.error("creatorMobile:{}",creatorMobile);
|
||||
log.error("creatorname:{}",creatorname);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(operator_open_id)){
|
||||
String status = "PENDING";
|
||||
code = esb2FeishuSendTodoUtil.senTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
creatorname,createTime,
|
||||
nodeId,nodeName,
|
||||
archivingTime,
|
||||
degree,mobileurl,pcurl,create_open_id,todoOpenIdList,
|
||||
recepttime,status
|
||||
degree,mobileurl,pcurl,create_open_id,operator_open_id,
|
||||
recepttime,status,cid
|
||||
);
|
||||
if(!"0".equals(code)){
|
||||
log.error("todoOpenIdList:{}","创建飞书待办异常");
|
||||
log.error("operator_open_id:{}","创建飞书待办异常");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
}
|
||||
}else{
|
||||
log.error("todoOpenIdList:{}","获取待办人员为空");
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
}else{
|
||||
log.error("creatorMobile:{}","创建人飞书openid为空");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("data",requestid+"_"+operatorid);
|
||||
actionMap.put("status",code);
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("nodeid",nodeId);
|
||||
actionMap.put("operatorid",operatorid);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,37 +24,34 @@ public class Esb2FeishuBotCreateTodoUtil {
|
|||
|
||||
public String senBotTodoMessage(String requestid,String requestName,String requestmark,
|
||||
String create_open_id,
|
||||
String title_open_id,List<String> todoOpenIdList,
|
||||
String title_open_id,String receiver_open_id,
|
||||
String mobileurl,String pcurl) {
|
||||
String message_ids = "";
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String receiver_open_id = todoOpenIdList.get(i);
|
||||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
receiver_open_id,title_open_id,
|
||||
mobileurl, pcurl);
|
||||
|
||||
log.error("feishu-todo:{}",bodyData);
|
||||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
receiver_open_id,title_open_id,
|
||||
mobileurl, pcurl);
|
||||
|
||||
String message = doSendPost(bodyData,token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("message_id")){
|
||||
String message_id = dataJson.getString("message_id");
|
||||
message_ids += StringUtils.isBlank(message_ids) ? message_id : ","+message_id;
|
||||
}
|
||||
}
|
||||
log.error("feishu-todo:{}",bodyData);
|
||||
|
||||
String message = doSendPost(bodyData,token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("message_id")){
|
||||
String message_id = dataJson.getString("message_id");
|
||||
message_ids += StringUtils.isBlank(message_ids) ? message_id : ","+message_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return message_ids;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.util;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.feishu.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class Esb2FeishuBotDeleteTodoUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2FeishuBotDeleteTodoUtil.class);
|
||||
|
||||
@Autowired
|
||||
private Esb2FeishuTokenUtil esb2FeishuTokenUtil;
|
||||
|
||||
public String deleteBotTodoMessage(String status,String message_id) {
|
||||
String update_message_id = "";
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("message_id",message_id);
|
||||
bodyJson.put("status",status);
|
||||
|
||||
JSONObject textsJson = new JSONObject();
|
||||
JSONObject i18nResourcesJson = new JSONObject();
|
||||
i18nResourcesJson.put("locale","zh-CN");
|
||||
i18nResourcesJson.put("texts",textsJson);
|
||||
i18nResourcesJson.put("is_default","true");
|
||||
JSONArray i18nResourcesArray = new JSONArray();
|
||||
i18nResourcesArray.add(i18nResourcesJson);
|
||||
bodyJson.put("i18n_resources",i18nResourcesArray);
|
||||
|
||||
String message = doSendPost(bodyJson.toJSONString(),token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("message_id")){
|
||||
update_message_id = dataJson.getString("message_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return update_message_id;
|
||||
}
|
||||
|
||||
|
||||
public String doSendPost(String bodyData, String token){
|
||||
String msg = "";
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyData);
|
||||
|
||||
// RequestBody body = RequestBody.create(mediaType, "{\n \"message_id\":\"7530608640169000988\",\n \"status\":\"PROCESSED\",\n \"i18n_resources\":[\n {\n \"locale\":\"zh-CN\",\n \"is_default\":true,\n \"texts\":{\n \n \n }\n }\n ]\n}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.feishuHost+Constants.updateBotUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,44 +20,39 @@ public class Esb2FeishuBotUpdateTodoUtil {
|
|||
@Autowired
|
||||
private Esb2FeishuTokenUtil esb2FeishuTokenUtil;
|
||||
|
||||
public String senBotTodoMessage(String status,List<Map<String,Object>> todoOpenIdList) {
|
||||
String update_message_ids = "";
|
||||
public String updateBotTodoMessage(String status,String message_id) {
|
||||
String update_message_id = "";
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String message_id = String.valueOf(todoOpenIdList.get(i).get("message_id"));
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("message_id",message_id);
|
||||
bodyJson.put("status",status);
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("message_id",message_id);
|
||||
bodyJson.put("status",status);
|
||||
JSONObject textsJson = new JSONObject();
|
||||
JSONObject i18nResourcesJson = new JSONObject();
|
||||
i18nResourcesJson.put("locale","zh-CN");
|
||||
i18nResourcesJson.put("texts",textsJson);
|
||||
i18nResourcesJson.put("is_default","true");
|
||||
JSONArray i18nResourcesArray = new JSONArray();
|
||||
i18nResourcesArray.add(i18nResourcesJson);
|
||||
bodyJson.put("i18n_resources",i18nResourcesArray);
|
||||
|
||||
JSONObject textsJson = new JSONObject();
|
||||
JSONObject i18nResourcesJson = new JSONObject();
|
||||
i18nResourcesJson.put("locale","zh-CN");
|
||||
i18nResourcesJson.put("texts",textsJson);
|
||||
i18nResourcesJson.put("is_default","true");
|
||||
JSONArray i18nResourcesArray = new JSONArray();
|
||||
i18nResourcesArray.add(i18nResourcesJson);
|
||||
bodyJson.put("i18n_resources",i18nResourcesArray);
|
||||
|
||||
String message = doSendPost(bodyJson.toJSONString(),token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("message_id")){
|
||||
String update_message_id = dataJson.getString("message_id");
|
||||
update_message_ids += StringUtils.isBlank(update_message_ids) ? update_message_id : ","+update_message_id;
|
||||
}
|
||||
String message = doSendPost(bodyJson.toJSONString(),token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("message_id")){
|
||||
update_message_id = dataJson.getString("message_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return update_message_ids;
|
||||
return update_message_id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
String creatorName, String createTime,
|
||||
String nodeId, String nodeName, String archivingTime,
|
||||
String degree,String mobileurl,String pcurl,
|
||||
String create_open_id,List<String> todoOpenIdList,
|
||||
String recepttime,String status
|
||||
String create_open_id,String operator_open_id,
|
||||
String recepttime,String status,String cid
|
||||
) {
|
||||
log.error("senTodoMessage start");
|
||||
String code = "";
|
||||
|
|
@ -108,8 +108,8 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
department_id,department_name,
|
||||
createTimeStamp,archivingTimeStamp,
|
||||
formList,nodeId,nodeName,todoOpenIdList,
|
||||
mobileurl, pcurl,receptTimeStamp,status);
|
||||
formList,nodeId,nodeName,operator_open_id,
|
||||
mobileurl, pcurl,receptTimeStamp,status,cid);
|
||||
|
||||
log.error("feishu-delete:{}",bodyData);
|
||||
|
||||
|
|
@ -164,11 +164,12 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
List<Map<String, Object>> formList,
|
||||
String node_id,
|
||||
String nodeName,
|
||||
List<String> todoOpenIdList,
|
||||
String task_open_id,
|
||||
String mobileurl,
|
||||
String pcurl,
|
||||
String receptTimeStamp,
|
||||
String status
|
||||
String status,
|
||||
String cid
|
||||
){
|
||||
|
||||
|
||||
|
|
@ -201,21 +202,20 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
log.error("update_time:{}",String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
JSONArray taskListArray = new JSONArray();
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String task_open_id = String.valueOf(todoOpenIdList.get(i));
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
|
||||
// JSONArray actionConfigsArray = new JSONArray();
|
||||
// JSONObject actionConfigsJson = new JSONObject();
|
||||
|
|
@ -227,11 +227,9 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
// actionConfigsArray.add(actionConfigsJson);
|
||||
// taskListJson.put("action_configs",actionConfigsArray);
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
}
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
bodyJson.put("task_list",taskListArray);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public class Esb2FeishuSendDoneUtil {
|
|||
String creatorName, String createTime,
|
||||
String nodeId, String nodeName, String archivingTime,
|
||||
String degree,String mobileurl,String pcurl,
|
||||
String create_open_id,List<String> todoOpenIdList,
|
||||
String recepttime,String status
|
||||
String create_open_id,String operator_open_id,
|
||||
String recepttime,String status,String cid
|
||||
) {
|
||||
log.error("senTodoMessage start");
|
||||
String code = "";
|
||||
|
|
@ -103,13 +103,12 @@ public class Esb2FeishuSendDoneUtil {
|
|||
formList.add(formMap);
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
department_id,department_name,
|
||||
createTimeStamp,archivingTimeStamp,
|
||||
formList,nodeId,nodeName,todoOpenIdList,
|
||||
mobileurl, pcurl,receptTimeStamp,status);
|
||||
formList,nodeId,nodeName,operator_open_id,
|
||||
mobileurl, pcurl,receptTimeStamp,status,cid);
|
||||
|
||||
log.error("feishu-done:{}",bodyData);
|
||||
|
||||
|
|
@ -164,11 +163,12 @@ public class Esb2FeishuSendDoneUtil {
|
|||
List<Map<String, Object>> formList,
|
||||
String node_id,
|
||||
String nodeName,
|
||||
List<String> todoOpenIdList,
|
||||
String task_open_id,
|
||||
String mobileurl,
|
||||
String pcurl,
|
||||
String receptTimeStamp,
|
||||
String status
|
||||
String status,
|
||||
String cid
|
||||
){
|
||||
|
||||
|
||||
|
|
@ -201,21 +201,19 @@ public class Esb2FeishuSendDoneUtil {
|
|||
log.error("update_time:{}",String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
JSONArray taskListArray = new JSONArray();
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String task_open_id = String.valueOf(todoOpenIdList.get(i));
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
|
||||
// JSONArray actionConfigsArray = new JSONArray();
|
||||
// JSONObject actionConfigsJson = new JSONObject();
|
||||
|
|
@ -227,11 +225,9 @@ public class Esb2FeishuSendDoneUtil {
|
|||
// actionConfigsArray.add(actionConfigsJson);
|
||||
// taskListJson.put("action_configs",actionConfigsArray);
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
}
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
bodyJson.put("task_list",taskListArray);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public class Esb2FeishuSendFinishUtil {
|
|||
String creatorName, String createTime,
|
||||
String nodeId, String nodeName, String archivingTime,
|
||||
String degree,String mobileurl,String pcurl,
|
||||
String create_open_id,List<String> todoOpenIdList,
|
||||
String recepttime,String status
|
||||
String create_open_id,String operator_open_id,
|
||||
String recepttime,String status,String cid
|
||||
) {
|
||||
log.error("senTodoMessage start");
|
||||
String code = "";
|
||||
|
|
@ -110,8 +110,8 @@ public class Esb2FeishuSendFinishUtil {
|
|||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
department_id,department_name,
|
||||
createTimeStamp,archivingTimeStamp,
|
||||
formList,nodeId,nodeName,todoOpenIdList,
|
||||
mobileurl, pcurl,receptTimeStamp,status);
|
||||
formList,nodeId,nodeName,operator_open_id,
|
||||
mobileurl, pcurl,receptTimeStamp,status,cid);
|
||||
|
||||
log.error("feishu-finish:{}",bodyData);
|
||||
|
||||
|
|
@ -166,11 +166,12 @@ public class Esb2FeishuSendFinishUtil {
|
|||
List<Map<String, Object>> formList,
|
||||
String node_id,
|
||||
String nodeName,
|
||||
List<String> todoOpenIdList,
|
||||
String task_open_id,
|
||||
String mobileurl,
|
||||
String pcurl,
|
||||
String receptTimeStamp,
|
||||
String status
|
||||
String status,
|
||||
String cid
|
||||
){
|
||||
|
||||
|
||||
|
|
@ -203,21 +204,19 @@ public class Esb2FeishuSendFinishUtil {
|
|||
log.error("update_time:{}",String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
JSONArray taskListArray = new JSONArray();
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String task_open_id = String.valueOf(todoOpenIdList.get(i));
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
|
||||
// JSONArray actionConfigsArray = new JSONArray();
|
||||
// JSONObject actionConfigsJson = new JSONObject();
|
||||
|
|
@ -229,10 +228,9 @@ public class Esb2FeishuSendFinishUtil {
|
|||
// actionConfigsArray.add(actionConfigsJson);
|
||||
// taskListJson.put("action_configs",actionConfigsArray);
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
}
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
|
||||
bodyJson.put("task_list",taskListArray);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ public class Esb2FeishuSendTodoUtil {
|
|||
String creatorName, String createTime,
|
||||
String nodeId, String nodeName, String archivingTime,
|
||||
String degree,String mobileurl,String pcurl,
|
||||
String create_open_id,List<String> todoOpenIdList,
|
||||
String recepttime,String status
|
||||
String create_open_id,String operator_open_id,
|
||||
String recepttime,String status,String cid
|
||||
) {
|
||||
log.error("senTodoMessage start");
|
||||
String code = "";
|
||||
|
|
@ -105,8 +105,8 @@ public class Esb2FeishuSendTodoUtil {
|
|||
String bodyData = appendBodyParam(requestid,requestName,create_open_id,
|
||||
department_id,department_name,
|
||||
createTimeStamp,archivingTimeStamp,
|
||||
formList,nodeId,nodeName,todoOpenIdList,
|
||||
mobileurl, pcurl,receptTimeStamp,status);
|
||||
formList,nodeId,nodeName,operator_open_id,
|
||||
mobileurl, pcurl,receptTimeStamp,status,cid);
|
||||
|
||||
log.error("feishu-todo:{}",bodyData);
|
||||
|
||||
|
|
@ -161,11 +161,12 @@ public class Esb2FeishuSendTodoUtil {
|
|||
List<Map<String, Object>> formList,
|
||||
String node_id,
|
||||
String nodeName,
|
||||
List<String> todoOpenIdList,
|
||||
String task_open_id,
|
||||
String mobileurl,
|
||||
String pcurl,
|
||||
String receptTimeStamp,
|
||||
String status
|
||||
String status,
|
||||
String cid
|
||||
){
|
||||
|
||||
|
||||
|
|
@ -198,21 +199,19 @@ public class Esb2FeishuSendTodoUtil {
|
|||
log.error("update_time:{}",String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
JSONArray taskListArray = new JSONArray();
|
||||
for(int i=0;i<todoOpenIdList.size();i++){
|
||||
String task_open_id = String.valueOf(todoOpenIdList.get(i));
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
taskListJson.put("status",status);
|
||||
taskListJson.put("create_time",receptTimeStamp);
|
||||
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
taskListJson.put("end_time",archivingTimeStamp);
|
||||
taskListJson.put("update_time",String.valueOf(System.currentTimeMillis()));
|
||||
taskListJson.put("display_method",Constants.browser);
|
||||
taskListJson.put("exclude_statistics",Constants.excludeStatistics);
|
||||
|
||||
// JSONArray actionConfigsArray = new JSONArray();
|
||||
// JSONObject actionConfigsJson = new JSONObject();
|
||||
|
|
@ -224,11 +223,9 @@ public class Esb2FeishuSendTodoUtil {
|
|||
// actionConfigsArray.add(actionConfigsJson);
|
||||
// taskListJson.put("action_configs",actionConfigsArray);
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
}
|
||||
|
||||
taskListJson.put("node_id",node_id);
|
||||
taskListJson.put("node_name","@i18n@node");
|
||||
taskListArray.add(taskListJson);
|
||||
bodyJson.put("task_list",taskListArray);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,4 +16,9 @@ public class Constants {
|
|||
public static String applyUrl = "/api/item/sealAuthorize";
|
||||
|
||||
public static String finishUrl = "/api/item/finishWorkflowApply";
|
||||
|
||||
public static String sealTable = "uf_yzgl";
|
||||
|
||||
public static String applyerUserName = "admin";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.weaver.seconddev.chapanda.qunjie.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.qunjie.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.qunjie.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SealsManageDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(SealsManageDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sealid
|
||||
* @return
|
||||
*/
|
||||
public String querySealsDataBySealId(String sealid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String dataid = "";
|
||||
try{
|
||||
String dataSql =" select id from " + Constants.sealTable+
|
||||
" where sealid = ? and tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(sealid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
dataid = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return dataid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,8 @@ package com.weaver.seconddev.chapanda.qunjie.esb;
|
|||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuSendMessageUtil;
|
||||
import com.weaver.seconddev.chapanda.qunjie.util.Esb2QunjieCreateApplySealUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -16,36 +17,81 @@ public class Esb2QunjieCreateSealApplyAction implements EsbServerlessRpcRemoteIn
|
|||
private final static Logger log = LoggerFactory.getLogger(Esb2QunjieCreateSealApplyAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuSendMessageUtil esb2FeishuSendMessageUtil;
|
||||
Esb2QunjieCreateApplySealUtil esb2QunjieCreateApplySealUtil;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2FeishuSendMessageTxtAction start");
|
||||
|
||||
// String feishuHost = "https://open.feishu.cn";
|
||||
// String tokenUrl = "/open-apis/auth/v3/tenant_access_token/internal";
|
||||
// String feishuUrl = "/open-apis/im/v1/messages?receive_id_type=open_id";
|
||||
// String app_id = "cli_a8d0ee6b667dd00e";
|
||||
// String app_secret = "UjShC4eY7vCgHsQvFWZZleVdCqSEWGD0";
|
||||
String requestName = (String) params.get("requestName");
|
||||
String sealId = (String) params.get("sealId");
|
||||
String applyCount = (String) params.get("applyCount");
|
||||
String applyCrossPageSealCount = (String) params.get("applyCrossPageSealCount");
|
||||
log.error("requestName:{}",requestName);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("applyCount:{}",applyCount);
|
||||
log.error("applyCrossPageSealCount:{}",applyCrossPageSealCount);
|
||||
|
||||
String content = (String) params.get("content");
|
||||
String receiveId = (String) params.get("receiveId");
|
||||
log.error("content:{}",content);
|
||||
log.error("receiveId:{}",receiveId);
|
||||
String fileid = (String) params.get("fileid");
|
||||
|
||||
// String content = "测试发送文本消息";
|
||||
// String receiveId = "ou_8ff7816cfa8cda57643cac2a06fbdc7e";
|
||||
log.error("fileid:{}",fileid);
|
||||
|
||||
Map<String, Object> dataMap = esb2FeishuSendMessageUtil.senTextMessage(content,receiveId);
|
||||
if(StringUtils.isBlank(sealId)){
|
||||
return WeaResult.fail(500,"获取印章信息为空");
|
||||
}
|
||||
|
||||
String chat_id = (String) dataMap.get("chat_id");
|
||||
String message_id = (String) dataMap.get("message_id");
|
||||
if(StringUtils.isBlank(fileid)){
|
||||
return WeaResult.fail(500,"用印文件为空");
|
||||
}
|
||||
Long longFileId = 0L;
|
||||
try{
|
||||
longFileId = Long.valueOf(fileid);
|
||||
}catch (Exception e){
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
|
||||
if(longFileId <=0){
|
||||
return WeaResult.fail(500,"用印文件ID转换失败");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(applyCount) && StringUtils.isBlank(applyCrossPageSealCount)){
|
||||
return WeaResult.fail(500,"用印次数和骑缝章次数不能同时为空");
|
||||
}
|
||||
|
||||
int applyCountInt = 0;
|
||||
if(StringUtils.isNotBlank(applyCount)){
|
||||
applyCountInt = Integer.parseInt(applyCount);
|
||||
}
|
||||
int applyCrossPageSealCountInt = 0;
|
||||
if(StringUtils.isNotBlank(applyCrossPageSealCount)){
|
||||
applyCrossPageSealCountInt = Integer.parseInt(applyCrossPageSealCount);
|
||||
}
|
||||
if(applyCountInt <=0 && applyCrossPageSealCountInt <=0){
|
||||
return WeaResult.fail(500,"用印次数和骑缝章次数不能同时小等于0");
|
||||
}
|
||||
|
||||
Map<String, Object> dataMap = esb2QunjieCreateApplySealUtil.applySealRequest(requestName,sealId,applyCount,applyCrossPageSealCount,longFileId);
|
||||
|
||||
String applyId = String.valueOf(dataMap.get("applyId"));
|
||||
String workflowBaseId = String.valueOf(dataMap.get("workflowBaseId"));
|
||||
String formId = String.valueOf(dataMap.get("formId"));
|
||||
String applyNo = String.valueOf(dataMap.get("applyNo"));
|
||||
String safeCode = String.valueOf(dataMap.get("safeCode"));
|
||||
String vrCode = String.valueOf(dataMap.get("vrCode"));
|
||||
String status = String.valueOf(dataMap.get("status"));
|
||||
|
||||
if(StringUtils.isBlank(safeCode)){
|
||||
return WeaResult.fail(500,"用印申请流程创建失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","Esb2FeishuSendMessageTxtAction");
|
||||
actionMap.put("chat_id",chat_id);
|
||||
actionMap.put("message_id",message_id);
|
||||
|
||||
actionMap.put("msg","申请成功");
|
||||
actionMap.put("applyid",applyId);
|
||||
actionMap.put("workflowbaseid",workflowBaseId);
|
||||
actionMap.put("formid",formId);
|
||||
actionMap.put("applyno",applyNo);
|
||||
actionMap.put("safecode",safeCode);
|
||||
actionMap.put("vrcode",vrCode);
|
||||
actionMap.put("status",status);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.weaver.seconddev.chapanda.qunjie.esb;
|
|||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.qunjie.util.Esb2QunjieFinshSealApplyUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -26,16 +27,23 @@ public class Esb2QunjieFinshSealApplyAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("applyId:{}",applyId);
|
||||
log.error("sealId:{}",sealId);
|
||||
|
||||
Map<String, Object> dataMap = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId,sealId);
|
||||
if(StringUtils.isBlank(applyId)){
|
||||
return WeaResult.fail(500,"用印申请流程获取失败");
|
||||
}
|
||||
|
||||
String chat_id = (String) dataMap.get("chat_id");
|
||||
String message_id = (String) dataMap.get("message_id");
|
||||
if(StringUtils.isBlank(sealId)){
|
||||
return WeaResult.fail(500,"印章信息获取失败");
|
||||
}
|
||||
|
||||
String message = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId,sealId);
|
||||
if(StringUtils.isBlank(message)){
|
||||
return WeaResult.fail(500,"关闭授权失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","Esb2FeishuSendMessageTxtAction");
|
||||
actionMap.put("chat_id",chat_id);
|
||||
actionMap.put("message_id",message_id);
|
||||
actionMap.put("msg","关闭授权成功");
|
||||
actionMap.put("data",message);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ public class Esb2QunjieQuerySealBaseCron implements EsbServerlessRpcRemoteInterf
|
|||
@Autowired
|
||||
Esb2QunjieQuerySealUtil esb2QunjieQuerySealUtil;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2QunjieQuerySealBaseCron start");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import com.weaver.ebuilder.form.client.entity.data.*;
|
|||
import com.weaver.ebuilder.form.client.service.data.RemoteSimpleDataService;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.publishkit.api.util.PublishKitRuntimeUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.qunjie.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.qunjie.dao.FormFieldDao;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -28,7 +28,7 @@ public class EbuilderOperateUtils {
|
|||
@RpcReference(group = "ebuilderform")
|
||||
private RemoteSimpleDataService remoteSimpleDataService;
|
||||
|
||||
public EBDataChangeResult bacthInsertDbForm(String formTable,List<EBDataReqDto> datas) {
|
||||
public EBDataChangeResult bacthInsertEbForm(String formTable,List<EBDataReqDto> datas) {
|
||||
|
||||
log.error("bacthInsertDbForm");
|
||||
EBDataChangeResult ebDataChangeResult = new EBDataChangeResult();
|
||||
|
|
@ -152,4 +152,43 @@ public class EbuilderOperateUtils {
|
|||
// return ebDataChangeResult;
|
||||
// }
|
||||
|
||||
public EBDataChangeResult bacthEditEbForm(String formTable,List<EBDataReqDto> datas) {
|
||||
|
||||
EBDataChangeResult ebDataChangeResult = new EBDataChangeResult();
|
||||
|
||||
Map<String,Object> recordMap= formFieldDao.queryTableFormId(formTable);
|
||||
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
|
||||
if (StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)) {
|
||||
|
||||
RemoteSimpleDataService remoteSimpleDataService = publishKitRuntimeUtil.buildRpcService(RemoteSimpleDataService.class, "ebuilderform", appId);
|
||||
|
||||
/**
|
||||
* 直接通过id更新数据, 即update table set a = '11' where id = 1
|
||||
*/
|
||||
EBDataChangeReqDto ebDataChangeReqDto = new EBDataChangeReqDto();
|
||||
// 构建基础参数; objId 表单id, operator 操作人, tenantKey 租户
|
||||
ebDataChangeReqDto.setHeader(new EBDataReqHeader(formId, Constants.SysUserId, Constants.TENANT_KEY));
|
||||
// 请求操作信息
|
||||
EBDataReqOperation ebDataReqOperation = new EBDataReqOperation();
|
||||
ebDataReqOperation.setUpdateType(EBDataUpdateType.ids);
|
||||
// 若数据写入后就要从前台看到数据或者立即操作本次写入的数据, 需要调整后置处理为同步 权限处理完成再返回
|
||||
ebDataReqOperation.setAsyncPostProcess(false);
|
||||
ebDataChangeReqDto.setOperation(ebDataReqOperation);
|
||||
// 数据没有找到的时候是否新增数据
|
||||
EBDataReqOperationInfo ebDataReqOperationInfo = new EBDataReqOperationInfo();
|
||||
ebDataReqOperationInfo.setNeedAdd(true);
|
||||
ebDataReqOperation.setMainData(ebDataReqOperationInfo);
|
||||
ebDataChangeReqDto.setOperation(ebDataReqOperation);
|
||||
ebDataChangeReqDto.setDatas(datas);
|
||||
ebDataChangeResult = remoteSimpleDataService.updateFormData(ebDataChangeReqDto);
|
||||
}
|
||||
return ebDataChangeResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.weaver.seconddev.chapanda.qunjie.util;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.chapanda.qunjie.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -10,13 +13,12 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Component
|
||||
|
|
@ -26,60 +28,100 @@ public class Esb2QunjieCreateApplySealUtil {
|
|||
@Autowired
|
||||
private Esb2QunjieTokenUtil esb2QunjieTokenUtil;
|
||||
|
||||
public Map<String, Object> applySealRequest(String requestName,String sealId,String applyCount) {
|
||||
log.error("senCardMessage start");
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
|
||||
public Map<String, Object> applySealRequest(String requestName,String sealId,String applyCount,String applyCrossPageSealCount,Long fileid) {
|
||||
log.error("applySealRequest start");
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("title",requestName);
|
||||
bodyJson.put("applyerUserName","interactive");
|
||||
JSONArray usedSealParamList = new JSONArray();
|
||||
FileData fileData = fileDownloadService.downloadFile(fileid);
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName:{}",fileName);
|
||||
InputStream fileInputStream = null;
|
||||
try{
|
||||
fileInputStream = fileData.getInputStream();
|
||||
|
||||
JSONObject usedSealParam = new JSONObject();
|
||||
usedSealParam.put("sealId",sealId);
|
||||
usedSealParam.put("takeOut","0");
|
||||
usedSealParam.put("applyCount",applyCount);
|
||||
usedSealParamList.add(usedSealParam);
|
||||
if(fileInputStream.available() > 0) {
|
||||
|
||||
// {
|
||||
// "sealId": "5021257c-1002-491a-b111-6618914123f4",
|
||||
// "takeOut": "0",
|
||||
// "applyCount": "1"
|
||||
// }
|
||||
byte[] fileByte = convertInputStreamToBytes(fileInputStream);
|
||||
log.error("fileByte:{}",fileByte.length);
|
||||
|
||||
System.out.println("bodyJson:"+bodyJson.toJSONString());
|
||||
if(fileByte.length > 0){
|
||||
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
String chat_id = dataJson.getString("chat_id");
|
||||
String msg_type = dataJson.getString("msg_type");
|
||||
String message_id = dataJson.getString("message_id");
|
||||
String create_time = dataJson.getString("create_time");
|
||||
|
||||
messageMap.put("chat_id",chat_id);
|
||||
messageMap.put("msg_type",msg_type);
|
||||
messageMap.put("message_id",message_id);
|
||||
messageMap.put("create_time",create_time);
|
||||
// {
|
||||
// "title": "测试20250704",
|
||||
// "applyerUserName": "admin",
|
||||
// "callBackUrl": "baidu.com",
|
||||
// "usedSealParamList": [
|
||||
// {
|
||||
// "sealId": "4e22398d-0ab1-4226-8546-7f65f6f8622d",
|
||||
// "takeOut": "0",
|
||||
// "applyCount": "1"
|
||||
// }
|
||||
// ],
|
||||
// "option": {
|
||||
// "watermark": "1",
|
||||
// "preventWaterMark": "1"
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
JSONArray usedSealParamList = new JSONArray();
|
||||
JSONObject usedSealParam = new JSONObject();
|
||||
usedSealParam.put("sealId",sealId);
|
||||
usedSealParam.put("takeOut","0");
|
||||
usedSealParam.put("applyCount",applyCount);
|
||||
usedSealParam.put("applyCrossPageSealCount",applyCrossPageSealCount);
|
||||
usedSealParamList.add(usedSealParam);
|
||||
|
||||
JSONObject optionJson = new JSONObject();
|
||||
optionJson.put("watermark","1");
|
||||
optionJson.put("preventWaterMark","1");
|
||||
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("title",requestName);
|
||||
bodyJson.put("applyerUserName",Constants.applyerUserName);
|
||||
bodyJson.put("usedSealParamList",usedSealParamList);
|
||||
bodyJson.put("option",optionJson);
|
||||
|
||||
|
||||
log.error("bodyJson:"+bodyJson.toJSONString());
|
||||
String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token,fileName,fileByte);
|
||||
log.error("message:{}",message);
|
||||
messageMap = convertBodyDataToMap(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileInputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
if(fileInputStream !=null){
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return messageMap;
|
||||
}
|
||||
|
||||
public String doPostReqeustByOkHttp(String bodyData,String token){
|
||||
public String doPostReqeustByOkHttp(String bodyData,String token,String fileName,byte[] fileByte){
|
||||
String msg = "";
|
||||
|
||||
log.error("bodyData:{}",bodyData);
|
||||
log.error("fileByte:{}",fileByte.length);
|
||||
log.error("fileName:{}",fileName);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
|
|
@ -101,12 +143,12 @@ public class Esb2QunjieCreateApplySealUtil {
|
|||
// }
|
||||
// }
|
||||
|
||||
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
|
||||
.addFormDataPart("workflowApplyParam",bodyData)
|
||||
.addFormDataPart("file","E10二开.pdf", RequestBody.create(MediaType.parse("application/octet-stream"),new File("/Users/apple/Desktop/E10二开.pdf") ))
|
||||
.build();
|
||||
|
||||
try {
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
|
||||
.addFormDataPart("workflowApplyParam",bodyData)
|
||||
.addFormDataPart("file",encodedFileName, RequestBody.create(MediaType.parse("application/octet-stream"),fileByte))
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.qunjieHost+ Constants.applyUrl)
|
||||
.method("POST", body)
|
||||
|
|
@ -117,10 +159,88 @@ public class Esb2QunjieCreateApplySealUtil {
|
|||
log.error("code:{}",code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public byte[] convertInputStreamToBytes(InputStream inputStream) throws IOException {
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
||||
log.error("inputStream2:{}",inputStream.available());
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
byteStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
log.error("byteStream:{}",byteStream.toByteArray().length);
|
||||
|
||||
return byteStream.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> convertBodyDataToMap(String message) {
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("status")){
|
||||
String status = returnData.getString("status");
|
||||
log.error("status:"+status);
|
||||
if("0".equals(status)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
String applyId = dataJson.getString("applyId");
|
||||
String workflowBaseId = dataJson.getString("workflowBaseId");
|
||||
String formId = dataJson.getString("formId");
|
||||
String applyNo = dataJson.getString("applyNo");
|
||||
String safeCode = dataJson.getString("safeCode");
|
||||
String applyStatus = dataJson.getString("status");
|
||||
|
||||
log.error("applyId:{}",applyId);
|
||||
log.error("workflowBaseId:{}",workflowBaseId);
|
||||
log.error("formId:{}",formId);
|
||||
log.error("applyNo:{}",applyNo);
|
||||
log.error("safeCode:{}",safeCode);
|
||||
log.error("applyStatus:{}",applyStatus);
|
||||
if("null".equals(applyStatus)){
|
||||
applyStatus = "";
|
||||
}
|
||||
|
||||
String vrCode = "";
|
||||
if(dataJson.containsKey("usedSealParamList")){
|
||||
JSONArray usedSealParamArray = dataJson.getJSONArray("usedSealParamList");
|
||||
log.error("usedSealParamArray:{}",usedSealParamArray.size());
|
||||
for(int i=0;i<usedSealParamArray.size();i++){
|
||||
JSONObject usedSealJson = usedSealParamArray.getJSONObject(i);
|
||||
log.error("usedSealJson:{}",usedSealJson.toJSONString());
|
||||
if(usedSealJson.containsKey("takeOrPutQrCode")){
|
||||
JSONObject takeOrPutQrCode = usedSealJson.getJSONObject("takeOrPutQrCode");
|
||||
if(takeOrPutQrCode.containsKey("takeCode") || takeOrPutQrCode.containsKey("putCode")){
|
||||
JSONObject takeCode = takeOrPutQrCode.getJSONObject("takeCode");
|
||||
JSONObject putCode = takeOrPutQrCode.getJSONObject("putCode");
|
||||
if(takeCode.containsKey("vrCode")){
|
||||
vrCode = takeCode.getString("vrCode");
|
||||
}else if(putCode.containsKey("vrCode")){
|
||||
vrCode = putCode.getString("vrCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.error("vrCode:"+vrCode);
|
||||
|
||||
messageMap.put("applyId",applyId);
|
||||
messageMap.put("workflowBaseId",workflowBaseId);
|
||||
messageMap.put("formId",formId);
|
||||
messageMap.put("applyNo",applyNo);
|
||||
messageMap.put("safeCode",safeCode);
|
||||
messageMap.put("vrCode",vrCode);
|
||||
messageMap.put("status",applyStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return messageMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ public class Esb2QunjieFinshSealApplyUtil {
|
|||
@Autowired
|
||||
private Esb2QunjieTokenUtil esb2QunjieTokenUtil;
|
||||
|
||||
public Map<String, Object> finshApplyRquest(String applyId,String sealId) {
|
||||
public String finshApplyRquest(String applyId,String sealId) {
|
||||
log.error("senCardMessage start");
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
String timestamp = "";
|
||||
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
|
@ -42,25 +42,15 @@ public class Esb2QunjieFinshSealApplyUtil {
|
|||
String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
String chat_id = dataJson.getString("chat_id");
|
||||
String msg_type = dataJson.getString("msg_type");
|
||||
String message_id = dataJson.getString("message_id");
|
||||
String create_time = dataJson.getString("create_time");
|
||||
|
||||
messageMap.put("chat_id",chat_id);
|
||||
messageMap.put("msg_type",msg_type);
|
||||
messageMap.put("message_id",message_id);
|
||||
messageMap.put("create_time",create_time);
|
||||
|
||||
if(returnData.containsKey("status")){
|
||||
String status = returnData.getString("status");
|
||||
if("0".equals(status)){
|
||||
timestamp = returnData.getString("timestamp");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return messageMap;
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public String doPostReqeustByOkHttp(String bodyData,String token){
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.seconddev.chapanda.qunjie.dao.SealsManageDao;
|
||||
import com.weaver.seconddev.chapanda.qunjie.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.qunjie.dao.FormFieldDao;
|
||||
import okhttp3.*;
|
||||
|
|
@ -29,6 +30,10 @@ public class Esb2QunjieQuerySealUtil {
|
|||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
SealsManageDao sealsManageDao;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param token
|
||||
|
|
@ -38,13 +43,7 @@ public class Esb2QunjieQuerySealUtil {
|
|||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<Map<String,Object>> sealList = new ArrayList<Map<String,Object>>();
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, "{}");
|
||||
|
||||
String formTable = "uf_yzgl";
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("sealid");
|
||||
fieldList.add("orgNo");
|
||||
|
|
@ -54,16 +53,7 @@ public class Esb2QunjieQuerySealUtil {
|
|||
fieldList.add("sealNo");
|
||||
fieldList.add("yzzl");
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.qunjieHost+Constants.querySealUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
String msg = response.body().string();
|
||||
String msg = doPostReqeustByOkHttp(token);
|
||||
log.error("msg:"+msg);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
|
|
@ -117,7 +107,6 @@ public class Esb2QunjieQuerySealUtil {
|
|||
sealMap.put("sealNo",sealNo);
|
||||
sealMap.put("sealSurroundWord",sealSurroundWord);
|
||||
sealMap.put("orgNo",orgNo);
|
||||
|
||||
sealMap.put("blueNo",blueNo);
|
||||
sealMap.put("deviceTypeValue",deviceTypeValue);
|
||||
sealMap.put("isWarning",isWarning);
|
||||
|
|
@ -132,43 +121,124 @@ public class Esb2QunjieQuerySealUtil {
|
|||
log.error("sealList:"+sealList.size());
|
||||
|
||||
if(sealList.size()>0){
|
||||
List<EBDataReqDto> datas = new ArrayList<EBDataReqDto>();
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(formTable,fieldList);
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.sealTable,fieldList);
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
|
||||
for(int i=0;i<sealList.size();i++){
|
||||
Map<String,Object> dataMap = sealList.get(i);
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(fieldList.get(n).equals("yzzl")){
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, "2"));
|
||||
}else{
|
||||
if(dataMap.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataMap.get(fieldList.get(n)).toString();
|
||||
|
||||
String sealid = String.valueOf(dataMap.get("sealid"));
|
||||
String ufId = sealsManageDao.querySealsDataBySealId(sealid);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)) {
|
||||
log.error("修改");
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(fieldList.get(n).equals("yzzl")){
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, "2"));
|
||||
}else{
|
||||
if(dataMap.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataMap.get(fieldList.get(n)).toString();
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
|
||||
}else{
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(fieldList.get(n).equals("yzzl")){
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, "2"));
|
||||
}else{
|
||||
if(dataMap.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataMap.get(fieldList.get(n)).toString();
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
datas.add(ebDataReqDto);
|
||||
}
|
||||
EBDataChangeResult ebDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(formTable,datas);
|
||||
if(ebDataChangeResult.getStatus()){
|
||||
ebList = ebDataChangeResult.getDataIds();
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertEbForm(Constants.sealTable,addDatas);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(Constants.sealTable,updateDatas);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ebList;
|
||||
}
|
||||
|
||||
|
||||
public String doPostReqeustByOkHttp(String token){
|
||||
String msg = "";
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, "{}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.qunjieHost+Constants.querySealUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue