Commit 259bd2d5 by chentianzhong

外部接口

parent 107746a6
......@@ -2,7 +2,6 @@ package com.zq.email.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.TokenUtils;
import com.zq.common.vo.OnlineUserDto;
......
......@@ -2,6 +2,9 @@ package com.zq.email.feign;
import com.zq.common.annotation.AnonymousAccess;
import com.zq.common.annotation.Log;
import com.zq.common.annotation.rest.AnonymousGetMapping;
import com.zq.common.annotation.rest.AnonymousPostMapping;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.CustomerUserVo;
import com.zq.common.vo.OnlineUserDto;
import com.zq.common.vo.ResultVo;
......@@ -57,4 +60,18 @@ public interface AdminFeignClient {
@Log("获取指定人员")
@ApiOperation("获取指定人员")
@AnonymousGetMapping("/users/getUserById/{userId}")
CustomerUserVo getUserById(@PathVariable Long userId);
@ApiOperation("根据人员标识查询用户")
@AnonymousPostMapping("/getBypCode/{pCode}")
ResultVo<CustomerUserVo> getBypCode(@PathVariable String pCode);
}
......@@ -74,6 +74,16 @@ public class AdminFeignFallbackFactory implements FallbackFactory<AdminFeignClie
return ResultVo.fail("admin服务调用异常-->getBySystemTag异常");
}
@Override
public CustomerUserVo getUserById(Long userId) {
return null;
}
@Override
public ResultVo<CustomerUserVo> getBypCode(String pCode) {
return ResultVo.fail("admin服务调用异常-->get> getBypCode异常");
}
};
}
......
......@@ -26,9 +26,9 @@ public interface IEmailContentService extends IService<EmailContent> {
EmailContent saveContent(EmailEditVo vo, OnlineUserDto adminContext);
EmailContent saveContentApi(ApiSendEmailVo emailVo, CustomerUserVo data, List<Long> receiveIds);
EmailContent saveContentApi(ApiSendEmailVo emailVo, CustomerUserVo formVo, List<Long> receiveIds);
EmailContent saveContentApi2(EmailEditApiVo vo, CustomerUserVo formUser);
EmailContent saveContentApi2(EmailEditApiVo vo, CustomerUserVo formVo);
void setTaskEmail(EmailTaskVo vo);
......
......@@ -46,11 +46,17 @@ public interface IEmailPersonService extends IService<EmailPerson> {
EmailPerson saveEmailSender(OnlineUserDto userDto, EmailContent content, Long folderId, Integer isSend);
//保存发件人2
EmailPerson saveEmailSender(CustomerUserVo userVo, EmailContent content, Long folderId, Integer isSend);
EmailPerson saveEmailSender2(UserDto userVo, EmailContent content, Long folderId, Integer isSend);
//保存发件人3
EmailPerson saveEmailSender3(CustomerUserVo userVo, EmailContent content, Long folderId, Integer isSend);
//保存收件人
void saveEmailReceiver(List<UserDto> receiverList, EmailContent content, Long folderId, Integer isPerson, Integer isSend);
//保存收件人2
void saveEmailReceiver2(List<CustomerUserVo> receiverList, EmailContent content, Long folderId, Integer isPerson, Integer isSend);
//移动邮件到文件夹
void moveEmailFolder(EmailFolderMoveVo vo);
......
......@@ -96,14 +96,14 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
}
@Override
public EmailContent saveContentApi(ApiSendEmailVo emailVo, CustomerUserVo data, List<Long> receiveIds) {
public EmailContent saveContentApi(ApiSendEmailVo emailVo, CustomerUserVo formVo, List<Long> receiveIds) {
EmailContent content = new EmailContent();
content.setTitle(emailVo.getSubject());
content.setContent(emailVo.getContent());
content.setDegree(EmailDegreeEnum.DEGREE_COMMON.getKey());
content.setSendUserId(data.getUserId());
content.setSendUserEmail(data.getUsername());
content.setSendUserName(data.getNickName());
content.setSendUserId(formVo.getUserId());
content.setSendUserEmail(formVo.getUsername());
content.setSendUserName(formVo.getNickName());
content.setSendTime(LocalDateTime.now());
content.setIsTask(WhetherEnum.NO.getKey());
......@@ -122,14 +122,14 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
}
@Override
public EmailContent saveContentApi2(EmailEditApiVo vo, CustomerUserVo formUser) {
public EmailContent saveContentApi2(EmailEditApiVo vo, CustomerUserVo formVo) {
EmailContent content = new EmailContent();
content.setTitle(vo.getTitle());
content.setContent(vo.getContent());
content.setDegree(vo.getDegree());
content.setSendUserId(formUser.getUserId());
content.setSendUserEmail(formUser.getUsername());
content.setSendUserName(formUser.getNickName());
content.setSendUserId(formVo.getUserId());
content.setSendUserEmail(formVo.getUsername());
content.setSendUserName(formVo.getNickName());
content.setSendTime(LocalDateTime.now());
content.setIsTask(vo.getIsTask());
content.setSmsRemind(vo.getIsSmsRemind());
......
......@@ -48,6 +48,25 @@ public class MsgUtil {
}
//发送消息和代办
@Async
public void sendMsg3(String sender, EmailContent content, List<CustomerUserVo> userVoList, SystemInfo systemInfo, Integer folderId) {
Map<String, Object> params = new HashMap<>();
params .put("systemTag", EmailConstant.SYSTEM_TAG);
params .put("sender", sender);
params .put("senderId", content.getSendUserId());
params .put("nickName", sender);
params .put("title","您有一封新邮件提醒");
params .put("content", "请查收我的邮件!主题:"+content.getTitle()+"。");
params.put("userIdList", userVoList.stream().map(e->e.getUserId()).collect(Collectors.toList()));
params .put("businessId", content.getId());
params.put("jumpUrl", systemInfo.getHomeUrl() + "/#/detail?folderId="+folderId+"&contentId=" + content.getId());
log.warn("---发送内部消息打印内容: {}", JSONUtil.toJsonStr(params));
messageFeignClient.sendApi(params);
messageFeignClient.addToDoApi(params);
}
@Async
public void sendMsg2(String sender, EmailContent content, List<Long> userIds, SystemInfo systemInfo, Integer folderId) {
......
......@@ -59,6 +59,34 @@ public class SmsUtil {
}
}
/**
* 发送批量短信
*
* @return
*/
@Async
public void sendBatchSms2(List<CustomerUserVo> userVoList, String content, Long contentId) {
String regex = "^1[3-9]\\d{9}";
StringBuffer sb = new StringBuffer();
for (CustomerUserVo userVo : userVoList) {
if (userVo!=null && StrUtil.isNotBlank(userVo.getPhone()) && userVo.getPhone().matches(regex)){
sb.append(userVo.getPhone()).append(",");
}
}
if (sb.length() >0) {
Map<String, Object> map = new HashMap<>();
map.put("phones", Base64.encode(sb.toString().getBytes()));
map.put("fromId", Base64.encode("oa_email".getBytes()));
map.put("content", Base64.encode(content.getBytes()));
map.put("isReply", Base64.encode("0".getBytes()));
String param = JSONUtil.toJsonStr(map);
sendRequest(Base64.encode(param.getBytes()), contentId);
}
}
private void sendRequest(String content, Long contentId) {
log.debug("发送短信请求 => 邮件标识:{},请求地址:{}", contentId, smsProperties.getUrl());
......
......@@ -14,8 +14,6 @@ spring:
eureka:
instance:
prefer-ip-address: true
lease-renewal-interval-in-seconds: 30 #服务续约(renew)的间隔,默认为30秒
lease-expiration-duration-in-seconds: 90 #服务失效时间,默认值90秒
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client:
serviceUrl:
......
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