diff --git a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java index 7d8f2b6f..625d6c41 100644 --- a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java +++ b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java @@ -9,7 +9,7 @@ public enum WorkMsgTypeEnum { //绩效提交审核的通知(自己提交给领导,自己提交给人事,人事提交给老板) SUBMIT(0, "绩效提交", "去审核", "# 绩效提交\n ## @的绩效已经提交"), //绩效打回审核的通知 - REJECT(1, "绩效驳回", "去修改", "# 绩效驳回\n ## @的绩效已经驳回"), + REJECT(1, "绩效驳回", "去修改", "# 绩效驳回\n ## @的绩效被驳回"), //绩效通过领导审核的通知,这一步提交到HR,提交的type LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"), //绩效通过人事,老板审核的最终审核通知 diff --git a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java index 7163f141..593d8ae1 100644 --- a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java +++ b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java @@ -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 toStaffids; + if(type == WorkMsgTypeEnum.REJECT.getType()){ + toStaffids = new ArrayList<>(); + toStaffids.add(fromStaff); + sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.REJECT.getType()); + }else{ + List flowRecords = + flowRecordService.selectFlowRecordByRecordIdStatus(resultRecordId, 2); + List ids = flowRecords.stream().map(new Function() { + @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();