package com.lz.modules.flow.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.Constant;
import com.lz.common.utils.NumberUtil;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class TypeRoleDto {
    private String type;
    private Long roleId;

    public TypeRoleDto() {
    }

    public TypeRoleDto(String type, Long roleId) {
        this.type = type;
        this.roleId = roleId;
    }

    public static Long getRoleId(String flowInfo, Integer type) {
        Map<String, Long> a = JSONObject.parseObject(flowInfo, Map.class);
        return NumberUtil.objToLongDefault(a.get(Constant.TYPE + type),0l);
    }


    public static void main(String[] args) {
        Map<String,Long > a  = JSONObject.parseObject("{\"type2\":3,\"type1\":3}",Map.class);
        System.out.println(a.get("type1"));
    }


}
