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

接口注释,人员部分代码

上级 5cf3774c
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个).无法生成模拟工作记录模拟数据.");
} // }
//
} // }
//
} //}
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论