提交修改

This commit is contained in:
quyixiao 2020-11-19 12:00:50 +08:00
commit 77683457e4
19 changed files with 255 additions and 98 deletions

View File

@ -16,11 +16,18 @@ public enum WorkMsgTypeEnum {
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"),
END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"),
<<<<<<< HEAD
START_WORK(6, "绩效考评待办事项", "去查看", "# 绩效目标制定\n ## @,你的绩效需要制定目标"),
START_SCORE(7, "绩效考评待办事项", "去查看", "# 绩效结果输入\n ## @,你的绩效需要输入结果"),
PROCESS(8, "绩效考评待办事项", "去查看", "# @的绩效\n ## 需您去处理"),
SKIP(9, "绩效跳过", "跳过", "# @的绩效\n ## 己经跳过"),
TRANSFER(10, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
=======
START_WORK(6, "绩效考评待办事项", "制定目标", "\n 绩效目标制定\n \n @,你的绩效需要制定目标"),
START_SCORE(7, "绩效考评待办事项", "输入结果", "\n 绩效结果输入\n \n @,你的绩效需要输入结果"),
PROCESS(8, "绩效考评待办事项", "目标确认", "\n @的绩效\n \n 需您去目标确认"),
SCORE(8, "绩效考评待办事项", "评分", "\n @的绩效\n \n 需您去评分"),
>>>>>>> b16c903f3a09f8170eeedcd239fde8acc99f1d2c
// 您的2020年10月绩效考核已经开始请尽快制定绩效目标
// 吴林的2020年12月绩效考核的目标需要您确认点击前往确认
;

View File

@ -275,7 +275,7 @@ public class DingTalkUtil {
thirdMsgSendRecord.setMsgType("action_card");
thirdMsgSendRecord.setStaffId(staff.getId());
thirdMsgSendRecord.setMsgTitle(singleTitle);
thirdMsgSendRecord.setAppId(Long.parseLong(appid));
thirdMsgSendRecord.setAppId(appid);
thirdMsgSendRecord.setHeadText(title);
thirdMsgSendRecord.setMsgContent(marDown);
thirdMsgSendRecord.setMsgUrl(singleUrl);
@ -283,7 +283,7 @@ public class DingTalkUtil {
try{
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request();
req.setAgentId(thirdMsgSendRecord.getAppId());
req.setAgentId(Long.parseLong(thirdMsgSendRecord.getAppId()));
req.setUseridList(staff.getEmployeeId());
OapiMessageCorpconversationAsyncsendV2Request.Msg obj1 = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
obj1.setMsgtype(thirdMsgSendRecord.getMsgType());
@ -299,10 +299,10 @@ public class DingTalkUtil {
//插入数据库
JSONObject json = JSONObject.parseObject(rsp.getBody());
if(json.getIntValue("errcode") == 0){
thirdMsgSendRecord.setTaskId(json.getLong("task_id"));
thirdMsgSendRecord.setTaskId(json.getString("task_id"));
thirdMsgSendRecord.setStatus(1);
}else{
thirdMsgSendRecord.setTaskId(0L);
thirdMsgSendRecord.setTaskId("0");
thirdMsgSendRecord.setStatus(6);
thirdMsgSendRecord.setRemark(json.getString("errmsg"));
msg = thirdMsgSendRecord.getRemark();
@ -319,17 +319,19 @@ public class DingTalkUtil {
return msg;
}
//发送待办任务
public String sendSingleWorkMSG(String appid, StaffEntity staff, String title, String marDown,
String singleTitle, String singleUrl, String token) {
public String sendSingleWorkMSG(String appid, StaffEntity staff, String title, String title1,
String content1, String title2,
String content2, String title3,
String content3, String singleUrl, String token, String from) {
String msg = "OK";
ThirdMsgSendRecord thirdMsgSendRecord = new ThirdMsgSendRecord();
thirdMsgSendRecord.setMsgType("work_msg");
thirdMsgSendRecord.setStaffId(staff.getId());
thirdMsgSendRecord.setMsgTitle(singleTitle);
thirdMsgSendRecord.setAppId(Long.parseLong(appid));
thirdMsgSendRecord.setMsgTitle(title1 + "#" + title2 + "#" + title3);
thirdMsgSendRecord.setAppId(appid);
thirdMsgSendRecord.setHeadText(title);
thirdMsgSendRecord.setMsgContent(marDown);
thirdMsgSendRecord.setMsgContent(content1 + "#" + content2 + "#" + content3);
thirdMsgSendRecord.setMsgUrl(singleUrl);
thirdMsgSendRecord.setStatus(0);
try{
@ -337,13 +339,22 @@ public class DingTalkUtil {
OapiWorkrecordAddRequest req = new OapiWorkrecordAddRequest();
req.setUserid(staff.getEmployeeId());
req.setCreateTime(System.currentTimeMillis());
req.setTitle(singleTitle);
req.setTitle(title);
req.setUrl(singleUrl);
req.setSourceName(from);
List<OapiWorkrecordAddRequest.FormItemVo> list2 = new ArrayList<OapiWorkrecordAddRequest.FormItemVo>();
OapiWorkrecordAddRequest.FormItemVo obj3 = new OapiWorkrecordAddRequest.FormItemVo();
list2.add(obj3);
obj3.setTitle(title);
obj3.setContent(marDown);
obj3.setTitle(title1);
obj3.setContent(content1);
obj3 = new OapiWorkrecordAddRequest.FormItemVo();
list2.add(obj3);
obj3.setTitle(title2);
obj3.setContent(content2);
obj3 = new OapiWorkrecordAddRequest.FormItemVo();
list2.add(obj3);
obj3.setTitle(title3);
obj3.setContent(content3);
req.setFormItemList(list2);
OapiWorkrecordAddResponse rsp = client.execute(req, token);
@ -352,15 +363,15 @@ public class DingTalkUtil {
//插入数据库
JSONObject json = JSONObject.parseObject(rsp.getBody());
if(json.getIntValue("errcode") == 0){
thirdMsgSendRecord.setTaskId(json.getLong("record_id"));
thirdMsgSendRecord.setTaskId(json.getString("record_id"));
thirdMsgSendRecord.setStatus(1);
}else{
thirdMsgSendRecord.setTaskId(0L);
thirdMsgSendRecord.setTaskId("0");
thirdMsgSendRecord.setStatus(6);
thirdMsgSendRecord.setRemark(json.getString("errmsg"));
msg = thirdMsgSendRecord.getRemark();
}
logger.info("发送消息{}", thirdMsgSendRecord);
}catch (ApiException e) {
e.printStackTrace();
thirdMsgSendRecord.setStatus(6);
@ -368,7 +379,7 @@ public class DingTalkUtil {
msg = thirdMsgSendRecord.getRemark();
}
thirdMsgSendRecordService.insert(thirdMsgSendRecord);
thirdMsgSendRecordService.insertThirdMsgSendRecord(thirdMsgSendRecord);
return msg;
}

View File

@ -429,6 +429,9 @@ public class ResultRecordController extends AbstractController {
}
//流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点
if(flowRecords.size() == 0){
return R.error("绩效流程数据初始化中...,请稍后!");
}
if(flowRecords.get(0).getType().intValue() == 1){
//或签,这里还有优化多个评分节点时针对每个节点是否为或签
isOrScore = true;

View File

@ -2,6 +2,8 @@ package com.lz.modules.app.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.sys.entity.app.ResultRecord;
import lombok.Data;
import java.io.Serializable;
@ -46,10 +48,10 @@ public class StaffSimpleInfo implements Serializable {
private String employeeId;
//头像
private String avatar;
//本次发起任务的id
private Long startId;
//本次发起绩效的id
private Long recordId;
//本次发起任务的
private ResultRecord resultRecord;
//本次发起的任务信息
private FlowStart flowStart;

View File

@ -34,4 +34,6 @@ public interface FlowMapper extends BaseMapper<Flow> {
List<Flow> selectByFlowId(@Param("flowId") Long flowId, @Param("startId") Long startId);
}

View File

@ -76,7 +76,10 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
FlowRecord selectFlowRecordByRecordIdMinIdStatus(@Param("resultRecordId") Long resultRecordId, @Param("id") Long id, @Param("status") int status);
int batchUpdateExecution(@Param("recordIds")List<Long> recordIds,@Param("processId") int processId);
int batchUpdateSkip(@Param("recordIds")List<Long> recordIds);
List<FlowRecord> selectFlowRecordByRecordIdFlowProcess(@Param("id") Long id, @Param("flowProcess") int flowProcess);
int batchDeleteByRecordIds(@Param("recordIds")List<Long> recordIds);
}

View File

@ -1,12 +1,16 @@
package com.lz.modules.flow.model;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.flow.entity.FlowApprovalRole;
import com.lz.modules.sys.entity.app.ResultRecord;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class StartStartDto {
private int status;
private List<ResultRecord> resultRecordList = new ArrayList<>();
public class StartStartDto {//发起一个考评组对应的返回的数据
private int status;//返回结果
private List<Flow> flows ;
private List<FlowApprovalRole> flowApprovalRoles;
private List<ResultRecord> resultRecordList;
}

View File

@ -36,4 +36,6 @@ public interface FlowService extends IService<Flow> {
List<Flow> selectByFlowId(Long flowId,Long startId);
FlowChart selectFlowChartByChartId(Long flowId);
}

View File

@ -78,4 +78,6 @@ public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements Fl
}
}

View File

@ -103,7 +103,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
@Autowired
private DingtalkBusiness dingtalkBusiness;
List<ThreadInitFlowRecord> threadInitFlowRecords = new ArrayList<>();
@ -162,7 +161,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
List<StartStartDto> resultRecords = new ArrayList<>();
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
@ -188,7 +187,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffSimpleInfos);
resultRecords.addAll(startDto.getResultRecordList());
resultRecords.add(startDto);
break;
}
@ -277,7 +276,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
List<StartStartDto> resultRecords = new ArrayList<>();
for (int n = 0; n < evaluationGroups.size(); n++
) {
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
@ -324,7 +323,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffIds);
resultRecords.addAll(startDto.getResultRecordList());
resultRecords.add(startDto);
break;
}
}
@ -380,6 +379,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return startStartDto;
}
List<ResultRecord> resultRecords = new ArrayList<>();
List<Flow> flows;
List<FlowApprovalRole> flowApprovalRoles;
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
if(!isInsert){
evaluationGroup.setCopyId(evaluationGroup.getId());
@ -451,11 +453,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<ResultDetail> resultDetails = new ArrayList();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
staffInfo.setStartId(flowStart.getId());
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
@ -483,16 +483,16 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
resultRecords.add(resultRecord);
resultRecordService.insertResultRecord(resultRecord);
startStartDto.getResultRecordList().add(resultRecord);
//resultRecordService.initFlowRecord(resultRecord.getId());
//下面生成实际的考核流程
staffInfo.setRecordId(resultRecord.getId());
staffInfo.setResultRecord(resultRecord);
staffInfo.setFlowStart(flowStart);
for (ResultModelDto modelDto:resultModelDtos
) {
@ -522,22 +522,35 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
}
evaluationStartStaffService.saveBatch(evaluationStartStaffs);
startStartDto.setResultRecordList(resultRecords);
flows = flowService.selectByFlowId(evaluationGroup.getId(),flowStart.getId());
List<Long> flowIds = flows.stream().map(new Function<Flow, Long>() {
@Override
public Long apply(Flow flow) {
return flow.getId();
}
}).collect(Collectors.toList());
flowApprovalRoles =flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
startStartDto.setFlows(flows);
startStartDto.setFlowApprovalRoles(flowApprovalRoles);
startStartDto.setStatus(0);
return startStartDto;
}
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
flows = new ArrayList<>();
flowApprovalRoles = new ArrayList<>();
int stepIndex = 0;
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
) {
) {//初始化考评组对应的的flow
Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
flow.setOptDesc(chartNameMaps.get(flowChartDetailRecord.getChartId()));
flows.add(flow);
flowService.insertFlow(flow);
FlowApprovalRole flowApprovalRole = null;
List<FlowChartRole> flowChartRoles = null;
@ -565,7 +578,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
) {//初始化考评组对应的的FlowApprovalRole
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
@ -638,11 +651,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<ResultDetail> resultDetails = new ArrayList<>();
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
staffInfo.setStartId(flowStart.getId());
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
@ -747,10 +759,13 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
roleJSON += "]";
roleJSON = roleJSON.replace(",]", "]");
resultRecord.setFlowStaffIdRole(roleJSON);
resultRecords.add(resultRecord);
resultRecordService.insertResultRecord(resultRecord);
startStartDto.getResultRecordList().add(resultRecord);
staffInfo.setRecordId(resultRecord.getId());
//startStartDto.getResultRecordList().add(resultRecord);
staffInfo.setResultRecord(resultRecord);
staffInfo.setFlowStart(flowStart);
//下面生成实际的考核流程
/*ExecutorService executor = Executors.newFixedThreadPool(10);
@ -783,6 +798,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
}
}
startStartDto.setResultRecordList(resultRecords);
startStartDto.setFlowApprovalRoles(flowApprovalRoles);
startStartDto.setFlows(flows);
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
@ -795,6 +813,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
startStartDto.setStatus(5);
return startStartDto;
}
startStartDto.setStatus(0);
return startStartDto;
}
@ -808,10 +827,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.ok().put("data",staffEntity);
}
private void initFlowRecordAnsy(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
private void initFlowRecordAnsy(List<StartStartDto> resultRecords, List<StaffSimpleInfo> noticeStaff){
if(resultRecords.size() > 0){
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords, noticeStaff);
threadInitFlowRecords.add(threadInitFlowRecord);//防止提前回收
Thread thread = new Thread(threadInitFlowRecord);
thread.start();
@ -820,29 +839,34 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
public class ThreadInitFlowRecord implements Runnable{
List<ResultRecord> resultRecords;
List<StartStartDto> resultRecords;
List<StaffSimpleInfo> noticeStaff;
public ThreadInitFlowRecord(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
public ThreadInitFlowRecord(List<StartStartDto> resultRecords, List<StaffSimpleInfo> noticeStaff){
this.resultRecords = resultRecords;
this.noticeStaff = noticeStaff;
}
@Override
public void run() {
//String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
//String newNo = oldNo + "_initFlowRecord" ;//+ resultRecord.getStaffId() + "_" + resultRecord.getId();
//ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
String newNo = oldNo + "_initFlowRecord" ;//+ resultRecord.getStaffId() + "_" + resultRecord.getId();
ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
log.info("开始批量初始化流程,数量{}", resultRecords.size());
for (ResultRecord resultRecord:resultRecords
) {
resultRecordService.initFlowRecord(resultRecord.getId());
for (StartStartDto startStartDto:resultRecords
) {
for (ResultRecord resultRecord:startStartDto.getResultRecordList()
) {
resultRecordService.initFlowRecord(resultRecord, startStartDto.getFlows(), startStartDto.getFlowApprovalRoles());
}
}
//ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
}
ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
threadInitFlowRecords.remove(this);
}
}
}

View File

@ -14,7 +14,9 @@ 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.entity.FlowStart;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.sys.dao.SysUserTokenDao;
@ -74,6 +76,9 @@ public class DingtalkBusiness {
@Autowired
private FlowRecordService flowRecordService;
@Autowired
private FlowStartService flowStartService;
@Resource
StaffDao staffDao;
@ -212,9 +217,12 @@ public class DingtalkBusiness {
public String sendWorkMSGWithAsyn(Long resultRecordId , int type) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
if(resultRecord != null){
FlowStart flowStart = flowStartService.selectFlowStartById(resultRecord.getStartId());
StaffSimpleInfo fromStaff = staffService.selectStaffSimpleInfo(resultRecord.getStaffId());
fromStaff.setResultRecord(resultRecord);
fromStaff.setFlowStart(flowStart);
List<StaffSimpleInfo> toStaffids;
if(type == WorkMsgTypeEnum.REJECT.getType()){
if(type == WorkMsgTypeEnum.REJECT.getType()){//被拒
toStaffids = new ArrayList<>();
toStaffids.add(fromStaff);
sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.REJECT.getType());
@ -228,6 +236,11 @@ public class DingtalkBusiness {
}
}).collect(Collectors.toList());
toStaffids = staffService.selectStaffSimpleInfos(ids);
for (StaffSimpleInfo simpleInfo:toStaffids
) {
simpleInfo.setResultRecord(resultRecord);
simpleInfo.setFlowStart(flowStart);
}
sendWorkMSGWithAsyn(fromStaff, toStaffids, WorkMsgTypeEnum.PROCESS.getType());
}
@ -344,7 +357,7 @@ public class DingtalkBusiness {
StaffSimpleInfo fromStaff = null;
WorkMsgTypeEnum workMsgTypeEnum;
String appid;
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization/dingTalkLogin";
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization";
public ThreadSendMessage(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
this.toStaffids = toStaffids;
workMsgTypeEnum = typeEnum;
@ -354,7 +367,7 @@ public class DingtalkBusiness {
@Override
public void run() {
logger.info("开始批量推送消息,数量{}, appid", toStaffids.size(), appid);
logger.info("开始批量推送消息,数量{}, appid{}", toStaffids.size(), appid);
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
for (StaffSimpleInfo info:toStaffids
@ -367,30 +380,62 @@ public class DingtalkBusiness {
}else{
url += "?halokit=" + System.currentTimeMillis();
}
url += ("&detail=1&id=" + info.getRecordId());
url += ("&detail=1&id=" + info.getResultRecord().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;
String content = null;
if(fromStaff == null){
content = workMsgTypeEnum.getContent().replace("@", info.getName());
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_WORK.getType()){
//发送制定目标通知
StaffEntity entity = new StaffEntity();
entity.setId(info.getId());
entity.setEmployeeId(info.getEmployeeId());
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
"任务内容", "目标制定",
"考核名称", info.getFlowStart().getName(),
"被考核人", info.getResultRecord().getStaffName(),
url, token, "霖梓控股");
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.START_SCORE.getType()){
//发送开始评分通知
StaffEntity entity = new StaffEntity();
entity.setId(info.getId());
entity.setEmployeeId(info.getEmployeeId());
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
"任务内容", "结果录入",
"考核名称", info.getFlowStart().getName(),
"被考核人", info.getResultRecord().getStaffName(),
url, token, "霖梓控股");
}else{
if(fromStaff.getId() == info.getId()){
content = workMsgTypeEnum.getContent().replace("@", "");
//流程流转通知
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(info.getResultRecord().getId(), 2);
if(flowRecords.size() == 0){
//任务结束
}else{
content = workMsgTypeEnum.getContent().replace("@", fromStaff.getName());
}
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
) {
StaffEntity entity = new StaffEntity();
entity.setId(staffSimpleInfo.getId());
entity.setEmployeeId(staffSimpleInfo.getEmployeeId());
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
"任务内容", flowRecords.get(0).getFlowName(),
"考核名称", info.getFlowStart().getName(),
"被考核人", info.getResultRecord().getStaffName(),
url, token, "霖梓控股");
}
}
}
StaffEntity entity = new StaffEntity();
entity.setId(info.getId());
entity.setEmployeeId(info.getEmployeeId());
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
content, workMsgTypeEnum.getBtnText(), url, token);
}else{
logger.info("ThreadSendMessage token无效"); ;
}

View File

@ -80,8 +80,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Autowired
private DingtalkBusiness dingtalkBusiness;
public static final int processId = 1;
@Override
@ -165,7 +163,14 @@ public class AssessManagerServiceImpl implements AssessManagerService {
//删除副本组
evaluationGroupService.deleteByCopyIds(collect,flowStart.getId());
}
resultRecordMapper.batchDeleteByStartId(flowStart.getId());
List<Long> ids = resultRecordMapper.selectIdsByStartId(flowStart.getId());
if(CollectionUtils.isNotEmpty(ids)){
log.info("删除resultRecordIds: " + JSON.toJSONString(ids));
resultRecordMapper.batchDeleteByResultRecordIds(ids);
//删除flowRecord
flowRecordMapper.batchDeleteByRecordIds(ids);
}
return ;
}
@ -280,7 +285,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
Long evaluation = group.getId();
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId());
log.info("更新evaluationStartStaff 数据 为已评分 " + i);
List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
List<ResultRecord> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isNotEmpty(dtos)){
log.info("本次评分更新操作 num: " + dtos.size());
dtos.forEach(dto -> {
@ -299,8 +304,9 @@ public class AssessManagerServiceImpl implements AssessManagerService {
//钉钉通知评分构建
StaffSimpleInfo staffSimpleInfo = new StaffSimpleInfo();
staffSimpleInfo.setId(dto.getStaffId());
staffSimpleInfo.setRecordId(recordId);
staffSimpleInfo.setStartId(req.getStartId());
staffSimpleInfo.setResultRecord(dto);
FlowStart start = flowStartMapper.selectFlowStartById(req.getStartId());
staffSimpleInfo.setFlowStart(start);
toStaffids.add(staffSimpleInfo);
});
@ -317,7 +323,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
List<Long> collect = objects.stream().map(o -> Long.valueOf(String.valueOf(o))).collect(toList());
int updateExecution = flowRecordMapper.batchUpdateExecution(collect, processId);
int updateExecution = flowRecordMapper.batchUpdateSkip(collect);
log.info("更新flowRecord记录,i:" + updateExecution);
}

View File

@ -94,11 +94,16 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
int batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
List<ToScoreDingTalkDto> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);
List<ResultRecord> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);
int countAssessNumJoin(@Param("req")AssessDetailReq req);
ResultRecord selectLastResultRecordByUserId(@Param("userId") Long userId);
ResultRecord selectResultRecordByStaffIdAndStartId(@Param("userId") Long userId, @Param("startId") Long startId);
List<Long> selectIdsByStartId(@Param("startId")Long startId);
int batchDeleteByResultRecordIds(@Param("resultRecordIds")List<Long> resultRecordIds);
}

View File

@ -13,6 +13,7 @@ import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.flow.entity.FlowApprovalRole;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.OwnResultReq;
@ -112,7 +113,9 @@ public interface ResultRecordService extends IService<ResultRecord> {
R initFlowRecord(Long resultRecordId);
R newApproval(ApprovalDto approvalDto) throws Exception;
R initFlowRecord(ResultRecord resultRecord, List<Flow> flows, List<FlowApprovalRole> flowApprovalRoles);
R newApproval(ApprovalDto approvalDto) throws Exception;
R newResultRecordList(RecordDetailDto recordDetailDto);

View File

@ -778,6 +778,13 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
flowIds.add(flow.getId());
}
List<FlowApprovalRole> flowApprovalRoles =flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
return initFlowRecord(resultRecord, flows, flowApprovalRoles);
}
@Override
public R initFlowRecord(ResultRecord resultRecord, List<Flow> flows, List<FlowApprovalRole> flowApprovalRoles) {
int i = 0;
for (FlowApprovalRole flowApprovalRole : flowApprovalRoles) {
FlowRecord flowRecord = new FlowRecord();

View File

@ -63,9 +63,9 @@ public class ThirdMsgSendRecord implements java.io.Serializable {
//发送状态0新建1已发送2处理中3已送达4未读5已读6发送失败7撤回
private Integer status;
//应用ID
private Long appId;
private String appId;
//钉钉返回的任务id
private Long taskId;
private String taskId;
//备注一些说明
private String remark;
/**
@ -417,14 +417,14 @@ public class ThirdMsgSendRecord implements java.io.Serializable {
* 应用ID
* @return
*/
public Long getAppId() {
public String getAppId() {
return appId;
}
/**
* 应用ID
* @param appId
*/
public void setAppId(Long appId) {
public void setAppId(String appId) {
this.appId = appId;
}
@ -432,14 +432,14 @@ public class ThirdMsgSendRecord implements java.io.Serializable {
* 钉钉返回的任务id
* @return
*/
public Long getTaskId() {
public String getTaskId() {
return taskId;
}
/**
* 钉钉返回的任务id
* @param taskId
*/
public void setTaskId(Long taskId) {
public void setTaskId(String taskId) {
this.taskId = taskId;
}

View File

@ -580,8 +580,8 @@
)
</update>
<select id="selectToScoreList" resultType="com.lz.modules.performance.dto.ToScoreDingTalkDto">
select id,staff_id from lz_result_record where is_delete = 0
<select id="selectToScoreList" resultType="ResultRecord">
select * from lz_result_record where is_delete = 0
and start_id = #{startId}
and flow_process = 2
and evaluation_id = #{evaluationId}
@ -594,5 +594,23 @@
<select id="selectResultRecordByStaffIdAndStartId" resultType="ResultRecord" >
select * from lz_result_record where staff_id=#{userId} and is_delete = 0 and start_id = #{startId} order by id desc limit 1
</select>
<select id="selectIdsByStartId" resultType="long">
select id from lz_result_record where
is_delete = 0
and start_id = #{startId}
</select>
<update id="batchDeleteByResultRecordIds">
update lz_result_record set is_delete = 1
,gmt_modified = now()
where
is_delete = 0
and id in (
<foreach collection="resultRecordIds" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@ -103,5 +103,7 @@
select * from lz_flow where flow_id = #{flowId} and is_delete = 0 and start_id = #{startId}
</select>
</mapper>

View File

@ -266,23 +266,34 @@
select * from lz_flow_record where is_delete = 0 and record_id = #{resultRecordId} and id > #{id} and status = #{status} order by id asc limit 1
</select>
<update id="batchUpdateExecution">
<update id="batchUpdateSkip">
UPDATE lz_flow_record
SET status = 4
,gmt_modified = now()
where is_delete = 0 and status !=4 and flow_process = 2 and process_id = #{processId}
<if test="recordIds !=null and recordIds.size()!=0">
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</if>
where is_delete = 0 and status !=4 and flow_process = 2
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</update>
<select id="selectFlowRecordByRecordIdFlowProcess" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{id} and flow_process = #{flowProcess}
</select>
<update id="batchDeleteByRecordIds">
UPDATE lz_flow_record
SET is_delete = 1
,gmt_modified = now()
where is_delete = 0
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</update>
</mapper>