|
|
@ -35,10 +35,7 @@ import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -89,7 +86,7 @@ public class BmsChannelPointController { |
|
|
|
} |
|
|
|
|
|
|
|
if(param.getExportNum() != null && param.getExportNum()!= 0 |
|
|
|
&& param.getStartNum() != null && param.getStartNum()!= 0){ |
|
|
|
&& param.getStartNum() != null ){ |
|
|
|
lqw.last(" limit "+param.getStartNum() + "," + param.getExportNum()); |
|
|
|
} |
|
|
|
|
|
|
@ -337,9 +334,9 @@ public class BmsChannelPointController { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
List<BmsChannelPoint4ExcelBo> saveList = param.stream().filter(a->a.getType().equals("1")).collect(Collectors.toList()); |
|
|
|
List<BmsChannelPoint4ExcelBo> updateList = param.stream().filter(a->a.getType().equals("2")).collect(Collectors.toList()); |
|
|
|
List<BmsChannelPoint4ExcelBo> deleteList = param.stream().filter(a->a.getType().equals("3")).collect(Collectors.toList()); |
|
|
|
List<BmsChannelPoint4ExcelBo> saveList = param.stream().filter(a-> "1".equals(a.getType())).collect(Collectors.toList()); |
|
|
|
List<BmsChannelPoint4ExcelBo> updateList = param.stream().filter(a-> "2".equals(a.getType())).collect(Collectors.toList()); |
|
|
|
List<BmsChannelPoint4ExcelBo> deleteList = param.stream().filter(a-> "3".equals(a.getType())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
/** ------------------------------- 查渠道列表 ------------------------------------------------ */ |
|
|
|
List<String> channelCodes = new ArrayList<>(); |
|
|
@ -363,12 +360,16 @@ public class BmsChannelPointController { |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String,BmsChannel> codeToChannaledId = channelList.stream().collect(Collectors.toMap(BmsChannel::getChannelCode, a->a)); |
|
|
|
//有重复的key这个方法会报错
|
|
|
|
//Map<String,BmsChannel> codeToChannaledId = channelList.stream().collect(Collectors.toMap(BmsChannel::getChannelCode, a->a));
|
|
|
|
Map<String,BmsChannel> codeToChannaledId = channelList.stream() |
|
|
|
.filter(a->a.getChannelCode()!=null) |
|
|
|
.collect(Collectors.toMap(BmsChannel::getChannelCode, p -> p, (o, n) -> n)); |
|
|
|
/** ----------------------------------------------------------------------------------- */ |
|
|
|
/** ------------------------------- 查行政区域列表 ------------------------------------------------ */ |
|
|
|
List<String> bizRegionCodes = new ArrayList<>(); |
|
|
|
bizRegionCodes.addAll(saveList.stream().filter(a->a.getBizRegionCode()!=null).map(a->a.getBizRegionCode()).collect(Collectors.toList())); |
|
|
|
bizRegionCodes.addAll(updateList.stream().filter(a->a.getBizRegionCode()!=null).map(a->a.getBizRegionCode()).collect(Collectors.toList())); |
|
|
|
bizRegionCodes.addAll(saveList.stream().map(BmsChannelPoint4ExcelBo::getBizRegionCode).filter(Objects::nonNull).collect(Collectors.toList())); |
|
|
|
bizRegionCodes.addAll(updateList.stream().map(BmsChannelPoint4ExcelBo::getBizRegionCode).filter(Objects::nonNull).collect(Collectors.toList())); |
|
|
|
bizRegionCodes = bizRegionCodes.stream().distinct().collect(Collectors.toList()); |
|
|
|
List<BmsRegion2> region2List = new ArrayList<>(); |
|
|
|
if(bizRegionCodes.size()>0){ |
|
|
@ -463,7 +464,7 @@ public class BmsChannelPointController { |
|
|
|
|
|
|
|
/** ----------------------------------------------------------------------------------- */ |
|
|
|
/** ------------------------------- 返回错误 ------------------------------------------- */ |
|
|
|
if(param.stream().filter(a->a.getErrorInfo().length()>0).count()>0) { |
|
|
|
if(param.stream().filter(a->a.getErrorInfo()!=null&&a.getErrorInfo().length()>0).count()>0) { |
|
|
|
return R.ok(param, "导入失败,请打开EXCEL查询错误详情!"); |
|
|
|
} |
|
|
|
|
|
|
|