ailton преди 8 години
родител
ревизия
393d4b7920

+ 49 - 0
src/main/java/org/develop/officialjournal/controllers/JudgeController.java

@@ -0,0 +1,49 @@
1
+package org.develop.officialjournal.controllers;
2
+
3
+import org.develop.officialjournal.services.Database;
4
+import org.springframework.web.bind.annotation.PathVariable;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RequestParam;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
9
+import dao.DAOJudge;
10
+import entity.Judge;
11
+
12
+@RestController
13
+public class JudgeController {
14
+
15
+	private DAOJudge daoJudge;
16
+
17
+	public JudgeController() {
18
+
19
+		daoJudge =  Database.get().getDaoJudge();
20
+		
21
+	}
22
+
23
+
24
+	/**returns lawyer by id*/
25
+
26
+	@RequestMapping("/judge/{id}")
27
+	public Judge getById(@PathVariable Integer id ) {
28
+
29
+		Judge judge = this.daoJudge.get(id);
30
+		return judge;
31
+
32
+	}
33
+	
34
+	@RequestMapping("/judge/{id}/info")
35
+	public Judge getInfoById(@PathVariable Integer id ) {
36
+
37
+		Judge judge = this.daoJudge.get(id);
38
+		return judge;
39
+
40
+	}
41
+	
42
+
43
+	@RequestMapping("/judge/")
44
+	public Judge getByName(@RequestParam (required = true) String name ) {
45
+
46
+		Judge judge = new Judge(name);
47
+		return daoJudge.get(judge);
48
+	}
49
+}

+ 10 - 0
src/main/java/org/develop/officialjournal/controllers/SearchController.java

@@ -13,6 +13,7 @@ import dao.DAOLawyer;
13 13
 import dao.DAOProcess;
14 14
 import dao.DAOSearch;
15 15
 import entity.Entity;
16
+import entity.Info;
16 17
 import entity.Judge;
17 18
 import entity.Lawyer;
18 19
 
@@ -66,6 +67,15 @@ public class SearchController {
66 67
 	}
67 68
 	
68 69
 	
70
+	@RequestMapping("/search/info")
71
+	public Info getEntityInfo(@RequestParam String type, @RequestParam Integer entityId ) {
72
+				
73
+		return daoSearch.getInfo(type, entityId);
74
+			
75
+	}
76
+	
77
+	
78
+	
69 79
 	
70 80
 	
71 81
 	

+ 14 - 0
src/main/resources/static/css/app.css

@@ -0,0 +1,14 @@
1
+#verditctText{
2
+	
3
+	float: left;
4
+	text-align: justify;
5
+	padding: 10px 10px 10px 10px;
6
+	
7
+}
8
+
9
+
10
+#verdictTitle{
11
+	
12
+	font-size: 15;
13
+	
14
+}

+ 70 - 30
src/main/resources/static/index.html

@@ -4,15 +4,17 @@
4 4
 <title>Angular JS Modules</title>
5 5
 
6 6
   <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css">
7
-     
7
+  <link rel="stylesheet" href="css/app.css">
8 8
  
9
-  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
10
-  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
11
-  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
12
-  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>
9
+  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js" 		></script>
10
+  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"		></script>
11
+  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"		></script>
12
+  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js" 	></script>
13 13
 
14 14
   <!-- Angular Material Library -->
15 15
   <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>
16
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-google-chart/0.1.0/ng-google-chart.min.js" type="text/javascript"></script>
17
+  
16 18
   
17 19
   
18 20
 
@@ -27,7 +29,10 @@
27 29
 table, th, td {
28 30
 	border: 1px solid grey;
29 31
 	border-collapse: collapse;
30
-	padding: 5px;
32
+	padding-left:12px;
33
+	padding-right:12px;
34
+	padding-top:5px;
35
+	padding-bottom:5px;
31 36
 }
32 37
 
