|
@@ -32,6 +32,7 @@ import com.michael.utils.gson.FloatConverter;
|
|
|
import com.michael.utils.gson.GsonUtils;
|
|
|
import com.michael.utils.gson.IntegerConverter;
|
|
|
import com.michael.utils.string.StringUtils;
|
|
|
+import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.http.NoHttpResponseException;
|
|
|
import org.apache.http.client.fluent.Request;
|
|
@@ -46,6 +47,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.regex.Matcher;
|
|
@@ -144,8 +147,9 @@ public class DataLoanOrderServiceImpl implements DataLoanOrderService, BeanWrapC
|
|
|
}
|
|
|
Map<String, Object> params = SignUtils.sign();
|
|
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
// 设置开始和截至时间
|
|
|
- params.put("startTime", lastTime.getTime());
|
|
|
+ params.put("startTime", dateFormat.format(lastTime));
|
|
|
|
|
|
long total = 0;
|
|
|
// 发起请求
|
|
@@ -153,18 +157,20 @@ public class DataLoanOrderServiceImpl implements DataLoanOrderService, BeanWrapC
|
|
|
AtomicInteger update = new AtomicInteger();
|
|
|
try {
|
|
|
String json = GsonUtils.toJson(params);
|
|
|
- String jsonData = Request.Post("http://noa.scdayou.com/wx/history/loanOrders-kbsl")
|
|
|
- .body(new StringEntity(json, "utf-8"))
|
|
|
+ String jsonData = Request.Post("http://mbs.scdayou.com/api/personalTarget/evaData")
|
|
|
+ .body(new StringEntity(json, "utf-8")).addHeader("Content-Type","application/json;charset=UTF-8")
|
|
|
.execute()
|
|
|
.returnContent().toString();
|
|
|
+ byte[] bytes = jsonData.getBytes("ISO8859-1");
|
|
|
+ String result = new String(bytes, "UTF-8");
|
|
|
Gson gson = new GsonBuilder()
|
|
|
.registerTypeAdapter(Date.class, new DateConverter())
|
|
|
.registerTypeAdapter(Integer.class, new IntegerConverter())
|
|
|
.registerTypeAdapter(Float.class, new FloatConverter())
|
|
|
.registerTypeAdapter(Double.class, new DoubleConverter())
|
|
|
.create();
|
|
|
- DataLoanOrderWrapper dto = gson.fromJson(jsonData, DataLoanOrderWrapper.class);
|
|
|
- Assert.isTrue(dto.isSuccess(), dto.getMessage());
|
|
|
+ DataLoanOrderWrapper dto = gson.fromJson(result, DataLoanOrderWrapper.class);
|
|
|
+// Assert.isTrue(dto.isSuccess(), dto.getMessage());
|
|
|
List<DataLoanOrderDTO> data = dto.getData();
|
|
|
Pattern pattern = Pattern.compile("房屋建筑面积(\\d+(\\.\\d+)?)平方米");
|
|
|
Pattern floorPattern = Pattern.compile("(\\d+)(含地下)?");
|
|
@@ -221,16 +227,19 @@ public class DataLoanOrderServiceImpl implements DataLoanOrderService, BeanWrapC
|
|
|
if (RegUtils.isDouble(foo.getArea())) {
|
|
|
order.setBuildArea(Double.parseDouble(foo.getArea()));
|
|
|
} else {
|
|
|
- Matcher matcher = pattern.matcher(foo.getArea());
|
|
|
- if (matcher.find()) {
|
|
|
- order.setBuildArea(Double.parseDouble(matcher.group(1)));
|
|
|
+ if (StringUtils.isNotEmpty(foo.getArea())){
|
|
|
+ Matcher matcher = pattern.matcher(foo.getArea());
|
|
|
+ if (matcher.find()) {
|
|
|
+ order.setBuildArea(Double.parseDouble(matcher.group(1)));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 对于单价,面积都低于指定指标的,都跳过
|
|
|
- if (!HouseUtils.check(order.getPrice(), order.getBuildArea())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+// if (!HouseUtils.check(order.getPrice(), order.getBuildArea())) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
|
|
|
// 套内面积
|
|
|
if (RegUtils.isDouble(foo.getInnerArea())) {
|