Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
impnhyw
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
wangjinjing
impnhyw
Commits
855f0cd6
Commit
855f0cd6
authored
Nov 08, 2019
by
wangjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src 文件更新
parent
3857f13a
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
572 additions
and
209 deletions
+572
-209
src/cn/bsystem/Test/model/User.java
src/cn/bsystem/Test/model/User.java
+22
-0
src/cn/bsystem/Test/model/User.xml
src/cn/bsystem/Test/model/User.xml
+11
-0
src/cn/bsystem/Test/service/ILoginFrameService.java
src/cn/bsystem/Test/service/ILoginFrameService.java
+9
-0
src/cn/bsystem/ptlogin/dao/LoginDAO.java
src/cn/bsystem/ptlogin/dao/LoginDAO.java
+1
-1
src/cn/bsystem/ptlogin/service/LoginService.java
src/cn/bsystem/ptlogin/service/LoginService.java
+4
-0
src/cn/bsystem/ptmenu/util/MenuXml.java
src/cn/bsystem/ptmenu/util/MenuXml.java
+3
-3
src/cn/datasource/DS.java
src/cn/datasource/DS.java
+10
-0
src/cn/datasource/DatabaseContextHolder.java
src/cn/datasource/DatabaseContextHolder.java
+34
-0
src/cn/datasource/DynamicDataSource.java
src/cn/datasource/DynamicDataSource.java
+11
-0
src/cn/datasource/DynamicDataSourceAspect.java
src/cn/datasource/DynamicDataSourceAspect.java
+54
-0
src/cn/nhyw/xxpzgl/service/NhywxmglwdxxService.java
src/cn/nhyw/xxpzgl/service/NhywxmglwdxxService.java
+3
-1
src/cn/yw/alarm/action/YwalarmeventinfoAction.java
src/cn/yw/alarm/action/YwalarmeventinfoAction.java
+35
-5
src/cn/yw/nhyw/nhywjtxhdgl/action/NhywjtxhdglAction.java
src/cn/yw/nhyw/nhywjtxhdgl/action/NhywjtxhdglAction.java
+262
-196
src/cn/yw/nhyw/nhywjtxhdgl/dao/NhywjtxhdglDao.java
src/cn/yw/nhyw/nhywjtxhdgl/dao/NhywjtxhdglDao.java
+19
-0
src/cn/yw/nhyw/nhywjtxhdgl/service/NhywjtxhdglService.java
src/cn/yw/nhyw/nhywjtxhdgl/service/NhywjtxhdglService.java
+31
-1
src/cn/yw/xhd/action/XHDAction.java
src/cn/yw/xhd/action/XHDAction.java
+4
-0
src/rebel.xml
src/rebel.xml
+21
-0
src/sqlmap/Nhywjtxhdgl.xml
src/sqlmap/Nhywjtxhdgl.xml
+38
-2
No files found.
src/cn/bsystem/Test/model/User.java
0 → 100644
View file @
855f0cd6
package
cn
.
bsystem
.
Test
.
model
;
public
class
User
{
private
String
id
;
private
String
name
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
src/cn/bsystem/Test/model/User.xml
0 → 100644
View file @
855f0cd6
<?xml version="1.0" encoding="gbk" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap
namespace=
""
>
<select
id=
"getUserlist"
resultClass=
"java.util.HashMap"
>
select * from user
</select>
</sqlMap>
\ No newline at end of file
src/cn/bsystem/Test/service/ILoginFrameService.java
0 → 100644
View file @
855f0cd6
package
cn
.
bsystem
.
Test
.
service
;
import
cn.bsystem.Test.model.User
;
import
java.util.List
;
public
interface
ILoginFrameService
{
public
List
<
User
>
getUserlist
();
}
src/cn/bsystem/ptlogin/dao/LoginDAO.java
View file @
855f0cd6
...
...
@@ -18,7 +18,7 @@ import com.ibatis.sqlmap.client.SqlMapClient;
@Repository
(
"loginDao"
)
public
class
LoginDAO
extends
SqlMapClientDaoSupport
{
@Autowired
private
SqlMapClient
sqlMapClient
;
private
SqlMapClient
sqlMapClient
;
@PostConstruct
public
void
initSqlMapClient
(){
...
...
src/cn/bsystem/ptlogin/service/LoginService.java
View file @
855f0cd6
...
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
cn.datasource.DS
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -24,6 +25,7 @@ public class LoginService {
* 查询登录机构
* @throws SQLException
*/
public
List
selectUserRole
(
Map
map
)
throws
SQLException
{
return
dao
.
selectUserRole
(
map
);
}
...
...
@@ -31,6 +33,7 @@ public class LoginService {
* 查询登录用户
* @throws SQLException
*/
public
List
selectUser
(
Map
map
)
throws
SQLException
{
return
dao
.
selectUser
(
map
);
}
...
...
@@ -47,6 +50,7 @@ public class LoginService {
* 查询登录用户信息
* @throws SQLException
*/
public
PtyhBean
selectUserInfo
(
Map
map
)
throws
SQLException
{
PtyhBean
user
=
new
PtyhBean
();
user
=
dao
.
selectUserInfo
(
map
);
...
...
src/cn/bsystem/ptmenu/util/MenuXml.java
View file @
855f0cd6
...
...
@@ -108,9 +108,9 @@ public class MenuXml {
MenuNodeAddToParent
(
listThird
,
listSecond
);
MenuNodeAddToParent
(
listSecond
,
listFirst
);
//
System.out.println(listRight);
//
System.out.println(listFirst);
//
System.out.println(listSecond);
System
.
out
.
println
(
listRight
);
System
.
out
.
println
(
listFirst
);
System
.
out
.
println
(
listSecond
);
}
catch
(
DocumentException
e
)
{
e
.
printStackTrace
();
iLog
.
info
(
"解析菜单出错,配置文件格式不正确."
+
e
);
...
...
src/cn/datasource/DS.java
0 → 100644
View file @
855f0cd6
package
cn
.
datasource
;
import
java.lang.annotation.*
;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
})
@Documented
public
@interface
DS
{
String
value
()
default
"datasource1"
;
}
src/cn/datasource/DatabaseContextHolder.java
0 → 100644
View file @
855f0cd6
package
cn
.
datasource
;
public
class
DatabaseContextHolder
{
/**
* 默认数据源
*/
public
static
final
String
DEFAULT_DS
=
"datasource1"
;
private
static
final
ThreadLocal
<
String
>
contextHolder
=
new
ThreadLocal
<>();
// 设置数据源名
public
static
void
setDB
(
String
dbType
)
{
System
.
out
.
println
(
"切换到{"
+
dbType
+
"}数据源"
);
contextHolder
.
set
(
dbType
);
}
// 获取数据源名
public
static
String
getDB
()
{
if
(
contextHolder
.
get
()==
null
){
return
DEFAULT_DS
;
}
else
{
return
(
contextHolder
.
get
());
}
}
// 清除数据源名
public
static
void
clearDB
()
{
contextHolder
.
remove
();
}
}
\ No newline at end of file
src/cn/datasource/DynamicDataSource.java
0 → 100644
View file @
855f0cd6
package
cn
.
datasource
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
;
@Order
(
2
)
public
class
DynamicDataSource
extends
AbstractRoutingDataSource
{
@Override
protected
Object
determineCurrentLookupKey
()
{
return
DatabaseContextHolder
.
getDB
();
}
}
src/cn/datasource/DynamicDataSourceAspect.java
0 → 100644
View file @
855f0cd6
package
cn
.
datasource
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.After
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Method
;
@Aspect
@Order
(
1
)
public
class
DynamicDataSourceAspect
{
@After
(
"@annotation(DS)"
)
public
void
afterSwitchDS
(
JoinPoint
point
){
System
.
out
.
println
(
"清除当前数据源"
+
DatabaseContextHolder
.
getDB
());
DatabaseContextHolder
.
clearDB
();
}
//*/
//使用DS注解动态切换
@Before
(
"@annotation(DS)"
)
public
void
beforeSwitchDS
(
JoinPoint
point
){
//获得当前访问的class
Class
<?>
className
=
point
.
getTarget
().
getClass
();
//获得访问的方法名
String
methodName
=
point
.
getSignature
().
getName
();
//得到方法的参数的类型
Class
[]
argClass
=
((
MethodSignature
)
point
.
getSignature
()).
getParameterTypes
();
String
dataSource
=
DatabaseContextHolder
.
DEFAULT_DS
;
try
{
// 得到访问的方法对象
Method
method
=
className
.
getMethod
(
methodName
,
argClass
);
// 判断是否存在@DS注解
if
(
method
.
isAnnotationPresent
(
DS
.
class
))
{
DS
annotation
=
method
.
getAnnotation
(
DS
.
class
);
// 取出注解中的数据源名
dataSource
=
annotation
.
value
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// 切换数据源
DatabaseContextHolder
.
setDB
(
dataSource
);
}
}
src/cn/nhyw/xxpzgl/service/NhywxmglwdxxService.java
View file @
855f0cd6
...
...
@@ -4,7 +4,8 @@ package cn.nhyw.xxpzgl.service;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
cn.datasource.DS
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -96,6 +97,7 @@ public class NhywxmglwdxxService extends BaseService {
/**
* Nhywxmglwdxx 分页
*/
@DS
(
"datasource1"
)
public
Map
listNhywxmglwdxxByPage
(
Map
map
)
throws
SQLException
{
List
<
Map
>
list
=
nhywxmglwdxxDao
.
query_Nhywxmglwdxx
(
map
);
Integer
totalCount
=
nhywxmglwdxxDao
.
count_Nhywxmglwdxx
(
map
);
...
...
src/cn/yw/alarm/action/YwalarmeventinfoAction.java
View file @
855f0cd6
...
...
@@ -9,7 +9,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
jxl.write.DateTime
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -102,7 +103,7 @@ public class YwalarmeventinfoAction extends BaseAction{
/**
* 查询总数
*/
//
@OperateType(value = LogConstants.LOG_QUERY ,info ="count_Ywalarmeventinfo")
@OperateType
(
value
=
LogConstants
.
LOG_QUERY
,
info
=
"count_Ywalarmeventinfo"
)
public
void
count_Ywalarmeventinfo
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
...
...
@@ -116,7 +117,7 @@ public class YwalarmeventinfoAction extends BaseAction{
/**
* 饼图统计
*/
//
@OperateType(value = LogConstants.LOG_QUERY ,info ="statisticPieChart")
@OperateType
(
value
=
LogConstants
.
LOG_QUERY
,
info
=
"statisticPieChart"
)
public
void
statisticPieChart
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
...
...
@@ -130,7 +131,7 @@ public class YwalarmeventinfoAction extends BaseAction{
/**
* 折线统计
*/
//
@OperateType(value = LogConstants.LOG_QUERY ,info ="alarmStatisticsLine")
@OperateType
(
value
=
LogConstants
.
LOG_QUERY
,
info
=
"alarmStatisticsLine"
)
public
void
alarmStatisticsLine
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
...
...
@@ -253,6 +254,9 @@ public class YwalarmeventinfoAction extends BaseAction{
try
{
if
(
StringUtil
.
checkEmpty
(
map
.
get
(
"alarmeventid"
))){
map
.
put
(
"alarmeventid"
,
StringUtil
.
getUUID
());
String
username
=
((
PtyhBean
)
Struts2Utils
.
getSession
().
getAttribute
(
"userInfo"
)).
getYhzh
();
map
.
put
(
"createaccount"
,
username
);
map
.
put
(
"createtime"
,
DateUtil
.
currentDateTime
());
}
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
))){
Map
sMap
=
new
HashMap
();
...
...
@@ -570,5 +574,31 @@ public class YwalarmeventinfoAction extends BaseAction{
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 手动新增一条告警信息
*/
@OperateType
(
value
=
LogConstants
.
LOG_DELETE
,
info
=
"insertVideoTaskAlarmConfig"
)
public
void
insertVideoTaskAlarmConfig
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
map
.
put
(
"yhbh"
,
((
PtyhBean
)
Struts2Utils
.
getSession
().
getAttribute
(
"userInfo"
)).
getYhbh
());
Map
m
=
this
.
service
.
checkQx
(
map
);
String
sfgly
=
m
.
get
(
"sfgly"
)
+
""
;
//是否管理员
String
seealarmauthory
=
m
.
get
(
"seealarmauthory"
)
+
""
;
//查看告警权限
//判断是否管理员和是否查看告警权限,无权限直接返回
if
(
"1"
.
equals
(
sfgly
))
{
//若用户为管理员,不添加bmbh字段值,查询所有告警数据
}
else
if
(
"1"
.
equals
(
seealarmauthory
))
{
//若不为管理员,有查看告警权限,获取用户所在部门编号
String
bmbh
=
((
PtyhBean
)
Struts2Utils
.
getSession
().
getAttribute
(
"userInfo"
)).
getBmbh
();
map
.
put
(
"bmbh"
,
bmbh
);
}
else
{
//没有权限直接返回
Struts2Utils
.
renderJson
(
null
);
return
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"YwalarmeventinfoAction-count_HomepageFaultCount-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
}
src/cn/yw/nhyw/nhywjtxhdgl/action/NhywjtxhdglAction.java
View file @
855f0cd6
package
cn
.
yw
.
nhyw
.
nhywjtxhdgl
.
action
;
import
cn.yw.nhyw.nhywjtxhdgl.service.NhywjtxhdglService
;
import
cn.base.aspect.OperateType
;
import
cn.base.bean.BaseAction
;
import
cn.base.util.*
;
import
cn.yw.nhyw.nhywjtxhdgl.service.NhywjtxhdglService
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
cn.base.aspect.OperateType
;
import
cn.base.bean.BaseAction
;
import
cn.base.excel.ExcelCol
;
import
cn.base.excel.ExportEngine
;
import
cn.base.util.CommUtils
;
import
cn.base.util.Constants
;
import
cn.base.util.DateUtil
;
import
cn.base.util.LogConstants
;
import
cn.base.util.StringUtil
;
import
cn.base.util.Struts2Utils
;
import
cn.bsystem.ptuserrole.model.PtyhBean
;
@SuppressWarnings
({
"all"
})
@Component
(
"nhywjtxhdglAction"
)
public
class
NhywjtxhdglAction
extends
BaseAction
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
Logger
iLog
=
Logger
.
getLogger
(
NhywjtxhdglAction
.
class
);
@Autowired
private
NhywjtxhdglService
service
;
/**
* 分页
*/
@OperateType
(
value
=
LogConstants
.
LOG_QUERY
,
info
=
"listNhywjtxhdglByPage"
)
public
void
listNhywjtxhdglByPage
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
int
page
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"page"
));
int
rows
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"rows"
));
int
start
=
(
(
page
==
0
?
1
:
page
)
-
1
)
*
rows
;
map
.
put
(
"start"
,
start
);
map
.
put
(
"limit"
,
rows
);
Struts2Utils
.
renderJson
(
this
.
service
.
listNhywjtxhdglByPage
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-listNhywjtxhdglByPage-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 查询总数
*/
public
class
NhywjtxhdglAction
extends
BaseAction
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
Logger
iLog
=
Logger
.
getLogger
(
NhywjtxhdglAction
.
class
);
@Autowired
private
NhywjtxhdglService
service
;
/**
* 分页
*/
@OperateType
(
value
=
LogConstants
.
LOG_QUERY
,
info
=
"listNhywjtxhdglByPage"
)
public
void
listNhywjtxhdglByPage
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
int
page
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"page"
));
int
rows
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"rows"
));
int
start
=
((
page
==
0
?
1
:
page
)
-
1
)
*
rows
;
map
.
put
(
"start"
,
start
);
map
.
put
(
"limit"
,
rows
);
Struts2Utils
.
renderJson
(
this
.
service
.
listNhywjtxhdglByPage
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-listNhywjtxhdglByPage-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 查询总数
*/
/*
//@OperateType(value = LogConstants.LOG_QUERY ,info ="count_Nhywjtxhdgl")
public void count_Nhywjtxhdgl(){
...
...
@@ -69,147 +57,147 @@ public class NhywjtxhdglAction extends BaseAction{
}
}
*/
/**
* 查询 Nhywjtxhdgl
*/
@OperateType
(
value
=
LogConstants
.
LOG_GET
,
info
=
"query_Nhywjtxhdgl"
)
public
void
query_Nhywjtxhdgl
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
Struts2Utils
.
renderJson
(
this
.
service
.
query_AllNhywjtxhdgl
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-query_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 查询 一条Nhywjtxhdgl
*/
@OperateType
(
value
=
LogConstants
.
LOG_GET
,
info
=
"get_Nhywjtxhdgl"
)
public
void
get_Nhywjtxhdgl
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
Struts2Utils
.
renderJson
(
this
.
service
.
get_Nhywjtxhdgl
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglActionquery_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 删除
*/
@OperateType
(
value
=
LogConstants
.
LOG_DELETE
,
info
=
"deleteNhywjtxhdgl"
)
public
void
delete_Nhywjtxhdgl
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
CommUtils
.
isEmpty
(
map
)){
int
result
=
service
.
delete_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
else
{
throw
new
Exception
(
"请正确的选择删除记录!!!"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-delete_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 插入
*/
@OperateType
(
value
=
LogConstants
.
LOG_ADD
,
info
=
"insert_Nhywjtxhdgl"
)
public
void
insert_Nhywjtxhdgl
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(
StringUtil
.
checkEmpty
(
map
.
get
(
"xh"
))){
map
.
put
(
"xh"
,
StringUtil
.
getUUID
());
}
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
))){
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)||
ls
.
size
()>
0
){
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
service
.
insert_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
service
.
insert_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-insert_Nhywjtxhdgl()-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 修改
*/
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"update_Nhywjtxhdgl"
)
public
void
update_Nhywjtxhdgl
(){
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
))){
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)||
ls
.
size
()>
0
){
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
int
result
=
service
.
update_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
int
result
=
service
.
update_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-update_Nhywjtxhdgl-error: "
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 查询 Nhywjtxhdgl
*/
@OperateType
(
value
=
LogConstants
.
LOG_GET
,
info
=
"query_Nhywjtxhdgl"
)
public
void
query_Nhywjtxhdgl
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
Struts2Utils
.
renderJson
(
this
.
service
.
query_AllNhywjtxhdgl
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-query_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 修改经纬度
*/
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"updateJtxhdJdWdByXh"
)
public
void
updateJtxhdJdWdByXh
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
))){
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)||
ls
.
size
()>
0
){
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
int
result
=
service
.
updateJtxhdJdWdByXh
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
int
result
=
service
.
updateJtxhdJdWdByXh
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjthlglAction-updateJthlJdWdByXh-error: "
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 批量删除
*/
/**
* 查询 一条Nhywjtxhdgl
*/
@OperateType
(
value
=
LogConstants
.
LOG_GET
,
info
=
"get_Nhywjtxhdgl"
)
public
void
get_Nhywjtxhdgl
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
Struts2Utils
.
renderJson
(
this
.
service
.
get_Nhywjtxhdgl
(
map
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglActionquery_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 删除
*/
@OperateType
(
value
=
LogConstants
.
LOG_DELETE
,
info
=
"deleteNhywjtxhdgl"
)
public
void
delete_Nhywjtxhdgl
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
CommUtils
.
isEmpty
(
map
))
{
int
result
=
service
.
delete_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
else
{
throw
new
Exception
(
"请正确的选择删除记录!!!"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-delete_Nhywjtxhdgl-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 插入
*/
@OperateType
(
value
=
LogConstants
.
LOG_ADD
,
info
=
"insert_Nhywjtxhdgl"
)
public
void
insert_Nhywjtxhdgl
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(
StringUtil
.
checkEmpty
(
map
.
get
(
"xh"
)))
{
map
.
put
(
"xh"
,
StringUtil
.
getUUID
());
}
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
)))
{
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)
||
ls
.
size
()
>
0
)
{
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
service
.
insert_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
service
.
insert_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-insert_Nhywjtxhdgl()-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 修改
*/
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"update_Nhywjtxhdgl"
)
public
void
update_Nhywjtxhdgl
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
)))
{
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)
||
ls
.
size
()
>
0
)
{
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
int
result
=
service
.
update_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
int
result
=
service
.
update_Nhywjtxhdgl
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjtxhdglAction-update_Nhywjtxhdgl-error: "
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 修改经纬度
*/
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"updateJtxhdJdWdByXh"
)
public
void
updateJtxhdJdWdByXh
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
if
(!
StringUtil
.
checkEmpty
(
map
.
get
(
"checkparam"
)))
{
Map
sMap
=
new
HashMap
();
sMap
.
put
(
"tableparam"
,
map
.
get
(
"checkparam"
));
List
ls
=
service
.
query_Nhywjtxhdgl
(
sMap
);
if
(!
StringUtil
.
checkEmpty
(
ls
)
||
ls
.
size
()
>
0
)
{
Struts2Utils
.
renderJson
(
Constants
.
SAME
);
}
else
{
int
result
=
service
.
updateJtxhdJdWdByXh
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
else
{
int
result
=
service
.
updateJtxhdJdWdByXh
(
map
);
Struts2Utils
.
renderJson
(
Constants
.
SUCCESS
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjthlglAction-updateJthlJdWdByXh-error: "
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
/**
* 批量删除
*/
/*
@OperateType(value = LogConstants.LOG_DELETE ,info ="batch_delete_Nhywjtxhdgl")
public void batch_delete_Nhywjtxhdgl(){
...
...
@@ -226,10 +214,10 @@ public class NhywjtxhdglAction extends BaseAction{
}
}
*/
/**
* 导出Excel
*/
/**
* 导出Excel
*/
/*
//@OperateType(value = LogConstants.LOG_EXPORT ,info ="exp_Nhywjtxhdgl")
public void exp_Nhywjtxhdgl(){
...
...
@@ -267,10 +255,10 @@ public class NhywjtxhdglAction extends BaseAction{
}
}
*/
/**
* 导入Excel
*/
/**
* 导入Excel
*/
/*
//@OperateType(value = LogConstants.LOG_IMPORT ,info ="imp_Nhywjtxhdgl")
public String imp_Nhywjtxhdgl(String excelFile,Object user) {
...
...
@@ -304,4 +292,82 @@ public class NhywjtxhdglAction extends BaseAction{
return rs;
}
*/
//查询信号灯状态,mysql 表的异常信息与oracle 表中的路灯表进行右关联,得出状态信息
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"listNhywjtxhdglStatusByPage"
)
public
void
listNhywjtxhdglStatusByPage
()
{
try
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
//信号灯的所有异常信息
Map
xhdstatusmap
=
service
.
listNhywjtxhdglStatusByPage
(
map
);
List
<
Map
>
xhdstatemap
=
(
List
<
Map
>)
xhdstatusmap
.
get
(
"rows"
);
int
page
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"page"
));
int
rows
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"rows"
));
int
start
=
((
page
==
0
?
1
:
page
)
-
1
)
*
rows
;
map
.
put
(
"start"
,
start
);
map
.
put
(
"limit"
,
rows
);
//信号灯的分页信息
Map
xhdmap
=
service
.
listNhywjtxhdglByPage
(
map
);
List
<
Map
>
xhdmaplist
=
(
List
<
Map
>)
xhdmap
.
get
(
"rows"
);
boolean
ischeck
=
false
;
//遍历两个集合获得结果
for
(
Map
mapLD
:
xhdmaplist
)
{
for
(
Map
mapLDState
:
xhdstatemap
)
{
if
(
null
!=
mapLD
.
get
(
"qybh"
)
&&
null
!=
mapLDState
.
get
(
"noarea"
)
&&
null
!=
mapLD
.
get
(
"lkh"
)
&&
null
!=
mapLDState
.
get
(
"nojunc"
)
&&
mapLD
.
get
(
"qybh"
).
equals
(
String
.
valueOf
(
mapLDState
.
get
(
"noarea"
)))
&&
mapLD
.
get
(
"lkh"
).
equals
(
String
.
valueOf
(
mapLDState
.
get
(
"nojunc"
))))
{
mapLD
.
putAll
(
mapLDState
);
ischeck
=
true
;
}
}
if
(!
ischeck
)
{
mapLD
.
put
(
"mode"
,
null
);
mapLD
.
put
(
"time"
,
null
);
}
}
xhdmap
.
put
(
"rows"
,
xhdmaplist
);
Struts2Utils
.
renderJson
(
xhdmap
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjthlglAction-listNhywjtxhdglStatusByPage-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
//查询信号灯历史状态,关联运维表 获得区域名称,路口名称,路灯名称
@OperateType
(
value
=
LogConstants
.
LOG_UPDATE
,
info
=
"listNhywjtxhdglHistoryStateByPage"
)
public
void
listNhywjtxhdglHistoryStateByPage
()
{
Map
map
=
Struts2Utils
.
getRequestParameterMap
();
try
{
int
page
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"page"
));
int
rows
=
Integer
.
parseInt
(
Struts2Utils
.
getParameter
(
"rows"
));
int
start
=
((
page
==
0
?
1
:
page
)
-
1
)
*
rows
;
map
.
put
(
"start"
,
start
);
map
.
put
(
"limit"
,
rows
);
map
.
put
(
"qybh"
,
Struts2Utils
.
getParameter
(
"qybh"
));
map
.
put
(
"lkh"
,
Struts2Utils
.
getParameter
(
"lkh"
));
//信号灯的历史异常信息
Map
xhdhistory
=
this
.
service
.
listNhywjtxhdglHistoryStateByPage
(
map
);
List
<
Map
>
xhdmaplist
=(
List
<
Map
>)
xhdhistory
.
get
(
"rows"
);
Map
xhd
=
this
.
service
.
listNhywjtxhdglByPage
(
map
);
for
(
Map
mapLD
:
(
List
<
Map
>)
xhd
.
get
(
"rows"
))
{
for
(
Map
mapLDState
:
xhdmaplist
)
{
if
(
null
!=
mapLD
.
get
(
"qybh"
)
&&
null
!=
mapLDState
.
get
(
"noarea"
)
&&
null
!=
mapLD
.
get
(
"lkh"
)
&&
null
!=
mapLDState
.
get
(
"nojunc"
)
&&
mapLD
.
get
(
"qybh"
).
equals
(
String
.
valueOf
(
mapLDState
.
get
(
"noarea"
)))
&&
mapLD
.
get
(
"lkh"
).
equals
(
String
.
valueOf
(
mapLDState
.
get
(
"nojunc"
))))
{
mapLDState
.
putAll
(
mapLD
);
}
}
}
xhdhistory
.
put
(
"rows"
,
xhdmaplist
);
Struts2Utils
.
renderJson
(
xhdhistory
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
iLog
.
error
(
"NhywjthlglAction-listNhywjtxhdglHistoryStateByPage-error:"
+
e
);
Struts2Utils
.
renderJson
(
null
);
}
}
}
src/cn/yw/nhyw/nhywjtxhdgl/dao/NhywjtxhdglDao.java
View file @
855f0cd6
...
...
@@ -87,4 +87,23 @@ public class NhywjtxhdglDao extends BaseSqlMapDAO{
public
Map
get_Nhywjtxhdgl
(
Map
map
)
throws
SQLException
{
return
(
Map
)
this
.
queryForObject
(
"query_Nhywjtxhdgl"
,
map
);
}
//查询mysql
public
List
<
Map
>
listXHDStatus
()
throws
SQLException
{
return
(
List
<
Map
>)
this
.
queryForPage
(
"query_XHDStatus"
,
null
);
}
public
List
<
Map
>
query_NhywjtxhdglState
(
Map
map
)
throws
SQLException
{
return
this
.
queryForPage
(
"query_NhywjtxhdglState"
,
map
);
}
public
Integer
count_NhywjtxhdglState
(
Map
map
)
throws
SQLException
{
return
(
Integer
)
this
.
queryForObject
(
"count_NhywjtxhdglState"
,
map
);
}
public
List
<
Map
>
query_NhywjtxhdglHistoryState
(
Map
map
)
throws
SQLException
{
return
this
.
queryForPage
(
"query_NhywjtxhdglHistoryState"
,
map
);
}
public
Integer
count_NhywjtxhdglHistoryState
(
Map
map
)
throws
SQLException
{
return
(
Integer
)
this
.
queryForObject
(
"count_NhywjtxhdglHistoryState"
,
map
);
}
}
src/cn/yw/nhyw/nhywjtxhdgl/service/NhywjtxhdglService.java
View file @
855f0cd6
package
cn
.
yw
.
nhyw
.
nhywjtxhdgl
.
service
;
import
cn.datasource.DS
;
import
cn.yw.nhyw.nhywjtxhdgl.dao.NhywjtxhdglDao
;
import
java.sql.SQLException
;
import
java.util.List
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
...
...
@@ -13,6 +15,7 @@ import org.springframework.stereotype.Service;
import
cn.base.bean.BaseService
;
import
cn.base.util.CommUtils
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
(
"nhywjtxhdglService"
)
public
class
NhywjtxhdglService
extends
BaseService
{
...
...
@@ -115,4 +118,31 @@ public class NhywjtxhdglService extends BaseService {
map
.
put
(
"rows"
,
list
);
return
map
;
}
//访问mysql 数据库获得异常数据,并存放到文件中
@DS
(
"datasource2"
)
public
List
<
Map
>
listXHDStatus
()
throws
SQLException
{
return
nhywjtxhdglDao
.
listXHDStatus
();
}
@DS
(
"datasource2"
)
@Transactional
public
Map
listNhywjtxhdglStatusByPage
(
Map
map
)
throws
SQLException
{
List
<
Map
>
list
=
nhywjtxhdglDao
.
query_NhywjtxhdglState
(
map
);
Integer
totalCount
=
nhywjtxhdglDao
.
count_NhywjtxhdglState
(
map
);
Map
mapresult
=
new
HashMap
<>();
mapresult
.
put
(
"total"
,
totalCount
);
mapresult
.
put
(
"rows"
,
list
);
return
mapresult
;
}
@DS
(
"datasource2"
)
@Transactional
public
Map
listNhywjtxhdglHistoryStateByPage
(
Map
map
)
throws
SQLException
{
List
<
Map
>
list
=
nhywjtxhdglDao
.
query_NhywjtxhdglHistoryState
(
map
);
Integer
totalCount
=
nhywjtxhdglDao
.
count_NhywjtxhdglHistoryState
(
map
);
map
.
clear
();
map
.
put
(
"total"
,
totalCount
);
map
.
put
(
"rows"
,
list
);
return
map
;
}
}
src/cn/yw/xhd/action/XHDAction.java
0 → 100644
View file @
855f0cd6
package
cn
.
yw
.
xhd
.
action
;
public
class
XHDAction
{
}
src/rebel.xml
0 → 100644
View file @
855f0cd6
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.zeroturnaround.com/jrebel/standalone/config.html for more information.
-->
<application
generated-by=
"intellij"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://www.zeroturnaround.com"
xsi:schemaLocation=
"http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd"
>
<classpath>
<dir
name=
"E:/19年项目/杭州文件/eclipse/impnhyw/WebRoot/WEB-INF/classes"
>
</dir>
</classpath>
<web>
<link
target=
"/"
>
<dir
name=
"E:/19年项目/杭州文件/eclipse/impnhyw/WebRoot"
>
</dir>
</link>
</web>
</application>
src/sqlmap/Nhywjtxhdgl.xml
View file @
855f0cd6
...
...
@@ -204,7 +204,22 @@
$order$
</isNotEmpty>
</sql>
<sql
id=
"condition_xhdstate"
>
where 1=1
<isNotEmpty
prepend=
'AND'
property=
'xhdmc'
>
(xhdmc like '%$xhdmc$%')
</isNotEmpty>
<isNotEmpty
prepend=
'AND'
property=
'qybh'
>
(noarea = #qybh# )
</isNotEmpty>
<isNotEmpty
prepend=
'AND'
property=
'lkh'
>
(nojunc = #lkh# )
</isNotEmpty>
<isNotEmpty
property=
'tableparam'
>
$tableparam$
</isNotEmpty>
</sql>
<!-- add object -->
<insert
id=
"insert_Nhywjtxhdgl"
parameterClass=
"java.util.Map"
>
insert into
...
...
@@ -385,7 +400,7 @@
select
xh,xhdbh,xhdmc,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4,sjzp,gxdwbm,gxdwmc,lxr,lxdh
from nhywjtxhdgl
<include
refid=
"condition_Nhywjtxhdgl"
/>
<include
refid=
"condition_Nhywjtxhdgl"
/>
</select>
<!-- query objects totalcount -->
...
...
@@ -412,6 +427,27 @@
]]>
</iterate>
</insert>
<!-- query objects by page-->
<select
id=
"query_NhywjtxhdglState"
resultClass=
"java.util.HashMap"
parameterClass=
"java.util.Map"
remapResults=
"true"
>
select * from tabjuncmode_current
<include
refid=
"condition_xhdstate"
/>
</select>
<select
id=
"count_NhywjtxhdglState"
resultClass=
"java.lang.Integer"
parameterClass=
"java.util.Map"
remapResults=
"true"
>
select count(*) from tabjuncmode_current
<include
refid=
"condition_xhdstate"
/>
</select>
<select
id=
"query_NhywjtxhdglHistoryState"
resultClass=
"java.util.HashMap"
parameterClass=
"java.util.Map"
remapResults=
"true"
>
select * from tabjuncmode
<include
refid=
"condition_xhdstate"
/>
</select>
<select
id=
"count_NhywjtxhdglHistoryState"
resultClass=
"java.lang.Integer"
parameterClass=
"java.util.Map"
remapResults=
"true"
>
select count(*) from tabjuncmode
<include
refid=
"condition_xhdstate"
/>
</select>
</sqlMap>
...
...
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