/**
 * bobotuan.com Inc.
 * Copyright (c) 2004-2020 All Rights Reserved.
 */
package com.qs.mp.framework.domain;

import com.qs.mp.admin.domain.Marketing;
import com.qs.mp.common.utils.DateUtils;
import java.util.HashMap;

/**
 * 微信订阅消息（具体参见https://developers.weixin.qq
 * .com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html）
 *
 *
 *
 * @author chunping.zhongcp
 * @version $Id: WxUniformMessage.java, v 0.1 2020/6/7 chunping.zhongcp Exp $
 */
public class WxSubscribeMessage {
    private String appId ;
    private String touser;
    private String template_id ;
    private String page = "/pages/index/index";// 首页
    private String miniprogram_state;
    private String lang;
    private HashMap<String, WeappDataValue> data = new HashMap<String, WeappDataValue>();

    public String getAppId() { return appId; }

    public String getTouser() {
        return touser;
    }

    public String getTemplate_id() {
        return template_id;
    }

    public String getPage() {
        return page;
    }

    public String getMiniprogram_state() {
        return miniprogram_state;
    }

    public String getLang() {
        return lang;
    }

    public HashMap<String, WeappDataValue> getData() {
        return data;
    }

    public class WeappDataValue{
        private String value;
        public WeappDataValue(String input){
            value = input;
        }

        public String getValue() {
            return value;
        }
    }


    /**
     * 通知消息
     *
     * @param openid 用户id
     */
    public WxSubscribeMessage(String appId, String openid,  String state){
        appId = appId;
        touser = openid;
//        page = page + actId ;
        miniprogram_state = state;
    }


    /**
     * 活动助力成功通知消息
     * @param marketing
     */
    public void buildMarketingHelpSuccessMessage(Marketing marketing){
        template_id = "92xxL8XTRPLROyNUtmN04OT0kyq4iwSCH3sz-j6zbZs";
        page = "/packageOperate/activity/index?id=" + marketing.getId();

        /**
         * 活动名称
         * {{thing1.DATA}}
         *
         * 温馨提示
         * {{thing3.DATA}}
         */
        data.put("thing1", new WeappDataValue(marketing.getTitle()));
        data.put("thing3", new WeappDataValue("获得一个抽奖码,点击查看>>"));
    }



    /**
     * 活动开始提醒消息
     * @param marketing
     */
    public void buildMarketingStartSuccessMessage(Marketing marketing){
        template_id = "FGcPOV1j9ApESr3VUlWjFr6E1vF4X_h0LLN82T2CLL0";
        page = "/pages/activity/index";

        /**
         * 活动名称
         * {{thing1.DATA}}
         *
         * 温馨提示
         * {{thing5.DATA}}
         */
        data.put("thing1", new WeappDataValue(marketing.getTitle()));
        data.put("thing5", new WeappDataValue("点击马上参与>>"));
    }



        /**
         * 活动开奖消息
         */
    public void buildMarketingLotterySuccessMessage(Marketing marketing){
        template_id = "3y_My-yRmqmGd3-f-vAwNaK4LQeehzXBSNDi_5wcnFI";
        page = "/packageOperate/activity/record?id=" + marketing.getId();
        /**
         * 活动名称
         * {{thing1.DATA}}
         *
         * 温馨提示
         * {{thing5.DATA}}
         */
        data.put("thing1", new WeappDataValue(marketing.getTitle()));
        data.put("thing5", new WeappDataValue("看看你中奖了吗?"));
    }


/*
    public void buildBillPaySuccessMessage(MerchantBill merchantBill){
        template_id = "1F2Hrqfr8fS--3CWeUOkDCjP83U6WTcfnBfqG7CYdKM";
        page = "/pages/bills/detail?id=" + merchantBill.getBillId() + "&custId=" + merchantBill.getCustId();
        *//**
         *         缴费类型
         *         {{thing1.DATA}}
         *         缴费金额
         *         {{amount2.DATA}}
         *         缴费时间
         *         {{date3.DATA}}
         *         缴费状态
         *         {{phrase4.DATA}}
         *//*
        data.put("thing1", new WeappDataValue(DateUtils.dateTime(merchantBill.getBillingDay()) + "账单"));
        data.put("amount2", new WeappDataValue(String.valueOf(merchantBill.getPayedAmt()/100)  + "元"));
        data.put("date3", new WeappDataValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, merchantBill.getPayTime())));
        data.put("phrase4", new WeappDataValue("缴费成功"));
    }

    public void buildBillPayFailMessage(MerchantBill merchantBill){
        template_id = "2OotDCg0jDon0g5G_Wguagd1meZHzet6Mk0xX_RD7yM";
        page = "/pages/bills/detail?id=" + merchantBill.getBillId() + "&custId=" + merchantBill.getCustId();
        *//**
         *  缴费类型
         * {{thing1.DATA}}
         *
         * 缴费金额
         * {{amount2.DATA}}
         *
         * 备注
         * {{thing3.DATA}}
         *//*
        data.put("thing1", new WeappDataValue(DateUtils.dateTime(merchantBill.getBillingDay()) + "账单"));
        data.put("amount2", new WeappDataValue(String.valueOf(merchantBill.getBillAmt()/100)  + "元"));
        data.put("thing3", new WeappDataValue("账户余额不足，请及时充值，以免造成不必要的损失！"));
    }

    public void buildBillPayRemindMessage(MerchantBill merchantBill){
        template_id = "WPygplj4MDmHGINZk6NcR2Ta6WzYFHyYZATvDXKcepU";
        page = "/pages/bills/detail?id=" + merchantBill.getBillId() + "&custId=" + merchantBill.getCustId();
        *//**
         *  缴费项目
         * {{thing9.DATA}}
         *
         * 应缴金额
         * {{amount4.DATA}}
         *
         * 最晚支付日期
         * {{time5.DATA}}
         *
         * 备注
         * {{thing11.DATA}}
         *//*
        data.put("thing9", new WeappDataValue(DateUtils.dateTime(merchantBill.getBillingDay()) + "账单"));
        data.put("amount4", new WeappDataValue(String.valueOf(merchantBill.getBillAmt()/100)  + "元"));
        data.put("time5", new WeappDataValue(DateUtils.dateTime(DateUtils.addDays(merchantBill.getBillingDay(),3))));
        data.put("thing11", new WeappDataValue("账单金额超出限额，请线下转账到指定银行卡号，完成后再到云管铺小程序中提交转账凭证，以便财务核实！"));
    }

    public void buildDepositRemindMessage(Merchant merchant){
        template_id = "djSQrpMGAqH6xV5JEVsI3l-CqGGUXXY_IZG8CCt8V4E";
        page = "/pages/deposit/index?merchId=" + merchant.getMerchId() + "&custId=" + merchant.getCustId();
        *//**
         *  服务类型
         * {{thing1.DATA}}
         *
         * 余额
         * {{thing3.DATA}}
         *
         * 备注
         * {{thing4.DATA}}
         *//*
        data.put("thing1", new WeappDataValue("充值提醒通知"));
        data.put("thing3", new WeappDataValue(String.valueOf(merchant.getMoney()/100) + "元"));
        data.put("thing4", new WeappDataValue("账户余额低于阀值，请及时充值，以免造成不必要的损失！"));
    }*/


}
