Merge remote-tracking branch 'origin/dev' into dev
commit
a2ceca5d90
|
|
@ -4,7 +4,7 @@ import org.mapstruct.Mapper;
|
|||
import org.mapstruct.Mapping;
|
||||
import org.qinan.safetyeval.client.co.WpsFileCO;
|
||||
import org.qinan.safetyeval.client.co.WpsUserCO;
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
|
||||
import org.qinan.safetyeval.domain.entity.WpsDocEntity;
|
||||
import org.qinan.safetyeval.domain.entity.WpsDocVersionEntity;
|
||||
|
||||
|
|
@ -31,6 +31,6 @@ public interface WpsCmdConvertor {
|
|||
|
||||
@Mapping(target = "id", expression = "java(entity.getId() == null ? null : String.valueOf(entity.getId()))")
|
||||
@Mapping(source = "userName", target = "name")
|
||||
@Mapping(source = "profileUrl", target = "avatarUrl")
|
||||
WpsUserCO toUserCO(AccountEntity entity);
|
||||
@Mapping(target = "avatarUrl", ignore = true)
|
||||
WpsUserCO toUserCO(OrgPersonnelEntity entity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ import org.qinan.safetyeval.client.co.WpsFileCO;
|
|||
import org.qinan.safetyeval.client.co.WpsPermissionCO;
|
||||
import org.qinan.safetyeval.client.co.WpsUserCO;
|
||||
import org.qinan.safetyeval.domain.constant.ProjectStageEnum;
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.entity.FileStorage;
|
||||
import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
|
||||
import org.qinan.safetyeval.domain.entity.WpsDocEntity;
|
||||
import org.qinan.safetyeval.domain.entity.WpsDocVersionEntity;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
import org.qinan.safetyeval.domain.gateway.AccountGateway;
|
||||
import org.qinan.safetyeval.domain.gateway.OrgPersonnelGateway;
|
||||
import org.qinan.safetyeval.domain.service.FileStorageDomainService;
|
||||
import org.qinan.safetyeval.domain.service.ProjectStageSyncService;
|
||||
import org.qinan.safetyeval.domain.service.WpsDocDomainService;
|
||||
|
|
@ -49,7 +49,7 @@ public class WpsExecutor implements WpsApi {
|
|||
@Resource
|
||||
private WpsDocDomainService wpsDocDomainService;
|
||||
@Resource
|
||||
private AccountGateway accountGateway;
|
||||
private OrgPersonnelGateway orgPersonnelGateway;
|
||||
@Resource
|
||||
private WpsCmdConvertor wpsCmdConvertor;
|
||||
@Resource
|
||||
|
|
@ -124,10 +124,10 @@ public class WpsExecutor implements WpsApi {
|
|||
.map(Long::valueOf)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<AccountEntity> accounts = accountGateway.listByIds(ids);
|
||||
List<OrgPersonnelEntity> personnels = orgPersonnelGateway.listByIds(ids);
|
||||
List<WpsUserCO> users = new ArrayList<>();
|
||||
for (AccountEntity account : accounts) {
|
||||
users.add(wpsCmdConvertor.toUserCO(account));
|
||||
for (OrgPersonnelEntity personnel : personnels) {
|
||||
users.add(wpsCmdConvertor.toUserCO(personnel));
|
||||
}
|
||||
return ok(users);
|
||||
} catch (BizException e) {
|
||||
|
|
@ -321,7 +321,7 @@ public class WpsExecutor implements WpsApi {
|
|||
try {
|
||||
Long userId = requireUserId();
|
||||
String creatorId = String.valueOf(userId);
|
||||
WpsDocEntity existing = wpsDocDomainService.findLatestByCreatorId(creatorId);
|
||||
WpsDocEntity existing = wpsDocDomainService.findLatestByCreatorId(creatorId, projectId);
|
||||
if (existing != null) {
|
||||
return toOpenCO(existing, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public interface OrgPersonnelGateway {
|
|||
* 按机构ID + 账号集合批量查询未删除人员(用于导入手机号重复校验)。
|
||||
*/
|
||||
java.util.List<OrgPersonnelEntity> listByOrgIdAndAccounts(Long orgId, Collection<String> accounts);
|
||||
|
||||
/**
|
||||
* 按主键批量查询未删除人员(WPS 用户展示等)。
|
||||
*/
|
||||
java.util.List<OrgPersonnelEntity> listByIds(Collection<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public interface WpsDocGateway {
|
|||
/**
|
||||
* 当前用户最近一份文档(按 id 倒序)
|
||||
*/
|
||||
WpsDocEntity getLatestByCreatorId(String creatorId);
|
||||
WpsDocEntity getLatestByCreatorId(String creatorId, Long projectId);
|
||||
|
||||
WpsDocEntity save(WpsDocEntity entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ public class WpsDocDomainService {
|
|||
/**
|
||||
* 当前用户最近一份文档,没有则返回 null
|
||||
*/
|
||||
public WpsDocEntity findLatestByCreatorId(String creatorId) {
|
||||
return wpsDocGateway.getLatestByCreatorId(creatorId);
|
||||
public WpsDocEntity findLatestByCreatorId(String creatorId, Long projectId) {
|
||||
return wpsDocGateway.getLatestByCreatorId(creatorId, projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,5 +204,16 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
|||
return orgPersonnelDoConvertor.converDosToEes(orgPersonnelMapper.selectList(wrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgPersonnelEntity> listByIds(Collection<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
LambdaQueryWrapper<OrgPersonnelDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(OrgPersonnelDO::getId, ids);
|
||||
wrapper.eq(OrgPersonnelDO::getDeleteEnum, "false");
|
||||
return orgPersonnelDoConvertor.converDosToEes(orgPersonnelMapper.selectList(wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@ public class WpsDocGatewayImpl implements WpsDocGateway {
|
|||
}
|
||||
|
||||
@Override
|
||||
public WpsDocEntity getLatestByCreatorId(String creatorId) {
|
||||
public WpsDocEntity getLatestByCreatorId(String creatorId, Long projectId) {
|
||||
LambdaQueryWrapper<WpsDocDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WpsDocDO::getCreatorId, creatorId);
|
||||
wrapper.eq(WpsDocDO::getProjectId, projectId);
|
||||
wrapper.eq(WpsDocDO::getDeleteEnum, "false");
|
||||
wrapper.orderByDesc(WpsDocDO::getId);
|
||||
wrapper.last("limit 1");
|
||||
|
|
|
|||
Loading…
Reference in New Issue