|
@@ -70,7 +70,7 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
Long id = message.getId();
|
|
Long id = message.getId();
|
|
|
|
|
|
|
|
//从系统参数中获取以下参数值
|
|
//从系统参数中获取以下参数值
|
|
|
- Map<String, Object> sysCtrlParamMap = sysCtrlParam();
|
|
|
|
|
|
|
+ Map<String, Object> sysCtrlParamMap = sysCtrlParam(entityNumber);
|
|
|
//微信获取token地址
|
|
//微信获取token地址
|
|
|
String url = (String) sysCtrlParamMap.get("nckd_tokenurl");
|
|
String url = (String) sysCtrlParamMap.get("nckd_tokenurl");
|
|
|
//公众号appid
|
|
//公众号appid
|
|
@@ -107,17 +107,17 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(accessToken)){
|
|
if(!StringUtils.isEmpty(accessToken)){
|
|
|
//微信公众号模板消息接口url 配置成参数
|
|
//微信公众号模板消息接口url 配置成参数
|
|
|
- url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
|
|
|
|
|
|
+ url = (String) sysCtrlParamMap.get("nckd_msgurl");
|
|
|
url = url+accessToken;
|
|
url = url+accessToken;
|
|
|
//模板消息接口请求参数
|
|
//模板消息接口请求参数
|
|
|
Map<String,Object> requestJson = new HashMap<>();
|
|
Map<String,Object> requestJson = new HashMap<>();
|
|
|
requestJson.put("template_id",templateid);
|
|
requestJson.put("template_id",templateid);
|
|
|
- //采购订单 跳转路径
|
|
|
|
|
-// String testUrl = "http://erp-test.jxctly.com/ierp/mobile.html?form=mobsp_purorderview&accountId="+ RequestContext.get().getAccountId()+"&pkId="+message.getBizDataId();
|
|
|
|
|
- //对账单 跳转路径
|
|
|
|
|
- String testUrl = "http://erp-test.jxctly.com/ierp/mobile.html?form=mobsp_checkaccountview&accountId="+ RequestContext.get().getAccountId()+"&pkId="+message.getBizDataId();
|
|
|
|
|
-// String testUrl = "http://erp-test.jxctly.com/ierp/mobile.html?form=mobsp_checkaccountlist&accountId="+ RequestContext.get().getAccountId()+"&pkId="+message.getBizDataId();
|
|
|
|
|
- requestJson.put("url",testUrl);
|
|
|
|
|
|
|
+ //微信公众号对应跳转信息
|
|
|
|
|
+ Map<String, String> nckdRes = getResMap(entityNumber, (String) sysCtrlParamMap.get("nckd_res"));
|
|
|
|
|
+ nckdRes.get("nckd_rescode");
|
|
|
|
|
+ //拼接跳转路径
|
|
|
|
|
+ String msgUrl = "http://erp-test.jxctly.com/ierp/mobile.html?form="+nckdRes.get("nckd_rescode")+"&accountId="+ RequestContext.get().getAccountId()+"&pkId="+bizDataId;
|
|
|
|
|
+ requestJson.put("url",msgUrl);
|
|
|
requestJson.put("client_msg_id",id);
|
|
requestJson.put("client_msg_id",id);
|
|
|
//组装data参数
|
|
//组装data参数
|
|
|
JSONObject dataJson = madeJsonObject(entityNumber,bizDataId);
|
|
JSONObject dataJson = madeJsonObject(entityNumber,bizDataId);
|
|
@@ -161,6 +161,7 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 组装Json
|
|
* 组装Json
|
|
|
* @param entityNumber
|
|
* @param entityNumber
|
|
@@ -191,6 +192,12 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
dataJson.put("orderNumber", orderNumberObj);
|
|
dataJson.put("orderNumber", orderNumberObj);
|
|
|
return dataJson;
|
|
return dataJson;
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询表单对象
|
|
|
|
|
+ * @param entityNumber
|
|
|
|
|
+ * @param bizDataId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
private Map<String, String> queryEntityObject(String entityNumber, Long bizDataId) {
|
|
private Map<String, String> queryEntityObject(String entityNumber, Long bizDataId) {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
@@ -222,8 +229,10 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
return openid;
|
|
return openid;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //获取公共参数
|
|
|
|
|
- private Map<String, Object> sysCtrlParam() {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取公共参数
|
|
|
|
|
+ */
|
|
|
|
|
+ private Map<String, Object> sysCtrlParam(String entityNumber) {
|
|
|
//获取采购应用参数
|
|
//获取采购应用参数
|
|
|
Map<String, Object> sysCtrlParamMap = ParamUtils.getSysCtrlParameter(ParamUtils.PM);
|
|
Map<String, Object> sysCtrlParamMap = ParamUtils.getSysCtrlParameter(ParamUtils.PM);
|
|
|
//微信获取token地址
|
|
//微信获取token地址
|
|
@@ -234,6 +243,29 @@ public class SendMsgToWeChatOA extends AbstractMessageServiceHandler {
|
|
|
sysCtrlParamMap.get("nckd_appsecret");
|
|
sysCtrlParamMap.get("nckd_appsecret");
|
|
|
//公众号模板消息 模板id
|
|
//公众号模板消息 模板id
|
|
|
sysCtrlParamMap.get("nckd_textfield");
|
|
sysCtrlParamMap.get("nckd_textfield");
|
|
|
|
|
+ //模板消息接口url
|
|
|
|
|
+ sysCtrlParamMap.get("nckd_msgurl");
|
|
|
|
|
+ //对应跳转信息
|
|
|
|
|
+ sysCtrlParamMap.get("nckd_res");
|
|
|
return sysCtrlParamMap;
|
|
return sysCtrlParamMap;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取采购应用参数
|
|
|
|
|
+ * @param entityNumber
|
|
|
|
|
+ * @param resStr
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Map<String, String> getResMap(String entityNumber, String resStr) {
|
|
|
|
|
+ if (StringUtils.isEmpty(resStr)) {
|
|
|
|
|
+ throw new KDBizException("请前往系统参数-应用-供应链云-采购应用参数 对应跳转信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ //资源代号信息
|
|
|
|
|
+ Map<String, String> res = ((List<Map<String, String>>) JSONObject.parseObject(resStr, List.class))
|
|
|
|
|
+ .stream().filter(it -> it.get("nckd_rescaption").equals(entityNumber)).findAny().orElse(null);
|
|
|
|
|
+ if (null == res) {
|
|
|
|
|
+ throw new KDBizException("请前往系统参数-应用-供应链云-采购应用参数 对应跳转信息,配置供应商协同页面标识");
|
|
|
|
|
+ }
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|