Spring Boot集成EasyPoi实现导入导出操作

news2024/10/5 23:30:45

文章目录

  • Spring Boot集成EasyPoi实现导入导出操作
    • 0 简要说明
    • 1 环境搭建
      • 1.1 项目目录
      • 1.2 依赖管理
      • 2.3 关于swagger处理
      • 2.4 关于切面处理耗时
        • 1 自定义注解
        • 2 定义切面类
        • 3 如何使用
      • 2.5 核心导入操作
      • 2.6 核心导出操作
    • 2 最佳实线
      • 2.1 导入操作
        • 1 实体类说明
        • 2 业务层
        • 3 效果
        • 3 控制层
      • 2.2 导出操作
      • 2.3 大数据量处理
    • 4 问题
      • 4.1 日期类型字段特殊处理
      • 4.2 文件上传
      • 4.3 指定导出路径

参考博客
1.官网

Spring Boot集成EasyPoi实现导入导出操作

0 简要说明

Excel自适应xls和xlsx两种格式,word只支持docx模式
主要特点

1.设计精巧,使用简单
2.接口丰富,扩展简单
3.默认值多,write less do more
4.spring mvc支持,web导出可以简单明了

在这里插入图片描述

1 环境搭建

1.1 项目目录

在这里插入图片描述

1.2 依赖管理

        <!--Spring 环境-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>
        <!--MySQL 驱动包-->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <version>8.0.31</version>
        </dependency>

        <!--自动配置-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!--实体类优化-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!--单元测试-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <!--接口平台-->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>2.0.7</version>
        </dependency>

        <!--commons-lang3工具包-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>

        <!--Mybatis Plus 扩展包-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-extension</artifactId>
            <version>3.5.1</version>
        </dependency>

        <!--Mybatis Plus 依赖包-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>

        <!--easypoi-->
        <dependency>
            <groupId>cn.afterturn</groupId>
            <artifactId>easypoi-spring-boot-starter</artifactId>
            <version>4.4.0</version>
        </dependency>

        <!--easyexcel-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
            <version>3.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.9.1</version>
        </dependency>

        <!--接口平台-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

2.3 关于swagger处理

依赖

        <!--接口平台-->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>2.0.7</version>
        </dependency>
        <!--接口平台-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

配置类

package com.geekmice.springbootselfexercise.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @BelongsProject: spring-boot-scaffold
 * @BelongsPackage: com.geekmice.sbhelloworld.com.geekmice.sbpagehelper.config
 * @Author: pingmingbo
 * @CreateTime: 2023-07-30  15:45
 * @Description: TODO
 * @Version: 1.0
 */
@Configuration
public class Knife4jConfig {
    @Bean(value = "defaultApi2")
    public Docket customDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.geekmice.springbootselfexercise.controller"))
                .build();
    }

    /**
     * 构建 api文档的详细信息函数
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("现货交易")
                .version("1.0.0")
                .description("现货交易详情")
                .contact(new Contact("geekmice","http://geekmice.cn","2437690868@qq.com"))
                .build();
    }
}

访问地址:http://localhost:端口号/doc.html
在这里插入图片描述

2.4 关于切面处理耗时

1 自定义注解

package com.geekmice.springbootselfexercise.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author PMB
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MethodExporter {
}

2 定义切面类

package com.geekmice.springbootselfexercise.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: spring-boot-scaffold
 * @BelongsPackage: com.geekmice.com.geekmice.sbpagehelper.utils
 * @Author: pmb
 * @CreateTime: 2023-07-26  21:52
 * @Description: TODO
 * @Version: 1.0
 */
@Aspect
@Component
@Slf4j
public class MethodExporterAspect {
    @Around("@annotation(com.geekmice.springbootselfexercise.annotation.MethodExporter)")
    public Object methodExporter(ProceedingJoinPoint point) throws Throwable {
        long start = System.currentTimeMillis() / 1000;
        Object proceed = point.proceed();
        long end = System.currentTimeMillis() / 1000;
        log.info("【耗时:】{}s", (end - start));
        return proceed;
    }
}

3 如何使用

直接在控制层方法上面添加注解,调用接口即可生效

    @PostMapping(value = "uploadFileByEasyPoi")
    @MethodExporter
    @ApiOperation(value = "通过easypoi上传文件")
    public AjaxResult uploadFileByEasyPoi(@RequestPart MultipartFile file){
        userService.uploadFileByEasyPoi(file);
        return AjaxResult.success();
    }

