Commit 24ba0867d65bdb7c163a88ce62ffcef0c27e0725
1 parent
1f6d435f
Exists in
master
#4289 - Implementação tipo suporte documento
Showing
4 changed files
with
237 additions
and
118 deletions
Show diff stats
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
... | ... | @@ -203,6 +203,18 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
203 | 203 | |
204 | 204 | list.add(new Dominio("statusProcesso", "Concluído", "CONCLUIDO", 1L)); |
205 | 205 | list.add(new Dominio("statusProcesso", "Em andamento", "EM_ANDAMENTO", 2L)); |
206 | + | |
207 | + list.add(new Dominio("filtroPesquisa", "Ambos", "AMBOS", 0L)); | |
208 | + list.add(new Dominio("filtroPesquisa", "Processo", "PROCESSO", 1L)); | |
209 | + list.add(new Dominio("filtroPesquisa", "Documento", "DOCUMENTO", 2L)); | |
210 | + | |
211 | + list.add(new Dominio("filtroData", "Em qualquer data", "QUAL_QUER_DATA", 0L)); | |
212 | + list.add(new Dominio("filtroData", "Na última hora", "ULTIMA_HORA", 1L)); | |
213 | + list.add(new Dominio("filtroData", "Nas últimas 24 horas", "ULTIMAS_24_HORA", 2L)); | |
214 | + list.add(new Dominio("filtroData", "Na última semana", "ULTIMA_SEMANA", 3L)); | |
215 | + list.add(new Dominio("filtroData", "No último mês", "ULTIMO_MES", 4L)); | |
216 | + list.add(new Dominio("filtroData", "No último ano", "ULTIMO_ANO", 5L)); | |
217 | + list.add(new Dominio("filtroData", "Intervalo personalizado", "INTERVALO_PERSONALIZADO", 6L)); | |
206 | 218 | |
207 | 219 | this.dominioService.saveListIfNotExist(list); |
208 | 220 | |
... | ... | @@ -404,6 +416,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
404 | 416 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.TIPO_SUPORTE_DOCUMENTO ", "Tipo suporte de documento", dominio, modulo)); |
405 | 417 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.UNIDADE_GESTORA ", "Unidade gestora", dominio, modulo)); |
406 | 418 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DATA_CRIACAO ", "Data criação", dominio, modulo)); |
419 | + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.PLACEHOLDER_PESQUISA ", "Digite o Nup, tipo de processo, tipo de documento, conteúdo do documento, autor, assunto, destinatário...", dominio, modulo)); | |
407 | 420 | |
408 | 421 | |
409 | 422 | } | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/SolrSearchController.js
... | ... | @@ -26,15 +26,10 @@ |
26 | 26 | * @param Utils |
27 | 27 | */ |
28 | 28 | |
29 | -citApp.controller('SolrSearchController', ['$scope','$attrs','$location','$route','$routeParams','$window','$timeout','SolrSearchService','Utils', "$compile", | |
30 | - function SolrSearchController($scope, $attrs, $location, $route, $routeParams, $window, $timeout, SolrSearchService, Utils, $compile) { | |
29 | +citApp.controller('SolrSearchController', ['$scope','$attrs','$location','$route','$routeParams','$window','$timeout','SolrSearchService','Utils', "$compile", 'DominioRepository', '$filter', | |
30 | + function SolrSearchController($scope, $attrs, $location, $route, $routeParams, $window, $timeout, SolrSearchService, Utils, $compile, DominioRepository, $filter) { | |
31 | 31 | |
32 | 32 | $scope.searchHintsField = 'tipoProcesso,tipoDocumento,objeto,assunto,autor,atribuidoA,destinatario,unidadeGeradora,situacao,nivelAcesso,dataCriacao'; |
33 | - | |
34 | - var KEY_ENTER = '13'; | |
35 | - var KEY_ESCAPE = '27'; | |
36 | - var KEY_ARROW_UP = '38'; | |
37 | - var KEY_ARROW_DOWN = '40'; | |
38 | 33 | |
39 | 34 | // instructional message to aid the user in constructing a query |
40 | 35 | $scope.messages = [ |
... | ... | @@ -99,8 +94,16 @@ citApp.controller('SolrSearchController', ['$scope','$attrs','$location','$route |
99 | 94 | |
100 | 95 | // user query |
101 | 96 | $scope.userquery = ''; |
97 | + | |
98 | + //parametro para pesquisa | |
99 | + $scope.parameterPesquisa = {}; | |
100 | + | |
101 | + //Parameters | |
102 | + $scope.queryParameters = []; | |
102 | 103 | |
103 | - /////////////////////////////////////////////////////////////////////////// | |
104 | + //Date parameter | |
105 | + $scope.dateMathFilter = ""; | |
106 | + | |
104 | 107 | |
105 | 108 | /** |
106 | 109 | * A page in a pagination list |
... | ... | @@ -316,60 +319,38 @@ citApp.controller('SolrSearchController', ['$scope','$attrs','$location','$route |
316 | 319 | * @param event |
317 | 320 | */ |
318 | 321 | $scope.onkeyup = function (event) { |
319 | - $scope.showHints = true; | |
320 | - if (event.keyCode == KEY_ENTER) { | |
321 | - if ($scope.selectedHint != -1) { | |
322 | - $scope.selectHint($scope.selectedHint); | |
323 | - } | |
324 | - $scope.handleSubmit(); | |
325 | - $scope.onblur(); | |
326 | - } | |
327 | - else if (event.keyCode == KEY_ESCAPE) { | |
328 | - $scope.showHints = false; | |
329 | - $scope.resetHintSelection(); | |
330 | - $scope.$apply(); | |
331 | - } | |
332 | - else if (event.keyCode == KEY_ARROW_UP) { | |
333 | - $scope.clearHintSelection(); | |
334 | - if ($scope.selectedHint < 1) { | |
335 | - $scope.selectedHint = $scope.hints.length - 1; | |
336 | - } else { | |
337 | - $scope.selectedHint -= 1; | |
338 | - } | |
339 | - $scope.highlightHint($scope.selectedHint); | |
340 | - } | |
341 | - else if (event.keyCode == KEY_ARROW_DOWN) { | |
342 | - $scope.clearHintSelection(); | |
343 | - if ($scope.selectedHint < $scope.hints.length - 1) { | |
344 | - $scope.selectedHint += 1; | |
345 | - } else { | |
346 | - $scope.selectedHint = 0; | |
347 | - } | |
348 | - $scope.highlightHint($scope.selectedHint); | |
349 | - } | |
350 | - // if the current query meets the minimum requirements, | |
351 | - // get the list of search hints | |
352 | - else if ($scope.userQuery.length >= $scope.minSearchLength) { | |
322 | + | |
323 | + if ($scope.userQuery && $scope.userQuery.length >= $scope.minSearchLength) { | |
353 | 324 | if ($scope.timeout) $timeout.cancel($scope.timeout); |
354 | - $scope.timeout = $timeout(function () { | |
355 | - var query = SolrSearchService.createQuery("https://localhost:8983/solr/jcg"); | |
356 | - query.setOption("rows", "10"); | |
357 | - query.setOption("facet", "true"); | |
358 | - query.setOption("facet.limit", $scope.maxHints); | |
359 | - | |
360 | - var hints = $scope.searchHintsField.split(','); | |
361 | - for(var i = 0; i < hints.length; i++){ | |
362 | - query.setOption("facet.field#" + i, hints[i]); | |
363 | - } | |
364 | - | |
365 | - query.setNearMatch($scope.nearMatch); | |
366 | - query.setUserQuery($scope.userQuery); | |
367 | - SolrSearchService.setQuery($scope.queryName, query); | |
368 | - SolrSearchService.updateQuery($scope.queryName); | |
325 | + $scope.timeout = $timeout(function () { | |
326 | + var query = SolrSearchService.createQuery("https://localhost:8983/solr/jcg"); | |
327 | + query.setOption("rows", "10"); | |
328 | + query.setOption("facet", "true"); | |
329 | + query.setOption("facet.limit", $scope.maxHints); | |
330 | + | |
331 | + //Verifica se foi selecionado filtro de data | |
332 | + if($scope.dateMathFilter != ""){ | |
333 | + | |
334 | + query.setOption("fq", $scope.dateMathFilter); | |
335 | + } | |
336 | + | |
337 | + var hints = $scope.searchHintsField.split(','); | |
338 | + for(var i = 0; i < hints.length; i++){ | |
339 | + query.setOption("facet.field#" + i, hints[i]); | |
340 | + } | |
341 | + | |
342 | + query.setNearMatch($scope.nearMatch); | |
343 | + query.setUserQuery($scope.userQuery); | |
344 | + query.setQueryParameters($scope.queryParameters); | |
345 | + | |
346 | + SolrSearchService.setQuery($scope.queryName, query); | |
347 | + SolrSearchService.updateQuery($scope.queryName); | |
369 | 348 | }, 350); |
370 | 349 | }else{ |
371 | 350 | |
372 | 351 | $scope.apresentarMsgSemResultado = false; |
352 | + | |
353 | + $scope.documents = []; | |
373 | 354 | } |
374 | 355 | }; |
375 | 356 | |
... | ... | @@ -469,6 +450,118 @@ citApp.controller('SolrSearchController', ['$scope','$attrs','$location','$route |
469 | 450 | }, 350); |
470 | 451 | }; |
471 | 452 | |
453 | + //limpar os filtros da tela | |
454 | + $scope.cleanFilters = function(){ | |
455 | + | |
456 | + $scope.documents = []; | |
457 | + $scope.userQuery = ""; | |
458 | + $scope.hints = []; | |
459 | + }; | |
460 | + | |
461 | + //Adicionar os parametro processo | |
462 | + $scope.addParameter = function(){ | |
463 | + | |
464 | + $timeout(function () { | |
465 | + //verifica se o parametro é ambos | |
466 | + if($scope.parameterPesquisa.codigo == 0){ | |
467 | + | |
468 | + $scope.removeQueryParameter("AND objeto: Processo "); | |
469 | + | |
470 | + $scope.removeQueryParameter("AND objeto: Documento "); | |
471 | + $scope.onkeyup(); | |
472 | + | |
473 | + //verifica se o parametro é processo | |
474 | + }else if($scope.parameterPesquisa.codigo == 1){ | |
475 | + | |
476 | + $scope.addQueryParameter("AND objeto: Processo "); | |
477 | + $scope.removeQueryParameter("AND objeto: Documento "); | |
478 | + $scope.onkeyup(); | |
479 | + //verifica se o parametro é documento | |
480 | + }else if($scope.parameterPesquisa.codigo == 2){ | |
481 | + | |
482 | + $scope.addQueryParameter("AND objeto: Documento "); | |
483 | + $scope.removeQueryParameter("AND objeto: Processo "); | |
484 | + $scope.onkeyup(); | |
485 | + } | |
486 | + }); | |
487 | + | |
488 | + }; | |
489 | + | |
490 | + //adicionar o parametro de data | |
491 | + $scope.addParameterDate = function(){ | |
492 | + | |
493 | + $timeout(function () { | |
494 | + //Última Hora | |
495 | + if($scope.parameterDatePesquisa.codigo == 1){ | |
496 | + | |
497 | + $scope.dateMathFilter = "dataCriacao:[NOW-1HOUR TO NOW]"; | |
498 | + $scope.onkeyup(); | |
499 | + //Útimas 24 horas | |
500 | + }else if($scope.parameterDatePesquisa.codigo == 2){ | |
501 | + | |
502 | + $scope.dateMathFilter = "dataCriacao:[NOW-1DAY TO NOW]"; | |
503 | + $scope.onkeyup(); | |
504 | + //Última semana | |
505 | + }else if($scope.parameterDatePesquisa.codigo == 3){ | |
506 | + | |
507 | + $scope.dateMathFilter = "dataCriacao:[NOW-7DAY TO NOW]"; | |
508 | + $scope.onkeyup(); | |
509 | + //Último mês | |
510 | + }else if($scope.parameterDatePesquisa.codigo == 4){ | |
511 | + | |
512 | + $scope.dateMathFilter = "dataCriacao:[NOW-31DAY TO NOW]"; | |
513 | + $scope.onkeyup(); | |
514 | + //Útimo ano | |
515 | + }else if($scope.parameterDatePesquisa.codigo == 5){ | |
516 | + | |
517 | + $scope.dateMathFilter = "dataCriacao:[NOW-365DAY TO NOW]"; | |
518 | + $scope.onkeyup(); | |
519 | + } | |
520 | + }); | |
521 | + | |
522 | + }; | |
523 | + | |
524 | + /** | |
525 | + * Add a query parameter. The parameter setting is added only if it is | |
526 | + * unique. | |
527 | + * @param Parameter | |
528 | + */ | |
529 | + $scope.addQueryParameter = function(Parameter) { | |
530 | + for (var i=0; i<$scope.queryParameters.length;i++) { | |
531 | + if ($scope.queryParameters[i] == Parameter) { | |
532 | + return; | |
533 | + } | |
534 | + } | |
535 | + $scope.queryParameters.push(Parameter); | |
536 | + }; | |
537 | + | |
538 | + /** | |
539 | + * remove a query parameter | |
540 | + * unique. | |
541 | + * @param Parameter | |
542 | + */ | |
543 | + $scope.removeQueryParameter = function(Parameter) { | |
544 | + for (var i=0;i<$scope.queryParameters.length;i++) { | |
545 | + if ($scope.queryParameters[i] == Parameter) { | |
546 | + $scope.queryParameters.splice(i, 1); | |
547 | + } | |
548 | + } | |
549 | + }; | |
550 | + | |
551 | + DominioRepository.findAllDominio('filtroPesquisa').then(function(result) { | |
552 | + $scope.filtroPesquisaList = result; | |
553 | + | |
554 | + $scope.parameterPesquisa = $.grep($scope.filtroPesquisaList, function(e){ return e.codigo == 0; })[0].originalElement; | |
555 | + }); | |
556 | + | |
557 | + DominioRepository.findAllDominio('filtroData').then(function(result) { | |
558 | + $scope.filtroDateList = $filter('orderBy')(result, "codigo"); | |
559 | + | |
560 | + $scope.parameterDatePesquisa = $.grep($scope.filtroDateList, function(e){ return e.codigo == 0; })[0].originalElement; | |
561 | + | |
562 | + }); | |
563 | + | |
564 | + | |
472 | 565 | $scope.init(); |
473 | 566 | }]); |
474 | 567 | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/service/solr.js
... | ... | @@ -135,6 +135,19 @@ function SolrQuery(Url) { |
135 | 135 | } |
136 | 136 | self.queryParameters.push(Parameter); |
137 | 137 | }; |
138 | + | |
139 | + /** | |
140 | + * remove a query parameter | |
141 | + * unique. | |
142 | + * @param Parameter | |
143 | + */ | |
144 | + self.removeQueryParameter = function(Parameter) { | |
145 | + for (var i=0;i<self.queryParameters.length;i++) { | |
146 | + if (self.queryParameters[i] == Parameter) { | |
147 | + self.queryParameters.splice(i, 1); | |
148 | + } | |
149 | + } | |
150 | + }; | |
138 | 151 | |
139 | 152 | /** |
140 | 153 | * Create a new facet. | ... | ... |
cit-ecm-web/src/main/webapp/html/pesquisa/pesquisa.html
... | ... | @@ -8,72 +8,72 @@ |
8 | 8 | <favorito /> |
9 | 9 | <help-button workspace="workspace" /> |
10 | 10 | </div> |
11 | - | |
12 | 11 | </div> |
13 | - | |
14 | 12 | </div> |
15 | - | |
16 | - <breadcrumb ng-workspace="workspace"></breadcrumb> | |
17 | - | |
18 | - <fieldset> | |
19 | - <legend> | |
20 | - <translate>ECM.LABEL.SOLR_SEARCH_INTERFACE</translate> | |
21 | - </legend> | |
22 | - | |
23 | - <div class="row"> | |
24 | - <div class="col-sm-12"> | |
25 | - <form class="searchbox" name="solrForm"> | |
26 | - <div class="input-group" id="inputs"> | |
27 | - <input type="text" class="form-control" id="query" type="text" placeholder="{{placeHolder}}" ng-model="userQuery" autocomplete="off" ng-focus="onfocus()" ng-blur="onblur()" | |
28 | - ng-keyup="onkeyup($event)"> | |
29 | - <div class="input-group-btn"> | |
30 | - <button class="btn btn-default" type="button" id="submit" name="submit" ng-click="handleSubmit()"> | |
31 | - <i class="ace-icon fa fa-search icon-on-right bigger-110"></i> | |
32 | - </button> | |
13 | + <div class="row"> | |
14 | + <div class="col-sm-12" style="text-align: center;"> | |
15 | + <h3><translate>ECM.LABEL.SOLR_SEARCH_INTERFACE</translate></h3> | |
16 | + </div> | |
17 | + </div> | |
18 | + | |
19 | + <div class="table-container"> | |
20 | + <div class="table-header clearfix"> | |
21 | + <div class="table-header-right"> | |
22 | + <button class="btn btn-primary btn-inline btn-white table-header-item" ng-click="$showAdvancedFilters = !$showAdvancedFilters" type="button"> | |
23 | + <i class="fa fa-filter"></i> <translate>LABEL.FILTROS_AVANCADOS</translate> | |
24 | + </button> | |
25 | + <button class="btn btn-primary btn-inline btn-white table-header-item" ng-click="cleanFilters()" type="button"> | |
26 | + <i class="fa fa-eraser"></i> | |
27 | + </button> | |
28 | + </div> | |
29 | + | |
30 | + <div class="table-header-left"> | |
31 | + <div class="form-group"> | |
32 | + <form class="searchbox" name="solrForm"> | |
33 | + <div class="input-group" id="inputs"> | |
34 | + <input type="text" class="form-control" id="query" type="text" placeholder="{{$translate.instant('ECM.LABEL.PLACEHOLDER_PESQUISA')}}" ng-model="userQuery" autocomplete="off" ng-focus="onfocus()" ng-keyup="onkeyup($event)"> | |
35 | + <div class="input-group-btn"> | |
36 | + <button class="btn btn-default" type="button" id="submit" name="submit" ng-click="handleSubmit()"> | |
37 | + <i class="ace-icon fa fa-search icon-on-right bigger-110"></i> | |
38 | + </button> | |
39 | + </div> | |
33 | 40 | </div> |
34 | - </div> | |
35 | - | |
36 | - <div class="row"> | |
37 | - <div class="col-md-8" ng-show='userQuery != "" && apresentarMsgSemResultado'> | |
38 | - </p> | |
39 | - <translate>ECM.LABEL.SUA_PESQUISA</translate> | |
40 | - : <label style="font-weight: bold;">{{userQuery}} </label> | |
41 | - </p> | |
42 | - <translate>ECM.LABEL.NENHUM_DOCUMENTO_CORRESPONDENTE</translate> | |
43 | - </p> | |
44 | - <translate>ECM.LABEL.SUGESTOES</translate> | |
45 | - <ul> | |
46 | - <li style="list-style-type: disc;"><translate>ECM.LABEL.CERTIFIQUE_PALAVRAS_ESCRITAS_CORRETAMENTE</translate></li> | |
47 | - <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_PALAVRAS_CHAVES_DIFERENTE</translate></li> | |
48 | - <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_PALAVRAS_CHAVES_MAIS_GENERICAS</translate></li> | |
49 | - <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_MENOS_PALAVRAS_CHAVES</translate></li> | |
50 | - </ul> | |
41 | + | |
42 | + <div class="row" ng-show="$showAdvancedFilters" style="padding-top: 10px;"> | |
43 | + <hr> | |
44 | + <div class="col-sm-2"> | |
45 | + <label-select ng-id="parameterPesquisa" ng-model="parameterPesquisa" form="solrForm" ng-list="filtroPesquisaList" | |
46 | + ng-custom-options="dominio.originalElement as dominio.descricao for dominio" show-selecione='false' ng-custom-change="addParameter()"> </label-select> | |
47 | + </div> | |
48 | + | |
49 | + <div class="col-sm-2"> | |
50 | + <label-select ng-id="parameterDatePesquisa" ng-model="parameterDatePesquisa" form="solrForm" ng-list="filtroDateList" | |
51 | + ng-custom-options="dominio.originalElement as dominio.descricao for dominio" show-selecione='false' ng-custom-change="addParameterDate()"> </label-select> | |
52 | + </div> | |
51 | 53 | </div> |
52 | - </div> | |
53 | - | |
54 | - <!-- div class="alert alert-warning" ng-show="loading" ng-cloak> | |
55 | - <img | |
56 | - src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" | |
57 | - class="icon" /> | |
58 | - <h5> | |
59 | - Processing... | |
60 | - <button type="button" class="close" style="float: none;" | |
61 | - data-dismiss="modal" aria-hidden="true">�</button> | |
62 | - </h5> | |
63 | - </div> | |
64 | - | |
65 | - <div class="summary" ng-show="documents.length > 0" ng-cloak> | |
66 | - <div style="padding-bottom: 20px;"> | |
67 | - Search Results <span class="badge">{{totalResults}}</span> found | |
54 | + | |
55 | + <div class="row"> | |
56 | + <div class="col-md-8" ng-show='userQuery != "" && apresentarMsgSemResultado'> | |
57 | + </p> | |
58 | + <translate>ECM.LABEL.SUA_PESQUISA</translate> | |
59 | + : <label style="font-weight: bold;">{{userQuery}} </label> | |
60 | + </p> | |
61 | + <translate>ECM.LABEL.NENHUM_DOCUMENTO_CORRESPONDENTE</translate> | |
62 | + </p> | |
63 | + <translate>ECM.LABEL.SUGESTOES</translate> | |
64 | + <ul> | |
65 | + <li style="list-style-type: disc;"><translate>ECM.LABEL.CERTIFIQUE_PALAVRAS_ESCRITAS_CORRETAMENTE</translate></li> | |
66 | + <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_PALAVRAS_CHAVES_DIFERENTE</translate></li> | |
67 | + <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_PALAVRAS_CHAVES_MAIS_GENERICAS</translate></li> | |
68 | + <li style="list-style-type: disc;"><translate>ECM.LABEL.TENTE_MENOS_PALAVRAS_CHAVES</translate></li> | |
69 | + </ul> | |
70 | + </div> | |
71 | + </div> | |
72 | + </form> | |
68 | 73 | </div> |
69 | - <div class="alert alert-warning" ng-show="error">{{error}}</div> | |
70 | - <div class="alert alert-info" ng-show="message">{{message}}</div> | |
71 | - </div--> | |
72 | - | |
73 | - </form> | |
74 | 74 | </div> |
75 | 75 | </div> |
76 | - | |
76 | + | |
77 | 77 | <div class="row"> |
78 | 78 | <div class="col-sm-2"> |
79 | 79 | <div class="ecm-search-wrapper"> |
... | ... | @@ -266,7 +266,7 @@ |
266 | 266 | <div class="row"> |
267 | 267 | <div class="col-md-6">{{doc.unidadeGeradora}}</div> |
268 | 268 | <div class="col-md-4">{{doc.autor}}</div> |
269 | - <div class='col-sm-2'>{{doc.dataCriacao | date:'dd/MM/yyyy HH:mm:ss'}}</div> | |
269 | + <div class='col-sm-2'>{{doc.dataCriacao | date: 'dd/MM/yyyy HH:mm:ss'}}</div> | |
270 | 270 | </div> <!-- .row --> |
271 | 271 | </li> |
272 | 272 | </ul> |
... | ... | @@ -280,6 +280,6 @@ |
280 | 280 | <!-- .col --> |
281 | 281 | </div> |
282 | 282 | </div> |
283 | - </fieldset> | |
283 | + </div> | |
284 | 284 | </div> |
285 | 285 | <!-- .page-content --> |
286 | 286 | \ No newline at end of file | ... | ... |