diff --git a/README.md b/README.md index 835df02..a3381f7 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,27 @@ String signature = MD5(accessKey + secretKey + timestamp); ## 📚 主要API +### 数据同步API + +#### 基础同步接口 +- `POST /api/sync/single` - 同步单条数据 +- `POST /api/sync/batch` - 批量同步指定ID的数据 +- `POST /api/sync/unuploaded` - 同步所有未上传的数据 +- `POST /api/sync/incremental` - 增量同步数据(基于皮重时间) +- `POST /api/sync/all` - 全量同步所有数据 + +#### 分批处理接口(推荐用于大数据量) +- `POST /api/sync/unuploaded/batch?batchSize=500` - 分批同步未上传数据 +- `POST /api/sync/incremental/batch?batchSize=500` - 分批增量同步 +- `POST /api/sync/all/batch?batchSize=500` - 分批全量同步 + +**分批处理优势**: +- 🚀 **性能优化**: 避免一次性加载大量数据到内存 +- 💾 **内存友好**: 每批处理500条记录,减少内存占用 +- 🔄 **错误恢复**: 单批失败不影响其他批次 +- 📊 **进度监控**: 实时显示每批处理进度 +- ⚡ **仅插入模式**: 不进行更新检查,直接插入新记录,提高性能 + ### 供应商管理 ```http POST /api/supplier/page/conditions diff --git a/src/main/java/com/example/webapi/controller/ImageInfoController.java b/src/main/java/com/example/webapi/controller/ImageInfoController.java index ce3935f..5155def 100644 --- a/src/main/java/com/example/webapi/controller/ImageInfoController.java +++ b/src/main/java/com/example/webapi/controller/ImageInfoController.java @@ -4,8 +4,8 @@ import com.example.webapi.dto.ImageInfoQueryDTO; import com.example.webapi.entity.ImageInfo; import com.example.webapi.service.ImageInfoService; import com.example.webapi.dto.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Tag(name = "图片信息管理") +@Api(tags = "图片信息管理") @RestController @RequestMapping("/image-info") public class ImageInfoController { @@ -23,33 +23,33 @@ public class ImageInfoController { - @Operation(summary = "条件查询图片信息(分页)") + @ApiOperation("条件查询图片信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody ImageInfoQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @Operation(summary = "根据ID查询图片信息") + @ApiOperation("根据ID查询图片信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该图片信息")); } - @Operation(summary = "新增图片信息") + @ApiOperation("新增图片信息") @PostMapping public ApiResponse create(@RequestBody ImageInfo entity) { return ApiResponse.success(service.save(entity)); } - @Operation(summary = "更新图片信息") + @ApiOperation("更新图片信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody ImageInfo entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @Operation(summary = "删除图片信息") + @ApiOperation("删除图片信息") @DeleteMapping("/{id}") public ApiResponse delete(@PathVariable Integer id) { service.deleteById(id); diff --git a/src/main/java/com/example/webapi/controller/MaterialInfoController.java b/src/main/java/com/example/webapi/controller/MaterialInfoController.java index 3209d83..fbdd982 100644 --- a/src/main/java/com/example/webapi/controller/MaterialInfoController.java +++ b/src/main/java/com/example/webapi/controller/MaterialInfoController.java @@ -4,8 +4,8 @@ import com.example.webapi.dto.MaterialInfoQueryDTO; import com.example.webapi.entity.MaterialInfo; import com.example.webapi.service.MaterialInfoService; import com.example.webapi.dto.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Tag(name = "品种信息管理") +@Api(tags = "品种信息管理") @RestController @RequestMapping("/material-info") public class MaterialInfoController { @@ -22,33 +22,33 @@ public class MaterialInfoController { private MaterialInfoService service; - @Operation(summary = "条件查询品种信息(分页)") + @ApiOperation("条件查询品种信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody MaterialInfoQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @Operation(summary = "根据ID查询品种信息") + @ApiOperation("根据ID查询品种信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该品种信息")); } - @Operation(summary = "新增品种信息") + @ApiOperation("新增品种信息") @PostMapping public ApiResponse create(@RequestBody MaterialInfo entity) { return ApiResponse.success(service.save(entity)); } - @Operation(summary = "更新品种信息") + @ApiOperation("更新品种信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody MaterialInfo entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @Operation(summary = "删除品种信息") + @ApiOperation("删除品种信息") @DeleteMapping("/{id}") public ApiResponse delete(@PathVariable Integer id) { service.deleteById(id); diff --git a/src/main/java/com/example/webapi/controller/SupplierController.java b/src/main/java/com/example/webapi/controller/SupplierController.java index 161f0fe..a9ab27c 100644 --- a/src/main/java/com/example/webapi/controller/SupplierController.java +++ b/src/main/java/com/example/webapi/controller/SupplierController.java @@ -4,8 +4,8 @@ import com.example.webapi.dto.SupplierQueryDTO; import com.example.webapi.entity.Supplier; import com.example.webapi.service.SupplierService; import com.example.webapi.dto.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Tag(name = "供应商信息管理") +@Api(tags = "供应商信息管理") @RestController @RequestMapping("/supplier") public class SupplierController { @@ -22,33 +22,33 @@ public class SupplierController { private SupplierService service; - @Operation(summary = "条件查询供应商信息(分页)") + @ApiOperation("条件查询供应商信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody SupplierQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @Operation(summary = "根据ID查询供应商信息") + @ApiOperation("根据ID查询供应商信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应商信息")); } - @Operation(summary = "新增供应商信息") + @ApiOperation("新增供应商信息") @PostMapping public ApiResponse create(@RequestBody Supplier entity) { return ApiResponse.success(service.save(entity)); } - @Operation(summary = "更新供应商信息") + @ApiOperation("更新供应商信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody Supplier entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @Operation(summary = "删除供应商信息") + @ApiOperation("删除供应商信息") @DeleteMapping("/{id}") public ApiResponse delete(@PathVariable Integer id) { service.deleteById(id); diff --git a/src/main/java/com/example/webapi/dto/ApiResponse.java b/src/main/java/com/example/webapi/dto/ApiResponse.java index 02e76c4..22ea829 100644 --- a/src/main/java/com/example/webapi/dto/ApiResponse.java +++ b/src/main/java/com/example/webapi/dto/ApiResponse.java @@ -1,6 +1,8 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import java.time.LocalDateTime; @@ -10,19 +12,20 @@ import java.time.LocalDateTime; * @author Your Name * @version 1.0.0 */ -@Schema(description = "API通用响应结构") +@Data +@ApiModel(description = "API通用响应结构") public class ApiResponse { - @Schema(description = "响应状态码", example = "200") + @ApiModelProperty(value = "响应状态码", example = "200", notes = "200表示成功,其他值表示失败") private Integer code; - @Schema(description = "响应消息", example = "操作成功") + @ApiModelProperty(value = "响应消息", example = "操作成功") private String message; - @Schema(description = "响应数据") + @ApiModelProperty(value = "响应数据") private T data; - @Schema(description = "响应时间戳", example = "2023-05-01T10:30:00") + @ApiModelProperty(value = "响应时间戳", example = "2023-05-01T10:30:00") private LocalDateTime timestamp; public ApiResponse() { @@ -40,39 +43,6 @@ public class ApiResponse { this.data = data; } - // Getter and Setter methods - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public T getData() { - return data; - } - - public void setData(T data) { - this.data = data; - } - - public LocalDateTime getTimestamp() { - return timestamp; - } - - public void setTimestamp(LocalDateTime timestamp) { - this.timestamp = timestamp; - } - /** * 成功响应 * diff --git a/src/main/java/com/example/webapi/dto/BasePageDTO.java b/src/main/java/com/example/webapi/dto/BasePageDTO.java index 492ad7a..4c7f3f7 100644 --- a/src/main/java/com/example/webapi/dto/BasePageDTO.java +++ b/src/main/java/com/example/webapi/dto/BasePageDTO.java @@ -1,70 +1,40 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; /** * 基础分页DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "基础分页参数") +@Data +@ApiModel(description = "基础分页参数") public class BasePageDTO { - + /** * 页码(从0开始) */ - @Schema(description = "页码(从0开始)", example = "0") + @ApiModelProperty(value = "页码(从0开始)", example = "0", notes = "默认为0") private Integer page = 0; - + /** * 每页大小 */ - @Schema(description = "每页大小", example = "10") + @ApiModelProperty(value = "每页大小", example = "10", notes = "默认为10") private Integer size = 10; - + /** * 排序字段 */ - @Schema(description = "排序字段", example = "id") + @ApiModelProperty(value = "排序字段", example = "id", notes = "可选") private String sortBy; - + /** * 排序方向(asc/desc) */ - @Schema(description = "排序方向", example = "asc") + @ApiModelProperty(value = "排序方向", example = "asc", notes = "可选值:asc(升序)、desc(降序),默认为asc") private String sortDirection = "asc"; - - // Getter and Setter methods - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public Integer getSize() { - return size; - } - - public void setSize(Integer size) { - this.size = size; - } - - public String getSortBy() { - return sortBy; - } - - public void setSortBy(String sortBy) { - this.sortBy = sortBy; - } - - public String getSortDirection() { - return sortDirection; - } - - public void setSortDirection(String sortDirection) { - this.sortDirection = sortDirection; - } -} \ No newline at end of file +} diff --git a/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java b/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java index e3340f7..a6ea862 100644 --- a/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java @@ -1,69 +1,33 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 图片信息查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "图片信息查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "图片信息查询条件数据传输对象") public class ImageInfoQueryDTO extends BasePageDTO { - - @Schema(description = "文件名", example = "image001") - private String fileName; - - @Schema(description = "文件扩展名", example = "jpg") - private String fileExtension; - - @Schema(description = "MIME类型", example = "image/jpeg") - private String mimeType; - - @Schema(description = "文件大小最小值(字节)", example = "1024") - private Long fileSizeMin; - - @Schema(description = "文件大小最大值(字节)", example = "1048576") - private Long fileSizeMax; - // Getter and Setter methods - public String getFileName() { - return fileName; - } + @ApiModelProperty(value = "文件名", example = "image001", notes = "支持模糊查询") + private String fileName; - public void setFileName(String fileName) { - this.fileName = fileName; - } + @ApiModelProperty(value = "文件扩展名", example = "jpg", notes = "精确匹配") + private String fileExtension; - public String getFileExtension() { - return fileExtension; - } + @ApiModelProperty(value = "MIME类型", example = "image/jpeg", notes = "精确匹配") + private String mimeType; - public void setFileExtension(String fileExtension) { - this.fileExtension = fileExtension; - } + @ApiModelProperty(value = "文件大小最小值(字节)", example = "1024", notes = "单位:字节") + private Long fileSizeMin; - public String getMimeType() { - return mimeType; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public Long getFileSizeMin() { - return fileSizeMin; - } - - public void setFileSizeMin(Long fileSizeMin) { - this.fileSizeMin = fileSizeMin; - } - - public Long getFileSizeMax() { - return fileSizeMax; - } - - public void setFileSizeMax(Long fileSizeMax) { - this.fileSizeMax = fileSizeMax; - } -} + @ApiModelProperty(value = "文件大小最大值(字节)", example = "1048576", notes = "单位:字节") + private Long fileSizeMax; +} diff --git a/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java b/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java index b0be828..869933c 100644 --- a/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java @@ -1,47 +1,27 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 品种信息查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "品种信息查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "品种信息查询条件数据传输对象") public class MaterialInfoQueryDTO extends BasePageDTO { - - @Schema(description = "品种编码", example = "M001") - private String code; // 品种编码(模糊查询) - - @Schema(description = "品种名称", example = "钢材") - private String name; // 品种名称(模糊查询) - - @Schema(description = "激活状态", example = "true") - private Boolean activate; // 激活状态 - - // Getter and Setter methods - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } + @ApiModelProperty(value = "品种编码", example = "M001", notes = "支持模糊查询") + private String code; // 品种编码(模糊查询) - public Boolean getActivate() { - return activate; - } + @ApiModelProperty(value = "品种名称", example = "钢材", notes = "支持模糊查询") + private String name; // 品种名称(模糊查询) - public void setActivate(Boolean activate) { - this.activate = activate; - } -} \ No newline at end of file + @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + private Boolean activate; // 激活状态 +} diff --git a/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java b/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java index 080f002..290c793 100644 --- a/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java @@ -1,58 +1,30 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 供应商信息查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "供应商信息查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "供应商信息查询条件数据传输对象") public class SupplierQueryDTO extends BasePageDTO { - - @Schema(description = "供应商编码", example = "SUP001") - private String code; // 供应商编码(模糊查询) - - @Schema(description = "供应商名称", example = "福泉供应商") - private String name; // 供应商名称(模糊查询) - - @Schema(description = "激活状态", example = "true") - private Boolean active; // 激活状态 - - @Schema(description = "备注", example = "长期合作伙伴") - private String remark; // 备注(模糊查询) - - // Getter and Setter methods - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Boolean getActive() { - return active; - } + @ApiModelProperty(value = "供应商编码", example = "SUP001", notes = "支持模糊查询") + private String code; // 供应商编码(模糊查询) - public void setActive(Boolean active) { - this.active = active; - } + @ApiModelProperty(value = "供应商名称", example = "福泉供应商", notes = "支持模糊查询") + private String name; // 供应商名称(模糊查询) - public String getRemark() { - return remark; - } + @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + private Boolean active; // 激活状态 - public void setRemark(String remark) { - this.remark = remark; - } -} \ No newline at end of file + @ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") + private String remark; // 备注(模糊查询) +} diff --git a/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java b/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java index 1874dda..d54390c 100644 --- a/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java @@ -1,47 +1,27 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 供应标识品种信息查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "供应标识品种信息查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "供应标识品种信息查询条件数据传输对象") public class SupplyVarietyQueryDTO extends BasePageDTO { - - @Schema(description = "供应商ID", example = "1") - private Integer supplyId; // 供应商ID - - @Schema(description = "品种ID", example = "1") - private Integer good; // 品种ID - - @Schema(description = "激活状态", example = "true") - private Boolean active; // 激活状态 - - // Getter and Setter methods - public Integer getSupplyId() { - return supplyId; - } - - public void setSupplyId(Integer supplyId) { - this.supplyId = supplyId; - } - public Integer getGood() { - return good; - } - - public void setGood(Integer good) { - this.good = good; - } + @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + private Integer supplyId; // 供应商ID - public Boolean getActive() { - return active; - } + @ApiModelProperty(value = "品种ID", example = "1", notes = "精确匹配") + private Integer good; // 品种ID - public void setActive(Boolean active) { - this.active = active; - } -} \ No newline at end of file + @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + private Boolean active; // 激活状态 +} diff --git a/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java b/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java index de08a09..12e95fe 100644 --- a/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java @@ -1,93 +1,41 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 转运记录查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "转运记录查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "转运记录查询条件数据传输对象") public class TransferRecordQueryDTO extends BasePageDTO { - - // 基础查询条件(支持模糊查询) - @Schema(description = "单据号", example = "TR20230501001") - private String billNo; - - @Schema(description = "车牌号", example = "京A12345") - private String vehicleNo; - - @Schema(description = "卡号", example = "C0001") - private String cardNo; - - // 精确匹配查询 - @Schema(description = "物料ID", example = "1") - private Integer materielId; - - @Schema(description = "收货公司ID", example = "1") - private Integer receiveCompanyId; - - @Schema(description = "转运公司ID", example = "1") - private Integer transitCompanyId; - - @Schema(description = "供应商ID", example = "1") - private Integer supplyId; - - // Getter and Setter methods - public String getBillNo() { - return billNo; - } - - public void setBillNo(String billNo) { - this.billNo = billNo; - } - - public String getVehicleNo() { - return vehicleNo; - } - - public void setVehicleNo(String vehicleNo) { - this.vehicleNo = vehicleNo; - } - public String getCardNo() { - return cardNo; - } - - public void setCardNo(String cardNo) { - this.cardNo = cardNo; - } - - public Integer getMaterielId() { - return materielId; - } - - public void setMaterielId(Integer materielId) { - this.materielId = materielId; - } + // 基础查询条件(支持模糊查询) + @ApiModelProperty(value = "单据号", example = "TR20230501001", notes = "支持模糊查询") + private String billNo; - public Integer getReceiveCompanyId() { - return receiveCompanyId; - } + @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + private String vehicleNo; - public void setReceiveCompanyId(Integer receiveCompanyId) { - this.receiveCompanyId = receiveCompanyId; - } + @ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") + private String cardNo; - public Integer getTransitCompanyId() { - return transitCompanyId; - } + // 精确匹配查询 + @ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") + private Integer materielId; - public void setTransitCompanyId(Integer transitCompanyId) { - this.transitCompanyId = transitCompanyId; - } + @ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") + private Integer receiveCompanyId; - public Integer getSupplyId() { - return supplyId; - } + @ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") + private Integer transitCompanyId; - public void setSupplyId(Integer supplyId) { - this.supplyId = supplyId; - } -} \ No newline at end of file + @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + private Integer supplyId; +} diff --git a/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java b/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java index 4eab9fc..0d59f07 100644 --- a/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java @@ -1,36 +1,24 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 运输公司查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "运输公司查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "运输公司查询条件数据传输对象") public class TransportCompanyQueryDTO extends BasePageDTO { - - @Schema(description = "公司名称", example = "福泉物流") - private String name; // 公司名称(模糊查询) - - @Schema(description = "备注", example = "长期合作伙伴") - private String remark; // 备注(模糊查询) - - // Getter and Setter methods - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getRemark() { - return remark; - } + @ApiModelProperty(value = "公司名称", example = "福泉物流", notes = "支持模糊查询") + private String name; // 公司名称(模糊查询) - public void setRemark(String remark) { - this.remark = remark; - } -} \ No newline at end of file + @ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") + private String remark; // 备注(模糊查询) +} diff --git a/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java b/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java index 3957738..7fe17c6 100644 --- a/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java @@ -1,91 +1,39 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 车辆信息查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "车辆信息查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "车辆信息查询条件数据传输对象") public class VehicleInfoQueryDTO extends BasePageDTO { - - @Schema(description = "车牌号", example = "京A12345") - private String licensePlate; // 车牌号(模糊查询) - - @Schema(description = "车辆类型", example = "货车") - private String type; // 车辆类型 - - @Schema(description = "停用状态", example = "false") - private Boolean outage; // 停用状态 - - @Schema(description = "锁定状态", example = "false") - private Boolean lock; // 锁定状态 - - @Schema(description = "运输公司ID", example = "1") - private Integer transCompany; // 运输公司ID - - @Schema(description = "审核状态", example = "true") - private Boolean reviewed; // 审核状态 - - @Schema(description = "备注", example = "新购车辆") - private String remarks; // 备注(模糊查询) - - // Getter and Setter methods - public String getLicensePlate() { - return licensePlate; - } - - public void setLicensePlate(String licensePlate) { - this.licensePlate = licensePlate; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - public Boolean getOutage() { - return outage; - } - - public void setOutage(Boolean outage) { - this.outage = outage; - } - - public Boolean getLock() { - return lock; - } - - public void setLock(Boolean lock) { - this.lock = lock; - } + @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + private String licensePlate; // 车牌号(模糊查询) - public Integer getTransCompany() { - return transCompany; - } + @ApiModelProperty(value = "车辆类型", example = "货车", notes = "精确匹配") + private String type; // 车辆类型 - public void setTransCompany(Integer transCompany) { - this.transCompany = transCompany; - } + @ApiModelProperty(value = "停用状态", example = "false", notes = "true=已停用,false=未停用") + private Boolean outage; // 停用状态 - public Boolean getReviewed() { - return reviewed; - } + @ApiModelProperty(value = "锁定状态", example = "false", notes = "true=已锁定,false=未锁定") + private Boolean lock; // 锁定状态 - public void setReviewed(Boolean reviewed) { - this.reviewed = reviewed; - } + @ApiModelProperty(value = "运输公司ID", example = "1", notes = "精确匹配") + private Integer transCompany; // 运输公司ID - public String getRemarks() { - return remarks; - } + @ApiModelProperty(value = "审核状态", example = "true", notes = "true=已审核,false=未审核") + private Boolean reviewed; // 审核状态 - public void setRemarks(String remarks) { - this.remarks = remarks; - } -} \ No newline at end of file + @ApiModelProperty(value = "备注", example = "新购车辆", notes = "支持模糊查询") + private String remarks; // 备注(模糊查询) +} diff --git a/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java b/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java index 1921e32..796cfac 100644 --- a/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java @@ -1,159 +1,59 @@ package com.example.webapi.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * 称重记录查询条件DTO - * + * * @author Your Name * @version 1.0.0 */ -@Schema(description = "称重记录查询条件数据传输对象") +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(description = "称重记录查询条件数据传输对象") public class WeighingRecordQueryDTO extends BasePageDTO { - - // 基础查询条件(支持模糊查询) - @Schema(description = "单据号", example = "BL20230501001") - private String billNo; - - @Schema(description = "车牌号", example = "京A12345") - private String vehicleNo; - - @Schema(description = "卡号", example = "C0001") - private String cardNo; - - @Schema(description = "RFID号", example = "RF0001") - private String rfidNo; - - @Schema(description = "开单人", example = "张三") - private String issuedBy; - - @Schema(description = "毛重操作人", example = "李四") - private String gwBy; - - @Schema(description = "皮重操作人", example = "王五") - private String tBy; - - // 精确匹配查询 - @Schema(description = "物料ID", example = "1") - private Integer materielId; - - @Schema(description = "仓库ID", example = "1") - private Integer warehouseId; - - @Schema(description = "收货公司ID", example = "1") - private Integer receiveCompanyId; - - @Schema(description = "转运公司ID", example = "1") - private Integer transitCompanyId; - - @Schema(description = "车辆ID", example = "1") - private Integer vehicleId; - - @Schema(description = "供应商ID", example = "1") - private Integer supplyId; - - // Getter and Setter methods - public String getBillNo() { - return billNo; - } - - public void setBillNo(String billNo) { - this.billNo = billNo; - } - - public String getVehicleNo() { - return vehicleNo; - } - - public void setVehicleNo(String vehicleNo) { - this.vehicleNo = vehicleNo; - } - - public String getCardNo() { - return cardNo; - } - - public void setCardNo(String cardNo) { - this.cardNo = cardNo; - } - - public String getRfidNo() { - return rfidNo; - } - public void setRfidNo(String rfidNo) { - this.rfidNo = rfidNo; - } - - public String getIssuedBy() { - return issuedBy; - } - - public void setIssuedBy(String issuedBy) { - this.issuedBy = issuedBy; - } - - public String getGwBy() { - return gwBy; - } - - public void setGwBy(String gwBy) { - this.gwBy = gwBy; - } - - public String getTBy() { - return tBy; - } - - public void setTBy(String tBy) { - this.tBy = tBy; - } + // 基础查询条件(支持模糊查询) + @ApiModelProperty(value = "单据号", example = "BL20230501001", notes = "支持模糊查询") + private String billNo; - public Integer getMaterielId() { - return materielId; - } + @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + private String vehicleNo; - public void setMaterielId(Integer materielId) { - this.materielId = materielId; - } + @ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") + private String cardNo; - public Integer getWarehouseId() { - return warehouseId; - } + @ApiModelProperty(value = "RFID号", example = "RF0001", notes = "支持模糊查询") + private String rfidNo; - public void setWarehouseId(Integer warehouseId) { - this.warehouseId = warehouseId; - } + @ApiModelProperty(value = "开单人", example = "张三", notes = "支持模糊查询") + private String issuedBy; - public Integer getReceiveCompanyId() { - return receiveCompanyId; - } + @ApiModelProperty(value = "毛重操作人", example = "李四", notes = "支持模糊查询") + private String gwBy; - public void setReceiveCompanyId(Integer receiveCompanyId) { - this.receiveCompanyId = receiveCompanyId; - } + @ApiModelProperty(value = "皮重操作人", example = "王五", notes = "支持模糊查询") + private String tBy; - public Integer getTransitCompanyId() { - return transitCompanyId; - } + // 精确匹配查询 + @ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") + private Integer materielId; - public void setTransitCompanyId(Integer transitCompanyId) { - this.transitCompanyId = transitCompanyId; - } + @ApiModelProperty(value = "仓库ID", example = "1", notes = "精确匹配") + private Integer warehouseId; - public Integer getVehicleId() { - return vehicleId; - } + @ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") + private Integer receiveCompanyId; - public void setVehicleId(Integer vehicleId) { - this.vehicleId = vehicleId; - } + @ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") + private Integer transitCompanyId; - public Integer getSupplyId() { - return supplyId; - } + @ApiModelProperty(value = "车辆ID", example = "1", notes = "精确匹配") + private Integer vehicleId; - public void setSupplyId(Integer supplyId) { - this.supplyId = supplyId; - } -} \ No newline at end of file + @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + private Integer supplyId; +} diff --git a/src/main/java/com/example/webapi/entity/ImageInfo.java b/src/main/java/com/example/webapi/entity/ImageInfo.java index 2b49e88..dcd7017 100644 --- a/src/main/java/com/example/webapi/entity/ImageInfo.java +++ b/src/main/java/com/example/webapi/entity/ImageInfo.java @@ -1,99 +1,44 @@ package com.example.webapi.entity; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.persistence.Entity; -import jakarta.persistence.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; import java.util.Date; +@Data @Entity @Table(name = "图片信息表") -@Schema(description = "图片信息实体") +@ApiModel(description = "图片信息实体") public class ImageInfo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - @Schema(description = "图片ID", example = "1") + @ApiModelProperty(value = "图片ID", example = "1", notes = "主键,自动生成") private Integer id; @Column(name = "FileName", length = 255, nullable = false) - @Schema(description = "文件名", example = "vehicle_photo_001", required = true) + @ApiModelProperty(value = "文件名", example = "vehicle_photo_001", required = true) private String fileName; @Column(name = "FileExtension", length = 10, nullable = false) - @Schema(description = "文件扩展名", example = "jpg", required = true) + @ApiModelProperty(value = "文件扩展名", example = "jpg", required = true) private String fileExtension; @Column(name = "MimeType ", length = 50, nullable = false) - @Schema(description = "MIME类型", example = "image/jpeg", required = true) + @ApiModelProperty(value = "MIME类型", example = "image/jpeg", required = true) private String mimeType; @Lob @Column(name = "ImageData", nullable = false) - @Schema(description = "图片二进制数据", required = true, hidden = true) + @ApiModelProperty(value = "图片二进制数据", required = true, hidden = true) private byte[] imageData; @Column(name = "FileSize", nullable = false) - @Schema(description = "文件大小(字节)", example = "102400", required = true) + @ApiModelProperty(value = "文件大小(字节)", example = "102400", required = true, notes = "单位:字节") private Long fileSize; @Column(name = "UploadTime", nullable = false) - @Schema(description = "上传时间", example = "2023-05-01 10:30:00", required = true) + @ApiModelProperty(value = "上传时间", example = "2023-05-01 10:30:00", required = true) private Date uploadTime; - - // Getter and Setter methods - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public String getFileExtension() { - return fileExtension; - } - - public void setFileExtension(String fileExtension) { - this.fileExtension = fileExtension; - } - - public String getMimeType() { - return mimeType; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public byte[] getImageData() { - return imageData; - } - - public void setImageData(byte[] imageData) { - this.imageData = imageData; - } - - public Long getFileSize() { - return fileSize; - } - - public void setFileSize(Long fileSize) { - this.fileSize = fileSize; - } - - public Date getUploadTime() { - return uploadTime; - } - - public void setUploadTime(Date uploadTime) { - this.uploadTime = uploadTime; - } -} \ No newline at end of file +} diff --git a/src/main/java/com/example/webapi/entity/Supplier.java b/src/main/java/com/example/webapi/entity/Supplier.java index 3ac0123..29b8b35 100644 --- a/src/main/java/com/example/webapi/entity/Supplier.java +++ b/src/main/java/com/example/webapi/entity/Supplier.java @@ -1,72 +1,33 @@ package com.example.webapi.entity; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.persistence.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; +@Data @Entity @Table(name = "供应商信息表") -@Schema(description = "供应商信息实体") +@ApiModel(description = "供应商信息实体") public class Supplier { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @Schema(description = "供应商ID", example = "1") + @ApiModelProperty(value = "供应商ID", example = "1", notes = "主键,自动生成") private Integer id; @Column(name = "Code", length = 50, nullable = false) - @Schema(description = "供应商编码", example = "SUP001", required = true) + @ApiModelProperty(value = "供应商编码", example = "SUP001", required = true) private String code; @Column(name = "Name", length = 100, nullable = false) - @Schema(description = "供应商名称", example = "福泉供应商", required = true) + @ApiModelProperty(value = "供应商名称", example = "福泉供应商", required = true) private String name; @Column(name = "Active") - @Schema(description = "激活状态", example = "true") + @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") private Boolean active; @Column(name = "Remark", length = 300) - @Schema(description = "备注", example = "长期合作伙伴") + @ApiModelProperty(value = "备注", example = "长期合作伙伴") private String remark; - - // Getter and Setter methods - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Boolean getActive() { - return active; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } } diff --git a/src/main/java/com/example/webapi/entity/TransferRecord.java b/src/main/java/com/example/webapi/entity/TransferRecord.java index 3b62263..8ac2c07 100644 --- a/src/main/java/com/example/webapi/entity/TransferRecord.java +++ b/src/main/java/com/example/webapi/entity/TransferRecord.java @@ -1,194 +1,76 @@ package com.example.webapi.entity; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.persistence.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; +@Data @Entity @Table(name = "转运记录表") -@Schema(description = "转运记录实体") +@ApiModel(description = "转运记录实体") public class TransferRecord { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @Schema(description = "记录ID", example = "1") + @ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") private Integer id; @Column(name = "Materiel_ID") - @Schema(description = "物料ID", example = "1") + @ApiModelProperty(value = "物料ID", example = "1", notes = "关联物料信息") private Integer materielId; @Column(name = "Receive_Company_ID") - @Schema(description = "收货公司ID", example = "1") + @ApiModelProperty(value = "收货公司ID", example = "1", notes = "关联收货公司信息") private Integer receiveCompanyId; @Column(name = "Transit_Company_ID") - @Schema(description = "转运公司ID", example = "1") + @ApiModelProperty(value = "转运公司ID", example = "1", notes = "关联转运公司信息") private Integer transitCompanyId; @Column(name = "Bill_NO", length = 50, nullable = false) - @Schema(description = "单据号", example = "TR20230501001", required = true) + @ApiModelProperty(value = "单据号", example = "TR20230501001", required = true) private String billNo; @Column(name = "Supply_ID") - @Schema(description = "供应商ID", example = "1") + @ApiModelProperty(value = "供应商ID", example = "1", notes = "关联供应商信息") private Integer supplyId; @Column(name = "Card_NO", length = 8) - @Schema(description = "卡号", example = "C0001") + @ApiModelProperty(value = "卡号", example = "C0001") private String cardNo; @Column(name = "Vehicle_NO", length = 15, nullable = false) - @Schema(description = "车牌号", example = "京A12345", required = true) + @ApiModelProperty(value = "车牌号", example = "京A12345", required = true) private String vehicleNo; @Column(name = "Issued_Time") - @Schema(description = "开单时间", example = "2023-05-01 10:00:00") + @ApiModelProperty(value = "开单时间", example = "2023-05-01 10:00:00") private Date issuedTime; @Column(name = "GW", precision = 18, scale = 4) - @Schema(description = "毛重(kg)", example = "5000.5") + @ApiModelProperty(value = "毛重(kg)", example = "5000.5", notes = "单位:千克") private BigDecimal gw; @Column(name = "T", precision = 18, scale = 4) - @Schema(description = "皮重(kg)", example = "1000.5") + @ApiModelProperty(value = "皮重(kg)", example = "1000.5", notes = "单位:千克") private BigDecimal t; @Column(name = "T_Time") - @Schema(description = "皮重时间", example = "2023-05-01 11:00:00") + @ApiModelProperty(value = "皮重时间", example = "2023-05-01 11:00:00") private Date tTime; @Column(name = "NW", precision = 18, scale = 4) - @Schema(description = "净重(kg)", example = "4000.0") + @ApiModelProperty(value = "净重(kg)", example = "4000.0", notes = "单位:千克,毛重-皮重") private BigDecimal nw; @Column(name = "Comments", length = 500) - @Schema(description = "备注", example = "货物完好") + @ApiModelProperty(value = "备注", example = "货物完好") private String comments; + @Column(name = "status") - @Schema(description = "是否已转运", example = "1") + @ApiModelProperty(value = "是否已转运", example = "1", notes = "是否已转运0.否 1是") private Integer status; - - // Getter and Setter methods - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getMaterielId() { - return materielId; - } - - public void setMaterielId(Integer materielId) { - this.materielId = materielId; - } - - public Integer getReceiveCompanyId() { - return receiveCompanyId; - } - - public void setReceiveCompanyId(Integer receiveCompanyId) { - this.receiveCompanyId = receiveCompanyId; - } - - public Integer getTransitCompanyId() { - return transitCompanyId; - } - - public void setTransitCompanyId(Integer transitCompanyId) { - this.transitCompanyId = transitCompanyId; - } - - public String getBillNo() { - return billNo; - } - - public void setBillNo(String billNo) { - this.billNo = billNo; - } - - public Integer getSupplyId() { - return supplyId; - } - - public void setSupplyId(Integer supplyId) { - this.supplyId = supplyId; - } - - public String getCardNo() { - return cardNo; - } - - public void setCardNo(String cardNo) { - this.cardNo = cardNo; - } - - public String getVehicleNo() { - return vehicleNo; - } - - public void setVehicleNo(String vehicleNo) { - this.vehicleNo = vehicleNo; - } - - public Date getIssuedTime() { - return issuedTime; - } - - public void setIssuedTime(Date issuedTime) { - this.issuedTime = issuedTime; - } - - public BigDecimal getGw() { - return gw; - } - - public void setGw(BigDecimal gw) { - this.gw = gw; - } - - public BigDecimal getT() { - return t; - } - - public void setT(BigDecimal t) { - this.t = t; - } - - public Date getTTime() { - return tTime; - } - - public void setTTime(Date tTime) { - this.tTime = tTime; - } - - public BigDecimal getNw() { - return nw; - } - - public void setNw(BigDecimal nw) { - this.nw = nw; - } - - public String getComments() { - return comments; - } - - public void setComments(String comments) { - this.comments = comments; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } } diff --git a/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java b/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java index 77fcfd5..581ce47 100644 --- a/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java +++ b/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java @@ -1,8 +1,7 @@ package com.example.webapi.interceptor; import com.example.webapi.util.SignatureUtil; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; + import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,6 +12,8 @@ import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.ContentCachingRequestWrapper; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId;