java110 лет назад: 2
Родитель
Сommit
a664bdfa18

+ 1 - 1
service-job/src/main/java/com/java110/job/adapt/fee/OweFeeCallableAdapt.java

@@ -119,7 +119,7 @@ public class OweFeeCallableAdapt extends DatabusAdaptImpl {
             content.put("payerObjName", oweFeeCallablePo.getPayerObjName());
             content.put("billAmountOwed", oweFeeCallablePo.getAmountdOwed());
             content.put("date", DateUtil.dateTimeToDate(oweFeeCallablePo.getStartTime()) + "~" + DateUtil.dateTimeToDate(oweFeeCallablePo.getEndTime()));
-            content.put("url", oweUrl);
+            content.put("url", oweUrl+oweFeeCallablePo.getPayerObjId());
             String notifyWay = MsgNotifyFactory.NOTIFY_WAY_WECHAT;
             if (OweFeeCallableDto.CALLABLE_WAY_SMS.equals(oweFeeCallablePo.getCallableWay())) {
                 notifyWay = MsgNotifyFactory.NOTIFY_WAY_ALI;

+ 2 - 0
service-job/src/main/java/com/java110/job/msgNotify/IWechatTemplate.java

@@ -22,4 +22,6 @@ public interface IWechatTemplate {
      * @return
      */
     String getAccessToken(String communityId);
+
+    String getAppId(String communityId);
 }

+ 24 - 0
service-job/src/main/java/com/java110/job/msgNotify/WechatTemplateImpl.java

@@ -267,4 +267,28 @@ public class WechatTemplateImpl implements IWechatTemplate {
 
         return accessToken;
     }
+
+    @Override
+    public String getAppId(String communityId) {
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setWeChatType(SmallWeChatDto.WECHAT_TYPE_PUBLIC);
+        smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
+        smallWeChatDto.setObjId(communityId);
+        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
+
+        if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) {
+            String appIdCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId");
+            String appSecretCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret");
+            String mchIdCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "mchId");
+            String keyCache = MappingCache.getValue(MappingConstant.WECHAT_STORE_DOMAIN, "key");
+            smallWeChatDto = new SmallWeChatDto();
+            smallWeChatDto.setAppId(appIdCache);
+            smallWeChatDto.setAppSecret(appSecretCache);
+            smallWeChatDto.setMchId(mchIdCache);
+            smallWeChatDto.setPayPassword(keyCache);
+        } else {
+            smallWeChatDto = smallWeChatDtos.get(0);
+        }
+        return smallWeChatDto.getAppId();
+    }
 }

+ 1 - 1
service-job/src/main/java/com/java110/job/msgNotify/wechat/WechatMsgNotifyImpl.java

@@ -183,7 +183,7 @@ public class WechatMsgNotifyImpl implements IMsgNotify {
         data.put("amount3",new Content(content.getString("billAmountOwed")));
         data.put("time19",new Content(content.getString("date")));
         templateMessage.setData(data);
-        templateMessage.setUrl(content.getString("url"));
+        templateMessage.setUrl(content.getString("url")+"&wAppId="+wechatTemplateImpl.getAppId(communityId));
         logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage));
         ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class);
         logger.info("微信模板返回内容:{}", responseEntity);