Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
H
Hgs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐州
Hgs
Commits
ffe58353
Commit
ffe58353
authored
Feb 26, 2021
by
jay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抓取云迹接口修改
parent
1ab4ec3b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
23 deletions
+35
-23
CloudActivityController.java
.../com/house365/web/controller/CloudActivityController.java
+8
-3
HttpUtil.java
...hgs-web/src/main/java/com/house365/web/util/HttpUtil.java
+10
-11
addcloud.jsp
...ain/webapp/WEB-INF/views/cloudactivity/pages/addcloud.jsp
+5
-5
CloudActivityImpl.java
...va/com/house365/ws/interfaces/impl/CloudActivityImpl.java
+12
-4
No files found.
house365-hgs-web/src/main/java/com/house365/web/controller/CloudActivityController.java
View file @
ffe58353
...
@@ -499,8 +499,11 @@ public class CloudActivityController extends BaseController {
...
@@ -499,8 +499,11 @@ public class CloudActivityController extends BaseController {
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
startTime
=
entity
.
getStartTime
();
String
startTime
=
entity
.
getStartTime
();
String
endTime
=
entity
.
getEndTime
();
String
endTime
=
entity
.
getEndTime
();
long
time1
=
System
.
currentTimeMillis
();
String
seeResult
=
HttpClientUtil
.
doPost
(
cloudPullUrl
,
pairList
);
String
seeResult
=
HttpClientUtil
.
doPost
(
cloudPullUrl
,
pairList
);
long
time2
=
System
.
currentTimeMillis
();
logger
.
info
(
"----------云迹拉取接口程序运行时间----------: "
+
(
time2
-
time1
)
+
"ms"
);
System
.
out
.
println
(
"----------云迹拉取接口程序运行时间----------: "
+
(
time2
-
time1
)
+
"ms"
);
int
count
=
0
;
int
count
=
0
;
if
(
seeResult
!=
null
)
{
if
(
seeResult
!=
null
)
{
JSONObject
json
=
JSONObject
.
fromObject
(
seeResult
);
JSONObject
json
=
JSONObject
.
fromObject
(
seeResult
);
...
@@ -641,12 +644,14 @@ public class CloudActivityController extends BaseController {
...
@@ -641,12 +644,14 @@ public class CloudActivityController extends BaseController {
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getBlockList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getBlockList
()))
{
entity
.
getBlockList
().
forEach
(
e
->
blockBuilder
.
append
(
e
).
append
(
","
));
entity
.
getBlockList
().
forEach
(
e
->
blockBuilder
.
append
(
e
).
append
(
","
));
String
blocks
=
blockBuilder
.
toString
();
String
blocks
=
blockBuilder
.
toString
();
pairList
.
add
(
new
BasicNameValuePair
(
"plate_id_array"
,
blocks
));
// pairList.add(new BasicNameValuePair("plate_id_array", blocks));
pairList
.
add
(
new
BasicNameValuePair
(
"plate_name_array"
,
blocks
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getDistrictList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getDistrictList
()))
{
entity
.
getDistrictList
().
forEach
(
e
->
districtBuilder
.
append
(
e
).
append
(
","
));
entity
.
getDistrictList
().
forEach
(
e
->
districtBuilder
.
append
(
e
).
append
(
","
));
String
districts
=
districtBuilder
.
toString
();
String
districts
=
districtBuilder
.
toString
();
pairList
.
add
(
new
BasicNameValuePair
(
"district_id_array"
,
districts
));
// pairList.add(new BasicNameValuePair("district_id_array", districts));
pairList
.
add
(
new
BasicNameValuePair
(
"district_name_array"
,
districts
));
}
}
if
(
StringUtils
.
isNotBlank
(
entity
.
getChannel
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getChannel
()))
{
pairList
.
add
(
new
BasicNameValuePair
(
"info_type"
,
entity
.
getChannel
()));
pairList
.
add
(
new
BasicNameValuePair
(
"info_type"
,
entity
.
getChannel
()));
...
...
house365-hgs-web/src/main/java/com/house365/web/util/HttpUtil.java
View file @
ffe58353
...
@@ -100,7 +100,7 @@ public class HttpUtil {
...
@@ -100,7 +100,7 @@ public class HttpUtil {
return
null
;
return
null
;
}
}
public
static
String
doPostWithHeader
(
String
url
,
List
<
NameValuePair
>
params
,
String
access
_t
oken
,
String
charSet
)
{
public
static
String
doPostWithHeader
(
String
url
,
List
<
NameValuePair
>
params
,
String
access
T
oken
,
String
charSet
)
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
httpResponse
=
null
;
CloseableHttpResponse
httpResponse
=
null
;
long
beginTime
=
System
.
currentTimeMillis
();
long
beginTime
=
System
.
currentTimeMillis
();
...
@@ -108,7 +108,7 @@ public class HttpUtil {
...
@@ -108,7 +108,7 @@ public class HttpUtil {
HttpPost
httpPost
=
new
HttpPost
(
url
);
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setEntity
(
new
UrlEncodedFormEntity
(
params
,
"UTF-8"
));
httpPost
.
setEntity
(
new
UrlEncodedFormEntity
(
params
,
"UTF-8"
));
httpPost
.
addHeader
(
"version"
,
"v3.0"
);
httpPost
.
addHeader
(
"version"
,
"v3.0"
);
httpPost
.
addHeader
(
"access-token"
,
access
_t
oken
);
httpPost
.
addHeader
(
"access-token"
,
access
T
oken
);
httpResponse
=
httpClient
.
execute
(
httpPost
);
httpResponse
=
httpClient
.
execute
(
httpPost
);
HttpEntity
httpEntity
=
httpResponse
.
getEntity
();
HttpEntity
httpEntity
=
httpResponse
.
getEntity
();
...
@@ -175,13 +175,13 @@ public class HttpUtil {
...
@@ -175,13 +175,13 @@ public class HttpUtil {
return
signature
;
return
signature
;
}
}
public
static
String
getSignature2
(
String
decice
_id
,
String
rand_s
tr
,
String
timestamp
){
public
static
String
getSignature2
(
String
decice
Id
,
String
randS
tr
,
String
timestamp
){
//获取signature
//获取signature
List
<
NameValuePair
>
signatureInParam
=
new
ArrayList
<>();
List
<
NameValuePair
>
signatureInParam
=
new
ArrayList
<>();
signatureInParam
.
add
(
new
BasicNameValuePair
(
"app_id"
,
"89962055"
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"app_id"
,
"89962055"
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"app_secret"
,
"pMHTUWAoOGSjaToIhHKwmQJKWZcAAvjN"
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"app_secret"
,
"pMHTUWAoOGSjaToIhHKwmQJKWZcAAvjN"
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"device_id"
,
decice
_i
d
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"device_id"
,
decice
I
d
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"rand_str"
,
rand
_s
tr
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"rand_str"
,
rand
S
tr
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"timestamp"
,
timestamp
));
signatureInParam
.
add
(
new
BasicNameValuePair
(
"timestamp"
,
timestamp
));
List
<
String
>
newParams
=
new
ArrayList
<>();
List
<
String
>
newParams
=
new
ArrayList
<>();
for
(
NameValuePair
pair
:
signatureInParam
)
{
for
(
NameValuePair
pair
:
signatureInParam
)
{
...
@@ -192,17 +192,16 @@ public class HttpUtil {
...
@@ -192,17 +192,16 @@ public class HttpUtil {
return
signature
;
return
signature
;
}
}
public
static
String
getAccessToken
(
HashMap
<
String
,
String
>
tokenMap
,
String
timestamp
,
String
rand
_str
,
String
signature
,
String
decice_i
d
,
House365RestResponse
response
){
public
static
String
getAccessToken
(
HashMap
<
String
,
String
>
tokenMap
,
String
timestamp
,
String
rand
Str
,
String
signature
,
String
deciceI
d
,
House365RestResponse
response
){
//获取acceToken接口URl
//获取acceToken接口URl
String
getAccessTokenUrl
=
"http://api.400.house365.com/api/5aaf0c48ed105"
;
String
getAccessTokenUrl
=
"http://api.400.house365.com/api/5aaf0c48ed105"
;
List
<
NameValuePair
>
tokenInParam
=
new
ArrayList
<>();
List
<
NameValuePair
>
tokenInParam
=
new
ArrayList
<>();
List
<
NameValuePair
>
tokenHeaderParam
=
new
ArrayList
<>();
tokenInParam
.
add
(
new
BasicNameValuePair
(
"timestamp"
,
timestamp
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"timestamp"
,
timestamp
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"app_id"
,
"12558119"
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"app_id"
,
"12558119"
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"rand_str"
,
rand
_s
tr
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"rand_str"
,
rand
S
tr
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"signature"
,
signature
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"signature"
,
signature
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"device_id"
,
decice
_i
d
));
tokenInParam
.
add
(
new
BasicNameValuePair
(
"device_id"
,
decice
I
d
));
List
<
String
>
newTokenParams
=
new
ArrayList
<>();
List
<
String
>
newTokenParams
=
new
ArrayList
<>();
for
(
NameValuePair
pair
:
tokenInParam
)
{
for
(
NameValuePair
pair
:
tokenInParam
)
{
newTokenParams
.
add
(
pair
.
getName
()
+
"="
+
pair
.
getValue
());
newTokenParams
.
add
(
pair
.
getName
()
+
"="
+
pair
.
getValue
());
...
@@ -216,8 +215,8 @@ public class HttpUtil {
...
@@ -216,8 +215,8 @@ public class HttpUtil {
}
}
JSONObject
json
=
JSONObject
.
fromObject
(
tokenResult
);
JSONObject
json
=
JSONObject
.
fromObject
(
tokenResult
);
JSONObject
jo
=
json
.
getJSONObject
(
"data"
);
JSONObject
jo
=
json
.
getJSONObject
(
"data"
);
String
access
_t
oken
=
jo
.
getString
(
"access_token"
);
String
access
T
oken
=
jo
.
getString
(
"access_token"
);
return
access
_t
oken
;
return
access
T
oken
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
LOG
.
error
(
e
.
getMessage
(),
e
);
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
"0"
);
response
.
setResult
(
"0"
);
...
...
house365-hgs-web/src/main/webapp/WEB-INF/views/cloudactivity/pages/addcloud.jsp
View file @
ffe58353
...
@@ -87,7 +87,8 @@
...
@@ -87,7 +87,8 @@
<select
id=
"block"
name=
"entity.block"
class=
"selectpicker show-tick form-control"
<select
id=
"block"
name=
"entity.block"
class=
"selectpicker show-tick form-control"
multiple
data-live-search=
"false"
>
multiple
data-live-search=
"false"
>
<c:forEach
items=
"${blocks}"
var=
"block"
>
<c:forEach
items=
"${blocks}"
var=
"block"
>
<option
value=
"${block.dicValue}"
>
${block.dicName}
</option>
<
%
--
<
option
value=
"${block.dicValue}"
>
${block.dicName}
</option>
--%>
<option
value=
"${block.dicName}"
>
${block.dicName}
</option>
</c:forEach>
</c:forEach>
</select>
</select>
</div>
</div>
...
@@ -100,7 +101,8 @@
...
@@ -100,7 +101,8 @@
<select
id=
"district"
name=
"entity.district"
class=
"selectpicker show-tick form-control"
<select
id=
"district"
name=
"entity.district"
class=
"selectpicker show-tick form-control"
multiple
data-live-search=
"false"
>
multiple
data-live-search=
"false"
>
<c:forEach
items=
"${districts}"
var=
"district"
>
<c:forEach
items=
"${districts}"
var=
"district"
>
<option
value=
"${district.dicValue}"
>
${district.dicName}
</option>
<
%
--
<
option
value=
"${district.dicValue}"
>
${district.dicName}
</option>
--%>
<option
value=
"${district.dicName}"
>
${district.dicName}
</option>
</c:forEach>
</c:forEach>
</select>
</select>
</div>
</div>
...
@@ -254,7 +256,7 @@
...
@@ -254,7 +256,7 @@
text
:
"确认"
,
text
:
"确认"
,
click
:
function
()
{
click
:
function
()
{
$
(
this
).
dialog
(
"close"
);
$
(
this
).
dialog
(
"close"
);
window
.
open
(
"/house365-hgs-web/cloudcustomer/list/"
+
$
(
"#activeId"
).
val
(),
"_
blank
"
);
window
.
open
(
"/house365-hgs-web/cloudcustomer/list/"
+
$
(
"#activeId"
).
val
(),
"_
self
"
);
return
true
;
return
true
;
}
}
}
}
...
@@ -312,7 +314,6 @@
...
@@ -312,7 +314,6 @@
}
}
function
checkForm
()
{
function
checkForm
()
{
debugger
;
var
name
=
$
(
"#name"
).
val
();
var
name
=
$
(
"#name"
).
val
();
var
seeStartTime
=
$
(
"#seeStartTime"
).
val
();
var
seeStartTime
=
$
(
"#seeStartTime"
).
val
();
var
seeEndTime
=
$
(
"#seeEndTime"
).
val
();
var
seeEndTime
=
$
(
"#seeEndTime"
).
val
();
...
@@ -519,7 +520,6 @@
...
@@ -519,7 +520,6 @@
};
};
$
(
'#signTimeNew'
).
daterangepicker
(
options
,
function
(
start
,
end
,
label
)
{
$
(
'#signTimeNew'
).
daterangepicker
(
options
,
function
(
start
,
end
,
label
)
{
// console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
$
(
"#seeStartTime"
).
val
(
start
.
format
(
'YYYY-MM-DD 00:00:00'
));
$
(
"#seeStartTime"
).
val
(
start
.
format
(
'YYYY-MM-DD 00:00:00'
));
$
(
"#seeEndTime"
).
val
(
end
.
format
(
'YYYY-MM-DD 00:00:00'
));
$
(
"#seeEndTime"
).
val
(
end
.
format
(
'YYYY-MM-DD 00:00:00'
));
});
});
...
...
house365-hgs-ws/src/main/java/com/house365/ws/interfaces/impl/CloudActivityImpl.java
View file @
ffe58353
...
@@ -420,6 +420,8 @@ public class CloudActivityImpl implements ICloudActivityInterface {
...
@@ -420,6 +420,8 @@ public class CloudActivityImpl implements ICloudActivityInterface {
//调取接口获取数据
//调取接口获取数据
if
(
CollectionUtils
.
isNotEmpty
(
seeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
seeList
))
{
int
total
=
seeList
.
size
();
int
total
=
seeList
.
size
();
int
count1
=
0
;
int
count2
=
0
;
for
(
int
i
=
0
;
i
<
seeList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
seeList
.
size
();
i
++)
{
Map
<
String
,
Object
>
s
=
seeList
.
get
(
i
);
Map
<
String
,
Object
>
s
=
seeList
.
get
(
i
);
//数据保护机制 只过滤私客存在的客户
//数据保护机制 只过滤私客存在的客户
...
@@ -428,13 +430,16 @@ public class CloudActivityImpl implements ICloudActivityInterface {
...
@@ -428,13 +430,16 @@ public class CloudActivityImpl implements ICloudActivityInterface {
Map
<
String
,
Object
>
queryMap
=
new
HashMap
<>(
5
);
Map
<
String
,
Object
>
queryMap
=
new
HashMap
<>(
5
);
queryMap
.
put
(
"phone"
,
phone
);
queryMap
.
put
(
"phone"
,
phone
);
List
<
CustomerEntity
>
cusList
=
mergeMapper
.
queryByConditions
(
queryMap
);
List
<
CustomerEntity
>
cusList
=
mergeMapper
.
queryByConditions
(
queryMap
);
if
(
CollectionUtils
.
isNotEmpty
(
cusList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cusList
))
{
Long
count
=
increaseProtectKey
(
activeId
);
Long
count
=
increaseProtectKey
(
activeId
);
logger
.
warn
(
"protect "
+
phone
+
" count :"
+
count
+
" total:"
+
getFinishCount
(
activeId
));
logger
.
warn
(
"cloud protect "
+
phone
+
" count :"
+
count
+
" total:"
+
getFinishCount
(
activeId
));
count1
++;
continue
;
continue
;
}
else
{
}
else
{
count2
++;
Long
count
=
increaseDoneKey
(
activeId
);
Long
count
=
increaseDoneKey
(
activeId
);
logger
.
warn
(
"线程:"
+
"-"
+
total
+
" done count:"
+
count
+
" total:"
+
getFinishCount
(
activeId
));
logger
.
warn
(
"
cloud
线程:"
+
"-"
+
total
+
" done count:"
+
count
+
" total:"
+
getFinishCount
(
activeId
));
CloudCustomerEntity
entity
=
getCloudCustomer
(
phone
,
houseName
,
city
);
CloudCustomerEntity
entity
=
getCloudCustomer
(
phone
,
houseName
,
city
);
entity
.
setActiveId
(
activeId
);
entity
.
setActiveId
(
activeId
);
entity
.
setIsOvertime
(
0
);
entity
.
setIsOvertime
(
0
);
...
@@ -443,6 +448,7 @@ public class CloudActivityImpl implements ICloudActivityInterface {
...
@@ -443,6 +448,7 @@ public class CloudActivityImpl implements ICloudActivityInterface {
decreaseKey
(
activeId
);
decreaseKey
(
activeId
);
redisUtil
.
addKeyVal
(
"cloud:process:"
+
activeId
,
"1"
);
redisUtil
.
addKeyVal
(
"cloud:process:"
+
activeId
,
"1"
);
}
}
System
.
out
.
println
(
activeId
+
"--------count1---------"
+
count1
+
" ---------count2--------"
+
count2
);
}
}
//更新云迹活动字段
//更新云迹活动字段
...
@@ -652,12 +658,14 @@ public class CloudActivityImpl implements ICloudActivityInterface {
...
@@ -652,12 +658,14 @@ public class CloudActivityImpl implements ICloudActivityInterface {
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getBlockList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getBlockList
()))
{
entity
.
getBlockList
().
forEach
(
e
->
blockBuilder
.
append
(
e
).
append
(
","
));
entity
.
getBlockList
().
forEach
(
e
->
blockBuilder
.
append
(
e
).
append
(
","
));
String
blocks
=
blockBuilder
.
toString
();
String
blocks
=
blockBuilder
.
toString
();
pairList
.
add
(
new
BasicNameValuePair
(
"plate_id_array"
,
blocks
));
// pairList.add(new BasicNameValuePair("plate_id_array", blocks));
pairList
.
add
(
new
BasicNameValuePair
(
"plate_name_array"
,
blocks
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getDistrictList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getDistrictList
()))
{
entity
.
getDistrictList
().
forEach
(
e
->
districtBuilder
.
append
(
e
).
append
(
","
));
entity
.
getDistrictList
().
forEach
(
e
->
districtBuilder
.
append
(
e
).
append
(
","
));
String
districts
=
districtBuilder
.
toString
();
String
districts
=
districtBuilder
.
toString
();
pairList
.
add
(
new
BasicNameValuePair
(
"district_id_array"
,
districts
));
// pairList.add(new BasicNameValuePair("district_id_array", districts));
pairList
.
add
(
new
BasicNameValuePair
(
"district_name_array"
,
districts
));
}
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
entity
.
getChannel
()))
{
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
entity
.
getChannel
()))
{
pairList
.
add
(
new
BasicNameValuePair
(
"info_type"
,
entity
.
getChannel
()));
pairList
.
add
(
new
BasicNameValuePair
(
"info_type"
,
entity
.
getChannel
()));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment