package com.ssm.core.utils;

import com.alibaba.fastjson.JSON;
import com.ssm.manage.entity.*;
import com.ssm.manage.query.SmsSendRequest;
import com.ssm.manage.response.ResponseCode;
import com.ssm.manage.response.SmsSendResponse;
import com.ssm.manage.response.UserResponse;
import com.ssm.manage.utils.Constant;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

//import java.io.PrintWriter;

/**
 *
 * @author tianyh
 * @Description:HTTP 请求
 */

public class ChuangLanSmsUtil {

	/***
	 * 胜联开卡
	 */
	public static void sendSLCardUseSms(BaseStore baseStore, String memberName, String phone, String projectName, Integer projectTime) throws IOException, SmsException {
		/*String sex = "女士";
		if(isMan) {
			sex = "先生";
		}*/
		if(baseStore.getMessagingPlatform()==0){
			//深圳创蓝
			String msg ="【"+baseStore.getSignId()+"】 "+"尊敬的"+ memberName +"客户，感谢您选择了胜联高尔夫，成为我们的尊贵会员。您购买" + projectName + "成功,账户余额：" + projectTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);

		}else{
			String msg = "尊敬的"+ memberName +"客户，感谢您选择了胜联高尔夫，成为我们的尊贵会员。您购买" + projectName + "成功,账户余额：" + projectTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 胜联项目付收银
	 */
	public static void sendSLStoreCashProjectPaySms(BaseStore baseStore, String memberName, String phone, String projectName, Integer projectTime,Integer projectRestTime) throws IOException, SmsException {
		/*String sex = "女士";
		if(isMan) {
			sex = "先生";
		}*/
		if(baseStore.getMessagingPlatform()==0){
			String msg = "【"+baseStore.getSignId()+"】 "+"尊敬的" + memberName + "会员，您本次消费的" + projectName + ",消费了" + projectTime + "小时/节课，剩余" + projectRestTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			String msg = "尊敬的" + memberName + "会员，您本次消费的" + projectName + ",消费了" + projectTime + "小时/节课，剩余" + projectRestTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendSLStoreCashProjectPaySmsNew(BaseStore baseStore, String memberName, String phone, String projectName, Integer projectTime,Integer projectRestTime) throws IOException, SmsException {
		/*String sex = "女士";
		if(isMan) {
			sex = "先生";
		}*/
//		if(baseStore.getMessagingPlatform()==0){
//			String msg = "【"+baseStore.getSignId()+"】 "+"尊敬的" + memberName + "会员，您本次消费的" + projectName + ",消费了" + projectTime + "小时/节课，剩余" + projectRestTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
//			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
//		}else{
//			String msg = "尊敬的" + memberName + "会员，您本次消费的" + projectName + ",消费了" + projectTime + "小时/节课，剩余" + projectRestTime + "小时/节课。欢迎您再次莅临！客服电话：18948983125---德财美业";
//			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
//		}
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "尊敬的"+memberName+"会员：您本次消费"+projectName+"项目"+projectTime+
						"次。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = msg = "尊敬的"+memberName+"会员：您本次消费"+projectName+"项目" +projectTime+
						"次。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			if(baseStore.getSignId()!=null){
				msg = "【" + baseStore.getSignId() + "】"+msg;
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "尊敬的【"+memberName+"】会员：您本次消费【"+projectName+"】【" +projectTime+
						"】次。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = msg = "尊敬的【"+memberName+"】会员：您本次消费【"+projectName+"】【" +projectTime+
						"】次。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendSLStoreCashProjectPaySmsNewBySmsFix(BaseStore baseStore, AccountTradeRecord accountTradeRecord,SmsFix smsFix) throws IOException, SmsException {
		Map<String,String> map = new HashMap<>();
		String phone = accountTradeRecord.getMemberPhone().trim();
		map.put("memberName",accountTradeRecord.getMemberName());
		map.put("projectName",accountTradeRecord.getTradeName());
		map.put("projectTime",accountTradeRecord.getTradeCount().toString());
		map.put("memberPhone",phone);
		map.put("storePhone",baseStore.getTelephone());
		map.put("customerPhone","18620905828");
		String msg = smsReplace(map, smsFix.getSmsBody());

//		if(baseStore.getSignId()!=null){
//				msg = "【" + baseStore.getSignId() + "】"+msg;
//		}
		System.out.println(msg);
		SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
//		SmsType.sendSmsCode(Constant.smsUrl.trim(), Constant.smsAccount.trim(),Constant.smsPassword, phone, msg);


	}
	/***
	 * 获取导出会员短信验证码
	 */
	public static void sendStoreCode(BaseStore baseStore, String code, String staffName,String storeName,String iphone) throws IOException, SmsException {
		String msg = null;
		if(null == baseStore.getTelephone()){
			msg = baseStore.getRegistrant() + "你的门店组织下的【"+storeName+"】门店的员工【"+staffName+"】正在申请导出会员全部信息,申请验证码为:"+ code+"---德财美业";
		}else{
			msg = baseStore.getRegistrant() + "你的门店组织下的【"+storeName+"】门店的员工【"+staffName+"】正在申请导出会员全部信息,申请验证码为:"+ code+",服务电话："+baseStore.getTelephone()+"---德财美业";
		}
		SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, iphone, msg);
	}


	/***
	 * 门店注册成功短信
	 */
	public static void sendStoreInitPwdSms(BaseStore baseStore, String pwd) throws IOException, SmsException {
		String msg =null;
		if(null == baseStore.getParentId()){
			if(null == baseStore.getTelephone()){
				msg = baseStore.getRegistrant() + "先生/女士,您申请的店铺已经开通,初始密码为:"+ pwd.trim()+"先生/女士,您申请的分店已经开通,您开通的年限为："+baseStore.getOpeningYear()+"---德财美业";
			}else{
				msg = baseStore.getRegistrant() + "先生/女士,您申请的店铺已经开通,初始密码为:"+ pwd.trim()+",服务电话："+baseStore.getTelephone()+"先生/女士,您申请的分店已经开通,您开通的年限为："+baseStore.getOpeningYear()+"---德财美业";
			}

		}else{
			if(null == baseStore.getTelephone()){
				msg = baseStore.getRegistrant() + "先生/女士,您申请的分店已经开通,您开通的年限为："+baseStore.getOpeningYear()+"您的初始密码为"+pwd.trim()+"+---德财美业";
			}else{
				msg = baseStore.getRegistrant() + "先生/女士,您申请的分店已经开通,您开通的年限为："+baseStore.getOpeningYear()+"服务电话为："+baseStore.getTelephone()+"您的初始密码为"+pwd.trim()+"---德财美业";
			}

		}

		SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, baseStore.getRegistrantMobilePhone(), msg);
	}


	/***
	 * 门店注册成功短信
	 */
	public static void sendAddStore(BaseStore baseStore) throws Exception, SmsException {
		String msg = "系统管理员您好，现在有客户： ["+baseStore.getRegistrant()+"] 正在申请开店，客户的手机号码为 ["+ baseStore.getRegistrantMobilePhone() +"],请尽快审核";
		SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, "18902223487", msg);
	}

