|
|
|
@ -126,6 +126,7 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
|
boolean isNew = (originalApplyNo == null || originalApplyNo.trim().isEmpty()); |
|
|
|
|
|
|
|
validatePjmLeader(data); |
|
|
|
fillProjectLeaderId(data); |
|
|
|
|
|
|
|
ErfExpApply entity = new ErfExpApply(); |
|
|
|
BeanUtils.copyProperties(data, entity); |
|
|
|
@ -198,6 +199,31 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 试验负责人ID兜底填充: |
|
|
|
* 优先使用前端传入的 projectLeaderId;若未传入则按用户名/姓名反查 sys_user.user_id。 |
|
|
|
*/ |
|
|
|
private void fillProjectLeaderId(ErfExpApplyData data) { |
|
|
|
if (data == null || data.getProjectLeaderId() != null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getProjectLeaderName())) { |
|
|
|
SysUserEntity userByName = sysUserDao.queryByUserName(data.getProjectLeaderName().trim()); |
|
|
|
if (userByName != null) { |
|
|
|
data.setProjectLeaderId(userByName.getUserId()); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getProjectLeader())) { |
|
|
|
SysUserEntity userByDisplay = sysUserDao.selectOne(new QueryWrapper<SysUserEntity>() |
|
|
|
.eq("user_display", data.getProjectLeader().trim()) |
|
|
|
.last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY")); |
|
|
|
if (userByDisplay != null) { |
|
|
|
data.setProjectLeaderId(userByDisplay.getUserId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void submitExpApply(ErfExpApplyData data) { |
|
|
|
ErfExpApply entity = this.getById(data.getApplyNo()); |
|
|
|
@ -2588,12 +2614,18 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据试验单上的试验负责人字段解析系统用户邮箱(优先用户名,其次用户显示名精确匹配) |
|
|
|
* 根据试验单上的试验负责人字段解析系统用户邮箱(优先负责人ID,其次用户名,再次姓名精确匹配) |
|
|
|
*/ |
|
|
|
private UserEmailInfoDto resolveProjectLeaderEmailInfo(ErfExpApply entity) { |
|
|
|
if (entity == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
if (entity.getProjectLeaderId() != null) { |
|
|
|
UserEmailInfoDto userById = sysUserDao.getUserEmailInfoById(entity.getProjectLeaderId()); |
|
|
|
if (userById != null) { |
|
|
|
return userById; |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getProjectLeaderName())) { |
|
|
|
SysUserEntity u = sysUserDao.queryByUserName(entity.getProjectLeaderName()); |
|
|
|
if (u != null) { |
|
|
|
|