From 74c794253b5fd390ae94c7fd6a647c8618e6571c Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Wed, 8 Jul 2026 10:44:43 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=9F=A5=E8=AF=A2=E8=B4=B4=E7=9A=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6id=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=EF=BC=9B2=E3=80=81=E6=96=B0=E5=A2=9E=E8=B4=B4=E7=9A=AE?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=90=8D=E7=A7=B0=E5=88=A0=E9=99=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/enums/ErrorCodeConstants.java | 2 + .../admin/veneer/VeneerController.java | 7 +++ .../admin/veneer/vo/VeneerRespVO.java | 3 ++ .../service/veneer/VeneerService.java | 7 +++ .../service/veneer/VeneerServiceImpl.java | 15 ++++++ .../message_errorcode_cht.properties | 4 +- .../resources/message_errorcode_en.properties | 4 +- .../resources/message_errorcode_zh.properties | 4 +- .../admin/veneer/VeneerControllerTest.java | 12 +++++ .../service/veneer/VeneerServiceImplTest.java | 53 +++++++++++++++++++ 10 files changed, 108 insertions(+), 3 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java b/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java index 0069522dc..f35fed2be 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java +++ b/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java @@ -170,6 +170,8 @@ public class ErrorCodeConstants { public static final ErrorCode VENEER_IMPORT_ORG_CLASSIFICATION_NAME_NOT_EXIST = new ErrorCode(1_003_009_008, "veneer.import.org.classification.name.not.exist"); public static final ErrorCode VENEER_ORG_CLASSIFICATION_NAME_EXIST = new ErrorCode(1_003_009_009, "veneer.org.classification.name.exist"); public static final ErrorCode VENEER_ORG_CLASSIFICATION_NAME_EMPTY = new ErrorCode(1_003_009_010, "veneer.org.classification.name.empty"); + public static final ErrorCode VENEER_ORG_CLASSIFICATION_NAME_NOT_EXIST = new ErrorCode(1_003_009_011, "veneer.org.classification.name.not.exist"); + public static final ErrorCode VENEER_ORG_CLASSIFICATION_NAME_USED = new ErrorCode(1_003_009_012, "veneer.org.classification.name.used"); //=========== 部件管理 1-003-010-000 ============ public static final ErrorCode ORDER_COMPONENT_NOT_EXIST = new ErrorCode(1_003_010_000, "order.component.not.exist"); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerController.java index e493fb596..dc76c6093 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerController.java @@ -133,6 +133,13 @@ public class VeneerController { return success(veneerService.addClassificationName(saveReqVO)); } + @DeleteMapping("/classificationName/{id}") + @Operation(summary = "删除分类名称") + public CommonResult deleteClassificationName(@PathVariable Long id) { + veneerService.deleteClassificationName(id); + return success(true); + } + @GetMapping("/org/classificationName") @Operation(summary = "获取分类名称列表") public CommonResult> getOrgVeneerClassificationNameList() { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/vo/VeneerRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/vo/VeneerRespVO.java index 113125602..6b12723bb 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/vo/VeneerRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/veneer/vo/VeneerRespVO.java @@ -101,4 +101,7 @@ public class VeneerRespVO { @Schema(description = "瑕疵数据") private String defectData; + + @Schema(description = "贴皮文件ID") + private Long fileId; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerService.java index 4b13c63e9..d2b4d610b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerService.java @@ -115,6 +115,13 @@ public interface VeneerService { */ Long addClassificationName(VeneerClassificationNameSaveReqVO saveReqVO); + /** + * 删除分类名称 + * + * @param id 分类名称ID + */ + void deleteClassificationName(Long id); + /** * 获取组织分类名称列表 * diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImpl.java index 7519a593a..6938e4834 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImpl.java @@ -53,6 +53,8 @@ import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NOT_EX import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NO_EXIST; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_EMPTY; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_EXIST; +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_NOT_EXIST; +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_USED; /** * 贴皮管理ServiceImpl 实现类 @@ -282,6 +284,19 @@ public class VeneerServiceImpl implements VeneerService { return veneerClassificationNameDO.getId(); } + @Override + public void deleteClassificationName(Long id) { + VeneerClassificationNameDO classificationNameDO = veneerClassificationNameMapper.selectById(id); + if (ObjectUtil.isNull(classificationNameDO)) { + throw new ServiceException(VENEER_ORG_CLASSIFICATION_NAME_NOT_EXIST); + } + if (veneerMapper.selectCount(new LambdaQueryWrapper() + .eq(VeneerDO::getClassificationName, classificationNameDO.getName())) > 0) { + throw new ServiceException(VENEER_ORG_CLASSIFICATION_NAME_USED); + } + veneerClassificationNameMapper.deleteById(id); + } + /** * 校验组织下分类名称唯一 * diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_cht.properties b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_cht.properties index f5383e43b..d3b9baecf 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_cht.properties +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_cht.properties @@ -78,6 +78,8 @@ veneer.import.positive.number.error=第{0}行{1}必須大於0,請檢查檔案 veneer.import.number.length.error=第{0}行{1}長度不能超過整數{2}位、小數{3}位,請檢查檔案 veneer.org.classification.name.exist=組織下分類名稱已存在,請檢查 veneer.org.classification.name.empty=組織下分類名稱不存在,請前往 [新增] 視窗維護分類名稱 +veneer.org.classification.name.not.exist=組織下分類名稱不存在,請重新整理後再試 +veneer.org.classification.name.used=目前分類名稱已被貼皮使用,無法刪除 veneer.import.template.download.error=導入模版下載失敗 veneer.import.org.classification.name.not.exist=第{0}行分類名稱{1}不存在,請前往[新增]視窗維護分類名稱 @@ -102,4 +104,4 @@ parts.pack.item.source.not.exist=配件打包數據异常,請重繪後再次 parts.heapsplit.num.not.enough=配件可分堆數量不足,請重繪後再次分堆 parts.heapsplit.item.source.not.exist=配件分堆數據异常,請重繪後再次分堆 -plan.not.allow.delete=排單號:{0}已開料無法刪除 \ No newline at end of file +plan.not.allow.delete=排單號:{0}已開料無法刪除 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_en.properties b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_en.properties index f1d51f353..301c5e639 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_en.properties +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_en.properties @@ -78,6 +78,8 @@ veneer.import.positive.number.error=The field must be greater than 0 in line {0} veneer.import.number.length.error=The length of the field cannot exceed integer {0} digits and decimal {1} digits in line {2}, please check the file veneer.org.classification.name.exist=The classification name already exists under the organization, please check veneer.org.classification.name.empty=The classification name does not exist under the organization, Please go to the [Add] window to maintain the classification name +veneer.org.classification.name.not.exist=The classification name does not exist under the organization, please refresh and retry +veneer.org.classification.name.used=The classification name is already used by veneer and cannot be deleted veneer.import.template.download.error=Import template download failed veneer.import.org.classification.name.not.exist=The classification name {1} does not exist in line {0}, please go to the [Add] window to maintain the classification name @@ -102,4 +104,4 @@ parts.pack.item.source.not.exist=Abnormal accessory packaging data, please refre parts.heapsplit.num.not.enough=The number of accessories that can be stacked is insufficient. Please refresh and stack again parts.heapsplit.item.source.not.exist=Abnormal accessory stacking data, please refresh and stack again -plan.not.allow.delete=Plan number: {0} has been cut and cannot be deleted \ No newline at end of file +plan.not.allow.delete=Plan number: {0} has been cut and cannot be deleted diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_zh.properties b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_zh.properties index c594bfb0e..d593143f5 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_zh.properties +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/message_errorcode_zh.properties @@ -78,6 +78,8 @@ veneer.import.positive.number.error=第{0}行{1}必须大于0,请检查文件 veneer.import.number.length.error=第{0}行{1}长度不能超过整数{2}位、小数{3}位,请检查文件 veneer.org.classification.name.exist=组织下分类名称已存在,请检查 veneer.org.classification.name.empty=组织下分类名称不存在,请前往 [新增] 窗口维护分类名称 +veneer.org.classification.name.not.exist=组织下分类名称不存在,请刷新后重试 +veneer.org.classification.name.used=当前分类名称已被贴皮使用,无法删除 veneer.import.template.download.error=导入模版下载失败 veneer.import.org.classification.name.not.exist=第{0}行分类名称{1}不存在,请前往 [新增] 窗口维护分类名称 @@ -102,4 +104,4 @@ parts.pack.item.source.not.exist=配件打包数据异常,请刷新后再次 parts.heapsplit.num.not.enough=配件可分堆数量不足,请刷新后再次分堆 parts.heapsplit.item.source.not.exist=配件分堆数据异常,请刷新后再次分堆 -plan.not.allow.delete=排单号:{0}已开料无法删除 \ No newline at end of file +plan.not.allow.delete=排单号:{0}已开料无法删除 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerControllerTest.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerControllerTest.java index 157cead9b..bcb654e7b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerControllerTest.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/controller/admin/veneer/VeneerControllerTest.java @@ -257,6 +257,18 @@ class VeneerControllerTest extends BaseWebUnitTest { .addClassificationName(any(VeneerClassificationNameSaveReqVO.class)); } + @Test + void deleteClassificationName_success() throws Exception { + doNothing().when(veneerService).deleteClassificationName(1L); + + mockMvc.perform(delete("/executor/veneer/classificationName/1")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(0)) + .andExpect(jsonPath("$.data").value(true)); + + Mockito.verify(veneerService).deleteClassificationName(1L); + } + @Test void getOrgVeneerClassificationNameList_success() throws Exception { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImplTest.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImplTest.java index 0c8f418ad..e278db25d 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImplTest.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/test/java/com/cf/imes/module/executor/service/veneer/VeneerServiceImplTest.java @@ -60,6 +60,8 @@ import static com.cf.imes.framework.test.core.util.RandomUtils.randomPojo; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NOT_EXIST; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NO_EXIST; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_EXIST; +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_NOT_EXIST; +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_ORG_CLASSIFICATION_NAME_USED; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -561,6 +563,57 @@ class VeneerServiceImplTest extends BaseMockitoUnitTest { .insert(any(VeneerClassificationNameDO.class)); } + @Test + void deleteClassificationName_success() { + VeneerClassificationNameDO entity = new VeneerClassificationNameDO(); + entity.setId(1L); + entity.setName("分类A"); + + Mockito.when(veneerClassificationNameMapper.selectById(1L)) + .thenReturn(entity); + Mockito.when(veneerMapper.selectCount(any())) + .thenReturn(0L); + + assertDoesNotThrow(() -> veneerService.deleteClassificationName(1L)); + + Mockito.verify(veneerMapper) + .selectCount(any()); + Mockito.verify(veneerClassificationNameMapper) + .deleteById(1L); + } + + @Test + void deleteClassificationName_notExist_throwException() { + Mockito.when(veneerClassificationNameMapper.selectById(1L)) + .thenReturn(null); + + assertServiceException(() -> veneerService.deleteClassificationName(1L), + VENEER_ORG_CLASSIFICATION_NAME_NOT_EXIST); + + Mockito.verify(veneerMapper, Mockito.never()) + .selectCount(any()); + Mockito.verify(veneerClassificationNameMapper, Mockito.never()) + .deleteById(anyLong()); + } + + @Test + void deleteClassificationName_used_throwException() { + VeneerClassificationNameDO entity = new VeneerClassificationNameDO(); + entity.setId(1L); + entity.setName("分类A"); + + Mockito.when(veneerClassificationNameMapper.selectById(1L)) + .thenReturn(entity); + Mockito.when(veneerMapper.selectCount(any())) + .thenReturn(1L); + + assertServiceException(() -> veneerService.deleteClassificationName(1L), + VENEER_ORG_CLASSIFICATION_NAME_USED); + + Mockito.verify(veneerClassificationNameMapper, Mockito.never()) + .deleteById(anyLong()); + } + @Test void getOrgVeneerClassificationNameList_success() {