待办任务消息优化

This commit is contained in:
wulin 2020-11-11 15:48:28 +08:00
parent 19bcf786c2
commit b4060718b3
2 changed files with 44 additions and 4 deletions

View File

@ -9,7 +9,7 @@ public enum WorkMsgTypeEnum {
//绩效提交审核的通知自己提交给领导自己提交给人事人事提交给老板
SUBMIT(0, "绩效提交", "去审核", "# 绩效提交\n ## @的绩效已经提交"),
//绩效打回审核的通知
REJECT(1, "绩效驳回", "去修改", "# 绩效驳回\n ## @的绩效已经驳回"),
REJECT(1, "绩效驳回", "去修改", "# 绩效驳回\n ## @的绩效驳回"),
//绩效通过领导审核的通知这一步提交到HR提交的type
LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"),
//绩效通过人事老板审核的最终审核通知

View File

@ -13,10 +13,14 @@ import com.lz.modules.app.service.DepartmentsService;
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.service.FlowRecordService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.sys.dao.SysUserTokenDao;
import com.lz.modules.sys.entity.SysUserTokenEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.lz.modules.third.entity.ThirdAppConfig;
import com.lz.modules.third.service.ThirdAppConfigService;
import org.slf4j.LoggerFactory;
@ -26,6 +30,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@ -63,9 +68,16 @@ public class DingtalkBusiness {
@Autowired
private SysUserTokenDao sysUserTokenDao;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private FlowRecordService flowRecordService;
@Resource
StaffDao staffDao;
@Value("${dingtalk.appid}")
private String appid;
@ -194,10 +206,33 @@ public class DingtalkBusiness {
}
//流程流转发送消息
public String sendWorkMSGWithAsyn(Long resultRecordId , int type) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
if(resultRecord != null){
StaffSimpleInfo fromStaff = staffService.selectStaffSimpleInfo(resultRecord.getStaffId());
List<StaffSimpleInfo> toStaffids;
if(type == WorkMsgTypeEnum.REJECT.getType()){
toStaffids = new ArrayList<>();
toStaffids.add(fromStaff);
sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.REJECT.getType());
}else{
List<FlowRecord> flowRecords =
flowRecordService.selectFlowRecordByRecordIdStatus(resultRecordId, 2);
List<Long> ids = flowRecords.stream().map(new Function<FlowRecord, Long>() {
@Override
public Long apply(FlowRecord flowRecord) {
return flowRecord.getApprovalStaffId();
}
}).collect(Collectors.toList());
toStaffids = staffService.selectStaffSimpleInfos(ids);
sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.PROCESS.getType());
}
return null;
}
return "error";
}
@ -337,7 +372,12 @@ public class DingtalkBusiness {
if(fromStaff == null){
content = workMsgTypeEnum.getContent().replace("@", info.getName());
}else{
content = workMsgTypeEnum.getContent().replace("@", fromStaff.getName());
if(fromStaff.getId() == info.getId()){
content = workMsgTypeEnum.getContent().replace("@", "");
}else{
content = workMsgTypeEnum.getContent().replace("@", fromStaff.getName());
}
}
StaffEntity entity = new StaffEntity();