Merge pull request #75 from Kitzanos/update-application-status-prod
Cherry-pick(Update application status prod)
This commit is contained in:
@@ -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) {
|
||||
@@ -615,8 +619,11 @@ public class ApplicationDao {
|
||||
sendMailToUserAndCompany(userEntity, applicationEntity);
|
||||
sendMailTodefaultSystemAndGepafin(userEntity, applicationEntity);
|
||||
applicationEntity.setStatus(status.getValue());
|
||||
applicationEntity = saveApplicationEntity(applicationEntity);
|
||||
}
|
||||
if (status.equals(ApplicationStatusTypeEnum.DRAFT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.AWAITING.getValue()))) {
|
||||
applicationEntity.setStatus(status.getValue());
|
||||
}
|
||||
applicationEntity = saveApplicationEntity(applicationEntity);
|
||||
|
||||
|
||||
return getApplicationResponse(applicationEntity);
|
||||
@@ -719,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<>();
|
||||
@@ -752,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<>();
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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,10 +25,13 @@ 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());
|
||||
}
|
||||
@@ -37,12 +40,12 @@ public class SystemEmailTemplatesDao {
|
||||
.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,8 @@ public class HubEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "UNIQUE_UUID")
|
||||
private String uniqueUuid;
|
||||
|
||||
@Column(name = "EMAIL_SIGNATURE")
|
||||
private String emailSignature;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,5 @@ public interface HubService {
|
||||
void deleteHub(Long hubId);
|
||||
HubEntity getHubByUuid(String hubUuid);
|
||||
HubResponseBean getHubByHubUuid(String uuid);
|
||||
HubEntity valdateHub(Long hubId);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package net.gepafin.tendermanagement.service;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.HubEntity;
|
||||
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
||||
|
||||
public interface SystemEmailTemplatesService {
|
||||
|
||||
SystemEmailTemplateResponse retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum type, CallEntity call, Locale language);
|
||||
SystemEmailTemplateResponse retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language);
|
||||
|
||||
}
|
||||
|
||||
@@ -56,4 +56,8 @@ public class HubServiceImpl implements HubService {
|
||||
public HubResponseBean getHubByHubUuid(String uuid) {
|
||||
return hubDao.getHubByHubUuid(uuid);
|
||||
}
|
||||
@Override
|
||||
public HubEntity valdateHub(Long hubId) {
|
||||
return hubDao.validateHub(hubId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import net.gepafin.tendermanagement.dao.SystemEmailTemplatesDao;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.HubEntity;
|
||||
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
||||
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
||||
@@ -19,8 +19,8 @@ public class SystemEmailTemplatesServiceImpl implements SystemEmailTemplatesServ
|
||||
|
||||
|
||||
@Override
|
||||
public SystemEmailTemplateResponse retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum type, CallEntity call, Locale language) {
|
||||
return systemEmailTemplatesDao.retrieveTemplate(type, call, language);
|
||||
public SystemEmailTemplateResponse retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
|
||||
return systemEmailTemplatesDao.retrieveTemplate(type, hub, language);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,3 +60,5 @@ mailGun_base_url=https://api.eu.mailgun.net/
|
||||
apiKey=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
|
||||
#senderEmail=mailer@bflows.net
|
||||
|
||||
default.email.signature=Gepafin S.p.a
|
||||
|
||||
|
||||
@@ -1483,5 +1483,26 @@
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="31-10-2024_1" author="Rajesh Khore">
|
||||
<addColumn tableName="hub">
|
||||
<column name="EMAIL_SIGNATURE" type="TEXT"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="31-10-2024_2" author="Rajesh Khore">
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/updated_system_email_template_for_application_submition_30-10-2024.sql"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="31-10-2024_3" author="Rajesh Khore">
|
||||
<update tableName="hub">
|
||||
<column name="EMAIL_SIGNATURE" value="Gepafin S.p.a"/>
|
||||
<where>UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs'</where>
|
||||
</update>
|
||||
<update tableName="hub">
|
||||
<column name="EMAIL_SIGNATURE" value="Sviluppumbria S.p.a"/>
|
||||
<where>UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE'</where>
|
||||
</update>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
UPDATE gepafin_schema.system_email_template SET html_content='<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #333; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p>Buongiorno,</p>
|
||||
<p>
|
||||
Si comunica che, in riferimento alla domanda di concessione di
|
||||
Finanziamento agevolato a valere sul Fondo prestiti
|
||||
<strong>{{call_name}}</strong> di cui all''oggetto, la stessa è stata
|
||||
regolarmente acquisita ed è stata registrata con Protocollo n.
|
||||
<strong>{{protocol_number}}</strong> del <strong>{{date}}</strong> alle
|
||||
<strong>{{time}}</strong>.
|
||||
</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p>
|
||||
<strong>{{email_signature}}</strong>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>' WHERE "type"='APPLICATION_SUBMISSION_TO_USER_AND_COMPANY' AND "system"=true ;
|
||||
|
||||
|
||||
UPDATE gepafin_schema.system_email_template SET html_content='<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #333; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p>
|
||||
In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti
|
||||
<strong>{{call_name}}</strong> di cui all’oggetto, la stessa è stata regolarmente acquisita ed è stata
|
||||
registrata con Protocollo n. <strong>{{protocol_number}}</strong> del <strong>{{date}}</strong> alle <strong>{{time}}</strong>.
|
||||
</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p>
|
||||
<strong>{{email_signature}}</strong>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>' WHERE "type"='APPLICATION_SUBMISSION_TO_GEPAFIN' AND "system"=true;
|
||||
|
||||
Reference in New Issue
Block a user