jeecg-boot字典翻译改造(支持实体类详情查询自动翻译)

2023-11-13

  1. 找到字典切面类(DictAspect)

  2. 改造方法(parseDictText)

支持自动生成的列表接口/单个实体类查询翻译
代码如下:

private void parseDictText(Object result) {
        if (result instanceof Result) {
            if (((Result) result).getResult() instanceof IPage) {
                List<JSONObject> items = new ArrayList<>();
                for (Object record : ((IPage) ((Result) result).getResult()).getRecords()) {
                    ObjectMapper mapper = new ObjectMapper();
                    String json = "{}";
                    try {
                        //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                        json = mapper.writeValueAsString(record);
                    } catch (JsonProcessingException e) {
                        log.error("json解析失败" + e.getMessage(), e);
                    }
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                        //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : " + textValue);
                            log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                            SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
                    items.add(item);
                }
                ((IPage) ((Result) result).getResult()).setRecords(items);
            } else {
                Object record = (Object) ((Result) result).getResult();
                ObjectMapper mapper = new ObjectMapper();
                String json = "{}";
                try {
                    //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                    json = mapper.writeValueAsString(record);
                } catch (JsonProcessingException e) {
                    log.error("json解析失败" + e.getMessage(), e);
                }
                try {
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                        //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : " + textValue);
                            log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                            SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
//                }
                    ((Result) result).setResult(item);
                }catch (Exception e){
                    log.info("########################此返回类型不支持字典翻译########################");
                }
            }
        }
    }

单个查询返回数据格式样例:

/**
 * 通过id查询
 *
 * @param id
 * @return
 */

@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
   ShgBanner shgBanner = shgBannerService.getById(id);
   if(shgBanner==null) {
      return Result.error("未找到对应数据");
   }
   return Result.ok(shgBanner);
}

第二版改造 : 2023/2/22

总结:

  1. 支持单个实体类解析
  2. 支持实体类集合解析
  3. 支持过滤基本类型集合不进行解析, 暂时过滤了三种 java.lang.String java.lang.long java.lang.Integer

完整方法如下 :

private void parseDictTextOne(Object result) {
        if (result instanceof Result) {
            if (((Result) result).getResult() instanceof IPage) {
                List<JSONObject> items = new ArrayList<>();
                for (Object record : ((IPage) ((Result) result).getResult()).getRecords()) {
                    ObjectMapper mapper = new ObjectMapper();
                    String json = "{}";
                    try {
                        //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                        json = mapper.writeValueAsString(record);
                    } catch (JsonProcessingException e) {
                        log.error("json解析失败" + e.getMessage(), e);
                    }
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                        //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : " + textValue);
                            log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                            SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
                    items.add(item);
                }
                ((IPage) ((Result) result).getResult()).setRecords(items);
            } else if (((Result) result).getResult() instanceof List) {
                List result1 = (List) ((Result) result).getResult();
                if (CollectionUtils.isNotEmpty(result1)) {
                    Class<?> aClass = result1.get(0).getClass();
                    String className = aClass.getName();
                    log.info("------- List<T> 泛型 T is {}", className);
                    //只解析result中list泛型是object的数据, 基本数据类型不解析
                    /**
                     * 以下类型不解析
                     * java.lang.String
                     * java.lang.long
                     * java.lang.Integer
                     */
                    if (!className.equals("java.lang.String") && !className.equals("java.lang.long") && !className.equals("java.lang.Integer")) {
                        List<JSONObject> items = new ArrayList<>();
                        for (Object record : (List) ((Result) result).getResult()) {
                            ObjectMapper mapper = new ObjectMapper();
                            String json = "{}";
                            try {
                                //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                                json = mapper.writeValueAsString(record);
                            } catch (JsonProcessingException e) {
                                log.error("json解析失败" + e.getMessage(), e);
                            }
                            JSONObject item = JSONObject.parseObject(json);
                            //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                            //for (Field field : record.getClass().getDeclaredFields()) {
                            for (Field field : oConvertUtils.getAllFields(record)) {
                                //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                                if (field.getAnnotation(Dict.class) != null) {
                                    String code = field.getAnnotation(Dict.class).dicCode();
                                    String text = field.getAnnotation(Dict.class).dicText();
                                    String table = field.getAnnotation(Dict.class).dictTable();
                                    String key = String.valueOf(item.get(field.getName()));

                                    //翻译字典值对应的txt
                                    String textValue = translateDictValue(code, text, table, key);

                                    log.debug(" 字典Val : " + textValue);
                                    log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                                    item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                                }
                                //date类型默认转换string格式化日期
                                if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                                    SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                    item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                                }
                            }
                            items.add(item);
                        }
                        ((Result) result).setResult(items);
                    }else {
                        log.info("只解析result中list<T>泛型是实体类的数据, 基本数据类型不解析: T is {}", className);
                    }
                }else {
                    log.info(" result中List<T> 为空,跳过不解析 ");
                }

            } else {
                Object record = (Object) ((Result) result).getResult();
                ObjectMapper mapper = new ObjectMapper();
                String json = "{}";
                try {
                    //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                    json = mapper.writeValueAsString(record);
                } catch (JsonProcessingException e) {
                    log.error("json解析失败" + e.getMessage(), e);
                }
                try {
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                        //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : " + textValue);
                            log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                            SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
                    ((Result) result).setResult(item);
                } catch (Exception e) {
                    log.info("########################此返回类型不支持字典翻译########################");
                }
            }
        }
    }

