DefVarController.java 3.2 KB
package com.hotent.bpmModel.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.hotent.base.annotation.NewVersion;
import com.hotent.base.controller.BaseController;
import com.hotent.bpmModel.manager.BpmDefVarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.model.CommonResult;
import com.hotent.bpm.api.model.process.def.BpmVariableDef;
import com.hotent.bpmModel.params.BpmVariableDefVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


/**
 *  描述:流程变量管理
 * @company 广州宏天软件有限公司
 * @author wanghb
 * @email wanghb@jee-soft.cn
 * @date 2018年6月26日
 */
@RestController
@RequestMapping("/flow/var/v1/")
@Api(tags="流程变量")
@ApiGroup(group= {ApiGroupConsts.GROUP_BPM})
@NewVersion
public class DefVarController {
	@Autowired
	BpmDefVarService defVarService;

	/**
	 * 流程变量列表数据
	 */
	@RequestMapping(value="listJson", method=RequestMethod.GET, produces={"application/json; charset=utf-8" })
	@ApiOperation(value = "流程变量列表数据", httpMethod = "GET", notes = "流程变量列表数据")
	public List<BpmVariableDef> listJson(
			@ApiParam(name="defId",value="常用语id")@RequestParam String defId,
			@ApiParam(name="nodeId",value="节点id")@RequestParam String nodeId) throws Exception {
		List<BpmVariableDef> res=defVarService.listJson(defId,nodeId);
		return res;
	}


	/**
	 * 编辑节点变量
	 */
	@RequestMapping(value="defVarEdit", method=RequestMethod.GET, produces={"application/json; charset=utf-8" })
	@ApiOperation(value = "编辑节点变量", httpMethod = "GET", notes = "编辑节点变量")
	public Map<String,Object> defVarEdit(
			@ApiParam(name="defId",value="常用语id")@RequestParam String defId,
			@ApiParam(name="varKey",value="变量key")@RequestParam String varKey) throws Exception {
		Map<String,Object> res=defVarService.defVarEdit(defId,varKey);
		return res;
	}

	/**
	 * 删除节点变量
	 */
	@RequestMapping(value="remove",method=RequestMethod.DELETE, produces = { "application/json; charset=utf-8" })
	@ApiOperation(value = "删除节点变量", httpMethod = "DELETE", notes = "删除节点变量")
	public CommonResult<String> remove(
			@ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId,
			@ApiParam(name="varKey",value="变量key,支持','逗号分割批量删除", required = true) @RequestParam String varKey) throws Exception {
		CommonResult<String> res=defVarService.remove(defId,varKey);
		return res;
	}

	/**
	 * 保存节点规则
	 */
	@RequestMapping(value="save",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
	@ApiOperation(value = "保存节点规则", httpMethod = "POST", notes = "保存节点规则")
	public CommonResult<String> save(
			@ApiParam(name="variableDefVo",value="保存节点规则", required = true) @RequestBody BpmVariableDefVo variableDefVo) throws Exception {
		CommonResult<String> res=defVarService.save(variableDefVo);
		return res;
	}

}