Search in sources :

Example 6 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class OrgGroupAction method save.

@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = userVo.getDefaultOrgId();
    OrgGroupVo group = JSON.parseObject(JSON.toJSONString(json.get("group")), OrgGroupVo.class);
    ;
    List<RelationOrgGroupUserVo> relations = (List<RelationOrgGroupUserVo>) json.get("relations");
    TestOrgGroup po = orgGroupService.save(group, orgId);
    boolean success = orgGroupUserService.saveRelations(relations);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) TestOrgGroup(com.ngtesting.platform.entity.TestOrgGroup) HashMap(java.util.HashMap) OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo) JSONObject(com.alibaba.fastjson.JSONObject) List(java.util.List) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

OrgGroupVo (com.ngtesting.platform.vo.OrgGroupVo)6 JSONObject (com.alibaba.fastjson.JSONObject)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)4 UserVo (com.ngtesting.platform.vo.UserVo)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 TestOrgGroup (com.ngtesting.platform.entity.TestOrgGroup)3 RelationOrgGroupUserVo (com.ngtesting.platform.vo.RelationOrgGroupUserVo)3 List (java.util.List)2 JSONArray (com.alibaba.fastjson.JSONArray)1 Page (com.ngtesting.platform.vo.Page)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1