Compare commits
	
		
			2 Commits
		
	
	
		
			2928ee4c3e
			...
			9165ca7baa
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 9165ca7baa | ||
|  | 702e8b0427 | 
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							| @ -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>--> | ||||
|  | ||||
| @ -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.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; | ||||
| @ -31,13 +33,17 @@ 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())); | ||||
|         smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), | ||||
|                 BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); | ||||
|         String templateCode = "fta_workflow_task_pass"; | ||||
|         notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId()) | ||||
|                 .setTemplateCode(templateCode).setTemplateParams(templateParams)); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
| @ -46,19 +52,20 @@ public class BpmMessageServiceImpl implements BpmMessageService { | ||||
|         templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); | ||||
|         templateParams.put("reason", reqDTO.getReason()); | ||||
|         templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); | ||||
|         smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), | ||||
|                 BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); | ||||
|         String templateCode = "fta_workflow_task_not_pass"; | ||||
|         notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId()) | ||||
|                 .setTemplateCode(templateCode).setTemplateParams(templateParams)); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     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("startUserNickname",reqDTO.getStartUserNickname()); | ||||
|         templateParams.put("taskName", reqDTO.getTaskName()); | ||||
|         templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); | ||||
|         templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); | ||||
|         smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), | ||||
|                 BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)); | ||||
|         String templateCode = "fta_workflow_task"; | ||||
|         notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getAssigneeUserId()) | ||||
|                 .setTemplateCode(templateCode).setTemplateParams(templateParams)); | ||||
|     } | ||||
| 
 | ||||
|     private String getProcessInstanceDetailUrl(String taskId) { | ||||
|  | ||||
| @ -30,6 +30,14 @@ | ||||
|             <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> | ||||
|  | ||||
| @ -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"); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -1,5 +1,6 @@ | ||||
| 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; | ||||
|  | ||||
| @ -79,4 +79,12 @@ 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; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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<String, List<Long>> startUserSelectAssignees; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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"); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -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; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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<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(); | ||||
|     } | ||||
|  | ||||
| @ -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>--> | ||||
|  | ||||
| @ -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 # 基于域名获取租户,不许带租户编号 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user