1.创建替换字段实体类
package io.renren.dto;
import lombok.Data;
/**
* 台风快报内容模板参数DTO
*/
@Data
public class StormPdfContentTemplateParamsDTO {
/**
* 当前时间
*/
private String nowTime;
/**
* 台风ID
*/
private String stormId;
/**
* 台风名称
*/
private String stormName;
/**
* 台风类型
*/
private String stormType;
/**
* 登陆地址
*/
private String address;
/**
* 台风中心位置
*/
private String centerPosition;
/**
* 登陆日期
*/
private String loginDate;
/**
* 台风编号
*/
private String stormNumber;
/**
* 台风等级
*/
private String stormLevel;
/**
* 台风风力
*/
private String speedLevel;
/**
* 台风发布时间
*/
private String pubTime;
/**
* 经度
*/
private String JD;
/**
* 纬度
*/
private String WD;
/**
* 台风附件最大风速
*/
private String windSpeed;
/**
* 台风移动速度
*/
private String moveSpeed;
/**
* 台风移动方向
*/
private String moveDirection;
/**
* 台风路径图
*/
private String imageUrl;
}
2.编写实现类
获取需要填充和替换的字段内容。
@Override
public String getContentTemplate(String tfTywysbm, String stormName) {
StormPdfContentTemplateParamsDTO paramsDTO = new StormPdfContentTemplateParamsDTO()