|
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JacksonException;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.malk.fenggefushi.service.HeiHuOrderService;
|
|
import com.malk.fenggefushi.service.HeiHuOrderService;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
import com.malk.server.aliwork.YDParam;
|
|
@@ -18,6 +19,7 @@ import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.utils.UtilHttp;
|
|
import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
import com.malk.utils.UtilMap;
|
|
|
|
|
+import jdk.nashorn.internal.ir.ObjectNode;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -32,6 +34,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.StreamSupport;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Service
|
|
@Service
|
|
@@ -1191,38 +1194,51 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
|
|
|
HashMap body_A = new HashMap();
|
|
HashMap body_A = new HashMap();
|
|
|
body_A.put("orderNo",orderNumber);
|
|
body_A.put("orderNo",orderNumber);
|
|
|
String jsonString2 = UtilHttp.doPost("https://liteweb.blacklake.cn/api/dytin/external/saleOrder/queryList2", header, null, body_A);//todo:查询销售订单,获取客户、订单号、款号、产品描述、颜色、数量、销售单价、销售金额、币别
|
|
String jsonString2 = UtilHttp.doPost("https://liteweb.blacklake.cn/api/dytin/external/saleOrder/queryList2", header, null, body_A);//todo:查询销售订单,获取客户、订单号、款号、产品描述、颜色、数量、销售单价、销售金额、币别
|
|
|
|
|
+ log.info("saleOrder/queryList2:{}",jsonString2);
|
|
|
JSONArray array = JSONObject.parseObject(jsonString2).getJSONArray("data");//主表数据
|
|
JSONArray array = JSONObject.parseObject(jsonString2).getJSONArray("data");//主表数据
|
|
|
-
|
|
|
|
|
|
|
+ String finalOrderNumber = orderNumber;
|
|
|
|
|
+// array = array.stream()
|
|
|
|
|
+// .filter(item -> item instanceof JSONObject) // 确保是 JSONObject
|
|
|
|
|
+// .map(item -> (JSONObject) item)
|
|
|
|
|
+// .filter(obj -> obj.getString("contractNo").equals(finalOrderNumber))
|
|
|
|
|
+// .collect(Collectors.toCollection(JSONArray::new));
|
|
|
boolean isSample = false;//销售订单若为样品订单则不发起钉钉流程
|
|
boolean isSample = false;//销售订单若为样品订单则不发起钉钉流程
|
|
|
for(int i=0;i<array.size();i++){
|
|
for(int i=0;i<array.size();i++){
|
|
|
JSONObject data = array.getJSONObject(i);
|
|
JSONObject data = array.getJSONObject(i);
|
|
|
customerName = data.getString("customerCode");//客户
|
|
customerName = data.getString("customerCode");//客户
|
|
|
|
|
+ if (finalOrderNumber.equals(data.getString("contractNo"))){
|
|
|
|
|
+ log.info("customer123:{}",customerName);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
ObjectMapper objectMapper2 = new ObjectMapper();
|
|
ObjectMapper objectMapper2 = new ObjectMapper();
|
|
|
JsonNode dataNode2 = null;//主表数据
|
|
JsonNode dataNode2 = null;//主表数据
|
|
|
|
|
+ List<JsonNode> list = new ArrayList<>();
|
|
|
try {
|
|
try {
|
|
|
dataNode2 = objectMapper2.readTree(jsonString2).get("data");
|
|
dataNode2 = objectMapper2.readTree(jsonString2).get("data");
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
- }
|
|
|
|
|
- for (JsonNode item : dataNode2){
|
|
|
|
|
- JsonNode customFieldValues = item.get("customFieldValues");
|
|
|
|
|
- for (JsonNode field : customFieldValues){
|
|
|
|
|
- JsonNode fieldIdNode = field.get("fieldId");
|
|
|
|
|
- if(fieldIdNode != null && fieldIdNode.asInt() == 161769){
|
|
|
|
|
- JsonNode valueNode = field.get("value");
|
|
|
|
|
- if(valueNode != null){
|
|
|
|
|
- estimatedPrice = valueNode.asDouble();//辅料预估单价
|
|
|
|
|
|
|
+ list = StreamSupport.stream(dataNode2.spliterator(), false)
|
|
|
|
|
+ .filter(node -> finalOrderNumber.equals(node.get("orderNo").asText()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ for (JsonNode item : list){
|
|
|
|
|
+ JsonNode customFieldValues = item.get("customFieldValues");
|
|
|
|
|
+ for (JsonNode field : customFieldValues){
|
|
|
|
|
+ JsonNode fieldIdNode = field.get("fieldId");
|
|
|
|
|
+ if(fieldIdNode != null && fieldIdNode.asInt() == 161769){
|
|
|
|
|
+ JsonNode valueNode = field.get("value");
|
|
|
|
|
+ if(valueNode != null){
|
|
|
|
|
+ estimatedPrice = valueNode.asDouble();//辅料预估单价
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if(fieldIdNode != null && fieldIdNode.asInt() == 47771){
|
|
|
|
|
- JsonNode valueNode = field.get("value");
|
|
|
|
|
- log.info("销售订单类型:{}",valueNode.asText());
|
|
|
|
|
- if("样品订单".equals(valueNode.asText())){
|
|
|
|
|
- isSample = true;
|
|
|
|
|
|
|
+ else if(fieldIdNode != null && fieldIdNode.asInt() == 47771){
|
|
|
|
|
+ JsonNode valueNode = field.get("value");
|
|
|
|
|
+ log.info("销售订单类型:{}",valueNode.asText());
|
|
|
|
|
+ if("样品订单".equals(valueNode.asText())){
|
|
|
|
|
+ isSample = true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!isSample){
|
|
if (!isSample){
|