package net.yyc.common.ding.entity;


import net.yyc.common.ding.config.DingConfig;
import net.yyc.common.ding.sign.AccessSign;
import net.yyc.common.ding.utils.JsonUtils;
import net.yyc.common.ding.utils.SignUtils;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class EmployFreelancesQueryRequest extends CommonRequest{

	private static final String PATH = "/oapi/v1/employ/freelances/payResult";

	public EmployFreelancesQueryRequest(DingConfig config, String statementNo) {


		Map<String, Object> map = new HashMap<>();
		map.put("statementNo", statementNo);
		String bodyStr = JsonUtils.serializer(map);

		this.body = bodyStr;
		String serviceSign = null;
		try {
			//签名
			serviceSign = SignUtils.serviceSign(PATH, config.getAppSecret(),
					"POST", new HashMap<>(), body.getBytes());
		} catch (Exception e) {
			e.printStackTrace();
		}

		this.body = bodyStr;
		this.sign = new AccessSign(config.getAppId(),serviceSign);
		this.queryUrl = String.format("%s%s", config.getQueryUrl(), PATH);
	}


}
