Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
study-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
study-platform
Commits
af3d966a
Commit
af3d966a
authored
Mar 17, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改人员学习
parent
bb3215eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
54 deletions
+71
-54
study-manager/src/main/java/com/mortals/xhx/module/notice/web/NoticeStudyController.java
.../mortals/xhx/module/notice/web/NoticeStudyController.java
+31
-23
study-manager/src/main/java/com/mortals/xhx/module/project/web/ProjectStudyController.java
...ortals/xhx/module/project/web/ProjectStudyController.java
+40
-31
No files found.
study-manager/src/main/java/com/mortals/xhx/module/notice/web/NoticeStudyController.java
View file @
af3d966a
package
com.mortals.xhx.module.notice.web
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
...
...
@@ -13,8 +14,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.notice.model.NoticeStudyEntity
;
import
com.mortals.xhx.module.notice.service.NoticeStudyService
;
...
...
@@ -23,20 +26,22 @@ import com.mortals.framework.util.StringUtils;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
*
* 公告学习人员
*
* @author zxfei
* @date 2023-02-23
*/
* 公告学习人员
*
* @author zxfei
* @date 2023-02-23
*/
@RestController
@RequestMapping
(
"notice/study"
)
public
class
NoticeStudyController
extends
BaseCRUDJsonBodyMappingController
<
NoticeStudyService
,
NoticeStudyEntity
,
Long
>
{
public
class
NoticeStudyController
extends
BaseCRUDJsonBodyMappingController
<
NoticeStudyService
,
NoticeStudyEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
...
...
@@ -44,15 +49,15 @@ public class NoticeStudyController extends BaseCRUDJsonBodyMappingController<Not
private
NoticeService
noticeService
;
public
NoticeStudyController
(){
super
.
setModuleDesc
(
"公告学习人员"
);
public
NoticeStudyController
()
{
super
.
setModuleDesc
(
"公告学习人员"
);
}
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"noticetType"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"noticetType"
));
this
.
addDict
(
model
,
"noticeStatus"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"noticeStatus"
));
this
.
addDict
(
model
,
"top"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"top"
));
this
.
addDict
(
model
,
"noticetType"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"noticetType"
));
this
.
addDict
(
model
,
"noticeStatus"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"noticeStatus"
));
this
.
addDict
(
model
,
"top"
,
paramService
.
getParamBySecondOrganize
(
"NoticeStudy"
,
"top"
));
super
.
init
(
model
,
context
);
}
...
...
@@ -61,7 +66,7 @@ public class NoticeStudyController extends BaseCRUDJsonBodyMappingController<Not
protected
void
doListBefore
(
NoticeStudyEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
super
.
doListBefore
(
query
,
model
,
context
);
Integer
userType
=
context
.
getUser
().
getUserType
();
if
(!
org
.
apache
.
commons
.
lang3
.
ObjectUtils
.
isEmpty
(
userType
)&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
if
(!
ObjectUtils
.
isEmpty
(
userType
)
&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
query
.
setUserId
(
this
.
service
.
getContextUserId
(
context
));
}
List
<
OrderCol
>
orderColList
=
new
ArrayList
<>();
...
...
@@ -73,16 +78,19 @@ public class NoticeStudyController extends BaseCRUDJsonBodyMappingController<Not
@Override
protected
int
viewAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
NoticeStudyEntity
entity
,
Context
context
)
throws
AppException
{
NoticeEntity
noticeEntity
=
noticeService
.
get
(
entity
.
getNoticeId
());
entity
.
setNoticeContent
(
noticeEntity
.
getNoticeContent
());
entity
.
setFileName
(
noticeEntity
.
getFileName
());
entity
.
setFilePath
(
noticeEntity
.
getFilePath
());
if
(
ObjectUtils
.
isEmpty
(
entity
.
getViewTime
())&&
NoticeStatusEnum
.
未读
.
getValue
()==
entity
.
getNoticeStatus
()){
entity
.
setViewTime
(
new
Date
());
entity
.
setNoticeStatus
(
NoticeStatusEnum
.
已读
.
getValue
());
entity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
entity
.
setUpdateTime
(
new
Date
());
this
.
service
.
update
(
entity
,
context
);
Integer
userType
=
context
.
getUser
().
getUserType
();
if
(!
ObjectUtils
.
isEmpty
(
userType
)
&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
NoticeEntity
noticeEntity
=
noticeService
.
get
(
entity
.
getNoticeId
());
entity
.
setNoticeContent
(
noticeEntity
.
getNoticeContent
());
entity
.
setFileName
(
noticeEntity
.
getFileName
());
entity
.
setFilePath
(
noticeEntity
.
getFilePath
());
if
(
ObjectUtils
.
isEmpty
(
entity
.
getViewTime
())
&&
NoticeStatusEnum
.
未读
.
getValue
()
==
entity
.
getNoticeStatus
())
{
entity
.
setViewTime
(
new
Date
());
entity
.
setNoticeStatus
(
NoticeStatusEnum
.
已读
.
getValue
());
entity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
entity
.
setUpdateTime
(
new
Date
());
this
.
service
.
update
(
entity
,
context
);
}
}
return
super
.
viewAfter
(
id
,
model
,
entity
,
context
);
}
...
...
study-manager/src/main/java/com/mortals/xhx/module/project/web/ProjectStudyController.java
View file @
af3d966a
package
com.mortals.xhx.module.project.web
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.util.DateUtils
;
...
...
@@ -17,8 +18,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.project.model.ProjectStudyEntity
;
import
com.mortals.xhx.module.project.service.ProjectStudyService
;
...
...
@@ -27,20 +30,22 @@ import com.mortals.framework.util.StringUtils;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
*
* 项目学习人员
*
* @author zxfei
* @date 2023-02-23
*/
* 项目学习人员
*
* @author zxfei
* @date 2023-02-23
*/
@RestController
@RequestMapping
(
"project/study"
)
public
class
ProjectStudyController
extends
BaseCRUDJsonBodyMappingController
<
ProjectStudyService
,
ProjectStudyEntity
,
Long
>
{
public
class
ProjectStudyController
extends
BaseCRUDJsonBodyMappingController
<
ProjectStudyService
,
ProjectStudyEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
...
...
@@ -50,16 +55,16 @@ public class ProjectStudyController extends BaseCRUDJsonBodyMappingController<Pr
@Autowired
private
ProjectService
projectService
;
public
ProjectStudyController
(){
super
.
setModuleDesc
(
"项目学习人员"
);
public
ProjectStudyController
()
{
super
.
setModuleDesc
(
"项目学习人员"
);
}
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"projectType"
,
paramService
.
getParamBySecondOrganize
(
"ProjectStudy"
,
"projectType"
));
this
.
addDict
(
model
,
"projectType"
,
paramService
.
getParamBySecondOrganize
(
"ProjectStudy"
,
"projectType"
));
this
.
addDict
(
model
,
"studyStatus"
,
StudyStatusEnum
.
getEnumMap
());
this
.
addDict
(
model
,
"top"
,
paramService
.
getParamBySecondOrganize
(
"ProjectStudy"
,
"top"
));
this
.
addDict
(
model
,
"createUserId"
,
userService
.
find
(
new
UserQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getRealName
())));
this
.
addDict
(
model
,
"top"
,
paramService
.
getParamBySecondOrganize
(
"ProjectStudy"
,
"top"
));
this
.
addDict
(
model
,
"createUserId"
,
userService
.
find
(
new
UserQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getRealName
())));
super
.
init
(
model
,
context
);
}
...
...
@@ -70,7 +75,7 @@ public class ProjectStudyController extends BaseCRUDJsonBodyMappingController<Pr
super
.
doListBefore
(
query
,
model
,
context
);
Integer
userType
=
context
.
getUser
().
getUserType
();
if
(!
ObjectUtils
.
isEmpty
(
userType
)&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
if
(!
ObjectUtils
.
isEmpty
(
userType
)
&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
query
.
setUserId
(
this
.
service
.
getContextUserId
(
context
));
}
List
<
OrderCol
>
orderColList
=
new
ArrayList
<>();
...
...
@@ -83,24 +88,28 @@ public class ProjectStudyController extends BaseCRUDJsonBodyMappingController<Pr
@Override
protected
int
viewAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
ProjectStudyEntity
entity
,
Context
context
)
throws
AppException
{
ProjectEntity
projectEntity
=
projectService
.
get
(
entity
.
getProjectId
());
entity
.
setStudyContent
(
projectEntity
.
getStudyContent
());
entity
.
setFileName
(
projectEntity
.
getFileName
());
entity
.
setFilePath
(
projectEntity
.
getFilePath
());
//判断时间是否在学习时间范围内
Date
projectStartTime
=
projectEntity
.
getProjectStartTime
();
Date
projectEndTime
=
projectEntity
.
getProjectEndTime
();
entity
.
setProjectStartTime
(
projectEntity
.
getProjectStartTime
());
entity
.
setProjectEndTime
(
projectEntity
.
getProjectEndTime
());
long
curTime
=
DateUtils
.
getCurrDatetime
().
getTime
();
if
(
projectEndTime
.
getTime
()>
curTime
&&
curTime
>
projectStartTime
.
getTime
()){
if
(
entity
.
getStudyStatus
()==
StudyStatusEnum
.
未学习
.
getValue
()){
entity
.
setStudyStatus
(
StudyStatusEnum
.
已学习
.
getValue
());
entity
.
setUpdateTime
(
new
Date
());
entity
.
setUpdateUserId
(
this
.
service
.
getContextUserId
(
context
));
this
.
service
.
update
(
entity
,
context
);
Integer
userType
=
context
.
getUser
().
getUserType
();
if
(!
org
.
springframework
.
util
.
ObjectUtils
.
isEmpty
(
userType
)
&&
userType
==
UserType
.
WORK_PERSON
.
getValue
())
{
ProjectEntity
projectEntity
=
projectService
.
get
(
entity
.
getProjectId
());
entity
.
setStudyContent
(
projectEntity
.
getStudyContent
());
entity
.
setFileName
(
projectEntity
.
getFileName
());
entity
.
setFilePath
(
projectEntity
.
getFilePath
());
//判断时间是否在学习时间范围内
Date
projectStartTime
=
projectEntity
.
getProjectStartTime
();
Date
projectEndTime
=
projectEntity
.
getProjectEndTime
();
entity
.
setProjectStartTime
(
projectEntity
.
getProjectStartTime
());
entity
.
setProjectEndTime
(
projectEntity
.
getProjectEndTime
());
long
curTime
=
DateUtils
.
getCurrDatetime
().
getTime
();
if
(
projectEndTime
.
getTime
()
>
curTime
&&
curTime
>
projectStartTime
.
getTime
())
{
if
(
entity
.
getStudyStatus
()
==
StudyStatusEnum
.
未学习
.
getValue
())
{
entity
.
setStudyStatus
(
StudyStatusEnum
.
已学习
.
getValue
());
entity
.
setUpdateTime
(
new
Date
());
entity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
this
.
service
.
update
(
entity
,
context
);
}
}
}
return
super
.
viewAfter
(
id
,
model
,
entity
,
context
);
...
...
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