package net.yyc.common.taxhelper.service;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.logosdata.security.SM2;
import net.yyc.common.core.util.Base64Utils;
import net.yyc.common.taxhelper.annotation.TaxHelper;
import net.yyc.common.taxhelper.common.CommonConstants;
import net.yyc.common.taxhelper.entity.model.EncryptLoginInfo;
import net.yyc.common.taxhelper.entity.request.TaxHelperAppletCheckFaceRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperBindingCardVerificationRequest;
import net.yyc.common.taxhelper.entity.model.TaxHelperModel;
import net.yyc.common.taxhelper.entity.request.TaxHelperAddMemberRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperAppletBizTokenRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperBindingCardConfirmRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperECheckRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperEidTokenRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperGetUserAgreementRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperH5BizTokenRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperLoginRequest;
import com.logosdata.security.SM3;
import com.logosdata.security.SM4;
import net.yyc.common.taxhelper.entity.request.TaxHelperRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperSettlementRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperUserAgreementAuthorizationRequest;
import net.yyc.common.taxhelper.entity.request.TaxHelperUserAgreementAuthorizationRequestV2;
import net.yyc.common.taxhelper.entity.response.TaxHelperResponse;
import com.logosdata.security.util.SignUtils;
import net.yyc.common.taxhelper.util.HttpUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.HttpClientUtils;
import org.bouncycastle.math.ec.ECPoint;
import org.springframework.beans.BeanUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;

import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
 * {@code TaxHelperService} 税邦云服务
 *
 * @author Hengchen.Sun
 * @version 1.0.2
 * @date 2021-02-18
 * @since ver.1.0.0
 */
@Slf4j
public class TaxHelperService {

