package com.hzs.bonus.constant;

import cn.hutool.core.util.ReflectUtil;
import com.hzs.common.domain.member.achieve.CuMemberRetailDetail;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BonusConstants {

    /**
     * 一阶段奖金 -- 满14，发35
     */
    public static final BigDecimal ONE_BONUS = new BigDecimal("35");
    /**
     * 二阶段奖金 -- 满14，发220
     */
    public static final BigDecimal TWO_BONUS = new BigDecimal("220");

    public static final String POINT_11 = "11";
    public static final String POINT_12 = "12";
    public static final String POINT_21 = "21";
    public static final String POINT_22 = "22";
    public static final String POINT_23 = "23";
    public static final String POINT_24 = "24";
    public static final String POINT_31 = "31";
    public static final String POINT_32 = "32";
    public static final String POINT_33 = "33";
    public static final String POINT_34 = "34";
    public static final String POINT_35 = "35";
    public static final String POINT_36 = "36";
    public static final String POINT_37 = "37";
    public static final String POINT_38 = "38";

    public static final List<String> FIELD_LIST = Arrays.asList(POINT_11, POINT_12, POINT_21, POINT_22, POINT_23, POINT_24,
            POINT_31, POINT_32, POINT_33, POINT_34, POINT_35, POINT_36, POINT_37, POINT_38);

    // 会员ID字段
    public static final String POINT_MEMBER_FIELD_NAME = "pointMember";
    // 会员子点位字段
    public static final String POINT_FIELD_NAME = "point";
    // 入库标记字段
    public static final String UPDATE_FLAG = "updateBool";

    public static Map<String, Field> FIELD_MAP = null;

    static {
        BonusConstants.FIELD_MAP = new HashMap<>();
        for (String suffix : BonusConstants.FIELD_LIST) {
            BonusConstants.FIELD_MAP.put(BonusConstants.POINT_MEMBER_FIELD_NAME + suffix, ReflectUtil.getField(CuMemberRetailDetail.class, BonusConstants.POINT_MEMBER_FIELD_NAME + suffix));
            BonusConstants.FIELD_MAP.put(BonusConstants.POINT_FIELD_NAME + suffix, ReflectUtil.getField(CuMemberRetailDetail.class, BonusConstants.POINT_FIELD_NAME + suffix));
        }
    }

}
