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
8abd7980
Commit
8abd7980
authored
Oct 16, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新接口
parent
560c0e12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
15 deletions
+36
-15
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+2
-5
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+20
-4
BRStudentChapterRepository.java
...ness/brstudentchapter/dao/BRStudentChapterRepository.java
+8
-0
BRStudentChapterServiceImpl.java
...dentchapter/service/impl/BRStudentChapterServiceImpl.java
+6
-6
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
8abd7980
...
...
@@ -33,10 +33,7 @@ import org.rcisoft.sys.role.dao.SysRoleRepository;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -116,7 +113,7 @@ public class BChapterController extends PaginationController<BChapter> {
}
@ApiOperation
(
value
=
"205 查询章节带进度"
,
notes
=
"根据lessonId查询章节带进度"
,
response
=
QueryChapterListResDTO
.
class
)
@GetMapping
(
value
=
"/queryBChaptersWithProgress"
)
public
Result
queryBChaptersWithProgress
(
CurUser
curUser
,
@Valid
String
lessonId
,
BindingResult
br
)
{
public
Result
queryBChaptersWithProgress
(
CurUser
curUser
,
@RequestParam
String
lessonId
,
BindingResult
br
)
{
Map
<
String
,
Object
>
map
=
new
HashedMap
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
8abd7980
...
...
@@ -37,6 +37,7 @@ import java.io.*;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -93,16 +94,31 @@ public class BChapterServiceImpl implements BChapterService {
model
.
setLessonId
(
lessonId
);
model
.
setStudentId
(
curUser
.
getUserId
());
List
<
QueryChapterListResDTO
>
queryChapterListResDTOS
=
queryChapterListResDTO
(
model
,
curUser
.
getCorpId
());
queryChapterListResDTOS
.
stream
().
forEach
(
queryChapterListResDTO
->
{
queryChapterListResDTO
.
getChildList
().
stream
().
forEach
(
childList
->
{
int
i
=
0
;
int
percent
=
0
;
for
(
QueryChapterListResDTO
queryChapterListResDTO:
queryChapterListResDTOS
){
for
(
QueryChapterListResDTO
childList:
queryChapterListResDTO
.
getChildList
()){
List
<
BRStudentChapter
>
brStudentChapterList
=
brStudentChapterRepository
.
queryByStuIdAndChapter
(
childList
.
getBusinessId
(),
curUser
.
getUserId
());
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()
>
0
)
{
childList
.
setProgress
(
brStudentChapterList
.
get
(
0
).
getProgress
());
String
temp
=
brStudentChapterList
.
get
(
0
).
getProgress
().
substring
(
0
,
brStudentChapterList
.
get
(
0
).
getProgress
().
length
()-
1
);
percent
+=
Float
.
valueOf
(
temp
);
}
});
});
i
++;
}
}
// queryChapterListResDTOS.stream().forEach(queryChapterListResDTO -> {
// queryChapterListResDTO.getChildList().stream().forEach(childList -> {
// List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
// if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
// childList.setProgress(brStudentChapterList.get(0).getProgress());
// }
// });
// });
Map
map
=
new
HashMap
();
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
//设置保留位数
map
.
put
(
"chapterList"
,
queryChapterListResDTOS
);
map
.
put
(
"totalProgress"
,
df
.
format
((
float
)
percent
/
i
)
+
"%"
);
map
.
put
(
"lessonInfo"
,
bLessonRepository
.
selectByPrimaryKey
(
model
.
getLessonId
()));
return
map
;
}
...
...
src/main/java/org/rcisoft/business/brstudentchapter/dao/BRStudentChapterRepository.java
View file @
8abd7980
package
org
.
rcisoft
.
business
.
brstudentchapter
.
dao
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Update
;
import
org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.business.brstudentchapter.entity.BRStudentChapter
;
...
...
@@ -38,5 +39,12 @@ public interface BRStudentChapterRepository extends BaseMapper<BRStudentChapter>
+
"</script>"
)
@ResultMap
(
value
=
"BRStudentChapterResultMap"
)
List
<
BRStudentChapter
>
queryByStuIdAndChapter
(
@Param
(
"chapterId"
)
String
chapterId
,
@Param
(
"studentId"
)
String
studentId
);
@Update
(
"UPDATE b_r_student_chapter "
+
"SET progress = #{progress} "
+
"WHERE "
+
" business_id = #{businessId} "
)
@ResultMap
(
value
=
"BRStudentChapterResultMap"
)
int
updateById
(
BRStudentChapter
brStudentChapter
);
}
src/main/java/org/rcisoft/business/brstudentchapter/service/impl/BRStudentChapterServiceImpl.java
View file @
8abd7980
...
...
@@ -44,16 +44,16 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
public
PersistModel
save
(
BRStudentChapterDto
brStudentChapterDto
){
int
line
=
0
;
List
<
BRStudentChapter
>
brStudentChapterList
=
bRStudentChapterRepository
.
queryByStuIdAndChapter
(
brStudentChapterDto
.
getChapterId
(),
brStudentChapterDto
.
getStudentId
());
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
//设置保留位数
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()
>
0
){
// DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
// df.format((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration());
BRStudentChapter
brStudentChapter
=
brStudentChapterList
.
get
(
0
);
if
(
brStudentChapterDto
.
getCurrent
()
==
brStudentChapterDto
.
getDuration
()){
// who finish
brStudentChapter
.
setProgress
(
"100%"
);
}
else
brStudentChapter
.
setProgress
(
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
100
+
"%"
);
line
=
bRStudentChapterRepository
.
updateByPrimaryKey
(
brStudentChapter
);
}
else
{
brStudentChapter
.
setProgress
(
df
.
format
((
float
)
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
100
)+
"%"
);
}
line
=
bRStudentChapterRepository
.
updateById
(
brStudentChapter
);
}
else
{
BRStudentChapter
brStudentChapter
=
new
BRStudentChapter
();
brStudentChapter
.
setBusinessId
(
IdGen
.
uuid
());
...
...
@@ -66,7 +66,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}
else
{
brStudentChapter
.
setIsComplete
(
"0"
);
// brStudentChapter.setAutomatic("0");
brStudentChapter
.
setProgress
(
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
100
+
"%"
);
brStudentChapter
.
setProgress
(
df
.
format
(
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
100
)
+
"%"
);
}
line
=
bRStudentChapterRepository
.
insertSelective
(
brStudentChapter
);
}
...
...
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