|
@@ -0,0 +1,51 @@
|
|
|
+package com.zjugis.z_workflow.serviceApi;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.zjugis.framework.workflow.model.BaseController;
|
|
|
+import com.zjugis.framework.workflow.model.SerialNumberDto;
|
|
|
+import com.zjugis.z_workflow.service.CodeTemplateService;
|
|
|
+import com.zjugis.z_workflow.service.ObsoleteNumRecyclingService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+
|
|
|
+@RestController
|
|
|
+public class CodeTemplateServiceApiController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CodeTemplateService codeTemplateService;
|
|
|
+ @Autowired
|
|
|
+ private ObsoleteNumRecyclingService obsoleteNumRecyclingService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据编码模板名称和编码参数生成编码
|
|
|
+ */
|
|
|
+ // " /**\n" +
|
|
|
+// " * 业务编码生成调用示例\n" +
|
|
|
+// " */\n" +
|
|
|
+// " private void callExample() {\n" +
|
|
|
+// " //编码模板:\"测试模板1_\"+{systemName}+\"_\"+FlowNum(1,4,'0',\"林业审批{districtCode}\",0)\n" +
|
|
|
+// " //编码参数\n" +
|
|
|
+// " Map<String, String> mapParam = new HashMap<>();\n" +
|
|
|
+// " mapParam.put(\"id\", \"id\");//编码模板ID\n" +
|
|
|
+// " //动态参数(没有动态参数,可不传)\n" +
|
|
|
+// " Map<String, String> dynamicParam = new HashMap<>();\n" +
|
|
|
+// " dynamicParam.put(\"systemName\", \"测试系统\");//对应编码模板系统变量{systemName}\n" +
|
|
|
+// " dynamicParam.put(\"districtCode\", \"320201\");//对应编码模板系统变量{districtCode}\n" +
|
|
|
+// " mapParam.put(\"codeParam\", JSON.toJSONString(dynamicParam));\n" +
|
|
|
+// " //是否预览模式(1:预览模式 0或不传:非预览模式)\n" +
|
|
|
+// " mapParam.put(\"iPreview\", \"0\");\n" +
|
|
|
+// " //接口Url\n" +
|
|
|
+// " String apiUrl = YamlConfig.getValue(\"application-project.yml\",\"serviceUrl.z_bussiness_commom\") + \"CodeTemplateServiceApi/getFlowNumByName\";\n" +
|
|
|
+// " //调用接口获取数据\n" +
|
|
|
+// " String result = ServiceApiUtils.getDataFromServiceApi(apiUrl, mapParam);\n" +
|
|
|
+// " }"
|
|
|
+ @PostMapping
|
|
|
+ public String getFlowNumByName(@Valid @RequestBody SerialNumberDto serialNumberDto) throws Exception {
|
|
|
+ return codeTemplateService.getFlowNumByName(serialNumberDto.getName(), JSON.toJSONString(serialNumberDto.getParams()), serialNumberDto.getIPreview());
|
|
|
+ }
|
|
|
+}
|