Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
f388f23d
提交
f388f23d
authored
3月 02, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git.yfzx.zjtys.com.cn:zjm/notes2.0
上级
27fe4a6b
da767ec9
全部展开
显示空白字符变更
内嵌
并排
正在显示
49 个修改的文件
包含
1549 行增加
和
1434 行删除
+1549
-1434
CommentController.java
.../zjty/tynotes/job/basic/controller/CommentController.java
+60
-60
ScController.java
...a/com/zjty/tynotes/job/basic/controller/ScController.java
+60
-0
WorkController.java
...com/zjty/tynotes/job/basic/controller/WorkController.java
+0
-0
ScoreCoefficient.java
...y/tynotes/job/basic/entity/database/ScoreCoefficient.java
+64
-0
Work.java
...java/com/zjty/tynotes/job/basic/entity/database/Work.java
+49
-25
UpdateCrew.java
...com/zjty/tynotes/job/basic/entity/request/UpdateCrew.java
+31
-0
WorkVo.java
...va/com/zjty/tynotes/job/basic/entity/response/WorkVo.java
+2
-18
CommentRepository.java
.../zjty/tynotes/job/basic/repository/CommentRepository.java
+1
-2
ScoreCoefficientRepository.java
...otes/job/basic/repository/ScoreCoefficientRepository.java
+10
-0
WorkRepository.java
...com/zjty/tynotes/job/basic/repository/WorkRepository.java
+0
-4
CommentService.java
...va/com/zjty/tynotes/job/basic/service/CommentService.java
+74
-74
ScoreCoefficientService.java
...ty/tynotes/job/basic/service/ScoreCoefficientService.java
+45
-0
TransHelper.java
.../java/com/zjty/tynotes/job/basic/service/TransHelper.java
+35
-35
WorkService.java
.../java/com/zjty/tynotes/job/basic/service/WorkService.java
+33
-1
CommentServiceImpl.java
...ty/tynotes/job/basic/service/impl/CommentServiceImpl.java
+131
-131
ScoreCoefficientServiceImpl.java
...s/job/basic/service/impl/ScoreCoefficientServiceImpl.java
+65
-0
TransHelperImpl.java
.../zjty/tynotes/job/basic/service/impl/TransHelperImpl.java
+120
-120
WorkServiceImpl.java
.../zjty/tynotes/job/basic/service/impl/WorkServiceImpl.java
+32
-3
AlterTaskService.java
...m/zjty/tynotes/job/business/service/AlterTaskService.java
+0
-16
NoteMessageService.java
...zjty/tynotes/job/business/service/NoteMessageService.java
+0
-48
AlterTaskStatusImpl.java
...ynotes/job/business/service/impl/AlterTaskStatusImpl.java
+0
-54
NoteMessageServiceImpl.java
...tes/job/business/service/impl/NoteMessageServiceImpl.java
+0
-76
Action.java
...job/src/main/java/com/zjty/tynotes/job/common/Action.java
+34
-11
Constants.java
.../src/main/java/com/zjty/tynotes/job/common/Constants.java
+0
-2
WorkStatus.java
...java/com/zjty/tynotes/job/common/constant/WorkStatus.java
+21
-3
WorkAttribution.java
...om/zjty/tynotes/job/common/exception/WorkAttribution.java
+30
-0
ActionHistoryController.java
...ynotes/job/status/controller/ActionHistoryController.java
+0
-1
Read1Controller.java
...m/zjty/tynotes/job/status/controller/Read1Controller.java
+25
-45
TaskController.java
...om/zjty/tynotes/job/status/controller/TaskController.java
+0
-116
EsListSum.java
...in/java/com/zjty/tynotes/job/status/entity/EsListSum.java
+9
-24
EventTitle.java
...n/java/com/zjty/tynotes/job/status/entity/EventTitle.java
+0
-1
Personnel.java
...in/java/com/zjty/tynotes/job/status/entity/Personnel.java
+21
-0
RedisPersonalWork.java
...com/zjty/tynotes/job/status/entity/RedisPersonalWork.java
+81
-0
RoleSum.java
...main/java/com/zjty/tynotes/job/status/entity/RoleSum.java
+22
-12
EventService.java
...ava/com/zjty/tynotes/job/status/service/EventService.java
+0
-89
InternalService.java
.../com/zjty/tynotes/job/status/service/InternalService.java
+18
-0
PrivateService.java
...a/com/zjty/tynotes/job/status/service/PrivateService.java
+0
-70
Take.java
...c/main/java/com/zjty/tynotes/job/status/service/Take.java
+0
-38
WorkShowSeeService.java
...m/zjty/tynotes/job/status/service/WorkShowSeeService.java
+56
-0
WorkShowService.java
.../com/zjty/tynotes/job/status/service/WorkShowService.java
+49
-0
BusinessTreeManagementImpl.java
...s/job/status/service/impl/BusinessTreeManagementImpl.java
+0
-0
EventServiceImpl.java
...jty/tynotes/job/status/service/impl/EventServiceImpl.java
+0
-0
InternalServiceImpl.java
.../tynotes/job/status/service/impl/InternalServiceImpl.java
+42
-0
PrivateServiceImpl.java
...y/tynotes/job/status/service/impl/PrivateServiceImpl.java
+0
-242
WorkShowSeeServiceImpl.java
...notes/job/status/service/impl/WorkShowSeeServiceImpl.java
+121
-0
WorkShowServiceImpl.java
.../tynotes/job/status/service/impl/WorkShowServiceImpl.java
+0
-0
MySuccessHandler.java
...com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
+103
-107
EsUtil.java
.../java/com/zjty/tynotes/search/subject/service/EsUtil.java
+17
-0
EsUtilImpl.java
.../zjty/tynotes/search/subject/service/impl/EsUtilImpl.java
+88
-6
没有找到文件。
notes-job/src/main/java/com/zjty/tynotes/job/basic/controller/CommentController.java
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
controller
;
import
com.zjty.tynotes.job.basic.entity.database.Comment
;
import
com.zjty.tynotes.job.basic.entity.response.JobResponse
;
import
com.zjty.tynotes.job.basic.service.CommentService
;
import
com.zjty.tynotes.job.status.service.BusinessTreeManagement
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
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.*
;
import
java.util.Date
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
/**
* <p>Description : ty-note-backend
* <p>Date : 2019/4/28 10:28
* <p>@author : C
*/
@AutoDocument
@Api
(
tags
=
"工作记录相关接口"
,
description
=
"工作记录模块"
)
@RestController
@RequestMapping
(
"/job/comment"
)
public
class
CommentController
{
private
final
CommentService
commentService
;
@Autowired
private
BusinessTreeManagement
businessTreeManagement
;
@Autowired
public
CommentController
(
CommentService
commentService
)
{
this
.
commentService
=
commentService
;
}
@PostMapping
(
value
=
"/{workId}"
)
@ApiOperation
(
value
=
"新增留言并将其添加到所属工作中."
,
notes
=
"新增不可在数据中附带id.需要在路径中指定所属工作的id.成功时返回新增数据保存的id."
)
public
ResponseEntity
<
JobResponse
>
add
(
@RequestBody
Comment
comment
,
@PathVariable
String
workId
)
{
String
saveId
=
commentService
.
add
(
comment
,
workId
);
businessTreeManagement
.
saveAction
(
comment
.
getCommentator
(),
workId
,
7
,
new
Date
(),
""
);
return
ok
(
new
JobResponse
(
saveId
));
}
@PutMapping
()
@ApiOperation
(
value
=
"修改留言."
,
notes
=
"修改必须在数据中附带id."
)
public
ResponseEntity
<
JobResponse
>
modify
(
@RequestBody
Comment
comment
)
{
String
saveId
=
commentService
.
modify
(
comment
);
return
ok
(
new
JobResponse
(
saveId
));
}
@DeleteMapping
(
"/{commentId}"
)
@ApiOperation
(
value
=
"根据id删除留言."
)
public
ResponseEntity
<
JobResponse
>
delete
(
@PathVariable
String
commentId
)
{
return
ok
(
new
JobResponse
(
commentId
));
}
}
package
com
.
zjty
.
tynotes
.
job
.
basic
.
controller
;
//package com.zjty.tynotes.job.basic.controller;
//
//
import com.zjty.tynotes.job.basic.entity.database.Comment;
//
import com.zjty.tynotes.job.basic.entity.response.JobResponse;
//
import com.zjty.tynotes.job.basic.service.CommentService;
//
import com.zjty.tynotes.job.status.service.BusinessTreeManagement;
//
import com.zjty.tynotes.misc.config.AutoDocument;
//
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.*;
//
//
import java.util.Date;
//
//
import static org.springframework.http.ResponseEntity.ok;
//
/
//
**
//
* <p>Description : ty-note-backend
//
* <p>Date : 2019/4/28 10:28
//
* <p>@author : C
//
*/
//
@AutoDocument
//
@Api(tags = "工作记录相关接口", description = "工作记录模块")
//
@RestController
//
@RequestMapping("/job/comment")
//
public class CommentController {
//
//
private final
//
CommentService commentService;
//
//
@Autowired
//
private BusinessTreeManagement businessTreeManagement;
//
//
@Autowired
//
public CommentController(CommentService commentService) {
//
this.commentService = commentService;
//
}
//
//
@PostMapping(value = "/{workId}")
//
@ApiOperation(value = "新增留言并将其添加到所属工作中.", notes = "新增不可在数据中附带id.需要在路径中指定所属工作的id.成功时返回新增数据保存的id.")
//
public ResponseEntity<JobResponse> add(@RequestBody Comment comment, @PathVariable String workId) {
//
String saveId = commentService.add(comment, workId);
//
businessTreeManagement.saveAction(comment.getCommentator(),workId,7,new Date(),"");
//
return ok(new JobResponse(saveId));
//
}
//
//
@PutMapping()
//
@ApiOperation(value = "修改留言.", notes = "修改必须在数据中附带id.")
//
public ResponseEntity<JobResponse> modify(@RequestBody Comment comment) {
//
String saveId = commentService.modify(comment);
//
return ok(new JobResponse(saveId));
//
}
//
//
@DeleteMapping("/{commentId}")
//
@ApiOperation(value = "根据id删除留言.")
//
public ResponseEntity<JobResponse> delete(@PathVariable String commentId) {
//
return ok(new JobResponse(commentId));
//
}
//
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/controller/ScController.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
controller
;
import
com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient
;
import
com.zjty.tynotes.job.basic.entity.response.JobResponse
;
import
com.zjty.tynotes.job.basic.service.ScoreCoefficientService
;
import
com.zjty.tynotes.job.common.Action
;
import
com.zjty.tynotes.job.status.service.BusinessTreeManagement
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
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.*
;
import
java.util.Date
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
/**
* <p>Description : ty-note-backend
* <p>Date : 2019/5/5 10:08
* <p>@author : C
*/
@AutoDocument
@Api
(
tags
=
"工作记录相关接口"
,
description
=
"工作记录模块"
)
@RestController
@RequestMapping
(
"/job/sc"
)
public
class
ScController
{
private
final
ScoreCoefficientService
scoreCoefficientService
;
@Autowired
BusinessTreeManagement
businessTreeManagement
;
@Autowired
public
ScController
(
ScoreCoefficientService
scoreCoefficientService
)
{
this
.
scoreCoefficientService
=
scoreCoefficientService
;
}
@PostMapping
(
"/"
)
@ApiOperation
(
value
=
"新增考评信息."
,
notes
=
"新增不可在数据中附带id.成功时返回新增数据保存的id."
)
public
ResponseEntity
<
JobResponse
>
add
(
@RequestBody
ScoreCoefficient
scoreCoefficient
,
@RequestParam
String
userId
)
{
String
saveId
=
scoreCoefficientService
.
add
(
scoreCoefficient
);
businessTreeManagement
.
saveAction
(
userId
,
scoreCoefficient
.
getWordId
(),
Action
.
APPRAISAL_WORD
,
new
Date
(),
""
);
return
ok
(
new
JobResponse
(
saveId
));
}
@PutMapping
(
"/upDate"
)
@ApiOperation
(
value
=
"考评信息修改."
,
notes
=
"修改必须在数据中附带id."
)
public
ResponseEntity
<
JobResponse
>
modify
(
@RequestBody
ScoreCoefficient
scoreCoefficient
,
@RequestParam
String
userId
)
{
String
saveId
=
scoreCoefficientService
.
modify
(
scoreCoefficient
);
businessTreeManagement
.
saveAction
(
userId
,
scoreCoefficient
.
getWordId
(),
Action
.
APPRAISAL_WORD
,
new
Date
(),
""
);
return
ok
(
new
JobResponse
(
saveId
));
}
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/controller/WorkController.java
浏览文件 @
f388f23d
差异被折叠。
点击展开。
notes-job/src/main/java/com/zjty/tynotes/job/basic/entity/database/ScoreCoefficient.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
entity
.
database
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"评分"
,
description
=
"评分对象"
)
public
class
ScoreCoefficient
{
/**
* 编号
*/
@ApiModelProperty
(
value
=
"编号"
,
example
=
"id"
)
private
String
id
;
/**
* 任务id
*/
@ApiModelProperty
(
value
=
"任务id"
,
example
=
"任务id"
)
private
String
wordId
;
/**
* 自评分
*/
@ApiModelProperty
(
value
=
"自评分"
,
example
=
"score1"
)
private
String
score1
;
/**
* 自评评语
*/
@ApiModelProperty
(
value
=
"自评评语"
,
example
=
"comments1"
)
private
String
comments1
;
/**
* 发布者评价
*/
@ApiModelProperty
(
value
=
"发布者评价"
,
example
=
"score2"
)
private
String
score2
;
/**
* 发布者评语
*/
@ApiModelProperty
(
value
=
"发布者评语"
,
example
=
"comments2"
)
private
String
comments2
;
/**
* 最终评价
* 发布者的直接上级或更上级
*/
@ApiModelProperty
(
value
=
"最终评价"
,
example
=
"score3"
)
private
String
score3
;
/**
* 最终评语
*/
@ApiModelProperty
(
value
=
"最终评语"
,
example
=
"comments3"
)
private
String
comments3
;
/**
* 最终工作量
*/
@ApiModelProperty
(
value
=
"最终工作量"
,
example
=
"endWorkLoad"
)
private
int
endWorkLoad
;
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/entity/database/Work.java
浏览文件 @
f388f23d
...
...
@@ -32,6 +32,13 @@ public class Work {
@Id
@ApiModelProperty
(
value
=
"id.若新增数据则不可附带id.更新已有数据则必须附带id."
,
example
=
"id"
,
notes
=
"若新增数据则不可附带id.更新已有数据则必须附带id"
)
private
String
id
;
/**
* 上级任务id
*/
@Id
@ApiModelProperty
(
value
=
"上级任务id"
,
example
=
"superiorId"
)
private
String
superiorId
;
/**
* 标题
*/
...
...
@@ -44,6 +51,20 @@ public class Work {
@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
stateTime
;
/**
* 任务结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
value
=
"结束时间"
,
example
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
endTime
;
/**
* 预计完成时间
*/
...
...
@@ -67,20 +88,15 @@ public class Work {
* 执行者id
*/
@NotNull
@ApiModelProperty
(
value
=
"
执行者的用户
id."
,
example
=
"id"
)
@ApiModelProperty
(
value
=
"
组长
id."
,
example
=
"id"
)
private
String
executor
;
/**
* 审核者id集合
*/
@NotNull
@ApiModelProperty
(
value
=
"审核者的用户id集合."
,
example
=
"[\"id\",\"id\"]"
)
private
List
<
String
>
checker
;
/**
* 关注者id集合
* 组员id集合
*/
@NotNull
@ApiModelProperty
(
value
=
"
关注者的用户
id集合."
,
example
=
"[\"id\",\"id\"]"
)
private
List
<
String
>
follower
;
@ApiModelProperty
(
value
=
"
组原
id集合."
,
example
=
"[\"id\",\"id\"]"
)
private
List
<
String
>
crewList
;
/**
* 附件id
...
...
@@ -89,12 +105,6 @@ public class Work {
@ApiModelProperty
(
value
=
"附件的id集合."
,
example
=
"[\"id\",\"id\"]"
)
private
List
<
String
>
attachment
;
/**
* 留言id
*/
@NotNull
@ApiModelProperty
(
value
=
"留言的id集合."
,
example
=
"[\"id\",\"id\"]"
)
private
List
<
String
>
comment
;
/*工作内容*/
/**
...
...
@@ -105,25 +115,39 @@ public class Work {
@ApiModelProperty
(
value
=
"内容"
,
example
=
"内容..............."
,
notes
=
"内容字数有上限3000个字,上限可设置."
)
private
String
content
;
/**
* 是否为正式的
* 正式的是在工作簿页面上显示的
* 非正式的是不在工作簿页面上显示的 目前就是草稿
* <p>
* 申请任务时只能指定审核者和关注者
* 申请的任务转正后发布者为审核者 执行者为申请者
* 工作量
*/
@NotNull
@ApiModelProperty
(
value
=
"
是否为正式的.正式的是在工作簿页面上显示的.非正式的目前就是草稿."
,
example
=
"true
"
)
private
Boolean
isFormal
;
@ApiModelProperty
(
value
=
"
工作量"
,
example
=
"30
"
)
private
int
workload
;
/**
* 工作状态
* 目前有:
进行中、已提交、已完结
* 目前有:
未发布、进行中、待审核、待考评
*/
@NotEmpty
@NotNull
@ApiModelProperty
(
value
=
"状态.进行中:underway、已提交:committed、已完结:finished"
,
example
=
"finished"
)
private
String
status
;
/**
* 考评系数
*/
@NotNull
@ApiModelProperty
(
value
=
"考评系数"
,
example
=
"0.8"
)
private
int
workCoefficient
;
/**
* 是否记录个人工作量
*/
private
int
pWorkload
=
1
;
/**
* 是否记录任务工作量
*/
private
int
workloadCount
=
1
;
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/entity/request/UpdateCrew.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
entity
.
request
;
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
;
import
java.util.List
;
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"修改任务组员"
,
description
=
"修改任务组员请求数据对象"
)
public
class
UpdateCrew
{
@ApiModelProperty
(
value
=
"操作人id"
,
example
=
"userid"
)
private
String
userid
;
@ApiModelProperty
(
value
=
"任务id"
,
example
=
"workId"
)
private
String
workId
;
@ApiModelProperty
(
value
=
"组员id"
,
example
=
"users"
)
private
List
<
String
>
users
;
@ApiModelProperty
(
value
=
"说明"
,
example
=
"msg"
)
private
String
msg
;
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/entity/response/WorkVo.java
浏览文件 @
f388f23d
...
...
@@ -2,7 +2,6 @@ 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.job.basic.entity.database.Comment
;
import
com.zjty.tynotes.pas.entity.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -90,13 +89,7 @@ public class WorkVo {
@ApiModelProperty
(
value
=
"附件.该任务中的附件,分3种类型:初始附件、工作附件、交流附件,由Attachment模型中的type属性区分附件类型."
)
private
List
<
Attachment
>
attachment
;
/**
* 留言
*
* @see CommentVo
*/
@ApiModelProperty
(
value
=
"留言"
)
private
List
<
CommentVo
>
comment
;
/*工作内容*/
/**
...
...
@@ -105,16 +98,7 @@ public class WorkVo {
*/
@ApiModelProperty
(
value
=
"内容"
,
example
=
"若是内容过多,将显示滚动条,同时,内容字数有上限3000个字,上限可设置,若是内容超出,请附件。"
)
private
String
content
;
/**
* 是否为正式的
* 正式的是在工作簿页面上显示的
* 非正式的是不在工作簿页面上显示的 目前就是草稿
* <p>
* 申请任务时只能指定审核者和关注者
* 申请的任务转正后发布者为审核者 执行者为申请者
*/
@ApiModelProperty
(
value
=
"是否为正式.正式的是在工作簿页面上显示的;非正式的是草稿."
,
example
=
"true"
,
notes
=
"正式的是在工作簿页面上显示的;非正式的是草稿"
)
private
Boolean
isFormal
;
/**
* Job状态
...
...
notes-job/src/main/java/com/zjty/tynotes/job/basic/repository/CommentRepository.java
浏览文件 @
f388f23d
...
...
@@ -6,8 +6,7 @@ import org.springframework.stereotype.Repository;
/**
* <p>Description : note
* <p>Date : 2019/4/25 11:28
* <p>@author : C
* <p>@author : zjm
*/
@Repository
public
interface
CommentRepository
extends
MongoRepository
<
Comment
,
String
>
{
...
...
notes-job/src/main/java/com/zjty/tynotes/job/basic/repository/ScoreCoefficientRepository.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
repository
;
import
com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
ScoreCoefficientRepository
extends
MongoRepository
<
ScoreCoefficient
,
String
>
{
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/repository/WorkRepository.java
浏览文件 @
f388f23d
...
...
@@ -2,12 +2,8 @@ package com.zjty.tynotes.job.basic.repository;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.data.mongodb.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
java.util.List
;
/**
* <p>Description : note
* <p>Date : 2019/4/23 9:45
...
...
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/CommentService.java
浏览文件 @
f388f23d
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.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();
//
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/ScoreCoefficientService.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
service
;
import
com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient
;
public
interface
ScoreCoefficientService
{
/**
* 新增工作
* 不可附带id
* 判断上级任务id是否存在,存在者减去这次任务设置的分数
* @param scoreCoefficient 考评对象
* @return 新增对象的id
*/
String
add
(
ScoreCoefficient
scoreCoefficient
);
/**
* 修改工作
* 必须附带id
*
* @param scoreCoefficient 考评对象
* @return 更新对象的id
*/
String
modify
(
ScoreCoefficient
scoreCoefficient
);
/**
* 指定id的Work是否存在
*
* @param Id 指定id
* @return 是否存在
*/
Boolean
idExists
(
String
Id
);
/**
* 查找指定id的Work
*
* @param id 指定id
* @return ScoreCoefficient 对象
*/
ScoreCoefficient
findById
(
String
id
);
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/TransHelper.java
浏览文件 @
f388f23d
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
;
//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);
//
//
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/WorkService.java
浏览文件 @
f388f23d
...
...
@@ -21,7 +21,7 @@ public interface WorkService {
/**
* 新增工作
* 不可附带id
*
*
判断上级任务id是否存在,存在者减去这次任务设置的分数
* @param work Work对象
* @return 新增对象的id
*/
...
...
@@ -79,6 +79,38 @@ public interface WorkService {
*/
void
deleteAll
();
/**
* 修改任务的状态
* @param taskId 任务id
* @param status 要修改的状态
*/
void
alterTaskStatus
(
String
taskId
,
String
status
);
/**
* 逻辑删除任务
* @param taskId 任务id
* @param personalWorkload 是否记录个人工作量 默认记录1 0 为不记录
* @param workloadCount 是否记录任务总工作量
*/
void
deleteWork
(
String
taskId
,
int
personalWorkload
,
int
workloadCount
);
/**
* 修改任务 组员
* @param taskId 任务id
*
* @param crews 组员名单
*/
void
updateWorkCrew
(
String
taskId
,
List
<
String
>
crews
);
/**
* 修改任务 组员
* @param taskId 任务id
*
* @param workload 工作量
* @param workCoefficient 考评系数 只能修改0.1-0.2
*/
void
updateWorkload
(
String
taskId
,
int
workload
,
int
workCoefficient
);
// /**
// * 查看正在进行中的任务
// */
...
...
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/impl/CommentServiceImpl.java
浏览文件 @
f388f23d
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.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();
//
}
//
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/impl/ScoreCoefficientServiceImpl.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
basic
.
service
.
impl
;
import
com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient
;
import
com.zjty.tynotes.job.basic.repository.ScoreCoefficientRepository
;
import
com.zjty.tynotes.job.basic.service.ScoreCoefficientService
;
import
com.zjty.tynotes.job.common.exception.BadRequestException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Optional
;
import
static
java
.
util
.
Objects
.
isNull
;
import
static
java
.
util
.
Objects
.
nonNull
;
@Service
@Slf4j
public
class
ScoreCoefficientServiceImpl
implements
ScoreCoefficientService
{
private
final
ScoreCoefficientRepository
scoreCoefficientRepository
;
@Autowired
public
ScoreCoefficientServiceImpl
(
ScoreCoefficientRepository
scoreCoefficientRepository
)
{
this
.
scoreCoefficientRepository
=
scoreCoefficientRepository
;
}
@Override
public
String
add
(
ScoreCoefficient
scoreCoefficient
)
{
Boolean
idIsNull
=
isNull
(
scoreCoefficient
.
getId
());
if
(
idIsNull
){
String
id
=
scoreCoefficientRepository
.
save
(
scoreCoefficient
).
getId
();
log
.
info
(
"[job] 任务{},考评添加成功,id为 {} "
,
scoreCoefficient
.
getWordId
(),
id
);
return
id
;
}
else
{
String
msg
=
"[job] 任务"
+
scoreCoefficient
.
getWordId
()+
",新增考评数据不能带id."
;
log
.
error
(
msg
);
throw
new
BadRequestException
(
msg
);
}
}
@Override
public
String
modify
(
ScoreCoefficient
scoreCoefficient
)
{
Boolean
idMustExist
=
(
nonNull
(
scoreCoefficient
.
getId
()))
&&
(
scoreCoefficientRepository
.
existsById
(
scoreCoefficient
.
getId
()));
if
(
idMustExist
)
{
String
modifyId
=
scoreCoefficientRepository
.
save
(
scoreCoefficient
).
getId
();
log
.
info
(
String
.
format
(
"[job] 更新了任务id为 %s 的考评数据id为 %s ."
,
scoreCoefficient
.
getWordId
(),
modifyId
));
return
modifyId
;
}
else
{
String
msg
=
"[job] 更新数据必须指定id且指定id的数据存在."
;
log
.
error
(
msg
);
throw
new
BadRequestException
(
msg
);
}
}
@Override
public
Boolean
idExists
(
String
Id
)
{
return
scoreCoefficientRepository
.
existsById
(
Id
);
}
@Override
public
ScoreCoefficient
findById
(
String
id
)
{
Optional
<
ScoreCoefficient
>
scoreOptional
=
scoreCoefficientRepository
.
findById
(
id
);
return
scoreOptional
.
orElseThrow
(()
->
new
BadRequestException
(
String
.
format
(
"[job] 考评id为 %s 的数据不存在."
,
id
)));
}
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/impl/TransHelperImpl.java
浏览文件 @
f388f23d
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
.
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()
//
);
//
}
//
}
notes-job/src/main/java/com/zjty/tynotes/job/basic/service/impl/WorkServiceImpl.java
浏览文件 @
f388f23d
...
...
@@ -10,9 +10,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneOffset
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -106,6 +103,38 @@ public class WorkServiceImpl implements WorkService {
public
void
deleteAll
()
{
}
@Override
public
void
alterTaskStatus
(
String
taskId
,
String
status
)
{
Work
ob
=
workRepository
.
findById
(
taskId
).
get
();
ob
.
setStatus
(
status
);
workRepository
.
save
(
ob
);
}
@Override
public
void
deleteWork
(
String
taskId
,
int
personalWorkload
,
int
workloadCount
)
{
Work
ob
=
workRepository
.
findById
(
taskId
).
get
();
ob
.
setPWorkload
(
personalWorkload
);
ob
.
setWorkloadCount
(
workloadCount
);
workRepository
.
save
(
ob
);
}
@Override
public
void
updateWorkCrew
(
String
taskId
,
List
<
String
>
crews
)
{
Work
ob
=
workRepository
.
findById
(
taskId
).
get
();
ob
.
setCrewList
(
crews
);
workRepository
.
save
(
ob
);
}
@Override
public
void
updateWorkload
(
String
taskId
,
int
workload
,
int
workCoefficient
)
{
Work
ob
=
workRepository
.
findById
(
taskId
).
get
();
ob
.
setWorkload
(
workload
);
ob
.
setWorkCoefficient
(
workCoefficient
);
workRepository
.
save
(
ob
);
}
// @Override
// public List<Work> selectTimeWork() {
//// LocalDateTime minTime = LocalDateTime.now().with(LocalTime.MIN).atZone(ZoneOffset.ofHours(8)).ge;
...
...
notes-job/src/main/java/com/zjty/tynotes/job/business/service/AlterTaskService.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
business
.
service
;
import
com.zjty.tynotes.job.basic.entity.request.UserRo
;
/**
* @author LJJ cnljj1995@gmail.com
* on 2019-05-22
*/
public
interface
AlterTaskService
{
void
alterTaskStatus
(
String
taskId
,
String
status
);
void
updateFlower
(
UserRo
userRo
);
void
updateChecker
(
UserRo
userRo
);
}
notes-job/src/main/java/com/zjty/tynotes/job/business/service/NoteMessageService.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
business
.
service
;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
import
com.zjty.tynotes.job.business.service.impl.NoteMessageServiceImpl
;
import
com.zjty.tynotes.job.common.Action
;
import
org.springframework.stereotype.Service
;
/**
* <p>Description : ty-note-backend
* <p>Date : 2019/5/13 10:25
* <p>@author : C
* 接口实现见
*
* @see NoteMessageServiceImpl
*/
@Service
public
interface
NoteMessageService
{
/**
* 发生使工作变化的相关操作时(新增、修改)
* 需要记录下来
* 保存操作记录(已知操作编号的情况下)
*
* @param userId 执行该次操作的用户的id
* @param workId 该次操作涉及的工作的id
* @param action 操作编号
* @param remarks 备注内容
* 操作编号详细见↓
* @see Action
*/
void
saveNoteMessage
(
String
userId
,
String
workId
,
Integer
action
,
String
remarks
);
/**
* 同上
* 保存操作记录(未知操作编号的情况下)
* (先对比新旧Work对象 判断出操作编号 再保存)
*
* @param userId 执行该次操作的用户的id
* @param workId 该次操作涉及的工作的id
* @param newWork 操作后的Work对象
* @param oldWork 原Work对象
* @param remarks 备注内容
* 操作编号详细见↓
* @see Action
*/
void
saveNoteMessage
(
String
userId
,
String
workId
,
Work
newWork
,
Work
oldWork
,
String
remarks
);
}
notes-job/src/main/java/com/zjty/tynotes/job/business/service/impl/AlterTaskStatusImpl.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
business
.
service
.
impl
;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
import
com.zjty.tynotes.job.basic.entity.request.UserRo
;
import
com.zjty.tynotes.job.basic.repository.WorkRepository
;
import
com.zjty.tynotes.job.business.service.AlterTaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
javax.management.Query
;
import
java.util.Optional
;
/**
* @author LJJ cnljj1995@gmail.com
* on 2019-05-22
*/
@Service
public
class
AlterTaskStatusImpl
implements
AlterTaskService
{
@Autowired
private
WorkRepository
workRepository
;
@Override
public
void
alterTaskStatus
(
String
taskId
,
String
status
)
{
Work
ob
=
workRepository
.
findById
(
taskId
).
get
();
ob
.
setStatus
(
status
);
workRepository
.
save
(
ob
);
}
@Override
public
void
updateFlower
(
UserRo
userRo
)
{
Work
ob
=
workRepository
.
findById
(
userRo
.
getWorkId
()).
get
();
ob
.
setFollower
(
userRo
.
getUsers
());
workRepository
.
save
(
ob
);
}
@Override
public
void
updateChecker
(
UserRo
userRo
)
{
Work
ob
=
workRepository
.
findById
(
userRo
.
getWorkId
()).
get
();
ob
.
setChecker
(
userRo
.
getUsers
());
workRepository
.
save
(
ob
);
}
}
notes-job/src/main/java/com/zjty/tynotes/job/business/service/impl/NoteMessageServiceImpl.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
business
.
service
.
impl
;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
import
com.zjty.tynotes.job.business.service.NoteMessageService
;
import
com.zjty.tynotes.job.common.constant.WorkStatus
;
import
com.zjty.tynotes.job.status.service.BusinessTreeManagement
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Objects
;
import
static
com
.
zjty
.
tynotes
.
job
.
common
.
Action
.*;
import
static
com
.
zjty
.
tynotes
.
job
.
common
.
constant
.
WorkStatus
.
COMMITTED
;
import
static
com
.
zjty
.
tynotes
.
job
.
common
.
constant
.
WorkStatus
.
FINISHED
;
import
static
com
.
zjty
.
tynotes
.
job
.
common
.
constant
.
WorkStatus
.
UNDERWAY
;
/**
* <p>Description : ty-note-backend
* <p>Date : 2019/5/13 13:37
* <p>@author : C
* 接口定义见
*
* @see NoteMessageService
*/
@Service
public
class
NoteMessageServiceImpl
implements
NoteMessageService
{
private
final
BusinessTreeManagement
businessTreeManagement
;
@Autowired
public
NoteMessageServiceImpl
(
BusinessTreeManagement
businessTreeManagement
)
{
this
.
businessTreeManagement
=
businessTreeManagement
;
}
@Override
public
void
saveNoteMessage
(
String
userId
,
String
workId
,
Integer
action
,
String
remarks
)
{
Boolean
remarksRequired
=
action
.
equals
(
COMMIT_WORK
)
||
action
.
equals
(
BACK_WORK
)
||
action
.
equals
(
FINISH_WORK
);
Boolean
remarksExist
=
Objects
.
nonNull
(
remarks
);
if
(
remarksRequired
&&
remarksExist
)
{
businessTreeManagement
.
saveAction
(
userId
,
workId
,
action
,
new
Date
(),
remarks
);
}
else
{
businessTreeManagement
.
saveAction
(
userId
,
workId
,
action
,
new
Date
(),
""
);
}
}
@Override
public
void
saveNoteMessage
(
String
userId
,
String
workId
,
Work
newWork
,
Work
oldWork
,
String
remarks
)
{
Integer
action
=
0
;
Boolean
publishWork
=
Objects
.
equals
(
oldWork
.
getIsFormal
(),
false
)
&&
Objects
.
equals
(
newWork
.
getIsFormal
(),
true
);
Boolean
commitWork
=
Objects
.
equals
(
oldWork
.
getStatus
(),
UNDERWAY
)
&&
Objects
.
equals
(
newWork
.
getStatus
(),
WorkStatus
.
COMMITTED
);
Boolean
backWork
=
Objects
.
equals
(
oldWork
.
getStatus
(),
COMMITTED
)
&&
Objects
.
equals
(
newWork
.
getStatus
(),
UNDERWAY
);
Boolean
finishWork
=
Objects
.
equals
(
oldWork
.
getStatus
(),
COMMITTED
)
&&
Objects
.
equals
(
newWork
.
getStatus
(),
FINISHED
);
Boolean
alterChecker
=
!
Objects
.
equals
(
oldWork
.
getChecker
(),
newWork
.
getChecker
());
Boolean
alterFollower
=
!
Objects
.
equals
(
oldWork
.
getFollower
(),
newWork
.
getFollower
());
Boolean
comment
=
!
Objects
.
equals
(
oldWork
.
getComment
(),
newWork
.
getComment
());
if
(
publishWork
)
{
action
=
PUBLISH_WORK
;
}
else
if
(
commitWork
)
{
action
=
COMMIT_WORK
;
}
else
if
(
backWork
)
{
action
=
BACK_WORK
;
}
else
if
(
finishWork
)
{
action
=
FINISH_WORK
;
}
else
if
(
alterChecker
)
{
action
=
ALTER_CHECKER
;
}
else
if
(
alterFollower
)
{
action
=
ALTER_FOLLOWER
;
}
else
if
(
comment
)
{
action
=
COMMENT
;
}
saveNoteMessage
(
userId
,
workId
,
action
,
remarks
);
}
}
notes-job/src/main/java/com/zjty/tynotes/job/common/Action.java
浏览文件 @
f388f23d
...
...
@@ -7,7 +7,7 @@ package com.zjty.tynotes.job.common;
public
interface
Action
{
/**
*
发布
者发布工作
* 者发布工作
*/
int
PUBLISH_WORK
=
1
;
...
...
@@ -17,27 +17,50 @@ public interface Action {
int
COMMIT_WORK
=
2
;
/**
*
审核者退
回工作
*
执行者撤
回工作
*/
int
BACK_WORK
=
3
;
int
COMMIT_
BACK_WORK
=
3
;
/**
* 审核者
完结
工作
* 审核者
审核不通过
工作
*/
int
FINISH
_WORK
=
4
;
int
BACK
_WORK
=
4
;
/**
*
修改审核者
*
审核者审核通过工作
*/
int
ALTER_CHECKER
=
5
;
int
FINISH_WORK
=
5
;
/**
*
修改关注者
*
删除工作
*/
int
ALTER_FOLLOWER
=
6
;
int
DELETE_WORK
=
6
;
/**
* 修改 任务组员
*/
int
UPDATE_WORK_CREW
=
7
;
/**
* 修改 工作量 以及考评系数
*/
int
UPDATE_WORKLOAD
=
8
;
/**
* 考评任务
*/
int
APPRAISAL_WORD
=
9
;
/**
* 发布者保存任务
*/
int
SAVE_WORK
=
10
;
/**
*
留言
*
任务重未发布到进行中
*/
int
COMMENT
=
7
;
int
SAVE_PUBLISH_WORK
=
11
;
}
notes-job/src/main/java/com/zjty/tynotes/job/common/Constants.java
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
common
;
import
org.springframework.beans.factory.annotation.Value
;
/**
* 公用类
*
...
...
notes-job/src/main/java/com/zjty/tynotes/job/common/constant/WorkStatus.java
浏览文件 @
f388f23d
...
...
@@ -8,19 +8,37 @@ package com.zjty.tynotes.job.common.constant;
*/
public
final
class
WorkStatus
{
/**
* 未发布
*/
public
static
final
String
UNPUBLISHED
=
"unpublished"
;
/**
* 进行中
*/
public
static
final
String
UNDERWAY
=
"underway"
;
public
static
final
String
ONGOING
=
"ongoing"
;
/**
* 待审核
*/
public
static
final
String
AUDIT
=
"audit"
;
/**
*
已提交
*
待考评
*/
public
static
final
String
COMMITTED
=
"committed"
;
public
static
final
String
REVIEW
=
"review"
;
/**
* 已完结
*/
public
static
final
String
FINISHED
=
"finished"
;
/**
* 已删除
*/
public
static
final
String
DELETE
=
"delete"
;
}
notes-job/src/main/java/com/zjty/tynotes/job/common/exception/WorkAttribution.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
common
.
exception
;
/**
* @author LJJ cnljj1995@gmail.com
* on 2019-05-09
*/
public
interface
WorkAttribution
{
/**
* 我的任务
*/
int
ME_WORK
=
1
;
/**
* 我接收的任务
*/
int
ME_RECEIVE_WORK
=
2
;
/**
* 我分解的任务
*/
int
ME_RESOLVE_WORK
=
3
;
/**
* 我发布的任务
*/
int
ME_RELEASE_WORK
=
4
;
}
notes-job/src/main/java/com/zjty/tynotes/job/status/controller/ActionHistoryController.java
浏览文件 @
f388f23d
...
...
@@ -8,7 +8,6 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
notes-job/src/main/java/com/zjty/tynotes/job/status/controller/ReadController.java
→
notes-job/src/main/java/com/zjty/tynotes/job/status/controller/Read
1
Controller.java
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
controller
;
import
com.zjty.tynotes.job.status.entity.BouncedMessage
;
import
com.zjty.tynotes.job.status.entity.EsListSum
;
import
com.zjty.tynotes.job.status.entity.EventTitle
;
import
com.zjty.tynotes.job.status.service.EventService
;
import
com.zjty.tynotes.job.status.service.PrivateService
;
import
com.zjty.tynotes.job.status.service.WorkShowSeeService
;
import
com.zjty.tynotes.job.status.service.WorkShowService
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -18,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* @author zjm
...
...
@@ -27,18 +24,18 @@ import java.util.List;
@RestController
@RequestMapping
(
"/read"
)
@Api
(
tags
=
"阅读页面接口"
,
value
=
"阅读页面数据"
)
public
class
ReadController
{
public
class
Read
1
Controller
{
@Autowired
EventService
event
Service
;
WorkShowSeeService
workShowSee
Service
;
@Autowired
PrivateService
private
Service
;
WorkShowService
workShow
Service
;
/**
*阅读页面
待审核
列表
*阅读页面
我的任务
列表
* @param page 页码 默认1
* @param size 每页显示条数 默认10
* @param id 人员id
*/
@PostMapping
(
"/select
Commission
"
)
@PostMapping
(
"/select
MeWork
"
)
@ApiOperation
(
value
=
"获取阅读页面待审核列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
,
required
=
true
),
...
...
@@ -56,16 +53,16 @@ public class ReadController {
pageSize
=
page
-
1
;
}
return
ResponseEntity
.
ok
(
privateService
.
selectCommission
(
id
,
pageSize
,
size
));
return
ResponseEntity
.
ok
(
workShowSeeService
.
selectMeWork
(
id
,
pageSize
,
size
));
}
/**
*阅读页面
已提交
列表
*阅读页面
我接收的任务
列表
* @param page 页码 默认1
* @param size 每页显示条数 默认10
* @param id 人员id
*/
@PostMapping
(
"/select
Submit
"
)
@PostMapping
(
"/select
MeReceiv
"
)
@ApiOperation
(
value
=
"获取阅读页面已提交列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
,
required
=
true
),
...
...
@@ -83,23 +80,23 @@ public class ReadController {
pageSize
=
page
-
1
;
}
return
ResponseEntity
.
ok
(
privateService
.
selectSubmit
(
id
,
pageSize
,
size
));
return
ResponseEntity
.
ok
(
workShowSeeService
.
selectMeReceiveWork
(
id
,
pageSize
,
size
));
}
/**
*阅读页面
其他
列表
*阅读页面
我的分解任务
列表
* @param page 页码 默认1
* @param size 每页显示条数 默认10
* @param id 人员id
*/
@PostMapping
(
"/select
Other
"
)
@ApiOperation
(
value
=
"
获取阅读页面其他
列表"
)
@PostMapping
(
"/select
MeResolve
"
)
@ApiOperation
(
value
=
"
阅读页面我的分解任务
列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
dataType
=
"int"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页显示条数"
,
dataType
=
"int"
,
paramType
=
"query"
,
example
=
"10"
)
})
public
ResponseEntity
<
EsListSum
>
select
Other
(
@RequestParam
(
value
=
"id"
)
String
id
,
public
ResponseEntity
<
EsListSum
>
select
MeResolveWork
(
@RequestParam
(
value
=
"id"
)
String
id
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
){
...
...
@@ -109,23 +106,23 @@ public class ReadController {
}
else
{
pageSize
=
page
-
1
;
}
return
ResponseEntity
.
ok
(
privateService
.
selectOther
(
id
,
pageSize
,
size
));
return
ResponseEntity
.
ok
(
workShowSeeService
.
selectMeResolveWork
(
id
,
pageSize
,
size
));
}
/**
*阅读页面
收藏
列表
*阅读页面
我发布的任务
列表
* @param page 页码 默认1
* @param size 每页显示条数 默认10
* @param id 人员id
*/
@PostMapping
(
"/select
Collection
"
)
@ApiOperation
(
value
=
"
获取阅读页面收藏
列表"
)
@PostMapping
(
"/select
MeRelease
"
)
@ApiOperation
(
value
=
"
阅读页面我发布的任务
列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
dataType
=
"int"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页显示条数"
,
dataType
=
"int"
,
paramType
=
"query"
,
example
=
"10"
)
})
public
ResponseEntity
<
EsListSum
>
select
Collection
(
@RequestParam
(
value
=
"id"
)
String
id
,
public
ResponseEntity
<
EsListSum
>
select
MeReleaseWork
(
@RequestParam
(
value
=
"id"
)
String
id
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
){
...
...
@@ -135,7 +132,7 @@ public class ReadController {
}
else
{
pageSize
=
page
-
1
;
}
return
ResponseEntity
.
ok
(
privateService
.
selectCollection
(
id
,
pageSize
,
size
));
return
ResponseEntity
.
ok
(
workShowSeeService
.
selectMeReleaseWork
(
id
,
pageSize
,
size
));
}
/**
...
...
@@ -163,28 +160,11 @@ public class ReadController {
}
else
{
pageSize
=
page
-
1
;
}
return
ResponseEntity
.
ok
(
privat
eService
.
titleSelect
(
id
,
pageSize
,
size
,
title
));
return
ResponseEntity
.
ok
(
workShowSe
eService
.
titleSelect
(
id
,
pageSize
,
size
,
title
));
}
/**
*阅读页设置收藏
* @param eventId 事件id
* @param id 人员id
*/
@ApiOperation
(
value
=
"事件置顶"
)
@PostMapping
(
"/collection"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"String"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件id"
,
dataType
=
"String"
,
paramType
=
"query"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"collection"
,
value
=
"是否收藏"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
,
example
=
"1"
)
})
public
ResponseEntity
<
BouncedMessage
>
collection
(
@RequestParam
(
value
=
"id"
)
String
id
,
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"collection"
)
int
collection
){
return
ResponseEntity
.
ok
(
eventService
.
placedCollection
(
eventId
,
id
,
collection
));
}
/**
* 查看事件的时候
...
...
@@ -205,7 +185,7 @@ public class ReadController {
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"readState"
)
int
readState
){
event
Service
.
readsStatus
(
id
,
eventId
,
readState
);
workShow
Service
.
readsStatus
(
id
,
eventId
,
readState
);
HashMap
map
=
new
HashMap
(
10
);
map
.
put
(
"msg"
,
"事件状态修改成功"
);
return
ResponseEntity
.
ok
(
map
);
...
...
@@ -220,7 +200,7 @@ public class ReadController {
public
ResponseEntity
loginFirstOneManualPush
(
@RequestParam
(
value
=
"id"
)
String
id
){
private
Service
.
loginFirstOneManualPush
(
id
);
workShow
Service
.
loginFirstOneManualPush
(
id
);
return
ResponseEntity
.
ok
().
build
();
}
...
...
notes-job/src/main/java/com/zjty/tynotes/job/status/controller/TaskController.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
status
.
controller
;
import
com.zjty.tynotes.job.common.constant.WorkStatus
;
import
com.zjty.tynotes.job.status.service.EventService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
/**
* @author zjm
*/
@RequestMapping
(
"/read"
)
@RestController
@Slf4j
public
class
TaskController
{
@Autowired
EventService
eventService
;
@GetMapping
(
"/task/{id}/{id1}/{id2}/{id3}"
)
public
void
task
(
@PathVariable
(
"id"
)
String
id
,
@PathVariable
(
"id1"
)
String
id1
,
@PathVariable
(
"id2"
)
String
id2
,
@PathVariable
(
"id3"
)
String
id3
){
log
.
info
(
"开始"
);
Map
<
Integer
,
List
<
String
>>
map
=
new
HashMap
<>();
List
<
String
>
s
=
new
ArrayList
<>();
List
<
String
>
f1
=
new
ArrayList
<>();
f1
.
add
(
id
);
List
<
String
>
z
=
new
ArrayList
<>();
z
.
add
(
id1
);
s
.
add
(
id2
);
List
<
String
>
g
=
new
ArrayList
<>();
g
.
add
(
id3
);
map
.
put
(
1
,
s
);
map
.
put
(
0
,
g
);
Map
<
String
,
List
<
String
>>
map1
=
new
HashMap
<>();
map1
.
put
(
"inspector"
,
s
);
map1
.
put
(
"viewer"
,
g
);
map1
.
put
(
"executor"
,
z
);
map1
.
put
(
"publisher"
,
f1
);
eventService
.
saveTakePushEvent
(
"test1"
,
"第一次"
,
id
,
id1
,
map
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
map1
,
"添加新的事件"
);
eventService
.
saveTakePushEvent
(
"test2"
,
"第2次"
,
id
,
id1
,
map
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
map1
,
"添加新的事件"
);
eventService
.
saveTakePushEvent
(
"test3"
,
"第3次"
,
id
,
id1
,
map
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
map1
,
"添加新的事件"
);
eventService
.
saveTakePushEvent
(
"test4"
,
"第4次"
,
id
,
id1
,
map
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
map1
,
"添加新的事件"
);
}
@GetMapping
(
"/task1"
)
public
void
task1
(){
eventService
.
readsStatus
(
"z"
,
"test1"
,
1
);
eventService
.
readsStatus
(
"z"
,
"test2"
,
1
);
eventService
.
readsStatus
(
"f"
,
"test1"
,
1
);
eventService
.
readsStatus
(
"f"
,
"test2"
,
1
);
}
@GetMapping
(
"/task2"
)
public
void
task2
(){
Set
<
String
>
s
=
new
HashSet
<>();
s
.
add
(
"s1"
);
s
.
add
(
"s2"
);
s
.
add
(
"g1"
);
s
.
add
(
"g2"
);
s
.
add
(
"z"
);
eventService
.
addMessage
(
"f"
,
"test1"
,
s
,
new
Date
(),
1
,
"f对test1时间留言"
);
eventService
.
addMessage
(
"f"
,
"test2"
,
s
,
new
Date
(),
1
,
"f对test2时间留言"
);
}
@GetMapping
(
"/task3"
)
public
void
task3
(){
Set
<
String
>
s
=
new
HashSet
<>();
s
.
add
(
"s1"
);
s
.
add
(
"s2"
);
s
.
add
(
"g1"
);
s
.
add
(
"g2"
);
s
.
add
(
"z"
);
eventService
.
upDateStateEvent
(
"test1"
,
"f"
,
s
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
"f修改了事件状态"
);
eventService
.
upDateStateEvent
(
"test2"
,
"f"
,
s
,
new
Date
(),
WorkStatus
.
UNDERWAY
,
"f修改了事件状态"
);
}
@GetMapping
(
"/task4"
)
public
void
task4
(){
List
<
String
>
s
=
new
ArrayList
<>();
List
<
String
>
f1
=
new
ArrayList
<>();
f1
.
add
(
"f"
);
List
<
String
>
z
=
new
ArrayList
<>();
z
.
add
(
"z"
);
s
.
add
(
"s1"
);
s
.
add
(
"s3"
);
List
<
String
>
g
=
new
ArrayList
<>();
g
.
add
(
"g1"
);
g
.
add
(
"g3"
);
Map
<
String
,
List
<
String
>>
map1
=
new
HashMap
<>();
map1
.
put
(
"inspector"
,
s
);
map1
.
put
(
"viewer"
,
g
);
map1
.
put
(
"executor"
,
z
);
map1
.
put
(
"publisher"
,
f1
);
Set
<
String
>
s1
=
new
HashSet
<>();
s1
.
add
(
"s1"
);
s1
.
add
(
"s2"
);
s1
.
add
(
"g1"
);
s1
.
add
(
"g2"
);
s1
.
add
(
"z"
);
eventService
.
addFollowersEvent
(
"f"
,
"test1"
,
s1
,
"第一次"
,
new
Date
(),
1
,
WorkStatus
.
UNDERWAY
,
map1
,
"修改事件"
);
//eventService.addFollowersEvent("test2","第2次",new Date(),1,"q",0,1);
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/entity/EsListSum.java
浏览文件 @
f388f23d
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
;
import
java.util.List
;
...
...
@@ -9,33 +13,14 @@ import java.util.List;
* @author zjm
*/
@ApiModel
(
value
=
"EsListSum对象"
,
description
=
"提供数据列表和总数"
)
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
EsListSum
{
@ApiModelProperty
(
value
=
"总数"
,
name
=
"count"
,
example
=
"0L"
)
private
Long
count
;
@ApiModelProperty
(
value
=
"数据列表"
,
name
=
"eventTitles"
)
private
List
<
EventTitle
>
eventTitles
;
private
List
<
RedisPersonalWork
>
eventTitles
;
public
EsListSum
(
Long
count
,
List
<
EventTitle
>
eventTitles
)
{
this
.
count
=
count
;
this
.
eventTitles
=
eventTitles
;
}
public
EsListSum
()
{
}
public
Long
getCount
()
{
return
count
;
}
public
void
setCount
(
Long
count
)
{
this
.
count
=
count
;
}
public
List
<
EventTitle
>
getEventTitles
()
{
return
eventTitles
;
}
public
void
setEventTitles
(
List
<
EventTitle
>
eventTitles
)
{
this
.
eventTitles
=
eventTitles
;
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/entity/EventTitle.java
浏览文件 @
f388f23d
...
...
@@ -3,7 +3,6 @@ package com.zjty.tynotes.job.status.entity;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
notes-job/src/main/java/com/zjty/tynotes/job/status/entity/Personnel.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
entity
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"人员管理页面人员列表"
)
public
class
Personnel
{
private
String
id
;
private
String
name
;
private
int
count
;
}
notes-job/src/main/java/com/zjty/tynotes/job/status/entity/RedisPersonalWork.java
0 → 100644
浏览文件 @
f388f23d
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
;
import
java.util.List
;
@AutoDocument
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
""
)
public
class
RedisPersonalWork
{
/**
* 任务id
*/
@ApiModelProperty
(
value
=
"任务id"
,
name
=
"workId"
,
example
=
"3y8735217537c"
)
private
String
workId
;
/**
* 时间 秒
*/
@ApiModelProperty
(
value
=
"时间"
,
name
=
"time"
,
example
=
"7878979686L"
)
private
Long
time
;
/**
*任务标题
*/
@ApiModelProperty
(
value
=
"任务标题"
,
name
=
"title"
,
example
=
"xxx"
)
private
String
title
;
/**
* 任务状态
*/
@ApiModelProperty
(
value
=
"任务状态"
,
name
=
"status"
,
example
=
"进行中"
)
private
String
status
;
/**
* 发布者
*/
@ApiModelProperty
(
value
=
"发布者"
,
name
=
"release"
,
example
=
"xx"
)
private
String
release
;
/**
* 执行者
*/
@ApiModelProperty
(
value
=
"执行者"
,
name
=
"executor"
,
example
=
"xxx"
)
private
String
executor
;
/**
* 已读未读
*/
@ApiModelProperty
(
value
=
"是否已读(0已读,1未读)"
,
name
=
"readState"
,
example
=
"1"
)
private
int
readState
;
/**
* 任务所属位置 我的任务 我接受的任务
*/
@ApiModelProperty
(
value
=
"任务所属位置"
,
name
=
"workAttribution"
,
example
=
"1"
)
private
int
workAttribution
;
/**
* 最近的操作
*/
@ApiModelProperty
(
value
=
"最近一次的操作"
,
name
=
"latestNews"
,
example
=
"root留言"
)
private
String
latestNews
;
/**
* 上级任务id
*/
@ApiModelProperty
(
value
=
"上级任务id"
,
name
=
"superiorId"
,
example
=
"root留言"
)
private
String
superiorId
;
/**
* 子任务id集合
*/
@ApiModelProperty
(
value
=
"上级任务id"
,
name
=
"superiorId"
,
example
=
"root留言"
)
private
List
<
String
>
subtaskIds
;
}
notes-job/src/main/java/com/zjty/tynotes/job/status/entity/RoleSum.java
浏览文件 @
f388f23d
...
...
@@ -13,34 +13,44 @@ import lombok.NoArgsConstructor;
public
class
RoleSum
{
/**
*
代办
是否有未读 0 否 1有
*
我的任务
是否有未读 0 否 1有
*/
private
int
commission
Unread
;
private
int
meWork
Unread
;
/**
*
代办
条数
*
我的任务
条数
*/
private
int
commission
Count
;
private
int
meWork
Count
;
/**
*
提交
是否有未读 0 否 1有
*
我接收的任务
是否有未读 0 否 1有
*/
private
int
submit
Unread
;
private
int
meReceive
Unread
;
/**
*
提交
条数
*
我接收的任务
条数
*/
private
int
submit
Count
;
private
int
meReceive
Count
;
/**
*
其他
是否有未读 0 否 1有
*
我分解的任务
是否有未读 0 否 1有
*/
private
int
other
Unread
;
private
int
meResolve
Unread
;
/**
*
其他
条数
*
我分解的任务
条数
*/
private
int
otherCount
;
private
int
meResolveCount
;
/**
* 我发布的任务 是否有未读 0 否 1有
*/
private
int
meReleaseUnread
;
/**
* 我发布的任务 条数
*/
private
int
meReleaseCount
;
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/EventService.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.status.entity.BouncedMessage
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author zjm
*/
public
interface
EventService
{
/**
* 添加数据到redis(分别安人员id来进行) ->取出数据->推送数据
* @param eventId 事件id
* @param eventTitle 事件标题
* @param id 发布者
* @param map 3种角色的id集合
* @param updateTime 更新时间
* @param state 事件状态
* @param executorId 执行人id
* @param mapName 执行人名称
* @param latestNews 对任务的操作
*
*/
void
saveTakePushEvent
(
String
eventId
,
String
eventTitle
,
String
id
,
String
executorId
,
Map
<
Integer
,
List
<
String
>>
map
,
Date
updateTime
,
String
state
,
Map
<
String
,
List
<
String
>>
mapName
,
String
latestNews
);
/**
*新留言
* @param id 留言人的Id
* @param eventId 事件id
* @param ids 推送人员的id(相关人员id)
* @param updateTime 更新时间
* @param messageCount 留言条数
* @param latestNews 对任务的操作
*/
void
addMessage
(
String
id
,
String
eventId
,
Set
<
String
>
ids
,
Date
updateTime
,
int
messageCount
,
String
latestNews
);
/**
* 更新事件的状态
* @param eventId 事件id
* @param id 操作者id
* @param ids 推送人员的id(相关人员id)
* @param updateTime 更新时间
* @param state 事件状态
* @param latestNews 对任务的操作
*/
void
upDateStateEvent
(
String
eventId
,
String
id
,
Set
<
String
>
ids
,
Date
updateTime
,
String
state
,
String
latestNews
);
/**
* 添加审核 - 关注者
* @param operationId 操作者id
* @param eventId 事件id
* @param ids 事件相关人员id
* @param eventTitle 事件标题
* @param updateTime 更新时间
* @param messageCount 留言条数
* @param state 事件的状态
* @param mapName 执行人名称
* @param latestNews 最近的一次对任务的操作
*/
void
addFollowersEvent
(
String
operationId
,
String
eventId
,
Set
<
String
>
ids
,
String
eventTitle
,
Date
updateTime
,
int
messageCount
,
String
state
,
Map
<
String
,
List
<
String
>>
mapName
,
String
latestNews
);
/**
* 设置收藏 和取消收藏
* @param eventId 事件id
* @param id 人员id
* @param collection 是否收藏
* @return 操作状态
*/
BouncedMessage
placedCollection
(
String
eventId
,
String
id
,
int
collection
);
/**
* 查看事件的时候
* @param id 人员id
* @param eventId 事件id
* @param readState 是否阅读过 判读是否阅读过 否修改 阅读状态
*/
void
readsStatus
(
String
id
,
String
eventId
,
int
readState
);
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/InternalService.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.status.entity.Personnel
;
import
java.util.List
;
/**
* 接其他模块使用的service
*/
public
interface
InternalService
{
/**
* 根据id集合返任务数量
* @param list
* @return
*/
List
<
Personnel
>
personnels
(
List
<
String
>
list
);
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/PrivateService.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.status.entity.EsListSum
;
import
com.zjty.tynotes.job.status.entity.EventTitle
;
import
java.util.List
;
/**
* @author zjm
*/
public
interface
PrivateService
{
/**
* 代办事件查询
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @return 事件对象集合
*/
EsListSum
selectCommission
(
String
id
,
int
page
,
int
size
);
/**
* 已提交事件查询
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @return 事件对象集合
*/
EsListSum
selectSubmit
(
String
id
,
int
page
,
int
size
);
/**
* 其他事件查询
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @return 事件对象集合
*/
EsListSum
selectOther
(
String
id
,
int
page
,
int
size
);
/**
* 收藏事件
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @return 给前端对象集合 和条数
*/
EsListSum
selectCollection
(
String
id
,
int
page
,
int
size
);
/**
* 标题查询
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @param title 事件的标题
* @return 给前端对象集合 和条数
*/
EsListSum
titleSelect
(
String
id
,
int
page
,
int
size
,
String
title
);
/**
* 人员登入 第一次的数据 接口触发
* @param id 人员id
*/
void
loginFirstOneManualPush
(
String
id
);
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/Take.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.common.constant.WorkStatus
;
import
com.zjty.tynotes.job.status.entity.RoleSum
;
import
com.zjty.tynotes.job.status.utils.JacksonUtil
;
import
com.zjty.tynotes.sms.service.MessageTemplateService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
java.util.*
;
/**
* @author zjm
*/
@Service
@Slf4j
public
class
Take
{
@Autowired
MessageTemplateService
messageTemplateService
;
@Autowired
EventService
eventService
;
// @Scheduled(cron = "40 * * * * ? ")
public
void
task
(){
Random
random
=
new
Random
();
RoleSum
roleSum
=
new
RoleSum
(
random
.
ints
(
0
,
2
).
findFirst
().
getAsInt
(),
random
.
ints
(
1
,
10
).
findFirst
().
getAsInt
(),
random
.
ints
(
0
,
2
).
findFirst
().
getAsInt
(),
random
.
ints
(
1
,
10
).
findFirst
().
getAsInt
(),
random
.
ints
(
0
,
2
).
findFirst
().
getAsInt
(),
random
.
ints
(
1
,
10
).
findFirst
().
getAsInt
());
messageTemplateService
.
beingPushed
(
"root"
,
"/topic/event"
,
JacksonUtil
.
toJSon
(
roleSum
));
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/WorkShowSeeService.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.status.entity.EsListSum
;
/**
* @author zjm
*/
public
interface
WorkShowSeeService
{
/**
* 根据人员id查看我的任务列表
* @param id
* @param page
* @param size
* @return
*/
EsListSum
selectMeWork
(
String
id
,
int
page
,
int
size
);
/**
* 根据人员id查看我接收的任务列表
* @param id
* @param page
* @param size
* @return
*/
EsListSum
selectMeReceiveWork
(
String
id
,
int
page
,
int
size
);
/**
*根据人员id查看我分解的任务列表
* @param id
* @param page
* @param size
* @return
*/
EsListSum
selectMeResolveWork
(
String
id
,
int
page
,
int
size
);
/**
*根据人员id查看我发布的任务列表
* @param id
* @param page
* @param size
* @return
*/
EsListSum
selectMeReleaseWork
(
String
id
,
int
page
,
int
size
);
/**
* 标题查询
*
* @param id 人员id
* @param page 页码
* @param size 每页显示的条数
* @param title 事件的标题
* @return 给前端对象集合 和条数
*/
EsListSum
titleSelect
(
String
id
,
int
page
,
int
size
,
String
title
);
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/WorkShowService.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
;
import
com.zjty.tynotes.job.basic.entity.database.Work
;
import
java.util.List
;
public
interface
WorkShowService
{
/**
* 任务新增 操作人 最近一次操作 看到人员id work 对象
*/
void
saveTakePushWork
(
String
executorId
,
String
latestNews
,
List
<
String
>
userIds
,
Work
work
);
/**
* 新增分解任务
*/
void
saveTakePushWork1
(
String
executorId
,
String
latestNews
,
List
<
String
>
userIds
,
Work
work
);
void
saveWork
(
String
executorId
,
String
latestNews
,
Work
work
);
void
unpublishedToOngoing
(
String
executorId
,
String
latestNews
,
List
<
String
>
userIds
,
Work
work
);
/**
* 修改任务 操作人 最近一次操作 看到人员id
*/
void
updateWorkStatus
(
String
executorId
,
String
latestNews
,
List
<
String
>
userIds
,
String
status
,
String
workId
);
/**
* 修改任务 常用
* @param executorId 操作人id
* @param latestNews 最近操作
* @param userIds 所有人员集合
* @param workId 任务id
*/
void
upDateWork
(
String
executorId
,
String
latestNews
,
List
<
String
>
userIds
,
String
workId
);
/**
* 查看事件的时候
* @param id 人员id
* @param eventId 事件id
* @param readState 是否阅读过 判读是否阅读过 否修改 阅读状态
*/
void
readsStatus
(
String
id
,
String
eventId
,
int
readState
);
/**
* 人员登入 第一次的数据 接口触发
* @param id 人员id
*/
void
loginFirstOneManualPush
(
String
id
);
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/BusinessTreeManagementImpl.java
浏览文件 @
f388f23d
差异被折叠。
点击展开。
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/EventServiceImpl.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
差异被折叠。
点击展开。
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/InternalServiceImpl.java
0 → 100644
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
job
.
status
.
service
.
impl
;
import
com.zjty.tynotes.job.common.Constants
;
import
com.zjty.tynotes.job.common.exception.WorkAttribution
;
import
com.zjty.tynotes.job.status.entity.Personnel
;
import
com.zjty.tynotes.job.status.entity.RedisPersonalWork
;
import
com.zjty.tynotes.job.status.service.InternalService
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
com.zjty.tynotes.search.subject.service.EsUtil
;
import
com.zjty.tynotes.sms.service.MessageTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
InternalServiceImpl
implements
InternalService
{
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
IUserService
iUserService
;
@Override
public
List
<
Personnel
>
personnels
(
List
<
String
>
list
)
{
List
<
Personnel
>
personnels
=
new
ArrayList
<>();
for
(
String
id:
list
)
{
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
++;
}
}
personnels
.
add
(
new
Personnel
(
id
,
iUserService
.
findUserById
(
id
).
getUsername
(),
count
));
}
return
personnels
;
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/PrivateServiceImpl.java
deleted
100644 → 0
浏览文件 @
27fe4a6b
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.common.constant.WorkStatus
;
import
com.zjty.tynotes.job.status.entity.EsListSum
;
import
com.zjty.tynotes.job.status.entity.EventTitle
;
import
com.zjty.tynotes.job.status.entity.RoleSum
;
import
com.zjty.tynotes.job.status.service.PrivateService
;
import
com.zjty.tynotes.job.status.utils.JacksonUtil
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
com.zjty.tynotes.search.subject.entity.CollectionRs
;
import
com.zjty.tynotes.search.subject.entity.EsSearchArg
;
import
com.zjty.tynotes.search.subject.service.EsUtil
;
import
com.zjty.tynotes.sms.service.MessageTemplateService
;
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
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zjm
*/
@Service
@Slf4j
public
class
PrivateServiceImpl
implements
PrivateService
{
@Autowired
EsUtil
esUtil
;
@Autowired
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
MessageTemplateService
messageTemplateService
;
@Autowired
IUserService
iUserService
;
@Override
public
EsListSum
selectCommission
(
String
id
,
int
page
,
int
size
)
{
CollectionRs
collection
=
esUtil
.
getPresentTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
assert
objectList
!=
null
;
List
<
EventTitle
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
EventTitle:
:
getUpdateTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
// JacksonUtil.readValue(s, new TypeReference<List<EventTitle>>() {
// });
}
@Override
public
EsListSum
selectSubmit
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
CollectionRs
collection
=
esUtil
.
getApplyTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
assert
objectList
!=
null
;
List
<
EventTitle
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
EventTitle:
:
getUpdateTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
}
@Override
public
EsListSum
selectOther
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
CollectionRs
collection
=
esUtil
.
getContactTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
assert
objectList
!=
null
;
List
<
EventTitle
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
EventTitle:
:
getUpdateTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
}
@Override
public
EsListSum
selectCollection
(
String
id
,
int
page
,
int
size
)
{
CollectionRs
collection
=
esUtil
.
getCollection
(
id
,
page
,
size
);
String
s
=
JacksonUtil
.
toJSon
(
collection
.
getSource
());
List
<
EventTitle
>
eventTitles
=
JacksonUtil
.
readValue
(
s
,
new
TypeReference
<
List
<
EventTitle
>>()
{
});
assert
eventTitles
!=
null
;
eventTitles
.
sort
(
Comparator
.
comparing
(
EventTitle:
:
getUpdateTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
eventTitles
);
}
@Override
public
EsListSum
titleSelect
(
String
id
,
int
page
,
int
size
,
String
title
)
{
CollectionRs
collection
=
esUtil
.
getTaskByTitle
(
id
,
title
,
page
,
size
);
String
s
=
JacksonUtil
.
toJSon
(
collection
.
getSource
());
List
<
EventTitle
>
eventTitles
=
JacksonUtil
.
readValue
(
s
,
new
TypeReference
<
List
<
EventTitle
>>()
{
});
assert
eventTitles
!=
null
;
eventTitles
.
sort
(
Comparator
.
comparing
(
EventTitle:
:
getUpdateTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
eventTitles
);
}
@Override
public
void
loginFirstOneManualPush
(
String
id
)
{
log
.
info
(
"redis :{}"
,
Constants
.
REDIS_EVENT
);
List
<
Object
>
list
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
assert
list
!=
null
;
RoleSum
roleSum
=
statisticalRoleCount
(
list
);
String
receive
=
iUserService
.
findUserById
(
id
).
getUsername
();
log
.
info
(
"{}调用了id查询的接口"
,
receive
);
if
(
receive
!=
null
)
{
messageTemplateService
.
beingPushed
(
receive
,
"/topic/note"
,
JacksonUtil
.
toJSon
(
roleSum
));
}
else
{
log
.
info
(
"{}数据库查询不到,请尝试"
,
id
);
}
}
private
List
<
EventTitle
>
redisToEs
(
List
<
Object
>
objectList
,
List
<
Map
<
String
,
Object
>>
esList
){
List
<
EventTitle
>
eventTitles
=
new
ArrayList
<>();
for
(
Object
obj:
objectList
){
EventTitle
eventTitle
=(
EventTitle
)
obj
;
for
(
Map
<
String
,
Object
>
map:
esList
){
if
(
eventTitle
.
getId
().
equals
(
map
.
get
(
"id"
))){
eventTitles
.
add
(
eventTitle
);
}
}
}
return
eventTitles
;
}
private
RoleSum
statisticalRoleCount
(
List
<
Object
>
list
){
int
role1
=
0
,
role2
=
0
,
role3
=
0
;
int
unread1
=
0
,
unread2
=
0
,
unread3
=
0
;
for
(
Object
object:
list
)
{
EventTitle
eventTitle
=
(
EventTitle
)
object
;
switch
(
eventTitle
.
getIdentity
())
{
case
1
:
switch
(
eventTitle
.
getState
()){
case
WorkStatus
.
UNDERWAY
:
if
(
eventTitle
.
getRelease
()==
2
){
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
}
if
(
eventTitle
.
getReadState
()==
1
){
unread1
=
1
;
}
role1
=
role1
+
1
;
break
;
case
WorkStatus
.
COMMITTED
:
if
(
eventTitle
.
getRelease
()==
2
){
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
}
if
(
eventTitle
.
getReadState
()==
1
){
unread2
=
1
;
}
role2
=
role2
+
1
;
break
;
default
:
}
break
;
case
2
:
switch
(
eventTitle
.
getState
()){
case
WorkStatus
.
UNDERWAY
:
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
break
;
case
WorkStatus
.
COMMITTED
:
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
break
;
default
:
}
break
;
case
3
:
switch
(
eventTitle
.
getState
()){
case
WorkStatus
.
UNDERWAY
:
if
(
eventTitle
.
getRelease
()==
1
){
role3
=
role3
+
1
;
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
}
else
{
if
(
eventTitle
.
getReadState
()
==
1
)
{
unread3
=
1
;
}
role3
=
role3
+
1
;
}
break
;
case
WorkStatus
.
COMMITTED
:
if
(
eventTitle
.
getRelease
()==
1
){
role3
=
role3
+
1
;
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
}
if
(
eventTitle
.
getReadState
()==
1
){
unread1
=
1
;
}
role1
=
role1
+
1
;
break
;
default
:
}
break
;
case
4
:
switch
(
eventTitle
.
getState
()){
case
WorkStatus
.
UNDERWAY
:
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
break
;
case
WorkStatus
.
COMMITTED
:
if
(
eventTitle
.
getReadState
()==
1
){
unread3
=
1
;
}
role3
=
role3
+
1
;
break
;
default
:
}
break
;
default
:
}
}
return
new
RoleSum
(
unread1
,
role1
,
unread2
,
role2
,
unread3
,
role3
);
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/WorkShowSeeServiceImpl.java
0 → 100644
浏览文件 @
f388f23d
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
@Slf4j
public
class
WorkShowSeeServiceImpl
implements
WorkShowSeeService
{
@Autowired
EsUtil
esUtil
;
@Autowired
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Override
public
EsListSum
selectMeWork
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
CollectionRs
collection
=
esUtil
.
getMeTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
assert
objectList
!=
null
;
List
<
RedisPersonalWork
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
RedisPersonalWork:
:
getTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
}
@Override
public
EsListSum
selectMeReceiveWork
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
//分解任务中的子任务
List
<
String
>
list
=
new
ArrayList
<>();
//没有子任务的分解任务
List
<
String
>
list1
=
new
ArrayList
<>();
List
<
RedisPersonalWork
>
redisPersonalWorks
=
new
ArrayList
<>();
for
(
Object
object:
objectList
){
RedisPersonalWork
redisPersonalWork
=(
RedisPersonalWork
)
object
;
if
(
redisPersonalWork
.
getSubtaskIds
()!=
null
){
list
.
addAll
(
redisPersonalWork
.
getSubtaskIds
());
}
else
{
list1
.
add
(
redisPersonalWork
.
getWorkId
());
}
}
list1
.
removeAll
(
list
);
for
(
Object
object:
objectList
){
RedisPersonalWork
redisPersonalWork
=(
RedisPersonalWork
)
object
;
for
(
String
ids:
list1
){
if
(
redisPersonalWork
.
getWorkId
().
equals
(
ids
)){
redisPersonalWorks
.
add
(
redisPersonalWork
);
}
}
}
return
new
EsListSum
((
long
)
redisPersonalWorks
.
size
(),
redisPersonalWorks
);
}
@Override
public
EsListSum
selectMeResolveWork
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
CollectionRs
collection
=
esUtil
.
getMeResolveTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
assert
objectList
!=
null
;
List
<
RedisPersonalWork
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
RedisPersonalWork:
:
getTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
}
@Override
public
EsListSum
selectMeReleaseWork
(
String
id
,
int
page
,
int
size
)
{
List
<
Object
>
objectList
=
redisTemplate
.
opsForList
().
range
(
Constants
.
REDIS_EVENT
+
id
,
0
,-
1
);
CollectionRs
collection
=
esUtil
.
getMeReleaseTask
(
id
,
new
EsSearchArg
.
Builder
().
page
(
page
).
size
(
size
).
build
());
assert
objectList
!=
null
;
List
<
RedisPersonalWork
>
list
=
redisToEs
(
objectList
,
collection
.
getSource
());
list
.
sort
(
Comparator
.
comparing
(
RedisPersonalWork:
:
getTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
list
);
}
@Override
public
EsListSum
titleSelect
(
String
id
,
int
page
,
int
size
,
String
title
)
{
CollectionRs
collection
=
esUtil
.
getTaskByTitle
(
id
,
title
,
page
,
size
);
String
s
=
JacksonUtil
.
toJSon
(
collection
.
getSource
());
List
<
RedisPersonalWork
>
eventTitles
=
JacksonUtil
.
readValue
(
s
,
new
TypeReference
<
List
<
RedisPersonalWork
>>()
{
});
assert
eventTitles
!=
null
;
eventTitles
.
sort
(
Comparator
.
comparing
(
RedisPersonalWork:
:
getTime
).
reversed
());
return
new
EsListSum
(
collection
.
getTotal
(),
eventTitles
);
}
private
List
<
RedisPersonalWork
>
redisToEs
(
List
<
Object
>
objectList
,
List
<
Map
<
String
,
Object
>>
esList
){
List
<
RedisPersonalWork
>
eventTitles
=
new
ArrayList
<>();
for
(
Object
obj:
objectList
){
RedisPersonalWork
eventTitle
=(
RedisPersonalWork
)
obj
;
for
(
Map
<
String
,
Object
>
map:
esList
){
if
(
eventTitle
.
getWorkId
().
equals
(
map
.
get
(
"workId"
))){
eventTitles
.
add
(
eventTitle
);
}
}
}
return
eventTitles
;
}
}
notes-job/src/main/java/com/zjty/tynotes/job/status/service/impl/WorkShowServiceImpl.java
0 → 100644
浏览文件 @
f388f23d
差异被折叠。
点击展开。
notes-pas/src/main/java/com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
浏览文件 @
f388f23d
package
com
.
zjty
.
tynotes
.
pas
.
config
.
handler
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.zjty.tynotes.pas.entity.Authority
;
import
com.zjty.tynotes.pas.entity.Menu
;
import
com.zjty.tynotes.pas.entity.Role
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.RoleVo
;
import
com.zjty.tynotes.pas.entity.vo.UserVo
;
import
com.zjty.tynotes.pas.service.IAuthorityService
;
import
com.zjty.tynotes.pas.service.IMenuSerivce
;
import
com.zjty.tynotes.pas.service.IRoleService
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.session.SessionInformation
;
import
org.springframework.security.core.session.SessionRegistry
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.web.authentication.AuthenticationSuccessHandler
;
import
org.springframework.security.web.authentication.session.SessionAuthenticationException
;
import
org.springframework.security.web.session.ConcurrentSessionFilter
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
* @author mcj
*/
@Component
@Slf4j
public
class
MySuccessHandler
implements
AuthenticationSuccessHandler
{
@Autowired
private
SessionRegistry
sessionRegistry
;
@Autowired
private
IAuthorityService
iAuthorityService
;
@Autowired
IRoleService
iRoleService
;
@Autowired
IMenuSerivce
iMenuSerivce
;
private
BCryptPasswordEncoder
bCryptPasswordEncoder
=
new
BCryptPasswordEncoder
();
@Autowired
IUserService
iUserService
;
@Autowired
RedisTemplate
redisTemplate
;
@Override
public
void
onAuthenticationSuccess
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Authentication
authentication
)
throws
IOException
,
ServletException
{
Cookie
[]
cookies
=
httpServletRequest
.
getCookies
();
if
(
cookies
==
null
){
return
;
}
String
value
=
cookies
[
0
].
getValue
();
List
<
Object
>
o
=
sessionRegistry
.
getAllPrincipals
();
User
user
=
(
User
)
authentication
.
getPrincipal
();
for
(
Object
principal
:
o
)
{
User
cacheUser
=
(
User
)
principal
;
if
(
cacheUser
.
getUsername
().
equals
(
user
.
getUsername
()))
{
log
.
info
(
"当前用户已经在线上.现顶替:{}"
,
user
.
getUsername
());
List
<
SessionInformation
>
sessions
=
sessionRegistry
.
getAllSessions
(
cacheUser
,
false
);
for
(
SessionInformation
sessionInformation
:
sessions
)
{
String
sessionId
=
sessionInformation
.
getSessionId
();
sessionInformation
.
expireNow
();
}
}
}
redisTemplate
.
opsForValue
().
set
(
user
.
getUsername
(),
0
);
UserVo
userVo
=
new
UserVo
().
user2userVo
(
user
);
User
username
=
iUserService
.
findUserByUsername
(
userVo
.
getUsername
());
Role
role
=
iRoleService
.
findRoleById
(
user
.
getRoleId
());
RoleVo
roleVo
=
new
RoleVo
();
User
user1
=
iUserService
.
findUserByUsername
(
userVo
.
getUsername
());
userVo
.
setPassword
(
user1
.
getPassword
());
roleVo
.
setRoleId
(
user
.
getRoleId
());
List
<
Menu
>
allByMenuId
=
iMenuSerivce
.
findAllByMenuId
(
role
.
getMenuIds
());
roleVo
.
setMenus
(
allByMenuId
);
roleVo
.
setRoleName
(
role
.
getName
());
userVo
.
setRole
(
roleVo
);
List
<
Authority
>
authorityByIds
=
iAuthorityService
.
findAuthorityByIds
(
role
.
getAuthorityIds
());
roleVo
.
setAuthorities
(
authorityByIds
);
sessionRegistry
.
registerNewSession
(
value
,
authentication
.
getPrincipal
());
httpServletResponse
.
setStatus
(
200
);
httpServletResponse
.
setContentType
(
"application/json; charset=utf-8"
);
httpServletResponse
.
getWriter
().
println
(
new
ObjectMapper
().
writeValueAsString
(
userVo
));
}
}
//package com.zjty.tynotes.pas.config.handler;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.zjty.tynotes.pas.entity.Authority;
//import com.zjty.tynotes.pas.entity.Role;
//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 lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.core.ValueOperations;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContext;
//import org.springframework.security.core.context.SecurityContextHolder;
//import org.springframework.security.core.session.SessionInformation;
//import org.springframework.security.core.session.SessionRegistry;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
//import org.springframework.security.web.authentication.session.SessionAuthenticationException;
//import org.springframework.security.web.session.ConcurrentSessionFilter;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.Cookie;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.List;
//
///**
// * @author mcj
// */
//@Component
//@Slf4j
//public class MySuccessHandler implements AuthenticationSuccessHandler {
// @Autowired
// private SessionRegistry sessionRegistry;
//
// @Autowired
// private IAuthorityService iAuthorityService;
//
// @Autowired
// IRoleService iRoleService;
//
// @Autowired
// IMenuSerivce iMenuSerivce;
//
// private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
//
// @Autowired
// IUserService iUserService;
//
// @Autowired
// RedisTemplate redisTemplate;
//
// @Override
// public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
// Cookie[] cookies = httpServletRequest.getCookies();
// if(cookies==null){
// return;
// }
// String value = cookies[0].getValue();
// List<Object> o = sessionRegistry.getAllPrincipals();
// User user = (User) authentication.getPrincipal();
// for (Object principal : o) {
// User cacheUser = (User) principal;
// if (cacheUser.getUsername().equals(user.getUsername())) {
// log.info("当前用户已经在线上.现顶替:{}",user.getUsername());
// List<SessionInformation> sessions = sessionRegistry.getAllSessions(cacheUser, false);
// for (SessionInformation sessionInformation : sessions) {
// String sessionId = sessionInformation.getSessionId();
//
// sessionInformation.expireNow();
// }
// }
// }
//
// redisTemplate.opsForValue().set(user.getUsername(),0);
//
// UserVo userVo = new UserVo().user2userVo(user);
// User username = iUserService.findUserByUsername(userVo.getUsername());
// Role role = iRoleService.findRoleById(user.getRoleId());
// RoleVo roleVo = new RoleVo();
// User user1 = iUserService.findUserByUsername(userVo.getUsername());
// userVo.setPassword(user1.getPassword());
// roleVo.setRoleId(user.getRoleId());
// List<Menu> allByMenuId = iMenuSerivce.findAllByMenuId(role.getMenuIds());
// roleVo.setMenus(allByMenuId);
// roleVo.setRoleName(role.getName());
// userVo.setRole(roleVo);
// List<Authority> authorityByIds = iAuthorityService.findAuthorityByIds(role.getAuthorityIds());
// roleVo.setAuthorities(authorityByIds);
//
// sessionRegistry.registerNewSession(value, authentication.getPrincipal());
// httpServletResponse.setStatus(200);
// httpServletResponse.setContentType("application/json; charset=utf-8");
// httpServletResponse.getWriter().println(new ObjectMapper().writeValueAsString(userVo));
//
//
// }
//}
notes-search/src/main/java/com/zjty/tynotes/search/subject/service/EsUtil.java
浏览文件 @
f388f23d
...
...
@@ -60,6 +60,23 @@ public interface EsUtil {
*/
CollectionRs
getPresentTask
(
String
id
,
EsSearchArg
esSearchArg
);
/**
* 搜索我的任务列表
*/
CollectionRs
getMeTask
(
String
id
,
EsSearchArg
esSearchArg
);
/**
* 搜索我的接收任务
*/
CollectionRs
getMeReceiveTask
(
String
id
,
EsSearchArg
esSearchArg
);
/**
* 搜索我的分解任务
*/
CollectionRs
getMeResolveTask
(
String
id
,
EsSearchArg
esSearchArg
);
/**
* 搜索我的发布的任务
*/
CollectionRs
getMeReleaseTask
(
String
id
,
EsSearchArg
esSearchArg
);
/**
* 搜索已提交任务的方法
*
...
...
notes-search/src/main/java/com/zjty/tynotes/search/subject/service/impl/EsUtilImpl.java
浏览文件 @
f388f23d
...
...
@@ -191,11 +191,30 @@ public class EsUtilImpl implements EsUtil {
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"executor"
,
id
))
.
must
(
QueryBuilders
.
matchQuery
(
"state"
,
"underway"
)))
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"inspector"
,
id
))
.
must
(
QueryBuilders
.
matchQuery
(
"state"
,
"committed"
))))
.
sort
(
"updateTime"
,
SortOrder
.
DESC
);
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"executor"
,
id
))))
.
sort
(
"time"
,
SortOrder
.
DESC
);
builder
.
size
(
esSearchArg
.
getSize
());
builder
.
from
(
esSearchArg
.
getSize
()
*
esSearchArg
.
getPage
());
searchRequest
.
source
(
builder
);
return
getSearchTotalAndSource
(
client
,
searchRequest
);
}
@Override
public
CollectionRs
getMeTask
(
String
id
,
EsSearchArg
esSearchArg
)
{
RestHighLevelClient
client
=
esConfiguration
.
conn
();
SearchRequest
searchRequest
=
new
SearchRequest
(
ES_PREFIX
+
id
);
searchRequest
.
types
(
"doc"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"workAttribution"
,
1
))))
.
sort
(
"time"
,
SortOrder
.
DESC
);
builder
.
size
(
esSearchArg
.
getSize
());
builder
.
from
(
esSearchArg
.
getSize
()
*
esSearchArg
.
getPage
());
...
...
@@ -203,7 +222,70 @@ public class EsUtilImpl implements EsUtil {
searchRequest
.
source
(
builder
);
return
getSearchTotalAndSource
(
client
,
searchRequest
);
}
@Override
public
CollectionRs
getMeReceiveTask
(
String
id
,
EsSearchArg
esSearchArg
)
{
RestHighLevelClient
client
=
esConfiguration
.
conn
();
SearchRequest
searchRequest
=
new
SearchRequest
(
ES_PREFIX
+
id
);
searchRequest
.
types
(
"doc"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"workAttribution"
,
2
))))
.
sort
(
"time"
,
SortOrder
.
DESC
);
builder
.
size
(
esSearchArg
.
getSize
());
builder
.
from
(
esSearchArg
.
getSize
()
*
esSearchArg
.
getPage
());
searchRequest
.
source
(
builder
);
return
getSearchTotalAndSource
(
client
,
searchRequest
);
}
@Override
public
CollectionRs
getMeResolveTask
(
String
id
,
EsSearchArg
esSearchArg
)
{
RestHighLevelClient
client
=
esConfiguration
.
conn
();
SearchRequest
searchRequest
=
new
SearchRequest
(
ES_PREFIX
+
id
);
searchRequest
.
types
(
"doc"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"workAttribution"
,
3
))))
.
sort
(
"time"
,
SortOrder
.
DESC
);
builder
.
size
(
esSearchArg
.
getSize
());
builder
.
from
(
esSearchArg
.
getSize
()
*
esSearchArg
.
getPage
());
searchRequest
.
source
(
builder
);
return
getSearchTotalAndSource
(
client
,
searchRequest
);
}
@Override
public
CollectionRs
getMeReleaseTask
(
String
id
,
EsSearchArg
esSearchArg
)
{
RestHighLevelClient
client
=
esConfiguration
.
conn
();
SearchRequest
searchRequest
=
new
SearchRequest
(
ES_PREFIX
+
id
);
searchRequest
.
types
(
"doc"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"workAttribution"
,
4
)))
.
mustNot
(
QueryBuilders
.
matchQuery
(
"superiorId"
,
""
)))
.
sort
(
"time"
,
SortOrder
.
DESC
);
builder
.
size
(
esSearchArg
.
getSize
());
builder
.
from
(
esSearchArg
.
getSize
()
*
esSearchArg
.
getPage
());
searchRequest
.
source
(
builder
);
return
getSearchTotalAndSource
(
client
,
searchRequest
);
}
@Override
...
...
@@ -293,7 +375,7 @@ public class EsUtilImpl implements EsUtil {
builder
.
query
(
QueryBuilders
.
boolQuery
()
.
must
(
QueryBuilders
.
matchQuery
(
"title"
,
title
))
.
mustNot
(
QueryBuilders
.
matchQuery
(
"state"
,
"finished"
))
);
);
builder
.
size
(
size
)
.
from
(
size
*
page
)
.
sort
(
"updateTime"
,
SortOrder
.
DESC
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论