Browse Source

Add graphic

ailton 8 years ago
parent
commit
8a084fe122

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

38
 		return process;
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
 	@RequestMapping("/process/entity")
55
 	@RequestMapping("/process/entity")
43
 	public List<DOProcess> getProcessByEntity(@RequestParam (required = true)  Integer entityId,
56
 	public List<DOProcess> getProcessByEntity(@RequestParam (required = true)  Integer entityId,
47
 		Entity entity = new Entity();
60
 		Entity entity = new Entity();
48
 		entity.setId(entityId);
61
 		entity.setId(entityId);
49
 		entity.setType(type);
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
 		return searchResults;
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
 package org.develop.officialjournal.controllers;
1
 package org.develop.officialjournal.controllers;
2
 
2
 
3
 import org.develop.officialjournal.services.Database;
3
 import org.develop.officialjournal.services.Database;
4
-import org.springframework.web.bind.annotation.PathVariable;
5
 import org.springframework.web.bind.annotation.RequestMapping;
4
 import org.springframework.web.bind.annotation.RequestMapping;
6
-import org.springframework.web.bind.annotation.RequestMethod;
7
 import org.springframework.web.bind.annotation.RequestParam;
5
 import org.springframework.web.bind.annotation.RequestParam;
8
 import org.springframework.web.bind.annotation.RestController;
6
 import org.springframework.web.bind.annotation.RestController;
9
 
7
 
10
 import dao.DAOEntity;
8
 import dao.DAOEntity;
11
 import dao.DAOJudge;
9
 import dao.DAOJudge;
12
 import dao.DAOLawyer;
10
 import dao.DAOLawyer;
13
-import dao.DAOProcess;
14
 import dao.DAOSearch;
11
 import dao.DAOSearch;
15
 import entity.Entity;
12
 import entity.Entity;
16
 import entity.Info;
13
 import entity.Info;
24
 	private DAOJudge daoJudge;
21
 	private DAOJudge daoJudge;
25
 	private DAOEntity daoEntity;
22
 	private DAOEntity daoEntity;
26
 	private DAOSearch daoSearch;
23
 	private DAOSearch daoSearch;
27
-	private DAOProcess daoProcess;
28
 	
24
 	
29
 	
25
 	
30
 	public SearchController() {
26
 	public SearchController() {
33
 		daoJudge =  Database.get().getDaoJudge();
29
 		daoJudge =  Database.get().getDaoJudge();
34
 		daoEntity =  Database.get().getDaoEntity();
30
 		daoEntity =  Database.get().getDaoEntity();
35
 		daoSearch = Database.get().getDaoSearch();
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
 	 * @return the daoProcess
89
 	 * @return the daoProcess
90
 	 */
90
 	 */
91
 	public DAOProcess getDaoProcess() {
91
 	public DAOProcess getDaoProcess() {
92
+		if(this.daoProcess == null)
93
+		{
94
+			this.daoProcess = new DAOProcess(connector.getConnection());
95
+		}
92
 		return daoProcess;
96
 		return daoProcess;
93
 	}
97
 	}
94
 
98
 
100
 	}
104
 	}
101
 
105
 
102
 
106
 
103
-
104
 	/**
107
 	/**
105
 	 * @return the daoEntity
108
 	 * @return the daoEntity
106
 	 */
109
 	 */

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

18
 	/**Return all process from entity*/
18
 	/**Return all process from entity*/
19
 	$scope.getProcessEntity = function(){
19
 	$scope.getProcessEntity = function(){
20
 		var url =urlBase+"/process/entity?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
20
 		var url =urlBase+"/process/entity?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
21
-
22
 		var size = $scope.processList.length;
21
 		var size = $scope.processList.length;
23
-
24
 		if($scope.processList != undefined && size > 0   )
22
 		if($scope.processList != undefined && size > 0   )
25
 		{
23
 		{
26
 			url = url +"&processId="+$scope.processList[size -1].id;
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
 
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
 		var judge  = " <p> JUIZ: "+process.process.judge.name +" </p> ";
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
 		for(var i in process.process.lawyers)
100
 		for(var i in process.process.lawyers)
73
 		{
101
 		{
74
 			var lawyerObj = process.process.lawyers[i];
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
 		var entities = "";
108
 		var entities = "";
83
 		for(var i in process.process.otherEntities)
109
 		for(var i in process.process.otherEntities)
84
 		{
110
 		{
85
 			var entityObject = process.process.otherEntities[i];
111
 			var entityObject = process.process.otherEntities[i];
86
-			
112
+
87
 			entities = entities +  "<p> "+entityObject.type+" : "+entityObject.name +" </p>";
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
 		$mdDialog.show({
119
 		$mdDialog.show({
98
 			clickOutsideToClose: true,
120
 			clickOutsideToClose: true,
99
 			scope: $scope,        // use parent scope in template
121
 			scope: $scope,        // use parent scope in template
100
 			preserveScope: true,  // do not forget this if use parent scope
122
 			preserveScope: true,  // do not forget this if use parent scope
101
-
102
 			template: modalText	,
123
 			template: modalText	,
103
 			controller: function DialogController($scope, $mdDialog) {
124
 			controller: function DialogController($scope, $mdDialog) {
104
 				$scope.closeDialog = function() {
125
 				$scope.closeDialog = function() {
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
 	$scope.getInfoEntity = function(){
156
 	$scope.getInfoEntity = function(){
114
 
157
 
115
 		var url =urlBase+"/search/info?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
158
 		var url =urlBase+"/search/info?type="+$scope.entity.type +"&entityId="+$scope.entity.id;
119
 
162
 
120
 			$scope.myChartObject = {};
163
 			$scope.myChartObject = {};
121
 			$scope.myChartObject.type = "ColumnChart";
164
 			$scope.myChartObject.type = "ColumnChart";
122
-			
123
-			
165
+
166
+
124
 			$scope.myChartObject.data = 
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
 			$scope.myChartObject.options = {'title': 'Informaçoes sobre a entidade'	};
182
 			$scope.myChartObject.options = {'title': 'Informaçoes sobre a entidade'	};
140
-			
141
-			
183
+
184
+
142
 
185
 
143
 		});
186
 		});
144
 
187