Score
0
Watch 2.7K Star 6K Fork 3.4K

GVP卓源软件 / JeeSiteJavaApache-2.0

流程不能保存问题

Open
ouyang  Opened this issue

修改保存controller
@RequiresPermissions("act:model:edit")
@RequestMapping(value = "/act/service/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, HttpServletRequest request) {
//public void saveModel(@PathVariable String modelId, @RequestBody MultiValueMap<String, String> values) {
try {

		Map<String, String[]> values = request.getParameterMap();

		Model model = repositoryService.getModel(modelId);

		ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());

		//modelJson.put(MODEL_NAME, values.getFirst("name"));
		modelJson.put(MODEL_NAME, values.get("name")[0]);
		//modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
		modelJson.put(MODEL_DESCRIPTION, values.get("description")[0]);
		model.setMetaInfo(modelJson.toString());
		//model.setName(values.getFirst("name"));
		model.setName(values.get("name")[0]);

		repositoryService.saveModel(model);

		//repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
		repositoryService.addModelEditorSource(model.getId(), new String(values.get("json_xml")[0]).getBytes("utf-8"));

		//InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
		InputStream svgStream = new ByteArrayInputStream(new String(values.get("svg_xml")[0]).getBytes("utf-8"));
		TranscoderInput input = new TranscoderInput(svgStream);

		PNGTranscoder transcoder = new PNGTranscoder();
		// Setup output
		ByteArrayOutputStream outStream = new ByteArrayOutputStream();
		TranscoderOutput output = new TranscoderOutput(outStream);

		// Do the transformation
		transcoder.transcode(input, output);
		final byte[] result = outStream.toByteArray();
		repositoryService.addModelEditorSourceExtra(model.getId(), result);
		outStream.close();

	} catch (Exception e) {
		LOGGER.error("Error saving model", e);
		throw new ActivitiException("Error saving model", e);
	}
}
total 1 participants

Comments (0)

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
Java
1
https://gitee.com/thinkgem/jeesite.git
git@gitee.com:thinkgem/jeesite.git
thinkgem
jeesite
JeeSite

Help Search