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
9b88068b
Commit
9b88068b
authored
Jul 02, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增FeignConfig
parent
d01b1e29
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
32 deletions
+143
-32
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+36
-6
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+11
-9
BMessageController.java
...soft/business/bmessage/controller/BMessageController.java
+11
-0
BMessageService.java
...rg/rcisoft/business/bmessage/service/BMessageService.java
+7
-0
BMessageServiceImpl.java
...t/business/bmessage/service/impl/BMessageServiceImpl.java
+19
-7
MTUserInfoRspDTO.java
...va/org/rcisoft/common/util/feignDto/MTUserInfoRspDTO.java
+0
-10
FeignConfig.java
src/main/java/org/rcisoft/config/FeignConfig.java
+59
-0
No files found.
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
9b88068b
...
...
@@ -1273,12 +1273,42 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* 查询平台推荐
* @return
*/
@Select
(
" select * from b_lesson "
+
" where 1=1 "
+
" and del_flag != 1 "
+
" and flag = 1 "
+
" and is_push = 1 "
+
" and corp_id = #{corpId} "
)
@Select
(
" <script> select distinct bl.* "
+
" ,su.name lecturerName "
+
" ,suc.name createByName "
+
" from b_lesson bl "
+
" left join s_user su on su.business_id = bl.lecturer_id "
+
// " and su.del_flag != 1 and su.flag = 1 " +
" and su.corp_id = #{curUser.corpId} "
+
" left join s_user suc on suc.business_id = bl.create_by "
+
// " and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{curUser.corpId} "
+
" left join b_viewrange bv on bl.business_id = bv.lesson_id "
+
" and bv.del_flag != 1 and bv.flag = 1 "
+
" and bv.corp_id = #{curUser.corpId} "
+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id "
+
// " left join b_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and bl.corp_id = #{curUser.corpId} "
+
" and bl.release_state = 2 "
+
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) "
+
" or (bl.lecturer_id = #{curUser.userId}) "
+
" <if test=\"departs != null and departs.size() > 0 \"> "
+
" or (bvs.type = 1 and bvs.target_id in "
+
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)"
+
" </if> "
+
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 AND lesson_id IS NOT NULL ))) "
+
" and bl.person_number >= (select `value` from b_dictionary where type = 'ZXRS' and corp_id = #{curUser.corpId}) + 0 "
+
//ZXRS 在学人数
" order by CAST(bl.person_number AS UNSIGNED) desc,bl.release_date desc "
+
"</script>"
)
@ResultMap
(
value
=
"BasePushResultMap"
)
List
<
BLesson
>
queryPush
(
String
corpId
);
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
9b88068b
...
...
@@ -248,16 +248,18 @@ public class BLessonServiceImpl implements BLessonService {
@Override
public
List
<
BLesson
>
queryPushByPagination
(
PageUtil
pageUtil
,
CurUser
curUser
)
{
List
<
BLesson
>
result
=
bLessonRepository
.
queryPush
(
curUser
.
getCorpId
());
for
(
BLesson
b
:
result
){
String
pushLable
=
bLessonRepository
.
getPushLable
(
b
.
getBusinessId
());
if
(
StringUtils
.
isEmpty
(
pushLable
)){
b
.
setLabelList
(
bLessonRepository
.
queryLabelByLessonId
(
b
.
getBusinessId
()));
}
else
{
b
.
setLabelList
(
bLessonRepository
.
queryPushLabelByLessonId
(
pushLable
,
b
.
getBusinessId
()));
}
List
<
String
>
ids
=
Arrays
.
asList
(
new
String
[]{
curUser
.
getUserId
()});
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
)
{
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
List
<
BLesson
>
result
=
bLessonRepository
.
queryPersonMore
(
curUser
,
departs
);
return
addNew
(
result
);
}
...
...
src/main/java/org/rcisoft/business/bmessage/controller/BMessageController.java
View file @
9b88068b
...
...
@@ -70,6 +70,17 @@ public class BMessageController extends PaginationController<BMessage> {
bMessage
);
}
@ApiOperation
(
value
=
"修改共享 "
,
notes
=
"修改"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
"/updateSycn"
)
public
Result
updateSycn
(
CurUser
curUser
,
@Valid
BMessage
bMessage
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bMessageServiceImpl
.
updateSycn
(
curUser
,
bMessage
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bMessage
);
}
@ApiOperation
(
value
=
"查看 集合"
,
notes
=
"查看 集合"
)
@GetMapping
(
value
=
"/query"
)
...
...
src/main/java/org/rcisoft/business/bmessage/service/BMessageService.java
View file @
9b88068b
...
...
@@ -33,6 +33,13 @@ public interface BMessageService {
*/
PersistModel
merge
(
CurUser
curUser
,
BMessage
bMessage
);
/**
* 修改
* @param bMessage
* @return
*/
PersistModel
updateSycn
(
CurUser
curUser
,
BMessage
bMessage
);
/**
* 根据id查询
* @param id
...
...
src/main/java/org/rcisoft/business/bmessage/service/impl/BMessageServiceImpl.java
View file @
9b88068b
...
...
@@ -98,18 +98,30 @@ public class BMessageServiceImpl implements BMessageService {
@Override
public
PersistModel
merge
(
CurUser
curUser
,
BMessage
bMessage
){
//判断是否修改课程共享状态
if
(
bMessage
.
getSort
()
==
8
){
sendLog
(
curUser
,
bMessage
);
//开启共享时同步课程
if
(
"1"
.
equals
(
bMessage
.
getTimeValue
()))
sycnBPLesson
(
curUser
);
}
UserUtil
.
setCurrentMergeOperation
(
bMessage
);
int
line
=
bMessageRepository
.
updateByPrimaryKeySelective
(
bMessage
);
return
new
PersistModel
(
line
);
}
/**
* 修改 bMessage
* @param bMessage
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
updateSycn
(
CurUser
curUser
,
BMessage
bMessage
){
//保存课程日志
sendLog
(
curUser
,
bMessage
);
//开启共享时同步课程
if
(
"1"
.
equals
(
bMessage
.
getTimeValue
()))
sycnBPLesson
(
curUser
);
UserUtil
.
setCurrentMergeOperation
(
bMessage
);
int
line
=
bMessageRepository
.
updateByPrimaryKeySelective
(
bMessage
);
return
new
PersistModel
(
line
);
}
/**
* 根据id查询 bMessage
* @param id
...
...
src/main/java/org/rcisoft/common/util/feignDto/MTUserInfoRspDTO.java
View file @
9b88068b
...
...
@@ -79,16 +79,6 @@ public class MTUserInfoRspDTO {
private
List
<
RolesBean
>
roles
;
public
String
getIsHide
()
{
return
isHide
;
}
public
void
setIsHide
(
String
isHide
)
{
this
.
isHide
=
isHide
;
}
private
String
isHide
;
public
String
getId
()
{
return
id
;
}
...
...
src/main/java/org/rcisoft/config/FeignConfig.java
0 → 100644
View file @
9b88068b
package
org
.
rcisoft
.
config
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
feign.codec.Decoder
;
import
feign.codec.Encoder
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConverters
;
import
org.springframework.cloud.openfeign.support.ResponseEntityDecoder
;
import
org.springframework.cloud.openfeign.support.SpringDecoder
;
import
org.springframework.cloud.openfeign.support.SpringEncoder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
/**
* 重写Feign序列化和反序列化的接口
* Feign 调用接收参数不需要 一一对应
*/
@Configuration
public
class
FeignConfig
{
public
ObjectMapper
customObjectMapper
()
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
//Customize as much as you want
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
return
objectMapper
;
}
/**
* 重写解码器
*
* @return Decoder
*/
@Bean
public
Decoder
feignDecoder
()
{
HttpMessageConverter
jacksonConverter
=
new
MappingJackson2HttpMessageConverter
(
customObjectMapper
());
ObjectFactory
<
HttpMessageConverters
>
objectFactory
=
()
->
new
HttpMessageConverters
(
jacksonConverter
);
return
new
ResponseEntityDecoder
(
new
SpringDecoder
(
objectFactory
));
}
/**
* 重写编码器
*
* @return Encoder
*/
@Bean
public
Encoder
feignEncoder
()
{
HttpMessageConverter
jacksonConverter
=
new
MappingJackson2HttpMessageConverter
(
customObjectMapper
());
ObjectFactory
<
HttpMessageConverters
>
objectFactory
=
()
->
new
HttpMessageConverters
(
jacksonConverter
);
return
new
SpringEncoder
(
objectFactory
);
}
}
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