package com.philisense.www.controller.web;

import com.alibaba.fastjson.JSON;
import com.philisense.www.common.config.CommonConst;
import com.philisense.www.service.ProDictionarysService;
import com.philisense.www.annotation.log.OperateLog;
import com.philisense.www.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.philisense.www.controller.BaseUtilController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(CommonConst.WEB_REST_SERVICE_PREFICX + "prodictionarys")
@Api(tags = "ProDictionarysControllerForWeb|一个用来操作-{系统字典表}-业务模块的控制器")
public class ProDictionarysControllerForWeb extends BaseUtilController {

    @Autowired
    private ProDictionarysService proDictionarysService;


    @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> deleteByPrimaryKeyForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestParam String recordid) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            int flag = proDictionarysService.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> selectByPrimaryKeyForProDictionarysForWeb(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, proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象插入记录", value = "insert", type = "PC")
    public Map<String, Object> insertForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            map.put("id", UUID.randomUUID().toString().replaceAll("-", ""));

            proDictionarysService.insert(map);
            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("/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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象更新记录", value = "update", type = "PC")
    public Map<String, Object> updateForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            Map<String, Object> paramsmap = proDictionarysService.selectByPrimaryKey(map.get("id") + "");

            int flag = 0;

            if (null != paramsmap && paramsmap.size() > 0) {
                paramsmap.putAll(map);
                flag = proDictionarysService.update(paramsmap);
            }

            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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map删除记录", value = "delete", type = "PC")
    public Map<String, Object> deleteByMapForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            int flag = proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map更新记录", value = "update", type = "PC")
    public Map<String, Object> updateByMapForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {


            int flag = proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map查询记录", value = "query", type = "PC")
    public Map<String, Object> getOneForProDictionarysForWeb(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, proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map查询所有记录", value = "query", type = "PC")
    public Map<String, Object> getAllForProDictionarysForWeb(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, proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{部门表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageForProDictionarysForWeb(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 = proDictionarysService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{部门表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageVueForProDictionarysForWeb(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 = proDictionarysService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
        @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{部门表}-对象Map分页记录",value = "query",type = "PC")
    public Map<String, Object>  queryPageOracleForProDictionarysForWeb(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 = proDictionarysService.count(map);
            List<Map<String, Object>> datalist = new ArrayList<Map<String, Object>>();
            if(total>0){
            datalist = proDictionarysService.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("/queryDicBytype")
    @ApiOperation(value = "根据-{字典类型}-查询业务字典", notes = "成功返回:{\"success\":true,\"message\",\"数据查询成功\",\"data\":\"[]\"},失败返回:{\"success\":false,\"message\",\"数据查询失败\"}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = false,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map分页记录", value = "query", type = "PC")
    public Map<String, Object> queryDicBytypeForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            Map<String, Object> resultMap = new HashMap<>();

             List<Map<String, Object>> datalist = proDictionarysService.queryPageForTypes(map);
                for (Map<String, Object> dmap : datalist) {

                    String types = "" + dmap.get("type_s");
                    String leaf = "" + dmap.get("leaf");

                    HashMap<String, Object> paramMap = new HashMap<>();

                    paramMap.put("type_s", types);
                    List<Map<String, Object>> sonLists = proDictionarysService.queryPage(paramMap);

                    Map<String, Object> sMap = new HashMap();

                    if (leaf.equalsIgnoreCase("0")) {
                        //无子节点

                        for (int i = 0; i < sonLists.size(); i++) {
                            Map<String, Object> tMap = sonLists.get(i);
                            sMap.put("" + tMap.get("code"), tMap.get("name"));
                        }

                    } else {
                        //存在父子节点

                        paramMap.put("leaf", "0");
                        List<Map<String, Object>> parLists = proDictionarysService.queryPage(paramMap);

                        HashMap<String, Object> sonMap = new HashMap<>();

                        for (Map<String, Object> parMap : parLists) {

                            List<Map<String, Object>> mapList = sonLists.stream().filter(nMap -> ("" + parMap.get("id")).equalsIgnoreCase("" + nMap.get("parentid"))).collect(Collectors.toList());

                            Map<String, Object> rMap = new HashMap<String, Object>();

                            for (int i = 0; i < mapList.size(); i++) {

                                Map<String, Object> tMap = mapList.get(i);
                                rMap.put("" + tMap.get("code"), tMap.get("name"));

                            }
                            sonMap.put("" + parMap.get("code"), rMap);
                        }
                        sMap=sonMap;
                    }
                    resultMap.put(types, sMap);
                }


            result.put(DATASUCCESS, SUCCESSFLAG);
            result.put(DATAMESSAGE, QUERY_SUCCESS_MSG);
            result.put(DATALIST_VUE, resultMap);
        } 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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map统计查询总数记录", value = "query", type = "PC")
    public Map<String, Object> countForProDictionarysForWeb(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, proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map批量插入记录", value = "insert", type = "PC")
    public Map<String, Object> insertBatchForProDictionarysForWeb(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("-", ""));
            }

            proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map批量删除记录", value = "delete", type = "PC")
    public Map<String, Object> deleteBatchForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Map<String, Object>> list) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            proDictionarysService.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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{系统字典表}-对象Map批量更新记录", value = "update", type = "PC")
    public Map<String, Object> updateBatchForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Map<String, Object>> list) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {


            proDictionarysService.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;
    }


    @GetMapping("/export")
    @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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{{系统字典表}}-对象Map导出所有记录", value = "query", type = "PC")
    public void exportForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {

            List<Map<String, Object>> rows = proDictionarysService.getAll(map);
            // 通过工具类创建writer
            //创建xlsx格式的
            ExcelWriter writer = ExcelUtil.getWriter(true);
            String filename = "系统字典表";
            getWriter(writer, filename);
            writer.setHeaderAlias(getKVAliasMap());


            writer.setOnlyAlias(true);

            // 一次性写出内容，使用默认样式，强制输出标题
            writer.write(rows, true);

            //response为HttpServletResponse对象
            response.setContentType("application/vnd.ms-excel;charset=utf-8");
            //test.xls是弹出下载对话框的文件名，不能为中文，中文请自行编码
            response.setHeader("Content-Disposition", "attachment;filename=" + filename + "_ProDictionarys.xlsx");
            ServletOutputStream out = response.getOutputStream();
            writer.flush(out, true);
            // 关闭writer，释放内存
            writer.close();
            //此处记得关闭输出Servlet流
            IoUtil.close(out);

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


    @GetMapping("/exportTemplate")
    @ApiOperation(value = "根据-{{系统字典表}}-下载导出模板", 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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{{系统字典表}}-下载导出模板", value = "query", type = "PC")
    public void exportTemplateForProDictionarysForWeb(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, Object> map) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            String filename = "系统字典表";
            InputStream resource = getClass().getClassLoader().getResourceAsStream("excelTemplate/prodictionarys" + "/" + filename + "_ProDictionarys.xlsx");
            //response为HttpServletResponse对象
            response.setContentType("application/vnd.ms-excel;charset=utf-8");
            //test.xls是弹出下载对话框的文件名，不能为中文，中文请自行编码
            response.setHeader("Content-Disposition", "attachment;filename=" + filename + "_ProDictionarys.xlsx");
            ServletOutputStream out = response.getOutputStream();
            IoUtil.copy(resource, out);
            //此处记得关闭输出Servlet流
            IoUtil.close(out);
            IoUtil.close(resource);
        } catch (Exception e) {
            result.put(DATASUCCESS, ERRORFLAG);
            result.put(DATAMESSAGE, QUERY_FAIL_MSG + e.getMessage());
        }
    }


    @PostMapping("/importExcel")
    @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 = "code", value = "code", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "parentid", value = "父Id", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "levelcode", value = "层次码", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "leaf", value = "是否叶子", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "icon", value = "图标", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "cls", value = "层叠样式", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_s", value = "类型简称", required = true,  dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "body", name = "type_a", value = "类型全称", required = true,  dataTypeClass = String.class)
    })
    @OperateLog(name = "根据-{{系统字典表}}-对象Map批量导入记录", value = "update", type = "PC")
    public Map<String, Object> importExcelForProDictionarysForWeb(String baseDir, MultipartFile file) {
        Map<String, Object> result = new HashMap<String, Object>();

        if (!file.isEmpty()) {
            try {
                ExcelReader reader = ExcelUtil.getReader(file.getInputStream());

                reader.setHeaderAlias(getVKAliasMap());


                List<Map<String, Object>> list = new ArrayList<>();
                List<Map<String, Object>> read = reader.read(1, 2, Integer.MAX_VALUE);

                for (Map<String, Object> map : read) {


                    if ("".equals(map.get("id"))) {
                        map.put("id", null);
                    }

                    if ("".equals(map.get("name"))) {
                        map.put("name", null);
                    }

                    if ("".equals(map.get("code"))) {
                        map.put("code", null);
                    }

                    if ("".equals(map.get("parentid"))) {
                        map.put("parentid", null);
                    }

                    if ("".equals(map.get("levelcode"))) {
                        map.put("levelcode", null);
                    }

                    if ("".equals(map.get("leaf"))) {
                        map.put("leaf", null);
                    }

                    if ("".equals(map.get("icon"))) {
                        map.put("icon", null);
                    }

                    if ("".equals(map.get("cls"))) {
                        map.put("cls", null);
                    }

                    if ("".equals(map.get("type_s"))) {
                        map.put("type_s", null);
                    }

                    if ("".equals(map.get("type_a"))) {
                        map.put("type_a", null);
                    }


                    list.add(map);

                }
                proDictionarysService.insertBatch(list);

                result.put(DATASUCCESS, SUCCESSFLAG);
                result.put(DATAMESSAGE, INSERT_SUCCESS_MSG);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        result.put(DATASUCCESS, ERRORFLAG);
        result.put(DATAMESSAGE, INSERT_FAIL_MSG);
        return result;
    }


    protected void getWriter(ExcelWriter writer, String filename) {
        // 通过工具类创建writer
        //创建xlsx格式的
        writer.setColumnWidth(0, 25);
        writer.setColumnWidth(1, 25);
        writer.setColumnWidth(2, 25);
        writer.setColumnWidth(3, 25);
        writer.setColumnWidth(4, 25);
        writer.setColumnWidth(5, 25);
        writer.setColumnWidth(6, 25);
        writer.setColumnWidth(7, 25);
        writer.setColumnWidth(8, 25);
        writer.setColumnWidth(9, 25);
        // 合并单元格后的标题行，使用默认标题样式
        writer.merge(10, filename);

    }


    protected Map<String, String> getKVAliasMap() {

        Map<String, String> aliasMap = new LinkedHashMap<>();

        aliasMap.put("id", "Id");
        aliasMap.put("name", "名称");
        aliasMap.put("code", "code");
        aliasMap.put("parentid", "父Id");
        aliasMap.put("levelcode", "层次码");
        aliasMap.put("leaf", "是否叶子");
        aliasMap.put("icon", "图标");
        aliasMap.put("cls", "层叠样式");
        aliasMap.put("type_s", "类型简称");
        aliasMap.put("type_a", "类型全称");

        return aliasMap;

    }

    protected Map<String, String> getVKAliasMap() {
        Map<String, String> aliasMap = new LinkedHashMap<>();

        aliasMap.put("Id", "id");
        aliasMap.put("名称", "name");
        aliasMap.put("code", "code");
        aliasMap.put("父Id", "parentid");
        aliasMap.put("层次码", "levelcode");
        aliasMap.put("是否叶子", "leaf");
        aliasMap.put("图标", "icon");
        aliasMap.put("层叠样式", "cls");
        aliasMap.put("类型简称", "type_s");
        aliasMap.put("类型全称", "type_a");

        return aliasMap;
    }


}
