增加评论通知实现
This commit is contained in:
parent
4673471145
commit
78081a0374
@ -24,6 +24,7 @@ public enum WorkMsgTypeEnum {
|
||||
SKIP(10, "绩效跳过", "跳过", "# @的绩效\n ## 己经跳过"),
|
||||
TRANSFER(11, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
|
||||
CLEARN(12, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
|
||||
TASK_COMMENT(13, "任务评论", "去查看", "# 任务评论\n ## @1评论了你的@2的任务"),
|
||||
// 您的2020年10月绩效考核已经开始,请尽快制定绩效目标
|
||||
// 吴林的2020年12月绩效考核的目标需要您确认,点击前往确认
|
||||
;
|
||||
|
||||
@ -29,9 +29,15 @@ import com.lz.modules.flow.service.FlowRecordService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.entity.ResultTask;
|
||||
import com.lz.modules.performance.entity.TaskComment;
|
||||
import com.lz.modules.performance.service.ResultTaskService;
|
||||
import com.lz.modules.performance.service.TaskCommentService;
|
||||
import com.lz.modules.sys.dao.SysUserTokenDao;
|
||||
import com.lz.modules.sys.entity.SysUserTokenEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.lz.modules.third.entity.ThirdAppConfig;
|
||||
import com.lz.modules.third.entity.ThirdMsgSendRecord;
|
||||
@ -101,6 +107,15 @@ public class DingtalkBusiness {
|
||||
@Autowired
|
||||
private ThirdMsgSendRecordService thirdMsgSendRecordService;
|
||||
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
|
||||
@Autowired
|
||||
private ResultTaskService resultTaskService;
|
||||
|
||||
@Autowired
|
||||
private TaskCommentService taskCommentService;
|
||||
|
||||
@Resource
|
||||
StaffDao staffDao;
|
||||
|
||||
@ -646,7 +661,50 @@ public class DingtalkBusiness {
|
||||
}
|
||||
|
||||
public String sendTaskNoticeMsg(Long detailId, Long taskId) {
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
|
||||
logger.info("评论通知指标id{}, 任务id{}", detailId, taskId);
|
||||
if(resultDetail != null){
|
||||
TaskComment taskComment = null;
|
||||
if(taskId == null){
|
||||
taskComment = taskCommentService.selectTaskCommentByDetailId(detailId);
|
||||
}else{
|
||||
taskComment = taskCommentService.selectTaskCommentByTaskId(taskId);
|
||||
}
|
||||
StaffSimpleInfo fromStaffSimpleInfo = staffService.selectStaffSimpleInfo(taskComment.getStaffId());
|
||||
StaffSimpleInfo toStaffSimpleInfo = staffService.selectStaffSimpleInfo(resultDetail.getStaffId());
|
||||
|
||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||
if(token != null && token.length() > 0){
|
||||
|
||||
String url = homeUrl;
|
||||
if(url.contains("?")){
|
||||
url += "&halokit=" + System.currentTimeMillis();
|
||||
}else{
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + resultDetail.getRecordId());
|
||||
url = URLEncoder.encode(url);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
return "OK";
|
||||
|
||||
}else{
|
||||
return "token无效";
|
||||
}
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
public String sendNoticeMsg(ResultRecord lzResultRecord, List<StaffEntity> staffs) {
|
||||
|
||||
@ -38,4 +38,8 @@ public interface TaskCommentMapper extends BaseMapper<TaskComment> {
|
||||
int deleteTaskCommensByTaskId(@Param("taskId") Long taskId);
|
||||
|
||||
List<TaskComment> selectByCondition(@Param("page") IPage page, @Param("taskModel") TaskModel taskModel);
|
||||
|
||||
TaskComment selectTaskCommentByTaskId(Long taskId);
|
||||
|
||||
TaskComment selectTaskCommentByDetailId(Long detailId);
|
||||
}
|
||||
@ -31,4 +31,8 @@ public interface TaskCommentService extends IService<TaskComment> {
|
||||
|
||||
|
||||
int deleteTaskCommensByTaskId(Long taskId);
|
||||
|
||||
TaskComment selectTaskCommentByDetailId(Long detailId);
|
||||
|
||||
TaskComment selectTaskCommentByTaskId(Long taskId);
|
||||
}
|
||||
@ -62,6 +62,16 @@ public class TaskCommentServiceImpl extends ServiceImpl<TaskCommentMapper, TaskC
|
||||
public int deleteTaskCommensByTaskId(Long taskId){
|
||||
return taskCommentMapper.deleteTaskCommensByTaskId(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskComment selectTaskCommentByDetailId(Long detailId){
|
||||
return taskCommentMapper.selectTaskCommentByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskComment selectTaskCommentByTaskId(Long taskId){
|
||||
return taskCommentMapper.selectTaskCommentByTaskId(taskId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -111,5 +111,13 @@
|
||||
update lz_task_comment set is_delete = 1 where task_id=#{taskId}
|
||||
</update>
|
||||
|
||||
<select id="selectTaskCommentByTaskId" resultType="TaskComment" >
|
||||
select * from lz_task_comment where task_id=#{taskId} and is_delete = 0 order by id desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectTaskCommentByDetailId" resultType="TaskComment" >
|
||||
select * from lz_task_comment where detail_id=#{detailId} and is_delete = 0 order by id desc limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user