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
e7ee52c2
Commit
e7ee52c2
authored
Dec 06, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改指派同时添加两条问题
parent
3f5d93ea
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
539 additions
and
367 deletions
+539
-367
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+35
-2
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+1
-1
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+1
-1
AppointResDTO.java
.../java/org/rcisoft/business/blesson/dto/AppointResDTO.java
+23
-0
SynLessonDTO.java
...n/java/org/rcisoft/business/blesson/dto/SynLessonDTO.java
+16
-0
BLessonPerson.java
...va/org/rcisoft/business/blesson/entity/BLessonPerson.java
+5
-0
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+1
-1
SendNoticeService.java
...g/rcisoft/business/blesson/service/SendNoticeService.java
+11
-0
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+329
-353
SendNoticeServiceImpl.java
.../business/blesson/service/impl/SendNoticeServiceImpl.java
+71
-0
LessonSyncUtil.java
...ava/org/rcisoft/business/blesson/util/LessonSyncUtil.java
+32
-0
MTNotificationApiRequestClient.java
...common/util/outClient/MTNotificationApiRequestClient.java
+8
-5
application-mt.yml
src/main/resources/application-mt.yml
+2
-1
application-test.yml
src/main/resources/application-test.yml
+4
-3
No files found.
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
e7ee52c2
...
...
@@ -12,9 +12,12 @@ import org.rcisoft.business.blesson.entity.BLesson;
import
org.rcisoft.business.blesson.entity.BLessonPerson
;
import
org.rcisoft.business.blesson.service.BLessonPersonService
;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.business.blesson.service.SendNoticeService
;
import
org.rcisoft.business.blesson.util.LessonSyncUtil
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.common.controller.PaginationController
;
import
org.rcisoft.common.model.GridModel
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
...
...
@@ -29,8 +32,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
java
.
util
.
Arrays
.
asList
;
/**
...
...
@@ -53,6 +60,12 @@ public class BLessonController extends PaginationController<BLesson> {
@Autowired
private
SysRoleService
sysRoleService
;
@Autowired
MTCotactApiRequestClient
cotactApiRequestClient
;
@Autowired
SendNoticeService
sendNoticeService
;
@Autowired
private
Global
global
;
...
...
@@ -446,8 +459,28 @@ public class BLessonController extends PaginationController<BLesson> {
@PostMapping
(
value
=
"/appointLessonToPerson"
)
public
Result
appointLessonToPerson
(
CurUser
curUser
,
@Valid
AppointLessonDTO
appointLessonDTO
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bLessonService
.
appointLessonToPerson
(
appointLessonDTO
);
return
Result
.
builder
(
data
,
//获取部门中人员
List
<
String
>
deptList
=
asList
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
split
(
appointLessonDTO
.
getAppointDepart
(),
","
));
Set
<
String
>
deptSet
=
new
HashSet
<>(
deptList
);
List
<
String
>
inDepartPerson
=
cotactApiRequestClient
.
getSubUserIdsByDeptIds
(
appointLessonDTO
.
getCorpId
(),
deptSet
);
//指派课程
AppointResDTO
data
=
bLessonService
.
appointLessonToPerson
(
appointLessonDTO
,
inDepartPerson
);
LessonSyncUtil
.
removeSynLessonDTO
(
appointLessonDTO
.
getLessonId
());
//发送通知
// new Thread(){
// public void run(){
sendNoticeService
.
sendAppointNotice
(
data
.
getBLesson
(),
data
.
getAppointLessonDTO
(),
data
.
getNoticePersonList
());
//
// }
// }.start();
return
Result
.
builder
(
new
PersistModel
(
data
.
getResLine
()),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
appointLessonDTO
);
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
e7ee52c2
...
...
@@ -294,7 +294,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
* @param personId
* @return
*/
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId} and del_flag != 1 "
)
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId} and del_flag != 1
order by update_date desc
"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLessonPerson
>
getAppointInTraining
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"personId"
)
String
personId
);
/**
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
e7ee52c2
...
...
@@ -98,7 +98,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"LEFT JOIN b_course b3 ON b3.business_id = b2.pid "
+
"and b3.del_flag != 1 and b3.flag = 1 "
+
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and bl.business_id = #{businessId} "
)
" and bl.business_id = #{businessId}
order by update_date desc
"
)
@ResultMap
(
value
=
"TrainBaseResultMap"
)
List
<
BLesson
>
selectInfoById
(
@Param
(
"businessId"
)
String
businessId
,
@Param
(
"curUser"
)
CurUser
curUser
);
...
...
src/main/java/org/rcisoft/business/blesson/dto/AppointResDTO.java
0 → 100644
View file @
e7ee52c2
package
org
.
rcisoft
.
business
.
blesson
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
java.util.List
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
AppointResDTO
{
private
Integer
resLine
;
private
BLesson
bLesson
;
private
AppointLessonDTO
appointLessonDTO
;
private
List
<
String
>
noticePersonList
;
}
src/main/java/org/rcisoft/business/blesson/dto/SynLessonDTO.java
0 → 100644
View file @
e7ee52c2
package
org
.
rcisoft
.
business
.
blesson
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.NoArgsConstructor
;
@Data
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
public
class
SynLessonDTO
{
private
String
lessonId
;
}
src/main/java/org/rcisoft/business/blesson/entity/BLessonPerson.java
View file @
e7ee52c2
...
...
@@ -172,6 +172,11 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@ApiModelProperty
(
value
=
"学员id集合"
)
ILessonCountDTO
iLessonCount
;
public
BLessonPerson
(
String
isAppoint
,
String
appointId
){
this
.
isAppoint
=
isAppoint
;
this
.
appointId
=
appointId
;
}
//初始化
public
void
initModel
(){
UserUtil
.
setCurrentPersistOperation
(
this
);
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
e7ee52c2
...
...
@@ -148,7 +148,7 @@ public interface BLessonService{
* @param appointLessonDTO
* @return
*/
PersistModel
appointLessonToPerson
(
AppointLessonDTO
appointLessonDTO
);
AppointResDTO
appointLessonToPerson
(
AppointLessonDTO
appointLessonDTO
,
List
<
String
>
inDepartPerson
);
/**
* 课程培训条件查询
...
...
src/main/java/org/rcisoft/business/blesson/service/SendNoticeService.java
0 → 100644
View file @
e7ee52c2
package
org
.
rcisoft
.
business
.
blesson
.
service
;
import
org.rcisoft.business.blesson.dto.AppointLessonDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
java.util.List
;
public
interface
SendNoticeService
{
void
sendAppointNotice
(
BLesson
bLesson
,
AppointLessonDTO
appointLessonDTO
,
List
<
String
>
userIds
)
;
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
e7ee52c2
This diff is collapsed.
Click to expand it.
src/main/java/org/rcisoft/business/blesson/service/impl/SendNoticeServiceImpl.java
0 → 100644
View file @
e7ee52c2
package
org
.
rcisoft
.
business
.
blesson
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.blesson.dto.AppointLessonDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.service.SendNoticeService
;
import
org.rcisoft.business.bmessage.dao.BMessageRepository
;
import
org.rcisoft.business.bmessage.entity.BMessage
;
import
org.rcisoft.business.bnotice.entity.BNotice
;
import
org.rcisoft.common.model.InfoTypeEnum
;
import
org.rcisoft.common.util.outClient.MTNotificationApiRequestClient
;
import
org.rcisoft.core.enums.MessageEnum
;
import
org.rcisoft.core.enums.UrlTypeEnum
;
import
org.rcisoft.sys.user.service.impl.SysUserServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Slf4j
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
SendNoticeServiceImpl
implements
SendNoticeService
{
@Autowired
BMessageRepository
bMessageRepository
;
@Autowired
SysUserServiceImpl
sysUserServiceImpl
;
@Autowired
MTNotificationApiRequestClient
client
;
@Override
public
void
sendAppointNotice
(
BLesson
bLesson
,
AppointLessonDTO
appointLessonDTO
,
List
<
String
>
userIds
)
{
// try {
// Thread.sleep(10000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
//是否去掉已在切已指派的人员
String
type
=
"0"
.
equals
(
bLesson
.
getLessonType
())
?
MessageEnum
.
ZPKC
.
getName
()
:
MessageEnum
.
ZPPX
.
getName
();
List
<
BMessage
>
bMessageList
=
bMessageRepository
.
queryByNameAndCorp
(
type
,
appointLessonDTO
.
getCorpId
());
BMessage
message
=
new
BMessage
();
if
(
bMessageList
!=
null
&&
bMessageList
.
size
()
>
0
){
message
=
bMessageList
.
get
(
0
);
}
if
(
userIds
!=
null
&&
userIds
.
size
()
>
0
&&
message
!=
null
&&
"1"
.
equals
(
message
.
getFlag
())){
try
{
BNotice
bNotice
=
new
BNotice
();
bNotice
.
setRecipientIds
(
userIds
);
bNotice
.
setLessonId
(
bLesson
.
getBusinessId
());
bNotice
.
setSenderId
(
appointLessonDTO
.
getUserId
());
bNotice
.
setCorpId
(
appointLessonDTO
.
getCorpId
());
// 获取课程信息
String
lessonType
=
"0"
.
equals
(
bLesson
.
getLessonType
())
?
"线上课程"
:
"线下培训"
;
String
infoType
=
"0"
.
equals
(
bLesson
.
getLessonType
())
?
InfoTypeEnum
.
ONLINE_LESSON
.
getValue
()
:
InfoTypeEnum
.
OFFLINE_TRAIN
.
getValue
();
bNotice
.
setInfoType
(
infoType
);
String
urlType
=
"0"
.
equals
(
bLesson
.
getLessonType
())
?
UrlTypeEnum
.
LESSON
.
getName
()
:
UrlTypeEnum
.
TRAIN
.
getName
();
bNotice
.
setInfoText
(
sysUserServiceImpl
.
getNameById
(
appointLessonDTO
.
getUserId
()).
getName
()
+
"给您指派了"
+
lessonType
+
"“"
+
bLesson
.
getLessonName
()
+
"”,请及时学习"
);
// 往智信平台发啊消息
client
.
send
(
bNotice
,
InfoTypeEnum
.
REPLY_DISCUSS
.
getLable
(),
type
,
urlType
);
}
catch
(
Exception
e
){
log
.
info
(
"发送通知失败,"
+
e
);
}
}
}
}
src/main/java/org/rcisoft/business/blesson/util/LessonSyncUtil.java
0 → 100644
View file @
e7ee52c2
package
org
.
rcisoft
.
business
.
blesson
.
util
;
import
org.rcisoft.business.blesson.dto.SynLessonDTO
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 指派类锁,防止同时操作同一个课程
*/
public
class
LessonSyncUtil
{
private
static
Map
<
String
,
SynLessonDTO
>
synLessonDTOList
=
new
HashMap
<>();
public
static
SynLessonDTO
getSynLessonDTO
(
String
lessonId
){
if
(
synLessonDTOList
.
containsKey
(
lessonId
))
return
synLessonDTOList
.
get
(
lessonId
);
SynLessonDTO
synLessonDTO
=
new
SynLessonDTO
(
lessonId
);
synLessonDTOList
.
put
(
lessonId
,
synLessonDTO
);
return
synLessonDTO
;
}
public
static
void
removeSynLessonDTO
(
String
lessonId
){
if
(
synLessonDTOList
.
containsKey
(
lessonId
))
synLessonDTOList
.
remove
(
lessonId
);
}
}
src/main/java/org/rcisoft/common/util/outClient/MTNotificationApiRequestClient.java
View file @
e7ee52c2
...
...
@@ -58,6 +58,9 @@ public class MTNotificationApiRequestClient {
@Value
(
"${server.type}"
)
private
String
serverType
;
@Value
(
"${notice.defaultUrl}"
)
private
String
defaultUrl
;
@Autowired
private
NotificationFeignClient
notificationFeignClient
;
@Autowired
...
...
@@ -83,7 +86,7 @@ public class MTNotificationApiRequestClient {
* @return
*/
public
boolean
send
(
BNotice
message
,
String
noticeTitle
,
String
type
,
String
urlType
)
{
if
(
"dev"
.
equalsIgnoreCase
(
serverType
))
{
if
(
"dev"
.
equalsIgnoreCase
(
serverType
)
||
"mt"
.
equalsIgnoreCase
(
serverType
)
)
{
return
true
;
}
NotiRet
ret
=
new
NotiRet
();
...
...
@@ -120,7 +123,7 @@ public class MTNotificationApiRequestClient {
}
}
else
{
senderUser
.
setName
(
"智学"
);
senderUser
.
setHeadPic
(
"http://zx-zgiot-002.oss-cn-qingdao.aliyuncs.com/image/2d60950fefa14041b4d9715a70a7d389.png"
);
senderUser
.
setHeadPic
(
defaultUrl
);
}
List
<
String
>
reciIds
=
new
ArrayList
<>();
...
...
@@ -146,7 +149,7 @@ public class MTNotificationApiRequestClient {
bNotice1
.
setReadFlag
(
"0"
);
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
());
// 发送智信通知
MTNotificationSendReqDTO
mtNotificationSendReqDTO
=
MTNotificationSendReqDTO
.
builder
().
content
(
message
.
getInfoText
())
...
...
@@ -190,8 +193,8 @@ public class MTNotificationApiRequestClient {
return
false
;
}
bNoticeServiceImpl
.
save
(
bNoticeList
);
//
}
//
bNoticeServiceImpl.save(bNoticeList);
}
}
}
...
...
src/main/resources/application-mt.yml
View file @
e7ee52c2
...
...
@@ -124,4 +124,5 @@ notice:
properties
:
urlCourse
:
http://192.168.9.39:8001/#/courseDetail?
urlTrain
:
http://192.168.9.39:8001/#/trainDetail?
urlExam
:
http://192.168.9.39:8001/#/onlineExamination?
\ No newline at end of file
urlExam
:
http://192.168.9.39:8001/#/onlineExamination?
defaultUrl
:
http://zx-zgiot-002.oss-cn-qingdao.aliyuncs.com/image/2d60950fefa14041b4d9715a70a7d389.png
\ No newline at end of file
src/main/resources/application-test.yml
View file @
e7ee52c2
...
...
@@ -123,6 +123,7 @@ ribbon:
notice
:
properties
:
urlCourse
:
http://192.168.9.39:8001/#/courseDetail?
urlTrain
:
http://192.168.9.39:8001/#/trainDetail?
urlExam
:
http://192.168.9.39:8001/#/onlineExamination?
\ No newline at end of file
urlCourse
:
http://192.168.5.54/education-mobile/#/courseDetail?
urlTrain
:
http://192.168.5.54/education-mobile/#/trainDetail?
urlExam
:
http://192.168.5.54/education-mobile/#/onlineExamination?
defaultUrl
:
http://zx-zgiot-002.oss-cn-qingdao.aliyuncs.com/image/2d60950fefa14041b4d9715a70a7d389.png
\ No newline at end of file
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