feat(REQ-3282): 修改测试中的bug

This commit is contained in:
zhanghongbo 2024-12-16 17:52:23 +08:00
parent ea77b16104
commit f5c9b41857
12 changed files with 90 additions and 49 deletions

View File

@ -195,6 +195,9 @@ public class CreateUnitReq implements Serializable {
*/ */
private String cityName; private String cityName;
/**
* 操作人
*/
private Long operatorId;
} }

View File

@ -1,14 +1,29 @@
# 查询协同关系 # 处理部门相关的逻辑
POST {{host}}/api/org/cooperate-ship/list POST {{host}}/api/org/node/process
Content-Type: application/json Content-Type: application/json
Accept: application/json Accept: application/json
{ {
"workspaceId": 195, "action": "CREATE",
"status": 1, "operatorId": 123,
"organizationalUnitId": 5140, "param": {
"cooperateTypes": [ "operatorId": 123,
9, "organizationalUnitId":10748,
11 "nodeType": 1,
] "nodeName": "随便测试的部门",
"parentId": 0
}
} }
###
# 处理部门相关的逻辑
POST {{host}}/api/org/node/list
Content-Type: application/json
Accept: application/json
{
"id": 22588
}
###

View File

@ -1,14 +1,10 @@
# 查询协同关系 # 分页列表接口
POST {{host}}/api/org/cooperate-ship/list POST {{host}}/api/org/node-user/list
Content-Type: application/json Content-Type: application/json
Accept: application/json Accept: application/json
{ {
"workspaceId": 195, "id": 984
"status": 1,
"organizationalUnitId": 5140,
"cooperateTypes": [
9,
11
]
} }
###

View File

@ -1,14 +1,23 @@
# 查询协同关系 #创建
POST {{host}}/api/org/cooperate-ship/list POST {{host}}/api/org/job/create
Content-Type: application/json Content-Type: application/json
Accept: application/json Accept: application/json
{ {
"workspaceId": 195, "name": "cold_blade2",
"status": 1, "alias": "colde_blade2",
"organizationalUnitId": 5140, "code": "colde_blade2"
"cooperateTypes": [
9,
11
]
} }
###
# 查询
POST {{host}}/api/org/job/list
Content-Type: application/json
Accept: application/json
{
"name": "项目负责人"
}
###

View File

@ -1,14 +1,23 @@
# 查询协同关系 # 创建单位
POST {{host}}/api/org/cooperate-ship/list POST {{host}}/api/org/unit/create
Content-Type: application/json Content-Type: application/json
Accept: application/json Accept: application/json
{ {
"workspaceId": 195, "name": "随便写一个",
"status": 1, "operatorId": 123
"organizationalUnitId": 5140,
"cooperateTypes": [
9,
11
]
} }
###
#分页列表接口
POST {{host}}/api/org/unit/list
Content-Type: application/json
Accept: application/json
{
"id": 10747,
"name": "auto企业注册通过1215113919"
}
###

View File

