|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.http.HttpStatus;
|
|
|
|
import cn.hutool.http.HttpStatus;
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
|
|
import com.baiye.constant.DefaultNumberConstants;
|
|
|
|
import com.baiye.constant.WeChatRequestConstants;
|
|
|
|
import com.baiye.constant.WeChatRequestConstants;
|
|
|
|
import com.baiye.domain.PageParam;
|
|
|
|
import com.baiye.domain.PageParam;
|
|
|
|
import com.baiye.domain.PageResult;
|
|
|
|
import com.baiye.domain.PageResult;
|
|
|
@ -45,16 +46,20 @@ public class LoginEquipmentServiceImpl extends ExtendServiceImpl<LoginEquipmentM
|
|
|
|
qo.setUserId(SecurityUtils.getCurrentUserId());
|
|
|
|
qo.setUserId(SecurityUtils.getCurrentUserId());
|
|
|
|
PageResult<WeChatAccountVO> queryPage = baseMapper.queryPage(pageParam, qo);
|
|
|
|
PageResult<WeChatAccountVO> queryPage = baseMapper.queryPage(pageParam, qo);
|
|
|
|
queryPage.getRecords().forEach(accountVO -> {
|
|
|
|
queryPage.getRecords().forEach(accountVO -> {
|
|
|
|
|
|
|
|
// 默认离线状态
|
|
|
|
|
|
|
|
accountVO.setStatus(DefaultNumberConstants.ZERO_NUMBER);
|
|
|
|
map.put("robotId", accountVO.getRobotId());
|
|
|
|
map.put("robotId", accountVO.getRobotId());
|
|
|
|
String robotResult = HttpUtil.get
|
|
|
|
String robotResult = HttpUtil.get
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_ROBOT_TYPE)
|
|
|
|
(weChatProperties.getGatewayHost().concat(WeChatRequestConstants.GET_ROBOT_TYPE)
|
|
|
|
.concat(weChatProperties.getAppKey()), map);
|
|
|
|
.concat(weChatProperties.getAppKey()), map);
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(robotResult, WeChatResponse.class);
|
|
|
|
if (JSONUtil.isTypeJSON(robotResult)) {
|
|
|
|
if (weChatResponse.getStatus() == HttpStatus.HTTP_OK) {
|
|
|
|
WeChatResponse weChatResponse = JSONUtil.toBean(robotResult, WeChatResponse.class);
|
|
|
|
WeChatAccountDTO dto = BeanUtil.toBean(weChatResponse.getData(), WeChatAccountDTO.class);
|
|
|
|
if (weChatResponse.getStatus() == HttpStatus.HTTP_OK) {
|
|
|
|
if (ObjectUtil.isNotNull(dto)) {
|
|
|
|
WeChatAccountDTO dto = BeanUtil.toBean(weChatResponse.getData(), WeChatAccountDTO.class);
|
|
|
|
accountVO.setCityInfo(dto.getProvince());
|
|
|
|
if (ObjectUtil.isNotNull(dto) && dto.getPit().equals(accountVO.getPit())) {
|
|
|
|
accountVO.setStatus(dto.getStatus());
|
|
|
|
accountVO.setCityInfo(dto.getProvince());
|
|
|
|
|
|
|
|
accountVO.setStatus(dto.getStatus());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|