Commit 65e8a3f5 by 徐高华

企微托管

parent 4c735ce4
......@@ -291,7 +291,11 @@ public class OpenStaffServiceImpl implements OpenStaffService {
List<TabOpenStaff> staffList = this.openStaffMapper.listAllOnline(wxEnterpriseId, enterpriseId);
if(CollectionUtils.isNotEmpty(staffList)) {
staffList.forEach(o->{
this.logout(o.getUuid(),"服务过期",0,null);
try {
this.logout(o.getUuid(), "服务过期", 0, null);
}catch (Exception e) {
log.info("异常",e);
}
});
}
}
......
package com.gic.haoban.manage.service.util;
import com.gic.commons.switcher.Switcher;
import com.gic.commons.switcher.SwitcherNamespace;
@SwitcherNamespace("BUZ.qywx.open")
public class CustomSwitcher {
/**
* 积分触不通知会员名单
*/
@Switcher
public static String qywx_open_host ;
}
\ No newline at end of file
......@@ -19,14 +19,16 @@ public class OpenUtils {
private static final String gicCallbackHost = GlobalVar.ctxPropertiesMap.get("haoban_service_host") + "/haoban-manage3-operation-web/qywx-msg-notice";
private static final String openHost = ConfigService.getConfig("BUZ.qywx.open").getProperty("qywx_open_host","") ;
private static String getHost() {
return CustomSwitcher.qywx_open_host ;
}
public static ServiceResponse<QwOpenResultInitBO> init(Long qwUserId, boolean qrcodeFlag) {
JSONObject initJson = new JSONObject();
if (null != qwUserId) {
initJson.put("vid", qwUserId);
}
String initStr = HttpClient.sendPostJSON(String.format(openHost, "init"), initJson.toJSONString(), "utf-8");
String initStr = HttpClient.sendPostJSON(String.format(getHost(), "init"), initJson.toJSONString(), "utf-8");
logger.info("企微初始化,req={},{}", initJson.toJSONString(), initStr);
QwOpenResultBO initResult = result(initStr);
if (!initResult.isOk()) {
......@@ -55,7 +57,7 @@ public class OpenUtils {
json.put("uuid", uuid);
json.put("qrcodeKey", qrcodeKey);
json.put("code", validCode);
String backJson = HttpClient.sendPostJSON(String.format(openHost, "CheckCode"), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "CheckCode"), json.toJSONString(), "utf-8");
logger.info("校验验证码={},uuid={}", backJson, uuid);
QwOpenResultBO bo = result(backJson);
if (!bo.isOk()) {
......@@ -67,7 +69,7 @@ public class OpenUtils {
public static void logout(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(openHost, "LoginOut"), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "LoginOut"), json.toJSONString(), "utf-8");
logger.info("退出={},uuid={}", backJson, uuid);
}
......@@ -75,7 +77,7 @@ public class OpenUtils {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
json.put("url", gicCallbackHost);
String backJson = HttpClient.sendPostJSON(String.format(openHost, "SetCallbackUrl"), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "SetCallbackUrl"), json.toJSONString(), "utf-8");
logger.info("设置回调={},uuid={}", backJson, uuid);
}
......@@ -86,7 +88,7 @@ public class OpenUtils {
}
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(openHost, req), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), req), json.toJSONString(), "utf-8");
logger.info("获取qrcode={},uuid={},times={}", backJson, uuid, times);
QwOpenResultBO initResult = result(backJson);
if (!initResult.isOk()) {
......@@ -115,7 +117,7 @@ public class OpenUtils {
public static boolean autoLogin(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(openHost, "automaticLogin"), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "automaticLogin"), json.toJSONString(), "utf-8");
logger.info("自动登录={},uuid={}", backJson, uuid);
JSONObject resultJson = JSONObject.parseObject(backJson);
int errcode = resultJson.getIntValue("errcode");
......@@ -135,7 +137,7 @@ public class OpenUtils {
public static boolean isLogin(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(openHost, "GetProfile"), json.toJSONString(), "utf-8");
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "GetProfile"), json.toJSONString(), "utf-8");
logger.info("获取当前账号详情={},uuid={}", backJson, uuid);
JSONObject resultJson = JSONObject.parseObject(backJson);
int errcode = resultJson.getIntValue("errcode");
......
package com.gic.haoban.manage.service.util;
import com.gic.commons.switcher.SwitcherApplication;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import java.util.concurrent.atomic.AtomicBoolean;
@Component
public class SwitcherInitialization implements InitializingBean {
static AtomicBoolean INIT = new AtomicBoolean(false);
@Override
public void afterPropertiesSet() throws Exception {
SwitcherApplication.init(CustomSwitcher.class);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment