|
@@ -8,10 +8,7 @@ import com.platform.common.constant.CommonConstants;
|
|
import com.platform.common.constant.RedisKeyConstants;
|
|
import com.platform.common.constant.RedisKeyConstants;
|
|
import com.platform.common.enums.DictTypeEnum;
|
|
import com.platform.common.enums.DictTypeEnum;
|
|
import com.platform.common.exception.BusinessException;
|
|
import com.platform.common.exception.BusinessException;
|
|
-import com.platform.common.util.HttpUtil;
|
|
|
|
-import com.platform.common.util.RedisUtils;
|
|
|
|
-import com.platform.common.util.ShaUtil;
|
|
|
|
-import com.platform.common.util.StringUtils;
|
|
|
|
|
|
+import com.platform.common.util.*;
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
import com.platform.service.wechat.model.request.template.WechatTemplateRequest;
|
|
import com.platform.service.wechat.model.request.template.WechatTemplateRequest;
|
|
import com.platform.service.wechat.model.request.token.WechatTicketToken;
|
|
import com.platform.service.wechat.model.request.token.WechatTicketToken;
|
|
@@ -177,6 +174,10 @@ public class WeChatConnectService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
|
+ postTemplate(new WechatTemplateRequest());
|
|
|
|
+ }
|
|
|
|
+
|
|
/***
|
|
/***
|
|
* 发送模版消息
|
|
* 发送模版消息
|
|
*
|
|
*
|
|
@@ -184,9 +185,15 @@ public class WeChatConnectService {
|
|
* 请求json数据
|
|
* 请求json数据
|
|
* @return 返回消息 WechatTemplateResponse
|
|
* @return 返回消息 WechatTemplateResponse
|
|
*/
|
|
*/
|
|
- public static WechatTemplateResponse postTemplate(WechatTemplateRequest request) {
|
|
|
|
|
|
+ public static WechatTemplateResponse postTemplate(WechatTemplateRequest request) throws IOException {
|
|
log.info("获取微信token");
|
|
log.info("获取微信token");
|
|
- String token = getToken();
|
|
|
|
|
|
+ String resp = HttpUtil.get("http://buy.catlsc.com:6688/api/common/wechat/token/sb");
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(resp);
|
|
|
|
+ log.info("获取token返回数据:"+jsonObject);
|
|
|
|
+ if (Integer.parseInt(jsonObject.get("code").toString())!=0){
|
|
|
|
+ throw new BusinessException("token获取失败!");
|
|
|
|
+ }
|
|
|
|
+ String token = jsonObject.get("data").toString();
|
|
if(StringUtils.isBlank(token)){
|
|
if(StringUtils.isBlank(token)){
|
|
log.info("发送模板消息时,获取token失败");
|
|
log.info("发送模板消息时,获取token失败");
|
|
}
|
|
}
|