Browse Source

工作票推送消息

zhongwei
段飞宇 2 years ago
parent
commit
3a41ebfacc
  1. 1
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
  2. 59
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

1
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java

@ -53,6 +53,7 @@ public class MessageConstants {
DUTY("duty","值班消息"),
SAFE("safe","安全消息"),
ACCESS("access","检修消息"),
TICKETMESSAGE("ticket-message","工作票消息"),
;
@Getter
private String key;

59
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
@ -54,6 +57,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
@ -147,6 +151,13 @@ public class TicketProcessServiceImpl implements TicketProcessService {
private final ProcessDictService processDictService;
private final IMessageClient messageClient;
private final ISysClient sysClient;
/**
* 启动开票流程
*
@ -306,15 +317,16 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
try {
log.info("工作结束==============>"+ (workTicket.getFlowStatus().intValue()));
if (ObjectUtils.isNotEmpty(workTicketFinish)) {
WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId());
log.info("获取工作结束:{}", workTicketFinish);
if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) {
log.info("获取工作结束保存成功");
workTicketFinish.setTicketId(workTicketInfo.getId());
workTicketFinishService.save(workTicketFinish);
} else {
log.info("获取工作结束更新成功");
workTicketDelay.setInitialTime(LocalDateTime.now());
workTicketFinishService.updateByTicketId(workTicketFinish);
}
@ -384,6 +396,47 @@ public class TicketProcessServiceImpl implements TicketProcessService {
} catch (Exception e) {
e.printStackTrace();
}
//推送消息
MessagePushRecordDto message = new MessagePushRecordDto();
message.setBusinessClassify("business");
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey());
message.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription());
message.setTaskId(workTicketInfo.getId());
message.setTenantId("200000");
message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
message.setPushType(MessageConstants.IMMEDIATELY);
//您有一张工作票待审批,工作内容:*****,审批环节:*****;
String countent =
"您有一张工作票待审批,工作内容:".concat(workTicketInfo.getWorkContent())
.concat(",审批环节:")
.concat(response.getTaskName());
message.setContent(countent);
message.setDeptId(workTicketInfo.getCreateDept());
R<String> deptName = sysClient.getDeptName(workTicketInfo.getCreateDept());
if (deptName.isSuccess()) {
message.setDeptName(deptName.getData());
}
String userIds = response.getUserId();
if (StringUtils.isBlank(userIds)){
log.error("推送的消息不能为空哦,{}",userIds);
return;
}
String[] split = userIds.split(",");
for (String userId : split) {
message.setPusher(userId);
User user = UserCache.getUser(NumberUtils.toLong(userId));
if (ObjectUtils.isNotEmpty(user)) {
message.setPusherName(user.getName());
}
message.setAccount(userId);
message.setCreateUser(NumberUtils.toLong(userId));
messageClient.sendMessage(message);
}
}
@ -432,7 +485,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
String taskId = response.getTaskId();
if (StringUtils.isEmpty(taskId)) {
workTicket.setFlowDescription("结束");
workTicket.setFlowTaskId(" ");
// workTicket.setFlowTaskId(" ");
workTicket.setFlowTaskName("结束");
workTicket.setNextStepOperator(" ");
workTicket.setStepOperator(" ");
@ -1165,8 +1218,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
dataConversion.put(key, BooleanUtils.toBoolean(newValue) ? "☑" : "□");
}
}
}

Loading…
Cancel
Save