|
@@ -0,0 +1,85 @@
|
|
|
+package cn.com.ctop.job.kuaishou.handler;
|
|
|
+
|
|
|
+import cn.com.ctop.common.module.service.IMaterialInfoService;
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils2;
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+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;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class DuxiaomanJob {
|
|
|
+
|
|
|
+ @Value("${xxl-job.requestUrl}")
|
|
|
+ private String jobUrl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMaterialInfoService materialInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将1-待上传状态de素材 进行 上传媒体
|
|
|
+ */
|
|
|
+ @XxlJob("uploadMaterial")
|
|
|
+ public void uploadMaterial() throws InterruptedException {
|
|
|
+ String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/uploadMaterial";
|
|
|
+
|
|
|
+ //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
|
|
|
+ List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(1);
|
|
|
+ if (Check.isNull(idList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (Long id : idList) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", id);
|
|
|
+ HttpUtils2.httpGet(url, requestMap, null);
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将7-上传成功状态de素材 进行 素材报备
|
|
|
+ */
|
|
|
+ @XxlJob("materialReport")
|
|
|
+ public void materialReport() throws InterruptedException {
|
|
|
+ String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/materialReport";
|
|
|
+
|
|
|
+ //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
|
|
|
+ List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(7);
|
|
|
+ if (Check.isNull(idList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (Long id : idList) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", id);
|
|
|
+ HttpUtils2.httpGet(url, requestMap, null);
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将2-审批中状态的素材 进行 更新报备状态
|
|
|
+ */
|
|
|
+ @XxlJob("materialDetail")
|
|
|
+ public void materialDetail() throws InterruptedException {
|
|
|
+ String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/materialDetail";
|
|
|
+
|
|
|
+ //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
|
|
|
+ List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(2);
|
|
|
+ if (Check.isNull(idList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (Long id : idList) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", id);
|
|
|
+ HttpUtils2.httpGet(url, requestMap, null);
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|