diff --git a/austin-handler/pom.xml b/austin-handler/pom.xml
index eb6ef31..94ca8bb 100644
--- a/austin-handler/pom.xml
+++ b/austin-handler/pom.xml
@@ -41,16 +41,7 @@
com.sun.mail
javax.mail
-
-
- com.github.binarywang
- weixin-java-mp
-
-
-
- com.github.binarywang
- weixin-java-miniapp
-
+
diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/wechat/impl/OfficialAccountServiceImpl.java b/austin-handler/src/main/java/com/java3y/austin/handler/wechat/impl/OfficialAccountServiceImpl.java
index a4359d2..6ce3703 100644
--- a/austin-handler/src/main/java/com/java3y/austin/handler/wechat/impl/OfficialAccountServiceImpl.java
+++ b/austin-handler/src/main/java/com/java3y/austin/handler/wechat/impl/OfficialAccountServiceImpl.java
@@ -1,10 +1,10 @@
package com.java3y.austin.handler.wechat.impl;
-import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.WeChatOfficialAccount;
import com.java3y.austin.handler.domain.wechat.WeChatOfficialParam;
import com.java3y.austin.handler.wechat.OfficialAccountService;
import com.java3y.austin.support.utils.AccountUtils;
+import com.java3y.austin.support.utils.WxServiceUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
@@ -31,8 +31,8 @@ public class OfficialAccountServiceImpl implements OfficialAccountService {
@Override
public List send(WeChatOfficialParam officialParam) throws Exception {
- WeChatOfficialAccount officialAccount = accountUtils.getAccountById(officialParam.getSendAccount(),WeChatOfficialAccount.class);
- WxMpService wxMpService = initService(officialAccount);
+ WxMpService wxMpService = WxServiceUtils.wxMpServiceMap.get(officialParam.getSendAccount());
+ WeChatOfficialAccount officialAccount = WxServiceUtils.accountHashMap.get(officialParam.getSendAccount());
List messages = assembleReq(officialParam, officialAccount);
List messageIds = new ArrayList<>(messages.size());
for (WxMpTemplateMessage wxMpTemplateMessage : messages) {
diff --git a/austin-support/pom.xml b/austin-support/pom.xml
index f6dfb2b..0a20790 100644
--- a/austin-support/pom.xml
+++ b/austin-support/pom.xml
@@ -94,21 +94,31 @@
dynamic-tp-spring-boot-starter-apollo
-
- com.aliyun
- alibaba-dingtalk-service-sdk
-
org.springframework.amqp
spring-rabbit
-
com.alibaba.boot
nacos-config-spring-boot-starter
+
+ com.aliyun
+ alibaba-dingtalk-service-sdk
+
+
+
+ com.github.binarywang
+ weixin-java-mp
+
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+
+
\ No newline at end of file
diff --git a/austin-support/src/main/java/com/java3y/austin/support/utils/WxServiceUtils.java b/austin-support/src/main/java/com/java3y/austin/support/utils/WxServiceUtils.java
new file mode 100644
index 0000000..cc39aba
--- /dev/null
+++ b/austin-support/src/main/java/com/java3y/austin/support/utils/WxServiceUtils.java
@@ -0,0 +1,60 @@
+package com.java3y.austin.support.utils;
+
+
+import com.alibaba.fastjson.JSON;
+import com.java3y.austin.common.constant.CommonConstant;
+import com.java3y.austin.common.dto.account.WeChatOfficialAccount;
+import com.java3y.austin.common.enums.ChannelType;
+import com.java3y.austin.support.dao.ChannelAccountDao;
+import com.java3y.austin.support.domain.ChannelAccount;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
+import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 微信服务号/微信小程序 工具类
+ *
+ * @author 3y
+ */
+@Component
+@Slf4j
+public class WxServiceUtils {
+
+ public static Map wxMpServiceMap = new HashMap<>();
+ public static Map accountHashMap = new HashMap<>();
+
+ @Autowired
+ private ChannelAccountDao channelAccountDao;
+
+ @PostConstruct
+ public void init() {
+ List officialAccountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.OFFICIAL_ACCOUNT.getCode());
+ for (ChannelAccount channelAccount : officialAccountList) {
+ WeChatOfficialAccount weChatOfficialAccount = JSON.parseObject(channelAccount.getAccountConfig(), WeChatOfficialAccount.class);
+ wxMpServiceMap.put(channelAccount.getId(), initService(weChatOfficialAccount));
+ accountHashMap.put(channelAccount.getId(), weChatOfficialAccount);
+ }
+ }
+
+ /**
+ * 初始化微信服务号
+ *
+ * @return
+ */
+ public WxMpService initService(WeChatOfficialAccount officialAccount) {
+ WxMpService wxMpService = new WxMpServiceImpl();
+ WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
+ config.setAppId(officialAccount.getAppId());
+ config.setSecret(officialAccount.getSecret());
+ wxMpService.setWxMpConfigStorage(config);
+ return wxMpService;
+ }
+}
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
index f1f5e0e..c6c393d 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
@@ -6,6 +6,7 @@ import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.web.service.ChannelAccountService;
+import com.java3y.austin.web.vo.amis.CommonAmisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -47,14 +48,12 @@ public class ChannelAccountController {
@GetMapping("/queryByChannelType")
@ApiOperation("/根据渠道标识查询相关的记录")
public BasicResultVO query(Integer channelType) {
- List channelAccounts = channelAccountService.queryByChannelType(channelType);
+ List result = new ArrayList<>();
- List