Commit 857a86f0 authored by shiyu's avatar shiyu

参数详情

parent 91c07744
package com.wwdz.ch.wx.constant;
public class CategoryExtraInfoEnum {
public enum CoinExtraInfoEnum {
PUBLISHTIME("publishTime", "铸年"),
PUBLISHER( "publisher", "铸主"),
DYNASTY( "dynasty", "王朝"),
PARVALUE( "parValue", "面值"),
DIAMETER( "diameter", "直径"),
THICKNESS("thickness", "厚度"),
WEIGHT( "weight", "重量"),
EXIQUANTITY("exiQuantity", "存世量"),
MATERIAL( "material", "材质"),
NAMESRC( "nameSrc", "命名出处"),
DESC( "desc", "细节描述"),
CATABLEIMAGE("caTableImage", "金属成分分析表"),
;
private String key;
private String name;
CoinExtraInfoEnum(String key, String name) {
this.key = key;
this.name = name;
}
public String getKey() {
return key;
}
public String getName() {
return name;
}
}
}
...@@ -2,15 +2,15 @@ package com.wwdz.ch.wx.entity.vo; ...@@ -2,15 +2,15 @@ package com.wwdz.ch.wx.entity.vo;
import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.wx.constant.CategoryExtraInfoEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.IntStream;
import java.util.Map;
@ApiModel @ApiModel
@Data @Data
...@@ -95,6 +95,11 @@ public class CategoryVo implements Serializable { ...@@ -95,6 +95,11 @@ public class CategoryVo implements Serializable {
*/ */
private String introduction; private String introduction;
/**
* 额外信息map
*/
private List<Map<String, Object>> extraInfoList = new ArrayList<>();
/** /**
...@@ -158,10 +163,10 @@ public class CategoryVo implements Serializable { ...@@ -158,10 +163,10 @@ public class CategoryVo implements Serializable {
this.name = category.getName(); this.name = category.getName();
this.icon = category.getIcon(); this.icon = category.getIcon();
this.pid = category.getPid(); this.pid = category.getPid();
this.desc = category.getDesc();
this.level = category.getLevel(); this.level = category.getLevel();
this.isLeaf = category.getIsLeaf(); this.isLeaf = category.getIsLeaf();
this.introduction = category.getIntroduction(); this.introduction = category.getIntroduction();
this.desc = category.getDesc();
if (!StringUtils.isEmpty(category.getExtra())) { if (!StringUtils.isEmpty(category.getExtra())) {
Map<String, Object> extraData = (Map<String, Object>) JSONUtils.parse(category.getExtra()); Map<String, Object> extraData = (Map<String, Object>) JSONUtils.parse(category.getExtra());
this.publishTime = extractExtra(extraData, "publishTime"); this.publishTime = extractExtra(extraData, "publishTime");
...@@ -178,7 +183,27 @@ public class CategoryVo implements Serializable { ...@@ -178,7 +183,27 @@ public class CategoryVo implements Serializable {
this.mint = extractExtra(extraData, "mint"); this.mint = extractExtra(extraData, "mint");
this.parValue = extractExtra(extraData, "parValue"); this.parValue = extractExtra(extraData, "parValue");
this.material = extractExtra(extraData, "material"); this.material = extractExtra(extraData, "material");
for (CategoryExtraInfoEnum.CoinExtraInfoEnum coinExtraInfoEnum : CategoryExtraInfoEnum.CoinExtraInfoEnum.values()){
Map<String, Object> extraInfoMap = new HashMap<>();
if (coinExtraInfoEnum.getKey().equals("caTableImage") && StringUtils.isEmpty(this.caTableImage)) {
continue;
}
extraInfoMap.put(coinExtraInfoEnum.getName(), extractExtra(extraData, coinExtraInfoEnum.getKey()));
extraInfoList.add(extraInfoMap);
}
} else {
for (CategoryExtraInfoEnum.CoinExtraInfoEnum coinExtraInfoEnum : CategoryExtraInfoEnum.CoinExtraInfoEnum.values()){
Map<String, Object> extraInfoMap = new HashMap<>();
if (coinExtraInfoEnum.getKey().equals("caTableImage")) {
continue;
}
extraInfoMap.put(coinExtraInfoEnum.getName(), null);
extraInfoList.add(extraInfoMap);
}
} }
Map<String, Object> extraInfoMap = new HashMap<>();
extraInfoMap.put("desc", category.getDesc());
extraInfoList.add(extraInfoMap);
} }
public static CategoryVo of(Category category) { public static CategoryVo of(Category category) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment