Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
1ef891a9
提交
1ef891a9
authored
3月 03, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
接口注释,人员部分代码
上级
5cf3774c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
133 行增加
和
133 行删除
+133
-133
JobRunner.java
...ain/java/com/zjty/tynotes/job/basic/runner/JobRunner.java
+99
-99
WeeklyInit.java
...rc/main/java/com/zjty/tynotes/weekly/task/WeeklyInit.java
+34
-34
没有找到文件。
notes-job/src/main/java/com/zjty/tynotes/job/basic/runner/JobRunner.java
浏览文件 @
1ef891a9
package
com
.
zjty
.
tynotes
.
job
.
basic
.
runner
;
//
package com.zjty.tynotes.job.basic.runner;
//
import
com.google.common.collect.Lists
;
//
import com.google.common.collect.Lists;
import
com.zjty.tynotes.job.basic.entity.database.Attachment
;
//
import com.zjty.tynotes.job.basic.entity.database.Attachment;
import
com.zjty.tynotes.job.basic.entity.database.Comment
;
//
import com.zjty.tynotes.job.basic.entity.database.Comment;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
//
import com.zjty.tynotes.job.basic.entity.database.Work;
import
com.zjty.tynotes.job.basic.service.AttachmentService
;
//
import com.zjty.tynotes.job.basic.service.AttachmentService;
import
com.zjty.tynotes.job.basic.service.CommentService
;
//
import com.zjty.tynotes.job.basic.service.CommentService;
import
com.zjty.tynotes.job.basic.service.WorkService
;
//
import com.zjty.tynotes.job.basic.service.WorkService;
import
com.zjty.tynotes.job.common.constant.AttachmentType
;
//
import com.zjty.tynotes.job.common.constant.AttachmentType;
import
com.zjty.tynotes.pas.entity.User
;
//
import com.zjty.tynotes.pas.entity.User;
import
com.zjty.tynotes.pas.service.IUserService
;
//
import com.zjty.tynotes.pas.service.IUserService;
import
lombok.extern.slf4j.Slf4j
;
//
import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.CommandLineRunner
;
//
import org.springframework.boot.CommandLineRunner;
import
org.springframework.stereotype.Component
;
//
import org.springframework.stereotype.Component;
//
import
java.util.Date
;
//
import java.util.Date;
import
java.util.List
;
//
import java.util.List;
//
import
static
com
.
zjty
.
tynotes
.
job
.
common
.
constant
.
WorkStatus
.
UNDERWAY
;
//
import static com.zjty.tynotes.job.common.constant.WorkStatus.UNDERWAY;
//
/**
/
//
**
* <p>Description : note
//
* <p>Description : note
* <p>Date : 2019/4/24 16:42
//
* <p>Date : 2019/4/24 16:42
* <p>@author : C
//
* <p>@author : C
* 在项目启动时运行的一些内容.
//
* 在项目启动时运行的一些内容.
*/
//
*/
@SuppressWarnings
(
"SpringAutowiredFieldsWarningInspection"
)
//
@SuppressWarnings("SpringAutowiredFieldsWarningInspection")
@Slf4j
//
@Slf4j
@Component
//
@Component
public
class
JobRunner
implements
CommandLineRunner
{
//
public class JobRunner implements CommandLineRunner {
//
@Autowired
//
@Autowired
IUserService
userService
;
//
IUserService userService;
//
@Autowired
//
@Autowired
AttachmentService
attachmentService
;
//
AttachmentService attachmentService;
//
@Autowired
//
@Autowired
CommentService
commentService
;
//
CommentService commentService;
//
@Autowired
//
@Autowired
WorkService
workService
;
//
WorkService workService;
//
@Override
//
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
//
public void run(String... args) throws Exception {
log
.
info
(
"工作记录模块:启动完毕."
);
//
log.info("工作记录模块:启动完毕.");
// initData();
//
//
initData();
}
//
}
//
private
void
initData
()
{
//
private void initData() {
log
.
info
(
"工作记录模块:开始初始化模拟数据"
);
//
log.info("工作记录模块:开始初始化模拟数据");
attachmentService
.
deleteAll
();
//
attachmentService.deleteAll();
commentService
.
deleteAll
();
//
commentService.deleteAll();
workService
.
deleteAll
();
//
workService.deleteAll();
Integer
minSize
=
4
;
//
Integer minSize = 4;
if
(
userService
.
findAll
().
size
()
<
minSize
)
{
//
if (userService.findAll().size() < minSize) {
userService
.
registerUser
(
new
User
().
createUser
());
//
userService.registerUser(new User().createUser());
userService
.
registerUser
(
new
User
().
createUser
());
//
userService.registerUser(new User().createUser());
userService
.
registerUser
(
new
User
().
createUser
());
//
userService.registerUser(new User().createUser());
userService
.
registerUser
(
new
User
().
createUser
());
//
userService.registerUser(new User().createUser());
}
//
}
List
<
User
>
users
=
userService
.
findAll
();
//
List<User> users = userService.findAll();
Boolean
condition
=
(
users
.
size
()
>=
minSize
);
//
Boolean condition = (users.size() >= minSize);
if
(
condition
)
{
//
if (condition) {
String
publisher
=
users
.
get
(
0
).
getId
();
//
String publisher = users.get(0).getId();
String
executor
=
users
.
get
(
1
).
getId
();
//
String executor = users.get(1).getId();
List
<
String
>
checker
=
Lists
.
newArrayList
(
users
.
get
(
2
).
getId
());
//
List<String> checker = Lists.newArrayList(users.get(2).getId());
List
<
String
>
follower
=
Lists
.
newArrayList
(
users
.
get
(
3
).
getId
());
//
List<String> follower = Lists.newArrayList(users.get(3).getId());
Attachment
attachment
=
new
Attachment
(
null
,
"test file"
,
"doc"
,
publisher
,
AttachmentType
.
INIT
,
new
Date
(),
"abcd"
);
//
Attachment attachment = new Attachment(null, "test file", "doc", publisher, AttachmentType.INIT, new Date(), "abcd");
Comment
comment
=
new
Comment
(
null
,
follower
.
get
(
0
),
new
Date
(),
new
Date
(),
"some contents"
);
//
Comment comment = new Comment(null, follower.get(0), new Date(), new Date(), "some contents");
Work
work
=
new
Work
(
//
Work work = new Work(
null
,
//
null,
"test"
,
//
"test",
new
Date
(),
//
new Date(),
new
Date
(),
//
new Date(),
new
Date
(),
//
new Date(),
publisher
,
//
publisher,
executor
,
//
executor,
checker
,
//
checker,
follower
,
//
follower,
null
,
//
null,
null
,
//
null,
"some contents"
,
//
"some contents",
true
,
//
true,
UNDERWAY
//
UNDERWAY
);
//
);
String
workId
=
workService
.
add
(
work
);
//
String workId = workService.add(work);
attachmentService
.
add
(
attachment
,
workId
);
//
attachmentService.add(attachment, workId);
commentService
.
add
(
comment
,
workId
);
//
commentService.add(comment, workId);
log
.
info
(
"工作记录模块:生成模拟数据完毕."
);
//
log.info("工作记录模块:生成模拟数据完毕.");
}
else
{
//
} else {
log
.
info
(
"工作记录模块:用户模块的数据数量不足(需要至少4个).无法生成模拟工作记录模拟数据."
);
//
log.info("工作记录模块:用户模块的数据数量不足(需要至少4个).无法生成模拟工作记录模拟数据.");
}
//
}
//
}
//
}
//
}
//
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/task/WeeklyInit.java
浏览文件 @
1ef891a9
package
com
.
zjty
.
tynotes
.
weekly
.
task
;
//
package com.zjty.tynotes.weekly.task;
//
import
com.zjty.tynotes.pas.entity.User
;
//
import com.zjty.tynotes.pas.entity.User;
import
com.zjty.tynotes.pas.service.IUserService
;
//
import com.zjty.tynotes.pas.service.IUserService;
import
com.zjty.tynotes.weekly.subject.service.WeeklyService
;
//
import com.zjty.tynotes.weekly.subject.service.WeeklyService;
import
lombok.extern.slf4j.Slf4j
;
//
import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.scheduling.annotation.Scheduled
;
//
import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Service
;
//
import org.springframework.stereotype.Service;
//
import
java.util.List
;
//
import java.util.List;
//
/**
/
//
**
* @author LJJ cnljj1995@gmail.com
//
* @author LJJ cnljj1995@gmail.com
* on 2019-07-05
//
* on 2019-07-05
*/
//
*/
@Slf4j
//
@Slf4j
@Service
//
@Service
public
class
WeeklyInit
{
//
public class WeeklyInit {
@Autowired
//
@Autowired
WeeklyService
weeklyService
;
//
WeeklyService weeklyService;
//
@Autowired
//
@Autowired
IUserService
iUserService
;
//
IUserService iUserService;
//
// @Scheduled(cron = "0 5 0 ? * MON")
//
//
@Scheduled(cron = "0 5 0 ? * MON")
public
void
task
(){
//
public void task(){
List
<
User
>
list
=
iUserService
.
findAll
();
//
List<User> list=iUserService.findAll();
for
(
User
user:
list
){
//
for (User user:list){
weeklyService
.
createWeekly
(
user
.
getId
());
//
weeklyService.createWeekly(user.getId());
}
//
}
log
.
info
(
"每周的个人周报生成完成"
);
//
log.info("每周的个人周报生成完成");
}
//
}
}
//
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论