Test.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * 创建时间:2017-08-19 08:55
  3. * 项目名称:kmall_pt
  4. * 类名称:Test.java
  5. * 包名称:com.kmall.admin
  6. *
  7. * 修改履历:
  8. * 日期 修正者 主要内容
  9. *
  10. *
  11. * Copyright (c) 2016-2017 兆尹科技
  12. */
  13. package com.kmall.admin;
  14. import cn.hutool.http.HttpRequest;
  15. import cn.hutool.http.HttpUtil;
  16. import com.alibaba.fastjson.JSON;
  17. import com.google.gson.Gson;
  18. import com.kmall.admin.dto.GoodsProductDto;
  19. import com.kmall.admin.dto.PdProductDtoInfo;
  20. import com.kmall.admin.entity.GoodsEntity;
  21. import com.kmall.admin.utils.CalculateTax;
  22. import com.kmall.admin.utils.data.response.ResponseMessage;
  23. import com.kmall.admin.utils.oms.OmsSign;
  24. import okhttp3.Request;
  25. import java.math.BigDecimal;
  26. import java.util.*;
  27. /**
  28. * 名称:Test <br>
  29. * 描述:<br>
  30. *
  31. * @author Scott
  32. * @version 1.0
  33. * @since 1.0.0
  34. */
  35. public class Test {
  36. public static void main(String[] args) {
  37. // Map<String, String> sParaTemp = new TreeMap<String, String>();
  38. // List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
  39. // GoodsProductDto dto = new GoodsProductDto();
  40. // dto.setMerchSn("mhbs990053989883052032");
  41. // goodsProductDtoList.add(dto);
  42. // PdProductDtoInfo pdProductDtoInfo = new PdProductDtoInfo();
  43. // pdProductDtoInfo.setPdProductDtoList(goodsProductDtoList);
  44. // sParaTemp.put("data", JSON.toJSONString(pdProductDtoInfo));
  45. // sParaTemp.put("merchId","mhbs990053989883052032");
  46. // String timestamp = String.valueOf(System.currentTimeMillis()/1000);
  47. // sParaTemp.put("timestamp", timestamp);
  48. // //生成要请求给oms秘钥
  49. //// String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
  50. // String sign = OmsSign.sign(sParaTemp,"IxyIvP0sJqlUZinx");
  51. // sParaTemp.put("sign", sign);
  52. // //构建Request
  53. // String url = "http://127.0.0.1:8680/al/product/addPdProductList";
  54. // Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
  55. // String s = JSON.toJSONString(sParaTemp);
  56. // // 同步访问,返回结果字符串
  57. // String responseString = null;
  58. // try {
  59. //
  60. // responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
  61. //
  62. // } catch (Exception e) {
  63. // e.printStackTrace();
  64. // }
  65. //
  66. // //解析响应数据
  67. // Gson gson = new Gson();
  68. // ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
  69. // if(result == null){
  70. // String info = "解析响应数据Result失败";
  71. // throw new RuntimeException(info);
  72. // }
  73. List<String> list = new ArrayList<>();
  74. for (int i = 0; i < list.size(); i++) {
  75. System.out.println(list.get(i));
  76. }
  77. }
  78. }