Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public OpportunityQuotationGetResponse get(@PathVariable("id") String id) {
return opportunityQuotationService.get(id);
}

@GetMapping("/module/form/snapshot/{id}")
@RequiresPermissions(PermissionConstants.OPPORTUNITY_QUOTATION_READ)
@Operation(summary = "获取表单快照配置")
public ModuleFormConfigDTO getFormSnapshot(@PathVariable("id") String id) {
return opportunityQuotationService.getFormSnapshot(id, OrganizationContext.getOrganizationId());
}

//撤销审批
@GetMapping("/revoke/{id}")
@Operation(summary = "撤销报价单审批")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,4 +617,31 @@ private Set<String> extractIdsFromFieldValue(Object fieldValue) {
}


/**
* 获取表单快照
*
* @param id 报价单ID
* @param orgId 组织ID
* @return 表单配置DTO
*/
public ModuleFormConfigDTO getFormSnapshot(String id, String orgId) {
ModuleFormConfigDTO moduleFormConfigDTO = new ModuleFormConfigDTO();
OpportunityQuotation opportunityQuotation = opportunityQuotationMapper.selectByPrimaryKey(id);
if (opportunityQuotation == null) {
throw new GenericException(Translator.get("opportunity.quotation.not.exist"));
}
if (Strings.CI.equals(opportunityQuotation.getApprovalStatus(), ApprovalState.APPROVED.toString()) || Strings.CI.equals(opportunityQuotation.getApprovalStatus(), ApprovalState.APPROVING.toString())) {
LambdaQueryWrapper<OpportunityQuotationSnapshot> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OpportunityQuotationSnapshot::getQuotationId, id);
OpportunityQuotationSnapshot snapshot = snapshotBaseMapper.selectListByLambda(wrapper).stream().findFirst().orElse(null);
if (snapshot != null) {
moduleFormConfigDTO = JSON.parseObject(snapshot.getQuotationProp(), ModuleFormConfigDTO.class);
} else {
moduleFormConfigDTO = moduleFormCacheService.getBusinessFormConfig(FormKey.QUOTATION.getKey(), orgId);
}
} else {
moduleFormConfigDTO = moduleFormCacheService.getBusinessFormConfig(FormKey.QUOTATION.getKey(), orgId);
}
return moduleFormConfigDTO;
}
}
Loading