修复推送消息时可能无法推送问题,增加手动条用开始平分消息接口

This commit is contained in:
wulin 2021-09-01 10:46:23 +08:00
parent 2d594a8806
commit 2f26ec96c7
6 changed files with 110 additions and 5 deletions

View File

@ -75,6 +75,7 @@ public class ShiroConfig {
filterMap.put("/luck/getLuckById", "anon");
filterMap.put("/luck/updateLuck", "anon");
filterMap.put("/doc.html**", "anon");
filterMap.put("/thirdAppConfig/reSendDingTalkMst", "anon");
filterMap.put("/**", "oauth2");
shiroFilter.setFilterChainDefinitionMap(filterMap);

View File

@ -0,0 +1,29 @@
package com.lz.modules.flow.req;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* <p>
* 菜单权限表
* </p>*流转表
* @author quyixiao
* @since 2020-08-18
*/
@Data
public class FlowReSendDingTalkMsgReq implements java.io.Serializable {
//
private List<Long> id;//用户id
//自己部门小伙伴 走的 流程id
private Long startId;
//
}

View File

@ -196,6 +196,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
ids.add("141");
ids.add("134");
Map<String, String> maps = ids.stream().collect(Collectors.toMap(e->e, e->e));
System.out.println(maps);
}

View File

@ -901,8 +901,11 @@ public class DingtalkBusiness {
public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, int type) {
if (toStaffids != null && toStaffids.size() > 0 && (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0)) {
logger.info("推送人员个数:{}", toStaffids.size());
if (toStaffids != null
&& toStaffids.size() > 0
&& (toStaffids.get(0).getEmployeeId() == null ||
toStaffids.get(0).getEmployeeId().length() == 0)) {
//查询第三方id
List<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
@Override
@ -915,7 +918,7 @@ public class DingtalkBusiness {
for (StaffSimpleInfo staff : staffSimpleInfos
) {
StaffSimpleInfo staff1 = map.get(staff.getId());
staff1.setEmployeeId(staff1.getEmployeeId());
staff1.setEmployeeId(staff.getEmployeeId());
}
}
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);

View File

@ -1838,8 +1838,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
resultRecordService.updateResultRecordById(resultRecord);
String commentId = null;
if (dto.getSave() == null) {//非暂存
//修改评论信息
if (dto.getSave() == null) {//非暂存//修改评论信息
log.info("修改了多少个指标{}", editResultDetails.size());
editResultDetails.addAll(resultDetailService.selectNotNoticeResultDetailByRecordId(dto.getId()));
log.info("可能需要写入评论的内容条数{}", editResultDetails.size());

View File

@ -1,21 +1,37 @@
package com.lz.modules.third.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.req.FlowReSendDingTalkMsgReq;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.business.DingtalkBusiness;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/thirdAppConfig")
@Slf4j
public class ThirdAppConfigController {
@ -25,6 +41,15 @@ public class ThirdAppConfigController {
@Autowired
private DingtalkBusiness dingtalkBusiness;
@Autowired
private StaffService staffService;
@Autowired
private FlowStartService flowStartService;
@Autowired
private ResultRecordService resultRecordService;
@RequestMapping("/list")
public R list(@RequestBody String body) {
@ -42,6 +67,53 @@ public class ThirdAppConfigController {
return R.ok();
}
@PostMapping("/reSendDingTalkMst")
public R reSendDingTalkMst(@RequestBody FlowReSendDingTalkMsgReq flowReSendDingTalkMsgReq) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(flowReSendDingTalkMsgReq.getId());
List<StaffSimpleInfo> toStaffids = new ArrayList<>();
//List<StaffEntity> staffEntities = staffService.selectByIds(flowReSendDingTalkMsgReq.getId());
if(staffSimpleInfos.size() > 0){
FlowStart flowStart = flowStartService.selectFlowStartById(flowReSendDingTalkMsgReq.getStartId());
if(flowStart != null){
List<ResultRecord> resultRecords = resultRecordService.selectResultRecordsByStartId(flowStart.getId());
if(resultRecords.size() > 0){
Map<Long, ResultRecord> resultRecordMap = resultRecords.stream().collect(Collectors.toMap(ResultRecord::getStaffId,
Function.identity(), (e, r) -> e));
for (StaffSimpleInfo staffSimpleInfo:staffSimpleInfos
) {
ResultRecord resultRecord = resultRecordMap.get(staffSimpleInfo.getId());
if(resultRecord != null){
// StaffSimpleInfo staffSimpleInfo = new StaffSimpleInfo();
//staffSimpleInfo.setId(resultRecord.getStaffId());
staffSimpleInfo.setResultRecord(resultRecord);
staffSimpleInfo.setFlowStart(flowStart);
toStaffids.add(staffSimpleInfo);
}else{
}
}
//通知评分
if(toStaffids.size() > 0){
try {
String s = dingtalkBusiness.sendWorkMSGWithAsyn(toStaffids, WorkMsgTypeEnum.START_SCORE.getType());
log.info("钉钉评分响应返回res" + s);
return R.ok();
} catch (Exception e) {
log.error("通知评分异常ids: " + JSON.toJSONString(toStaffids) + " ,e: " ,e);
return R.error("通知评分异常ids: " + JSON.toJSONString(toStaffids) + " ,e: "+e);
}
}
return R.error("有效推送人员个数为0");
}
return R.error("无效考核记录");
}
return R.error("无效考核任务");
}
return R.error("无有效人员");
}