|
|
|
@ -9,6 +9,7 @@ import com.dxhy.order.baseservice.module.taxclass.service.TaxClassCodeService; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.emum.SdenergyTaxCodeMatchEnum; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMatch; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMathchImport; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.model.dto.SdenergyTaxCodeMatchDTO; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.model.dto.SdenergyTaxCodeMatchDeleteDTO; |
|
|
|
|
import com.dxhy.order.consumer.modules.taxcodematch.service.SdenergyTaxCodeMatchService; |
|
|
|
@ -132,7 +133,7 @@ public class SdenergyTaxCodeMatchController { |
|
|
|
|
for (SdenergyTaxCodeMatchEnum flowStatus : SdenergyTaxCodeMatchEnum.values()) { |
|
|
|
|
headToProperty.put(flowStatus.getKey(), flowStatus.getValue()); |
|
|
|
|
} |
|
|
|
|
ExcelReadContext context = new ExcelReadContext(SdenergyTaxCodeMatch.class, headToProperty, false); |
|
|
|
|
ExcelReadContext context = new ExcelReadContext(SdenergyTaxCodeMathchImport.class, headToProperty, false); |
|
|
|
|
if (StringUtils.isBlank(file.getOriginalFilename())) { |
|
|
|
|
context.setFilePrefix(".xlsx"); |
|
|
|
|
} else { |
|
|
|
@ -140,9 +141,9 @@ public class SdenergyTaxCodeMatchController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ExcelReadHandle handle = new ExcelReadHandle(context); |
|
|
|
|
List<SdenergyTaxCodeMatch> uploadList = new ArrayList<>(); |
|
|
|
|
List<SdenergyTaxCodeMathchImport> uploadList = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
|
uploadList = handle.readFromExcel(file.getInputStream(), SdenergyTaxCodeMatch.class); |
|
|
|
|
uploadList = handle.readFromExcel(file.getInputStream(), SdenergyTaxCodeMathchImport.class); |
|
|
|
|
} catch (ExcelReadException e) { |
|
|
|
|
log.error("{},导入物料分类编码异常", LOGGER_MSG, e); |
|
|
|
|
return R.error("导入物料分类编码异常,请重新上传"); |
|
|
|
@ -155,12 +156,12 @@ public class SdenergyTaxCodeMatchController { |
|
|
|
|
} |
|
|
|
|
List<Map<String,String>> errorMsgList = Lists.newArrayList(); |
|
|
|
|
int resultIndex = 2; |
|
|
|
|
Map<String, List<SdenergyTaxCodeMatch>> collect = uploadList.stream().collect(Collectors.groupingBy(t -> t.getSsflbm())); |
|
|
|
|
Map<String, List<SdenergyTaxCodeMathchImport>> collect = uploadList.stream().collect(Collectors.groupingBy(t -> t.getSsflbm())); |
|
|
|
|
List<String> collect1 = collect.keySet().stream().filter(t -> collect.get(t).size() > 1).collect(Collectors.toList()); |
|
|
|
|
if(!collect1.isEmpty()){ |
|
|
|
|
return R.error("导入物料分类编码异常,物料分类编码存在重复项,请检查"); |
|
|
|
|
} |
|
|
|
|
for (SdenergyTaxCodeMatch taxCodeMatch : uploadList) { |
|
|
|
|
for (SdenergyTaxCodeMathchImport taxCodeMatch : uploadList) { |
|
|
|
|
resultIndex++; |
|
|
|
|
String wlflbm = taxCodeMatch.getWlflbm(); |
|
|
|
|
if(StringUtils.isNotBlank(wlflbm)){ |
|
|
|
|