package com.ssm.manage.utils;

import org.apache.commons.lang.StringUtils;

import java.math.BigDecimal;

/**
 * 常量
 * */
public class Constant {

	//系统初始化日期
	public static String INITDATE ="2023-05";
	public static String ISADDITION = "isAddition";

//	public static String smsUrl = "http://smssh1.253.com/msg/send/json";//短信发送url
//	public static String smsAccount = "N215021_N0202334";//短信发送账号
//	public static String smsPassword = "RkzUyYqnF3206a";//短信发送密码


	//飞鸽
//	public static String smsUrl = "https://api.4321.sh/sms/send";//短信发送url(德美)
//	public static String smsAccount = "N714828db9";//短信发送账号(德美)
//	public static String smsPassword = "71482cf8d1725360";//短信发送密码(德美)


// todo	 公司
//	public static String smsUrl = "http://smssh1.253.com/msg/send/json";//短信发送url(德美)
//	public static String smsAccount = "N3013361";//短信发送账号(德美)
//	public static String smsPassword = "d8te7PGmUK336a";//短信发送密码(德美)


	//todo 天懿达
	public static String smsUrl = "http://smssh1.253.com/msg/v1/send/json";//短信发送url天懿达
	public static String smsAccount = "N431008_N6670142";//短信发送账号天懿达
	public static String smsPassword = "xIkpYQqLPdb063";//短信发送密码天懿达
	public static String ruzhiPhone = "ruzhiPhone";//短信发送密码天懿达
	public static String ruzhiPhoneAndTime = "staff:ruzhi:ruzhiPhoneAndTime";//短信发送密码天懿达



	public static String filePath = "/demay/img";//文件测试服务器保存地址根目录
//	public static String filePath = "/demay_formal/img";//文件正式服务器保存地址根目录

	public static String staffKey = "staffKey";//员工redis 登录key
	public static String beiSenToken = "beiSenToken";//员工redis 登录key
	public static String beiSenRefreshToken = "beiSenRefreshToken";//员工redis 登录key
	public static String loginstaffKey = "loginstaffKey";//员工redis 登录key
	public static String staffPasscode = "staffPasscode";//员工redis 验证码key

	public static String userKey = "userKey";//平台redis 登录key
	public static String hduserKey = "hduserKey";//平台redis 登录key
	public static String userPasscode = "userPassCode";//平台redis 验证码key

	public static String memberKey = "memberKey";//会员redis 登录key
	public static String staffTemporary = "staff:temporary:staffTemporary";//会员redis 登录key
	public static String memberPasscode = "memberPasscode";//会员redis 验证码key

	public static String doc_type_recharge = "card_recharge";//充值开卡
	public static String trun_doc_type_recharge = "turn_card_recharge";//会员充值卡转送
	public static String doc_type_recharge_upgrade_out = "upgrade_out";//充值卡升级转出
	public static String doc_type_recharge_upgrade_in = "upgrade_in";//充值卡升级充值
	public static String member_mobile_phone_change = "member_mobile_phone_change";//充值卡升级充值
	public static String member_mobile_phone_change_old = "member_mobile_phone_change_old";//充值卡升级充值
	public static String member_mobile_phone_change_new = "member_mobile_phone_change_new";//充值卡升级充值

	public static String doc_type_recharge_Transition_out = "recharge_Transition_out";//充值卡升级转出
	public static String doc_type_recharge_Transition_out_cancel = "recharge_Transition_out_cancel";//充值卡升级转出
	public static String doc_type_recharge_Transition_in = "recharge_Transition_in";//充值卡升级转入
	public static String doc_type_recharge_Transition_in_cancel = "recharge_Transition_in_cancel";//充值卡升级转入
	public static String doc_type_recharge_Transition = "recharge_Transition";//充值卡升级转入

	public static String doc_type_recharge_upgrade_out_clance = "upgrade_out_clance";//充值卡升级作废返回
	public static String doc_type_recharge_upgrade_in_clance = "upgrade_in_clance";//充值卡升级充值作废

	public static String doc_type_recharge_turn_course = "recharge_roll_course";//疗程转充值 转入充值卡

	public static String doc_type_recharge_demotion_out = "demotion_out";//充值卡降级转出
	public static String doc_type_recharge_demotion_in = "demotion_in";//充值卡降级充值

	public static String doc_type_recharge_demotion_out_clance = "demotion_out_clance";//充值卡降级作废返回
	public static String doc_type_recharge_demotion_in_clance = "demotion_in_clance";//充值卡降级充值作废

