parent
10c996232b
commit
6c3e946bda
@ -0,0 +1,80 @@ |
||||
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); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package com.hai.enum_type; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 订单推送类型 |
||||
* @author hurui |
||||
*/ |
||||
public enum OrderPushType { |
||||
type1(1 , "加油订单"), |
||||
type2(2 , "话费订单"), |
||||
type3(3 , "KFC订单"), |
||||
type4(4 , "电影票订单"), |
||||
type5(5 , "汇联通会员卡"), |
||||
type6(6 , "汇联通卡券"), |
||||
; |
||||
|
||||
private Integer type; |
||||
private String name; |
||||
|
||||
|
||||
OrderPushType(int type , String name) { |
||||
this.type = type; |
||||
this.name = name; |
||||
} |
||||
|
||||
public static String getNameByType(Integer type) { |
||||
for (OrderPushType ele : values()) { |
||||
if (Objects.equals(type,ele.getType())) { |
||||
return ele.getName(); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
Loading…
Reference in new issue