Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
email
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈天仲
email
Commits
259bd2d5
Commit
259bd2d5
authored
Oct 11, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
外部接口
parent
107746a6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
91 additions
and
14 deletions
+91
-14
src/main/java/com/zq/email/controller/EmailController.java
+0
-1
src/main/java/com/zq/email/feign/AdminFeignClient.java
+17
-0
src/main/java/com/zq/email/feign/fallback/AdminFeignFallbackFactory.java
+10
-0
src/main/java/com/zq/email/service/IEmailContentService.java
+2
-2
src/main/java/com/zq/email/service/IEmailPersonService.java
+7
-1
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
+8
-8
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+0
-0
src/main/java/com/zq/email/utils/MsgUtil.java
+19
-0
src/main/java/com/zq/email/utils/SmsUtil.java
+28
-0
src/main/resources/bootstrap.yml
+0
-2
src/main/resources/logback-spring.xml
+0
-0
No files found.
src/main/java/com/zq/email/controller/EmailController.java
View file @
259bd2d5
...
...
@@ -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
;
...
...
src/main/java/com/zq/email/feign/AdminFeignClient.java
View file @
259bd2d5
...
...
@@ -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
);
}
src/main/java/com/zq/email/feign/fallback/AdminFeignFallbackFactory.java
View file @
259bd2d5
...
...
@@ -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异常"
);
}
};
}
...
...
src/main/java/com/zq/email/service/IEmailContentService.java
View file @
259bd2d5
...
...
@@ -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
form
User
);
EmailContent
saveContentApi2
(
EmailEditApiVo
vo
,
CustomerUserVo
form
Vo
);
void
setTaskEmail
(
EmailTaskVo
vo
);
...
...
src/main/java/com/zq/email/service/IEmailPersonService.java
View file @
259bd2d5
...
...
@@ -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
);
...
...
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
View file @
259bd2d5
...
...
@@ -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
form
User
)
{
public
EmailContent
saveContentApi2
(
EmailEditApiVo
vo
,
CustomerUserVo
form
Vo
)
{
EmailContent
content
=
new
EmailContent
();
content
.
setTitle
(
vo
.
getTitle
());
content
.
setContent
(
vo
.
getContent
());
content
.
setDegree
(
vo
.
getDegree
());
content
.
setSendUserId
(
form
User
.
getUserId
());
content
.
setSendUserEmail
(
form
User
.
getUsername
());
content
.
setSendUserName
(
form
User
.
getNickName
());
content
.
setSendUserId
(
form
Vo
.
getUserId
());
content
.
setSendUserEmail
(
form
Vo
.
getUsername
());
content
.
setSendUserName
(
form
Vo
.
getNickName
());
content
.
setSendTime
(
LocalDateTime
.
now
());
content
.
setIsTask
(
vo
.
getIsTask
());
content
.
setSmsRemind
(
vo
.
getIsSmsRemind
());
...
...
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
259bd2d5
This diff is collapsed.
Click to expand it.
src/main/java/com/zq/email/utils/MsgUtil.java
View file @
259bd2d5
...
...
@@ -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
)
{
...
...
src/main/java/com/zq/email/utils/SmsUtil.java
View file @
259bd2d5
...
...
@@ -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
());
...
...
src/main/resources/bootstrap.yml
View file @
259bd2d5
...
...
@@ -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
:
...
...
src/main/resources/logback-spring.xml
View file @
259bd2d5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment