Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
This commit is contained in:
commit
2590638c22
|
@ -31,6 +31,10 @@ public class RestTemplateConfig {
|
|||
factory.setReadTimeout(30 * 000);//单位为ms
|
||||
factory.setConnectTimeout(5 * 1000);//单位为ms
|
||||
factory.setOutputStreaming(false);
|
||||
|
||||
// InetSocketAddress socketAddress = new InetSocketAddress("192.168.124.31", 8888);
|
||||
// factory.setProxy(new Proxy(Proxy.Type.HTTP, socketAddress));
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,13 @@ package io.renren.modules.gateway.controller;
|
|||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.renren.modules.gateway.dao.ApiCountHistoryDao;
|
||||
import io.renren.modules.gateway.entity.ApiCountHistoryEntity;
|
||||
import io.renren.modules.gateway.service.MonitorServiceV2;
|
||||
import io.renren.modules.monitor.entity.Result;
|
||||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||
import io.renren.modules.notice.service.impl.SysNoticeServiceImpl;
|
||||
import io.renren.modules.resource.dao.AttrDao;
|
||||
import io.renren.modules.resource.dao.ResourceDao;
|
||||
import io.renren.modules.resource.entity.AttrEntity;
|
||||
|
@ -75,6 +78,9 @@ public class MonitorControllerV2 {
|
|||
@Autowired
|
||||
private ApiCountHistoryDao apiCountHistoryDao;
|
||||
|
||||
@Autowired
|
||||
private SysNoticeServiceImpl sysNoticeService;
|
||||
|
||||
public List queryMetricCount(String queryFormat, Long start, Long end, String metricElement, int limit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}&time={time}";
|
||||
|
||||
|
@ -325,4 +331,12 @@ public class MonitorControllerV2 {
|
|||
return Result.success(callCount);
|
||||
}
|
||||
|
||||
@GetMapping("/sendMsg")
|
||||
@ApiOperation("查询总api调用总量")
|
||||
public void sendMsg(){
|
||||
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
|
||||
sysNoticeDTO.setTitle("请审批yyyy的流程申请");
|
||||
sysNoticeService.sendToYaweiUser(sysNoticeDTO, Lists.newArrayList(1513432847327199233L));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.renren.common.constant.Constant;
|
|||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.service.impl.CrudServiceImpl;
|
||||
import io.renren.common.utils.ConvertUtils;
|
||||
import io.renren.common.utils.Result;
|
||||
import io.renren.modules.notice.dao.SysNoticeDao;
|
||||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||
import io.renren.modules.notice.entity.SysNoticeEntity;
|
||||
|
@ -17,7 +18,9 @@ import io.renren.modules.notice.enums.ReceiverTypeEnum;
|
|||
import io.renren.modules.notice.service.SysNoticeService;
|
||||
import io.renren.modules.notice.service.SysNoticeUserService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.entity.SysUserEntity;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import io.renren.websocket.WebSocketServer;
|
||||
import io.renren.websocket.data.MessageData;
|
||||
|
@ -26,14 +29,16 @@ import org.apache.shiro.session.UnknownSessionException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -53,6 +58,10 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
private WebSocketServer webSocketServer;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
|
||||
|
@ -185,6 +194,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
//通过WebSocket,提示选中用户,有新通知
|
||||
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
|
||||
webSocketServer.sendMessage(finalUserIdList, message);
|
||||
sendToYaweiUser(notice, finalUserIdList);
|
||||
}, executor);
|
||||
}
|
||||
}
|
||||
|
@ -213,5 +223,77 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
});
|
||||
}
|
||||
|
||||
public void sendToYaweiUser(SysNoticeDTO notice, List<Long> userIdList) {
|
||||
|
||||
List<SysUserEntity> sysUserEntities = sysUserDao.selectBatchIds(userIdList);
|
||||
|
||||
StringBuilder userNames = new StringBuilder();
|
||||
StringBuilder userGuids = new StringBuilder();
|
||||
StringBuilder exchangeCodes = new StringBuilder();
|
||||
for (SysUserEntity sysUserEntity : sysUserEntities) {
|
||||
userNames.append(sysUserEntity.getUsername() + ";");
|
||||
String guid = sysUserEntity.getGuid();
|
||||
if (StringUtils.isNotBlank(guid)) {
|
||||
userGuids.append(guid + ";");
|
||||
}
|
||||
String ywMobile = sysUserEntity.getYwMobile();
|
||||
if (StringUtils.isNotBlank(ywMobile)) {
|
||||
exchangeCodes.append(ywMobile + ";");
|
||||
}
|
||||
}
|
||||
if (userNames.charAt(userNames.length()-1) == ';') {
|
||||
userNames.deleteCharAt(userNames.length()-1);
|
||||
}
|
||||
if (userGuids.charAt(userGuids.length()-1) == ';') {
|
||||
userGuids.deleteCharAt(userGuids.length()-1);
|
||||
}
|
||||
if (exchangeCodes.charAt(exchangeCodes.length()-1) == ';') {
|
||||
exchangeCodes.deleteCharAt(exchangeCodes.length()-1);
|
||||
}
|
||||
|
||||
|
||||
String url = "http://15.72.158.155/jhoa200/OAReceiver/OuterSystemOAReceiver.asmx";
|
||||
String param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
|
||||
" <soap:Body>\n" +
|
||||
" <InsertTodealByPollCode xmlns=\"http://tempuri.org/\">\n" +
|
||||
String.format("<todealGuid>{%s}</todealGuid>\n", UUID.randomUUID().toString().toUpperCase()) +
|
||||
String.format("<fileGuid>{%s}</fileGuid>\n", UUID.randomUUID().toString().toUpperCase()) +
|
||||
String.format("<title>%s</title>\n",notice.getTitle()) +
|
||||
" <docType>2</docType>\n" +
|
||||
String.format("<receiveLocalPerson>%s</receiveLocalPerson>\n", userNames.toString()) +
|
||||
String.format("<receiveLocalPersonGuid>%s</receiveLocalPersonGuid>\n", userGuids.toString()) +
|
||||
" <sendperson>能力平台</sendperson>\n" + //没有发送人定义,先写死
|
||||
" <sendpersonGuid>BE604908-D7A3-4947-9CAD-A70FF2E48AB1</sendpersonGuid>\n" + //没有发送人定义,先写死
|
||||
" <typeName>其他</typeName>\n" +
|
||||
" <isout>1</isout>\n" +
|
||||
" <url>http://15.72.183.90:7008</url>\n" +
|
||||
" <openFlag>1</openFlag>\n" +
|
||||
" <isReply>0</isReply>\n" +
|
||||
" <isTop>0</isTop>\n" +
|
||||
" <fromExchangeCode>00010000000000000058</fromExchangeCode>\n" +
|
||||
String.format("<toExchangeCode>%s</toExchangeCode>\n", exchangeCodes.toString()) +
|
||||
" <pollCode>20040</pollCode>\n" +
|
||||
" </InsertTodealByPollCode>\n" +
|
||||
" </soap:Body>\n" +
|
||||
"</soap:Envelope>";
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("SOAPAction", "http://tempuri.org/InsertTodealByPollCode");
|
||||
requestHeaders.setContentType(new MediaType("text", "xml", StandardCharsets.UTF_8));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(param, requestHeaders);
|
||||
try {
|
||||
String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody();
|
||||
//返回示例
|
||||
// <InsertTodealByPollCodeResponse xmlns="http://tempuri.org/">
|
||||
// <InsertTodealByPollCodeResult>1</InsertTodealByPollCodeResult>
|
||||
// </InsertTodealByPollCodeResponse>
|
||||
if (!body.contains("<InsertTodealByPollCodeResult>1</InsertTodealByPollCodeResult>")) {
|
||||
logger.error("推送待办失败:" + body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("推送亚威待办失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -78,7 +78,7 @@ public class TsingtaoDataResourceService extends AbstractDataResourceService {
|
|||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
logger.error("青岛市资源数据调用失败!!!");
|
||||
logger.error("青岛市资源数据调用失败!!!",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ public class SysUserEntity extends BaseEntity {
|
|||
*/
|
||||
private String guid;
|
||||
|
||||
/**
|
||||
* 亚威的不知道什么exchangecode
|
||||
*/
|
||||
private String ywMobile;
|
||||
|
||||
}
|
Loading…
Reference in New Issue