| | |
| | | int index =0; |
| | | for (int j = start; j < end; j++) { |
| | | try { |
| | | log.error("交通规划========"+customerList.get(j).getName()+"========cirle:"+finalI+"==="+index++); |
| | | log.error("交通规划========"+cate.getId()+"/"+cate.getName()+"/"+customerList.get(j).getName()+"=======cirle/index:"+finalI+"/"+index++); |
| | | dealDistancePerCustomer(customerList.get(j),url,date, finalCLatitude, finalCLongitude,customerList); |
| | | }catch (Exception e){ |
| | | |
| | |
| | | List<JkCustomerNavigation> navigationList = new ArrayList<>(); |
| | | List<DistanceMapParam> tmpList = new ArrayList<>(); |
| | | List<DistanceMapParam> distanceMapParamList = getListFromJsonStr(c.getDistance()); |
| | | boolean isNew = false; |
| | | boolean isNew = false,hasError =false; |
| | | JkCustomer u =new JkCustomer(); |
| | | DistanceMapParam t0 = new DistanceMapParam(); |
| | | t0.setId(-2);//表示返回园区 |
| | |
| | | //如果有路径信息 |
| | | u.setStartSteps(dm.getPolyline()); |
| | | } |
| | | }else{ |
| | | hasError=true; |
| | | } |
| | | |
| | | } |
| | | tmpList.add(t0); |
| | | for(JkCustomer cm : customerList){ |
| | | //客户和客户之间的距离信息 |
| | | Thread.sleep(500); |
| | | DistanceMapParam t = new DistanceMapParam(); |
| | | t.setId(cm.getId()); |
| | | DistanceMapParam param = getParamByCustomerIds( cm.getId(),distanceMapParamList); |
| | |
| | | }else{ |
| | | DistanceCustomerModel dm = DistanceCalculator.calculateDistanceGaode(url,c,cm); |
| | | t.setDistance(dm.getDistance() ); |
| | | if(dm.getCode() == 1){ |
| | | if(dm.getLocations().size()>0){ |
| | | //如果有路径信息 |
| | | navigation.setSteps(dm.getPolyline()); |
| | | } |
| | | }else{ |
| | | hasError=true; |
| | | } |
| | | |
| | | } |
| | | navigation.setIdIndex(c.getId()+"-"+cm.getId()); |
| | | navigation.setDistance(t.getDistance()); |
| | |
| | | //如果有路径信息 |
| | | u.setEndSteps(dm.getPolyline()); |
| | | } |
| | | }else{ |
| | | hasError=true; |
| | | } |
| | | |
| | | } |
| | | tmpList.add(tt); |
| | | if(isNew){// |
| | | u.setDistanceStatus(Constants.ONE); |
| | | u.setDistanceStatus(hasError?Constants.ZERO:Constants.ONE);//所有都成功才标注已规划 |
| | | u.setId(c.getId()); |
| | | u.setDistance(JSONObject.toJSONString(tmpList)); |
| | | updateCustomerList.add(u); |
| | |
| | | .eq(JkLine::getCategoryId,model.getCategoryId() ); |
| | | List<JkCustomer> customerList = jkCustomerMapper.selectJoinList(JkCustomer.class,queryWrapper1); |
| | | List<JkCustomer> needList =checkNeedDistanceDo(customerList); |
| | | if(needList == null || needList.size() == 0){ |
| | | if(Constants.equalsInteger(model.getForceUpdate(),0)&& (needList == null || needList.size() == 0)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该主线下无需要进行距离计算的客户信息!"); |
| | | } |
| | | String errorMsg =""; |
| | |
| | | } |
| | | c.setStatus(Constants.TWO); |
| | | categoryMapper.updateById(c);//更新任务执行状态 |
| | | c.setCustomerList(customerList); |
| | | c.setCustomerList(Constants.equalsInteger(model.getForceUpdate(),0)?needList:customerList); |
| | | return c; |
| | | } |
| | | |
| | |
| | | .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()); |
| | | if(sketchList!=null){ |
| | | for (JkSketch jkSketch:sketchList) { |
| | | TelecomCategoryDataVO telecomCategoryDataVO = new TelecomCategoryDataVO(); |
| | | telecomCategoryDataVO.setId(jkSketch.getCategoryId()); |
| | | 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()); |
| | | telecomCategoryDataVO.setDistance( |
| | | beforeList.stream().map(i->i.getDistance()).reduce(Long.valueOf(0),Long::sum) |
| | | ); |
| | | if(Constants.equalsInteger(jkSketch.getOptStatus(),Constants.ZERO)){ |
| | | telecomCategoryDataVO.setDistanceAfter(telecomCategoryDataVO.getDistance()); |
| | | }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()); |
| | | |
| | | Long distanceAfter = 0L; |
| | | for (JkSketchLine jkSketchLine:afterList) { |
| | |
| | | } |
| | | telecomCategoryDataVOList.add(telecomCategoryDataVO); |
| | | } |
| | | } |
| | | return telecomCategoryDataVOList; |
| | | } |
| | | |