Commit 87d109eb authored by 高滢's avatar 高滢
parents 3b871da5 366a1516
......@@ -78,12 +78,14 @@ public class CarReviewTask implements Serializable {
* 任务开始时间
*/
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
/**
* 任务结束时间
*/
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
/**
......@@ -97,6 +99,7 @@ public class CarReviewTask implements Serializable {
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
/**
......
......@@ -77,6 +77,7 @@ public class ReviewDetailsResult implements Serializable {
* 最后修改时间
*/
@ApiModelProperty("最后修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date lastModifyTime;
@ApiModelProperty("文件目录")
......
......@@ -46,6 +46,7 @@ public class ReviewEnterpriseArchive implements Serializable {
* 发布日期
*/
@ApiModelProperty("发布日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date publishDate;
/**
......@@ -83,6 +84,7 @@ public class ReviewEnterpriseArchive implements Serializable {
private String createBy;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
}
\ No newline at end of file
......@@ -190,12 +190,14 @@ public class ReviewSceneChangeTask {
* 任务开始时间
*/
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
/**
* 任务结束时间
*/
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
/**
......
......@@ -65,6 +65,7 @@ public class ReviewSceneChangeTaskUserRelation {
* 审核时间
*/
@ApiModelProperty("审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date decisionTime;
/**
......
......@@ -54,9 +54,11 @@ public class Standard {
private String standardStatus;
@ApiModelProperty("发布日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date releaseDate;
@ApiModelProperty("实施日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date implementationDate;
}
......@@ -82,12 +82,14 @@ public class SystemReviewTask {
* 任务开始时间
*/
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
/**
* 任务结束时间
*/
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
/**
......@@ -114,6 +116,7 @@ public class SystemReviewTask {
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
/**
......
......@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
......@@ -116,9 +117,11 @@ public class Task {
private String taskInitiatorDept;
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
......@@ -132,6 +135,7 @@ public class Task {
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
......
......@@ -131,7 +131,7 @@ public class InspectionReportPdfVO {
private String taskNumber;
/**
*
* 样品数量
*/
private String sampleSum;
......@@ -140,6 +140,11 @@ public class InspectionReportPdfVO {
*/
private String vehicleType;
/**
* 车辆型号
*/
private String vehicleModel;
/**
* 车辆识别码
*/
......
......@@ -5,7 +5,7 @@ import com.itextpdf.text.pdf.*;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PdfBaseWriter;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.vo.PhotoStorageVO;
import com.ruoyi.domain.vo.InspectionReportPdfVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.PdfTemplateManagementService;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
......@@ -76,23 +76,15 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
BaseFont bf = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
fields.addSubstitutionFont(bf);
// 渲染
// fillData(fields, map, ps);
renderData(fields);
// 测试数据
InspectionReportPdfVO inspectionReportPdfVO = requireData();
PhotoStorageVO photoStorageVO = new PhotoStorageVO();
Class<? extends PhotoStorageVO> aClass = photoStorageVO.getClass();
Field[] declaredFields = aClass.getDeclaredFields();
for (Field field : declaredFields) {
String name = field.getName();
System.out.println(name);
}
// 渲染数据
renderData(fields, inspectionReportPdfVO);
//必须要调用这个,否则文档不会生成的
ps.setFormFlattening(true);
if(ps != null){
ps.close();
}
ps.close();
//生成pdf路径存放的路径
fos = response.getOutputStream();
fos.write(bos.toByteArray());
......@@ -113,6 +105,40 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
}
}
private InspectionReportPdfVO requireData() {
InspectionReportPdfVO inspectionReportPdfVO = InspectionReportPdfVO.builder()
.reportNumber("报告编号")
.productName("产品名称")
.productModel("产品型号")
.entrustedUnit("委托单位")
.inspectionCenterName("检验中心名称")
.inspectionCenterAddress("检验中心地址")
.inspectionCenterTelephone("检验中心电话")
.inspectionCenterPostcode("检验中心邮编")
.clientAddress("委托单位地址")
.entrustedUnitTelephone("委托单位电话")
.clientPostalCode("委托单位邮编")
.sampleName("样品名称")
.typeSpecification("型号规格")
.productionEnterprise("生产企业")
.sampleSender("送养着")
.sampleDeliveryDate("送样日期")
.sampleQuantity("样品数量")
.productionDate("生产日期")
.inspectionItem("检验项目")
.testConclusion("检验结论")
.issueDate("签发日期")
.remark("备注")
.taskNumber("任务编号")
.sampleSum("样品数量")
.vehicleType("车俩类型")
.vehicleModel("车辆型号")
.vehicleIdentificationNumber("车辆识别码")
.sampleNumberSummary("样品编号汇总")
.build();
return inspectionReportPdfVO;
}
/**
* 企业留档文件PDF下载
* @param taskId
......@@ -147,7 +173,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
document.setParagraph("检验中心名称", 12f, 0, 30,15f, 20f);
// 创建表格
List<String> list = Arrays.asList("文件名称", "文件目录", "标准章节", "标准要求", "审查要点");
float[] columnWidths = {20, 20, 20, 70, 70};
float[] columnWidths = {30, 25, 25, 60, 60};
PdfPTable table = document.createWithHeaderTable(list, columnWidths);
// 查询数据
List<ReviewEnterpriseArchiveViewVO> viewList = reviewEnterpriseArchiveService.view(taskId);
......@@ -161,6 +187,13 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
});
}
document.addContent(table);
// 最后结尾签字
PdfPTable signTable = new PdfPTable(new float[]{40, 15});
signTable.setWidthPercentage(100);
signTable.setSpacingBefore(40);
document.writeNoBorderCell("车企负责人签字:", Element.ALIGN_RIGHT, 1, 1, signTable);
document.writeBottomCell("", Element.ALIGN_RIGHT, 1, 1, signTable);
document.addContent(signTable);
// 关闭
document.close();
......@@ -206,8 +239,20 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* 渲染数据
* @param fields
*/
private void renderData(AcroFields fields) {
private void renderData(AcroFields fields, InspectionReportPdfVO inspectionReportPdfVO) throws Exception {
// 取出当前对象所有属性,并赋值到模板里
Class<? extends InspectionReportPdfVO> aClass = inspectionReportPdfVO.getClass();
Field[] declaredFields = aClass.getDeclaredFields();
for (Field field : declaredFields) {
String name = field.getName();
String key = name.replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase();
field.setAccessible(true);
Object o = field.get(inspectionReportPdfVO);
if (o != null) {
String value = o.toString();
fields.setField(key, value);
}
}
}
......
package com.ruoyi.web.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -12,6 +13,7 @@ import java.util.Date;
public class TaskListRequest extends PageDomain {
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
@ApiModelProperty("任务状态")
......
package com.ruoyi.web.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -131,12 +132,14 @@ public class ReviewSceneChangeTaskResponse {
* 任务开始时间
*/
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
/**
* 任务结束时间
*/
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
/**
......
......@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
......@@ -46,9 +47,11 @@ public class TaskFindResponse {
private String runStatus;
@ApiModelProperty("总任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
@JsonFormat(shape = JsonFormat.Shape.STRING)
......@@ -65,9 +68,11 @@ public class TaskFindResponse {
private Double systemReview;
@ApiModelProperty("体系问卷任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date systemTaskBeginTime;
@ApiModelProperty("体系问卷任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date systemTaskEndTime;
@ApiModelProperty("车型审查任务状态")
......@@ -77,9 +82,11 @@ public class TaskFindResponse {
private Double carReview;
@ApiModelProperty("车辆问卷任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date carTaskBeginTime;
@ApiModelProperty("车辆问卷任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date carTaskEndTime;
@ApiModelProperty("测试任务状态")
......
......@@ -78,9 +78,11 @@ public class TaskGetInfoResponse {
private String taskInitiatorDept;
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
......@@ -94,6 +96,7 @@ public class TaskGetInfoResponse {
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
......
......@@ -156,6 +156,7 @@
)
</if>
</where>
order by t.task_begin_time desc
</select>
<select id="findByCarReviewTaskId" resultType="java.lang.Long">
SELECT id
......@@ -246,6 +247,7 @@
)
</if>
</where>
order by t.task_begin_time desc
</select>
<select id="getByUserIdTemporary" resultType="com.ruoyi.domain.Task">
SELECT id, system_review_task_id, car_review_task_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment