Commit 855f0cd6 authored by wangjinjing's avatar wangjinjing

src 文件更新

parent 3857f13a
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;
}
}
<?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
package cn.bsystem.Test.service;
import cn.bsystem.Test.model.User;
import java.util.List;
public interface ILoginFrameService {
public List<User> getUserlist();
}
......@@ -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(){
......
......@@ -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);
......
......@@ -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);
......
package cn.datasource;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
public @interface DS {
String value() default "datasource1";
}
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
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();
}
}
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);
}
}
......@@ -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);
......
......@@ -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);
}
}
}
......@@ -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);
}
}
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;
}
}
package cn.yw.xhd.action;
public class XHDAction {
}
<?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>
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment