Commit 5434f62ee33018e25d465067d5d223b59a466a0e

Authored by wangqian
1 parent 4c64c91e

人机材导入修改

urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/DepartmentCostImport.java
@@ -43,7 +43,7 @@ public class DepartmentCostImport { @@ -43,7 +43,7 @@ public class DepartmentCostImport {
43 @ExcelProperty(index = 3) 43 @ExcelProperty(index = 3)
44 @NotNull(message = "部门人数不能为空") 44 @NotNull(message = "部门人数不能为空")
45 @Positive(message = "部门人数必须为正数") 45 @Positive(message = "部门人数必须为正数")
46 - private Long personCount; 46 + private Integer personCount;
47 47
48 /** 归属公司 */ 48 /** 归属公司 */
49 @ExcelProperty(index = 4) 49 @ExcelProperty(index = 4)
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/GardenWasteRecordImport.java
@@ -16,6 +16,7 @@ import lombok.Data; @@ -16,6 +16,7 @@ import lombok.Data;
16 import lombok.NoArgsConstructor; 16 import lombok.NoArgsConstructor;
17 17
18 import java.math.BigDecimal; 18 import java.math.BigDecimal;
  19 +import java.time.LocalDate;
19 import java.util.Date; 20 import java.util.Date;
20 21
21 /** 22 /**
@@ -33,7 +34,7 @@ public class GardenWasteRecordImport { @@ -33,7 +34,7 @@ public class GardenWasteRecordImport {
33 @ExcelProperty(index = 0) 34 @ExcelProperty(index = 0)
34 @JsonFormat(pattern = "yyyy-MM-dd") 35 @JsonFormat(pattern = "yyyy-MM-dd")
35 @NotNull(message = "运输日期不能为空") 36 @NotNull(message = "运输日期不能为空")
36 - private Date transportDate; 37 + private LocalDate transportDate;
37 38
38 /** 废弃物类型(如渣土、树枝等) */ 39 /** 废弃物类型(如渣土、树枝等) */
39 @ExcelProperty(index = 1) 40 @ExcelProperty(index = 1)
@@ -58,7 +59,7 @@ public class GardenWasteRecordImport { @@ -58,7 +59,7 @@ public class GardenWasteRecordImport {
58 @NotNull(message = "运输次数不能为空") 59 @NotNull(message = "运输次数不能为空")
59 @Positive(message = "运输次数必须为正整数") 60 @Positive(message = "运输次数必须为正整数")
60 @Max(value = 999, message = "运输次数最大值为999") 61 @Max(value = 999, message = "运输次数最大值为999")
61 - private Long transportTimes; 62 + private Integer transportTimes;
62 63
63 /** 总费用(元) */ 64 /** 总费用(元) */
64 @ExcelProperty(index = 5) 65 @ExcelProperty(index = 5)
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/MechanicalCostImport.java
@@ -17,6 +17,7 @@ import lombok.Data; @@ -17,6 +17,7 @@ import lombok.Data;
17 import lombok.NoArgsConstructor; 17 import lombok.NoArgsConstructor;
18 18
19 import java.math.BigDecimal; 19 import java.math.BigDecimal;
  20 +import java.time.LocalDate;
20 import java.util.Date; 21 import java.util.Date;
21 22
22 /** 23 /**
@@ -71,13 +72,13 @@ public class MechanicalCostImport { @@ -71,13 +72,13 @@ public class MechanicalCostImport {
71 @ExcelProperty(index = 7) 72 @ExcelProperty(index = 7)
72 @NotNull(message = "数量不能为空") 73 @NotNull(message = "数量不能为空")
73 @Positive(message = "数量必须为正整数") 74 @Positive(message = "数量必须为正整数")
74 - private Long quantity; 75 + private Integer quantity;
75 76
76 /** 开始使用时间 */ 77 /** 开始使用时间 */
77 @ExcelProperty(index = 8) 78 @ExcelProperty(index = 8)
78 @JsonFormat(pattern = "yyyy-MM-dd") 79 @JsonFormat(pattern = "yyyy-MM-dd")
79 @NotNull(message = "开始使用时间不能为空") 80 @NotNull(message = "开始使用时间不能为空")
80 - private Date startUseTime; 81 + private LocalDate startUseTime;
81 82
82 /** 使用年限 */ 83 /** 使用年限 */
83 @ExcelProperty(index = 9) 84 @ExcelProperty(index = 9)
@@ -85,8 +86,13 @@ public class MechanicalCostImport { @@ -85,8 +86,13 @@ public class MechanicalCostImport {
85 @Positive(message = "使用年限必须为正整数") 86 @Positive(message = "使用年限必须为正整数")
86 private Long serviceLife; 87 private Long serviceLife;
87 88
  89 + /**
  90 + * 结束使用时间
  91 + */
  92 + private LocalDate endUseTime;
  93 +
88 /** 状态(0正常 1停用) */ 94 /** 状态(0正常 1停用) */
89 - private Long status; 95 + private Integer status;
90 96
91 @ExcelProperty(index = 10) 97 @ExcelProperty(index = 10)
92 @NotNull(message = "当前状态不能为空") 98 @NotNull(message = "当前状态不能为空")
@@ -121,7 +127,7 @@ public class MechanicalCostImport { @@ -121,7 +127,7 @@ public class MechanicalCostImport {
121 * 2. 修改 status(数字状态)时,自动同步 statusTxt(文本状态) 127 * 2. 修改 status(数字状态)时,自动同步 statusTxt(文本状态)
122 * 保持双向联动:改数字→更文本,改文本→更数字 128 * 保持双向联动:改数字→更文本,改文本→更数字
123 */ 129 */
124 - public void setStatus(Long status) { 130 + public void setStatus(Integer status) {
125 this.status = status; // 先赋值数字状态 131 this.status = status; // 先赋值数字状态
126 this.statusTxt = parseTxtFromStatus(status); // 同步文本状态 132 this.statusTxt = parseTxtFromStatus(status); // 同步文本状态
127 } 133 }
@@ -129,7 +135,7 @@ public class MechanicalCostImport { @@ -129,7 +135,7 @@ public class MechanicalCostImport {
129 /** 135 /**
130 * 辅助方法:将状态文本转为数字状态 136 * 辅助方法:将状态文本转为数字状态
131 */ 137 */
132 - private Long parseStatusFromTxt(String statusTxt) { 138 + private Integer parseStatusFromTxt(String statusTxt) {
133 if (statusTxt == null || statusTxt.trim().isEmpty()) { 139 if (statusTxt == null || statusTxt.trim().isEmpty()) {
134 this.statusTxt = "未知状态"; // 空文本兜底 140 this.statusTxt = "未知状态"; // 空文本兜底
135 return null; 141 return null;
@@ -137,8 +143,8 @@ public class MechanicalCostImport { @@ -137,8 +143,8 @@ public class MechanicalCostImport {
137 String trimmedTxt = statusTxt.trim(); 143 String trimmedTxt = statusTxt.trim();
138 // 支持多文本映射(兼容 Excel 中可能的不同写法) 144 // 支持多文本映射(兼容 Excel 中可能的不同写法)
139 return switch (trimmedTxt) { 145 return switch (trimmedTxt) {
140 - case "在用", "正常", "0" -> 0L;  
141 - case "报废", "停用", "1" -> 1L; 146 + case "在用", "正常", "0" -> 0;
  147 + case "报废", "停用", "1" -> 1;
142 default -> { 148 default -> {
143 this.statusTxt = "未知状态"; // 非法文本兜底 149 this.statusTxt = "未知状态"; // 非法文本兜底
144 yield null; // 非法状态返回 null,后续可做校验 150 yield null; // 非法状态返回 null,后续可做校验
@@ -149,7 +155,7 @@ public class MechanicalCostImport { @@ -149,7 +155,7 @@ public class MechanicalCostImport {
149 /** 155 /**
150 * 辅助方法:将数字状态转为文本状态 156 * 辅助方法:将数字状态转为文本状态
151 */ 157 */
152 - private String parseTxtFromStatus(Long status) { 158 + private String parseTxtFromStatus(Integer status) {
153 if (status == null) { 159 if (status == null) {
154 return "未知状态"; 160 return "未知状态";
155 } 161 }
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/RentalMechanicalCostImport.java
@@ -16,6 +16,7 @@ import lombok.Data; @@ -16,6 +16,7 @@ import lombok.Data;
16 import lombok.NoArgsConstructor; 16 import lombok.NoArgsConstructor;
17 17
18 import java.math.BigDecimal; 18 import java.math.BigDecimal;
  19 +import java.time.LocalDate;
19 import java.util.Date; 20 import java.util.Date;
20 21
21 /** 22 /**
@@ -65,20 +66,20 @@ public class RentalMechanicalCostImport { @@ -65,20 +66,20 @@ public class RentalMechanicalCostImport {
65 @ExcelProperty(index = 6) 66 @ExcelProperty(index = 6)
66 @NotNull(message = "数量不能为空") 67 @NotNull(message = "数量不能为空")
67 @Positive(message = "数量必须为正整数") 68 @Positive(message = "数量必须为正整数")
68 - private Long quantity; 69 + private Integer quantity;
69 70
70 /** 开始使用时间 */ 71 /** 开始使用时间 */
71 @ExcelProperty(index = 7) 72 @ExcelProperty(index = 7)
72 @JsonFormat(pattern = "yyyy-MM-dd") 73 @JsonFormat(pattern = "yyyy-MM-dd")
73 @NotNull(message = "开始使用时间不能为空") 74 @NotNull(message = "开始使用时间不能为空")
74 - private Date startUseTime; 75 + private LocalDate startUseTime;
75 76
76 /** 使用时长(天) */ 77 /** 使用时长(天) */
77 @ExcelProperty(index = 8) 78 @ExcelProperty(index = 8)
78 @NotNull(message = "使用时长不能为空") 79 @NotNull(message = "使用时长不能为空")
79 @Positive(message = "使用时长必须为正整数") 80 @Positive(message = "使用时长必须为正整数")
80 @Max(value = 3650, message = "使用时长最大值为3650") 81 @Max(value = 3650, message = "使用时长最大值为3650")
81 - private Long useDuration; 82 + private Integer useDuration;
82 83
83 /** 归属公司 */ 84 /** 归属公司 */
84 @ExcelProperty(index = 9) 85 @ExcelProperty(index = 9)
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostRespVO.java
@@ -3,10 +3,12 @@ package com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo; @@ -3,10 +3,12 @@ package com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo;
3 import cn.hutool.core.annotation.Alias; 3 import cn.hutool.core.annotation.Alias;
4 import cn.idev.excel.annotation.ExcelIgnoreUnannotated; 4 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
5 import cn.idev.excel.annotation.ExcelProperty; 5 import cn.idev.excel.annotation.ExcelProperty;
  6 +import com.fasterxml.jackson.annotation.JsonFormat;
6 import com.fhs.core.trans.anno.Trans; 7 import com.fhs.core.trans.anno.Trans;
7 import com.fhs.core.trans.constant.TransType; 8 import com.fhs.core.trans.constant.TransType;
8 import io.swagger.v3.oas.annotations.media.Schema; 9 import io.swagger.v3.oas.annotations.media.Schema;
9 import lombok.Data; 10 import lombok.Data;
  11 +import org.springframework.format.annotation.DateTimeFormat;
10 12
11 import java.math.BigDecimal; 13 import java.math.BigDecimal;
12 import java.time.LocalDate; 14 import java.time.LocalDate;
@@ -60,6 +62,8 @@ public class MechanicalCostRespVO { @@ -60,6 +62,8 @@ public class MechanicalCostRespVO {
60 62
61 @Schema(description = "开始使用时间", requiredMode = Schema.RequiredMode.REQUIRED) 63 @Schema(description = "开始使用时间", requiredMode = Schema.RequiredMode.REQUIRED)
62 @ExcelProperty("开始使用时间") 64 @ExcelProperty("开始使用时间")
  65 + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING)
  66 + @DateTimeFormat(pattern = "yyyy-MM-dd")
63 private LocalDate startUseTime; 67 private LocalDate startUseTime;
64 68
65 @Schema(description = "使用年限") 69 @Schema(description = "使用年限")
@@ -68,6 +72,8 @@ public class MechanicalCostRespVO { @@ -68,6 +72,8 @@ public class MechanicalCostRespVO {
68 72
69 @Schema(description = "结束使用时间") 73 @Schema(description = "结束使用时间")
70 @ExcelProperty("结束使用时间") 74 @ExcelProperty("结束使用时间")
  75 + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING)
  76 + @DateTimeFormat(pattern = "yyyy-MM-dd")
71 private LocalDate endUseTime; 77 private LocalDate endUseTime;
72 78
73 @Schema(description = "归属公司", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") 79 @Schema(description = "归属公司", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/wasterecord/vo/WasteRecordRespVO.java
@@ -3,10 +3,12 @@ package com.zteits.urbanops.module.garden.controller.admin.wasterecord.vo; @@ -3,10 +3,12 @@ package com.zteits.urbanops.module.garden.controller.admin.wasterecord.vo;
3 import cn.hutool.core.annotation.Alias; 3 import cn.hutool.core.annotation.Alias;
4 import cn.idev.excel.annotation.ExcelIgnoreUnannotated; 4 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
5 import cn.idev.excel.annotation.ExcelProperty; 5 import cn.idev.excel.annotation.ExcelProperty;
  6 +import com.fasterxml.jackson.annotation.JsonFormat;
6 import com.fhs.core.trans.anno.Trans; 7 import com.fhs.core.trans.anno.Trans;
7 import com.fhs.core.trans.constant.TransType; 8 import com.fhs.core.trans.constant.TransType;
8 import io.swagger.v3.oas.annotations.media.Schema; 9 import io.swagger.v3.oas.annotations.media.Schema;
9 import lombok.Data; 10 import lombok.Data;
  11 +import org.springframework.format.annotation.DateTimeFormat;
10 12
11 import java.math.BigDecimal; 13 import java.math.BigDecimal;
12 import java.time.LocalDate; 14 import java.time.LocalDate;
@@ -24,6 +26,8 @@ public class WasteRecordRespVO { @@ -24,6 +26,8 @@ public class WasteRecordRespVO {
24 26
25 @Schema(description = "运输日期", requiredMode = Schema.RequiredMode.REQUIRED) 27 @Schema(description = "运输日期", requiredMode = Schema.RequiredMode.REQUIRED)
26 @ExcelProperty("运输日期") 28 @ExcelProperty("运输日期")
  29 + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING)
  30 + @DateTimeFormat(pattern = "yyyy-MM-dd")
27 private LocalDate transportDate; 31 private LocalDate transportDate;
28 32
29 @Schema(description = "废弃物类型(如渣土、树枝等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 33 @Schema(description = "废弃物类型(如渣土、树枝等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")