33 38
 table tr:nth-child(odd) {
@@ -37,59 +42,94 @@ table tr:nth-child(odd) {
37 42
 table tr:nth-child(even) {
38 43
 	background-color: #ffffff;
39 44
 }
45
+
46
+tabble ,tr, td  {
47
+	min-width: 200px;
48
+	text-align: center;
49
+	
50
+}
51
+
52
+#appContainer {
53
+	position: relative;
54
+	left: 7%;
55
+}
56
+
57
+
58
+
59
+
40 60
 </style>
41 61
 
42 62
 </head>
43 63
 
44 64
 <body>
45
-	<h2>Conhecimento nos diarios</h2>
46
-	<div ng-app="mainApp">
47
-		<div ng-controller="searchController">
48
-
49
-			<input type="text" ng-model="entity.text" size="50">
50
-			<button ng-click="search()">Busca</button>
51
-
65
+	<div  ng-app="mainApp">
66
+		<div id="appContainer" ng-controller="searchController">
67
+
68
+
69
+			<h2>Conhecimento nos diarios</h2>
70
+			<br/>
71
+			<layout class="row" >
72
+				<md-input-container>
73
+	        		<label>Busque Aqui</label>
74
+					<input type="text" ng-model="entity.text" size="50">
75
+	      		</md-input-container>
76
+				<div style="position: relative; top: -5px; display: inline-block; ">
77
+					<md-button ng-click="search()" class="md-raised md-warn">Buscar</md-button>
78
+				</div>
79
+			</layout>
80
+			
52 81
 
53
-			<table border="0">
82
+			<table border="0" >
54 83
 				<tr>
55
-					<td>Identificador</td>
56 84
 					<td>Nome</td>
57 85
 					<td>Tipo</td>
58 86
 					<td>NumeroOAB</td>
87
+					<td>Processos</td>
88
+					<td>Info</td>
59 89
 				</tr>
60 90
 
61 91
 				<tr>
62
-					<td><input type="text" ng-model="entity.id" /></td>
63
-					<td><input type="text" ng-model="entity.name" size="40" /></td>
64
-					<td><input type="text" ng-model="entity.type"></td>
65
-					<td><input type="text" ng-model="entity.oabnumber"></td>
92
+					<td><div > {{entity.name}} </div></td>
93
+					<td><div > {{entity.type}} </div></td>
94
+					<td><div > {{entity.oabnumber}} </div></td>
95
+					<td><md-button ng-click="getProcessEntity()" class="md-raised md-warn">Processos</md-button></td>
96
+					<td><md-button ng-click="getInfoEntity()" class="md-raised md-warn">Info</md-button></td>
97
+					<td><div google-chart chart="myChartObject" style="height: 200px; width: 500px;" >	</div></td>
66 98
 				</tr>
67 99
 
68 100
 			</table>
69
-			<button ng-click="getProcessEntity()"> Processos</button>
101
+			
102
+			
103
+			
104
+			
70 105
 			
71 106
 
72
-			<br>
73
-			<br>
107
+			
74 108
 			<br>
75 109
 
76 110
 			<table border="0">
77 111
 				<tr>
78
-					<td>Identificador</td>
79
-					<td>Numero</td>
80 112
 					<td>Data</td>
113
+					<td>Numero</td>
81 114
 					<td>Tipo</td>
115
+					<td>Sentença</td>
116
+					<td>Info</td>
82 117
 
83 118
 				</tr>
84 119
 
85 120
 				<tr ng-repeat="process in processList">
86
-					<td><input type="text" ng-model="process.id" /></td>
87
-					<td><input type="text" ng-model="process.processNumber" ng-click="getProcessNumber(process.processNumber)" size="40" /></td>
88
-					<td><input type="text" ng-model="process.processDate"></td>
89
-					<td><input type="text" ng-model="process.typeVerdict.name"></td>
121
+					<td><div > {{process.processDate}} </div></td>
122
+					<td><a   ng-click="getProcessNumber(process.processNumber)"  >{{process.processNumber}}</a> </td>
123
+					<td><div >{{process.typeVerdict.name}} </div></td>
124
+					<td >
125
+						<md-button class="md-primary md-raised" ng-click="showVerdict(this)"   >
126
+						     Sentença
127
+    					</md-button>
128
+					</td>
90 129
 					<td >
91
-						<div ng-click="showVerdict(this)">Setença</div>
92
-						<div ng-model="process.verdict"  class="ng-hide" data-id="process.id"> </div>
130
+						<md-button class="md-primary md-raised" ng-click="getInfo(this)"   >
131
+						     Info
132
+    					</md-button>
93 133
 					</td>
94 134
 				</tr>
95 135
 				

+ 2 - 1
src/main/resources/static/script/module/app.js

@@ -1,4 +1,5 @@
1
-var mainApp = angular.module("mainApp", ['ngMaterial']);
1
+var mainApp = angular.module("mainApp", ['ngMaterial', 'googlechart']);
2
+
2 3
 
3 4
 
4 5
 

+ 127 - 102
src/main/resources/static/script/module/search.js

@@ -3,128 +3,153 @@ mainApp.controller("searchController", function($scope, $http, $mdDialog ) {
3 3
 	var urlBase = "http://localhost:8080"
4 4
 
5 5
 
6
-		
6
+
7 7
 		/**Search the entity*/
8 8
 		$scope.search = function(){
9
-			var url =urlBase+"/search"+"?text="+$scope.entity.text;
10
-			$http.get(url).then(function(response) {
11
-				$scope.entity =  response.data;
12
-				$scope.processList=[];
13
-				
14
-			});
15
-		};
16
-			
17
-			
18
-		/**Return all process from entity*/
19
-		$scope.getProcessEntity = function(){
20
-			var url =urlBase+"/process/entity?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
21
-			
22
-			var size = $scope.processList.length;
23
-			
24
-			if($scope.processList != undefined && size > 0   )
25
-			{
26
-				url = url +"&processId="+$scope.processList[size -1].id;
27
-				
9
+		var url =urlBase+"/search"+"?text="+$scope.entity.text;
10
+		$http.get(url).then(function(response) {
11
+			$scope.entity =  response.data;
12
+			$scope.processList=[];
13
+
14
+		});
15
+	};
16
+
17
+
18
+	/**Return all process from entity*/
19
+	$scope.getProcessEntity = function(){
20
+		var url =urlBase+"/process/entity?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
21
+
22
+		var size = $scope.processList.length;
23
+
24
+		if($scope.processList != undefined && size > 0   )
25
+		{
26
+			url = url +"&processId="+$scope.processList[size -1].id;
27
+		}
28
+
29
+		$http.get(url) .then(function(response) {$scope.processList =  response.data;});
30
+	};
31
+
32
+
33
+
34
+	/**Return all process from process Number*/
35
+	$scope.getProcessNumber = function(processNumber ){
36
+
37
+		var url =urlBase+"/process/number?processNumber="+processNumber;
38
+		var size = $scope.processList.length;
39
+		$http.get(url) .then(function(response) {$scope.processList =  response.data;});
40
+	};
41
+
42
+	$scope.processList=[];
43
+	$scope.showVerdict = function(process) {
44
+
45
+
46
+		$mdDialog.show({
47
+			clickOutsideToClose: true,
48
+			scope: $scope,        // use parent scope in template
49
+			preserveScope: true,  // do not forget this if use parent scope
50
+
51
+			template: "<div id=\"verditctText\" > " +
52
+			" <div id=\"verdictTitle\">"+process.process.judge.name+"</div>"
53
+			+process.process.verdict.replace(/\n\r?/g, '<br />') +
54
+			"</div>",
55
+			controller: function DialogController($scope, $mdDialog) {
56
+				$scope.closeDialog = function() {
57
+					$mdDialog.hide();
58
+				}
28 59
 			}
29
-			
30
-			
31
-			$http.get(url) .then(function(response) {$scope.processList =  response.data;});
32
-		};
60
+		});
61
+
62
+
63
+	};
64
+
65
+
66
+	$scope.getInfo = function(process) {
67
+
33 68
 		
34
-		/**Return all process from entity*/
35
-		$scope.getProcessNumber = function(processNumber ){
36
-			
69
+		var judge  = " <p> JUIZ: "+process.process.judge.name +" </p> ";
70
+		var lawyer = "";// <p> ADVOGADO: "+process.process.judge.name +" </p>";
37 71
 		
38
-			var url =urlBase+"/process/number?processNumber="+processNumber;
72
+		for(var i in process.process.lawyers)
73
+		{
74
+			var lawyerObj = process.process.lawyers[i];
39 75
 			
76
+			lawyer = lawyer + "<p> ADVOGADO: "+lawyerObj.name +" </p>";
40 77
 			
41
-			var size = $scope.processList.length;
42
-//			
43
-//			if($scope.processList != undefined && size > 0   )
44
-//			{
45
-//				//url = url +"&processId="+$scope.processList[size -1].id;
46
-//				
47
-//			}
78
+		}
79
+		
80
+		
81
+		
82
+		var entities = "";
83
+		for(var i in process.process.otherEntities)
84
+		{
85
+			var entityObject = process.process.otherEntities[i];
48 86
 			
87
+			entities = entities +  "<p> "+entityObject.type+" : "+entityObject.name +" </p>";
49 88
 			
50
-			$http.get(url) .then(function(response) {$scope.processList =  response.data;});
51
-		};
89
+		}
52 90
 		
53
-		$scope.processList=[];
91
+		var modalText = "<div id=\"verditctText\" > " + juiz + advogado + entities +"</div>"
54 92
 		
55
-//		$scope.shwoVerdict = function(process){
56
-//			
57
-//		
58
-//			
59
-//			
60
-//			
61
-////			var idProcess = process.id;
62
-////			
63
-////			for(var i in $scope.processList)
64
-////			{
65
-////				var item = $scope.processList[i];
66
-////				
67
-////				if(item.id = idProcess)
68
-////				{
69
-////					console.log(id);
70
-////					
71
-////				}
72
-////				
73
-////			}
74
-//
75
-//			console.log(process.process.verdict);
76
-//			
77
-//			
78
-//			
79
-//			
80
-//		}
81 93
 		
82 94
 		
83 95
 		
84 96
 		
85
-		$scope.showVerdict = function(process) {
86
-		    
87
-			
97
+		$mdDialog.show({
98
+			clickOutsideToClose: true,
99
+			scope: $scope,        // use parent scope in template
100
+			preserveScope: true,  // do not forget this if use parent scope
101
+
102
+			template: modalText	,
103
+			controller: function DialogController($scope, $mdDialog) {
104
+				$scope.closeDialog = function() {
105
+					$mdDialog.hide();
106
+				}
107
+			}
108
+		});
88 109
 
89
-//			var url =urlBase+"/judge/"+process.process.judge.id;
90
-//			$http.get(url).then(function(response) {process.process.judge =  response.data;});
91
-//			
110
+
111
+	};
112
+
113
+	$scope.getInfoEntity = function(){
114
+
115
+		var url =urlBase+"/search/info?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
116
+		var size = $scope.processList.length;
117
+
118
+		$http.get(url) .then(function(response) {
119
+
120
+			$scope.myChartObject = {};
121
+			$scope.myChartObject.type = "ColumnChart";
122
+			
123
+			
124
+			$scope.myChartObject.data = 
125
+			{
126
+			"cols": [   {id: "t", label: "Topping", type: "string"},
127
+			            {id: "s", label: "Diarios", type: "number" } ,
128
+			            {role: "style", type: "string"} 
129
+			            
130
+			            
131
+			], 
132
+			"rows": [
133
+			       {c: [{v: "Deferidos"},	{v: response.data.deferredProcess }	,	{v: "green"} 	]},
134
+			       {c: [{v: "Indeferidos"},	{v: response.data.rejectedProcess } ,	{v: "red"}		]},
135
+			       {c: [{v: "Transito"},	{v: response.data.transtitProcess }	,	{v: "beige"}	]}  
136
+			       ]
137
+			};
138
+			
139
+			$scope.myChartObject.options = {'title': 'Informaçoes sobre a entidade'	};
140
+			
92 141
 			
93
-			$mdDialog.show(
94
-		      $mdDialog.alert()
95
-		        .clickOutsideToClose(true)
96
-		        .title(process.process.judge.name)
97
-		        .textContent(process.process.verdict)
98
-		        .ok('Fechar!')
99
-		        // You can specify either sting with query selector
100
-		        .openFrom('#left')
101
-		        // or an element
102
-		        .closeTo(angular.element(document.querySelector('#right')))
103
-		    );
104
-		};
105
-		
106
-		
142
+
143
+		});
144
+
145
+	};
146
+
147
+
148
+
107 149
 
108 150
 
109
-		
110
-		
111 151
 
112
-	
113 152
 
114 153
 });
115 154
 
116
-//mainApp.controller("processController", function($scope, $http) {
117
-//
118
-//	var urlBase = "http://localhost:8080/search"
119
-//
120
-//
121
-//		$scope.search = function(){
122
-//
123
-//		var url =urlBase+"?text="+$scope.entity.text;
124
-//		$http.get(url) .then(function(response) {
125
-//			$scope.entity =  response.data;
126
-//		});
127
-//
128
-//	}
129
-//
130
-//});
155
+