优化待办通知
This commit is contained in:
parent
a63a28262c
commit
9321fafdaa
@ -16,9 +16,10 @@ public enum WorkMsgTypeEnum {
|
||||
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
|
||||
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"),
|
||||
END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"),
|
||||
START_WORK(6, "绩效考评待办事项", "去查看", "\n 绩效目标制定\n \n @,你的绩效需要制定目标"),
|
||||
START_SCORE(7, "绩效考评待办事项", "去查看", "\n 绩效结果输入\n \n @,你的绩效需要输入结果"),
|
||||
PROCESS(8, "绩效考评待办事项", "去查看", "\n @的绩效\n \n 需您去处理"),
|
||||
START_WORK(6, "绩效考评待办事项", "制定目标", "\n 绩效目标制定\n \n @,你的绩效需要制定目标"),
|
||||
START_SCORE(7, "绩效考评待办事项", "输入结果", "\n 绩效结果输入\n \n @,你的绩效需要输入结果"),
|
||||
PROCESS(8, "绩效考评待办事项", "目标确认", "\n @的绩效\n \n 需您去目标确认"),
|
||||
SCORE(8, "绩效考评待办事项", "评分", "\n @的绩效\n \n 需您去评分"),
|
||||
// 您的2020年10月绩效考核已经开始,请尽快制定绩效目标
|
||||
// 吴林的2020年12月绩效考核的目标需要您确认,点击前往确认
|
||||
;
|
||||
|
||||
@ -319,17 +319,19 @@ public class DingTalkUtil {
|
||||
return msg;
|
||||
}
|
||||
//发送待办任务
|
||||
public String sendSingleWorkMSG(String appid, StaffEntity staff, String title, String marDown,
|
||||
String singleTitle, String singleUrl, String token) {
|
||||
public String sendSingleWorkMSG(String appid, StaffEntity staff, String title, String title1,
|
||||
String content1, String title2,
|
||||
String content2, String title3,
|
||||
String content3, String singleUrl, String token, String from) {
|
||||
String msg = "OK";
|
||||
|
||||
ThirdMsgSendRecord thirdMsgSendRecord = new ThirdMsgSendRecord();
|
||||
thirdMsgSendRecord.setMsgType("work_msg");
|
||||
thirdMsgSendRecord.setStaffId(staff.getId());
|
||||
thirdMsgSendRecord.setMsgTitle(singleTitle);
|
||||
thirdMsgSendRecord.setMsgTitle(title1 + "#" + title2 + "#" + title3);
|
||||
thirdMsgSendRecord.setAppId(appid);
|
||||
thirdMsgSendRecord.setHeadText(title);
|
||||
thirdMsgSendRecord.setMsgContent(marDown);
|
||||
thirdMsgSendRecord.setMsgContent(content1 + "#" + content2 + "#" + content3);
|
||||
thirdMsgSendRecord.setMsgUrl(singleUrl);
|
||||
thirdMsgSendRecord.setStatus(0);
|
||||
try{
|
||||
@ -339,15 +341,20 @@ public class DingTalkUtil {
|
||||
req.setCreateTime(System.currentTimeMillis());
|
||||
req.setTitle(title);
|
||||
req.setUrl(singleUrl);
|
||||
req.setSourceName(from);
|
||||
List<OapiWorkrecordAddRequest.FormItemVo> list2 = new ArrayList<OapiWorkrecordAddRequest.FormItemVo>();
|
||||
OapiWorkrecordAddRequest.FormItemVo obj3 = new OapiWorkrecordAddRequest.FormItemVo();
|
||||
list2.add(obj3);
|
||||
obj3.setTitle(title);
|
||||
obj3.setContent(marDown);
|
||||
obj3.setTitle(title1);
|
||||
obj3.setContent(content1);
|
||||
obj3 = new OapiWorkrecordAddRequest.FormItemVo();
|
||||
list2.add(obj3);
|
||||
obj3.setTitle(marDown);
|
||||
obj3.setContent("123");
|
||||
obj3.setTitle(title2);
|
||||
obj3.setContent(content2);
|
||||
obj3 = new OapiWorkrecordAddRequest.FormItemVo();
|
||||
list2.add(obj3);
|
||||
obj3.setTitle(title3);
|
||||
obj3.setContent(content3);
|
||||
req.setFormItemList(list2);
|
||||
OapiWorkrecordAddResponse rsp = client.execute(req, token);
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.lz.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -46,10 +48,10 @@ public class StaffSimpleInfo implements Serializable {
|
||||
private String employeeId;
|
||||
//头像
|
||||
private String avatar;
|
||||
//本次发起任务的id
|
||||
private Long startId;
|
||||
//本次发起绩效的id
|
||||
private Long recordId;
|
||||
//本次发起任务的
|
||||
private ResultRecord resultRecord;
|
||||
//本次发起的任务信息
|
||||
private FlowStart flowStart;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -456,7 +456,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
staffInfo.setStartId(flowStart.getId());
|
||||
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||
@ -491,8 +491,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//resultRecordService.initFlowRecord(resultRecord.getId());
|
||||
|
||||
//下面生成实际的考核流程
|
||||
staffInfo.setRecordId(resultRecord.getId());
|
||||
|
||||
staffInfo.setResultRecord(resultRecord);
|
||||
staffInfo.setFlowStart(flowStart);
|
||||
for (ResultModelDto modelDto:resultModelDtos
|
||||
) {
|
||||
|
||||
@ -655,7 +655,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
staffInfo.setStartId(flowStart.getId());
|
||||
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
@ -765,7 +764,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
|
||||
//startStartDto.getResultRecordList().add(resultRecord);
|
||||
staffInfo.setRecordId(resultRecord.getId());
|
||||
staffInfo.setResultRecord(resultRecord);
|
||||
staffInfo.setFlowStart(flowStart);
|
||||
//下面生成实际的考核流程
|
||||
|
||||
/*ExecutorService executor = Executors.newFixedThreadPool(10);
|
||||
|
||||
@ -14,7 +14,9 @@ import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffOccupationService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.FlowRecord;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
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.sys.dao.SysUserTokenDao;
|
||||
@ -74,6 +76,9 @@ public class DingtalkBusiness {
|
||||
@Autowired
|
||||
private FlowRecordService flowRecordService;
|
||||
|
||||
@Autowired
|
||||
private FlowStartService flowStartService;
|
||||
|
||||
@Resource
|
||||
StaffDao staffDao;
|
||||
|
||||
@ -212,9 +217,10 @@ public class DingtalkBusiness {
|
||||
public String sendWorkMSGWithAsyn(Long resultRecordId , int type) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
if(resultRecord != null){
|
||||
FlowStart flowStart = flowStartService.selectFlowStartById(resultRecord.getStartId());
|
||||
StaffSimpleInfo fromStaff = staffService.selectStaffSimpleInfo(resultRecord.getStaffId());
|
||||
fromStaff.setRecordId(resultRecord.getId());
|
||||
fromStaff.setStartId(resultRecord.getStartId());
|
||||
fromStaff.setResultRecord(resultRecord);
|
||||
fromStaff.setFlowStart(flowStart);
|
||||
List<StaffSimpleInfo> toStaffids;
|
||||
if(type == WorkMsgTypeEnum.REJECT.getType()){//被拒
|
||||
toStaffids = new ArrayList<>();
|
||||
@ -232,8 +238,8 @@ public class DingtalkBusiness {
|
||||
toStaffids = staffService.selectStaffSimpleInfos(ids);
|
||||
for (StaffSimpleInfo simpleInfo:toStaffids
|
||||
) {
|
||||
simpleInfo.setRecordId(resultRecord.getId());
|
||||
simpleInfo.setStartId(resultRecord.getStartId());
|
||||
simpleInfo.setResultRecord(resultRecord);
|
||||
simpleInfo.setFlowStart(flowStart);
|
||||
}
|
||||
sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.PROCESS.getType());
|
||||
}
|
||||
@ -374,30 +380,62 @@ public class DingtalkBusiness {
|
||||
}else{
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + info.getRecordId());
|
||||
url += ("&detail=1&id=" + info.getResultRecord().getId());
|
||||
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;
|
||||
String content = null;
|
||||
if(fromStaff == null){
|
||||
content = workMsgTypeEnum.getContent().replace("@", info.getName());
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_WORK.getType()){
|
||||
//发送制定目标通知
|
||||
StaffEntity entity = new StaffEntity();
|
||||
entity.setId(info.getId());
|
||||
entity.setEmployeeId(info.getEmployeeId());
|
||||
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
|
||||
"任务内容", "目标制定",
|
||||
"考核名称", info.getFlowStart().getName(),
|
||||
"被考核人", info.getResultRecord().getStaffName(),
|
||||
url, token, "霖梓控股");
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_SCORE.getType()){
|
||||
//发送开始评分通知
|
||||
StaffEntity entity = new StaffEntity();
|
||||
entity.setId(info.getId());
|
||||
entity.setEmployeeId(info.getEmployeeId());
|
||||
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
|
||||
"任务内容", "结果录入",
|
||||
"考核名称", info.getFlowStart().getName(),
|
||||
"被考核人", info.getResultRecord().getStaffName(),
|
||||
url, token, "霖梓控股");
|
||||
}else{
|
||||
if(fromStaff.getId() == info.getId()){
|
||||
content = workMsgTypeEnum.getContent().replace("@", "您");
|
||||
//流程流转通知
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
|
||||
if(flowRecords.size() == 0){
|
||||
//任务结束
|
||||
}else{
|
||||
content = workMsgTypeEnum.getContent().replace("@", fromStaff.getName());
|
||||
}
|
||||
List<Long> ids = flowRecords.stream().map(new Function<FlowRecord, Long>() {
|
||||
@Override
|
||||
public Long apply(FlowRecord flowRecord) {
|
||||
return flowRecord.getApprovalStaffId();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
|
||||
for (StaffSimpleInfo staffSimpleInfo:staffSimpleInfos
|
||||
) {
|
||||
StaffEntity entity = new StaffEntity();
|
||||
entity.setId(staffSimpleInfo.getId());
|
||||
entity.setEmployeeId(staffSimpleInfo.getEmployeeId());
|
||||
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
|
||||
"任务内容", flowRecords.get(0).getFlowName(),
|
||||
"考核名称", info.getFlowStart().getName(),
|
||||
"被考核人", info.getResultRecord().getStaffName(),
|
||||
url, token, "霖梓控股");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
StaffEntity entity = new StaffEntity();
|
||||
entity.setId(info.getId());
|
||||
entity.setEmployeeId(info.getEmployeeId());
|
||||
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
|
||||
content, workMsgTypeEnum.getBtnText(), url, token);
|
||||
|
||||
}else{
|
||||
logger.info("ThreadSendMessage token无效"); ;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user