改造部分如下 :

else if (((Result) result).getResult() instanceof List) {
                List result1 = (List) ((Result) result).getResult();
                if (CollectionUtils.isNotEmpty(result1)) {
                    Class<?> aClass = result1.get(0).getClass();
                    String className = aClass.getName();
                    log.info("------- List<T> 泛型 T is {}", className);
                    //只解析result中list泛型是object的数据, 基本数据类型不解析
                    /**
                     * 以下类型不解析
                     * java.lang.String
                     * java.lang.long
                     * java.lang.Integer
                     */
                    if (!className.equals("java.lang.String") && !className.equals("java.lang.long") && !className.equals("java.lang.Integer")) {
                        List<JSONObject> items = new ArrayList<>();
                        for (Object record : (List) ((Result) result).getResult()) {
                            ObjectMapper mapper = new ObjectMapper();
                            String json = "{}";
                            try {
                                //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                                json = mapper.writeValueAsString(record);
                            } catch (JsonProcessingException e) {
                                log.error("json解析失败" + e.getMessage(), e);
                            }
                            JSONObject item = JSONObject.parseObject(json);
                            //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                            //for (Field field : record.getClass().getDeclaredFields()) {
                            for (Field field : oConvertUtils.getAllFields(record)) {
                                //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                                if (field.getAnnotation(Dict.class) != null) {
                                    String code = field.getAnnotation(Dict.class).dicCode();
                                    String text = field.getAnnotation(Dict.class).dicText();
                                    String table = field.getAnnotation(Dict.class).dictTable();
                                    String key = String.valueOf(item.get(field.getName()));

                                    //翻译字典值对应的txt
                                    String textValue = translateDictValue(code, text, table, key);

                                    log.debug(" 字典Val : " + textValue);
                                    log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                                    item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                                }
                                //date类型默认转换string格式化日期
                                if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                                    SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                    item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                                }
                            }
                            items.add(item);
                        }
                        ((Result) result).setResult(items);
                    }else {
                        log.info("只解析result中list<T>泛型是实体类的数据, 基本数据类型不解析: T is {}", className);
                    }
                }else {
                    log.info(" result中List<T> 为空,跳过不解析 ");
                }

            } else {
                Object record = (Object) ((Result) result).getResult();
                ObjectMapper mapper = new ObjectMapper();
                String json = "{}";
                try {
                    //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                    json = mapper.writeValueAsString(record);
                } catch (JsonProcessingException e) {
                    log.error("json解析失败" + e.getMessage(), e);
                }
                try {
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                        //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : " + textValue);
                            log.debug(" __翻译字典字段__ " + field.getName() + CommonConstant.DICT_TEXT_SUFFIX + ": " + textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date") && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                            SimpleDateFormat aDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
                    ((Result) result).setResult(item);
                } catch (Exception e) {
                    log.info("########################此返回类型不支持字典翻译########################");
                }
            }

支持如下返回方式 :

// 单个实体解析
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
   ShgBanner shgBanner = shgBannerService.getById(id);
   if(shgBanner==null) {
      return Result.error("未找到对应数据");
   }
   return Result.ok(shgBanner);
}

