Browse Source

流程发送通知调整

wangqiang 8 months ago
parent
commit
e7aece4357

+ 1 - 0
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/FlowableTaskController.java

@@ -34,6 +34,7 @@ import com.jeeplus.flowable.vo.ProcessVo;
 import com.jeeplus.mail.feign.IMailApi;
 import com.jeeplus.sys.feign.IUserApi;
 import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.weChat.util.HttpUtils;
 import com.jeeplus.weChat.util.SendMessageUtil;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;

+ 1 - 0
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/weChat/controller/ProxyController.java

@@ -94,4 +94,5 @@ public class ProxyController {
 
 //    这是测试号在微信开发者工具里面的 地址
 //    https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx96885ba58675d910&redirect_uri=http%3A%2F%2Fxrd3cp.natappfree.cc%2Fh5%2F&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
+//    https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa79f618dcaf992f7&redirect_uri=http%3A%2F%2Fkqe4km.natappfree.cc%2Fh5%2F&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
 }

+ 1 - 1
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/weChat/controller/WeChatController.java

@@ -76,7 +76,7 @@ public class WeChatController {
      * 微信授权登录
      */
     @GetMapping( value = "/authorize")
-    public String authorize(@RequestParam(value = "returnUrl", defaultValue = "http://gfnu5c.natappfree.cc/") String returnUrl) throws UnsupportedEncodingException {
+    public String authorize(@RequestParam(value = "returnUrl", defaultValue = "http://kqe4km.natappfree.cc/") String returnUrl) throws UnsupportedEncodingException {
         log.info("【微信网页授权】进来了,参数={}", returnUrl);
         System.out.println("进来了:" + returnUrl);
         //1. 配置

+ 30 - 25
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/weChat/service/WxSendService.java

@@ -67,41 +67,46 @@ public class WxSendService {
         //拿到accessToken
         String accessToken = HttpUtils.dogetToken();
 
-        //发送模板消息开始
-        TranTemplate tranTemplate = new TranTemplate();
-        //设置接收人的openid(当前登录人的openid)
+        String result = "";
 
-        tranTemplate.setTouser(resource.getOpenid());
+        if ( null != accessToken ) {
+            //发送模板消息开始
+            TranTemplate tranTemplate = new TranTemplate();
+            //设置接收人的openid(当前登录人的openid)
 
-        tranTemplate.setUrl(resource.getUrl());
+            tranTemplate.setTouser(resource.getOpenid());
 
-        //设置模板ID
-        tranTemplate.setTemplate_id("ehTUuyDFL7f2RApsMXLsJEPlCgt82aTj2vtmO2l9Cso");
-        //给模板的内容赋值
-        Map<String , TemplateInfo> dataMap = new HashMap<>();
+            tranTemplate.setUrl(resource.getUrl());
 
-        TemplateInfo title = new TemplateInfo(resource.getTitleName(),"#173177");
-        dataMap.put("title",title);
+            //设置模板ID
+            tranTemplate.setTemplate_id("ehTUuyDFL7f2RApsMXLsJEPlCgt82aTj2vtmO2l9Cso");
+            //给模板的内容赋值
+            Map<String , TemplateInfo> dataMap = new HashMap<>();
 
-        TemplateInfo processName = new TemplateInfo(resource.getProcessName(),"#173177");
-        dataMap.put("processName",processName);
+            TemplateInfo title = new TemplateInfo(resource.getTitleName(),"#173177");
+            dataMap.put("title",title);
 
-        TemplateInfo currentStage = new TemplateInfo(resource.getCurrentStage(),"#173177");
-        dataMap.put("currentStage",currentStage);
+            TemplateInfo processName = new TemplateInfo(resource.getProcessName(),"#173177");
+            dataMap.put("processName",processName);
 
-        TemplateInfo processInitiator = new TemplateInfo(resource.getProcessInitiator(),"#173177");
-        dataMap.put("processInitiator",processInitiator);
+            TemplateInfo currentStage = new TemplateInfo(resource.getCurrentStage(),"#173177");
+            dataMap.put("currentStage",currentStage);
 
-        TemplateInfo createTime = new TemplateInfo(resource.getCreateTime(),"#173177");
-        dataMap.put("createTime",createTime);
+            TemplateInfo processInitiator = new TemplateInfo(resource.getProcessInitiator(),"#173177");
+            dataMap.put("processInitiator",processInitiator);
 
-        tranTemplate.setData(dataMap);
+            TemplateInfo createTime = new TemplateInfo(resource.getCreateTime(),"#173177");
+            dataMap.put("createTime",createTime);
+
+            tranTemplate.setData(dataMap);
+
+            JSONObject jsonObject = JSONUtil.parseObj(tranTemplate);
+            //将入参转为字符串
+            String jsonParam = jsonObject.toString();
+            //发起请求发送模板信息
+            result = HttpUtils.requestPost(sendTemplateUrl + accessToken, jsonParam);
+        }
 
-        JSONObject jsonObject = JSONUtil.parseObj(tranTemplate);
-        //将入参转为字符串
-        String jsonParam = jsonObject.toString();
-        //发起请求发送模板信息
-        String result = HttpUtils.requestPost(sendTemplateUrl + accessToken, jsonParam);
 
         return  result;
     }

File diff suppressed because it is too large
+ 2 - 2
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/weChat/util/SendMessageUtil.java