Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
9123e7d1
Commit
9123e7d1
authored
Dec 05, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改通知路径
parent
3b3f3e56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
9 deletions
+139
-9
NotificationFeignClient.java
...soft/common/util/feignClient/NotificationFeignClient.java
+4
-3
MTNotificationApiRequestClient.java
...common/util/outClient/MTNotificationApiRequestClient.java
+12
-6
NotiRet.java
src/main/java/org/rcisoft/core/result/NotiRet.java
+123
-0
No files found.
src/main/java/org/rcisoft/common/util/feignClient/NotificationFeignClient.java
View file @
9123e7d1
package
org
.
rcisoft
.
common
.
util
.
feignClient
;
package
org
.
rcisoft
.
common
.
util
.
feignClient
;
import
org.rcisoft.core.result.NotiRet
;
import
org.rcisoft.core.result.Ret
;
import
org.rcisoft.core.result.Ret
;
import
org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO
;
import
org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
@@ -21,8 +22,8 @@ public interface NotificationFeignClient {
...
@@ -21,8 +22,8 @@ public interface NotificationFeignClient {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/notification/send"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/notification/send"
,
method
=
RequestMethod
.
POST
)
Ret
sendMessage
(
@RequestBody
MTNotificationSendReqDTO
mtNotificationSendReqDTO
,
Noti
Ret
sendMessage
(
@RequestBody
MTNotificationSendReqDTO
mtNotificationSendReqDTO
,
@RequestParam
(
"zxClientType"
)
String
zxClientType
,
@RequestParam
(
"zxClientType"
)
String
zxClientType
,
@RequestParam
(
"zxAccountId"
)
Long
zxAccountId
@RequestParam
(
"zxAccountId"
)
Long
zxAccountId
);
);
}
}
src/main/java/org/rcisoft/common/util/outClient/MTNotificationApiRequestClient.java
View file @
9123e7d1
...
@@ -3,6 +3,7 @@ package org.rcisoft.common.util.outClient;
...
@@ -3,6 +3,7 @@ package org.rcisoft.common.util.outClient;
//import com.zgiot.zx.schedule.service.INotificationService;
//import com.zgiot.zx.schedule.service.INotificationService;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.business.bmessage.dao.BMessageRepository
;
import
org.rcisoft.business.bmessage.dao.BMessageRepository
;
...
@@ -11,6 +12,7 @@ import org.rcisoft.business.bnotice.entity.BNotice;
...
@@ -11,6 +12,7 @@ import org.rcisoft.business.bnotice.entity.BNotice;
import
org.rcisoft.business.bnotice.service.BNoticeService
;
import
org.rcisoft.business.bnotice.service.BNoticeService
;
import
org.rcisoft.common.model.InfoTypeEnum
;
import
org.rcisoft.common.model.InfoTypeEnum
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.result.NotiRet
;
import
org.rcisoft.core.result.ResultCode
;
import
org.rcisoft.core.result.ResultCode
;
import
org.rcisoft.core.result.Ret
;
import
org.rcisoft.core.result.Ret
;
import
org.rcisoft.common.util.feignClient.NotificationFeignClient
;
import
org.rcisoft.common.util.feignClient.NotificationFeignClient
;
...
@@ -84,7 +86,7 @@ public class MTNotificationApiRequestClient {
...
@@ -84,7 +86,7 @@ public class MTNotificationApiRequestClient {
if
(
"dev"
.
equalsIgnoreCase
(
serverType
))
{
if
(
"dev"
.
equalsIgnoreCase
(
serverType
))
{
return
true
;
return
true
;
}
}
Ret
ret
=
new
Ret
();
NotiRet
ret
=
new
Noti
Ret
();
List
<
BNotice
>
bNoticeList
=
new
ArrayList
<>();
List
<
BNotice
>
bNoticeList
=
new
ArrayList
<>();
String
noticeType
=
"考试"
;
String
noticeType
=
"考试"
;
...
@@ -144,11 +146,11 @@ public class MTNotificationApiRequestClient {
...
@@ -144,11 +146,11 @@ public class MTNotificationApiRequestClient {
bNotice1
.
setReadFlag
(
"0"
);
bNotice1
.
setReadFlag
(
"0"
);
bNoticeList
.
add
(
bNotice1
);
bNoticeList
.
add
(
bNotice1
);
// 判断智学权限
// 判断智学权限
if
(
microappApiRequestClient
.
isHaveApps
(
Long
.
parseLong
(
sysUser
.
getBusinessId
()),
Long
.
parseLong
(
sysUser
.
getCorpId
())))
{
//
if (microappApiRequestClient.isHaveApps(Long.parseLong(sysUser.getBusinessId()), Long.parseLong(sysUser.getCorpId()))) {
reciIds
.
add
(
sysUser
.
getBusinessId
());
reciIds
.
add
(
sysUser
.
getBusinessId
());
// 发送智信通知
// 发送智信通知
MTNotificationSendReqDTO
mtNotificationSendReqDTO
=
MTNotificationSendReqDTO
.
builder
().
content
(
message
.
getInfoText
())
MTNotificationSendReqDTO
mtNotificationSendReqDTO
=
MTNotificationSendReqDTO
.
builder
().
content
(
message
.
getInfoText
())
.
channels
(
"ALL"
).
targetId
(
bNotice1
.
getBusinessId
()).
receiverIds
(
Arrays
.
asList
(
new
String
[]{
sysUser
.
getBusinessId
()
})).
build
();
.
channels
(
"ALL"
).
targetId
(
bNotice1
.
getBusinessId
()).
receiverIds
(
Arrays
.
asList
(
new
String
[]{
"290"
})).
build
();
mtNotificationSendReqDTO
.
setSenderName
(
"智学"
);
mtNotificationSendReqDTO
.
setSenderName
(
"智学"
);
mtNotificationSendReqDTO
.
setChannels
(
"ALL"
);
mtNotificationSendReqDTO
.
setChannels
(
"ALL"
);
...
@@ -175,17 +177,21 @@ public class MTNotificationApiRequestClient {
...
@@ -175,17 +177,21 @@ public class MTNotificationApiRequestClient {
put
(
"url"
,
url
);
put
(
"url"
,
url
);
put
(
"createUrl"
,
senderUser
.
getHeadPic
());
put
(
"createUrl"
,
senderUser
.
getHeadPic
());
put
(
"createName"
,
senderUser
.
getName
());
put
(
"createName"
,
senderUser
.
getName
());
// put("
type
",finalNoticeType);
// put("
area
",finalNoticeType);
}});
}});
String
json
=
JSON
.
toJSONString
(
mtNotificationSendReqDTO
);
log
.
debug
(
json
);
try
{
try
{
ret
=
notificationFeignClient
.
sendMessage
(
mtNotificationSendReqDTO
,
"app"
,
(
long
)
1
);
ret
=
notificationFeignClient
.
sendMessage
(
mtNotificationSendReqDTO
,
"app"
,
(
long
)
1
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
log
.
error
(
"----------------------------------------------------调用智信通知失败!----------------------------------------------------------"
);
log
.
error
(
"----------------------------------------------------调用智信通知失败!----------------------------------------------------------"
+
ex
);
return
false
;
return
false
;
}
}
bNoticeServiceImpl
.
save
(
bNoticeList
);
bNoticeServiceImpl
.
save
(
bNoticeList
);
}
//
}
}
}
}
}
...
...
src/main/java/org/rcisoft/core/result/NotiRet.java
0 → 100644
View file @
9123e7d1
package
org
.
rcisoft
.
core
.
result
;
import
com.google.common.base.MoreObjects
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.core.annotation.Order
;
import
java.io.Serializable
;
/**
* 返回信息
*
* @author David
*/
@ApiModel
(
value
=
"通知请求响应"
)
public
class
NotiRet
<
T
>
implements
Serializable
{
@Order
(
1
)
@ApiModelProperty
(
value
=
"错误码"
)
private
String
code
;
@Order
(
2
)
@ApiModelProperty
(
value
=
"错误描述"
)
private
String
message
;
@Order
(
3
)
@ApiModelProperty
(
value
=
"请求时间"
)
private
Long
ctime
;
@Order
(
4
)
@ApiModelProperty
(
value
=
"请求编号"
)
private
String
requestId
;
@Order
(
5
)
@ApiModelProperty
(
value
=
"响应数据"
)
private
T
data
;
public
NotiRet
()
{
this
(
null
);
}
public
NotiRet
(
String
code
)
{
this
(
code
,
null
);
}
public
NotiRet
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
this
.
ctime
=
System
.
currentTimeMillis
();
if
(
UserUtil
.
getCurUser
()
!=
null
)
{
this
.
requestId
=
String
.
valueOf
(
UserUtil
.
getCurUser
().
getRequireId
());
}
}
//构建成功返回
public
static
NotiRet
ok
()
{
return
new
NotiRet
(
ResultCode
.
SUCCESS
.
getCode
().
toString
(),
"ok"
);
}
//构建系统异常返回
public
static
NotiRet
error
()
{
return
new
NotiRet
(
ResultCode
.
ERROR
.
getCode
().
toString
(),
"false"
);
}
public
String
getCode
()
{
return
code
;
}
public
NotiRet
<
T
>
setCode
(
String
code
)
{
this
.
code
=
code
;
return
this
;
}
public
String
getMessage
()
{
return
message
;
}
public
NotiRet
<
T
>
setMessage
(
String
message
)
{
this
.
message
=
message
;
return
this
;
}
public
Long
getCtime
()
{
return
ctime
;
}
public
NotiRet
<
T
>
setCtime
(
Long
ctime
)
{
this
.
ctime
=
ctime
;
return
this
;
}
public
String
getRequestId
()
{
return
requestId
;
}
public
NotiRet
<
T
>
setRequestId
(
String
requestId
)
{
this
.
requestId
=
requestId
;
return
this
;
}
public
T
getData
()
{
return
data
;
}
public
NotiRet
<
T
>
setData
(
T
data
)
{
this
.
data
=
data
;
return
this
;
}
@Override
public
String
toString
()
{
return
MoreObjects
.
toStringHelper
(
this
)
.
add
(
"\ncode"
,
code
)
.
add
(
"\nmessage"
,
message
)
.
add
(
"\nctime"
,
ctime
)
.
add
(
"\nrequestId"
,
requestId
)
.
add
(
"\ndata"
,
data
)
.
toString
();
}
}
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