wuxw
2023-11-01 7fca0ff445f4c19d547daf71b47201505cb2b9c0
service-job/src/main/java/com/java110/job/msgNotify/WechatTemplateImpl.java
@@ -267,4 +267,28 @@
        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();
    }
}