V2.4.0 发布~
This commit is contained in:
parent
16a71c1a7b
commit
da0a20477c
@ -1,16 +0,0 @@
|
|||||||
### 请求 /bpm/process-instance/get-bpmn 接口 => 成功
|
|
||||||
GET {{baseUrl}}/bpm/process-instance/get-bpmn-model-view?id=1d5fb5a6-85f8-11ef-b717-7e93075f94e3
|
|
||||||
Content-Type: application/json
|
|
||||||
tenant-id: 1
|
|
||||||
Authorization: Bearer {{token}}
|
|
||||||
|
|
||||||
### 请求 /bpm/process-instance/get-bpmn 接口 => 失败
|
|
||||||
#GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processInstanceId=1d5fb5a6-85f8-11ef-b717-7e93075f94e3
|
|
||||||
#GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processInstanceId=3ee5c5ba-904a-11ef-a76e-b2ed5d6ef911
|
|
||||||
#GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processInstanceId=f630dfa2-8f92-11ef-947c-ba5e239a6eb4
|
|
||||||
#GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processInstanceId=9de8bdbf-9133-11ef-ae97-eaf49df1f932
|
|
||||||
#GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processInstanceId=dd2188eb-9394-11ef-a039-7a9ac3d9eb6b
|
|
||||||
GET {{baseUrl}}/bpm/process-instance/get-approval-detail?processDefinitionId=test-auto:1:c70a799a-9394-11ef-a039-7a9ac3d9eb6b
|
|
||||||
Content-Type: application/json
|
|
||||||
tenant-id: 1
|
|
||||||
Authorization: Bearer {{token}}
|
|
@ -1,43 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 流程示例的 BPMN 视图 Response VO")
|
|
||||||
@Data
|
|
||||||
public class BpmProcessInstanceBpmnModelViewRespVO {
|
|
||||||
|
|
||||||
// ========== 基本信息 ==========
|
|
||||||
|
|
||||||
@Schema(description = "流程实例信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private BpmProcessInstanceRespVO processInstance;
|
|
||||||
|
|
||||||
@Schema(description = "任务列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private List<BpmTaskRespVO> tasks;
|
|
||||||
|
|
||||||
@Schema(description = "BPMN XML", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private String bpmnXml;
|
|
||||||
|
|
||||||
@Schema(description = "SIMPLE 模型")
|
|
||||||
private BpmSimpleModelNodeVO simpleModel;
|
|
||||||
|
|
||||||
// ========== 进度信息 ==========
|
|
||||||
|
|
||||||
@Schema(description = "进行中的活动节点编号集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Set<String> unfinishedTaskActivityIds; // 只包括 UserTask
|
|
||||||
|
|
||||||
@Schema(description = "已经完成的活动节点编号集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Set<String> finishedTaskActivityIds; // 包括 UserTask、Gateway 等,不包括 SequenceFlow
|
|
||||||
|
|
||||||
@Schema(description = "已经完成的连线节点编号集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Set<String> finishedSequenceFlowActivityIds; // 只包括 SequenceFlow
|
|
||||||
|
|
||||||
@Schema(description = "已经拒绝的活动节点编号集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Set<String> rejectedTaskActivityIds; // 只包括 UserTask
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 抄送流程任务的 Request VO")
|
|
||||||
@Data
|
|
||||||
public class BpmTaskCopyReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
|
||||||
@NotEmpty(message = "任务编号不能为空")
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Schema(description = "抄送的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2]")
|
|
||||||
@NotEmpty(message = "抄送用户不能为空")
|
|
||||||
private Collection<Long> copyUserIds;
|
|
||||||
|
|
||||||
@Schema(description = "抄送意见", example = "帮忙看看!")
|
|
||||||
private String reason;
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.form;
|
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept.AbstractBpmTaskCandidateDeptLeaderStrategy;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表单内部门负责人 {@link BpmTaskCandidateStrategy} 实现类
|
|
||||||
*
|
|
||||||
* @author jason
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class BpmTaskCandidateFormDeptLeaderStrategy extends AbstractBpmTaskCandidateDeptLeaderStrategy {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BpmTaskCandidateStrategyEnum getStrategy() {
|
|
||||||
return BpmTaskCandidateStrategyEnum.FORM_DEPT_LEADER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validateParam(String param) {
|
|
||||||
// 参数格式: | 分隔:1)左边为表单内部门字段。2)右边为部门层级
|
|
||||||
String[] params = param.split("\\|");
|
|
||||||
Assert.isTrue(params.length == 2, "参数格式不匹配");
|
|
||||||
Assert.notEmpty(param, "表单内部门字段不能为空");
|
|
||||||
int level = Integer.parseInt(params[1]);
|
|
||||||
Assert.isTrue(level > 0, "部门层级必须大于 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
|
|
||||||
String[] params = param.split("\\|");
|
|
||||||
Object result = execution.getVariable(params[0]);
|
|
||||||
int level = Integer.parseInt(params[1]);
|
|
||||||
return super.getMultiLevelDeptLeaderIds(Convert.toList(Long.class, result), level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
|
|
||||||
String param, Long startUserId, String processDefinitionId,
|
|
||||||
Map<String, Object> processVariables) {
|
|
||||||
String[] params = param.split("\\|");
|
|
||||||
Object result = processVariables == null ? null : processVariables.get(params[0]);
|
|
||||||
int level = Integer.parseInt(params[1]);
|
|
||||||
return super.getMultiLevelDeptLeaderIds(Convert.toList(Long.class, result), level);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.form;
|
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表单内用户字段 {@link BpmTaskCandidateUserStrategy} 实现类
|
|
||||||
*
|
|
||||||
* @author jason
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class BpmTaskCandidateFormUserStrategy implements BpmTaskCandidateStrategy {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BpmTaskCandidateStrategyEnum getStrategy() {
|
|
||||||
return BpmTaskCandidateStrategyEnum.FORM_USER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validateParam(String param) {
|
|
||||||
Assert.notEmpty(param, "表单内用户字段不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
|
|
||||||
Object result = execution.getVariable(param);
|
|
||||||
return Convert.toSet(Long.class, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
|
|
||||||
String param, Long startUserId, String processDefinitionId,
|
|
||||||
Map<String, Object> processVariables) {
|
|
||||||
Object result = processVariables == null ? null : processVariables.get(param);
|
|
||||||
return Convert.toSet(Long.class, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.other;
|
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
|
||||||
import org.flowable.common.engine.api.FlowableException;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表达式 {@link BpmTaskCandidateStrategy} 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class BpmTaskCandidateExpressionStrategy implements BpmTaskCandidateStrategy {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BpmTaskCandidateStrategyEnum getStrategy() {
|
|
||||||
return BpmTaskCandidateStrategyEnum.EXPRESSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validateParam(String param) {
|
|
||||||
// do nothing 因为它基本做不了校验
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
|
|
||||||
Object result = FlowableUtils.getExpressionValue(execution, param);
|
|
||||||
return Convert.toSet(Long.class, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, String param,
|
|
||||||
Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
|
|
||||||
Map<String, Object> variables = processVariables == null ? new HashMap<>() : processVariables;
|
|
||||||
try {
|
|
||||||
Object result = FlowableUtils.getExpressionValue(variables, param);
|
|
||||||
return Convert.toSet(Long.class, result);
|
|
||||||
} catch (FlowableException ex) {
|
|
||||||
// 预测未运行的节点时候,表达式如果包含 execution 或者不存在的流程变量会抛异常,
|
|
||||||
log.warn("[calculateUsersByActivity][表达式({}) 变量({}) 解析报错", param, variables, ex);
|
|
||||||
// 不能预测候选人,返回空列表, 避免流程无法进行
|
|
||||||
return Sets.newHashSet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
||||||
import org.assertj.core.util.Sets;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateDeptLeaderMultiStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateDeptLeaderMultiStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private DeptApi deptApi;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsers() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "10,20|2";
|
|
||||||
// mock 方法
|
|
||||||
when(deptApi.getDept(any())).thenAnswer((Answer<DeptRespDTO>) invocationOnMock -> {
|
|
||||||
Long deptId = invocationOnMock.getArgument(0);
|
|
||||||
return randomPojo(DeptRespDTO.class, o -> o.setId(deptId).setParentId(deptId * 100).setLeaderUserId(deptId + 1));
|
|
||||||
});
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsers(param);
|
|
||||||
// 断言结果
|
|
||||||
assertEquals(Sets.newLinkedHashSet(11L, 1001L, 21L, 2001L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
||||||
import org.assertj.core.util.Sets;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateStartUserDeptLeaderMultiStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateStartUserDeptLeaderMultiStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private BpmProcessInstanceService processInstanceService;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private AdminUserApi adminUserApi;
|
|
||||||
@Mock
|
|
||||||
private DeptApi deptApi;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByTask() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法(获得流程发起人)
|
|
||||||
Long startUserId = 1L;
|
|
||||||
ProcessInstance processInstance = mock(ProcessInstance.class);
|
|
||||||
DelegateExecution execution = mock(DelegateExecution.class);
|
|
||||||
when(processInstanceService.getProcessInstance(eq(execution.getProcessInstanceId()))).thenReturn(processInstance);
|
|
||||||
when(processInstance.getStartUserId()).thenReturn(startUserId.toString());
|
|
||||||
// mock 方法(获取发起人的 multi 部门负责人)
|
|
||||||
mockGetStartUserDept(startUserId);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByTask(execution, param);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(11L, 1001L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByActivity() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法
|
|
||||||
Long startUserId = 1L;
|
|
||||||
mockGetStartUserDept(startUserId);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByActivity(null, null, param,
|
|
||||||
startUserId, null, null);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(11L, 1001L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mockGetStartUserDept(Long startUserId) {
|
|
||||||
when(adminUserApi.getUser(eq(startUserId))).thenReturn(
|
|
||||||
randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptId(10L)));
|
|
||||||
when(deptApi.getDept(any())).thenAnswer((Answer<DeptRespDTO>) invocationOnMock -> {
|
|
||||||
Long deptId = invocationOnMock.getArgument(0);
|
|
||||||
return randomPojo(DeptRespDTO.class, o -> o.setId(deptId).setParentId(deptId * 100).setLeaderUserId(deptId + 1));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
||||||
import org.assertj.core.util.Sets;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateStartUserDeptLeaderStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateStartUserDeptLeaderStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private BpmProcessInstanceService processInstanceService;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private AdminUserApi adminUserApi;
|
|
||||||
@Mock
|
|
||||||
private DeptApi deptApi;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByTask() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法(获得流程发起人)
|
|
||||||
Long startUserId = 1L;
|
|
||||||
ProcessInstance processInstance = mock(ProcessInstance.class);
|
|
||||||
DelegateExecution execution = mock(DelegateExecution.class);
|
|
||||||
when(processInstanceService.getProcessInstance(eq(execution.getProcessInstanceId()))).thenReturn(processInstance);
|
|
||||||
when(processInstance.getStartUserId()).thenReturn(startUserId.toString());
|
|
||||||
// mock 方法(获取发起人的部门负责人)
|
|
||||||
mockGetStartUserDeptLeader(startUserId);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByTask(execution, param);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(1001L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetStartUserDeptLeader() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法
|
|
||||||
Long startUserId = 1L;
|
|
||||||
mockGetStartUserDeptLeader(startUserId);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByActivity(null, null, param,
|
|
||||||
startUserId, null, null);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(1001L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mockGetStartUserDeptLeader(Long startUserId) {
|
|
||||||
when(adminUserApi.getUser(eq(startUserId))).thenReturn(
|
|
||||||
randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptId(10L)));
|
|
||||||
when(deptApi.getDept(any())).thenAnswer((Answer<DeptRespDTO>) invocationOnMock -> {
|
|
||||||
Long deptId = invocationOnMock.getArgument(0);
|
|
||||||
return randomPojo(DeptRespDTO.class, o -> o.setId(deptId).setParentId(deptId * 100).setLeaderUserId(deptId + 1));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
|
||||||
import org.assertj.core.util.Sets;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateStartUserSelectStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateStartUserSelectStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private BpmProcessInstanceService processInstanceService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByTask() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法(获得流程发起人)
|
|
||||||
ProcessInstance processInstance = mock(ProcessInstance.class);
|
|
||||||
DelegateExecution execution = mock(DelegateExecution.class);
|
|
||||||
when(processInstanceService.getProcessInstance(eq(execution.getProcessInstanceId()))).thenReturn(processInstance);
|
|
||||||
when(execution.getCurrentActivityId()).thenReturn("activity_001");
|
|
||||||
// mock 方法(FlowableUtils)
|
|
||||||
Map<String, Object> processVariables = new HashMap<>();
|
|
||||||
processVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
|
|
||||||
MapUtil.of("activity_001", ListUtil.of(1L, 2L)));
|
|
||||||
when(processInstance.getProcessVariables()).thenReturn(processVariables);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByTask(execution, param);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(1L, 2L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByActivity() {
|
|
||||||
// 准备参数
|
|
||||||
String activityId = "activity_001";
|
|
||||||
Map<String, Object> processVariables = new HashMap<>();
|
|
||||||
processVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
|
|
||||||
MapUtil.of("activity_001", ListUtil.of(1L, 2L)));
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByActivity(null, activityId, null,
|
|
||||||
null, null, processVariables);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(1L, 2L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.other;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
|
||||||
import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskAssignEmptyHandlerTypeEnum;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
|
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
|
||||||
import org.flowable.bpmn.model.FlowElement;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.MockedStatic;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateAssignEmptyStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateAssignEmptyStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private BpmProcessDefinitionService processDefinitionService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByTask() {
|
|
||||||
try (MockedStatic<FlowableUtils> flowableUtilMockedStatic = mockStatic(FlowableUtils.class);
|
|
||||||
MockedStatic<BpmnModelUtils> bpmnModelUtilsMockedStatic = mockStatic(BpmnModelUtils.class)) {
|
|
||||||
// 准备参数
|
|
||||||
DelegateExecution execution = mock(DelegateExecution.class);
|
|
||||||
String param = randomString();
|
|
||||||
// mock 方法(execution)
|
|
||||||
String processDefinitionId = randomString();
|
|
||||||
when(execution.getProcessDefinitionId()).thenReturn(processDefinitionId);
|
|
||||||
FlowElement flowElement = mock(FlowElement.class);
|
|
||||||
when(execution.getCurrentFlowElement()).thenReturn(flowElement);
|
|
||||||
// mock 方法(parseAssignEmptyHandlerType)
|
|
||||||
bpmnModelUtilsMockedStatic.when(() -> BpmnModelUtils.parseAssignEmptyHandlerType(same(flowElement)))
|
|
||||||
.thenReturn(BpmUserTaskAssignEmptyHandlerTypeEnum.ASSIGN_USER.getType());
|
|
||||||
bpmnModelUtilsMockedStatic.when(() -> BpmnModelUtils.parseAssignEmptyHandlerUserIds(same(flowElement)))
|
|
||||||
.thenReturn(ListUtil.of(1L, 2L));
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByTask(execution, param);
|
|
||||||
// 断言
|
|
||||||
assertEquals(SetUtils.asSet(1L, 2L), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByActivity() {
|
|
||||||
try (MockedStatic<BpmnModelUtils> bpmnModelUtilsMockedStatic = mockStatic(BpmnModelUtils.class)) {
|
|
||||||
// 准备参数
|
|
||||||
String processDefinitionId = randomString();
|
|
||||||
String activityId = randomString();
|
|
||||||
String param = randomString();
|
|
||||||
// mock 方法(getFlowElementById)
|
|
||||||
FlowElement flowElement = mock(FlowElement.class);
|
|
||||||
BpmnModel bpmnModel = mock(BpmnModel.class);
|
|
||||||
bpmnModelUtilsMockedStatic.when(() -> BpmnModelUtils.getFlowElementById(same(bpmnModel), eq(activityId)))
|
|
||||||
.thenReturn(flowElement);
|
|
||||||
// mock 方法(parseAssignEmptyHandlerType)
|
|
||||||
bpmnModelUtilsMockedStatic.when(() -> BpmnModelUtils.parseAssignEmptyHandlerType(same(flowElement)))
|
|
||||||
.thenReturn(BpmUserTaskAssignEmptyHandlerTypeEnum.ASSIGN_ADMIN.getType());
|
|
||||||
// mock 方法(getProcessDefinitionInfo)
|
|
||||||
BpmProcessDefinitionInfoDO processDefinition = randomPojo(BpmProcessDefinitionInfoDO.class,
|
|
||||||
o -> o.setManagerUserIds(ListUtil.of(1L, 2L)));
|
|
||||||
when(processDefinitionService.getProcessDefinitionInfo(eq(processDefinitionId))).thenReturn(processDefinition);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByActivity(bpmnModel, activityId, param,
|
|
||||||
null, processDefinitionId, null);
|
|
||||||
// 断言
|
|
||||||
assertEquals(SetUtils.asSet(1L, 2L), userIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
|
||||||
import org.assertj.core.util.Sets;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class BpmTaskCandidateStartUserStrategyTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private BpmTaskCandidateStartUserStrategy strategy;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private BpmProcessInstanceService processInstanceService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByTask() {
|
|
||||||
// 准备参数
|
|
||||||
String param = "2";
|
|
||||||
// mock 方法(获得流程发起人)
|
|
||||||
Long startUserId = 1L;
|
|
||||||
ProcessInstance processInstance = mock(ProcessInstance.class);
|
|
||||||
DelegateExecution execution = mock(DelegateExecution.class);
|
|
||||||
when(processInstanceService.getProcessInstance(eq(execution.getProcessInstanceId()))).thenReturn(processInstance);
|
|
||||||
when(processInstance.getStartUserId()).thenReturn(startUserId.toString());
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByTask(execution, param);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(startUserId), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCalculateUsersByActivity() {
|
|
||||||
// 准备参数
|
|
||||||
Long startUserId = 1L;
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Set<Long> userIds = strategy.calculateUsersByActivity(null, null, null,
|
|
||||||
startUserId, null, null);
|
|
||||||
// 断言
|
|
||||||
assertEquals(Sets.newLinkedHashSet(startUserId), userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Max;
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 客服消息列表 Request VO")
|
|
||||||
@Data
|
|
||||||
public class KeFuMessageListReqVO {
|
|
||||||
|
|
||||||
private static final Integer LIMIT = 10;
|
|
||||||
|
|
||||||
@Schema(description = "会话编号", example = "12580")
|
|
||||||
@NotNull(message = "会话编号不能为空")
|
|
||||||
private Long conversationId;
|
|
||||||
|
|
||||||
@Schema(description = "发送时间", example = "2024-03-27 12:00:00")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@Schema(description = "每次查询条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
|
||||||
@NotNull(message = "每次查询条数不能为空")
|
|
||||||
@Min(value = 1, message = "每次查询条数最小值为 1")
|
|
||||||
@Max(value = 100, message = "每次查询最大值为 100")
|
|
||||||
private Integer limit = LIMIT;
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
/**
|
|
||||||
* 占位符,可忽略
|
|
||||||
*/
|
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.base.system;
|
|
@ -1,19 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.admin.base.system.user;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Schema(description = "用户精简信息 VO")
|
|
||||||
@Data
|
|
||||||
public class UserSimpleBaseVO {
|
|
||||||
|
|
||||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
|
||||||
private String nickname;
|
|
||||||
|
|
||||||
@Schema(description = "用户头像", example = "https://www.iocoder.cn/1.png")
|
|
||||||
private String avatar;
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 分销用户创建 Request VO")
|
|
||||||
@Data
|
|
||||||
public class BrokerageUserCreateReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "分销用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
@NotNull(message = "分销用户编号不能为空")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
@Schema(description = "推广员编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4587")
|
|
||||||
private Long bindUserId;
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 自提门店绑定核销人 Request VO")
|
|
||||||
@Data
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class DeliveryPickUpBindReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
|
|
||||||
@NotNull(message = "编号不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "绑定用户编号组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
|
|
||||||
@NotEmpty(message = "绑定用户编号组数不能未空")
|
|
||||||
private List<Long> verifyUserIds;
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.transfer.dto;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class PayTransferRespDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编号
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账单号
|
|
||||||
*/
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账金额,单位:分
|
|
||||||
*/
|
|
||||||
private Integer price;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账状态
|
|
||||||
*
|
|
||||||
* 枚举 {@link PayTransferStatusEnum}
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 钱包 API 接口
|
|
||||||
*
|
|
||||||
* @author liurulin
|
|
||||||
*/
|
|
||||||
public interface PayWalletApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加钱包余额
|
|
||||||
*
|
|
||||||
* @param reqDTO 增加余额请求
|
|
||||||
*/
|
|
||||||
void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO);
|
|
||||||
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.wallet.dto;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 钱包余额增加 Request DTO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PayWalletAddBalanceReqDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户编号
|
|
||||||
*
|
|
||||||
* 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性
|
|
||||||
*/
|
|
||||||
@NotNull(message = "用户编号不能为空")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 用户类型
|
|
||||||
*
|
|
||||||
* 关联 {@link UserTypeEnum}
|
|
||||||
*/
|
|
||||||
@NotNull(message = "用户类型不能为空")
|
|
||||||
private Integer userType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联业务分类
|
|
||||||
*/
|
|
||||||
@NotNull(message = "关联业务分类不能为空")
|
|
||||||
private Integer bizType;
|
|
||||||
/**
|
|
||||||
* 关联业务编号
|
|
||||||
*/
|
|
||||||
@NotNull(message = "关联业务编号不能为空")
|
|
||||||
private String bizId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易金额,单位分
|
|
||||||
*
|
|
||||||
* 正值表示余额增加,负值表示余额减少
|
|
||||||
*/
|
|
||||||
@NotNull(message = "交易金额不能为空")
|
|
||||||
private Integer price;
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 钱包 API 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class PayWalletApiImpl implements PayWalletApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private PayWalletService payWalletService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO) {
|
|
||||||
// 创建或获取钱包
|
|
||||||
PayWalletDO wallet = payWalletService.getOrCreateWallet(reqDTO.getUserId(), reqDTO.getUserType());
|
|
||||||
Assert.notNull(wallet, "钱包({}/{})不存在", reqDTO.getUserId(), reqDTO.getUserType());
|
|
||||||
|
|
||||||
// 增加余额
|
|
||||||
PayWalletBizTypeEnum bizType = PayWalletBizTypeEnum.valueOf(reqDTO.getBizType());
|
|
||||||
payWalletService.addWalletBalance(wallet.getId(), reqDTO.getBizId(), bizType, reqDTO.getPrice());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.dto.transfer;
|
|
||||||
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayBaseNotifyV3Result;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
// TODO @luchi:这个可以复用 wxjava 里的类么?
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class WxPayTransferPartnerNotifyV3Result implements Serializable, WxPayBaseNotifyV3Result<WxPayTransferPartnerNotifyV3Result.TransferNotifyResult> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 源数据
|
|
||||||
*/
|
|
||||||
private OriginNotifyResponse rawData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解密后的数据
|
|
||||||
*/
|
|
||||||
private TransferNotifyResult result;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRawData(OriginNotifyResponse rawData) {
|
|
||||||
this.rawData = rawData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setResult(TransferNotifyResult data) {
|
|
||||||
this.result = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TransferNotifyResult getResult() {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OriginNotifyResponse getRawData() {
|
|
||||||
return rawData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
public static class TransferNotifyResult implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*********************** 公共字段 ********************
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商家批次单号
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "out_batch_no")
|
|
||||||
protected String outBatchNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信批次单号
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "batch_id")
|
|
||||||
protected String batchId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次状态
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "batch_status")
|
|
||||||
protected String batchStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次总笔数
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "total_num")
|
|
||||||
protected Integer totalNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次总金额
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "total_amount")
|
|
||||||
protected Integer totalAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次更新时间
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "update_time")
|
|
||||||
private String updateTime;
|
|
||||||
|
|
||||||
/*********************** FINISHED ********************
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账成功金额
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "success_amount")
|
|
||||||
protected Integer successAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账成功笔数
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "success_num")
|
|
||||||
protected Integer successNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账失败金额
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "fail_amount")
|
|
||||||
protected Integer failAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账失败笔数
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "fail_num")
|
|
||||||
protected Integer failNum;
|
|
||||||
|
|
||||||
/*********************** CLOSED ********************
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户号
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "mchid")
|
|
||||||
protected String mchId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次关闭原因
|
|
||||||
*/
|
|
||||||
@SerializedName(value = "close_reason")
|
|
||||||
protected String closeReason;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
package com.github.binarywang.wxpay.bean.transfer;
|
|
||||||
|
|
||||||
import com.github.binarywang.wxpay.v3.SpecEncrypt;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发起商家转账API参数
|
|
||||||
*
|
|
||||||
* @author zhongjun
|
|
||||||
* created on 2022/6/17
|
|
||||||
**/
|
|
||||||
@Data
|
|
||||||
@Builder(builderMethodName = "newBuilder")
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TransferBatchesRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = -2175582517588397426L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 直连商户的appid
|
|
||||||
*/
|
|
||||||
@SerializedName("appid")
|
|
||||||
private String appid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商家批次单号
|
|
||||||
*/
|
|
||||||
@SerializedName("out_batch_no")
|
|
||||||
private String outBatchNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次名称
|
|
||||||
*/
|
|
||||||
@SerializedName("batch_name")
|
|
||||||
private String batchName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次备注
|
|
||||||
*/
|
|
||||||
@SerializedName("batch_remark")
|
|
||||||
private String batchRemark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账总金额
|
|
||||||
*/
|
|
||||||
@SerializedName("total_amount")
|
|
||||||
private Integer totalAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账总笔数
|
|
||||||
*/
|
|
||||||
@SerializedName("total_num")
|
|
||||||
private Integer totalNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账明细列表
|
|
||||||
*/
|
|
||||||
@SpecEncrypt
|
|
||||||
@SerializedName("transfer_detail_list")
|
|
||||||
private List<TransferDetail> transferDetailList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账场景ID
|
|
||||||
*/
|
|
||||||
@SerializedName("transfer_scene_id")
|
|
||||||
private String transferSceneId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知地址 说明:异步接收微信支付结果通知的回调地址,通知url必须为公网可访问的url,必须为https,不能携带参数。
|
|
||||||
*/
|
|
||||||
@SerializedName("notify_url")
|
|
||||||
private String notifyUrl;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder(builderMethodName = "newBuilder")
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public static class TransferDetail {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商家明细单号
|
|
||||||
*/
|
|
||||||
@SerializedName("out_detail_no")
|
|
||||||
private String outDetailNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账金额
|
|
||||||
*/
|
|
||||||
@SerializedName("transfer_amount")
|
|
||||||
private Integer transferAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账备注
|
|
||||||
*/
|
|
||||||
@SerializedName("transfer_remark")
|
|
||||||
private String transferRemark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户在直连商户应用下的用户标示
|
|
||||||
*/
|
|
||||||
@SerializedName("openid")
|
|
||||||
private String openid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收款用户姓名
|
|
||||||
*/
|
|
||||||
@SpecEncrypt
|
|
||||||
@SerializedName("user_name")
|
|
||||||
private String userName;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user