diff --git a/yudao-module-fta/yudao-module-fta-biz/pom.xml b/yudao-module-fta/yudao-module-fta-biz/pom.xml index 8f1771c..39796ec 100644 --- a/yudao-module-fta/yudao-module-fta-biz/pom.xml +++ b/yudao-module-fta/yudao-module-fta-biz/pom.xml @@ -30,6 +30,14 @@ yudao-spring-boot-starter-web + + + cn.iocoder.boot + yudao-module-bpm-api + ${revision} + + + cn.iocoder.boot yudao-spring-boot-starter-security diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/FtaTestController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/FtaTestController.java deleted file mode 100644 index d7d1400..0000000 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/FtaTestController.java +++ /dev/null @@ -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 get() { - return success("true"); - } - -} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java index 364d6c7..5f10a8a 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java @@ -70,4 +70,8 @@ public class EnterpriseInformationSaveReqVO { @NotEmpty(message = "经营许可范围不能为空") private String operatePermitRange; + @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "审批人不能为空") + private Map> startUserSelectAssignees; + } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/app/AppFtaTestController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/app/AppFtaTestController.java deleted file mode 100644 index cc59226..0000000 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/app/AppFtaTestController.java +++ /dev/null @@ -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 get() { - return success("true"); - } - -} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/EnterpriseInformationDO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/EnterpriseInformationDO.java index 82232e0..d2178ad 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/EnterpriseInformationDO.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/EnterpriseInformationDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation; +import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; import lombok.*; import java.time.LocalDate; @@ -89,5 +90,19 @@ public class EnterpriseInformationDO extends BaseDO { * 经营许可范围 */ private String operatePermitRange; + /** + * 审批结果 + * + * 枚举 {@link BpmTaskStatusEnum} + * 考虑到简单,所以直接复用了 BpmProcessInstanceStatusEnum 枚举,也可以自己定义一个枚举哈 + */ + private Integer status; + + /** + * 对应的流程编号 + * + * 关联 ProcessInstance 的 id 属性 + */ + private String processInstanceId; } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java index a551848..30e8f0e 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java @@ -1,5 +1,8 @@ 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; @@ -15,6 +18,7 @@ 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.*; /** @@ -26,14 +30,34 @@ 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); + // 插入 企业基础信息填报 + EnterpriseInformationDO enterpriseInformation = BeanUtils.toBean(createReqVO, EnterpriseInformationDO.class) + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); enterpriseInformationMapper.insert(enterpriseInformation); + + // 发起 BPM 流程 + Map 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(); } diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index 296c4a8..b2c8761 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -51,11 +51,11 @@ - - - - - + + cn.iocoder.boot + yudao-module-bpm-biz + ${revision} + diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 6cb5386..fe803f1 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -182,7 +182,7 @@ yudao: db-schemas: ${spring.datasource.dynamic.datasource.master.name} front-type: 10 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类 tenant: # 多租户相关配置项 - enable: true + enable: false ignore-urls: - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 @@ -261,4 +261,4 @@ debug: false # 积木报表配置 jeecg: jmreport: - saas-mode: tenant \ No newline at end of file + saas-mode: tenant