@@ -1,7 +1,7 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<project xmlns="http://maven.apache.org/POM/4.0.0" | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||||
http://maven.apache.org/xsd/maven-4.0.0.xsd"> | http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
@@ -96,9 +96,9 @@ | |||||
</dependency> | </dependency> | ||||
<!-- Swagger3/Springfox 3.x 依赖 --> | <!-- Swagger3/Springfox 3.x 依赖 --> | ||||
<dependency> | <dependency> | ||||
<groupId>io.springfox</groupId> | |||||
<artifactId>springfox-boot-starter</artifactId> | |||||
<version>3.0.0</version> | |||||
<groupId>org.springdoc</groupId> | |||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> | |||||
<version>2.2.0</version> | |||||
</dependency> | </dependency> | ||||
</dependencies> | </dependencies> | ||||
@@ -138,12 +138,12 @@ | |||||
<groupId>org.springframework.boot</groupId> | <groupId>org.springframework.boot</groupId> | ||||
<artifactId>spring-boot-maven-plugin</artifactId> | <artifactId>spring-boot-maven-plugin</artifactId> | ||||
<configuration> | <configuration> | ||||
<excludes> | |||||
<exclude> | |||||
<groupId>org.projectlombok</groupId> | |||||
<artifactId>lombok</artifactId> | |||||
</exclude> | |||||
</excludes> | |||||
<!-- <excludes>--> | |||||
<!-- <exclude>--> | |||||
<!-- <groupId>org.projectlombok</groupId>--> | |||||
<!-- <artifactId>lombok</artifactId>--> | |||||
<!-- </exclude>--> | |||||
<!-- </excludes>--> | |||||
</configuration> | </configuration> | ||||
</plugin> | </plugin> | ||||
<plugin> | <plugin> | ||||
@@ -182,4 +182,4 @@ | |||||
</plugin> | </plugin> | ||||
</plugins> | </plugins> | ||||
</build> | </build> | ||||
</project> | |||||
</project> |
@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | |||||
/** | /** | ||||
* SpringBoot WebAPI 应用程序主类 | * SpringBoot WebAPI 应用程序主类 | ||||
* | |||||
* | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@@ -16,7 +16,7 @@ public class WebApiApplication { | |||||
SpringApplication.run(WebApiApplication.class, args); | SpringApplication.run(WebApiApplication.class, args); | ||||
System.out.println("================================="); | System.out.println("================================="); | ||||
System.out.println("WebAPI 应用程序启动成功!"); | 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("================================="); | System.out.println("================================="); | ||||
} | } | ||||
} | |||||
} |
@@ -1,93 +1,18 @@ | |||||
package com.example.webapi.config; | 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.Bean; | ||||
import org.springframework.context.annotation.Configuration; | 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 | @Configuration | ||||
public class SwaggerConfig { | public class SwaggerConfig { | ||||
@Bean | @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") | .version("1.0.0") | ||||
.contact(new Contact("开发团队", "http://www.example.com", "dev@example.com")) | |||||
.build(); | |||||
} | |||||
/** | |||||
* 获取全局请求参数 | |||||
* 注意:在Swagger UI中这些参数设置为非必需,以便能够正常访问Swagger界面 | |||||
* 实际API调用时,这些参数仍然需要通过拦截器进行验证 | |||||
*/ | |||||
private List<RequestParameter> getGlobalRequestParameters() { | |||||
List<RequestParameter> 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("福泉项目后端接口文档")); | |||||
} | } | ||||
} | |||||
} |
@@ -29,19 +29,17 @@ public class WebConfig implements WebMvcConfigurer { | |||||
@Override | @Override | ||||
public void addInterceptors(InterceptorRegistry registry) { | public void addInterceptors(InterceptorRegistry registry) { | ||||
// 添加签名验证拦截器,对所有API请求进行验证 | |||||
registry.addInterceptor(signatureInterceptor) | 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 | @Override | ||||
@@ -4,8 +4,8 @@ import com.example.webapi.dto.ImageInfoQueryDTO; | |||||
import com.example.webapi.entity.ImageInfo; | import com.example.webapi.entity.ImageInfo; | ||||
import com.example.webapi.service.ImageInfoService; | import com.example.webapi.service.ImageInfoService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; | |||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "图片信息管理") | |||||
@Tag(name = "图片信息管理") | |||||
@RestController | @RestController | ||||
@RequestMapping("/image-info") | @RequestMapping("/image-info") | ||||
public class ImageInfoController { | public class ImageInfoController { | ||||
@@ -23,33 +23,33 @@ public class ImageInfoController { | |||||
@ApiOperation("条件查询图片信息(分页)") | |||||
@Operation(summary = "条件查询图片信息(分页)") | |||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<ImageInfo>> pageByConditions(@RequestBody ImageInfoQueryDTO queryDTO) { | public ApiResponse<Page<ImageInfo>> pageByConditions(@RequestBody ImageInfoQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation("根据ID查询图片信息") | |||||
@Operation(summary = "根据ID查询图片信息") | |||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<ImageInfo> getById(@PathVariable Integer id) { | public ApiResponse<ImageInfo> getById(@PathVariable Integer id) { | ||||
Optional<ImageInfo> result = service.findById(id); | Optional<ImageInfo> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该图片信息")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该图片信息")); | ||||
} | } | ||||
@ApiOperation("新增图片信息") | |||||
@Operation(summary = "新增图片信息") | |||||
@PostMapping | @PostMapping | ||||
public ApiResponse<ImageInfo> create(@RequestBody ImageInfo entity) { | public ApiResponse<ImageInfo> create(@RequestBody ImageInfo entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("更新图片信息") | |||||
@Operation(summary = "更新图片信息") | |||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<ImageInfo> update(@PathVariable Integer id, @RequestBody ImageInfo entity) { | public ApiResponse<ImageInfo> update(@PathVariable Integer id, @RequestBody ImageInfo entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("删除图片信息") | |||||
@Operation(summary = "删除图片信息") | |||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete(@PathVariable Integer id) { | public ApiResponse<Void> delete(@PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
@@ -4,8 +4,8 @@ import com.example.webapi.dto.MaterialInfoQueryDTO; | |||||
import com.example.webapi.entity.MaterialInfo; | import com.example.webapi.entity.MaterialInfo; | ||||
import com.example.webapi.service.MaterialInfoService; | import com.example.webapi.service.MaterialInfoService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; | |||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "品种信息管理") | |||||
@Tag(name = "品种信息管理") | |||||
@RestController | @RestController | ||||
@RequestMapping("/material-info") | @RequestMapping("/material-info") | ||||
public class MaterialInfoController { | public class MaterialInfoController { | ||||
@@ -22,33 +22,33 @@ public class MaterialInfoController { | |||||
private MaterialInfoService service; | private MaterialInfoService service; | ||||
@ApiOperation("条件查询品种信息(分页)") | |||||
@Operation(summary = "条件查询品种信息(分页)") | |||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<MaterialInfo>> pageByConditions(@RequestBody MaterialInfoQueryDTO queryDTO) { | public ApiResponse<Page<MaterialInfo>> pageByConditions(@RequestBody MaterialInfoQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation("根据ID查询品种信息") | |||||
@Operation(summary = "根据ID查询品种信息") | |||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<MaterialInfo> getById(@PathVariable Integer id) { | public ApiResponse<MaterialInfo> getById(@PathVariable Integer id) { | ||||
Optional<MaterialInfo> result = service.findById(id); | Optional<MaterialInfo> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该品种信息")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该品种信息")); | ||||
} | } | ||||
@ApiOperation("新增品种信息") | |||||
@Operation(summary = "新增品种信息") | |||||
@PostMapping | @PostMapping | ||||
public ApiResponse<MaterialInfo> create(@RequestBody MaterialInfo entity) { | public ApiResponse<MaterialInfo> create(@RequestBody MaterialInfo entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("更新品种信息") | |||||
@Operation(summary = "更新品种信息") | |||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<MaterialInfo> update(@PathVariable Integer id, @RequestBody MaterialInfo entity) { | public ApiResponse<MaterialInfo> update(@PathVariable Integer id, @RequestBody MaterialInfo entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("删除品种信息") | |||||
@Operation(summary = "删除品种信息") | |||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete(@PathVariable Integer id) { | public ApiResponse<Void> delete(@PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
@@ -4,8 +4,8 @@ import com.example.webapi.dto.SupplierQueryDTO; | |||||
import com.example.webapi.entity.Supplier; | import com.example.webapi.entity.Supplier; | ||||
import com.example.webapi.service.SupplierService; | import com.example.webapi.service.SupplierService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; | |||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "供应商信息管理") | |||||
@Tag(name = "供应商信息管理") | |||||
@RestController | @RestController | ||||
@RequestMapping("/supplier") | @RequestMapping("/supplier") | ||||
public class SupplierController { | public class SupplierController { | ||||
@@ -22,33 +22,33 @@ public class SupplierController { | |||||
private SupplierService service; | private SupplierService service; | ||||
@ApiOperation("条件查询供应商信息(分页)") | |||||
@Operation(summary = "条件查询供应商信息(分页)") | |||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<Supplier>> pageByConditions(@RequestBody SupplierQueryDTO queryDTO) { | public ApiResponse<Page<Supplier>> pageByConditions(@RequestBody SupplierQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation("根据ID查询供应商信息") | |||||
@Operation(summary = "根据ID查询供应商信息") | |||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<Supplier> getById(@PathVariable Integer id) { | public ApiResponse<Supplier> getById(@PathVariable Integer id) { | ||||
Optional<Supplier> result = service.findById(id); | Optional<Supplier> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应商信息")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应商信息")); | ||||
} | } | ||||
@ApiOperation("新增供应商信息") | |||||
@Operation(summary = "新增供应商信息") | |||||
@PostMapping | @PostMapping | ||||
public ApiResponse<Supplier> create(@RequestBody Supplier entity) { | public ApiResponse<Supplier> create(@RequestBody Supplier entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("更新供应商信息") | |||||
@Operation(summary = "更新供应商信息") | |||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<Supplier> update(@PathVariable Integer id, @RequestBody Supplier entity) { | public ApiResponse<Supplier> update(@PathVariable Integer id, @RequestBody Supplier entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation("删除供应商信息") | |||||
@Operation(summary = "删除供应商信息") | |||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete(@PathVariable Integer id) { | public ApiResponse<Void> delete(@PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
@@ -4,20 +4,18 @@ import com.example.webapi.dto.SupplyVarietyQueryDTO; | |||||
import com.example.webapi.entity.SupplyVariety; | import com.example.webapi.entity.SupplyVariety; | ||||
import com.example.webapi.service.SupplyVarietyService; | import com.example.webapi.service.SupplyVarietyService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.Content; | ||||
import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "供应标识品种信息管理") | |||||
@Tag(name = "供应标识品种信息管理", description = "提供供应标识品种信息的增删改查接口") | @Tag(name = "供应标识品种信息管理", description = "提供供应标识品种信息的增删改查接口") | ||||
@RestController | @RestController | ||||
@RequestMapping("/supply-variety") | @RequestMapping("/supply-variety") | ||||
@@ -26,7 +24,7 @@ public class SupplyVarietyController { | |||||
@Autowired | @Autowired | ||||
private SupplyVarietyService service; | private SupplyVarietyService service; | ||||
@ApiOperation(value = "条件查询供应标识品种信息(分页)", notes = "根据提供的查询条件分页查询供应标识品种信息") | |||||
@Operation(summary = "条件查询供应标识品种信息(分页)", description = "根据提供的查询条件分页查询供应标识品种信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -35,12 +33,12 @@ public class SupplyVarietyController { | |||||
}) | }) | ||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<SupplyVariety>> pageByConditions( | public ApiResponse<Page<SupplyVariety>> pageByConditions( | ||||
@ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@RequestBody SupplyVarietyQueryDTO queryDTO) { | @RequestBody SupplyVarietyQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation(value = "根据ID查询供应标识品种信息", notes = "根据ID获取单条供应标识品种信息详情") | |||||
@Operation(summary = "根据ID查询供应标识品种信息", description = "根据ID获取单条供应标识品种信息详情") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -50,13 +48,13 @@ public class SupplyVarietyController { | |||||
}) | }) | ||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<SupplyVariety> getById( | public ApiResponse<SupplyVariety> getById( | ||||
@ApiParam(value = "供应标识品种ID", required = true, example = "1") | |||||
@Parameter(description = "供应标识品种ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
Optional<SupplyVariety> result = service.findById(id); | Optional<SupplyVariety> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应标识品种信息")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该供应标识品种信息")); | ||||
} | } | ||||
@ApiOperation(value = "新增供应标识品种信息", notes = "创建新的供应标识品种信息") | |||||
@Operation(summary = "新增供应标识品种信息", description = "创建新的供应标识品种信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -66,12 +64,12 @@ public class SupplyVarietyController { | |||||
}) | }) | ||||
@PostMapping | @PostMapping | ||||
public ApiResponse<SupplyVariety> create( | public ApiResponse<SupplyVariety> create( | ||||
@ApiParam(value = "供应标识品种实体", required = true) | |||||
@Parameter(description = "供应标识品种实体", required = true) | |||||
@RequestBody SupplyVariety entity) { | @RequestBody SupplyVariety entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "更新供应标识品种信息", notes = "根据ID更新供应标识品种信息") | |||||
@Operation(summary = "更新供应标识品种信息", description = "根据ID更新供应标识品种信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -82,15 +80,15 @@ public class SupplyVarietyController { | |||||
}) | }) | ||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<SupplyVariety> update( | public ApiResponse<SupplyVariety> update( | ||||
@ApiParam(value = "供应标识品种ID", required = true, example = "1") | |||||
@Parameter(description = "供应标识品种ID", required = true, example = "1") | |||||
@PathVariable Integer id, | @PathVariable Integer id, | ||||
@ApiParam(value = "更新后的供应标识品种实体", required = true) | |||||
@Parameter(description = "更新后的供应标识品种实体", required = true) | |||||
@RequestBody SupplyVariety entity) { | @RequestBody SupplyVariety entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "删除供应标识品种信息", notes = "根据ID删除供应标识品种信息") | |||||
@Operation(summary = "删除供应标识品种信息", description = "根据ID删除供应标识品种信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -100,7 +98,7 @@ public class SupplyVarietyController { | |||||
}) | }) | ||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete( | public ApiResponse<Void> delete( | ||||
@ApiParam(value = "供应标识品种ID", required = true, example = "1") | |||||
@Parameter(description = "供应标识品种ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
return ApiResponse.success(); | return ApiResponse.success(); | ||||
@@ -4,20 +4,18 @@ import com.example.webapi.dto.TransferRecordQueryDTO; | |||||
import com.example.webapi.entity.TransferRecord; | import com.example.webapi.entity.TransferRecord; | ||||
import com.example.webapi.service.TransferRecordService; | import com.example.webapi.service.TransferRecordService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.Content; | ||||
import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "转运记录管理") | |||||
@Tag(name = "转运记录管理", description = "提供转运记录的增删改查接口") | @Tag(name = "转运记录管理", description = "提供转运记录的增删改查接口") | ||||
@RestController | @RestController | ||||
@RequestMapping("/transfer-record") | @RequestMapping("/transfer-record") | ||||
@@ -26,7 +24,7 @@ public class TransferRecordController { | |||||
@Autowired | @Autowired | ||||
private TransferRecordService service; | private TransferRecordService service; | ||||
@ApiOperation(value = "条件查询转运记录(分页)", notes = "根据提供的查询条件分页查询转运记录") | |||||
@Operation(summary = "条件查询转运记录(分页)", description = "根据提供的查询条件分页查询转运记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -35,13 +33,13 @@ public class TransferRecordController { | |||||
}) | }) | ||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<TransferRecord>> pageByConditions( | public ApiResponse<Page<TransferRecord>> pageByConditions( | ||||
@ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@RequestBody TransferRecordQueryDTO queryDTO) { | @RequestBody TransferRecordQueryDTO queryDTO) { | ||||
queryDTO.setSortBy("issuedTime"); | queryDTO.setSortBy("issuedTime"); | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation(value = "根据ID查询转运记录", notes = "根据ID获取单条转运记录详情") | |||||
@Operation(summary = "根据ID查询转运记录", description = "根据ID获取单条转运记录详情") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -51,13 +49,13 @@ public class TransferRecordController { | |||||
}) | }) | ||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<TransferRecord> getById( | public ApiResponse<TransferRecord> getById( | ||||
@ApiParam(value = "转运记录ID", required = true, example = "1") | |||||
@Parameter(description = "转运记录ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
Optional<TransferRecord> result = service.findById(id); | Optional<TransferRecord> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该转运记录")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该转运记录")); | ||||
} | } | ||||
@ApiOperation(value = "新增转运记录", notes = "创建新的转运记录") | |||||
@Operation(summary = "新增转运记录", description = "创建新的转运记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -67,12 +65,12 @@ public class TransferRecordController { | |||||
}) | }) | ||||
@PostMapping | @PostMapping | ||||
public ApiResponse<TransferRecord> create( | public ApiResponse<TransferRecord> create( | ||||
@ApiParam(value = "转运记录实体", required = true) | |||||
@Parameter(description = "转运记录实体", required = true) | |||||
@RequestBody TransferRecord entity) { | @RequestBody TransferRecord entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "更新转运记录", notes = "根据ID更新转运记录信息") | |||||
@Operation(summary = "更新转运记录", description = "根据ID更新转运记录信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -83,15 +81,15 @@ public class TransferRecordController { | |||||
}) | }) | ||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<TransferRecord> update( | public ApiResponse<TransferRecord> update( | ||||
@ApiParam(value = "转运记录ID", required = true, example = "1") | |||||
@Parameter(description = "转运记录ID", required = true, example = "1") | |||||
@PathVariable Integer id, | @PathVariable Integer id, | ||||
@ApiParam(value = "更新后的转运记录实体", required = true) | |||||
@Parameter(description = "更新后的转运记录实体", required = true) | |||||
@RequestBody TransferRecord entity) { | @RequestBody TransferRecord entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "删除转运记录", notes = "根据ID删除转运记录") | |||||
@Operation(summary = "删除转运记录", description = "根据ID删除转运记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -101,7 +99,7 @@ public class TransferRecordController { | |||||
}) | }) | ||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete( | public ApiResponse<Void> delete( | ||||
@ApiParam(value = "转运记录ID", required = true, example = "1") | |||||
@Parameter(description = "转运记录ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
return ApiResponse.success(); | return ApiResponse.success(); | ||||
@@ -4,20 +4,18 @@ import com.example.webapi.dto.TransportCompanyQueryDTO; | |||||
import com.example.webapi.entity.TransportCompany; | import com.example.webapi.entity.TransportCompany; | ||||
import com.example.webapi.service.TransportCompanyService; | import com.example.webapi.service.TransportCompanyService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.Content; | ||||
import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "运输公司管理") | |||||
@Tag(name = "运输公司管理", description = "提供运输公司的增删改查接口") | @Tag(name = "运输公司管理", description = "提供运输公司的增删改查接口") | ||||
@RestController | @RestController | ||||
@RequestMapping("/transport-company") | @RequestMapping("/transport-company") | ||||
@@ -26,7 +24,7 @@ public class TransportCompanyController { | |||||
@Autowired | @Autowired | ||||
private TransportCompanyService service; | private TransportCompanyService service; | ||||
@ApiOperation(value = "条件查询运输公司(分页)", notes = "根据提供的查询条件分页查询运输公司") | |||||
@Operation(summary = "条件查询运输公司(分页)", description = "根据提供的查询条件分页查询运输公司") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -35,12 +33,12 @@ public class TransportCompanyController { | |||||
}) | }) | ||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<TransportCompany>> pageByConditions( | public ApiResponse<Page<TransportCompany>> pageByConditions( | ||||
@ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@RequestBody TransportCompanyQueryDTO queryDTO) { | @RequestBody TransportCompanyQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation(value = "根据ID查询运输公司", notes = "根据ID获取单条运输公司详情") | |||||
@Operation(summary = "根据ID查询运输公司", description = "根据ID获取单条运输公司详情") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -50,13 +48,13 @@ public class TransportCompanyController { | |||||
}) | }) | ||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<TransportCompany> getById( | public ApiResponse<TransportCompany> getById( | ||||
@ApiParam(value = "运输公司ID", required = true, example = "1") | |||||
@Parameter(description = "运输公司ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
Optional<TransportCompany> result = service.findById(id); | Optional<TransportCompany> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该运输公司")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该运输公司")); | ||||
} | } | ||||
@ApiOperation(value = "新增运输公司", notes = "创建新的运输公司") | |||||
@Operation(summary = "新增运输公司", description = "创建新的运输公司") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -66,12 +64,12 @@ public class TransportCompanyController { | |||||
}) | }) | ||||
@PostMapping | @PostMapping | ||||
public ApiResponse<TransportCompany> create( | public ApiResponse<TransportCompany> create( | ||||
@ApiParam(value = "运输公司实体", required = true) | |||||
@Parameter(description = "运输公司实体", required = true) | |||||
@RequestBody TransportCompany entity) { | @RequestBody TransportCompany entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "更新运输公司", notes = "根据ID更新运输公司信息") | |||||
@Operation(summary = "更新运输公司", description = "根据ID更新运输公司信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -82,15 +80,15 @@ public class TransportCompanyController { | |||||
}) | }) | ||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<TransportCompany> update( | public ApiResponse<TransportCompany> update( | ||||
@ApiParam(value = "运输公司ID", required = true, example = "1") | |||||
@Parameter(description = "运输公司ID", required = true, example = "1") | |||||
@PathVariable Integer id, | @PathVariable Integer id, | ||||
@ApiParam(value = "更新后的运输公司实体", required = true) | |||||
@Parameter(description = "更新后的运输公司实体", required = true) | |||||
@RequestBody TransportCompany entity) { | @RequestBody TransportCompany entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "删除运输公司", notes = "根据ID删除运输公司") | |||||
@Operation(summary = "删除运输公司", description = "根据ID删除运输公司") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -100,7 +98,7 @@ public class TransportCompanyController { | |||||
}) | }) | ||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete( | public ApiResponse<Void> delete( | ||||
@ApiParam(value = "运输公司ID", required = true, example = "1") | |||||
@Parameter(description = "运输公司ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
return ApiResponse.success(); | return ApiResponse.success(); | ||||
@@ -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<Page<TwiceWeighing>> pageByConditions(@RequestBody TwiceWeighingQueryDTO queryDTO) { | |||||
return ApiResponse.success(service.findByConditions(queryDTO)); | |||||
} | |||||
@Operation(summary = "根据ID查询二次称重记录") | |||||
@GetMapping("/{id}") | |||||
public ApiResponse<TwiceWeighing> getById(@PathVariable String id) { | |||||
Optional<TwiceWeighing> result = service.findById(id); | |||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该二次称重记录")); | |||||
} | |||||
@Operation(summary = "新增二次称重记录") | |||||
@PostMapping | |||||
public ApiResponse<TwiceWeighing> create(@RequestBody TwiceWeighing entity) { | |||||
return ApiResponse.success(service.save(entity)); | |||||
} | |||||
@Operation(summary = "更新二次称重记录") | |||||
@PutMapping("/{id}") | |||||
public ApiResponse<TwiceWeighing> update(@PathVariable String id, @RequestBody TwiceWeighing entity) { | |||||
entity.setId(id); | |||||
return ApiResponse.success(service.save(entity)); | |||||
} | |||||
@Operation(summary = "删除二次称重记录") | |||||
@DeleteMapping("/{id}") | |||||
public ApiResponse<Void> delete(@PathVariable String id) { | |||||
service.deleteById(id); | |||||
return ApiResponse.success(); | |||||
} | |||||
@Operation(summary = "根据车号查询二次称重记录") | |||||
@GetMapping("/vehicle/{vehicleId}") | |||||
public ApiResponse<TwiceWeighing> getByVehicleId(@PathVariable String vehicleId) { | |||||
TwiceWeighing result = service.findByVehicleId(vehicleId); | |||||
return result != null ? ApiResponse.success(result) : ApiResponse.error("未找到该车号的记录"); | |||||
} | |||||
@Operation(summary = "根据打印编号查询二次称重记录") | |||||
@GetMapping("/print/{printId}") | |||||
public ApiResponse<TwiceWeighing> 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<Long> countByUploadFlag(@PathVariable Boolean uploadFlag) { | |||||
return ApiResponse.success(service.countByUploadFlag(uploadFlag)); | |||||
} | |||||
@Operation(summary = "获取作废记录数量") | |||||
@GetMapping("/count/useless/{uselessFlag}") | |||||
public ApiResponse<Long> countByUselessFlag(@PathVariable Boolean uselessFlag) { | |||||
return ApiResponse.success(service.countByUselessFlag(uselessFlag)); | |||||
} | |||||
} |
@@ -4,9 +4,9 @@ import com.example.webapi.dto.VehicleInfoQueryDTO; | |||||
import com.example.webapi.entity.VehicleInfo; | import com.example.webapi.entity.VehicleInfo; | ||||
import com.example.webapi.service.VehicleInfoService; | import com.example.webapi.service.VehicleInfoService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.Content; | ||||
import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||||
@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.*; | |||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "车辆信息管理") | |||||
@Tag(name = "车辆信息管理", description = "提供车辆信息的增删改查接口") | @Tag(name = "车辆信息管理", description = "提供车辆信息的增删改查接口") | ||||
@RestController | @RestController | ||||
@RequestMapping("/vehicle-info") | @RequestMapping("/vehicle-info") | ||||
@@ -26,7 +25,7 @@ public class VehicleInfoController { | |||||
@Autowired | @Autowired | ||||
private VehicleInfoService service; | private VehicleInfoService service; | ||||
@ApiOperation(value = "条件查询车辆信息(分页)", notes = "根据提供的查询条件分页查询车辆信息") | |||||
@Operation(summary = "条件查询车辆信息(分页)", description = "根据提供的查询条件分页查询车辆信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -35,12 +34,12 @@ public class VehicleInfoController { | |||||
}) | }) | ||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<VehicleInfo>> pageByConditions( | public ApiResponse<Page<VehicleInfo>> pageByConditions( | ||||
@ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@RequestBody VehicleInfoQueryDTO queryDTO) { | @RequestBody VehicleInfoQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation(value = "根据ID查询车辆信息", notes = "根据ID获取单条车辆信息详情") | |||||
@Operation(summary = "根据ID查询车辆信息", description = "根据ID获取单条车辆信息详情") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -50,13 +49,13 @@ public class VehicleInfoController { | |||||
}) | }) | ||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<VehicleInfo> getById( | public ApiResponse<VehicleInfo> getById( | ||||
@ApiParam(value = "车辆ID", required = true, example = "1") | |||||
@Parameter(description = "车辆ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
Optional<VehicleInfo> result = service.findById(id); | Optional<VehicleInfo> result = service.findById(id); | ||||
return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该车辆信息")); | return result.map(ApiResponse::success).orElseGet(() -> ApiResponse.error("未找到该车辆信息")); | ||||
} | } | ||||
@ApiOperation(value = "新增车辆信息", notes = "创建新的车辆信息") | |||||
@Operation(summary = "新增车辆信息", description = "创建新的车辆信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -66,12 +65,12 @@ public class VehicleInfoController { | |||||
}) | }) | ||||
@PostMapping | @PostMapping | ||||
public ApiResponse<VehicleInfo> create( | public ApiResponse<VehicleInfo> create( | ||||
@ApiParam(value = "车辆信息实体", required = true) | |||||
@Parameter(description = "车辆信息实体", required = true) | |||||
@RequestBody VehicleInfo entity) { | @RequestBody VehicleInfo entity) { | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "更新车辆信息", notes = "根据ID更新车辆信息") | |||||
@Operation(summary = "更新车辆信息", description = "根据ID更新车辆信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -82,15 +81,15 @@ public class VehicleInfoController { | |||||
}) | }) | ||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<VehicleInfo> update( | public ApiResponse<VehicleInfo> update( | ||||
@ApiParam(value = "车辆ID", required = true, example = "1") | |||||
@Parameter(description = "车辆ID", required = true, example = "1") | |||||
@PathVariable Integer id, | @PathVariable Integer id, | ||||
@ApiParam(value = "更新后的车辆信息实体", required = true) | |||||
@Parameter(description = "更新后的车辆信息实体", required = true) | |||||
@RequestBody VehicleInfo entity) { | @RequestBody VehicleInfo entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "删除车辆信息", notes = "根据ID删除车辆信息") | |||||
@Operation(summary = "删除车辆信息", description = "根据ID删除车辆信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -100,7 +99,7 @@ public class VehicleInfoController { | |||||
}) | }) | ||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete( | public ApiResponse<Void> delete( | ||||
@ApiParam(value = "车辆ID", required = true, example = "1") | |||||
@Parameter(description = "车辆ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
return ApiResponse.success(); | return ApiResponse.success(); | ||||
@@ -6,20 +6,18 @@ import com.example.webapi.entity.WeighingRecord; | |||||
import com.example.webapi.service.TransferRecordService; | import com.example.webapi.service.TransferRecordService; | ||||
import com.example.webapi.service.WeighingRecordService; | import com.example.webapi.service.WeighingRecordService; | ||||
import com.example.webapi.dto.ApiResponse; | 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.Content; | ||||
import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
@Api(tags = "称重记录管理") | |||||
@Tag(name = "称重记录管理", description = "提供称重记录的增删改查接口") | @Tag(name = "称重记录管理", description = "提供称重记录的增删改查接口") | ||||
@RestController | @RestController | ||||
@RequestMapping("/weighing-record") | @RequestMapping("/weighing-record") | ||||
@@ -31,7 +29,7 @@ public class WeighingRecordController { | |||||
@Autowired | @Autowired | ||||
private TransferRecordService transferRecordService; | private TransferRecordService transferRecordService; | ||||
@ApiOperation(value = "条件查询称重记录(分页)", notes = "根据提供的查询条件分页查询称重记录") | |||||
@Operation(summary = "条件查询称重记录(分页)", description = "根据提供的查询条件分页查询称重记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -40,12 +38,12 @@ public class WeighingRecordController { | |||||
}) | }) | ||||
@PostMapping("/page/conditions") | @PostMapping("/page/conditions") | ||||
public ApiResponse<Page<WeighingRecord>> pageByConditions( | public ApiResponse<Page<WeighingRecord>> pageByConditions( | ||||
@ApiParam(value = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@Parameter(description = "查询条件DTO,包含分页信息和过滤条件", required = true) | |||||
@RequestBody WeighingRecordQueryDTO queryDTO) { | @RequestBody WeighingRecordQueryDTO queryDTO) { | ||||
return ApiResponse.success(service.findByConditions(queryDTO)); | return ApiResponse.success(service.findByConditions(queryDTO)); | ||||
} | } | ||||
@ApiOperation(value = "根据ID查询称重记录", notes = "根据ID获取单条称重记录详情") | |||||
@Operation(summary = "根据ID查询称重记录", description = "根据ID获取单条称重记录详情") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "查询成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -55,14 +53,14 @@ public class WeighingRecordController { | |||||
}) | }) | ||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
public ApiResponse<WeighingRecord> getById( | public ApiResponse<WeighingRecord> getById( | ||||
@ApiParam(value = "称重记录ID", required = true, example = "1") | |||||
@Parameter(description = "称重记录ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
Optional<WeighingRecord> result = service.findById(id); | Optional<WeighingRecord> result = service.findById(id); | ||||
return result.map(ApiResponse::success) | return result.map(ApiResponse::success) | ||||
.orElseGet(() -> ApiResponse.error("未找到该称重记录")); | .orElseGet(() -> ApiResponse.error("未找到该称重记录")); | ||||
} | } | ||||
@ApiOperation(value = "新增称重记录", notes = "创建新的称重记录") | |||||
@Operation(summary = "新增称重记录", description = "创建新的称重记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "创建成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -72,7 +70,7 @@ public class WeighingRecordController { | |||||
}) | }) | ||||
@PostMapping | @PostMapping | ||||
public ApiResponse<WeighingRecord> create( | public ApiResponse<WeighingRecord> create( | ||||
@ApiParam(value = "称重记录实体", required = true) | |||||
@Parameter(description = "称重记录实体", required = true) | |||||
@RequestBody WeighingRecord entity) { | @RequestBody WeighingRecord entity) { | ||||
WeighingRecord weighingRecord= service.save(entity); | WeighingRecord weighingRecord= service.save(entity); | ||||
if(weighingRecord.getMaterielId()!=null){ | if(weighingRecord.getMaterielId()!=null){ | ||||
@@ -88,7 +86,7 @@ public class WeighingRecordController { | |||||
} | } | ||||
@ApiOperation(value = "更新称重记录", notes = "根据ID更新称重记录信息") | |||||
@Operation(summary = "更新称重记录", description = "根据ID更新称重记录信息") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "更新成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -99,15 +97,15 @@ public class WeighingRecordController { | |||||
}) | }) | ||||
@PutMapping("/{id}") | @PutMapping("/{id}") | ||||
public ApiResponse<WeighingRecord> update( | public ApiResponse<WeighingRecord> update( | ||||
@ApiParam(value = "称重记录ID", required = true, example = "1") | |||||
@Parameter(description = "称重记录ID", required = true, example = "1") | |||||
@PathVariable Integer id, | @PathVariable Integer id, | ||||
@ApiParam(value = "更新后的称重记录实体", required = true) | |||||
@Parameter(description = "更新后的称重记录实体", required = true) | |||||
@RequestBody WeighingRecord entity) { | @RequestBody WeighingRecord entity) { | ||||
entity.setId(id); | entity.setId(id); | ||||
return ApiResponse.success(service.save(entity)); | return ApiResponse.success(service.save(entity)); | ||||
} | } | ||||
@ApiOperation(value = "删除称重记录", notes = "根据ID删除称重记录") | |||||
@Operation(summary = "删除称重记录", description = "根据ID删除称重记录") | |||||
@ApiResponses(value = { | @ApiResponses(value = { | ||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "删除成功", | ||||
content = @Content(mediaType = "application/json", | content = @Content(mediaType = "application/json", | ||||
@@ -117,7 +115,7 @@ public class WeighingRecordController { | |||||
}) | }) | ||||
@DeleteMapping("/{id}") | @DeleteMapping("/{id}") | ||||
public ApiResponse<Void> delete( | public ApiResponse<Void> delete( | ||||
@ApiParam(value = "称重记录ID", required = true, example = "1") | |||||
@Parameter(description = "称重记录ID", required = true, example = "1") | |||||
@PathVariable Integer id) { | @PathVariable Integer id) { | ||||
service.deleteById(id); | service.deleteById(id); | ||||
return ApiResponse.success(); | return ApiResponse.success(); | ||||
@@ -1,31 +1,28 @@ | |||||
package com.example.webapi.dto; | 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; | import java.time.LocalDateTime; | ||||
/** | /** | ||||
* 通用API响应类 | * 通用API响应类 | ||||
* | |||||
* | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@ApiModel(description = "API通用响应结构") | |||||
@Schema(description = "API通用响应结构") | |||||
public class ApiResponse<T> { | public class ApiResponse<T> { | ||||
@ApiModelProperty(value = "响应状态码", example = "200", notes = "200表示成功,其他值表示失败") | |||||
@Schema(description = "响应状态码", example = "200") | |||||
private Integer code; | private Integer code; | ||||
@ApiModelProperty(value = "响应消息", example = "操作成功") | |||||
@Schema(description = "响应消息", example = "操作成功") | |||||
private String message; | private String message; | ||||
@ApiModelProperty(value = "响应数据") | |||||
@Schema(description = "响应数据") | |||||
private T data; | private T data; | ||||
@ApiModelProperty(value = "响应时间戳", example = "2023-05-01T10:30:00") | |||||
@Schema(description = "响应时间戳", example = "2023-05-01T10:30:00") | |||||
private LocalDateTime timestamp; | private LocalDateTime timestamp; | ||||
public ApiResponse() { | public ApiResponse() { | ||||
@@ -43,9 +40,42 @@ public class ApiResponse<T> { | |||||
this.data = data; | 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 data 响应数据 | ||||
* @param <T> 数据类型 | * @param <T> 数据类型 | ||||
* @return 响应对象 | * @return 响应对象 | ||||
@@ -56,7 +86,7 @@ public class ApiResponse<T> { | |||||
/** | /** | ||||
* 成功响应(无数据) | * 成功响应(无数据) | ||||
* | |||||
* | |||||
* @return 响应对象 | * @return 响应对象 | ||||
*/ | */ | ||||
public static <T> ApiResponse<T> success() { | public static <T> ApiResponse<T> success() { | ||||
@@ -65,7 +95,7 @@ public class ApiResponse<T> { | |||||
/** | /** | ||||
* 失败响应 | * 失败响应 | ||||
* | |||||
* | |||||
* @param message 错误消息 | * @param message 错误消息 | ||||
* @return 响应对象 | * @return 响应对象 | ||||
*/ | */ | ||||
@@ -75,7 +105,7 @@ public class ApiResponse<T> { | |||||
/** | /** | ||||
* 失败响应 | * 失败响应 | ||||
* | |||||
* | |||||
* @param code 错误码 | * @param code 错误码 | ||||
* @param message 错误消息 | * @param message 错误消息 | ||||
* @return 响应对象 | * @return 响应对象 | ||||
@@ -83,4 +113,4 @@ public class ApiResponse<T> { | |||||
public static <T> ApiResponse<T> error(Integer code, String message) { | public static <T> ApiResponse<T> error(Integer code, String message) { | ||||
return new ApiResponse<>(code, message); | return new ApiResponse<>(code, message); | ||||
} | } | ||||
} | |||||
} |
@@ -1,8 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 基础分页DTO | ||||
@@ -10,31 +8,63 @@ import lombok.Data; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@ApiModel(description = "基础分页参数") | |||||
@Schema(description = "基础分页参数") | |||||
public class BasePageDTO { | public class BasePageDTO { | ||||
/** | /** | ||||
* 页码(从0开始) | * 页码(从0开始) | ||||
*/ | */ | ||||
@ApiModelProperty(value = "页码(从0开始)", example = "0", notes = "默认为0") | |||||
@Schema(description = "页码(从0开始)", example = "0") | |||||
private Integer page = 0; | private Integer page = 0; | ||||
/** | /** | ||||
* 每页大小 | * 每页大小 | ||||
*/ | */ | ||||
@ApiModelProperty(value = "每页大小", example = "10", notes = "默认为10") | |||||
@Schema(description = "每页大小", example = "10") | |||||
private Integer size = 10; | private Integer size = 10; | ||||
/** | /** | ||||
* 排序字段 | * 排序字段 | ||||
*/ | */ | ||||
@ApiModelProperty(value = "排序字段", example = "id", notes = "可选") | |||||
@Schema(description = "排序字段", example = "id") | |||||
private String sortBy; | private String sortBy; | ||||
/** | /** | ||||
* 排序方向(asc/desc) | * 排序方向(asc/desc) | ||||
*/ | */ | ||||
@ApiModelProperty(value = "排序方向", example = "asc", notes = "可选值:asc(升序)、desc(降序),默认为asc") | |||||
@Schema(description = "排序方向", example = "asc") | |||||
private String sortDirection = "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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 图片信息查询条件DTO | ||||
@@ -11,23 +8,62 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "图片信息查询条件数据传输对象") | |||||
@Schema(description = "图片信息查询条件数据传输对象") | |||||
public class ImageInfoQueryDTO extends BasePageDTO { | public class ImageInfoQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "文件名", example = "image001", notes = "支持模糊查询") | |||||
@Schema(description = "文件名", example = "image001") | |||||
private String fileName; | private String fileName; | ||||
@ApiModelProperty(value = "文件扩展名", example = "jpg", notes = "精确匹配") | |||||
@Schema(description = "文件扩展名", example = "jpg") | |||||
private String fileExtension; | private String fileExtension; | ||||
@ApiModelProperty(value = "MIME类型", example = "image/jpeg", notes = "精确匹配") | |||||
@Schema(description = "MIME类型", example = "image/jpeg") | |||||
private String mimeType; | private String mimeType; | ||||
@ApiModelProperty(value = "文件大小最小值(字节)", example = "1024", notes = "单位:字节") | |||||
@Schema(description = "文件大小最小值(字节)", example = "1024") | |||||
private Long fileSizeMin; | private Long fileSizeMin; | ||||
@ApiModelProperty(value = "文件大小最大值(字节)", example = "1048576", notes = "单位:字节") | |||||
@Schema(description = "文件大小最大值(字节)", example = "1048576") | |||||
private Long fileSizeMax; | private Long fileSizeMax; | ||||
} | |||||
// 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; | |||||
} | |||||
} |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 品种信息查询条件DTO | ||||
@@ -11,17 +8,40 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "品种信息查询条件数据传输对象") | |||||
@Schema(description = "品种信息查询条件数据传输对象") | |||||
public class MaterialInfoQueryDTO extends BasePageDTO { | public class MaterialInfoQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "品种编码", example = "M001", notes = "支持模糊查询") | |||||
@Schema(description = "品种编码", example = "M001") | |||||
private String code; // 品种编码(模糊查询) | private String code; // 品种编码(模糊查询) | ||||
@ApiModelProperty(value = "品种名称", example = "钢材", notes = "支持模糊查询") | |||||
@Schema(description = "品种名称", example = "钢材") | |||||
private String name; // 品种名称(模糊查询) | private String name; // 品种名称(模糊查询) | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean activate; // 激活状态 | 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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 供应商信息查询条件DTO | ||||
@@ -11,20 +8,51 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "供应商信息查询条件数据传输对象") | |||||
@Schema(description = "供应商信息查询条件数据传输对象") | |||||
public class SupplierQueryDTO extends BasePageDTO { | public class SupplierQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "供应商编码", example = "SUP001", notes = "支持模糊查询") | |||||
@Schema(description = "供应商编码", example = "SUP001") | |||||
private String code; // 供应商编码(模糊查询) | private String code; // 供应商编码(模糊查询) | ||||
@ApiModelProperty(value = "供应商名称", example = "福泉供应商", notes = "支持模糊查询") | |||||
@Schema(description = "供应商名称", example = "福泉供应商") | |||||
private String name; // 供应商名称(模糊查询) | private String name; // 供应商名称(模糊查询) | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean active; // 激活状态 | private Boolean active; // 激活状态 | ||||
@ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") | |||||
@Schema(description = "备注", example = "长期合作伙伴") | |||||
private String remark; // 备注(模糊查询) | 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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 供应标识品种信息查询条件DTO | ||||
@@ -11,17 +8,40 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "供应标识品种信息查询条件数据传输对象") | |||||
@Schema(description = "供应标识品种信息查询条件数据传输对象") | |||||
public class SupplyVarietyQueryDTO extends BasePageDTO { | public class SupplyVarietyQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer supplyId; // 供应商ID | private Integer supplyId; // 供应商ID | ||||
@ApiModelProperty(value = "品种ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "品种ID", example = "1") | |||||
private Integer good; // 品种ID | private Integer good; // 品种ID | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean active; // 激活状态 | 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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 转运记录查询条件DTO | ||||
@@ -11,31 +8,86 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "转运记录查询条件数据传输对象") | |||||
@Schema(description = "转运记录查询条件数据传输对象") | |||||
public class TransferRecordQueryDTO extends BasePageDTO { | public class TransferRecordQueryDTO extends BasePageDTO { | ||||
// 基础查询条件(支持模糊查询) | // 基础查询条件(支持模糊查询) | ||||
@ApiModelProperty(value = "单据号", example = "TR20230501001", notes = "支持模糊查询") | |||||
@Schema(description = "单据号", example = "TR20230501001") | |||||
private String billNo; | private String billNo; | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") | |||||
@Schema(description = "车牌号", example = "京A12345") | |||||
private String vehicleNo; | private String vehicleNo; | ||||
@ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") | |||||
@Schema(description = "卡号", example = "C0001") | |||||
private String cardNo; | private String cardNo; | ||||
// 精确匹配查询 | // 精确匹配查询 | ||||
@ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "物料ID", example = "1") | |||||
private Integer materielId; | private Integer materielId; | ||||
@ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "收货公司ID", example = "1") | |||||
private Integer receiveCompanyId; | private Integer receiveCompanyId; | ||||
@ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "转运公司ID", example = "1") | |||||
private Integer transitCompanyId; | private Integer transitCompanyId; | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer supplyId; | 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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 运输公司查询条件DTO | ||||
@@ -11,14 +8,29 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "运输公司查询条件数据传输对象") | |||||
@Schema(description = "运输公司查询条件数据传输对象") | |||||
public class TransportCompanyQueryDTO extends BasePageDTO { | public class TransportCompanyQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "公司名称", example = "福泉物流", notes = "支持模糊查询") | |||||
@Schema(description = "公司名称", example = "福泉物流") | |||||
private String name; // 公司名称(模糊查询) | private String name; // 公司名称(模糊查询) | ||||
@ApiModelProperty(value = "备注", example = "长期合作伙伴", notes = "支持模糊查询") | |||||
@Schema(description = "备注", example = "长期合作伙伴") | |||||
private String remark; // 备注(模糊查询) | 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; | |||||
} | |||||
} | } |
@@ -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; | |||||
} | |||||
} |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 车辆信息查询条件DTO | ||||
@@ -11,29 +8,84 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "车辆信息查询条件数据传输对象") | |||||
@Schema(description = "车辆信息查询条件数据传输对象") | |||||
public class VehicleInfoQueryDTO extends BasePageDTO { | public class VehicleInfoQueryDTO extends BasePageDTO { | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") | |||||
@Schema(description = "车牌号", example = "京A12345") | |||||
private String licensePlate; // 车牌号(模糊查询) | private String licensePlate; // 车牌号(模糊查询) | ||||
@ApiModelProperty(value = "车辆类型", example = "货车", notes = "精确匹配") | |||||
@Schema(description = "车辆类型", example = "货车") | |||||
private String type; // 车辆类型 | private String type; // 车辆类型 | ||||
@ApiModelProperty(value = "停用状态", example = "false", notes = "true=已停用,false=未停用") | |||||
@Schema(description = "停用状态", example = "false") | |||||
private Boolean outage; // 停用状态 | private Boolean outage; // 停用状态 | ||||
@ApiModelProperty(value = "锁定状态", example = "false", notes = "true=已锁定,false=未锁定") | |||||
@Schema(description = "锁定状态", example = "false") | |||||
private Boolean lock; // 锁定状态 | private Boolean lock; // 锁定状态 | ||||
@ApiModelProperty(value = "运输公司ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "运输公司ID", example = "1") | |||||
private Integer transCompany; // 运输公司ID | private Integer transCompany; // 运输公司ID | ||||
@ApiModelProperty(value = "审核状态", example = "true", notes = "true=已审核,false=未审核") | |||||
@Schema(description = "审核状态", example = "true") | |||||
private Boolean reviewed; // 审核状态 | private Boolean reviewed; // 审核状态 | ||||
@ApiModelProperty(value = "备注", example = "新购车辆", notes = "支持模糊查询") | |||||
@Schema(description = "备注", example = "新购车辆") | |||||
private String remarks; // 备注(模糊查询) | 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; | |||||
} | |||||
} | } |
@@ -1,9 +1,6 @@ | |||||
package com.example.webapi.dto; | 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 | * 称重记录查询条件DTO | ||||
@@ -11,49 +8,152 @@ import lombok.EqualsAndHashCode; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(description = "称重记录查询条件数据传输对象") | |||||
@Schema(description = "称重记录查询条件数据传输对象") | |||||
public class WeighingRecordQueryDTO extends BasePageDTO { | public class WeighingRecordQueryDTO extends BasePageDTO { | ||||
// 基础查询条件(支持模糊查询) | // 基础查询条件(支持模糊查询) | ||||
@ApiModelProperty(value = "单据号", example = "BL20230501001", notes = "支持模糊查询") | |||||
@Schema(description = "单据号", example = "BL20230501001") | |||||
private String billNo; | private String billNo; | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", notes = "支持模糊查询") | |||||
@Schema(description = "车牌号", example = "京A12345") | |||||
private String vehicleNo; | private String vehicleNo; | ||||
@ApiModelProperty(value = "卡号", example = "C0001", notes = "支持模糊查询") | |||||
@Schema(description = "卡号", example = "C0001") | |||||
private String cardNo; | private String cardNo; | ||||
@ApiModelProperty(value = "RFID号", example = "RF0001", notes = "支持模糊查询") | |||||
@Schema(description = "RFID号", example = "RF0001") | |||||
private String rfidNo; | private String rfidNo; | ||||
@ApiModelProperty(value = "开单人", example = "张三", notes = "支持模糊查询") | |||||
@Schema(description = "开单人", example = "张三") | |||||
private String issuedBy; | private String issuedBy; | ||||
@ApiModelProperty(value = "毛重操作人", example = "李四", notes = "支持模糊查询") | |||||
@Schema(description = "毛重操作人", example = "李四") | |||||
private String gwBy; | private String gwBy; | ||||
@ApiModelProperty(value = "皮重操作人", example = "王五", notes = "支持模糊查询") | |||||
@Schema(description = "皮重操作人", example = "王五") | |||||
private String tBy; | private String tBy; | ||||
// 精确匹配查询 | // 精确匹配查询 | ||||
@ApiModelProperty(value = "物料ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "物料ID", example = "1") | |||||
private Integer materielId; | private Integer materielId; | ||||
@ApiModelProperty(value = "仓库ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "仓库ID", example = "1") | |||||
private Integer warehouseId; | private Integer warehouseId; | ||||
@ApiModelProperty(value = "收货公司ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "收货公司ID", example = "1") | |||||
private Integer receiveCompanyId; | private Integer receiveCompanyId; | ||||
@ApiModelProperty(value = "转运公司ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "转运公司ID", example = "1") | |||||
private Integer transitCompanyId; | private Integer transitCompanyId; | ||||
@ApiModelProperty(value = "车辆ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "车辆ID", example = "1") | |||||
private Integer vehicleId; | private Integer vehicleId; | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "精确匹配") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer supplyId; | 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; | |||||
} | |||||
} | } |
@@ -1,45 +1,99 @@ | |||||
package com.example.webapi.entity; | 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.Entity; | ||||
import jakarta.persistence.*; | import jakarta.persistence.*; | ||||
import lombok.Data; | |||||
import java.util.Date; | import java.util.Date; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "图片信息表") | @Table(name = "图片信息表") | ||||
@ApiModel(description = "图片信息实体") | |||||
@Schema(description = "图片信息实体") | |||||
public class ImageInfo { | public class ImageInfo { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "id") | @Column(name = "id") | ||||
@ApiModelProperty(value = "图片ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "图片ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "FileName", length = 255, nullable = false) | @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; | private String fileName; | ||||
@Column(name = "FileExtension", length = 10, nullable = false) | @Column(name = "FileExtension", length = 10, nullable = false) | ||||
@ApiModelProperty(value = "文件扩展名", example = "jpg", required = true) | |||||
@Schema(description = "文件扩展名", example = "jpg", required = true) | |||||
private String fileExtension; | private String fileExtension; | ||||
@Column(name = "MimeType ", length = 50, nullable = false) | @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; | private String mimeType; | ||||
@Lob | @Lob | ||||
@Column(name = "ImageData", nullable = false) | @Column(name = "ImageData", nullable = false) | ||||
@ApiModelProperty(value = "图片二进制数据", required = true, hidden = true) | |||||
@Schema(description = "图片二进制数据", required = true, hidden = true) | |||||
private byte[] imageData; | private byte[] imageData; | ||||
@Column(name = "FileSize", nullable = false) | @Column(name = "FileSize", nullable = false) | ||||
@ApiModelProperty(value = "文件大小(字节)", example = "102400", required = true, notes = "单位:字节") | |||||
@Schema(description = "文件大小(字节)", example = "102400", required = true) | |||||
private Long fileSize; | private Long fileSize; | ||||
@Column(name = "UploadTime", nullable = false) | @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; | 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; | |||||
} | |||||
} | } |
@@ -1,30 +1,60 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "品种信息表") | @Table(name = "品种信息表") | ||||
@ApiModel(description = "品种信息实体") | |||||
@Schema(description = "品种信息实体") | |||||
public class MaterialInfo { | public class MaterialInfo { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "品种ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "品种ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "Code", length = 30, nullable = false) | @Column(name = "Code", length = 30, nullable = false) | ||||
@ApiModelProperty(value = "品种编码", example = "M001", required = true) | |||||
@Schema(description = "品种编码", example = "M001", required = true) | |||||
private String code; | private String code; | ||||
@Column(name = "Name", length = 50, nullable = false) | @Column(name = "Name", length = 50, nullable = false) | ||||
@ApiModelProperty(value = "品种名称", example = "钢材", required = true) | |||||
@Schema(description = "品种名称", example = "钢材", required = true) | |||||
private String name; | private String name; | ||||
@Column(name = "Activate", nullable = false) | @Column(name = "Activate", nullable = false) | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean activate; | 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; | |||||
} | |||||
} | } |
@@ -1,34 +1,72 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "供应商信息表") | @Table(name = "供应商信息表") | ||||
@ApiModel(description = "供应商信息实体") | |||||
@Schema(description = "供应商信息实体") | |||||
public class Supplier { | public class Supplier { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "Code", length = 50, nullable = false) | @Column(name = "Code", length = 50, nullable = false) | ||||
@ApiModelProperty(value = "供应商编码", example = "SUP001", required = true) | |||||
@Schema(description = "供应商编码", example = "SUP001", required = true) | |||||
private String code; | private String code; | ||||
@Column(name = "Name", length = 100, nullable = false) | @Column(name = "Name", length = 100, nullable = false) | ||||
@ApiModelProperty(value = "供应商名称", example = "福泉供应商", required = true) | |||||
@Schema(description = "供应商名称", example = "福泉供应商", required = true) | |||||
private String name; | private String name; | ||||
@Column(name = "Active") | @Column(name = "Active") | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean active; | private Boolean active; | ||||
@Column(name = "Remark", length = 300) | @Column(name = "Remark", length = 300) | ||||
@ApiModelProperty(value = "备注", example = "长期合作伙伴") | |||||
@Schema(description = "备注", example = "长期合作伙伴") | |||||
private String remark; | 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; | |||||
} | |||||
} | } |
@@ -1,30 +1,60 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "供应标识品种信息") | @Table(name = "供应标识品种信息") | ||||
@ApiModel(description = "供应标识品种信息实体") | |||||
@Schema(description = "供应标识品种信息实体") | |||||
public class SupplyVariety { | public class SupplyVariety { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "记录ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "SupplyID", nullable = false) | @Column(name = "SupplyID", nullable = false) | ||||
@ApiModelProperty(value = "供应商ID", example = "1", required = true, notes = "关联供应商信息") | |||||
@Schema(description = "供应商ID", example = "1", required = true) | |||||
private Integer supplyId; | private Integer supplyId; | ||||
@Column(name = "Good", nullable = false) | @Column(name = "Good", nullable = false) | ||||
@ApiModelProperty(value = "品种ID", example = "1", required = true, notes = "关联品种信息") | |||||
@Schema(description = "品种ID", example = "1", required = true) | |||||
private Integer good; | private Integer good; | ||||
@Column(name = "Active") | @Column(name = "Active") | ||||
@ApiModelProperty(value = "激活状态", example = "true", notes = "true=激活,false=未激活") | |||||
@Schema(description = "激活状态", example = "true") | |||||
private Boolean active; | 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; | |||||
} | |||||
} | } |
@@ -1,77 +1,194 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.util.Date; | import java.util.Date; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "转运记录表") | @Table(name = "转运记录表") | ||||
@ApiModel(description = "转运记录实体") | |||||
@Schema(description = "转运记录实体") | |||||
public class TransferRecord { | public class TransferRecord { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "记录ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "Materiel_ID") | @Column(name = "Materiel_ID") | ||||
@ApiModelProperty(value = "物料ID", example = "1", notes = "关联物料信息") | |||||
@Schema(description = "物料ID", example = "1") | |||||
private Integer materielId; | private Integer materielId; | ||||
@Column(name = "Receive_Company_ID") | @Column(name = "Receive_Company_ID") | ||||
@ApiModelProperty(value = "收货公司ID", example = "1", notes = "关联收货公司信息") | |||||
@Schema(description = "收货公司ID", example = "1") | |||||
private Integer receiveCompanyId; | private Integer receiveCompanyId; | ||||
@Column(name = "Transit_Company_ID") | @Column(name = "Transit_Company_ID") | ||||
@ApiModelProperty(value = "转运公司ID", example = "1", notes = "关联转运公司信息") | |||||
@Schema(description = "转运公司ID", example = "1") | |||||
private Integer transitCompanyId; | private Integer transitCompanyId; | ||||
@Column(name = "Bill_NO", length = 50, nullable = false) | @Column(name = "Bill_NO", length = 50, nullable = false) | ||||
@ApiModelProperty(value = "单据号", example = "TR20230501001", required = true) | |||||
@Schema(description = "单据号", example = "TR20230501001", required = true) | |||||
private String billNo; | private String billNo; | ||||
@Column(name = "Supply_ID") | @Column(name = "Supply_ID") | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "关联供应商信息") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer supplyId; | private Integer supplyId; | ||||
@Column(name = "Card_NO", length = 8) | @Column(name = "Card_NO", length = 8) | ||||
@ApiModelProperty(value = "卡号", example = "C0001") | |||||
@Schema(description = "卡号", example = "C0001") | |||||
private String cardNo; | private String cardNo; | ||||
@Column(name = "Vehicle_NO", length = 15, nullable = false) | @Column(name = "Vehicle_NO", length = 15, nullable = false) | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", required = true) | |||||
@Schema(description = "车牌号", example = "京A12345", required = true) | |||||
private String vehicleNo; | private String vehicleNo; | ||||
@Column(name = "Issued_Time") | @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; | private Date issuedTime; | ||||
@Column(name = "GW", precision = 18, scale = 4) | @Column(name = "GW", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "毛重(kg)", example = "5000.5", notes = "单位:千克") | |||||
@Schema(description = "毛重(kg)", example = "5000.5") | |||||
private BigDecimal gw; | private BigDecimal gw; | ||||
@Column(name = "T", precision = 18, scale = 4) | @Column(name = "T", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "皮重(kg)", example = "1000.5", notes = "单位:千克") | |||||
@Schema(description = "皮重(kg)", example = "1000.5") | |||||
private BigDecimal t; | private BigDecimal t; | ||||
@Column(name = "T_Time") | @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; | private Date tTime; | ||||
@Column(name = "NW", precision = 18, scale = 4) | @Column(name = "NW", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "净重(kg)", example = "4000.0", notes = "单位:千克,毛重-皮重") | |||||
@Schema(description = "净重(kg)", example = "4000.0") | |||||
private BigDecimal nw; | private BigDecimal nw; | ||||
@Column(name = "Comments", length = 500) | @Column(name = "Comments", length = 500) | ||||
@ApiModelProperty(value = "备注", example = "货物完好") | |||||
@Schema(description = "备注", example = "货物完好") | |||||
private String comments; | private String comments; | ||||
@Column(name = "status") | @Column(name = "status") | ||||
@ApiModelProperty(value = "是否已转运", example = "1", notes = "是否已转运0.否 1是") | |||||
@Schema(description = "是否已转运", example = "1") | |||||
private Integer status; | 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; | |||||
} | |||||
} | } |
@@ -1,26 +1,48 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "运输公司") | @Table(name = "运输公司") | ||||
@ApiModel(description = "运输公司实体") | |||||
@Schema(description = "运输公司实体") | |||||
public class TransportCompany { | public class TransportCompany { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "编号") | @Column(name = "编号") | ||||
@ApiModelProperty(value = "公司ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "公司ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "公司名称", length = 100) | @Column(name = "公司名称", length = 100) | ||||
@ApiModelProperty(value = "公司名称", example = "福泉物流") | |||||
@Schema(description = "公司名称", example = "福泉物流") | |||||
private String name; | private String name; | ||||
@Column(name = "备注", length = 300) | @Column(name = "备注", length = 300) | ||||
@ApiModelProperty(value = "备注", example = "长期合作伙伴") | |||||
@Schema(description = "备注", example = "长期合作伙伴") | |||||
private String remark; | 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; | |||||
} | |||||
} | } |
@@ -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; | |||||
} | |||||
} |
@@ -1,46 +1,108 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "车辆信息") | @Table(name = "车辆信息") | ||||
@ApiModel(description = "车辆信息实体") | |||||
@Schema(description = "车辆信息实体") | |||||
public class VehicleInfo { | public class VehicleInfo { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "车辆ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "车辆ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "LicensePlate", nullable = false, length = 20) | @Column(name = "LicensePlate", nullable = false, length = 20) | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", required = true) | |||||
@Schema(description = "车牌号", example = "京A12345", required = true) | |||||
private String licensePlate; | private String licensePlate; | ||||
@Column(name = "Type", length = 20) | @Column(name = "Type", length = 20) | ||||
@ApiModelProperty(value = "车辆类型", example = "货车") | |||||
@Schema(description = "车辆类型", example = "货车") | |||||
private String type; | private String type; | ||||
@Column(name = "Outage") | @Column(name = "Outage") | ||||
@ApiModelProperty(value = "停用状态", example = "false", notes = "true=已停用,false=未停用") | |||||
@Schema(description = "停用状态", example = "false") | |||||
private Boolean outage; | private Boolean outage; | ||||
@Column(name = "Lock") | @Column(name = "Lock") | ||||
@ApiModelProperty(value = "锁定状态", example = "false", notes = "true=已锁定,false=未锁定") | |||||
@Schema(description = "锁定状态", example = "false") | |||||
private Boolean lock; | private Boolean lock; | ||||
@Column(name = "TransCompany") | @Column(name = "TransCompany") | ||||
@ApiModelProperty(value = "运输公司ID", example = "1", notes = "关联运输公司信息") | |||||
@Schema(description = "运输公司ID", example = "1") | |||||
private Integer transCompany; | private Integer transCompany; | ||||
@Column(name = "Reviewed") | @Column(name = "Reviewed") | ||||
@ApiModelProperty(value = "审核状态", example = "true", notes = "true=已审核,false=未审核") | |||||
@Schema(description = "审核状态", example = "true") | |||||
private Boolean reviewed; | private Boolean reviewed; | ||||
@Column(name = "Remarks", length = 1000) | @Column(name = "Remarks", length = 1000) | ||||
@ApiModelProperty(value = "备注", example = "新购车辆") | |||||
@Schema(description = "备注", example = "新购车辆") | |||||
private String remarks; | 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; | |||||
} | |||||
} | } |
@@ -1,136 +1,374 @@ | |||||
package com.example.webapi.entity; | 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 jakarta.persistence.*; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.util.Date; | import java.util.Date; | ||||
@Data | |||||
@Entity | @Entity | ||||
@Table(name = "称重记录表") | @Table(name = "称重记录表") | ||||
@ApiModel(description = "称重记录实体") | |||||
@Schema(description = "称重记录实体") | |||||
public class WeighingRecord { | public class WeighingRecord { | ||||
@Id | @Id | ||||
@GeneratedValue(strategy = GenerationType.IDENTITY) | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
@Column(name = "ID") | @Column(name = "ID") | ||||
@ApiModelProperty(value = "记录ID", example = "1", notes = "主键,自动生成") | |||||
@Schema(description = "记录ID", example = "1") | |||||
private Integer id; | private Integer id; | ||||
@Column(name = "Materiel_ID") | @Column(name = "Materiel_ID") | ||||
@ApiModelProperty(value = "物料ID", example = "1", notes = "关联物料信息") | |||||
@Schema(description = "物料ID", example = "1") | |||||
private Integer materielId; | private Integer materielId; | ||||
@Column(name = "Warehouse_ID") | @Column(name = "Warehouse_ID") | ||||
@ApiModelProperty(value = "仓库ID", example = "1", notes = "关联仓库信息") | |||||
@Schema(description = "仓库ID", example = "1") | |||||
private Integer warehouseId; | private Integer warehouseId; | ||||
@Column(name = "Receive_Company_ID") | @Column(name = "Receive_Company_ID") | ||||
@ApiModelProperty(value = "收货公司ID", example = "1", notes = "关联收货公司信息") | |||||
@Schema(description = "收货公司ID", example = "1") | |||||
private Integer receiveCompanyId; | private Integer receiveCompanyId; | ||||
@Column(name = "Transit_Company_ID") | @Column(name = "Transit_Company_ID") | ||||
@ApiModelProperty(value = "转运公司ID", example = "1", notes = "关联转运公司信息") | |||||
@Schema(description = "转运公司ID", example = "1") | |||||
private Integer transitCompanyId; | private Integer transitCompanyId; | ||||
@Column(name = "Vehicle_ID") | @Column(name = "Vehicle_ID") | ||||
@ApiModelProperty(value = "车辆ID", example = "1", notes = "关联车辆信息") | |||||
@Schema(description = "车辆ID", example = "1") | |||||
private Integer vehicleId; | private Integer vehicleId; | ||||
@Column(name = "Bill_NO", length = 50, nullable = false) | @Column(name = "Bill_NO", length = 50, nullable = false) | ||||
@ApiModelProperty(value = "单据号", example = "BL20230501001", required = true) | |||||
@Schema(description = "单据号", example = "BL20230501001", required = true) | |||||
private String billNo; | private String billNo; | ||||
@Column(name = "Supply_ID") | @Column(name = "Supply_ID") | ||||
@ApiModelProperty(value = "供应商ID", example = "1", notes = "关联供应商信息") | |||||
@Schema(description = "供应商ID", example = "1") | |||||
private Integer supplyId; | private Integer supplyId; | ||||
@Column(name = "Card_NO", length = 8) | @Column(name = "Card_NO", length = 8) | ||||
@ApiModelProperty(value = "卡号", example = "C0001") | |||||
@Schema(description = "卡号", example = "C0001") | |||||
private String cardNo; | private String cardNo; | ||||
@Column(name = "RFID_NO", length = 30) | @Column(name = "RFID_NO", length = 30) | ||||
@ApiModelProperty(value = "RFID号", example = "RF0001") | |||||
@Schema(description = "RFID号", example = "RF0001") | |||||
private String rfidNo; | private String rfidNo; | ||||
@Column(name = "Vehicle_NO", length = 15, nullable = false) | @Column(name = "Vehicle_NO", length = 15, nullable = false) | ||||
@ApiModelProperty(value = "车牌号", example = "京A12345", required = true) | |||||
@Schema(description = "车牌号", example = "京A12345", required = true) | |||||
private String vehicleNo; | private String vehicleNo; | ||||
@Column(name = "Issued_Machine_NO", length = 50) | @Column(name = "Issued_Machine_NO", length = 50) | ||||
@ApiModelProperty(value = "开单机器编号", example = "M001") | |||||
@Schema(description = "开单机器编号", example = "M001") | |||||
private String issuedMachineNo; | private String issuedMachineNo; | ||||
@Column(name = "Issued_By", length = 20) | @Column(name = "Issued_By", length = 20) | ||||
@ApiModelProperty(value = "开单人", example = "张三") | |||||
@Schema(description = "开单人", example = "张三") | |||||
private String issuedBy; | private String issuedBy; | ||||
@Column(name = "Issued_Time") | @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; | private Date issuedTime; | ||||
@Column(name = "GW", precision = 18, scale = 4) | @Column(name = "GW", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "毛重(kg)", example = "5000.5", notes = "单位:千克") | |||||
@Schema(description = "毛重(kg)", example = "5000.5") | |||||
private BigDecimal gw; | private BigDecimal gw; | ||||
@Column(name = "GW_Scale_NO", length = 50) | @Column(name = "GW_Scale_NO", length = 50) | ||||
@ApiModelProperty(value = "毛重秤编号", example = "S001") | |||||
@Schema(description = "毛重秤编号", example = "S001") | |||||
private String gwScaleNo; | private String gwScaleNo; | ||||
@Column(name = "GW_Time") | @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; | private Date gwTime; | ||||
@Column(name = "GW_By", length = 20) | @Column(name = "GW_By", length = 20) | ||||
@ApiModelProperty(value = "毛重操作人", example = "李四") | |||||
@Schema(description = "毛重操作人", example = "李四") | |||||
private String gwBy; | private String gwBy; | ||||
@Column(name = "T", precision = 18, scale = 4) | @Column(name = "T", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "皮重(kg)", example = "1000.5", notes = "单位:千克") | |||||
@Schema(description = "皮重(kg)", example = "1000.5") | |||||
private BigDecimal t; | private BigDecimal t; | ||||
@Column(name = "T_Scale_NO", length = 50) | @Column(name = "T_Scale_NO", length = 50) | ||||
@ApiModelProperty(value = "皮重秤编号", example = "S002") | |||||
@Schema(description = "皮重秤编号", example = "S002") | |||||
private String tScaleNo; | private String tScaleNo; | ||||
@Column(name = "T_Time") | @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; | private Date tTime; | ||||
@Column(name = "T_By", length = 20) | @Column(name = "T_By", length = 20) | ||||
@ApiModelProperty(value = "皮重操作人", example = "王五") | |||||
@Schema(description = "皮重操作人", example = "王五") | |||||
private String tBy; | private String tBy; | ||||
@Column(name = "NW", precision = 18, scale = 4) | @Column(name = "NW", precision = 18, scale = 4) | ||||
@ApiModelProperty(value = "净重(kg)", example = "4000.0", notes = "单位:千克,毛重-皮重") | |||||
@Schema(description = "净重(kg)", example = "4000.0") | |||||
private BigDecimal nw; | private BigDecimal nw; | ||||
@Column(name = "Comments", length = 500) | @Column(name = "Comments", length = 500) | ||||
@ApiModelProperty(value = "备注", example = "货物完好") | |||||
@Schema(description = "备注", example = "货物完好") | |||||
private String comments; | private String comments; | ||||
@Column(name = "Operate_Time") | @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; | private Date operateTime; | ||||
@Column(name = "Arrival_Time") | @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; | private Date arrivalTime; | ||||
@Column(name = "Leave_Time") | @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; | private Date leaveTime; | ||||
@Column(name = "Pic01") | @Column(name = "Pic01") | ||||
@ApiModelProperty(value = "图片1ID", example = "101") | |||||
@Schema(description = "图片1ID", example = "101") | |||||
private Integer pic01; | private Integer pic01; | ||||
@Column(name = "Pic02") | @Column(name = "Pic02") | ||||
@ApiModelProperty(value = "图片2ID", example = "102") | |||||
@Schema(description = "图片2ID", example = "102") | |||||
private Integer pic02; | private Integer pic02; | ||||
@Column(name = "WTId") | @Column(name = "WTId") | ||||
@ApiModelProperty(value = "称重类型ID", example = "1") | |||||
@Schema(description = "称重类型ID", example = "1") | |||||
private Integer wtId; | 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; | |||||
} | |||||
} | } |
@@ -4,6 +4,8 @@ import com.example.webapi.util.SignatureUtil; | |||||
import jakarta.servlet.http.HttpServletRequest; | import jakarta.servlet.http.HttpServletRequest; | ||||
import jakarta.servlet.http.HttpServletResponse; | import jakarta.servlet.http.HttpServletResponse; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.web.method.HandlerMethod; | import org.springframework.web.method.HandlerMethod; | ||||
@@ -22,10 +24,11 @@ import java.util.Objects; | |||||
* @author Your Name | * @author Your Name | ||||
* @version 1.0.0 | * @version 1.0.0 | ||||
*/ | */ | ||||
@Slf4j | |||||
@Component | @Component | ||||
public class SignatureInterceptor implements HandlerInterceptor { | public class SignatureInterceptor implements HandlerInterceptor { | ||||
private static final Logger log = LoggerFactory.getLogger(SignatureInterceptor.class); | |||||
@Value("${api.client.ak}") | @Value("${api.client.ak}") | ||||
private String configAk; | private String configAk; | ||||
@@ -37,19 +40,27 @@ public class SignatureInterceptor implements HandlerInterceptor { | |||||
@Override | @Override | ||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | 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) { | // if (ak == null || timestamp == null || signature == null) { | ||||
// log.error("缺少必要的请求头: ak={}, timestamp={}, signature={}", ak, timestamp, signature); | // log.error("缺少必要的请求头: ak={}, timestamp={}, signature={}", ak, timestamp, signature); | ||||
@@ -82,8 +93,8 @@ public class SignatureInterceptor implements HandlerInterceptor { | |||||
// response.getWriter().write("Invalid signature"); | // response.getWriter().write("Invalid signature"); | ||||
// return false; | // return false; | ||||
// } | // } | ||||
// | |||||
// log.debug("签名验证成功,用户: {}", ak); | |||||
log.debug("签名验证成功,用户: {}", ak); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -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<TwiceWeighing, String>, JpaSpecificationExecutor<TwiceWeighing> { | |||||
/** | |||||
* 根据车号查询记录 | |||||
* | |||||
* @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); | |||||
} |
@@ -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<TwiceWeighing> findByConditions(TwiceWeighingQueryDTO queryDTO) { | |||||
// 构建分页和排序 | |||||
Pageable pageable = buildPageable(queryDTO); | |||||
// 构建查询条件 | |||||
Specification<TwiceWeighing> spec = buildSpecification(queryDTO); | |||||
return repository.findAll(spec, pageable); | |||||
} | |||||
/** | |||||
* 根据ID查询二次称重记录 | |||||
* | |||||
* @param id 记录ID | |||||
* @return 二次称重记录 | |||||
*/ | |||||
public Optional<TwiceWeighing> 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<TwiceWeighing> buildSpecification(TwiceWeighingQueryDTO queryDTO) { | |||||
return (root, query, criteriaBuilder) -> { | |||||
List<Predicate> 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])); | |||||
}; | |||||
} | |||||
} |
@@ -7,9 +7,10 @@ spring: | |||||
application: | application: | ||||
name: fuquanapi | name: fuquanapi | ||||
datasource: | 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 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | ||||
jpa: | jpa: | ||||
hibernate: | hibernate: | ||||