	public static String doc_type_card_use = "card_use";//疗程开卡
	public static String promotion_card_use = "promotion_card_use";//促销疗程开卡
	public static String turn_doc_type_card_use = "turn_card_use";//疗程开卡
	public static String doc_type_store_cash = "store_cash";//收银
	public static String doc_type_store_cash_room = "store_room";//房间床位收银
	public static String doc_type_store_cash_room_market = "store_room_market";//计算业绩使用，推荐人业绩
	public static String doc_type_store_cash_croun = "store_cash_croun";//收银
	public static String doc_type_repay = "card_repay";//充值疗程还款
	public static String doc_type_repay_promotion = "promotion_card_repay";//促销还款

	public static String doc_type_refund_recharge = "refund_recharge";//充值退款
	public static String MEMBER_LOGIN_IMGER = "member_login_image";//充值退款
	public static String doc_type_refund_course = "refund_course";//充值退款
	public static String doc_type_refund_cash = "refund_cash";//消费退款
	public static String doc_type_refund_cash_room = "refund_cash_room";//沐足消费退款
	public static String doc_type_promotion = "promotion";//促销活动
	public static String doc_type_promotion_recharge = "promotion_recharge";//促销送卡
	public static String doc_type_recharge_course = "recharge_course";//促销送卡

	public static String dabao_promotion = "dabao";//打包价
	public static String doc_type_init = "init";//初始化
	public static String doc_type_recharge_modify = "recharge_modify";//充值账户修改
	public static String doc_type_course_modify = "course_modify";//疗程账户修改
	public static String doc_type_card_change = "card_change";//加价转疗程
	public static String doc_type_card_change_nt = "card_change_nt";//内调
	public static String doc_type_platform_coupon = "platform_coupon";//优惠券
    public static String doc_type_platform_huizhi="platform_coupon_huizhi";//回执

	public static String account_type_store_cash = "cash";//账户交易记录现付收银
	public static String account_type_store_cash_room = "cash_room";//账户交易记录现付收银
	public static String account_type_store_cash_cancel = "cash_cancel";//账户交易记录现付收银作废
	public static String account_type_store_cash_cancel_room = "cash_cancel_room";//账户交易记录现付收银作废
	public static String account_type_recharge = "recharge";//账户交易记录充值
	public static String account_type_recharge_in = "recharge_in";//会员转卡充值卡包转入
	public static String account_type_recharge_out = "recharge_out";//会员转卡充值卡包转出
	public static String account_type_recharge_in_cancel = "recharge_in_cancel";//会员转卡充值卡包转入
	public static String account_type_recharge_out_cancel = "recharge_out_cancel";//会员转卡充值卡包转出
	public static String account_type_recharge_cancel = "recharge_cancel";//账户交易记录充值作废
	public static String account_type_project = "project";//账户交易记录疗程开卡
	public static String account_type_project_in = "project_in";//会员转卡疗程账户转出
	public static String account_type_project_out = "project_out";//会员转卡疗程账户转入
	public static String account_type_project_in_cancel = "project_in_cancel";//会员转卡疗程账户转出
	public static String account_type_project_out_cancel = "project_out_cancel";//会员转卡疗程账户转入
	public static String account_type_project_cancel = "project_cancel";//账户交易记录疗程开卡作废
	public static String account_type_rec_repay = "rec_repay";//账户交易记录充值还款
	public static String account_type_rec_repay_cancel = "rec_repay_cancel";//账户交易记录充值还款作废
	public static String account_type_course_repay = "course_repay";//账户交易记录疗程还款
	public static String account_type_course_repay_promotion = "promotion_course_repay";//账户交易记录促销疗程还款
	public static String account_type_course_repay_cancel_promotion = "promotion_course_repay_cancel";//账户交易记录促销疗程还款作废
	public static String account_type_course_repay_cancel = "course_repay_cancel";//账户交易记录疗程还款作废


	public static String account_type_recharge_groupon = "recharge_groupon";//团购卡购买
	public static String account_type_recharge_groupon_cancel = "recharge_groupon_cancel";//团购卡作废
	public static String recharge_groupon_card = "recharge_groupon_card";//团购卡作废

	public static String recharge_pay_Repay = "recharge_pay_Repay";//充值卡还款
	public static String recharge_pay_Repay_cancel = "recharge_pay_Repay_cancel";//充值卡还款作废
	public static String course_pay_Repay = "course_pay_Repay";//充值卡还款
	public static String course_pay_Repay_cancel = "course_pay_Repay_cancel";//充值卡还款作废

	public static String cancel_Debt = "cancel_Debt";//充值卡还款
	public static String cancel_Debt_cancel = "cancel_Debt_cancel";//充值卡还款作废

