Resolved conflicts

This commit is contained in:
rajesh
2024-10-30 17:54:26 +05:30
parent fc43b8d082
commit e45aa789c6
11 changed files with 114 additions and 22 deletions

View File

@@ -20,6 +20,7 @@ import net.gepafin.tendermanagement.service.CallService;
import net.gepafin.tendermanagement.service.CompanyService;
import net.gepafin.tendermanagement.service.DocumentService;
import net.gepafin.tendermanagement.service.FormService;
import net.gepafin.tendermanagement.service.HubService;
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
import net.gepafin.tendermanagement.service.UserService;
import net.gepafin.tendermanagement.util.DateTimeUtil;
@@ -129,7 +130,10 @@ public class ApplicationDao {
private UserService userService;
@Autowired
S3PathConfig s3ConfigBean;
private S3PathConfig s3ConfigBean;
@Autowired
private HubService hubService;
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
@@ -722,9 +726,10 @@ public class ApplicationDao {
CallEntity call =applicationEntity.getCall();
CompanyEntity company = applicationEntity.getCompany();
ProtocolEntity protocol = applicationEntity.getProtocol();
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_TO_USER_AND_COMPANY,
call, null);
hub, null);
// Create the map for subject placeholders
Map<String, String> subjectPlaceholders = new HashMap<>();
@@ -755,9 +760,10 @@ public class ApplicationDao {
CallEntity call = applicationEntity.getCall();
CompanyEntity company = applicationEntity.getCompany();
ProtocolEntity protocol = applicationEntity.getProtocol();
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_TO_GEPAFIN,
call, null);
hub, null);
// Create the map for subject placeholders
Map<String, String> subjectPlaceholders = new HashMap<>();

View File

@@ -49,7 +49,7 @@ public class HubDao {
hubRepository.save(hubEntity);
}
private HubEntity validateHub(Long hubId) {
public HubEntity validateHub(Long hubId) {
return hubRepository.findById(hubId)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.HUB_NOT_FOUND)));

View File

@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import net.gepafin.tendermanagement.entities.CallEntity;
import net.gepafin.tendermanagement.entities.HubEntity;
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity;
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
@@ -25,24 +25,27 @@ public class SystemEmailTemplatesDao {
@Value("${fe.base.url}")
private String feBaseUrl;
@Value("${default.email.signature}")
private String defaultEmailSignature;
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, CallEntity call, Locale language) {
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null;
if(call != null){
if(hub != null){
// dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
// .findByTypeAndCallId(type.getValue(), call.getId());
}
if(dbSystemEmailTemplatesEntity == null){
if(dbSystemEmailTemplatesEntity == null) {
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
.findByType(type.getValue());
}
SystemEmailTemplateResponse systemEmailTemplateResponse = replaceHtmlContant(dbSystemEmailTemplatesEntity, call, language, Boolean.TRUE);
SystemEmailTemplateResponse systemEmailTemplateResponse = replaceHtmlContant(dbSystemEmailTemplatesEntity, hub, language, Boolean.TRUE);
return systemEmailTemplateResponse;
}
private SystemEmailTemplateResponse replaceHtmlContant(SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity,
CallEntity call, Locale language1, Boolean isDefaultReplace) {
HubEntity hub, Locale language1, Boolean isDefaultReplace) {
String language = null;
String htmlContent = dbSystemEmailTemplatesEntity.getHtmlContent();
String subject = dbSystemEmailTemplatesEntity.getSubject();
@@ -69,7 +72,8 @@ public class SystemEmailTemplatesDao {
}
htmlContent = replacePlatformLinkPlaceholder(call, htmlContent, languageMap);
htmlContent = replacePlatformLinkPlaceholderAndEmailSignature(hub, htmlContent, languageMap);
subject = replacePlatformLinkPlaceholderAndEmailSignature(hub, subject, languageMap);
SystemEmailTemplateResponse systemEmailTemplateResponse = new SystemEmailTemplateResponse();
systemEmailTemplateResponse.setHtmlContent(htmlContent);
systemEmailTemplateResponse.setSubject(subject);
@@ -102,15 +106,28 @@ public class SystemEmailTemplatesDao {
}
return "";
}
private String replacePlatformLinkPlaceholder(CallEntity call, String htmlContent,
private String replacePlatformLinkPlaceholderAndEmailSignature(HubEntity hub, String htmlContent,
Map<String, String> languageMap) {
String platformLink = feBaseUrl;
htmlContent = replacePlatformLinkPlaceholder(hub, htmlContent, languageMap);
htmlContent = replaceEmailSignature(hub, htmlContent, languageMap);
// if(hubEntity != null && Boolean.FALSE.equals(isEmpty(hubEntity.getDomainName()))){
// platformLink = hubEntity.getDomainName();
// }
htmlContent = htmlContent.replace("{{platform_link}}", platformLink);
return htmlContent;
}
private String replaceEmailSignature(HubEntity hub, String htmlContent, Map<String, String> languageMap) {
String emailSignature = defaultEmailSignature;
if(hub != null && Boolean.FALSE.equals(StringUtils.isEmpty(hub.getEmailSignature()))){
emailSignature = hub.getEmailSignature();
}
return htmlContent.replace("{{email_signature}}", emailSignature);
}
private String replacePlatformLinkPlaceholder(HubEntity hub, String htmlContent, Map<String, String> languageMap) {
String platformLink = feBaseUrl;
if(hub != null && Boolean.FALSE.equals(StringUtils.isEmpty(hub.getDomainName()))){
platformLink = hub.getDomainName();
}
return htmlContent.replace("{{platform_link}}", platformLink);
}
}