修改是删除待办jiekou
This commit is contained in:
parent
94bc2dd60e
commit
7b87828450
@ -23,6 +23,7 @@ public enum WorkMsgTypeEnum {
|
||||
SCORE(9, "绩效考评待办事项", "评分", "\n @的绩效\n \n 需您去评分"),
|
||||
SKIP(10, "绩效跳过", "跳过", "# @的绩效\n ## 己经跳过"),
|
||||
TRANSFER(11, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
|
||||
CLEARN(10, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
|
||||
// 您的2020年10月绩效考核已经开始,请尽快制定绩效目标
|
||||
// 吴林的2020年12月绩效考核的目标需要您确认,点击前往确认
|
||||
;
|
||||
|
||||
@ -221,8 +221,14 @@ public class DingtalkBusiness {
|
||||
return sendWorkMSGByEntity(appid, fromStaffEntity, toStaffEntity, workMsgTypeEnum, "https://www.baidu.com");
|
||||
}
|
||||
|
||||
public String delWorkMSGWithStart(Long startId){
|
||||
return "";
|
||||
public String delWorkMSGWithStart(List<Long> recordIds){
|
||||
|
||||
|
||||
ThreadSendMessage threadSendMessage = new ThreadSendMessage(recordIds, WorkMsgTypeEnum.CLEARN, appid);
|
||||
Thread thread = new Thread(threadSendMessage);
|
||||
thread.start();
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +290,7 @@ public class DingtalkBusiness {
|
||||
}
|
||||
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
|
||||
|
||||
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
|
||||
ThreadSendMessage threadSendMessage = new ThreadSendMessage(toStaffids, workMsgTypeEnum, appid);
|
||||
Thread thread = new Thread(threadSendMessage);
|
||||
thread.start();
|
||||
|
||||
@ -366,14 +372,20 @@ public class DingtalkBusiness {
|
||||
|
||||
public class ThreadSendMessage implements Runnable{
|
||||
List<StaffSimpleInfo> toStaffids;
|
||||
StaffSimpleInfo fromStaff = null;
|
||||
//StaffSimpleInfo fromStaff = null;
|
||||
List<Long> recordIds;
|
||||
WorkMsgTypeEnum workMsgTypeEnum;
|
||||
String appid;
|
||||
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization";
|
||||
public ThreadSendMessage(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
|
||||
public ThreadSendMessage(List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
|
||||
this.toStaffids = toStaffids;
|
||||
workMsgTypeEnum = typeEnum;
|
||||
this.fromStaff = fromStaff;
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
public ThreadSendMessage(List<Long> recordIds, WorkMsgTypeEnum typeEnum, String appid){
|
||||
this.recordIds = recordIds;
|
||||
workMsgTypeEnum = typeEnum;
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
@ -400,148 +412,157 @@ public class DingtalkBusiness {
|
||||
logger.info("开始批量推送消息,数量{}, appid{}", toStaffids.size(), appid);
|
||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||
for (StaffSimpleInfo info:toStaffids
|
||||
) {
|
||||
if(token != null && token.length() > 0){
|
||||
//下面防止第二次发送消息时钉钉不推送
|
||||
String url = hostUrl;
|
||||
if(url.contains("?")){
|
||||
url += "&halokit=" + System.currentTimeMillis();
|
||||
}else{
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + info.getResultRecord().getId());
|
||||
url = URLEncoder.encode(url);
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.URGING.getType()){
|
||||
//绩效催办
|
||||
logger.info("绩效清空");
|
||||
|
||||
|
||||
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||
"&container_type=work_platform&app_id=0_" +
|
||||
appid + "&redirect_type=jump&redirect_url=" + url;
|
||||
//List<ThreadSendMessage> threadSendMessages = thirdMsgSendRecordService.selectThirdMsgSendRecordsByRecordIds(resultRecordIds);
|
||||
}else{
|
||||
for (StaffSimpleInfo info:toStaffids
|
||||
) {
|
||||
if(token != null && token.length() > 0){
|
||||
//下面防止第二次发送消息时钉钉不推送
|
||||
String url = hostUrl;
|
||||
if(url.contains("?")){
|
||||
url += "&halokit=" + System.currentTimeMillis();
|
||||
}else{
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + info.getResultRecord().getId());
|
||||
url = URLEncoder.encode(url);
|
||||
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_WORK.getType()){
|
||||
//发送制定目标通知
|
||||
logger.info("目标制定");
|
||||
sendNotic(info.getId(), info.getEmployeeId(),
|
||||
"目标制定", info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_SCORE.getType()){
|
||||
//发送开始评分通知
|
||||
logger.info("结果录入");
|
||||
sendNotic(info.getId(), info.getEmployeeId(),
|
||||
"结果录入", info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||
"&container_type=work_platform&app_id=0_" +
|
||||
appid + "&redirect_type=jump&redirect_url=" + url;
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.URGING.getType()){
|
||||
//绩效催办
|
||||
logger.info("绩效催办");
|
||||
}else {
|
||||
//流程流转通知
|
||||
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.TRANSFER.getType()){//转交
|
||||
//转交
|
||||
logger.info("转交待办任务处理");
|
||||
FlowChange flowChange = flowChangeService.selectFlowChangeByRecordIdAndToIdAndType(info.getResultRecord().getId(),
|
||||
info.getId(), 0);
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(), flowChange.getApprovalId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
|
||||
//发送待办任务到新指定人员,转交过来一定会有数据
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_WORK.getType()){
|
||||
//发送制定目标通知
|
||||
logger.info("目标制定");
|
||||
sendNotic(info.getId(), info.getEmployeeId(),
|
||||
flowRecords.get(0).getFlowName(), info.getFlowStart().getName(),
|
||||
"目标制定", info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_SCORE.getType()){
|
||||
//发送开始评分通知
|
||||
logger.info("结果录入");
|
||||
sendNotic(info.getId(), info.getEmployeeId(),
|
||||
"结果录入", info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.URGING.getType()){
|
||||
//绩效催办
|
||||
logger.info("绩效催办");
|
||||
}else {
|
||||
//流程流转通知
|
||||
|
||||
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.TRANSFER.getType()){//转交
|
||||
//转交
|
||||
logger.info("转交待办任务处理");
|
||||
FlowChange flowChange = flowChangeService.selectFlowChangeByRecordIdAndToIdAndType(info.getResultRecord().getId(),
|
||||
info.getId(), 0);
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(), flowChange.getApprovalId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
|
||||
//发送待办任务到新指定人员,转交过来一定会有数据
|
||||
sendNotic(info.getId(), info.getEmployeeId(),
|
||||
flowRecords.get(0).getFlowName(), info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.SKIP.getType()){//跳过
|
||||
//跳过
|
||||
logger.info("跳过待办任务处理");
|
||||
FlowChange flowChange = flowChangeService.selectFlowChangeByRecordIdAndToIdAndType(info.getResultRecord().getId(),
|
||||
info.getId(), 1);
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(),
|
||||
flowChange.getApprovalId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectAndOrFlowRecordsById(flowChange.getFlowRecordId(), info.getResultRecord().getId());
|
||||
logger.info("查询到可能需要更新待办任务数量{}", flowRecords.size());
|
||||
if(flowRecords.size() > 0){
|
||||
if(flowRecords.get(0).getType().intValue() == 1){
|
||||
//或签
|
||||
logger.info("或签,需要更新该节点下所有人员的待办任务");
|
||||
|
||||
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.SKIP.getType()){//跳过
|
||||
//跳过
|
||||
logger.info("跳过待办任务处理");
|
||||
FlowChange flowChange = flowChangeService.selectFlowChangeByRecordIdAndToIdAndType(info.getResultRecord().getId(),
|
||||
info.getId(), 1);
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(),
|
||||
flowChange.getApprovalId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectAndOrFlowRecordsById(flowChange.getFlowRecordId(), info.getResultRecord().getId());
|
||||
logger.info("查询到可能需要更新待办任务数量{}", flowRecords.size());
|
||||
if(flowRecords.size() > 0){
|
||||
if(flowRecords.get(0).getType().intValue() == 1){
|
||||
//或签
|
||||
logger.info("或签,需要更新该节点下所有人员的待办任务");
|
||||
for (FlowRecord flowRecord:flowRecords
|
||||
) {
|
||||
if(flowRecord.getApprovalStaffId().longValue() != info.getId()){
|
||||
logger.info("更新非直接跳关人员的待办任务,人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
|
||||
flowRecord.getApprovalStaffName());
|
||||
thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(),
|
||||
flowRecord.getApprovalStaffId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
|
||||
if(flowRecords.size() > 0){//给下一步骤需要处理的人发送待办任务
|
||||
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
|
||||
) {
|
||||
sendNotic(staffSimpleInfo.getId(), staffSimpleInfo.getEmployeeId(),
|
||||
flowRecords.get(0).getFlowName(), info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//取消上一步骤发送的待办任务
|
||||
if(flowRecords.size() == 0){//任务结束了
|
||||
flowRecords = flowRecordService.selectLastFlowRecordsById(info.getResultRecord().getId());
|
||||
}else{
|
||||
flowRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(info.getResultRecord().getId()
|
||||
, flowRecords.get(0).getFlowIndex().intValue() - 1);//获取上一步的数据
|
||||
}
|
||||
logger.info("查询到可能需要更新的待办任务数量{}", flowRecords.size());
|
||||
if(flowRecords.size() > 0){
|
||||
for (FlowRecord flowRecord:flowRecords
|
||||
) {
|
||||
if(flowRecord.getApprovalStaffId().longValue() != info.getId()){
|
||||
logger.info("更新非直接跳关人员的待办任务,人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
|
||||
) {
|
||||
if(flowRecord.getStatus().intValue() == 1){
|
||||
logger.info("将要更新人员的待办任务,人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
|
||||
flowRecord.getApprovalStaffName());
|
||||
thirdMsgSendRecord =
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(),
|
||||
flowRecord.getApprovalStaffId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}else{
|
||||
logger.info("无需更新待办任务");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
|
||||
if(flowRecords.size() > 0){//给下一步骤需要处理的人发送待办任务
|
||||
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
|
||||
) {
|
||||
sendNotic(staffSimpleInfo.getId(), staffSimpleInfo.getEmployeeId(),
|
||||
flowRecords.get(0).getFlowName(), info.getFlowStart().getName(),
|
||||
info.getResultRecord().getStaffName(), token, url, info.getResultRecord().getId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//取消上一步骤发送的待办任务
|
||||
if(flowRecords.size() == 0){//任务结束了
|
||||
flowRecords = flowRecordService.selectLastFlowRecordsById(info.getResultRecord().getId());
|
||||
}else{
|
||||
flowRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(info.getResultRecord().getId()
|
||||
, flowRecords.get(0).getFlowIndex().intValue() - 1);//获取上一步的数据
|
||||
}
|
||||
logger.info("查询到可能需要更新的待办任务数量{}", flowRecords.size());
|
||||
if(flowRecords.size() > 0){
|
||||
for (FlowRecord flowRecord:flowRecords
|
||||
) {
|
||||
if(flowRecord.getStatus().intValue() == 1){
|
||||
logger.info("将要更新人员的待办任务,人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
|
||||
flowRecord.getApprovalStaffName());
|
||||
ThirdMsgSendRecord thirdMsgSendRecord =
|
||||
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
|
||||
info.getResultRecord().getId(),
|
||||
flowRecord.getApprovalStaffId(), 1, 1);
|
||||
if(thirdMsgSendRecord != null){//把原来的任务更新掉
|
||||
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
|
||||
}else{
|
||||
logger.info("无需更新待办任务");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.info("ThreadSendMessage token无效"); ;
|
||||
}
|
||||
}else{
|
||||
logger.info("ThreadSendMessage token无效"); ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,4 +106,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
int batchDeleteByResultRecordIds(@Param("resultRecordIds")List<Long> resultRecordIds);
|
||||
|
||||
List<ResultRecord> selectResultRecordsByStartId(Long startId);
|
||||
|
||||
}
|
||||
@ -122,4 +122,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
ResultRecord selectLastResultRecordByUserId(Long userId);
|
||||
|
||||
ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId);
|
||||
|
||||
List<ResultRecord> selectResultRecordsByStartId(Long startId);
|
||||
List<Long> selectResultRecordIdsByStartId(Long startId);
|
||||
}
|
||||
@ -1334,4 +1334,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
public ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId){
|
||||
return resultRecordMapper.selectResultRecordByStaffIdAndStartId(userId, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultRecord> selectResultRecordsByStartId(Long startId){
|
||||
return resultRecordMapper.selectResultRecordsByStartId(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectResultRecordIdsByStartId(Long startId){
|
||||
return resultRecordMapper.selectIdsByStartId(startId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,5 +612,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
|
||||
<select id="selectResultRecordsByStartId" resultType="ResultRecord">
|
||||
select * from lz_result_record where
|
||||
is_delete = 0
|
||||
and start_id = #{startId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user