Merge branch 'feature/REQ-1507' into dev
This commit is contained in:
commit
17d4ae0376
@ -113,6 +113,10 @@
|
||||
<groupId>cn.axzo.im.center</groupId>
|
||||
<artifactId>im-center-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.apollo</groupId>
|
||||
<artifactId>apollo-workspace-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -44,18 +44,20 @@ public class PendingMessagePushParam implements Serializable {
|
||||
* 模板编码
|
||||
*/
|
||||
private String templateCode;
|
||||
/**
|
||||
* 消息所属项目部类型
|
||||
*/
|
||||
private OrganizationTypeEnum orgType;
|
||||
// /**
|
||||
// * 删除工作台类型,通过id查
|
||||
// * 消息所属项目部类型
|
||||
// */
|
||||
// private OrganizationTypeEnum orgType;
|
||||
/**
|
||||
* 消息所属项目部Id
|
||||
*/
|
||||
private Long workspaceId;
|
||||
/**
|
||||
* 消息所属项目部名称
|
||||
*/
|
||||
private String workspaceName;
|
||||
// /**
|
||||
// * 删除工作台名称,通过id查
|
||||
// * 消息所属项目部名称
|
||||
// */
|
||||
// private String workspaceName;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package cn.axzo.msg.center.message.service.impl;
|
||||
|
||||
import cn.axzo.apollo.core.web.Result;
|
||||
import cn.axzo.apollo.workspace.api.workspace.WorkspaceApi;
|
||||
import cn.axzo.apollo.workspace.api.workspace.res.SimpleWorkspaceRes;
|
||||
import cn.axzo.msg.center.common.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.msg.center.common.exception.ServiceException;
|
||||
import cn.axzo.msg.center.common.utils.PlaceholderResolver;
|
||||
@ -61,6 +64,7 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
private final MessageGroupNodeService messageGroupNodeService;
|
||||
private final MessageTemplateNewService messageTemplateNewService;
|
||||
private final MessageTemplateGroupService messageTemplateGroupService;
|
||||
private final WorkspaceApi workspaceApi;
|
||||
|
||||
@Override
|
||||
public List<PendingMessageStatisticDTO> groupStatistic(MessageGroupNodeStatisticParam param) {
|
||||
@ -122,8 +126,18 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
MessageTemplateDTO msgTemplate = messageTemplateNewService
|
||||
.queryByTemplateCode(param.getTemplateCode())
|
||||
.orElseThrow(() -> new ServiceException("not found message template."));
|
||||
// 生成requestNo
|
||||
String requestNo = UUIDUtil.uuidString();
|
||||
List<PendingMessageRecord> record = convert(param, msgTemplate,requestNo);
|
||||
// 查询工作台信息
|
||||
SimpleWorkspaceRes workspace = null;
|
||||
Long workspaceId = param.getWorkspaceId();
|
||||
Result<SimpleWorkspaceRes> workspaceRes = workspaceApi.getOne(workspaceId);
|
||||
if (!"200".equals(workspaceRes.getCode())) {
|
||||
log.info("未查询到工作台信息 workspaceId:{}",workspaceId);
|
||||
}else{
|
||||
workspace = workspaceRes.getData();
|
||||
}
|
||||
List<PendingMessageRecord> record = convert(param, msgTemplate,requestNo,workspace);
|
||||
pendingMessageRecordDao.saveBatch(record);
|
||||
// TODO 消息推送 @luofu
|
||||
return requestNo;
|
||||
@ -250,7 +264,7 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
});
|
||||
}
|
||||
|
||||
private List<PendingMessageRecord> convert(PendingMessagePushParam param, MessageTemplateDTO msgTemplate,String requestNo) {
|
||||
private List<PendingMessageRecord> convert(PendingMessagePushParam param, MessageTemplateDTO msgTemplate,String requestNo,SimpleWorkspaceRes workspace) {
|
||||
// 多个执行者生成多条record
|
||||
return param.getExecutor().stream().map(executor ->{
|
||||
PendingMessageRecord record = new PendingMessageRecord();
|
||||
@ -262,9 +276,11 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
// 构建模板信息
|
||||
buildTemplateInfo(record, msgTemplate, param.getRouterParams());
|
||||
// 构建代办所属企业/项目等相关信息
|
||||
record.setOrgType(Objects.isNull(param.getOrgType()) ? OrganizationTypeEnum.UNKNOWN : param.getOrgType());
|
||||
record.setOrgId(param.getWorkspaceId());
|
||||
record.setOrgName(param.getWorkspaceName());
|
||||
if (workspace != null) {
|
||||
record.setOrgType(OrganizationTypeEnum.codeOf(workspace.getType()));
|
||||
record.setOrgName(workspace.getName());
|
||||
}
|
||||
// 构建业务类信息
|
||||
buildBusinessInfo(record, param);
|
||||
return record;
|
||||
|
||||
@ -4,7 +4,10 @@ import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 工作台类型
|
||||
* @description
|
||||
*
|
||||
* @author cold_blade
|
||||
@ -14,10 +17,17 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public enum OrganizationTypeEnum {
|
||||
ENT(2, "企业工作台"),
|
||||
PROJECT(1, "项目部工作台"),
|
||||
ENT(1, "企业工作台"),
|
||||
PROJECT(2, "项目部工作台"),
|
||||
UNKNOWN(0, "未知");
|
||||
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
public static OrganizationTypeEnum codeOf(Integer code) {
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.code.equals(code))
|
||||
.findFirst().orElse(UNKNOWN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user