	/***
	 * 门店注册成功短信
	 */
	public static void sendStoreInitPwdpayment(BaseStore baseStore, String pwd) throws IOException, SmsException {
		String msg =null;
		if(null == baseStore.getTelephone()){
			msg = baseStore.getRegistrant() + "先生/女士,您申请的店铺已经设置通用支付密码,初始密码为:"+ pwd+"---德财美业";
		}else{
			msg = baseStore.getRegistrant() + "先生/女士,您申请的店铺已经设置通用支付密码,初始密码为:"+ pwd+",服务电话："+baseStore.getTelephone()+"---德财美业";
		}
		SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, baseStore.getRegistrantMobilePhone(), msg);
	}


	/***
	 * 验证码短信
	 */
	public static UserResponse sendCheckSms(BaseStore baseStore, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
//			return  SmsType.sendSmsCode(Constant.smsUrl,Constant.smsAccount, Constant.smsPassword, phone, msg);
			return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效---德财美业";
			}else{
				msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			return  SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	public static UserResponse sendCheckSmsNew(BaseStore baseStore, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效,服务电话："+baseStore.getTelephone();
			}
			return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);

		}else{
			if(null == baseStore.getTelephone()){
				msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效";
			}else{
				msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,10分钟内有效,服务电话："+baseStore.getTelephone();
			}
			return  SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 验证码短信
	 */
	public static UserResponse sendCheckSmss(BaseStore baseStore,String phone, Integer pwd) throws IOException, SmsException {
		String msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,3分钟内有效---德财美业";
		return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
	}

	public static UserResponse sendCheckCode(BaseStore baseStore,String phone, Integer pwd) throws IOException, SmsException {
		String msg = "您的验证码是:" + pwd + ",请确认是您本人在操作,并注意保管,3分钟内有效";
		return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
	}

	public static UserResponse getDynamicPsw(BaseStore baseStore,String phone, Integer pwd,Integer PswTime) throws IOException, SmsException {
		String msg = "【"+baseStore.getSignId()+"】您的动态密码是:" + pwd + "("+baseStore.getStoreNum()+"),请确认是您本人在操作,并注意保管,"+PswTime+"分钟内有效";
		return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
	}

	/**
	 * 发送登录密码短信
	 */
	public static UserResponse getPsw(List<BaseStaff> baseStaffList, BaseStore baseStore, String phone) throws IOException, SmsException {
		String msg="";
		for(BaseStaff baseStaff1:baseStaffList){
			try {
				String password=AESUtils.decrypt(baseStaff1.getPassword());
				msg +="您在" + baseStaff1.getStoreName() + "的登录密码为："+password.trim()+",请确认是您本人在操作,并注意保管。"+" \n \n";
			} catch (Exception e) {
				throw new SmsException(ResponseCode.DECRYPT_FAILED);
			}
		}
		return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
	}

	/***
	 * 验证码短信
	 */
	public static UserResponse sendCheckSmsPassword(BaseStore baseStore, String phone, String pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 "+ "你本次获取的账号"+phone.trim()+"密码是:" + pwd.trim() + ",请确认是您本人在操作,并注意保管---德财美业";
			}else{
				msg ="【"+baseStore.getSignId()+"】 "+ "你本次获取的账号"+phone.trim()+"密码是:" + pwd.trim() + ",请确认是您本人在操作,并注意保管,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			return  SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "你本次获取的账号"+phone+"密码是:" + pwd + ",请确认是您本人在操作,并注意保管---德财美业";
			}else{
				msg = "你本次获取的账号"+phone+"密码是:" + pwd + ",请确认是您本人在操作,并注意保管,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			return   SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}


	/***
	 * 会员初始密码短信
	 */
	public static void sendMemberInitPwdSms(BaseStore baseStore,String memberName, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(null == baseStore.getTelephone()){
			msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,初始密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录---德财美业";
		}else{
			msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,初始密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录,服务电话："+baseStore.getTelephone()+"---德财美业";
		}
		SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
	}

	/**
	 * 团购会员
	 * @param baseStore
	 * @param memberName
	 * @param phone
	 * @param pwd
	 * @throws IOException
	 * @throws SmsException
	 */
	public static void sendMemberInitPwdSmsTG(BaseStore baseStore, String memberName, String phone, Integer pwd, Integer cashPwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录---德财美业";
			}else{
				msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录---德财美业";
			}else{
				msg = memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.您可以通过微信小程序DCMY,用注册手机号进行登录,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}
	}
	public static void sendMemberInitPwdSmsTGNew(BaseStore baseStore, String memberName, String phone, Integer pwd, Integer cashPwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.";
			}else{
				msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.";
			}else{
				msg = memberName + "先生/女士,您的会员已经开通,支付密码为："+cashPwd+",初始登录密码为:" + pwd + ",请妥善保管.服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}
	}

	/***
	 * 会员重置密码短信
	 */
	public static void sendMemberRestPwdSms(BaseStore baseStore,String memberName, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 本次动态登录密码为 "+ pwd + " ，此动态密码十分钟之内有效---德财美业";
			}else{
				msg ="【"+baseStore.getSignId()+"】 本次动态登录密码为 "+ pwd + " ，此动态密码十分钟之内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg ="本次动态登录密码为 "+ pwd + " ，此动态密码十分钟之内有效---德财美业";
			}else{
				msg ="本次动态登录密码为 "+ pwd + " ，此动态密码十分钟之内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员重置密码短信
	 */
	public static void sendMemberRestCashPwdSms(BaseStore baseStore,String memberName, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 本次动态支付密码为 "+  pwd + "，此动态密码十分钟之内有效---德财美业";
			}else{
				msg ="【"+baseStore.getSignId()+"】 本次动态支付密码为 "+  pwd + "，此动态密码十分钟之内有效,服务电话：" +baseStore.getTelephone()+"---德财美业";
			}
//			String msg ="【"+baseStore.getSignId()+"】 "+ memberName + "先生/女士,您的会员支付密码已重置,重置密码为:" + pwd + ",请尽快通过微信小程序DCMY进行登录更改新的密码，此重置密码十分钟之内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = " 本次动态支付密码为 "+  pwd + "，此动态密码十分钟之内有效---德财美业";
			}else{
				msg = " 本次动态支付密码为 "+  pwd + "，此动态密码十分钟之内有效,服务电话：" +baseStore.getTelephone()+"---德财美业";
			}
//			String msg = memberName + "先生/女士,您的会员支付密码已重置,重置密码为:" + pwd + ",请尽快通过微信小程序DCMY进行登录更改新的密码，此重置密码十分钟之内有效,服务电话："+baseStore.getTelephone()+"---德财美业";
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 员工初始密码短信
	 */
	public static void sendStaffInitPwdSms(BaseStore baseStore, String phone, Integer pwd) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg ="【"+baseStore.getSignId()+"】 "+ "您所在门店的员工账户已开通,初始密码为:" + pwd + ",请妥善保管.您可以通过DCMY员工APP,用注册手机号进行登录---德财美业";
			}else{
				msg ="【"+baseStore.getSignId()+"】 "+ "您所在门店的员工账户已开通,初始密码为:" + pwd + ",请妥善保管.您可以通过DCMY员工APP,用注册手机号进行登录,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "您所在门店的员工账户已开通,初始密码为:" + pwd + ",请妥善保管.您可以通过DCMY员工APP,用注册手机号进行登录---德财美业";
			}else{
				msg = "您所在门店的员工账户已开通,初始密码为:" + pwd + ",请妥善保管.您可以通过DCMY员工APP,用注册手机号进行登录,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员充值购买短信
	 */
	public static void sendRechargeSms(BaseStore baseStore, String phone, BigDecimal rechargeMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"充值成功,本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"充值成功,本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "充值成功,本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "充值成功,本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendRechargeSmsNew(BaseStore baseStore, String phone, RechargeAccount rechargeAccount,BigDecimal rechargeMoney,BigDecimal gifMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "尊敬的"+rechargeAccount.getMemberName()+"会员：您本次充值金额为"+rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"" +
						"元，赠送金额为"+gifMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，会员卡余额为"
						+rechargeAccount.getCardRestMoney().setScale(2,BigDecimal.ROUND_HALF_UP)+"元" +
						"，赠送余额为"+rechargeAccount.getCardGiftMoney()+"元。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "尊敬的"+rechargeAccount.getMemberName()+"会员：您本次充值金额为"+rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"" +
						"元，赠送金额为"+gifMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，会员卡余额为"
						+rechargeAccount.getCardRestMoney().setScale(2,BigDecimal.ROUND_HALF_UP)+"元" +
						"，赠送余额为"+rechargeAccount.getCardGiftMoney()+"元。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			if(baseStore.getSignId()!=null){
				msg = "【" + baseStore.getSignId() + "】"+msg;
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "尊敬的"+rechargeAccount.getMemberName()+"会员：您本次充值金额为【"+rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"】" +
						"元，赠送金额为【"+gifMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"】元，会员卡余额为【"+rechargeAccount.getCardRestMoney().setScale(2,BigDecimal.ROUND_HALF_UP)+"】元" +
						"，赠送余额为【"+rechargeAccount.getCardGiftMoney()+"】元。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "尊敬的"+rechargeAccount.getMemberName()+"会员：您本次充值金额为【"+rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"】" +
						"元，赠送金额为【"+gifMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"】元，会员卡余额为【"+rechargeAccount.getCardRestMoney().setScale(2,BigDecimal.ROUND_HALF_UP)+"】元" +
						"，赠送余额为【"+rechargeAccount.getCardGiftMoney()+"】元。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+",客服热线：18620905828";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	public static void sendRechargeSmsNewBySmsFix(BaseStore baseStore, String phone, RechargeAccount rechargeAccount,BigDecimal rechargeMoney,BigDecimal gifMoney,SmsFix smsFix) throws IOException, SmsException {
		String msg = null;
		Map<String,String> map = new HashMap<>();
		map.put("memberName",rechargeAccount.getMemberName());
		map.put("rechargeMoney", rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
		map.put("rechargeGiftMoney",gifMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
		map.put("rechargeRestMoney",rechargeAccount.getCardRestMoney().setScale(2,BigDecimal.ROUND_HALF_UP).toString());
		map.put("rechargeGiftRestMoney",rechargeAccount.getCardGiftMoney().toString());
		map.put("memberPhone",phone);
		map.put("storePhone",baseStore.getTelephone());
		map.put("customerPhone","18620905828");
		msg = smsReplace(map,smsFix.getSmsBody());
//			if(baseStore.getSignId()!=null){
//				msg = "【" + baseStore.getSignId() + "】"+msg;
//			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
//			SmsType.sendSmsCode(Constant.smsUrl,Constant.smsAccount,Constant.smsPassword, phone, msg);

	}
	/***
	 * 团购充值购买短信
	 */
	public static void sendRechargeSmsGroupPurchase(BaseStore baseStore, String phone, BigDecimal rechargeMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendRechargeSmsGroupPurchaseNew(BaseStore baseStore, String phone, BigDecimal rechargeMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
			}else{
				msg = "团购成功,本次团购充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员充值购买短信(补单)
	 */
	public static void sendRechargeSms(BaseStore baseStore, String phone, BigDecimal rechargeMoney,Date AdditionDate) throws IOException, SmsException {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		String format = simpleDateFormat.format(AdditionDate);
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"充值成功,"+format+"本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"充值成功,"+format+"本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "充值成功,"+format+"本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "充值成功,"+format+"本次充值金额:"+ rechargeMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员疗程购买短信
	 */
	public static void sendCourseSms(BaseStore baseStore, String phone, String projectName) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendCourseSmsNew(BaseStore baseStore, String phone, String projectName,String memberName) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "尊敬的"+memberName+"会员：您本次购买" + projectName + "欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "尊敬的"+memberName+"会员：您本次购买" + projectName + "欢迎您再次莅临！本店的联系电话为"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			if(baseStore.getSignId()!=null){
				msg = "【" + baseStore.getSignId() + "】"+msg;
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "尊敬的【"+memberName+"】会员：您本次购买" + projectName + "欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "尊敬的【"+memberName+"】会员：您本次购买" + projectName + "欢迎您再次莅临！本店的联系电话为"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	public static void sendCourseSmsNewBySmsFix(BaseStore baseStore, String phone, String projectName,String numberTime,String giftNumberTime,String memberName,SmsFix smsFix) throws IOException, SmsException {
		String msg = null;
		Map<String,String> map = new HashMap<>();
		map.put("memberName",memberName);
		map.put("courseName", projectName);
		map.put("courseNumberTime",numberTime);
		map.put("courseGiftNumberTime",giftNumberTime);
		map.put("memberPhone",phone);
		map.put("storePhone",baseStore.getTelephone());
		map.put("customerPhone","18620905828");
		msg = smsReplace(map,smsFix.getSmsBody());
//			if(baseStore.getSignId()!=null){
//				msg = "【" + baseStore.getSignId() + "】"+msg;
//			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
//			SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, phone, msg);

	}
	/***
	 * 会员疗程购买短信(补单)
	 */
	public static void sendCourseSms(BaseStore baseStore, String phone, String projectName,Date additionDate) throws IOException, SmsException {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		String format = simpleDateFormat.format(additionDate);
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+format+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+format+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = format+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询---德财美业";
			}else{
				msg = format+"本次购买的" + projectName + "项目已经成功,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员收银充值卡付短信
	 */
	public static void sendCashByRechargeSms(BaseStore baseStore, String phone, BigDecimal spendMoney, BigDecimal restMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"感谢您的支持,本次消费"+ spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"感谢您的支持,本次消费"+ spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,本次消费"+ spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "感谢您的支持,本次消费"+ spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员收银充值卡付短信()盛联
	 */
	public static void sendCashByRechargeSmsSL(BaseStore baseStore, String phone, BigDecimal spendMoney, BigDecimal giftspendMoney, BigDecimal restMoney, BigDecimal giftRestMoney) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员收银充值卡付短信(整合修改1)
	 */
	public static void sendCashByRechargeSmsSL1(BaseStore baseStore, String phone, List<AccountTradeRecord> list) throws IOException, SmsException {
		//支付金额、赠送支付、账户余额、赠送账户余额.
		//ChuangLanSmsUtil.sendCashByRechargeSmsSL(baseStore, value.get(0).getMemberPhone(), reduce,reduce1, value.get(value.size()-1).getAccountRestMoney(),value.get(value.size()-1).getAccountGiftConsumeMoney());
		String msg = "";
		int n=0;
		for(AccountTradeRecord accountTradeRecord:list){
			//支付金额
			BigDecimal spendMoney=accountTradeRecord.getAccountSpendMoney();
			//赠送支付
			BigDecimal giftspendMoney=accountTradeRecord.getAccountGiftSpendMoney();
			//账户余额
			BigDecimal restMoney=accountTradeRecord.getAccountRestMoney();
			//赠送账户余额.
			BigDecimal giftRestMoney=accountTradeRecord.getAccountGiftConsumeMoney();

			if(baseStore.getMessagingPlatform()==0){
				if(null == baseStore.getTelephone()){
					msg += "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业"+" \n \n";
					n++;
				}else{
					msg += "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业"+" \n \n ";

					n++;
				}
			}else{
				if(null == baseStore.getTelephone()){
					msg += "感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业 "+" \n \n ";
					n++;
				}else{
					msg += "感谢您的支持,本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业 "+" \n \n ";
					n++;
				}
			}
		}
		System.out.println(msg+"-----------------   \n"+"------------");
		if(baseStore.getMessagingPlatform()==0){
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}
	}
	public static void sendCashByRechargeSmsSL1New(BaseStore baseStore, String phone, List<AccountTradeRecord> list) throws IOException, SmsException {

		//支付金额、赠送支付、账户余额、赠送账户余额.
//		ChuangLanSmsUtil.sendCashByRechargeSmsSL(baseStore, value.get(0).getMemberPhone(), reduce,reduce1, value.get(value.size()-1).getAccountRestMoney(),value.get(value.size()-1).getAccountGiftConsumeMoney());
		Map<Long, List<AccountTradeRecord>> collect = list.stream().collect(Collectors.groupingBy(item -> item.getAccountId()));
		Iterator<Map.Entry<Long, List<AccountTradeRecord>>> iterator = collect.entrySet().iterator();
		while (iterator.hasNext()){
			Map.Entry<Long, List<AccountTradeRecord>> next = iterator.next();
			List<AccountTradeRecord> value = next.getValue();
			String msg = "";
			int n=0;
			BigDecimal spendMoney = BigDecimal.ZERO;
			BigDecimal giftspendMoney = BigDecimal.ZERO;
			BigDecimal restMoney = value.get(0).getAccountRestMoney();
			BigDecimal giftRestMoney = value.get(0).getAccountGiftConsumeMoney();
			String memberName = value.get(0).getMemberName();
			for(AccountTradeRecord accountTradeRecord:value) {
				//支付金额
				spendMoney = spendMoney.add(accountTradeRecord.getAccountSpendMoney());
				//赠送支付
				giftspendMoney = giftspendMoney.add(accountTradeRecord.getAccountGiftSpendMoney());
				//账户余额
				if (accountTradeRecord.getAccountRestMoney().compareTo(restMoney) == -1) {
					restMoney = accountTradeRecord.getAccountRestMoney();
				}
				//赠送账户余额.
				if (accountTradeRecord.getAccountGiftConsumeMoney().compareTo(restMoney) == -1) {
					giftRestMoney = accountTradeRecord.getAccountGiftConsumeMoney();
				}
			}
			if(baseStore.getMessagingPlatform()==0){
				if(null == baseStore.getTelephone()){
					msg += "尊敬的"+memberName+"会员：您本次消费折后金额"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元，" +
							"使用赠送金额"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元"+
							"，会员卡内余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元。赠送卡内余额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+
							"元。欢迎您再次莅临！客服热线：18620905828";
					n++;
				}else{
					msg += "尊敬的"+memberName+"会员：您本次消费折后金额"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元，" +
							"使用赠送金额"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元"+
							"，会员卡内余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元。赠送卡内余额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+
							"元。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
					n++;
				}
			}else{
				if(null == baseStore.getTelephone()){
					msg += "尊敬的【"+memberName+"】会员：您本次消费折后金额"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元，" +
							"使用赠送金额"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元"+
							"，会员卡内余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元。赠送卡内余额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元。欢迎您再次莅临！客服热线：18620905828";
					n++;
				}else{
					msg += "尊敬的【"+memberName+"】会员：您本次消费折后金额"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元，" +
							"使用赠送金额"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元"+
							"，会员卡内余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元。赠送卡内余额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
					n++;
				}
			}
			System.out.println(msg+"-----------------   \n"+"------------");
			if(baseStore.getMessagingPlatform()==0){
				if(baseStore.getSignId()!=null){
					msg = "【" + baseStore.getSignId() + "】"+msg;
				}
				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
			}else{
				SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
			}
		}

	}
	public static void sendCashByRechargeSmsSL1NewBySmsFix(BaseStore baseStore, String phone, List<AccountTradeRecord> list,SmsFix smsFix) throws IOException, SmsException {
		//支付金额、赠送支付、账户余额、赠送账户余额.
//		ChuangLanSmsUtil.sendCashByRechargeSmsSL(baseStore, value.get(0).getMemberPhone(), reduce,reduce1, value.get(value.size()-1).getAccountRestMoney(),value.get(value.size()-1).getAccountGiftConsumeMoney());
		Map<Long, List<AccountTradeRecord>> collect = list.stream().collect(Collectors.groupingBy(item -> item.getAccountId()));
		Iterator<Map.Entry<Long, List<AccountTradeRecord>>> iterator = collect.entrySet().iterator();
		while (iterator.hasNext()){
			Map.Entry<Long, List<AccountTradeRecord>> next = iterator.next();
			List<AccountTradeRecord> value = next.getValue();

			int n=0;
			BigDecimal spendMoney = BigDecimal.ZERO;
			BigDecimal giftspendMoney = BigDecimal.ZERO;
			BigDecimal restMoney = value.get(0).getAccountRestMoney();
			BigDecimal giftRestMoney = value.get(0).getAccountGiftConsumeMoney();
			String memberName = value.get(0).getMemberName();
			for(AccountTradeRecord accountTradeRecord:value) {
				//支付金额
				spendMoney = spendMoney.add(accountTradeRecord.getAccountSpendMoney());
				//赠送支付
				giftspendMoney = giftspendMoney.add(accountTradeRecord.getAccountGiftSpendMoney());
				//账户余额
				if (accountTradeRecord.getAccountRestMoney().compareTo(restMoney) == -1) {
					restMoney = accountTradeRecord.getAccountRestMoney();
				}
				//赠送账户余额.
				if (accountTradeRecord.getAccountGiftConsumeMoney().compareTo(restMoney) == -1) {
					giftRestMoney = accountTradeRecord.getAccountGiftConsumeMoney();
				}
			}

			Map<String,String> map = new HashMap<>();
			map.put("memberName",memberName);
			map.put("rechargeCashMoney", (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
			map.put("rechargeSpendGeneralMoney",spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
			map.put("rechargeSpendGiftMoney",giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
			map.put("rechargeRestMoney",restMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
			map.put("rechargeGiftRestMoney",giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
			map.put("memberPhone",phone);
			map.put("storePhone",baseStore.getTelephone());
			map.put("customerPhone","18620905828");
			String msg = smsReplace(map,smsFix.getSmsBody());
			System.out.println(msg+"-----------------   \n"+"------------");
//				if(baseStore.getSignId()!=null){
//					msg = "【" + baseStore.getSignId() + "】"+msg;
//				}
				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
//				SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount,Constant.smsPassword, phone, msg);

		}

	}

	/***
	 * 会员收银充值卡付短信()盛联
	 */
	public static void sendCashByRechargeSmsSLNew(BaseStore baseStore, String phone, BigDecimal spendMoney, BigDecimal giftspendMoney, BigDecimal restMoney, BigDecimal giftRestMoney,Date additionDate) throws IOException, SmsException {
		SimpleDateFormat simpl = new SimpleDateFormat("yyyy-MM-dd");
		String format = simpl.format(additionDate);
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,对本次消费进行评价,服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元";
			}else {
				msg = "感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendCashByRechargeSmsSL(BaseStore baseStore, String phone, BigDecimal spendMoney, BigDecimal giftspendMoney, BigDecimal restMoney, BigDecimal giftRestMoney,Date additionDate) throws IOException, SmsException {
		SimpleDateFormat simpl = new SimpleDateFormat("yyyy-MM-dd");
		String format = simpl.format(additionDate);
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else {
				msg = "感谢您的支持,"+format+"本次消费"+ (spendMoney.add(giftspendMoney)).setScale(2,BigDecimal.ROUND_HALF_UP) +"元,其中充值金额支付"+spendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元，赠送金额支付"+giftspendMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,账户余额"+ restMoney.setScale(2,BigDecimal.ROUND_HALF_UP) +"元,赠送剩余金额"+giftRestMoney.setScale(2,BigDecimal.ROUND_HALF_UP)+"元,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}

	/***
	 * 会员收银疗程卡付短信
	 */
	public static void sendCashByCourseSms(BaseStore baseStore, String phone, String projectName, Integer spendCount, Integer restCount) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"感谢您的支持,本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl().trim(), baseStore.getSmsAccount().trim(), baseStore.getSmsPassword().trim(), phone.trim(), msg.trim());
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "感谢您的支持,本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	public static void sendCashByCourseSmsNew(BaseStore baseStore, String phone, String projectName, Integer spendCount, Integer restCount,String memberName) throws IOException, SmsException {
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】"+"尊敬的"+memberName+"会员：您本次消费"+ projectName
						+"项目"+ spendCount + "次，剩余"+ restCount +"次。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "【"+baseStore.getSignId()+"】"+"尊敬的"+memberName+"会员：您本次消费"+ projectName
						+"项目"+ spendCount + "次，剩余"+ restCount +"次。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl().trim(), baseStore.getSmsAccount().trim(), baseStore.getSmsPassword().trim(), phone.trim(), msg.trim());
		}else{
			if(null == baseStore.getTelephone()){
				msg = "尊敬的【"+memberName+"】会员：您本次消费"+ projectName +"项目"+ spendCount + "次，剩余"+ restCount +"次。欢迎您再次莅临！客服热线：18620905828";
			}else{
				msg = "尊敬的【"+memberName+"】会员：您本次消费"+ projectName +"项目"+ spendCount + "次，剩余"+ restCount +"次。欢迎您再次莅临！本店的联系电话"+baseStore.getTelephone()+"，客服热线：18620905828";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}


	public static void sendCashByCourseSmsNewBySmsFix(
			BaseStore baseStore, AccountTradeRecord accountTradeRecord,SmsFix smsFix
	) throws IOException, SmsException {
		String phone = accountTradeRecord.getMemberPhone().trim();
		Map<String,String> map = new HashMap<>();
		map.put("memberName",accountTradeRecord.getMemberName());
		map.put("projectName",accountTradeRecord.getTradeName());
		map.put("courseCashTime",accountTradeRecord.getAccountSpendCount().toString());
		map.put("courseReaminderTime",accountTradeRecord.getAccountConsumeCount().toString());
		map.put("memberPhone",phone);
		map.put("storePhone",baseStore.getTelephone());
		map.put("customerPhone","18620905828");

		String msg = smsReplace(map,smsFix.getSmsBody());
//		if(baseStore.getMessagingPlatform()==0){
//				msg = "【" + baseStore.getSignId() + "】" + msg;

				SmsType.sendSmsCode(baseStore.getSmsUrl().trim(), baseStore.getSmsAccount().trim(), baseStore.getSmsPassword().trim(), phone.trim(), msg.trim());
//				SmsType.sendSmsCode(Constant.smsUrl, Constant.smsAccount, Constant.smsPassword, phone.trim(), msg.trim());
//		}
	}

	/***
	 * 会员收银疗程卡付短信
	 */
	public static void sendCashByCourseSmsAddition(BaseStore baseStore, String phone, String projectName, Integer spendCount, Integer restCount, Date additionDate) throws IOException, SmsException {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		String format = simpleDateFormat.format(additionDate);
		String msg = null;
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"感谢您的支持,"+format+"本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"感谢您的支持,"+format+"本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "感谢您的支持,"+format+"本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价---德财美业";
			}else{
				msg = "感谢您的支持,"+format+"本次消费"+ projectName +"项目"+ spendCount + "次,还余"+ restCount +"次可消费,您可以登录微信小程序DCMY,对本次消费进行评价,服务电话："+baseStore.getTelephone()+"---德财美业";
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}
	}


	/***
	 * 会员还款短信
	 */
	public static void sendRepaySmsNew(BaseStore baseStore, String phone, String tradeName, BigDecimal repayMoney, String type) throws IOException, SmsException {
		if(baseStore.getMessagingPlatform()==0){
			String msg = "";
			if (type.equals(Constant.doc_type_recharge)) {
				if(null == baseStore.getTelephone()){
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功，本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
				}else{
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功，本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元，服务电话："+baseStore.getTelephone();
				}
				if(baseStore.getSignId()!=null){
					msg = "【" + baseStore.getSignId() + "】"+msg;
				}
				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
			}else if (type.equals(Constant.doc_type_card_use)){
				if(null == baseStore.getTelephone()){
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功，本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
				}else{
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功，本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元，服务电话："+baseStore.getTelephone();
				}
				if(baseStore.getSignId()!=null){
					msg = "【" + baseStore.getSignId() + "】"+msg;
				}
				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
			}
		}else{
			String msg = "";
			if (type.equals(Constant.doc_type_recharge)) {
				if(null == baseStore.getTelephone()){
					msg = "还款成功，本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
				}else{
					msg = "还款成功，本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元，服务电话："+baseStore.getTelephone();
				}

				SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
			}else if (type.equals(Constant.doc_type_card_use)){
				if(null == baseStore.getTelephone()){
					msg = "还款成功，本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元";
				}else{
					msg = "还款成功，本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元，服务电话："+baseStore.getTelephone();
				}

				SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
			}
		}

	}
	public static void sendRepaySms(BaseStore baseStore, String phone, String tradeName, BigDecimal repayMoney, String type) throws IOException, SmsException {
		if(baseStore.getMessagingPlatform()==0){
			String msg = "";
			if (type.equals(Constant.doc_type_recharge)) {
				if(null == baseStore.getTelephone()){
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功,本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
				}else{
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功,本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
				}
				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
			}else if (type.equals(Constant.doc_type_card_use)){
				if(null == baseStore.getTelephone()){
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功,本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
				}else{
					msg = "【"+baseStore.getSignId()+"】 "+"还款成功,本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
				}

				SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
			}
		}else{
			String msg = "";
			if (type.equals(Constant.doc_type_recharge)) {
				if(null == baseStore.getTelephone()){
					msg = "还款成功,本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
				}else{
					msg = "还款成功,本次还款" + tradeName + "充值卡" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
				}

				SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
			}else if (type.equals(Constant.doc_type_card_use)){
				if(null == baseStore.getTelephone()){
					msg = "还款成功,本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询---德财美业";
				}else{
					msg = "还款成功,本次还款" + tradeName + "疗程" + repayMoney.setScale(2,BigDecimal.ROUND_HALF_UP) + "元,详情请登录DCMY微信小程序查询,服务电话："+baseStore.getTelephone()+"---德财美业";
				}

				SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
			}
		}

	}

	/***
	 * 会员退款短信
	 */
	public static void sendRefundSms(BaseStore baseStore, String phone) throws IOException, SmsException {
		String msg = "";
		if(baseStore.getMessagingPlatform()==0){
			if(null == baseStore.getTelephone()){
				msg = "【"+baseStore.getSignId()+"】 "+"您的退款申请,我们已经受理,我们将进快跟进处理,感谢您一直以来对我们的信任和支持!!!期待未来我们还可以继续合作,谢谢!";
			}else{
				msg = "【"+baseStore.getSignId()+"】 "+"您的退款申请,我们已经受理,我们将进快跟进处理,感谢您一直以来对我们的信任和支持!!!期待未来我们还可以继续合作,谢谢!服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCode(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg);
		}else{
			if(null == baseStore.getTelephone()){
				msg = "您的退款申请,我们已经受理,我们将进快跟进处理,感谢您一直以来对我们的信任和支持!!!期待未来我们还可以继续合作,谢谢!";
			}else{
				msg = "您的退款申请,我们已经受理,我们将进快跟进处理,感谢您一直以来对我们的信任和支持!!!期待未来我们还可以继续合作,谢谢!服务电话："+baseStore.getTelephone();
			}
			SmsType.sendSmsCodeFG(baseStore.getSmsUrl(), baseStore.getSmsAccount(), baseStore.getSmsPassword(), phone, msg,baseStore.getSignId());
		}

	}
	private static   String smsReplace(Map<String, String> hash, String postfix) {
//		Iterator<Map.Entry<String, String>> iterator = hash.entrySet().iterator();
//		while (iterator.hasNext()){
//			Map.Entry<String, String> next = iterator.next();
//			String key = next.getKey();
//			String value = next.getValue();
//
//		}
		if(postfix.contains("${会员名字}")){
			postfix = postfix.replace("${会员名字}", hash.get("memberName"));
		}
		if(postfix.contains("${会员手机号}")){
			postfix = postfix.replace("${会员手机号}", hash.get("memberPhone"));
		}
		if(postfix.contains("${疗程名称}")){
			postfix = postfix.replace("${疗程名称}", hash.get("courseName"));
		}
		if(postfix.contains("${疗程购买次数}")){
			postfix = postfix.replace("${疗程购买次数}", hash.get("courseNumberTime"));
		}
		if(postfix.contains("${疗程购买赠送次数}")){
			postfix = postfix.replace("${疗程购买赠送次数}", hash.get("courseGiftNumberTime"));
		}
		if(postfix.contains("${疗程剩余次数}")){
			postfix = postfix.replace("${疗程剩余次数}", hash.get("courseReaminderTime"));
		}
		if(postfix.contains("${疗程赠送剩余次数}")){
			postfix = postfix.replace("${疗程赠送剩余次数}", hash.get("courseReaminderGiftTime"));
		}
		if(postfix.contains("${充值开卡金额}")){
			postfix = postfix.replace("${充值开卡金额}", hash.get("rechargeMoney"));
		}
		if(postfix.contains("${充值开卡赠送金额}")){
			postfix = postfix.replace("${充值开卡赠送金额}", hash.get("rechargeGiftMoney"));
		}
		if(postfix.contains("${充值卡余额}")){
			postfix = postfix.replace("${充值卡余额}", hash.get("rechargeRestMoney"));
		}
		if(postfix.contains("${充值卡赠送余额}")){
			postfix = postfix.replace("${充值卡赠送余额}", hash.get("rechargeGiftRestMoney"));
		}
		if(postfix.contains("${收银项目名称}")){
			postfix = postfix.replace("${收银项目名称}", hash.get("projectName"));
		}
		if(postfix.contains("${收银项目次数}")){
			postfix = postfix.replace("${收银项目次数}", hash.get("projectTime"));
		}
		if(postfix.contains("${收银充值卡付金额}")){
			postfix = postfix.replace("${收银充值卡付金额}", hash.get("rechargeCashMoney"));
		}
		if(postfix.contains("${收银充值卡付通用金额}")){
			postfix = postfix.replace("${收银充值卡付通用金额}", hash.get("rechargeSpendGeneralMoney"));
		}
		if(postfix.contains("${收银充值卡付赠送金额}")){
			postfix = postfix.replace("${收银充值卡付赠送金额}", hash.get("rechargeSpendGiftMoney"));
		}
		if(postfix.contains("${收银疗程消费次数}")){
			postfix = postfix.replace("${收银疗程消费次数}", hash.get("courseCashTime"));
		}
//		if(postfix.contains("${收银疗程赠送消费次数}")){
//			postfix = postfix.replace("${收银疗程赠送消费次数}", hash.get("courseGiftCashTime"));
//		}
		if(postfix.contains("${门店联系电话}")){
			postfix = postfix.replace("${门店联系电话}", hash.get("storePhone"));
		}
		if(postfix.contains("${客服热线}")){
			postfix = postfix.replace("${客服热线}", hash.get("customerPhone"));
		}

		return postfix;
	}
}
