package com.winsun.utils;

import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

/**
*
* @Description:常量类
* @Title: Constant
* @date 2018年5月16日下午6:55:54
* @version 1.0
 */
public class Constant {

	/* 默认一页显示10条数据  */
	public final static Integer PAGENUM = 2;

	/* 默认第一页  */
	public final static Integer FROMPAGE = 0;

	/*用户状态*/
	public final static String USERQIDONG = "1";//启用
	public final static String USERJINYONG = "0";//禁用

	/*支付参数*/
	public final static String CLIENTNUMBER = "xyzxyql";	//商户标识，由穗易付平台统一分配
	public final static String key_VALUE = "E805F0305C455BA7C5BAE3796C6500BD";	//商户标识，由穗易付平台统一分配
	public final static String USERNAME = "apitest";	//智能平台提供测试的账号
	public final static String USERNAMEKEY = "46b97294d4dac3f62ee42f3ab2804f68";	//智能平台提供的测试key
    public final static String ZHENGSHIAUCCON = "ruany";	//智能平台提供的正式账号
    public final static String ZHANGSHIKEY = "3df143292455bfea88bc613c53004d36";	//智能平台提供的正式key
//	public final static String ZHENGSHIAUCCON = "xiaoykd";	//智能平台提供的正式账号
//	public final static String ZHANGSHIKEY = "d345040accff0421d03f760a03e5cbd9";	//智能平台提供的正式key
	public final static String ZHANGSHIURL = "https://icloud.mini189.cn/api/";	//智能平台提供的正式key
	public final static String PRODUCTCATEGORY = "单宽带";	//只能平台提供的key
//	public final static String TOMCATURL = "http://183.57.78.132:8080";	//Linux外网服务器地址
//	public final static String INTRANETURL = "http://10.3.1.21:8080";	//Linux内网服务器地址
	public final static String TOMCATURL = "http://yrym.winsun-aly.com";	//省windows外网服务器地址
	public final static String INTRANETURL = "http://172.51.229.10:8081";	//省windows内网服务器地址
//	public final static String TOMCATURL = "http://ue189.com:8529";	//服务器地址
//	public final static String INTRANETURL = "http://ue189.com:8529";	//服务器地址
//	public final static String TOMCATURL = "http://127.0.0.1:8080";	//服务器地址
//	public final static String INTRANETURL = "http://127.0.0.1:8080";	//服务器地址
	public final static String PRODUCTSKU481 = "481";	//产品sku:校园宽带300元/年
	public final static String PRODUCTSKU479 = "479";	//产品sku:校园宽带30元/月
	public final static String PRODUCTSKU479Str = "30元";	//产品sku:校园宽带30元/月
	public final static String PRODUCTSKU481Str = "300元";	//产品sku:校园宽带30元/月
	public final static String Payment0 = "0";	//支付方式：为翼支付网厅
	public final static String Payment1 = "1";	//支付方式：为支付宝
	public final static String Payment3 = "3";	//支付方式：为微信支付
	public static final String VALIDATECODE_SESSION_KEY = "validatecode";	// 验证码 session key
	/*宽带图片*/
	public final static String KUANDAIIMAGE = "kuandai";//封面图
	public final static String IMGBDURL = "/static/images/temp/";//图片存放位置
	public final static String KDIMGBDURL = "/static/images/kuandai/";//图片存放位置


	public final static String ORDERSTATUS1 = "1";	// 待提交
	public final static String ORDERSTATUS2 = "2";	// 待受理
	public final static String ORDERSTATUS3 = "3";	// 受理成功【待收费】
	public final static String ORDERSTATUS4 = "4";	// 归档
	public final static String ORDERSTATUS5 = "5";	// 作废
	public final static String ORDERSTATUS9 = "9";	// 已收费【待竣工】
	public final static String ORDERSTATUS10 = "10";	// 受理异常
	public final static String ORDERSTATUS100= "100";	// 未支付

	public final static String ROLE1 = "1";	// 用户权限：1管理员  2测试人员  3工作人员  4学校人员
	public final static String ROLE2 = "2";	// 用户权限：1管理员  2测试人员  3工作人员  4学校人员
	public final static String ROLE3 = "3";	// 用户权限：1管理员  2测试人员  3工作人员  4学校人员
	public final static String ROLE4 = "4";	// 用户权限：1管理员  2测试人员  3工作人员  4学校人员

	/** 信任任何站点 */
	public static void trustEveryone() {
		try {
			HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
				@Override
				public boolean verify(String hostname, SSLSession session) {
					return true;
				}
			});

			SSLContext context = SSLContext.getInstance("TLS");
			context.init(null, new X509TrustManager[] { new X509TrustManager() {
				@Override
				public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
				}

				@Override
				public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
				}

				@Override
				public X509Certificate[] getAcceptedIssuers() {
					return new X509Certificate[0];
				}
			} }, new SecureRandom());
			HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
