3.11需求变更:1、/component/top/list实现;2、/assembly/list列表接口实现;2、加工接口修改为只修改本身,新增加工状态恢复接口;

This commit is contained in:
gaoqr
2026-03-12 15:57:17 +08:00
parent 4b93fc14bf
commit ebee7a2630
16 changed files with 390 additions and 161 deletions
@@ -26,4 +26,8 @@ public interface AssemblyConfigApi {
@PostMapping("/getOrgAssemblySettingByComponentNames")
@Operation(summary = "根据部件名称列表查询组织下对应的装配设置")
CommonResult<List<AssemblyConfigRespDTO>> getAssemblyConfigByPartNameList(@RequestBody List<String> componentNameList);
@PostMapping("/getOrgNotProcessAssemblySettingByComponentNames")
@Operation(summary = "根据部件名称列表查询组织下对应不加工的装配设置")
CommonResult<List<AssemblyConfigRespDTO>> getNotProcessAssemblyConfigByPartNameList(@RequestBody List<String> componentNameList);
}
@@ -28,4 +28,10 @@ public class AssemblyConfigApiImpl implements AssemblyConfigApi {
List<AssemblyConfigRespVO> assemblyConfigByComponentNameList = assemblyConfigService.getAssemblyConfigByComponentNameList(componentNameList);
return CommonResult.success(BeanUtil.copyToList(assemblyConfigByComponentNameList, AssemblyConfigRespDTO.class));
}
@Override
public CommonResult<List<AssemblyConfigRespDTO>> getNotProcessAssemblyConfigByPartNameList(List<String> componentNameList) {
List<AssemblyConfigRespVO> assemblyConfigByComponentNameList = assemblyConfigService.getNotProcessAssemblyConfigByComponentNameList(componentNameList);
return CommonResult.success(BeanUtil.copyToList(assemblyConfigByComponentNameList, AssemblyConfigRespDTO.class));
}
}
@@ -19,5 +19,5 @@ public class AssemblyConfigSaveReqVO {
@Schema(description = "装备设置树形结构", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{assembly.config.save.structure.config.notNull}")
private AssemblyConfigSaveStructureVO config;
private AssemblyConfigStructureVO config;
}
@@ -65,4 +65,9 @@ public class AssemblyConfigDO extends BaseDO {
* 状态
*/
private Integer status;
/**
* 不加工
*/
private Boolean notProcess;
}
@@ -71,4 +71,12 @@ public interface AssemblyConfigService {
* @return
*/
List<AssemblyConfigRespVO> getAssemblyConfigByComponentNameList(List<String> componentNameList);
/**
* 根据部件名称获取组织不加工的装配设置
*
* @param componentNameList
* @return
*/
List<AssemblyConfigRespVO> getNotProcessAssemblyConfigByComponentNameList(List<String> componentNameList);
}
@@ -21,7 +21,6 @@ import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConf
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigListRespVO;
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigRespVO;
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigSaveReqVO;
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigSaveStructureVO;
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigStructureVO;
import com.cf.imes.module.system.dal.dataobject.assemblyconfig.AssemblyConfigDO;
import com.cf.imes.module.system.dal.dataobject.assemblyconfig.AssemblyConfigNameSeqDO;
@@ -422,8 +421,7 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
AssemblyConfigDO assemblyConfigDO = getById(reqVO.getId(), organId);
AssemblyConfigSaveStructureVO config = reqVO.getConfig();
AssemblyConfigStructureVO structureVO = BeanUtil.toBean(config, AssemblyConfigStructureVO.class);
AssemblyConfigStructureVO structureVO = reqVO.getConfig();
String newTopName = structureVO.getName();
// 2、如果顶级的名称发生改变,需要校验是否重复,并且同步给name
String needChangeName = null;
@@ -440,7 +438,8 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
}
// 3、更新hash和json
computeHashRecursively(structureVO);
// 生成hash并检查是不是全部不加工
boolean allNotProcess = computeHashAndCheckProcess(structureVO);
String structureHash = structureVO.getStructureHash();
assemblyConfigMapper.update(new LambdaUpdateWrapperX<AssemblyConfigDO>()
@@ -450,10 +449,43 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
.eq(AssemblyConfigDO::getStatus, AssemblyConfigStatusEnum.CONFIGURED.getStatus())
.setIfPresent(AssemblyConfigDO::getComponentName, needChangeName)
.set(AssemblyConfigDO::getStructureHash, structureHash)
.set(AssemblyConfigDO::getStructureJson, JsonUtils.zipString(JsonUtils.toJsonString(config)))
.set(AssemblyConfigDO::getStructureJson, JsonUtils.zipString(JsonUtils.toJsonString(structureVO)))
.set(AssemblyConfigDO::getNotProcess, allNotProcess)
);
}
/**
* 生成结构hash、逐级检查是否全部不加工
*
* @param node
* @return true 表示全部不加工
*/
private boolean computeHashAndCheckProcess(AssemblyConfigStructureVO node) {
// 当前节点是否不加工
boolean hasProcessFalse = !node.isProcess();
List<AssemblyConfigStructureVO> children = node.getChildren();
if (children != null && !children.isEmpty()) {
// 1. 按 name 排序保证 hash 稳定
children.sort(Comparator.comparing(AssemblyConfigStructureVO::getName));
// 2. 递归子节点
for (AssemblyConfigStructureVO child : children) {
if (computeHashAndCheckProcess(child)) {
hasProcessFalse = true;
}
}
}
// 3. 生成结构字符串并 hash
String structureStr = buildStructureString(node);
node.setStructureHash(DigestUtil.sha256Hex(structureStr));
return hasProcessFalse;
}
@Override
public List<AssemblyConfigRespVO> getAssemblyConfigByComponentNameList(List<String> componentNameList) {
Long organId = SecurityFrameworkUtils.getUserOrganId();
@@ -468,4 +500,20 @@ public class AssemblyConfigServiceImpl implements AssemblyConfigService {
return BeanUtil.copyToList(assemblyConfigDOS, AssemblyConfigRespVO.class);
}
@Override
public List<AssemblyConfigRespVO> getNotProcessAssemblyConfigByComponentNameList(List<String> componentNameList) {
Long organId = SecurityFrameworkUtils.getUserOrganId();
List<AssemblyConfigDO> assemblyConfigDOS = assemblyConfigMapper.selectList(new LambdaQueryWrapper<AssemblyConfigDO>()
.eq(AssemblyConfigDO::getOrganId, organId)
.in(AssemblyConfigDO::getComponentName, componentNameList)
.eq(AssemblyConfigDO::getStatus, AssemblyConfigStatusEnum.CONFIGURED.getStatus())
.eq(AssemblyConfigDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
.eq(AssemblyConfigDO::getNotProcess, true)
.select(AssemblyConfigDO::getComponentName, AssemblyConfigDO::getStructureHash, AssemblyConfigDO::getStructureJson)
);
return BeanUtil.copyToList(assemblyConfigDOS, AssemblyConfigRespVO.class);
}
}