提交 8b163da5 authored 作者: gongwenjie's avatar gongwenjie

Merge branch 'master' of git.yfzx.zjtys.com.cn:zjm/notes2.0

......@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import javax.validation.constraints.NotEmpty;
......@@ -142,11 +143,13 @@ public class Work {
/**
* 是否记录个人工作量
*/
@ApiModelProperty(value = "是否记录个人工作量",example = "1.是记录0.不记录")
private int pWorkload=1;
/**
* 是否记录任务工作量
*/
@ApiModelProperty(value = "是否记录任务工作量",example = "1.是记录0.不记录")
private int workloadCount=1;
......
package com.zjty.tynotes.job.basic.entity.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* <p>Description : ty-note-backend
* <p>Date : 2019/6/5 11:01
* <p>@author : C
*/
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "留言VO")
public class CommentVo {
/**
* id
*/
@Id
@ApiModelProperty(value = "id", example = "id", notes = "若新增数据则不可附带id.更新已有数据则必须附带id")
private String id;
/**
* 评论者id
*/
@NotNull
@ApiModelProperty(value = "评论者")
private User commentator;
/**
* 评论时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "评论创建时间", example = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 评论时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "评论更新时间", example = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 内容
*/
@NotNull
@ApiModelProperty(value = "内容", example = "some content")
private String content;
}
package com.zjty.tynotes.job.basic.entity.response;
import com.zjty.tynotes.job.basic.entity.database.Attachment;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* <p>Description : note
* <p>Date : 2019/4/23 11:21
* <p>@author : C
*/
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "工作VO", description = "工作记录模块的返回数据对象")
public class WorkVo {
/**
* id
*/
@ApiModelProperty(value = "id", example = "id")
private String id;
/**
* 标题
*/
@ApiModelProperty(value = "标题", example = "请输入标题")
private String title;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 预计完成时间
*/
@ApiModelProperty(value = "预计完成时间")
private Date completeTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/*相关用户 同一个人不能同时担任多种职位*/
/**
* 发布者
*
* @see User
*/
@ApiModelProperty(value = "发布者")
private User publisher;
/**
* 执行者
*
* @see User
*/
@ApiModelProperty(value = "执行者")
private User executor;
/**
* 审核者
*
* @see User
*/
@ApiModelProperty(value = "审核者")
private List<User> checker;
/**
* 关注者
*
* @see User
*/
@ApiModelProperty(value = "关注者")
private List<User> follower;
/**
* 附件
* 该任务中的附件
* 分3种类型:初始附件、工作附件、交流附件
* 由Attachment类中的type属性区分附件类型
*
* @see Attachment
*/
@ApiModelProperty(value = "附件.该任务中的附件,分3种类型:初始附件、工作附件、交流附件,由Attachment模型中的type属性区分附件类型.")
private List<Attachment> attachment;
/*工作内容*/
/**
* 内容
* 内容字数有上限3000个字,上限可设置。
*/
@ApiModelProperty(value = "内容", example = "若是内容过多,将显示滚动条,同时,内容字数有上限3000个字,上限可设置,若是内容超出,请附件。")
private String content;
/**
* Job状态
* 目前有:进行中、已提交、已完结
*/
@ApiModelProperty(value = "状态.进行中:underway、已提交:committed、已完结:finished.", example = "finished")
private String status;
}
//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.service;//package com.zjty.tynotes.job.basic.service;
//
//import com.zjty.tynotes.job.basic.entity.database.Comment;
//import com.zjty.tynotes.job.basic.service.impl.CommentServiceImpl;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
///**
// * <p>Description : note
// * <p>Date : 2019/4/23 14:43
// * <p>@author : C
// * 实现类见↓
// *
// * @see //CommentServiceImpl
// */
//@Service
//public interface CommentService {
//
// /**
// * 新增Comment
// * 不可附带id
// *
// * @param comment Comment对象
// * @return 新增对象的id
// */
// String add(Comment comment);
//
// /**
// * 根据workId新增Comment并与所属Work建立关系
// * 不可附带id
// *
// * @param comment Comment对象
// * @param workId 所属工作Id
// * @return Comment对象的id
// */
// String add(Comment comment, String workId);
//
// /**
// * 修改Comment
// * 必须附带id
// *
// * @param comment Comment对象
// * @return 更新对象的id
// */
// String modify(Comment comment);
//
// /**
// * 查询所有
// *
// * @return 对象集合
// */
// List<Comment> findAll();
//
// /**
// * 根据id集合查询所有
// *
// * @param ids id集合
// * @return 对象集合
// */
// List<Comment> findAll(List<String> ids);
//
// /**
// * 根据id删除
// *
// * @param id 指定id
// */
// void delete(String id);
//
// /**
// * 删除所有数据
// */
// void deleteAll();
//}
package com.zjty.tynotes.job.basic.service;//package com.zjty.tynotes.job.basic.service;
//
//import com.zjty.tynotes.job.basic.entity.database.Work;
//import com.zjty.tynotes.job.basic.entity.response.WorkVo;
//import com.zjty.tynotes.job.basic.service.impl.TransHelperImpl;
//import org.springframework.stereotype.Service;
//
///**
// * <p>Description : note
// * <p>Date : 2019/4/23 11:33
// * <p>@author : C
// * 实现类见↓
// *
// * @see TransHelperImpl
// */
//@Service
//public interface TransHelper {
//
// /**
// * 把DataBase类型对象转换成Vo类型对象(DataBase类型用于存储 Vo类型用于跟前端交互)
// *
// * @param work Work对象
// * @return WorkVo对象
// */
// WorkVo transToVo(Work work);
//
// /**
// * 把Vo类型对象转换成DataBase类型对象(DataBase类型用于存储 Vo类型用于跟前端交互)
// *
// * @param workVo WorkVo对象
// * @return Work
// */
// Work transToDataBase(WorkVo workVo);
//
//}
package com.zjty.tynotes.job.basic.service.impl;//package com.zjty.tynotes.job.basic.service.impl;
//
//import com.google.common.collect.Lists;
//import com.zjty.tynotes.job.basic.entity.database.Comment;
//import com.zjty.tynotes.job.basic.entity.database.Work;
//import com.zjty.tynotes.job.basic.repository.CommentRepository;
//import com.zjty.tynotes.job.basic.service.CommentService;
//import com.zjty.tynotes.job.basic.service.WorkService;
//import com.zjty.tynotes.job.common.exception.BadRequestException;
//import com.zjty.tynotes.job.common.exception.NotFoundException;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//import java.util.List;
//
//import static java.util.Objects.isNull;
//import static java.util.Objects.nonNull;
//
///**
// * <p>Description : note
// * <p>Date : 2019/4/24 14:25
// * <p>@author : C
// * 接口定义说明见↓
// *
// * @see CommentService
// */
//@Slf4j
//@Service
//public class CommentServiceImpl implements CommentService {
//
// private final
// CommentRepository commentRepository;
//
// private final
// WorkService workService;
//
// @Autowired
// public CommentServiceImpl(CommentRepository commentRepository, WorkService workService) {
// this.commentRepository = commentRepository;
// this.workService = workService;
// }
//
// @Override
// public String add(Comment comment) {
// //新增数据不可附带id
// Boolean idMustNull = isNull(comment.getId());
// if (idMustNull) {
// //更新时间
// comment.setCreateTime(new Date());
// comment.setUpdateTime(new Date());
// String saveId = commentRepository.save(comment).getId();
// log.info(String.format("[job] 新增了id为 %s 的数据.", saveId));
// return saveId;
// } else {
// String msg = "[job] 新增数据不可附带id.";
// log.error(msg);
// throw new BadRequestException(msg);
// }
//
// }
//
// @Override
// public String add(Comment comment, String workId) {
// Boolean idMustNull = isNull(comment.getId());
// if (idMustNull) {
// Boolean workMustExist = workService.idExists(workId);
// if (workMustExist) {
// String saveId = commentRepository.save(comment).getId();
// Work work = workService.findById(workId);
// if (isNull(work.getComment())) {
// work.setComment(Lists.newArrayList());
// }
// work.getComment().add(saveId);
// workService.modify(work);
// log.info(String.format("[job] id为 %s 的留言已添加到id为 %s 的所属工作中.", saveId, workId));
// return saveId;
// } else {
// String msg = "[job] 指定id的所属工作不存在.";
// log.error(msg);
// throw new NotFoundException(msg);
// }
// } else {
// String msg = "[job] 新增数据不可附带id.";
// log.error(msg);
// throw new BadRequestException(msg);
// }
// }
//
// @Override
// public String modify(Comment comment) {
// Boolean idMustExist = nonNull(comment.getId());
// if (idMustExist) {
// if (commentRepository.existsById(comment.getId())) {
// comment.setUpdateTime(new Date());
// String modifyId = commentRepository.save(comment).getId();
// log.info(String.format("[job] 修改了id为 %s 的数据.", modifyId));
// return modifyId;
// } else {
// String msg = "[job] 指定id的数据不存在.";
// log.error(msg);
// throw new NotFoundException(msg);
// }
// } else {
// String msg = "[job] 修改必须在数据中附带id.";
// log.error(msg);
// throw new BadRequestException(msg);
// }
// }
//
// @Override
// public List<Comment> findAll() {
// return commentRepository.findAll();
// }
//
// @Override
// public List<Comment> findAll(List<String> ids) {
// return Lists.newArrayList(commentRepository.findAllById(ids));
// }
//
// @Override
// public void delete(String id) {
//
// }
//
// @Override
// public void deleteAll() {
// commentRepository.deleteAll();
// }
//}
package com.zjty.tynotes.job.basic.service.impl;//package com.zjty.tynotes.job.basic.service.impl;
//
//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.entity.response.CommentVo;
//import com.zjty.tynotes.job.basic.entity.response.WorkVo;
//import com.zjty.tynotes.job.basic.service.AttachmentService;
//import com.zjty.tynotes.job.basic.service.CommentService;
//import com.zjty.tynotes.job.basic.service.TransHelper;
//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.stereotype.Service;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * <p>Description : note
// * <p>Date : 2019/4/24 17:05
// * <p>@author : C
// */
//@Service
//@Slf4j
//public class TransHelperImpl implements TransHelper {
//
// private final
// IUserService userService;
//
// private final
// AttachmentService attachmentService;
//
// private final
// CommentService commentService;
//
// @Autowired
// public TransHelperImpl(IUserService userService, AttachmentService attachmentService, CommentService commentService) {
// this.userService = userService;
// this.attachmentService = attachmentService;
// this.commentService = commentService;
// }
//
// @Override
// public WorkVo transToVo(Work work) {
// User publisher = userService.findUserById(work.getPublisher());
// User executor = userService.findUserById(work.getExecutor());
// List<User> checkerList = userService.findUserByIds(work.getChecker());
// List<User> followerList = userService.findUserByIds(work.getFollower());
// List<Attachment> attachmentList = attachmentService.findAll(work.getAttachment());
// List<Comment> commentList = commentService.findAll(work.getComment());
// List<CommentVo> commentVoList = commentList.stream().map(this::toCommentVo).collect(Collectors.toList());
// return new WorkVo(
// work.getId(),
// work.getTitle(),
// work.getCreateTime(),
// work.getCompleteTime(),
// work.getUpdateTime(),
// publisher,
// executor,
// checkerList,
// followerList,
// attachmentList,
// commentVoList,
// work.getContent(),
// work.getIsFormal(),
// work.getStatus()
// );
// }
//
// @Override
// public Work transToDataBase(WorkVo workVo) {
// return new Work(
// workVo.getId(),
// workVo.getTitle(),
// workVo.getCreateTime(),
// workVo.getCompleteTime(),
// workVo.getUpdateTime(),
// workVo.getPublisher().getId(),
// workVo.getExecutor().getId(),
// getUserIds(workVo.getChecker()),
// getUserIds(workVo.getFollower()),
// getAttachmentIds(workVo.getAttachment()),
// getCommentIds(workVo.getComment()),
// workVo.getContent(),
// workVo.getIsFormal(),
// workVo.getStatus()
// );
// }
//
// private List<String> getUserIds(List<User> userList) {
// return userList.stream()
// .map(User::getId)
// .collect(Collectors.toList());
// }
//
// private List<String> getAttachmentIds(List<Attachment> attachmentList) {
// return attachmentList.stream()
// .map(Attachment::getId)
// .collect(Collectors.toList());
// }
//
// private List<String> getCommentIds(List<CommentVo> commentVoList) {
// return commentVoList.stream()
// .map(CommentVo::getId)
// .collect(Collectors.toList());
// }
//
//
// private CommentVo toCommentVo(Comment comment) {
// return new CommentVo(
// comment.getId(),
// userService.findUserById(comment.getCommentator()),
// comment.getCreateTime(),
// comment.getUpdateTime(),
// comment.getContent()
// );
// }
//}
package com.zjty.tynotes.job.status.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zjm
*/
@ApiModel(value = "弹框的消息对象", description = "操作成功与否的消息")
public class BouncedMessage {
@ApiModelProperty(value = "消息", name = "msg", example = "收藏成功")
private String msg;
public BouncedMessage(String msg) {
this.msg = msg;
}
public String getMsg() {
return msg;
}
public BouncedMessage() {
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.zjty.tynotes.job.status.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @author zjm
* 提供前端阅读页面的事件集合
*/
@ApiModel(value = "EventTitle对象",description="提供阅读页面的事件列表")
public class EventTitle {
//事件标题
@ApiModelProperty(value = "事件标题",name = "title",example = "这是一个事件的标题")
private String title;
//留言条数
@ApiModelProperty(value = "留言条数",name = "messageCount")
private int messageCount;
//更新时间
@ApiModelProperty(value = "更新时间(毫秒)",name = "updateTime")
private Long updateTime;
//事件状态 (进行中)假设1进行中 2.已提交 3.已完结
@ApiModelProperty(value = "事件状态(进行中)",name = "state",example = "underway")
private String state;
//是否已读(0已读,1未读)
@ApiModelProperty(value = "是否已读(0已读,1未读)",name = "readState",example = "1")
private int readState;
//事件id
@ApiModelProperty(value = "事件id",name = "id")
private String id;
//是否收藏(0否,1是)
@ApiModelProperty(value = "是否收藏(0否,1是)",name = "collection",example = "0")
private int collection;
//在这个事件担任的角色(身份)
@ApiModelProperty(value = "担任的角色(身份)",name = "identity",hidden = true)
private int identity;
//是否是发布者(0,不是,1是)
@ApiModelProperty(value = "是否是发布者",name = "release",hidden = true)
private int release;
//执行人名称
@ApiModelProperty(value = "执行人名称",name = "executor",example = "mcj1")
private String executor;
//审核人名称
@ApiModelProperty(value = "审核人名称",name = "inspector",example = "[\"id\",\"id\"]")
private List<String> inspector;
//最近一次的操作
@ApiModelProperty(value = "最近一次的操作",name = "latestNews",example = "root留言")
private String latestNews;
//发布者
@ApiModelProperty(value = "发布者",name = "publisher",example = "root")
private String publisher;
//关注者
@ApiModelProperty(value = "关注者",name = "viewer",example = "[\"id\",\"id\"]")
private List<String> viewer;
/*get --------------------------------- set*/
public int getRelease() {
return release;
}
public void setRelease(int release) {
this.release = release;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public int getReadState() {
return readState;
}
public void setReadState(int readState) {
this.readState = readState;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getCollection() {
return collection;
}
public void setCollection(int collection) {
this.collection = collection;
}
public int getIdentity() {
return identity;
}
public void setIdentity(int identity) {
this.identity = identity;
}
public int getMessageCount() {
return messageCount;
}
public void setMessageCount(int messageCount) {
this.messageCount = messageCount;
}
public String getExecutor() {
return executor;
}
public void setExecutor(String executor) {
this.executor = executor;
}
public List<String> getInspector() {
return inspector;
}
public void setInspector(List<String> inspector) {
this.inspector = inspector;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public List<String> getViewer() {
return viewer;
}
public void setViewer(List<String> viewer) {
this.viewer = viewer;
}
public String getLatestNews() {
return latestNews;
}
public void setLatestNews(String latestNews) {
this.latestNews = latestNews;
}
/*构造方法*/
public EventTitle(String title, int messageCount, Long updateTime, String state, int readState, String id, int collection, int identity) {
this.title = title;
this.messageCount = messageCount;
this.updateTime = updateTime;
this.state = state;
this.readState = readState;
this.id = id;
this.collection = collection;
this.identity = identity;
}
public EventTitle() { }
public EventTitle(String title, int messageCount, Long updateTime, String state, int readState, String id, int collection, int identity, int release, String executor, List<String> inspector, String latestNews, String publisher, List<String> viewer) {
this.title = title;
this.messageCount = messageCount;
this.updateTime = updateTime;
this.state = state;
this.readState = readState;
this.id = id;
this.collection = collection;
this.identity = identity;
this.release = release;
this.executor = executor;
this.inspector = inspector;
this.latestNews = latestNews;
this.publisher = publisher;
this.viewer = viewer;
}
}
......@@ -13,7 +13,7 @@ import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "")
@ApiModel(value = "任务列表对象")
public class RedisPersonalWork {
/**
......
package com.zjty.tynotes.job.status.entity;
import com.zjty.tynotes.misc.config.AutoDocument;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -10,47 +13,57 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@AutoDocument
@ApiModel(value = "webSocket对象")
public class RoleSum {
/**
* 我的任务 是否有未读 0 否 1有
*/
@ApiModelProperty(value = "我的任务 是否未读",name = "meWorkUnread",example = "0 读了 1没读")
private int meWorkUnread;
/**
* 我的任务 条数
*/
@ApiModelProperty(value = "我的任务 条数",name = "meWorkCount",example = "20")
private int meWorkCount;
/**
* 我接收的任务 是否有未读 0 否 1有
*/
@ApiModelProperty(value = "我接收的任务 是否未读",name = "workId",example = "0 读了 1没读")
private int meReceiveUnread;
/**
* 我接收的任务 条数
*/
@ApiModelProperty(value = "我接收的任务 条数",name = "meReceiveCount",example = "1")
private int meReceiveCount;
/**
* 我分解的任务 是否有未读 0 否 1有
*/
@ApiModelProperty(value = "我分解的任务 是否未读",name = "workId",example = "0 读了 1没读")
private int meResolveUnread;
/**
* 我分解的任务 条数
*/
@ApiModelProperty(value = "我分解的任务 条数",name = "meResolveCount",example = "10")
private int meResolveCount;
/**
* 我发布的任务 是否有未读 0 否 1有
*/
@ApiModelProperty(value = "我发布的任务 是否未读",name = "workId",example = "0 读了 1没读")
private int meReleaseUnread;
/**
* 我发布的任务 条数
*/
@ApiModelProperty(value = " 我发布的任务 条数",name = "meReleaseCount",example = "12")
private int meReleaseCount;
}
......@@ -15,4 +15,9 @@ public interface InternalService {
* @return
*/
List<Personnel> personnels(List<String> list);
/**
* 根据人员id返回任务数量
*/
int personnelWorkCount(String id);
}
......@@ -5,6 +5,12 @@ import com.zjty.tynotes.job.basic.entity.database.Work;
import java.util.List;
public interface WorkShowService {
/**
* 预留
*/
void test(String executorId, String latestNews, Work work);
/**
* 任务新增 操作人 最近一次操作 看到人员id work 对象
*/
......@@ -15,9 +21,22 @@ public interface WorkShowService {
*/
void saveTakePushWork1(String executorId, String latestNews, List<String> userIds, Work work);
/**
* 保存任务
* @param executorId
* @param latestNews
* @param work
*/
void saveWork(String executorId, String latestNews, Work work);
/**
* 把未发布的任务转变为进行中
* @param executorId
* @param latestNews
* @param userIds
* @param work
*/
void unpublishedToOngoing(String executorId, String latestNews, List<String> userIds, Work work);
/**
* 修改任务 操作人 最近一次操作 看到人员id
......
......@@ -39,4 +39,19 @@ public class InternalServiceImpl implements InternalService {
}
return personnels;
}
@Override
public int personnelWorkCount(String id) {
List<Object> lists = redisTemplate.opsForList().range(Constants.REDIS_EVENT + id, 0, -1);
int count=0;
for (Object object:lists){
RedisPersonalWork redisPersonalWork=(RedisPersonalWork)object;
if (redisPersonalWork.getWorkAttribution()==WorkAttribution.ME_WORK){
count++;
}
}
return count;
}
}
......@@ -3,21 +3,17 @@ package com.zjty.tynotes.job.status.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.zjty.tynotes.job.common.Constants;
import com.zjty.tynotes.job.status.entity.EsListSum;
import com.zjty.tynotes.job.status.entity.EventTitle;
import com.zjty.tynotes.job.status.entity.RedisPersonalWork;
import com.zjty.tynotes.job.status.entity.RoleSum;
import com.zjty.tynotes.job.status.service.WorkShowSeeService;
import com.zjty.tynotes.job.status.utils.JacksonUtil;
import com.zjty.tynotes.search.subject.entity.CollectionRs;
import com.zjty.tynotes.search.subject.entity.EsSearchArg;
import com.zjty.tynotes.search.subject.entity.EsSource;
import com.zjty.tynotes.search.subject.service.EsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.naming.ldap.Rdn;
import java.util.*;
@Service
......
package com.zjty.tynotes.job.status.service.impl;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.common.Constants;
import com.zjty.tynotes.job.common.exception.WorkAttribution;
import com.zjty.tynotes.job.status.entity.RedisPersonalWork;
......@@ -28,11 +29,102 @@ public class WorkShowServiceImpl implements WorkShowService {
@Autowired
MessageTemplateService messageTemplateService;
@Autowired
WorkService workService;
@Autowired
EsUtil esUtil;
@Autowired
IUserService iUserService;
@Override
public void test(String executorId, String latestNews, Work work) {
List<String> uIds=new ArrayList<>();
Long time=new Date().getTime();
String releaseName= iUserService.findUserById(work.getPublisher()).getUsername();
String executorName= iUserService.findUserById(work.getExecutor()).getUsername();
RedisPersonalWork personalWork=new RedisPersonalWork(work.getId(),time,work.getTitle(),work.getStatus(),releaseName,executorName,1,WorkAttribution.ME_WORK,latestNews,work.getSuperiorId(),new ArrayList<>());
//发布人
if (work.getSuperiorId()==null){
personalWork.setWorkAttribution(WorkAttribution.ME_RELEASE_WORK);
personalWork.setReadState(0);
redisTemplate.opsForList().leftPush(Constants.REDIS_EVENT+work.getPublisher(),personalWork);
asynchronousAddEs(Constants.REDIS_EVENT+work.getPublisher(),personalWork);
List<Object> list=redisTemplate.opsForList().range(Constants.REDIS_EVENT+work.getPublisher(),0,-1);
assert list != null;
pushData(work.getPublisher(),JacksonUtil.toJSon(statisticalRoleCount(list)));
log.info("{}这里发送{}",work.getPublisher(), JacksonUtil.toJSon(statisticalRoleCount(list)));
}else {
uIds=tests(work.getSuperiorId(),uIds);
personalWork.setWorkAttribution(WorkAttribution.ME_RESOLVE_WORK);
personalWork.setReadState(0);
redisTemplate.opsForList().leftPush(Constants.REDIS_EVENT+work.getPublisher(),personalWork);
asynchronousAddEs(Constants.REDIS_EVENT+work.getPublisher(),personalWork);
List<Object> list=redisTemplate.opsForList().range(Constants.REDIS_EVENT+work.getPublisher(),0,-1);
assert list != null;
pushData(work.getPublisher(),JacksonUtil.toJSon(statisticalRoleCount(list)));
subWork(list,work,work.getPublisher());
log.info("{}这里发送{}",work.getPublisher(), JacksonUtil.toJSon(statisticalRoleCount(list)));
}
//执行人 判断执行人是否有分解权限
boolean flag=true;
if (flag){
personalWork.setWorkAttribution(WorkAttribution.ME_RECEIVE_WORK);
personalWork.setReadState(1);
redisTemplate.opsForList().leftPush(Constants.REDIS_EVENT+work.getExecutor(),personalWork);
asynchronousAddEs(Constants.REDIS_EVENT+work.getExecutor(),personalWork);
List<Object> list=redisTemplate.opsForList().range(Constants.REDIS_EVENT+work.getExecutor(),0,-1);
assert list != null;
pushData(work.getExecutor(),JacksonUtil.toJSon(statisticalRoleCount(list)));
subWork(list,work,work.getExecutor());
log.info("{}这里发送{}",work.getExecutor(), JacksonUtil.toJSon(statisticalRoleCount(list)));
}else {
personalWork.setWorkAttribution(WorkAttribution.ME_WORK);
personalWork.setReadState(1);
redisTemplate.opsForList().leftPush(Constants.REDIS_EVENT+work.getExecutor(),personalWork);
asynchronousAddEs(Constants.REDIS_EVENT+work.getExecutor(),personalWork);
List<Object> list=redisTemplate.opsForList().range(Constants.REDIS_EVENT+work.getExecutor(),0,-1);
assert list != null;
pushData(work.getExecutor(),JacksonUtil.toJSon(statisticalRoleCount(list)));
subWork(list,work,work.getExecutor());
log.info("{}这里发送{}",work.getExecutor(), JacksonUtil.toJSon(statisticalRoleCount(list)));
}
//有待修改
if (uIds.size()!=0) {
for (String id : uIds) {
personalWork.setWorkAttribution(0);
personalWork.setReadState(1);
redisTemplate.opsForList().leftPush(Constants.REDIS_EVENT + id, personalWork);
asynchronousAddEs(Constants.REDIS_EVENT + id, personalWork);
List<Object> list = redisTemplate.opsForList().range(Constants.REDIS_EVENT + id, 0, -1);
assert list != null;
pushData(id, JacksonUtil.toJSon(statisticalRoleCount(list)));
subWork(list, work, id);
log.info("{}这里发送{}", id, JacksonUtil.toJSon(statisticalRoleCount(list)));
}
}
}
private List<String> tests(String id,List<String> list){
Work work=workService.findById(id);
String workId=work.getSuperiorId();
list.add(work.getPublisher());
if (workId==null || "".equals(workId)){
return list;
}
return tests(workId,list);
}
//加一个时间
@Override
public void saveTakePushWork(String executorId, String latestNews, List<String> userIds, Work work) {
......
package com.zjty.tynotes.pas.config;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.service.IAuthorityService;
import com.zjty.tynotes.pas.service.IRoleService;
import com.zjty.tynotes.pas.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
/**
* @author mcj
*/
@Component
@Service
public class MyProvider implements AuthenticationProvider {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
......
......@@ -17,10 +17,8 @@ import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.access.channel.ChannelProcessingFilter;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsUtils;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
......
......@@ -29,9 +29,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.1.RELEASE</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
......
package com.zjty.tynotes.union.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.union.service.RedisToEsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjm
*/
@AutoDocument
@Api(tags = "redis同步es接口",protocols = "http")
@RestController
@RequestMapping("/redis")
public class RedisToEs {
@Autowired
RedisToEsService redisToEsService;
@GetMapping("/es")
@ApiOperation(value = "同步数据")
public ResponseEntity redisToEs(){
redisToEsService.saveEsToRedis();
return ResponseEntity.ok("保存es成功");
}
}
//package com.zjty.tynotes.union.controller;
//
//import com.zjty.tynotes.misc.config.AutoDocument;
//import com.zjty.tynotes.union.service.RedisToEsService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @author zjm
// */
//@AutoDocument
//@Api(tags = "redis同步es接口",protocols = "http")
//@RestController
//@RequestMapping("/redis")
//public class RedisToEs {
// @Autowired
// RedisToEsService redisToEsService;
//
// @GetMapping("/es")
// @ApiOperation(value = "同步数据")
// public ResponseEntity redisToEs(){
// redisToEsService.saveEsToRedis();
// return ResponseEntity.ok("保存es成功");
// }
//
//}
package com.zjty.tynotes.union.service.impl;
import com.zjty.tynotes.job.common.Constants;
import com.zjty.tynotes.job.status.entity.EventTitle;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.service.IUserService;
import com.zjty.tynotes.search.subject.entity.EsSource;
import com.zjty.tynotes.search.subject.service.EsUtil;
import com.zjty.tynotes.union.service.RedisToEsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zjm
*/
@Service
public class RedisToEsServiceImpl implements RedisToEsService {
@Autowired
IUserService iUserService;
@Autowired
private RedisTemplate<String,Object> redisTemplate;
@Autowired
EsUtil esUtil;
@Override
public void saveEsToRedis() {
List<User> users=iUserService.findAll();
for (User user:users){
esUtil.createIndex(user.getId());
List<Object> objectList= redisTemplate.opsForList().range(Constants.REDIS_EVENT+user.getId(),0,-1);
if (objectList==null){
return;
}
for (Object obj:objectList){
asynchronousAddEs(Constants.REDIS_EVENT+user.getId(),(EventTitle)obj);
}
}
}
private void asynchronousAddEs(String index,EventTitle eventTitle){
esUtil.save(index, eventToEs(eventTitle));
}
private EsSource eventToEs(EventTitle title) {
EsSource esSource = new EsSource();
Map<String, Object> objectMap = new HashMap<>(20);
objectMap.put("title", title.getTitle());
objectMap.put("messageCount", title.getMessageCount());
objectMap.put("updateTime", title.getUpdateTime());
objectMap.put("state", title.getState());
objectMap.put("readState", title.getReadState());
objectMap.put("id", title.getId());
objectMap.put("collection", title.getCollection());
objectMap.put("identity", title.getIdentity());
objectMap.put("release", title.getRelease());
objectMap.put("executor", title.getExecutor());
objectMap.put("inspector", title.getInspector());
objectMap.put("latestNews", title.getLatestNews());
objectMap.put("publisher", title.getPublisher());
objectMap.put("viewer", title.getViewer());
esSource.setId(title.getId());
esSource.setJsonMap(objectMap);
return esSource;
}
}
//package com.zjty.tynotes.union.service.impl;
//
//import com.zjty.tynotes.job.common.Constants;
//import com.zjty.tynotes.pas.entity.User;
//import com.zjty.tynotes.pas.service.IUserService;
//import com.zjty.tynotes.search.subject.entity.EsSource;
//import com.zjty.tynotes.search.subject.service.EsUtil;
//import com.zjty.tynotes.union.service.RedisToEsService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Service;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
///**
// * @author zjm
// */
//@Service
//public class RedisToEsServiceImpl implements RedisToEsService {
// @Autowired
// IUserService iUserService;
//
// @Autowired
// private RedisTemplate<String,Object> redisTemplate;
//
// @Autowired
// EsUtil esUtil;
// @Override
// public void saveEsToRedis() {
// List<User> users=iUserService.findAll();
// for (User user:users){
// esUtil.createIndex(user.getId());
//
// List<Object> objectList= redisTemplate.opsForList().range(Constants.REDIS_EVENT+user.getId(),0,-1);
// if (objectList==null){
// return;
// }
// for (Object obj:objectList){
// asynchronousAddEs(Constants.REDIS_EVENT+user.getId(),(EventTitle)obj);
// }
//
// }
// }
//
// private void asynchronousAddEs(String index,EventTitle eventTitle){
//
// esUtil.save(index, eventToEs(eventTitle));
//
// }
//
// private EsSource eventToEs(EventTitle title) {
// EsSource esSource = new EsSource();
// Map<String, Object> objectMap = new HashMap<>(20);
// objectMap.put("title", title.getTitle());
// objectMap.put("messageCount", title.getMessageCount());
// objectMap.put("updateTime", title.getUpdateTime());
// objectMap.put("state", title.getState());
// objectMap.put("readState", title.getReadState());
// objectMap.put("id", title.getId());
// objectMap.put("collection", title.getCollection());
// objectMap.put("identity", title.getIdentity());
// objectMap.put("release", title.getRelease());
// objectMap.put("executor", title.getExecutor());
// objectMap.put("inspector", title.getInspector());
// objectMap.put("latestNews", title.getLatestNews());
// objectMap.put("publisher", title.getPublisher());
// objectMap.put("viewer", title.getViewer());
// esSource.setId(title.getId());
// esSource.setJsonMap(objectMap);
// return esSource;
// }
//}
......@@ -4,7 +4,7 @@ spring.application.name=simc
server.port=8082
# mongodb configuration
spring.data.mongodb.uri=mongodb://192.168.1.244:27017/note
spring.data.mongodb.uri=mongodb://localhost:27017/notes
# servlet configuration
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=1000MB
......@@ -12,7 +12,7 @@ spring.servlet.multipart.max-request-size=1000MB
spring.redis.timeout=5000
# es configuraiton
es.ip=192.168.1.244
es.ip=localhost
es.prefix=event_list
logging.file=./log/note.log
......@@ -18,8 +18,8 @@ spring.data.mongodb.uri=mongodb://192.168.1.248:27017/note
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=1000MB
spring.redis.host=192.168.1.248
spring.redis.port=6380
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.timeout=5000ms
# es configuraiton
......
......@@ -16,6 +16,12 @@
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-job</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-weekly</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论