alibaba / fastjson

FASTJSON 2.0.x has been released, faster and more secure, recommend you upgrade.
https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn
Apache License 2.0
25.76k stars 6.5k forks source link

JSON.toJSONString Class java.util.HashSet does not implement the requested interface java.util.List #2942

Open jiafeijiang opened 4 years ago

jiafeijiang commented 4 years ago

FastJson version 1.2.51

  Object v = cacheManager.getByFst(ICacheKey.ORDER_COUPON_KEY + orderNo);

    if (Validator.isNotNull(v)) {
        try {
            return JSON.parseObject(JSON.toJSONString(v), MeCouponDTO.class);
        } catch (Exception e) {
            log.info("getMeCouponByOrderNo 解析缓存出错 orderNo:{}", orderNo);
        }
    }

Class

private static final long serialVersionUID = -1;

private Integer couponId;

private String description;

/**
 * 是否选用 0 未选用 1 已经选用
 */
private Integer selected;

/**
 * 是否被限制 0 未被限制 1 被限制
 */
private Integer limited;

/**
 * 是否可用 0 不可用 1 可用
 */
private Integer canUse;

/**
 * 满额
 */
private BigDecimal reachPrice;

/**
 * 减额
 */
private BigDecimal discountPrice;

/**
 * 还差额度可用
 */
private BigDecimal diffPrice;

@JsonFormat(pattern="yyyy.MM.dd", timezone = "GMT+8")
private Date startTime;

@JsonFormat(pattern="yyyy.MM.dd", timezone = "GMT+8")
private Date endTime;

private String name;

private Integer useStatus;

private Integer couponRecordId;

/**商品限制 1 优鲜全场 2 优鲜指定品类 3 指定商品**/
private Integer goodsLimit;

/**平台限制 1 不限 2 小程序 3 app**/
private Integer platformLimit;

/**
 * 城市限制 1:不限 2:限制城市
 */
private Integer cityLimit;

private Integer shopLimit;

private Integer leaderCommissionLimit;

private List<SpellCouponCategoryDTO> categoryList;

private List<SpellCityDTO> cityList;

/**
 * 当前选择商品金额
 */
private BigDecimal currentPrice;

private Set<String> goodsNoList = Sets.newHashSet();
jiafeijiang commented 4 years ago

@qifanyang 帮忙看一下

kimmking commented 4 years ago

最新的代码已经修复了hashset的反序列化问题。 请等待新版本发布,或者自己按此修改:

2936