| 
package com.doumee.core.wx.wxPlat; 
 | 
  
 | 
import com.doumee.biz.system.SystemDictDataBiz; 
 | 
import com.doumee.core.utils.Constants; 
 | 
import me.chanjar.weixin.mp.api.WxMpService; 
 | 
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; 
 | 
import me.chanjar.weixin.mp.config.WxMpConfigStorage; 
 | 
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.context.annotation.Bean; 
 | 
import org.springframework.context.annotation.Configuration; 
 | 
  
 | 
/** 
 | 
 * Created by IntelliJ IDEA. 
 | 
 * 
 | 
 * @Author : Rk 
 | 
 * @create 2023/12/27 9:30 
 | 
 */ 
 | 
//@Configuration 
 | 
public class WxPlatConfig { 
 | 
  
 | 
    @Autowired 
 | 
    private SystemDictDataBiz systemDictDataBiz; 
 | 
  
 | 
//    @Bean 
 | 
    public WxMpConfigStorage wxMpConfigStorage() { 
 | 
        WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); 
 | 
        // 公众号appId 
 | 
        configStorage.setAppId(systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_APPID).getCode()); 
 | 
        // 公众号appSecret 
 | 
        configStorage.setSecret(systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_SECRET).getCode()); 
 | 
        // 公众号Token 
 | 
        configStorage.setToken(systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode()); 
 | 
        // 公众号EncodingAESKey 
 | 
//        configStorage.setAesKey(); 
 | 
        return configStorage; 
 | 
    } 
 | 
  
 | 
  
 | 
    /** 
 | 
     * 声明实例 
 | 
     * 
 | 
     * @return 
 | 
     */ 
 | 
//    @Bean 
 | 
    public WxMpService wxMpService() { 
 | 
        WxMpService wxMpService = new WxMpServiceImpl(); 
 | 
        wxMpService.setWxMpConfigStorage(wxMpConfigStorage()); 
 | 
        return wxMpService; 
 | 
    } 
 | 
  
 | 
} 
 |