项目中的小功能或模块
项目中的一些小功能或模块
松子落
这个作者很懒,什么都没留下…
展开
-
阿里 easyExcel 动态写入数据,多级表头,单元格合并示例
public static void writeExcel1(final File file, List<? extends BaseRowModel> list, Class<? extends BaseRowModel> clazz) { ExcelWriter excelWriter = EasyExcel.write(file).excelType(ExcelTypeEnum.XLSX).build(); WriteSheet wri...原创 2021-02-23 09:17:16 · 4161 阅读 · 1 评论 -
SpringMvc 文件下载的两种方式
方式一:通过reponse的输出流 @RequestMapping("/d1") public ResultVo<String> downloadFile(HttpServletResponse response){ String fileName="test1.png"; try { //获取response的输出流 ServletOutputStream outputStream = respon原创 2021-02-23 08:57:15 · 440 阅读 · 0 评论 -
udp端
import io.netty.bootstrap.Bootstrap;import io.netty.channel.Channel;import io.netty.channel.ChannelOption;import io.netty.channel.EventLoopGroup;import io.netty.channel.nio.NioEventLoopGroup;import io.netty.channel.socket.nio.NioDatagramChannel;impo.原创 2020-12-23 11:32:25 · 272 阅读 · 0 评论 -
apache ftp的服务端
package com.jzxs.transmissionmonitor.manager.ftp;import com.jzxs.transmissionmonitor.utils.PathUtils;import com.jzxs.transmissionmonitor.utils.TimeUtils;import lombok.Getter;import lombok.extern.slf4j.Slf4j;import org.apache.ftpserver.ConnectionCon.原创 2020-12-23 11:14:55 · 406 阅读 · 0 评论 -
spring boot web 跨域设置
@Configurationpublic class GlobalCorsConfigure { @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").原创 2020-08-31 14:41:41 · 172 阅读 · 0 评论 -
spring web中统一处理报错,并设置http响应的状态
@RestControllerAdvicepublic class RestControllerExceptionTranslator { private static final Logger log = LoggerFactory.getLogger(RestControllerExceptionTranslator.class); public RestControllerExceptionTranslator() { } @ExceptionHandler({.原创 2020-08-24 10:10:02 · 551 阅读 · 0 评论 -
对返回数据的每个字段值进行base64编码
import com.alibaba.fastjson.JSONArray;import com.alibaba.fastjson.JSONObject;import java.util.ArrayList;import java.util.List;import java.util.Set;public class CommonEncodingUtils { /** * * 递归循环json字符串 * * @param object * * @...原创 2020-07-06 16:04:04 · 520 阅读 · 0 评论 -
获取关注了关注了公众号微信用户的openid
import com.google.common.collect.Maps;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import org.springframework.web.client.RestTemplate;import org.springfr..原创 2020-07-03 09:54:29 · 1146 阅读 · 0 评论 -
微信公众号将消息转发给自己的服务器
import io.swagger.annotations.Api;import io.swagger.annotations.ApiOperation;import lombok.extern.slf4j.Slf4j;import org.aurochsframework.boot.commons.api.CommonResult;import org.aurochsframework.boot.commons.param.QueryParam;import org.springframewo.原创 2020-07-03 09:51:58 · 1060 阅读 · 0 评论 -
微信公众号推送模板消息
import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.JSONObject;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Value;import org.springframewor.原创 2020-07-03 08:59:02 · 291 阅读 · 0 评论 -
mybatis-generator工具生成对应的自定Service和Controller
https://mp.csdn.net/console/editor/html/106635288关于mybatis-generator工具的使用。在此基础上,增加了一个类,和一段配置。1、增加类ServiceAndControllerGeneratorPlugin.jar自定义生成Controller和Service的模板。package com.jzxs.etp.mbg;import org.mybatis.generator.api.GeneratedJavaFile;..原创 2020-06-17 16:49:52 · 8552 阅读 · 8 评论 -
websocket
import org.springframework.context.annotation.Configuration;import org.springframework.messaging.simp.config.MessageBrokerRegistry;import org.springframework.web.socket.config.annotation.*;/** * 开启websocket */@Configuration@EnableWebSocketMessageB.原创 2020-06-10 09:04:31 · 205 阅读 · 0 评论 -
导出excel
controller接口 @RequestMapping("/export") @ResponseBody @OperLog(operType = OperType.query, operDesc = "导出统计报表") public void export( HttpServletResponse response, @DateTimeFormat(pattern = Constant.STR_DATE) Date sta原创 2020-06-10 09:04:53 · 693 阅读 · 0 评论 -
JPA多数据源配置
import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.context.annotation..原创 2020-06-10 09:05:03 · 752 阅读 · 1 评论 -
AOP,请求日志记录
import org.aspectj.lang.JoinPoint;import org.aspectj.lang.annotation.AfterReturning;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Before;import org.aspectj.lang.annotation.Pointcut;import org.slf4j.Logger;import org.sl.原创 2020-06-09 16:01:34 · 380 阅读 · 0 评论 -
Spring MVC 文件上传
FileController.javaimport com.todo.common.ResultCode;import com.todo.service.FileService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Value;import org.springframework.web.bind.an.原创 2020-06-09 15:36:06 · 121 阅读 · 0 评论 -
swagger的一些配置
import java.util.Collections;import java.util.List;@Configuration@EnableSwagger2public class Swagger2Configure { public List<Parameter> createParameters() { ParameterBuilder token = new ParameterBuilder() .name("...原创 2020-06-09 14:52:04 · 692 阅读 · 0 评论 -
maven repositories
<repositories> <repository> <id>releases</id> <name>RELEASES PUBLISH</name> <url>http://47.108.196.40:8081/repository/maven-releases/</url> <sn...原创 2020-06-09 14:51:54 · 311 阅读 · 0 评论 -
maven+springboot 项目打jar包的pom配置
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration&g...原创 2020-06-09 14:51:44 · 1209 阅读 · 0 评论 -
mybatis-generator工具根据数据库表,生成相应的带字段注释的实体类和mapper
Generator.javaimport org.mybatis.generator.api.MyBatisGenerator;import org.mybatis.generator.config.Configuration;import org.mybatis.generator.config.xml.ConfigurationParser;import org.mybatis.generator.internal.DefaultShellCallback;import java.io.原创 2020-06-09 14:51:23 · 2059 阅读 · 0 评论 -
java实现ftpServer
maven依赖 <dependency> <groupId>org.apache.ftpserver</groupId> <artifactId>ftpserver-core</artifactId> <version>1.1.1</version> <scope>compile</scope原创 2020-06-09 14:52:41 · 1727 阅读 · 0 评论