update 移动模型设计器翻译方法

This commit is contained in:
songgaoshuai 2023-11-30 14:27:02 +08:00
parent 3b5e321085
commit 323f3a69d6
2 changed files with 15 additions and 39 deletions

View File

@ -1,11 +1,13 @@
package org.dromara.workflow.controller; package org.dromara.workflow.controller;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.resource.ResourceUtil;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.io.IOUtils;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.AddGroup;
@ -27,6 +29,8 @@ import org.springframework.util.MultiValueMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
/** /**
@ -163,4 +167,15 @@ public class ActModelController extends BaseController {
return actModelService.getGroups(filter); return actModelService.getGroups(filter);
} }
/**
* 解析翻译模型设计器内容
*/
@GetMapping(value = "/rest/stencil-sets/editor")
public String getStencilset() {
try (InputStream inputStream = ResourceUtil.getStream("static/stencilset.json")) {
return IOUtils.toString(inputStream, StandardCharsets.UTF_8);
} catch (Exception e) {
throw new SecurityException("Error while loading stencil set", e);
}
}
} }

View File

@ -1,39 +0,0 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.workflow.controller;
import cn.hutool.core.io.resource.ResourceUtil;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
* @author Tijs Rademakers
*/
@RestController
@RequestMapping("/workflow/model")
public class StencilsetRestResource {
@GetMapping(value = "/rest/stencil-sets/editor")
public String getStencilset() {
try (InputStream inputStream = ResourceUtil.getStream("static/stencilset.json")) {
return IOUtils.toString(inputStream, StandardCharsets.UTF_8);
} catch (Exception e) {
throw new SecurityException("Error while loading stencil set", e);
}
}
}