提交修改
This commit is contained in:
commit
acb28649e5
@ -26,6 +26,7 @@ public enum WorkMsgTypeEnum {
|
||||
CLEARN(12, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
|
||||
TASK_COMMENT(13, "任务评论", "去查看", "# 任务评论\n ## @1评论了你的@2的任务"),
|
||||
TASK_UPDATE(14, "任务更新", "去更新", "# 任务更新\n ## 记得每天来更新任务哦"),
|
||||
TASK_REPLY_COMMENT(15, "任务评论", "去查看", "# 任务评论\n ## @1在@2的任务中@的了你"),
|
||||
// 您的2020年10月绩效考核已经开始,请尽快制定绩效目标
|
||||
// 吴林的2020年12月绩效考核的目标需要您确认,点击前往确认
|
||||
;
|
||||
|
||||
@ -752,6 +752,7 @@ public class ResultRecordController extends AbstractController {
|
||||
@PostMapping("/saveDetail")
|
||||
@ApiOperation("保存绩效详情-吴林")
|
||||
public R saveDetail(@RequestBody @ApiParam ResultRecordDetailDto dto) {
|
||||
Long userId = getUserId();
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
BeanUtils.copyProperties(dto, resultRecord);
|
||||
resultRecord.setAllScore(resultRecord.getLastScore());
|
||||
@ -866,7 +867,7 @@ public class ResultRecordController extends AbstractController {
|
||||
) {
|
||||
if(taskDto.getId() != null && taskDto.getIsDelete() != null && taskDto.getIsDelete().intValue() == 1){
|
||||
//删除
|
||||
resultTaskService.deleteTask(taskDto.getId());
|
||||
resultTaskService.deleteTask(taskDto.getId(),userId);
|
||||
}else{
|
||||
ResultUpdateTaskReq taskReq = new ResultUpdateTaskReq();
|
||||
taskReq.setDetailId(resultDetail.getId());
|
||||
@ -874,7 +875,7 @@ public class ResultRecordController extends AbstractController {
|
||||
taskReq.setName(taskDto.getName());
|
||||
taskReq.setOrderBy(orderBy);
|
||||
taskReq.setProcessRate(BigDecimal.valueOf(taskDto.getProcessRate()));
|
||||
resultTaskService.saveOrUpdateResultTask(taskReq);
|
||||
resultTaskService.saveOrUpdateResultTask(taskReq,userId);
|
||||
orderBy++;
|
||||
}
|
||||
|
||||
@ -1005,9 +1006,9 @@ public class ResultRecordController extends AbstractController {
|
||||
resultComment.setOptDesc("修改了目标");
|
||||
resultComment.setComment(commandValue);
|
||||
}else{
|
||||
resultComment.setOptDesc(resultComment.getOptDesc() + "-修改了目标");
|
||||
resultComment.setOptDesc("修改了目标-" + resultComment.getOptDesc());
|
||||
|
||||
resultComment.setComment((resultComment.getComment() == null ? "" : resultComment.getComment()) + commandValue);
|
||||
resultComment.setComment((resultComment.getComment() == null ? "" : (resultComment.getComment() + "\n")) + commandValue);
|
||||
}
|
||||
resultCommentService.updateResultCommentById(resultComment);//.updateResultCommentCommentById(dto.getCommentId(), commandValue);
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ public class DingtalkBusiness {
|
||||
|
||||
public String sendTaskNoticeMsg(Long detailId, Long taskId) {
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
|
||||
logger.info("评论通知指标id{}, 任务id{}", detailId, taskId);
|
||||
logger.info("评论通知指标id{}, 任务id{}, 指标信息{}", detailId, taskId, resultDetail);
|
||||
if(resultDetail != null){
|
||||
TaskProcessRecord taskProcessRecord = null;
|
||||
if(taskId == null){
|
||||
@ -701,17 +701,13 @@ public class DingtalkBusiness {
|
||||
}else{
|
||||
taskProcessRecord = taskProcessRecordService.selectCommentTaskProcessRecordByTaskId(taskId);
|
||||
}
|
||||
StaffSimpleInfo fromStaffSimpleInfo = staffService.selectStaffSimpleInfo(taskProcessRecord.getStaffId());
|
||||
StaffSimpleInfo toStaffSimpleInfo = staffService.selectStaffSimpleInfo(resultDetail.getStaffId());
|
||||
|
||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||
if(token != null && token.length() > 0){
|
||||
|
||||
if(taskProcessRecord != null) {
|
||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||
String url = homeUrl;
|
||||
if(url.contains("?")){
|
||||
if (url.contains("?")) {
|
||||
url += "&halokit=" + System.currentTimeMillis();
|
||||
}else{
|
||||
} else {
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + resultDetail.getRecordId());
|
||||
@ -721,20 +717,71 @@ public class DingtalkBusiness {
|
||||
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||
"&container_type=work_platform&app_id=0_" +
|
||||
appid + "&redirect_type=jump&redirect_url=" + url;
|
||||
StaffEntity info = new StaffEntity();
|
||||
info.setId(toStaffSimpleInfo.getId());
|
||||
info.setEmployeeId(toStaffSimpleInfo.getEmployeeId());
|
||||
String content = WorkMsgTypeEnum.TASK_COMMENT.getContent().replace("@1", fromStaffSimpleInfo.getName());
|
||||
content = content.replace("@2", "“" + resultDetail.getTarget() + "”");
|
||||
logger.info("通知内容{},url{}", content, url);
|
||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_COMMENT.getTitle(),
|
||||
content, WorkMsgTypeEnum.TASK_COMMENT.getBtnText(), url, token);
|
||||
if (token != null && token.length() > 0) {
|
||||
|
||||
return "OK";
|
||||
StaffSimpleInfo fromStaffSimpleInfo = staffService.selectStaffSimpleInfo(taskProcessRecord.getStaffId());
|
||||
if (taskProcessRecord.getStaffId().longValue() != resultDetail.getId().longValue()) {
|
||||
//自己评论自己的不允许给自己发消息
|
||||
StaffSimpleInfo toStaffSimpleInfo = staffService.selectStaffSimpleInfo(resultDetail.getStaffId());
|
||||
|
||||
StaffEntity info = new StaffEntity();
|
||||
info.setId(toStaffSimpleInfo.getId());
|
||||
info.setEmployeeId(toStaffSimpleInfo.getEmployeeId());
|
||||
String content = WorkMsgTypeEnum.TASK_COMMENT.getContent().replace("@1", fromStaffSimpleInfo.getName());
|
||||
content = content.replace("@2", "“" + resultDetail.getTarget() + "”");
|
||||
logger.info("通知内容{},url{}", content, url);
|
||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_COMMENT.getTitle(),
|
||||
content, WorkMsgTypeEnum.TASK_COMMENT.getBtnText(), url, token);
|
||||
|
||||
}
|
||||
if(taskProcessRecord.getAtStaffIds().length() > 0){
|
||||
//@的人员
|
||||
List<Long> ids = Arrays.stream(taskProcessRecord.getAtStaffIds().split(","))
|
||||
.map(new Function<String, Long>() {
|
||||
@Override
|
||||
public Long apply(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<StaffEntity> staffEntities = staffService.selectByIds(ids);
|
||||
logger.info("评论推送人员个数{}", staffEntities.size());
|
||||
String content = WorkMsgTypeEnum.TASK_REPLY_COMMENT.getContent().replace("@1", fromStaffSimpleInfo.getName());
|
||||
content = content.replace("@2", "“" + resultDetail.getTarget() + "”");
|
||||
logger.info("通知内容{},url{}", content, url);
|
||||
String userIds = "";
|
||||
int m = 0;
|
||||
for (int i = 0; i < staffEntities.size(); i++) {
|
||||
StaffEntity staff = staffEntities.get(i);
|
||||
userIds += (staff.getEmployeeId() + ",");
|
||||
if(m >= 99 || i == staffEntities.size() - 1){
|
||||
//发送消息
|
||||
StaffEntity info = new StaffEntity();
|
||||
info.setId(0L);
|
||||
info.setEmployeeId(userIds);
|
||||
logger.info("推送的人员信息{}", info);
|
||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_REPLY_COMMENT.getTitle(),
|
||||
WorkMsgTypeEnum.TASK_REPLY_COMMENT.getContent(), WorkMsgTypeEnum.TASK_REPLY_COMMENT.getBtnText(), url, token);
|
||||
m = 0;
|
||||
userIds = "";
|
||||
continue;
|
||||
}
|
||||
m++;
|
||||
}
|
||||
/*for (StaffEntity info:staffEntities
|
||||
) {
|
||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_REPLY_COMMENT.getTitle(),
|
||||
content, WorkMsgTypeEnum.TASK_REPLY_COMMENT.getBtnText(), url, token);
|
||||
}*/
|
||||
|
||||
}
|
||||
return "OK";
|
||||
}else {
|
||||
return "token无效";
|
||||
}
|
||||
}else{
|
||||
return "token无效";
|
||||
logger.info("任务不存在");
|
||||
}
|
||||
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
|
||||
CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
|
||||
//如果不存在,则创建
|
||||
if(cronTrigger == null) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
|
||||
//ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
|
||||
}else {
|
||||
ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.lz.modules.performance.req.ResultUpdateTaskReq;
|
||||
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||
import com.lz.modules.performance.service.ResultTaskService;
|
||||
import com.lz.modules.performance.service.TaskProcessRecordService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
@ -26,7 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequestMapping("/performance")
|
||||
@Slf4j
|
||||
@Api(value="绩效任务接口", tags={"绩效任务"})
|
||||
public class ResultTaskController {
|
||||
public class ResultTaskController extends AbstractController{
|
||||
|
||||
@Autowired
|
||||
private ResultTaskService resultTaskService;
|
||||
@ -47,11 +48,8 @@ public class ResultTaskController {
|
||||
@ApiOperation("任务新增或修改")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
|
||||
public R changeTask(@RequestBody ResultUpdateTaskReq req){
|
||||
int i = resultTaskService.saveOrUpdateResultTask(req);
|
||||
if(i>0){
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
Long userId = getUserId();
|
||||
return resultTaskService.saveOrUpdateResultTask(req,userId);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +65,7 @@ public class ResultTaskController {
|
||||
@ApiOperation("任务删除")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
|
||||
public R deleteTask(Long taskId){
|
||||
resultTaskService.deleteTask(taskId);
|
||||
return R.ok();
|
||||
Long userId = getUserId();
|
||||
return resultTaskService.deleteTask(taskId,userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ public interface ResultTaskMapper extends BaseMapper<ResultTask> {
|
||||
|
||||
List<ResultTaskDto> selectResultTaskDtosByDetailId(@Param("detailId") Long detailId);
|
||||
|
||||
List<ResultTaskDto> selectAllResultTaskDtosByDetailId(@Param("detailId") Long detailId);
|
||||
|
||||
List<ResultTask> selectResultTasksByDetailId(@Param("detailId") Long detailId);
|
||||
|
||||
int deleteResultTasksByDetailId(Long detailId);
|
||||
|
||||
@ -35,9 +35,16 @@ public class TaskProcessRecordDto {
|
||||
@ApiModelProperty(value = "类型", name = "描述")
|
||||
private String typeDesc;
|
||||
//操作标签
|
||||
@ApiModelProperty(value = "任务名称", name = "name")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "任务名称", name = "taskName")
|
||||
private String taskName;
|
||||
//1,修改名称,2修改进度 ,3名称和进度都修改
|
||||
@ApiModelProperty(value = "0表示记录,不传全部", name = "useType")
|
||||
private Integer useType;
|
||||
//1,修改名称,2修改进度 ,3名称和进度都修改
|
||||
@ApiModelProperty(value = "职位", name = "position")
|
||||
private String position;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long detailId;
|
||||
}
|
||||
|
||||
@ -6,11 +6,15 @@ package com.lz.modules.performance.enums;
|
||||
* @Date: 2020/12/9 14:08
|
||||
*/
|
||||
public enum ProcessRecordEnum {
|
||||
NAME(1,"更新了名称"),
|
||||
NAME(1,"修改名称"),
|
||||
PROCESS(2,"更新了进度"),
|
||||
ALL(3,"更新了名称和进度"),
|
||||
ADD(4,"增加了任务"),
|
||||
DELETE(5,"删除了任务"),
|
||||
NAME_PROCESS(3,"更新了名称和进度"),
|
||||
REMARK(4,"修改进度说明"),
|
||||
NAME_REMARK(5,"修改了名称和进度说明"),
|
||||
PROCESS_REMARK(6,"修改了进度和进度说明"),
|
||||
ALL(7,"都修改"),
|
||||
ADD(8,"新增"),
|
||||
DELETE(9,"删除"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@ -25,8 +25,8 @@ public class ResultUpdateTaskReq {
|
||||
@ApiModelProperty(value = "任务的当前进度", name = "processRate")
|
||||
private BigDecimal processRate;
|
||||
//更新说明
|
||||
@ApiModelProperty(value = "更新说明", name = "remake")
|
||||
private String remake;
|
||||
@ApiModelProperty(value = "更新说明", name = "remark")
|
||||
private String remark;
|
||||
//排序由小到大
|
||||
@ApiModelProperty(value = "排序由小到大", name = "orderBy")
|
||||
private Integer orderBy;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.lz.modules.performance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||
import com.lz.modules.performance.entity.ResultTask;
|
||||
import com.lz.modules.performance.req.ResultUpdateTaskReq;
|
||||
@ -36,14 +37,14 @@ public interface ResultTaskService extends IService<ResultTask> {
|
||||
|
||||
ResultTaskDetailRes taskDetail(Long detailId);
|
||||
|
||||
int saveOrUpdateResultTask(ResultUpdateTaskReq req);
|
||||
R saveOrUpdateResultTask(ResultUpdateTaskReq req, Long userId);
|
||||
|
||||
|
||||
|
||||
int deleteResultTasksByDetailId(Long detailId);
|
||||
List<ResultTask> selectResultTasksByDetailId(Long detailId);
|
||||
|
||||
void deleteTask(Long taskId);
|
||||
R deleteTask(Long taskId,Long userId);
|
||||
|
||||
List<ResultTaskDto> selectResultTaskDtosByDetailId(Long detailId);
|
||||
}
|
||||
@ -2,6 +2,8 @@ package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.performance.dao.ResultTaskMapper;
|
||||
@ -19,6 +21,7 @@ import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -122,27 +125,40 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveOrUpdateResultTask(ResultUpdateTaskReq req) {
|
||||
public R saveOrUpdateResultTask(ResultUpdateTaskReq req, Long userId) {
|
||||
Long tasklId = req.getTaskId();
|
||||
Long detailId = req.getDetailId();
|
||||
if(tasklId == null && detailId == null){
|
||||
log.error("任务保存或更新失败:tasklId, detailId都为空");
|
||||
return -1;
|
||||
return R.error();
|
||||
}
|
||||
ResultTask resultTask;
|
||||
if(tasklId == null){
|
||||
log.info("绩效任务新增操作。。。");
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(req.getDetailId());
|
||||
if(!userId.equals(resultDetail.getStaffId())){
|
||||
log.info("非本人任务不能添加");
|
||||
return R.error("非本人任务不能添加");
|
||||
}
|
||||
resultTask = new ResultTask();
|
||||
BeanUtils.copyProperties(req,resultTask);
|
||||
resultTask.setDetailId(detailId);
|
||||
resultTaskMapper.insertResultTask(resultTask);
|
||||
int i = changeTaskProcess(null, req);
|
||||
//将插入的id传递过去
|
||||
req.setTaskId(resultTask.getId());
|
||||
changeTaskProcess(null, req,null);
|
||||
}
|
||||
else {
|
||||
|
||||
log.info("绩效任务修改操作。。。");
|
||||
resultTask = resultTaskMapper.selectResultTaskById(tasklId);
|
||||
int i = changeTaskProcess(resultTask, req);
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId());
|
||||
if(!userId.equals(resultDetail.getStaffId())){
|
||||
log.info("非本人任务不能修改");
|
||||
return R.error("非本人任务不能修改");
|
||||
}
|
||||
TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(tasklId);
|
||||
int i = changeTaskProcess(resultTask, req,taskProcessRecordDto);
|
||||
if(i<1){
|
||||
log.info("任务暂无变化,不做修改");
|
||||
}
|
||||
@ -158,7 +174,8 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
}
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
|
||||
resultDetail.setProcessRate(BigDecimal.valueOf(caclateResultDetailProcess(detailId)));
|
||||
return resultDetailService.updateResultDetailById(resultDetail);
|
||||
resultDetailService.updateResultDetailById(resultDetail);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
@ -180,38 +197,68 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
}
|
||||
|
||||
//记录变更记录
|
||||
private int changeTaskProcess(ResultTask before,ResultUpdateTaskReq after){
|
||||
private int changeTaskProcess(ResultTask beforeResultTask,ResultUpdateTaskReq req,TaskProcessRecordDto beforeTaskProcessRecord){
|
||||
TaskProcessRecord taskProcessRecord = new TaskProcessRecord();
|
||||
BeanUtils.copyProperties(after,taskProcessRecord);
|
||||
BeanUtils.copyProperties(req,taskProcessRecord);
|
||||
//新增操作
|
||||
if(before == null){
|
||||
if(beforeResultTask == null){
|
||||
taskProcessRecord.setType(ProcessRecordEnum.ADD.getType());
|
||||
taskProcessRecord.setDetailId(after.getDetailId());
|
||||
taskProcessRecord.setLabel("新增key Results名称:" + after.getName() + "进度:" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
taskProcessRecord.setLabel("新增key Results名称:" + req.getName() + ";进度:" + BigDecimalUtil.mul(req.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
|
||||
}
|
||||
taskProcessRecord.setTaskId(before.getId());
|
||||
taskProcessRecord.setDetailId(before.getDetailId());
|
||||
//判断修改了名称或进度
|
||||
if(!before.getName().equals(after.getName())){
|
||||
if(!before.getProcessRate().equals(after.getProcessRate())){
|
||||
int i = 0;
|
||||
String lebel = "key Results名称:" + beforeResultTask.getName();
|
||||
if(!beforeResultTask.getName().equals(req.getName())) {
|
||||
i|= (0x00000001<<0);
|
||||
lebel = lebel + " 改为 " + req.getName() + "\n";
|
||||
}
|
||||
if(BigDecimalUtil.compareTo(beforeResultTask.getProcessRate(),req.getProcessRate())!=0){
|
||||
i|= (0x00000001<<1);
|
||||
lebel = lebel + "将进度:" +BigDecimalUtil.mul(beforeResultTask.getProcessRate(),BigDecimal.valueOf(100)).setScale(2)+ "%" + " 更新为 " + BigDecimalUtil.mul(req.getProcessRate(),BigDecimal.valueOf(100)).setScale(2)+ "%";
|
||||
}
|
||||
|
||||
String remark = StringUtil.EMPTY;
|
||||
|
||||
if(req.getRemark() != null){
|
||||
if(beforeTaskProcessRecord != null){
|
||||
remark = beforeTaskProcessRecord.getRemark();
|
||||
}
|
||||
if(beforeTaskProcessRecord == null ||(!req.getRemark().equals(beforeTaskProcessRecord.getRemark()))){
|
||||
i|= (0x00000001<<2);
|
||||
lebel = lebel + "将进度说明更新为: " + req.getRemark();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(i==0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
taskProcessRecord.setTaskId(beforeResultTask.getId());
|
||||
taskProcessRecord.setDetailId(beforeResultTask.getDetailId());
|
||||
taskProcessRecord.setType(i);
|
||||
taskProcessRecord.setLabel(lebel);
|
||||
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
|
||||
/*if(!beforeResultTask.getName().equals(req.getName())){
|
||||
if(BigDecimalUtil.compareTo(beforeResultTask.getProcessRate(),req.getProcessRate())!=0){
|
||||
taskProcessRecord.setType(ProcessRecordEnum.ALL.getType());
|
||||
taskProcessRecord.setLabel("将key Results名称:" + before.getName() + "改为" + after.getName() + "\n"
|
||||
+ "进度:" + BigDecimalUtil.mul(before.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "改为" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
taskProcessRecord.setLabel("将key Results名称:" + beforeResultTask.getName() + "改为" + req.getName() + "\n"
|
||||
+ "进度:" + BigDecimalUtil.mul(beforeResultTask.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "改为" + BigDecimalUtil.mul(req.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
|
||||
}
|
||||
|
||||
taskProcessRecord.setType(ProcessRecordEnum.NAME.getType());
|
||||
taskProcessRecord.setLabel("将key Results名称:" + before.getName() + "改为" + after.getName());
|
||||
taskProcessRecord.setLabel("将key Results名称:" + beforeResultTask.getName() + "改为" + req.getName());
|
||||
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
|
||||
|
||||
}
|
||||
if(!before.getProcessRate().equals(after.getProcessRate())){
|
||||
if(BigDecimalUtil.compareTo(beforeResultTask.getProcessRate(),req.getProcessRate())!=0){
|
||||
taskProcessRecord.setType(ProcessRecordEnum.PROCESS.getType());
|
||||
taskProcessRecord.setLabel("将" +before.getName() + "得进度由" + BigDecimalUtil.mul(before.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "更新为:" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
taskProcessRecord.setLabel("将" +beforeResultTask.getName() + "得进度由" + BigDecimalUtil.mul(beforeResultTask.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "更新为:" + BigDecimalUtil.mul(req.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
|
||||
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
|
||||
}
|
||||
return -1;
|
||||
return -1;*/
|
||||
}
|
||||
|
||||
|
||||
@ -232,8 +279,13 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTask(Long taskId) {
|
||||
public R deleteTask(Long taskId,Long userId) {
|
||||
ResultTask resultTask = resultTaskMapper.selectResultTaskById(taskId);
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId());
|
||||
if(!userId.equals(resultDetail.getStaffId())){
|
||||
log.info("非本人任务不能删除");
|
||||
return R.error("非本人任务不能删除");
|
||||
}
|
||||
resultTaskMapper.deleteResultTaskById(taskId);
|
||||
TaskProcessRecord taskProcessRecord = new TaskProcessRecord();
|
||||
taskProcessRecord.setTaskId(taskId);
|
||||
@ -241,13 +293,14 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
taskProcessRecord.setLabel("将" +resultTask.getName() + "任务删除");
|
||||
taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord);
|
||||
//修改总进度
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId());
|
||||
resultDetail.setProcessRate(BigDecimal.valueOf(caclateResultDetailProcess(resultTask.getDetailId())));
|
||||
resultDetailService.updateResultDetailById(resultDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultTaskDto> selectResultTaskDtosByDetailId(Long detailId){
|
||||
return resultTaskMapper.selectResultTaskDtosByDetailId(detailId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.app.model.TaskModel;
|
||||
import com.lz.modules.app.service.StaffOccupationService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.performance.dao.ResultTaskMapper;
|
||||
import com.lz.modules.performance.dao.TaskProcessRecordMapper;
|
||||
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||
import com.lz.modules.performance.dto.TaskProcessRecordDto;
|
||||
@ -53,6 +56,10 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
@Autowired
|
||||
private StaffOccupationService staffOccupationService;
|
||||
@Autowired
|
||||
private ResultTaskMapper resultTaskMapper;
|
||||
|
||||
|
||||
|
||||
@ -95,7 +102,7 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
|
||||
Long detailId = req.getDetailId();
|
||||
PageUtils pageUtils = new PageUtils();
|
||||
if(detailId!=null){
|
||||
List<ResultTaskDto> resultTaskDtos = resultTaskService.selectResultTaskDtosByDetailId(req.getDetailId());
|
||||
List<ResultTaskDto> resultTaskDtos = resultTaskMapper.selectAllResultTaskDtosByDetailId(detailId);
|
||||
if(CollectionUtils.isNotEmpty(resultTaskDtos)){
|
||||
List<Long> collect = resultTaskDtos.stream().map(resultTaskDto -> resultTaskDto.getId()).collect(Collectors.toList());
|
||||
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
@ -106,26 +113,32 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
|
||||
}
|
||||
else {
|
||||
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, req.getTaskId(),req.getUseType())
|
||||
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, taskId,req.getUseType())
|
||||
);
|
||||
}
|
||||
|
||||
List list = pageUtils.getList();
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
|
||||
List<TaskProcessRecordDto> dtos = list;
|
||||
if(detailId == null){
|
||||
ResultTask resultTask = resultTaskService.selectResultTaskById(taskId);
|
||||
detailId = resultTask.getDetailId();
|
||||
detailId = dtos.get(0).getDetailId();
|
||||
}
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultDetail.getStaffId());
|
||||
List<TaskProcessRecordDto> dtos = list;
|
||||
StaffOccupationEntity staffOccupationByStaffId = staffOccupationService.getStaffOccupationByStaffId(resultDetail.getStaffId());
|
||||
|
||||
|
||||
for(TaskProcessRecordDto dto:dtos){
|
||||
dto.setTypeDesc(ProcessRecordEnum.findByType(dto.getType()).getDesc());
|
||||
ResultTask resultTask = resultTaskService.selectResultTaskById(dto.getTaskId());
|
||||
Optional.ofNullable(resultTask).ifPresent(resultTask1 -> dto.setTaskName(resultTask1.getName()));
|
||||
if(dto.getUseType()==0){
|
||||
dto.setTypeDesc(ProcessRecordEnum.findByType(dto.getType()).getDesc());
|
||||
}
|
||||
Optional.ofNullable(staffEntity).ifPresent(staffEntity1 -> {
|
||||
dto.setAvatar(staffEntity1.getAvatar());
|
||||
dto.setStaffName(staffEntity1.getName());
|
||||
});
|
||||
Optional.ofNullable(staffOccupationByStaffId).ifPresent(staffOccupationEntity -> dto.setPosition(staffOccupationEntity.getPosition()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -95,5 +95,9 @@
|
||||
<select id="selectResultTaskDtosByDetailId" resultType="com.lz.modules.performance.dto.ResultTaskDto" >
|
||||
select id, is_delete, name,process_rate from lz_result_task where detail_id=#{detailId} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectAllResultTaskDtosByDetailId" resultType="com.lz.modules.performance.dto.ResultTaskDto" >
|
||||
select id, is_delete, name,process_rate from lz_result_task where detail_id=#{detailId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@
|
||||
|
||||
|
||||
<select id="selectTaskProcessRecordsByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
|
||||
select gmt_create,remark,label,type,name,use_type from lz_task_process_record where task_id=#{taskId}
|
||||
select gmt_create,remark,label,type,name,use_type,detail_id,task_id from lz_task_process_record where task_id=#{taskId}
|
||||
<if test="useType !=null">
|
||||
and use_type = #{useType}
|
||||
</if>
|
||||
@ -149,7 +149,7 @@
|
||||
|
||||
|
||||
<select id="selectTaskProcessRecordsByTaskIdsAndType" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
|
||||
select gmt_create,remark,label,type from lz_task_process_record where is_delete = 0
|
||||
select gmt_create,remark,label,type,use_type,task_id,detail_id from lz_task_process_record where is_delete = 0
|
||||
<if test="useType !=null">
|
||||
and use_type = #{useType}
|
||||
</if>
|
||||
@ -165,8 +165,6 @@
|
||||
select * from lz_task_process_record where is_delete = 0 and (detail_id = #{taskModel.detailId} or task_id=#{taskModel.taskId} ) and use_type=#{taskModel.useType} order by id desc
|
||||
</select>
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<select id="selectCommentTaskProcessRecordByDetailId" resultType="TaskProcessRecord" >
|
||||
select * from lz_task_process_record where detail_id=#{detailId} and is_delete = 0 and use_type=1 order by id desc limit 1
|
||||
</select>
|
||||
@ -175,6 +173,5 @@
|
||||
select * from lz_task_process_record where task_id=#{taskId} and is_delete = 0 and use_type=1 order by id desc limit 1
|
||||
</select>
|
||||
|
||||
>>>>>>> 0759c9bb2ac2d85becab14db3150110f2bf20e63
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ public class MysqlMain {
|
||||
|
||||
|
||||
|
||||
|
||||
String path = ResourceUtils.getURL("classpath:").getPath();
|
||||
System.out.println(path);
|
||||
String dir = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user