Commit ffe58353 authored by jay's avatar jay

抓取云迹接口修改

parent 1ab4ec3b
...@@ -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()));
......
...@@ -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_token, String charSet) { public static String doPostWithHeader(String url, List<NameValuePair> params, String accessToken, 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_token); httpPost.addHeader("access-token", accessToken);
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_str, String timestamp){ public static String getSignature2(String deciceId, String randStr, 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_id)); signatureInParam.add(new BasicNameValuePair("device_id", deciceId));
signatureInParam.add(new BasicNameValuePair("rand_str", rand_str)); signatureInParam.add(new BasicNameValuePair("rand_str", randStr));
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_id, House365RestResponse response){ public static String getAccessToken(HashMap<String, String> tokenMap, String timestamp, String randStr, String signature, String deciceId, 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_str)); tokenInParam.add(new BasicNameValuePair("rand_str", randStr));
tokenInParam.add(new BasicNameValuePair("signature", signature)); tokenInParam.add(new BasicNameValuePair("signature", signature));
tokenInParam.add(new BasicNameValuePair("device_id", decice_id)); tokenInParam.add(new BasicNameValuePair("device_id", deciceId));
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_token = jo.getString("access_token"); String accessToken = jo.getString("access_token");
return access_token; return accessToken;
}catch (Exception e){ }catch (Exception e){
LOG.error(e.getMessage(), e); LOG.error(e.getMessage(), e);
response.setResult("0"); response.setResult("0");
......
...@@ -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'));
}); });
......
...@@ -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()));
......
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