|
|
|
@ -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<CommodityCodeEntityExcel> 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<MdmSyncGroupTaxCodeReqBO> 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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|