Merge remote-tracking branch 'origin/feature/REQ-3300' into feature/REQ-3300
This commit is contained in:
commit
34b7cfd5f0
@ -11,7 +11,6 @@ import cn.axzo.nanopart.visa.api.request.VisaChangePageSearchReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaChangeTempCreateReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaDetailByIdRequest;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaInitiatorListReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaRecordSelectReq;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaChangeInitiatorResp;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaChangePageSearchResp;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaDetailByIdResponse;
|
||||
@ -88,15 +87,6 @@ public interface ChangeRecordApi {
|
||||
@PostMapping("/api/visa/change/export")
|
||||
ApiResult<Void> exportVisaChangeRecord(@RequestBody @Validated VisaChangeExportReq req);
|
||||
|
||||
/**
|
||||
* 变更单选择器
|
||||
*
|
||||
* @param req {@link VisaRecordSelectReq} 筛选条件
|
||||
* @return 变更单列表
|
||||
*/
|
||||
@PostMapping("/api/visa/change/record/select")
|
||||
ApiResult<List<VisaChangePageSearchResp>> selectVisaChangeRecord(@RequestBody @Validated VisaRecordSelectReq req);
|
||||
|
||||
/**
|
||||
* 获取发起人列表
|
||||
*
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.nanopart.visa.api.request;
|
||||
|
||||
import cn.axzo.maokai.common.enums.SaasCooperateShipCooperateTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -42,7 +43,7 @@ public class VisaChangeApproveCreateReq extends VisaChangeTempCreateReq {
|
||||
*
|
||||
* @see cn.axzo.maokai.common.enums.SaasCooperateShipCooperateTypeEnum
|
||||
*/
|
||||
private Integer type;
|
||||
private SaasCooperateShipCooperateTypeEnum type;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
@ -52,12 +53,27 @@ public class VisaChangeApproveCreateReq extends VisaChangeTempCreateReq {
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
private Long unitId;
|
||||
private Long ouId;
|
||||
|
||||
/**
|
||||
* 节点 Id
|
||||
*/
|
||||
private Long nodeId;
|
||||
/**
|
||||
* 审批人personId列表
|
||||
*/
|
||||
private List<Long> personIdList;
|
||||
private Long personId;
|
||||
|
||||
/**
|
||||
* (主要用于回显)审批人的姓名
|
||||
*/
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* (主要用于回显)审批人头像
|
||||
*/
|
||||
private String avatarUrl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -106,4 +106,9 @@ public class VisaChangePageSearchReq {
|
||||
*/
|
||||
private List<Long> visaIds;
|
||||
|
||||
/**
|
||||
* 是否需要主单据(即是否被其他单据关联)信息
|
||||
*/
|
||||
private Boolean needRelatedBill = false;
|
||||
|
||||
}
|
||||
|
||||
@ -156,17 +156,20 @@ public class VisaChangeTempCreateReq {
|
||||
*/
|
||||
private SaasCooperateShipCooperateTypeEnum type;
|
||||
|
||||
/**
|
||||
* 单位 ID
|
||||
*/
|
||||
private Long ouId;
|
||||
|
||||
/**
|
||||
* 单位的顶级节点Id或项目内班组节点id
|
||||
* 确认人所在部门节点id或项目内班组节点id
|
||||
*/
|
||||
private Long nodeId;
|
||||
|
||||
/**
|
||||
* 确认人personId
|
||||
*/
|
||||
private List<Long> personId;
|
||||
private Long personId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
package cn.axzo.nanopart.visa.api.request;
|
||||
|
||||
import cn.axzo.nanopart.visa.api.enums.VisaStatusEnum;
|
||||
import cn.axzo.nanopart.visa.api.enums.VisaTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author chenwenjian
|
||||
* @version 1.0
|
||||
* @date 2025/1/17 16:55
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VisaRecordSelectReq {
|
||||
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
* <p>
|
||||
* DESIGN_CHANGE:设计变更
|
||||
* TECHNOLOGY_APPROVED:技术核定
|
||||
* PROJECT_VISA:工程签证
|
||||
* </p>
|
||||
*
|
||||
* @see VisaTypeEnum
|
||||
*/
|
||||
private VisaTypeEnum type;
|
||||
|
||||
/**
|
||||
* 单号或主题
|
||||
* <p>
|
||||
* 单号精确搜索,主题模糊搜索
|
||||
* </p>
|
||||
*/
|
||||
private String keyword;
|
||||
|
||||
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
private List<Long> initiators;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private List<VisaStatusEnum> statuses;
|
||||
|
||||
}
|
||||
@ -108,6 +108,15 @@ public class VisaChangePageSearchResp {
|
||||
*/
|
||||
private VisaChangeInitiatorResp initiator;
|
||||
|
||||
/**
|
||||
* 发生原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 是否被其他单据关联
|
||||
*/
|
||||
private Boolean isRelated;
|
||||
|
||||
public String getTypeDesc() {
|
||||
if (Objects.isNull(type)) {
|
||||
return null;
|
||||
|
||||
@ -13,7 +13,6 @@ import cn.axzo.nanopart.visa.api.request.VisaChangePageSearchReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaChangeTempCreateReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaDetailByIdRequest;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaInitiatorListReq;
|
||||
import cn.axzo.nanopart.visa.api.request.VisaRecordSelectReq;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaChangeInitiatorResp;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaChangePageSearchResp;
|
||||
import cn.axzo.nanopart.visa.api.response.VisaDetailByIdResponse;
|
||||
@ -89,11 +88,6 @@ public class ChangeRecordController implements ChangeRecordApi {
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<List<VisaChangePageSearchResp>> selectVisaChangeRecord(VisaRecordSelectReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<List<VisaChangeInitiatorResp>> listInitiator(VisaInitiatorListReq req) {
|
||||
return ApiResult.ok(changeRecordService.listInitiator(req));
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.nanopart.visa.server.service;
|
||||
|
||||
import cn.axzo.nanopart.visa.api.enums.VisaRelationFieldEnum;
|
||||
import cn.axzo.nanopart.visa.server.domain.ChangeRecordBill;
|
||||
import cn.axzo.nanopart.visa.server.dto.VisaBillDto;
|
||||
|
||||
@ -38,4 +39,13 @@ public interface ChangeRecordBillService {
|
||||
*/
|
||||
List<ChangeRecordBill> listById(Long visaId);
|
||||
|
||||
/**
|
||||
* 获取指定类型单据的主单据(是否被其他单据关联)
|
||||
*
|
||||
* @param billType 单据类型
|
||||
* @param billIds 单据id
|
||||
* @return 主单据信息
|
||||
*/
|
||||
List<ChangeRecordBill> findMainBill(VisaRelationFieldEnum billType, List<Long> billIds);
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package cn.axzo.nanopart.visa.server.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.nanopart.visa.api.enums.VisaRelationFieldEnum;
|
||||
import cn.axzo.nanopart.visa.server.domain.ChangeRecordBill;
|
||||
import cn.axzo.nanopart.visa.server.dto.VisaBillDto;
|
||||
import cn.axzo.nanopart.visa.server.mapper.ChangeRecordBillDao;
|
||||
@ -24,7 +26,7 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ChangeRecordBillServiceImpl extends ServiceImpl<ChangeRecordBillDao, ChangeRecordBill> implements ChangeRecordBillService {
|
||||
public class ChangeRecordBillServiceImpl extends ServiceImpl<ChangeRecordBillDao, ChangeRecordBill> implements ChangeRecordBillService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
@ -56,6 +58,7 @@ public class ChangeRecordBillServiceImpl extends ServiceImpl<ChangeRecordBillDao
|
||||
.eq(ChangeRecordBill::getIsDelete, 0)
|
||||
.setSql("is_delete = id").update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询记录
|
||||
*/
|
||||
@ -74,6 +77,17 @@ public class ChangeRecordBillServiceImpl extends ServiceImpl<ChangeRecordBillDao
|
||||
return findByCondition(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChangeRecordBill> findMainBill(VisaRelationFieldEnum billType, List<Long> billIds) {
|
||||
AssertUtil.notNull(billType, "单据类型不能为空");
|
||||
AssertUtil.notEmpty(billIds, "单据Id不能为空");
|
||||
return lambdaQuery().in(ChangeRecordBill::getBillId, billIds)
|
||||
.eq(ChangeRecordBill::getBillType, billType)
|
||||
.eq(ChangeRecordBill::getIsDelete, 0)
|
||||
.orderByDesc(ChangeRecordBill::getUpdateAt)
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数量
|
||||
*/
|
||||
|
||||
@ -152,7 +152,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
@Resource
|
||||
private VisaOrganizationalNodeUserGateway nodeUserGateway;
|
||||
|
||||
// @Resource
|
||||
// @Resource
|
||||
// private ReportServiceSDK reportServiceSDK;
|
||||
@Resource
|
||||
private WorkflowGateway workflowGateway;
|
||||
@ -430,7 +430,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
// 相关单位与人员
|
||||
if (CollectionUtils.isNotEmpty(req.getRelationUnitAndPersonList())) {
|
||||
confirmPerson = req.getRelationUnitAndPersonList().stream()
|
||||
.flatMap(rup -> rup.getPersonId().stream().map(p -> buildVisaConfirmDto(changeRecord, rup, p)))
|
||||
.map(p -> buildVisaConfirmDto(p, changeRecord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
changeRecordConfirmService.addConfirm(confirmPerson);
|
||||
@ -670,7 +670,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
.page(Math.toIntExact(page.getCurrent()))
|
||||
.pageSize(Math.toIntExact(page.getSize()))
|
||||
.totalCount(page.getTotal())
|
||||
.list(buildVisaChangePageSearchResp(page.getRecords()))
|
||||
.list(buildVisaChangePageSearchResp(page.getRecords(), req))
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -767,7 +767,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<VisaChangePageSearchResp> buildVisaChangePageSearchResp(List<ChangeRecord> records) {
|
||||
private List<VisaChangePageSearchResp> buildVisaChangePageSearchResp(List<ChangeRecord> records, VisaChangePageSearchReq req) {
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -790,6 +790,22 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
Map<Long, OrgNodeUserBriefInfoResp> initiatorMap = getPersonBriefInfoMap(records.get(0).getRelationWorkspaceId(), initiatorPersonIdList);
|
||||
AssertUtil.isTrue(CollUtil.isNotEmpty(initiatorMap), "发起人信息获取失败");
|
||||
|
||||
// 获取主单据信息
|
||||
Map<Long, Long> billMainMap;
|
||||
if (req.getNeedRelatedBill()) {
|
||||
List<Long> billIds = records.stream().map(ChangeRecord::getId).distinct().collect(Collectors.toList());
|
||||
List<ChangeRecordBill> mainBill = changeRecordBillService.findMainBill(VisaRelationFieldEnum.VISA_ORDER, billIds);
|
||||
if (CollectionUtils.isEmpty(mainBill)) {
|
||||
billMainMap = null;
|
||||
log.info("所有单据均为主单据");
|
||||
} else {
|
||||
// Map<billId,visaId>
|
||||
billMainMap = mainBill.stream().collect(Collectors.toMap(ChangeRecordBill::getBillId, ChangeRecordBill::getVisaId, (v1, v2) -> v2));
|
||||
}
|
||||
} else {
|
||||
billMainMap = null;
|
||||
}
|
||||
|
||||
/*组装信息*/
|
||||
return records.stream()
|
||||
.map(r -> {
|
||||
@ -798,6 +814,8 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
resp.setRelationProjectName(projectIdNameMap.get(r.getRelationProject()));
|
||||
// 发起人
|
||||
resp.setInitiator(buildInitiatorResp(initiatorMap, visaIdInitiatorMap.get(r.getId())));
|
||||
// 是否被其他单据关联
|
||||
resp.setIsRelated(Objects.nonNull(billMainMap) && Objects.nonNull(billMainMap.get(r.getId())));
|
||||
return resp;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
@ -847,16 +865,16 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
.build();
|
||||
}
|
||||
|
||||
private static VisaConfirmDto buildVisaConfirmDto(ChangeRecord changeRecord, VisaChangeTempCreateReq.RelationUnitAndPerson rup, Long personId) {
|
||||
private static VisaConfirmDto buildVisaConfirmDto(VisaChangeTempCreateReq.RelationUnitAndPerson person, ChangeRecord changeRecord) {
|
||||
return VisaConfirmDto.builder()
|
||||
.visaId(changeRecord.getId())
|
||||
.type(rup.getType())
|
||||
.type(person.getType())
|
||||
.bizType(VisaConfirmBizTypeEnum.CONFIRM)
|
||||
.personId(personId)
|
||||
.ouId(rup.getOuId())
|
||||
.personId(person.getPersonId())
|
||||
.ouId(person.getOuId())
|
||||
.workspaceId(changeRecord.getRelationWorkspaceId())
|
||||
.projectId(changeRecord.getRelationProject())
|
||||
.nodeId(rup.getNodeId())
|
||||
.nodeId(person.getNodeId())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -880,18 +898,17 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
||||
});
|
||||
}
|
||||
// 相关单位及人员存在性
|
||||
if (CollectionUtils.isNotEmpty(req.getRelationUnitAndPersonList())) {
|
||||
List<VisaChangeTempCreateReq.RelationUnitAndPerson> team = req.getRelationUnitAndPersonList().stream()
|
||||
.filter(r -> {
|
||||
AssertUtil.notNull(r.getType(), "相关单位类型错误");
|
||||
AssertUtil.isTrue(NumberUtil.isPositiveNumber(r.getOuId()), "请选择" + r.getType().getDesc());
|
||||
AssertUtil.isTrue(NumberUtil.isPositiveNumber(r.getNodeId()), "请选择" + r.getType().getDesc());
|
||||
AssertUtil.notEmpty(r.getPersonId(), "请选择" + r.getType().getDesc() + "确认人");
|
||||
AssertUtil.isTrue(r.getPersonId().size() <= verifyPersonLimit, String.format(r.getType().getDesc() + "确认人,最多支持{}个", verifyPersonLimit));
|
||||
return Objects.equals(SaasCooperateShipCooperateTypeEnum.PROJ_TEAM, r.getType());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
List<VisaChangeTempCreateReq.RelationUnitAndPerson> unit = req.getRelationUnitAndPersonList();
|
||||
// if (CollectionUtils.isNotEmpty(req.getRelationUnitAndPersonList())) {
|
||||
// List<VisaChangeTempCreateReq.RelationUnitAndPerson> team = req.getRelationUnitAndPersonList().stream()
|
||||
// .filter(r -> {
|
||||
// AssertUtil.notNull(r.getType(), "相关单位类型错误");
|
||||
// AssertUtil.isTrue(NumberUtil.isPositiveNumber(r.getOuId()), "请选择" + r.getType().getDesc());
|
||||
// AssertUtil.isTrue(NumberUtil.isPositiveNumber(r.getNodeId()), "请选择" + r.getType().getDesc());
|
||||
//// AssertUtil.isTrue(r.getPersonId().size() <= verifyPersonLimit, String.format(r.getType().getDesc() + "确认人,最多支持{}个", verifyPersonLimit));
|
||||
// return Objects.equals(SaasCooperateShipCooperateTypeEnum.PROJ_TEAM, r.getType());
|
||||
// })
|
||||
// .collect(Collectors.toList());
|
||||
// List<VisaChangeTempCreateReq.RelationUnitAndPerson> unit = req.getRelationUnitAndPersonList();
|
||||
// if (CollectionUtils.isNotEmpty(team)) {
|
||||
// // 去除班组
|
||||
// List<Long> teamNodeId = team.stream().map(VisaChangeTempCreateReq.RelationUnitAndPerson::getOuIdOrTeamNodeId).distinct().collect(Collectors.toList());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user