1、查询贴皮增加文件id回显;2、新增贴皮分类名称删除接口;

This commit is contained in:
gaoqr
2026-07-08 10:44:43 +08:00
parent 0c8f673b6d
commit 74c794253b
10 changed files with 108 additions and 3 deletions
@@ -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");
@@ -133,6 +133,13 @@ public class VeneerController {
return success(veneerService.addClassificationName(saveReqVO));
}
@DeleteMapping("/classificationName/{id}")
@Operation(summary = "删除分类名称")
public CommonResult<Boolean> deleteClassificationName(@PathVariable Long id) {
veneerService.deleteClassificationName(id);
return success(true);
}
@GetMapping("/org/classificationName")
@Operation(summary = "获取分类名称列表")
public CommonResult<List<VeneerClassificationNameRespVO>> getOrgVeneerClassificationNameList() {
@@ -101,4 +101,7 @@ public class VeneerRespVO {
@Schema(description = "瑕疵数据")
private String defectData;
@Schema(description = "贴皮文件ID")
private Long fileId;
}
@@ -115,6 +115,13 @@ public interface VeneerService {
*/
Long addClassificationName(VeneerClassificationNameSaveReqVO saveReqVO);
/**
* 删除分类名称
*
* @param id 分类名称ID
*/
void deleteClassificationName(Long id);
/**
* 获取组织分类名称列表
*
@@ -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<VeneerDO>()
.eq(VeneerDO::getClassificationName, classificationNameDO.getName())) > 0) {
throw new ServiceException(VENEER_ORG_CLASSIFICATION_NAME_USED);
}
veneerClassificationNameMapper.deleteById(id);
}
/**
* 校验组织下分类名称唯一
*
@@ -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}已開料無法刪除
plan.not.allow.delete=排單號:{0}已開料無法刪除
@@ -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
plan.not.allow.delete=Plan number: {0} has been cut and cannot be deleted
@@ -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}已开料无法删除
plan.not.allow.delete=排单号:{0}已开料无法删除
@@ -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 {
@@ -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() {