Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -5,21 +5,15 @@ import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.service.ExchangeDocumentImportService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("exchange/documenti/")
|
||||
public class ExchangeDocumentImportController {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private ExchangeDocumentImportService exchangeDocumentImportService;
|
||||
|
||||
@@ -27,12 +21,23 @@ public class ExchangeDocumentImportController {
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
|
||||
@RequestMapping(value = "importAcquisto", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importAcquisto(@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
exchangeDocumentImportService.importAcquisto(internalDb, exchangeDb, requestDataDTO);
|
||||
}
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "importLavorazione", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importLavorazione(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
ServiceRestResponse importLavorazione(@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
@@ -42,12 +47,10 @@ public class ExchangeDocumentImportController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "importVendita", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importVendita(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
ServiceRestResponse importVendita(@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
|
||||
@@ -46,6 +46,10 @@ public class ExchangeDocumentImportService {
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
|
||||
public void importAcquisto(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
this.internalImport(internalMultiDb, exchangeMultiDb, requestDataDTO, ExchangeImportSchemaManagerService.SchemaType.DocumentiAcquisto);
|
||||
}
|
||||
|
||||
public void importLavorazione(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
this.internalImport(internalMultiDb, exchangeMultiDb, requestDataDTO, ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione);
|
||||
}
|
||||
@@ -62,6 +66,9 @@ public class ExchangeDocumentImportService {
|
||||
|
||||
String logType = null;
|
||||
switch (schemaType) {
|
||||
case DocumentiAcquisto:
|
||||
logType = "acquisto";
|
||||
break;
|
||||
case DocumentiLavorazione:
|
||||
logType = "lavorazione";
|
||||
break;
|
||||
@@ -78,7 +85,11 @@ public class ExchangeDocumentImportService {
|
||||
String testataTableName;
|
||||
String righeTableName;
|
||||
|
||||
if (schemaType == ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione) {
|
||||
if (schemaType == ExchangeImportSchemaManagerService.SchemaType.DocumentiAcquisto) {
|
||||
testataTableName = "dtb_doct_acq";
|
||||
righeTableName = "dtb_docr_acq";
|
||||
|
||||
} else if (schemaType == ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione) {
|
||||
testataTableName = "dtb_doct_lav";
|
||||
righeTableName = "dtb_docr_lav";
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ public class ExchangeImportSchemaManagerService {
|
||||
Clienti(11),
|
||||
Fornitori(12),
|
||||
PDCAnag(13),
|
||||
Destinatari(14);
|
||||
Destinatari(14),
|
||||
DocumentiAcquisto(15);
|
||||
|
||||
|
||||
private final int value;
|
||||
@@ -81,6 +82,8 @@ public class ExchangeImportSchemaManagerService {
|
||||
put(SchemaType.Fornitori, Arrays.asList("gtb_anag_fornitori", "atb_forn"));
|
||||
put(SchemaType.PDCAnag, Collections.singletonList("ctb_anag"));
|
||||
put(SchemaType.Destinatari, Collections.singletonList("vtb_dest"));
|
||||
put(SchemaType.DocumentiAcquisto, Arrays.asList("dtb_doct_acq", "dtb_docr_acq"));
|
||||
|
||||
}};
|
||||
|
||||
public List<String> getTablesBySchemaType(SchemaType schemaType) {
|
||||
|
||||
Reference in New Issue
Block a user