|
@@ -0,0 +1,55 @@
|
|
|
+package cn.com.ctop.job.kuaishou.handler;
|
|
|
+
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouSupplyChainService;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class settlementJob {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouSupplyChainService ikuaishouSupplyChainService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义创建监测链接预警
|
|
|
+ */
|
|
|
+ @XxlJob("cleanSettlementData")
|
|
|
+ public void cleanSettlementData() {
|
|
|
+ String url = "http://ruixuan.api.tjyourong.com.cn/settlement/data";
|
|
|
+ String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
|
|
|
+ Long statDate = Long.valueOf(date.replace("-", ""));
|
|
|
+ List<JSONObject> list = ikuaishouSupplyChainService.getDataList(statDate);
|
|
|
+
|
|
|
+ if (Check.isNull(list)) {
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+ List<List<JSONObject>> partition = Lists.partition(list, 1000);
|
|
|
+ for (int i = 0; i < partition.size(); i++) {
|
|
|
+ List<JSONObject> jsonObjects = partition.get(i);
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("statDate", date);
|
|
|
+ param.put("data", jsonObjects);
|
|
|
+ HttpUtils.httpPostRequest(url, param, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|