REQ-2303: backup
This commit is contained in:
parent
016c14c049
commit
f988245459
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.message.domain.dto;
|
package cn.axzo.msg.center.message.domain.dto;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.domain.entity.PendingMessageRecord;
|
import cn.axzo.msg.center.domain.entity.PendingMessageRecord;
|
||||||
import cn.axzo.msg.center.service.dto.IdentityDTO;
|
import cn.axzo.msg.center.service.dto.IdentityDTO;
|
||||||
import cn.axzo.msg.center.service.dto.MessageCardContentItemDTO;
|
import cn.axzo.msg.center.service.dto.MessageCardContentItemDTO;
|
||||||
@ -170,6 +171,10 @@ public class PendingMessageDTO implements Serializable {
|
|||||||
* 发起人工作台名称
|
* 发起人工作台名称
|
||||||
*/
|
*/
|
||||||
private String promoterWorkspaceName;
|
private String promoterWorkspaceName;
|
||||||
|
/**
|
||||||
|
* 发起人企业类型
|
||||||
|
*/
|
||||||
|
private OrganizationTypeEnum promoterWorkspaceType;
|
||||||
/**
|
/**
|
||||||
* 发起人企业id
|
* 发起人企业id
|
||||||
*/
|
*/
|
||||||
@ -182,6 +187,10 @@ public class PendingMessageDTO implements Serializable {
|
|||||||
* 接收人工作台名称
|
* 接收人工作台名称
|
||||||
*/
|
*/
|
||||||
private String executorWorkspaceName;
|
private String executorWorkspaceName;
|
||||||
|
/**
|
||||||
|
* 执行人企业类型
|
||||||
|
*/
|
||||||
|
private OrganizationTypeEnum executorWorkspaceType;
|
||||||
/**
|
/**
|
||||||
* 接收人企业id
|
* 接收人企业id
|
||||||
*/
|
*/
|
||||||
@ -192,6 +201,10 @@ public class PendingMessageDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private MessageDetailStyle detailStyle;
|
private MessageDetailStyle detailStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static PendingMessageDTO from(PendingMessageRecord pendingMessageRecord) {
|
public static PendingMessageDTO from(PendingMessageRecord pendingMessageRecord) {
|
||||||
@ -253,10 +266,12 @@ public class PendingMessageDTO implements Serializable {
|
|||||||
.promoterOuId(promoterOuId)
|
.promoterOuId(promoterOuId)
|
||||||
.promoterWorkspaceId(promoterWorkspaceId)
|
.promoterWorkspaceId(promoterWorkspaceId)
|
||||||
.promoterWorkspaceName(promoterWorkspaceName)
|
.promoterWorkspaceName(promoterWorkspaceName)
|
||||||
|
.promoterWorkspaceType(promoterWorkspaceType)
|
||||||
// 接收者单位、项目信息
|
// 接收者单位、项目信息
|
||||||
.executorOuId(executorOuId)
|
.executorOuId(executorOuId)
|
||||||
.executorWorkspaceId(executorWorkspaceId)
|
.executorWorkspaceId(executorWorkspaceId)
|
||||||
.executorWorkspaceName(executorWorkspaceName)
|
.executorWorkspaceName(executorWorkspaceName)
|
||||||
|
.executorWorkspaceType(executorWorkspaceType)
|
||||||
//页面展示
|
//页面展示
|
||||||
.ouId(this.ouId)
|
.ouId(this.ouId)
|
||||||
.workspaceId(workspaceId)
|
.workspaceId(workspaceId)
|
||||||
@ -266,6 +281,7 @@ public class PendingMessageDTO implements Serializable {
|
|||||||
.isCreatedToday(isCreatedToday)
|
.isCreatedToday(isCreatedToday)
|
||||||
.isRead(isRead)
|
.isRead(isRead)
|
||||||
.todoType(todoType)
|
.todoType(todoType)
|
||||||
|
.customButtons(customButtons)
|
||||||
.templateCategory(templateCategory)
|
.templateCategory(templateCategory)
|
||||||
.identityCode(this.identityCode)
|
.identityCode(this.identityCode)
|
||||||
.templateCode(this.templateCode)
|
.templateCode(this.templateCode)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package cn.axzo.msg.center.message.domain.param;
|
package cn.axzo.msg.center.message.domain.param;
|
||||||
|
|
||||||
import cn.axzo.core.utils.converter.BeanConverter;
|
import cn.axzo.core.utils.converter.BeanConverter;
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.api.request.v3.PendingSendInfo;
|
import cn.axzo.msg.center.api.request.v3.PendingSendInfo;
|
||||||
import cn.axzo.msg.center.service.dto.PersonDTO;
|
import cn.axzo.msg.center.service.dto.PersonDTO;
|
||||||
import cn.axzo.msg.center.service.enums.OrganizationTypeEnum;
|
import cn.axzo.msg.center.service.enums.OrganizationTypeEnum;
|
||||||
@ -16,6 +17,7 @@ import lombok.Setter;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +80,15 @@ public class PendingMessagePushParam extends PendingSendInfo implements Serializ
|
|||||||
*/
|
*/
|
||||||
private String routerParams;
|
private String routerParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
|
|
||||||
|
public List<CustomButton> determineCustomButtons() {
|
||||||
|
return customButtons == null ? Collections.emptyList() : customButtons;
|
||||||
|
}
|
||||||
|
|
||||||
public static PendingMessagePushParam from(PendingMessagePushRequest request) {
|
public static PendingMessagePushParam from(PendingMessagePushRequest request) {
|
||||||
return BeanConverter.convert(request, PendingMessagePushParam.class);
|
return BeanConverter.convert(request, PendingMessagePushParam.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -762,10 +762,12 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
|||||||
pendingMessage.setPromoterOuId(adapter.getPromoterOuId());
|
pendingMessage.setPromoterOuId(adapter.getPromoterOuId());
|
||||||
pendingMessage.setPromoterWorkspaceId(adapter.getPromoterOrgId());
|
pendingMessage.setPromoterWorkspaceId(adapter.getPromoterOrgId());
|
||||||
pendingMessage.setPromoterWorkspaceName(adapter.getPromoterOrgName());
|
pendingMessage.setPromoterWorkspaceName(adapter.getPromoterOrgName());
|
||||||
|
pendingMessage.setPromoterWorkspaceType(adapter.getPromoterOrgType());
|
||||||
// 接收者单位、项目信息
|
// 接收者单位、项目信息
|
||||||
pendingMessage.setExecutorOuId(adapter.getOuId());
|
pendingMessage.setExecutorOuId(adapter.getOuId());
|
||||||
pendingMessage.setExecutorWorkspaceId(adapter.getOrgId());
|
pendingMessage.setExecutorWorkspaceId(adapter.getOrgId());
|
||||||
pendingMessage.setExecutorWorkspaceName(adapter.getOrgName());
|
pendingMessage.setExecutorWorkspaceName(adapter.getOrgName());
|
||||||
|
pendingMessage.setExecutorWorkspaceType(adapter.getExecutorOrgType());
|
||||||
// 兼容页面老逻辑
|
// 兼容页面老逻辑
|
||||||
pendingMessage.setOuId(adapter.getOuId());
|
pendingMessage.setOuId(adapter.getOuId());
|
||||||
pendingMessage.setWorkspaceId(adapter.getPromoterOrgId());
|
pendingMessage.setWorkspaceId(adapter.getPromoterOrgId());
|
||||||
@ -777,6 +779,7 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
|||||||
// 其它信息
|
// 其它信息
|
||||||
pendingMessage.setTodoType(adapter.getTodoType());
|
pendingMessage.setTodoType(adapter.getTodoType());
|
||||||
pendingMessage.setIsRead(adapter.isRead());
|
pendingMessage.setIsRead(adapter.isRead());
|
||||||
|
pendingMessage.setCustomButtons(adapter.getCustomButtons());
|
||||||
|
|
||||||
Map<String, MessageTemplateDTO> templateCode2Template = messageTemplates.stream()
|
Map<String, MessageTemplateDTO> templateCode2Template = messageTemplates.stream()
|
||||||
.collect(toMap(MessageTemplateDTO::getCode, identity()));
|
.collect(toMap(MessageTemplateDTO::getCode, identity()));
|
||||||
@ -837,7 +840,7 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
|||||||
res.setTerminalId(response.getWorkspaceId());
|
res.setTerminalId(response.getWorkspaceId());
|
||||||
res.setTerminalName(response.getWorkspaceName());
|
res.setTerminalName(response.getWorkspaceName());
|
||||||
res.setTerminalType(MsgRecordTerminalTypeEnum.valueOf(response.getOrganizationType().name()));
|
res.setTerminalType(MsgRecordTerminalTypeEnum.valueOf(response.getOrganizationType().name()));
|
||||||
res.setState(MsgStateEnum.getByCode(response.getState().getCode()));
|
res.setState(MsgStateEnum.getByCode(response.getState().getDeprecatedCode()));
|
||||||
res.setMsgTimestamp(DateFormatUtil.toTimestamp(response.getCreateTime()));
|
res.setMsgTimestamp(DateFormatUtil.toTimestamp(response.getCreateTime()));
|
||||||
res.setRouterParam(response.getRouterParam());
|
res.setRouterParam(response.getRouterParam());
|
||||||
buildRouter(res, response.getMsgTemplateRouter(), terminalType);
|
buildRouter(res, response.getMsgTemplateRouter(), terminalType);
|
||||||
|
|||||||
@ -75,8 +75,7 @@ public class TodoRangeQueryService {
|
|||||||
if (CollectionUtils.isEmpty(templateCodes))
|
if (CollectionUtils.isEmpty(templateCodes))
|
||||||
return AnalysisPage.emptyPage(request.getPage(), request.getPageSize());
|
return AnalysisPage.emptyPage(request.getPage(), request.getPageSize());
|
||||||
AnalysisPage<PendingRecordAdapter> pageResult;
|
AnalysisPage<PendingRecordAdapter> pageResult;
|
||||||
if (request.determineToDoType() == TodoType.EXECUTABLE
|
if (request.isQueryBusiness())
|
||||||
&& request.getRoleCategory() == PendingMessageRoleCategoryEnum.PROMOTER)
|
|
||||||
// 我发起的
|
// 我发起的
|
||||||
pageResult = pageQueryBusiness(request, templateCodes);
|
pageResult = pageQueryBusiness(request, templateCodes);
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.message.service.todo;
|
package cn.axzo.msg.center.message.service.todo;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.common.utils.BizAssertions;
|
import cn.axzo.msg.center.common.utils.BizAssertions;
|
||||||
import cn.axzo.msg.center.domain.entity.PendingRecordAdapter;
|
import cn.axzo.msg.center.domain.entity.PendingRecordAdapter;
|
||||||
import cn.axzo.msg.center.domain.entity.PendingRecordExt;
|
import cn.axzo.msg.center.domain.entity.PendingRecordExt;
|
||||||
@ -16,6 +17,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yanglin
|
* @author yanglin
|
||||||
@ -25,13 +27,12 @@ public class TodoRecordAdapter implements PendingRecordAdapter {
|
|||||||
|
|
||||||
private final TodoBusiness business;
|
private final TodoBusiness business;
|
||||||
private final Todo todo;
|
private final Todo todo;
|
||||||
// 查询我发起的待办的时候, 不返回subBizCode, 不然流程那边处理按钮会出现问题(当发起人同时也是执行人时)
|
private final boolean forBusiness;
|
||||||
private final boolean useNullSubBizCode;
|
|
||||||
|
|
||||||
private TodoRecordAdapter(TodoBusiness business, Todo todo, boolean useNullSubBizCode) {
|
private TodoRecordAdapter(TodoBusiness business, Todo todo, boolean forBusiness) {
|
||||||
this.business = business;
|
this.business = business;
|
||||||
this.todo = todo;
|
this.todo = todo;
|
||||||
this.useNullSubBizCode = useNullSubBizCode;
|
this.forBusiness = forBusiness;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TodoRecordAdapter adaptBusiness(TodoBusiness business, Todo todo) {
|
public static TodoRecordAdapter adaptBusiness(TodoBusiness business, Todo todo) {
|
||||||
@ -126,6 +127,11 @@ public class TodoRecordAdapter implements PendingRecordAdapter {
|
|||||||
return business.getOrgType();
|
return business.getOrgType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrganizationTypeEnum getExecutorOrgType() {
|
||||||
|
return todo.getOrgType();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromoterOrgName() {
|
public String getPromoterOrgName() {
|
||||||
return business.getOrgName();
|
return business.getOrgName();
|
||||||
@ -168,7 +174,7 @@ public class TodoRecordAdapter implements PendingRecordAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSubBizCode() {
|
public String getSubBizCode() {
|
||||||
return useNullSubBizCode ? "" : todo.getSubBizCode();
|
return forBusiness ? "" : todo.getSubBizCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -247,4 +253,9 @@ public class TodoRecordAdapter implements PendingRecordAdapter {
|
|||||||
public TodoBusiness getTodoBusiness() {
|
public TodoBusiness getTodoBusiness() {
|
||||||
return business;
|
return business;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CustomButton> getCustomButtons() {
|
||||||
|
return forBusiness ? business.getCustomButtons() : todo.getCustomButtons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,6 +70,7 @@ class TodoRecordBuilder {
|
|||||||
business.setRouterParams(ext.parseRouterExtParams());
|
business.setRouterParams(ext.parseRouterExtParams());
|
||||||
business.setDeadline(request.getDeadline());
|
business.setDeadline(request.getDeadline());
|
||||||
business.setBizFinalState(null);
|
business.setBizFinalState(null);
|
||||||
|
business.setCustomButtons(request.determineCustomButtons());
|
||||||
return business;
|
return business;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +111,7 @@ class TodoRecordBuilder {
|
|||||||
: PendingMessageStateEnum.HAS_BEEN_SENT);
|
: PendingMessageStateEnum.HAS_BEEN_SENT);
|
||||||
todo.setExecutorId(executor.identityIdOrDefault());
|
todo.setExecutorId(executor.identityIdOrDefault());
|
||||||
todo.setExecutorType(executor.identityTypeOrDefault());
|
todo.setExecutorType(executor.identityTypeOrDefault());
|
||||||
|
todo.setCustomButtons(request.determineCustomButtons());
|
||||||
}
|
}
|
||||||
return todos;
|
return todos;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.axzo.msg.center.api.custombutton;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*
|
||||||
|
* @author yanglin
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomButton {
|
||||||
|
/**
|
||||||
|
* 自定义按钮的key
|
||||||
|
*/
|
||||||
|
private String buttonKey;
|
||||||
|
/**
|
||||||
|
* 自定义按钮的名称
|
||||||
|
*/
|
||||||
|
private String buttonName;
|
||||||
|
/**
|
||||||
|
* 自定义按钮配置
|
||||||
|
*/
|
||||||
|
private List<CustomButtonConfig> configs;
|
||||||
|
|
||||||
|
public List<CustomButtonConfig> determineConfigs() {
|
||||||
|
return configs == null ? Collections.emptyList() : configs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建按钮
|
||||||
|
*/
|
||||||
|
public static CustomButton createButton(String buttonKey, CustomButtonConfig... configs) {
|
||||||
|
CustomButton customButton = new CustomButton();
|
||||||
|
customButton.setButtonKey(buttonKey);
|
||||||
|
customButton.setConfigs(configs == null ? Collections.emptyList() : Arrays.asList(configs));
|
||||||
|
return customButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建按钮
|
||||||
|
*/
|
||||||
|
public static CustomButton createButton(String buttonKey, List<CustomButtonConfig> configs) {
|
||||||
|
CustomButton customButton = new CustomButton();
|
||||||
|
customButton.setButtonKey(buttonKey);
|
||||||
|
customButton.setConfigs(configs);
|
||||||
|
return customButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
package cn.axzo.msg.center.api.custombutton;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.enums.TodoActorType;
|
||||||
|
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
||||||
|
import cn.axzo.msg.center.service.enums.CodeDefinition;
|
||||||
|
import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.toSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮配置
|
||||||
|
*
|
||||||
|
* @author yanglin
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomButtonConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适用的按钮的角色
|
||||||
|
*/
|
||||||
|
private TodoActorType actorType;
|
||||||
|
/**
|
||||||
|
* 按钮可见的状态. 没有传则忽略状态, 都可见
|
||||||
|
*/
|
||||||
|
private Set<String> visibleStates;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建对待办发起人总是可见的按钮, 忽略业务最终状态
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig alwaysVisibleForPromoter() {
|
||||||
|
return visibleForPromoterAndBizStates(Collections.emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建对待办发起人总是可见的按钮, 忽略待办状态
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig alwaysVisibleForExecutor() {
|
||||||
|
return visibleForExecutorAndStates(Collections.emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建待办发起者按钮. 根据状态来控制可见性
|
||||||
|
*
|
||||||
|
* @param visibleBizFinalStates 按钮可见的状态. 为空则忽略状态, 都可见
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig visibleForPromoterAndBizStates(BizFinalStateEnum... visibleBizFinalStates) {
|
||||||
|
BizFinalStateEnum[] states = visibleBizFinalStates;
|
||||||
|
if (states == null)
|
||||||
|
states = new BizFinalStateEnum[0];
|
||||||
|
return visibleForPromoterAndBizStates(Arrays.asList(states));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建待办执行者按钮. 根据状态来控制可见性
|
||||||
|
*
|
||||||
|
* @param visibleTodoStates 按钮可见的状态. 为空则忽略状态, 都可见
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig visibleForExecutorAndStates(PendingMessageStateEnum... visibleTodoStates) {
|
||||||
|
PendingMessageStateEnum[] states = visibleTodoStates;
|
||||||
|
if (states == null)
|
||||||
|
states = new PendingMessageStateEnum[0];
|
||||||
|
return visibleForExecutorAndStates(Arrays.asList(states));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建待办发起者按钮. 根据状态来控制可见性
|
||||||
|
*
|
||||||
|
* @param visibleBizFinalStates 按钮可见的状态. 为空则忽略状态, 都可见
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig visibleForPromoterAndBizStates(List<BizFinalStateEnum> visibleBizFinalStates) {
|
||||||
|
CustomButtonConfig customButtonConfig = new CustomButtonConfig();
|
||||||
|
customButtonConfig.setActorType(TodoActorType.TODO_PROMOTER);
|
||||||
|
if (visibleBizFinalStates != null) {
|
||||||
|
Set<String> visibleStates = visibleBizFinalStates.stream()
|
||||||
|
.map(Enum::name)
|
||||||
|
.collect(toSet());
|
||||||
|
customButtonConfig.setVisibleStates(visibleStates);
|
||||||
|
}
|
||||||
|
return customButtonConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建待办执行者按钮. 根据状态来控制可见性
|
||||||
|
*
|
||||||
|
* @param visibleTodoStates 按钮可见的状态. 为空则忽略状态, 都可见
|
||||||
|
*/
|
||||||
|
public static CustomButtonConfig visibleForExecutorAndStates(List<PendingMessageStateEnum> visibleTodoStates) {
|
||||||
|
CustomButtonConfig customButtonConfig = new CustomButtonConfig();
|
||||||
|
customButtonConfig.setActorType(TodoActorType.TODO_EXECUTOR);
|
||||||
|
if (visibleTodoStates != null) {
|
||||||
|
Set<String> visibleStates = visibleTodoStates.stream()
|
||||||
|
.map(Enum::name)
|
||||||
|
.collect(toSet());
|
||||||
|
customButtonConfig.setVisibleStates(visibleStates);
|
||||||
|
}
|
||||||
|
return customButtonConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断待办发起者按钮是否可见
|
||||||
|
*/
|
||||||
|
public boolean isVisible(BizFinalStateEnum state) {
|
||||||
|
// 没有指定状态, 一直可见
|
||||||
|
if (CollectionUtils.isEmpty(visibleStates))
|
||||||
|
return true;
|
||||||
|
return visibleStates.stream()
|
||||||
|
.map(code -> CodeDefinition.findByCode(BizFinalStateEnum.class, code))
|
||||||
|
.filter(Optional::isPresent)
|
||||||
|
.map(Optional::get)
|
||||||
|
.anyMatch(s -> s == state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断待办执行者按钮是否可见
|
||||||
|
*/
|
||||||
|
public boolean isVisible(PendingMessageStateEnum state) {
|
||||||
|
// 没有指定状态, 一直可见
|
||||||
|
if (CollectionUtils.isEmpty(visibleStates))
|
||||||
|
return true;
|
||||||
|
return visibleStates.stream()
|
||||||
|
.map(code -> CodeDefinition.findByCode(PendingMessageStateEnum.class, code))
|
||||||
|
.filter(Optional::isPresent)
|
||||||
|
.map(Optional::get)
|
||||||
|
.anyMatch(s -> s == state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package cn.axzo.msg.center.api.custombutton;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.service.dto.ButtonRouterDTO;
|
||||||
|
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
||||||
|
import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
||||||
|
import cn.axzo.msg.center.service.enums.RouterButtonSourceEnum;
|
||||||
|
import cn.axzo.msg.center.service.pending.response.PendingMessageResponse;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.toList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yanglin
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CustomButtonFilter {
|
||||||
|
|
||||||
|
public static void adjustButtonRouters(PendingMessageResponse response, boolean forPromoter) {
|
||||||
|
// 非流程的待办按钮保持不变
|
||||||
|
if (response.getBizCategory() == BizCategoryEnum.FLOW)
|
||||||
|
response.setButtonRouters(filterFlowCustomButtons(response, forPromoter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ButtonRouterDTO> filterFlowCustomButtons(PendingMessageResponse response, boolean forPromoter) {
|
||||||
|
Function<String, CustomButton> findCustomBtnFun = btnKey -> {
|
||||||
|
if(CollectionUtils.isEmpty(response.getCustomButtons()))
|
||||||
|
return null;
|
||||||
|
return response.getCustomButtons().stream()
|
||||||
|
.filter(i -> btnKey.equals(i.getButtonKey()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
};
|
||||||
|
Function<ButtonRouterDTO, Boolean> filterCustomBtnFun = btn -> {
|
||||||
|
// 已完成就不显示了
|
||||||
|
if (response.getState() != PendingMessageStateEnum.HAS_BEEN_SENT)
|
||||||
|
return false;
|
||||||
|
// 没有配置可见的自定义的按钮
|
||||||
|
// 这个判断不能放到整个方法的里面调用, 因为涉及到自定义的按钮
|
||||||
|
if(CollectionUtils.isEmpty(response.getCustomButtons()))
|
||||||
|
return false;
|
||||||
|
CustomButton customBtn = findCustomBtnFun.apply(btn.getKey());
|
||||||
|
if (customBtn == null || CollectionUtils.isEmpty(customBtn.getConfigs()))
|
||||||
|
return false;
|
||||||
|
return customBtn.getConfigs().stream()
|
||||||
|
.anyMatch(c -> forPromoter
|
||||||
|
? c.isVisible(response.getBizFinalState())
|
||||||
|
: c.isVisible(response.getState()));
|
||||||
|
};
|
||||||
|
return response.getButtonRouters().stream()
|
||||||
|
.filter(btn -> {
|
||||||
|
CustomButton customBtn = findCustomBtnFun.apply(btn.getKey());
|
||||||
|
boolean isNormalTodoCustomBtn = customBtn == null && btn.getSource() == RouterButtonSourceEnum.CUSTOM;
|
||||||
|
return isNormalTodoCustomBtn || filterCustomBtnFun.apply(btn);
|
||||||
|
})
|
||||||
|
.collect(toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package cn.axzo.msg.center.api.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yanglin
|
||||||
|
*/
|
||||||
|
public enum TodoActorType {
|
||||||
|
/**
|
||||||
|
* 待办发起者
|
||||||
|
*/
|
||||||
|
TODO_PROMOTER,
|
||||||
|
/**
|
||||||
|
* 待办执行者或抄送者
|
||||||
|
*/
|
||||||
|
TODO_EXECUTOR
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.api.response.v3;
|
package cn.axzo.msg.center.api.response.v3;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
||||||
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
||||||
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
||||||
@ -12,6 +13,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yanglin
|
* @author yanglin
|
||||||
@ -162,4 +164,9 @@ public class SearchPendingMessageResp {
|
|||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateAt;
|
private Date updateAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public enum BizFinalStateEnum {
|
public enum BizFinalStateEnum implements CodeDefinition<String> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 已处理
|
* 已处理
|
||||||
@ -38,4 +38,9 @@ public enum BizFinalStateEnum {
|
|||||||
ABORTED("https://axzo-public.oss-cn-chengdu.aliyuncs.com/%E5%8D%B0%E7%AB%A0-%E8%AF%A6%E6%83%85end.png");
|
ABORTED("https://axzo-public.oss-cn-chengdu.aliyuncs.com/%E5%8D%B0%E7%AB%A0-%E8%AF%A6%E6%83%85end.png");
|
||||||
|
|
||||||
private final String icon;
|
private final String icon;
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String getCode() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
package cn.axzo.msg.center.service.enums;
|
package cn.axzo.msg.center.service.enums;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yanglin
|
* @author yanglin
|
||||||
*/
|
*/
|
||||||
@ -17,4 +19,15 @@ public interface CodeDefinition<T> {
|
|||||||
return code.equals(this.getCode());
|
return code.equals(this.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
static <T, E extends Enum<E> & CodeDefinition<T>>
|
||||||
|
Optional<E> findByCode(Class<E> enumType, T code) {
|
||||||
|
if (code == null)
|
||||||
|
return Optional.empty();
|
||||||
|
for (E e : enumType.getEnumConstants()) {
|
||||||
|
if (e.getCode().equals(code))
|
||||||
|
return Optional.of(e);
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,8 +4,6 @@ import lombok.AccessLevel;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作台类型
|
* 工作台类型
|
||||||
* @description
|
* @description
|
||||||
@ -19,6 +17,7 @@ import java.util.Arrays;
|
|||||||
public enum OrganizationTypeEnum {
|
public enum OrganizationTypeEnum {
|
||||||
ENT(2, "企业"),
|
ENT(2, "企业"),
|
||||||
PROJECT(1, "项目"),
|
PROJECT(1, "项目"),
|
||||||
|
OMS(6, "oms工作台"),
|
||||||
UNKNOWN(0, "未知");
|
UNKNOWN(0, "未知");
|
||||||
|
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public enum PendingMessageStateEnum {
|
public enum PendingMessageStateEnum implements CodeDefinition<String> {
|
||||||
|
|
||||||
CREATED(0, "创建"),
|
CREATED(0, "创建"),
|
||||||
UNSENT(1, "未发送"),
|
UNSENT(1, "未发送"),
|
||||||
@ -27,13 +27,18 @@ public enum PendingMessageStateEnum {
|
|||||||
READ(8, "已读"),
|
READ(8, "已读"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final Integer code;
|
private final Integer deprecatedCode;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|
||||||
public static PendingMessageStateEnum codeOf(Integer code) {
|
public static PendingMessageStateEnum codeOf(Integer code) {
|
||||||
return Arrays.stream(values())
|
return Arrays.stream(values())
|
||||||
.filter(e -> Objects.equals(e.code, code))
|
.filter(e -> Objects.equals(e.deprecatedCode, code))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(HAS_BEEN_SENT);
|
.orElse(HAS_BEEN_SENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCode() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,6 +178,11 @@ public class PendingMessagePageRequest extends PageRequest implements Serializab
|
|||||||
return CollectionUtils.isNotEmpty(orderFields);
|
return CollectionUtils.isNotEmpty(orderFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isQueryBusiness() {
|
||||||
|
return determineToDoType() == TodoType.EXECUTABLE
|
||||||
|
&& getRoleCategory() == PendingMessageRoleCategoryEnum.PROMOTER;
|
||||||
|
}
|
||||||
|
|
||||||
public TodoType determineToDoType() {
|
public TodoType determineToDoType() {
|
||||||
return todoType == null ? TodoType.EXECUTABLE : todoType;
|
return todoType == null ? TodoType.EXECUTABLE : todoType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package cn.axzo.msg.center.service.pending.response;
|
package cn.axzo.msg.center.service.pending.response;
|
||||||
|
|
||||||
|
import cn.axzo.basics.common.util.AssertUtil;
|
||||||
import cn.azxo.framework.common.model.Page;
|
import cn.azxo.framework.common.model.Page;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
@ -61,6 +63,16 @@ public class AnalysisPage<T> extends Page<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAnalysis(String key, Object... fields) {
|
||||||
|
if (!enableAnalysis) return;
|
||||||
|
AssertUtil.notNull(fields, "Fields can't be null");
|
||||||
|
AssertUtil.isTrue(fields.length % 2 == 0, "The length of fields must be an integer multiple of 2");
|
||||||
|
Map<String, Object> fieldsObj = new HashMap<>();
|
||||||
|
for (int i = 0; i < fields.length; i += 2)
|
||||||
|
fieldsObj.put(String.valueOf(fields[i]), fields[i + 1]);
|
||||||
|
addAnalysis(key, fieldsObj);
|
||||||
|
}
|
||||||
|
|
||||||
public void setAnalysis(TreeMap<String, Object> analysis) {
|
public void setAnalysis(TreeMap<String, Object> analysis) {
|
||||||
this.analysis = analysis;
|
this.analysis = analysis;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.service.pending.response;
|
package cn.axzo.msg.center.service.pending.response;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.service.dto.ButtonRouterDTO;
|
import cn.axzo.msg.center.service.dto.ButtonRouterDTO;
|
||||||
import cn.axzo.msg.center.service.dto.DetailRouterDTO;
|
import cn.axzo.msg.center.service.dto.DetailRouterDTO;
|
||||||
import cn.axzo.msg.center.service.dto.IdentityDTO;
|
import cn.axzo.msg.center.service.dto.IdentityDTO;
|
||||||
@ -7,12 +8,17 @@ import cn.axzo.msg.center.service.dto.MessageCardContentItemDTO;
|
|||||||
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
||||||
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
||||||
import cn.axzo.msg.center.service.enums.MessageCategoryEnum;
|
import cn.axzo.msg.center.service.enums.MessageCategoryEnum;
|
||||||
|
import cn.axzo.msg.center.service.enums.OrganizationTypeEnum;
|
||||||
import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
||||||
import cn.axzo.msg.center.service.enums.TodoQueryType;
|
import cn.axzo.msg.center.service.enums.TodoQueryType;
|
||||||
import cn.axzo.msg.center.service.enums.TodoType;
|
import cn.axzo.msg.center.service.enums.TodoType;
|
||||||
import cn.axzo.msg.center.service.template.response.MessageDetailStyle;
|
import cn.axzo.msg.center.service.template.response.MessageDetailStyle;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.*;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -120,6 +126,10 @@ public class PendingMessageResponse implements Serializable {
|
|||||||
* 发起人工作台名称
|
* 发起人工作台名称
|
||||||
*/
|
*/
|
||||||
private String promoterWorkspaceName;
|
private String promoterWorkspaceName;
|
||||||
|
/**
|
||||||
|
* 发起人企业类型
|
||||||
|
*/
|
||||||
|
private OrganizationTypeEnum promoterWorkspaceType;
|
||||||
/**
|
/**
|
||||||
* 发起人企业id
|
* 发起人企业id
|
||||||
*/
|
*/
|
||||||
@ -132,6 +142,10 @@ public class PendingMessageResponse implements Serializable {
|
|||||||
* 接收人工作台名称
|
* 接收人工作台名称
|
||||||
*/
|
*/
|
||||||
private String executorWorkspaceName;
|
private String executorWorkspaceName;
|
||||||
|
/**
|
||||||
|
* 执行人企业类型
|
||||||
|
*/
|
||||||
|
private OrganizationTypeEnum executorWorkspaceType;
|
||||||
/**
|
/**
|
||||||
* 接收人企业id
|
* 接收人企业id
|
||||||
*/
|
*/
|
||||||
@ -210,8 +224,14 @@ public class PendingMessageResponse implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private TodoQueryType queryType;
|
private TodoQueryType queryType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JSON.toJSONString(this);
|
return JSON.toJSONString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.domain.entity;
|
package cn.axzo.msg.center.domain.entity;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
||||||
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
import cn.axzo.msg.center.service.enums.BizFinalStateEnum;
|
||||||
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
||||||
@ -8,7 +9,9 @@ import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
|||||||
import cn.axzo.msg.center.service.enums.TodoType;
|
import cn.axzo.msg.center.service.enums.TodoType;
|
||||||
import cn.axzo.msg.center.service.enums.YesOrNo;
|
import cn.axzo.msg.center.service.enums.YesOrNo;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 尽可能地使用已经存在的方法, 减少工作量
|
* 尽可能地使用已经存在的方法, 减少工作量
|
||||||
@ -99,6 +102,10 @@ public interface PendingRecordAdapter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default OrganizationTypeEnum getExecutorOrgType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
default String getPromoterOrgName() {
|
default String getPromoterOrgName() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -114,4 +121,8 @@ public interface PendingRecordAdapter {
|
|||||||
default TodoBusiness getTodoBusiness() {
|
default TodoBusiness getTodoBusiness() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<CustomButton> getCustomButtons() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.domain.entity;
|
package cn.axzo.msg.center.domain.entity;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
||||||
import cn.axzo.msg.center.domain.utils.IgnorePropsJsonTypeHandler;
|
import cn.axzo.msg.center.domain.utils.IgnorePropsJsonTypeHandler;
|
||||||
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
|
||||||
@ -15,6 +16,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yanglin
|
* @author yanglin
|
||||||
@ -152,6 +154,12 @@ public class Todo extends BaseEntityExt<Todo> {
|
|||||||
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
||||||
private PendingRecordExt recordExt = new PendingRecordExt();
|
private PendingRecordExt recordExt = new PendingRecordExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
|
|
||||||
// !! helper
|
// !! helper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.domain.entity;
|
package cn.axzo.msg.center.domain.entity;
|
||||||
|
|
||||||
|
import cn.axzo.msg.center.api.custombutton.CustomButton;
|
||||||
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
||||||
import cn.axzo.msg.center.domain.utils.IgnorePropsJsonTypeHandler;
|
import cn.axzo.msg.center.domain.utils.IgnorePropsJsonTypeHandler;
|
||||||
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
import cn.axzo.msg.center.service.enums.BizCategoryEnum;
|
||||||
@ -14,6 +15,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yanglin
|
* @author yanglin
|
||||||
@ -125,6 +127,12 @@ public class TodoBusiness extends BaseEntityExt<TodoBusiness> {
|
|||||||
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
||||||
private TodoBusinessExt recordExt = new TodoBusinessExt();
|
private TodoBusinessExt recordExt = new TodoBusinessExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义按钮
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = IgnorePropsJsonTypeHandler.class)
|
||||||
|
private List<CustomButton> customButtons;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JSON.toJSONString(this);
|
return JSON.toJSONString(this);
|
||||||
|
|||||||
@ -23,14 +23,12 @@ public class IgnorePropsJsonTypeHandler extends AbstractJsonTypeHandler<Object>
|
|||||||
@Override
|
@Override
|
||||||
protected Object parse(String json) {
|
protected Object parse(String json) {
|
||||||
if (StringUtils.isBlank(json))
|
if (StringUtils.isBlank(json))
|
||||||
return JSON.parseObject("{}", type);
|
return null;
|
||||||
return JSON.parseObject(json, type);
|
return JSON.parseObject(json, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String toJson(Object obj) {
|
protected String toJson(Object obj) {
|
||||||
if (obj == null)
|
|
||||||
return "{}";
|
|
||||||
return JSON.toJSONString(obj);
|
return JSON.toJSONString(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,14 @@ import cn.axzo.msg.center.notices.integration.dto.response.SendSmsCommonResponse
|
|||||||
import cn.azxo.framework.common.utils.LogUtil;
|
import cn.azxo.framework.common.utils.LogUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.aliyun.dysmsapi20170525.Client;
|
import com.aliyun.dysmsapi20170525.Client;
|
||||||
import com.aliyun.dysmsapi20170525.models.*;
|
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsRequest;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponse;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponseBody;
|
||||||
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponseBody.QuerySendDetailsResponseBodySmsSendDetailDTOs;
|
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponseBody.QuerySendDetailsResponseBodySmsSendDetailDTOs;
|
||||||
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponseBody.QuerySendDetailsResponseBodySmsSendDetailDTOsSmsSendDetailDTO;
|
import com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponseBody.QuerySendDetailsResponseBodySmsSendDetailDTOsSmsSendDetailDTO;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
|
||||||
import com.aliyun.teautil.models.RuntimeOptions;
|
import com.aliyun.teautil.models.RuntimeOptions;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@ -140,7 +145,13 @@ public class AliYunSmsClientImpl implements AliYunSmsClient {
|
|||||||
ServiceContextHolder.get().setChannelResponse(response);
|
ServiceContextHolder.get().setChannelResponse(response);
|
||||||
|
|
||||||
// 检查响应
|
// 检查响应
|
||||||
SendSmsResponseBody responseBody = checkSendResponse(response);
|
SendSmsResponseBody responseBody;
|
||||||
|
try {
|
||||||
|
responseBody = checkSendResponse(response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("send sms via aliyun fail, request={}", request, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// 响应转换
|
// 响应转换
|
||||||
SendSmsCommonResponse smsResponse = new SendSmsCommonResponse();
|
SendSmsCommonResponse smsResponse = new SendSmsCommonResponse();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.msg.center.notices.integration.dto.request;
|
package cn.axzo.msg.center.notices.integration.dto.request;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@ -31,4 +32,9 @@ public class SendSmsCommonRequest {
|
|||||||
/** 渠道请求号 */
|
/** 渠道请求号 */
|
||||||
private String requestChannelNo;
|
private String requestChannelNo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return JSON.toJSONString(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user