Compare commits

..

No commits in common. "9165ca7baa6137183b3b338262a2cb354c662f57" and "2928ee4c3e399cb28056adf789d0bb100e49ac9f" have entirely different histories.

12 changed files with 78 additions and 86 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1,30 @@
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,6 +1,5 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import lombok.*;
import java.time.LocalDate;

View File

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

View File

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

View File

@ -1,8 +1,5 @@
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 javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -18,7 +15,6 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
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.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
/**
@ -30,34 +26,14 @@ import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
@Validated
public class EnterpriseInformationServiceImpl implements EnterpriseInformationService {
/**
* FTA 企业基础信息对应的流程定义 KEY
*/
public static final String PROCESS_KEY = "fta_enterprise";
@Resource
private EnterpriseInformationMapper enterpriseInformationMapper;
@Resource
private BpmProcessInstanceApi processInstanceApi;
@Override
public Long createEnterpriseInformation(EnterpriseInformationSaveReqVO createReqVO) {
// 插入 企业基础信息填报
EnterpriseInformationDO enterpriseInformation = BeanUtils.toBean(createReqVO, EnterpriseInformationDO.class)
.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
// 插入
EnterpriseInformationDO enterpriseInformation = BeanUtils.toBean(createReqVO, EnterpriseInformationDO.class);
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();
}

View File

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

View File

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