|
|
@ -45,7 +45,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -81,6 +80,7 @@ public class WeChatServiceImpl extends ExtendServiceImpl<WeChatAccountMapper, We
|
|
|
|
String getQrCodeResult = HttpUtil.get
|
|
|
|
String getQrCodeResult = HttpUtil.get
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_QR_CODE)
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_QR_CODE)
|
|
|
|
.concat(weChatProperties.getAppKey()), beanToMap);
|
|
|
|
.concat(weChatProperties.getAppKey()), beanToMap);
|
|
|
|
|
|
|
|
log.info("=============== the response as {} =============", getQrCodeResult);
|
|
|
|
if (StringUtils.isNotBlank(getQrCodeResult)) {
|
|
|
|
if (StringUtils.isNotBlank(getQrCodeResult)) {
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(getQrCodeResult, WeChatResponse.class);
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(getQrCodeResult, WeChatResponse.class);
|
|
|
|
return weChatResponse.getMsg();
|
|
|
|
return weChatResponse.getMsg();
|
|
|
@ -114,6 +114,7 @@ public class WeChatServiceImpl extends ExtendServiceImpl<WeChatAccountMapper, We
|
|
|
|
String createEquipmentResult = HttpUtil.get
|
|
|
|
String createEquipmentResult = HttpUtil.get
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.CREATE_EQUIPMENT)
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.CREATE_EQUIPMENT)
|
|
|
|
.concat(weChatProperties.getAppKey()), map);
|
|
|
|
.concat(weChatProperties.getAppKey()), map);
|
|
|
|
|
|
|
|
log.info("=============== the response as {} =============", createEquipmentResult);
|
|
|
|
if (StringUtils.isNotBlank(createEquipmentResult)) {
|
|
|
|
if (StringUtils.isNotBlank(createEquipmentResult)) {
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(createEquipmentResult, WeChatResponse.class);
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(createEquipmentResult, WeChatResponse.class);
|
|
|
|
if (weChatResponse.getStatus() == ResponseConstant.SUCCESS) {
|
|
|
|
if (weChatResponse.getStatus() == ResponseConstant.SUCCESS) {
|
|
|
@ -151,6 +152,7 @@ public class WeChatServiceImpl extends ExtendServiceImpl<WeChatAccountMapper, We
|
|
|
|
String pushQrCodeResult = HttpUtil.get
|
|
|
|
String pushQrCodeResult = HttpUtil.get
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_PUSH_LOGIN)
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_PUSH_LOGIN)
|
|
|
|
.concat(weChatProperties.getAppKey()), beanToMap);
|
|
|
|
.concat(weChatProperties.getAppKey()), beanToMap);
|
|
|
|
|
|
|
|
log.info("=============== the response as {} =============", pushQrCodeResult);
|
|
|
|
if (StringUtils.isNotBlank(pushQrCodeResult)) {
|
|
|
|
if (StringUtils.isNotBlank(pushQrCodeResult)) {
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(pushQrCodeResult, WeChatResponse.class);
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(pushQrCodeResult, WeChatResponse.class);
|
|
|
|
return weChatResponse.getMsg();
|
|
|
|
return weChatResponse.getMsg();
|
|
|
@ -285,7 +287,7 @@ public class WeChatServiceImpl extends ExtendServiceImpl<WeChatAccountMapper, We
|
|
|
|
|
|
|
|
|
|
|
|
Long friendNum = wechatFriendService.queryByUserId(currentUserId);
|
|
|
|
Long friendNum = wechatFriendService.queryByUserId(currentUserId);
|
|
|
|
Integer abnormalNum = DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
Integer abnormalNum = DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
Integer onlineNum = DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
int onlineNum = DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
for (WeChatAccountVO weChatAccount : weChatAccounts) {
|
|
|
|
for (WeChatAccountVO weChatAccount : weChatAccounts) {
|
|
|
|
map.put("robotId", weChatAccount.getRobotId());
|
|
|
|
map.put("robotId", weChatAccount.getRobotId());
|
|
|
@ -315,4 +317,22 @@ public class WeChatServiceImpl extends ExtendServiceImpl<WeChatAccountMapper, We
|
|
|
|
return this.baseMapper.updateRemark(wxId, remark);
|
|
|
|
return this.baseMapper.updateRemark(wxId, remark);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Boolean logoutByRobotId(Integer robotId) {
|
|
|
|
|
|
|
|
List<Integer> arrayList = Lists.newArrayList(robotId);
|
|
|
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
|
|
|
map.put("robotIds", arrayList);
|
|
|
|
|
|
|
|
String result = HttpUtil.post
|
|
|
|
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.ROBOT_LOGOUT)
|
|
|
|
|
|
|
|
.concat(weChatProperties.getAppKey()), map);
|
|
|
|
|
|
|
|
log.info("=============== the response as {} =============", result);
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(result) && result.contains(ResponseCode.SUCCESS.getDesc())) {
|
|
|
|
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(result, WeChatResponse.class);
|
|
|
|
|
|
|
|
if (weChatResponse.getStatus() == HttpStatus.HTTP_OK) {
|
|
|
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|