工作中技术的实际运用(1)

本文介绍了在工作中的技术应用,包括使用文件服务器(如OSS)进行文件存储,利用Factory @Mapping处理映射,借助hootul工具包提升效率,探讨MQ和Redis在消息队列和缓存中的作用,以及如何生成二维码和管理Maven库。

1. 文件服务器(oss) 类似于百度图片

上传一个base64 的流,一个key 就可以存储。成熟的文件服务器会自动对比,上传的流跟库里有没有重复的,有返回则返回相同的code,没有则新建一个code

2.Factory @Mapping

@Mapper(componentModel = "spring")
public inferface stringFactory{
	@Mapping(source = "workOrder", target = "workOrderOn")
	 NameBo inputToBo(NameInput);
}

pom

<dependencies>
    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${org.mapstruct.version}</version>
    </dependency>
</dependencies>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source> 
                <target>1.8</target>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${org.mapstruct.version}</version>
                    </path>
                    <!-- other annotation processors -->
                </annotationProcessorPaths>
            </configuration>
        </plugin>
    </plugins>
</build>

3 hootul 的工具包 嘎嘎好用

1.csv生成解析
2.xls生成解析
3.时间工具
都挺好用的

4 mq ,redis

// mq: 做并行处理,多线程处理,共同领域事件,ddd领域模型数据同步,
@RabbitListener(queues = QUEUE_NAME //队列
            , concurrency = "1"  //同时进入的链接数
            , exclusive = true   // 排他锁
            , containerFactory = "ConsumerRabbitFactory") // 工厂
// redis:做数据查重,数据码表存储

5 二维码生成

            // 生成二维码
            QRCodeWriter qrCodeWriter1 = new QRCodeWriter();
            //设置二维码图片宽高
            BitMatrix bitMatrix1 = qrCodeWriter1.encode(data,BarcodeFormat.QR_CODE, 600, 600);
            // 写到输出流
            ByteArrayOutputStream outputStream1 = new ByteArrayOutputStream();
            写入stream
            MatrixToImageWriter.writeToStream(bitMatrix1, "PNG", outputStream1);
            // 转base64 流
            String advUrl = Base64.encode(outputStream1.toByteArray());
        <!--二维码-->
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
        </dependency>

6 maven 库

https://repo1.maven.org/maven2/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值