From 89c19e94c2f7d1c27888697dd9d361f605ab7b92 Mon Sep 17 00:00:00 2001 From: Searises Hao Wang Date: Thu, 31 Jul 2025 20:52:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8D=87=E7=BA=A7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 22 +- .../com/example/webapi/WebApiApplication.java | 6 +- .../example/webapi/config/SwaggerConfig.java | 91 +--- .../com/example/webapi/config/WebConfig.java | 22 +- .../controller/ImageInfoController.java | 16 +- .../controller/MaterialInfoController.java | 16 +- .../webapi/controller/SupplierController.java | 16 +- .../controller/SupplyVarietyController.java | 30 +- .../controller/TransferRecordController.java | 30 +- .../TransportCompanyController.java | 30 +- .../controller/TwiceWeighingController.java | 81 +++ .../controller/VehicleInfoController.java | 29 +- .../controller/WeighingRecordController.java | 30 +- .../com/example/webapi/dto/ApiResponse.java | 66 ++- .../com/example/webapi/dto/BasePageDTO.java | 48 +- .../example/webapi/dto/ImageInfoQueryDTO.java | 62 ++- .../webapi/dto/MaterialInfoQueryDTO.java | 40 +- .../example/webapi/dto/SupplierQueryDTO.java | 50 +- .../webapi/dto/SupplyVarietyQueryDTO.java | 40 +- .../webapi/dto/TransferRecordQueryDTO.java | 80 ++- .../webapi/dto/TransportCompanyQueryDTO.java | 30 +- .../webapi/dto/TwiceWeighingQueryDTO.java | 247 +++++++++ .../webapi/dto/VehicleInfoQueryDTO.java | 80 ++- .../webapi/dto/WeighingRecordQueryDTO.java | 140 ++++- .../com/example/webapi/entity/ImageInfo.java | 78 ++- .../example/webapi/entity/MaterialInfo.java | 48 +- .../com/example/webapi/entity/Supplier.java | 58 ++- .../example/webapi/entity/SupplyVariety.java | 48 +- .../example/webapi/entity/TransferRecord.java | 159 +++++- .../webapi/entity/TransportCompany.java | 38 +- .../example/webapi/entity/TwiceWeighing.java | 484 ++++++++++++++++++ .../example/webapi/entity/VehicleInfo.java | 88 +++- .../example/webapi/entity/WeighingRecord.java | 308 +++++++++-- .../interceptor/SignatureInterceptor.java | 43 +- .../repository/TwiceWeighingRepository.java | 48 ++ .../webapi/service/TwiceWeighingService.java | 259 ++++++++++ src/main/resources/application.yml | 7 +- 37 files changed, 2492 insertions(+), 476 deletions(-) create mode 100644 src/main/java/com/example/webapi/controller/TwiceWeighingController.java create mode 100644 src/main/java/com/example/webapi/dto/TwiceWeighingQueryDTO.java create mode 100644 src/main/java/com/example/webapi/entity/TwiceWeighing.java create mode 100644 src/main/java/com/example/webapi/repository/TwiceWeighingRepository.java create mode 100644 src/main/java/com/example/webapi/service/TwiceWeighingService.java diff --git a/pom.xml b/pom.xml index 0de6973..f19e3d7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -96,9 +96,9 @@ - io.springfox - springfox-boot-starter - 3.0.0 + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.2.0 @@ -138,12 +138,12 @@ org.springframework.boot spring-boot-maven-plugin - - - org.projectlombok - lombok - - + + + + + + @@ -182,4 +182,4 @@ - \ No newline at end of file + diff --git a/src/main/java/com/example/webapi/WebApiApplication.java b/src/main/java/com/example/webapi/WebApiApplication.java index e9ba4b9..91b8636 100644 --- a/src/main/java/com/example/webapi/WebApiApplication.java +++ b/src/main/java/com/example/webapi/WebApiApplication.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * SpringBoot WebAPI 应用程序主类 - * + * * @author Your Name * @version 1.0.0 */ @@ -16,7 +16,7 @@ public class WebApiApplication { SpringApplication.run(WebApiApplication.class, args); System.out.println("================================="); System.out.println("WebAPI 应用程序启动成功!"); - System.out.println("访问地址: http://localhost:8080/api"); + System.out.println("访问地址: http://localhost:8806/fuquanapi/swagger-ui/index.html"); System.out.println("================================="); } -} \ No newline at end of file +} diff --git a/src/main/java/com/example/webapi/config/SwaggerConfig.java b/src/main/java/com/example/webapi/config/SwaggerConfig.java index 56fdd62..df4e5a2 100644 --- a/src/main/java/com/example/webapi/config/SwaggerConfig.java +++ b/src/main/java/com/example/webapi/config/SwaggerConfig.java @@ -1,93 +1,18 @@ package com.example.webapi.config; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.builders.RequestParameterBuilder; -import springfox.documentation.schema.ScalarType; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.service.ParameterType; -import springfox.documentation.service.RequestParameter; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import java.util.ArrayList; -import java.util.List; - -/** - * Swagger配置类 - * 配置Swagger3文档,支持详细的请求参数和响应参数说明 - */ @Configuration public class SwaggerConfig { @Bean - public Docket api() { - return new Docket(DocumentationType.OAS_30) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.example.webapi.controller")) - .paths(PathSelectors.any()) - .build() - .globalRequestParameters(getGlobalRequestParameters()) - // 以下设置对展示参数说明和返回值说明很重要 - .useDefaultResponseMessages(false) // 不使用默认的响应消息 - .forCodeGeneration(true) // 为代码生成优化 - .pathMapping("/"); // 设置路径映射 - } - - /** - * API信息配置 - */ - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("福泉WebAPI接口文档") - .description("提供福泉系统的所有接口说明,包括请求参数和响应数据的详细描述") + public OpenAPI customOpenAPI() { + return new OpenAPI() + .info(new Info() + .title("福泉API文档") .version("1.0.0") - .contact(new Contact("开发团队", "http://www.example.com", "dev@example.com")) - .build(); - } - - /** - * 获取全局请求参数 - * 注意:在Swagger UI中这些参数设置为非必需,以便能够正常访问Swagger界面 - * 实际API调用时,这些参数仍然需要通过拦截器进行验证 - */ - private List getGlobalRequestParameters() { - List parameters = new ArrayList<>(); - - // AK (Access Key) - 在Swagger中设为非必需,便于测试 - RequestParameter akParam = new RequestParameterBuilder() - .name("ak") - .description("访问密钥 (Access Key) - 必填") - .in(ParameterType.HEADER.toString()) - .required(false) // 改为false,让Swagger UI可以正常访问 - .query(param -> param.model(model -> model.scalarModel(ScalarType.STRING))) - .build(); - parameters.add(akParam); - - // Timestamp - 在Swagger中设为非必需,便于测试 - RequestParameter timestampParam = new RequestParameterBuilder() - .name("timestamp") - .description("时间戳 (毫秒) - 必填") - .in(ParameterType.HEADER.toString()) - .required(false) // 改为false,让Swagger UI可以正常访问 - .query(param -> param.model(model -> model.scalarModel(ScalarType.STRING))) - .build(); - parameters.add(timestampParam); - - // Signature - 在Swagger中设为非必需,便于测试 - RequestParameter signatureParam = new RequestParameterBuilder() - .name("signature") - .description("签名 (MD5(ak + sk + timestamp)) - 必填") - .in(ParameterType.HEADER.toString()) - .required(false) // 改为false,让Swagger UI可以正常访问 - .query(param -> param.model(model -> model.scalarModel(ScalarType.STRING))) - .build(); - parameters.add(signatureParam); - - return parameters; + .description("福泉项目后端接口文档")); } -} \ No newline at end of file +} 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/controller/SupplyVarietyController.java b/src/main/java/com/example/webapi/controller/SupplyVarietyController.java index 12286a0..fbe8e0e 100644 --- a/src/main/java/com/example/webapi/controller/SupplyVarietyController.java +++ b/src/main/java/com/example/webapi/controller/SupplyVarietyController.java @@ -4,20 +4,18 @@ import com.example.webapi.dto.SupplyVarietyQueryDTO; import com.example.webapi.entity.SupplyVariety; import com.example.webapi.service.SupplyVarietyService; import com.example.webapi.dto.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Api(tags = "供应标识品种信息管理") @Tag(name = "供应标识品种信息管理", description = "提供供应标识品种信息的增删改查接口") @RestController @RequestMapping("/supply-variety") @@ -26,7 +24,7 @@ public class SupplyVarietyController { @Autowired private SupplyVarietyService service; - @ApiOperation(value = "条件查询供应标识品种信息(分页)", notes = "根据提供的查询条件分页查询供应标识品种信息") + @Operation(summary = "条件查询供应标识品种信息(分页)", description = "根据提供的查询条件分页查询供应标识品种信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -35,12 +33,12 @@ public class SupplyVarietyController { }) @PostMapping("/page/conditions") public ApiResponse> pageByConditions( - @ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) + @Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) @RequestBody SupplyVarietyQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation(value = "根据ID查询供应标识品种信息", notes = "根据ID获取单条供应标识品种信息详情") + @Operation(summary = "根据ID查询供应标识品种信息", description = "根据ID获取单条供应标识品种信息详情") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -50,13 +48,13 @@ public class SupplyVarietyController { }) @GetMapping("/{id}") public ApiResponse getById( - @ApiParam(value = "供应标识品种ID", required = true, example = "1") + @Parameter(description = "供应标识品种ID", required = true, example = "1") @PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应标识品种信息")); } - @ApiOperation(value = "新增供应标识品种信息", notes = "创建新的供应标识品种信息") + @Operation(summary = "新增供应标识品种信息", description = "创建新的供应标识品种信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", content = @Content(mediaType = "application/json", @@ -66,12 +64,12 @@ public class SupplyVarietyController { }) @PostMapping public ApiResponse create( - @ApiParam(value = "供应标识品种实体", required = true) + @Parameter(description = "供应标识品种实体", required = true) @RequestBody SupplyVariety entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "更新供应标识品种信息", notes = "根据ID更新供应标识品种信息") + @Operation(summary = "更新供应标识品种信息", description = "根据ID更新供应标识品种信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", content = @Content(mediaType = "application/json", @@ -82,15 +80,15 @@ public class SupplyVarietyController { }) @PutMapping("/{id}") public ApiResponse update( - @ApiParam(value = "供应标识品种ID", required = true, example = "1") + @Parameter(description = "供应标识品种ID", required = true, example = "1") @PathVariable Integer id, - @ApiParam(value = "更新后的供应标识品种实体", required = true) + @Parameter(description = "更新后的供应标识品种实体", required = true) @RequestBody SupplyVariety entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "删除供应标识品种信息", notes = "根据ID删除供应标识品种信息") + @Operation(summary = "删除供应标识品种信息", description = "根据ID删除供应标识品种信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", content = @Content(mediaType = "application/json", @@ -100,7 +98,7 @@ public class SupplyVarietyController { }) @DeleteMapping("/{id}") public ApiResponse delete( - @ApiParam(value = "供应标识品种ID", required = true, example = "1") + @Parameter(description = "供应标识品种ID", required = true, example = "1") @PathVariable Integer id) { service.deleteById(id); return ApiResponse.success(); diff --git a/src/main/java/com/example/webapi/controller/TransferRecordController.java b/src/main/java/com/example/webapi/controller/TransferRecordController.java index 2f99206..7b3d46d 100644 --- a/src/main/java/com/example/webapi/controller/TransferRecordController.java +++ b/src/main/java/com/example/webapi/controller/TransferRecordController.java @@ -4,20 +4,18 @@ import com.example.webapi.dto.TransferRecordQueryDTO; import com.example.webapi.entity.TransferRecord; import com.example.webapi.service.TransferRecordService; import com.example.webapi.dto.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Api(tags = "转运记录管理") @Tag(name = "转运记录管理", description = "提供转运记录的增删改查接口") @RestController @RequestMapping("/transfer-record") @@ -26,7 +24,7 @@ public class TransferRecordController { @Autowired private TransferRecordService service; - @ApiOperation(value = "条件查询转运记录(分页)", notes = "根据提供的查询条件分页查询转运记录") + @Operation(summary = "条件查询转运记录(分页)", description = "根据提供的查询条件分页查询转运记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -35,13 +33,13 @@ public class TransferRecordController { }) @PostMapping("/page/conditions") public ApiResponse> pageByConditions( - @ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) + @Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) @RequestBody TransferRecordQueryDTO queryDTO) { queryDTO.setSortBy("issuedTime"); return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation(value = "根据ID查询转运记录", notes = "根据ID获取单条转运记录详情") + @Operation(summary = "根据ID查询转运记录", description = "根据ID获取单条转运记录详情") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -51,13 +49,13 @@ public class TransferRecordController { }) @GetMapping("/{id}") public ApiResponse getById( - @ApiParam(value = "转运记录ID", required = true, example = "1") + @Parameter(description = "转运记录ID", required = true, example = "1") @PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该转运记录")); } - @ApiOperation(value = "新增转运记录", notes = "创建新的转运记录") + @Operation(summary = "新增转运记录", description = "创建新的转运记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", content = @Content(mediaType = "application/json", @@ -67,12 +65,12 @@ public class TransferRecordController { }) @PostMapping public ApiResponse create( - @ApiParam(value = "转运记录实体", required = true) + @Parameter(description = "转运记录实体", required = true) @RequestBody TransferRecord entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "更新转运记录", notes = "根据ID更新转运记录信息") + @Operation(summary = "更新转运记录", description = "根据ID更新转运记录信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", content = @Content(mediaType = "application/json", @@ -83,15 +81,15 @@ public class TransferRecordController { }) @PutMapping("/{id}") public ApiResponse update( - @ApiParam(value = "转运记录ID", required = true, example = "1") + @Parameter(description = "转运记录ID", required = true, example = "1") @PathVariable Integer id, - @ApiParam(value = "更新后的转运记录实体", required = true) + @Parameter(description = "更新后的转运记录实体", required = true) @RequestBody TransferRecord entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "删除转运记录", notes = "根据ID删除转运记录") + @Operation(summary = "删除转运记录", description = "根据ID删除转运记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", content = @Content(mediaType = "application/json", @@ -101,7 +99,7 @@ public class TransferRecordController { }) @DeleteMapping("/{id}") public ApiResponse delete( - @ApiParam(value = "转运记录ID", required = true, example = "1") + @Parameter(description = "转运记录ID", required = true, example = "1") @PathVariable Integer id) { service.deleteById(id); return ApiResponse.success(); diff --git a/src/main/java/com/example/webapi/controller/TransportCompanyController.java b/src/main/java/com/example/webapi/controller/TransportCompanyController.java index 0f676cb..ed2b310 100644 --- a/src/main/java/com/example/webapi/controller/TransportCompanyController.java +++ b/src/main/java/com/example/webapi/controller/TransportCompanyController.java @@ -4,20 +4,18 @@ import com.example.webapi.dto.TransportCompanyQueryDTO; import com.example.webapi.entity.TransportCompany; import com.example.webapi.service.TransportCompanyService; import com.example.webapi.dto.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Api(tags = "运输公司管理") @Tag(name = "运输公司管理", description = "提供运输公司的增删改查接口") @RestController @RequestMapping("/transport-company") @@ -26,7 +24,7 @@ public class TransportCompanyController { @Autowired private TransportCompanyService service; - @ApiOperation(value = "条件查询运输公司(分页)", notes = "根据提供的查询条件分页查询运输公司") + @Operation(summary = "条件查询运输公司(分页)", description = "根据提供的查询条件分页查询运输公司") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -35,12 +33,12 @@ public class TransportCompanyController { }) @PostMapping("/page/conditions") public ApiResponse> pageByConditions( - @ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) + @Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) @RequestBody TransportCompanyQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation(value = "根据ID查询运输公司", notes = "根据ID获取单条运输公司详情") + @Operation(summary = "根据ID查询运输公司", description = "根据ID获取单条运输公司详情") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -50,13 +48,13 @@ public class TransportCompanyController { }) @GetMapping("/{id}") public ApiResponse getById( - @ApiParam(value = "运输公司ID", required = true, example = "1") + @Parameter(description = "运输公司ID", required = true, example = "1") @PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该运输公司")); } - @ApiOperation(value = "新增运输公司", notes = "创建新的运输公司") + @Operation(summary = "新增运输公司", description = "创建新的运输公司") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", content = @Content(mediaType = "application/json", @@ -66,12 +64,12 @@ public class TransportCompanyController { }) @PostMapping public ApiResponse create( - @ApiParam(value = "运输公司实体", required = true) + @Parameter(description = "运输公司实体", required = true) @RequestBody TransportCompany entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "更新运输公司", notes = "根据ID更新运输公司信息") + @Operation(summary = "更新运输公司", description = "根据ID更新运输公司信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", content = @Content(mediaType = "application/json", @@ -82,15 +80,15 @@ public class TransportCompanyController { }) @PutMapping("/{id}") public ApiResponse update( - @ApiParam(value = "运输公司ID", required = true, example = "1") + @Parameter(description = "运输公司ID", required = true, example = "1") @PathVariable Integer id, - @ApiParam(value = "更新后的运输公司实体", required = true) + @Parameter(description = "更新后的运输公司实体", required = true) @RequestBody TransportCompany entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "删除运输公司", notes = "根据ID删除运输公司") + @Operation(summary = "删除运输公司", description = "根据ID删除运输公司") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", content = @Content(mediaType = "application/json", @@ -100,7 +98,7 @@ public class TransportCompanyController { }) @DeleteMapping("/{id}") public ApiResponse delete( - @ApiParam(value = "运输公司ID", required = true, example = "1") + @Parameter(description = "运输公司ID", required = true, example = "1") @PathVariable Integer id) { service.deleteById(id); return ApiResponse.success(); diff --git a/src/main/java/com/example/webapi/controller/TwiceWeighingController.java b/src/main/java/com/example/webapi/controller/TwiceWeighingController.java new file mode 100644 index 0000000..3f4904b --- /dev/null +++ b/src/main/java/com/example/webapi/controller/TwiceWeighingController.java @@ -0,0 +1,81 @@ +package com.example.webapi.controller; + +import com.example.webapi.dto.TwiceWeighingQueryDTO; +import com.example.webapi.entity.TwiceWeighing; +import com.example.webapi.service.TwiceWeighingService; +import com.example.webapi.dto.ApiResponse; +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.web.bind.annotation.*; + +import java.util.Optional; + +@Tag(name = "二次称重记录管理") +@RestController +@RequestMapping("/twice-weighing") +public class TwiceWeighingController { + + @Autowired + private TwiceWeighingService service; + + @Operation(summary = "条件查询二次称重记录(分页)") + @PostMapping("/page/conditions") + public ApiResponse> pageByConditions(@RequestBody TwiceWeighingQueryDTO queryDTO) { + return ApiResponse.success(service.findByConditions(queryDTO)); + } + + @Operation(summary = "根据ID查询二次称重记录") + @GetMapping("/{id}") + public ApiResponse getById(@PathVariable String id) { + Optional result = service.findById(id); + return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该二次称重记录")); + } + + @Operation(summary = "新增二次称重记录") + @PostMapping + public ApiResponse create(@RequestBody TwiceWeighing entity) { + return ApiResponse.success(service.save(entity)); + } + + @Operation(summary = "更新二次称重记录") + @PutMapping("/{id}") + public ApiResponse update(@PathVariable String id, @RequestBody TwiceWeighing entity) { + entity.setId(id); + return ApiResponse.success(service.save(entity)); + } + + @Operation(summary = "删除二次称重记录") + @DeleteMapping("/{id}") + public ApiResponse delete(@PathVariable String id) { + service.deleteById(id); + return ApiResponse.success(); + } + + @Operation(summary = "根据车号查询二次称重记录") + @GetMapping("/vehicle/{vehicleId}") + public ApiResponse getByVehicleId(@PathVariable String vehicleId) { + TwiceWeighing result = service.findByVehicleId(vehicleId); + return result != null ? ApiResponse.success(result) : ApiResponse.error("未找到该车号的记录"); + } + + @Operation(summary = "根据打印编号查询二次称重记录") + @GetMapping("/print/{printId}") + public ApiResponse getByPrintId(@PathVariable String printId) { + TwiceWeighing result = service.findByPrintId(printId); + return result != null ? ApiResponse.success(result) : ApiResponse.error("未找到该打印编号的记录"); + } + + @Operation(summary = "获取上传记录数量") + @GetMapping("/count/upload/{uploadFlag}") + public ApiResponse countByUploadFlag(@PathVariable Boolean uploadFlag) { + return ApiResponse.success(service.countByUploadFlag(uploadFlag)); + } + + @Operation(summary = "获取作废记录数量") + @GetMapping("/count/useless/{uselessFlag}") + public ApiResponse countByUselessFlag(@PathVariable Boolean uselessFlag) { + return ApiResponse.success(service.countByUselessFlag(uselessFlag)); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/webapi/controller/VehicleInfoController.java b/src/main/java/com/example/webapi/controller/VehicleInfoController.java index 9c40e80..15b8d85 100644 --- a/src/main/java/com/example/webapi/controller/VehicleInfoController.java +++ b/src/main/java/com/example/webapi/controller/VehicleInfoController.java @@ -4,9 +4,9 @@ import com.example.webapi.dto.VehicleInfoQueryDTO; import com.example.webapi.entity.VehicleInfo; import com.example.webapi.service.VehicleInfoService; import com.example.webapi.dto.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; @@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Api(tags = "车辆信息管理") @Tag(name = "车辆信息管理", description = "提供车辆信息的增删改查接口") @RestController @RequestMapping("/vehicle-info") @@ -26,7 +25,7 @@ public class VehicleInfoController { @Autowired private VehicleInfoService service; - @ApiOperation(value = "条件查询车辆信息(分页)", notes = "根据提供的查询条件分页查询车辆信息") + @Operation(summary = "条件查询车辆信息(分页)", description = "根据提供的查询条件分页查询车辆信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -35,12 +34,12 @@ public class VehicleInfoController { }) @PostMapping("/page/conditions") public ApiResponse> pageByConditions( - @ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) + @Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) @RequestBody VehicleInfoQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation(value = "根据ID查询车辆信息", notes = "根据ID获取单条车辆信息详情") + @Operation(summary = "根据ID查询车辆信息", description = "根据ID获取单条车辆信息详情") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -50,13 +49,13 @@ public class VehicleInfoController { }) @GetMapping("/{id}") public ApiResponse getById( - @ApiParam(value = "车辆ID", required = true, example = "1") + @Parameter(description = "车辆ID", required = true, example = "1") @PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该车辆信息")); } - @ApiOperation(value = "新增车辆信息", notes = "创建新的车辆信息") + @Operation(summary = "新增车辆信息", description = "创建新的车辆信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", content = @Content(mediaType = "application/json", @@ -66,12 +65,12 @@ public class VehicleInfoController { }) @PostMapping public ApiResponse create( - @ApiParam(value = "车辆信息实体", required = true) + @Parameter(description = "车辆信息实体", required = true) @RequestBody VehicleInfo entity) { return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "更新车辆信息", notes = "根据ID更新车辆信息") + @Operation(summary = "更新车辆信息", description = "根据ID更新车辆信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", content = @Content(mediaType = "application/json", @@ -82,15 +81,15 @@ public class VehicleInfoController { }) @PutMapping("/{id}") public ApiResponse update( - @ApiParam(value = "车辆ID", required = true, example = "1") + @Parameter(description = "车辆ID", required = true, example = "1") @PathVariable Integer id, - @ApiParam(value = "更新后的车辆信息实体", required = true) + @Parameter(description = "更新后的车辆信息实体", required = true) @RequestBody VehicleInfo entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "删除车辆信息", notes = "根据ID删除车辆信息") + @Operation(summary = "删除车辆信息", description = "根据ID删除车辆信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", content = @Content(mediaType = "application/json", @@ -100,7 +99,7 @@ public class VehicleInfoController { }) @DeleteMapping("/{id}") public ApiResponse delete( - @ApiParam(value = "车辆ID", required = true, example = "1") + @Parameter(description = "车辆ID", required = true, example = "1") @PathVariable Integer id) { service.deleteById(id); return ApiResponse.success(); diff --git a/src/main/java/com/example/webapi/controller/WeighingRecordController.java b/src/main/java/com/example/webapi/controller/WeighingRecordController.java index f018e32..f40862b 100644 --- a/src/main/java/com/example/webapi/controller/WeighingRecordController.java +++ b/src/main/java/com/example/webapi/controller/WeighingRecordController.java @@ -6,20 +6,18 @@ import com.example.webapi.entity.WeighingRecord; import com.example.webapi.service.TransferRecordService; import com.example.webapi.service.WeighingRecordService; import com.example.webapi.dto.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.Optional; -@Api(tags = "称重记录管理") @Tag(name = "称重记录管理", description = "提供称重记录的增删改查接口") @RestController @RequestMapping("/weighing-record") @@ -31,7 +29,7 @@ public class WeighingRecordController { @Autowired private TransferRecordService transferRecordService; - @ApiOperation(value = "条件查询称重记录(分页)", notes = "根据提供的查询条件分页查询称重记录") + @Operation(summary = "条件查询称重记录(分页)", description = "根据提供的查询条件分页查询称重记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -40,12 +38,12 @@ public class WeighingRecordController { }) @PostMapping("/page/conditions") public ApiResponse> pageByConditions( - @ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) + @Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) @RequestBody WeighingRecordQueryDTO queryDTO) { return ApiResponse.success(service.findByConditions(queryDTO)); } - @ApiOperation(value = "根据ID查询称重记录", notes = "根据ID获取单条称重记录详情") + @Operation(summary = "根据ID查询称重记录", description = "根据ID获取单条称重记录详情") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", content = @Content(mediaType = "application/json", @@ -55,14 +53,14 @@ public class WeighingRecordController { }) @GetMapping("/{id}") public ApiResponse getById( - @ApiParam(value = "称重记录ID", required = true, example = "1") + @Parameter(description = "称重记录ID", required = true, example = "1") @PathVariable Integer id) { Optional result = service.findById(id); return result.map(ApiResponse::success) .orElseGet(() -> ApiResponse.error("未找到该称重记录")); } - @ApiOperation(value = "新增称重记录", notes = "创建新的称重记录") + @Operation(summary = "新增称重记录", description = "创建新的称重记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", content = @Content(mediaType = "application/json", @@ -72,7 +70,7 @@ public class WeighingRecordController { }) @PostMapping public ApiResponse create( - @ApiParam(value = "称重记录实体", required = true) + @Parameter(description = "称重记录实体", required = true) @RequestBody WeighingRecord entity) { WeighingRecord weighingRecord= service.save(entity); if(weighingRecord.getMaterielId()!=null){ @@ -88,7 +86,7 @@ public class WeighingRecordController { } - @ApiOperation(value = "更新称重记录", notes = "根据ID更新称重记录信息") + @Operation(summary = "更新称重记录", description = "根据ID更新称重记录信息") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", content = @Content(mediaType = "application/json", @@ -99,15 +97,15 @@ public class WeighingRecordController { }) @PutMapping("/{id}") public ApiResponse update( - @ApiParam(value = "称重记录ID", required = true, example = "1") + @Parameter(description = "称重记录ID", required = true, example = "1") @PathVariable Integer id, - @ApiParam(value = "更新后的称重记录实体", required = true) + @Parameter(description = "更新后的称重记录实体", required = true) @RequestBody WeighingRecord entity) { entity.setId(id); return ApiResponse.success(service.save(entity)); } - @ApiOperation(value = "删除称重记录", notes = "根据ID删除称重记录") + @Operation(summary = "删除称重记录", description = "根据ID删除称重记录") @ApiResponses(value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", content = @Content(mediaType = "application/json", @@ -117,7 +115,7 @@ public class WeighingRecordController { }) @DeleteMapping("/{id}") public ApiResponse delete( - @ApiParam(value = "称重记录ID", required = true, example = "1") + @Parameter(description = "称重记录ID", required = true, example = "1") @PathVariable Integer id) { service.deleteById(id); return ApiResponse.success(); 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/TwiceWeighingQueryDTO.java b/src/main/java/com/example/webapi/dto/TwiceWeighingQueryDTO.java new file mode 100644 index 0000000..ab7651c --- /dev/null +++ b/src/main/java/com/example/webapi/dto/TwiceWeighingQueryDTO.java @@ -0,0 +1,247 @@ +package com.example.webapi.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 二次称重记录查询条件DTO + * + * @author Your Name + * @version 1.0.0 + */ +@Schema(description = "二次称重记录查询条件数据传输对象") +public class TwiceWeighingQueryDTO extends BasePageDTO { + + // 基础查询条件(支持模糊查询) + @Schema(description = "车号", example = "京A12345") + private String vehicleId; + + @Schema(description = "车型", example = "货车") + private String vehicleType; + + @Schema(description = "货物", example = "煤炭") + private String goods; + + @Schema(description = "收货单位", example = "福泉电厂") + private String receiveUnit; + + @Schema(description = "发货单位", example = "福泉煤矿") + private String sendUnit; + + @Schema(description = "发货站", example = "福泉站") + private String sendStation; + + @Schema(description = "到站", example = "电厂站") + private String theStation; + + @Schema(description = "炉号", example = "F001") + private String furnaceNumber; + + @Schema(description = "铁号", example = "I001") + private String ironNumber; + + @Schema(description = "方向", example = "进厂") + private String direction; + + @Schema(description = "毛重操作员ID", example = "OP001") + private String grossOpId; + + @Schema(description = "皮重操作员ID", example = "OP002") + private String tareOpId; + + @Schema(description = "打印编号", example = "PRINT001") + private String printId; + + @Schema(description = "备注", example = "正常称重") + private String demo; + + // 精确匹配查询 + @Schema(description = "物资ID", example = "1") + private Integer materialsId; + + @Schema(description = "供应商ID", example = "1") + private Integer supplierId; + + @Schema(description = "上传标志", example = "false") + private Boolean uploadFlag; + + @Schema(description = "作废标志", example = "false") + private Boolean uselessFlag; + + @Schema(description = "皮重模式", example = "手动") + private String tareModel; + + @Schema(description = "毛重衡器ID", example = "GS001") + private String grossScaleId; + + @Schema(description = "皮重衡器ID", example = "TS001") + private String tareScaleId; + + // Getter and Setter methods + public String getVehicleId() { + return vehicleId; + } + + public void setVehicleId(String vehicleId) { + this.vehicleId = vehicleId; + } + + public String getVehicleType() { + return vehicleType; + } + + public void setVehicleType(String vehicleType) { + this.vehicleType = vehicleType; + } + + public String getGoods() { + return goods; + } + + public void setGoods(String goods) { + this.goods = goods; + } + + public String getReceiveUnit() { + return receiveUnit; + } + + public void setReceiveUnit(String receiveUnit) { + this.receiveUnit = receiveUnit; + } + + public String getSendUnit() { + return sendUnit; + } + + public void setSendUnit(String sendUnit) { + this.sendUnit = sendUnit; + } + + public String getSendStation() { + return sendStation; + } + + public void setSendStation(String sendStation) { + this.sendStation = sendStation; + } + + public String getTheStation() { + return theStation; + } + + public void setTheStation(String theStation) { + this.theStation = theStation; + } + + public String getFurnaceNumber() { + return furnaceNumber; + } + + public void setFurnaceNumber(String furnaceNumber) { + this.furnaceNumber = furnaceNumber; + } + + public String getIronNumber() { + return ironNumber; + } + + public void setIronNumber(String ironNumber) { + this.ironNumber = ironNumber; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getGrossOpId() { + return grossOpId; + } + + public void setGrossOpId(String grossOpId) { + this.grossOpId = grossOpId; + } + + public String getTareOpId() { + return tareOpId; + } + + public void setTareOpId(String tareOpId) { + this.tareOpId = tareOpId; + } + + public String getPrintId() { + return printId; + } + + public void setPrintId(String printId) { + this.printId = printId; + } + + public String getDemo() { + return demo; + } + + public void setDemo(String demo) { + this.demo = demo; + } + + public Integer getMaterialsId() { + return materialsId; + } + + public void setMaterialsId(Integer materialsId) { + this.materialsId = materialsId; + } + + public Integer getSupplierId() { + return supplierId; + } + + public void setSupplierId(Integer supplierId) { + this.supplierId = supplierId; + } + + public Boolean getUploadFlag() { + return uploadFlag; + } + + public void setUploadFlag(Boolean uploadFlag) { + this.uploadFlag = uploadFlag; + } + + public Boolean getUselessFlag() { + return uselessFlag; + } + + public void setUselessFlag(Boolean uselessFlag) { + this.uselessFlag = uselessFlag; + } + + public String getTareModel() { + return tareModel; + } + + public void setTareModel(String tareModel) { + this.tareModel = tareModel; + } + + public String getGrossScaleId() { + return grossScaleId; + } + + public void setGrossScaleId(String grossScaleId) { + this.grossScaleId = grossScaleId; + } + + public String getTareScaleId() { + return tareScaleId; + } + + public void setTareScaleId(String tareScaleId) { + this.tareScaleId = tareScaleId; + } +} \ 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 31b9f45..2b49e88 100644 --- a/src/main/java/com/example/webapi/entity/ImageInfo.java +++ b/src/main/java/com/example/webapi/entity/ImageInfo.java @@ -1,45 +1,99 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Entity; import jakarta.persistence.*; -import lombok.Data; 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/MaterialInfo.java b/src/main/java/com/example/webapi/entity/MaterialInfo.java index f4d802f..014b312 100644 --- a/src/main/java/com/example/webapi/entity/MaterialInfo.java +++ b/src/main/java/com/example/webapi/entity/MaterialInfo.java @@ -1,30 +1,60 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.*; -@Data @Entity @Table(name = "品种信息表") -@ApiModel(description = "品种信息实体") +@Schema(description = "品种信息实体") public class MaterialInfo { @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 = 30, nullable = false) - @ApiModelProperty(value = "品种编码", example = "M001", required = true) + @Schema(description = "品种编码", example = "M001", required = true) private String code; @Column(name = "Name", length = 50, nullable = false) - @ApiModelProperty(value = "品种名称", example = "钢材", required = true) + @Schema(description = "品种名称", example = "钢材", required = true) private String name; @Column(name = "Activate", nullable = false) - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @Schema(description = "激活状态", example = "true") private Boolean activate; + + // 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 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/entity/Supplier.java b/src/main/java/com/example/webapi/entity/Supplier.java index afa96d1..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 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/SupplyVariety.java b/src/main/java/com/example/webapi/entity/SupplyVariety.java index bc59cd5..7f87730 100644 --- a/src/main/java/com/example/webapi/entity/SupplyVariety.java +++ b/src/main/java/com/example/webapi/entity/SupplyVariety.java @@ -1,30 +1,60 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.*; -@Data @Entity @Table(name = "供应标识品种信息") -@ApiModel(description = "供应标识品种信息实体") +@Schema(description = "供应标识品种信息实体") public class SupplyVariety { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") + @Schema(description = "记录ID", example = "1") private Integer id; @Column(name = "SupplyID", nullable = false) - @ApiModelProperty(value = "供应商ID", example = "1", required = true, notes = "关联供应商信息") + @Schema(description = "供应商ID", example = "1", required = true) private Integer supplyId; @Column(name = "Good", nullable = false) - @ApiModelProperty(value = "品种ID", example = "1", required = true, notes = "关联品种信息") + @Schema(description = "品种ID", example = "1", required = true) private Integer good; @Column(name = "Active") - @ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") + @Schema(description = "激活状态", example = "true") private Boolean active; + + // Getter and Setter methods + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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/entity/TransferRecord.java b/src/main/java/com/example/webapi/entity/TransferRecord.java index 6dd0aff..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 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/entity/TransportCompany.java b/src/main/java/com/example/webapi/entity/TransportCompany.java index a1e0287..f86ffb4 100644 --- a/src/main/java/com/example/webapi/entity/TransportCompany.java +++ b/src/main/java/com/example/webapi/entity/TransportCompany.java @@ -1,26 +1,48 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.*; -@Data @Entity @Table(name = "运输公司") -@ApiModel(description = "运输公司实体") +@Schema(description = "运输公司实体") public class TransportCompany { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "编号") - @ApiModelProperty(value = "公司ID", example = "1", notes = "主键,自动生成") + @Schema(description = "公司ID", example = "1") private Integer id; @Column(name = "公司名称", length = 100) - @ApiModelProperty(value = "公司名称", example = "福泉物流") + @Schema(description = "公司名称", example = "福泉物流") private String name; @Column(name = "备注", 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 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/entity/TwiceWeighing.java b/src/main/java/com/example/webapi/entity/TwiceWeighing.java new file mode 100644 index 0000000..ca20cc8 --- /dev/null +++ b/src/main/java/com/example/webapi/entity/TwiceWeighing.java @@ -0,0 +1,484 @@ +package com.example.webapi.entity; + +import jakarta.persistence.*; +import java.math.BigDecimal; +import java.util.Date; + +@Entity +@Table(name = "TB_TWICEWEIGHING") +public class TwiceWeighing { + @Id + @Column(name = "ID", length = 22, nullable = false) + private String id; + + @Column(name = "VEHICLETYPE", length = 10) + private String vehicleType; + + @Column(name = "VEHICLEID", length = 10) + private String vehicleId; + + @Column(name = "GROSS", precision = 18, scale = 3) + private BigDecimal gross; + + @Column(name = "TARE", precision = 18, scale = 3) + private BigDecimal tare; + + @Column(name = "NET", precision = 18, scale = 3) + private BigDecimal net; + + @Column(name = "STANDARD", precision = 18, scale = 3) + private BigDecimal standard; + + @Column(name = "MAXWEIGHT", precision = 18, scale = 3) + private BigDecimal maxWeight; + + @Column(name = "OTHERNET", precision = 18, scale = 3) + private BigDecimal otherNet; + + @Column(name = "GROSSTIME") + private Date grossTime; + + @Column(name = "TARETIME") + private Date tareTime; + + @Column(name = "NETTIME") + private Date netTime; + + @Column(name = "WINTERVAL") + private Integer winterval; + + @Column(name = "GROSSNODEID", length = 22) + private String grossNodeId; + + @Column(name = "TARENODEID", length = 22) + private String tareNodeId; + + @Column(name = "GROSSSCALEID", length = 10) + private String grossScaleId; + + @Column(name = "TARESCALEID", length = 10) + private String tareScaleId; + + @Column(name = "GROSSOPID", length = 10) + private String grossOpId; + + @Column(name = "TAREOPID", length = 10) + private String tareOpId; + + @Column(name = "TAREMODEL", length = 10) + private String tareModel; + + @Column(name = "UPLOADFLAG") + private Boolean uploadFlag; + + @Column(name = "USELESSFLAG") + private Boolean uselessFlag; + + @Column(name = "PRINTCOUNT") + private Integer printCount; + + @Column(name = "PRINTID", length = 30) + private String printId; + + @Column(name = "DEMO", length = 50) + private String demo; + + @Column(name = "MATERIALSID") + private Integer materialsId; + + @Column(name = "SUPPLIERID") + private Integer supplierId; + + @Column(name = "LOSSPATH") + private Float lossPath; + + @Column(name = "WINWEIGHT") + private Float winWeight; + + @Column(name = "LOSSWEIHGT") + private Float lossWeight; + + @Column(name = "GROSSSPEED") + private Float grossSpeed; + + @Column(name = "TARESPEED") + private Float tareSpeed; + + @Column(name = "GROSSLISTID", length = 20) + private String grossListId; + + @Column(name = "TARELISTID", length = 20) + private String tareListId; + + @Column(name = "DELWEIGHT") + private Float delWeight; + + @Column(name = "GOODS", length = 50) + private String goods; + + @Column(name = "RECEIVEUNIT", length = 50) + private String receiveUnit; + + @Column(name = "SENDUNIT", length = 50) + private String sendUnit; + + @Column(name = "SENDSTSTION", length = 50) + private String sendStation; + + @Column(name = "THESTATION", length = 50) + private String theStation; + + @Column(name = "FURNACENUMBER", length = 50) + private String furnaceNumber; + + @Column(name = "IRONNUMBER", length = 50) + private String ironNumber; + + @Column(name = "DIRECTION", length = 50) + private String direction; + + // Getter and Setter methods + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVehicleType() { + return vehicleType; + } + + public void setVehicleType(String vehicleType) { + this.vehicleType = vehicleType; + } + + public String getVehicleId() { + return vehicleId; + } + + public void setVehicleId(String vehicleId) { + this.vehicleId = vehicleId; + } + + public BigDecimal getGross() { + return gross; + } + + public void setGross(BigDecimal gross) { + this.gross = gross; + } + + public BigDecimal getTare() { + return tare; + } + + public void setTare(BigDecimal tare) { + this.tare = tare; + } + + public BigDecimal getNet() { + return net; + } + + public void setNet(BigDecimal net) { + this.net = net; + } + + public BigDecimal getStandard() { + return standard; + } + + public void setStandard(BigDecimal standard) { + this.standard = standard; + } + + public BigDecimal getMaxWeight() { + return maxWeight; + } + + public void setMaxWeight(BigDecimal maxWeight) { + this.maxWeight = maxWeight; + } + + public BigDecimal getOtherNet() { + return otherNet; + } + + public void setOtherNet(BigDecimal otherNet) { + this.otherNet = otherNet; + } + + public Date getGrossTime() { + return grossTime; + } + + public void setGrossTime(Date grossTime) { + this.grossTime = grossTime; + } + + public Date getTareTime() { + return tareTime; + } + + public void setTareTime(Date tareTime) { + this.tareTime = tareTime; + } + + public Date getNetTime() { + return netTime; + } + + public void setNetTime(Date netTime) { + this.netTime = netTime; + } + + public Integer getWinterval() { + return winterval; + } + + public void setWinterval(Integer winterval) { + this.winterval = winterval; + } + + public String getGrossNodeId() { + return grossNodeId; + } + + public void setGrossNodeId(String grossNodeId) { + this.grossNodeId = grossNodeId; + } + + public String getTareNodeId() { + return tareNodeId; + } + + public void setTareNodeId(String tareNodeId) { + this.tareNodeId = tareNodeId; + } + + public String getGrossScaleId() { + return grossScaleId; + } + + public void setGrossScaleId(String grossScaleId) { + this.grossScaleId = grossScaleId; + } + + public String getTareScaleId() { + return tareScaleId; + } + + public void setTareScaleId(String tareScaleId) { + this.tareScaleId = tareScaleId; + } + + public String getGrossOpId() { + return grossOpId; + } + + public void setGrossOpId(String grossOpId) { + this.grossOpId = grossOpId; + } + + public String getTareOpId() { + return tareOpId; + } + + public void setTareOpId(String tareOpId) { + this.tareOpId = tareOpId; + } + + public String getTareModel() { + return tareModel; + } + + public void setTareModel(String tareModel) { + this.tareModel = tareModel; + } + + public Boolean getUploadFlag() { + return uploadFlag; + } + + public void setUploadFlag(Boolean uploadFlag) { + this.uploadFlag = uploadFlag; + } + + public Boolean getUselessFlag() { + return uselessFlag; + } + + public void setUselessFlag(Boolean uselessFlag) { + this.uselessFlag = uselessFlag; + } + + public Integer getPrintCount() { + return printCount; + } + + public void setPrintCount(Integer printCount) { + this.printCount = printCount; + } + + public String getPrintId() { + return printId; + } + + public void setPrintId(String printId) { + this.printId = printId; + } + + public String getDemo() { + return demo; + } + + public void setDemo(String demo) { + this.demo = demo; + } + + public Integer getMaterialsId() { + return materialsId; + } + + public void setMaterialsId(Integer materialsId) { + this.materialsId = materialsId; + } + + public Integer getSupplierId() { + return supplierId; + } + + public void setSupplierId(Integer supplierId) { + this.supplierId = supplierId; + } + + public Float getLossPath() { + return lossPath; + } + + public void setLossPath(Float lossPath) { + this.lossPath = lossPath; + } + + public Float getWinWeight() { + return winWeight; + } + + public void setWinWeight(Float winWeight) { + this.winWeight = winWeight; + } + + public Float getLossWeight() { + return lossWeight; + } + + public void setLossWeight(Float lossWeight) { + this.lossWeight = lossWeight; + } + + public Float getGrossSpeed() { + return grossSpeed; + } + + public void setGrossSpeed(Float grossSpeed) { + this.grossSpeed = grossSpeed; + } + + public Float getTareSpeed() { + return tareSpeed; + } + + public void setTareSpeed(Float tareSpeed) { + this.tareSpeed = tareSpeed; + } + + public String getGrossListId() { + return grossListId; + } + + public void setGrossListId(String grossListId) { + this.grossListId = grossListId; + } + + public String getTareListId() { + return tareListId; + } + + public void setTareListId(String tareListId) { + this.tareListId = tareListId; + } + + public Float getDelWeight() { + return delWeight; + } + + public void setDelWeight(Float delWeight) { + this.delWeight = delWeight; + } + + public String getGoods() { + return goods; + } + + public void setGoods(String goods) { + this.goods = goods; + } + + public String getReceiveUnit() { + return receiveUnit; + } + + public void setReceiveUnit(String receiveUnit) { + this.receiveUnit = receiveUnit; + } + + public String getSendUnit() { + return sendUnit; + } + + public void setSendUnit(String sendUnit) { + this.sendUnit = sendUnit; + } + + public String getSendStation() { + return sendStation; + } + + public void setSendStation(String sendStation) { + this.sendStation = sendStation; + } + + public String getTheStation() { + return theStation; + } + + public void setTheStation(String theStation) { + this.theStation = theStation; + } + + public String getFurnaceNumber() { + return furnaceNumber; + } + + public void setFurnaceNumber(String furnaceNumber) { + this.furnaceNumber = furnaceNumber; + } + + public String getIronNumber() { + return ironNumber; + } + + public void setIronNumber(String ironNumber) { + this.ironNumber = ironNumber; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } +} \ No newline at end of file diff --git a/src/main/java/com/example/webapi/entity/VehicleInfo.java b/src/main/java/com/example/webapi/entity/VehicleInfo.java index e76f4a1..096a525 100644 --- a/src/main/java/com/example/webapi/entity/VehicleInfo.java +++ b/src/main/java/com/example/webapi/entity/VehicleInfo.java @@ -1,46 +1,108 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.*; -@Data @Entity @Table(name = "车辆信息") -@ApiModel(description = "车辆信息实体") +@Schema(description = "车辆信息实体") public class VehicleInfo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") - @ApiModelProperty(value = "车辆ID", example = "1", notes = "主键,自动生成") + @Schema(description = "车辆ID", example = "1") private Integer id; @Column(name = "LicensePlate", nullable = false, length = 20) - @ApiModelProperty(value = "车牌号", example = "京A12345", required = true) + @Schema(description = "车牌号", example = "京A12345", required = true) private String licensePlate; @Column(name = "Type", length = 20) - @ApiModelProperty(value = "车辆类型", example = "货车") + @Schema(description = "车辆类型", example = "货车") private String type; @Column(name = "Outage") - @ApiModelProperty(value = "停用状态", example = "false", notes = "true=已停用,false=未停用") + @Schema(description = "停用状态", example = "false") private Boolean outage; @Column(name = "Lock") - @ApiModelProperty(value = "锁定状态", example = "false", notes = "true=已锁定,false=未锁定") + @Schema(description = "锁定状态", example = "false") private Boolean lock; @Column(name = "TransCompany") - @ApiModelProperty(value = "运输公司ID", example = "1", notes = "关联运输公司信息") + @Schema(description = "运输公司ID", example = "1") private Integer transCompany; @Column(name = "Reviewed") - @ApiModelProperty(value = "审核状态", example = "true", notes = "true=已审核,false=未审核") + @Schema(description = "审核状态", example = "true") private Boolean reviewed; @Column(name = "Remarks", length = 1000) - @ApiModelProperty(value = "备注", example = "新购车辆") + @Schema(description = "备注", example = "新购车辆") private String remarks; + + // Getter and Setter methods + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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/entity/WeighingRecord.java b/src/main/java/com/example/webapi/entity/WeighingRecord.java index 44439e9..07f7a8a 100644 --- a/src/main/java/com/example/webapi/entity/WeighingRecord.java +++ b/src/main/java/com/example/webapi/entity/WeighingRecord.java @@ -1,136 +1,374 @@ package com.example.webapi.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +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 WeighingRecord { @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 = "Warehouse_ID") - @ApiModelProperty(value = "仓库ID", example = "1", notes = "关联仓库信息") + @Schema(description = "仓库ID", example = "1") private Integer warehouseId; @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 = "Vehicle_ID") - @ApiModelProperty(value = "车辆ID", example = "1", notes = "关联车辆信息") + @Schema(description = "车辆ID", example = "1") private Integer vehicleId; @Column(name = "Bill_NO", length = 50, nullable = false) - @ApiModelProperty(value = "单据号", example = "BL20230501001", required = true) + @Schema(description = "单据号", example = "BL20230501001", 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 = "RFID_NO", length = 30) - @ApiModelProperty(value = "RFID号", example = "RF0001") + @Schema(description = "RFID号", example = "RF0001") private String rfidNo; @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_Machine_NO", length = 50) - @ApiModelProperty(value = "开单机器编号", example = "M001") + @Schema(description = "开单机器编号", example = "M001") private String issuedMachineNo; @Column(name = "Issued_By", length = 20) - @ApiModelProperty(value = "开单人", example = "张三") + @Schema(description = "开单人", example = "张三") private String issuedBy; @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 = "GW_Scale_NO", length = 50) - @ApiModelProperty(value = "毛重秤编号", example = "S001") + @Schema(description = "毛重秤编号", example = "S001") private String gwScaleNo; @Column(name = "GW_Time") - @ApiModelProperty(value = "毛重时间", example = "2023-05-01 10:30:00") + @Schema(description = "毛重时间", example = "2023-05-01 10:30:00") private Date gwTime; @Column(name = "GW_By", length = 20) - @ApiModelProperty(value = "毛重操作人", example = "李四") + @Schema(description = "毛重操作人", example = "李四") private String gwBy; @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_Scale_NO", length = 50) - @ApiModelProperty(value = "皮重秤编号", example = "S002") + @Schema(description = "皮重秤编号", example = "S002") private String tScaleNo; @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 = "T_By", length = 20) - @ApiModelProperty(value = "皮重操作人", example = "王五") + @Schema(description = "皮重操作人", example = "王五") private String tBy; @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 = "Operate_Time") - @ApiModelProperty(value = "操作时间", example = "2023-05-01 11:30:00") + @Schema(description = "操作时间", example = "2023-05-01 11:30:00") private Date operateTime; @Column(name = "Arrival_Time") - @ApiModelProperty(value = "到达时间", example = "2023-05-01 09:30:00") + @Schema(description = "到达时间", example = "2023-05-01 09:30:00") private Date arrivalTime; @Column(name = "Leave_Time") - @ApiModelProperty(value = "离开时间", example = "2023-05-01 12:00:00") + @Schema(description = "离开时间", example = "2023-05-01 12:00:00") private Date leaveTime; @Column(name = "Pic01") - @ApiModelProperty(value = "图片1ID", example = "101") + @Schema(description = "图片1ID", example = "101") private Integer pic01; @Column(name = "Pic02") - @ApiModelProperty(value = "图片2ID", example = "102") + @Schema(description = "图片2ID", example = "102") private Integer pic02; @Column(name = "WTId") - @ApiModelProperty(value = "称重类型ID", example = "1") + @Schema(description = "称重类型ID", example = "1") private Integer wtId; + + // 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 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 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 getRfidNo() { + return rfidNo; + } + + public void setRfidNo(String rfidNo) { + this.rfidNo = rfidNo; + } + + public String getVehicleNo() { + return vehicleNo; + } + + public void setVehicleNo(String vehicleNo) { + this.vehicleNo = vehicleNo; + } + + public String getIssuedMachineNo() { + return issuedMachineNo; + } + + public void setIssuedMachineNo(String issuedMachineNo) { + this.issuedMachineNo = issuedMachineNo; + } + + public String getIssuedBy() { + return issuedBy; + } + + public void setIssuedBy(String issuedBy) { + this.issuedBy = issuedBy; + } + + 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 String getGwScaleNo() { + return gwScaleNo; + } + + public void setGwScaleNo(String gwScaleNo) { + this.gwScaleNo = gwScaleNo; + } + + public Date getGwTime() { + return gwTime; + } + + public void setGwTime(Date gwTime) { + this.gwTime = gwTime; + } + + public String getGwBy() { + return gwBy; + } + + public void setGwBy(String gwBy) { + this.gwBy = gwBy; + } + + public BigDecimal getT() { + return t; + } + + public void setT(BigDecimal t) { + this.t = t; + } + + public String getTScaleNo() { + return tScaleNo; + } + + public void setTScaleNo(String tScaleNo) { + this.tScaleNo = tScaleNo; + } + + public Date getTTime() { + return tTime; + } + + public void setTTime(Date tTime) { + this.tTime = tTime; + } + + public String getTBy() { + return tBy; + } + + public void setTBy(String tBy) { + this.tBy = tBy; + } + + 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 Date getOperateTime() { + return operateTime; + } + + public void setOperateTime(Date operateTime) { + this.operateTime = operateTime; + } + + public Date getArrivalTime() { + return arrivalTime; + } + + public void setArrivalTime(Date arrivalTime) { + this.arrivalTime = arrivalTime; + } + + public Date getLeaveTime() { + return leaveTime; + } + + public void setLeaveTime(Date leaveTime) { + this.leaveTime = leaveTime; + } + + public Integer getPic01() { + return pic01; + } + + public void setPic01(Integer pic01) { + this.pic01 = pic01; + } + + public Integer getPic02() { + return pic02; + } + + public void setPic02(Integer pic02) { + this.pic02 = pic02; + } + + public Integer getWtId() { + return wtId; + } + + public void setWtId(Integer wtId) { + this.wtId = wtId; + } } \ No newline at end of file diff --git a/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java b/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java index 994bcf9..77fcfd5 100644 --- a/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java +++ b/src/main/java/com/example/webapi/interceptor/SignatureInterceptor.java @@ -4,6 +4,8 @@ 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; @@ -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; } diff --git a/src/main/java/com/example/webapi/repository/TwiceWeighingRepository.java b/src/main/java/com/example/webapi/repository/TwiceWeighingRepository.java new file mode 100644 index 0000000..0cfbf3b --- /dev/null +++ b/src/main/java/com/example/webapi/repository/TwiceWeighingRepository.java @@ -0,0 +1,48 @@ +package com.example.webapi.repository; + +import com.example.webapi.entity.TwiceWeighing; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +/** + * 二次称重记录数据访问层 + * + * @author Your Name + * @version 1.0.0 + */ +@Repository +public interface TwiceWeighingRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据车号查询记录 + * + * @param vehicleId 车号 + * @return 二次称重记录 + */ + TwiceWeighing findByVehicleId(String vehicleId); + + /** + * 根据打印编号查询记录 + * + * @param printId 打印编号 + * @return 二次称重记录 + */ + TwiceWeighing findByPrintId(String printId); + + /** + * 根据上传标志查询记录数量 + * + * @param uploadFlag 上传标志 + * @return 记录数量 + */ + long countByUploadFlag(Boolean uploadFlag); + + /** + * 根据作废标志查询记录数量 + * + * @param uselessFlag 作废标志 + * @return 记录数量 + */ + long countByUselessFlag(Boolean uselessFlag); +} \ No newline at end of file diff --git a/src/main/java/com/example/webapi/service/TwiceWeighingService.java b/src/main/java/com/example/webapi/service/TwiceWeighingService.java new file mode 100644 index 0000000..3e2f4a8 --- /dev/null +++ b/src/main/java/com/example/webapi/service/TwiceWeighingService.java @@ -0,0 +1,259 @@ +package com.example.webapi.service; + +import com.example.webapi.dto.TwiceWeighingQueryDTO; +import com.example.webapi.entity.TwiceWeighing; +import com.example.webapi.repository.TwiceWeighingRepository; +import com.example.webapi.util.PageUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import jakarta.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +/** + * 二次称重记录服务层 + * + * @author Your Name + * @version 1.0.0 + */ +@Service +@Transactional +public class TwiceWeighingService { + + @Autowired + private TwiceWeighingRepository repository; + + /** + * 根据条件分页查询二次称重记录 + * + * @param queryDTO 查询条件 + * @return 分页结果 + */ + public Page findByConditions(TwiceWeighingQueryDTO queryDTO) { + // 构建分页和排序 + Pageable pageable = buildPageable(queryDTO); + + // 构建查询条件 + Specification spec = buildSpecification(queryDTO); + + return repository.findAll(spec, pageable); + } + + /** + * 根据ID查询二次称重记录 + * + * @param id 记录ID + * @return 二次称重记录 + */ + public Optional findById(String id) { + return repository.findById(id); + } + + /** + * 保存二次称重记录 + * + * @param entity 二次称重记录 + * @return 保存后的记录 + */ + public TwiceWeighing save(TwiceWeighing entity) { + return repository.save(entity); + } + + /** + * 根据ID删除二次称重记录 + * + * @param id 记录ID + */ + public void deleteById(String id) { + repository.deleteById(id); + } + + /** + * 根据车号查询记录 + * + * @param vehicleId 车号 + * @return 二次称重记录 + */ + public TwiceWeighing findByVehicleId(String vehicleId) { + return repository.findByVehicleId(vehicleId); + } + + /** + * 根据打印编号查询记录 + * + * @param printId 打印编号 + * @return 二次称重记录 + */ + public TwiceWeighing findByPrintId(String printId) { + return repository.findByPrintId(printId); + } + + /** + * 获取上传记录数量 + * + * @param uploadFlag 上传标志 + * @return 记录数量 + */ + public long countByUploadFlag(Boolean uploadFlag) { + return repository.countByUploadFlag(uploadFlag); + } + + /** + * 获取作废记录数量 + * + * @param uselessFlag 作废标志 + * @return 记录数量 + */ + public long countByUselessFlag(Boolean uselessFlag) { + return repository.countByUselessFlag(uselessFlag); + } + + /** + * 构建分页和排序 + * + * @param queryDTO 查询条件 + * @return 分页对象 + */ + private Pageable buildPageable(TwiceWeighingQueryDTO queryDTO) { + // 分页参数 + int page = queryDTO.getPage() != null ? queryDTO.getPage() : 0; + int size = queryDTO.getSize() != null ? queryDTO.getSize() : 10; + + // 排序 + Sort sort = Sort.unsorted(); + if (StringUtils.hasText(queryDTO.getSortBy())) { + String direction = "desc".equalsIgnoreCase(queryDTO.getSortDirection()) ? "desc" : "asc"; + sort = Sort.by(Sort.Direction.fromString(direction), queryDTO.getSortBy()); + } + + return PageRequest.of(page, size, sort); + } + + /** + * 构建查询条件 + * + * @param queryDTO 查询条件 + * @return 查询规格 + */ + private Specification buildSpecification(TwiceWeighingQueryDTO queryDTO) { + return (root, query, criteriaBuilder) -> { + List predicates = new ArrayList<>(); + + // 车号模糊查询 + if (StringUtils.hasText(queryDTO.getVehicleId())) { + predicates.add(criteriaBuilder.like(root.get("vehicleId"), "%" + queryDTO.getVehicleId() + "%")); + } + + // 车型精确匹配 + if (StringUtils.hasText(queryDTO.getVehicleType())) { + predicates.add(criteriaBuilder.equal(root.get("vehicleType"), queryDTO.getVehicleType())); + } + + // 货物模糊查询 + if (StringUtils.hasText(queryDTO.getGoods())) { + predicates.add(criteriaBuilder.like(root.get("goods"), "%" + queryDTO.getGoods() + "%")); + } + + // 收货单位模糊查询 + if (StringUtils.hasText(queryDTO.getReceiveUnit())) { + predicates.add(criteriaBuilder.like(root.get("receiveUnit"), "%" + queryDTO.getReceiveUnit() + "%")); + } + + // 发货单位模糊查询 + if (StringUtils.hasText(queryDTO.getSendUnit())) { + predicates.add(criteriaBuilder.like(root.get("sendUnit"), "%" + queryDTO.getSendUnit() + "%")); + } + + // 发货站模糊查询 + if (StringUtils.hasText(queryDTO.getSendStation())) { + predicates.add(criteriaBuilder.like(root.get("sendStation"), "%" + queryDTO.getSendStation() + "%")); + } + + // 到站模糊查询 + if (StringUtils.hasText(queryDTO.getTheStation())) { + predicates.add(criteriaBuilder.like(root.get("theStation"), "%" + queryDTO.getTheStation() + "%")); + } + + // 炉号模糊查询 + if (StringUtils.hasText(queryDTO.getFurnaceNumber())) { + predicates.add(criteriaBuilder.like(root.get("furnaceNumber"), "%" + queryDTO.getFurnaceNumber() + "%")); + } + + // 铁号模糊查询 + if (StringUtils.hasText(queryDTO.getIronNumber())) { + predicates.add(criteriaBuilder.like(root.get("ironNumber"), "%" + queryDTO.getIronNumber() + "%")); + } + + // 方向精确匹配 + if (StringUtils.hasText(queryDTO.getDirection())) { + predicates.add(criteriaBuilder.equal(root.get("direction"), queryDTO.getDirection())); + } + + // 毛重操作员ID模糊查询 + if (StringUtils.hasText(queryDTO.getGrossOpId())) { + predicates.add(criteriaBuilder.like(root.get("grossOpId"), "%" + queryDTO.getGrossOpId() + "%")); + } + + // 皮重操作员ID模糊查询 + if (StringUtils.hasText(queryDTO.getTareOpId())) { + predicates.add(criteriaBuilder.like(root.get("tareOpId"), "%" + queryDTO.getTareOpId() + "%")); + } + + // 打印编号模糊查询 + if (StringUtils.hasText(queryDTO.getPrintId())) { + predicates.add(criteriaBuilder.like(root.get("printId"), "%" + queryDTO.getPrintId() + "%")); + } + + // 备注模糊查询 + if (StringUtils.hasText(queryDTO.getDemo())) { + predicates.add(criteriaBuilder.like(root.get("demo"), "%" + queryDTO.getDemo() + "%")); + } + + // 物资ID精确匹配 + if (queryDTO.getMaterialsId() != null) { + predicates.add(criteriaBuilder.equal(root.get("materialsId"), queryDTO.getMaterialsId())); + } + + // 供应商ID精确匹配 + if (queryDTO.getSupplierId() != null) { + predicates.add(criteriaBuilder.equal(root.get("supplierId"), queryDTO.getSupplierId())); + } + + // 上传标志精确匹配 + if (queryDTO.getUploadFlag() != null) { + predicates.add(criteriaBuilder.equal(root.get("uploadFlag"), queryDTO.getUploadFlag())); + } + + // 作废标志精确匹配 + if (queryDTO.getUselessFlag() != null) { + predicates.add(criteriaBuilder.equal(root.get("uselessFlag"), queryDTO.getUselessFlag())); + } + + // 皮重模式精确匹配 + if (StringUtils.hasText(queryDTO.getTareModel())) { + predicates.add(criteriaBuilder.equal(root.get("tareModel"), queryDTO.getTareModel())); + } + + // 毛重衡器ID精确匹配 + if (StringUtils.hasText(queryDTO.getGrossScaleId())) { + predicates.add(criteriaBuilder.equal(root.get("grossScaleId"), queryDTO.getGrossScaleId())); + } + + // 皮重衡器ID精确匹配 + if (StringUtils.hasText(queryDTO.getTareScaleId())) { + predicates.add(criteriaBuilder.equal(root.get("tareScaleId"), queryDTO.getTareScaleId())); + } + + return criteriaBuilder.and(predicates.toArray(new Predicate[0])); + }; + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 87656f1..fd36ab4 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,9 +7,10 @@ spring: application: name: fuquanapi datasource: - url: jdbc:sqlserver://112.33.47.173:6789;SelectMethod=cursor;rewriteBatchedStatements=true;DatabaseName=ERPPlatForm2025_FQ_JK;encrypt=false;trustServerCertificate=true - username: PlatForm_FuQ - password: p|Rc9fZza[@XR-4 +# url: jdbc:sqlserver://112.33.47.173:6789;SelectMethod=cursor;rewriteBatchedStatements=true;DatabaseName=ERPPlatForm2025_FQ_JK;encrypt=false;trustServerCertificate=true + url: jdbc:sqlserver://112.33.47.173:6789;SelectMethod=cursor;rewriteBatchedStatements=true;DatabaseName=WY_DATAMANAGE20250731;encrypt=false;trustServerCertificate=true + username: admin + password: admin@Erp2021 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver jpa: hibernate: