|
|
|
@ -25,6 +25,7 @@ import com.xxl.job.core.biz.model.ReturnT;
|
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -62,6 +63,11 @@ public class SpiderDataJob {
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private Executor asyncChangeDbExecutor; |
|
|
|
|
@Autowired |
|
|
|
|
private BladeRedis bladeRedis; |
|
|
|
|
|
|
|
|
|
private LocalDate firstDayOfMonth; |
|
|
|
|
private LocalDate lastDayOfMonth; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,6 +85,8 @@ public class SpiderDataJob {
|
|
|
|
|
startData =LocalDate.now().toString(); |
|
|
|
|
endData = LocalDate.now().minusDays(1).toString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(param)){ |
|
|
|
|
if(param.contains(",")){ |
|
|
|
|
String[] split = param.split(","); |
|
|
|
@ -91,6 +99,14 @@ public class SpiderDataJob {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前日期的第一天 的日期 和最后一天的日期
|
|
|
|
|
LocalDate now = LocalDate.parse(startData); |
|
|
|
|
firstDayOfMonth = now.withDayOfMonth(1); |
|
|
|
|
lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// startData ="2025-02-25";
|
|
|
|
@ -195,6 +211,7 @@ public class SpiderDataJob {
|
|
|
|
|
vo.setOrderInfo(orderInfo); |
|
|
|
|
vo.setPackageInfo(packageInfoVOs); |
|
|
|
|
} |
|
|
|
|
log.debug(">>>>> vo {}",vo); |
|
|
|
|
|
|
|
|
|
asyncChangeDbExecutor.execute(new ChdbTask(spiderInforEntity.getBindTenantCode(), vo,deliveryNoteService)); |
|
|
|
|
} |
|
|
|
@ -308,14 +325,25 @@ public class SpiderDataJob {
|
|
|
|
|
JSONObject jsonObject = getData(url, buildCookies(username, password)); |
|
|
|
|
|
|
|
|
|
JSONArray temList = jsonObject.getJSONArray("result"); |
|
|
|
|
|
|
|
|
|
log.debug("getCarOrders 执行时间:{}",temList.size()); |
|
|
|
|
|
|
|
|
|
for (Object o : temList) { |
|
|
|
|
JSONObject jsonObject1 = (JSONObject) o; |
|
|
|
|
JSONObject list2 = getOrderInfor(jsonObject1.getStr("orderNumber"), username, password); |
|
|
|
|
|
|
|
|
|
JSONArray list_2 = list2.getJSONArray("result"); |
|
|
|
|
for (Object o1 : list_2) { |
|
|
|
|
JSONObject t = (JSONObject) o1; |
|
|
|
|
result.add(t); |
|
|
|
|
String orderNumber = jsonObject1.getStr("orderNumber"); |
|
|
|
|
String key = "sfy:factory:"+orderNumber+".lock"; |
|
|
|
|
Object o2 = bladeRedis.get(key); |
|
|
|
|
if(o2 == null){ |
|
|
|
|
JSONObject list2 = getOrderInfor(orderNumber, username, password); |
|
|
|
|
|
|
|
|
|
JSONArray list_2 = list2.getJSONArray("result"); |
|
|
|
|
for (Object o1 : list_2) { |
|
|
|
|
JSONObject t = (JSONObject) o1; |
|
|
|
|
result.add(t); |
|
|
|
|
} |
|
|
|
|
// 单号存储3个小时
|
|
|
|
|
bladeRedis.setEx(key,"1",60L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -339,8 +367,14 @@ public class SpiderDataJob {
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
private JSONObject getOrderInfor(String orderCode, String username, String password) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long _dc_ = System.currentTimeMillis(); |
|
|
|
|
String url ="https://portal.sfygroup.com/reporthome/rest/delivedryNotice/all?_dc="+_dc_+"&page=1&start=0&limit=20&filtersRaw=[{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+startData+"\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+endData+"\",\"operator\":\"<\",\"sql\":null},{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\""+orderCode+"\",\"operator\":\"like\",\"sql\":null}]"; |
|
|
|
|
String url ="https://portal.sfygroup.com/reporthome/rest/delivedryNotice/all?_dc="+_dc_ |
|
|
|
|
+"&page=1&start=0&limit=20&filtersRaw=[{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+ |
|
|
|
|
firstDayOfMonth+"\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+ |
|
|
|
|
lastDayOfMonth+"\",\"operator\":\"<\",\"sql\":null},{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\""+orderCode+"\",\"operator\":\"like\",\"sql\":null}]"; |
|
|
|
|
JSONObject jsonObject = getData(url, buildCookiesByDD(username, password)); |
|
|
|
|
return jsonObject; |
|
|
|
|
|
|
|
|
@ -385,7 +419,7 @@ public class SpiderDataJob {
|
|
|
|
|
JSONArray response = new JSONArray(); |
|
|
|
|
//获取订单对应的装箱单
|
|
|
|
|
Long _dc_ = System.currentTimeMillis(); |
|
|
|
|
String url = "https://portal.sfygroup.com/reporthome/rest/orderPackHead/all?_dc=" + _dc_ + "&page=1&start=0&limit=1000&filtersRaw=[{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\"" + orderCode + "\",\"operator\":\"=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + startData + "\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + endData + "\",\"operator\":\"<\",\"sql\":null}]"; |
|
|
|
|
String url = "https://portal.sfygroup.com/reporthome/rest/orderPackHead/all?_dc=" + _dc_ + "&page=1&start=0&limit=1000&filtersRaw=[{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\"" + orderCode + "\",\"operator\":\"=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + firstDayOfMonth + "\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + lastDayOfMonth + "\",\"operator\":\"<\",\"sql\":null}]"; |
|
|
|
|
JSONObject data = getData(url, buildCookiesByZx(username, password)); |
|
|
|
|
JSONArray tempList = data.getJSONArray("result"); |
|
|
|
|
for (Object o : tempList) { |
|
|
|
|