|
|
|
|
@ -212,8 +212,50 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
// return legislacao;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
protected Integer getRelatorioIdForPlanoId( Integer planoId )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Integer relatorioId = null;
|
|
|
|
|
Select areaSelect =
|
|
|
|
|
new Select2( new String[]{ "plano_areas" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "plano_areas.area_id" },
|
|
|
|
|
new Field( "plano_areas.plano_id" ).isEqual( planoId ),
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
Virtual2DArray areaArray = WEB_EXECUTER.executeQuery( areaSelect );
|
|
|
|
|
if( areaArray.columnLength() > 0 )
|
|
|
|
|
{
|
|
|
|
|
Select relatorioSelect =
|
|
|
|
|
new Select2( new String[]{ "hs_relatorio_area" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "hs_relatorio_area.relatorio_id" },
|
|
|
|
|
new Field( "hs_relatorio_area.id" ).isEqual( areaArray.get(0, 0) ),
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
relatorioId = ( Integer ) LOCAL_EXECUTER.executeQuery( relatorioSelect ).get(0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return relatorioId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LegislacaoAplicavelToPrint getLegislacaoAplicavel( Integer relatorioId )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
if( web )
|
|
|
|
|
{
|
|
|
|
|
relatorioId = getRelatorioIdForPlanoId( relatorioId );
|
|
|
|
|
}
|
|
|
|
|
Vector<String> diplomasGerais = new Vector<String>();
|
|
|
|
|
Vector<String> nomes = new Vector<String>();
|
|
|
|
|
Vector<Vector<String>> diplomas = new Vector<Vector<String>>();
|
|
|
|
|
if( relatorioId != null )
|
|
|
|
|
{
|
|
|
|
|
Select select =
|
|
|
|
|
new Select2(
|
|
|
|
|
@ -228,9 +270,7 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
Virtual2DArray array = LOCAL_EXECUTER.executeQuery( select );
|
|
|
|
|
Vector<String> diplomasGerais = new Vector<String>();
|
|
|
|
|
Vector<String> nomes = new Vector<String>();
|
|
|
|
|
Vector<Vector<String>> diplomas = new Vector<Vector<String>>();
|
|
|
|
|
|
|
|
|
|
String last = null;
|
|
|
|
|
for( int n = 0; n < array.columnLength(); n++ )
|
|
|
|
|
{
|
|
|
|
|
@ -251,6 +291,7 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
diplomas.lastElement().add( descricao );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LegislacaoAplicavelToPrint legislacao =
|
|
|
|
|
new LegislacaoAplicavelToPrint( diplomasGerais, nomes.toArray( new String[ nomes.size() ] ),
|
|
|
|
|
diplomas.toArray( new Vector[ diplomas.size() ] ));
|
|
|
|
|
@ -262,6 +303,7 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
{
|
|
|
|
|
Virtual2DArray array;
|
|
|
|
|
Vector<AreaToPrint> areas = new Vector<AreaToPrint>();
|
|
|
|
|
HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
|
|
|
|
|
if( web )
|
|
|
|
|
{
|
|
|
|
|
Select select =
|
|
|
|
|
@ -269,13 +311,32 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
new String[]{ "plano_areas" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "id", "descricao", "1" },
|
|
|
|
|
new String[]{ "area_id", "id" },
|
|
|
|
|
new Field( "plano_id" ).isEqual( planoId ),
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
Virtual2DArray arrayTemp = WEB_EXECUTER.executeQuery( select );
|
|
|
|
|
Vector<Integer> ids = new Vector<Integer>();
|
|
|
|
|
for( int n = 0; n < arrayTemp.columnLength(); n++ )
|
|
|
|
|
{
|
|
|
|
|
ids.add( ( Integer ) arrayTemp.get(n, 0) );
|
|
|
|
|
map.put( ( Integer ) arrayTemp.get(n, 0), ( Integer ) arrayTemp.get(n, 1) );
|
|
|
|
|
}
|
|
|
|
|
select =
|
|
|
|
|
new Select2(
|
|
|
|
|
new String[]{ "hs_relatorio_area" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "id", "description", "ordem" },
|
|
|
|
|
new Field( "id" ).in( ids.toArray( new Integer[ ids.size() ] ) ).and(
|
|
|
|
|
new Field( "deleted_date" ).isEqual( null ) ),
|
|
|
|
|
new String[]{ "id" },
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
array = WEB_EXECUTER.executeQuery( select );
|
|
|
|
|
array = LOCAL_EXECUTER.executeQuery( select );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -319,7 +380,8 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
generico = ( ( Number ) genArray.get( 0, 0 ) ).intValue() > 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Vector<RiscoToPrint> riscos = getRiscosToPrintByAreaId( areaId, validacaoDl, validacaoDns );
|
|
|
|
|
Vector<RiscoToPrint> riscos =
|
|
|
|
|
getRiscosToPrintByAreaId( map.containsKey( areaId ) ? map.get( areaId ) : areaId, validacaoDl, validacaoDns );
|
|
|
|
|
if( riscos.size() > 0 )
|
|
|
|
|
{
|
|
|
|
|
areas.add( new AreaToPrint( areaDescricao, riscos, ordem, generico ) );
|
|
|
|
|
@ -493,6 +555,10 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
{
|
|
|
|
|
o1Value = -o1.valorQuantitativo;
|
|
|
|
|
}
|
|
|
|
|
else if(o1.valorQualitativo == null)
|
|
|
|
|
{
|
|
|
|
|
o1Value = 300;
|
|
|
|
|
}
|
|
|
|
|
else if(o1.valorQualitativo.equals(UNCONTROLLED))
|
|
|
|
|
{
|
|
|
|
|
o1Value = 100;
|
|
|
|
|
@ -509,6 +575,10 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
{
|
|
|
|
|
o2Value = -o2.valorQuantitativo;
|
|
|
|
|
}
|
|
|
|
|
else if(o2.valorQualitativo == null )
|
|
|
|
|
{
|
|
|
|
|
o2Value = 300;
|
|
|
|
|
}
|
|
|
|
|
else if(o2.valorQualitativo.equals(UNCONTROLLED))
|
|
|
|
|
{
|
|
|
|
|
o2Value = 100;
|
|
|
|
|
@ -543,7 +613,7 @@ public class PlanoActuacaoPrintDataProvider
|
|
|
|
|
new String[]{ "plano_medidas" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "id", "descricao" },
|
|
|
|
|
new String[]{ "id", "descricao", "true" },
|
|
|
|
|
new Field( "risco_id" ).isEqual( riscoId ),
|
|
|
|
|
new String[]{ "id" },
|
|
|
|
|
null,
|
|
|
|
|
|