Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roncoo
roncoo-education
提交
44200a0b
R
roncoo-education
项目概览
roncoo
/
roncoo-education
10 个月 前同步成功
通知
146
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roncoo-education
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
44200a0b
编写于
7月 06, 2022
作者:
K
keyh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
课程增加一键导入ES功能
上级
8730e89e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
104 addition
and
4 deletion
+104
-4
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/CourseDao.java
.../main/java/com/roncoo/education/course/dao/CourseDao.java
+9
-0
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/impl/CourseDaoImpl.java
...a/com/roncoo/education/course/dao/impl/CourseDaoImpl.java
+9
-0
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/pc/PcApiCourseController.java
...oo/education/course/service/pc/PcApiCourseController.java
+7
-4
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/pc/biz/PcApiCourseBiz.java
...oncoo/education/course/service/pc/biz/PcApiCourseBiz.java
+40
-0
roncoo-education-user/roncoo-education-user-feign/src/main/java/com/roncoo/education/user/feign/interfaces/IFeignLecturer.java
...oncoo/education/user/feign/interfaces/IFeignLecturer.java
+8
-0
roncoo-education-user/roncoo-education-user-feign/src/main/java/com/roncoo/education/user/feign/interfaces/qo/LecturerQO.java
...roncoo/education/user/feign/interfaces/qo/LecturerQO.java
+5
-0
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/dao/LecturerDao.java
.../main/java/com/roncoo/education/user/dao/LecturerDao.java
+8
-0
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/dao/impl/LecturerDaoImpl.java
...a/com/roncoo/education/user/dao/impl/LecturerDaoImpl.java
+8
-0
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/feign/FeignLecturerController.java
.../roncoo/education/user/feign/FeignLecturerController.java
+5
-0
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/feign/biz/FeignLecturerBiz.java
...com/roncoo/education/user/feign/biz/FeignLecturerBiz.java
+5
-0
未找到文件。
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/CourseDao.java
浏览文件 @
44200a0b
...
...
@@ -50,4 +50,13 @@ public interface CourseDao {
* @return
*/
List
<
Course
>
listBycategoryId2AndStatusId
(
Long
categoryId2
,
Integer
statusId
);
/**
* 根据状态获取课程信息
*
* @param isPutaway
* @param statusId
* @return
*/
List
<
Course
>
listByIsPutawayAndStatusId
(
Integer
isPutaway
,
Integer
statusId
);
}
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/impl/CourseDaoImpl.java
浏览文件 @
44200a0b
...
...
@@ -87,4 +87,13 @@ public class CourseDaoImpl implements CourseDao {
example
.
setOrderByClause
(
"sort desc,id desc"
);
return
this
.
courseMapper
.
selectByExample
(
example
);
}
@Override
public
List
<
Course
>
listByIsPutawayAndStatusId
(
Integer
isPutaway
,
Integer
statusId
)
{
CourseExample
example
=
new
CourseExample
();
CourseExample
.
Criteria
c
=
example
.
createCriteria
();
c
.
andIsPutawayEqualTo
(
isPutaway
);
c
.
andStatusIdEqualTo
(
statusId
);
return
this
.
courseMapper
.
selectByExample
(
example
);
}
}
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/pc/PcApiCourseController.java
浏览文件 @
44200a0b
...
...
@@ -13,10 +13,7 @@ import com.roncoo.education.course.service.pc.resq.CoursePageRESQ;
import
com.roncoo.education.course.service.pc.resq.CourseViewRESQ
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
/**
* 课程信息
...
...
@@ -76,4 +73,10 @@ public class PcApiCourseController extends BaseController {
return
biz
.
view
(
courseViewREQ
);
}
@ApiOperation
(
value
=
"一键导入ES"
,
notes
=
"一键导入ES"
)
@PostMapping
(
value
=
"/es/add"
)
public
Result
<
String
>
addEs
()
{
return
biz
.
addEs
();
}
}
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/pc/biz/PcApiCourseBiz.java
浏览文件 @
44200a0b
...
...
@@ -18,6 +18,7 @@ import com.roncoo.education.course.service.pc.req.CourseUpdateREQ;
import
com.roncoo.education.course.service.pc.req.CourseViewREQ
;
import
com.roncoo.education.course.service.pc.resq.*
;
import
com.roncoo.education.user.feign.interfaces.IFeignLecturer
;
import
com.roncoo.education.user.feign.interfaces.qo.LecturerQO
;
import
com.roncoo.education.user.feign.interfaces.vo.LecturerVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
...
...
@@ -29,7 +30,11 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 课程信息
...
...
@@ -58,6 +63,7 @@ public class PcApiCourseBiz extends BaseBiz {
private
CourseChapterPeriodDao
courseChapterPeriodDao
;
@Autowired
private
ElasticsearchRestTemplate
elasticsearchRestTemplate
;
/**
* 分页列出
*
...
...
@@ -298,4 +304,38 @@ public class PcApiCourseBiz extends BaseBiz {
return
Result
.
success
(
resq
);
}
public
Result
<
String
>
addEs
()
{
// 查询全部,删除全部索引重建
List
<
Course
>
courseList
=
dao
.
listByIsPutawayAndStatusId
(
IsPutawayEnum
.
YES
.
getCode
(),
StatusIdEnum
.
YES
.
getCode
());
if
(
CollectionUtil
.
isEmpty
(
courseList
))
{
return
Result
.
error
(
"暂无导入课程"
);
}
List
<
Long
>
lecturerUserNos
=
courseList
.
stream
().
map
(
Course:
:
getLecturerUserNo
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
LecturerVO
>
lecturerNameMap
=
new
HashMap
<>();
LecturerQO
lecturerQO
=
new
LecturerQO
();
lecturerQO
.
setLecturerUserNos
(
lecturerUserNos
);
List
<
LecturerVO
>
lecturerVOList
=
bossLecturer
.
listByLecturerUserNos
(
lecturerQO
);
if
(
CollectionUtil
.
isNotEmpty
(
lecturerVOList
))
{
lecturerNameMap
=
lecturerVOList
.
stream
().
collect
(
Collectors
.
toMap
(
LecturerVO:
:
getLecturerUserNo
,
item
->
item
));
}
List
<
IndexQuery
>
queries
=
new
ArrayList
<>();
try
{
// 查询讲师名称并插入es
for
(
Course
course
:
courseList
)
{
EsCourse
esCourse
=
BeanUtil
.
copyProperties
(
course
,
EsCourse
.
class
);
LecturerVO
lecturerVO
=
lecturerNameMap
.
get
(
course
.
getLecturerUserNo
());
if
(
ObjectUtil
.
isNotNull
(
lecturerVO
)
&&
!
StringUtils
.
isEmpty
(
lecturerVO
.
getLecturerName
()))
{
esCourse
.
setLecturerName
(
lecturerVO
.
getLecturerName
());
}
IndexQuery
query
=
new
IndexQueryBuilder
().
withObject
(
esCourse
).
build
();
queries
.
add
(
query
);
}
elasticsearchRestTemplate
.
indexOps
(
EsCourse
.
class
).
delete
();
elasticsearchRestTemplate
.
bulkIndex
(
queries
,
IndexCoordinates
.
of
(
EsCourse
.
COURSE
));
}
catch
(
Exception
e
)
{
logger
.
warn
(
"elasticsearch更新数据失败"
,
e
);
return
Result
.
error
(
"导入失败"
);
}
return
Result
.
success
(
"导入成功"
);
}
}
roncoo-education-user/roncoo-education-user-feign/src/main/java/com/roncoo/education/user/feign/interfaces/IFeignLecturer.java
浏览文件 @
44200a0b
...
...
@@ -47,5 +47,13 @@ public interface IFeignLecturer {
*/
@RequestMapping
(
value
=
"/feign/user/lecturer/listAllForLecturer"
,
method
=
RequestMethod
.
POST
)
List
<
LecturerVO
>
listAllForLecturer
();
/**
* 根据讲师编号集合获取讲师信息
*
* @param lecturerQO
* @return
*/
@RequestMapping
(
value
=
"/lecturer/listByLecturerUserNos"
,
method
=
RequestMethod
.
POST
)
List
<
LecturerVO
>
listByLecturerUserNos
(
@RequestBody
LecturerQO
lecturerQO
);
}
roncoo-education-user/roncoo-education-user-feign/src/main/java/com/roncoo/education/user/feign/interfaces/qo/LecturerQO.java
浏览文件 @
44200a0b
...
...
@@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* 讲师信息
...
...
@@ -78,4 +79,8 @@ public class LecturerQO implements Serializable {
* 讲师分成比例
*/
private
BigDecimal
lecturerProportion
;
/**
* 讲师编号集合
*/
private
List
<
Long
>
lecturerUserNos
;
}
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/dao/LecturerDao.java
浏览文件 @
44200a0b
...
...
@@ -46,4 +46,12 @@ public interface LecturerDao {
* @author WY
*/
Lecturer
getByLecturerUserNoAndStatusId
(
Long
lecturerUserNo
,
Integer
statusId
);
/**
* 根据讲师编号集合获取讲师信息
*
* @param lecturerUserNos
* @return
*/
List
<
Lecturer
>
listByLecturerUserNos
(
List
<
Long
>
lecturerUserNos
);
}
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/dao/impl/LecturerDaoImpl.java
浏览文件 @
44200a0b
...
...
@@ -93,4 +93,12 @@ public class LecturerDaoImpl implements LecturerDao {
}
return
resultList
.
get
(
0
);
}
@Override
public
List
<
Lecturer
>
listByLecturerUserNos
(
List
<
Long
>
lecturerUserNos
)
{
LecturerExample
example
=
new
LecturerExample
();
LecturerExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andLecturerUserNoIn
(
lecturerUserNos
);
return
this
.
lecturerMapper
.
selectByExample
(
example
);
}
}
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/feign/FeignLecturerController.java
浏览文件 @
44200a0b
...
...
@@ -57,6 +57,11 @@ public class FeignLecturerController extends BaseController implements IFeignLec
return
biz
.
listAllForLecturer
();
}
@Override
public
List
<
LecturerVO
>
listByLecturerUserNos
(
LecturerQO
lecturerQO
)
{
return
biz
.
listByLecturerUserNos
(
lecturerQO
);
}
/***
* 根据讲师用户编号查找讲师信息
*/
...
...
roncoo-education-user/roncoo-education-user-service/src/main/java/com/roncoo/education/user/feign/biz/FeignLecturerBiz.java
浏览文件 @
44200a0b
...
...
@@ -106,4 +106,9 @@ public class FeignLecturerBiz {
List
<
Lecturer
>
lecturerList
=
dao
.
listByStatusId
(
StatusIdEnum
.
YES
.
getCode
());
return
PageUtil
.
copyList
(
lecturerList
,
LecturerVO
.
class
);
}
public
List
<
LecturerVO
>
listByLecturerUserNos
(
LecturerQO
lecturerQO
)
{
List
<
Lecturer
>
lecturerList
=
dao
.
listByLecturerUserNos
(
lecturerQO
.
getLecturerUserNos
());
return
PageUtil
.
copyList
(
lecturerList
,
LecturerVO
.
class
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录