Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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_20240710120537 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createSetup("IMPORT_SCONTRINI", "INTEGRETAIL", "GG_RECUPERO", null, "giorni di recuper per il servizio pianificato", false, null, false, false, false, false, false, null, false, null);
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Carelli, IntegryCustomerDB.Carelli_GestFood, IntegryCustomerDB.Carelli_Panimal))
|
||||
updateSetupValue("IMPORT_SCONTRINI", "INTEGRETAIL", "GG_RECUPERO", "3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public class ActivityController {
|
||||
@RequestMapping(value = EmsRestConstants.PATH_ACTIVITY_GET_TREE_VIEW, method = RequestMethod.GET)
|
||||
public ServiceRestResponse getTreeView(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String codJcom,
|
||||
@RequestParam(required = false) String codJcom,
|
||||
@RequestParam(required = false, defaultValue = "false") boolean loadTasks,
|
||||
@RequestParam(required = false) String activityId) throws Exception {
|
||||
|
||||
|
||||
@@ -4,19 +4,42 @@ import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class TreeViewDTO {
|
||||
|
||||
@SqlField("cod_jcom")
|
||||
private String codJcom;
|
||||
|
||||
@SqlField("livello")
|
||||
private int livello;
|
||||
|
||||
@SqlField("activity_id")
|
||||
private String activityId;
|
||||
|
||||
@SqlField("activity_description")
|
||||
private String activityDescription;
|
||||
|
||||
@SqlField("parent_activity_id")
|
||||
private String parentActivityId;
|
||||
|
||||
@SqlField("activity_type_id")
|
||||
private String activityTypeId;
|
||||
|
||||
@SqlField("row")
|
||||
private int row;
|
||||
|
||||
@SqlField("isFinished")
|
||||
private boolean isFinished;
|
||||
|
||||
@SqlField("esito")
|
||||
private String esito;
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public TreeViewDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRow() {
|
||||
return row;
|
||||
}
|
||||
@@ -70,4 +93,22 @@ public class TreeViewDTO {
|
||||
this.parentActivityId = parentActivityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return isFinished;
|
||||
}
|
||||
|
||||
public TreeViewDTO setFinished(boolean finished) {
|
||||
isFinished = finished;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEsito() {
|
||||
return esito;
|
||||
}
|
||||
|
||||
public TreeViewDTO setEsito(String esito) {
|
||||
this.esito = esito;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,8 +995,13 @@ public class ActivityService {
|
||||
" stb_activity_type.flag_tipologia\n" +
|
||||
" AND stb_activity_type.flag_attiva = 'S'\n" +
|
||||
" GROUP BY srl_activity_type.activity_type_id\n" +
|
||||
" HAVING COUNT(DISTINCT flag_tipologia_next) = 1)\n" +
|
||||
" AND flag_tipologia_next = 'A'))\n" +
|
||||
" HAVING COUNT(DISTINCT flag_tipologia_next) = 1)\n";
|
||||
|
||||
if (activityId == null) {
|
||||
sql += " AND flag_tipologia_next = 'A'\n";
|
||||
}
|
||||
|
||||
sql += " ))\n" +
|
||||
"\n" +
|
||||
"SELECT processi.cod_jcom AS 'Commessa',\n" +
|
||||
" processi.user_name,\n" +
|
||||
@@ -1355,7 +1360,29 @@ public class ActivityService {
|
||||
public List<TreeViewDTO> getTreeView(String codJcom, String activityId, boolean loadTasks) throws Exception {
|
||||
String sql;
|
||||
|
||||
if (activityId == null) {
|
||||
if (codJcom == null) {
|
||||
sql = "WITH commesse AS (SELECT cod_jcom FROM jtb_comt WHERE stato_commessa IN ('IN CORSO', 'POST VENDITA', 'TRATTATIVA'))\n" +
|
||||
"SELECT t.cod_jcom,\n" +
|
||||
" t.livello,\n" +
|
||||
" t.activity_id,\n" +
|
||||
" stb_activity.activity_description,\n" +
|
||||
" t.parent_activity_id,\n" +
|
||||
" stb_activity.activity_type_id,\n" +
|
||||
" count_activity.row,\n" +
|
||||
" CAST(IIF(stb_activity.effective_enddate IS NULL, 1, 0) AS BIT) AS isFinished,\n" +
|
||||
" stb_activity.activity_result_id AS esito\n" +
|
||||
"FROM commesse\n" +
|
||||
" CROSS APPLY [dbo].[getTreeViewActivity](commesse.cod_jcom) t\n" +
|
||||
" INNER JOIN stb_activity ON t.activity_id = stb_activity.activity_id\n" +
|
||||
" OUTER APPLY (SELECT COUNT(*) AS row\n" +
|
||||
" FROM stb_activity s\n" +
|
||||
" WHERE stb_activity.activity_id = s.parent_activity_id) count_activity\n" +
|
||||
"WHERE EXISTS (SELECT *\n" +
|
||||
" FROM srl_activity_type\n" +
|
||||
" WHERE flag_tipologia_next IN ('P', 'A')\n" +
|
||||
" AND srl_activity_type.flag_tipologia = stb_activity.flag_tipologia\n" +
|
||||
" AND srl_activity_type.activity_type_id = stb_activity.activity_type_id)";
|
||||
} else if (activityId == null) {
|
||||
sql = "SELECT t.livello,\n" +
|
||||
" t.activity_id,\n" +
|
||||
" stb_activity.activity_description,\n" +
|
||||
@@ -1372,11 +1399,6 @@ public class ActivityService {
|
||||
"EXISTS (SELECT *\n" +
|
||||
" FROM srl_activity_type\n" +
|
||||
" WHERE flag_tipologia_next IN ('P' " + (loadTasks ? ", 'A'" : "") + ")\n" +
|
||||
"-- AND NOT EXISTS (SELECT *\n" +
|
||||
"-- FROM srl_activity_type tipo_attivita\n" +
|
||||
"-- WHERE tipo_attivita.flag_tipologia_next = 'A'\n" +
|
||||
"-- AND tipo_attivita.activity_type_id = srl_activity_type.activity_type_id\n" +
|
||||
"-- AND tipo_attivita.flag_tipologia = srl_activity_type.flag_tipologia)\n" +
|
||||
" AND srl_activity_type.flag_tipologia = stb_activity.flag_tipologia\n" +
|
||||
" AND srl_activity_type.activity_type_id = stb_activity.activity_type_id)";
|
||||
} else {
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ScontriniService {
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
String pathFile = setup.get("PATH_FILE");
|
||||
String profileDb = setup.get("PROFILE_DB");
|
||||
String ggRecupero = setup.get("GG_RECUPERO");
|
||||
|
||||
String whereCond = null;
|
||||
if (requestDTO != null) {
|
||||
@@ -64,8 +65,12 @@ public class ScontriniService {
|
||||
if (requestDTO != null && requestDTO.getDataIniz() != null) {
|
||||
dataIniz.setTime(requestDTO.getDataIniz());
|
||||
} else {
|
||||
dataIniz = (Calendar) dataFine.clone();
|
||||
dataIniz.add(Calendar.DATE, -7);
|
||||
Integer gg = -7;
|
||||
if (ggRecupero != null) {
|
||||
gg = Integer.valueOf(ggRecupero);
|
||||
gg = gg * -1;
|
||||
}
|
||||
dataIniz.add(Calendar.DATE, gg);
|
||||
}
|
||||
|
||||
String query =
|
||||
|
||||
Reference in New Issue
Block a user