Merge remote-tracking branch 'origin/dev' into dev

dev
luotaiqian 2026-08-05 11:04:07 +08:00
commit a2ceca5d90
7 changed files with 31 additions and 14 deletions

View File

@ -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);
} }

View File

@ -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);
} }

View File

@ -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);
} }

View File

@ -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);

View File

@ -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);
} }
/** /**

View File

@ -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));
}
} }

View File

@ -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");