	public static String account_type_recharge_consume = "recharge_consume";//账户交易记录收银充值卡付消费
	public static String account_type_recharge_consume_room = "recharge_consume_room";//账户交易记录房间床位上钟充值卡付消费
	public static String account_type_recharge_consume_room_cancel = "recharge_consume_room_cancel";//账户交易记录房间床位上钟充值卡付消费
	public static String account_type_recharge_consume_cancel = "recharge_consume_cancel";//账户交易记录收银充值卡付消费作废
	public static String account_type_project_consume = "project_consume";//账户交易记录收银疗程卡付消费
	public static String account_type_project_consume_room = "project_consume_room";//账户交易记录房间床位收银疗程卡付消费
	public static String account_type_project_consume_cancel = "project_consume_cancel";//账户交易记录收银疗程卡付消费作废
	public static String account_type_project_consume_cancel_room = "project_consume_cancel_room";//账户交易记录房间床位收银疗程卡付消费作废
	public static String account_type_refund_recharge_audit = "refund_recharge_audit";//账户交易记录充值退款审核
	public static String account_type_refund_course_audit = "refund_course_audit";//账户交易记录充值退款审核
	public static String account_type_refund_cash_audit = "refund_cash_audit";//账户交易记录充值退款审核
	public static String account_type_refund_cash_audit_room = "refund_cash_audit_room";//账户交易记录沐足收银退款审核
	public static String account_type_refund_recharge_unaudit = "refund_recharge_unaudit";//账户交易记录充值退款审核
	public static String account_type_refund_course_unaudit = "refund_course_unaudit";//账户交易记录充值退款审核
	public static String account_type_refund_cash_unaudit = "refund_cash_unaudit";//账户交易记录充值退款审核
	public static String account_type_refund_cash_unaudit_room = "refund_cash_unaudit_room";//账户交易记录充值退款审核

	public static String account_type_recharge_turn_course = "recharge_turn_course";//账户交易记录 疗程转入充值 -审核
	public static String account_type_recharge_turn_course_cancel = "recharge_turn_course_cancel";//账户交易记录 疗程转充值 -反审核

	public static String recharge_turn_account = "recharge_turn_account";//账户交易记录 疗程转充值转出疗程 -审核  转入充值卡
	public static String recharge_rollout_account = "recharge_rollout_account";//账户交易记录 疗程转充值转出疗程 -反审核  转出充值卡

	public static String recharge_turn_account_counrse = "recharge_turn_account_counrse";//账户交易记录 疗程转充值转出疗程 -审核  转入疗程卡
	public static String recharge_rollout_account_counrse = "recharge_rollout_account_counrse";//账户交易记录 疗程转充值转出疗程 -反审核  转出疗程卡

