待办同步到旗舰版
This commit is contained in:
parent
570d68d8e5
commit
6ae501a325
|
|
@ -1,6 +1,5 @@
|
|||
package nc.impl.baseapp.ds;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import nc.api.arap.resource.IgnoreSslUtil;
|
||||
|
|
@ -89,6 +88,61 @@ public class DSMessageService {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addMessage(String add, NCCApproveMessageVO approveMessageVO) throws IOException, NoSuchAlgorithmException, InvalidKeyException, BusinessException {
|
||||
Map<String, String> bipParamMap = checkBipParam("BIP-sq");
|
||||
if (bipParamMap.isEmpty()) {
|
||||
Logger.error("SyncSrmDSMessageService-bipParamMap is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject reqData=new JSONObject();
|
||||
// reqData.put("donePK", donePK);
|
||||
Date date=new Date();
|
||||
Random rand = new Random();
|
||||
reqData.put("srcMsgId", "YS:"+date+add);
|
||||
|
||||
reqData.put("businessKey", "YS_"+approveMessageVO.getPk_detail());
|
||||
reqData.put("yyUserIds",new String[]{ approveMessageVO.getDef5()});
|
||||
reqData.put("appId", bipParamMap.get("appid"));
|
||||
|
||||
reqData.put("title", approveMessageVO.getSubject());
|
||||
reqData.put("content", approveMessageVO.getSubject());
|
||||
reqData.put("mUrl",approveMessageVO.getDef3());
|
||||
reqData.put("webUrl",approveMessageVO.getDef4());
|
||||
if (bipParamMap.isEmpty()) {
|
||||
Logger.error("SyncSrmDSMessageService-bipParamMap is empty");
|
||||
return;
|
||||
}
|
||||
baseUrl = bipParamMap.get("baseUrl");
|
||||
appKey = bipParamMap.get("srmappkey");
|
||||
appSecret = bipParamMap.get("appSecret");
|
||||
toBipUrl = bipParamMap.get("ipuPuReqQuery");
|
||||
String accessToken= getAccessToken(baseUrl,bipParamMap);
|
||||
if (accessToken != "") {
|
||||
Map<String, String> tokenParam = new HashMap<>();
|
||||
tokenParam.put("access_token", accessToken);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
|
||||
Logger.error("SyncDSMessageService-param = " + reqData.toString());
|
||||
String url = baseUrl + "/iuap-api-gateway/yonbip/uspace/rest/openapi/idempotent/todo/push";
|
||||
// String resultString = doPost(url,reqData );
|
||||
|
||||
String resultString = doSendHttp(url, "POST", tokenParam, "", headers,reqData.toString()
|
||||
);
|
||||
Gson gson = new Gson();
|
||||
Logger.error("SyncDSMessageService-res = " + resultString);
|
||||
Map updateMap = gson.fromJson(resultString, Map.class);
|
||||
if ("200".equals(updateMap.get("code"))) {// 保存更新成功后需要更新日志表
|
||||
// getSuperDMO().updateArray(saleOrderHVOList.toArray(new SaleOrderHVO[0]));
|
||||
} else {
|
||||
throw new BusinessException("【"+updateMap.get("message")+"】");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static String doSendHttp(String baseUrl, String method, Map<String, String> paramMap, String mediaType,
|
||||
Map<String, String> headers, String json) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
package nc.impl.baseapp.task;
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.pub.pa.PreAlertObject;
|
||||
import nc.bs.pub.taskcenter.BgWorkingContext;
|
||||
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.impl.baseapp.ds.DSMessageService;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDateTime;
|
||||
import nccloud.message.vo.NCCApproveMessageVO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时同步待办已办到先行通
|
||||
*/
|
||||
public class SyncNeedTodoToXXTTask implements IBackgroundWorkPlugin{
|
||||
private static final String LOG_INFO_NAME = "dldzlog";
|
||||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
||||
private HYSuperDMO superDMO = null;
|
||||
private String appKey = "";
|
||||
private String appSecret = "";
|
||||
private String baseUrl = "";
|
||||
private String tokenUrl = "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken";
|
||||
private String toBipUrl = "";
|
||||
private Integer num = 0;
|
||||
@Override
|
||||
public PreAlertObject executeTask(BgWorkingContext context) throws BusinessException {
|
||||
|
||||
DSMessageService messageService=new DSMessageService();
|
||||
List<NCCApproveMessageVO> approveMessageVOs= queryNCCApproveMessages();
|
||||
if(approveMessageVOs!=null&&!approveMessageVOs.isEmpty()) {
|
||||
for(NCCApproveMessageVO approveMessageVO:approveMessageVOs) {
|
||||
try {
|
||||
messageService.addMessage(String.valueOf(num),approveMessageVO);
|
||||
num++;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
num=0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private List<NCCApproveMessageVO> queryNCCApproveMessages() throws BusinessException{
|
||||
String query = "\t SELECT * from V_BIP_TODOMESSAGE";
|
||||
List<NCCApproveMessageVO> approveMessageVOs=new ArrayList<>();
|
||||
BaseDAO dao = new BaseDAO();
|
||||
List<Map<String,Object>> approveMessages = (List<Map<String,Object>>)dao.executeQuery(query, new MapListProcessor());
|
||||
if(approveMessages!=null&&!approveMessages.isEmpty()) {
|
||||
for(Map<String,Object> approveMessage:approveMessages) {
|
||||
String pk_detail = (String)approveMessage.get("pk_detail");
|
||||
String sender = (String)approveMessage.get("sender");
|
||||
String subject = (String)approveMessage.get("subject");
|
||||
NCCApproveMessageVO approveMessageVO=new NCCApproveMessageVO();
|
||||
approveMessageVO.setSender(sender);
|
||||
String receiver = (String)approveMessage.get("receiver");
|
||||
approveMessageVO.setReceiver(receiver);
|
||||
approveMessageVO.setPk_detail(pk_detail);
|
||||
approveMessageVO.setSubject(subject);
|
||||
approveMessageVO.setTs(new UFDateTime());
|
||||
approveMessageVO.setPk_detail(pk_detail);
|
||||
approveMessageVOs.add(approveMessageVO);
|
||||
String mmurl=null;
|
||||
if(approveMessage.get("mmurl")!=null) {
|
||||
mmurl=(String)approveMessage.get("mmurl");
|
||||
}else {
|
||||
if(approveMessage.get("systemcode")==null) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
// mmurl=String.format("https://c1.yonyoucloud.com/yonbip-ec-commonapprove/ucf-wh/mobileApprove/index.html#/detail?status=${donestatus}&code=${esncode}&taskId=%s&deftabtitle=tasktitle&apsys=NC&openAppId=1055&moduleCode=%s&tenantId=jq10k8j1", approveMessage.get("pk_detail"),approveMessage.get("systemcode").toString().toLowerCase());
|
||||
}
|
||||
String webUrl=null;
|
||||
if(approveMessage.get("weburl")!=null) {
|
||||
webUrl=(String)approveMessage.get("weburl");
|
||||
}else {
|
||||
continue;
|
||||
// webUrl=String.format("https://c1.yonyoucloud.com/yonbip-ec-commonapprove/ucf-wh/webapprove/index.html?status=${donestatus}&code=${esncode}&taskId=%s&deftabtitle=tasktitle&apsys=NC&openAppId=1055&moduleCode=%s&tenantId=jq10k8j1#/detail", approveMessage.get("pk_detail"),approveMessage.get("systemcode").toString().toLowerCase());
|
||||
}
|
||||
approveMessageVO.setDef3(mmurl);
|
||||
approveMessageVO.setDef4(webUrl);
|
||||
approveMessageVO.setDef5((String)approveMessage.get("yyuserids"));
|
||||
approveMessageVOs.add(approveMessageVO);
|
||||
}
|
||||
}
|
||||
return approveMessageVOs;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue