Compare commits

...

2 Commits

Author SHA1 Message Date
Wayne 9165ca7baa 工作流消息通知集成 2024-05-07 09:14:17 +08:00
Wayne 702e8b0427 1、关闭多租户功能
2、新增企业管理模块
2024-05-06 10:17:50 +08:00
12 changed files with 86 additions and 78 deletions

View File

@ -17,7 +17,7 @@
<module>yudao-module-infra</module> <module>yudao-module-infra</module>
<module>yudao-module-fta</module> <module>yudao-module-fta</module>
<!-- <module>yudao-module-member</module>--> <!-- <module>yudao-module-member</module>-->
<!-- <module>yudao-module-bpm</module>--> <module>yudao-module-bpm</module>
<!-- <module>yudao-module-report</module>--> <!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>--> <!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>--> <!-- <module>yudao-module-pay</module>-->

View File

@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.bpm.enums.message.BpmMessageEnum;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi; import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -31,13 +33,17 @@ public class BpmMessageServiceImpl implements BpmMessageService {
@Resource @Resource
private WebProperties webProperties; private WebProperties webProperties;
@Resource
private NotifyMessageSendApi notifySendApi;
@Override @Override
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) { public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); Map<String, Object> templateParams = new HashMap<>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), String templateCode = "fta_workflow_task_pass";
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId())
.setTemplateCode(templateCode).setTemplateParams(templateParams));
} }
@Override @Override
@ -46,19 +52,20 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("reason", reqDTO.getReason()); templateParams.put("reason", reqDTO.getReason());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), String templateCode = "fta_workflow_task_not_pass";
BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId())
.setTemplateCode(templateCode).setTemplateParams(templateParams));
} }
@Override @Override
public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) { public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); Map<String,Object> templateParams = new HashMap<String,Object>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("startUserNickname",reqDTO.getStartUserNickname());
templateParams.put("taskName", reqDTO.getTaskName()); templateParams.put("taskName", reqDTO.getTaskName());
templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); String templateCode = "fta_workflow_task";
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getAssigneeUserId())
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), .setTemplateCode(templateCode).setTemplateParams(templateParams));
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
} }
private String getProcessInstanceDetailUrl(String taskId) { private String getProcessInstanceDetailUrl(String taskId) {

View File

@ -30,6 +30,14 @@
<artifactId>yudao-spring-boot-starter-web</artifactId> <artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- 工作流相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 权限校验相关 -->
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId> <artifactId>yudao-spring-boot-starter-security</artifactId>

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.fta.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* @Author wss
* @Date 2024.04.26 10:28
**/
@Tag(name = "管理后台 - 自贸区")
@RestController
@RequestMapping("/fta/test")
@Validated
public class FtaTestController {
@GetMapping("/get")
@Operation(summary = "获取 test 信息")
public CommonResult<String> get() {
return success("true");
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo; package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import lombok.*; import lombok.*;
import java.time.LocalDate; import java.time.LocalDate;

View File

@ -79,4 +79,12 @@ public class EnterpriseInformationRespVO {
@ExcelProperty("经营许可范围") @ExcelProperty("经营许可范围")
private String operatePermitRange; private String operatePermitRange;
@Schema(description = "审批结果", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelIgnore
private Integer status;
@Schema(description = "流程编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelIgnore
private String processInstanceId;
} }

View File

@ -70,4 +70,8 @@ public class EnterpriseInformationSaveReqVO {
@NotEmpty(message = "经营许可范围不能为空") @NotEmpty(message = "经营许可范围不能为空")
private String operatePermitRange; private String operatePermitRange;
@Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "审批人不能为空")
private Map<String, List<Long>> startUserSelectAssignees;
} }

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.fta.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* @Author wss
* @Date 2024.04.26 10:33
**/
@Tag(name = "用户 App - 自贸区")
@RestController
@RequestMapping("/demo/test")
@Validated
public class AppFtaTestController {
@GetMapping("/get")
@Operation(summary = "获取 test 信息")
public CommonResult<String> get() {
return success("true");
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation; package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation;
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import lombok.*; import lombok.*;
import java.time.LocalDate; import java.time.LocalDate;
@ -89,5 +90,19 @@ public class EnterpriseInformationDO extends BaseDO {
* 经营许可范围 * 经营许可范围
*/ */
private String operatePermitRange; private String operatePermitRange;
/**
* 审批结果
*
* 枚举 {@link BpmTaskStatusEnum}
* 考虑到简单所以直接复用了 BpmProcessInstanceStatusEnum 枚举也可以自己定义一个枚举哈
*/
private Integer status;
/**
* 对应的流程编号
*
* 关联 ProcessInstance id 属性
*/
private String processInstanceId;
} }

View File

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.fta.service.enterpriseinformation; package cn.iocoder.yudao.module.fta.service.enterpriseinformation;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -15,6 +18,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.EnterpriseInformationMapper; import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.EnterpriseInformationMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
/** /**
@ -26,14 +30,34 @@ import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
@Validated @Validated
public class EnterpriseInformationServiceImpl implements EnterpriseInformationService { public class EnterpriseInformationServiceImpl implements EnterpriseInformationService {
/**
* FTA 企业基础信息对应的流程定义 KEY
*/
public static final String PROCESS_KEY = "fta_enterprise";
@Resource @Resource
private EnterpriseInformationMapper enterpriseInformationMapper; private EnterpriseInformationMapper enterpriseInformationMapper;
@Resource
private BpmProcessInstanceApi processInstanceApi;
@Override @Override
public Long createEnterpriseInformation(EnterpriseInformationSaveReqVO createReqVO) { public Long createEnterpriseInformation(EnterpriseInformationSaveReqVO createReqVO) {
// 插入 // 插入 企业基础信息填报
EnterpriseInformationDO enterpriseInformation = BeanUtils.toBean(createReqVO, EnterpriseInformationDO.class); EnterpriseInformationDO enterpriseInformation = BeanUtils.toBean(createReqVO, EnterpriseInformationDO.class)
.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
enterpriseInformationMapper.insert(enterpriseInformation); enterpriseInformationMapper.insert(enterpriseInformation);
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(),
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(enterpriseInformation.getId()))
.setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees()));
// 将工作流的编号更新到企业基础信息填报
enterpriseInformationMapper.updateById(new EnterpriseInformationDO().setId(enterpriseInformation.getId()).setProcessInstanceId(processInstanceId));
// 返回 // 返回
return enterpriseInformation.getId(); return enterpriseInformation.getId();
} }

View File

@ -51,11 +51,11 @@
<!-- <version>${revision}</version>--> <!-- <version>${revision}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- 工作流。默认注释,保证编译速度 --> <!-- 工作流。默认注释,保证编译速度 -->
<!-- <dependency>--> <dependency>
<!-- <groupId>cn.iocoder.boot</groupId>--> <groupId>cn.iocoder.boot</groupId>
<!-- <artifactId>yudao-module-bpm-biz</artifactId>--> <artifactId>yudao-module-bpm-biz</artifactId>
<!-- <version>${revision}</version>--> <version>${revision}</version>
<!-- </dependency>--> </dependency>
<!-- 支付服务。默认注释,保证编译速度 --> <!-- 支付服务。默认注释,保证编译速度 -->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>--> <!-- <groupId>cn.iocoder.boot</groupId>-->

View File

@ -182,7 +182,7 @@ yudao:
db-schemas: ${spring.datasource.dynamic.datasource.master.name} db-schemas: ${spring.datasource.dynamic.datasource.master.name}
front-type: 10 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类 front-type: 10 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类
tenant: # 多租户相关配置项 tenant: # 多租户相关配置项
enable: true enable: false
ignore-urls: ignore-urls:
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
@ -261,4 +261,4 @@ debug: false
# 积木报表配置 # 积木报表配置
jeecg: jeecg:
jmreport: jmreport:
saas-mode: tenant saas-mode: tenant