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