浏览代码

产品第三方接口推送修改异步

chen 1 年之前
父节点
当前提交
c3f551c6f5
共有 1 个文件被更改,包括 15 次插入9 次删除
  1. 15 9
      src/main/java/org/springblade/modules/pl/product/service/impl/ProductServiceImpl.java

+ 15 - 9
src/main/java/org/springblade/modules/pl/product/service/impl/ProductServiceImpl.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.pl.product.service.impl;
 
+import liquibase.pro.packaged.E;
 import lombok.extern.slf4j.Slf4j;
 import org.springblade.api.utils.FileUtils;
 import org.springblade.common.utils.PostGet;
@@ -27,6 +28,7 @@ import org.springblade.modules.pl.product.excel.ProductExcel;
 import org.springblade.modules.pl.product.mapper.ProductMapper;
 import org.springblade.modules.pl.product.service.IProductService;
 import org.springblade.modules.pl.productModel.entity.ProductModelEntity;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -63,16 +65,20 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, ProductEn
 	}
 
 	@Override
+	@Async
 	public void pushTripartite(String productCode, String fileUlr, ProductModelEntity productModel ,String result) {
-		File file = FileUtils.getFileByUrl(fileUlr,".jpg");
-		Map<String,Object> param = new HashMap<>();
-		param.put("sn",productCode);
-		param.put("result",result);
-		param.put("file",file);
-		log.info("产品-{}推送三方平台result:{},fileUrl:{}",productCode,result,fileUlr);
-		String postResult = HttpUtil.post(productModel.getTripartiteUrl(), param);
-		log.info("产品-{}推送三方平台结果:{}",productCode,postResult);
-//		HttpUtil.post()
+		try {
+			File file = FileUtils.getFileByUrl(fileUlr,".jpg");
+			Map<String,Object> param = new HashMap<>();
+			param.put("sn",productCode);
+			param.put("result",result);
+			param.put("file",file);
+			log.info("产品-{}推送三方平台result:{},fileUrl:{}",productCode,result,fileUlr);
+			String postResult = HttpUtil.post(productModel.getTripartiteUrl(), param);
+			log.info("产品-{}推送三方平台结果:{}",productCode,postResult);
+		}catch (Exception e){
+			log.error("产品-{}推送三方平台异常",productCode,e);
+		}
 	}
 
 	public static void main(String[] args) {