提交 1ef891a9 authored 作者: gongwenjie's avatar gongwenjie

接口注释,人员部分代码

上级 5cf3774c
package com.zjty.tynotes.job.basic.runner;
import com.google.common.collect.Lists;
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.Work;
import com.zjty.tynotes.job.basic.service.AttachmentService;
import com.zjty.tynotes.job.basic.service.CommentService;
import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.common.constant.AttachmentType;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import static com.zjty.tynotes.job.common.constant.WorkStatus.UNDERWAY;
/**
* <p>Description : note
* <p>Date : 2019/4/24 16:42
* <p>@author : C
* 在项目启动时运行的一些内容.
*/
@SuppressWarnings("SpringAutowiredFieldsWarningInspection")
@Slf4j
@Component
public class JobRunner implements CommandLineRunner {
@Autowired
IUserService userService;
@Autowired
AttachmentService attachmentService;
@Autowired
CommentService commentService;
@Autowired
WorkService workService;
@Override
public void run(String... args) throws Exception {
log.info("工作记录模块:启动完毕.");
// initData();
}
private void initData() {
log.info("工作记录模块:开始初始化模拟数据");
attachmentService.deleteAll();
commentService.deleteAll();
workService.deleteAll();
Integer minSize = 4;
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());
}
List<User> users = userService.findAll();
Boolean condition = (users.size() >= minSize);
if (condition) {
String publisher = users.get(0).getId();
String executor = users.get(1).getId();
List<String> checker = Lists.newArrayList(users.get(2).getId());
List<String> follower = Lists.newArrayList(users.get(3).getId());
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");
Work work = new Work(
null,
"test",
new Date(),
new Date(),
new Date(),
publisher,
executor,
checker,
follower,
null,
null,
"some contents",
true,
UNDERWAY
);
String workId = workService.add(work);
attachmentService.add(attachment, workId);
commentService.add(comment, workId);
log.info("工作记录模块:生成模拟数据完毕.");
} else {
log.info("工作记录模块:用户模块的数据数量不足(需要至少4个).无法生成模拟工作记录模拟数据.");
}
}
}
//package com.zjty.tynotes.job.basic.runner;
//
//import com.google.common.collect.Lists;
//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.Work;
//import com.zjty.tynotes.job.basic.service.AttachmentService;
//import com.zjty.tynotes.job.basic.service.CommentService;
//import com.zjty.tynotes.job.basic.service.WorkService;
//import com.zjty.tynotes.job.common.constant.AttachmentType;
//import com.zjty.tynotes.pas.entity.User;
//import com.zjty.tynotes.pas.service.IUserService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.stereotype.Component;
//
//import java.util.Date;
//import java.util.List;
//
//import static com.zjty.tynotes.job.common.constant.WorkStatus.UNDERWAY;
//
///**
// * <p>Description : note
// * <p>Date : 2019/4/24 16:42
// * <p>@author : C
// * 在项目启动时运行的一些内容.
// */
//@SuppressWarnings("SpringAutowiredFieldsWarningInspection")
//@Slf4j
//@Component
//public class JobRunner implements CommandLineRunner {
//
// @Autowired
// IUserService userService;
//
// @Autowired
// AttachmentService attachmentService;
//
// @Autowired
// CommentService commentService;
//
// @Autowired
// WorkService workService;
//
// @Override
// public void run(String... args) throws Exception {
// log.info("工作记录模块:启动完毕.");
//// initData();
// }
//
// private void initData() {
// log.info("工作记录模块:开始初始化模拟数据");
// attachmentService.deleteAll();
// commentService.deleteAll();
// workService.deleteAll();
// Integer minSize = 4;
// 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());
// }
// List<User> users = userService.findAll();
// Boolean condition = (users.size() >= minSize);
// if (condition) {
// String publisher = users.get(0).getId();
// String executor = users.get(1).getId();
// List<String> checker = Lists.newArrayList(users.get(2).getId());
// List<String> follower = Lists.newArrayList(users.get(3).getId());
// 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");
// Work work = new Work(
// null,
// "test",
// new Date(),
// new Date(),
// new Date(),
// publisher,
// executor,
// checker,
// follower,
// null,
// null,
// "some contents",
// true,
// UNDERWAY
// );
// String workId = workService.add(work);
// attachmentService.add(attachment, workId);
// commentService.add(comment, workId);
// log.info("工作记录模块:生成模拟数据完毕.");
// } else {
// log.info("工作记录模块:用户模块的数据数量不足(需要至少4个).无法生成模拟工作记录模拟数据.");
// }
//
// }
//
//}
package com.zjty.tynotes.weekly.task;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.service.IUserService;
import com.zjty.tynotes.weekly.subject.service.WeeklyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author LJJ cnljj1995@gmail.com
* on 2019-07-05
*/
@Slf4j
@Service
public class WeeklyInit {
@Autowired
WeeklyService weeklyService;
@Autowired
IUserService iUserService;
// @Scheduled(cron = "0 5 0 ? * MON")
public void task(){
List<User> list=iUserService.findAll();
for (User user:list){
weeklyService.createWeekly(user.getId());
}
log.info("每周的个人周报生成完成");
}
}
//package com.zjty.tynotes.weekly.task;
//
//import com.zjty.tynotes.pas.entity.User;
//import com.zjty.tynotes.pas.service.IUserService;
//import com.zjty.tynotes.weekly.subject.service.WeeklyService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
///**
// * @author LJJ cnljj1995@gmail.com
// * on 2019-07-05
// */
//@Slf4j
//@Service
//public class WeeklyInit {
// @Autowired
// WeeklyService weeklyService;
//
// @Autowired
// IUserService iUserService;
//
//// @Scheduled(cron = "0 5 0 ? * MON")
// public void task(){
// List<User> list=iUserService.findAll();
// for (User user:list){
// weeklyService.createWeekly(user.getId());
// }
// log.info("每周的个人周报生成完成");
// }
//}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论