// 列表实体解析
@GetMapping("/queryRawMaters")
public Result<?> queryRawMaters(){
	List<HgRawMaterial> rawMaterialList = hgFinishedProductSonService.queryRawMaters();
	return Result.OK(rawMaterialList);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

jeecg-boot字典翻译改造(支持实体类详情查询自动翻译) 的相关文章

  • Python在ENG信号中的应用(1)

    实验任务点与要求 设计合适的函数读取文件中的数据 该函数以孕妇ID号为唯一参数 返回包含每一个通道每种滤波方式的二维列表sig 从而使用户能够通过sig 3 1 获得第一通道经0 3 4Hz滤波后的时序信号 设计合适的函数 计算每一通道各个
  • openai

    作者介绍 大二本科网络工程专业在读 持续学习Java 努力输出优质文章 作者主页 逐梦苍穹 所属专栏 人工智能 目录 1 简介 2 如何实现 3 api文档 1 简介 OpenAI 提供了一个名为 OpenAI API 的库 用于与他们的人
  • function_score组合script_score定制评分结果

    背景 ES版本 6 4 脚本 分两步 过滤掉不关心的数据 加速后续计算分值性能 编写分值脚本 得到最终分值 GET user doc search query function score 过滤掉不关心的数据 加速计算分值性能 query
  • 【表白神器】Python超火隐藏表白图 你能看出来吗?【附源码】

    导语 浪漫至死不渝 温柔绝对屈服 马上国庆了 没啥送的 那就送大家一些表白的代码吧 大兄弟小姐妹们 大家好 我是准时上线更新代码 讲故事的程序媛小姐姐 整理了一款超火的 隐藏表白代码 希望你们喜欢 正文 隐藏表白图 我喜欢你 就像你看不见但
  • 利用sharding-jdbc进行加密解密

    使用前必看 加密后字段不可以进行like查询 加密字段以及涉及的表 代码中需改成小写 数据库表定义也需改成小写 jar包引入 mybatis spring boot starter升级为2 2 2
  • jre替换local_policy.jar和US_export_policy.jar

    JDK1 8 0 151以前版本方法 JDK1 8 0 151的无限制强度加密策略文件变动
  • 【机器视觉系统】基于3DOF机械臂的五子棋机器人(1)

    基于3DOF机械臂的五子棋机器人 文章目录 基于3DOF机械臂的五子棋机器人 1 前言 2 机器视觉系统概述 2 1 机器 2 2 视觉 2 3 系统 3 系统组成概述 3 1 使用工具盘点 3 2 流程图 4 制作步骤建议 5 需要的知识
  • 伤腰的Python爬虫案例,零基础必备实战教程

    目录 前言 开发环境介绍 爬虫案例数据采集一般步骤 1 首先第一步 找到对应的链接地址

随机推荐

  • 三维GIS技术应用

    三维GIS技术应用 背景 以二三维一体化GIS技术为基础框架 进一步拓展二三维一体化数据模型 融合倾斜摄影 BIM 激光点云等多源异构数据 推动三维GIS实现室外室内一体化 宏观微观一体化与空天 地表 地下一体化 赋能全空间的三维GIS应用
  • 北斗短报文遥测终端机在水雨情监测系统中的应用

    一 方案概述 我国水利监管手段比较单一 水雨情监测移动公网覆盖不足等诸多问题 利用北斗短报文通信技术 数字化信息采集技术 实现水文自动测报 大幅度提升湿地生态和水域的监测 查询 预警和应急处理能力 在恶劣天气情况或特殊灾害环境中 通过北斗卫
  • Django 缓存机制 Redis缓存

    Django 提供6种缓存方式 1 开发调式缓存 2 内存缓存 3 文件缓存 4 数据库缓存 5 Memcache缓存 使用Python memcached模块 6 Memcache缓存 使用pylibmc模块 常用的缓存方式是 文件缓存
  • 5g信令流程详解_5G无线网络信令流程

    招个电子工程师 招个电子工程师 一个只专注电子工程师精准招聘的服务 精准 快速 高效 低成本 这是 招个电子工程师 服务的精髓 如果您的技术团队需要扩军 那么 热烈欢迎各大中小企业的HR和招聘负责人与我们联系 具体合作详情请咨询 管理员微信
  • Compose 动画边学边做 - 夏日彩虹

    引言 Compose 在动画方面下足了功夫 提供了种类丰富的 API 但也正由于 API 种类繁多 如果想一气儿学下来 可能会消化不良导致似懂非懂 结合例子学习是一个不错的方法 本文就带大家边学边做 通过高仿微博长按点赞的彩虹动画 学习和实
  • 初学者如何快速练习盲打

    初学者如何快速练习盲打 2012 05 22 15 25 54 转载 标签 打字练习 初学者 手感 杂谈 分类 计算机技巧 盲打要求的是对键盘的熟练 是感觉上的东西 当你看到一句话想到的不应该是每个字有哪个拼音 有那个字母 而是像 手感 一
  • sonar扫描时报Failed to upload report - An error has occurred. Please contact your administrator

    本人新学习使用此软件 参考网络各大神资料后解决问题方法如下 此问题产生的原因在于mysql的max allowed packet 参数限制默认为4M 将设置进行修改就可以了 mysql根据配置文件会限制server接受的数据包大小 有时候大
  • 【应届生必看】技术岗面试应答有哪些话术和技巧?

    很多时候 面试过程中A与B两人工作经历 能力都相差不大时 A能脱颖而出的大部分原因是在面试过程中表现出的较高的情商 稳定性和与企业文化匹配的性格 价值观等 求职者从各项提问中了解面试官想要考察的主旨 根据自己实际情况适当地进行总结和梳理 以
  • Linux操作系统学习,Linux基础命令大全

    目录 第一章 Linux简介和安装 1 1 Linux简介和分类 1 2 安装VMware虚拟机 在虚拟机中安装CentOS 7 第二章 虚拟机中Linux的IP地址配置详解 2 1 什么是IP地址 如何查看 2 2 虚拟机NAT模式中Li
  • JCR分区与中科院分区详解-中科院基础版和升级版详解

    https baijiahao baidu com s id 1642002458698070188 wfr spider for pc JCR分区 科睿唯安每年出版JCR 期刊引用报告 JCR将收录的期刊分为176个不同学科类别 每个学科
  • ubuntu安装NERDTree,Taglist和WinManager

    在ubuntu中要用vim进行开发的话 这三个插件组合在一起 给你一种顺滑的感受 NERDTree NERDTree的安装 nerdtree可以显示当前项目的文件结构 安装方法如下 执行以下命令即可 1 创建文件夹 mkdir vim 如果
  • 线性代数的本质(五)——矩阵的运算

    文章目录 矩阵的运算 矩阵的转置 方阵的运算 初等矩阵 分块矩阵 逆矩阵 矩阵的秩 广义逆矩阵 矩阵的运算 矩阵的转置 转置 矩阵 A A A的行列互换得到的矩阵称为 A A A 的转置 transpose 记作
  • 【满分】【华为OD机试真题2023B卷 JAVA&JS】最佳植树距离

    华为OD2023 B卷 机试题库全覆盖 刷题指南点这里 最佳植树距离 知识点二分查找 时间限制 1s 空间限制 256MB 限定语言 不限 题目描述 按照环保公司要求 小明需要在沙化严重的地区进行植树防沙工作 初步目标是种植一条直线的树带
  • git报错:error: RPC failed; curl 18 transfer closed with outstanding read data remaining

    今天和朋友聊天 推荐了个项目给我看看 在克隆的过程中发现太大拉不下来 报错如下 error RPC failed curl 18 transfer closed with outstanding read data remaining 远程
  • 黄金矿工(Java)

    先来一张效果图 图片资源 https pan baidu com s 1weCGFLQlzOTvDRY18bizrg pwd ivjt 提取码 ivjt 该项目一共12个类 均处于同一目录 首先是基类 其余用来表示物体的类都继承它 impo
  • Tensorflow 1.13训练模型.pb文件转换成Tensorflowlite可以使用的.tflite文件过程记录

    Tensorflow 1 13训练模型 pb文件转换成Tensorflowlite可以使用的 tflite文件过程记录 前言 之前一直通过1 13版本的TensorflowGpu训练模型 使用范围局限在电脑端 例如opencv调用模型等等
  • unity游戏开发-socket网络通信

    本篇主要是分享基于unity的客户端socket网络通信方案 关于服务器的c socekt搭建放在了这里 基于C 的Tcp服务端通信 其中关于socekt粘包断包的处理放在这里分享了 C socket粘包断包处理 目录 整体设计 TcpCl
  • Spring Security Oauth2 认证(获取token/刷新token)流程(password模式)

    1 本文介绍的认证流程范围 本文主要对从用户发起获取token的请求 oauth token 到请求结束返回token中间经过的几个关键点进行说明 2 认证会用到的相关请求 注 所有请求均为post请求 获取access token请求 o
  • BUUCTF WEB刷题记录

    第一题 刚打开的页面 看源码 发现source php 访问source php 我们要用file参数带出flag 但是有白名单限制 第一个和第二个判断是对file本身的值进行判断 第三个和第四个是对 前面的file值进行判断 所以我们可以
  • jeecg-boot字典翻译改造(支持实体类详情查询自动翻译)

    找到字典切面类 DictAspect 改造方法 parseDictText 支持自动生成的列表接口 单个实体类查询翻译 代码如下 private void parseDictText Object result if result inst