diff --git a/order-management-consumer/pom.xml b/order-management-consumer/pom.xml
index 3354abf1..732eff14 100644
--- a/order-management-consumer/pom.xml
+++ b/order-management-consumer/pom.xml
@@ -542,6 +542,11 @@
wsdl4j
1.4
+
+ com.alibaba
+ easyexcel-core
+ 3.1.1
+
diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
index a2c996fe..34606ee7 100644
--- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
+++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
@@ -1,18 +1,27 @@
package com.dxhy.order.consumer.modules.commodity.controller;
-import cn.hutool.json.JSONObject;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSONObject;
+import com.dxhy.order.baseservice.module.base.service.BaseService;
+import com.dxhy.order.consumer.modules.commodity.domain.dto.CommodityCodeEntityExcel;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QueryGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QuoteGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.domain.dto.SyncGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.service.IGroupCommodityCodeService;
+import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.MdmSyncGroupTaxCodeReqBO;
+import com.dxhy.order.consumer.openapi.service.ISDEnregyService;
import com.dxhy.order.model.PageUtils;
import com.dxhy.order.model.R;
+import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import java.util.Map;
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.List;
/**
* @Description 集团物料库
@@ -28,6 +37,10 @@ public class GroupCommodityCodeController {
@Autowired
private IGroupCommodityCodeService groupCommodityCodeService;
+ @Autowired
+ private ISDEnregyService sdEnregyService;
+ @Resource
+ private BaseService baseService;
@GetMapping("/list")
public R list(QueryGroupCommodityDTO queryGroupCommodityDTO) {
@@ -54,4 +67,31 @@ public class GroupCommodityCodeController {
public R sync(@RequestBody @Validated SyncGroupCommodityDTO dto) {
return groupCommodityCodeService.syncGroupCommodityDTO(dto);
}
+
+ @RequestMapping("/uploadGroupCommodityDTO")
+ public R emailUpload(@RequestParam(value = "file") MultipartFile file) {
+ try {
+ List entityExcelList = EasyExcel.read(file.getInputStream()).sheet().head(CommodityCodeEntityExcel.class).headRowNumber(1).doReadSync();
+ log.info("解析的数据:{}", JSONObject.toJSONString(entityExcelList));
+ if (entityExcelList == null || entityExcelList.isEmpty()) {
+ return R.error("数据解析失败");
+ }
+ List taxxtbReqBOS = Lists.newArrayList();
+ for (CommodityCodeEntityExcel entityExcel : entityExcelList) {
+ MdmSyncGroupTaxCodeReqBO taxCodeReqBO = new MdmSyncGroupTaxCodeReqBO();
+ taxCodeReqBO.setCODE(entityExcel.getCODE());
+ taxCodeReqBO.setDESC1(entityExcel.getDESC1());
+ taxCodeReqBO.setDESC5(entityExcel.getDESC5());
+ taxCodeReqBO.setDESCSHORT(entityExcel.getDESCSHORT());
+ taxCodeReqBO.setUUID(baseService.getGenerateShotKey());
+ taxCodeReqBO.setCATEGORYNAME(entityExcel.getCATEGORYNAME());
+ taxCodeReqBO.setCATEGORYCODE(entityExcel.getCATEGORYCODE());
+ taxxtbReqBOS.add(taxCodeReqBO);
+ }
+ String str = sdEnregyService.syncMdmGroupTaxService(taxxtbReqBOS);
+ return R.ok().put("data",str);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/CommodityCodeEntityExcel.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/CommodityCodeEntityExcel.java
new file mode 100644
index 00000000..e5f6e387
--- /dev/null
+++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/CommodityCodeEntityExcel.java
@@ -0,0 +1,23 @@
+package com.dxhy.order.consumer.modules.commodity.domain.dto;
+
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class CommodityCodeEntityExcel {
+ @ExcelProperty("CODE")
+ private String CODE;
+ @ExcelProperty("DESC1")
+ private String DESC1;
+ @ExcelProperty("DESC5")
+ private String DESC5;
+ @ExcelProperty("DESCSHORT")
+ private String DESCSHORT;
+ // 物料分类编码
+ @ExcelProperty("CATEGORYNAME")
+ private String CATEGORYNAME;
+ // 物料分类名称
+ @ExcelProperty("CATEGORYCODE")
+ private String CATEGORYCODE;
+}
diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java
index 3cf706b0..db4bb2a4 100644
--- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java
+++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java
@@ -47,6 +47,7 @@ public interface ISDEnregyService {
* @return
*/
public R proactiveSyncMdmGroupTax(String code);
+ String syncMdmGroupTaxService(List taxxtbReqBOS);
/**
* 主动同步人员
diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java
index 75d9dcad..bb88a5c0 100644
--- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java
+++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java
@@ -20,7 +20,6 @@ import com.dxhy.order.consumer.openapi.protocol.AjaxResult;
import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*;
import com.dxhy.order.model.R;
import com.dxhy.order.utils.DistributedKeyMaker;
-import com.dxhy.order.utils.HttpUtils;
import com.dxhy.order.utils.JsonUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -202,7 +201,6 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
String resp = JsonUtils.getInstance().toJsonStringNullToEmpty(result);
return AjaxResult.success("success", resp);
}
-
/**
* 集团物料同步接口
*
@@ -274,24 +272,26 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
}
list.add(commodityCodeEntity);
}
-
- SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(requestBody, SDEnergyMdmBaseBO.class);
- SDEnergyMdmBaseBO result = buildResult(
- baseBO,
- list,
- i -> {
- CommodityCodeEntity t = (CommodityCodeEntity) i;
- SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO();
- resp.setCODE(t.getZxbm());
- resp.setUUID(t.getUUID());
- resp.setSYNSTATUS(t.getSuccess() ? "0" : "1");
- resp.setSYNRESULT(t.getSuccess() ? "success" : "failed");
- return resp;
- }
- );
-
- String resp = JsonUtils.getInstance().toJsonStringNullToEmpty(result);
- return AjaxResult.success("success", resp);
+ String respStr = "";
+ if(StringUtils.isNotBlank(requestBody)){
+ SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(requestBody, SDEnergyMdmBaseBO.class);
+ SDEnergyMdmBaseBO result = buildResult(
+ baseBO,
+ list,
+ i -> {
+ CommodityCodeEntity t = (CommodityCodeEntity) i;
+ SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO();
+ resp.setCODE(t.getZxbm());
+ resp.setUUID(t.getUUID());
+ resp.setSYNSTATUS(t.getSuccess() ? "0" : "1");
+ resp.setSYNRESULT(t.getSuccess() ? "success" : "failed");
+ return resp;
+ }
+ );
+
+ respStr = JsonUtils.getInstance().toJsonStringNullToEmpty(result);
+ }
+ return AjaxResult.success("success", respStr);
}
/**
@@ -454,6 +454,17 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
}
}
+ @Override
+ public String syncMdmGroupTaxService(List taxxtbReqBOS){
+ AjaxResult syncResult = this.syncMdmGroupTax(taxxtbReqBOS,null);
+ if (syncResult.isSuccess()) {
+ return "";
+ } else {
+// return R.error();
+ return null;
+ }
+ }
+
/**
* 主动同步购方信息
*