1、装配设置重复添加配置序列不断累加修复;2、新增装配清单专用多订单cad视图板件分页和所有接口;

This commit is contained in:
gaoqr
2026-03-09 09:26:58 +08:00
parent 7955e3d318
commit e082313db2
12 changed files with 323 additions and 37 deletions
@@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -70,9 +69,8 @@ public class AssemblyConfigController {
@PostMapping("/new/{configId}")
@Operation(summary = "新增加工部件")
@Parameter(name = "configId", description = "装配设置编号", required = true)
@Parameter(name = "name", description = "新装配设置名称", required = true)
public CommonResult<Boolean> newConfig(@PathVariable Long configId, @RequestParam(value = "name") String name) {
assemblyConfigService.newConfig(configId, name);
public CommonResult<Boolean> newConfig(@PathVariable Long configId) {
assemblyConfigService.newConfig(configId);
return CommonResult.success(true);
}
@@ -47,9 +47,8 @@ public interface AssemblyConfigService {
* 新增加工部件
*
* @param configId
* @param name
*/
void newConfig(Long configId, String name);
void newConfig(Long configId);
/**
* 移除已配置的加工部件
@@ -316,16 +316,18 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
}
@Override
public void newConfig(Long configId, String name) {
public void newConfig(Long configId) {
Long organId = SecurityFrameworkUtils.getUserOrganId();
// 1、校验本身
AssemblyConfigDO assemblyConfigDO = getById(configId, organId);
String existName = assemblyConfigDO.getComponentName();
// 2、校验新的名字是否已有存在的部件
boolean exists = assemblyConfigMapper.exists(new LambdaQueryWrapper<AssemblyConfigDO>()
.eq(AssemblyConfigDO::getOrganId, organId)
.eq(AssemblyConfigDO::getComponentName, name)
.eq(AssemblyConfigDO::getComponentName, existName)
.ne(AssemblyConfigDO::getId, configId)
.eq(AssemblyConfigDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
.eq(AssemblyConfigDO::getStatus, AssemblyConfigStatusEnum.CONFIGURED.getStatus())
);
@@ -333,8 +335,8 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
if (exists) {
// 重名 → 自动生成新名字
// seq 表里直接用 newName 作为 baseName
int seq = nextSeq(organId, name);
String newName = name + " " + seq;
int seq = nextSeq(organId, existName);
String newName = existName + " " + seq;
// 再次校验生成的新名字是否意外重复
boolean newExists = assemblyConfigMapper.exists(new LambdaQueryWrapper<AssemblyConfigDO>()
@@ -343,7 +345,7 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
.eq(AssemblyConfigDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
.eq(AssemblyConfigDO::getStatus, AssemblyConfigStatusEnum.CONFIGURED.getStatus())
);
AssertUtils.isTrue(newExists, ASSEMBLY_CONFIG_NEW_CONFIG_NAME_EXIST, name);
AssertUtils.isTrue(newExists, ASSEMBLY_CONFIG_NEW_CONFIG_NAME_EXIST, newName);
// 新名更新到hash和json中
String structureJson = assemblyConfigDO.getStructureJson();
@@ -366,7 +368,7 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
.set(AssemblyConfigDO::getStructureJson, newJson)
);
} else {
throw new ServiceException(ASSEMBLY_CONFIG_NO_NEED_NEW_CONFIG, name);
throw new ServiceException(ASSEMBLY_CONFIG_NO_NEED_NEW_CONFIG, existName);
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long