package com.philisense.www.controller.web;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.philisense.www.annotation.log.OperateLog;
import com.philisense.www.common.config.CommonConst;
import com.philisense.www.controller.BaseUtilController;
import com.philisense.www.core.text.Convert;
import com.philisense.www.service.ProResourceActionService;
import com.philisense.www.utils.ActiveUserUtils;
import com.philisense.www.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;

@RestController
@RequestMapping(CommonConst.WEB_REST_SERVICE_PREFICX + "proresourceaction")
@Api(tags = "ProResourceActionControllerForWeb|一个用来操作-{按钮资源表}-业务模块的控制器")
public class ProResourceActionControllerForWeb extends BaseUtilController {

    @Autowired
    private ProResourceActionService proResourceActionService;


    @GetMapping("/delete")
    @ApiOperation(value = "根据-{按钮资源表}-主键删除记录", notes = "成功返回:{\"success\":true,\"message\",\"数据删除成功\"},失败返回:{\"success\":false,\"message\",\"数据删除失败\"}")
    @ApiImplicitParam(paramType = "query", name = "recordid", value = "记录主键", required = true,  dataTypeClass = String.class)
    @OperateLog(name = "根据-{按钮资源表}-主键删除记录", value = "delete", type = "PC")
    public Map<String, Object> deleteByPrimaryKeyForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestParam String recordid) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            int flag = proResourceActionService.deleteByPrimaryKey(recordid);
            if (1 <= flag) {
                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, DELETE_SUCCESS_MSG);
            } else {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, DELETE_FAIL_MSG);
            }

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, DELETE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @GetMapping("/get")
    @ApiOperation(value = "根据-{按钮资源表}-主键查询记录", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"datarecord\":\"{}\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParam(paramType = "body", name = "recordid", value = "记录主键", required = true,  dataTypeClass = String.class)
    @OperateLog(name = "根据-{按钮资源表}-主键查询记录", value = "query", type = "PC")
    public Map<String, Object> selectByPrimaryKeyForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestParam String recordid) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATARECORD, proResourceActionService.selectByPrimaryKey(recordid));
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/insert")
    @ApiOperation(value = "根据-{按钮资源表}-对象插入记录", notes = "成功返回:{\"success\":true,\"message\",\"数据插入成功\"},失败返回:{\"success\":false,\"message\",\"数据插入失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象插入记录", value = "insert", type = "PC")
    public Map<String, Object> insertForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            String ID = UUID.randomUUID().toString().replaceAll("-", "");
            map.put("id", ID);
            map.put("key", ID);
            map.put("title", map.get("name"));
            map.put("levelcode", map.get("levelcode") + "/" + ID);
            map.put("leaftype", (Convert.toStr(map.get("levelcode")).length() - Convert.toStr(map.get("levelcode")).replaceAll("/", "").length()) + 1);

            proResourceActionService.insert(map);
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, INSERT_SUCCESS_MSG);
            result.put(DATARECORD, map);
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, INSERT_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/update")
    @ApiOperation(value = "根据-{按钮资源表}-对象更新记录", notes = "成功返回:{\"success\":true,\"message\",\"数据更新成功\"},失败返回:{\"success\":false,\"message\",\"数据更新失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象更新记录", value = "update", type = "PC")
    public Map<String, Object> updateForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {


            String ID = map.get("id") + "";
            if (ID.equals("")) {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, UPDATE_FAIL_MSG + "记录ID不能为空");
                return result;
            }
            Map<String, Object> temmap = proResourceActionService.selectByPrimaryKey(ID);

            if (null == temmap || temmap.size() == 0) {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, UPDATE_FAIL_MSG + ID + "记录不存在");
                return result;
            }

            temmap.putAll(map);

            int flag = proResourceActionService.update(temmap);
            if (1 <= flag) {
                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, UPDATE_SUCCESS_MSG);
            } else {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, UPDATE_FAIL_MSG);
            }

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, UPDATE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/deleteByMap")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map删除记录", notes = "成功返回:{\"success\":true,\"message\",\"数据删除成功\"},失败返回:{\"success\":false,\"message\",\"数据删除失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map删除记录", value = "delete", type = "PC")
    public Map<String, Object> deleteByMapForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            int flag = proResourceActionService.deleteByMap(map);
            if (1 <= flag) {
                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, DELETE_SUCCESS_MSG);
            } else {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, DELETE_FAIL_MSG);
            }

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, DELETE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/updateByMap")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map更新记录", notes = "成功返回:{\"success\":true,\"message\",\"数据更新成功\"},失败返回:{\"success\":false,\"message\",\"数据更新失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map更新记录", value = "update", type = "PC")
    public Map<String, Object> updateByMapForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {


            int flag = proResourceActionService.updateByMap(map);
            if (1 <= flag) {
                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, UPDATE_SUCCESS_MSG);
            } else {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, UPDATE_FAIL_MSG);
            }

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, UPDATE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/getOne")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map查询记录", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"datarecord\":\"{}\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map查询记录", value = "query", type = "PC")
    public Map<String, Object> getOneForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATARECORD, proResourceActionService.getOne(map));
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/getAll")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map查询所有记录", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map查询所有记录", value = "query", type = "PC")
    public Map<String, Object> getAllForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST_VUE, proResourceActionService.getAll(map));
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }


    @PostMapping( "/queryPage")
    @ApiOperation(value="根据-{按钮资源表}-对象Map分页记录", notes="成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
        @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
        @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageForProResourceActionForWeb(HttpServletRequest request , HttpServletResponse response,@RequestBody Map<String, Object> map)
    {
            Map<String, Object> result = new HashMap<String, Object>();
            try {

            int currentPage = map.get(DATACURRENT)!=null?Integer.parseInt(map.get(DATACURRENT)+"")-1:0;
            int pageSize = map.get(PAGESIZE)!=null?Integer.parseInt(map.get(PAGESIZE)+""):10;
            int pageStart = currentPage*pageSize ;


            map.put(PAGESIZE,pageSize);
            map.put(PAGESTART,pageStart);

            int total = proResourceActionService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proResourceActionService.queryPage(map);
            }
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST,datalist);
            Map<String, Object> pagemode = new HashMap<String, Object>();
            pagemode.put(DATATOTAL,total);
            pagemode.put(PAGESIZE,map.get(PAGESIZE)!=null?map.get(PAGESIZE):10);
            pagemode.put(DATACURRENT,map.get(DATACURRENT)!=null?map.get(DATACURRENT):0);
            result.put(PAGINATION,pagemode);
            }catch(Exception e){
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG+e.getMessage());
            }
            return result;
    }


    @PostMapping( "/queryPageVue")
    @ApiOperation(value="根据-{按钮资源表}-对象Map分页记录", notes="成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
        @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
        @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageVueForProResourceActionForWeb(HttpServletRequest request , HttpServletResponse response,@RequestBody Map<String, Object> map)
    {
            Map<String, Object> result = new HashMap<String, Object>();
            try {

            int currentPage = map.get(DATACURRENT_VUE)!=null?Integer.parseInt(map.get(DATACURRENT_VUE)+"")-1:0;
            int pageSize = map.get(PAGESIZE_VUE)!=null?Integer.parseInt(map.get(PAGESIZE_VUE)+""):10;
            int pageStart = currentPage*pageSize ;


            map.put(PAGESIZE_VUE,pageSize);
            map.put(PAGESTART,pageStart);

            int total = proResourceActionService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proResourceActionService.queryPage(map);
            }
            Map<String, Object> tempresult = new HashMap<String, Object>();
            tempresult.put(DATASUCCESS, SUCCESSFLAG);
            tempresult.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            tempresult.put(DATALIST_VUE,datalist);
            tempresult.put(DATATOTAL_VUE,total);
            tempresult.put(PAGESIZE_VUE,map.get(PAGESIZE_VUE)!=null?map.get(PAGESIZE_VUE):10);
            tempresult.put(DATACURRENT_VUE,map.get(DATACURRENT_VUE)!=null?map.get(DATACURRENT_VUE):0);
            result.put(DATARESULT, tempresult);
            }catch(Exception e){
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG+e.getMessage());
            }
            return result;
    }



    @PostMapping( "/queryPageOracle")
    @ApiOperation(value="根据-{按钮资源表}-对象Map分页记录", notes="成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
        @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
        @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageOracleForProResourceActionForWeb(HttpServletRequest request , HttpServletResponse response,@RequestBody Map<String, Object> map)
    {
            Map<String, Object> result = new HashMap<String, Object>();
            try {

            int currentPage = map.get(DATACURRENT)!=null?Integer.parseInt(map.get(DATACURRENT)+""):1;
            int pageSize = map.get(PAGESIZE)!=null?Integer.parseInt(map.get(PAGESIZE)+""):10;
            int pageStart = currentPage*pageSize ;


            map.put(PAGESTART,(currentPage-1)*pageSize);
            map.put(PAGEEND,currentPage*pageSize);

            int total = proResourceActionService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proResourceActionService.queryPage(map);
            }
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST,datalist);
            Map<String, Object> pagemode = new HashMap<String, Object>();
            pagemode.put(DATATOTAL,total);
            pagemode.put(PAGESIZE,map.get(PAGESIZE)!=null?map.get(PAGESIZE):10);
            pagemode.put(DATACURRENT,map.get(DATACURRENT)!=null?map.get(DATACURRENT):0);
            result.put(PAGINATION,pagemode);
            }catch(Exception e){
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG+e.getMessage());
            }
            return result;
    }

    @PostMapping("/count")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map统计查询总数记录", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map统计查询总数记录", value = "query", type = "PC")
    public Map<String, Object> countForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATATOTAL_VUE, proResourceActionService.count(map));
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/insertBatch")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map批量插入记录", notes = "成功返回:{\"success\":true,\"message\",\"数据插入成功\"},失败返回:{\"success\":false,\"message\",\"数据插入失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map批量插入记录", value = "insert", type = "PC")
    public Map<String, Object> insertBatchForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Map<String, Object>> list) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            for (Map<String, Object> map : list) {
                map.put("id", UUID.randomUUID().toString().replaceAll("-", ""));
            }

            proResourceActionService.insertBatch(list);
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, INSERT_SUCCESS_MSG);
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, INSERT_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/deleteBatch")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map批量删除记录", notes = "成功返回:{\"success\":true,\"message\",\"数据删除成功\"},失败返回:{\"success\":false,\"message\",\"数据删除失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map批量删除记录", value = "delete", type = "PC")
    public Map<String, Object> deleteBatchForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Map<String, Object>> list) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            proResourceActionService.deleteBatch(list);
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, DELETE_SUCCESS_MSG);

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, DELETE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/updateBatch")
    @ApiOperation(value = "根据-{按钮资源表}-对象Map批量更新记录", notes = "成功返回:{\"success\":true,\"message\",\"数据更新成功\"},失败返回:{\"success\":false,\"message\",\"数据更新失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", value = "记录Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "name", value = "操作名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "enname", value = "英文名称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "handler", value = "操作方法", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "status", value = "状态", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "orderid", value = "排序", required = true,  dataTypeClass = Integer.class),
            @ApiImplicitParam(paramType = "body", name = "memo", value = "备注", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "上级id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "create_time", value = "创建日期", required = true,  dataTypeClass = Date.class),
            @ApiImplicitParam(paramType = "body", name = "menuid", value = "菜单id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "htmlid", value = "html页面Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaftype", value = "节点级别", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{按钮资源表}-对象Map批量更新记录", value = "update", type = "PC")
    public Map<String, Object> updateBatchForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Map<String, Object>> list) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {


            proResourceActionService.updateBatch(list);
            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, UPDATE_SUCCESS_MSG);

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, UPDATE_FAIL_MSG + e.getMessage());
        }
        return result;
    }


    @PostMapping("/getProResourceTreeByParentid")
    @ApiOperation(value = "查询所有资源数据根据父节点id", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父资源ID", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "查询所有资源数据根据父节点id", value = "query", type = "PC")
    public Map<String, Object> getProResourceTreeByParentid(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            List<Map<String, Object>> treedata = proResourceActionService.getProResourceTreeByParentid(map);


            for (Map<String, Object> tree : treedata) {
                tree.put("key", tree.get("id"));
                tree.put("title", tree.get("name"));

            }

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST_VUE, treedata);


        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }


    @PostMapping("/getProResourceTreeByLevelCode")
    @ApiOperation(value = "查询所有资源数据根据层次码", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父资源ID", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "查询所有资源数据根据层次码", value = "query", type = "PC")
    public Map<String, Object> getProResourceTreeByLevelCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            String parentid = map.get("parentid") + "";

            List<Map<String, Object>> treedata = proResourceActionService.getProResourceTreeByLevelCode(map);

            List<Map<String, Object>> parenttreedata = new ArrayList<Map<String, Object>>();

            if (null != treedata && treedata.size() > 0) {

                //一级树节点
                for (Map<String, Object> tree : treedata) {
                    tree.put("key", tree.get("id"));
                    tree.put("title", tree.get("name"));

                    if (tree.get("parentid").equals(parentid)) {
                        parenttreedata.add(tree);
                    }
                }

                //二级树节点
                List<Map<String, Object>> second_treedata = new ArrayList<Map<String, Object>>();//二级树节点
                for (Map<String, Object> ptree : parenttreedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            second_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                List<Map<String, Object>> third_treedata = new ArrayList<Map<String, Object>>();//三级树节点
                List<Map<String, Object>> fourth_treedata = new ArrayList<Map<String, Object>>();//四级树节点
                List<Map<String, Object>> fifth_treedata = new ArrayList<Map<String, Object>>();//五级树节点
                List<Map<String, Object>> sixth_treedata = new ArrayList<Map<String, Object>>();//六级树节点
                List<Map<String, Object>> seventh_treedata = new ArrayList<Map<String, Object>>();//七级树节点
                List<Map<String, Object>> eighth_treedata = new ArrayList<Map<String, Object>>();//八级树节点
                List<Map<String, Object>> nineth_treedata = new ArrayList<Map<String, Object>>();//九级树节点
                List<Map<String, Object>> tenth_treedata = new ArrayList<Map<String, Object>>();//十级树节点

                //三级树节点
                for (Map<String, Object> ptree : second_treedata) {
                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();

                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            third_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //四级树节点
                for (Map<String, Object> ptree : third_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fourth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //五级树节点
                for (Map<String, Object> ptree : fourth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fifth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //六级树节点
                for (Map<String, Object> ptree : fifth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            sixth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //七级树节点
                for (Map<String, Object> ptree : sixth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	seventh_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }
                //八级树节点
                for (Map<String, Object> ptree : seventh_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	eighth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //九级树节点
                for (Map<String, Object> ptree : eighth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	nineth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //十级树节点
                for (Map<String, Object> ptree : nineth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	tenth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }



            }

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST, parenttreedata);

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/getProResourceTreeByLevelCodeForGrading")
    @ApiOperation(value = "查询所有资源数据根据层次码", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父资源ID", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "查询所有资源数据根据层次码", value = "query", type = "PC")
    public Map<String, Object> getProResourceTreeByLevelCodeForGrading(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            String parentid = map.get("parentid") + "";
            map.put("userId", ActiveUserUtils.getUserId());
            List<Map<String, Object>> treedata = proResourceActionService.getProResourceTreeByLevelCode(map);

            List<Map<String, Object>> parenttreedata = new ArrayList<Map<String, Object>>();

            if (null != treedata && treedata.size() > 0) {

                //一级树节点
                for (Map<String, Object> tree : treedata) {
                    tree.put("key", tree.get("id"));
                    tree.put("title", tree.get("name"));

                    if (tree.get("parentid").equals(parentid)) {
                        parenttreedata.add(tree);
                    }
                }

                //二级树节点
                List<Map<String, Object>> second_treedata = new ArrayList<Map<String, Object>>();//二级树节点
                for (Map<String, Object> ptree : parenttreedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            second_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                List<Map<String, Object>> third_treedata = new ArrayList<Map<String, Object>>();//三级树节点
                List<Map<String, Object>> fourth_treedata = new ArrayList<Map<String, Object>>();//四级树节点
                List<Map<String, Object>> fifth_treedata = new ArrayList<Map<String, Object>>();//五级树节点
                List<Map<String, Object>> sixth_treedata = new ArrayList<Map<String, Object>>();//六级树节点
                List<Map<String, Object>> seventh_treedata = new ArrayList<Map<String, Object>>();//七级树节点
                List<Map<String, Object>> eighth_treedata = new ArrayList<Map<String, Object>>();//八级树节点
                List<Map<String, Object>> nineth_treedata = new ArrayList<Map<String, Object>>();//九级树节点
                List<Map<String, Object>> tenth_treedata = new ArrayList<Map<String, Object>>();//十级树节点

                //三级树节点
                for (Map<String, Object> ptree : second_treedata) {
                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();

                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            third_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //四级树节点
                for (Map<String, Object> ptree : third_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fourth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //五级树节点
                for (Map<String, Object> ptree : fourth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fifth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //六级树节点
                for (Map<String, Object> ptree : fifth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            sixth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //七级树节点
                for (Map<String, Object> ptree : sixth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            seventh_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }
                //八级树节点
                for (Map<String, Object> ptree : seventh_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            eighth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //九级树节点
                for (Map<String, Object> ptree : eighth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            nineth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //十级树节点
                for (Map<String, Object> ptree : nineth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            tenth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }



            }

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST, parenttreedata);

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }
    @PostMapping("/getProResourceTreeByLevelCodeVue")
    @ApiOperation(value = "查询所有资源数据根据层次码", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父资源ID", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "查询所有资源数据根据层次码", value = "query", type = "PC")
    public Map<String, Object> getProResourceTreeByLevelCodeVue(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            String parentid = map.get("parentid") + "";

            List<Map<String, Object>> treedata = proResourceActionService.getProResourceTreeByLevelCode(map);

            List<Map<String, Object>> parenttreedata = new ArrayList<Map<String, Object>>();

            if (null != treedata && treedata.size() > 0) {

                //一级树节点
                for (Map<String, Object> tree : treedata) {
                    tree.put("key", tree.get("id"));
                    tree.put("title", tree.get("name"));

                    if (tree.get("parentid").equals(parentid)) {
                        parenttreedata.add(tree);
                    }
                }

                //二级树节点
                List<Map<String, Object>> second_treedata = new ArrayList<Map<String, Object>>();//二级树节点
                for (Map<String, Object> ptree : parenttreedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            second_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                List<Map<String, Object>> third_treedata = new ArrayList<Map<String, Object>>();//三级树节点
                List<Map<String, Object>> fourth_treedata = new ArrayList<Map<String, Object>>();//四级树节点
                List<Map<String, Object>> fifth_treedata = new ArrayList<Map<String, Object>>();//五级树节点
                List<Map<String, Object>> sixth_treedata = new ArrayList<Map<String, Object>>();//六级树节点
                List<Map<String, Object>> seventh_treedata = new ArrayList<Map<String, Object>>();//七级树节点
                List<Map<String, Object>> eighth_treedata = new ArrayList<Map<String, Object>>();//八级树节点
                List<Map<String, Object>> nineth_treedata = new ArrayList<Map<String, Object>>();//九级树节点
                List<Map<String, Object>> tenth_treedata = new ArrayList<Map<String, Object>>();//十级树节点

                //三级树节点
                for (Map<String, Object> ptree : second_treedata) {
                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();

                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            third_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //四级树节点
                for (Map<String, Object> ptree : third_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fourth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //五级树节点
                for (Map<String, Object> ptree : fourth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            fifth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //六级树节点
                for (Map<String, Object> ptree : fifth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));
                        if (tree.get("parentid").equals(ptree.get("id"))) {
                            sixth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //七级树节点
                for (Map<String, Object> ptree : sixth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	seventh_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }
                //八级树节点
                for (Map<String, Object> ptree : seventh_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	eighth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //九级树节点
                for (Map<String, Object> ptree : eighth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	nineth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }

                //十级树节点
                for (Map<String, Object> ptree : nineth_treedata) {

                    List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                    for (Map<String, Object> tree : treedata) {
                        tree.put("key", tree.get("id"));
                        tree.put("title", tree.get("name"));

                        if (tree.get("parentid").equals(ptree.get("id"))) {
                        	tenth_treedata.add(tree);
                            sontreedata.add(tree);
                        }
                    }
                    ptree.put("children", sontreedata);
                }



            }

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST_VUE, parenttreedata);

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/updateDropNode")
    @ApiOperation(value = "根据-{来源节点与目标节点}-对象更新记录", notes = "成功返回:{\"success\":true,\"message\",\"数据更新成功\"},失败返回:{\"success\":false,\"message\",\"数据更新失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "dragId", value = "拖拽的id", required = true, dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "newParentid", value = "新的父id", required = true, dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "newLevelcode", value = "新的层次码", required = true, dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "sortArray", value = "排序", required = true, dataTypeClass = List.class),
    })
    @OperateLog(name = "根据-{来源节点与目标节点}-对象更新记录", value = "update", type = "PC")
    public Map<String, Object> updateDropNodeForProResourceActionForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            String dragId = Convert.toStr(map.get("dragId"), "");
            String newParentid = Convert.toStr(map.get("newParentid"), "");
            String newLevelcode = Convert.toStr(map.get("newLevelcode"), "");
            List<Map<String, String>> sortList = new ArrayList<>();
            if (StringUtils.isNotEmpty(Convert.toStr(map.get("sortArray")))) {
                sortList = JSONArray.parseObject(JSONObject.toJSONString(map.get("sortArray")), List.class);
            }

            Map<String, Object> paramsmap = proResourceActionService.selectByPrimaryKey(dragId);

            int flag = 0;
            if (StringUtils.isNotEmpty(paramsmap)) {
                Map<String, Object> temp = new HashMap<>();
                temp.put("old_levelcode", paramsmap.get("levelcode"));
                temp.put("old_parentid", paramsmap.get("parentid"));
                temp.put("parentid", newParentid);
                temp.put("levelcode", newLevelcode);
                temp.put("sort_array", sortList);
                paramsmap.putAll(temp);
                flag = proResourceActionService.updateDropNode(paramsmap);
            }

            if (1 <= flag) {
                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, UPDATE_SUCCESS_MSG);
                result.put(DATARECORD, paramsmap);
            } else {
                result.put(DATASUCCESS, ERRORFLAG);
                result.put(DATAMESSAGE, UPDATE_FAIL_MSG);
            }

        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, UPDATE_FAIL_MSG + e.getMessage());
        }
        return result;
    }

    @PostMapping("/getAllForProResourceActionByUserId")
    @ApiOperation(value = "查询所有资源数据用户ID", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "user_name", value = "用户ID", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "res_type", value = "资源类型", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "查询所有资源数据用户ID", value = "query", type = "PC")
    public Map<String, Object> getAllForProResourceActionByUserIdForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            map.put("user_name", ActiveUserUtils.getUserId());
            map.put("res_type", "F");

            // 查询所有的button数据
            List<Map<String, Object>> buttonAll = proResourceActionService.getAllForProResourceAction(map);

            // 查询授权表中用户已有的所有button
            List<Map<String, Object>> resourcedata = proResourceActionService.getAllForProResourceActionByUserId(map);

            List<Map<String, Object>> resList = new ArrayList<>();
            if(StringUtils.isNotEmpty(buttonAll)) {
                for (Map<String, Object> stringObjectMap : buttonAll) {
                    String buttonAuth = Convert.toStr(stringObjectMap.get("handler"), "");
                    stringObjectMap.put(buttonAuth, false);
                    if(StringUtils.isNotEmpty(resourcedata)) {
                        for (Map<String, Object> resourcedatum : resourcedata) {
                            if(Convert.toStr(stringObjectMap.get("id"), "buttonAll").equals(Convert.toStr(resourcedatum.get("id"), "resourcedata"))) {
                                stringObjectMap.put(buttonAuth, true);
                            }
                        }
                    }
                    resList.add(stringObjectMap);
                }
            }

            Map<String, List<Map<String, Object>>> resourcegroupdata = resList.stream().collect(Collectors.groupingBy(e -> {
                String path = "unclassified";
                if(null != e.get("menu")) {
                    JSONObject menu = JSONObject.parseObject(JSONObject.toJSONString(e.get("menu")));
                    path = Convert.toStr(menu.get("path"), "unclassified");
                }
                return path;
            }));

            Map<String, Object> resourcemap = new HashMap<>();
            for (Map.Entry<String, List<Map<String, Object>>> stringListEntry : resourcegroupdata.entrySet()) {
                Map<String, Object> buttonMap = new HashMap<>();
                for (Map<String, Object> stringObjectMap : stringListEntry.getValue()) {
                    buttonMap.put(Convert.toStr(stringObjectMap.get("handler"), ""), Convert.toBool(stringObjectMap.get(Convert.toStr(stringObjectMap.get("handler"), "")), false));
                }
                resourcemap.put(stringListEntry.getKey(), buttonMap);
            }

            Map<String, Object> resultMap = new HashMap<>();
            resultMap.put("button", resourcemap);

            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATARECORD, resultMap);

        } catch (Exception e) {
            e.printStackTrace();
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
        return result;
    }

}
