From 50f9e476309cb6f3f59101f9c3e52cbf44400ae7 Mon Sep 17 00:00:00 2001 From: liejiu946 Date: Mon, 20 Jul 2026 10:36:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9ELMS=20=E7=94=9F=E7=AE=94?= =?UTF-8?q?=E7=82=B9=E4=BD=8D=E5=BA=93=E5=AD=98=E7=AE=A1=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/module/lms/enums/ApiConstants.java | 23 ++ .../module/lms/enums/ErrorCodeConstants.java | 14 ++ .../RawFoilPointIVTController.java | 104 +++++++++ .../vo/RawFoilPointIVTPageReqVO.java | 34 +++ .../vo/RawFoilPointIVTRespVO.java | 66 ++++++ .../vo/RawFoilPointIVTSaveReqVO.java | 54 +++++ .../rawfoilpointivt/RawFoilPointIVTDO.java | 56 +++++ .../RawFoilPointIVTMapper.java | 31 +++ .../config/SecurityConfiguration.java | 118 ++++++++++ .../RawFoilPointIVTService.java | 62 +++++ .../RawFoilPointIVTServiceImpl.java | 86 +++++++ .../rawfoilpointivt/RawFoilPointIVTMapper.xml | 12 + .../src/api/lms/rawfoilpointivt/index.ts | 66 ++++++ .../src/views/lms/rawfoilpointivt/data.ts | 220 ++++++++++++++++++ .../src/views/lms/rawfoilpointivt/index.vue | 186 +++++++++++++++ .../lms/rawfoilpointivt/modules/form.vue | 82 +++++++ 16 files changed, 1214 insertions(+) create mode 100644 nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ApiConstants.java create mode 100644 nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/RawFoilPointIVTController.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTPageReqVO.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTRespVO.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTSaveReqVO.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/rawfoilpointivt/RawFoilPointIVTDO.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/rawfoilpointivt/RawFoilPointIVTMapper.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/security/config/SecurityConfiguration.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTService.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTServiceImpl.java create mode 100644 nl-module-lms/nl-module-lms-server/src/main/resources/mapper/rawfoilpointivt/RawFoilPointIVTMapper.xml create mode 100644 nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/rawfoilpointivt/index.ts create mode 100644 nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/data.ts create mode 100644 nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/index.vue create mode 100644 nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/modules/form.vue diff --git a/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ApiConstants.java b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ApiConstants.java new file mode 100644 index 00000000..0181ff96 --- /dev/null +++ b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ApiConstants.java @@ -0,0 +1,23 @@ +package cn.code.nl.module.lms.enums; + +import cn.code.nl.framework.common.enums.RpcConstants; + +/** + * API 相关的枚举 + * + * @author zhouz + */ +public class ApiConstants { + + /** + * 服务名 + * + * 注意,需要保证和 spring.application.name 保持一致 + */ + public static final String NAME = "lms-server"; + + public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/lms"; + + public static final String VERSION = "1.0.0"; + +} diff --git a/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java new file mode 100644 index 00000000..02fd427e --- /dev/null +++ b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java @@ -0,0 +1,14 @@ +package cn.code.nl.module.lms.enums; + +import cn.code.nl.framework.common.exception.ErrorCode; + +/** + * @author dsh + * 2026/7/16 + */ +public interface ErrorCodeConstants { + + // ========== 生箔点位库存 ========== + ErrorCode RAW_FOIL_POINT_IVT_NOT_EXISTS = new ErrorCode(1, "生箔点位库存不存在"); + +} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/RawFoilPointIVTController.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/RawFoilPointIVTController.java new file mode 100644 index 00000000..8a6a6092 --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/RawFoilPointIVTController.java @@ -0,0 +1,104 @@ +package cn.code.nl.module.lms.controller.admin.rawfoilpointivt; + +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.code.nl.framework.common.pojo.PageParam; +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.framework.common.util.object.BeanUtils; +import static cn.code.nl.framework.common.pojo.CommonResult.success; + +import cn.code.nl.framework.excel.core.util.ExcelUtils; + +import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog; +import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*; +import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO; +import cn.code.nl.module.lms.service.rawfoilpointivt.RawFoilPointIVTService; + +@Tag(name = "管理后台 - 生箔点位库存") +@RestController +@RequestMapping("/lms/raw-foil-point-IVT") +@Validated +public class RawFoilPointIVTController { + + @Resource + private RawFoilPointIVTService rawFoilPointIVTService; + + @PostMapping("/create") + @Operation(summary = "创建生箔点位库存") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:create')") + public CommonResult createRawFoilPointIVT(@Valid @RequestBody RawFoilPointIVTSaveReqVO createReqVO) { + return success(rawFoilPointIVTService.createRawFoilPointIVT(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新生箔点位库存") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:update')") + public CommonResult updateRawFoilPointIVT(@Valid @RequestBody RawFoilPointIVTSaveReqVO updateReqVO) { + rawFoilPointIVTService.updateRawFoilPointIVT(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除生箔点位库存") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:delete')") + public CommonResult deleteRawFoilPointIVT(@RequestParam("id") Long id) { + rawFoilPointIVTService.deleteRawFoilPointIVT(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除生箔点位库存") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:delete')") + public CommonResult deleteRawFoilPointIVTList(@RequestParam("ids") List ids) { + rawFoilPointIVTService.deleteRawFoilPointIVTListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得生箔点位库存") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:query')") + public CommonResult getRawFoilPointIVT(@RequestParam("id") Long id) { + RawFoilPointIVTDO rawFoilPointIVT = rawFoilPointIVTService.getRawFoilPointIVT(id); + return success(BeanUtils.toBean(rawFoilPointIVT, RawFoilPointIVTRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得生箔点位库存分页") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:query')") + public CommonResult> getRawFoilPointIVTPage(@Valid RawFoilPointIVTPageReqVO pageReqVO) { + PageResult pageResult = rawFoilPointIVTService.getRawFoilPointIVTPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, RawFoilPointIVTRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出生箔点位库存 Excel") + @PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportRawFoilPointIVTExcel(@Valid RawFoilPointIVTPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = rawFoilPointIVTService.getRawFoilPointIVTPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "生箔点位库存.xls", "数据", RawFoilPointIVTRespVO.class, + BeanUtils.toBean(list, RawFoilPointIVTRespVO.class)); + } + +} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTPageReqVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTPageReqVO.java new file mode 100644 index 00000000..aadf361a --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTPageReqVO.java @@ -0,0 +1,34 @@ +package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.code.nl.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.code.nl.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 生箔点位库存分页 Request VO") +@Data +public class RawFoilPointIVTPageReqVO extends PageParam { + + @Schema(description = "点位编码") + private String pointCode; + + @Schema(description = "载具编码") + private String vehicleCode; + + @Schema(description = "生产区域") + private String productionArea; + + @Schema(description = "位置") + private String pointLocation; + + @Schema(description = "外部编码") + private String extCode; + + @Schema(description = "是否启用") + private String isUsed; + +} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTRespVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTRespVO.java new file mode 100644 index 00000000..8921ec70 --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTRespVO.java @@ -0,0 +1,66 @@ +package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import cn.idev.excel.annotation.*; + +@Schema(description = "管理后台 - 生箔点位库存 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RawFoilPointIVTRespVO { + + @Schema(description = "点位标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "31653") + @ExcelProperty("点位标识") + private Long pointId; + + @Schema(description = "点位编码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("点位编码") + private String pointCode; + + @Schema(description = "载具编码") + @ExcelProperty("载具编码") + private String vehicleCode; + + @Schema(description = "生产区域") + @ExcelProperty("生产区域") + private String productionArea; + + @Schema(description = "位置") + @ExcelProperty("位置") + private String pointLocation; + + @Schema(description = "外部编码") + @ExcelProperty("外部编码") + private String extCode; + + @Schema(description = "备注", example = "随便") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否启用") + private String isUsed; + + @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("创建人") + private String creator; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "修改人", example = "张三") + @ExcelProperty("修改人") + private String updater; + + @Schema(description = "修改时间") + @ExcelProperty("修改时间") + private LocalDateTime updateTime; + + @Schema(description = "是否删除") + @ExcelProperty("是否删除") + private String deleted; +} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTSaveReqVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTSaveReqVO.java new file mode 100644 index 00000000..5ede2773 --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/rawfoilpointivt/vo/RawFoilPointIVTSaveReqVO.java @@ -0,0 +1,54 @@ +package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 生箔点位库存新增/修改 Request VO") +@Data +public class RawFoilPointIVTSaveReqVO { + + @Schema(description = "点位标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "31653") + private Long pointId; + + @Schema(description = "点位编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "点位编码不能为空") + private String pointCode; + + @Schema(description = "载具编码") + private String vehicleCode; + + @Schema(description = "生产区域") + private String productionArea; + + @Schema(description = "位置") + private String pointLocation; + + @Schema(description = "外部编码") + private String extCode; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "是否启用不能为空") + private String isUsed; + + @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + private String creator; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + + @Schema(description = "修改人", example = "张三") + private String updater; + + @Schema(description = "修改时间") + private LocalDateTime updateTime; + + @Schema(description = "是否删除") + private String deleted; +} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/rawfoilpointivt/RawFoilPointIVTDO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/rawfoilpointivt/RawFoilPointIVTDO.java new file mode 100644 index 00000000..a6c12b50 --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/rawfoilpointivt/RawFoilPointIVTDO.java @@ -0,0 +1,56 @@ +package cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.code.nl.framework.mybatis.core.dataobject.BaseDO; + +/** + * 生箔点位库存 DO + * + * @author 诺力管理员 + */ +@TableName("lms_rawfoil_pointivt") +@KeySequence("lms_rawfoil_pointivt_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class RawFoilPointIVTDO extends BaseDO { + + /** + * 点位标识 + */ + @TableId + private Long pointId; + /** + * 点位编码 + */ + private String pointCode; + /** + * 载具编码 + */ + private String vehicleCode; + /** + * 生产区域 + */ + private String productionArea; + /** + * 位置 + */ + private String pointLocation; + /** + * 外部编码 + */ + private String extCode; + /** + * 备注 + */ + private String remark; + /** + * 是否启用 + */ + private String isUsed; + +} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/rawfoilpointivt/RawFoilPointIVTMapper.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/rawfoilpointivt/RawFoilPointIVTMapper.java new file mode 100644 index 00000000..d416fecb --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/rawfoilpointivt/RawFoilPointIVTMapper.java @@ -0,0 +1,31 @@ +package cn.code.nl.module.lms.dal.mysql.rawfoilpointivt; + +import java.util.*; + +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX; +import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO; +import org.apache.ibatis.annotations.Mapper; +import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*; + +/** + * 生箔点位库存 Mapper + * + * @author 诺力管理员 + */ +@Mapper +public interface RawFoilPointIVTMapper extends BaseMapperX { + + default PageResult selectPage(RawFoilPointIVTPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(RawFoilPointIVTDO::getPointCode, reqVO.getPointCode()) + .eqIfPresent(RawFoilPointIVTDO::getVehicleCode, reqVO.getVehicleCode()) + .eqIfPresent(RawFoilPointIVTDO::getProductionArea, reqVO.getProductionArea()) + .eqIfPresent(RawFoilPointIVTDO::getPointLocation, reqVO.getPointLocation()) + .eqIfPresent(RawFoilPointIVTDO::getExtCode, reqVO.getExtCode()) + .eqIfPresent(RawFoilPointIVTDO::getIsUsed, reqVO.getIsUsed()) + .orderByDesc(RawFoilPointIVTDO::getPointId)); + } + +} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/security/config/SecurityConfiguration.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/security/config/SecurityConfiguration.java new file mode 100644 index 00000000..7ef36b0f --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/security/config/SecurityConfiguration.java @@ -0,0 +1,118 @@ +package cn.code.nl.module.lms.framwork.security.config; + +import cn.code.nl.framework.security.config.AuthorizeRequestsCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; + +/** + * Lms 模块的 Security 配置 + * + * @author dsh + * 2026/7/16 + */ +@Configuration(proxyBeanMethods = false, value = "lmsSecurityConfiguration") +public class SecurityConfiguration { + + /* + * + * 根因确认 + + 问题出在 NlWebSecurityConfigurerAdapter.java:77-78: + + @Resource // 第77行 + private List authorizeRequestsCustomizers; + + @Resource 在处理 List 泛型注入时的行为与 @Autowired 不同: + - @Autowired 能正确按元素类型 T 解析,即使 0 个 Bean 也能注入空集合 + - @Resource 先按字段名查找,失败后按原始类型回退匹配。由于泛型擦除,类型变成了原始 java.util.List,Spring 找不到类型为 java.util.List 的 Bean,直接报错 + + 为什么 infra 模块正常? infra 模块的 SecurityConfiguration 定义了 1 个 AuthorizeRequestsCustomizer Bean,@Resource 的非空集合路径能正确处理。而 base 模块有 + 0 个这样的 Bean,触发了空集合路径的 bug。 + + 修复方式: 为 base 模块创建 SecurityConfiguration(已创建),这是该项目的标准模式(每个模块定义自己的安全配置)。 + + 现在验证修改: + + Thought for 6s, read 1 file (ctrl+o to expand) + +⏺ 配置已创建。让我验证一下文件结构是否完整: + + Thought for 5s, searched for 1 pattern (ctrl+o to expand) + +⏺ 总结 + + 问题根因 + + NlWebSecurityConfigurerAdapter.java:77-78 中使用了 @Resource 注入 List: + + @Resource + private List authorizeRequestsCustomizers; + + @Resource 在处理泛型集合时存在局限性,按字段名查找失败后会按原始类型 java.util.List 回退匹配,导致 Spring 找不到对应 Bean 而报错。@Autowired + 能正确处理这种情况(包括空集合),但 @Resource 不行。 + + 修复内容 + + 创建了 base 模块的 SecurityConfiguration(参考 infra 模块的同等配置): + + nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/framework/security/config/SecurityConfiguration.java + + 这个配置类: + 1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List 能正确解析 + 1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List 能正确解析 + + Thought for 5s, searched for 1 pattern (ctrl+o to expand) +⏺ 总结 + + 问题根因 + + NlWebSecurityConfigurerAdapter.java:77-78 中使用了 @Resource 注入 + List: + + @Resource + private List authorizeRequestsCustomizers; + + @Resource 在处理泛型集合时存在局限性,按字段名查找失败后会按原始类型 + java.util.List 回退匹配,导致 Spring 找不到对应 Bean 而报错。@Autowired + 能正确处理这种情况(包括空集合),但 @Resource 不行。 + 修复内容 + + 创建了 base 模块的 SecurityConfiguration(参考 infra 模块的同等配置): + + nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/fr + amework/security/config/SecurityConfiguration.java + + + nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/framework/security/config/SecurityConfiguration.java + + 这个配置类: + 1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List 能正确解析 + 2. 配置了 Swagger、Actuator、Druid 等公共路径的免登录访问 + 3. 遵循了项目中每个模块定义各自安全配置的标准模式 + + 3. 遵循了项目中每个模块定义各自安全配置的标准模式 + * */ + @Bean("lmsAuthorizeRequestsCustomizer") + public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { + return new AuthorizeRequestsCustomizer() { + + @Override + public void customize(AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry registry) { + // Swagger 接口文档 + registry.requestMatchers("/v3/api-docs/**").permitAll() + .requestMatchers("/webjars/**").permitAll() + .requestMatchers("/swagger-ui").permitAll() + .requestMatchers("/swagger-ui/**").permitAll(); + // Spring Boot Actuator 的安全配置 + registry.requestMatchers("/actuator").permitAll() + .requestMatchers("/actuator/**").permitAll(); + // Druid 监控 + registry.requestMatchers("/druid/**").permitAll(); + } + + }; + } + +} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTService.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTService.java new file mode 100644 index 00000000..44734659 --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTService.java @@ -0,0 +1,62 @@ +package cn.code.nl.module.lms.service.rawfoilpointivt; + +import java.util.*; +import jakarta.validation.*; +import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*; +import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO; +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.common.pojo.PageParam; + +/** + * 生箔点位库存 Service 接口 + * + * @author 诺力管理员 + */ +public interface RawFoilPointIVTService { + + /** + * 创建生箔点位库存 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createRawFoilPointIVT(@Valid RawFoilPointIVTSaveReqVO createReqVO); + + /** + * 更新生箔点位库存 + * + * @param updateReqVO 更新信息 + */ + void updateRawFoilPointIVT(@Valid RawFoilPointIVTSaveReqVO updateReqVO); + + /** + * 删除生箔点位库存 + * + * @param id 编号 + */ + void deleteRawFoilPointIVT(Long id); + + /** + * 批量删除生箔点位库存 + * + * @param ids 编号 + */ + void deleteRawFoilPointIVTListByIds(List ids); + + /** + * 获得生箔点位库存 + * + * @param id 编号 + * @return 生箔点位库存 + */ + RawFoilPointIVTDO getRawFoilPointIVT(Long id); + + /** + * 获得生箔点位库存分页 + * + * @param pageReqVO 分页查询 + * @return 生箔点位库存分页 + */ + PageResult getRawFoilPointIVTPage(RawFoilPointIVTPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTServiceImpl.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTServiceImpl.java new file mode 100644 index 00000000..cacb287e --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/rawfoilpointivt/RawFoilPointIVTServiceImpl.java @@ -0,0 +1,86 @@ +package cn.code.nl.module.lms.service.rawfoilpointivt; + +import cn.code.nl.framework.security.core.util.SecurityFrameworkUtils; +import cn.hutool.core.collection.CollUtil; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*; +import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO; +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.common.pojo.PageParam; +import cn.code.nl.framework.common.util.object.BeanUtils; + +import cn.code.nl.module.lms.dal.mysql.rawfoilpointivt.RawFoilPointIVTMapper; + +import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.code.nl.framework.common.util.collection.CollectionUtils.convertList; +import static cn.code.nl.framework.common.util.collection.CollectionUtils.diffList; +import static cn.code.nl.module.lms.enums.ErrorCodeConstants.*; + +/** + * 生箔点位库存 Service 实现类 + * + * @author 诺力管理员 + */ +@Service +@Validated +public class RawFoilPointIVTServiceImpl implements RawFoilPointIVTService { + + @Resource + private RawFoilPointIVTMapper rawFoilPointIVTMapper; + + @Override + public Long createRawFoilPointIVT(RawFoilPointIVTSaveReqVO createReqVO) { + // 插入 + RawFoilPointIVTDO rawFoilPointIVT = BeanUtils.toBean(createReqVO, RawFoilPointIVTDO.class); + rawFoilPointIVTMapper.insert(rawFoilPointIVT); + + // 返回 + return rawFoilPointIVT.getPointId(); + } + + @Override + public void updateRawFoilPointIVT(RawFoilPointIVTSaveReqVO updateReqVO) { + // 校验存在 + validateRawFoilPointIVTExists(updateReqVO.getPointId()); + // 更新 + RawFoilPointIVTDO updateObj = BeanUtils.toBean(updateReqVO, RawFoilPointIVTDO.class); + rawFoilPointIVTMapper.updateById(updateObj); + } + + @Override + public void deleteRawFoilPointIVT(Long id) { + // 校验存在 + validateRawFoilPointIVTExists(id); + // 删除 + rawFoilPointIVTMapper.deleteById(id); + } + + @Override + public void deleteRawFoilPointIVTListByIds(List ids) { + // 删除 + rawFoilPointIVTMapper.deleteByIds(ids); + } + + + private void validateRawFoilPointIVTExists(Long id) { + if (rawFoilPointIVTMapper.selectById(id) == null) { + throw exception(RAW_FOIL_POINT_IVT_NOT_EXISTS); + } + } + + @Override + public RawFoilPointIVTDO getRawFoilPointIVT(Long id) { + return rawFoilPointIVTMapper.selectById(id); + } + + @Override + public PageResult getRawFoilPointIVTPage(RawFoilPointIVTPageReqVO pageReqVO) { + return rawFoilPointIVTMapper.selectPage(pageReqVO); + } + +} diff --git a/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/rawfoilpointivt/RawFoilPointIVTMapper.xml b/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/rawfoilpointivt/RawFoilPointIVTMapper.xml new file mode 100644 index 00000000..f766f95d --- /dev/null +++ b/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/rawfoilpointivt/RawFoilPointIVTMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/rawfoilpointivt/index.ts b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/rawfoilpointivt/index.ts new file mode 100644 index 00000000..bbea6fb2 --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/rawfoilpointivt/index.ts @@ -0,0 +1,66 @@ +import type { PageParam, PageResult } from '@vben/request'; +import type { Dayjs } from 'dayjs'; + +import { requestClient } from '#/api/request'; + +export namespace LmsRawFoilPointIVTApi { + /** 生箔点位库存信息 */ + export interface RawFoilPointIVT { + pointId: number; // 点位标识 + pointCode: string; // 点位编码 + vehicleCode: string; // 载具编码 + productionArea: string; // 生产区域 + pointLocation: string; // 位置 + extCode: string; // 外部编码 + remark: string; // 备注 + isUsed: string; // 是否启用 + creator: string; // 创建人 + createTime: string | Dayjs; // 创建时间 + updater: string; // 修改人 + updateTime: string | Dayjs; // 修改时间 + } +} + +/** 查询生箔点位库存分页 */ +export function getRawFoilPointIVTPage(params: PageParam) { + return requestClient.get>( + '/lms/raw-foil-point-IVT/page', + { params }, + ); +} + +/** 查询生箔点位库存详情 */ +export function getRawFoilPointIVT(id: number) { + return requestClient.get( + `/lms/raw-foil-point-IVT/get?id=${id}`, + ); +} + +/** 新增生箔点位库存 */ +export function createRawFoilPointIVT(data: LmsRawFoilPointIVTApi.RawFoilPointIVT) { + return requestClient.post('/lms/raw-foil-point-IVT/create', data); +} + +/** 修改生箔点位库存 */ +export function updateRawFoilPointIVT(data: LmsRawFoilPointIVTApi.RawFoilPointIVT) { + return requestClient.put('/lms/raw-foil-point-IVT/update', data); +} + +/** 删除生箔点位库存 */ +export function deleteRawFoilPointIVT(id: number) { + return requestClient.delete(`/lms/raw-foil-point-IVT/delete?id=${id}`); +} + +/** 批量删除生箔点位库存 */ +export function deleteRawFoilPointIVTList(ids: number[]) { + return requestClient.delete( + `/lms/raw-foil-point-IVT/delete-list?ids=${ids.join(',')}`, + ); +} + +/** 导出生箔点位库存 */ +export function exportRawFoilPointIVT(params: any) { + return requestClient.download('/lms/raw-foil-point-IVT/export-excel', { params }); +} + + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/data.ts b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/data.ts new file mode 100644 index 00000000..90f3d822 --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/data.ts @@ -0,0 +1,220 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { LmsRawFoilPointIVTApi } from '#/api/lms/rawfoilpointivt'; + +import {DICT_TYPE} from "@vben/constants"; +import { getDictOptions } from '@vben/hooks'; + +import {z} from "#/adapter/form"; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'pointId', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'pointCode', + label: '点位编码', + rules: 'required', + component: 'Input', + componentProps: { + placeholder: '请输入点位编码', + }, + }, + { + fieldName: 'vehicleCode', + label: '载具编码', + component: 'Input', + componentProps: { + placeholder: '请输入载具编码', + }, + }, + { + fieldName: 'productionArea', + label: '生产区域', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.PRODUCT_AREA), + placeholder: '请选择生产区域', + }, + }, + { + fieldName: 'pointLocation', + label: '位置', + component: 'Input', + componentProps: { + placeholder: '请输入位置', + }, + }, + { + fieldName: 'extCode', + label: '外部编码', + component: 'Input', + componentProps: { + placeholder: '请输入外部编码', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'TextArea', + componentProps: { + placeholder: '请输入备注', + }, + }, + { + fieldName: 'isUsed', + label: '是否启用', + rules: z.string().default('1'), + component: 'RadioGroup', + componentProps: { + options: [{ label: '是', value: '1' }, { label: '否', value: '0' }], + buttonStyle: 'solid', + optionType: 'button', + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'pointCode', + label: '点位编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入点位编码', + }, + }, + { + fieldName: 'vehicleCode', + label: '载具编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入载具编码', + }, + }, + { + fieldName: 'productionArea', + label: '生产区域', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.PRODUCT_AREA), + placeholder: '请选择生产区域', + }, + }, + { + fieldName: 'pointLocation', + label: '位置', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入位置', + }, + }, + { + fieldName: 'extCode', + label: '外部编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入外部编码', + }, + }, + { + fieldName: 'isUsed', + label: '是否启用', + component: 'Select', + componentProps: { + allowClear: true, + options: [ + { label: '是', value: '1' }, + { label: '否', value: '0' }, + ], + placeholder: '请选择是否启用', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 40 }, + { + field: 'pointCode', + title: '点位编码', + minWidth: 120, + }, + { + field: 'vehicleCode', + title: '载具编码', + minWidth: 120, + }, + { + field: 'productionArea', + title: '生产区域', + minWidth: 120, + }, + { + field: 'pointLocation', + title: '位置', + minWidth: 120, + }, + { + field: 'extCode', + title: '外部编码', + minWidth: 120, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'isUsed', + title: '是否启用', + minWidth: 120, + formatter: ({ cellValue }: { cellValue: string }) => (cellValue === '1' ? '是' : '否') + }, + { + field: 'creator', + title: '创建人', + minWidth: 120, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 120, + formatter: 'formatDateTime', + }, + { + field: 'updater', + title: '修改人', + minWidth: 120, + }, + { + field: 'updateTime', + title: '修改时间', + minWidth: 120, + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 200, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/index.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/index.vue new file mode 100644 index 00000000..9213d205 --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/index.vue @@ -0,0 +1,186 @@ + + + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/modules/form.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/modules/form.vue new file mode 100644 index 00000000..6c610e4b --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/rawfoilpointivt/modules/form.vue @@ -0,0 +1,82 @@ + + +