Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -11,6 +11,7 @@ public enum EntityExportType {
|
||||
ORDINI("ORDINI"),
|
||||
ORDINI_ACQUISTO("ORDINI ACQUISTO"),
|
||||
ORDINI_VENDITA("ORDINI VENDITA"),
|
||||
RISORSE_UMANE("RISORSE UMANE"),
|
||||
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
|
||||
OFFERTE("OFFERTE"),
|
||||
RAPPORTINI("RAPPORTINI"),
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240320141352 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("svw_menu_no_pb", "CREATE view [dbo].[svw_menu_no_pb] as \n" +
|
||||
"WITH GerarchiaMenu AS (SELECT sm.cod_opz,\n" +
|
||||
" sm.descrizione,\n" +
|
||||
" sm.cod_parent,\n" +
|
||||
" smo.gest_name,\n" +
|
||||
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" sm.tipo_azienda,\n" +
|
||||
" sm.flag_attivo,\n" +
|
||||
" sm.pos,\n" +
|
||||
" sm_g.pos AS pos_gruppo,\n" +
|
||||
" sm_g.descrizione AS gruppo\n" +
|
||||
" FROM stb_menu sm\n" +
|
||||
" INNER JOIN stb_menu_opz smo ON sm.cod_opz = smo.cod_opz \n" +
|
||||
" INNER JOIN stb_menu sm_g ON sm.cod_parent = sm_g.cod_opz AND\n" +
|
||||
" sm.tipo_azienda = sm_g.tipo_azienda\n" +
|
||||
" WHERE sm.cod_parent in ( 'MM007', 'WM002')\n" +
|
||||
" AND sm.tipo_azienda = (select tipo_azienda from azienda)\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT sm_c.cod_opz,\n" +
|
||||
" sm_c.descrizione,\n" +
|
||||
" sm_c.cod_parent,\n" +
|
||||
" smo.gest_name,\n" +
|
||||
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" sm_c.tipo_azienda,\n" +
|
||||
" sm_c.flag_attivo,\n" +
|
||||
" sm_c.pos,\n" +
|
||||
" sm_g.pos AS pos_gruppo,\n" +
|
||||
" sm_g.descrizione AS gruppo\n" +
|
||||
" FROM stb_menu sm_c\n" +
|
||||
" INNER JOIN GerarchiaMenu gm ON sm_c.cod_parent = gm.cod_opz\n" +
|
||||
" INNER JOIN stb_menu_opz smo on sm_c.cod_opz = smo.cod_opz\n" +
|
||||
" INNER JOIN stb_menu sm_g ON sm_c.cod_parent = sm_g.cod_opz AND\n" +
|
||||
" sm_c.tipo_azienda = sm_g.tipo_azienda\n" +
|
||||
" WHERE sm_c.tipo_azienda = gm.tipo_azienda)\n" +
|
||||
"SELECT DISTINCT gm.cod_opz,\n" +
|
||||
" descrizione,\n" +
|
||||
" cod_parent,\n" +
|
||||
" gm.gest_name,\n" +
|
||||
" gm.type,\n" +
|
||||
" tipo_azienda,\n" +
|
||||
" gm.pos,\n" +
|
||||
" gm.pos_gruppo,\n" +
|
||||
" gm.gruppo\n" +
|
||||
"FROM GerarchiaMenu gm\n" +
|
||||
"WHERE gm.gest_name IS NOT NULL\n" +
|
||||
" AND gm.flag_attivo = 'S'");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,13 @@ public class PackagesRules extends QueryRules {
|
||||
Date data, String gestione) throws Exception {
|
||||
|
||||
Short anno = new Short(new SimpleDateFormat("yyyy").format(data));
|
||||
|
||||
return completeNumCollo(connection, serie, anno, gestione);
|
||||
}
|
||||
|
||||
public static Integer completeNumCollo(Connection connection, String serie,
|
||||
Short anno, String gestione) throws Exception {
|
||||
|
||||
CallableStatement cs = connection.prepareCall("{call dbo.NextNumCol(?, ?, ?, ?)}");
|
||||
cs.setString(1, serie);
|
||||
cs.setShort(2, anno);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -466,16 +466,24 @@ public class ContabilImportService {
|
||||
"SELECT *\n" +
|
||||
"FROM ctb_part\n" +
|
||||
" INNER JOIN gtb_anag ON ctb_part.cod_anag = gtb_anag.cod_anag\n" +
|
||||
"WHERE gtb_anag.diacod = %s\n" +
|
||||
" AND ctb_part.data_doc = %s\n" +
|
||||
" AND ctb_part.num_doc = %s",
|
||||
cacheCodAnag,
|
||||
dataDoc,
|
||||
stringNumDoc
|
||||
"WHERE gtb_anag.diacod = %s\n",
|
||||
cacheCodAnag
|
||||
);
|
||||
|
||||
String whereCond = "";
|
||||
|
||||
if (dataDoc.before(UtilityDate.StringToDate("01/07/2021", CommonConstants.DATE_FORMAT_DMY))) {
|
||||
whereCond = " ctb_part.anno_part = '2021'\n" +
|
||||
" AND ctb_part.ser_doc = '/'\n" +
|
||||
" AND ctb_part.num_doc = 0";
|
||||
} else {
|
||||
whereCond = Query.format(" ctb_part.data_doc = %s\n AND ctb_part.num_doc = %s", dataDoc, stringNumDoc);
|
||||
}
|
||||
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
||||
|
||||
ctbPart = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbPart.class);
|
||||
if (ctbPart != null){
|
||||
if (ctbPart != null) {
|
||||
ctbPartList.add(ctbPart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,4 +785,21 @@ public class LogisticController {
|
||||
return sr;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "reserveNextNumCollo", method = RequestMethod.POST)
|
||||
public @ResponseBody ServiceRestResponse reserveNextNumCollo(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam Short anno,
|
||||
@RequestParam String serCollo,
|
||||
@RequestParam String gestione
|
||||
) {
|
||||
try {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(logisticService.reserveNextNumCollo(anno, serCollo, gestione));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, profileDb, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import it.integry.ems.response.FileItem;
|
||||
import it.integry.ems.rules.businessLogic.LoadColliService;
|
||||
import it.integry.ems.rules.businessLogic.dto.LoadColliDTO;
|
||||
import it.integry.ems.rules.completing.CommonRules;
|
||||
import it.integry.ems.rules.completing.PackagesRules;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.PrinterService;
|
||||
import it.integry.ems.service.ReportProcessor;
|
||||
@@ -2437,4 +2438,11 @@ public class LogisticService {
|
||||
}
|
||||
|
||||
|
||||
public Integer reserveNextNumCollo(Short anno, String serCollo, String gestione) throws Exception {
|
||||
|
||||
return PackagesRules.completeNumCollo(multiDBTransactionManager.getPrimaryConnection(),
|
||||
serCollo,
|
||||
anno,
|
||||
gestione);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import it.integry.ems.export.base.EntityExporterUtility;
|
||||
import it.integry.ems.export.enums.EntityExportType;
|
||||
import it.integry.ems.system.Import.AnagraficaImporter;
|
||||
import it.integry.ems.system.export.AnagraficaExporter;
|
||||
import it.integry.ems.system.export.RisorseUmaneExporter;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -21,6 +22,7 @@ public class EmsSystemContext {
|
||||
logger.debug("Init");
|
||||
EntityImporterUtility.addTypeBinding(EntityImportType.ANAGRAFICHE_CLIENTI_FORNITORI, AnagraficaImporter.class);
|
||||
EntityExporterUtility.addTypeBinding(EntityExportType.ANAGRAFICHE_CLIENTI_FORNITORI, AnagraficaExporter.class);
|
||||
EntityExporterUtility.addTypeBinding(EntityExportType.RISORSE_UMANE, RisorseUmaneExporter.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package it.integry.ems.system.export;
|
||||
|
||||
import it.integry.ems.export.base.BaseEntityExporter;
|
||||
import it.integry.ems.export.base.EntityExportResponse;
|
||||
import it.integry.ems.export.base.IEntityExporter;
|
||||
import it.integry.ems.system.export.services.risorseUmane.RisorseUmaneService;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
public class RisorseUmaneExporter extends BaseEntityExporter implements IEntityExporter {
|
||||
@Override
|
||||
public EntityExportResponse doExport() throws Exception {
|
||||
Format enumFormat = Format.fromString(super.format);
|
||||
WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
|
||||
|
||||
if (enumFormat != null){
|
||||
if (enumFormat == Format.ZUCCHETTI) {
|
||||
RisorseUmaneService risorseUmane = context.getBean(RisorseUmaneService.class);
|
||||
return risorseUmane.export(type, format);
|
||||
}
|
||||
throw new Exception(String.format("Formato %s non supportato", format));
|
||||
}else {
|
||||
throw new Exception(String.format("Formato %s non definito", format));
|
||||
}
|
||||
}
|
||||
|
||||
public enum Format {
|
||||
ZUCCHETTI("ZUCCHETTI");
|
||||
|
||||
private String text;
|
||||
|
||||
Format(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public static Format fromString(String text) {
|
||||
for (Format b : Format.values()) {
|
||||
if (b.text.equalsIgnoreCase(text)) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.system.export.dto;
|
||||
|
||||
public class ZucchettiDTO {
|
||||
public String key;
|
||||
public String value;
|
||||
|
||||
public ZucchettiDTO set(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public ZucchettiDTO setKey(String key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public ZucchettiDTO setValue(String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package it.integry.ems.system.export.services.risorseUmane;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems.export.base.EntityExportResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.export.dto.ZucchettiDTO;
|
||||
import it.integry.ems_model.entity.JtbFlav;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class RisorseUmaneService {
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
public EntityExportResponse export(String type, String format) throws Exception {
|
||||
EntityExportResponse<List<File>> entityExportResponse = new EntityExportResponse<>();
|
||||
List<JtbFlav> users = getUsers();
|
||||
String file = "";
|
||||
|
||||
String codAzienda = "000001";
|
||||
String codDipendete = "0000001";
|
||||
String dataInizioValidita = "18000101";
|
||||
String codRicezione = "HRANAGRAFICO";
|
||||
|
||||
int numDipendete = Integer.parseInt(codDipendete);
|
||||
List<String> usersFileList = new ArrayList<>();
|
||||
|
||||
for (JtbFlav jtbFlav : users) {
|
||||
List<ZucchettiDTO> zucchettiDto = new ArrayList<>();
|
||||
numDipendete++;
|
||||
|
||||
String baseLine = codAzienda + ";" +
|
||||
codDipendete + ";" +
|
||||
dataInizioValidita + ";" +
|
||||
codRicezione + ";";
|
||||
|
||||
zucchettiDto.add(new ZucchettiDTO().set("FLCHECKOBB", "S"));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDSUBJECT", jtbFlav.getCodJflav()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDTPSUBJ", "DIPEND"));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANNAME", jtbFlav.getNome()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANSURNAM", jtbFlav.getCognome()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("DTBIRTH", UtilityDate.formatDate(jtbFlav.getDataNascita(), "yyyyMMdd")));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("DTENDVL", UtilityDate.formatDate(jtbFlav.getDataFineLavoro(), "yyyyMMdd")));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("FLACTIVE", jtbFlav.getCodJfas().equalsIgnoreCase("LIC") ? "N" : "S"));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDCITYBT", jtbFlav.getCodiceFiscale()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDIDENTIFP", jtbFlav.getCodiceFiscale().substring(11, 15))); //Cod città
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDLEGALNAT", "000"));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDMARITAL", jtbFlav.getStatoCivile()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDSTUDY", jtbFlav.getTitoloStudio()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("TPSEX", jtbFlav.getSesso()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANADDRESRS", jtbFlav.getIndirizzo()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANCIVICNRS", jtbFlav.getIndirizzo().substring(jtbFlav.getIndirizzo().indexOf(',') + 1).trim().replace(" ", "")));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANEMAILRS", jtbFlav.geteMail()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("ANMOBILTEL", jtbFlav.getNumTelefono()));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDCITYRS", getCodCitta(jtbFlav.getComune())));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDRGNRS", "14"));
|
||||
zucchettiDto.add(new ZucchettiDTO().set("IDSTATERS", "IT"));
|
||||
|
||||
usersFileList.add(format(baseLine, zucchettiDto));
|
||||
|
||||
codDipendete = String.format("%07d", numDipendete);
|
||||
}
|
||||
|
||||
String a = String.join("||", usersFileList);
|
||||
|
||||
return entityExportResponse;
|
||||
}
|
||||
|
||||
public String format(String baseLine, List<ZucchettiDTO> zucchettiDto) {
|
||||
List<String> list = Stream.of(zucchettiDto)
|
||||
.filter(x -> x.getValue() != null)
|
||||
.filter(x -> !x.getValue().equalsIgnoreCase("NULL"))
|
||||
.map(x -> baseLine + x.getKey() + ";;" + x.getValue())
|
||||
.toList();
|
||||
|
||||
return String.join("||", list);
|
||||
}
|
||||
|
||||
public List<JtbFlav> getUsers() throws Exception {
|
||||
String sql = "SELECT jtb_flav.* FROM jtb_flav INNER JOIN mtb_depo ON jtb_flav.cod_jfas = mtb_depo.cod_jfas where mtb_depo.cod_mdep = 'AN'";
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, JtbFlav.class);
|
||||
}
|
||||
|
||||
public String getCodCitta(String citta) throws Exception {
|
||||
String sql = "SELECT cod_comu FROM gtb_istat_comuni where denominazione_comune = " + UtilityDB.valueToString(citta);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user