|
@@ -10,9 +10,7 @@ import com.simuwang.base.common.util.DateUtils;
|
|
import com.simuwang.base.common.util.StringUtil;
|
|
import com.simuwang.base.common.util.StringUtil;
|
|
import com.simuwang.base.components.UserAuthService;
|
|
import com.simuwang.base.components.UserAuthService;
|
|
import com.simuwang.base.mapper.daq.*;
|
|
import com.simuwang.base.mapper.daq.*;
|
|
-import com.simuwang.base.pojo.dos.AssetDO;
|
|
|
|
-import com.simuwang.base.pojo.dos.FundNavAssetDO;
|
|
|
|
-import com.simuwang.base.pojo.dos.NavDO;
|
|
|
|
|
|
+import com.simuwang.base.pojo.dos.*;
|
|
import com.simuwang.base.pojo.dto.NavAssetExcelData;
|
|
import com.simuwang.base.pojo.dto.NavAssetExcelData;
|
|
import com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery;
|
|
import com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery;
|
|
import com.simuwang.base.pojo.vo.*;
|
|
import com.simuwang.base.pojo.vo.*;
|
|
@@ -32,10 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -169,6 +164,33 @@ public class FundNavAssetServiceImpl implements FundNavAssetService {
|
|
int startRow = 3;
|
|
int startRow = 3;
|
|
List<ExcelNavAssetSuccessDataVO> successDataVOList = new ArrayList<>();
|
|
List<ExcelNavAssetSuccessDataVO> successDataVOList = new ArrayList<>();
|
|
List<ExcelNavAssetFailDataVO> excelFailDataVOList = new ArrayList<>();
|
|
List<ExcelNavAssetFailDataVO> excelFailDataVOList = new ArrayList<>();
|
|
|
|
+ Map<String,String> fundInfoMap = new HashMap<>();
|
|
|
|
+ Map<String,String> channelInfoMap = new HashMap<>();
|
|
|
|
+ try{
|
|
|
|
+ List<NavAssetExcelData> fundIdNotNullList = list.stream().filter(e -> StringUtil.isNotEmpty(e.getFundId())).collect(Collectors.toList());
|
|
|
|
+ Map<String,List<NavAssetExcelData>> fundIdMap = fundIdNotNullList.stream().collect(Collectors.groupingBy(NavAssetExcelData::getFundId));
|
|
|
|
+ List<NavAssetExcelData> fundNameNotNullList = list.stream().filter(e -> StringUtil.isNotEmpty(e.getFundName())).collect(Collectors.toList());
|
|
|
|
+ Map<String,List<NavAssetExcelData>> fundNameMap = fundNameNotNullList.stream().collect(Collectors.groupingBy(NavAssetExcelData::getFundName));
|
|
|
|
+ List<NavAssetExcelData> channelIdNotNullList = list.stream().filter(e -> StringUtil.isNotEmpty(e.getChannelId())).collect(Collectors.toList());
|
|
|
|
+ Map<String,List<NavAssetExcelData>> channelIdMap = channelIdNotNullList.stream().collect(Collectors.groupingBy(NavAssetExcelData::getChannelId));
|
|
|
|
+ if(!fundIdMap.isEmpty()){
|
|
|
|
+ Set<String> fundIdList = fundIdMap.keySet();
|
|
|
|
+ List<FundInfoDO> fundIdDOList = fundInfoMapper.searchFundInfoListByFundIdList(fundIdList.stream().toList());
|
|
|
|
+ fundIdDOList.forEach(fundInfoDO -> fundInfoMap.put(fundInfoDO.getFundId(),fundInfoDO.getFundName()));
|
|
|
|
+ }
|
|
|
|
+ if(!channelIdMap.isEmpty()){
|
|
|
|
+ Set<String> channelIdList = channelIdMap.keySet();
|
|
|
|
+ List<ChannelInfoDO> channelInfoList = channelService.selectChannelInfolist(channelIdList.stream().toList());
|
|
|
|
+ channelInfoList.forEach(channelInfoDO -> channelInfoMap.put(String.valueOf(channelInfoDO.getId()),channelInfoDO.getChannelName()));
|
|
|
|
+ }
|
|
|
|
+ if(!fundNameMap.isEmpty()){
|
|
|
|
+ Set<String> fundNameList = fundNameMap.keySet();
|
|
|
|
+ List<FundInfoDO> fundNameDOList = fundInfoMapper.searchFundInfoListByFundNameList(fundNameList.stream().toList());
|
|
|
|
+ fundNameDOList.forEach(fundInfoDO -> fundInfoMap.put(fundInfoDO.getFundName(),fundInfoDO.getFundId()));
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ logger.error(e.getMessage(),e);
|
|
|
|
+ }
|
|
for(int dataIdx=1;dataIdx<list.size(); dataIdx++){
|
|
for(int dataIdx=1;dataIdx<list.size(); dataIdx++){
|
|
NavAssetExcelData excelData = list.get(dataIdx);
|
|
NavAssetExcelData excelData = list.get(dataIdx);
|
|
try{
|
|
try{
|
|
@@ -183,13 +205,18 @@ public class FundNavAssetServiceImpl implements FundNavAssetService {
|
|
excelFailDataVOList.add(failDataVO);
|
|
excelFailDataVOList.add(failDataVO);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if(channelService.existsChannel(excelData.getChannelId())){
|
|
|
|
|
|
+ if(channelInfoMap.get(excelData.getChannelId()) == null){
|
|
ExcelNavAssetFailDataVO failDataVO = toExcelFailDataVO(excelData,ExcelConst.REQUIRE_FIELD,dataIdx+startRow);
|
|
ExcelNavAssetFailDataVO failDataVO = toExcelFailDataVO(excelData,ExcelConst.REQUIRE_FIELD,dataIdx+startRow);
|
|
excelFailDataVOList.add(failDataVO);
|
|
excelFailDataVOList.add(failDataVO);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if(StringUtil.isNotEmpty(excelData.getFundId())){
|
|
if(StringUtil.isNotEmpty(excelData.getFundId())){
|
|
- String fundName = fundInfoMapper.getFundNameByFundId(excelData.getFundId());
|
|
|
|
|
|
+ String fundName = null;
|
|
|
|
+ if(!fundInfoMap.isEmpty()){
|
|
|
|
+ fundName = fundInfoMap.get(excelData.getFundId());
|
|
|
|
+ }else{
|
|
|
|
+ fundName = fundInfoMapper.getFundNameByFundId(excelData.getFundId());
|
|
|
|
+ }
|
|
if(StringUtil.isEmpty(excelData.getFundName())){
|
|
if(StringUtil.isEmpty(excelData.getFundName())){
|
|
excelData.setFundName(fundName);
|
|
excelData.setFundName(fundName);
|
|
}
|
|
}
|
|
@@ -199,7 +226,12 @@ public class FundNavAssetServiceImpl implements FundNavAssetService {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- String fundId = fundInfoMapper.queryFundIdByName(excelData.getFundName());
|
|
|
|
|
|
+ String fundId = null;
|
|
|
|
+ if(!fundInfoMap.isEmpty()){
|
|
|
|
+ fundId = fundInfoMap.get(excelData.getFundName());
|
|
|
|
+ }else{
|
|
|
|
+ fundInfoMapper.queryFundIdByName(excelData.getFundName());
|
|
|
|
+ }
|
|
if(StringUtil.isEmpty(fundId)){
|
|
if(StringUtil.isEmpty(fundId)){
|
|
ExcelNavAssetFailDataVO failDataVO = toExcelFailDataVO(excelData,ExcelConst.NOT_MAPPING_FUND,dataIdx+startRow);
|
|
ExcelNavAssetFailDataVO failDataVO = toExcelFailDataVO(excelData,ExcelConst.NOT_MAPPING_FUND,dataIdx+startRow);
|
|
excelFailDataVOList.add(failDataVO);
|
|
excelFailDataVOList.add(failDataVO);
|