doum
6 小时以前 8134798d85d2abb086f727fde8b6fd20d3acd670
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) {