Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240808102851 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String value = null;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm)) {
|
||||
value = String.join("|",
|
||||
"laboratorio2@gruppomilo.it",
|
||||
"magazzino.secco@gruppomilo.it",
|
||||
"confezionamento.secco@gruppomilo.it",
|
||||
"produzione1@gruppomilo.it",
|
||||
"logistica@gruppomilo.it",
|
||||
"produzione.secco@gruppomilo.it",
|
||||
"ing.controllo@gruppomilo.it"
|
||||
);
|
||||
}
|
||||
|
||||
createSetup(
|
||||
"MES", "MAIL", "INDIRIZZI_QUARANTENA",
|
||||
value, "Lista di indirizzi mail divisi da | alla quale mandare i dati dei colli in quarantena.",
|
||||
null, true
|
||||
);
|
||||
|
||||
value = null;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm)) {
|
||||
value = "<p>Gentile Utente, di seguito i riferimenti delle pedane che vanno posizionate in Quarantena (dep [codMdep]):</p>\n" +
|
||||
"<p></p>\n" +
|
||||
"<table style=\"border-collapse:collapse;border-spacing:0;margin:0px auto\" class=\"tg\"><thead>\n" +
|
||||
"<tr><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Data collo</th><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Numero collo</th><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Articolo</th><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Partita</th>\n" +
|
||||
"<th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">PZ</th><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Cartoni</th><th style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">Posizione</th></tr>\n" +
|
||||
"</thead>\n" +
|
||||
"<tbody>\n" +
|
||||
"<tr><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[dataCollo]</td><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[numCollo]</td><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[articolo]</td><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[partitaMag]</td>\n" +
|
||||
"<td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[qtaCol]</td><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[numCnf]</td><td style=\"border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;text-align:center;vertical-align:top;word-break:normal\">[posizione]</td></tr>\n" +
|
||||
"</tbody></table>";
|
||||
}
|
||||
|
||||
createSetup(
|
||||
"MES", "MAIL", "TESTO_MAIL_QUARANTENA",
|
||||
value, "Contenuto della mail inviata durante la creazione di un collo in quarantena.", null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.StbEmail;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.security.utility.CryptoUtils;
|
||||
@@ -202,6 +203,16 @@ public class MailService {
|
||||
replyToName, List<IFileSharerAttachment> emailFileAttachmentList, boolean requestDeliveryNotification,
|
||||
String deliveryNotificationTo) throws
|
||||
Exception {
|
||||
return sendMailPrimary(multiDBTransactionManager, from, fromName, Arrays.asList(to.split(";")), Arrays.asList(cc.split(";")), Arrays.asList(ccn.split(";")),
|
||||
subject, msgText, isHtml, isDebug, replyTo, replyToName, emailFileAttachmentList, requestDeliveryNotification, deliveryNotificationTo);
|
||||
}
|
||||
|
||||
public Message sendMailPrimary(MultiDBTransactionManager multiDBTransactionManager, String from, String
|
||||
fromName, List<String> listTo, List<String> listCc, List<String> ListCcn,
|
||||
String subject, String msgText, Boolean isHtml, Boolean isDebug, String replyTo, String
|
||||
replyToName, List<IFileSharerAttachment> emailFileAttachmentList, boolean requestDeliveryNotification,
|
||||
String deliveryNotificationTo) throws
|
||||
Exception {
|
||||
|
||||
EmailFileSharerSettings fileSharerSettings = internalReadParameter(multiDBTransactionManager, from);
|
||||
|
||||
@@ -216,21 +227,21 @@ public class MailService {
|
||||
fileSharerSettings.withFrom(fromName + "<" + from + ">");
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(to)) {
|
||||
for (String toSplitted : to.split(";")) {
|
||||
fileSharerSettings.to(toSplitted);
|
||||
if (!UtilityList.isNullOrEmpty(listTo)) {
|
||||
for (String to : listTo) {
|
||||
fileSharerSettings.to(to);
|
||||
}
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(cc)) {
|
||||
for (String ccSplitted : cc.split(";")) {
|
||||
fileSharerSettings.cc(ccSplitted);
|
||||
if (!UtilityList.isNullOrEmpty(listCc)) {
|
||||
for (String cc : listCc) {
|
||||
fileSharerSettings.cc(cc);
|
||||
}
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ccn)) {
|
||||
for (String ccnSplitted : ccn.split(";")) {
|
||||
fileSharerSettings.bcc(ccnSplitted);
|
||||
if (!UtilityList.isNullOrEmpty(ListCcn)) {
|
||||
for (String ccn : ListCcn) {
|
||||
fileSharerSettings.bcc(ccn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,7 +709,7 @@ public class MailService {
|
||||
private String changeRepeatedText(String text, List<CustomEmailDTO.CustomEmailRowDTO> dati, String
|
||||
nomeUtente) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (text.indexOf("{") > 0){
|
||||
if (text.indexOf("{") > 0) {
|
||||
String patternText = text.substring(text.indexOf("{") + 1, text.indexOf("}"));
|
||||
for (CustomEmailDTO.CustomEmailRowDTO var : dati) {
|
||||
stringBuilder.append(changeVariableParts(patternText, var, nomeUtente) + CommonConstants.A_CAPO);
|
||||
|
||||
@@ -78,7 +78,7 @@ public class DroolsDataCompleting {
|
||||
System.setProperty("drools.dialect.mvel.strict", "false");
|
||||
|
||||
|
||||
if (shouldCompileDrools()) {
|
||||
if (shouldCompileDrools() || !compiledDrlFile.exists()) {
|
||||
File directory = new File(compiledRulesPath);
|
||||
if (!directory.exists())
|
||||
directory.mkdirs();
|
||||
|
||||
@@ -161,11 +161,14 @@ public class SocialWareEcommerceService {
|
||||
+ "/index.php?route=rest/product_admin/products");
|
||||
|
||||
Response response;
|
||||
response = resource.request().header("X-Oc-Restadmin-Id", password).post(Entity.json(jsonBody));
|
||||
|
||||
/* Response response;
|
||||
if ("U".compareTo(tipoVariazione) == 0) {
|
||||
response = resource.request().header("X-Oc-Restadmin-Id", password).put(Entity.json(jsonBody));
|
||||
} else {
|
||||
response = resource.request().header("X-Oc-Restadmin-Id", password).post(Entity.json(jsonBody));
|
||||
}
|
||||
}*/
|
||||
|
||||
String value = response.readEntity(String.class);
|
||||
SocialwareResponse respInsert = jsonObjectMapper.readValue(value, SocialwareResponse.class);
|
||||
|
||||
@@ -15,10 +15,8 @@ import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.production.dto.*;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.HttpRestWrapper;
|
||||
import it.integry.ems.service.PrinterService;
|
||||
import it.integry.ems.service.ReportProcessor;
|
||||
import it.integry.ems.service.*;
|
||||
import it.integry.ems.service.dto.MailTemplateDataDTO;
|
||||
import it.integry.ems.service.exception.EmptyReportException;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
@@ -80,6 +78,12 @@ public class MesProductionServiceV2 {
|
||||
@Autowired
|
||||
private ProductionWarehouseService productionWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private MailService mailService;
|
||||
|
||||
@Autowired
|
||||
private MailTemplateService mailTemplateService;
|
||||
|
||||
public BasePanelAnswerDTO callSupervisorServiceGET(String serviceIp, int servicePort, String serviceName, HashMap<String, String> queryParams) throws Exception {
|
||||
String url = String.format("http://%s:%d/%s", serviceIp, servicePort, serviceName);
|
||||
StringBuilder srb = new StringBuilder();
|
||||
@@ -1021,6 +1025,40 @@ public class MesProductionServiceV2 {
|
||||
|
||||
entityProcessor.processEntity(mtbColtToInsert, true, multiDBTransactionManager);
|
||||
|
||||
if (dto.isSegnaQuarantena()) {
|
||||
String indirizziQuarantena = setupGest.getSetup("MES", "MAIL", "INDIRIZZI_QUARANTENA");
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(indirizziQuarantena)) {
|
||||
String testoMailQuarantena = setupGest.getSetup("MES", "MAIL", "TESTO_MAIL_QUARANTENA");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(testoMailQuarantena)) {
|
||||
throw new GestSetupNotFoundException("MES", "SETUP", "TESTO_MAIL_QUARANTENA");
|
||||
}
|
||||
|
||||
testoMailQuarantena = testoMailQuarantena
|
||||
.replace("[codMdep]", mtbColtToInsert.getCodMdep())
|
||||
.replace("[dataCollo]", UtilityLocalDate.formatDate(mtbColtToInsert.getDataCollo(), CommonConstants.DATE_FORMAT_DMY))
|
||||
.replace("[numCollo]", String.valueOf(mtbColtToInsert.getNumCollo()))
|
||||
.replace("[articolo]", String.format("%s - %s", mtbAart.getCodMart(), mtbAart.getDescrizione()))
|
||||
.replace("[partitaMag]", mtbColrToInsert.getPartitaMag())
|
||||
.replace("[qtaCol]", UtilityString.bigDecimalToString(mtbColrToInsert.getQtaCol(), "#,###"))
|
||||
.replace("[numCnf]", UtilityString.bigDecimalToString(mtbColrToInsert.getNumCnf(), "#,###"))
|
||||
.replace("[posizione]", mtbColtToInsert.getPosizione());
|
||||
|
||||
String subject = "Pedane in Quarantena";
|
||||
|
||||
final MailTemplateDataDTO mailTemplateData = new MailTemplateDataDTO()
|
||||
.setTitle(subject)
|
||||
.setContent(testoMailQuarantena);
|
||||
|
||||
String htmlMailText = mailTemplateService.getGenericEmailTemplate(MailService.Level.INFO, mailTemplateData);
|
||||
|
||||
// SEND
|
||||
mailService.sendMailPrimary(multiDBTransactionManager, null, null, Arrays.asList(indirizziQuarantena.split("\\|")), null, null,
|
||||
subject, htmlMailText, true, false, null, null,
|
||||
null, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
return mtbColtToInsert;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user