You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.3 KiB
81 lines
2.3 KiB
3 years ago
|
package common;
|
||
|
|
||
|
import com.CWebApplication;
|
||
|
import com.alibaba.fastjson.JSON;
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.hai.common.QRCodeGenerator;
|
||
|
import com.hai.common.utils.DateUtil;
|
||
|
import com.hai.common.utils.HttpsUtils;
|
||
|
import com.hai.common.utils.IDGenerator;
|
||
|
import com.hai.entity.HighCouponCode;
|
||
|
import com.hai.entity.SecRegion;
|
||
|
import com.hai.service.CommonService;
|
||
|
import com.hai.service.HighCouponCodeService;
|
||
|
import com.hai.service.HighMerchantStoreService;
|
||
|
import org.junit.Test;
|
||
|
import org.junit.runner.RunWith;
|
||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.io.FileOutputStream;
|
||
|
import java.io.OutputStreamWriter;
|
||
|
import java.io.UnsupportedEncodingException;
|
||
|
import java.security.MessageDigest;
|
||
|
import java.security.NoSuchAlgorithmException;
|
||
|
import java.util.*;
|
||
|
|
||
|
/**
|
||
|
* @ClassName RegionTest
|
||
|
* @Description: TODO ()
|
||
|
* @Author 胡锐
|
||
|
* @Date 2020/12/29
|
||
|
**/
|
||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||
|
@SpringBootTest(classes = CWebApplication.class)
|
||
|
@WebAppConfiguration
|
||
|
public class test {
|
||
|
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
|
||
|
requestOrder();
|
||
|
}
|
||
|
|
||
|
public static void requestOrder(){
|
||
|
|
||
|
Map<String, Object> heard = new HashMap<>();
|
||
|
heard.put("Cookie", "_ida=oArhO6XxKSvjI9wLP3cTK-iSG8yY");
|
||
|
|
||
|
|
||
|
Map<String, Object> map = new HashMap<>();;
|
||
|
map.put("goodsId", "23423529");
|
||
|
map.put("goodsType", "1");
|
||
|
map.put("saleCount", "1");
|
||
|
|
||
|
List<Map<String, Object>> orderList = new ArrayList<>();
|
||
|
orderList.add(map);
|
||
|
|
||
|
Map<String, Object> param = new HashMap<>();
|
||
|
param.put("highChildOrderList", orderList);
|
||
|
|
||
|
int success = 0 ;
|
||
|
int fail = 0;
|
||
|
|
||
|
JSONObject object = HttpsUtils.doPost("https://hsgcs.dctpay.com/crest/highOrder/addOrder", param, heard);
|
||
|
if (object.getString("return_code").equals("000000")) {
|
||
|
success++;
|
||
|
System.out.println("提交订单成功");
|
||
|
} else {
|
||
|
fail++;
|
||
|
System.out.println(object.getString("return_msg"));
|
||
|
}
|
||
|
|
||
|
System.out.println("成功数量" + success);
|
||
|
System.out.println("失败数量" + fail);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|