	/**
	 * 税邦云登录
	 *
	 * @param request 登录请求request
	 * @return 结果字符串
	 */
	public TaxHelperResponse login(TaxHelperLoginRequest request) {
		TaxHelperResponse response = null;
		try {
			EncryptLoginInfo encryptLoginInfo = encryptLogin(request);
			request.setEncryptLoginInfo(encryptLoginInfo);
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云登录失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 获取小程序认证token
	 *
	 * @param request 小程序认证token
	 * @return 结果字符串
	 */
	@TaxHelper(value = "getAppletBizToken")
	public TaxHelperResponse getAppletBizToken(TaxHelperAppletBizTokenRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("获取小程序认证token失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 获取H5认证token
	 *
	 * @param request H5认证token
	 * @return 结果字符串
	 */
	@TaxHelper(value = "getH5BizToken")
	public TaxHelperResponse getH5BizToken(TaxHelperH5BizTokenRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("获取小程序认证token失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 获取E政通token
	 *
	 * @param request Eid token
	 * @return 结果字符串
	 */
	@TaxHelper(value = "getEidToken")
	public TaxHelperResponse getEidToken(TaxHelperEidTokenRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("获取E政通token失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 根据token查询认证结果
	 *
	 * @param request
	 * @return
	 */
	@TaxHelper(value = "appletCheckFace")
	public TaxHelperResponse appletCheckFace(TaxHelperAppletCheckFaceRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("认证token失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 根据token查询认证结果
	 *
	 * @param request
	 * @return
	 */
	@TaxHelper(value = "getECheckFace")
	public TaxHelperResponse getECheckFace(TaxHelperECheckRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("认证e-token失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}


	/**
	 * 增员
	 *
	 * @param request 增员请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "addMembers")
	public TaxHelperResponse addMembers(TaxHelperAddMemberRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云增员异常：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 获取绑卡验证码
	 *
	 * @param request 获取绑卡验证码请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "bindingCardVerification")
	public TaxHelperResponse bindingCardVerification(TaxHelperBindingCardVerificationRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云绑定卡验证异常：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 绑卡确认
	 *
	 * @param request 绑卡确认请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "bindingCardConfirm")
	public TaxHelperResponse bindingCardConfirm(TaxHelperBindingCardConfirmRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云绑定卡异常：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 结算
	 *
	 * @param request 结算请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "settlement")
	public TaxHelperResponse settlement(TaxHelperSettlementRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云结算异常：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 获取用户协议内容接口
	 *
	 * @param request 请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "getUserAgreement")
	public TaxHelperResponse getUserAgreement(TaxHelperGetUserAgreementRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云用户协议内容获取失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 回传用户协议授权信息接口
	 *
	 * @param request 请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "userAgreementAuthorization")
	public TaxHelperResponse userAgreementAuthorization(TaxHelperUserAgreementAuthorizationRequest request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云用户协议内容获取失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 回传用户协议授权信息接口（含手签）
	 *
	 * @param request 请求
	 * @return 结果字符串
	 * @throws Exception
	 */
	@TaxHelper(value = "userAgreementAuthorizationV2")
	public TaxHelperResponse userAgreementAuthorizationV2(TaxHelperUserAgreementAuthorizationRequestV2 request) {
		TaxHelperResponse response = null;
		try {
			response = process(request);
		} catch (Exception e) {
			log.error("税邦云用户协议内容获取失败：{}", e.getMessage());
			response = customResponse(e.getMessage());
		}
		return response;
	}

	/**
	 * 自定义响应结果
	 *
	 * @param msg 响应信息
	 * @return 响应结果
	 */
	private TaxHelperResponse customResponse(String msg) {
		return new TaxHelperResponse("4000", msg);
	}

	/**
	 * 加密登录请求信息
	 *
	 * @param request 登录请求
	 * @return 加密后的信息
	 * @throws Exception
	 */
	private EncryptLoginInfo encryptLogin(final TaxHelperLoginRequest request) throws Exception {
		//把请求报文传换成字符串
		String decData = JSONUtil.toJsonStr(request.getBizModel());

		SM4 sm4 = new SM4();
		sm4.setSecretKey(request.getKey());
		sm4.setHexString(false);

		String encData = sm4.encryptDataToString_ECB(decData, "UTF-8");
		byte[] hash = SM3.hash(decData.getBytes(StandardCharsets.UTF_8));

		SM2 sm2 = new SM2();
		log.error("获取publicKey：{}", SignUtils.getConfigPublicKey().get("publicKey").toString());

		ECPoint publicKey = sm2.importPublicKey(SignUtils.getConfigPublicKey().get("publicKey").toString());
		byte[] sign = sm2.encrypt(hash, publicKey);
		byte[] key = sm2.encrypt(sm4.getSecretKey(), publicKey);

		return new EncryptLoginInfo(encData, sign, key, request.getBizModel().getAppId());
	}

	/**
	 * 实际请求执行方法
	 *
	 * @param request request
	 * @return 结果
	 * @throws Exception
	 */
	private TaxHelperResponse process(final TaxHelperRequest request) throws Exception {
		HttpEntity<Object> httpEntity;
		if (request instanceof TaxHelperLoginRequest) {
			httpEntity = getHttpEntity(((TaxHelperLoginRequest) request).getEncryptLoginInfo(), request.getKey());

		} else {
			httpEntity = getHttpEntity(request.getBizModel(), request.getKey());
		}
		HttpEntity<String> result = HttpUtils.doPost(request.getQueryUrl(), httpEntity);
		log.error("税邦云返回结果：{} ", result);
		log.error("税邦云返回结果解析key：{} ", request.getKey());
		return getTaxHelperResponse(result, request.getKey());
	}

	/**
	 * 解析响应
	 *
	 * @param body 响应体
	 * @param key  随机密码（需要和登录的时候一致）
	 * @return 解析后的明文
	 * @throws Exception
	 */
	public String decryptResp(final String body, final String key) throws Exception {
		return SignUtils.decryptData(body, key);
	}

	/**
	 * 封装响应结果
	 *
	 * @param httpEntity 响应体
	 * @param key        加密秘钥
	 * @return 响应实体
	 */
	private TaxHelperResponse getTaxHelperResponse(final HttpEntity<String> httpEntity, final String key) {
		try {
			// 解密响应信息
			String decryptResp = decryptResp(httpEntity.getBody(), key);

			// 解析json
			JSONObject jsonObject = JSONObject.parseObject(decryptResp);
			// 获取状态码
			String code = jsonObject.getString("code");
			// 获取请求结果信息
			String msg = jsonObject.getString("message");
			// 获取token（获取token方法时包含）
			String token = jsonObject.getString("token");
			// 获取结算信息流水id（结算时候包含）
			String streamId = jsonObject.getString("streamId");
			// 获取E证通上次认证结果状态（获取E证通token时包含）
			String lastStatus = jsonObject.getString("lastStatus");
			// 获取E证通认证结果查询状态
			String status = jsonObject.getString("status");
			// 获取数据内容
			String data = jsonObject.getString("data");
			// 用户协议
			String userAgreement = jsonObject.getString("userAgreement");

			// 获取小程序token的时候没有code
			if (StringUtils.isEmpty(code)) {
				if (StringUtils.isNotEmpty(msg)) {
					code = String.valueOf(CommonConstants.CLIENT_ERROR_CODE);
				} else {
					code = String.valueOf(CommonConstants.SUCCESS_CODE);
					msg = token;
				}
			} else {
				// 判断是否是结算操作
				if (StringUtils.isNotEmpty(streamId)) {
					msg = StringUtils.equals(String.valueOf(CommonConstants.CLIENT_ERROR_CODE), code) ? msg : streamId;
				} else {
					// 判断是否是E政通token获取
					if (StringUtils.isNotEmpty(lastStatus)) {
						data = lastStatus;
					} else {
						// 判断是否是E政通token查询
						if (StringUtils.isNotEmpty(status)) {
							data = status;
						} else {
							// 判断是否是获取用户协议
							if (StringUtils.isNotEmpty(userAgreement)) {
								data = userAgreement;
							} else {
								msg = StringUtils.isEmpty(msg) ? data : msg;
							}
						}
					}
				}
			}
			return new TaxHelperResponse(code, msg, data, token);
		} catch (Exception e) {
			return new TaxHelperResponse(String.valueOf(CommonConstants.CLIENT_ERROR_CODE), "税邦云信息解密失败",
					null, null);
		}
	}


	/**
	 * 封装{@code HttpEntity}
	 *
	 * @param bizModel bizModel
	 * @param key      随机加密字符串（16位）
	 * @return
	 * @throws Exception
	 */
	private HttpEntity<Object> getHttpEntity(final TaxHelperModel bizModel, final String key) throws Exception {
		HttpHeaders headers = new HttpHeaders();
		headers.add("appId", bizModel.getAppId());
		headers.setContentType(MediaType.APPLICATION_JSON);
		Map<String, Object> params;
		if (bizModel instanceof EncryptLoginInfo) {
			params = BeanUtil.beanToMap(bizModel);
		} else {
			params = SignUtils.encryptData(BeanUtil.beanToMap(bizModel), key);
		}
		return new HttpEntity<>(params, headers);
	}


	// public static void main(String[] args) throws Exception {
	// 	TaxHelperService service = new TaxHelperService();
	//
	// 	log.warn(">>>>>>>>>>>>>>>>>>>登录");
	// 	TaxHelperConfig taxHelperConfig = new TaxHelperConfig();
	// 	taxHelperConfig.setAppId("yytetsczy01");
	// 	taxHelperConfig.setAppSecrete("7d301043970be6b51fd6a89cc245c936d72ea4ac3560585136d5dd8af10e06cb");
	// 	taxHelperConfig.setQueryUrl("https://test.taxhelpor.com:8883");
	// 	// taxHelperConfig.setQueryUrl("http://114.248.76.210:8883/");
	//
	// 	// TaxHelperLoginModel taxHelperLoginModel = new TaxHelperLoginModel(taxHelperConfig);
	// 	// TaxHelperLoginRequest loginRequest = new TaxHelperLoginRequest(taxHelperLoginModel);
	// 	String randomKey = "UVKVZfHcTRYgTZpV";
	// 	// // String randomKey = RandomStringUtils.randomAlphabetic(16);
	// 	// System.out.println(randomKey);
	// 	// loginRequest.setKey(randomKey);
	// 	//
	// 	// TaxHelperResponse s1 = service.login(loginRequest);
	// 	// System.out.println(s1.success());
	// 	// System.out.println(s1);
	// 	// System.out.println("7d301043970be6b51fd6a89cc245c936d72ea4ac3560585136d5dd8af10e06cb".length());
	//
	//
	// 	// System.out.println("====================================================");
	// 	//
	// 	// TaxHelperGetUserAgreementModel model = new TaxHelperGetUserAgreementModel(taxHelperConfig);
	// 	// model.setEnterpriseCode("91430181MA4RJ12345");
	// 	// TaxHelperGetUserAgreementRequest taxHelperGetUserAgreementRequest = new TaxHelperGetUserAgreementRequest(model);
	// 	// taxHelperGetUserAgreementRequest.setKey(randomKey);
	// 	// TaxHelperResponse userAgreement = service.getUserAgreement(taxHelperGetUserAgreementRequest);
	// 	// System.out.println(userAgreement.getData());
	//
	//
	// 	// System.out.println("====================================================");
	// 	// TaxHelperUserAgreementAuthorizationModel model1 = new TaxHelperUserAgreementAuthorizationModel(taxHelperConfig);
	// 	// model1.setEnterpriseCode("91430181MA4RJ12345");
	// 	// model1.setIdCard("110227200001010570");
	// 	//
	// 	// model1.setAuthorizationTime("2021-08-09 12:56:12");
	// 	//
	// 	// TaxHelperUserAgreementAuthorizationRequest rq1 = new TaxHelperUserAgreementAuthorizationRequest(model1);
	// 	// rq1.setKey(randomKey);
	// 	// TaxHelperResponse response1 = service.userAgreementAuthorization(rq1);
	// 	// System.out.println(response1);
	//
	//
	// 	// System.out.println("====================================================");
	// 	// TaxHelperUserAgreementAuthorizationModel model1 = new TaxHelperUserAgreementAuthorizationModel(taxHelperConfig);
	// 	// model1.setEnterpriseCode("91430181MA4RJ12345");
	// 	// model1.setIdCard("110227200001010570");
	// 	// model1.setAuthorizationTime("2021-08-09 12:56:12");
	// 	// String encodeImage = Base64Utils.encodeImage("/Users/jimmy/Downloads/BigBangTheory-Howard.jpg");
	// 	// model1.setSignatureHandwriting(encodeImage);
	// 	//
	// 	// TaxHelperUserAgreementAuthorizationRequestV2 rq1 = new TaxHelperUserAgreementAuthorizationRequestV2(model1);
	// 	// rq1.setKey(randomKey);
	// 	// TaxHelperResponse response1 = service.userAgreementAuthorizationV2(rq1);
	// 	// System.out.println(response1);
	//
	// }

		// System.out.println("================================================================================================================");
		// TaxHelperAddMemberModel addMemberModel = new TaxHelperAddMemberModel(taxHelperConfig);
		// addMemberModel.setEnterpriseCode("91430181MA4RJ12345");
		// addMemberModel.setName("张大三");
		// addMemberModel.setIdCard("110227200001010570");
		// addMemberModel.setPhone("13388889999");
		// addMemberModel.setNotifyUrl("https://localhost:8080/notify");
		// TaxHelperAddMemberRequest addMemberRequest = new TaxHelperAddMemberRequest(addMemberModel);
		// addMemberRequest.setKey(loginRequest.getKey());
		// TaxHelperResponse s3 = service.addMembers(addMemberRequest);
		// System.out.println(s3.success());
		// System.out.println(s3);
		// System.out.println("================================================================================================================");
		//
		// log.warn(">>>>>>>>>>>>>>获取eid token");
		//
		// TaxHelperEidTokenModel eidTokenModel = new TaxHelperEidTokenModel(taxHelperConfig);
		// eidTokenModel.setIdCard("110227200001010570");
		// TaxHelperEidTokenRequest eidTokenRequest = new TaxHelperEidTokenRequest(eidTokenModel);
		// eidTokenRequest.setKey(loginRequest.getKey());
		// TaxHelperResponse eRes = service.getEidToken(eidTokenRequest);
		// System.out.println(eRes.success());
		// System.out.println(JSONUtil.toJsonStr(eRes));
		// System.out.println("================================================================================================================");
		//
		// log.warn(">>>>>>>>>>>>>>echeck token");
		//
		// TaxHelperECheckModel eCheckModel = new TaxHelperECheckModel(taxHelperConfig);
		// eCheckModel.setToken(eRes.getMessage());
		// TaxHelperECheckRequest eCheckRequest = new TaxHelperECheckRequest(eCheckModel);
		// eCheckRequest.setKey(loginRequest.getKey());
		// TaxHelperResponse echeck = service.ECheckFace(eCheckRequest);
		// System.out.println(echeck.success());
		// System.out.println(JSONUtil.toJsonStr(echeck));
		//
		//
		// System.out.println("================================================================================================================");
	}

	// 	// log.warn(">>>>>>>>>>>>>>>>>>>获取token");
	//
	// 	TaxHelperAppletBizTokenModel taxHelperAppletBizTokenModel = new TaxHelperAppletBizTokenModel(taxHelperConfig);
	// 	taxHelperAppletBizTokenModel.setIdCard("110101200301011517");
	// 	taxHelperAppletBizTokenModel.setNotifyUrl("https://localhost:8080/notify");
	// 	TaxHelperAppletBizTokenRequest appletBizTokenRequest = new TaxHelperAppletBizTokenRequest(taxHelperAppletBizTokenModel);
	// 	appletBizTokenRequest.setKey(loginRequest.getKey());
	// 	TaxHelperResponse s2 = service.getAppletBizToken(appletBizTokenRequest);
	// 	System.out.println(s2);
	//
	// 	// 	log.warn(">>>>>>>>>>>>>>>>>>>认证token");
	// 	TaxHelperAppletCheckFaceModel taxHelperAppletCheckFaceModel = new TaxHelperAppletCheckFaceModel(taxHelperConfig);
	// 	taxHelperAppletCheckFaceModel.setToken("1462257147,34fb21937e47ae719f11cbc719615687");
	// 	TaxHelperAppletCheckFaceRequest appletCheckFaceRequest = new TaxHelperAppletCheckFaceRequest(taxHelperAppletCheckFaceModel);
	// 	appletCheckFaceRequest.setKey(loginRequest.getKey());
	// 	TaxHelperResponse ss = service.appletCheckFace(appletCheckFaceRequest);
	// 	System.out.println(ss);
	//
	//
	// 	//
	// 	System.out.println("================================================================================================================");
	//
	// 	TaxHelperBindingCardVerificationModel taxHelperBindingCardVerificationModel = new TaxHelperBindingCardVerificationModel(taxHelperConfig);
	// 	taxHelperBindingCardVerificationModel.setIdCard("110227200001010570");
	// 	taxHelperBindingCardVerificationModel.setPayAccount("6227001234877890101");
	// 	taxHelperBindingCardVerificationModel.setPayAccountPhone("13371737109");
	// 	TaxHelperBindingCardVerificationRequest taxHelperBindingCardVerificationRequest = new TaxHelperBindingCardVerificationRequest(taxHelperBindingCardVerificationModel);
	// 	taxHelperBindingCardVerificationRequest.setKey(loginRequest.getKey());
	// 	TaxHelperResponse s4 = service.bindingCardVerification(taxHelperBindingCardVerificationRequest);
	// 	System.out.println(s4);
	//
	// 	//
	// 	// System.out.println("================================================================================================================");
	//
	// 	TaxHelperBindingCardConfirmModel taxHelperBindingCardConfirmModel = new TaxHelperBindingCardConfirmModel(taxHelperConfig);
	// 	taxHelperBindingCardConfirmModel.setIdCard("110227200001010570");
	// 	taxHelperBindingCardConfirmModel.setNotifyUrl("https://localhost:8080/notify");
	// 	taxHelperBindingCardConfirmModel.setPayAccount("6227001234877890101");
	// 	taxHelperBindingCardConfirmModel.setVerificationCode("123456");
	// 	TaxHelperBindingCardConfirmRequest taxHelperBindingCardConfirmRequest = new TaxHelperBindingCardConfirmRequest(taxHelperBindingCardConfirmModel);
	// 	taxHelperBindingCardConfirmRequest.setKey(loginRequest.getKey());
	// 	TaxHelperResponse s5 = service.bindingCardConfirm(taxHelperBindingCardConfirmRequest);
	// 	System.out.println(s5);
	// 	// }
	// 	System.out.println("================================================================================================================");
	// 	TaxHelperSettlementModel taxHelperSettlementModel = new TaxHelperSettlementModel(taxHelperConfig);
	// 	taxHelperSettlementModel.setEnterpriseCode("911100007178005665");
	//
	// 	taxHelperSettlementModel.setExtendFieldNames(Arrays.asList("业务流水号", "交付时间", "交付地点"));
	// 	taxHelperSettlementModel.setCount(1);
	// 	taxHelperSettlementModel.setNotifyUrl("https://localhost:8080/notify");
	// 	TaxHelperSettlementModel.DetailedArr detailedArr1 = new TaxHelperSettlementModel.DetailedArr();
	// 	detailedArr1.setIdCard("110101199406288138");
	// 	detailedArr1.setInputAmount(15832.36);
	// 	taxHelperSettlementModel.setDetailedArr(Arrays.asList(detailedArr1));
	// 	TaxHelperSettlementModel.AbstractArr abstractArr1 = new TaxHelperSettlementModel.AbstractArr();
	// 	abstractArr1.setAmount(15832.36);
	// 	abstractArr1.setIdCard("110101199406288138");
	// 	abstractArr1.setNumber(1);
	// 	abstractArr1.setPrice(15832.36);
	// 	taxHelperSettlementModel.setAbstractArr(Arrays.asList(abstractArr1));
	// 	TaxHelperSettlementRequest taxHelperSettlementRequest = new TaxHelperSettlementRequest(taxHelperSettlementModel);
	// 	taxHelperSettlementRequest.setKey(loginRequest.getKey());
	// 	TaxHelperResponse s6 = service.settlement(taxHelperSettlementRequest);
	// 	System.out.println(s6);
	// }
// }
