|
@@ -0,0 +1,35 @@
|
|
|
+package cn.com.ctop.common.module.service.impl;
|
|
|
+
|
|
|
+import cn.com.ctop.common.module.service.ICorpWeixinService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import lombok.val;
|
|
|
+import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
+import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
|
|
|
+import me.chanjar.weixin.cp.api.WxCpService;
|
|
|
+import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
|
|
|
+import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
|
|
+import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class CorpWeixinServiceImpl implements ICorpWeixinService {
|
|
|
+ public static void main(String[] args){
|
|
|
+ val configStorage = new WxCpDefaultConfigImpl();
|
|
|
+ configStorage.setCorpId("ww24b8a47826f5875f");
|
|
|
+ configStorage.setAgentId(1000002);
|
|
|
+ configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
|
|
|
+ configStorage.setToken("hcst2019");
|
|
|
+ configStorage.setAesKey("hcst2019");
|
|
|
+ val service = new WxCpServiceImpl();
|
|
|
+ service.setWxCpConfigStorage(configStorage);
|
|
|
+ WxCpOAuth2Service wxCpOAuth2Service = new WxCpOAuth2ServiceImpl(service);
|
|
|
+ try {
|
|
|
+ wxCpOAuth2Service.getUserInfo(1000002,"");
|
|
|
+ }catch (WxErrorException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|