Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
securityRemake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Juan Guevara Mayta
securityRemake
Commits
72fb43bf
Commit
72fb43bf
authored
Aug 10, 2023
by
Mauro Paolo Josue Zuñiga Mallqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EDIT] CAMBIOS PARA MYSQL EN PROGRESO
parent
5da179ab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
326 additions
and
297 deletions
+326
-297
pom.xml
pom.xml
+8
-13
DAOFactory.java
...in/java/com/mycompany/moduloseguridad/dao/DAOFactory.java
+7
-10
MenuDAO.java
src/main/java/com/mycompany/moduloseguridad/dao/MenuDAO.java
+1
-1
TipoUsuarioDAO.java
...ava/com/mycompany/moduloseguridad/dao/TipoUsuarioDAO.java
+22
-30
MenuMYSQLDAO.java
.../com/mycompany/moduloseguridad/mysqldao/MenuMYSQLDAO.java
+0
-0
MySQLDAOFactory.java
...m/mycompany/moduloseguridad/mysqldao/MySQLDAOFactory.java
+22
-26
ProyectoMYSQLDAO.java
.../mycompany/moduloseguridad/mysqldao/ProyectoMYSQLDAO.java
+27
-33
TipoUsuarioMYSQLDAO.java
...company/moduloseguridad/mysqldao/TipoUsuarioMYSQLDAO.java
+30
-31
UsuarioMYSQLDAO.java
...m/mycompany/moduloseguridad/mysqldao/UsuarioMYSQLDAO.java
+22
-22
MenuService.java
...a/com/mycompany/moduloseguridad/services/MenuService.java
+3
-3
ProyectoService.java
...m/mycompany/moduloseguridad/services/ProyectoService.java
+1
-1
TipoUsuarioService.java
...ycompany/moduloseguridad/services/TipoUsuarioService.java
+17
-17
UsuarioService.java
...om/mycompany/moduloseguridad/services/UsuarioService.java
+1
-1
MantenimientoMenuServlet.java
...ny/moduloseguridad/servlets/MantenimientoMenuServlet.java
+7
-3
TipoUsuarioServlet.java
...ycompany/moduloseguridad/servlets/TipoUsuarioServlet.java
+2
-1
UsuarioServlet.java
...om/mycompany/moduloseguridad/servlets/UsuarioServlet.java
+31
-27
DAOHelper.java
...va/com/mycompany/moduloseguridad/utilities/DAOHelper.java
+16
-15
HttpRequest.java
.../com/mycompany/moduloseguridad/utilities/HttpRequest.java
+8
-14
general.css
src/main/webapp/css/general.css
+11
-11
MantenimientoMenu.js
src/main/webapp/js/pages/MantenimientoMenu.js
+23
-15
tipoUsuario.js
src/main/webapp/js/pages/tipoUsuario.js
+5
-3
mantenimientoMenu.jsp
src/main/webapp/vistas/mantenimientoMenu.jsp
+41
-16
mantenimientoTipoUsuario.jsp
src/main/webapp/vistas/mantenimientoTipoUsuario.jsp
+21
-4
No files found.
pom.xml
View file @
72fb43bf
...
...
@@ -68,13 +68,18 @@
<dependency>
<groupId>
org.json
</groupId>
<artifactId>
json
</artifactId>
<version>
20
1710
18
</version>
<version>
20
2306
18
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc42 -->
<dependency>
<
!-- <
dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency> -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.44
</version>
</dependency>
</dependencies>
...
...
@@ -127,17 +132,7 @@
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.wildfly.plugins</groupId>-->
<!-- <artifactId>wildfly-maven-plugin</artifactId>-->
<!-- <version>3.0.2.Final</version>-->
<!-- <configuration>-->
<!-- <hostname>172.16.1.33</hostname>-->
<!-- <port>9990</port>-->
<!-- <username>wildfly</username>-->
<!-- <password>Saco1357$</password>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>
...
...
src/main/java/com/mycompany/moduloseguridad/dao/DAOFactory.java
View file @
72fb43bf
...
...
@@ -5,7 +5,7 @@
*/
package
com
.
mycompany
.
moduloseguridad
.
dao
;
import
com.mycompany.moduloseguridad.
sqlserverdao.SqlServer
DAOFactory
;
import
com.mycompany.moduloseguridad.
mysqldao.MySQL
DAOFactory
;
/**
*
...
...
@@ -13,17 +13,14 @@ import com.mycompany.moduloseguridad.sqlserverdao.SqlServerDAOFactory;
*/
public
abstract
class
DAOFactory
{
public
static
final
int
SQLSERVER
=
1
;
public
static
final
int
MYSQL
=
2
;
public
static
final
int
MYSQL
=
1
;
public
static
DAOFactory
getDAOFactory
(
int
Motor_Base
)
{
switch
(
Motor_Base
)
{
case
SQLSERVER:
return
new
SqlServerDAOFactory
();
default
:
return
null
;
}
}
if
(
Motor_Base
==
MYSQL
)
{
return
new
MySQLDAOFactory
();
}
return
null
;
}
public
abstract
TipoUsuarioDAO
getTipoUsuario
();
...
...
src/main/java/com/mycompany/moduloseguridad/dao/MenuDAO.java
View file @
72fb43bf
...
...
@@ -14,7 +14,7 @@ import org.json.JSONObject;
*/
public
interface
MenuDAO
{
public
JSONArray
listarProyecto
()
throws
Exception
;
public
JSONArray
listarProyecto
(
int
estado
)
throws
Exception
;
public
JSONArray
listarTipoDeUsuario
(
int
proyecto
)
throws
Exception
;
...
...
src/main/java/com/mycompany/moduloseguridad/dao/TipoUsuarioDAO.java
View file @
72fb43bf
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com
.
mycompany
.
moduloseguridad
.
dao
;
import
org.json.JSONObject
;
/**
*
* @author sistem17user
*/
public
interface
TipoUsuarioDAO
{
public
JSONObject
listarProyectos
()
throws
Exception
;
public
JSONObject
listarTiposUsuarios
(
int
codigoProyecto
)
throws
Exception
;
public
JSONObject
asignarAcciones
(
JSONObject
datos
)
throws
Exception
;
public
JSONObject
activarDesactivarAccion
(
JSONObject
datos
)
throws
Exception
;
public
JSONObject
activarDesactivarTipoUsuario
(
JSONObject
datos
)
throws
Exception
;
public
JSONObject
listarAcciones
(
JSONObject
datos
)
throws
Exception
;
public
JSONObject
listarCboAcciones
()
throws
Exception
;
public
JSONObject
listadoPrincipal
(
String
filtro
,
int
filtrado
,
int
proyecto
,
int
vstart
,
int
vlength
,
String
draw
)
throws
Exception
;
JSONObject
listarProyectos
(
)
throws
Exception
;
public
int
activarTipoUsuario
(
int
codig
o
)
throws
Exception
;
JSONObject
listarTiposUsuarios
(
int
codigoProyect
o
)
throws
Exception
;
public
int
desactivarTipoUsuario
(
int
codigo
)
throws
Exception
;
JSONObject
asignarAcciones
(
JSONObject
datos
)
throws
Exception
;
public
int
editarTipoUsuario
(
int
codigo
,
String
nombre
)
throws
Exception
;
JSONObject
activarDesactivarAccion
(
JSONObject
datos
)
throws
Exception
;
public
int
crearTipoUsuario
(
String
nombre
)
throws
Exception
;
JSONObject
activarDesactivarTipoUsuario
(
JSONObject
datos
)
throws
Exception
;
public
int
validarTipoUsuario
(
int
codigo
)
throws
Exception
;
JSONObject
listarAcciones
(
JSONObject
datos
)
throws
Exception
;
public
int
validarNombreTipoUsuario
(
String
nombreInicial
,
String
nombreIngreso
,
int
tipo
)
throws
Exception
;
JSONObject
listarCboAcciones
()
throws
Exception
;
JSONObject
listadoPrincipal
(
String
filtro
,
int
filtrado
,
int
proyecto
,
int
vstart
,
int
vlength
,
String
draw
,
int
estado
)
throws
Exception
;
int
activarTipoUsuario
(
int
codigo
)
throws
Exception
;
int
desactivarTipoUsuario
(
int
codigo
)
throws
Exception
;
int
editarTipoUsuario
(
int
codigo
,
String
nombre
)
throws
Exception
;
int
crearTipoUsuario
(
String
nombre
)
throws
Exception
;
int
validarTipoUsuario
(
int
codigo
)
throws
Exception
;
int
validarNombreTipoUsuario
(
String
nombreInicial
,
String
nombreIngreso
,
int
tipo
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/mycompany/moduloseguridad/
sqlserverdao/MenuSqlServer
DAO.java
→
src/main/java/com/mycompany/moduloseguridad/
mysqldao/MenuMYSQL
DAO.java
View file @
72fb43bf
This diff is collapsed.
Click to expand it.
src/main/java/com/mycompany/moduloseguridad/
sqlserverdao/SqlServer
DAOFactory.java
→
src/main/java/com/mycompany/moduloseguridad/
mysqldao/MySQL
DAOFactory.java
View file @
72fb43bf
...
...
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com
.
mycompany
.
moduloseguridad
.
sqlserver
dao
;
package
com
.
mycompany
.
moduloseguridad
.
mysql
dao
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
...
...
@@ -14,33 +14,28 @@ import com.mycompany.moduloseguridad.dao.TipoUsuarioDAO;
import
com.mycompany.moduloseguridad.dao.UsuarioDAO
;
import
com.mycompany.moduloseguridad.utilities.dotenSrv
;
/**
*
* @author Felipe
*
*/
public
class
SqlServerDAOFactory
extends
DAOFactory
{
public
class
MySQLDAOFactory
extends
DAOFactory
{
public
static
Connection
getConnectionSQL
(
String
base
)
{
Connection
conexion
=
null
;
String
host
=
""
;
String
port
=
""
;
String
databaseName
=
""
;
String
userSgbd
=
""
;
String
passwordSgbd
=
""
;
if
(
base
.
equalsIgnoreCase
(
"security"
))
{
host
=
dotenSrv
.
obtenerValorVariableEntorno
(
"SQLSERVER_SECURITY_DB_HOST"
);
port
=
dotenSrv
.
obtenerValorVariableEntorno
(
"SQLSERVER_SECURITY_DB_PORT"
);
databaseName
=
dotenSrv
.
obtenerValorVariableEntorno
(
"SQLSERVER_SECURITY_DB_NAME"
);
userSgbd
=
dotenSrv
.
obtenerValorVariableEntorno
(
"SQLSERVER_SECURITY_DB_USER"
);
passwordSgbd
=
dotenSrv
.
obtenerValorVariableEntorno
(
"SQLSERVER_SECURITY_DB_PASS"
);
String
url
=
"jdbc:sqlserver://"
+
host
+
":"
+
port
+
";databaseName="
+
databaseName
;
String
host
=
""
;
String
port
=
""
;
String
databaseName
=
""
;
String
userSgbd
=
""
;
String
passwordSgbd
=
""
;
if
(
base
.
equalsIgnoreCase
(
"security"
))
{
host
=
dotenSrv
.
obtenerValorVariableEntorno
(
"MYSQL_SECURITY_DB_HOST"
);
port
=
dotenSrv
.
obtenerValorVariableEntorno
(
"MYSQL_SECURITY_DB_PORT"
);
databaseName
=
dotenSrv
.
obtenerValorVariableEntorno
(
"MYSQL_SECURITY_DB_NAME"
);
userSgbd
=
dotenSrv
.
obtenerValorVariableEntorno
(
"MYSQL_SECURITY_DB_USER"
);
passwordSgbd
=
dotenSrv
.
obtenerValorVariableEntorno
(
"MYSQL_SECURITY_DB_PASS"
);
String
url
=
"jdbc:mysql://"
+
host
+
":"
+
port
+
"/"
+
databaseName
+
"?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull"
;
// System.out.println("Conectando a la base de datos : "+url+ " con el usuario : "+userSgbd+ " y password : "+passwordSgbd);
try
{
Class
.
forName
(
"com.m
icrosoft.sqlserver.jdbc.SQLServerDriver"
);
Class
.
forName
(
"com.m
ysql.jdbc.Driver"
);
/*Produccion*/
conexion
=
DriverManager
.
getConnection
(
url
,
userSgbd
,
passwordSgbd
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"Error al conectarse a la bd"
);
System
.
out
.
println
(
"Error al conectarse a la bd : "
+
e
.
getMessage
());
}
}
return
conexion
;
...
...
@@ -48,21 +43,21 @@ public class SqlServerDAOFactory extends DAOFactory {
@Override
public
TipoUsuarioDAO
getTipoUsuario
()
{
return
new
TipoUsuario
SqlServer
DAO
();
return
new
TipoUsuario
MYSQL
DAO
();
}
@Override
public
ProyectoDAO
getProyectoDAO
()
{
return
new
Proyecto
SqlServer
DAO
();
return
new
Proyecto
MYSQL
DAO
();
}
@Override
public
UsuarioDAO
getUsuarioDAO
()
{
return
new
Usuario
SqlServer
DAO
();
return
new
Usuario
MYSQL
DAO
();
}
@Override
public
MenuDAO
getMenuDAO
()
{
return
new
Menu
SqlServer
DAO
();
return
new
Menu
MYSQL
DAO
();
}
}
\ No newline at end of file
src/main/java/com/mycompany/moduloseguridad/
sqlserverdao/ProyectoSqlServer
DAO.java
→
src/main/java/com/mycompany/moduloseguridad/
mysqldao/ProyectoMYSQL
DAO.java
View file @
72fb43bf
...
...
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com
.
mycompany
.
moduloseguridad
.
sqlserver
dao
;
package
com
.
mycompany
.
moduloseguridad
.
mysql
dao
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
...
...
@@ -18,7 +18,7 @@ import org.json.JSONObject;
*
* @author sistem17user
*/
public
class
Proyecto
SqlServer
DAO
implements
ProyectoDAO
{
public
class
Proyecto
MYSQL
DAO
implements
ProyectoDAO
{
@Override
public
JSONObject
listarProyecto
(
JSONObject
datos
,
int
vstart
,
int
vlength
,
String
draw
)
throws
Exception
{
...
...
@@ -43,13 +43,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
}
else
{
busqueda
+=
"and est = 1"
;
}
query
=
" select TOP "
+
vlength
+
" cod_proyecto, nom, est, url from proyecto "
+
" where cod_proyecto NOT IN "
+
" ( "
+
" SELECT top "
+
vstart
+
" "
+
" cod_proyecto from proyecto ORDER BY cod_proyecto) "
query
=
" select cod_proyecto, nom, est, url from proyecto "
+
" where true"
+
" "
+
busqueda
+
" "
;
con
=
SqlServerDAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQLDAOFactory
.
getConnectionSQL
(
base
);
System
.
out
.
println
(
"query: "
+
query
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -69,7 +67,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+
" "
+
busqueda
+
" "
;
PreparedStatement
pst2
=
null
;
ResultSet
rs2
=
null
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query2
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -100,7 +98,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+
" set nom = '"
+
nombre
+
"', "
+
" url = '"
+
url
+
"' "
+
" where cod_proyecto = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -123,7 +121,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query
=
" update proyecto "
+
" set est = 1 "
+
" where cod_proyecto = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -146,7 +144,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query
=
" update proyecto "
+
" set est = 0 "
+
" where cod_proyecto = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -169,7 +167,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
ResultSet
rsLlave
=
null
;
String
query
=
""
;
try
{
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
con
.
setAutoCommit
(
false
);
query
=
" insert into proyecto_detalle (cod_proyecto, cod_tipo_usuario, est) "
+
" values ("
+
proyecto
+
", "
+
tipoUsuario
+
", 1) "
;
...
...
@@ -212,15 +210,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
JSONArray
lista
=
new
JSONArray
();
int
conta
=
vstart
;
try
{
query
=
" select
TOP "
+
vlength
+
"
tu.nom, pd.est, pd.cod_proyecto_detalle from proyecto_detalle as pd "
query
=
" select tu.nom, pd.est, pd.cod_proyecto_detalle from proyecto_detalle as pd "
+
" inner join tipo_usuario as tu "
+
" on tu.cod_tipo_usuario = pd.cod_tipo_usuario "
+
" where cod_proyecto_detalle NOT IN "
+
" ( "
+
" SELECT top "
+
vstart
+
" "
+
" cod_proyecto_detalle from proyecto_detalle ORDER BY cod_proyecto_detalle) "
+
" and cod_proyecto = "
+
filtro
+
""
;
con
=
SqlServerDAOFactory
.
getConnectionSQL
(
base
);
+
" where cod_proyecto = "
+
filtro
+
" LIMIT "
+
vstart
+
", "
+
vlength
+
";"
;
con
=
MySQLDAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -238,7 +232,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+
" where cod_proyecto = "
+
filtro
+
" "
;
PreparedStatement
pst2
=
null
;
ResultSet
rs2
=
null
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query2
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -267,7 +261,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try
{
query
=
" insert into proyecto (nom, url, est)"
+
" values ('"
+
nombre
+
"', '"
+
url
+
"', 1) "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -290,7 +284,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query
=
" update proyecto_detalle "
+
" set est = 1 "
+
" where cod_proyecto_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -313,7 +307,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query
=
" update proyecto_detalle "
+
" set est = 0 "
+
" where cod_proyecto_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -338,7 +332,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+
" not in (select pd.cod_tipo_usuario from proyecto_detalle as pd "
+
" where pd.cod_proyecto = "
+
proyecto
+
") "
+
" and est = 1 "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -366,7 +360,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try
{
query
=
" delete from proyecto_detalle "
+
" where cod_proyecto_detalle = "
+
codigoDetalle
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -396,7 +390,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+
"where p.cod_proyecto = "
+
codigo
+
"\n"
+
"and ud.est = 1 "
;
System
.
out
.
println
(
"QUERY "
+
query
);
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -427,7 +421,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
if
(
tipo
==
1
)
{
query
+=
" and nom != '"
+
nombreActual
+
"' "
;
}
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -457,7 +451,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
if
(
tipo
==
1
)
{
query
+=
" and url != '"
+
urlActual
+
"' "
;
}
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -483,7 +477,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query
=
" select count(*) as cant from usuario_detalle "
+
" where cod_proyecto_detalle = "
+
codigo
+
" "
+
" and est = 1 "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -508,7 +502,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try
{
query
=
" select count(*) as cant from titulo_configuracion "
+
" where cod_proyecto_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rsQuery
=
pst
.
executeQuery
();
rsQuery
.
next
();
...
...
@@ -531,7 +525,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
ResultSet
rsQuery
=
null
;
String
query
=
""
;
try
{
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
query
=
" delete from titulo_configuracion "
+
" where cod_proyecto_detalle = "
+
codigo
+
""
;
pst
=
con
.
prepareStatement
(
query
);
...
...
@@ -567,7 +561,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
String
sql
=
""
;
ResponseHelper
response
=
new
ResponseHelper
();
try
{
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
"security"
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
"security"
);
// con.setAutoCommit(false);
sql
=
" update usuario_detalle\n"
+
"set est = 0\n"
...
...
src/main/java/com/mycompany/moduloseguridad/
sqlserverdao/TipoUsuarioSqlServer
DAO.java
→
src/main/java/com/mycompany/moduloseguridad/
mysqldao/TipoUsuarioMYSQL
DAO.java
View file @
72fb43bf
This diff is collapsed.
Click to expand it.
src/main/java/com/mycompany/moduloseguridad/
sqlserverdao/UsuarioSqlServer
DAO.java
→
src/main/java/com/mycompany/moduloseguridad/
mysqldao/UsuarioMYSQL
DAO.java
View file @
72fb43bf
...
...
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com
.
mycompany
.
moduloseguridad
.
sqlserver
dao
;
package
com
.
mycompany
.
moduloseguridad
.
mysql
dao
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
...
...
@@ -18,7 +18,7 @@ import org.json.JSONObject;
*
* @author sistem17user
*/
public
class
Usuario
SqlServer
DAO
implements
UsuarioDAO
{
public
class
Usuario
MYSQL
DAO
implements
UsuarioDAO
{
@Override
public
JSONArray
listarUsuario
(
JSONObject
datos
,
int
vstart
,
int
vlength
,
int
draw
)
throws
Exception
{
...
...
@@ -59,7 +59,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" select cod_usuario, cod_trabajador, usu, est, cantidad from tablaOrdenada "
+
" where cantidad BETWEEN "
+
vstart
+
" and "
+
vlength
*
draw
+
" ORDER BY usu ASC"
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
...
...
@@ -117,7 +117,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" LEFT JOIN proyecto_detalle AS pd ON pd.cod_proyecto_detalle = ud.cod_proyecto_detalle "
+
" WHERE 1 = 1 "
+
busqueda
+
" "
+
" GROUP BY a.cod_usuario "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -144,7 +144,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" set usu = upper('"
+
usuario
+
"'),"
+
" con = '"
+
clave
+
"'"
+
" where cod_usuario = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -167,7 +167,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" update usuario "
+
" set est = 1 "
+
" where cod_usuario = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -190,7 +190,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" update usuario "
+
" set est = 0 "
+
" where cod_usuario = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
if
(
rs
==
1
)
{
...
...
@@ -198,7 +198,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" set est = 0 "
+
" where cod_usuario = "
+
codigo
;
}
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -220,7 +220,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" insert into usuario (cod_trabajador, usu, con, est) "
+
" values ('"
+
codigoTrabajador
+
"', upper('"
+
usuario
+
"'), '"
+
clave
+
"', 1) "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -244,7 +244,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" select count(*) as cant "
+
" from usuario "
+
" where cod_trabajador = '"
+
codigoTrabajador
+
"'"
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -268,7 +268,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" delete from usuario "
+
" where cod_usuario = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -299,7 +299,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" inner join tipo_usuario as tu "
+
" on tu.cod_tipo_usuario = pd.cod_tipo_usuario "
+
" where ud.cod_usuario = "
+
filtro
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -346,7 +346,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" delete from usuario_detalle "
+
" where cod_usuario_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -369,7 +369,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" update usuario_detalle "
+
" set est = 1 "
+
" where cod_usuario_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -392,7 +392,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" update usuario_detalle "
+
" set est = 0 "
+
" where cod_usuario_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -415,7 +415,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query
=
" insert into usuario_detalle "
+
" (cod_usuario, cod_proyecto_detalle, est) "
+
" values("
+
usuario
+
", "
+
proyectoDetalle
+
", 1) "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeUpdate
();
}
catch
(
Exception
e
)
{
...
...
@@ -440,7 +440,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
"inner join proyecto as p "
+
"on p.cod_proyecto = pd.cod_proyecto "
+
"group by pd.cod_proyecto, p.nom "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -490,7 +490,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+
" cod_proyecto = "
+
proyecto
+
" "
+
valid
;
System
.
out
.
println
(
"LISTADO TIPO USUARIO ---> "
+
query
);
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
while
(
rs
.
next
())
{
...
...
@@ -519,7 +519,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" select count(*) as cant from usuario_detalle "
+
" where cod_usuario = "
+
codigo
+
" "
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -544,7 +544,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" select count(*) as cant from usuario "
+
" where upper(usu) = upper('"
+
nombre
+
"')"
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
base
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
base
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -569,7 +569,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try
{
query
=
" select count(*) as cant from auditoria "
+
" where cod_usuario_detalle = "
+
codigo
+
""
;
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
GeneralVariables
.
nameDB
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
GeneralVariables
.
nameDB
);
pst
=
con
.
prepareStatement
(
query
);
rs
=
pst
.
executeQuery
();
rs
.
next
();
...
...
@@ -603,7 +603,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
condicion
=
" where a.est = 1"
;
}
}
con
=
SqlServer
DAOFactory
.
getConnectionSQL
(
GeneralVariables
.
nameDB
);
con
=
MySQL
DAOFactory
.
getConnectionSQL
(
GeneralVariables
.
nameDB
);
sql
=
" SELECT a.cod_usuario, a.cod_trabajador, a.usu, a.est FROM usuario as a"
+
condicion
;
pst
=
con
.
prepareStatement
(
sql
);
rSet
=
pst
.
executeQuery
();
...
...
src/main/java/com/mycompany/moduloseguridad/services/MenuService.java
View file @
72fb43bf
...
...
@@ -16,13 +16,13 @@ import org.json.JSONObject;
*/
public
class
MenuService
{
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQLSERVER
);
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
MenuDAO
dao
=
fabrica
.
getMenuDAO
();
public
JSONArray
listarProyecto
()
{
public
JSONArray
listarProyecto
(
int
estado
)
{
JSONArray
obj
=
null
;
try
{
obj
=
dao
.
listarProyecto
();
obj
=
dao
.
listarProyecto
(
estado
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/java/com/mycompany/moduloseguridad/services/ProyectoService.java
View file @
72fb43bf
...
...
@@ -16,7 +16,7 @@ import org.json.JSONObject;
*/
public
class
ProyectoService
{
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQLSERVER
);
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
ProyectoDAO
dao
=
fabrica
.
getProyectoDAO
();
public
JSONObject
listarProyecto
(
JSONObject
filtro
,
int
vstart
,
int
vlength
,
String
draw
)
{
...
...
src/main/java/com/mycompany/moduloseguridad/services/TipoUsuarioService.java
View file @
72fb43bf
...
...
@@ -15,7 +15,7 @@ import org.json.JSONObject;
*/
public
class
TipoUsuarioService
{
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQLSERVER
);
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
TipoUsuarioDAO
dao
=
fabrica
.
getTipoUsuario
();
public
JSONObject
listarProyectos
()
{
...
...
@@ -23,7 +23,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
listarProyectos
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -33,7 +33,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
listarTiposUsuarios
(
codigoProyecto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -43,7 +43,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
asignarAcciones
(
datos
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -53,7 +53,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
listarAcciones
(
datos
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -63,7 +63,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
listarCboAcciones
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -73,7 +73,7 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
activarDesactivarAccion
(
datos
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -83,17 +83,17 @@ public class TipoUsuarioService {
try
{
obj
=
dao
.
activarDesactivarTipoUsuario
(
datos
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
public
JSONObject
listadoPrincipal
(
String
filtro
,
int
filtrado
,
int
proyecto
,
int
vstart
,
int
vlength
,
String
draw
)
{
public
JSONObject
listadoPrincipal
(
String
filtro
,
int
filtrado
,
int
proyecto
,
int
vstart
,
int
vlength
,
String
draw
,
int
estado
)
{
JSONObject
obj
=
null
;
try
{
obj
=
dao
.
listadoPrincipal
(
filtro
,
filtrado
,
proyecto
,
vstart
,
vlength
,
draw
);
obj
=
dao
.
listadoPrincipal
(
filtro
,
filtrado
,
proyecto
,
vstart
,
vlength
,
draw
,
estado
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
obj
;
}
...
...
@@ -103,7 +103,7 @@ public class TipoUsuarioService {
try
{
rs
=
dao
.
desactivarTipoUsuario
(
codigo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
rs
;
}
...
...
@@ -113,7 +113,7 @@ public class TipoUsuarioService {
try
{
rs
=
dao
.
activarTipoUsuario
(
codigo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
rs
;
}
...
...
@@ -123,7 +123,7 @@ public class TipoUsuarioService {
try
{
rs
=
dao
.
editarTipoUsuario
(
codigo
,
nombre
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
rs
;
}
...
...
@@ -133,7 +133,7 @@ public class TipoUsuarioService {
try
{
rs
=
dao
.
crearTipoUsuario
(
nombre
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
rs
;
}
...
...
@@ -143,7 +143,7 @@ public class TipoUsuarioService {
try
{
cant
=
dao
.
validarTipoUsuario
(
codigo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
cant
;
}
...
...
@@ -153,7 +153,7 @@ public class TipoUsuarioService {
try
{
cant
=
dao
.
validarNombreTipoUsuario
(
nombreInicial
,
nombreIngreso
,
tipo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
System
.
out
.
println
(
"Error en listado principal service"
+
e
.
getMessage
()
);
}
return
cant
;
}
...
...
src/main/java/com/mycompany/moduloseguridad/services/UsuarioService.java
View file @
72fb43bf
...
...
@@ -16,7 +16,7 @@ import org.json.JSONObject;
*/
public
class
UsuarioService
{
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQLSERVER
);
DAOFactory
fabrica
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
UsuarioDAO
dao
=
fabrica
.
getUsuarioDAO
();
public
JSONArray
listarUsuario
(
JSONObject
datos
,
int
vstart
,
int
vlength
,
int
draw
)
{
...
...
src/main/java/com/mycompany/moduloseguridad/servlets/MantenimientoMenuServlet.java
View file @
72fb43bf
...
...
@@ -67,14 +67,16 @@ public class MantenimientoMenuServlet extends HttpServlet {
break
;
default
:
break
;
}
}
}
private
void
listarProyecto
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
response
.
setContentType
(
"application/json"
);
PrintWriter
out
=
response
.
getWriter
();
MenuService
srv
=
new
MenuService
();
JSONArray
rs
=
srv
.
listarProyecto
();
int
estado
=
Integer
.
parseInt
(
request
.
getParameter
(
"estado"
));
JSONArray
rs
=
srv
.
listarProyecto
(
estado
);
out
.
println
(
rs
);
}
...
...
@@ -104,6 +106,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
int
iModulo
=
0
;
JSONObject
obj1
=
new
JSONObject
();
JSONObject
objTitulo
=
(
JSONObject
)
listaTitulo
.
get
(
i
);
System
.
out
.
println
(
"objTitulo "
+
i
+
" : "
+
objTitulo
);
String
nombreTitulo
=
objTitulo
.
getString
(
"nombreTitulo"
);
int
codigoTitulo
=
objTitulo
.
getInt
(
"codigoTitulo"
);
int
configuracionTitulo
=
objTitulo
.
getInt
(
"configuracionTitulo"
);
...
...
@@ -126,7 +129,8 @@ public class MantenimientoMenuServlet extends HttpServlet {
int
iCategoria
=
0
;
JSONObject
obj2
=
new
JSONObject
();
JSONObject
objModulo
=
(
JSONObject
)
listaModulo
.
get
(
j
);
boolean
esVisible
=
objModulo
.
getBoolean
(
"esVisible"
);
System
.
out
.
println
(
"objModulo "
+
i
+
" - "
+
j
+
" : "
+
objModulo
);
boolean
esVisible
=
objModulo
.
getBoolean
(
"esVisible"
);
String
nombreModulo
=
objModulo
.
getString
(
"nombreModulo"
);
int
codigoModulo
=
objModulo
.
getInt
(
"codigoModulo"
);
int
configuracionModulo
=
objModulo
.
getInt
(
"configuracionModulo"
);
...
...
src/main/java/com/mycompany/moduloseguridad/servlets/TipoUsuarioServlet.java
View file @
72fb43bf
...
...
@@ -159,12 +159,13 @@ public class TipoUsuarioServlet extends HttpServlet {
String
filtro
=
request
.
getParameter
(
"filtro"
);
int
filtrado
=
Integer
.
parseInt
(
request
.
getParameter
(
"filtrado"
));
int
cboProyecto
=
Integer
.
parseInt
(
request
.
getParameter
(
"valorCboProyecto"
));
int
estado
=
Integer
.
parseInt
(
request
.
getParameter
(
"estado"
));
String
draw
=
request
.
getParameter
(
"draw"
);
int
vstart
=
Integer
.
parseInt
(
request
.
getParameter
(
"start"
));
int
vlength
=
Integer
.
parseInt
(
request
.
getParameter
(
"length"
));
JSONObject
json
=
service
.
listadoPrincipal
(
filtro
,
filtrado
,
cboProyecto
,
vstart
,
vlength
,
draw
);
JSONObject
json
=
service
.
listadoPrincipal
(
filtro
,
filtrado
,
cboProyecto
,
vstart
,
vlength
,
draw
,
estado
);
out
.
println
(
json
);
}
...
...
src/main/java/com/mycompany/moduloseguridad/servlets/UsuarioServlet.java
View file @
72fb43bf
...
...
@@ -124,7 +124,7 @@ public class UsuarioServlet extends HttpServlet {
JSONObject
obj
=
json
.
getJSONObject
(
i
);
String
codigoTrabajador
=
obj
.
getString
(
"codigoTrabajador"
);
JSONObject
prs
=
listarPersonalPorCodigo
(
codigoTrabajador
);
if
(!
prs
.
isEmpty
()){
objeto
.
put
(
"codigoUsuario"
,
obj
.
getInt
(
"codigoUsuario"
));
objeto
.
put
(
"numeral"
,
obj
.
getInt
(
"numeral"
));
objeto
.
put
(
"usuario"
,
obj
.
getString
(
"usuario"
));
...
...
@@ -133,8 +133,8 @@ public class UsuarioServlet extends HttpServlet {
objeto
.
put
(
"nombreCargo"
,
prs
.
getString
(
"nom_car"
));
objeto
.
put
(
"nombreUsuario"
,
prs
.
getString
(
"nom_per"
)
+
" "
+
prs
.
getString
(
"ape_pat_per"
)
+
" "
+
prs
.
getString
(
"ape_mat_per"
));
objeto
.
put
(
"nombreSede"
,
prs
.
getString
(
"nom_sed"
));
lista
.
put
(
objeto
);
}
}
int
cantidad
=
srv
.
cantidadRegistros
(
filtro
);
retorno
.
put
(
"data"
,
lista
);
...
...
@@ -212,7 +212,7 @@ public class UsuarioServlet extends HttpServlet {
PrintWriter
out
=
response
.
getWriter
();
String
tipoDocumento
=
request
.
getParameter
(
"tipoDocumento"
);
String
numeroDocumento
=
request
.
getParameter
(
"numeroDocumento"
);
JSONObject
rs
=
listarPersonalPorTipoDocNumDoc
(
tipoDocumento
,
numeroDocumento
,
"1"
);
JSONObject
rs
=
listarPersonalPorTipoDocNumDoc
(
tipoDocumento
,
numeroDocumento
);
out
.
println
(
rs
);
}
...
...
@@ -338,12 +338,12 @@ public class UsuarioServlet extends HttpServlet {
out
.
println
(
rs
);
}
private
JSONObject
listarPersonalPorTipoDocNumDoc
(
java
.
lang
.
String
tipoDocumento
,
java
.
lang
.
String
numeroDocumento
,
java
.
lang
.
String
estado
)
throws
IOException
{
private
JSONObject
listarPersonalPorTipoDocNumDoc
(
String
tipoDocumento
,
String
numeroDocumento
)
throws
IOException
{
JSONObject
respuesta
=
null
;
JSONObject
obj
=
new
JSONObject
()
.
put
(
"tipoDocumento"
,
tipoDocumento
)
.
put
(
"numeroDocumento"
,
numeroDocumento
)
.
put
(
"estado"
,
estado
);
.
put
(
"estado"
,
"1"
);
HttpRequest
httpRequest
=
new
HttpRequest
();
String
r
=
httpRequest
.
getRespuesta
(
RequestPath
.
listarPersonalPorTipoDocNumDoc
,
HttpRequest
.
POST
,
obj
,
""
);
//Respuesta del server
respuesta
=
new
JSONObject
(
r
);
...
...
@@ -376,28 +376,30 @@ public class UsuarioServlet extends HttpServlet {
JSONObject
obj
=
lista
.
getJSONObject
(
i
);
String
codigoTrabajador
=
obj
.
getString
(
"codigoTrabajador"
);
JSONObject
prs
=
listarPersonalPorCodigo
(
codigoTrabajador
);
String
nombreCompleto
=
prs
.
getString
(
"nomPer"
)
+
" "
+
prs
.
getString
(
"apePatPer"
)
+
" "
+
prs
.
getString
(
"apeMatPer"
);
String
cargo
=
prs
.
getString
(
"nomCar"
);
if
(
tipo
==
4
&&
(
nombreCompleto
.
toUpperCase
()).
contains
(
busqueda
.
toUpperCase
()))
{
_final
.
put
(
"codigoUsuario"
,
obj
.
getInt
(
"codigoUsuario"
));
_final
.
put
(
"numeral"
,
obj
.
getInt
(
"numeral"
));
_final
.
put
(
"usuario"
,
obj
.
getString
(
"usuario"
));
_final
.
put
(
"estadoUsuario"
,
obj
.
getInt
(
"estadoUsuario"
));
_final
.
put
(
"nombreArea"
,
prs
.
getString
(
"nomAre"
));
_final
.
put
(
"nombreCargo"
,
prs
.
getString
(
"nomCar"
));
_final
.
put
(
"nombreUsuario"
,
prs
.
getString
(
"nomPer"
)
+
" "
+
prs
.
getString
(
"apePatPer"
)
+
" "
+
prs
.
getString
(
"apeMatPer"
));
_final
.
put
(
"nombreSede"
,
prs
.
getString
(
"nomSed"
));
listaFinal
.
put
(
_final
);
}
else
if
(
tipo
==
5
&&
(
cargo
.
toUpperCase
()).
equals
(
busqueda
.
toUpperCase
()))
{
_final
.
put
(
"codigoUsuario"
,
obj
.
getInt
(
"codigoUsuario"
));
_final
.
put
(
"numeral"
,
obj
.
getInt
(
"numeral"
));
_final
.
put
(
"usuario"
,
obj
.
getString
(
"usuario"
));
_final
.
put
(
"estadoUsuario"
,
obj
.
getInt
(
"estadoUsuario"
));
_final
.
put
(
"nombreArea"
,
prs
.
getString
(
"nomAre"
));
_final
.
put
(
"nombreCargo"
,
prs
.
getString
(
"nomCar"
));
_final
.
put
(
"nombreUsuario"
,
prs
.
getString
(
"nomPer"
)
+
" "
+
prs
.
getString
(
"apePatPer"
)
+
" "
+
prs
.
getString
(
"apeMatPer"
));
_final
.
put
(
"nombreSede"
,
prs
.
getString
(
"nomSed"
));
listaFinal
.
put
(
_final
);
if
(!
prs
.
isEmpty
())
{
String
nombreCompleto
=
prs
.
getString
(
"nom_per"
)
+
" "
+
prs
.
getString
(
"ape_pat_per"
)
+
" "
+
prs
.
getString
(
"ape_mat_per"
);
String
cargo
=
prs
.
getString
(
"nom_car"
);
if
(
tipo
==
4
&&
(
nombreCompleto
.
toUpperCase
()).
contains
(
busqueda
.
toUpperCase
()))
{
_final
.
put
(
"codigoUsuario"
,
obj
.
getInt
(
"codigoUsuario"
));
_final
.
put
(
"numeral"
,
obj
.
getInt
(
"numeral"
));
_final
.
put
(
"usuario"
,
obj
.
getString
(
"usuario"
));
_final
.
put
(
"estadoUsuario"
,
obj
.
getInt
(
"estadoUsuario"
));
_final
.
put
(
"nombreArea"
,
prs
.
getString
(
"nom_are"
));
_final
.
put
(
"nombreCargo"
,
prs
.
getString
(
"nom_car"
));
_final
.
put
(
"nombreUsuario"
,
prs
.
getString
(
"nom_per"
)
+
" "
+
prs
.
getString
(
"ape_pat_per"
)
+
" "
+
prs
.
getString
(
"ape_mat_per"
));
_final
.
put
(
"nombreSede"
,
prs
.
getString
(
"nom_sed"
));
listaFinal
.
put
(
_final
);
}
else
if
(
tipo
==
5
&&
(
cargo
).
equalsIgnoreCase
(
busqueda
))
{
_final
.
put
(
"codigoUsuario"
,
obj
.
getInt
(
"codigoUsuario"
));
_final
.
put
(
"numeral"
,
obj
.
getInt
(
"numeral"
));
_final
.
put
(
"usuario"
,
obj
.
getString
(
"usuario"
));
_final
.
put
(
"estadoUsuario"
,
obj
.
getInt
(
"estadoUsuario"
));
_final
.
put
(
"nombreArea"
,
prs
.
getString
(
"nom_are"
));
_final
.
put
(
"nombreCargo"
,
prs
.
getString
(
"nom_car"
));
_final
.
put
(
"nombreUsuario"
,
prs
.
getString
(
"nom_per"
)
+
" "
+
prs
.
getString
(
"ape_pat_per"
)
+
" "
+
prs
.
getString
(
"ape_mat_per"
));
_final
.
put
(
"nombreSede"
,
prs
.
getString
(
"nom_sed"
));
listaFinal
.
put
(
_final
);
}
}
}
out
.
println
(
listaFinal
);
...
...
@@ -413,9 +415,11 @@ public class UsuarioServlet extends HttpServlet {
for
(
int
i
=
0
;
i
<
lista
.
length
();
i
++)
{
JSONObject
obj
=
lista
.
getJSONObject
(
i
);
JSONObject
prs
=
listarPersonalPorCodigo
(
obj
.
getString
(
"codigoTrabajador"
));
if
(!
prs
.
isNull
(
"nom_car"
)){
if
(!
cargos
.
contains
(
prs
.
getString
(
"nom_car"
)))
{
cargos
.
add
(
prs
.
getString
(
"nom_car"
));
}
}
}
out
.
print
(
new
JSONArray
(
cargos
));
}
...
...
src/main/java/com/mycompany/moduloseguridad/utilities/DAOHelper.java
View file @
72fb43bf
...
...
@@ -82,13 +82,14 @@ public final class DAOHelper {
JSONArray
result
=
new
JSONArray
();
JSONObject
outputParamTypes
=
new
JSONObject
();
JSONArray
params
=
null
;
JSONArray
outputParams
=
new
JSONArray
();
try
(
CallableStatement
cs
=
cn
.
prepareCall
(
query
);){
if
(
parameters
!=
null
&&
parameters
.
length
>
0
)
{
params
=
parameters
[
0
];
int
index
=
1
;
for
(
Object
parameter
:
params
)
{
if
(
parameter
instanceof
Class
)
{
outputParams
.
put
(
index
);
registerOutputParameter
(
cs
,
index
++,
parameter
,
outputParamTypes
);
}
else
{
setPreparedStatement
(
cs
,
index
++,
parameter
);
...
...
@@ -96,7 +97,7 @@ public final class DAOHelper {
}
}
boolean
isResultSet
=
cs
.
execute
();
System
.
out
.
println
(
"CONSULTA\n"
+
cs
.
toString
());
if
(
isResultSet
)
{
try
(
final
ResultSet
rs
=
cs
.
getResultSet
()){
ResultSetMetaData
rm
=
rs
.
getMetaData
();
...
...
@@ -116,18 +117,21 @@ public final class DAOHelper {
result
.
put
(
obj
);
}
if
(
outputParamTypes
.
length
()
>
0
)
{
if
(
!
outputParamTypes
.
isEmpty
()
)
{
clearJSONArray
(
params
);
}
for
(
String
key
:
outputParamTypes
.
keySet
())
{
int
indexOutputParams
=
Integer
.
parseInt
(
key
);
int
type
=
outputParamTypes
.
getInt
(
key
);
getOutputParameter
(
cs
,
indexOutputParams
,
type
,
params
);
}
System
.
out
.
println
(
"CONSULTA\n"
+
cs
.
toString
());
JSONArray
finalParams
=
params
;
outputParams
.
forEach
((
index
)
->
{
int
type
=
outputParamTypes
.
getInt
(
String
.
valueOf
(
index
));
try
{
getOutputParameter
(
cs
,
(
Integer
)
index
,
type
,
finalParams
);
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
});
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
System
.
out
.
println
(
""
+
ex
.
getMessage
());
System
.
out
.
println
(
ex
.
getMessage
());
}
return
result
;
}
...
...
@@ -337,12 +341,9 @@ public final class DAOHelper {
private
static
void
getOutputParameter
(
CallableStatement
cs
,
int
cont
,
int
tipo
,
JSONArray
parameter
)
throws
SQLException
{
switch
(
tipo
)
{
case
Types
.
INTEGER
:
case
Types
.
NUMERIC
:
parameter
.
put
(
cs
.
getInt
(
cont
));
break
;
case
Types
.
VARCHAR
:
case
Types
.
CHAR
:
parameter
.
put
(
cs
.
getString
(
cont
));
break
;
case
Types
.
BOOLEAN
:
parameter
.
put
(
cs
.
getBoolean
(
cont
));
break
;
...
...
src/main/java/com/mycompany/moduloseguridad/utilities/HttpRequest.java
View file @
72fb43bf
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com
.
mycompany
.
moduloseguridad
.
utilities
;
import
java.io.BufferedReader
;
...
...
@@ -12,12 +7,10 @@ import java.io.OutputStream;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
org.json.JSONObject
;
/**
*
* @author Percy Oliver Quispe Huarcaya
*/
public
final
class
HttpRequest
{
public
static
final
String
POST
=
"POST"
;
...
...
@@ -47,19 +40,19 @@ public final class HttpRequest {
}
public
String
getRespuesta
(
String
path
,
String
requestMethod
,
JSONObject
obj
,
String
authorization
)
throws
IOException
{
String
respuesta
=
""
;
String
Builder
respuesta
=
new
StringBuilder
()
;
URL
url
=
getConn
(
path
);
HttpURLConnection
conn
=
setDefaultValues
(
url
,
requestMethod
,
authorization
);
OutputStream
os
=
conn
.
getOutputStream
();
os
.
write
(
obj
.
toString
().
getBytes
(
"UTF-8"
));
os
.
write
(
obj
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
));
os
.
close
();
BufferedReader
rd
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"UTF-8"
));
BufferedReader
rd
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
StandardCharsets
.
UTF_8
));
String
linea
;
while
((
linea
=
rd
.
readLine
())
!=
null
)
{
respuesta
+=
linea
;
respuesta
.
append
(
linea
)
;
}
rd
.
close
();
conn
.
disconnect
();
return
respuesta
;
return
respuesta
.
toString
()
;
}
}
\ No newline at end of file
src/main/webapp/css/general.css
View file @
72fb43bf
...
...
@@ -65,7 +65,7 @@ span .error{
}
.password
{
font-family
:
password
;
font-family
:
password
,
serif
;
font-size
:
16px
;
}
...
...
@@ -150,13 +150,13 @@ label {
}
.row
{
padding-left
:
0
px
;
padding-right
:
0
px
;
padding-left
:
0
;
padding-right
:
0
;
}
.datatable-scroll
{
border-top
:
1px
solid
#bbbbbb9
c
;
border-bottom
:
0
px
;
border-bottom
:
0
;
}
.panel-heading
.visible-elements
{
...
...
@@ -170,7 +170,7 @@ label {
.dataTables_info
{
float
:
left
;
padding
:
13px
0
;
margin-bottom
:
0
px
;
margin-bottom
:
0
;
}
.tp-animation-button
{
...
...
@@ -269,7 +269,7 @@ a.disabled {
padding
:
8px
10px
;
background
:
white
;
border-top
:
1px
solid
#e7eaec
;
margin-left
:
0
px
;
margin-left
:
0
;
font-size
:
11px
;
text-align
:
center
;
}
...
...
@@ -290,10 +290,10 @@ a.disabled {
}
.panel
{
margin-bottom
:
0
px
!important
;
margin-bottom
:
0
!important
;
}
.row
{
margin-left
:
0
px
;
margin-left
:
0
;
}
table
.display
tbody
tr
:hover
td
{
...
...
@@ -301,15 +301,15 @@ table.display tbody tr:hover td {
}
.modulo
{
padding-left
:
120px
;
padding-left
:
5vw
;
}
.categoria
{
padding-left
:
240px
;
padding-left
:
10vw
;
}
.subcategoria
{
padding-left
:
360px
;
padding-left
:
15vw
;
}
.modal-header
[
class
*=
bg-
]
{
...
...
src/main/webapp/js/pages/MantenimientoMenu.js
View file @
72fb43bf
...
...
@@ -23,6 +23,9 @@
type
:
'POST'
,
url
:
"../servlet/MantenimientoMenuServlet?accion=listarProyecto"
,
dataType
:
'JSON'
,
data
:
{
estado
:
document
.
getElementById
(
"cbkEstado"
).
checked
?
1
:
0
},
success
:
function
(
result
)
{
var
print
=
" <option value=''>SELECCIONE PROYECTO</option> "
;
for
(
var
i
in
result
)
{
...
...
@@ -100,7 +103,6 @@
"bFilter"
:
false
,
"serverSide"
:
true
,
"processing"
:
true
,
"aaSorting"
:
[],
"ordering"
:
false
,
"bLengthChange"
:
false
,
"bInfo"
:
false
,
...
...
@@ -112,11 +114,11 @@
],
"iDisplayLength"
:
-
1
,
"columnDefs"
:
[
{
targets
:
0
,
orderable
:
false
,
width
:
"
4
5%"
},
{
targets
:
1
,
orderable
:
false
,
width
:
"5%"
,
className
:
"text-center"
},
{
targets
:
2
,
orderable
:
false
,
width
:
"7%"
,
className
:
"text-center"
},
{
targets
:
3
,
orderable
:
false
,
width
:
"
10%"
},
{
targets
:
4
,
orderable
:
false
,
width
:
"15%"
,
className
:
"text-center"
}
{
targets
:
0
,
orderable
:
false
,
width
:
"
6
5%"
},
{
targets
:
1
,
orderable
:
false
,
width
:
"
7,
5%"
,
className
:
"text-center"
},
{
targets
:
2
,
orderable
:
false
,
width
:
"7
.5
%"
,
className
:
"text-center"
},
{
targets
:
3
,
orderable
:
false
,
width
:
"
5%"
,
},
{
targets
:
4
,
orderable
:
false
,
width
:
"15%"
,
className
:
"text-center"
}
],
"columns"
:
[
{
"data"
:
"jerarquia"
,
...
...
@@ -181,7 +183,11 @@
}
],
initComplete
:
function
(
nopor
,
data
)
{
$
(
"#tblMenu"
).
addClass
(
"table table-responsive table-striped table-hover table-bordered"
);
}
},
rowCallback
:
function
(
row
,
data
)
{
if
(
data
.
esVisible
===
false
){
$
(
row
).
css
(
"background-color"
,
"#ffeaea"
);
}
},
});
}
else
{
table
=
$
(
"#tblMenu"
).
DataTable
();
...
...
@@ -291,10 +297,13 @@
Es visible:
</label>
<input id="chkVisible" name="chkEsVisible" class="icp-opts form-control switch" type="checkbox"/>
</div>
<div class='col-md-12 hide' id="formHide">
</div>
<div class="frm col-md-12" id ="formPermisos">
<span>Permisos</span>
<table id="tablaPermisosVista">
</table>
</div>
</div>
<div class="col-md-12 pull-right form-group">
<div class="text-right" style="font-size: small">
...
...
@@ -354,7 +363,7 @@
validarDependenciaEditar
(
data
);
}
if
(
visible
){
if
(
!
visible
){
$
(
"#chkVisible"
).
prop
(
"checked"
,
true
);
}
else
{
$
(
"#chkVisible"
).
removeAttr
(
"checked"
);
...
...
@@ -443,7 +452,7 @@
"url"
:
txturl
,
"nombre"
:
$
(
'#editarNombre'
).
val
(),
"icono"
:
$
(
'#editarIcono'
).
val
(),
"esVisible"
:
$
(
"#chkVisible"
).
is
(
':checked'
)
"esVisible"
:
!
$
(
"#chkVisible"
).
is
(
':checked'
)
};
$
.
ajax
({
type
:
'POST'
,
...
...
@@ -1458,6 +1467,4 @@
});
}
};
};
\ No newline at end of file
src/main/webapp/js/pages/tipoUsuario.js
View file @
72fb43bf
...
...
@@ -85,7 +85,7 @@
"bLengthChange"
:
false
,
"bInfo"
:
true
,
"paging"
:
true
,
"iDisplayLength"
:
5
,
"iDisplayLength"
:
10
,
"columnDefs"
:
[
{
targets
:
0
,
orderable
:
false
,
width
:
"7%"
,
className
:
"text-center"
},
{
targets
:
1
,
orderable
:
false
,
width
:
"30%"
,
className
:
"text-left"
},
...
...
@@ -248,7 +248,8 @@
var
json
=
{
"filtro"
:
filtro
,
"filtrado"
:
tipoFiltrado
,
"valorCboProyecto"
:
cboProyecto
"valorCboProyecto"
:
cboProyecto
,
"estado"
:
document
.
getElementById
(
'cbkEstado'
).
checked
?
0
:
1
};
tabla
=
$
(
"#tblTipoUsuario"
).
DataTable
({
...
...
@@ -1040,4 +1041,4 @@
});
}
});
}
}
\ No newline at end of file
src/main/webapp/vistas/mantenimientoMenu.jsp
View file @
72fb43bf
...
...
@@ -25,7 +25,7 @@
cursor
:
pointer
;
background-color
:
green
;
border-radius
:
25px
;
transition
:
all
1
s
;
transition
:
all
0.5
s
;
}
.switch
:before
{
content
:
""
;
...
...
@@ -40,11 +40,11 @@
transition-delay
:
.1s
;
box-shadow
:
inset
2px
0px
4px
rgba
(
0
,
0
,
0
,
.5
),
-2px
0px
2px
rgba
(
0
,
0
,
0
,
.5
);
animation
:
off
1
s
forwards
;
animation
:
off
0.5
s
forwards
;
}
.switch
:checked
{
background-color
:
white
;
transition
:
all
1
s
;
background-color
:
#e70000
;
transition
:
all
0.5
s
;
}
.switch
:checked:before
{
transition
:
all
.5s
;
...
...
@@ -54,7 +54,7 @@
2px
0px
2px
rgba
(
0
,
0
,
0
,
.5
);
transition-delay
:
.1s
;
right
:
43px
;
animation
:
on
1
s
forwards
;
animation
:
on
0.5
s
forwards
;
}
@keyframes
on
{
...
...
@@ -84,9 +84,12 @@
<div
class=
"panel-heading"
style=
"padding: 8px 15px"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"icon icon-search4"
></i>
Búsqueda de Menús
</h6>
<div
class=
"heading-elements"
>
<ul
class=
"icons-list"
>
<li><a
data-action=
"collapse"
></a></li>
</ul>
<div
class=
"checkbox checkbox-switchery"
>
<label>
<span
id=
"txtEstado"
></span>
<input
type=
"checkbox"
id=
"cbkEstado"
>
</label>
</div>
</div>
</div>
<div
class=
"panel-body"
id=
"panelSearch"
>
...
...
@@ -95,7 +98,7 @@
<div
class=
'col-md-6'
>
<div
class=
"form-group"
>
<label>
Proyecto:
</label>
<span
id=
"spanAterik"
class=
"asterisk"
>
(*)
</span>
<span
class=
"asterisk"
>
(*)
</span>
<select
id=
"cboProyecto"
class=
"form-control"
>
<option
value=
""
>
SELECCIONE PROYECTO
</option>
</select>
...
...
@@ -104,7 +107,7 @@
<div
class=
'col-md-6'
>
<div
class=
"form-group"
>
<label>
Tipo de Usuario:
</label>
<span
id=
"spanAterik"
class=
"asterisk"
>
(*)
</span>
<span
class=
"asterisk"
>
(*)
</span>
<select
id=
"cboTipoUsuario"
class=
"form-control"
>
<option
value=
""
>
SELECCIONE TIPO DE USUARIO
</option>
</select>
...
...
@@ -113,7 +116,15 @@
</div>
</form>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
style=
"display: flex; justify-content: space-between"
>
<div
class=
"form-group"
>
<div
class=
"text-left"
style=
"display: flex; justify-content: center; align-items: center; gap: 1rem;"
>
<div>
No visibles :
</div>
<div
style=
"background: #ffeaea; width: 1rem; height: 1rem; border: 1px solid black; display: block"
></div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"text-right"
>
<span
class=
"text-danger"
>
(*)
</span>
Campo obligatorio
...
...
@@ -133,7 +144,7 @@
</div>
</div>
<div
class=
"col-sm-12 col-md-12 col-lg-1
0
col-centered"
>
<div
class=
"col-sm-12 col-md-12 col-lg-1
1
col-centered"
>
<div
class=
"panel panel-primary card-3 hide"
style=
"margin-top: 30px"
id=
"panelTabla"
>
<div
class=
"panel-heading"
style=
"padding: 8px 15px"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"fa fa-list"
></i>
Listado del Menu
</h6>
...
...
@@ -157,10 +168,23 @@
</div>
</div>
</div>
<!-- / content -->
<
%@
include
file=
"templates/footer-body.jsp"
%
>
<!--js-->
<script
src=
"../js/pages/MantenimientoMenu.js"
type=
"text/javascript"
></script>
<!--js-->
<script>
let
switchery
=
new
Switchery
(
document
.
querySelector
(
'#cbkEstado'
),
{
color
:
'red'
,
secondaryColor
:
'green'
})
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO ACTIVOS'
;
document
.
querySelector
(
'#cbkEstado'
).
checked
=
false
;
document
.
querySelector
(
'#cbkEstado'
).
onchange
=
function
()
{
if
(
document
.
querySelector
(
'#cbkEstado'
).
checked
)
{
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO INACTIVOS'
;
}
else
{
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO ACTIVOS'
;
}
listarProyectos
();
document
.
querySelector
(
'#btnLimpiar'
).
click
();
};
</script>
</body>
</html>
</html>
\ No newline at end of file
src/main/webapp/vistas/mantenimientoTipoUsuario.jsp
View file @
72fb43bf
...
...
@@ -25,9 +25,12 @@
<div
class=
"panel-heading"
style=
"padding: 8px 15px"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"icon icon-search4"
></i>
Búsqueda de Tipos de Usuario
</h6>
<div
class=
"heading-elements"
>
<ul
class=
"icons-list"
>
<li><a
data-action=
"collapse"
></a></li>
</ul>
<div
class=
"checkbox checkbox-switchery"
>
<label>
<span
id=
"txtEstado"
></span>
<input
type=
"checkbox"
id=
"cbkEstado"
>
</label>
</div>
</div>
</div>
<div
class=
"panel-body"
id=
"panelSearch"
>
...
...
@@ -108,6 +111,19 @@
<!--js-->
<script
src=
"../js/lib/jquery-editable-select.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/pages/tipoUsuario.js"
type=
"text/javascript"
></script>
<script>
let
switchery
=
new
Switchery
(
document
.
querySelector
(
'#cbkEstado'
),
{
color
:
'red'
,
secondaryColor
:
'green'
})
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO ACTIVOS'
;
document
.
querySelector
(
'#cbkEstado'
).
checked
=
false
;
document
.
querySelector
(
'#cbkEstado'
).
onchange
=
function
()
{
if
(
document
.
querySelector
(
'#cbkEstado'
).
checked
)
{
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO INACTIVOS'
;
}
else
{
document
.
querySelector
(
'#txtEstado'
).
innerText
=
'MOSTRANDO ACTIVOS'
;
}
document
.
querySelector
(
'#btnBuscar'
).
click
();
};
</script>
<!--js-->
</body>
</html>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment