|
|
@ -19,10 +19,7 @@ import org.phprpc.util.AssocArray;
|
|
|
|
import org.phprpc.util.PHPSerializer;
|
|
|
|
import org.phprpc.util.PHPSerializer;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
@ -68,24 +65,21 @@ public class GetProductInfoByProductId extends SPIBaseService implements Extensi
|
|
|
|
MoveSystemSourceCategory moveSystemSourceCategory = moveSystemSourceCategoryService.selectBySourceCategoryId(sourceCategoryId.toString());
|
|
|
|
MoveSystemSourceCategory moveSystemSourceCategory = moveSystemSourceCategoryService.selectBySourceCategoryId(sourceCategoryId.toString());
|
|
|
|
if (!ObjectUtil.isEmpty(moveSystemSourceCategory)) {
|
|
|
|
if (!ObjectUtil.isEmpty(moveSystemSourceCategory)) {
|
|
|
|
Long moveSystemSourceCategoryId = moveSystemSourceCategory.getMoveSystemSourceCategoryId();
|
|
|
|
Long moveSystemSourceCategoryId = moveSystemSourceCategory.getMoveSystemSourceCategoryId();
|
|
|
|
product.put("dsCid", moveSystemSourceCategoryId);
|
|
|
|
|
|
|
|
PHPSerializer p = new PHPSerializer();
|
|
|
|
PHPSerializer p = new PHPSerializer();
|
|
|
|
// Map map = (Map) p.unserialize(moveSystemSourceCategory.getMatchCategoryList().getBytes());
|
|
|
|
String content = moveSystemSourceCategory.getMatchCategoryList();
|
|
|
|
// map = sortByKey(map);
|
|
|
|
AssocArray assocArray = (AssocArray) p.unserialize(content.getBytes());
|
|
|
|
// String content = moveSystemSourceCategory.getMatchCategoryList();
|
|
|
|
Map assocMap = assocArrayToHash(assocArray);
|
|
|
|
String content ="a:10:{i:0;s:18:\"舞蹈(私教)\";i:1;s:5:\"Zumba\";i:2;s:12:\"完美塑造\";i:3;s:12:\"战斗有氧\";i:4;s:12:\"杠铃雕塑\";i:5;s:12:\"核心特训\";i:6;s:12:\"漫步舞林\";i:7;s:12:\"身体平衡\";i:8;s:12:\"高效冲击\";i:9;s:12:\"魅力热舞\";}";
|
|
|
|
List<Object> assocMapValues = new ArrayList<>(assocMap.values());
|
|
|
|
// String content ="a:2:{i:26953;a:2:{s:4:\"type\";s:6:\"manual\";s:4:\"path\";s:32:\"内衣裤袜>女士内衣>抹胸\";}i:24928;a:2:{s:4:\"type\";s:6:\"manual\";s:4:\"path\";s:112:\"童装/婴儿装/亲子装>帽子/围巾/口罩/手套/耳套/脚套>多件套 帽子、围巾、手套等组合\";}}";
|
|
|
|
Map inMap = (Map) assocMapValues.get(assocMapValues.size() - 1);
|
|
|
|
log.info("dsCategoryList:::" + content);
|
|
|
|
List<String> assocMapKeys = new ArrayList<>(assocMap.keySet());
|
|
|
|
Object unserialize = p.unserialize(content.getBytes("utf-8"));//数据转格式
|
|
|
|
|
|
|
|
AssocArray array = (AssocArray) unserialize;
|
|
|
|
|
|
|
|
log.info("dsCategoryList:::" + array);
|
|
|
|
|
|
|
|
List<Object> listResult = new ArrayList<Object>();
|
|
|
|
|
|
|
|
for (int s = 0; s < array.size(); s++) {
|
|
|
|
|
|
|
|
log.info("arrayList:::" + array.toHashMap());
|
|
|
|
|
|
|
|
listResult.add(new String((byte[])array.get(s)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
product.put("dsCategoryList", listResult);
|
|
|
|
log.info("assocArrayToHash" + inMap.get("path"));
|
|
|
|
|
|
|
|
log.info("assocArrayToHash" + assocMapKeys.get(assocMapKeys.size() - 1));
|
|
|
|
|
|
|
|
product.put("ddCid", inMap.get("path"));
|
|
|
|
|
|
|
|
product.put("ddCategoryList", assocMapKeys.get(assocMapKeys.size() - 1));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
product.put("ddCid", "");
|
|
|
|
|
|
|
|
product.put("ddCategoryList", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
productInfo.add(resObj.getJSONObject("productInfo"));
|
|
|
|
productInfo.add(resObj.getJSONObject("productInfo"));
|
|
|
|
log.info(res);
|
|
|
|
log.info(res);
|
|
|
@ -103,4 +97,20 @@ public class GetProductInfoByProductId extends SPIBaseService implements Extensi
|
|
|
|
// ----结果返回----
|
|
|
|
// ----结果返回----
|
|
|
|
return R.ok(Ret.success(result));
|
|
|
|
return R.ok(Ret.success(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Map assocArrayToHash(AssocArray assocArray) {
|
|
|
|
|
|
|
|
HashMap hashMap = assocArray.toHashMap();
|
|
|
|
|
|
|
|
Map result = new HashMap();
|
|
|
|
|
|
|
|
for (Object key : hashMap.keySet()) {
|
|
|
|
|
|
|
|
if(hashMap.get(key) instanceof AssocArray) {
|
|
|
|
|
|
|
|
result.put(key.toString(),assocArrayToHash((AssocArray) hashMap.get(key)));
|
|
|
|
|
|
|
|
}else if(hashMap.get(key) instanceof byte[]) {
|
|
|
|
|
|
|
|
result.put(key.toString(),new String((byte[]) hashMap.get(key)));
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
result.put(key.toString(),hashMap.get(key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info(result + "result");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|