	public static String allow_valid = "allowValid";//0不控制有效期 1控制有效期,设置到期时间
	public static String debt_ratio = "debtRatio";//疗程欠款最大比例
	public static String rec_debt_ratio = "recDebtRatio";//充值欠款最大比例
	public static String allow_debt = "allowDebt";//0表示充值不允许欠款,1表示充值允许欠款
	public static String debt_usable = "debtUsable";//数字表示欠款时可用的实充金额比例
	public static String rec_debt = "recDebt";//0表示充值不允许欠款,1表示充值允许欠款
	public static String rec_debt_usable = "recDebtUsable";//数字表示欠款时可用的实充金额比例
	public static String minimum = "minimum";//0表示无疗程、收银有最低价控制,1表示有疗程、收银有最低价控制
	public static String pro_achi_comm_verify = "proAchiCommVerify";//0表示不使用校验,1表示使用项目的业绩提成校验,主要校验提成不能大于业绩之类的数值,不使用时,数值就可以随意填写
	public static String integral = "integral";//1表示积分付不计入业绩和提成,0表示积分付计入业绩和提成
	public static String member_integral = "memberIntegral";//1表示会员有积分,0表示没有积分
	public static String exp_money_by_integral = "expMoneyByIntegral";//
	public static String exc_integral_by_money = "excIntegralByMoney";//
	public static String recharge = "recharge";//0表示购买充值不允许积分支付,1表示购买充值允许积分支付
	public static String cashier = "cashier";//1表示收银允许积分支付,0表示收银不允许积分支付
	public static String course = "course";//0表示购买疗程不允许积分支付,1表示购买疗程允许积分支付
	public static String payroll = "payroll";//工资计算方式:1 表示计件工资,2 表示底薪+月度考核工资,3 表示底薪＋计件工资
	public static String inquire = "inquire";//数字表示会员可以查询个人消费最长天数
	public static String service_ticke = "serviceTicke";//数字表示服务单可以作废控制的天数
	public static String use_recharge = "useRecharge";//1 表示按比例使用充值金额,2 表示先使用实充金额,再使用赠送金额
	public static String exceed = "exceed";//数字表是会员超过N天无消费, 停用会员
	public static String member_using = "memberUsing";//数字表示停用后启用会员要等多少天才能使用如果是0表示马上启用
	public static String refund_day = "refundDay";//数字表示消费退可以退的消费单最长天数
	public static String refund_course = "refundCourse";//0表示不控制,1表示疗程退款时的疗程单价不能超过购买疗程时的成交单价
	public static String refund_card = "refundCard";//0表示充值卡退款不需要将原来的消费按原价重新计算,1表示充值卡退款需要将原来的消费按原价重新计算
	public static String member_pay = "memberPay";//0表示会员确认支付要确认支付密码,1表示要手写签名确认,2表示要支付密码确认加手写签名确认
	public static String take_number = "takeNumber";//0表示取号通过微信扫码取号,1表示取号通过前台电脑取号
	public static String refill_card = "refillCard";//1允许充值卡购买疗程,0不允许充值卡购买疗程
	public static String buycourse = "buycourse";//0表示折扣卡购买疗程没有折扣,赠送卡不允许使用赠送金额，1表示有折扣 可以使用赠送金额
	public static String balance = "balance";//购买容差值
	public static String withinBalance = "withinBalance";//内调容差值
	public static String wechatSource = "wechatSource";//记录会员修改手机号来源
	public static String pcSource = "pcSource";//记录会员改号激活来源
	public static String editOrderNum = "editOrderNum";//业务单据最长修改天数 （ 0不受限制 ）
	public static String refunSpan = "refunSpan";//是否允许跨店还款/1=允许，0不允许
	public static String refundCourseNum = "refundCourseNum";//疗程退 ：0=按次数退，1按输金额退
	public static String promotion = "promotion";//是否允许促销欠款款/0表示充值不允许欠款,1表示充值允许欠款
	public static String promotionRatio = "promotionRatio";//促销可欠款最大比例
	public static String promotionUsable = "promotionUsable";//促销欠款可用比例
	public static String commissionCheck = "commissionCheck";//业绩提成设置校验 0=校验，1=不校验
	public static String commission_check_cash  = "commissionCheckCash ";//业绩提成收银校验 0=校验，1=不校验
	public static String Employees_SMS = "employeesSMS";//员工短信 0=发送短信，1=不发送短信
	public static String topUpControl = "topUpControl";//充值上限控制 0=控制，1=不控制
	public static String maximumAmount = "maximumAmount";//充值最大上限金额
	public static String refundRechargeType = "refundRechargeType";//0=自动按充值的单据扣除，1=手工录入扣除，2=按充值单比例扣除
	public static String cardCangeListDebt = "cardCangeListDebt";//0表示加价转疗程不允许欠款,1表示加价转疗程允许欠款
	public static String cardCangeListDebtUsable = "cardCangeListDebtUsable";//数字表示加价转疗程欠款时可用的金额比例
	public static String cardCangeListRatio = "cardCangeListRatio";//数字表示加价转疗程欠款最大比例

	/*
	* 充值业绩计算 业绩 = 占比 * 充值金额
	* */
	public static BigDecimal getAchievementAmount(BigDecimal ratio, BigDecimal totalMoney){
		BigDecimal achievementAmount = BigDecimalUtils.bigDecimal("0");
		BigDecimal hundredBD = BigDecimalUtils.bigDecimal("100");
		if (null == ratio){
			return null;
		}
		ratio = BigDecimalUtils.div(ratio, hundredBD);
		achievementAmount = BigDecimalUtils.multiply(totalMoney,ratio);
		return achievementAmount;
	}

	/*
	 * 充值提成计算 提成 = 提成比率 * (占比 * 充值金额) 使用原始数据计算 不使用计算后的业绩相乘 防止小数位四舍五入 (默认占比<1使用计算方式)
	 * */
	public static BigDecimal getCommissionAmount(BigDecimal typeRatio, BigDecimal totalMoney, BigDecimal ratio){
		BigDecimal commissionAmount = BigDecimalUtils.bigDecimal("0");
		BigDecimal hundredBD = BigDecimalUtils.bigDecimal("100");
		if (null == ratio){
			return null;
		}
		ratio = BigDecimalUtils.div(ratio, hundredBD);
		commissionAmount = BigDecimalUtils.multiply(BigDecimalUtils.multiply(totalMoney,ratio),typeRatio);
		return commissionAmount;
	}
}
