feat:搭建基础模块,新增物流信息、基础分类功能
This commit is contained in:
49
nl-module-base/nl-module-base-api/pom.xml
Normal file
49
nl-module-base/nl-module-base-api/pom.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.nl.cloud</groupId>
|
||||
<artifactId>nl-module-base</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>nl-module-base-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
base模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.nl.cloud</groupId>
|
||||
<artifactId>nl-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId> <!-- 接口文档:使用最新版本的 Swagger 模型 -->
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.code.nl.module.base.api.materialbase;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.module.base.api.materialbase.dto.MaterialBaseListReqDTO;
|
||||
import cn.code.nl.module.base.api.materialbase.dto.MaterialBaseRespDTO;
|
||||
import cn.code.nl.module.base.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.code.nl.module.base.api.materialbase.MaterialBaseApi.PREFIX;
|
||||
|
||||
/**
|
||||
* RPC 服务 - 物料基本信息
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 物料基本信息")
|
||||
public interface MaterialBaseApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/material-base";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "根据物料 ID 查询物料")
|
||||
@Parameter(name = "id", description = "物料标识", example = "1", required = true)
|
||||
CommonResult<MaterialBaseRespDTO> getMaterialBase(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/list")
|
||||
@Operation(summary = "根据条件查询物料列表")
|
||||
CommonResult<List<MaterialBaseRespDTO>> getMaterialBaseList(@Valid @RequestBody MaterialBaseListReqDTO reqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/getByCode")
|
||||
@Operation(summary = "根据物料编码查询物料")
|
||||
@Parameter(name = "materialCode", description = "物料编码", example = "MAT001", required = true)
|
||||
CommonResult<MaterialBaseRespDTO> getMaterialBaseByCode(@RequestParam("materialCode") String materialCode);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.code.nl.module.base.api.materialbase.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* RPC 服务 - 物料基本信息列表查询 Request DTO
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 物料基本信息列表查询 Request DTO")
|
||||
@Data
|
||||
public class MaterialBaseListReqDTO {
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String materialSpec;
|
||||
|
||||
@Schema(description = "型号")
|
||||
private String materialModel;
|
||||
|
||||
@Schema(description = "外文名称")
|
||||
private String englishName;
|
||||
|
||||
@Schema(description = "基本计量单位")
|
||||
private Long baseUnitId;
|
||||
|
||||
@Schema(description = "辅助计量单位")
|
||||
private Long assUnitId;
|
||||
|
||||
@Schema(description = "批准文号")
|
||||
private String approveFileno;
|
||||
|
||||
@Schema(description = "工程图号")
|
||||
private String printNo;
|
||||
|
||||
@Schema(description = "物料分类标识")
|
||||
private Long materialTypeId;
|
||||
|
||||
@Schema(description = "长度单位")
|
||||
private Long lenUnitId;
|
||||
|
||||
@Schema(description = "物料长度")
|
||||
private BigDecimal length;
|
||||
|
||||
@Schema(description = "物料宽度")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "物料高度")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "重量单位")
|
||||
private Long weightUnitId;
|
||||
|
||||
@Schema(description = "物料毛重")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
@Schema(description = "物料净重")
|
||||
private BigDecimal netWeight;
|
||||
|
||||
@Schema(description = "体积单位")
|
||||
private Long cubageUnitId;
|
||||
|
||||
@Schema(description = "物料体积")
|
||||
private BigDecimal cubage;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private String isUsed;
|
||||
|
||||
@Schema(description = "外部标识")
|
||||
private String extId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.code.nl.module.base.api.materialbase.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* RPC 服务 - 物料基本信息 Response DTO
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 物料基本信息 Response DTO")
|
||||
@Data
|
||||
public class MaterialBaseRespDTO {
|
||||
|
||||
@Schema(description = "物料标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "31653")
|
||||
private Long materialId;
|
||||
|
||||
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String materialCode;
|
||||
|
||||
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "螺丝")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String materialSpec;
|
||||
|
||||
@Schema(description = "型号")
|
||||
private String materialModel;
|
||||
|
||||
@Schema(description = "外文名称")
|
||||
private String englishName;
|
||||
|
||||
@Schema(description = "基本计量单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "30034")
|
||||
private Long baseUnitId;
|
||||
|
||||
@Schema(description = "辅助计量单位", example = "25021")
|
||||
private Long assUnitId;
|
||||
|
||||
@Schema(description = "批准文号")
|
||||
private String approveFileno;
|
||||
|
||||
@Schema(description = "工程图号")
|
||||
private String printNo;
|
||||
|
||||
@Schema(description = "物料分类标识", example = "14118")
|
||||
private Long materialTypeId;
|
||||
|
||||
@Schema(description = "长度单位", example = "18116")
|
||||
private Long lenUnitId;
|
||||
|
||||
@Schema(description = "物料长度")
|
||||
private BigDecimal length;
|
||||
|
||||
@Schema(description = "物料宽度")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "物料高度")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "重量单位", example = "26847")
|
||||
private Long weightUnitId;
|
||||
|
||||
@Schema(description = "物料毛重")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
@Schema(description = "物料净重")
|
||||
private BigDecimal netWeight;
|
||||
|
||||
@Schema(description = "体积单位", example = "32284")
|
||||
private Long cubageUnitId;
|
||||
|
||||
@Schema(description = "物料体积")
|
||||
private BigDecimal cubage;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "启用时间")
|
||||
private String isUsedTime;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String isUsed;
|
||||
|
||||
@Schema(description = "外部标识", example = "3240")
|
||||
private String extId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.code.nl.module.base.enums;
|
||||
|
||||
import cn.code.nl.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "base-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/base";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.code.nl.module.base.enums;
|
||||
|
||||
import cn.code.nl.framework.common.exception.ErrorCode;
|
||||
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 物料基本信息 ==========
|
||||
ErrorCode MATERIAL_BASE_NOT_EXISTS = new ErrorCode(1, "物料基本信息不存在");
|
||||
|
||||
// ========== 基础数据分类标准 ==========
|
||||
ErrorCode CLASS_STANDARD_NOT_EXISTS = new ErrorCode(2, "基础数据分类标准不存在");
|
||||
ErrorCode CLASSSTANDARD_NAME_DUPLICATE = new ErrorCode(3, "同级别下已存在同名的分类标准");
|
||||
ErrorCode CLASSSTANDARD_PARENT_NOT_EXISTS = new ErrorCode(4, "父分类不存在");
|
||||
ErrorCode CLASSSTANDARD_PARENT_ERROR = new ErrorCode(5, "不能设置自己为父分类");
|
||||
ErrorCode CLASSSTANDARD_PARENT_IS_CHILD = new ErrorCode(6, "不能设置自己的子分类为父分类");
|
||||
ErrorCode CLASSSTANDARD_EXISTS_CHILDREN = new ErrorCode(7, "存在子分类,无法删除");
|
||||
}
|
||||
Reference in New Issue
Block a user