@ -833,13 +833,13 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return productFormatNew ;
}
private Map < Lo ng, List < StrObjMap > > buildProductAttrs ( List < DataItem > attributes , JSONObject sourceAttrs , String title , MoveProductPublishQueueBO queueMsg ) {
Map < Lo ng, List < StrObjMap > > matchAttrs = new HashMap < > ( ) ;
private Map < Stri ng, List < StrObjMap > > buildProductAttrs ( List < DataItem > attributes , JSONObject sourceAttrs , String title , MoveProductPublishQueueBO queueMsg ) {
Map < Stri ng, List < StrObjMap > > matchAttrs = new HashMap < > ( ) ;
for ( DataItem attribute : attributes ) {
long currAid = attribute . getPropertyId ( ) ;
List < StrObjMap > matchList = matchSourceAttr ( attribute , sourceAttrs , title ) ;
if ( ObjectUtil . isNotEmpty ( matchList ) ) {
matchAttrs . put ( currAid, matchList ) ;
matchAttrs . put ( String. valueOf ( currAid) , matchList ) ;
}
}
log . info ( JSON . toJSONString ( matchAttrs ) ) ;
@ -857,18 +857,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
} else {
matchAttr = matchProductAttributesByOption ( attribute , sourceAttrs , title ) ;
}
log . info ( "type:" + attribute . getType ( ) + "--" + JSON . toJSONString ( matchAttr ) ) ;
List < StrObjMap > result = new ArrayList < > ( ) ;
if ( ObjectUtil . isNotEmpty ( matchAttr ) ) {
for ( StrObjMap v : matchAttr ) {
StrObjMap item = new StrObjMap ( ) ;
item . put ( "name" , v . get ( "name" ) ) ;
item . put ( "diy_type" , v . get ( "diy_type" ) ) ;
item . put ( "value" , 100 ) ;
result . add ( item ) ;
}
}
return result ;
return matchAttr ;
}
public List < StrObjMap > matchProductAttributesByOption ( DataItem attribute , JSONObject sourceAttrs , String title ) {
@ -1170,7 +1159,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
sourceValue = getDefaultValueByAttrName ( attribute . getPropertyName ( ) , sourceValue ) ;
if ( sourceValue = = null & & ! isReq ) {
if ( ObjectUtil. isEmpty ( sourceValue ) & & ! isReq ) {
return null ;
}
@ -1201,18 +1190,19 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if ( ! matchSourceAttrs . isEmpty ( ) ) {
if ( sourceAttrs . containsKey ( attribute . getPropertyName ( ) ) ) {
sourceAttrs . remove ( attribute . getPropertyName ( ) ) ;
} else {
for ( String key : sourceAttrs . keySet ( ) ) {
sourceAttrs . remove ( key ) ;
}
}
// else {
// for (String key : sourceAttrs.keySet()) {
// sourceAttrs.remove(key);
// }
// }
}
if ( sourceValue ! = null ) {
StrObjMap matchAttr = new StrObjMap ( ) ;
matchAttr . put ( "name" , attribute . getPropertyName ( ) ) ;
matchAttr . put ( "name" , sourceValue ) ;
matchAttr . put ( "diy_type" , 0 ) ;
matchAttr . put ( "value" , sourceValue ) ;
matchAttr . put ( "value" , 0 ) ;
return Collections . singletonList ( matchAttr ) ;
}
return null ;