Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
246d074c
提交
246d074c
authored
8月 15, 2021
作者:
133
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[单位 培训] 代码提交
上级
dc05c6a8
流水线
#316
已失败 于阶段
变更
8
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
144 行增加
和
21 行删除
+144
-21
pom.xml
dev-config/pom.xml
+1
-1
WebMvcConfigConfig.java
...src/main/java/com/tykj/dev/config/WebMvcConfigConfig.java
+12
-0
Check.java
.../src/main/java/com/tykj/dev/device/file/entity/Check.java
+7
-0
DocumentDevice.java
.../java/com/tykj/dev/device/file/entity/DocumentDevice.java
+6
-0
JavaToPdfHtmlFreeMarker.java
...om/tykj/dev/device/file/util/JavaToPdfHtmlFreeMarker.java
+43
-12
TrainThemeServiceImpl.java
.../dev/device/train/service/impl/TrainThemeServiceImpl.java
+34
-5
TrainTask.java
...c/main/java/com/tykj/dev/device/train/task/TrainTask.java
+33
-3
UnitsController.java
...j/dev/device/user/subject/controller/UnitsController.java
+8
-0
没有找到文件。
dev-config/pom.xml
浏览文件 @
246d074c
...
...
@@ -16,7 +16,7 @@
<version>
1.0-SNAPSHOT
</version>
</parent>
<properties>
<swagger.version>
2.9.
0
</swagger.version>
<swagger.version>
2.9.
1
</swagger.version>
</properties>
<dependencies>
...
...
dev-config/src/main/java/com/tykj/dev/config/WebMvcConfigConfig.java
浏览文件 @
246d074c
...
...
@@ -20,7 +20,9 @@ import org.springframework.format.support.FormattingConversionService;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.security.web.method.annotation.AuthenticationPrincipalArgumentResolver
;
import
org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
;
...
...
@@ -80,6 +82,16 @@ public class WebMvcConfigConfig extends WebMvcConfigurationSupport {
super
.
addResourceHandlers
(
registry
);
}
@Override
public
void
configureAsyncSupport
(
final
AsyncSupportConfigurer
configurer
)
{
configurer
.
setDefaultTimeout
(
20000
);
configurer
.
registerCallableInterceptors
(
timeoutInterceptor
());
}
@Bean
public
TimeoutCallableProcessingInterceptor
timeoutInterceptor
()
{
return
new
TimeoutCallableProcessingInterceptor
();
}
@Bean
@Override
public
FormattingConversionService
mvcConversionService
()
{
...
...
dev-file/src/main/java/com/tykj/dev/device/file/entity/Check.java
浏览文件 @
246d074c
package
com
.
tykj
.
dev
.
device
.
file
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -29,4 +30,10 @@ public class Check {
private
Integer
oneCount
;
@ApiModelProperty
(
value
=
"配用范围"
)
private
String
matchingRangeName
;
@ApiModelProperty
(
value
=
"设备类型 装备、配件"
)
private
Integer
isPart
;
}
dev-file/src/main/java/com/tykj/dev/device/file/entity/DocumentDevice.java
浏览文件 @
246d074c
...
...
@@ -66,6 +66,12 @@ public class DocumentDevice {
private
Integer
oneCount
;
@ApiModelProperty
(
value
=
"配用范围"
)
private
String
matchingRangeName
;
@ApiModelProperty
(
value
=
"设备类型 装备、配件"
)
private
Integer
isPart
;
public
Integer
getLen
(){
return
deviceSerialNumber
.
length
();
}
...
...
dev-file/src/main/java/com/tykj/dev/device/file/util/JavaToPdfHtmlFreeMarker.java
浏览文件 @
246d074c
...
...
@@ -761,27 +761,58 @@ public class JavaToPdfHtmlFreeMarker {
Map
<
String
,
Check
>
map
=
new
HashMap
<>();
deviceList
.
forEach
(
documentDevice
->
{
String
key
=
documentDevice
.
getModel
()
+
documentDevice
.
getParts
();
if
(
map
.
containsKey
(
key
))
{
Check
check
=
map
.
get
(
key
);
check
.
setCount
(
check
.
getCount
()
+
1
);
List
<
String
>
strings
=
check
.
getStrings
();
String
key
=
documentDevice
.
getModel
()+
documentDevice
.
getParts
()+
documentDevice
.
getMatchingRangeName
()+
documentDevice
.
getIsPart
();
if
(
map
.
containsKey
(
key
)){
Check
check
=
map
.
get
(
key
);
check
.
setMatchingRangeName
(
documentDevice
.
getMatchingRangeName
());
check
.
setIsPart
(
documentDevice
.
getIsPart
());
check
.
setCount
(
check
.
getCount
()+
1
);
List
<
String
>
strings
=
check
.
getStrings
();
strings
.
add
(
documentDevice
.
getDeviceSerialNumber
());
check
.
setStrings
(
strings
);
map
.
put
(
key
,
check
);
}
else
{
Check
check
=
new
Check
();
List
<
String
>
strings
=
new
ArrayList
<>();
map
.
put
(
key
,
check
);
}
else
{
Check
check
=
new
Check
();
List
<
String
>
strings
=
new
ArrayList
<>();
check
.
setCount
(
1
);
check
.
setMatchingRangeName
(
documentDevice
.
getMatchingRangeName
());
check
.
setIsPart
(
documentDevice
.
getIsPart
());
check
.
setModel
(
documentDevice
.
getModel
());
check
.
setName
(
documentDevice
.
getParts
());
strings
.
add
(
documentDevice
.
getDeviceSerialNumber
());
check
.
setStrings
(
strings
);
map
.
put
(
key
,
check
);
map
.
put
(
key
,
check
);
}
}
);
List
<
Check
>
checkList
=
map
.
values
().
stream
().
sorted
(
Comparator
.
comparing
(
Check:
:
getModel
).
thenComparing
(
Check:
:
getMatchingRangeName
).
thenComparing
(
Check:
:
getIsPart
)).
collect
(
Collectors
.
toList
());
map
.
clear
();
checkList
.
forEach
(
check
->
{
String
key
=
check
.
getModel
()+
check
.
getName
();
if
(
map
.
containsKey
(
key
)){
Check
check1
=
map
.
get
(
key
);
// check1.setMatchingRangeName(check.getMatchingRangeName());
// check1.setIsPart(check.getIsPart());
check1
.
setCount
(
check1
.
getCount
()+
check
.
getCount
());
List
<
String
>
strings
=
check1
.
getStrings
();
strings
.
addAll
(
check
.
getStrings
());
check1
.
setStrings
(
strings
);
map
.
put
(
key
,
check1
);
}
else
{
Check
check1
=
new
Check
();
check1
.
setCount
(
check
.
getCount
());
check1
.
setMatchingRangeName
(
check
.
getMatchingRangeName
());
check1
.
setIsPart
(
check
.
getIsPart
());
check1
.
setModel
(
check
.
getModel
());
check1
.
setName
(
check
.
getName
());
List
<
String
>
strings
=
new
ArrayList
<>(
check
.
getStrings
());
check1
.
setStrings
(
strings
);
map
.
put
(
key
,
check1
);
}
}
);
List
<
Check
>
checkList
=
map
.
values
().
stream
().
sorted
(
Comparator
.
comparing
(
Check:
:
getModel
).
thenComparing
(
Check:
:
getName
)).
collect
(
Collectors
.
toList
());
checkList
=
map
.
values
().
stream
().
sorted
(
Comparator
.
comparing
(
Check:
:
getModel
).
thenComparing
(
Check:
:
getMatchingRangeName
).
thenComparing
(
Check:
:
getIsPart
)).
collect
(
Collectors
.
toList
());
List
<
Check
>
checkList2
=
new
ArrayList
<>();
int
i
=
0
;
for
(
int
j
=
0
;
j
<
checkList
.
size
();
j
++)
{
...
...
@@ -865,7 +896,7 @@ public class JavaToPdfHtmlFreeMarker {
private
static
List
<
Check
>
addCheck
(
List
<
Check
>
checks
,
Integer
size
){
for
(
int
i
=
0
;
i
<
size
;
i
++){
checks
.
add
(
new
Check
(
null
,
null
,
null
,
null
,
""
,
1
));
checks
.
add
(
new
Check
(
null
,
null
,
null
,
null
,
""
,
1
,
""
,
1
));
}
return
checks
;
}
...
...
dev-train/src/main/java/com/tykj/dev/device/train/service/impl/TrainThemeServiceImpl.java
浏览文件 @
246d074c
...
...
@@ -20,13 +20,17 @@ import com.tykj.dev.device.train.entity.vo.*;
import
com.tykj.dev.device.train.service.TrainTaskService
;
import
com.tykj.dev.device.train.service.TrainThemeService
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.service.MgrcertService
;
import
com.tykj.dev.device.user.subject.service.UserService
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -37,10 +41,7 @@ import org.springframework.scheduling.annotation.Async;
import
org.springframework.stereotype.Service
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.function.Function
;
...
...
@@ -138,9 +139,25 @@ public class TrainThemeServiceImpl implements TrainThemeService {
ByTrainingPeople
byTrainingPeople
=
trainTheme
.
toByTrainingPeople
();
TrainUser
trainUser
=
trainUserDao
.
findByUserIdAndTrainId
(
userId
,
trainThemeId
);
List
<
TrainUser
>
trainUsers
=
trainUserDao
.
findAllByUnitsIdAndTrainId
(
trainUser
.
getUnitsId
(),
trainThemeId
);
Units
units
=
unitsCache
.
findById
(
trainUser
.
getUnitsId
());
Map
<
Integer
,
User
>
map
=
userService
.
findAllByUnite
(
units
.
getUnitId
()).
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getUserId
,
Function
.
identity
()));
Set
<
Integer
>
ids
=
map
.
keySet
();
ids
.
removeAll
(
trainUsers
.
stream
().
map
(
TrainUser:
:
getUserId
).
collect
(
Collectors
.
toList
()));
if
(
ids
.
size
()>
0
){
ids
.
forEach
(
i
->{
TrainUser
trainUser1
=
userToTrainUser
(
map
.
get
(
i
));
trainUser1
.
setIsSignUp
(
2
);
trainUser1
.
setIsNotJoinUserId
(
1
);
trainUser1
.
setTrainId
(
trainTheme
.
getTrainId
());
trainUser1
=
saveTrainUser
(
trainUser1
);
trainUsers
.
add
(
trainUser1
);
});
}
trainUsers
.
forEach
(
trainUser1
->
trainUser1
.
setMgrcert
(
mgrcertService
.
findByUserId
(
trainUser1
.
getUserId
()))
);
byTrainingPeople
.
setCoursewareFileList
(
JacksonUtil
.
readValue
(
trainTheme
.
getCoursewareFiles
(),
new
TypeReference
<
List
<
CoursewareFile
>>()
{}));
byTrainingPeople
.
setGenerateTestPaper
(
JacksonUtil
.
readValue
(
trainTheme
.
getGenerateTestPaperString
(),
GenerateTestPaper
.
class
));
byTrainingPeople
.
setTrainDataFileList
(
FilesUtil
.
stringFileToList
(
trainTheme
.
getTrainDataFiles
()));
...
...
@@ -343,6 +360,18 @@ public class TrainThemeServiceImpl implements TrainThemeService {
}
return
trainThemeDao
.
findAll
(
predicateBuilder
.
build
(),
pageable
);
}
private
TrainUser
userToTrainUser
(
User
user
){
ModelMapper
mapper
=
BeanHelper
.
getUserMapper
();
return
mapper
.
map
(
user
,
TrainUser
.
class
);
}
private
TrainUser
saveTrainUser
(
TrainUser
trainUser
){
TrainUser
trainUser1
=
trainUserDao
.
save
(
trainUser
);
//异步线程
CompletableFuture
.
runAsync
(()->
{
BcHash
bcHash
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
trainUser1
));
trainUserDao
.
upDate
(
bcHash
.
getData
().
getRecordID
(),
trainUser1
.
getId
());
});
return
trainUser1
;
}
}
dev-train/src/main/java/com/tykj/dev/device/train/task/TrainTask.java
浏览文件 @
246d074c
...
...
@@ -3,7 +3,9 @@ package com.tykj.dev.device.train.task;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.train.dao.TrainThemeDao
;
import
com.tykj.dev.device.train.dao.TrainUserDao
;
import
com.tykj.dev.device.train.entity.TrainTheme
;
import
com.tykj.dev.device.train.entity.TrainUser
;
import
com.tykj.dev.device.train.service.TrainTaskService
;
import
com.tykj.dev.device.train.service.TrainThemeService
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
...
...
@@ -14,10 +16,14 @@ import com.tykj.dev.misc.base.StatusEnum;
import
com.tykj.dev.socket.MyWebSocket
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author zjm
...
...
@@ -44,6 +50,8 @@ public class TrainTask {
@Autowired
MyWebSocket
myWebSocket
;
@Autowired
TrainUserDao
trainUserDao
;
@Autowired
TrainThemeDao
trainThemeDao
;
...
...
@@ -80,7 +88,9 @@ public class TrainTask {
@Scheduled
(
cron
=
"0 0/1 0 * * ? "
)
// @Scheduled(cron = "0/30 * * * * ? ")
private
void
trainingStarted
()
{
log
.
info
(
"[培训] 定时去推送培训中"
);
long
time
=
new
Date
().
getTime
();
trainThemeService
.
findAllStatus
(
StatusEnum
.
TRAIN1010
.
id
).
forEach
(
trainTheme
->
{
...
...
@@ -91,20 +101,40 @@ public class TrainTask {
}
private
void
inTraining
(
Integer
trainId
)
{
TrainTheme
trainTheme
=
trainThemeService
.
findById
(
trainId
);
trainTaskService
.
selectBillidAndBillType
(
trainId
,
BusinessEnum
.
TRAIN
.
id
,
StatusEnum
.
TRAIN1010
.
id
).
forEach
(
taskBto
->
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
TRAIN1004
,
taskBto
.
getInvolveUserIdList
().
get
(
0
))
);
//5 培训中
TaskBto
taskBto
=
trainTaskService
.
selectFatherIsNullAndBillidAndBillType
(
trainTheme
.
getTrainId
(),
BusinessEnum
.
TRAIN
.
id
);
// //主task往下推待培训状态,0
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
TRAIN1004
,
0
);
trainTheme
.
setTrainStatus
(
StatusEnum
.
TRAIN1004
.
id
);
//判断是否为线上培训 如是 则任务发给个人 如不是 则给单位推送任务。
if
(
trainTheme
.
getTrainType
()==
1
)
{
}
else
{
List
<
Integer
>
userIds
=
trainUserDao
.
findAllByIsSignUpAndTrainId
(
1
,
trainId
).
stream
().
map
(
TrainUser:
:
getUserId
).
collect
(
Collectors
.
toList
());
userIds
.
forEach
(
userId
->
onlineLearningTask
(
trainId
,
taskBto
.
getId
(),
trainTheme
.
getName
(),
userId
,
taskBto
.
getOwnUnit
())
);
}
trainThemeService
.
save
(
trainTheme
);
}
/**
* 线上培训业务 线上学习任务生成
*/
private
TaskBto
onlineLearningTask
(
Integer
trainId
,
Integer
parentTaskId
,
String
title
,
Integer
userId
,
Integer
ownUnitId
){
List
<
Integer
>
list
=
new
ArrayList
<>();
list
.
add
(
userId
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
TRAIN1012
.
id
,
title
,
parentTaskId
,
"."
,
trainId
,
BusinessEnum
.
TRAIN_STUDY
.
id
,
ownUnitId
,
0
,
"online"
,
list
);
taskBto
.
setCreateUserId
(
userId
);
return
taskService
.
start
(
taskBto
);
}
// @Scheduled(cron = "10 * * * * ?")
// private void trainingEnd1() {
// log.info("定时启动web推送");
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/UnitsController.java
浏览文件 @
246d074c
...
...
@@ -6,6 +6,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UserService
;
import
com.tykj.dev.misc.utils.DeviceModelSort
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -130,4 +131,11 @@ public class UnitsController {
return
ResponseEntity
.
ok
(
unitsService
.
findDirectlyUnder
());
}
@GetMapping
(
"/sort"
)
@ApiOperation
(
value
=
"单位序号接口"
,
notes
=
"单位序号接口"
)
public
ResponseEntity
sortAll
(){
return
ResponseEntity
.
ok
(
DeviceModelSort
.
mapUnitSort
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论