diff --git a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java index 3d9806fa..0f94627a 100644 --- a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java +++ b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java @@ -14,7 +14,7 @@ public enum WorkMsgTypeEnum { LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"), //绩效通过人事,老板审核的最终审核通知 PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"), - URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"), + URGING(4, "绩效催办", "去处理", "# 绩效催办\n ## @的绩效需您处理"), END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"), START_WORK(6, "绩效考评待办事项", "去查看", "# 绩效目标制定\n ## @,你的绩效需要制定目标"), START_SCORE(7, "绩效考评待办事项", "去查看", "# 绩效结果输入\n ## @,你的绩效需要输入结果"), diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 01d8012a..1471fcc5 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -20,6 +20,7 @@ import com.lz.modules.flow.entity.*; import com.lz.modules.flow.model.*; import com.lz.modules.flow.req.ResultDetailReq; import com.lz.modules.flow.service.*; +import com.lz.modules.job.business.DingtalkBusiness; import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.app.ResultComment; @@ -105,6 +106,9 @@ public class ResultRecordController extends AbstractController { @Autowired private FlowChartDetailRecordService flowChartDetailRecordService; + @Autowired + private DingtalkBusiness dingtalkBusiness; + /** * 列表 */ @@ -331,6 +335,31 @@ public class ResultRecordController extends AbstractController { return R.ok().put("lzResultRecord", lzResultRecord); } + /** + * 信息 + */ + @GetMapping("/urging") + @ApiOperation("绩效催办-吴林") + @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "绩效id")}) + @ApiResponses({@ApiResponse(code = 200, message = "成功", response = R.class)}) + public R getDetail(@RequestParam Long id) { + ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id); + //获取当前节点,谁在处理 + List flowRecords = flowRecordService.selectFlowRecordsByRecordIdAndStatus(id, 2); + if(flowRecords.size() > 0){ + List ids = flowRecords.stream().map(new Function() { + @Override + public Long apply(FlowRecord flowRecord) { + return flowRecord.getApprovalStaffId(); + } + }).collect(Collectors.toList()); + List staffs = staffService.selectNamesByIds(ids); + dingtalkBusiness.sendNoticeMsg(lzResultRecord, staffs); + return R.ok("催办成功"); + } + return R.error("无可催办人员"); + } + /** * 信息 */ diff --git a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java index d417c7c5..fff7c877 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java @@ -90,5 +90,7 @@ public interface FlowRecordMapper extends BaseMapper { List selectSkipFlowRecordsById(@Param("recordId") Long recordId); - List selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status); + List selectFirstFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status); + + List selectFlowRecordsByRecordIdAndStatus(@Param("recordId") Long recordId, @Param("status") int status); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java index 99c44187..4503002a 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java @@ -86,4 +86,6 @@ public interface FlowRecordService extends IService { List selectSkipFlowRecordsById(Long recordId); List selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status); + + List selectFlowRecordsByRecordIdAndStatus(Long recordId, int status); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java index 412a65e5..5a19246b 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java @@ -231,4 +231,9 @@ public class FlowRecordServiceImpl extends ServiceImpl selectFlowRecordsByRecordIdAndStatus(Long recordId, int status){ + return flowRecordMapper.selectFlowRecordsByRecordIdAndStatus(recordId, status); + } + } diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 727a3f44..e15a8364 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -2,22 +2,13 @@ package com.lz.modules.flow.service.impl; import ch.qos.logback.classic.Logger; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.google.common.collect.Lists; import com.lz.common.emun.ChartOptType; import com.lz.common.emun.CheckStaffType; import com.lz.common.emun.WorkMsgTypeEnum; import com.lz.common.utils.R; -import com.lz.common.utils.StringUtil; -import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.entity.StaffSimpleInfo; -import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums; -import com.lz.modules.app.enums.FlowRecordStatusEnums; -import com.lz.modules.app.enums.RoleEnums; -import com.lz.modules.app.service.DepartmentsService; -import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; -import com.lz.modules.flow.dao.EvaluationStartStaffMapper; import com.lz.modules.flow.dao.FlowStartMapper; import com.lz.modules.flow.entity.*; import com.lz.modules.flow.model.*; @@ -28,22 +19,15 @@ 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 lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.map.HashedMap; -import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.interceptor.TransactionAspectSupport; -import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.function.Function; import java.util.stream.Collectors; @@ -839,12 +823,12 @@ public class FlowStartServiceImpl extends ServiceImpl resultRecords; + List resultStarts; List noticeStaff; public ThreadInitFlowRecord(List resultRecords, List noticeStaff){ - this.resultRecords = resultRecords; + this.resultStarts = resultRecords; this.noticeStaff = noticeStaff; } @@ -853,12 +837,14 @@ public class FlowStartServiceImpl extends ServiceImpl staffs) { + + 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=" + lzResultRecord.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; + logger.info("推送消息个数{}", staffs.size()); + for (StaffEntity info: + staffs) { + logger.info("发送消息给{},url:{}", info, url); + String content = null; + if(!lzResultRecord.getStaffName().equals(info.getName())){ + content = WorkMsgTypeEnum.URGING.getContent().replace("@", lzResultRecord.getStaffName()); + }else{ + content = WorkMsgTypeEnum.URGING.getContent().replace("@", "您"); + } + + dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.URGING.getTitle(), + content, WorkMsgTypeEnum.URGING.getBtnText(), url, token); + } + return "OK"; + + }else{ + return "token无效"; + } + } + public String sendWorkMSG(String appid, Long fromStaffid, long toStaffid, int type) { //获取Token StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid); @@ -741,13 +781,15 @@ public class DingtalkBusiness { return R.error("未授权登录"); } + + public class ThreadSendMessage implements Runnable{ List toStaffids; StaffSimpleInfo fromStaff = null; List recordIds; WorkMsgTypeEnum workMsgTypeEnum; String appid; - String hostUrl = "https://lzmanagement.ldxinyong.com/digitization"; + String hostUrl = homeUrl; public ThreadSendMessage(StaffSimpleInfo fromStaff, List toStaffids, WorkMsgTypeEnum typeEnum, String appid){ this.fromStaff = fromStaff; this.toStaffids = toStaffids; diff --git a/src/main/resources/mapper/flow/FlowRecordMapper.xml b/src/main/resources/mapper/flow/FlowRecordMapper.xml index 22201063..7dca5bc4 100644 --- a/src/main/resources/mapper/flow/FlowRecordMapper.xml +++ b/src/main/resources/mapper/flow/FlowRecordMapper.xml @@ -322,5 +322,10 @@ select * from lz_flow_record where is_delete = 0 and flow_index =]]> #{flowIndex} and record_id = #{recordId} and status=#{status} order by flow_index asc + +