package com.hotent.bpmModel.controller; import java.util.List; import java.util.Map; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.node.ArrayNode; import com.hotent.base.annotation.ApiGroup; import com.hotent.base.constants.ApiGroupConsts; import com.hotent.base.controller.BaseController; import com.hotent.base.model.CommonResult; import com.hotent.bpm.persistence.manager.BpmDefUserManager; import com.hotent.bpm.persistence.model.BpmDefUser; import com.hotent.bpmModel.params.SaveRightsVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; /** * 栏目授权 * * @company 广州宏天软件股份有限公司 * @author heyifan * @email heyf@jee-soft.cn * @date 2020年4月15日 */ @RestController @RequestMapping("/flow/bpmDefUser/v1/") @Api(tags="栏目授权") @ApiGroup(group= {ApiGroupConsts.GROUP_BPM}) public class BpmDefUserController extends BaseController { @RequestMapping(value="getRights", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "获取首页栏目权限", httpMethod = "GET", notes = "获取首页栏目权限") public ArrayNode getRights( @ApiParam(name="id",value="id")@RequestParam String id, @ApiParam(name="objType",value="objType")@RequestParam String objType) throws Exception { return baseService.getRights(id, objType); } @RequestMapping(value="saveRights", method=RequestMethod.POST, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "保存首页栏目权限", httpMethod = "POST", notes = "保存节点json 配置") public CommonResult saveRights(@ApiParam(name="vo",value="节点保存对象")@RequestBody SaveRightsVo rightsVo) throws Exception { try { baseService.saveRights(rightsVo.getId(), rightsVo.getObjType(), rightsVo.getOwnerNameJson()); return new CommonResult("保存首页栏目权限成功"); } catch (Exception e) { e.printStackTrace(); return new CommonResult(false,"保存首页栏目权限失败"+e.getMessage()); } } @RequestMapping(value="getAuthorizeIdsByUserMap", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "通过objType获取当前用户权限", httpMethod = "GET", notes = "通过objType获取当前用户权限") public List getAuthorizeIdsByUserMap(@ApiParam(name="objType",value="objType")@RequestParam String objType) throws Exception { return baseService.getAuthorizeIdsByUserMap(objType); } @RequestMapping(value="hasRights", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "判断用户对某个模块数据是否有权限", httpMethod = "GET", notes = "判断用户对某个模块数据是否有权限") public boolean hasRights(@ApiParam(name="authorizeId",value="authorizeId")@RequestParam String authorizeId) throws Exception { return baseService.hasRights(authorizeId); } @RequestMapping(value = "delDefUser", method = RequestMethod.DELETE, produces = {"application/json; charset=utf-8" }) @ApiOperation(value = "(用户、组织、角色、岗位、所有人)取消流程授权", httpMethod = "DELETE", notes = "取消授权,ids为授权表主键ID(bpm_def_user),多个用英文逗号隔开") public CommonResult delDefUser( @ApiParam(name = "ids", value = "取消授权id字符串", required = true) @RequestParam String ids) throws Exception { return baseService.delDefUser(ids); } @RequestMapping(value="operatingDefUser",method=RequestMethod.POST, produces = {"application/json; charset=utf-8" }) @ApiOperation(value = "转移、复制流程授权信息给用户、组织、岗位、角色", httpMethod = "POST", notes = "转移、复制流程授权信息给用户、组织、岗位、角色") public CommonResult operatingDefUser(@ApiParam(name="map",value="参数", required = true) @RequestBody Map map) throws Exception{ return baseService.operatingDefUser(map); } }