diff --git a/src/main/java/com/spring/modules/sampleManagement/data/PlmTechnicalSpecificationSheetData.java b/src/main/java/com/spring/modules/sampleManagement/data/PlmTechnicalSpecificationSheetData.java index 57b1d4f3..79bd4b32 100644 --- a/src/main/java/com/spring/modules/sampleManagement/data/PlmTechnicalSpecificationSheetData.java +++ b/src/main/java/com/spring/modules/sampleManagement/data/PlmTechnicalSpecificationSheetData.java @@ -424,11 +424,17 @@ public class PlmTechnicalSpecificationSheetData extends PlmTechnicalSpecificatio } public String getUserName() { - return userName; + if (hasText(userName)) { + return userName; + } + return username; } public void setUserName(String userName) { this.userName = userName; + if (hasText(userName) || !hasText(this.username)) { + this.username = userName; + } } public String getMenuId() { @@ -568,11 +574,21 @@ public class PlmTechnicalSpecificationSheetData extends PlmTechnicalSpecificatio } public String getUsername() { - return username; + if (hasText(username)) { + return username; + } + return userName; } public void setUsername(String username) { this.username = username; + if (hasText(username) || !hasText(this.userName)) { + this.userName = username; + } + } + + private boolean hasText(String value) { + return value != null && !value.trim().isEmpty(); } public String getFinalCustomerNo() { diff --git a/src/main/java/com/spring/modules/sampleManagement/service/Impl/TechnicalSpecificationServiceImpl.java b/src/main/java/com/spring/modules/sampleManagement/service/Impl/TechnicalSpecificationServiceImpl.java index e0153847..909807bc 100644 --- a/src/main/java/com/spring/modules/sampleManagement/service/Impl/TechnicalSpecificationServiceImpl.java +++ b/src/main/java/com/spring/modules/sampleManagement/service/Impl/TechnicalSpecificationServiceImpl.java @@ -113,6 +113,31 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification @Autowired private DictDataServiceImpl dictDataServiceImpl; + private void fillBmOperatorFields(PlmTechnicalSpecificationSheetData data) { + if (data == null) { + return; + } + String operator = data.getUserName(); + if (!StringUtils.hasText(operator)) { + operator = data.getUsername(); + } + if (!StringUtils.hasText(operator)) { + operator = data.getUpdateBy(); + } + if (!StringUtils.hasText(operator)) { + Object principal = SecurityUtils.getSubject().getPrincipal(); + if (principal instanceof SysUserEntity) { + operator = ((SysUserEntity) principal).getUsername(); + } + } + if (!StringUtils.hasText(operator)) { + return; + } + data.setUserName(operator); + data.setUsername(operator); + data.setUpdateBy(operator); + } + @Override public PageUtils technicalSpecificationListSearch(PlmTechnicalSpecificationSheetData inData){ // IPage resultList = this.technicalSpecificationMapper.technicalSpecificationListSearch( @@ -447,6 +472,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification @Override public void updateBMBasicInfoEntry(PlmTechnicalSpecificationSheetData inData){ + fillBmOperatorFields(inData); technicalSpecificationMapper.updateBMBasicInfoEntry(inData); } @@ -1552,6 +1578,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification public void issueChange(PlmTechnicalSpecificationSheetData data) { SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); data.setUserName(sysUserEntity.getUsername()); + fillBmOperatorFields(data); // 修改 // updateBMBasicInformation(data); // 关闭调用OA接口时 @@ -1733,6 +1760,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification public void submitChange(PlmTechnicalSpecificationSheetData data) { SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); data.setUserName(sysUserEntity.getUsername()); + fillBmOperatorFields(data); // 修改 // updateBMBasicInformation(data); // 获取提交基础数据 @@ -2108,6 +2136,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification @Override @Transactional public void bmStatusToDead(PlmTechnicalSpecificationSheetData data) { + fillBmOperatorFields(data); // 查询特殊权限 校验是否可以执行操作 List processFormList = changeManagementMapper.queryRequestId(data.getSite(), "", data.getCodeNo()); if (!processFormList.isEmpty()) { @@ -2157,6 +2186,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification @Override @Transactional public void bmStatusToCg(PlmTechnicalSpecificationSheetData data) { + fillBmOperatorFields(data); // 将技术参数卡的状态改为"草稿"状态 // 将技术参数卡的Step_id改为初始状态(空) // ECN_flag 改为N,生产状态(stage)改为Sample @@ -2176,6 +2206,7 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification @Override @Transactional public void bmStatusToFinish(PlmTechnicalSpecificationSheetData data) { + fillBmOperatorFields(data); // 2025-07-17 修改技术参数卡的状态为已完成后,重新获取bom和工艺路线 List bomList = fetchBomComponentDetails(data.getSite(), data.getCodeNo(), "archiving"); diff --git a/src/main/resources/mapper/sampleManagement/TechnicalSpecificationMapper.xml b/src/main/resources/mapper/sampleManagement/TechnicalSpecificationMapper.xml index 5603fdb5..835e556c 100644 --- a/src/main/resources/mapper/sampleManagement/TechnicalSpecificationMapper.xml +++ b/src/main/resources/mapper/sampleManagement/TechnicalSpecificationMapper.xml @@ -2321,7 +2321,7 @@ update plm_technical_specification_sheet set status = #{status}, update_date = getDate(), - update_by = #{userName} + update_by = #{updateBy} where site = #{site} and code_no = #{codeNo} @@ -2824,7 +2824,7 @@ set step_id = #{stepId}, status = #{status}, update_date = getDate(), - update_by = #{userName}, + update_by = #{updateBy}, ECN_flag = 'N', stage = 'Sample' where site = #{site} and code_no = #{codeNo} @@ -3069,7 +3069,7 @@ step_id = #{stepId}, stage = #{stage}, update_date = getDate(), - update_by = #{userName} + update_by = #{updateBy} where site = #{site} and code_no = #{codeNo} @@ -3374,7 +3374,7 @@ UPDATE a - SET a.update_by = #{username}, + SET a.update_by = #{updateBy}, a.update_date = GETDATE(), node_conclusion = #{nodeConclusion}, is_remark = 2