1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

后台管理添加体温上报

This commit is contained in:
2023-04-14 00:53:02 +08:00
parent bad6ecb111
commit fb10c7e666
22 changed files with 472 additions and 58 deletions

View File

@@ -4,7 +4,8 @@ public enum FieldType {
HIDDEN("null"),
TEXT("plaintext"),
LONG_TEXT("longtext"),
IMAGE("image");
IMAGE("image"),
DATETIME("time");
private final String value;

View File

@@ -3,7 +3,8 @@ package com.cxyxiaomo.epp.PageTable.enums;
public enum SearchType {
CAN_NOT_SEARCH("null"),
INPUT("input"),
SELECT("select");
SELECT("select"),
DATETIME_INTERVAL("time-interval");
private final String value;

View File

@@ -7,6 +7,8 @@ import com.cxyxiaomo.epp.PageTable.enums.EditType;
import com.cxyxiaomo.epp.PageTable.enums.FieldType;
import com.cxyxiaomo.epp.PageTable.enums.SearchType;
import java.util.Objects;
public class FieldBuilder {
public final static String SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME = "<SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME>";
@@ -70,7 +72,8 @@ public class FieldBuilder {
jsonObject.put("editType", editType.getValue());
jsonObject.put("editPlaceholder", EDIT_PLACEHOLDER_SAME_AS_ADD_PLACEHOLDER.equals(editPlaceholder) ? addPlaceholder : editPlaceholder);
// 新增/修改时的前端表单验证
jsonObject.put("validateRules", fieldRuleListBuilder.build());
jsonObject.put("validateRules", Objects.nonNull(fieldRuleListBuilder)
? fieldRuleListBuilder.build() : new JSONArray());
// 新增弹窗 字段默认值
jsonObject.put("default", defaultValue);

View File

@@ -0,0 +1,28 @@
package com.cxyxiaomo.epp.common.query;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
// 数据库关系映射
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
// 微服务必须要实现Serializable
public class ReportQuery implements Serializable {
private Integer id;
private Integer userId;
private String name;
private String address;
private Long startTime, endTime;
private Integer temperature;
}

View File

@@ -0,0 +1,67 @@
package com.cxyxiaomo.epp.common.vo;
import com.cxyxiaomo.epp.common.pojo.Report;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
// 数据库关系映射
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
// 微服务必须要实现Serializable
public class ReportVO implements Serializable {
private Integer id;
private Integer userId;
private String name;
private String address;
private Long timestamp;
private Integer temperature;
public static ReportVO convertFrom(Report report) {
if (report == null) {
return null;
}
ReportVO reportVO = new ReportVO();
BeanUtils.copyProperties(report, reportVO);
Date time = report.getTime();
reportVO.setTimestamp(time.getTime());
return reportVO;
}
public static List<ReportVO> convertFrom(List<Report> reportList) {
if (reportList == null) {
return null;
}
List<ReportVO> reportVOList = reportList.stream()
.map(ReportVO::convertFrom).collect(Collectors.toList());
return reportVOList;
}
public static Report convertTo(ReportVO reportVO) {
if (reportVO == null) {
return null;
}
Report report = new Report();
BeanUtils.copyProperties(reportVO, report);
Long timestamp = reportVO.getTimestamp();
if (timestamp != null) {
Date date = new Date(timestamp);
report.setTime(date);
}
return report;
}
}