Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
dd6cb7d5
Commit
dd6cb7d5
authored
Nov 13, 2016
by
季圣华
Browse files
整理代码1
parent
631361fc
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/com/jsh/junitest/json/CableStream.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.json
;
import
java.io.Serializable
;
@SuppressWarnings
(
"serial"
)
public
class
CableStream
implements
Serializable
{
/**
* ID
*/
private
Long
id
;
/**
* 频点频率
*/
private
Integer
cablehz
;
/**
* 符号率
*/
private
Integer
symbolrate
;
/**
* 调制方式
*/
private
Integer
cableMode
;
/**
* 传输编号
*/
private
Integer
transNum
;
/**
* 服务编号
*/
private
Integer
serviceNum
;
/**
* 码率
*/
private
Float
rate
;
/**
* 规格
*/
private
Short
cablenorms
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Integer
getCablehz
()
{
return
cablehz
;
}
public
void
setCablehz
(
Integer
cablehz
)
{
this
.
cablehz
=
cablehz
;
}
public
Integer
getSymbolrate
()
{
return
symbolrate
;
}
public
void
setSymbolrate
(
Integer
symbolrate
)
{
this
.
symbolrate
=
symbolrate
;
}
public
Integer
getCableMode
()
{
return
cableMode
;
}
public
void
setCableMode
(
Integer
cableMode
)
{
this
.
cableMode
=
cableMode
;
}
public
Integer
getTransNum
()
{
return
transNum
;
}
public
void
setTransNum
(
Integer
transNum
)
{
this
.
transNum
=
transNum
;
}
public
Integer
getServiceNum
()
{
return
serviceNum
;
}
public
void
setServiceNum
(
Integer
serviceNum
)
{
this
.
serviceNum
=
serviceNum
;
}
public
Float
getRate
()
{
return
rate
;
}
public
void
setRate
(
Float
rate
)
{
this
.
rate
=
rate
;
}
public
Short
getCablenorms
()
{
return
cablenorms
;
}
public
void
setCablenorms
(
Short
cablenorms
)
{
this
.
cablenorms
=
cablenorms
;
}
}
\ No newline at end of file
src/com/jsh/junitest/json/Channel.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.json
;
import
java.io.Serializable
;
import
java.util.List
;
@SuppressWarnings
(
"serial"
)
public
class
Channel
implements
Serializable
{
/**
* 频道ID
*/
private
Long
id
;
/**
* 频道名称
*/
private
String
channelName
;
/**
* 分类
*/
private
Long
category
;
/**
* 台标路径
*/
private
String
tvLogo
;
/**
* 地区
*/
private
Long
area
;
/**
* 频道类型 0==直播 1==虚拟
*/
private
Short
type
;
/**
* json字符串
*/
private
String
ipStreamJson
;
/**
* ip流列表
*/
private
List
<
IPStream
>
ipStream
;
/**
* json字符串
*/
private
String
cableStreamJson
;
/**
* cable流列表
*/
private
List
<
CableStream
>
cableStream
;
public
Channel
()
{
super
();
}
public
Channel
(
String
channelName
,
Long
category
,
String
tvLogo
,
Long
area
,
Short
type
,
String
ipStreamJson
,
List
<
IPStream
>
ipStream
,
String
cableStreamJson
,
List
<
CableStream
>
cableStream
)
{
super
();
this
.
channelName
=
channelName
;
this
.
category
=
category
;
this
.
tvLogo
=
tvLogo
;
this
.
area
=
area
;
this
.
type
=
type
;
this
.
ipStreamJson
=
ipStreamJson
;
this
.
ipStream
=
ipStream
;
this
.
cableStreamJson
=
cableStreamJson
;
this
.
cableStream
=
cableStream
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getChannelName
()
{
return
channelName
;
}
public
void
setChannelName
(
String
channelName
)
{
this
.
channelName
=
channelName
;
}
public
Long
getCategory
()
{
return
category
;
}
public
void
setCategory
(
Long
category
)
{
this
.
category
=
category
;
}
public
String
getTvLogo
()
{
return
tvLogo
;
}
public
void
setTvLogo
(
String
tvLogo
)
{
this
.
tvLogo
=
tvLogo
;
}
public
Long
getArea
()
{
return
area
;
}
public
void
setArea
(
Long
area
)
{
this
.
area
=
area
;
}
public
Short
getType
()
{
return
type
;
}
public
void
setType
(
Short
type
)
{
this
.
type
=
type
;
}
public
List
<
IPStream
>
getIpStream
()
{
return
ipStream
;
}
public
void
setIpStream
(
List
<
IPStream
>
ipStream
)
{
this
.
ipStream
=
ipStream
;
}
public
List
<
CableStream
>
getCableStream
()
{
return
cableStream
;
}
public
void
setCableStream
(
List
<
CableStream
>
cableStream
)
{
this
.
cableStream
=
cableStream
;
}
public
String
getIpStreamJson
()
{
return
ipStreamJson
;
}
public
void
setIpStreamJson
(
String
ipStreamJson
)
{
this
.
ipStreamJson
=
ipStreamJson
;
}
public
String
getCableStreamJson
()
{
return
cableStreamJson
;
}
public
void
setCableStreamJson
(
String
cableStreamJson
)
{
this
.
cableStreamJson
=
cableStreamJson
;
}
}
src/com/jsh/junitest/json/ChannelUtil.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.json
;
import
java.util.ArrayList
;
import
java.util.List
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
public
class
ChannelUtil
{
/**
* 解析页面json字符串为IPStream对象列表
* @param ipStreamStr json字符串
* @return IPStream对象列表
*/
public
static
List
<
IPStream
>
parseJson2IPStream
(
String
ipStreamStr
)
{
List
<
IPStream
>
ipList
=
new
ArrayList
<
IPStream
>();
JSONArray
ipJson
=
JSONObject
.
fromObject
(
ipStreamStr
).
getJSONArray
(
"ipJsonData"
);
if
(
null
!=
ipJson
)
{
for
(
int
i
=
0
;
i
<
ipJson
.
size
();
i
++)
{
JSONObject
tempJson
=
JSONObject
.
fromObject
(
ipJson
.
get
(
i
));
IPStream
ip
=
new
IPStream
();
ip
.
setIPformat
(
Short
.
parseShort
(
tempJson
.
getString
(
"ipFomate"
)));
ip
.
setIPnorms
(
Short
.
parseShort
(
tempJson
.
getString
(
"IPnorms"
)));
ip
.
setIPUrl
(
tempJson
.
getString
(
"IPAddress"
));
ip
.
setPort
(
tempJson
.
getInt
(
"port"
));
ip
.
setProtocol
(
Short
.
parseShort
(
tempJson
.
getString
(
"protocol"
)));
ip
.
setRate
(
Float
.
parseFloat
(
tempJson
.
getString
(
"iprate"
)));
ip
.
setType
(
Short
.
parseShort
(
tempJson
.
getString
(
"inOrout"
)));
ipList
.
add
(
ip
);
}
}
return
ipList
;
}
/**
* 解析页面json字符串为cableStream对象列表
* @param cableStreamStr json字符串
* @return cableStream对象列表
*/
public
static
List
<
CableStream
>
parseJson2CableStream
(
String
cableStreamStr
)
{
List
<
CableStream
>
cableList
=
new
ArrayList
<
CableStream
>();
JSONArray
cableJson
=
JSONObject
.
fromObject
(
cableStreamStr
).
getJSONArray
(
"cableJsonData"
);
if
(
null
!=
cableJson
)
{
for
(
int
i
=
0
;
i
<
cableJson
.
size
();
i
++)
{
JSONObject
tempJson
=
JSONObject
.
fromObject
(
cableJson
.
get
(
i
));
CableStream
cable
=
new
CableStream
();
cable
.
setCablehz
(
tempJson
.
getInt
(
"cablehz"
));
cable
.
setCableMode
(
tempJson
.
getInt
(
"cableMode"
));
cable
.
setCablenorms
(
Short
.
parseShort
(
tempJson
.
getString
(
"cablenorms"
)));
cable
.
setRate
(
Float
.
parseFloat
(
tempJson
.
getString
(
"cablerate"
)));
cable
.
setServiceNum
(
tempJson
.
getInt
(
"serviceNum"
));
cable
.
setSymbolrate
(
tempJson
.
getInt
(
"symbolrate"
));
cable
.
setTransNum
(
tempJson
.
getInt
(
"transNum"
));
cableList
.
add
(
cable
);
}
}
return
cableList
;
}
public
static
void
main
(
String
[]
args
)
{
String
ipStreamStr
=
"{ipJsonData : [{\"iprate\":\"512.00\",\"IPnorms\":\"0\",\"ipFomate\":\"0\",\"inOrout\":\"0\",\"port\":\"512\",\"IPAddress\":\"11.03.12.23\",\"protocol\":\"0\",\"ipJsonIndex\":0}]}"
;
ChannelUtil
.
parseJson2IPStream
(
ipStreamStr
);
String
cableStreamStr
=
"{cableJsonData:[{\"cablenorms\":\"0\",\"cablerate\":\"54\",\"serviceNum\":\"45\",\"transNum\":\"57\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"45\",\"cableJsonIndex\":0},{\"cablenorms\":\"0\",\"cablerate\":\"548\",\"serviceNum\":\"236\",\"transNum\":\"256\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"85\",\"cableJsonIndex\":1}]}"
;
ChannelUtil
.
parseJson2CableStream
(
cableStreamStr
);
}
}
src/com/jsh/junitest/json/IPStream.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.json
;
import
java.io.Serializable
;
@SuppressWarnings
(
"serial"
)
public
class
IPStream
implements
Serializable
{
/**
* ID
*/
private
Long
id
;
/**
* 协议
*/
private
Short
protocol
;
/**
*IP地址
*/
private
String
IPUrl
;
/**
* 端口
*/
private
Integer
port
;
/**
* 类型--输入输出 0==输入 1==输出
*/
private
Short
type
;
/**
* 视频格式
*/
private
Short
IPformat
;
/**
* 视频规格 0==标清 1==高清
*/
private
Short
IPnorms
;
/**
* 码率
*/
private
Float
rate
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Short
getProtocol
()
{
return
protocol
;
}
public
void
setProtocol
(
Short
protocol
)
{
this
.
protocol
=
protocol
;
}
public
String
getIPUrl
()
{
return
IPUrl
;
}
public
void
setIPUrl
(
String
iPUrl
)
{
IPUrl
=
iPUrl
;
}
public
Integer
getPort
()
{
return
port
;
}
public
void
setPort
(
Integer
port
)
{
this
.
port
=
port
;
}
public
Short
getType
()
{
return
type
;
}
public
void
setType
(
Short
type
)
{
this
.
type
=
type
;
}
public
Short
getIPformat
()
{
return
IPformat
;
}
public
void
setIPformat
(
Short
iPformat
)
{
IPformat
=
iPformat
;
}
public
Short
getIPnorms
()
{
return
IPnorms
;
}
public
void
setIPnorms
(
Short
iPnorms
)
{
IPnorms
=
iPnorms
;
}
public
Float
getRate
()
{
return
rate
;
}
public
void
setRate
(
Float
rate
)
{
this
.
rate
=
rate
;
}
}
src/com/jsh/junitest/json/JsonTest.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.json
;
import
junit.framework.TestCase
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
public
class
JsonTest
extends
TestCase
{
public
void
testJson
()
{
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
8
);
JSONArray
json
=
new
JSONArray
();
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
JSONObject
jo
=
new
JSONObject
();
jo
.
put
(
"name"
,
"andy"
+
i
);
jo
.
put
(
"sex"
,
"false"
+
i
);
json
.
add
(
jo
);
}
outer
.
put
(
"rows"
,
json
);
System
.
out
.
println
(
outer
.
toString
());
}
}
src/com/jsh/junitest/spring/SpringTest.java
deleted
100644 → 0
View file @
631361fc
package
com.jsh.junitest.spring
;
import
junit.framework.TestCase
;
public
class
SpringTest
extends
TestCase
{
public
static
void
main
(
String
[]
args
)
{
// @SuppressWarnings({ "unchecked", "rawtypes" })
// public BaseService()
// {
// // //加载 已经加载过的 spring配置文件内容
// // WebApplicationContext wac =
// // ContextLoader.getCurrentWebApplicationContext();
// // // wac.getBean(beanID);
// // ApplicationContext factory = new
// // ClassPathXmlApplicationContext("spring/*-applicationContext.xml");
// // ApplicationContext factory = new ClassPathXmlApplicationContext(new
// // String[]{"spring/basic-applicationContext.xml",
// // "spring/dao-applicationContext.xml"});
// // this.baseDao = (BaseIDAO) factory.getBean("baseDao");
// // // this.baseDao =
// // ((BaseIDAO)BeanFactoryUtil.getBeanByClassPathAndBeanName("spring/dao-applicationContext.xml",
// // "baseDao"));
// BeanFactoryUtil util = BeanFactoryUtil.getInstance();
//
// this.baseDao = ((BaseIDAO<T>) util.getBean("baseDao"));
//// ApplicationContext factory = new ClassPathXmlApplicationContext(new
//// String[]{"spring/basic-applicationContext.xml",
//// "spring/dao-applicationContext.xml"});
//// this.baseDao = (BaseIDAO) factory.getBean("baseDao");
// Class c = getEntityClass();
// setPoJoClass(c);
// }
}
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment