嗨森逛服务
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.
hai-server/hai-cweb/src/test/common/test.java

101 lines
2.8 KiB

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.*;
import com.hai.service.*;
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 {
@Resource
private HighUserService highUserService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Test
public void test(){
/* List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(55L);
List<HighUser> userList = highUserService.getUserList();
int num = 0;
for (HighUser user : userList) {
// 领取优惠券
highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId());
num++;
}*/
}
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);
}
}