在这里插入图片描述

2.5 核心导入操作

    @Override
    public void uploadFileByEasyPoi(MultipartFile file) {

        InputStream inputStream;
        try {
            inputStream = file.getInputStream();
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
        try {
            List<UserDomain> result = ExcelImportUtil.importExcel(inputStream, UserDomain.class, new ImportParams());
            for (UserDomain userDomain : result) {
                log.info("导入数据:【{}】", userDomain.toString());
            }
            this.saveBatch(result);
            log.info("录入结束");
        } catch (Exception e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
    }

2.6 核心导出操作

ExcelExportUtil是easypoi里面工具类

    public void downloadFileByEasyPoi() {
        List<UserDomain> list = new ArrayList(16);
        for (int i = 0; i < 10; i++) {
            UserDomain item = UserDomain.builder().userName(RandomStringUtils.randomAlphabetic(6)).address(RandomStringUtils.randomAlphabetic(10))
                    .birthday(new Date())
                    .sex("男")
                    .build();
            list.add(item);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), UserDomain.class, list);
        FileOutputStream outputStream;
        try {
            outputStream = new FileOutputStream("D:\\easypoi.xlsx");
            workbook.write(outputStream);
        } catch (FileNotFoundException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
    }

2 最佳实线

2.1 导入操作

1 实体类说明

关于注解说明
easypoi起因就是Excel的导入导出,最初的模板是实体和Excel的对应,model–row,filed–col 这样利用注解我们可以和容易做到excel到导入导出
经过一段时间发展,现在注解有5个类分别是
@Excel 作用到filed上面,是对Excel一列的一个描述
@ExcelCollection 表示一个集合,主要针对一对多的导出,比如一个老师对应多个科目,科目就可以用集合表示
@ExcelEntity 表示一个继续深入导出的实体,但他没有太多的实际意义,只是告诉系统这个对象里面同样有导出的字段
@ExcelIgnore 和名字一样表示这个字段被忽略跳过这个导导出
@ExcelTarget 这个是作用于最外层的对象,描述这个对象的id,以便支持一个对象可以针对不同导出做出不同处理

package com.geekmice.springbootselfexercise.domain;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * (User)实体类
 *
 * @author pingmingbo
 * @since 2023-08-06 09:51:28
 */
@Data
@ApiModel
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "user")
public class UserDomain implements Serializable {
    private static final long serialVersionUID = 723356122339609354L;
    /**
     * 编号
     */
    @ApiModelProperty(value = "编号")
    @ExcelIgnore
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名")
    @Excel(name = "用户名")
    @TableField(value = "user_name")
    private String userName;
    /**
     * 生日
     */
    @ApiModelProperty(value = "生日")
    @Excel(name="生日")
    @TableField(value = "birthday")
    private Date birthday;
    /**
     * 性别
     */
    @Excel(name = "性别")
    @ApiModelProperty(value = "性别")
    @TableField(value = "sex")
    private String sex;
    /**
     * 地址
     */
    @ApiModelProperty(value = "地址")
    @Excel(name = "地址")
    @TableField(value = "address")
    private String address;


}

2 业务层

public interface UserService extends IService<UserDomain> {

    void uploadFileByEasyPoi(MultipartFile file);
}

package com.geekmice.springbootselfexercise.service.impl;

import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geekmice.springbootselfexercise.dao.UserDao;
import com.geekmice.springbootselfexercise.domain.UserDomain;
import com.geekmice.springbootselfexercise.service.UserService;
import com.sun.corba.se.impl.corba.ExceptionListImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * (User)表服务实现类
 *
 * @author pingmingbo
 * @since 2023-08-06 09:51:28
 */
@Service("userService")
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserDao, UserDomain> implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public void uploadFileByEasyPoi(MultipartFile file) {

        InputStream inputStream;
        try {
            inputStream = file.getInputStream();
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
        try {
            List<UserDomain> result = ExcelImportUtil.importExcel(inputStream, UserDomain.class, new ImportParams());
            for (UserDomain userDomain : result) {
                log.info("导入数据:【{}】", userDomain.toString());
            }
            this.saveBatch(result);
            log.info("录入结束");
        } catch (Exception e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
    }
}

3 效果

在这里插入图片描述

JDBC Connection [HikariProxyConnection@880330951 wrapping com.mysql.cj.jdbc.ConnectionImpl@55e295a5] will not be managed by Spring
==> Preparing: INSERT INTO user ( user_name, sex, address ) VALUES ( ?, ?, ? )
==> Parameters: pDwITO(String), 男(String), gqrkCeEpHh(String)
==> Parameters: TvOJNo(String), 男(String), BsAivNwjhP(String)
==> Parameters: miTVeL(String), 男(String), SMZOmxceID(String)
==> Parameters: siFTKf(String), 男(String), LcBfUNnITp(String)
==> Parameters: KGnyWX(String), 男(String), JXPbQboTdH(String)
==> Parameters: RyZYiE(String), 男(String), TydYPZxLah(String)
==> Parameters: JrcAnl(String), 男(String), bCttkDXCAN(String)
==> Parameters: nYMiAc(String), 男(String), uGXhBfyKgK(String)
==> Parameters: nDgzmK(String), 男(String), ZunMUZSYXa(String)
==> Parameters: xdLspA(String), 男(String), CLNrrpNHPw(String)
2023-08-06 14:00:51.218 INFO 9244 — [nio-8081-exec-3] c.g.s.service.impl.UserServiceImpl : 录入结束
在这里插入图片描述

3 控制层

    @PostMapping(value = "uploadFileByEasyPoi")
    @MethodExporter
    @ApiOperation(value = "通过easypoi上传文件")
    public AjaxResult uploadFileByEasyPoi(@RequestPart MultipartFile file){
        userService.uploadFileByEasyPoi(file);
        return AjaxResult.success();
    }

2.2 导出操作

核心代码

    @Override
    public void downloadFileByEasyPoi() {
        List<UserDomain> list = new ArrayList(16);
        for (int i = 0; i < 10; i++) {
            UserDomain item = UserDomain.builder().userName(RandomStringUtils.randomAlphabetic(6)).address(RandomStringUtils.randomAlphabetic(10))
                    .birthday(new Date())
                    .sex("男")
                    .build();
            list.add(item);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), UserDomain.class, list);
        FileOutputStream outputStream;
        try {
            outputStream = new FileOutputStream("D:\\easypoi.xlsx");
            workbook.write(outputStream);
        } catch (FileNotFoundException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
    }

2.3 大数据量处理

大数据导出是当我们的导出数量在几万,到上百万的数据时,一次从数据库查询这么多数据加载到内存然后写入会对我们的内存和CPU都产生压力,这个时候需要我们像分页一样处理导出分段写入Excel缓解Excel的压力 EasyPoi提供的是两个方法 *强制使用 xssf版本的Excel *

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>

importExcelBySax方法


    /**
     * Excel 通过SAX解析方法,适合大数据导入,不支持图片
     * 导入 数据源本地文件,不返回校验结果 导入 字 段类型 Integer,Long,Double,Date,String,Boolean
     * 
     * @param inputstream
     * @param pojoClass
     * @param params
     * @param handler
     */
    public static void importExcelBySax(InputStream inputstream, Class<?> pojoClass,
                                        ImportParams params, IReadHandler handler) {
        new SaxReadExcel().readExcel(inputstream, pojoClass, params, handler);
    }
    @Override
    public void uploadBigFileByEasyPoi(MultipartFile file) {
        InputStream inputStream;
        try {
            inputStream = file.getInputStream();
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
        ExcelImportUtil.importExcelBySax(inputStream,UserDomain.class,new ImportParams(),new UserHandler<UserDomain>());
    }

10w条数据,35s
与正常导入,10w数据,20s

4 问题

4.1 日期类型字段特殊处理

format属性指定一下日期格式

    @Excel(name="生日",format = "yyyy-MM-dd")
    private Date birthday;

4.2 文件上传

修改默认上传大小

  servlet:
    multipart:
      max-file-size: 50MB
      max-request-size: 50MB

4.3 指定导出路径

核心代码


 FileOutputStream outputStream = new FileOutputStream("D:\\test.xlsx"); // 指定输出流位置   
 workbook.write(outputStream) // 写到workbook中

业务层

        List<UserDomain> list = new ArrayList(16);
        for (int i = 0; i < 100000; i++) {
            UserDomain item = UserDomain.builder().userName(RandomStringUtils.randomAlphabetic(6)).address(RandomStringUtils.randomAlphabetic(10))
                    .birthday(new Date())
                    .sex("男")
                    .build();
            list.add(item);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), UserDomain.class, list);
        FileOutputStream outputStream;
        try {
            outputStream = new FileOutputStream("D:\\easypoi.xlsx");
            workbook.write(outputStream);
        } catch (FileNotFoundException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        } catch (IOException e) {
            log.error("error msg 【{}】", e);
            throw new IllegalArgumentException(e);
        }
        log.info("easypoi导出结束");

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/841921.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

前端工程师的摸鱼日常(19)

【图为恐子真身】 史记记载恐子九尺六寸高&#xff0c;根据春秋的尺度换算&#xff0c;有一米九至两米多高&#xff0c;人皆畏之。 一米九的山东大汉&#xff0c;手下七十二堂口&#xff08;帮派&#xff09;、三千门生&#xff08;小弟&#xff09;。 由他弟子所编写的《抡…

【数学建模学习(10):遗传算法】

遗传算法简介 • 遗传算法&#xff08;Genetic Algorithms&#xff09;是基于生物进化理论的原理发展起来的一种广为 应用的、高效的随机搜索与优化的方法。其主要特点是群体搜索策略和群体中个体之 间的信息交换&#xff0c;搜索不依赖于梯度信息。它是20世纪70年代初期由美国…

MFC第二十八天 WM_SIZE应用,CFrameWnd类LoadFrame的方法,PreCreateWindow窗口预处理,Frame-view窗口视图

文章目录 WM_SIZE应用通过WM_SIZE消息实现窗口布局管理通过控件属性实现窗口布局管理 CFrameWnd类CFrameWnd类简介OnCreate和OnCreateClient的方法注册时的要素与窗口设置PreCreateWindow创建窗口的预处理函数 附录预处理函数的结构体CFrameWnd::LoadFrame与CreateFrame WM_SIZ…

K8S系列文章之 Traefik快速入门

traefik 与 nginx 一样&#xff0c;是一款优秀的反向代理工具&#xff0c;或者叫 Edge Router。至于使用它的原因则基于以下几点 无须重启即可更新配置自动的服务发现与负载均衡与 docker 的完美集成&#xff0c;基于 container label 的配置漂亮的 dashboard 界面metrics 的支…

周末在家值班,解决几个月前遗忘的Bug

问题&#xff1a; 周末被迫在家值班&#xff0c;无聊之际打开尘封已久的Bug清单&#xff0c;发现有Bug拖了几个月还没解决… 场景是这样子的&#xff0c;有个功能是拿Redis缓存热点数据进行展示&#xff0c;暂且称它为功能A&#xff0c;有个另外的功能B&#xff0c;它会去更新缓…

(文章复现)建筑集成光储系统规划运行综合优化方法matlab代码

参考文献&#xff1a; [1]陈柯蒙,肖曦,田培根等.一种建筑集成光储系统规划运行综合优化方法[J].中国电机工程学报,2023,43(13):5001-5012. 1.基本原理 本文建立的双层耦合模型内、外层分别对应求解容量配置与能量调度问题。外层模型设置光伏与储能容量备选集并将容量配置组合…

【基础类】—原型链系统性知识

一、创建对象有几种方法 字面量创建对象 1-1. 什么是字面量 字面量就是所见即所&#xff0c;指的是常量&#xff1b;用来为变量赋值时的常数量 代码例子&#xff1a;123&#xff1b;‘ABC’, {name: ‘张三’}, undefined &#xff0c; true 生活例子&#xff1a;门店的招牌&a…

Docker安装Mysql、Redis、nginx、nacos等环境

相关系列文章&#xff1a; 1、DockerHarbor私有仓库快速搭建 2、DockerJenkinsHarbor 1、服务器 Ip部署内容说明192.168.88.7Docker、Mysql、redis、nacosnode1192.168.88.8Docker、Mysql、redis、nacosnode2192.168.88.9Docker、redis、nacos、nginxnode3 2、安装PXC8.0 Mys…

【已解决】Java 中使用 ES 高级客户端库 RestHighLevelClient 清理百万级规模历史数据

&#x1f389;工作中遇到这样一个需求场景&#xff1a;由于ES数据库中历史数据过多&#xff0c;占用太多的磁盘空间&#xff0c;需要定期地进行清理&#xff0c;在一定程度上可以释放磁盘空间&#xff0c;减轻磁盘空间压力。 &#x1f388;在经过调研之后发现&#xff0c;某服务…

AI一键生成短视频

AI一键生成推文短视频 阅读时长&#xff1a;10分钟 本文内容&#xff1a; 结合开源AI&#xff0c;一键生成短视频发布到常见的某音&#xff0c;某手平台&#xff0c;狠狠赚一笔 前置知识&#xff1a; 1.基本的 python 编程知识 2.chatGPT 使用过 3.stable diffution 使用过 成果…

一键开启ChatGPT“危险发言”

‍ ‍ 大数据文摘授权转载自学术头条 作者&#xff1a;Hazel Yan 编辑&#xff1a;佩奇 随着大模型技术的普及&#xff0c;AI 聊天机器人已成为社交娱乐、客户服务和教育辅助的常见工具之一。 然而&#xff0c;不安全的 AI 聊天机器人可能会被部分人用于传播虚假信息、操纵舆…

冠达管理:稳增长政策密集加码 顺周期板块有望持续表现

上星期A股商场回暖显着&#xff0c;首要宽基指数大都震荡收涨&#xff1b;日均成交额上升至约9600亿元&#xff1b;北向资金延续净买入&#xff0c;周净买入A股124.7亿元。职业层面&#xff0c;方针预期催化下&#xff0c;顺周期方向的金融、房地产等职业领涨。 机构以为&#…

方法区内存溢出及常量池

22 方法区-定义 是所有线程共享的一块区域。 存储了和类结构相关信息。运行时常量池&#xff0c; 方法区在虚拟机启动时被创建&#xff0c;逻辑上是堆的组成部分。方法区内存不足&#xff0c;也会导致oom异常。 是一个概念上的东西&#xff0c; 1.6使用永久代作为方法区&#…

Mybatis引出的一系列问题-spring多数据源配置

在日常开发中我们都是以单个数据库进行开发&#xff0c;在小型项目中是完全能够满足需求的。但是&#xff0c;当我们牵扯到像淘宝、京东这样的大型项目的时候&#xff0c;单个数据库就难以承受用户的CRUD操作。那么此时&#xff0c;我们就需要使用多个数据源进行读写分离的操作…

在Linux服务器上搭建Git

环境 服务器&#xff1a;Ubuntu 客户端&#xff1a;Win11 1、在服务器上安装Git&#xff08;服务器中处理&#xff09; 在服务器上执行git --version 如果出现&#xff1a; 则&#xff0c;已经安装Git&#xff0c;跳过此步骤。 如果没有&#xff0c;则&#xff1a; 执行…

前端个人年度工作述职报告(二十篇)

前端个人年度工作述职报告篇1 尊敬的各位领导、各位同仁&#xff1a; 大家好!按照20__年度我公司就职人员工作评估的安排和要求&#xff0c;我认真剖析、总结了自己的工作情况&#xff0c;现将本人工作开展情况向各位领导、同仁做以汇报&#xff0c;有不妥之处&#xff0c;希…

ElasticSearch详细操作

ElasticSearch搜索引擎详细操作以及概念 文章目录 ElasticSearch搜索引擎详细操作以及概念 1、_cat节点操作1.1、GET/_cat/nodes&#xff1a;查看所有节点1.2、GET/_cat/health&#xff1a;查看es健康状况1.3_、_GET/_cat/master&#xff1a;查看主节点1.4、GET/_cat/indices&a…

内存快照:宕机后,Redis如何实现快速恢复?RDB

AOF的回顾 回顾Redis 的AOF的持久化机制。 Redis 避免数据丢失的 AOF 方法。这个方法的好处&#xff0c;是每次执行只需要记录操作命令&#xff0c;需要持久化的数据量不大。一般而言&#xff0c;只要你采用的不是 always 的持久化策略&#xff0c;就不会对性能造成太大影响。 …

OpenAI因担心隐私问题而阻止GPT-4图像功能的发展

据《纽约时报》报道&#xff0c;GPT-4的图像能力可以识别某些个人。 OpenAI一直在测试其支持图像识别的多模态GPT-4版本&#xff0c;以便计划中的广泛发布。然而&#xff0c;据周二《纽约时报》报道&#xff0c;出于对其可能识别特定个体的担忧&#xff0c;公众访问被限制了。…

(2023国赛必看)零基础挑战一周拿下数学建模国奖

1、 数学建模国赛介绍 1.1 数学建模国赛是什么&#xff1f;如何评奖 全国大学生数学建模竞赛是全国高校规模最大的课外科技活动之一。该竞赛每年9月&#xff08;一般在上旬某个周末的星期五至下周星期一共3天&#xff0c;72小时&#xff09;举行&#xff0c;竞赛面向全国大专院…