- 浏览: 170701 次
- 性别:
- 来自: 北京
最新评论
文章列表
1,'org.hibernate.validator:hibernate-validator:6.0.17.Final'导入检验包
2,
@NotBlank(message = "图片url不能为空")
private String picUrl;
3,public Result saveObject(@RequestBody @Valid DemoDto dto) {
4,建立全局捕获异常类
package com.exception;
import com.ka.common.api.ResultJson;
import com.ka.common.er ...
1,引入
// https://mvnrepository.com/artifact/org.aspectj/aspectjweaver
implementation group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.6'
2
package com.etonkids.wonderhouse.interceptor;
import java.lang.annotation.*;
/**
* 系统日志注解
*
* @Author zys
* @email xxx
* @Date 2019年1月14日 ...
implementation 'cn.hutool:hutool-all:5.8.11'
implementation 'org.apache.poi:poi:4.1.2'
implementation 'org.apache.poi:poi-ooxml:4.1.2'
implementation 'org.apache.poi:poi-ooxml-schemas:4.1.2'
/**
* 导出
*
* @param response
*/
@RequestMapping("/doExport")
...
hutool导入excel
- 博客分类:
- hutool导入excel
1,定义controller
@PostMapping("/uploadExcel")
@ApiOperation(value = "导入上传")
public Result upload(@RequestParam("studentList") MultipartFile reqXls,HttpServletRequest request) {
return service.readRequestXls(ExcelUtil.getReader(reqXls.getInputStrea ...
服务端=====1
@GetMapping("getDate")
@ApiOperation(value = "获取数据")
public ResultJson getDate(Long userId,String studentNumber) {
try {
log.info("userId:::==="+userId);
log.info("studentNumber:::==="+studentNumber);
...
public static void main(String[] args) {
ArrayList<String> listA = CollectionUtil.toList("a", "b", "c", "d", "e");
ArrayList<String> listB = CollectionUtil.toList( "b", "c", "d", "e" ...
public static void main(String[] args) {
System.out.println(new Date()+"当前时间");
System.out.println(DateUtil.beginOfMonth(new Date())+"当月开始时间");
System.out.println(DateUtil.endOfMonth(new Date())+"当月结束时间");
DateTime dateTime = DateUtil.offs ...
java获取时间段内的每一天
- 博客分类:
- java获取时间段内的每一天
public static List<String> findDaysStr(String cntDateBeg, String cntDateEnd) {
List<String> list = new ArrayList<>();
//拆分成数组
String[] dateBegs = cntDateBeg.split("-");
String[] dateEnds = cntDateEnd.split("-");
//开始时间转换成时间戳
Calendar start = Calendar. ...
1,定义异步config
package com.text.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springfra ...
1.首先,新建一个word文档,内容如下,另存为pdf格式,我的命名:test.pdf
2.用Adobe Acrobat Pro 打开刚刚制作的pdf文件。
3.点击创建-->PDF表单-->使用当前文档-->使用当前文档,一直点下一步完成。(有的版本Adobe Acrobat Pro软件右边有准备表单,直接点击准备表单是同样的效果
4.上面好多给框,双击黑框可以修改名称,还可以设置字体大小。
5.图片的地方没有黑框,我们可以在空白处点击右键,选择文本域,给图片的域起名为img
6.如下图是制作好的pdf模板,直接保存即可。注意:黑框里面的名称,是后面程序要用到 ...
和表没关系做映射
@ApiModelProperty(value = "测试")
@TableField(exist = false)
// private List<Integer> lists;
前段忽律字段显示
@ApiModelProperty(value = "创建时间",hidden = (true))
private LocalDateTime createTime;
文件路径 =====resource/file/test.txt
代码直接使用即可
ClassPathResource classPathResource = new ClassPathResource("file/test.txt");
1,通过code获取sesionKey和openid
封装实体类
public class WxMaJscode2SessionResult {
private String session_key;
private String openid;
private String unionid;
private Integer errcode;
private String errmsg;
}
2,通过jsCode获取相关信息
Map<String, Object> param = Maps.newHashMap();
...
1创建时间
CURRENT_TIMESTAMP
2修改时间
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
3修改时间新增为空
NULL ON UPDATE CURRENT_TIMESTAMP
一、定义
Cron称计划任务,是任务在约定的时间执行已经计划好的工作,这是表面的意思。在Linux中,我们经常用到 cron 服务器来完成这项工作。cron服务器可以根据配置文件约定的时间来执行特定的任务。
二、常用表达式例子
(1)0/2 * * * * ? 表示每2秒 执行任务
(2)0 0/2 * * * ? 表示每2分钟 执行任务
0 10 0/1 * * ? 表示每小时10分钟 执行任务
(3)0 0 2 1 * ? 表示在每月的1日的凌晨2点执行任务
(4)0 15 10 ? * MON-FRI 表示周一到周五每天上午10:15执行任务
(5)0 15 10 ...