@ -156,6 +156,7 @@ public class OrganizationalNode implements Serializable {
if (Objects.equals(this.getParentId(), 0L)) { if (Objects.equals(this.getParentId(), 0L)) {
this.topNodeId = id; this.topNodeId = id;
this.path = id + ","; this.path = id + ",";
return;
} }
Assert.notNull(parentNode, "重置路径时,父节点不能为空"); Assert.notNull(parentNode, "重置路径时,父节点不能为空");
this.topNodeId = parentNode.getTopNodeId(); this.topNodeId = parentNode.getTopNodeId();

View File

@ -22,9 +22,7 @@ public interface OrgJobQueryRepository {
class ListReq implements IPageReq { class ListReq implements IPageReq {
@CriteriaField @CriteriaField
private Long id; private String name;
@CriteriaField(field = "id", operator = Operator.IN)
private Long parentId;
} }

View File

@ -70,7 +70,7 @@ public interface UnitQueryRepository {
private String uniformSocialCreditCode; private String uniformSocialCreditCode;
public void check() { public void check() {
Preconditions.checkArgument(id != null || CollUtil.isNotEmpty(ids), "参数异常"); // Preconditions.checkArgument(id != null || CollUtil.isNotEmpty(ids), "参数异常");
} }
} }

View File

@ -46,7 +46,7 @@ public class NodeFoundationServiceImpl implements NodeFoundationService {
.orElseThrow(() -> BizResultCode.ENTITY_NOT_FOUND.toException("部门所在单位不存在{}", nodeCreate.getOrganizationalUnitId())); .orElseThrow(() -> BizResultCode.ENTITY_NOT_FOUND.toException("部门所在单位不存在{}", nodeCreate.getOrganizationalUnitId()));
// 获取上级节点为了重新计算pathtopNodeId等数据 // 获取上级节点为了重新计算pathtopNodeId等数据
OrganizationalNode parentNode = nodeCreate.getParentId() == null || nodeCreate.getParentId() <= 0L ? null : OrganizationalNode parentNode = nodeCreate.getParentId() == 0L ? null :
nodeQueryRepository.oneOpt(NodeQueryRepository.OneReq.builder().id(nodeCreate.getParentId()).build()) nodeQueryRepository.oneOpt(NodeQueryRepository.OneReq.builder().id(nodeCreate.getParentId()).build())
.orElseThrow(() -> BizResultCode.ENTITY_NOT_FOUND.toException("父级部门不存在")); .orElseThrow(() -> BizResultCode.ENTITY_NOT_FOUND.toException("父级部门不存在"));

View File

@ -84,6 +84,8 @@ public class NodeCreate {
} }
public void check() { public void check() {
Axssert.notNull(parentId, BizResultCode.INVALID_PARAM, "父id不能为空");
Axssert.check(parentId >= 0, BizResultCode.INVALID_PARAM, "父id不能为负");
Axssert.notNull(operatorId, BizResultCode.INVALID_PARAM, "操作人不能为空"); Axssert.notNull(operatorId, BizResultCode.INVALID_PARAM, "操作人不能为空");
Axssert.notNull(organizationalUnitId, BizResultCode.INVALID_PARAM, "部门所属单位不能为空"); Axssert.notNull(organizationalUnitId, BizResultCode.INVALID_PARAM, "部门所属单位不能为空");
OrganizationalNode.TypeEnum nodeTypeEnum = OrganizationalNode.TypeEnum.getByValue(nodeType); OrganizationalNode.TypeEnum nodeTypeEnum = OrganizationalNode.TypeEnum.getByValue(nodeType);

View File

@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class OrgJobServiceImpl implements OrgJobService { public class OrgJobServiceImpl implements OrgJobService {
private OrgJobFoundationService foundationService; private final OrgJobFoundationService foundationService;
@Override @Override
public OrgJobDTO create(CreateOrgJobReq req) { public OrgJobDTO create(CreateOrgJobReq req) {

View File

@ -15,6 +15,7 @@ import cn.axzo.orgmanax.server.unit.foundation.dto.UnitCreator;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,8 +35,15 @@ public class UnitFoundationServiceImpl implements UnitFoundationService {
// 1. 重复校验 // 1. 重复校验
// 根据单位名称或信用代码查询 // 根据单位名称或信用代码查询
UnitQueryRepository.UnitResp unit = unitQueryRepository.one(UnitQueryRepository.OneReq.builder().name(creator.getCertificationLetterUrl()).build()); if (ObjectUtil.isNotEmpty(creator.getName())) {
Axssert.check(unit == null, BizResultCode.INVALID_PARAM,"创建失败, 单位重复"); UnitQueryRepository.UnitResp unit = unitQueryRepository.one(UnitQueryRepository.OneReq.builder().name(creator.getName()).build());
Axssert.check(unit == null, BizResultCode.INVALID_PARAM,"创建失败, 单位重复");
}
if (ObjectUtil.isNotEmpty(creator.getUniformSocialCreditCode())) {
UnitQueryRepository.UnitResp unit = unitQueryRepository.one(UnitQueryRepository.OneReq.builder().uniformSocialCreditCode(creator.getUniformSocialCreditCode()).build());
Axssert.check(unit == null, BizResultCode.INVALID_PARAM,"创建失败, 统一社会信用码重复");
}
// todo 1. parentId 是否使用 // todo 1. parentId 是否使用
// todo 2. 信用代码是否调用三方进行验证 // todo 2. 信用代码是否调用三方进行验证