切换导航条
此项目
正在载入...
登录
zhangFan
/
analysis_imf
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
zhangFan
6 years ago
提交
79d88c995f4e45cf9265cc8f5bed522e29d56121
1 个父辈
eebba7af
kakoIMF check some message
显示空白字符变更
内嵌
并排对比
正在显示
15 个修改的文件
包含
269 行增加
和
80 行删除
pom.xml
src/main/java/com/sy/IMF/KAKO_Reader.java
src/main/java/com/sy/bwAnalysis/AnalysisRoute.java
src/main/java/com/sy/bwAnalysis/CommandInfoAnalysis.java
src/main/java/com/sy/bwAssist/CommandInfo.java
src/main/java/com/sy/bwAssist/Seal.java
src/main/java/com/sy/crossDomain/buildBarCode.java
src/main/java/com/sy/logic/LogicOperation.java
src/main/java/com/sy/mapper/LandBusinessTypeListMapper.java
src/main/java/com/sy/model/LandBusinessTypeList.java
src/main/java/com/sy/service/impl/LandBusListServiceImpl.java
src/main/java/com/sy/service/impl/LandRoadVeServiceImpl.java
src/main/java/com/sy/socket/CommandClient.java
src/main/java/com/sy/utils/FileTool.java
src/main/resources/application.properties
pom.xml
查看文件 @
79d88c9
...
...
@@ -96,6 +96,12 @@
<version>
1.2.47
</version>
</dependency>
<!-- 二维码 -->
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<version>
3.3.0
</version>
</dependency>
<!--IMF need jar-->
<dependency>
...
...
src/main/java/com/sy/IMF/KAKO_Reader.java
查看文件 @
79d88c9
...
...
@@ -22,8 +22,7 @@ public class KAKO_Reader extends Thread{
String
message
=
this
.
client
.
getMSG
();
if
(
message
!=
null
)
{
logger
.
info
(
message
);
AnalysisRoute
route
=
new
AnalysisRoute
();
route
.
analysis
(
message
);
AnalysisRoute
.
analysis
(
message
);
}
}
else
{
...
...
src/main/java/com/sy/bwAnalysis/AnalysisRoute.java
查看文件 @
79d88c9
...
...
@@ -32,6 +32,9 @@ public class AnalysisRoute {
@Autowired
private
CommandInfoService
commandService
;
@Autowired
private
LandBusListService
listService
;
private
static
AnalysisRoute
route
;
private
static
MessageAnalysis
analysis
=
new
MessageAnalysis
();
...
...
@@ -51,9 +54,10 @@ public class AnalysisRoute {
route
.
gatService
=
this
.
gatService
;
route
.
infoService
=
this
.
infoService
;
route
.
commandService
=
this
.
commandService
;
route
.
listService
=
this
.
listService
;
}
public
void
analysis
(
String
string
)
{
public
static
void
analysis
(
String
string
)
{
Message
message
=
analysis
.
readTicketsXml
(
string
);
String
stype
=
message
.
getMeta
().
getSmType
();
if
(
stype
.
equals
(
"CARM"
))
{
...
...
@@ -62,8 +66,9 @@ public class AnalysisRoute {
route
.
commandService
.
save
(
info
);
}
else
{
GatherInfo
info
=
gatherInfoAnalysis
.
toJavaBean
(
message
);
if
(
LogicOperation
.
operation
(
info
)){
}
route
.
infoService
.
save
(
info
);
LogicOperation
.
operation
(
info
);
}
}
else
if
(
stype
.
equals
(
"ES1"
))
{
airone_ex_stock
exStock
=
exStockAnalysis
.
toExStock
(
message
);
...
...
src/main/java/com/sy/bwAnalysis/CommandInfoAnalysis.java
查看文件 @
79d88c9
...
...
@@ -22,6 +22,7 @@ public class CommandInfoAnalysis {
bean
.
setChnlNo
(
info
.
getCHNL_NO
());
bean
.
setiEType
(
info
.
getI_E_TYPE
());
bean
.
setSeqNo
(
info
.
getSEQ_NO
());
bean
.
setCheckResult
(
info
.
getCheckResult
());
bean
.
setEsealId
(
info
.
getSeal
().
getEsealId
());
bean
.
setSealKey
(
info
.
getSeal
().
getSealKey
());
bean
.
setVeName
(
info
.
getGps
().
getVeName
());
...
...
src/main/java/com/sy/bwAssist/CommandInfo.java
查看文件 @
79d88c9
...
...
@@ -34,6 +34,9 @@ public class CommandInfo {
@XStreamAlias
(
"SEAL"
)
private
Seal
seal
;
@XStreamAlias
(
"SZ_MSG"
)
private
Seal
seMsg
;
public
String
getAREA_ID
()
{
...
...
@@ -106,4 +109,12 @@ public class CommandInfo {
public
void
setFormId
(
String
formId
)
{
this
.
formId
=
formId
;
}
public
Seal
getSeMsg
()
{
return
seMsg
;
}
public
void
setSeMsg
(
Seal
seMsg
)
{
this
.
seMsg
=
seMsg
;
}
}
...
...
src/main/java/com/sy/bwAssist/Seal.java
查看文件 @
79d88c9
...
...
@@ -14,6 +14,12 @@ public class Seal {
@XStreamAlias
(
"CONTA_NUM"
)
private
String
countNum
;
@XStreamAlias
(
"OPEN_TIMES"
)
private
String
openTimes
;
@XStreamAlias
(
"ESEAL_IC_NO"
)
private
String
EsealIdNo
;
public
String
getEsealId
()
{
return
EsealId
;
...
...
@@ -38,6 +44,22 @@ public class Seal {
public
void
setCountNum
(
String
countNum
)
{
this
.
countNum
=
countNum
;
}
public
String
getOpenTimes
()
{
return
openTimes
;
}
public
void
setOpenTimes
(
String
openTimes
)
{
this
.
openTimes
=
openTimes
;
}
public
String
getEsealIdNo
()
{
return
EsealIdNo
;
}
public
void
setEsealIdNo
(
String
esealIdNo
)
{
EsealIdNo
=
esealIdNo
;
}
}
...
...
src/main/java/com/sy/crossDomain/buildBarCode.java
0 → 100644
查看文件 @
79d88c9
package
com
.
sy
.
crossDomain
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.Map
;
@Component
public
class
buildBarCode
{
private
static
String
CREATEBARCODE
=
"http://10.50.7.11:8088/publiclogistics/createVehicleBarCode"
;
private
static
String
CANCLEBARCODE
=
"http://10.50.7.11:8088/publiclogistics/cancelVehicleBarCode"
;
// 发送数据并接收返回数据
public
static
String
sendData
(
String
url
,
String
json
)
{
StringBuilder
str
=
new
StringBuilder
();
BufferedReader
bf
=
null
;
OutputStreamWriter
writer
=
null
;
try
{
URL
Url
=
new
URL
(
url
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
Url
.
openConnection
();
conn
.
setDoInput
(
true
);
conn
.
setDoOutput
(
true
);
conn
.
setRequestProperty
(
"X-Rrquested-With"
,
"XMLHttpRequest"
);
conn
.
setRequestProperty
(
"Connection"
,
"keep-alive"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
conn
.
setRequestMethod
(
"POST"
);
conn
.
connect
();
writer
=
new
OutputStreamWriter
(
conn
.
getOutputStream
(),
"UTF-8"
);
writer
.
write
(
json
);
writer
.
flush
();
bf
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"UTF-8"
));
String
inputLine
=
null
;
while
((
inputLine
=
bf
.
readLine
())
!=
null
)
{
str
.
append
(
inputLine
);
}
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
writer
.
close
();
bf
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
str
.
toString
();
}
// 解析返回的json里的data数据
public
static
Map
jsonFormat
(
String
json
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
json
);
Object
data
=
jsonObject
.
get
(
"data"
);
String
content
=
"["
+
data
.
toString
()
+
"]"
;
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
Map
map
=
JSON
.
parseObject
(
jsonArray
.
getString
(
0
));
return
map
;
}
// 生成二维码
public
static
String
CreateBarCode
(
String
carCode
,
String
carColor
,
String
mainifist
)
{
String
json
=
"{\"token\":\"samples\",\"data\":{\"vehicle_no\":\""
+
carCode
+
"\",\"vehicle_no_color\":\""
+
carColor
+
"\",\"vehicle_rela_id\":\""
+
mainifist
+
"\"}}"
;
String
content
=
buildBarCode
.
sendData
(
CREATEBARCODE
,
json
);
Map
map
=
buildBarCode
.
jsonFormat
(
content
);
return
map
.
get
(
"vehicle_bar_code"
).
toString
();
}
// 取消二维码
public
static
void
cancleBarCode
(
String
carCode
,
String
carColor
)
{
String
json
=
"{\"token\":\"samples\",\"data\":{\"vehicle_no\":\""
+
carCode
+
"\",\"vehicle_no_color\":\""
+
carColor
+
"\"}}"
;
buildBarCode
.
sendData
(
CANCLEBARCODE
,
json
);
}
}
...
...
src/main/java/com/sy/logic/LogicOperation.java
查看文件 @
79d88c9
...
...
@@ -3,6 +3,7 @@ package com.sy.logic;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.sy.crossDomain.buildBarCode
;
import
com.sy.model.GatherInfo
;
import
com.sy.model.LandBusinessTypeList
;
import
com.sy.model.LandRoadVe
;
...
...
@@ -48,11 +49,12 @@ public class LogicOperation {
//逻辑判断后的结果定义
private
static
String
PERMITTHOUGH
=
"直接放行"
;
private
static
String
GROWSSEXCETION
=
"禁止通行,重量不在可控范围"
;
private
static
String
NORECORD
=
"车辆未备案"
;
private
static
String
INPUTSTATION
=
"此车辆未做进站申请"
;
private
static
String
ENTERSTATION
=
"此车辆未做出站申请"
;
@PostConstruct
public
void
init
(){
public
void
init
()
{
logic
=
this
;
logic
.
listService
=
this
.
listService
;
logic
.
veService
=
this
.
veService
;
...
...
@@ -61,61 +63,76 @@ public class LogicOperation {
/**
* @Param info 卡口采集数据
* @Result 计算卡口采集数据并发送报文
* */
public
static
void
operation
(
GatherInfo
info
){
*/
public
static
boolean
operation
(
GatherInfo
info
)
{
boolean
result
=
false
;
BigDecimal
grosswt
=
info
.
getGrosswt
();
//转为double类型
double
growssWt
=
grosswt
.
doubleValue
();
String
ietype
=
info
.
getIetype
();
List
<
LandBusinessTypeList
>
lists
=
null
;
LandRoadVe
ve
=
logic
.
veService
.
selectByFrameNo
(
info
.
getIcvename
());
if
(
"E"
.
equals
(
ietype
)){
List
<
LandBusinessTypeList
>
lists
=
null
;
String
vaName
=
info
.
getVename
();
LandRoadVe
ve
=
logic
.
veService
.
selectByFrameNo
(
vaName
);
if
(
ve
==
null
)
return
result
;
if
(
"E"
.
equals
(
ietype
))
{
ietype
=
"出场站"
;
lists
=
logic
.
listService
.
selectByFrameNoAndType
(
info
.
getIcvename
(),
ietype
);
for
(
LandBusinessTypeList
list:
lists
)
{
lists
=
logic
.
listService
.
selectByFrameNoAndType
(
info
.
getVename
(),
ietype
);
for
(
LandBusinessTypeList
list
:
lists
)
{
//查询是否做了出场申请
if
(
list
.
getContrastflag
()==
""
|
list
.
getContrastflag
()==
null
)
{
if
(
list
.
getContrastflag
()
==
null
||
list
.
getContrastflag
()
==
""
||
list
.
getContrastflag
().
length
()
<=
0
)
{
//判断载货重量是否符合所设定的范围
double
goodsWt
=
GoodsWt
(
list
.
getMasterList
(),
"E"
);
double
goodsWt
=
0.0
;
if
(
list
.
getMasterList
().
length
()
>
0
)
{
goodsWt
=
GoodsWt
(
list
.
getMasterList
(),
"I"
);
}
double
selfWt
=
Double
.
parseDouble
(
ve
.
getSelfWt
());
sendBw
(
info
,
growssWt
,
selfWt
,
goodsWt
);
if
(
sendBw
(
info
,
growssWt
,
selfWt
,
goodsWt
))
{
list
.
setContrastflag
(
"已出站"
);
logic
.
listService
.
updateById
(
list
);
if
(
"货物流转"
.
equals
(
list
.
getBusinesstype
())
|
"分拨分流"
.
equals
(
list
.
getBusinesstype
())){
if
(
list
.
getMasterList
().
length
()>
0
)
{
if
(
"货物流转"
.
equals
(
list
.
getBusinesstype
())
|
"分拨分流"
.
equals
(
list
.
getBusinesstype
()))
{
if
(
list
.
getMasterList
().
length
()
>
0
)
{
createTypeList
(
list
);
}
}
}
else
{
CommandClient
.
Client
(
info
,
ENTERSTATION
);
result
=
true
;
}
}
else
{
CommandClient
.
Client
(
info
,
ENTERSTATION
);
}
}
}
else
{
}
else
{
ietype
=
"进场站"
;
lists
=
logic
.
listService
.
selectByFrameNoAndType
(
info
.
getIcvename
(),
ietype
);
for
(
LandBusinessTypeList
list:
lists
)
{
lists
=
logic
.
listService
.
selectByFrameNoAndType
(
info
.
getVename
(),
ietype
);
for
(
LandBusinessTypeList
list
:
lists
)
{
//查询是否做了出场申请
if
(
list
.
getContrastflag
()==
""
|
list
.
getContrastflag
()==
null
){
if
(
list
.
getContrastflag
()
==
null
||
list
.
getContrastflag
()
==
""
||
list
.
getContrastflag
().
length
()
<=
0
)
{
//判断载货重量是否符合所设定的范围
double
goodsWt
=
GoodsWt
(
list
.
getMasterList
(),
"I"
);
double
goodsWt
=
0.0
;
if
(
list
.
getMasterList
().
length
()
>
0
){
goodsWt
=
GoodsWt
(
list
.
getMasterList
(),
"E"
);
}
double
selfWt
=
Double
.
parseDouble
(
ve
.
getSelfWt
());
sendBw
(
info
,
growssWt
,
selfWt
,
goodsWt
);
if
(
sendBw
(
info
,
growssWt
,
selfWt
,
goodsWt
))
{
list
.
setContrastflag
(
"已进站"
);
logic
.
listService
.
updateById
(
list
);
}
else
{
CommandClient
.
Client
(
info
,
INPUTSTATION
);
result
=
true
;
}
}
else
{
CommandClient
.
Client
(
info
,
INPUTSTATION
);
}
}
}
return
result
;
}
//将获取的checkWt进行小数转化
public
static
double
valueDob
(){
NumberFormat
nf
=
NumberFormat
.
getPercentInstance
();
public
static
double
valueDob
()
{
NumberFormat
nf
=
NumberFormat
.
getPercentInstance
();
Number
m
=
null
;
try
{
m
=
nf
.
parse
(
checkWt
);
//将百分数转换成Number类型
}
catch
(
ParseException
e
){
m
=
nf
.
parse
(
checkWt
);
//将百分数转换成Number类型
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
logger
.
info
(
e
.
getMessage
());
}
...
...
@@ -127,13 +144,23 @@ public class LogicOperation {
* @Param wt 车辆自重
* @Param goodsWt 货物总重
* @Result 获取运单重量
*
*
/
*/
//校验载重和称重是否在合理的范围
public
static
boolean
checkResult
(
double
grossWt
,
double
wt
,
double
goodsWt
)
{
public
static
boolean
checkResult
(
double
grossWt
,
double
wt
,
double
goodsWt
)
{
boolean
flag
=
false
;
double
result
=
(
grossWt
-
wt
)/
goodsWt
;
double
result
=
0.0
;
if
(
goodsWt
>
0
)
{
result
=
(
grossWt
-
wt
)
/
goodsWt
;
if
(
result
>
1
)
{
result
=
result
-
1
;
}
else
{
result
=
1
-
result
;
}
}
else
{
result
=
(
grossWt
-
wt
);
}
BigDecimal
bd
=
new
BigDecimal
(
result
);
if
(
bd
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
()<=
valueDob
())
{
if
(
bd
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
()
<=
valueDob
())
{
flag
=
true
;
}
return
flag
;
...
...
@@ -143,13 +170,13 @@ public class LogicOperation {
* @Param mainifast 主单列表
* @Param ietype 进出标志
* 获取货物总重
* */
public
static
double
GoodsWt
(
String
mainifast
,
String
ietype
){
*/
public
static
double
GoodsWt
(
String
mainifast
,
String
ietype
)
{
Double
sum
=
0.0
;
if
(
mainifast
.
length
()>
0
){
String
[]
mainifastList
=
mainifast
.
split
(
","
);
for
(
String
mainBill:
mainifastList
)
{
sum
=
sum
+=
getGrossWt
(
mainBill
,
ietype
);
if
(
mainifast
.
length
()
>
0
)
{
String
[]
mainifastList
=
mainifast
.
split
(
","
);
for
(
String
mainBill
:
mainifastList
)
{
sum
=
sum
+=
getGrossWt
(
mainBill
,
ietype
);
}
}
return
sum
;
...
...
@@ -160,15 +187,15 @@ public class LogicOperation {
* @Param waybill 主单号
* @Param imp 进出港标识
* @Result 获取运单重量
*
*
/
*/
public
static
double
getGrossWt
(
String
waybill
,
String
imp
)
{
String
url
=
"http://tjfx.15miaoo.com:8003/tj/orig/orig?waybill="
+
waybill
+
"&imp="
+
imp
;
StringBuilder
json
=
new
StringBuilder
();
Map
map
=
null
;
double
bg
=
0
;
try
{
URL
oracle
=
new
URL
(
url
);
URLConnection
yc
=
oracle
.
openConnection
();
URL
Url
=
new
URL
(
url
);
URLConnection
yc
=
Url
.
openConnection
();
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
yc
.
getInputStream
()));
String
inputLine
=
null
;
while
((
inputLine
=
in
.
readLine
())
!=
null
)
{
...
...
@@ -177,7 +204,8 @@ public class LogicOperation {
JSONArray
array
=
JSONArray
.
parseArray
(
json
.
toString
());
for
(
int
i
=
0
;
i
<
array
.
size
();
i
++)
{
map
=
JSON
.
parseObject
(
array
.
getString
(
i
));
if
(
map
.
get
(
"receiptinformation"
).
toString
().
startsWith
(
"41301"
))
{
if
(
map
.
get
(
"receiptinformation"
).
toString
().
startsWith
(
"41301"
)
||
map
.
get
(
"receiptinformation"
)
.
toString
().
startsWith
(
"41106"
))
{
bg
=
Double
.
parseDouble
((
String
)
map
.
get
(
"totalweight"
));
return
bg
;
}
...
...
@@ -190,43 +218,50 @@ public class LogicOperation {
}
return
bg
;
}
/**
* 分拨或者流转业务生成新的进站申请
* */
public
static
void
createTypeList
(
LandBusinessTypeList
list
){
*/
public
static
void
createTypeList
(
LandBusinessTypeList
list
)
{
LandBusinessTypeList
typeList
=
new
LandBusinessTypeList
();
typeList
.
setId
(
UUIDCreate
.
getUUID
());
typeList
.
setAgentname
(
list
.
getAgentname
());
typeList
.
setAgentno
(
list
.
getAgentno
());
typeList
.
setAisle
(
"1号卡口"
);
typeList
.
setAisle
(
"1号卡口
-进
"
);
typeList
.
setCreateBy
(
list
.
getCreateBy
());
typeList
.
setUpdateBy
(
list
.
getUpdateBy
());
typeList
.
setCreateDate
(
new
Date
());
typeList
.
setUpdateDate
(
new
Date
());
typeList
.
setCocode
(
list
.
getCocode
());
typeList
.
setDriverid
(
list
.
getDriverid
());
typeList
.
setDrivername
(
list
.
getDrivername
());
typeList
.
setStartport
(
list
.
getEndport
());
typeList
.
setStartsatation
(
list
.
getEndstation
());
typeList
.
setEndport
(
list
.
getStartport
());
typeList
.
setEndstation
(
list
.
getStartsatation
());
typeList
.
setTrailerFrameNo
(
list
.
getTrailerFrameNo
());
typeList
.
setTrailerLicenseNo
(
list
.
getTrailer
Fram
eNo
());
typeList
.
setTrailerLicenseNo
(
list
.
getTrailer
Licens
eNo
());
typeList
.
setTurnoverflag
(
"进场站"
);
typeList
.
setProdectTime
(
new
Date
());
typeList
.
setMasterList
(
list
.
getMasterList
());
typeList
.
setBusinesstype
(
list
.
getBusinesstype
());
String
barCode
=
buildBarCode
.
CreateBarCode
(
list
.
getTrailerFrameNo
(),
""
,
list
.
getMasterList
());
typeList
.
setBarCode
(
barCode
);
logic
.
listService
.
saveList
(
typeList
);
}
/**
*校验重量并发送报文
* */
* 校验重量并发送报文
*/
public
static
void
sendBw
(
GatherInfo
info
,
double
growsswWt
,
double
selfWt
,
double
goodsWt
){
String
flag
=
null
;
if
(
checkResult
(
growsswWt
,
selfWt
,
goodsWt
)){
CommandClient
.
Client
(
info
,
PERMITTHOUGH
);
}
else
{
CommandClient
.
Client
(
info
,
GROWSSEXCETION
);
public
static
boolean
sendBw
(
GatherInfo
info
,
double
growsswWt
,
double
selfWt
,
double
goodsWt
)
{
boolean
flag
=
false
;
if
(
checkResult
(
growsswWt
,
selfWt
,
goodsWt
))
{
CommandClient
.
Client
(
info
,
PERMITTHOUGH
);
flag
=
true
;
}
else
{
CommandClient
.
Client
(
info
,
GROWSSEXCETION
);
}
return
flag
;
}
}
...
...
src/main/java/com/sy/mapper/LandBusinessTypeListMapper.java
查看文件 @
79d88c9
package
com
.
sy
.
mapper
;
import
com.sy.model.LandBusinessTypeList
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
...
...
@@ -18,5 +19,6 @@ public interface LandBusinessTypeListMapper {
int
updateByPrimaryKey
(
LandBusinessTypeList
record
);
//根据车牌号和进出场标志查询
List
<
LandBusinessTypeList
>
selectFrameNoAndType
(
String
frameNo
,
String
flag
);
List
<
LandBusinessTypeList
>
selectFrameNoAndType
(
@Param
(
"trailerFrameNo"
)
String
frameNo
,
@Param
(
"turnoverflag"
)
String
flag
);
}
\ No newline at end of file
...
...
src/main/java/com/sy/model/LandBusinessTypeList.java
查看文件 @
79d88c9
...
...
@@ -51,6 +51,8 @@ public class LandBusinessTypeList {
private
Date
updateDate
;
private
String
barCode
;
public
String
getId
()
{
return
id
;
}
...
...
@@ -242,4 +244,12 @@ public class LandBusinessTypeList {
public
void
setUpdateDate
(
Date
updateDate
)
{
this
.
updateDate
=
updateDate
;
}
public
String
getBarCode
()
{
return
barCode
;
}
public
void
setBarCode
(
String
barCode
)
{
this
.
barCode
=
barCode
;
}
}
\ No newline at end of file
...
...
src/main/java/com/sy/service/impl/LandBusListServiceImpl.java
查看文件 @
79d88c9
...
...
@@ -17,7 +17,13 @@ public class LandBusListServiceImpl implements LandBusListService {
@Override
public
List
<
LandBusinessTypeList
>
selectByFrameNoAndType
(
String
frameNo
,
String
flag
)
{
List
<
LandBusinessTypeList
>
lists
=
listMapper
.
selectFrameNoAndType
(
frameNo
,
flag
);
List
<
LandBusinessTypeList
>
lists
=
null
;
try
{
lists
=
listMapper
.
selectFrameNoAndType
(
frameNo
,
flag
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
System
.
out
.
println
(
e
.
getMessage
());
}
return
lists
;
}
...
...
@@ -29,7 +35,7 @@ public class LandBusListServiceImpl implements LandBusListService {
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
0
;
return
result
;
}
@Override
...
...
src/main/java/com/sy/service/impl/LandRoadVeServiceImpl.java
查看文件 @
79d88c9
...
...
@@ -3,11 +3,13 @@ package com.sy.service.impl;
import
com.sy.mapper.LandRoadVeMapper
;
import
com.sy.model.LandRoadVe
;
import
com.sy.service.LandRoadVeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
LandRoadVeServiceImpl
implements
LandRoadVeService
{
@Autowired
private
LandRoadVeMapper
veMapper
;
@Override
...
...
src/main/java/com/sy/socket/CommandClient.java
查看文件 @
79d88c9
...
...
@@ -15,15 +15,16 @@ public class CommandClient {
private
static
final
Logger
logger
=
Logger
.
getLogger
(
CommandClient
.
class
);
/**
* @Param GatherInfo 所传卡口信息
* @Param flag 是否放行标识符
* @Param GatherInfo 卡口采集信息
* @Param flag 是否放行信息
* */
public
static
void
Client
(
GatherInfo
info
,
String
flag
)
{
String
xmlBody
=
getXmlInfo
(
info
,
flag
);
Socket
socket
=
null
;
OutputStream
op
=
null
;
try
{
socket
=
new
Socket
(
"192.168.1.107"
,
9002
);
//ip+端口
socket
=
new
Socket
(
"10.50.7.10"
,
9003
);
logger
.
info
(
"socket通讯创建连接成功"
);
op
=
socket
.
getOutputStream
();
//xml字节流
...
...
@@ -45,19 +46,20 @@ public class CommandClient {
byte
[]
eType
=
info
.
getIetype
().
getBytes
(
"ASCII"
);
//标识符
byte
[]
bwFlag
=
new
byte
[
4
];
bwFlag
[
0
]=(
byte
)
0
xFF
;
bwFlag
[
1
]=(
byte
)
0
xFF
;
bwFlag
[
2
]=(
byte
)
0
xFF
;
bwFlag
[
3
]=(
byte
)
0
xFF
;
bwFlag
[
0
]=(
byte
)
0x00
;
bwFlag
[
1
]=(
byte
)
0x00
;
bwFlag
[
2
]=(
byte
)
0x00
;
bwFlag
[
3
]=(
byte
)
0x00
;
//xml字节流长度
byte
[]
xmlLength
=
intToByte4
(
xBody
.
length
);
//包尾
byte
[]
end
=
new
byte
[
2
];
end
[
0
]=(
byte
)
0
xFF
;
end
[
1
]=(
byte
)
0
xFF
;
//总长
System
.
out
.
println
();
//总长 4为总长的length
byte
[]
packge
=
intToByte4
((
head
.
length
+
xBody
.
length
+
mType
.
length
+
station
.
length
+
aisle
.
length
+
eType
.
length
+
bwFlag
.
length
+
xmlLength
.
length
+
end
.
length
));
.
length
+
bwFlag
.
length
+
xmlLength
.
length
+
end
.
length
+
4
));
byte
[]
allByte
=
byteMergerAll
(
head
,
packge
,
mType
,
station
,
aisle
,
eType
,
bwFlag
,
xmlLength
,
xBody
,
end
);
op
.
write
(
allByte
);
op
.
flush
();
...
...
@@ -82,9 +84,9 @@ public class CommandClient {
private
static
String
getXmlInfo
(
GatherInfo
info
,
String
message
)
{
String
flag
=
null
;
if
(
"直接放行"
.
equals
(
message
)){
flag
=
"11"
;
}
else
{
flag
=
"00"
;
}
else
{
flag
=
"11"
;
}
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
"<COMMAND_INFO AREA_ID=\""
+
info
.
getAreaid
()+
"\" CHNL_NO=\""
+
info
.
getChnlno
()+
"\" I_E_TYPE=\""
+
info
...
...
@@ -123,6 +125,7 @@ public class CommandClient {
return
value
;
}
//合并byte数据
private
static
byte
[]
byteMergerAll
(
byte
[]...
values
)
{
int
length_byte
=
0
;
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
...
...
src/main/java/com/sy/utils/FileTool.java
查看文件 @
79d88c9
...
...
@@ -42,7 +42,7 @@ public final class FileTool {
}
public
static
String
readfile
(
File
file
)
throws
IOException
{
String
fileToString
=
FileUtils
.
readFileToString
(
file
,
"UTF-8"
);
String
fileToString
=
CharasetCheck
.
getUTF8String
(
FileUtils
.
readFileToString
(
file
,
"GB2312"
)
);
return
fileToString
;
}
...
...
src/main/resources/application.properties
查看文件 @
79d88c9
...
...
@@ -14,15 +14,15 @@ spring.mvc.view.suffix=/WEB-INF/jsp/
#映射后缀
spring.mvc.view.prefix
=
.jsp
#设置本地数据源
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.driver-class-
name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://localhost:3306/bysj?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai
#设置线上数据源
#spring.datasource.username=root
#spring.datasource.password=root
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://10.50.7.10:3306/station?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
#spring.datasource.username=kako
#spring.datasource.password=mysql10.50.7.10
#spring.datasource.url=jdbc:mysql://localhost:3306/bysj?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai
#设置线上数据源
spring.datasource.driver-class-
name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://10.50.7.10:3306/station?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
spring.datasource.username
=
kako
spring.datasource.password
=
mysql10.50.7.10
#连接池类
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
#连接池配置,因为springboot默认是开启了连接池的,它有默认配置,这一段可以忽略
...
...
请
注册
或
登录
后发表评论