From 8134798d85d2abb086f727fde8b6fd20d3acd670 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 24 十一月 2025 09:04:36 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
index d22de24..a2c4051 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
@@ -730,7 +730,7 @@
                 DistanceMapParam t = new DistanceMapParam();
                 t.setId(cm.getCustomerId());
                  DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),distanceMapParamList);
-                if(param!=null){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
+                if(param!=null && t.getDistance()>0){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
                     t = param;
                 }else{
                     //濡傛灉鏈鍒掞紝鎸夌収鐩寸嚎璺濈
@@ -758,14 +758,27 @@
                 int index =0;
                 for(JkSketchCustomer c : customers){
                     if(index ==0){
-                        lineDistance+= Constants.formatLongNum(c.getStartDistance());
+                        if(c.getStartDistance() >0){
+                            lineDistance+= Constants.formatLongNum(c.getStartDistance());
+                        }else{
+                            lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),cLatitude,cLongitude);
+                        }
                     }
                     if(index == customers.size()-1){
-                        lineDistance+= Constants.formatLongNum(c.getEndDistance());
+                        if(c.getEndDistance() >0){
+                            lineDistance+= Constants.formatLongNum(c.getEndDistance());
+                        }else{
+                            lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),cLatitude,cLongitude);
+                        }
                         break;
                     }
-                    DistanceMapParam param = getParamByCustomerIds( customers.get(index+1).getCustomerId(),getListFromJsonStr(c.getDistanceJson()));
-                    lineDistance += param.getDistance();
+                    JkSketchCustomer end = customers.get(index+1);
+                    DistanceMapParam param1 = getParamByCustomerIds(end.getCustomerId(),getListFromJsonStr(c.getDistanceJson()));
+                    if(param1 !=null && param1.getDistance()>0){
+                        lineDistance += param1.getDistance();
+                    }else{
+                        lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),end.getLatitude(),end.getLongitude());
+                    }
                     index++;
                   /*  for(JkSketchCustomer cm : customers){
                         DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),getListFromJsonStr(c.getDistanceJson()));
@@ -1471,7 +1484,8 @@
                     .filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList());
             //浼樺寲鍚庢暟鎹�
             List<JkSketchLine> afterList = childLineList.stream()
-                    .filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
+                    .filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)
+                            && Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
 
             lineNum = lineNum + (Constants.equalsInteger(jkSketch.getOptStatus(),Constants.ZERO)?beforeList.size():afterList.size());
             List<TelecomLineDataVO> telecomLineDataVOList = new ArrayList<>();
@@ -1528,7 +1542,9 @@
                 telecomCategoryDataVO.setName(jkSketch.getCategoryName());
                 //浼樺寲鍓嶆暟鎹�
                 List<JkSketchLine> beforeList = jkSketchLineList.stream()
-                        .filter(i->Constants.equalsInteger(i.getSketchId(),jkSketch.getId())&&Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList());
+                        .filter(i->Constants.equalsInteger(i.getSketchId(),jkSketch.getId())
+                                && Objects.nonNull(i.getDistance())
+                                &&Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList());
                 telecomCategoryDataVO.setDistance(
                         beforeList.stream().map(i->i.getDistance()).reduce(Long.valueOf(0),Long::sum)
                 );
@@ -1537,7 +1553,9 @@
                 }else{
                     //浼樺寲鍚庢暟鎹�
                     List<JkSketchLine> afterList = jkSketchLineList.stream()
-                            .filter(i->Constants.equalsInteger(i.getSketchId(),jkSketch.getId())&&Constants.equalsInteger(i.getType(),Constants.ONE)&&Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
+                            .filter(i->Constants.equalsInteger(i.getSketchId(),jkSketch.getId())
+                                    && Objects.nonNull(i.getDistance())
+                                    &&Constants.equalsInteger(i.getType(),Constants.ONE)&&Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
 
                     Long distanceAfter = 0L;
                     for (JkSketchLine jkSketchLine:afterList) {

--
Gitblit v1.9.3