Commit 379a8eeb authored by Administrator's avatar Administrator

--智能分析平台项目代码

parent a9c90952
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1497,64 +1497,20 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/commons-beanutils-1.8.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/json-lib-2.4-jdk15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/ezmorph-1.0.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/commons-logging-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/commons-lang-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/软件包/json-lib依赖jar包/commons-collections-3.2.1.jar!/" />
<root url="file://$MODULE_DIR$/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
</library>
</orderEntry>
<orderEntry type="library" name="vertica-7.0.1" level="project" />
<orderEntry type="library" name="Maven: p6spy:p6spy:1.3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.xfire:xfire-xmpp:1.2.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.xfire:xfire-aegis:1.2.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.xfire:xfire-core:1.2.6" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="library" name="Maven: javax.mail:mail:1.4" level="project" />
<orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: jaxen:jaxen:1.1-beta-9" level="project" />
<orderEntry type="library" name="Maven: xerces:xmlParserAPIs:2.6.2" level="project" />
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.6.2" level="project" />
......@@ -1641,6 +1597,11 @@
<orderEntry type="library" name="Maven: com.hp.service:saaj:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.hp.service:wsdl4j-1.5.1:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.hp.service:xmlsec-1.3.0:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.axis:axis:1.4" level="project" />
<orderEntry type="library" name="Maven: commons-discovery:commons-discovery:0.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.axis:axis-jaxrpc:1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.axis:axis-saaj:1.4" level="project" />
<orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:3.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:3.2.3.RELEASE" level="project" />
......@@ -1662,7 +1623,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:servlet-api:2.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.2" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.6" level="project" />
......@@ -1674,6 +1634,11 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.5" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.5" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.5" level="project" />
<orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
<orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: ch.qos.logback:logback-classic:1.0.13" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: ch.qos.logback:logback-core:1.0.13" level="project" />
......@@ -1681,6 +1646,7 @@
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:jcl-over-slf4j:1.7.5" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:jul-to-slf4j:1.7.5" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:1.15" level="project" />
<orderEntry type="library" name="Maven: org.syslog4j:syslog4j:0.9.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:14.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springside:springside-test:4.1.0.GA" level="project" />
......@@ -1717,69 +1683,5 @@
<orderEntry type="library" name="Maven: commons-net:commons-net:3.1" level="project" />
<orderEntry type="library" name="Maven: sun.misc:BASE64Decoder:1.0" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20080701" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/json-lib-2.4-jdk15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/ezmorph-1.0.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-logging-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-lang-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-collections-3.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-beanutils-1.8.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
......@@ -277,6 +277,40 @@
<version>1.0.0</version>
</dependency>
<!-- axis 1.4 jar start -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-saaj</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.4</version>
</dependency>
<!-- axis 1.4 jar end -->
<!-- spring data access -->
<dependency>
<groupId>org.springframework</groupId>
......@@ -404,6 +438,14 @@
</dependency>
<!-- JSON end -->
<!--json-lib-->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!-- LOGGING begin -->
<dependency>
<groupId>org.slf4j</groupId>
......@@ -448,6 +490,13 @@
</dependency>
<!-- LOGGING end -->
<!-- syslog发送日志 -->
<dependency>
<groupId>org.syslog4j</groupId>
<artifactId>syslog4j</artifactId>
<version>0.9.30</version>
</dependency>
<!-- GENERAL UTILS begin -->
<dependency>
<groupId>org.apache.commons</groupId>
......
package com.cmsz.dao;
import java.io.IOException;
import java.sql.*;
import com.cmsz.ws.UserService;
import com.hp.cmsz.commons.utils.Constant;
import com.hp.cmsz.commons.utils.PropertiesUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cmsz.ws.impl.UserServiceImpl;
import com.hp.cmsz.commons.utils.Constant;
import com.hp.cmsz.commons.utils.PropertiesUtil;
import java.io.IOException;
import java.sql.*;
//import com.cmsz.ws.impl.UserServiceImpl;
/**
*
* @author huacha
*
*/
public class DAOSupport {
private static Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
private static Logger log = LoggerFactory.getLogger(UserService.class);
private Connection c;
private PreparedStatement ps;
private ResultSet rs = null;
......@@ -29,27 +29,20 @@ public class DAOSupport {
protected Connection getConnection() throws SQLException {
Connection conn = null;
log.info("--Begin to get DB connection--");
try {
// DriverManager.registerDriver(new com.vertica.jdbc.Driver());
String driver = PropertiesUtil.readValue(Constant.CONFIG_FILE,
Constant.JDBC_DRIVER);
log.info("driver is:" + driver);
String url = PropertiesUtil.readValue(Constant.CONFIG_FILE,
Constant.JDBC_URL);
log.info("url is:" + url);
String userName = PropertiesUtil.readValue(Constant.CONFIG_FILE,
Constant.JDBC_USER_NAME);
log.info("userName is:" + userName);
String password = PropertiesUtil.readValue(Constant.CONFIG_FILE,
Constant.JDBC_PASSWORD);
log.info("password is:" + password);
String driver = "com.vertica.jdbc.Driver";
//生产环境数据库
String url = "jdbc:vertica://192.168.113.116:5433/cmsz_ccolap";
String userName = "ccolap";
String password = "ccolap-cmsz";
//测试环境数据库
/*String url = "jdbc:vertica://192.168.127.58:5433/vertica_prd";
String userName = "ccolap";
String password = "hg.2015";*/
Class.forName(driver);
conn = DriverManager.getConnection(url, userName, password);
log.info("Get Connection successful");
conn.setAutoCommit(false);
} catch (IOException ie) {
ie.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -101,7 +94,6 @@ public class DAOSupport {
/**
*
* @param rs
*/
public void closeAll() throws SQLException
......@@ -111,8 +103,8 @@ public class DAOSupport {
rs.close();
if (ps != null)
ps.close();
if (c != null)
c.close();
// if (c != null)
// c.close();
}
......
package com.cmsz.dao;
import com.cmsz.vo.DepartmentVO;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.cmsz.vo.DepartmentVO;
/**
*
* @author huacha
*
*/
@Component
public class DepartmentDaoSupport extends DAOSupport {
public List<DepartmentVO> findByDepartmentId(String departmentId)
{
String sql="SELECT DEPARTMENT_ID, DEPARTMENT_CODE, DEPARTMENT_NAME, DEPARTMENT_NOTE FROM DIM_DEPARTMENT_INFO_T";
if (null==departmentId||departmentId.trim().isEmpty())
{
public List<DepartmentVO> findByDepartmentId(String departmentId) {
String sql="SELECT DEPARTMENT_ID, DEPARTMENT_NAME, DEPARTMENT_NOTE FROM DIM_DEPARTMENT_INFO_T ORDER BY DEPARTMENT_ID";
if (null==departmentId||departmentId.isEmpty())
{
sql="SELECT DEPARTMENT_ID, DEPARTMENT_NAME, DEPARTMENT_NOTE FROM DIM_DEPARTMENT_INFO_T ORDER BY DEPARTMENT_ID";
}
else
{
sql+=" where DEPARTMENT_ID="+departmentId;
sql+=" where DEPARTMENT_ID in ("+ departmentId +") ";
}
List<DepartmentVO> departmentList=new ArrayList<DepartmentVO>();
try {
......@@ -31,7 +34,7 @@ public class DepartmentDaoSupport extends DAOSupport {
{
DepartmentVO vo=new DepartmentVO();
vo.setDepartmentId(rs.getString("DEPARTMENT_ID"));
vo.setDepartmentname(rs.getString("DEPARTMENT_NAME"));
vo.setDepartmentName(rs.getString("DEPARTMENT_NAME"));
vo.setNote(rs.getString("DEPARTMENT_NOTE"));
//userInfoVO.setWorkCode(rs.getString(""));
departmentList.add(vo);
......@@ -47,7 +50,7 @@ public class DepartmentDaoSupport extends DAOSupport {
public List<DepartmentVO> findAllDepartment()
{
String sql="SELECT DEPARTMENT_ID, DEPARTMENT_CODE, DEPARTMENT_NAME, DEPARTMENT_NOTE FROM DIM_DEPARTMENT_INFO_T";
String sql="SELECT DEPARTMENT_ID, DEPARTMENT_NAME, DEPARTMENT_NOTE FROM DIM_DEPARTMENT_INFO_T ORDER BY DEPARTMENT_ID";
List<DepartmentVO> departmentList=new ArrayList<DepartmentVO>();
try {
......@@ -56,7 +59,7 @@ public class DepartmentDaoSupport extends DAOSupport {
{
DepartmentVO vo=new DepartmentVO();
vo.setDepartmentId(rs.getString("DEPARTMENT_ID"));
vo.setDepartmentname(rs.getString("DEPARTMENT_NAME"));
vo.setDepartmentName(rs.getString("DEPARTMENT_NAME"));
vo.setNote(rs.getString("DEPARTMENT_NOTE"));
//userInfoVO.setWorkCode(rs.getString(""));
departmentList.add(vo);
......
package com.cmsz.dao;
import com.cmsz.vo.ResultVO;
import com.cmsz.ws.LoginSwitchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.sql.SQLException;
@Component
public class LoginSwitchDaoSupport extends DAOSupport {
private static Logger logger = LoggerFactory.getLogger(LoginSwitchService.class);
public ResultVO loginModChg(String flag){
ResultVO resultVO = new ResultVO();
String sql = "UPDATE DIM_LOGIN_SWICH_INFO_T SET FLAG = '" + flag+ "' WHERE ID = '1' ";
try {
this.executeSQL(sql);
this.commit();
} catch (SQLException e) {
e.printStackTrace();
resultVO.setResult("1");
resultVO.setResultDesc("认证切换失败");
}
if(flag.equals("0")){
resultVO.setResult("0");
resultVO.setResultDesc("认证切换已开启");
}else if(flag.equals("1")){
resultVO.setResult("0");
resultVO.setResultDesc("认证切换已关闭");
}
return resultVO;
}
}
package com.cmsz.dao;
import com.cmsz.vo.WorkGroupVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cmsz.vo.WorkGroupVO;
@Component
public class RoleInfoDaoSupport extends DAOSupport {
private static Logger logger = LoggerFactory.getLogger(RoleInfoDaoSupport.class);
public List<WorkGroupVO> queryWorkGroup(String groupId) {
logger.info("开始查询工作组信息-----------------");
String sql="SELECT ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, CREATE_TIME, MODIFY_TIME, ROLE_TYPE, VALID_BEGIN, VALID_END, SAFE_MODE FROM JCPZ_ROLE_INFO_T";
String sql="SELECT ROLE_ID, ROLE_TYPE, SAFE_MODE, ROLE_NAME, VALID_BEGIN, VALID_END, ROLE_DESCRIPTION FROM JCPZ_ROLE_INFO_T ORDER BY ROLE_ID";
List<WorkGroupVO> resultList = new ArrayList<WorkGroupVO>();
if (groupId.trim().isEmpty() || groupId == null) {//为空
sql="SELECT ROLE_ID, ROLE_TYPE, SAFE_MODE, ROLE_NAME, VALID_BEGIN, VALID_END, ROLE_DESCRIPTION FROM JCPZ_ROLE_INFO_T ORDER BY ROLE_ID";
} else {
sql+=" where ROLE_ID="+groupId;
sql+=" where ROLE_ID in ("+ groupId +")";
}
try {
ResultSet rs=this.getResultSet(sql);
......@@ -31,11 +30,11 @@ public class RoleInfoDaoSupport extends DAOSupport {
WorkGroupVO vo = new WorkGroupVO();
vo.setGroupId(rs.getString("ROLE_ID"));
vo.setGroupType(rs.getString("ROLE_TYPE"));
vo.setName(rs.getString("ROLE_NAME"));
vo.setNote(rs.getString("ROLE_DESCRIPTION"));
vo.setSafeMode(rs.getString("SAFE_MODE"));
vo.setName(rs.getString("ROLE_NAME"));
vo.setValidBegin(rs.getString("VALID_BEGIN"));
vo.setValidEnd(rs.getString("VALID_END"));
vo.setNote(rs.getString("ROLE_DESCRIPTION"));
resultList.add(vo);
}
this.closeAll();
......@@ -49,7 +48,7 @@ public class RoleInfoDaoSupport extends DAOSupport {
public List<WorkGroupVO> queryAllWorkGroup() {
logger.info("开始查询工作组信息-----------------");
String sql="SELECT ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, CREATE_TIME, MODIFY_TIME, ROLE_TYPE, VALID_BEGIN, VALID_END, SAFE_MODE FROM JCPZ_ROLE_INFO_T";
String sql="SELECT ROLE_ID, ROLE_TYPE, SAFE_MODE, ROLE_NAME, VALID_BEGIN, VALID_END, ROLE_DESCRIPTION FROM JCPZ_ROLE_INFO_T ORDER BY ROLE_ID";
List<WorkGroupVO> resultList = new ArrayList<WorkGroupVO>();
try {
......@@ -59,11 +58,11 @@ public class RoleInfoDaoSupport extends DAOSupport {
WorkGroupVO vo = new WorkGroupVO();
vo.setGroupId(rs.getString("ROLE_ID"));
vo.setGroupType(rs.getString("ROLE_TYPE"));
vo.setName(rs.getString("ROLE_NAME"));
vo.setNote(rs.getString("ROLE_DESCRIPTION"));
vo.setSafeMode(rs.getString("SAFE_MODE"));
vo.setName(rs.getString("ROLE_NAME"));
vo.setValidBegin(rs.getString("VALID_BEGIN"));
vo.setValidEnd(rs.getString("VALID_END"));
vo.setNote(rs.getString("ROLE_DESCRIPTION"));
resultList.add(vo);
}
this.closeAll();
......
package com.cmsz.servlet;
import org.apache.axis.transport.http.AxisServlet;
/**
* @author tjh
* @create 2018-04-18
**/
@javax.servlet.annotation.WebServlet(
urlPatterns ="/services/*",
loadOnStartup = 1,
name = "AxisServlet"
)
public class WebServlet extends AxisServlet {
}
......@@ -11,7 +11,9 @@ public class DepartmentVO implements Serializable {
private String departmentId; // 部门标识
private String departmentname; //部门名称
private String departmentCode;
private String departmentName; //部门名称
private String note; // 备注
......@@ -42,9 +44,17 @@ public class DepartmentVO implements Serializable {
public DepartmentVO() {
}
public DepartmentVO(String departmentId, String departmentname, String note) {
public String getDepartmentCode() {
return departmentCode;
}
public void setDepartmentCode(String departmentCode) {
this.departmentCode = departmentCode;
}
public DepartmentVO(String departmentId, String departmentName, String note) {
this.departmentId = departmentId;
this.departmentname = departmentname;
this.departmentName = departmentName;
this.note = note;
}
......@@ -57,13 +67,13 @@ public class DepartmentVO implements Serializable {
this.departmentId = departmentId ;
}
public String getDepartmentname() {
return departmentname;
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentname(String departmentname) {
departmentname = departmentname.equals("") ? "0" : departmentname.trim();
this.departmentname = departmentname ;
public void setDepartmentName(String departmentName) {
departmentName = departmentName.equals("") ? "0" : departmentName.trim();
this.departmentName = departmentName ;
}
public String getNote() {
......@@ -77,7 +87,7 @@ public class DepartmentVO implements Serializable {
@Override
public String toString() {
return "DepartmentVO [departmentId=" + departmentId + ", departmentname=" + departmentname + ", note=" + note
return "DepartmentVO [departmentId=" + departmentId + ", departmentName=" + departmentName + ", note=" + note
+ "]";
}
}
\ No newline at end of file
package com.cmsz.vo;
import java.util.Date;
import java.io.Serializable;
public class LoginSwitch implements java.io.Serializable {
public class LoginSwitch implements Serializable {
/**
* 登录模式
*/
private static final long serialVersionUID = 1L;
private String id;
/*private String id;
private String modelValue;//登录模式 0 本地模式 1 4A托管模式
private String modelStatus;//模式状态 0 开启 1关闭
private Date createDate;//模式生效事件
......@@ -38,7 +38,15 @@ public class LoginSwitch implements java.io.Serializable {
}
public static long getSerialversionuid() {
return serialVersionUID;
}*/
private String flag;
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
}
......@@ -6,39 +6,39 @@ import java.util.Date;
public class SysLogDTO {
private String class_name;
private String type;
private String time;
private String src_ip;
private String src_port;
private String src_mac;
private String dst_ip;
private String dst_port;
private String dst_mac;
private String protocol;
private String class_name;//事件类别
private String type;//事件类型
private String time;//事件产生时间
private String src_ip;//源IP
private String src_port;//目的IP
private String src_mac;//源端口
private String dst_ip;//目的端口
private String dst_port;//源MAC地址
private String dst_mac;//目的MAC地址
private String protocol;//协议名称
// private String start_time;
// private String end_time;
private String primary_user;
private String secondary_user;
private String operation;
private String content;
private String sensitive_name;
private String sensitive_range;
private String sensitive_type;
private String is_remark;
private String remark_type;
private String remark_code;
private String menuname;
private String menucode;
private String primary_user;//主帐号
private String secondary_user;//从帐号
private String operation;//操作名称
private String content;//操作内容
private String sensitive_name;//敏感数据名称
private String sensitive_range;//敏感数据范围
private String sensitive_type;//敏感数据类别
private String is_remark;//是否具有操作凭证
private String remark_type;//操作凭证类型
private String remark_code;//操作凭证ID
private String menuname;//菜单名称
private String menucode;//菜单编号
// private String dev_ip;
// private String dev_port;
// private String dev_mac;
// private String authen_status;
private String log_level;
private String session_id;
private String param_len;
private String param;
private String result_status;
private String log_level;//事件级别
private String session_id;//认证编号
private String param_len;//参数长度
private String param;//参数内容
private String result_status;//结果状态
public String getOperation() {
return operation;
......
......@@ -13,7 +13,7 @@ public class UserInfoVO implements Serializable{
*/
private static final long serialVersionUID = -675389784876238114L;
// private Long userID;
private Long userID;
private String loginUser; //登录用户(账号)
......@@ -42,102 +42,13 @@ public class UserInfoVO implements Serializable{
private String updateBy;
private String updateTime;
// public Long getUserID() {
// return userID;
// }
//
// public void setUserID(Long userID) {
// this.userID = userID;
// }
//
// public String getLoginUser() {
// return loginUser;
// }
//
// public void setLoginUser(String loginUser) {
// this.loginUser = loginUser;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getStaffName() {
// return staffName;
// }
//
// public void setStaffName(String staffName) {
// this.staffName = staffName;
// }
//
// public String getFlag() {
// return flag;
// }
//
// public void setFlag(String flag) {
// this.flag = flag;
// }
//
// public String getValidLength() {
// return validLength;
// }
//
// public void setValidLength(String validLength) {
// this.validLength = validLength;
// }
//
// public String getExpireDate() {
// return expireDate;
// }
//
// public void setExpireDate(String expireDate) {
// this.expireDate = expireDate;
// }
//
// public String getLogLock() {
// return logLock;
// }
//
// public void setLogLock(String logLock) {
// this.logLock = logLock;
// }
//
// public String getDepartmentCode() {
// return departmentCode;
// }
//
// public void setDepartmentCode(String departmentCode) {
// this.departmentCode = departmentCode;
// }
//
// public String getWorkCode() {
// return workCode;
// }
//
// public void setWorkCode(String workCode) {
// this.workCode = workCode;
// }
//
// public String getNote() {
// return note;
// }
//
// public void setNote(String note) {
// this.note = note;
// }
//
// @Override
// public String toString() {
// return "UserInfoVO [loginUser=" + loginUser + ", password=" + password
// + ", staffName=" + staffName + ", flag=" + flag
// + ", validLength=" + validLength + ", expireDate=" + expireDate
// + ", logLock=" + logLock + ", departmentCode=" + departmentCode
// + ", workCode=" + workCode + ", note=" + note + "]";
// }
public Long getUserID() {
return userID;
}
public void setUserID(Long userID) {
this.userID = userID;
}
public static UserInfoVO getaddUserInfo(UserInfoVO user){
......@@ -346,10 +257,8 @@ public class UserInfoVO implements Serializable{
@Override
public String toString() {
return "UserInfo [loginUser=" + loginUser + ", userKey=" + userKey + ", staffName=" + staffName + ", msisdn="
+ msisdn + ", mail=" + mail + ", password=" + password + ", flag=" + flag + ", validLength="
+ validLength + ", expireDate=" + expireDate + ", updateBy=" + updateBy + ", updateTime=" + updateTime
+ ", logLock=" + logLock + ", departmentCode=" + departmentCode + ", workCode=" + workCode + ", note="
return "UserInfo [loginUser=" + loginUser + ", password= "+ password +" , staffName=" + staffName + ", flag=" + flag + ", validLength="
+ validLength + ", expireDate=" + expireDate + ", logLock=" + logLock + ", departmentCode=" + departmentCode + ", workCode=" + workCode + ", note="
+ note + "]";
}
}
\ No newline at end of file
......@@ -14,84 +14,24 @@ public class WorkGroupVO implements Serializable {
private String groupId; //工作组标识
private String name; //名称
private String groupType; //类型
private String safeMode; //权限属性
private String name; //名称
// private Date validBegin; //有效起始时间
//
// private Date validEnd; //有效终止时间
private String note; //备注
private String validBegin;// (有效起始时间)
private String validEnd;// (有效终止时间)
private String note; //备注
private String updateBy;
private String updateTime;
// public String getSafeMode() {
// return safeMode;
// }
//
// public void setSafeMode(String safeMode) {
// this.safeMode = safeMode;
// }
//
// public String getGroupId() {
// return groupId;
// }
//
// public void setGroupId(String groupId) {
// this.groupId = groupId;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getGroupType() {
// return groupType;
// }
//
// public void setGroupType(String groupType) {
// this.groupType = groupType;
// }
//
// public String getNote() {
// return note;
// }
//
// public void setNote(String note) {
// this.note = note;
// }
//
// public String getValidBegin() {
// return validBegin;
// }
//
// public void setValidBegin(String validBegin) {
// this.validBegin = validBegin;
// }
//
// public String getValidEnd() {
// return validEnd;
// }
//
// public void setValidEnd(String validEnd) {
// this.validEnd = validEnd;
// }
//
// public static long getSerialversionuid() {
// return serialVersionUID;
// }
public static List<WorkGroupVO> getWorkGroupVerification(List<WorkGroupVO> arry){
if (arry == null) {
......@@ -209,12 +149,11 @@ public class WorkGroupVO implements Serializable {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "WorkGroup [groupId=" + groupId + ", name=" + name + ", groupType=" + groupType + ", safeMode="
+ safeMode + ", validBegin=" + validBegin + ", validEnd=" + validEnd + ", note=" + note + ", updateBy="
+ updateBy + ", updateTime=" + updateTime + "]";
return "WorkGroupVO{" +
"groupId='" + groupId + ", groupType='" + groupType + ", safeMode='" + safeMode +
", name='" + name + ", validBegin='" + validBegin + ", validEnd='" + validEnd + ", note='" + note + '}';
}
}
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="queryDepartment">
<return-type componentType="com.cmsz.vo.DepartmentVO" />
</method>
</mapping>
</mappings>
\ No newline at end of file
package com.cmsz.ws;
import com.cmsz.dao.DepartmentDaoSupport;
import com.cmsz.vo.DepartmentVO;
import com.hp.cmsz.commons.utils.SyslogUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.cmsz.vo.DepartmentVO;
/**
*
* DepartmentService
* 部门同步接口
*
*/
@Service
public class DepartmentService extends SpringBeanAutowiringSupport {
private static Logger log = LoggerFactory.getLogger(DepartmentService.class);
@Autowired
private DepartmentDaoSupport departmentDao;
/**
* @param departmentId(部门标识)
* @return List 存放一个或多个DepartmentVO工作组对象(参数为空值时返回多个对象)
*/
public String queryDepartment(String departmentId){
String inparamter = "";
if(!departmentId.equals("") && departmentId != null){
JSONObject joo = JSONObject.fromObject(departmentId);
inparamter = (String) joo.get("departmentId");
}
log.info("查询用户部门操作:参数为 "+inparamter);
List<DepartmentVO> lists = new ArrayList<DepartmentVO>();
if(inparamter.equals("") && inparamter == null){
lists = departmentDao.findAllDepartment();
}else{
lists = departmentDao.findByDepartmentId(inparamter);
}
// List<DepartmentVO> lists = new ArrayList<DepartmentVO>();
// lists = departmentDao.findByDepartmentId(inparamter);
public interface DepartmentService{
JSONArray ja = new JSONArray();
if(lists != null){
int num = lists.size(); //行数
//AES aes = new AES(); // 模糊化处理AES方式加解密
System.out.println("同步业务系统数量="+ num);
for (int i = 0; i < num; i++){
JSONObject jo = new JSONObject();
jo.put("departmentId", lists.get(i).getDepartmentId());
jo.put("departmentname",lists.get(i).getDepartmentName());
jo.put("note",lists.get(i).getNote());
ja.add(jo);
}
}
/*查询部门列表*/
// public List<DepartmentVO> queryDepartment (String departmentId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\"192.168.83.221\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"查询\"" + " ");
buffer.append("content=" + "\"同步部门资源\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"4A同步资源\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
return ja.toString();
}
}
public String queryDepartment (String departmentId);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="queryWorkGroup">
<return-type componentType="com.cmsz.vo.WorkGroupVO" />
</method>
</mapping>
</mappings>
\ No newline at end of file
package com.cmsz.ws;
import java.util.List;
import com.cmsz.dao.RoleInfoDaoSupport;
import com.cmsz.vo.WorkGroupVO;
import com.hp.cmsz.commons.utils.SyslogUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONException;
@Service
public class GroupService extends SpringBeanAutowiringSupport {
private static Logger log = LoggerFactory.getLogger(GroupService.class);
@Autowired
private RoleInfoDaoSupport groupInfoDao;
public String queryWorkGroup(String groupId) {
System.out.println("begin++");
String inparameter = "";
if(!groupId.trim().equals("") && groupId != null){
JSONObject joo = JSONObject.fromObject(groupId);
inparameter = (String) joo.get("groupId");
}
log.info("查询用户工作组操作:参数为 "+inparameter);
public interface GroupService {
List<WorkGroupVO> workList = new ArrayList<WorkGroupVO>();
workList =groupInfoDao.queryWorkGroup(inparameter);
/*查询工作组 */
// public List<WorkGroupVO> queryWorkGroup(String groupId);
workList = WorkGroupVO.getWorkGroupVerification(workList);
public String queryWorkGroup(String groupId);
JSONArray ja = new JSONArray();
if(workList != null){
int num = workList.size(); //行数
//AES aes = new AES(); // 模糊化处理AES方式加解密
System.out.println("同步业务系统数量="+ num);
for (int i = 0; i < num; i++){
JSONObject jo = new JSONObject();
jo.put("groupId",workList.get(i).getGroupId());
jo.put("name",workList.get(i).getName());
jo.put("groupType",workList.get(i).getGroupType());
jo.put("safeMode",workList.get(i).getSafeMode());
jo.put("validBegin",workList.get(i).getValidBegin());
jo.put("validEnd",workList.get(i).getValidEnd());
jo.put("note",workList.get(i).getNote());
ja.add(jo);
}
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\"192.168.83.221\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"查询\"" + " ");
buffer.append("content=" + "\"同步部门资源\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"4A同步资源\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
return ja.toString();
}
}
package com.cmsz.ws;
import com.cmsz.vo.HttpRespons;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
......@@ -10,8 +12,6 @@ import java.nio.charset.Charset;
import java.util.Map;
import java.util.Vector;
import com.cmsz.vo.HttpRespons;
public class HttpRequester {
private String defaultContentEncoding;
......
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="loginModChg">
<return-type componentType="com.cmsz.vo.ResultVO" />
</method>
</mapping>
</mappings>
\ No newline at end of file
package com.cmsz.ws;
import com.cmsz.dao.LoginSwitchDaoSupport;
import com.cmsz.vo.ResultVO;
import com.hp.cmsz.commons.utils.SyslogUtil;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
* @ClassName: LoginSwitchService
* @Description: 认证转换接口
* @author: Administrator
* @date: 2018年4月18日 上午10:37:22
*/
@Service
public class LoginSwitchService extends SpringBeanAutowiringSupport {
private static Logger log = LoggerFactory.getLogger(LoginSwitchService.class);
@Autowired
private LoginSwitchDaoSupport loginSwitchDao;
/*@Autowired
private SyslogUtil syslog;*/
private static LoginSwitchService loginSwitchService;
/**
* 开关标志位 0 打开 1 关闭
*/
public String loginModChg(String flag) {
JSONObject joo = JSONObject.fromObject(flag);
String inparmeter = (String) joo.get("flag");
JSONObject jo = new JSONObject();
log.info("切换登陆接口(开关表)操作:参数为 "+inparmeter);
ResultVO resultVO = loginSwitchDao.loginModChg(inparmeter);
if(resultVO.getResult().equals("0")){//成功
log.info("4A认证已开启!");
public interface LoginSwitchService {
//操作成功
jo.put("result",resultVO.getResult()); // 操作结果:0 成功、1 失败
jo.put("resultDesc",resultVO.getResultDesc()); // 操作结果描述
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\"192.168.83.221\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"切换4A认证\"" + " ");
buffer.append("content=" + "\"切换认证成功\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
return jo.toString();
}else{
log.info("4A认证已关闭!");
// public ResultVO loginModChg(String flag);
//操作失败
jo.put("result",resultVO.getResult()); // 操作结果:0 成功、1 失败
jo.put("resultDesc",resultVO.getResultDesc()); // 操作结果描述
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\"192.168.83.221\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"切换4A认证\"" + " ");
buffer.append("content=" + "\"切换认证失败\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"4A认证开关\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
return jo.toString();
}
}
public String loginModChg(String flag);
}
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="logout">
<return-type componentType="com.cmsz.vo.UserInfoVO" />
</method>
</mapping>
</mappings>
\ No newline at end of file
package com.cmsz.ws;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import java.net.URL;
/**
* 测试 webservice
* by moly 2018913
*/
public class TestWebService {
public static void main(String[]ss){
try {
test2();
}catch (Exception e){
e.printStackTrace();
}
}
private static void test1 ()throws Exception{
String endpoint = "http://localhost:8088/services/UserService?token=yidongaxistoken";
String method = "queryUserInfo";
Service service = new Service();
Call call =(Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
call.setUsername("yidongaxisuser@#*&");
call.setPassword("password%%$#");
try {
System.out.println("begin=");
call.setOperationName(method);
String result = (String)call.invoke(new Object[]{"moly"});
System.out.println("result ="+result);
System.out.println("over=");
}catch (Exception e){
e.printStackTrace();
}
}
private static void test2 ()throws Exception{
String endpoint = "http://localhost:8088/services/UserService";
String method = "queryUserInfo";
Service service = new Service();
Call call =(Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
call.setUsername("yidongaxisuser@#*&");
call.setPassword("password%%$#");
try {
System.out.println("begin=");
call.setOperationName(method);
String result = (String)call.invoke(new Object[]{"moly"});
System.out.println("result ="+result);
System.out.println("over=");
}catch (Exception e){
e.printStackTrace();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="queryUserInfo">
<return-type componentType="com.cmsz.vo.UserInfoVO" />
</method>
<method name="addUserInfo">
<parameter index="0" componentType="com.cmsz.vo.UserInfoVO" />
<return-type componentType="com.cmsz.vo.ResultVO" />
</method>
<method name="modifyUserInfo">
<parameter index="0" componentType="com.cmsz.vo.UserInfoVO" />
<return-type componentType="com.cmsz.vo.ResultVO" />
</method>
<method name="modifyUserPassword">
<return-type componentType="com.cmsz.vo.ResultVO" />
</method>
<method name="delUserInfo">
<return-type componentType="com.cmsz.vo.ResultVO" />
</method>
</mapping>
</mappings>
\ No newline at end of file
This diff is collapsed.
package com.cmsz.ws.impl;
import java.util.ArrayList;
import java.util.List;
import com.hp.cmsz.entity.Department;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.cmsz.dao.DepartmentDaoSupport;
import com.cmsz.vo.DepartmentVO;
import com.cmsz.ws.DepartmentService;
public class DepartmentServiceImpl implements DepartmentService {
private static Logger logger = LoggerFactory.getLogger(DepartmentServiceImpl.class);
@Autowired
private DepartmentDaoSupport departmentDao;
/**
* 查询部门列表
*/
// public List<DepartmentVO> queryDepartment (String departmentId) {
// logger.info("开始查询部门列表信息-----------------");
// DepartmentDaoSupport departmentDao=new DepartmentDaoSupport();
// List<DepartmentVO> resultList = new ArrayList<DepartmentVO>();
// //List<Department> departmentList = new ArrayList<Department>();
// /*if (departmentId.equals("") || departmentId == null) {//为空
// departmentList = (List<Department>) departmentDao.findAll();
// } else {
// departmentList = (List<Department>) departmentDao.findByDepartmentId(Long.valueOf(departmentId));
// }
//
// */
// resultList=departmentDao.findByDepartmentId(departmentId);
// /*for (int i = 0; i < departmentList.size(); i++) {
// DepartmentVO vo = new DepartmentVO();
// vo.setDepartmentId(String.valueOf(departmentList.get(i).getDepartmentId()));
// resultList.add(vo);
// }*/
// return resultList;
// }
public String queryDepartment(String departmentId) {
String lu = "";
if(departmentId != null && !departmentId.equals("")){
JSONObject joo = JSONObject.fromObject(departmentId);
lu = (String) joo.get("departmentId");
}
logger.info("查询用户部门操作:参数为 "+lu);
List<DepartmentVO> lists = new ArrayList<DepartmentVO>();
if(lu!=null && !lu.equals("")){
lists = departmentDao.findByDepartmentId(lu);
} else{
lists = departmentDao.findAllDepartment();
}
JSONArray ja = new JSONArray();
try {
if(lists != null){
int num = lists.size(); //行数
//AES aes = new AES(); // 模糊化处理AES方式加解密
System.out.println("同步业务系统数量="+ num);
for (int i = 0; i < num; i++){
JSONObject jo = new JSONObject();
jo.put("departmentId", lists.get(i).getDepartmentId());
jo.put("departmentname", lists.get(i).getDepartmentname());
jo.put("note", lists.get(i).getNote());
ja.add(jo);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return ja.toString();
}
}
package com.cmsz.ws.impl;
import java.util.ArrayList;
import java.util.List;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.cmsz.dao.RoleInfoDaoSupport;
import com.cmsz.vo.WorkGroupVO;
import com.cmsz.ws.GroupService;
public class GroupServiceImpl implements GroupService {
private static Logger logger = LoggerFactory.getLogger(GroupServiceImpl.class);
@Autowired
private RoleInfoDaoSupport roleInfoDao;
/**
* 查询工作组
*/
// public List<WorkGroupVO> queryWorkGroup(String groupId) {
// logger.info("开始查询工作组信息-----------------");
// RoleInfoDaoSupport roleInfoDao=new RoleInfoDaoSupport();
// List<WorkGroupVO> resultList = new ArrayList<WorkGroupVO>();
// //List<RoleInfo> roleInfoList = new ArrayList<RoleInfo>();;
// /*if (groupId.equals("") || groupId == null) {//为空
// roleInfoList = (List<RoleInfo>) roleInfoDao.findAll();
// } else {
// roleInfoList = (List<RoleInfo>) roleInfoDao.findByRoleId(Long.valueOf(groupId));
// }
// for (int i = 0; i < roleInfoList.size(); i++) {
// WorkGroupVO vo = new WorkGroupVO();
// vo.setGroupId(String.valueOf(roleInfoList.get(i).getRoleId()));
// vo.setGroupType(roleInfoList.get(i).getRoleType());
// vo.setName(roleInfoList.get(i).getRoleName());
// vo.setNote(roleInfoList.get(i).getRoleDescription());
// vo.setSafeMode(roleInfoList.get(i).getSafeMode());
// vo.setValidBegin(roleInfoList.get(i).getValidBegin());
// vo.setValidEnd(roleInfoList.get(i).getValidEnd());
// resultList.add(vo);
// }*/
// resultList=roleInfoDao.queryWorkGroup(groupId);
// return resultList;
// }
public String queryWorkGroup(String groupId) {
String lu = "";
if(groupId != null && !groupId.equals("")){
JSONObject joo = JSONObject.fromObject(groupId);
lu = (String) joo.get("groupId");
}
logger.info("查询用户工作组操作:参数为 "+lu);
List<WorkGroupVO> workList = new ArrayList<WorkGroupVO>();
if (lu != null && !lu.equals("")) {
workList = roleInfoDao.queryWorkGroup(lu);
} else {
workList = roleInfoDao.queryAllWorkGroup();
}
workList = WorkGroupVO.getWorkGroupVerification(workList);
JSONArray ja = new JSONArray();
try {
if(workList != null){
int num = workList.size(); //行数
//AES aes = new AES(); // 模糊化处理AES方式加解密
System.out.println("同步业务系统数量="+ num);
for (int i = 0; i < num; i++){
JSONObject jo = new JSONObject();
jo.put("groupId", workList.get(i).getGroupId());
jo.put("name", workList.get(i).getName());
jo.put("groupType", workList.get(i).getGroupType());
jo.put("safeMode", workList.get(i).getSafeMode());
jo.put("validBegin", workList.get(i).getValidBegin());
jo.put("validEnd", workList.get(i).getValidEnd());
jo.put("note", workList.get(i).getNote());
ja.add(jo);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return ja.toString();
}
}
package com.cmsz.ws.impl;
import com.hp.cmsz.repository.UserInfoDao;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cmsz.vo.ResultVO;
import com.cmsz.ws.LoginSwitchService;
import org.springframework.beans.factory.annotation.Autowired;
public class LoginSwitchServiceImpl implements LoginSwitchService {
private static Logger logger = LoggerFactory.getLogger(LoginSwitchServiceImpl.class);
@Autowired
private LoginSwitchService loginSwitchService;
// public ResultVO loginModChg(String flag) {
//
// logger.info("开始切换系统登录模式----------------");
//
// ResultVO resultVO = new ResultVO();
// String descript = "";
// /*
// if (!"0".equals(flag) && !"1".equals(flag)) {
// descript = "开关标志无效";
// } else {
// try {
// loginSwitchDAO.updateLoginModel(flag);
// } catch (Exception e) {
// descript = "登录模式切换失败";
// e.printStackTrace();
// }
// }
// if(descript == "")
// resultVO.setResult("0");
// else
// resultVO.setResult("1");
// */
// resultVO.setResultDesc(descript);
// return resultVO;
// }
/**
* 开关标志位 0 打开 1 关闭
*/
public String loginModChg(String flag) {
JSONObject joo = JSONObject.fromObject(flag);
String lu = (String) joo.get("flag");
JSONObject jo = new JSONObject();
logger.info("切换登陆接口(开关表)操作:参数为 "+lu);
int code = Integer.parseInt(loginSwitchService.loginModChg(lu));
if(code!=1){ //失败
logger.info("切换失败!");
jo.put("result", "1"); // 操作结果:0 成功、1 失败
jo.put("resultDesc", "切换失败!"); // 操作结果描述
return jo.toString();
}else{
logger.info("切换成功!");
jo.put("result", "0"); // 操作结果:0 成功、1 失败
jo.put("resultDesc", "切换成功!"); // 操作结果描述
return jo.toString();
}
}
}
package com.cmsz.ws.impl;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cmsz.vo.ResultVO;
import com.cmsz.ws.LogoutService;
public class LogoutServiceImpl implements LogoutService {
private static Logger logger = LoggerFactory.getLogger(LogoutServiceImpl.class);
@Override
public ResultVO logout(String xmlStr) {
List<String> accountLst = readXml(xmlStr);
/* log.info("------[" + authentication.getName() + "]成功注销...");*/
return null;
}
private List<String> readXml(String xmlStr) {
List<String> list = new ArrayList<String>();
try {
List resultList = null;
Reader in = new StringReader(xmlStr);
SAXBuilder builder = new SAXBuilder();
Document xmlDoc = builder.build(in);
Element rootElement = xmlDoc.getRootElement();
resultList = rootElement.getChildren();
if (resultList != null && resultList.size() > 0) {
String account = rootElement.getChildText("ACCOUNT");
if (account == null)
account = "";
//TODO获取用户ID
list.add(account);
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
}
This diff is collapsed.
package com.hp.cmsz.commons.filter;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authz.AuthorizationFilter;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.util.Arrays;
/**
* 自定义角色判定器
*/
public class AxisAnyRoleFilter extends AuthorizationFilter {
@Override
protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) throws Exception {
Subject subject = getSubject(servletRequest, servletResponse);
String[] rolesArray = (String[]) o;
System.out.println("subject = "+subject.toString());
System.out.println("rolesArray ="+rolesArray.toString());
System.out.println("拥有的 角色 "+Arrays.toString(rolesArray));
if(rolesArray==null||rolesArray.length==0){
System.out.println("rolesArray wei null 或 0");
return true;
}
for(int i=0;i<rolesArray.length;i++){
if(subject.hasRole(rolesArray[i])){
System.out.println("has "+rolesArray[i]);
return true;
}
}
return false;
}
}
package com.hp.cmsz.commons.filter;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* axis 过滤器 token验证失败 进入登录界面
*/
public class AxisServiceInterceptor implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
String token = request.getParameter("token");
System.out.println("token ="+token);
if("yidongaxistoken".equals(token)){
filterChain.doFilter(servletRequest, servletResponse);
}else{
System.out.println("禁止访问wsdl");
response.sendRedirect("/");
// filterChain.doFilter(servletRequest, servletResponse);
}
}
@Override
public void destroy() {
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}
package com.hp.cmsz.commons.filter;
import javax.servlet.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class CookieHttpOnlyFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
Cookie[] cookies=req.getCookies();
System.out.println("cookies"+cookies);
if(cookies!=null || cookies.length != 0){
for(Cookie cookie:cookies){
/**
* //tomcat7 支持该属性,tomcat6不支持
* //cookie.setHttpOnly(true);
*/
//tomcat6
String value = cookie.getValue();
StringBuilder builder = new StringBuilder();
builder.append("JSESSIONID=" + value + "; ");
builder.append("Secure; ");
builder.append("HttpOnly; ");
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR, 1);
Date date = cal.getTime();
Locale locale = Locale.CHINA;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss",locale);
builder.append("Expires=" + sdf.format(date));
resp.setHeader("Set-Cookie", builder.toString());
}
}
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
}
package com.hp.cmsz.commons.filter;
import com.hp.cmsz.commons.utils.CommonUtil;
import com.hp.cmsz.commons.utils.IpUtil;
import com.hp.cmsz.commons.utils.JSDES;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
public class FourAFilter implements Filter {
private FilterConfig filterConfig;
private Log log = LogFactory.getLog(this.getClass());
@Override
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
System.out.println("进入4A流程登录");
Connection connection = null;
ResultSet rs = null;
ResultSet rs1 = null;
String loginSwitch = "";
String passWord1 = "";
//查询认证开关flag的状态
log.info("--Begin to get DB connection--");
try {
String driver = "com.vertica.jdbc.Driver";
//生产环境数据库
String urlJDBC = "jdbc:vertica://192.168.113.116:5433/cmsz_ccolap";
String userName = "ccolap";
String password = "ccolap-cmsz";
//测试环境数据库
/*String urlJDBC = "jdbc:vertica://192.168.127.58:5433/vertica_prd";
String userName = "ccolap";
String password = "hg.2015";*/
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
connection = DriverManager.getConnection(urlJDBC, userName, password);
} catch (SQLException e) {
e.printStackTrace();
}
log.info("Get Connection successful");
try {
connection.setAutoCommit(false);
} catch (SQLException e) {
e.printStackTrace();
}
String sql = "SELECT FLAG FROM DIM_LOGIN_SWICH_INFO_T WHERE ID = '1' ";
PreparedStatement ps = null;
try {
ps = connection.prepareStatement(sql);
} catch (SQLException e) {
e.printStackTrace();
}
try {
rs = ps.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
}
while (rs.next()) {
loginSwitch = rs.getString("FLAG");
}
System.out.println("查询4A认证开关状态:" + loginSwitch);
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
if (loginSwitch.equals("0")) {
log.info("4A认证开启");
String token = request.getParameter("Token");
System.out.println("获取token" + token);
Map<String, String> textMap = new HashMap<String, String>();
String username1 = null;
//不是4a发送的登录请求
if (token == null || token.length() == 0) {
//账号在4A验证失败
request.getRequestDispatcher("/WEB-INF/views/NotFourA.jsp").forward(request, response);
return;
} else if (token != null || token.length() != 0) {
String[] str = token.split("@");
username1 = str[1];
System.out.println("用户名:" + username1);
String ip = IpUtil.getIpAddress(request);
textMap.put("Token", str[0]);
textMap.put("IP", ip);
textMap.put("ACC_KEY", str[1]);
textMap.put("APP_KEY", str[2]);
textMap.put("Master_ACC", str[3]);
//向4A方验证发送的token中的用户是否有权限登录
try {
//向4A发送验证token的用户是否有应用权限
//4A测试环境地址
// String Url4a = "http://172.16.8.121:8080/TicketloginAction.do?method=appLoginResult";
//4A生产环境地址
String Url4a = "http://192.168.34.11:8080/TicketloginAction.do?method=appLoginResult";
URL url1 = new URL(Url4a);
HttpURLConnection conn = (HttpURLConnection) url1.openConnection();// 建立http连接
conn.setDoOutput(true);// 设置允许输出
conn.setDoInput(true);
conn.setUseCaches(false);// 设置不用缓存
conn.setRequestMethod("POST");// 设置传递方式
conn.setRequestProperty("Connection", "Keep-Alive");// 设置维持长连接
conn.setRequestProperty("Charset", "UTF-8");// 设置文件字符集:
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();// 开始连接请求
StringBuffer param = new StringBuffer();
if (conn.getRequestMethod().equalsIgnoreCase("POST") && textMap != null) {
for (Map.Entry<String, String> entry : textMap.entrySet()) {
param.append("&");
param.append(entry.getKey()).append("=").append(entry.getValue());
}
}
OutputStream out = conn.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
objectOutputStream.writeObject(param.toString());
conn.getOutputStream().flush();
conn.getOutputStream().close();
if (conn.getResponseCode() == 200) {// 请求返回的状态
System.out.println("连接成功");
InputStream in = conn.getInputStream();// 请求返回的数据
String a = null;
String result = "";
String fail = "";
try {
byte[] data1 = new byte[in.available()];
in.read(data1);
a = new String(data1);// 转成字符串
System.out.println("连接成功返回的数据:" + a);
result = String.valueOf(a.indexOf("1"));
fail = String.valueOf(a.indexOf("0"));
if ("13".equals(result)) {
JSDES d = new JSDES();
UsernamePasswordToken upToken = new UsernamePasswordToken(username1, d.strEnc(CommonUtil.decrypt(passWord1), "venustech_tbu_venus4A", "2", "3"));
SecurityUtils.getSubject().login(upToken);
request.setAttribute("upToken", upToken);
response.sendRedirect(request.getContextPath());
return;
} else if ("13".equals(fail)) {
//账号在4A验证失败
request.getRequestDispatcher("/WEB-INF/views/ErrorFourA.jsp").forward(request, response);
return;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
} catch (Exception e) {
System.out.println("异常问题:" + e);
}
}
}else if (loginSwitch.equals("1")) {
log.info("4A认证切换关闭!");
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
this.filterConfig = null;
}
}
package com.hp.cmsz.commons.filter;
import com.hp.cmsz.commons.utils.CommonUtil;
import com.hp.cmsz.commons.utils.IpUtil;
import com.hp.cmsz.commons.utils.JSDES;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
public class FourASwitchFilter implements Filter {
private FilterConfig filterConfig;
private Log log = LogFactory.getLog(this.getClass());
@Override
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
String upToken = request.getRequestURI();
System.out.println("4A开关校验");
Connection connection = null;
ResultSet rs = null;
ResultSet rs1 = null;
String loginSwitch = "";
String passWord1 = "";
//查询认证开关flag的状态
log.info("--Begin to get DB connection--");
try {
String driver = "com.vertica.jdbc.Driver";
/*String urlJDBC = "jdbc:vertica://192.168.113.116:5433/cmsz_ccolap";
String userName = "ccolap";
String password = "ccolap-cmsz";*/
String urlJDBC = "jdbc:vertica://192.168.127.58:5433/vertica_prd";
String userName = "ccolap";
String password = "hg.2015";
Class.forName(driver);
connection = DriverManager.getConnection(urlJDBC, userName, password);
log.info("Get Connection successful");
connection.setAutoCommit(false);
String sql = "SELECT FLAG FROM DIM_LOGIN_SWICH_INFO_T WHERE ID = '1' ";
PreparedStatement ps = connection.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
loginSwitch = rs.getString("FLAG");
}
System.out.println("查询4A认证开关状态:" + loginSwitch);
connection.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("数据库classNotFound异常:" + e);
e.printStackTrace();
} catch (SQLException e) {
System.out.println("数据库sql异常:" + e);
e.printStackTrace();
}
if (loginSwitch.equals("0")) {
//4A认证开启
request.setAttribute("FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME","MUST_LOGIN_FROM_4A");
}
else if(loginSwitch.equals("1")) {
log.info("4A认证切换关闭!");
chain.doFilter(request,response);
}
}
@Override
public void destroy() {
this.filterConfig = null;
}
}
This diff is collapsed.
package com.hp.cmsz.commons.filter;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class RefererFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
// 禁止缓存
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragrma", "no-cache");
response.setDateHeader("Expires", 0);
// 链接来源地址
String referer = request.getHeader("Referer");
System.out.println("refer is" + referer);
if((referer!=null) &&(referer.trim().startsWith("http://localhost:8088"))){
chain.doFilter(request, response);
} else {
request.getRequestDispatcher("/WEB-INF/views/error/500.jsp").forward(request, response);
return;
}
}
@Override
public void destroy() {
}
}
package com.hp.cmsz.commons.filter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import javax.servlet.Filter;
......@@ -11,6 +14,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 表单重复提交验证
* @author Administrator
......@@ -19,6 +23,8 @@ import javax.servlet.http.HttpServletResponse;
public class RepeatCommitFilter implements Filter{
private Log log = LogFactory.getLog(this.getClass());
@Override
public void destroy() {
......@@ -31,9 +37,10 @@ public class RepeatCommitFilter implements Filter{
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse respones = (HttpServletResponse) servletResponse;
HttpServletResponse response = (HttpServletResponse) servletResponse;
if(request.getParameter("tokenID")==null){
respones.sendRedirect(request.getContextPath());
response.sendRedirect(request.getContextPath());
}else{
if(isRepeatSubmit(request)){
return;
......
......@@ -12,6 +12,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hp.cmsz.commons.utils.AES;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
......@@ -80,6 +81,7 @@ public class SSOFilter implements Filter {
UsernamePasswordToken upToken = new UsernamePasswordToken(user,
d.strEnc(CommonUtil.decrypt(userinfo.getPassword()),
"venustech_tbu_venus4A", "2", "3"));
SecurityUtils.getSubject().login(upToken);
response.sendRedirect(request.getContextPath());
// SecurityUtils.getSubject().getSession()
......
package com.hp.cmsz.commons.filter;
import com.hp.cmsz.commons.utils.*;
import com.hp.cmsz.repository.LoginDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import static org.elasticsearch.common.netty.handler.codec.http.HttpHeaders.Values.BOUNDARY;
public class TokenFilter implements Filter {
private FilterConfig filterConfig;
private Log log = LogFactory.getLog(this.getClass());
@Override
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
System.out.println("进入4A流程登录");
String token = request.getParameter("Token");
Map<String, String> textMap = new HashMap<String, String>();
String username1 = null;
if(token == null || token.length() == 0){
//账号在4A验证失败
request.getRequestDispatcher("/WEB-INF/views/NotFourA.jsp").forward(request, response);
return;
} else if(token != null || token.length() != 0){
String[] str = token.split("@");
username1 = str[1];
System.out.println("用户名:" + username1);
String ip = IpUtil.getIpAddress(request);
textMap.put("Token", str[0]);
textMap.put("IP", ip);
textMap.put("ACC_KEY", str[1]);
textMap.put("APP_KEY", str[2]);
textMap.put("Master_ACC", str[3]);
}
Connection connection = null;
ResultSet rs = null;
ResultSet rs1 = null;
String loginSwitch = "";
String passWord1 = "";
//查询认证开关flag的状态
log.info("--Begin to get DB connection--");
try {
String driver = "com.vertica.jdbc.Driver";
//生产环境数据库
String urlJDBC = "jdbc:vertica://192.168.113.116:5433/cmsz_ccolap";
String userName = "ccolap";
String password = "ccolap-cmsz";
//测试环境数据库
/*String urlJDBC = "jdbc:vertica://192.168.127.58:5433/vertica_prd";
String userName = "ccolap";
String password = "hg.2015";*/
Class.forName(driver);
connection = DriverManager.getConnection(urlJDBC, userName, password);
log.info("Get Connection successful");
connection.setAutoCommit(false);
String sql = "SELECT FLAG FROM DIM_LOGIN_SWICH_INFO_T WHERE ID = '1' ";
PreparedStatement ps = connection.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
loginSwitch = rs.getString("FLAG");
}
System.out.println("查询4A认证开关状态:" + loginSwitch);
ps.close();
rs.close();
if(username1 != null || username1.length() != 0){
String sql1 = "SELECT PASSWORD FROM JCPZ_USER_INFO_T WHERE USER_NAME = '" + username1 + "'";
PreparedStatement ps1 = connection.prepareStatement(sql1);
rs1 = ps1.executeQuery();
while (rs1.next()) {
passWord1 = rs1.getString("PASSWORD");
}
ps1.close();
rs1.close();
}
connection.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("数据库classNotFound异常:" + e);
e.printStackTrace();
} catch (SQLException e) {
System.out.println("数据库sql异常:" + e);
e.printStackTrace();
}
if (loginSwitch.equals("0")) {
log.info("4A认证开启");
//不是4a发送的登录请求
if (token == null || "".equals(token.trim())) {
request.getRequestDispatcher("/WEB-INF/views/NotFourA.jsp").forward(request, response);
return;
} else {
//向4A方验证发送的token中的用户是否有权限登录
try {
//向4A发送验证token的用户是否有应用权限
//4A测试环境地址
// String Url4a = "http://172.16.8.121:8080/TicketloginAction.do?method=appLoginResult";
//4A生产环境地址
String Url4a = "http://192.168.34.11:8080/TicketloginAction.do?method=appLoginResult";
URL url1 = new URL(Url4a);
HttpURLConnection conn = (HttpURLConnection) url1.openConnection();// 建立http连接
conn.setDoOutput(true);// 设置允许输出
conn.setDoInput(true);
conn.setUseCaches(false);// 设置不用缓存
conn.setRequestMethod("POST");// 设置传递方式
conn.setRequestProperty("Connection", "Keep-Alive");// 设置维持长连接
conn.setRequestProperty("Charset", "UTF-8");// 设置文件字符集:
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();// 开始连接请求
StringBuffer param = new StringBuffer();
if (conn.getRequestMethod().equalsIgnoreCase("POST") && textMap != null) {
for (Map.Entry<String, String> entry : textMap.entrySet()) {
param.append("&");
param.append(entry.getKey()).append("=").append(entry.getValue());
}
}
OutputStream out = conn.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
objectOutputStream.writeObject(param.toString());
conn.getOutputStream().flush();
conn.getOutputStream().close();
if (conn.getResponseCode() == 200) {// 请求返回的状态
System.out.println("连接成功");
InputStream in = conn.getInputStream();// 请求返回的数据
String a = null;
String result = "";
String fail = "";
try {
byte[] data1 = new byte[in.available()];
in.read(data1);
a = new String(data1);// 转成字符串
System.out.println("连接成功返回的数据:" + a);
result = String.valueOf(a.indexOf("1"));
fail = String.valueOf(a.indexOf("0"));
if ("13".equals(result)) {
JSDES d = new JSDES();
UsernamePasswordToken upToken = new UsernamePasswordToken(username1, d.strEnc(CommonUtil.decrypt(passWord1), "venustech_tbu_venus4A", "2", "3"));
SecurityUtils.getSubject().login(upToken);
request.setAttribute("upToken",upToken);
response.sendRedirect(request.getContextPath());
return;
} else if ("13".equals(fail)) {
//账号在4A验证失败
request.getRequestDispatcher("/WEB-INF/views/ErrorFourA.jsp").forward(request, response);
return;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
} catch (Exception e) {
System.out.println("异常问题:" + e);
}
}
}
else if(loginSwitch.equals("1")) {
log.info("4A认证切换关闭!");
//chain.doFilter(request,response);
request.getRequestDispatcher("192.168.113.120:8080").forward(request, response);
return;
}
// chain.doFilter(request, response);
}
@Override
public void destroy() {
this.filterConfig = null;
}
}
\ No newline at end of file
This diff is collapsed.
package com.hp.cmsz.commons.utils;
import sun.misc.BASE64Decoder;
import java.io.UnsupportedEncodingException;
public class Base64 {
/**
* 将 s 进行 BASE64 编码
*
*
*/
public static String encode(String s) {
if (s == null)
return null;
String res = "";
try {
res = new sun.misc.BASE64Encoder().encode(s.getBytes("GBK"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return res;
}
/**
* 将 BASE64 编码的字符串 s 进行解码
*
*
*/
public static String decode(String s) {
if (s == null)
return null;
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(s);
return new String(b,"GBK");
} catch (Exception e) {
return null;
}
}
}
......@@ -155,6 +155,8 @@ public class CommonUtil {
try {
DES des = new DES();
result = des.encrypt(str);
/*AES aes = new AES();
result = aes.encrypt(str);*/
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -174,6 +176,8 @@ public class CommonUtil {
try {
DES des = new DES();
result = des.decrypt(cs);
/*AES aes = new AES();
result = aes.decrypt(cs);*/
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
......
......@@ -10,7 +10,7 @@ package com.hp.cmsz.commons.utils;
public interface Constant {
public static final String DATE_TIME_FORMAT_FOR_JAVA = "yyyy-MM-dd hh:mm:ss";
public static final String DATE_TIME_FORMAT_FOR_DB = "YYYY-MM-DD HH:MI:SS";
public static final String DATE_TIME_FORMAT_FOR_DB = "YYYY-MM-DD HH24:MI:SS";
public static final String EMPTY_VALUE_FOR_4A = "0";
public static final String CONFIG_FILE = "application.properties";
public static final String JDBC_DRIVER = "jdbc.driver";
......
......@@ -8,6 +8,7 @@ import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import com.sun.crypto.provider.AESKeyGenerator;
import org.apache.commons.codec.binary.Base64;
/**
......
package com.hp.cmsz.commons.utils;
import javax.servlet.http.HttpServletRequest;
public class IpUtil {
//获取客户端Ip地址
public static String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}
package com.hp.cmsz.commons.utils;
import org.productivity.java.syslog4j.Syslog;
import org.productivity.java.syslog4j.SyslogIF;
import org.productivity.java.syslog4j.impl.net.udp.UDPNetSyslogConfig;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.net.*;
import java.util.List;
import java.util.Map;
/**
......@@ -14,6 +15,33 @@ import java.util.Map;
*/
@SuppressWarnings("unchecked")
public class SyslogUtil {
/**
* 发送syslog
* @param host
* @param port
* @param log
* @param level
*/
public static void sendLog(String host,int port,String log,int level){
try {
UDPNetSyslogConfig config = new UDPNetSyslogConfig();
//设置syslog服务器端地址
config.setHost(host);
//设置syslog接收端口
config.setPort(port);
//向多个ip发送日志到多个地址
Syslog.shutdown();
//获取syslog的操作类,使用udp协议
SyslogIF syslog = Syslog.createInstance("udp", config);
syslog.log(level, URLDecoder.decode(log,"utf-8"));
System.out.println("syslog Server:"+host+":"+port);
}catch (Exception e){
e.printStackTrace();
System.out.println("syslog日志发送异常:"+e);
}
}
/**
* 发送数据
* @param dest String Syslog发往的目标IP
......@@ -26,8 +54,12 @@ public class SyslogUtil {
byte[] buffer = message.getBytes();
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, client, port);
socket.send(packet);
System.out.println("log发送成功");
socket.close();
}
/**
* 发送数据,默认IP为本机127.0.0.1,默认端口514
* @param message String 发的Syslog内容
......@@ -108,7 +140,7 @@ public class SyslogUtil {
try{
for(int i=0;i<100;i++){
SyslogUtil.sendSyslog("172.16.8.121:514",string);
SyslogUtil.sendSyslog("192.168.117.75:51455",string);
}
......
package com.hp.cmsz.commons.utils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import java.io.FileOutputStream;
import java.math.BigInteger;
import java.util.List;
/**
* @Description:
* @Author: m01
* @Date: created at 2018/11/2 10:44
* @Modified By:
*/
public class WordAndExcelUtil {
public static void main(String[] args) throws Exception {
WordAndExcelUtil t = new WordAndExcelUtil();
XWPFDocument document = new XWPFDocument();
XWPFTable table = document.createTable(2, 5);
t.setTableWidth(table, "8000");
List<XWPFTableCell> tableName = table.getRow(0).getTableCells();
tableName.get(0).setText("表名");
for (int i = 1; i <= 4; i++) {
if (i == 1)
tableName.get(i).getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);//这是起点
else
tableName.get(i).getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);//继续合并
}
tableName.get(1).setText("这是合并之后的表格");
t.mergeCellByHor(table, 0, 1, 3);
List<XWPFTableCell> heads = table.getRow(1).getTableCells();
for (int i = 0; i < 5; i++) {
heads.get(i).setText("" + i);
}
t.saveDocument(document, "e:/test/sys_" + System.currentTimeMillis() + ".docx");
}
public void setCellWidth(XWPFTableCell cell, int width) {
CTTc cttc = cell.getCTTc();
CTTcPr ctPr = cttc.addNewTcPr();
ctPr.addNewTcW().setW(BigInteger.valueOf(width));
}
public void mergeCellByHor(XWPFTable table, int row, int fromCell, int toCell) {
BigInteger totalWidth = new BigInteger("0");
for (int cellIndex = fromCell; cellIndex <= toCell; cellIndex++) {
XWPFTableCell cell = table.getRow(row).getCell(cellIndex);
BigInteger width =cell.getCTTc().getTcPr().getTcW().getW();
totalWidth.add(width);
if (cellIndex == fromCell) {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);//这是起点
} else {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
}
}
XWPFTableCell cell = table.getRow(row).getCell(fromCell);
cell.getCTTc().getTcPr().getTcW().setW(totalWidth);
cell.setText("aaa");
}
public void setCellText(XWPFTableCell cell, String text, String bgcolor, int width) {
CTTc cttc = cell.getCTTc();
CTTcPr cellPr = cttc.addNewTcPr();
cellPr.addNewTcW().setW(BigInteger.valueOf(width));
//cell.setColor(bgcolor);
CTTcPr ctPr = cttc.addNewTcPr();
CTShd ctshd = ctPr.addNewShd();
ctshd.setFill(bgcolor);
ctPr.addNewVAlign().setVal(STVerticalJc.CENTER);
cttc.getPList().get(0).addNewPPr().addNewJc().setVal(STJc.CENTER);
cell.setText(text);
}
public void mergeCellsHorizontal1(XWPFTable table, int row, int fromCell, int toCell) {
for (int cellIndex = fromCell; cellIndex <= toCell; cellIndex++) {
XWPFTableCell cell = table.getRow(row).getCell(cellIndex);
if (cellIndex == fromCell) {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);//这是起点
} else {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
}
}
XWPFTableCell cell = table.getRow(row).getCell(fromCell);
cell.setText("aaaa");
}
// word跨行并单元格
public void mergeCellsVertically1(XWPFTable table, int col, int fromRow, int toRow) {
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
if (rowIndex == fromRow) {
// The first merged cell is set with RESTART merge value
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART);
} else {
// Cells which join (merge) the first one, are set with CONTINUE
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE);
}
}
}
/**
* @Description: 跨列合并
*/
public void mergeCellsHorizontal(XWPFTable table, int row, int fromCell, int toCell) {
for (int cellIndex = fromCell; cellIndex <= toCell; cellIndex++) {
XWPFTableCell cell = table.getRow(row).getCell(cellIndex);
if (cellIndex == fromCell) {
// The first merged cell is set with RESTART merge value
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);
} else {
// Cells which join (merge) the first one, are set with CONTINUE
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
}
}
}
public void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) {
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
if (rowIndex == fromRow) {
// The first merged cell is set with RESTART merge value
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART);
} else {
// Cells which join (merge) the first one, are set with CONTINUE
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE);
}
}
}
public void setTableWidth(XWPFTable table, String width) {
CTTbl ttbl = table.getCTTbl();
CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
CTJc cTJc = tblPr.addNewJc();
cTJc.setVal(STJc.Enum.forString("center"));
tblWidth.setW(new BigInteger(width));
tblWidth.setType(STTblWidth.DXA);
}
public void saveDocument(XWPFDocument document, String savePath)
throws Exception {
FileOutputStream fos = new FileOutputStream(savePath);
document.write(fos);
fos.close();
}
}
\ No newline at end of file
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* dim_channel_datasource_rel_t视图对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "dim_channel_datasource_rel_t", schema = "ETL")
public class ChannelDataSourceNewMap implements Serializable {
private Long channelDatasourceId;//为主键
private Long channelId;//渠道id
private Long datasourceId;//数据来源id
private Timestamp crtTime;
private String crtUser;
private String currentVersion;
private Timestamp invalidTime;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getChannelDatasourceId() {
return channelDatasourceId;
}
public void setChannelDatasourceId(Long channelDatasourceId) {
this.channelDatasourceId = channelDatasourceId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getDatasourceId() {
return datasourceId;
}
public void setDatasourceId(Long dataSourceId) {
this.datasourceId = datasourceId;
}
public Timestamp getCrtTime() {
return crtTime;
}
public void setCrtTime(Timestamp crtTime) {
this.crtTime = crtTime;
}
public String getCrtUser() {
return crtUser;
}
public void setCrtUser(String crtUser) {
this.crtUser = crtUser;
}
public String getCurrentVersion() {
return currentVersion;
}
public void setCurrentVersion(String currentVersion) {
this.currentVersion = currentVersion;
}
public Timestamp getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Timestamp invalidTime) {
this.invalidTime = invalidTime;
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* 表对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "dim_channel_t", schema = "ETL")
public class ChannelNew implements Serializable {
private Long channelId ;//渠道ID
private String name ;//渠道名称
private String code ;//渠道编码
private String ifplatformFlg;
private Timestamp crtTime;
private String crtUser;
private String currentVersion;
private Timestamp invalidTime;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getIfplatformFlg() {
return ifplatformFlg;
}
public void setIfplatformFlg(String ifplatformFlg) {
this.ifplatformFlg = ifplatformFlg;
}
public Timestamp getCrtTime() {
return crtTime;
}
public void setCrtTime(Timestamp crtTime) {
this.crtTime = crtTime;
}
public String getCrtUser() {
return crtUser;
}
public void setCrtUser(String crtUser) {
this.crtUser = crtUser;
}
public String getCurrentVersion() {
return currentVersion;
}
public void setCurrentVersion(String currentVersion) {
this.currentVersion = currentVersion;
}
public Timestamp getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Timestamp invalidTime) {
this.invalidTime = invalidTime;
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* dim_datasource_t表对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "dim_datasource_t",schema = "ETL")
public class DataSourceNew implements Serializable {
private Long datasourceId ;//数据来源ID
private String name ;//数据来源名称
private String code;//数据来源编码
private Timestamp crtTime;
private String crtUser;
private String currentVersion;
private Timestamp invalidTime;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getDatasourceId() {
return datasourceId;
}
public void setDatasourceId(Long datasourceId) {
this.datasourceId = datasourceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Timestamp getCrtTime() {
return crtTime;
}
public void setCrtTime(Timestamp crtTime) {
this.crtTime = crtTime;
}
public String getCrtUser() {
return crtUser;
}
public void setCrtUser(String crtUser) {
this.crtUser = crtUser;
}
public String getCurrentVersion() {
return currentVersion;
}
public void setCurrentVersion(String currentVersion) {
this.currentVersion = currentVersion;
}
public Timestamp getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Timestamp invalidTime) {
this.invalidTime = invalidTime;
}
}
......@@ -33,11 +33,11 @@ public class DimKpi implements Serializable{
private String crtUser;
private String currentVersion;
private Date invalidTime;
private Long origKpiId;
private Long kpiTypeId;
private String origKpiId;
private Integer kpiTypeId;
private String bacType;
private String isActive;
private Long kpiCycleTypeId;
private Integer kpiCycleTypeId;
private String calCycle;
private String ifPercentageKpi;
......@@ -92,16 +92,16 @@ public class DimKpi implements Serializable{
public void setInvalidTime(Date invalidTime) {
this.invalidTime = invalidTime;
}
public Long getOrigKpiId() {
public String getOrigKpiId() {
return origKpiId;
}
public void setOrigKpiId(Long origKpiId) {
public void setOrigKpiId(String origKpiId) {
this.origKpiId = origKpiId;
}
public Long getKpiTypeId() {
public Integer getKpiTypeId() {
return kpiTypeId;
}
public void setKpiTypeId(Long kpiTypeId) {
public void setKpiTypeId(Integer kpiTypeId) {
this.kpiTypeId = kpiTypeId;
}
public String getBacType() {
......@@ -116,10 +116,10 @@ public class DimKpi implements Serializable{
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public Long getKpiCycleTypeId() {
public Integer getKpiCycleTypeId() {
return kpiCycleTypeId;
}
public void setKpiCycleTypeId(Long kpiCycleTypeId) {
public void setKpiCycleTypeId(Integer kpiCycleTypeId) {
this.kpiCycleTypeId = kpiCycleTypeId;
}
public String getCalCycle() {
......
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* @Description: 定制分析 所需表 图表的具体数值 一张图 对应 多条数据
* @Author: m01
* @Date: created at 2018/10/18 16:26
* @Modified By:
*/
@Entity
@Table(name = "FAULT_INFLUENCE_DETAIL_INFO_T")
public class FaultInfluenceDetailInfo implements Serializable {
private Integer influenceDetailId;//主键
private Integer influenceId;
private Integer kpiId;//指标
private Integer provinceId;//省份
private Timestamp businessTime;//数据采集时间 x
private BigDecimal varTure;//实际值
private BigDecimal varPre;
private BigDecimal varThr;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "faultinfluencedetailinfosequence")
@SequenceGenerator(name = "faultinfluencedetailinfosequence", sequenceName = "SEQ_INFLUENCE_DETAIL_ID", allocationSize = 1)//CCOLAP.SEQ_INFLUENCE_ID
public Integer getInfluenceDetailId() {
return influenceDetailId;
}
public void setInfluenceDetailId(Integer influenceDetailId) {
this.influenceDetailId = influenceDetailId;
}
public Integer getInfluenceId() {
return influenceId;
}
public void setInfluenceId(Integer influenceId) {
this.influenceId = influenceId;
}
public Integer getKpiId() {
return kpiId;
}
public void setKpiId(Integer kpiId) {
this.kpiId = kpiId;
}
public Integer getProvinceId() {
return provinceId;
}
public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
}
public Timestamp getBusinessTime() {
return businessTime;
}
public void setBusinessTime(Timestamp businessTime) {
this.businessTime = businessTime;
}
public BigDecimal getVarTure() {
return varTure;
}
public void setVarTure(BigDecimal varTure) {
this.varTure = varTure;
}
public BigDecimal getVarPre() {
return varPre;
}
public void setVarPre(BigDecimal varPre) {
this.varPre = varPre;
}
public BigDecimal getVarThr() {
return varThr;
}
public void setVarThr(BigDecimal varThr) {
this.varThr = varThr;
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.ByteArrayInputStream;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
/**
* @Description: 定制分析 所需表 一张图对应一条数据
* @Author: m01
* @Date: created at 2018/10/18 15:52
* @Modified By:
*/
@Entity //CCOLAP.fault_influence_result_inof_t" FAULT_INFLUENCE_RESULT_INFO_T
@Table(name = "FAULT_INFLUENCE_RESULT_INFo_T",catalog ="CCOLAP" )
public class FaultInfluenceResultInfo implements Serializable {
private Integer influenceId;//主键
private Integer kpiId;//指标
private Integer provinceId;//省份
private String provinceName;//省份
private Timestamp interrupteBeginTime;//中断开始
private Timestamp interrupteEndTime;//中断结束
private Integer interrupteTimes;//中断时长
private Integer interrupteLevel;//中断等级
private String faultReason;//故障原因
private BigDecimal influenceRate;//影响比例
private BigDecimal influenceNum;//影响值
private String ifWarning;//是否告警
private Timestamp warningBeginTime;//告警开始时间
private Timestamp warningEndTime;//告警结束时间
private Integer warningTimes;//告警次数
private BigInteger reportId;
private String workingOrderCode;//协查单号
private List<FaultInfluenceDetailInfo> faultInfluenceDetailInfos;
private String kpiName;//指标名称
//caonimab
private String chatName;
private String chatDesc;
private String tableXiechadan;//协查单
private String tableBegintime;
private String tableEndtime;
private String tablePro;//省份
private String tableDatasource;//数据来源
private String tableQudao;//渠道
private String tableGuzhangreason;//故障原因
private String tableLevel;//等级
private String tableBossBus;//省BOSS业务受理类
private String tableZhichengClaz;//支撑类
private String tableNengliClaz;//能力提供类
private String tableKehuClaz;//客户接入类
private ByteArrayInputStream img;//图片
//caonimab
@Transient
public String getTableDatasource() {
return tableDatasource;
}
public void setTableDatasource(String tableDatasource) {
this.tableDatasource = tableDatasource;
}
@Transient
public String getTablePro() {
return tablePro;
}
public void setTablePro(String tablePro) {
this.tablePro = tablePro;
}
@Transient
public String getTableQudao() {
return tableQudao;
}
public void setTableQudao(String tableQudao) {
this.tableQudao = tableQudao;
}
@Transient
public ByteArrayInputStream getImg() {
return img;
}
public void setImg(ByteArrayInputStream img) {
this.img = img;
}
@Transient
public String getTableXiechadan() {
return tableXiechadan;
}
public void setTableXiechadan(String tableXiechadan) {
this.tableXiechadan = tableXiechadan;
}
@Transient
public String getTableGuzhangreason() {
return tableGuzhangreason;
}
public void setTableGuzhangreason(String tableGuzhangreason) {
this.tableGuzhangreason = tableGuzhangreason;
}
@Transient
public String getTableLevel() {
return tableLevel;
}
public void setTableLevel(String tableLevel) {
this.tableLevel = tableLevel;
}
@Transient
public String getTableBegintime() {
return tableBegintime;
}
public void setTableBegintime(String tableBegintime) {
this.tableBegintime = tableBegintime;
}
@Transient
public String getTableEndtime() {
return tableEndtime;
}
public void setTableEndtime(String tableEndtime) {
this.tableEndtime = tableEndtime;
}
@Transient
public String getTableBossBus() {
return tableBossBus;
}
public void setTableBossBus(String tableBossBus) {
this.tableBossBus = tableBossBus;
}
@Transient
public String getTableZhichengClaz() {
return tableZhichengClaz;
}
public void setTableZhichengClaz(String tableZhichengClaz) {
this.tableZhichengClaz = tableZhichengClaz;
}
@Transient
public String getTableNengliClaz() {
return tableNengliClaz;
}
public void setTableNengliClaz(String tableNengliClaz) {
this.tableNengliClaz = tableNengliClaz;
}
@Transient
public String getTableKehuClaz() {
return tableKehuClaz;
}
public void setTableKehuClaz(String tableKehuClaz) {
this.tableKehuClaz = tableKehuClaz;
}
@Transient
public String getChatName() {
return chatName;
}
public void setChatName(String chatName) {
this.chatName = chatName;
}
@Transient
public String getChatDesc() {
return chatDesc;
}
public void setChatDesc(String chatDesc) {
this.chatDesc = chatDesc;
}
@Transient
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
@Transient
public String getKpiName() {
return kpiName;
}
public void setKpiName(String kpiName) {
this.kpiName = kpiName;
}
@Transient
public List<FaultInfluenceDetailInfo> getFaultInfluenceDetailInfos() {
return faultInfluenceDetailInfos;
}
public void setFaultInfluenceDetailInfos(List<FaultInfluenceDetailInfo> faultInfluenceDetailInfos) {
this.faultInfluenceDetailInfos = faultInfluenceDetailInfos;
}
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "influencesequence")
@SequenceGenerator(name = "influencesequence", sequenceName = "SEQ_INFLUENCE_ID", allocationSize = 1)//CCOLAP.SEQ_INFLUENCE_ID
public Integer getInfluenceId() {
return influenceId;
}
public void setInfluenceId(Integer influenceId) {
this.influenceId = influenceId;
}
public Integer getKpiId() {
return kpiId;
}
public void setKpiId(Integer kpiId) {
this.kpiId = kpiId;
}
public Integer getProvinceId() {
return provinceId;
}
public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
}
public Timestamp getInterrupteBeginTime() {
return interrupteBeginTime;
}
public void setInterrupteBeginTime(Timestamp interrupteBeginTime) {
this.interrupteBeginTime = interrupteBeginTime;
}
public Timestamp getInterrupteEndTime() {
return interrupteEndTime;
}
public void setInterrupteEndTime(Timestamp interrupteEndTime) {
this.interrupteEndTime = interrupteEndTime;
}
public Integer getInterrupteTimes() {
return interrupteTimes;
}
public void setInterrupteTimes(Integer interrupteTimes) {
this.interrupteTimes = interrupteTimes;
}
public Integer getInterrupteLevel() {
return interrupteLevel;
}
public void setInterrupteLevel(Integer interrupteLevel) {
this.interrupteLevel = interrupteLevel;
}
public String getFaultReason() {
return faultReason;
}
public void setFaultReason(String faultReason) {
this.faultReason = faultReason;
}
public BigDecimal getInfluenceRate() {
return influenceRate;
}
public void setInfluenceRate(BigDecimal influenceRate) {
this.influenceRate = influenceRate;
}
public BigDecimal getInfluenceNum() {
return influenceNum;
}
public void setInfluenceNum(BigDecimal influenceNum) {
this.influenceNum = influenceNum;
}
public String getIfWarning() {
return ifWarning;
}
public void setIfWarning(String ifWarning) {
this.ifWarning = ifWarning;
}
public Timestamp getWarningBeginTime() {
return warningBeginTime;
}
public void setWarningBeginTime(Timestamp warningBeginTime) {
this.warningBeginTime = warningBeginTime;
}
public Timestamp getWarningEndTime() {
return warningEndTime;
}
public void setWarningEndTime(Timestamp warningEndTime) {
this.warningEndTime = warningEndTime;
}
public Integer getWarningTimes() {
return warningTimes;
}
public void setWarningTimes(Integer warningTimes) {
this.warningTimes = warningTimes;
}
public BigInteger getReportId() {
return reportId;
}
public void setReportId(BigInteger reportId) {
this.reportId = reportId;
}
public String getWorkingOrderCode() {
return workingOrderCode;
}
public void setWorkingOrderCode(String workingOrderCode) {
this.workingOrderCode = workingOrderCode;
}
}
......@@ -114,4 +114,20 @@ public class Kpi implements Serializable{
public String getCalCycle(){ return calCycle;}
public void setCalCycle(String calCycle) { this.calCycle = calCycle;}
@Override
public String toString() {
return "Kpi{" +
"hWarningRuleSet=" + hWarningRuleSet +
", kpiId=" + kpiId +
", kpiName='" + kpiName + '\'' +
", kpiCode='" + kpiCode + '\'' +
", businessId=" + businessId +
", kpiValueType='" + kpiValueType + '\'' +
", kpiTypeId=" + kpiTypeId +
", kpiCycleTypeId=" + kpiCycleTypeId +
", isActive='" + isActive + '\'' +
", calCycle='" + calCycle + '\'' +
'}';
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* dim_login_swich_info_t表对应的实体类
*
* 4A认证开关
*
*/
@Entity
@Table(name = "dim_login_swich_info_t")
public class Login implements Serializable {
private Long id;
private String flag;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
@Override
public String toString() {
return "Login{" +
"flag='" + flag + '\'' +
'}';
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* gjgz_data_info_t表对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "GJGZ_DATA_INFO_T")
public class WarningRule {
private Long gjgzId;//告警规则ID
private Long kpiId;
private String kpiName;
private String ruleName;//规则名
private String ruleFileAddress;//上传规则地址
private String ruleLevel;//告警等级
private Timestamp ruleCreateTime;
private Timestamp ruleUpdateTime;
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="WarningRuleSequence")
@SequenceGenerator(name = "WarningRuleSequence", sequenceName = "ccolap.SEQ_GJGZ_ID", allocationSize=1)
public Long getGjgzId() {
return gjgzId;
}
public void setGjgzId(Long gjgzId) {
this.gjgzId = gjgzId;
}
public Long getKpiId() {
return kpiId;
}
public void setKpiId(Long kpiId) {
this.kpiId = kpiId;
}
public String getKpiName() {
return kpiName;
}
public void setKpiName(String kpiName) {
this.kpiName = kpiName;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getRuleFileAddress() {
return ruleFileAddress;
}
public void setRuleFileAddress(String ruleFileAddress) {
this.ruleFileAddress = ruleFileAddress;
}
public String getRuleLevel() {
return ruleLevel;
}
public void setRuleLevel(String ruleLevel) {
this.ruleLevel = ruleLevel;
}
public Timestamp getRuleCreateTime() {
return ruleCreateTime;
}
public void setRuleCreateTime(Timestamp ruleCreateTime) {
this.ruleCreateTime = ruleCreateTime;
}
public Timestamp getRuleUpdateTime() {
return ruleUpdateTime;
}
public void setRuleUpdateTime(Timestamp ruleUpdateTime) {
this.ruleUpdateTime = ruleUpdateTime;
}
@Override
public String toString() {
return "WarningRule{" +
"gjgzId=" + gjgzId +
", kpiId=" + kpiId +
", ruleName='" + ruleName + '\'' +
", ruleFileAddress='" + ruleFileAddress + '\'' +
", ruleLevel='" + ruleLevel + '\'' +
", ruleCreateTime=" + ruleCreateTime +
", ruleUpdateTime=" + ruleUpdateTime +
'}';
}
}
......@@ -60,6 +60,18 @@ public class XcdWarningInfoView {
private Long dataModelTypeId;
private String dataModelName;
//2018 12 13 moly 用于 自动下发协查单功能
private char autoWarning;
public char getAutoWarning() {
return autoWarning;
}
public void setAutoWarning(char autoWarning) {
this.autoWarning = autoWarning;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public String getWarningId() {
......
......@@ -88,5 +88,9 @@ public interface BusinessDao extends JpaSpecificationExecutor<Business>,
@Param(value = "channelDataSourceMapIdList") List<Long>channelDataSourceMapIdList,
@Param(value = "isActived") String isActived);
@Query(value = "select business_id,business_name from dim_business_info_t where if_warning_kpi ='Y' and IS_ACTIVE= :isActived and CHANNEL_DATA_SOURCE_MAP_ID in (:channelDataSourceMapIdList)" ,nativeQuery =true )
public List<Object[]> findBusinessListBychannelDataSourceMapIdListAndIsActived3(@Param(value = "channelDataSourceMapIdList") List<Long>channelDataSourceMapIdList,@Param(value = "isActived") String isActived);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.ChannelDataSourceNewMap;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface ChannelDataSourceNewMapDao extends PagingAndSortingRepository<ChannelDataSourceNewMap,Long>,JpaSpecificationExecutor<ChannelDataSourceNewMap> {
List<ChannelDataSourceNewMap> findByChannelId(Long channelId);
List<ChannelDataSourceNewMap> findByDataSourceId(Long dataSourceId);
@Query("select sourceMap.channelDatasourceId from ChannelDataSourceNewMap sourceMap where sourceMap.channelId in (:channelList) and sourceMap.datasourceId in (:dataSourceList)")
public List<Object>findChannelDataSourceMapIdByChannelIdListAndDatasourceIdList(@Param(value = "dataSourceList") List<Long> dataSourceList, @Param(value = "channelList") List<Long> channelList);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.ChannelNew;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ChannelNewDao extends JpaSpecificationExecutor<ChannelNew>,
PagingAndSortingRepository<ChannelNew, Long> {
@Query("from ChannelNew channel where channel.channelId >=0 order by channel.channelId")
List<ChannelNew> findChannel();
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.DataSourceNew;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface DataSourceNewDao extends JpaSpecificationExecutor<DataSourceNew>,
PagingAndSortingRepository<DataSourceNew, Long> {
//由数据来源ID组查找数据
@Query("from DataSourceNew dataSource where dataSource.datasourceId >=0 order by dataSource.datasourceId")
List<DataSourceNew> findDataSource();
}
......@@ -52,4 +52,23 @@ public interface DimKpiDao extends JpaSpecificationExecutor<DimKpi>,
public List<DimKpi> findDimKpiListBykpiIdList(@Param(value = "kpiIdList") List<Long> kpiIdList);
@Query("select dimKpi from DimKpi dimKpi where dimKpi.busnameId in (:busineseids) and dimKpi.kpiTypeId in(:kpitypeid)")
public List<DimKpi> findByBusineseIdsAndBusineseType(@Param(value = "busineseids")List<Long> busineseids,
@Param(value = "kpitypeid")List<Integer> kpitypeid);
@Query(value = "select kpi.name from DimKpi kpi where kpi.kpiId =:kpiid")
public String getKpiNameByKpiid(@Param(value = "kpiid") Long kpiid);
@Query(value = "select kpi.kpiId from DimKpi kpi where kpi.code in (:kpicodes)")
public List<Long> getKpiIdsByKpicodes(@Param(value = "kpicodes") List<String> kpicodes);
@Query(value = "select channel_type from etl.DIM_CHANNEL_KPI_V c where kpi_id =:kpiid",nativeQuery = true)
public String getKpiTypeByKpiId(@Param(value = "kpiid") Integer kpiid);
@Query(value = "select kpi.name from DimKpi kpi where kpi.kpiId in (:kpiIds)")
List<String> getKpiNameBykpiids(@Param(value = "kpiIds") List<Long>kpiIds);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.FaultInfluenceDetailInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.math.BigInteger;
import java.util.List;
/**
* @Description:
* @Author: m01
* @Date: created at 2018/10/18 16:31
* @Modified By:
*/
public interface FaultInfluenceDetailInfoDao
extends JpaSpecificationExecutor<FaultInfluenceDetailInfo>, PagingAndSortingRepository<FaultInfluenceDetailInfo, Integer> {
@Query("select info from FaultInfluenceDetailInfo info where info.influenceId=:influenceId")
public List<FaultInfluenceDetailInfo> findByInfluenceId(@Param(value = "influenceId") Integer influenceId);
@Query(value = "select nextval('ccolap.seq_report_id')", nativeQuery = true)
public BigInteger getNextReportId();
@Query(value = "select info from FaultInfluenceDetailInfo info where info.influenceId =:influenceids order by info.businessTime asc ")
public List<FaultInfluenceDetailInfo> findAllFaultInfluenceDetailInfosByInfluenceId(@Param(value = "influenceids") Integer influenceid);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.FaultInfluenceResultInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
/**
* @Description:
* @Author: m01
* @Date: created at 2018/10/18 16:40
* @Modified By:
*/
public interface FaultInfluenceResultInfoDao
extends JpaSpecificationExecutor<FaultInfluenceResultInfo>, PagingAndSortingRepository<FaultInfluenceResultInfo, Integer> {
@Query(value = "select info from FaultInfluenceResultInfo info")
public List<FaultInfluenceResultInfo> findAll();
@Query(value = "select info from FaultInfluenceResultInfo info where info.reportId=:reportId")
public List<FaultInfluenceResultInfo> findAllByReportId(@Param(value = "reportId") BigInteger reportId);
@Query(value = "select info from FaultInfluenceResultInfo info where info.influenceId=:id")
public FaultInfluenceResultInfo getFaultInfluenceResultInfoByInfluenceId(@Param(value = "id") Integer id);
@Modifying
@Query(value = " insert into CCOLAP.FAULT_INFLUENCE_REPORT_PARA_T" +
"(REPORT_ID,KPI_ID,BUSINESS_START_TIME,BUSINESS_END_TIME,PROVINCE_ID,WORKING_ORDER_CODE) " +
"values(?1,?2,?3,?4,?5,?6)", nativeQuery = true)
int addColumns(Integer reportId,
Long kpiid,
Timestamp begintime,
Timestamp endtime,
String provinceid,
String workingordercode);
@Query(value = "SELECT '渠道:'||channel_name||'省份:'||province_name||',指标:'||kpi_name||',中断开始时间:'||INTERRUPTE_BEGIN_TIME|| ',中断结束时间:'||INTERRUPTE_END_TIME||',中断时长 :'||INTERRUPTE_TIMES||',下降总量:'||INFLUENCE_NUM||',下降比例:'||INFLUENCE_RATE as desc2," +
"channel_name||'-'||kpi_name as kpi_name,INFLUENCE_ID FROM ccolap.FAULT_INFLUENCE_RESULT_INFO_T a ,ccolap.DIM_PROVINCE_INFO_T b,etl.DIM_CHANNEL_KPI_V c WHERE REPORT_ID=:reportId AND INTERRUPTE_BEGIN_TIME IS NOT NULL AND a.kpi_id=c.kpi_id AND a.province_id=b.province_id and a.kpi_id=:kpiId and b.province_id =:provinceId", nativeQuery = true)
List<Object[]> getChartNamesc(@Param(value = "reportId") BigInteger reportId,
@Param(value = "kpiId") Integer kpiId,
@Param(value = "provinceId") Integer provinceId);
@Query(value = "SELECT province_name||'-'||datasource_name||'-'||channel_name||'-'||kpi_name as desc1 ," +
"'指标:'||kpi_name||',中断开始时间:'||INTERRUPTE_BEGIN_TIME|| ',中断结束时间:'||INTERRUPTE_END_TIME||',中断时长 :'||INTERRUPTE_TIMES||',下降总量:'||INFLUENCE_NUM||',下降比例:'||INFLUENCE_RATE as desc2 , " +
" channel_type FROM ccolap.FAULT_INFLUENCE_RESULT_INFO_T a ,ccolap.DIM_PROVINCE_INFO_T b, etl.DIM_CHANNEL_KPI_V c WHERE REPORT_ID=:reportId AND INTERRUPTE_BEGIN_TIME IS NOT NULL AND a.kpi_id=c.kpi_id AND a.province_id=b.province_id", nativeQuery = true)
List<Object[]> getTableValues(@Param(value = "reportId") BigInteger reportId);
@Query(value = "select t.workingOrderTitle from xcd_working_order_info_t t where t.workingOrderCode=:workingOrderCode", nativeQuery = true)
String getXieChaDanNameByBianhao(@Param(value = "workingOrderCode") String workingOrderCode);
@Query(value = "select a.KPI_ID from CCOLAP.FAULT_INFLUENCE_REPORT_PARA_T a where a.REPORT_ID=:reporrId",nativeQuery = true)
List<Long> getKpiidsByReportid(@Param(value = "reporrId") BigInteger reporrId);
@Query(value = "SELECT datasource_name ,channel_name " +
"FROM " +
"ccolap.FAULT_INFLUENCE_RESULT_INFO_T a , " +
"ccolap.DIM_PROVINCE_INFO_T b, " +
"etl.DIM_CHANNEL_KPI_V c " +
"WHERE " +
"REPORT_ID=:reportId " +
"AND INTERRUPTE_BEGIN_TIME IS NOT NULL " +
"AND a.kpi_id=c.kpi_id " +
"AND a.province_id=b.province_id group by datasource_name,channel_name",nativeQuery = true)
List<Object[]> getDatasourceAndChannelForWordtable(@Param(value = "reportId")BigInteger reportId);
}
......@@ -44,11 +44,11 @@ public interface IndexDao extends PagingAndSortingRepository<Stat,Long>,JpaSpeci
/*工作视图两个table*/
//1、待处理的预警和隐患
@Query(value="from XcdWarningInfoView where warningStatus='0' and warningSourceId in (2,3) order by occurTime desc")
@Query(value="from XcdWarningInfoView where warningStatus='0' and warningSourceId in (2,3) order by occurTime desc ")
List<XcdWarningInfoView> findWaringAndRisk();
//2、发出的预警和隐患相关未关闭的协查单
@Query(value="FROM XcdDetailInfoView WHERE ifGeneratedBySystem = 'Y' and ( resolvingStatus <>'关闭' or resolvingStatus is null ) order by eventHappenTime desc")
@Query(value="FROM XcdDetailInfoView WHERE ifGeneratedBySystem = 'Y' and ( resolvingStatus <>'关闭' or resolvingStatus is null ) order by eventHappenTime desc ")
List<XcdDetailInfoView> findXcd();
......
......@@ -29,6 +29,9 @@ public interface KpiDao extends JpaSpecificationExecutor<Kpi>,PagingAndSortingRe
@Query("select kpi.kpiName, kpi.kpiCode from Kpi kpi where kpi.kpiId = :kpiId")
List<Kpi> findKpiCodeAndKpiNameByKpiId(@Param("kpiId") Long kpiId);
@Query("select kpi.kpiName from Kpi kpi where kpi.kpiId = :kpiId")
String findKpiNameByKpiId(@Param("kpiId") Long kpiId);
List<Kpi> findAllByIsActive(String active);
@Query("from Kpi kpi where kpi.kpiId >=0 and kpi.businessId in :businessIdList and kpi.isActive = 'Y'")
......
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.Login;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface LoginDao extends JpaSpecificationExecutor<Login>,PagingAndSortingRepository<Login, Long> {
//查询4A认证开关状态
@Query("select login.flag from Login login where login.id = '1'")
String findFlag();
}
......@@ -25,7 +25,7 @@ public interface ProvinceDao extends JpaSpecificationExecutor<Province>,
List<Province> findByProvinceId(Long provinceId);
@Query("from Province p where p.provinceId>=0 order by p.provinceId")
@Query("from Province p order by p.provinceId")
List<Province> findProvince();
//由集成商,渠道,时间得到省份名称
......
......@@ -24,4 +24,7 @@ public interface UserInfoDao extends PagingAndSortingRepository<UserInfo,Long>,J
UserInfo findByUserName(String userName);
//根据用户ID查找用户
UserInfo findByUserId(Long userId);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.WarningRule;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface WarningRuleDao extends JpaSpecificationExecutor<WarningRule>,
PagingAndSortingRepository<WarningRule, Long>{
//查找一条告警规则
WarningRule findByGjgzId(Long gjgzId);
//批量查找告警规则
List<WarningRule> findByGjgzIdIn(List<Long> gjgzId);
}
......@@ -113,4 +113,8 @@ public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWar
@Param(value = "occurTime") Date occurTime,
@Param(value = "closeTime") Date closeTime);*/
@Query(value = "select infoview from XcdWarningInfoView infoview where infoview.autoWarning =:autoWaring")
List<XcdWarningInfoView> findByAutoWarning(@Param("autoWaring") char autoWaring);
}
......@@ -3,7 +3,9 @@ package com.hp.cmsz.repository;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......@@ -133,4 +135,19 @@ public interface XcdWorkingOrderInfoDao extends PagingAndSortingRepository<XcdW
// @Query(value = "select xc.eventHappenTime,pr.provinceId from Province pr,XcdWorkingOrderInfo
// xc where xc.workingOrderCode=:xiechadanhao and xc.provCode =pr.provinceCode",nativeQuery = true)
@Query(value = "select a.EVENT_HAPPEN_TIME,b.PROVINCE_ID from ccolap.xcd_working_order_info_t a," +
"ccolap.dim_province_info_t b where a.WORKING_ORDER_CODE=?1 and a.PROV_CODE=b.PROVINCE_CODE", nativeQuery = true)
List<Object[]> getTimeAndProvinceIdByXiechadanhao( String xiechadanhao);
@Query(value = "select a.EVENT_HAPPEN_TIME ,a.BUSINESS_RECOVERY_TIME from" +
" ccolap.xcd_working_order_info_t a where a.Working_order_code=?1", nativeQuery = true)
List<Object[]> getBeginTimeAndEndTimeByXiechadanhao( String xiechadanhao);
//2018 12 18 qudao guzhangyuanyin dengji
@Query(value = "select a.suborigin,a.occur_reason,a.priority from ccolap.xcd_working_order_info_t a where a.Working_order_code=?1", nativeQuery = true)
List<Object[]> getTableDetail( String xiechadanhao);
}
......@@ -50,10 +50,18 @@ public interface YwglTagDao extends PagingAndSortingRepository<City, Long>, JpaS
@Query("select distinct(dataSource.dataSourceId), dataSource.dataSourceName from DataSource dataSource,AnalysisTypeDsCMap analysisTypeDsCMap where dataSource.dataSourceId = analysisTypeDsCMap.dataSourceId and analysisTypeDsCMap.analysisTypeId in (:analysisTypeId) and dataSource.dataSourceId>=0 order by dataSource.dataSourceId asc")
List<Object[]> findYwglDataSource(@Param("analysisTypeId")List<Long> analysisTypeId);
//业务规律部分"数据来源"筛选项取值修改替换180619
@Query("select distinct(datasource.datasourceId), datasource.name from DataSourceNew datasource,AnalysisTypeDsCMap analysisTypeDsCMap where datasource.datasourceId = analysisTypeDsCMap.dataSourceId and analysisTypeDsCMap.analysisTypeId in (:analysisTypeId) and datasource.datasourceId>=0 order by datasource.datasourceId asc")
List<Object[]> findYwglData(@Param("analysisTypeId")List<Long> analysisTypeId);
//业务规律部分"渠道"筛选项取值
@Query("select channel.channelId, channel.channelName from Channel channel,AnalysisTypeDsCMap analysisTypeDsCMap where channel.channelId = analysisTypeDsCMap.channelId and analysisTypeDsCMap.dataSourceId in (:dataSourceId) and analysisTypeDsCMap.analysisTypeId in (:analysisTypeId) and channel.channelId>=0 order by channel.channelId")
List<Object[]> findYwglChannel(@Param("analysisTypeId")List<Long> analysisTypeId,@Param("dataSourceId")List<Long> dataSourceId);
//业务规律部分"渠道"筛选项取值修改替换180619
@Query("select channel.channelId, channel.name from ChannelNew channel,AnalysisTypeDsCMap analysisTypeDsCMap where channel.channelId = analysisTypeDsCMap.channelId and analysisTypeDsCMap.dataSourceId in (:dataSourceId) and analysisTypeDsCMap.analysisTypeId in (:analysisTypeId) and channel.channelId>=0 order by channel.channelId")
List<Object[]> findYwglChannelData(@Param("analysisTypeId")List<Long> analysisTypeId,@Param("dataSourceId")List<Long> dataSourceId);
//业务规律部分"指标类型"筛选项取值
@Query("select kpiType.kpiTypeId, kpiType.kpiTypeName from Kpi kpi,KpiType kpiType where kpiType.kpiTypeId = kpi.kpiTypeId and kpi.kpiId in (:kpiId) and kpiType.kpiTypeId>=0 order by kpiType.kpiTypeId")
List<Object[]> findKpiTypeByKpi(@Param("kpiId")List<Long> kpiId);
......
......@@ -64,6 +64,7 @@ public class CustomCredentialsMatcher extends SimpleCredentialsMatcher {
private String encrypt(String data) {
// String sha384Hex = new Sha384Hash(data).toBase64();//这里可以选择自己的密码验证方式
// 比如 md5或者sha256等
//AES方式加解密
return CommonUtil.getDESStr(data);
}
}
......@@ -7,6 +7,7 @@ import java.util.List;
import javax.annotation.PostConstruct;
import com.hp.cmsz.repository.LoginDao;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.shiro.SecurityUtils;
......@@ -18,6 +19,7 @@ import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.pam.UnsupportedTokenException;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.cache.Cache;
......@@ -37,6 +39,10 @@ import com.hp.cmsz.entity.UserInfo;
public class ShiroDbRealm extends AuthorizingRealm {
protected AccountService accountService;
/*
@Autowired
LoginDao loginDao;*/
private static Logger log = LoggerFactory.getLogger(ShiroDbRealm.class);
/**
......@@ -51,23 +57,27 @@ public class ShiroDbRealm extends AuthorizingRealm {
log.info("-username:" + token.getUsername() + "|" + "password:" + CommonUtil.getDESStr(CommonUtil.char2String(token.getPassword())));
UserInfo userinfo = accountService.findUserInfoByLoginName(token.getUsername());
/*//查询4A开关状态
String switchFlag = loginDao.findFlag();*/
JSDES d = new JSDES();
System.out.println(d.strDec(CommonUtil.char2String(token.getPassword()), "venustech_tbu_venus4A","2","3"));
String password = CommonUtil.getDESStr(d.strDec(CommonUtil.char2String(token.getPassword()), "venustech_tbu_venus4A","2","3"));
System.out.println(d.strDec(CommonUtil.char2String(token.getPassword()), "venustech_tbu_venus4A", "2", "3"));
String password = CommonUtil.getDESStr(d.strDec(CommonUtil.char2String(token.getPassword()), "venustech_tbu_venus4A", "2", "3"));
String prompt = null;
if(userinfo == null) {
if (userinfo == null) {
prompt = "用户不存在!";
throw new UnknownAccountException();
}else if(userinfo.getLogLock().equals("0")){ // 0 禁用 1 启用
} else if (userinfo.getLogLock().equals("0")) { // 0 禁用 1 启用
prompt = "该用户已经被禁用!";
throw new LockedAccountException();
} else {
}/* else if (switchFlag.equals("0")) {
prompt = "该平台系统已经被4A接管,请从4A平台登录!";
throw new UnsupportedTokenException();
}*/ else {
SecurityUtils.getSubject().logout();
prompt = "success";
SecurityUtils.getSubject().getSession().setAttribute("CURRENT_USER_SESSION", userinfo);
return new SimpleAuthenticationInfo(new ShiroUser(userinfo.getUserId(),userinfo.getUserName(),userinfo.getStaffname()),userinfo.getPassword(),getName());
return new SimpleAuthenticationInfo(new ShiroUser(userinfo.getUserId(), userinfo.getUserName(), userinfo.getStaffname()), userinfo.getPassword(), getName());
}
}
......
......@@ -83,6 +83,7 @@ public class TSWBAnalysisService {
startTime = temp.getTime();
temp.setTime(endTime);
temp.set(Calendar.DATE, temp.getActualMaximum(Calendar.DATE));
temp.set(Calendar.HOUR, 23);
temp.set(Calendar.MINUTE, 59);
temp.set(Calendar.SECOND, 59);
temp.set(Calendar.MILLISECOND, 59);
......
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.WarningRule;
import com.hp.cmsz.repository.WarningRuleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
@Service
@Transactional
public class WarningRuleService {
@Autowired
private WarningRuleDao warningRuleDao;
@PersistenceContext
EntityManager em;
//生成分页
public Page<WarningRule> getQualityRuleInfoPage(WarningRule warningRule, int pageNumber, int pageSize, String sortType) {
PageRequest pageRequest = buildPageRequest(pageNumber, pageSize, sortType, "qualityRuleId");
return warningRuleDao.findAll(pageRequest);
}
/**
* 创建分页请求.
*/
private PageRequest buildPageRequest(int pageNumber, int pagzSize, String sortType, String sortFiled) {
Sort sort = new Sort(Sort.Direction.DESC, sortFiled);
return new PageRequest(pageNumber - 1, pagzSize, sort);
}
public List getData(String jhql) {
List dataList = em.createNativeQuery(jhql).getResultList();
em.close();
return dataList;
}
}
......@@ -58,8 +58,7 @@ public class KnowledgeService {
public void setSocketAddress(String socketAddress){
this.socketAddress = socketAddress;
}*/
public Client client = new TransportClient().addTransportAddress(
new InetSocketTransportAddress("192.168.113.112", 9300));
public Client client =null;// new TransportClient().addTransportAddress(new InetSocketTransportAddress("192.168.113.112", 9300));
/*public Client client = new TransportClient().addTransportAddress(
new InetSocketTransportAddress("127.0.0.1", 9300));*/
......@@ -84,10 +83,12 @@ public class KnowledgeService {
//新增知识库记录
public void createKnowledge(Knowledge knowledge) {
try {
XContentBuilder doc = getKnowledgeSource(knowledge);
IndexResponse response = client.prepareIndex("cmsz", "knowledge").setRefresh(true).setSource(doc).execute().actionGet();
} catch (IOException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
......@@ -214,7 +215,7 @@ public class KnowledgeService {
}
SearchRequestBuilder searchBuilder = client.prepareSearch("cmsz").setTypes("knowledge").setQuery(query)
.addFields("knowledgeId", "summary", "keyword", "content", "sourceId", "knowledgeType","documentType",
.addFields("knowledgeId", "summary", "keyword", "content", "sourceId", "knowledgeType", "documentType",
"publishDate", "validDate", "crtUser", "crtDate", "firstFilePath", "firstFileName",
"secondFilePath", "secondFileName", "thirdFilePath", "thirdFileName", "fourthFilePath",
"fourthFileName", "fifthFilePath", "fifthFileName", "provinceId").addHighlightedField("summary").addHighlightedField("content")
......@@ -295,13 +296,13 @@ public class KnowledgeService {
knowledge.setDocumentType((String) fields.get("documentType"));
}
if (fields.get("publishDate") != null) {
System.out.println("publishDate="+fields.get("publishDate"));
System.out.println("convertDate((String) publishDate="+convertDate((String) fields.get("publishDate")));
System.out.println("publishDate=" + fields.get("publishDate"));
System.out.println("convertDate((String) publishDate=" + convertDate((String) fields.get("publishDate")));
knowledge.setPublishDate(convertDate((String) fields.get("publishDate")));
}
if (fields.get("validDate") != null) {
System.out.println("validDate="+fields.get("validDate"));
System.out.println("convertDate((String) validDate="+convertDate((String) fields.get("validDate")));
System.out.println("validDate=" + fields.get("validDate"));
System.out.println("convertDate((String) validDate=" + convertDate((String) fields.get("validDate")));
knowledge.setValidDate(convertDate((String) fields.get("validDate")));
}
if (fields.get("crtUser") != null) {
......@@ -479,6 +480,7 @@ public class KnowledgeService {
value = StringUtils.replace(value, "</span><span style='color:red'>", "");
return value;
}
private Date convertDate(String esDate) {
String date = esDate.substring(0, 10);
String time = esDate.substring(11, 19);
......@@ -572,7 +574,8 @@ public class KnowledgeService {
/*if (read == -1) {
return charset; //文件编码为 ANSI
} else*/if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) {
} else*/
if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) {
result = false; //文件编码为 Unicode
} else if (first3Bytes[0] == (byte) 0xFE && first3Bytes[1] == (byte) 0xFF) {
result = false; //文件编码为 Unicode big endian
......@@ -594,8 +597,8 @@ public class KnowledgeService {
}
private String formatSpecialCharacter(String content) {
String[] specialCharacterArray = { "\\", "+", "-", "&", "|", "!", "(", ")", "{", "}", "[", "]", "^", "~", "*",
"?", ":", "%" };
String[] specialCharacterArray = {"\\", "+", "-", "&", "|", "!", "(", ")", "{", "}", "[", "]", "^", "~", "*",
"?", ":", "%"};
for (String character : specialCharacterArray) {
if (StringUtils.contains(content, character)) {
content = StringUtils.replace(content, character, "\\" + character);
......
......@@ -8,10 +8,8 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
......@@ -19,6 +17,8 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.hp.cmsz.commons.utils.*;
import com.hp.cmsz.entity.Login;
import com.hp.cmsz.repository.LoginDao;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.shiro.SecurityUtils;
......@@ -54,6 +54,7 @@ import com.hp.cmsz.service.authoritymanage.AuthorityManageService;
public class IndexController {
private static Logger log = LoggerFactory.getLogger(IndexController.class);
@Autowired
private AccountService accountService;
......@@ -65,55 +66,23 @@ public class IndexController {
private IndexService indexService;
@Autowired
private LoginDao loginDao;
@Autowired
private CmszOperationLogService cmszOperationLogService;
@RequestMapping(method = RequestMethod.GET)
public String login(
/*
* @RequestParam("username") String username,
*
* @RequestParam("password") String password,
*/
HttpServletRequest request, Map map) throws IOException {
/*
* username=java.net.URLDecoder.decode(username, "UTF-8");//一次解码
* password = java.net.URLDecoder.decode(password, "UTF-8");//一次解码
* System.out.println(IPUtils.getIpAddress(request)); String user_ip =
* IPUtils.getIpAddress(request); if (user_ip.substring(0,
* 7).equals("192.168") || user_ip.equals("127.0.0.1")) { //内网网段 //开关标志位
* 0 打开 1 关闭 if(accountService.getLoginModelSwitch().equals("1"))
* {//关闭4A认证,交由本地认证 String prompt = ""; UserInfo userInfo =
* authorityManageService.getUserInfoByUserName(username); if(userInfo
* == null) { prompt = "该用户不存在!"; }else
* if(userInfo.getLogLock().equals("0")){ // 0 禁用 1 启用 prompt =
* "该用户已经被禁用!"; } else
* if(!authorityManageService.entryptPassword(password
* ).equals(userInfo.getPassword())) { prompt = "你输入的密码不正确!"; } else {
* prompt = "success"; }
*
* } else { //通过4A认证
*
* }
*
* } else { //外网网段,通过4A认证
*
* }
*/
map.put("loginState", "loginSuccess");
UserInfo userinfo = (UserInfo) SecurityUtils.getSubject().getSession()
.getAttribute("CURRENT_USER_SESSION");
if (userinfo != null) {
cmszOperationLogService.createLog("访问", "首页",
userinfo.getStaffname() + "访问首页");
}
// Add by Huach on 20140803 begin
// return PageURLController.index;
return nextUrl(request);
// Add by Huach on 20140803 end
return PageURLController.index;
}
......@@ -126,10 +95,11 @@ public class IndexController {
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM,
userName);
map.put("loginState", "loginFail");
System.out.println("fail的request:"+request);
// Add by Huach on 20140803 begin
// return PageURLController.index;
return PageURLController.index;
return nextUrl(request);
// return nextUrl(request);
// Add by Huach on 20140803 end
}
......@@ -194,7 +164,7 @@ public class IndexController {
}
// 右上角中的数据实时刷新
@RequestMapping(value = "/table1/*", method = RequestMethod.GET)
/*@RequestMapping(value = "/table1/*", method = RequestMethod.GET)
public void tableData1(HttpServletResponse response,
HttpServletRequest request) {
List<XcdWarningInfoView> warningDetail = indexService
......@@ -250,7 +220,7 @@ public class IndexController {
} finally {
out.close();
}
}
}*/
// Function to do authentication by huach on 20140803 begin
private String validToken(String[] paras) {
......@@ -259,6 +229,7 @@ public class IndexController {
try {
strURL = PropertiesUtil.readValue(Constant.CONFIG_FILE,
Constant.URL_FOR_LOGIN_FROM_4A);
System.out.println("strURL:"+strURL);
} catch (IOException e1) {
log.info("get 4A URL error");
log.error(e1.getMessage());
......@@ -382,7 +353,7 @@ public class IndexController {
// 强制退出认证
request.getSession().setAttribute(
Constant.CURRENT_USER_SESSION, null);
return PageURLController.index;
return PageURLController.notFourA;
}
}
} else {
......
......@@ -16,6 +16,9 @@ public class PageURLController {
public static final String AUTO_LOGIN_PAGE="AutoLogin";//"forward:/index";/
//add by Huach for 4A on 20140804 end
//通过4A登录的提示页面
public static String notFourA="NotFourA";
//分析支撑下的业务特征分析下的地市热点
//通过ServiceFeatureAnalysis映射到WEB-INF/views下的AnalysisSupport/ServiceFeatureAnalysis.jsp页面
public static String ServiceFeatureAnalysis="AnalysisSupport/ServiceFeatureAnalysis";
......@@ -59,6 +62,7 @@ public class PageURLController {
//WarnAnalysis映射到WEB-INF/views下的MonitorOperation/WorkingOrderAnalysis.jsp页面
public static String WorkingOrderAnalysis="MonitorOperation/WorkingOrderAnalysis";
public static String CustomAnalysis="MonitorOperation/CustomAnalysis";
public static String CustomAnalysisUpdate="MonitorOperation/CustomAnalysisUpdate";
//监控运营下的故障页面 | author:August
//监控运营下的故障分析
......@@ -204,9 +208,16 @@ public class PageURLController {
public static String RuleOperation = "AnalysisSupport/QualityRuleOperation";
public static String RuleReport = "AnalysisSupport/QualityRuleReport";
//运营支撑下的告警规则配置
public static String WarningRuleResult = "AnalysisSupport/WarningRuleResult";
public static String WarningRuleConfiguration = "AnalysisSupport/WarningRuleConfiguration";
public static String WarningRuleUpdate = "AnalysisSupport/WarningRuleUpdate";
//基础管理
//AuthorityManage映射到WEB-INF/views下的AuthorityManage/AuthorityManage.jsp页面
public static String AuthorityManage="AuthorityManage/AuthorityManage";
public static String UserManage="AuthorityManage/CreateUser";
public static String ModifyUserManage="AuthorityManage/ModifyUser";
//Add by Huach on 20140715 begin
......
package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.IpUtil;
import com.hp.cmsz.commons.utils.SyslogUtil;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
......@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -137,9 +140,6 @@ public class FilterRuleConfigurationController {
@RequestParam(value="filterReason") String filterReason,
HttpServletRequest request, HttpServletResponse response){
ifRepeate = ifRepeate.equals("0")?"1":"0";
FilterRule filterRule = filterRuleDao.findAllBywarningFilteringRuleId(Long.parseLong(ruleId));
filterRule.setFilteringEndTime(Timestamp.valueOf(filterEndTime));
......@@ -163,6 +163,46 @@ public class FilterRuleConfigurationController {
}else{
filterRule.setFrequency(null);
}
//向4A发送审计日志
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ip = IpUtil.getIpAddress(request);
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\""+ip+"\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"新增\"" + " ");
buffer.append("content=" + "\"新增过滤规则资源成功\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"预分析与建模\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
filterRuleDao.save(filterRule);
}
......
package com.hp.cmsz.web.analysissupport;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.IpUtil;
import com.hp.cmsz.commons.utils.SyslogUtil;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
......@@ -149,6 +152,46 @@ public class FilterRuleMaintainController {
filterRules.add(filterRule);
}
}
//向4A发送审计日志
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ip = IpUtil.getIpAddress(request);
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\""+ip+"\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"新增\"" + " ");
buffer.append("content=" + "\"新增过滤规则资源成功\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"预分析与建模\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
filterRuleService.insertIntoRule(filterRules);
}
......
......@@ -3,12 +3,12 @@ package com.hp.cmsz.web.analysissupport;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.IpUtil;
import com.hp.cmsz.commons.utils.SyslogUtil;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import com.hp.cmsz.web.PageURLController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
......@@ -107,8 +108,8 @@ public class FilterRuleResultController {
String provinceArr,
String businessArr,
String isRepeat,
HttpServletResponse response){
HttpServletResponse response,
HttpServletRequest request){
List<FilterRule> filterRuleList = null;
List<Long> kpi = new ArrayList<Long>();
......@@ -159,7 +160,47 @@ public class FilterRuleResultController {
// Timestamp time1 = Timestamp.valueOf(startTime);
// Timestamp time2 = Timestamp.valueOf(endTime);
//向4A发送审计日志
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ip = IpUtil.getIpAddress(request);
StringBuffer buffer = new StringBuffer();
buffer.append("class=" + "\"CMSZMONITORANALYSIS\"" + " ");
buffer.append("type=" + "\"3\"" + " ");
buffer.append("time=" + "\""+sdf.format(new Date())+"\"" + " ");
buffer.append("src_ip=" + "\""+ ip +"\"" + " ");
buffer.append("dst_ip=" + "\"192.168.113.120\"" + " ");
buffer.append("src_port=" + "\"8080\"" + " ");
buffer.append("dst_port=" + "\"8080\"" + " ");
buffer.append("src_mac=" + "\"00:15:C5:79:7E:F7\"" + " ");
buffer.append("dst_mac=" + "\"00:E0:FC:57:E2:13\"" + " ");
buffer.append("protocol=" + "\"HTTP\"" + " ");
buffer.append("primary_user=" + "\"guoxd\"" + " ");
buffer.append("secondary_user=" + "\"admin\"" + " ");
buffer.append("operation=" + "\"查询\"" + " ");
buffer.append("content=" + "\"查询过滤规则资源成功\""+ " ");
buffer.append("sensitive_name=" + "\"\"" + " ");
buffer.append("sensitive_range=" + "\"\"" + " ");
buffer.append("sensitive_type=" + "\"\"" + " ");
buffer.append("is_remark=" + "\"0\"" + " ");
buffer.append("remark_type=" + "\"\"" + " ");
buffer.append("remark_code=" + "\"\"" + " ");
buffer.append("menuname=" + "\"预分析与建模\"" + " ");
buffer.append("menucode=" + "\"\"" + " ");
buffer.append("log_level=" + "\"1\"" + " ");
buffer.append("session_id=" + "\"\"" + " ");
buffer.append("param_len=" + "\"\"" + " ");
buffer.append("param=" + "\"\"" + " ");
buffer.append("result_status=" + "\"1\"");
SyslogUtil log2 = new SyslogUtil();
System.out.println("传输的buffer:"+buffer);
try {
log2.sendSyslog("192.168.83.221",51455,buffer.toString());
} catch (IOException e) {
e.printStackTrace();
System.out.println("发送日志异常:"+e);
}
return filterRuleList;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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