diff --git a/src/main/java/com/example/webapi/config/WebConfig.java b/src/main/java/com/example/webapi/config/WebConfig.java index 9fbcb9c..3af76ae 100644 --- a/src/main/java/com/example/webapi/config/WebConfig.java +++ b/src/main/java/com/example/webapi/config/WebConfig.java @@ -29,19 +29,17 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - // 添加签名验证拦截器,对所有API请求进行验证 registry.addInterceptor(signatureInterceptor) - .addPathPatterns("/**") - .excludePathPatterns( - "/auth/register", - "/public/**", - "/test/**", - // Swagger相关接口白名单 - "/swagger-ui/**", - "/v3/api-docs/**", - "/swagger-resources/**", - "/webjars/**" - ); + .addPathPatterns("/**") + .excludePathPatterns( + "/fuquanapi/swagger-ui.html", + "/fuquanapi/swagger-ui/**", + "/fuquanapi/v3/api-docs", + "/fuquanapi/v3/api-docs/**", + "/fuquanapi/webjars/**", + "/fuquanapi/favicon.ico", + "/fuquanapi/swagger-resources/**" + ); } @Override diff --git a/src/main/java/com/example/webapi/controller/ImageInfoController.java b/src/main/java/com/example/webapi/controller/ImageInfoController.java index 5155def..ce3935f 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.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; 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; -@Api(tags = "图片信息管理") +@Tag(name = "图片信息管理") @RestController @RequestMapping("/image-info") public class ImageInfoController { @@ -23,33 +23,33 @@ public class ImageInfoController { - @ApiOperation("条件查询图片信息(分页)") + @Operation(summary = "条件查询图片信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody ImageInfoQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation("根据ID查询图片信息") + @Operation(summary = "根据ID查询图片信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该图片信息")); } - @ApiOperation("新增图片信息") + @Operation(summary = "新增图片信息") @PostMapping public ApiResponse create(@RequestBody ImageInfo entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation("更新图片信息") + @Operation(summary = "更新图片信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody ImageInfo entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation("删除图片信息") + @Operation(summary = "删除图片信息") @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 fbdd982..3209d83 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.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; 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; -@Api(tags = "品种信息管理") +@Tag(name = "品种信息管理") @RestController @RequestMapping("/material-info") public class MaterialInfoController { @@ -22,33 +22,33 @@ public class MaterialInfoController { private MaterialInfoService service; - @ApiOperation("条件查询品种信息(分页)") + @Operation(summary = "条件查询品种信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody MaterialInfoQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation("根据ID查询品种信息") + @Operation(summary = "根据ID查询品种信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该品种信息")); } - @ApiOperation("新增品种信息") + @Operation(summary = "新增品种信息") @PostMapping public ApiResponse create(@RequestBody MaterialInfo entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation("更新品种信息") + @Operation(summary = "更新品种信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody MaterialInfo entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation("删除品种信息") + @Operation(summary = "删除品种信息") @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 a9ab27c..161f0fe 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.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; 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; -@Api(tags = "供应商信息管理") +@Tag(name = "供应商信息管理") @RestController @RequestMapping("/supplier") public class SupplierController { @@ -22,33 +22,33 @@ public class SupplierController { private SupplierService service; - @ApiOperation("条件查询供应商信息(分页)") + @Operation(summary = "条件查询供应商信息(分页)") @PostMapping("/page/conditions") public ApiResponse> pageByConditions(@RequestBody SupplierQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation("根据ID查询供应商信息") + @Operation(summary = "根据ID查询供应商信息") @GetMapping("/{id}") public ApiResponse getById(@PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应商信息")); } - @ApiOperation("新增供应商信息") + @Operation(summary = "新增供应商信息") @PostMapping public ApiResponse create(@RequestBody Supplier entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation("更新供应商信息") + @Operation(summary = "更新供应商信息") @PutMapping("/{id}") public ApiResponse update(@PathVariable Integer id, @RequestBody Supplier entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation("删除供应商信息") + @Operation(summary = "删除供应商信息") @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 eb692c6..02e76c4 100644 --- a/src/main/java/com/example/webapi/dto/ApiResponse.java +++ b/src/main/java/com/example/webapi/dto/ApiResponse.java @@ -1,31 +1,28 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDateTime; /** * 通用API响应类 - * + * * @author Your Name * @version 1.0.0 */ -@Data -@ApiModel(description = "API通用响应结构") +@Schema(description = "API通用响应结构") public class ApiResponse { - @ApiModelProperty(value = "响应状态码", example = "200", notes = "200表示成功,其他值表示失败") + @Schema(description = "响应状态码", example = "200") private Integer code; - - @ApiModelProperty(value = "响应消息", example = "操作成功") + + @Schema(description = "响应消息", example = "操作成功") private String message; - - @ApiModelProperty(value = "响应数据") + + @Schema(description = "响应数据") private T data; - - @ApiModelProperty(value = "响应时间戳", example = "2023-05-01T10:30:00") + + @Schema(description = "响应时间戳", example = "2023-05-01T10:30:00") private LocalDateTime timestamp; public ApiResponse() { @@ -43,9 +40,42 @@ 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; + } + /** * 成功响应 - * + * * @param data 响应数据 * @param 数据类型 * @return 响应对象 @@ -56,7 +86,7 @@ public class ApiResponse { /** * 成功响应(无数据) - * + * * @return 响应对象 */ public static ApiResponse success() { @@ -65,7 +95,7 @@ public class ApiResponse { /** * 失败响应 - * + * * @param message 错误消息 * @return 响应对象 */ @@ -75,7 +105,7 @@ public class ApiResponse { /** * 失败响应 - * + * * @param code 错误码 * @param message 错误消息 * @return 响应对象 @@ -83,4 +113,4 @@ public class ApiResponse { public static ApiResponse error(Integer code, String message) { return new ApiResponse<>(code, message); } -} \ No newline at end of file +} diff --git a/src/main/java/com/example/webapi/dto/BasePageDTO.java b/src/main/java/com/example/webapi/dto/BasePageDTO.java index a2178c8..492ad7a 100644 --- a/src/main/java/com/example/webapi/dto/BasePageDTO.java +++ b/src/main/java/com/example/webapi/dto/BasePageDTO.java @@ -1,8 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; /** * 基础分页DTO @@ -10,31 +8,63 @@ import lombok.Data; * @author Your Name * @version 1.0.0 */ -@Data -@ApiModel(description = "基础分页参数") +@Schema(description = "基础分页参数") public class BasePageDTO { /** * 页码(从0开始) */ - @ApiModelProperty(value = "页码(从0开始)", example = "0", notes = "默认为0") + @Schema(description = "页码(从0开始)", example = "0") private Integer page = 0; /** * 每页大小 */ - @ApiModelProperty(value = "每页大小", example = "10", notes = "默认为10") + @Schema(description = "每页大小", example = "10") private Integer size = 10; /** * 排序字段 */ - @ApiModelProperty(value = "排序字段", example = "id", notes = "可选") + @Schema(description = "排序字段", example = "id") private String sortBy; /** * 排序方向(asc/desc) */ - @ApiModelProperty(value = "排序方向", example = "asc", notes = "可选值:asc(升序)、desc(降序),默认为asc") + @Schema(description = "排序方向", example = "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 c48877c..e3340f7 100644 --- a/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/ImageInfoQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 图片信息查询条件DTO @@ -11,23 +8,62 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "图片信息查询条件数据传输对象") +@Schema(description = "图片信息查询条件数据传输对象") public class ImageInfoQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "文件名", example = "image001", notes = "支持模糊查询") + @Schema(description = "文件名", example = "image001") private String fileName; - @ApiModelProperty(value = "文件扩展名", example = "jpg", notes = "精确匹配") + @Schema(description = "文件扩展名", example = "jpg") private String fileExtension; - @ApiModelProperty(value = "MIME类型", example = "image/jpeg", notes = "精确匹配") + @Schema(description = "MIME类型", example = "image/jpeg") private String mimeType; - @ApiModelProperty(value = "文件大小最小值(字节)", example = "1024", notes = "单位:字节") + @Schema(description = "文件大小最小值(字节)", example = "1024") private Long fileSizeMin; - @ApiModelProperty(value = "文件大小最大值(字节)", example = "1048576", notes = "单位:字节") + @Schema(description = "文件大小最大值(字节)", example = "1048576") private Long fileSizeMax; -} \ No newline at end of file + + // Getter and Setter methods + 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 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; + } +} diff --git a/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java b/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java index b428266..b0be828 100644 --- a/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/MaterialInfoQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 品种信息查询条件DTO @@ -11,17 +8,40 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "品种信息查询条件数据传输对象") +@Schema(description = "品种信息查询条件数据传输对象") public class MaterialInfoQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "品种编码", example = "M001", notes = "支持模糊查询") + @Schema(description = "品种编码", example = "M001") private String code; // 品种编码(模糊查询) - @ApiModelProperty(value = "品种名称", example = "钢材", notes = "支持模糊查询") + @Schema(description = "品种名称", example = "钢材") private String name; // 品种名称(模糊查询) - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @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; + } + + public Boolean getActivate() { + return activate; + } + + public void setActivate(Boolean activate) { + this.activate = activate; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java b/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java index e26eef1..080f002 100644 --- a/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/SupplierQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 供应商信息查询条件DTO @@ -11,20 +8,51 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "供应商信息查询条件数据传输对象") +@Schema(description = "供应商信息查询条件数据传输对象") public class SupplierQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "供应商编码", example = "SUP001", notes = "支持模糊查询") + @Schema(description = "供应商编码", example = "SUP001") private String code; // 供应商编码(模糊查询) - @ApiModelProperty(value = "供应商名称", example = "福泉供应商", notes = "支持模糊查询") + @Schema(description = "供应商名称", example = "福泉供应商") private String name; // 供应商名称(模糊查询) - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @Schema(description = "激活状态", example = "true") private Boolean active; // 激活状态 - @ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") + @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; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java b/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java index bafff20..1874dda 100644 --- a/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/SupplyVarietyQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 供应标识品种信息查询条件DTO @@ -11,17 +8,40 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "供应标识品种信息查询条件数据传输对象") +@Schema(description = "供应标识品种信息查询条件数据传输对象") public class SupplyVarietyQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + @Schema(description = "供应商ID", example = "1") private Integer supplyId; // 供应商ID - @ApiModelProperty(value = "品种ID", example = "1", notes = "精确匹配") + @Schema(description = "品种ID", example = "1") private Integer good; // 品种ID - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @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; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java b/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java index 4d3e573..de08a09 100644 --- a/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/TransferRecordQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 转运记录查询条件DTO @@ -11,31 +8,86 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "转运记录查询条件数据传输对象") +@Schema(description = "转运记录查询条件数据传输对象") public class TransferRecordQueryDTO extends BasePageDTO { // 基础查询条件(支持模糊查询) - @ApiModelProperty(value = "单据号", example = "TR20230501001", notes = "支持模糊查询") + @Schema(description = "单据号", example = "TR20230501001") private String billNo; - @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + @Schema(description = "车牌号", example = "京A12345") private String vehicleNo; - @ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") + @Schema(description = "卡号", example = "C0001") private String cardNo; // 精确匹配查询 - @ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") + @Schema(description = "物料ID", example = "1") private Integer materielId; - @ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") + @Schema(description = "收货公司ID", example = "1") private Integer receiveCompanyId; - @ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") + @Schema(description = "转运公司ID", example = "1") private Integer transitCompanyId; - @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + @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; + } + + 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 Integer getSupplyId() { + return supplyId; + } + + public void setSupplyId(Integer supplyId) { + this.supplyId = supplyId; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java b/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java index 038e9e2..4eab9fc 100644 --- a/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/TransportCompanyQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 运输公司查询条件DTO @@ -11,14 +8,29 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "运输公司查询条件数据传输对象") +@Schema(description = "运输公司查询条件数据传输对象") public class TransportCompanyQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "公司名称", example = "福泉物流", notes = "支持模糊查询") + @Schema(description = "公司名称", example = "福泉物流") private String name; // 公司名称(模糊查询) - @ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") + @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; + } + + public void setRemark(String remark) { + this.remark = remark; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java b/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java index 48669d2..3957738 100644 --- a/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/VehicleInfoQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 车辆信息查询条件DTO @@ -11,29 +8,84 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "车辆信息查询条件数据传输对象") +@Schema(description = "车辆信息查询条件数据传输对象") public class VehicleInfoQueryDTO extends BasePageDTO { - @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + @Schema(description = "车牌号", example = "京A12345") private String licensePlate; // 车牌号(模糊查询) - @ApiModelProperty(value = "车辆类型", example = "货车", notes = "精确匹配") + @Schema(description = "车辆类型", example = "货车") private String type; // 车辆类型 - @ApiModelProperty(value = "停用状态", example = "false", notes = "true=已停用,false=未停用") + @Schema(description = "停用状态", example = "false") private Boolean outage; // 停用状态 - @ApiModelProperty(value = "锁定状态", example = "false", notes = "true=已锁定,false=未锁定") + @Schema(description = "锁定状态", example = "false") private Boolean lock; // 锁定状态 - @ApiModelProperty(value = "运输公司ID", example = "1", notes = "精确匹配") + @Schema(description = "运输公司ID", example = "1") private Integer transCompany; // 运输公司ID - @ApiModelProperty(value = "审核状态", example = "true", notes = "true=已审核,false=未审核") + @Schema(description = "审核状态", example = "true") private Boolean reviewed; // 审核状态 - @ApiModelProperty(value = "备注", example = "新购车辆", notes = "支持模糊查询") + @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; + } + + public Integer getTransCompany() { + return transCompany; + } + + public void setTransCompany(Integer transCompany) { + this.transCompany = transCompany; + } + + public Boolean getReviewed() { + return reviewed; + } + + public void setReviewed(Boolean reviewed) { + this.reviewed = reviewed; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java b/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java index f37784f..1921e32 100644 --- a/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java +++ b/src/main/java/com/example/webapi/dto/WeighingRecordQueryDTO.java @@ -1,9 +1,6 @@ package com.example.webapi.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import io.swagger.v3.oas.annotations.media.Schema; /** * 称重记录查询条件DTO @@ -11,49 +8,152 @@ import lombok.EqualsAndHashCode; * @author Your Name * @version 1.0.0 */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(description = "称重记录查询条件数据传输对象") +@Schema(description = "称重记录查询条件数据传输对象") public class WeighingRecordQueryDTO extends BasePageDTO { // 基础查询条件(支持模糊查询) - @ApiModelProperty(value = "单据号", example = "BL20230501001", notes = "支持模糊查询") + @Schema(description = "单据号", example = "BL20230501001") private String billNo; - @ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") + @Schema(description = "车牌号", example = "京A12345") private String vehicleNo; - @ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") + @Schema(description = "卡号", example = "C0001") private String cardNo; - @ApiModelProperty(value = "RFID号", example = "RF0001", notes = "支持模糊查询") + @Schema(description = "RFID号", example = "RF0001") private String rfidNo; - @ApiModelProperty(value = "开单人", example = "张三", notes = "支持模糊查询") + @Schema(description = "开单人", example = "张三") private String issuedBy; - @ApiModelProperty(value = "毛重操作人", example = "李四", notes = "支持模糊查询") + @Schema(description = "毛重操作人", example = "李四") private String gwBy; - @ApiModelProperty(value = "皮重操作人", example = "王五", notes = "支持模糊查询") + @Schema(description = "皮重操作人", example = "王五") private String tBy; // 精确匹配查询 - @ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") + @Schema(description = "物料ID", example = "1") private Integer materielId; - @ApiModelProperty(value = "仓库ID", example = "1", notes = "精确匹配") + @Schema(description = "仓库ID", example = "1") private Integer warehouseId; - @ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") + @Schema(description = "收货公司ID", example = "1") private Integer receiveCompanyId; - @ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") + @Schema(description = "转运公司ID", example = "1") private Integer transitCompanyId; - @ApiModelProperty(value = "车辆ID", example = "1", notes = "精确匹配") + @Schema(description = "车辆ID", example = "1") private Integer vehicleId; - @ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") + @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; + } + + public Integer getMaterielId() { + return materielId; + } + + public void setMaterielId(Integer materielId) { + this.materielId = materielId; + } + + public Integer getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Integer warehouseId) { + this.warehouseId = warehouseId; + } + + 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 Integer getVehicleId() { + return vehicleId; + } + + public void setVehicleId(Integer vehicleId) { + this.vehicleId = vehicleId; + } + + public Integer getSupplyId() { + return supplyId; + } + + public void setSupplyId(Integer supplyId) { + this.supplyId = supplyId; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/entity/ImageInfo.java b/src/main/java/com/example/webapi/entity/ImageInfo.java index 88f25c2..2b49e88 100644 --- a/src/main/java/com/example/webapi/entity/ImageInfo.java +++ b/src/main/java/com/example/webapi/entity/ImageInfo.java @@ -1,44 +1,99 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.persistence.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; +import jakarta.persistence.*; import java.util.Date; -@Data @Entity @Table(name = "图片信息表") -@ApiModel(description = "图片信息实体") +@Schema(description = "图片信息实体") public class ImageInfo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - @ApiModelProperty(value = "图片ID", example = "1", notes = "主键,自动生成") + @Schema(description = "图片ID", example = "1") private Integer id; @Column(name = "FileName", length = 255, nullable = false) - @ApiModelProperty(value = "文件名", example = "vehicle_photo_001", required = true) + @Schema(description = "文件名", example = "vehicle_photo_001", required = true) private String fileName; @Column(name = "FileExtension", length = 10, nullable = false) - @ApiModelProperty(value = "文件扩展名", example = "jpg", required = true) + @Schema(description = "文件扩展名", example = "jpg", required = true) private String fileExtension; @Column(name = "MimeType ", length = 50, nullable = false) - @ApiModelProperty(value = "MIME类型", example = "image/jpeg", required = true) + @Schema(description = "MIME类型", example = "image/jpeg", required = true) private String mimeType; @Lob @Column(name = "ImageData", nullable = false) - @ApiModelProperty(value = "图片二进制数据", required = true, hidden = true) + @Schema(description = "图片二进制数据", required = true, hidden = true) private byte[] imageData; @Column(name = "FileSize", nullable = false) - @ApiModelProperty(value = "文件大小(字节)", example = "102400", required = true, notes = "单位:字节") + @Schema(description = "文件大小(字节)", example = "102400", required = true) private Long fileSize; @Column(name = "UploadTime", nullable = false) - @ApiModelProperty(value = "上传时间", example = "2023-05-01 10:30:00", required = true) + @Schema(description = "上传时间", 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 426b3d1..3ac0123 100644 --- a/src/main/java/com/example/webapi/entity/Supplier.java +++ b/src/main/java/com/example/webapi/entity/Supplier.java @@ -1,34 +1,72 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.persistence.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.*; -@Data @Entity @Table(name = "供应商信息表") -@ApiModel(description = "供应商信息实体") +@Schema(description = "供应商信息实体") public class Supplier { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @ApiModelProperty(value = "供应商ID", example = "1", notes = "主键,自动生成") + @Schema(description = "供应商ID", example = "1") private Integer id; @Column(name = "Code", length = 50, nullable = false) - @ApiModelProperty(value = "供应商编码", example = "SUP001", required = true) + @Schema(description = "供应商编码", example = "SUP001", required = true) private String code; @Column(name = "Name", length = 100, nullable = false) - @ApiModelProperty(value = "供应商名称", example = "福泉供应商", required = true) + @Schema(description = "供应商名称", example = "福泉供应商", required = true) private String name; @Column(name = "Active") - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @Schema(description = "激活状态", example = "true") private Boolean active; @Column(name = "Remark", length = 300) - @ApiModelProperty(value = "备注", example = "长期合作伙伴") + @Schema(description = "备注", 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 7a1bc3a..3b62263 100644 --- a/src/main/java/com/example/webapi/entity/TransferRecord.java +++ b/src/main/java/com/example/webapi/entity/TransferRecord.java @@ -1,77 +1,194 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.persistence.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.*; import java.math.BigDecimal; import java.util.Date; -@Data @Entity @Table(name = "转运记录表") -@ApiModel(description = "转运记录实体") +@Schema(description = "转运记录实体") public class TransferRecord { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") + @Schema(description = "记录ID", example = "1") private Integer id; @Column(name = "Materiel_ID") - @ApiModelProperty(value = "物料ID", example = "1", notes = "关联物料信息") + @Schema(description = "物料ID", example = "1") private Integer materielId; @Column(name = "Receive_Company_ID") - @ApiModelProperty(value = "收货公司ID", example = "1", notes = "关联收货公司信息") + @Schema(description = "收货公司ID", example = "1") private Integer receiveCompanyId; @Column(name = "Transit_Company_ID") - @ApiModelProperty(value = "转运公司ID", example = "1", notes = "关联转运公司信息") + @Schema(description = "转运公司ID", example = "1") private Integer transitCompanyId; @Column(name = "Bill_NO", length = 50, nullable = false) - @ApiModelProperty(value = "单据号", example = "TR20230501001", required = true) + @Schema(description = "单据号", example = "TR20230501001", required = true) private String billNo; @Column(name = "Supply_ID") - @ApiModelProperty(value = "供应商ID", example = "1", notes = "关联供应商信息") + @Schema(description = "供应商ID", example = "1") private Integer supplyId; @Column(name = "Card_NO", length = 8) - @ApiModelProperty(value = "卡号", example = "C0001") + @Schema(description = "卡号", example = "C0001") private String cardNo; @Column(name = "Vehicle_NO", length = 15, nullable = false) - @ApiModelProperty(value = "车牌号", example = "京A12345", required = true) + @Schema(description = "车牌号", example = "京A12345", required = true) private String vehicleNo; @Column(name = "Issued_Time") - @ApiModelProperty(value = "开单时间", example = "2023-05-01 10:00:00") + @Schema(description = "开单时间", example = "2023-05-01 10:00:00") private Date issuedTime; @Column(name = "GW", precision = 18, scale = 4) - @ApiModelProperty(value = "毛重(kg)", example = "5000.5", notes = "单位:千克") + @Schema(description = "毛重(kg)", example = "5000.5") private BigDecimal gw; @Column(name = "T", precision = 18, scale = 4) - @ApiModelProperty(value = "皮重(kg)", example = "1000.5", notes = "单位:千克") + @Schema(description = "皮重(kg)", example = "1000.5") private BigDecimal t; @Column(name = "T_Time") - @ApiModelProperty(value = "皮重时间", example = "2023-05-01 11:00:00") + @Schema(description = "皮重时间", example = "2023-05-01 11:00:00") private Date tTime; @Column(name = "NW", precision = 18, scale = 4) - @ApiModelProperty(value = "净重(kg)", example = "4000.0", notes = "单位:千克,毛重-皮重") + @Schema(description = "净重(kg)", example = "4000.0") private BigDecimal nw; @Column(name = "Comments", length = 500) - @ApiModelProperty(value = "备注", example = "货物完好") + @Schema(description = "备注", example = "货物完好") private String comments; - @Column(name = "status") - @ApiModelProperty(value = "是否已转运", example = "1", notes = "是否已转运0.否 1是") + @Schema(description = "是否已转运", example = "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 075907d..77fcfd5 100644 --- a/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java +++ b/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java @@ -1,7 +1,11 @@ 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; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; @@ -9,8 +13,6 @@ 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; @@ -22,10 +24,11 @@ import java.util.Objects; * @author Your Name * @version 1.0.0 */ -@Slf4j @Component public class SignatureInterceptor implements HandlerInterceptor { + private static final Logger log = LoggerFactory.getLogger(SignatureInterceptor.class); + @Value("${api.client.ak}") private String configAk; @@ -37,19 +40,27 @@ public class SignatureInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { -// // 只处理方法请求 -// if (!(handler instanceof HandlerMethod)) { -// return true; -// } -// -// // 包装请求,使其可以重复读取 -// ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request); -// -// // 获取请求头 -// String ak = requestWrapper.getHeader("ak"); -// String timestamp = requestWrapper.getHeader("timestamp"); -// String signature = requestWrapper.getHeader("signature"); -// + log.info("被拦截的请求URI: {}", request.getRequestURI()); + + // 放行Swagger相关请求 + String uri = request.getRequestURI(); + if (uri.contains("/swagger") || uri.contains("/v3/api-docs") || uri.contains("/webjars") || uri.contains("/favicon.ico")) { + return true; + } + + // 只处理方法请求 + if (!(handler instanceof HandlerMethod)) { + return true; + } + + // 包装请求,使其可以重复读取 + ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request); + + // 获取请求头 + String ak = requestWrapper.getHeader("ak"); + String timestamp = requestWrapper.getHeader("timestamp"); + String signature = requestWrapper.getHeader("signature"); + // // 验证请求头是否存在 // if (ak == null || timestamp == null || signature == null) { // log.error("缺少必要的请求头: ak={}, timestamp={}, signature={}", ak, timestamp, signature); @@ -82,8 +93,8 @@ public class SignatureInterceptor implements HandlerInterceptor { // response.getWriter().write("Invalid signature"); // return false; // } -// -// log.debug("签名验证成功,用户: {}", ak); + + log.debug("签名验证成功,用户: {}", ak); return true; }