bug:物料分类编码导入失败

release
WangQi 2 years ago
parent 96b269ffa6
commit d98cb5dc64
  1. 2
      .gitignore
  2. 11
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/controller/SdenergyTaxCodeMatchController.java
  3. 3
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/dao/SdenergyTaxCodeMatchDao.java
  4. 25
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/entity/SdenergyTaxCodeMathchImport.java
  5. 3
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/service/SdenergyTaxCodeMatchService.java
  6. 3
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/service/impl/SdenergyTaxCodeMatchServiceImpl.java

2
.gitignore vendored

@ -14,6 +14,8 @@
*/target/
*/.classpath
*/*.iml
order-management-consumer/src/main/resources/bootstrap.yaml
order-management-consumer/src/main/resources/generator.properties
## 其他web 模式忽略文件
order-management-consumer/src/main/resources/META-INF/

@ -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)){

@ -1,6 +1,7 @@
package com.dxhy.order.consumer.modules.taxcodematch.dao;
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMatch;
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMathchImport;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -77,6 +78,6 @@ public interface SdenergyTaxCodeMatchDao {
* @param id
* @return
*/
int batchInsert(List<SdenergyTaxCodeMatch> id);
int batchInsert(List<SdenergyTaxCodeMathchImport> id);
}

@ -0,0 +1,25 @@
package com.dxhy.order.consumer.modules.taxcodematch.entity;
import lombok.Data;
@Data
public class SdenergyTaxCodeMathchImport {
/**
* 物料分类编码
*/
private String wlflbm;
/**
* 物料名称
*/
private String flmc;
/**
* 税收分类编码
*/
private String ssflbm;
/**
* 税收分类名称
*/
private String ssflmc;
}

@ -1,6 +1,7 @@
package com.dxhy.order.consumer.modules.taxcodematch.service;
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.model.PageUtils;
@ -59,7 +60,7 @@ public interface SdenergyTaxCodeMatchService {
boolean deleteById(Long id);
int upload(List<SdenergyTaxCodeMatch> list);
int upload(List<SdenergyTaxCodeMathchImport> list);
SdenergyTaxCodeMatch queryByWlflbm(String wlflbm);

@ -3,6 +3,7 @@ package com.dxhy.order.consumer.modules.taxcodematch.service.impl;
import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity;
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMatch;
import com.dxhy.order.consumer.modules.taxcodematch.dao.SdenergyTaxCodeMatchDao;
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.service.SdenergyTaxCodeMatchService;
import com.dxhy.order.model.PageUtils;
@ -117,7 +118,7 @@ public class SdenergyTaxCodeMatchServiceImpl implements SdenergyTaxCodeMatchServ
*/
@Override
@Transactional
public int upload(List<SdenergyTaxCodeMatch> list) {
public int upload(List<SdenergyTaxCodeMathchImport> list) {
return this.sdenergyTaxCodeMatchDao.batchInsert(list);
}

Loading…
Cancel
Save