fanxp 1 year ago
parent
commit
150d8ed772

+ 5 - 0
src/main/java/com/xjrsoft/module/workflow/constant/WorkflowConstant.java

@@ -194,6 +194,11 @@ public interface WorkflowConstant {
      */
     String TASK_ID_PLACEHOLDER = "#{task_id}#";
 
+    /**
+     * 发起人编号
+     */
+    String INITIATOR_ID_PLACEHOLDER = "#{initiator_id}#";
+
     /**
      * 发起人名称占位符
      */

+ 2 - 1
src/main/java/com/xjrsoft/module/workflow/utils/WorkFlowUtil.java

@@ -126,6 +126,7 @@ public class WorkFlowUtil {
                 .replace(WorkflowConstant.TEMPLATE_NAME_PLACEHOLDER, workflowSchema.getName())
                 .replace(WorkflowConstant.TEMPLATE_REMARK_PLACEHOLDER, workflowSchema.getRemark())
                 .replace(WorkflowConstant.TASK_ID_PLACEHOLDER, workflowSchema.getDefinitionId())
+                .replace(WorkflowConstant.INITIATOR_ID_PLACEHOLDER, StrUtil.toString(user.getId()))
                 .replace(WorkflowConstant.INITIATOR_USER_NAME_PLACEHOLDER, user.getName())
                 .replace(WorkflowConstant.INITIATOR_CODE_PLACEHOLDER, user.getCode())
                 .replace(WorkflowConstant.INITIATOR_MOBILE_PLACEHOLDER, user.getMobile())
@@ -836,7 +837,7 @@ public class WorkFlowUtil {
                     }
                     //流程数据
                     else {
-                        String newStr = WorkFlowUtil.replacePlaceHolder(processParamConfig.getValue(), workflowSchema, serialNumber, 0L);
+                        String newStr = WorkFlowUtil.replacePlaceHolder(requestParamsConfig.getConfig(), workflowSchema, serialNumber, 0L);
                         params.put(requestParamsConfig.getName(), newStr);
                     }
 

+ 45 - 0
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -85,6 +85,51 @@ public class FreeMarkerGeneratorTest {
         params.setDs(ds);
 
 
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
+    @Test
+    public void generateCodesTest1() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("xjr_oa_news");
+        mainTable.setIsMain(true);
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
+
+        TableConfig childTable1 = new TableConfig();
+        childTable1.setTableName("xjr_oa_news_relation");
+        childTable1.setIsMain(false);
+        childTable1.setPkField(GlobalConstant.DEFAULT_PK);
+        childTable1.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
+        childTable1.setRelationField("news_id");
+        childTable1.setRelationTableField(GlobalConstant.DEFAULT_PK);
+
+
+        TableConfig childTable2 = new TableConfig();
+        childTable2.setTableName("xjr_oa_news_relation_config");
+        childTable2.setIsMain(false);
+        childTable2.setPkField(GlobalConstant.DEFAULT_PK);
+        childTable2.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
+        childTable2.setRelationField("news_id");
+        childTable2.setRelationTableField(GlobalConstant.DEFAULT_PK);
+
+        tableConfigs.add(mainTable);
+        tableConfigs.add(childTable1);
+//        tableConfigs.add(childTable2);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("fanxp");
+        params.setPackageName("test");
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);
+        params.setImport(true);
+        params.setExport(true);
+        params.setOutMainDir(false);
+        params.setDs(ds);
+
+
         IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
 
         apiGeneratorService.generateCodes(params);