|
@@ -17,13 +17,16 @@ import cn.iocoder.yudao.module.relations.controller.admin.entry.vo.RelationsEntr
|
|
import cn.iocoder.yudao.module.relations.dal.dataobject.entry.RelationsEntryDO;
|
|
import cn.iocoder.yudao.module.relations.dal.dataobject.entry.RelationsEntryDO;
|
|
import cn.iocoder.yudao.module.relations.dal.mysql.entry.RelationsEntryMapper;
|
|
import cn.iocoder.yudao.module.relations.dal.mysql.entry.RelationsEntryMapper;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.PostApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.dto.PostRespDTO;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
@@ -46,6 +49,8 @@ public class RelationsEntryServiceImpl implements RelationsEntryService {
|
|
private DeptApi deptApi;
|
|
private DeptApi deptApi;
|
|
@Resource
|
|
@Resource
|
|
private EmployeeApi employeeApi;
|
|
private EmployeeApi employeeApi;
|
|
|
|
+ @Resource
|
|
|
|
+ private PostApi postApi;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Long createEntry(RelationsEntrySaveReqVO createReqVO) {
|
|
public Long createEntry(RelationsEntrySaveReqVO createReqVO) {
|
|
@@ -54,6 +59,12 @@ public class RelationsEntryServiceImpl implements RelationsEntryService {
|
|
// Long tenantId = user != null && user.getTenantId() != null ? user.getTenantId() : 0L;
|
|
// Long tenantId = user != null && user.getTenantId() != null ? user.getTenantId() : 0L;
|
|
Long userId = user != null && user.getId() != null ? user.getId() : 0L;
|
|
Long userId = user != null && user.getId() != null ? user.getId() : 0L;
|
|
// createReqVO.setTenantId(tenantId);
|
|
// createReqVO.setTenantId(tenantId);
|
|
|
|
+ // 职位
|
|
|
|
+ Long postId = createReqVO.getPostId();
|
|
|
|
+ PostRespDTO post = postApi.getPost(postId);
|
|
|
|
+ if (Objects.nonNull(post)) {
|
|
|
|
+ createReqVO.setPosition(post.getName());
|
|
|
|
+ }
|
|
// 插入
|
|
// 插入
|
|
String infoId = IdUtil.fastSimpleUUID();
|
|
String infoId = IdUtil.fastSimpleUUID();
|
|
createReqVO.setEntryId(infoId);
|
|
createReqVO.setEntryId(infoId);
|
|
@@ -84,6 +95,12 @@ public class RelationsEntryServiceImpl implements RelationsEntryService {
|
|
validateEntryExists(updateReqVO.getId());
|
|
validateEntryExists(updateReqVO.getId());
|
|
// 保存业务uuid到附件中
|
|
// 保存业务uuid到附件中
|
|
fileApi.updateFileBiz(updateReqVO.getFileIdList(), updateReqVO.getEntryId());
|
|
fileApi.updateFileBiz(updateReqVO.getFileIdList(), updateReqVO.getEntryId());
|
|
|
|
+ // 职位
|
|
|
|
+ Long postId = updateReqVO.getPostId();
|
|
|
|
+ PostRespDTO post = postApi.getPost(postId);
|
|
|
|
+ if (Objects.nonNull(post)) {
|
|
|
|
+ updateReqVO.setPosition(post.getName());
|
|
|
|
+ }
|
|
// 更新
|
|
// 更新
|
|
RelationsEntryDO updateObj = BeanUtils.toBean(updateReqVO, RelationsEntryDO.class);
|
|
RelationsEntryDO updateObj = BeanUtils.toBean(updateReqVO, RelationsEntryDO.class);
|
|
entryMapper.updateById(updateObj);
|
|
entryMapper.updateById(updateObj);
|