Browse Source

Add graphic

ailton 8 years ago
parent
commit
8a084fe122

+ 18 - 1
src/main/java/org/develop/officialjournal/controllers/ProcessController.java

@@ -38,6 +38,19 @@ public class ProcessController {
38 38
 		return process;
39 39
 
40 40
 	}
41
+	
42
+	@RequestMapping("/process/{id}/all")
43
+	public DOProcess getAllInfo(@PathVariable Integer id ) {
44
+
45
+		if(daoProcess == null)
46
+			daoProcess = Database.get().getDaoProcess();
47
+		
48
+		System.out.println("DAOPROCESS " +daoProcess);
49
+		DOProcess process = this.daoProcess.getAllInfo(id);
50
+		
51
+		return process;
52
+
53
+	}
41 54
 
42 55
 	@RequestMapping("/process/entity")
43 56
 	public List<DOProcess> getProcessByEntity(@RequestParam (required = true)  Integer entityId,
@@ -47,7 +60,7 @@ public class ProcessController {
47 60
 		Entity entity = new Entity();
48 61
 		entity.setId(entityId);
49 62
 		entity.setType(type);
50
-		return daoSearch.search(entity, true, processId);
63
+		return daoSearch.search(entity, false, processId);
51 64
 
52 65
 	}
53 66
 
@@ -70,6 +83,10 @@ public class ProcessController {
70 83
 		return searchResults;
71 84
 		
72 85
 	}
86
+	
87
+	
88
+	
89
+	
73 90
 
74 91
 
75 92
 

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

@@ -1,16 +1,13 @@
1 1
 package org.develop.officialjournal.controllers;
2 2
 
3 3
 import org.develop.officialjournal.services.Database;
4
-import org.springframework.web.bind.annotation.PathVariable;
5 4
 import org.springframework.web.bind.annotation.RequestMapping;
6
-import org.springframework.web.bind.annotation.RequestMethod;
7 5
 import org.springframework.web.bind.annotation.RequestParam;
8 6
 import org.springframework.web.bind.annotation.RestController;
9 7
 
10 8
 import dao.DAOEntity;
11 9
 import dao.DAOJudge;
12 10
 import dao.DAOLawyer;
13
-import dao.DAOProcess;
14 11
 import dao.DAOSearch;
15 12
 import entity.Entity;
16 13
 import entity.Info;
@@ -24,7 +21,6 @@ public class SearchController {
24 21
 	private DAOJudge daoJudge;
25 22
 	private DAOEntity daoEntity;
26 23
 	private DAOSearch daoSearch;
27
-	private DAOProcess daoProcess;
28 24
 	
29 25
 	
30 26
 	public SearchController() {
@@ -33,7 +29,6 @@ public class SearchController {
33 29
 		daoJudge =  Database.get().getDaoJudge();
34 30
 		daoEntity =  Database.get().getDaoEntity();
35 31
 		daoSearch = Database.get().getDaoSearch();
36
-		daoProcess = Database.get().getDaoProcess();
37 32
 		
38 33
 	}
39 34
 	

+ 4 - 1
src/main/java/org/develop/officialjournal/services/Database.java

@@ -89,6 +89,10 @@ public class Database {
89 89
 	 * @return the daoProcess
90 90
 	 */
91 91
 	public DAOProcess getDaoProcess() {
92
+		if(this.daoProcess == null)
93
+		{
94
+			this.daoProcess = new DAOProcess(connector.getConnection());
95
+		}
92 96
 		return daoProcess;
93 97
 	}
94 98
 
@@ -100,7 +104,6 @@ public class Database {
100 104
 	}
101 105
 
102 106
 
103
-
104 107
 	/**
105 108
 	 * @return the daoEntity
106 109
 	 */

+ 84 - 41
src/main/resources/static/script/module/search.js

@@ -18,15 +18,43 @@ mainApp.controller("searchController", function($scope, $http, $mdDialog ) {
18 18
 	/**Return all process from entity*/
19 19
 	$scope.getProcessEntity = function(){
20 20
 		var url =urlBase+"/process/entity?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
21
-
22 21
 		var size = $scope.processList.length;
23
-
24 22
 		if($scope.processList != undefined && size > 0   )
25 23
 		{
26 24
 			url = url +"&processId="+$scope.processList[size -1].id;
27 25
 		}
28 26
 
29
-		$http.get(url) .then(function(response) {$scope.processList =  response.data;});
27
+		
28
+		$http.get(url) .then(function(response) {
29
+			
30
+			$scope.processList =  response.data;
31
+			var k=0;
32
+
33
+			for( var i in $scope.processList)
34
+			{
35
+				var process =  $scope.processList[i];
36
+				
37
+				
38
+				var urlProcess =urlBase+"/process/"+process.id+"/all";
39
+
40
+				if(process.lawyers.length == 0)
41
+				{
42
+					$http.get(urlProcess).then(function(response) {
43
+						$scope.processList[k] =  response.data;
44
+						k++;
45
+						
46
+					});
47
+				}
48
+				
49
+			}
50
+		
51
+		
52
+		});
53
+		
54
+		
55
+		
56
+		
57
+		
30 58
 	};
31 59
 
32 60
 
@@ -61,44 +89,37 @@ mainApp.controller("searchController", function($scope, $http, $mdDialog ) {
61 89
 
62 90
 
63 91
 	};
92
+	
93
+	/**Show a popUp with a process**/
64 94
 
65
-
66
-	$scope.getInfo = function(process) {
67
-
68
-		
95
+	$scope.showPopUp = function(process)
96
+	{
69 97
 		var judge  = " <p> JUIZ: "+process.process.judge.name +" </p> ";
70
-		var lawyer = "";// <p> ADVOGADO: "+process.process.judge.name +" </p>";
71
-		
98
+		var lawyer = "";
99
+
72 100
 		for(var i in process.process.lawyers)
73 101
 		{
74 102
 			var lawyerObj = process.process.lawyers[i];
75
-			
76
-			lawyer = lawyer + "<p> ADVOGADO: "+lawyerObj.name +" </p>";
77
-			
103
+			if(lawyerObj.id != 22)
104
+			{
105
+				lawyer = lawyer + "<p> ADVOGADO: "+lawyerObj.name +" </p>";
106
+			}
78 107
 		}
79
-		
80
-		
81
-		
82 108
 		var entities = "";
83 109
 		for(var i in process.process.otherEntities)
84 110
 		{
85 111
 			var entityObject = process.process.otherEntities[i];
86
-			
112
+
87 113
 			entities = entities +  "<p> "+entityObject.type+" : "+entityObject.name +" </p>";
88
-			
114
+
89 115
 		}
90
-		
91
-		var modalText = "<div id=\"verditctText\" > " + juiz + advogado + entities +"</div>"
92
-		
93
-		
94
-		
95
-		
96
-		
116
+
117
+		var modalText = "<div id=\"verditctText\" > " + judge + lawyer + entities +"</div>"
118
+
97 119
 		$mdDialog.show({
98 120
 			clickOutsideToClose: true,
99 121
 			scope: $scope,        // use parent scope in template
100 122
 			preserveScope: true,  // do not forget this if use parent scope
101
-
102 123
 			template: modalText	,
103 124
 			controller: function DialogController($scope, $mdDialog) {
104 125
 				$scope.closeDialog = function() {
@@ -106,10 +127,32 @@ mainApp.controller("searchController", function($scope, $http, $mdDialog ) {
106 127
 				}
107 128
 			}
108 129
 		});
130
+		
131
+		
132
+	};
133
+	
134
+	
135
+	/**Get All Info about the user*/
136
+	
137
+	$scope.getInfo = function(process) {
109 138
 
139
+		var url =urlBase+"/process/"+process.process.id+"/all";
110 140
 
141
+		if(process.process.lawyers.length == 0)
142
+		{
143
+			$http.get(url) .then(function(response) {
144
+				process.process =  response.data;
145
+				$scope.showPopUp(process);
146
+			});
147
+		}
148
+		else{
149
+			$scope.showPopUp(process);
150
+		}
111 151
 	};
112 152
 
153
+
154
+	/**Info of entity and build the graphic**/
155
+
113 156
 	$scope.getInfoEntity = function(){
114 157
 
115 158
 		var url =urlBase+"/search/info?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
@@ -119,26 +162,26 @@ mainApp.controller("searchController", function($scope, $http, $mdDialog ) {
119 162
 
120 163
 			$scope.myChartObject = {};
121 164
 			$scope.myChartObject.type = "ColumnChart";
122
-			
123
-			
165
+
166
+
124 167
 			$scope.myChartObject.data = 
125 168
 			{
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
-			       ]
169
+					"cols": [   {id: "t", label: "Topping", type: "string"},
170
+					            {id: "s", label: "Diarios", type: "number" } ,
171
+					            {role: "style", type: "string"} 
172
+
173
+
174
+					            ], 
175
+					            "rows": [
176
+					                     {c: [{v: "Deferidos"},	{v: response.data.deferredProcess }	,	{v: "green"} 	]},
177
+					                     {c: [{v: "Indeferidos"},	{v: response.data.rejectedProcess } ,	{v: "red"}		]},
178
+					                     {c: [{v: "Transito"},	{v: response.data.transtitProcess }	,	{v: "beige"}	]}  
179
+					                     ]
137 180
 			};
138
-			
181
+
139 182
 			$scope.myChartObject.options = {'title': 'Informaçoes sobre a entidade'	};
140
-			
141
-			
183
+
184
+
142 185
 
143 186
 		});
144 187