| | |
| | | package com.yuanchu.mom; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.yuanchu.mom.Task.SyncOrder; |
| | | import com.yuanchu.mom.pojo.Sale; |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest |
| | |
| | | return sale; |
| | | }).collect(Collectors.toList()); |
| | | //System.out.println(list); |
| | | |
| | | for (Sale sale : list) { |
| | | List<Map<String, Object>> innerOrder = SyncOrder.getInnerOrder("2023-08-01 10:00:00", sale.getOrderNumber()); |
| | | List<SaleMaterial> saleMaterials = innerOrder.stream().map(inorder -> { |
| | |
| | | saleMaterial.setName(inorder.get("productName").toString()); //产品名称 |
| | | saleMaterial.setSpecifications(inorder.get("specificationModel").toString()); //产品规格型号 |
| | | saleMaterial.setUnit(inorder.get("unit").toString()); //单位 |
| | | saleMaterial.setNumber((int)Double.parseDouble(inorder.get("quantity").toString())); //数量 |
| | | saleMaterial.setNumber((int) Double.parseDouble(inorder.get("quantity").toString())); //数量 |
| | | saleMaterial.setPrice(inorder.get("unitPriceInclTax").toString()); //单价 |
| | | saleMaterial.setSaleId(sale.getId()); //关联 销售单id |
| | | saleMaterial.setAdress(String.valueOf(inorder.get("shippingAddress"))); //收货地址 |
| | |
| | | System.out.println(saleMaterials); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | void aaa() { |
| | | int orderId = 773699; |
| | | List<Map<String, Object>> attachment = SyncOrder.getAttachmentByOrderId(orderId); |
| | | List<String> list = new ArrayList<>(); |
| | | for (Map<String, Object> attch : attachment) { |
| | | String path = attch.get("path").toString(); |
| | | list.add(path); |
| | | } |
| | | System.out.println(list); |
| | | } |
| | | } |