|
@@ -239,7 +239,6 @@ public class ExcelService {
|
|
HashMap<String, List<String>> productSourceProductMap = new HashMap<>();
|
|
HashMap<String, List<String>> productSourceProductMap = new HashMap<>();
|
|
HashMap<String, List<String>> resultPMap = new HashMap<>();
|
|
HashMap<String, List<String>> resultPMap = new HashMap<>();
|
|
HashMap<String, List<String>> numMap = new HashMap<>();
|
|
HashMap<String, List<String>> numMap = new HashMap<>();
|
|
- HashMap<String, Integer> sourceMap = new HashMap<>();
|
|
|
|
HashMap<String,ProductSource> productMap = new HashMap<>();
|
|
HashMap<String,ProductSource> productMap = new HashMap<>();
|
|
|
|
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
@@ -280,34 +279,23 @@ public class ExcelService {
|
|
}
|
|
}
|
|
if(numMap.get(sceneNum) == null){
|
|
if(numMap.get(sceneNum) == null){
|
|
List<HotRelation> hotRelations = hotRelationService.getByNum(sceneNum);
|
|
List<HotRelation> hotRelations = hotRelationService.getByNum(sceneNum);
|
|
- for (HotRelation hotRelation : hotRelations) {
|
|
|
|
- sourceMap.put(hotRelation.getHotId(),hotRelation.getProductSourceId());
|
|
|
|
- }
|
|
|
|
List<String> sidList = hotRelations.stream().map(HotRelation::getHotId).collect(Collectors.toList());
|
|
List<String> sidList = hotRelations.stream().map(HotRelation::getHotId).collect(Collectors.toList());
|
|
numMap.put(sceneNum,sidList);
|
|
numMap.put(sceneNum,sidList);
|
|
}
|
|
}
|
|
- if(sourceMap.get(sid) == null){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if(!productMap.isEmpty() && !productMap.containsKey(mchId)){
|
|
|
|
- errorList.add(colum.toString());
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if(productMap.get(mchId) == null){
|
|
|
|
|
|
+ if(productMap.get(sid) == null){
|
|
ProductSource productSource = productSourceService.getByMchId(mchId);
|
|
ProductSource productSource = productSourceService.getByMchId(mchId);
|
|
if(productSource == null){
|
|
if(productSource == null){
|
|
errorList.add(colum.toString());
|
|
errorList.add(colum.toString());
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- productMap.put(mchId,productSource);
|
|
|
|
|
|
+ productMap.put(sid,productSource);
|
|
}
|
|
}
|
|
- ProductSource productSource = productMap.get(mchId);
|
|
|
|
- if(!productSource.getId().equals(sourceMap.get(sid))){
|
|
|
|
|
|
+ ProductSource productSource = productMap.get(sid);
|
|
|
|
+ if(!mchId.equals(productSource.getCdfMchId())){
|
|
errorList.add(colum.toString());
|
|
errorList.add(colum.toString());
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
if(!numMap.get(sceneNum).contains(sid)){
|
|
if(!numMap.get(sceneNum).contains(sid)){
|
|
errorList.add(colum.toString());
|
|
errorList.add(colum.toString());
|
|
continue;
|
|
continue;
|
|
@@ -419,6 +407,7 @@ public class ExcelService {
|
|
Integer colum = 1;
|
|
Integer colum = 1;
|
|
List<HashMap<Integer, String>> excelRowList = ExcelUtil.getExcelRowList(file);
|
|
List<HashMap<Integer, String>> excelRowList = ExcelUtil.getExcelRowList(file);
|
|
HashMap<String,HashMap<String,HashSet<String>>> numMap = new HashMap<>();
|
|
HashMap<String,HashMap<String,HashSet<String>>> numMap = new HashMap<>();
|
|
|
|
+ HashMap<String,ProductSource> sidProMap = new HashMap<>();
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
colum ++;
|
|
colum ++;
|
|
if(errorList.contains(colum.toString())){
|
|
if(errorList.contains(colum.toString())){
|
|
@@ -432,10 +421,18 @@ public class ExcelService {
|
|
if(StringUtils.isBlank(mchId) || StringUtils.isBlank(sceneNum) || StringUtils.isBlank(pid) || StringUtils.isBlank(sid)){
|
|
if(StringUtils.isBlank(mchId) || StringUtils.isBlank(sceneNum) || StringUtils.isBlank(pid) || StringUtils.isBlank(sid)){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(sidProMap.get(sid) == null){
|
|
|
|
+ ProductSource productSource = productSourceService.getByMchId(mchId);
|
|
|
|
+ if(productSource != null){
|
|
|
|
+ sidProMap.put(sid,productSource);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
numMap.computeIfAbsent(sceneNum, k -> new HashMap<>());
|
|
numMap.computeIfAbsent(sceneNum, k -> new HashMap<>());
|
|
numMap.get(sceneNum).computeIfAbsent(sid,k -> new HashSet<>());
|
|
numMap.get(sceneNum).computeIfAbsent(sid,k -> new HashSet<>());
|
|
numMap.get(sceneNum).get(sid).add(pid);
|
|
numMap.get(sceneNum).get(sid).add(pid);
|
|
}
|
|
}
|
|
|
|
+
|
|
List<HotRelation> updateList = new ArrayList<>();
|
|
List<HotRelation> updateList = new ArrayList<>();
|
|
for (String num : numMap.keySet()) {
|
|
for (String num : numMap.keySet()) {
|
|
HashMap<String, HashSet<String>> sidMap = numMap.get(num);
|
|
HashMap<String, HashSet<String>> sidMap = numMap.get(num);
|
|
@@ -444,8 +441,13 @@ public class ExcelService {
|
|
if(hotRelation == null){
|
|
if(hotRelation == null){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ ProductSource productSource = sidProMap.get(sid);
|
|
|
|
+ if(productSource == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
HashSet<String> pidSet = sidMap.get(sid);
|
|
HashSet<String> pidSet = sidMap.get(sid);
|
|
hotRelation.setRelationIds(JSONArray.toJSONString(pidSet));
|
|
hotRelation.setRelationIds(JSONArray.toJSONString(pidSet));
|
|
|
|
+ hotRelation.setProductSourceId(productSource.getId());
|
|
updateList.add(hotRelation);
|
|
updateList.add(hotRelation);
|
|
}
|
|
}
|
|
}
|
|
}
|