rk
4 天以前 f51c9e1bc0e82cbebd0e05130fb9a754317cbfa2
月台自动叫号处理问题
已添加5个文件
已修改10个文件
609 ■■■■■ 文件已修改
server/system_gateway/src/main/resources/bootstrap.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/TelecomApiController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/resources/bootstrap.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/dto/TelecomLineInfoDTO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkLine.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketch.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomCategoryDataVO.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomJkLineListVO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomLineCountVO.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomLineDataVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/JkLineService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/JkSketchService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkLineServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java 333 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/system_gateway/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    active: test
    active: dev
  application:
    name: system_gateway
  # å®‰å…¨é…ç½®
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/TelecomApiController.java
@@ -10,7 +10,8 @@
import com.doumee.core.utils.DESUtil;
import com.doumee.dao.business.JkLineMapper;
import com.doumee.dao.business.dto.TelecomCabinetLogDTO;
import com.doumee.dao.business.vo.TelecomJkCabinetLogVO;
import com.doumee.dao.business.dto.TelecomLineInfoDTO;
import com.doumee.dao.business.vo.*;
import com.doumee.dao.openapi.request.*;
import com.doumee.dao.openapi.response.*;
import com.doumee.dao.system.model.SystemUser;
@@ -44,7 +45,7 @@
    private JkCabinetLogService jkCabinetLogService;
    @Autowired
    private JkLineService jkLineService;
    private JkSketchService jkSketchService;
    @LoginNoRequired
@@ -56,4 +57,39 @@
    }
    @LoginNoRequired
    @PreventRepeat
    @ApiOperation("电信-车辆线路")
    @PostMapping("/getLineForTelecom")
    public ApiResponse<List<TelecomJkLineListVO>> getLineForTelecom (@RequestBody TelecomLineInfoDTO dto) {
        return ApiResponse.success(jkSketchService.getLineForTelecom(dto));
    }
    @LoginNoRequired
    @PreventRepeat
    @ApiOperation("电信-线路总计与主子线路数据")
    @PostMapping("/getTelecomLineCount")
    public ApiResponse<TelecomLineCountVO> getTelecomLineCount (@RequestBody TelecomLineInfoDTO dto) {
        return ApiResponse.success(jkSketchService.getTelecomLineCount(dto));
    }
    @LoginNoRequired
    @PreventRepeat
    @ApiOperation("电信-线路优化对比数据")
    @PostMapping("/getTelecomLineDistance")
    public ApiResponse<List<TelecomCategoryDataVO>> getTelecomLineDistance (@RequestBody TelecomLineInfoDTO dto) {
        return ApiResponse.success(jkSketchService.getTelecomLineDistance(dto));
    }
    @LoginNoRequired
    @PreventRepeat
    @ApiOperation("电信-线路数据")
    @PostMapping("/getTelecomLineInfo")
    public ApiResponse<List<TelecomLineDataVO>> getTelecomLineInfo (@RequestBody TelecomLineInfoDTO dto) {
        return ApiResponse.success(jkSketchService.getTelecomLineInfo(dto));
    }
}
server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    active: test
    active: dev
  application:
    name: visitsAdmin
    # å®‰å…¨é…ç½®
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/dto/TelecomLineInfoDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package com.doumee.dao.business.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2025/10/11 16:01
 */
@Data
public class TelecomLineInfoDTO {
    @ApiModelProperty(value = "查询日期")
    private String dateInfo;
    @ApiModelProperty(value = "车辆名称、分线路名称")
    private String searchInfo;
    @ApiModelProperty(value = "主线路主键")
    private Integer categoryId;
    @ApiModelProperty(value = "分线路主键")
    private Integer lineId;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkLine.java
@@ -100,6 +100,9 @@
    @ApiModelProperty(value = "司机", example = "1")
    @TableField(exist = false)
    private String memberName;
    @ApiModelProperty(value = "客户数量", example = "1")
    @TableField(exist = false)
    private Integer customerNum;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketch.java
@@ -128,4 +128,11 @@
    @TableField(exist = false)
    List<Integer> lineIdList;
    @ApiModelProperty(value = "客户数量", example = "1")
    @TableField(exist = false)
    private Integer customerNum;
    @ApiModelProperty(value = "优化前线路数量", example = "1")
    @TableField(exist = false)
    private Integer beforeLineNum;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomCategoryDataVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
package com.doumee.dao.business.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
 * äº¤æŽ§-线路信息表
 * @author æ±Ÿè¹„蹄
 * @date 2025/09/28 09:01
 */
@Data
@ApiModel("交控-主线路数据 - ç”µä¿¡å¤§å±")
public class TelecomCategoryDataVO {
    @ApiModelProperty(value = "主线路主键", example = "1")
    private Integer id;
    @ApiModelProperty(value = "主线路名称", example = "1")
    private String name;
    @ApiModelProperty(value = "客户数量", example = "1")
    private Integer customerNum;
    @ApiModelProperty(value = "优化前总距离(单位 ç±³)", example = "1")
    private Long distance;
    @ApiModelProperty(value = "优化后总距离 (单位 ç±³)", example = "1")
    private Long distanceAfter;
    @ApiModelProperty(value = "子线路集合", example = "1")
    private List<TelecomLineDataVO> telecomLineDataVOList;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomJkLineListVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
package com.doumee.dao.business.vo;
import com.doumee.service.business.third.model.LoginUserModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * äº¤æŽ§-线路信息表
 * @author æ±Ÿè¹„蹄
 * @date 2025/09/28 09:01
 */
@Data
@ApiModel("交控-线路信息 - ç”µä¿¡å¤§å±")
public class TelecomJkLineListVO{
    @ApiModelProperty(value = "名称", example = "1")
    private String name;
    @ApiModelProperty(value = "客户数量", example = "1")
    private Integer customerNum;
    @ApiModelProperty(value = "送货车辆", example = "1")
    private String carCode;
    @ApiModelProperty(value = "所属主线路", example = "1")
    private String categoryName;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomLineCountVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.doumee.dao.business.vo;
import com.doumee.service.business.third.model.LoginUserModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * äº¤æŽ§-线路信息表
 * @author æ±Ÿè¹„蹄
 * @date 2025/09/28 09:01
 */
@Data
@ApiModel("交控-线路总计 - ç”µä¿¡å¤§å±")
public class TelecomLineCountVO{
    @ApiModelProperty(value = "主线路数", example = "1")
    private Integer categoryNum;
    @ApiModelProperty(value = "最大客户量", example = "1")
    private Integer lineNum;
    @ApiModelProperty(value = "客户数量", example = "1")
    private Integer customerNum;
    @ApiModelProperty(value = "线路数据", example = "1")
    private List<TelecomCategoryDataVO> telecomCategoryDataVOList;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/vo/TelecomLineDataVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.doumee.dao.business.vo;
import com.doumee.dao.business.model.JkCustomerNavigation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * äº¤æŽ§-线路信息表
 * @author æ±Ÿè¹„蹄
 * @date 2025/09/28 09:01
 */
@Data
@ApiModel("交控-子线路数据 - ç”µä¿¡å¤§å±")
public class TelecomLineDataVO {
    @ApiModelProperty(value = "子线路主键", example = "1")
    private Integer id;
    @ApiModelProperty(value = "子线路名称", example = "1")
    private String name;
    @ApiModelProperty(value = "子线路经纬度地址信息", example = "1")
    private List<JkCustomerNavigation> navigationList;
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/JkLineService.java
@@ -1,6 +1,9 @@
package com.doumee.service.business;
import com.doumee.dao.business.dto.TelecomLineInfoDTO;
import com.doumee.dao.business.model.Cars;
import com.doumee.dao.business.vo.TelecomJkLineListVO;
import com.doumee.dao.business.vo.TelecomLineCountVO;
import com.doumee.service.business.third.model.LoginUserInfo;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -100,4 +103,6 @@
    long count(JkLine jkLine);
    List<JkLine> importBatch(MultipartFile file, LoginUserInfo loginUser);
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/JkSketchService.java
@@ -1,7 +1,12 @@
package com.doumee.service.business;
import com.doumee.dao.business.dto.TelecomLineInfoDTO;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.JkCustomer;
import com.doumee.dao.business.vo.TelecomCategoryDataVO;
import com.doumee.dao.business.vo.TelecomJkLineListVO;
import com.doumee.dao.business.vo.TelecomLineCountVO;
import com.doumee.dao.business.vo.TelecomLineDataVO;
import com.doumee.service.business.third.model.LoginUserInfo;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -114,4 +119,32 @@
    void startEditSketchLineAsync(JkSketch model);
    void startInitOriginDistanceBatch(JkSketch list);
    /**
     * è½¦è¾†çº¿è·¯  - ç”µä¿¡ä½¿ç”¨
     * @param telecomLineInfoDTO
     * @return
     */
    List<TelecomJkLineListVO>  getLineForTelecom(TelecomLineInfoDTO telecomLineInfoDTO);
    /**
     * çº¿è·¯æ€»è®¡ä¸Žä¸»å­çº¿è·¯æ•°æ® - ç”µä¿¡ä½¿ç”¨
     * @return
     */
    TelecomLineCountVO getTelecomLineCount(TelecomLineInfoDTO telecomLineInfoDTO);
    /**
     * çº¿è·¯ä¼˜åŒ–对比数据
     * @param telecomLineInfoDTO
     * @return
     */
    List<TelecomCategoryDataVO> getTelecomLineDistance(TelecomLineInfoDTO telecomLineInfoDTO);
    /**
     * çº¿è·¯æ•°æ®
     * @param telecomLineInfoDTO
     * @return
     */
    List<TelecomLineDataVO> getTelecomLineInfo(TelecomLineInfoDTO telecomLineInfoDTO);
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkLineServiceImpl.java
@@ -1,17 +1,21 @@
package com.doumee.service.business.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import com.doumee.core.annotation.excel.ExcelImporter;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.ScientificNotationTUtil;
import com.doumee.dao.admin.request.CarsImport;
import com.doumee.core.utils.DateUtil;
import com.doumee.dao.admin.request.JkLineImport;
import com.doumee.dao.business.CarsMapper;
import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.JkCustomerMapper;
import com.doumee.dao.business.dto.TelecomLineInfoDTO;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.TelecomCategoryDataVO;
import com.doumee.dao.business.vo.TelecomJkLineListVO;
import com.doumee.dao.business.vo.TelecomLineCountVO;
import com.doumee.dao.business.vo.TelecomLineDataVO;
import com.doumee.service.business.third.model.LoginUserInfo;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -23,7 +27,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@@ -32,11 +35,12 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * äº¤æŽ§-线路信息表Service实现
@@ -449,4 +453,11 @@
        }
        return null;
    }
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java
@@ -188,6 +188,12 @@
        }
        return list;
    }
    @Override
    public List<JkSketchCustomer> findList(JkSketchCustomer jkSketchCustomer) {
   /*     if(jkSketchCustomer.getSketchId()!=null){
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.doumee.biz.system.SystemDictDataBiz;
@@ -12,7 +13,12 @@
import com.doumee.core.wms.model.response.WmsBaseResponse;
import com.doumee.dao.admin.request.JkOrdersImport;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dto.TelecomLineInfoDTO;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.TelecomCategoryDataVO;
import com.doumee.dao.business.vo.TelecomJkLineListVO;
import com.doumee.dao.business.vo.TelecomLineCountVO;
import com.doumee.dao.business.vo.TelecomLineDataVO;
import com.doumee.service.business.third.model.LoginUserInfo;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -38,6 +44,7 @@
import java.util.*;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * äº¤æŽ§-线路优化记录信息表Service实现
@@ -1298,4 +1305,330 @@
        }
        return null;
    }
    @Override
    public List<TelecomJkLineListVO>  getLineForTelecom(TelecomLineInfoDTO telecomLineInfoDTO){
        if(StringUtils.isBlank(telecomLineInfoDTO.getDateInfo())){
            telecomLineInfoDTO.setDateInfo(DateUtil.getDate(new Date(),"yyyy-MM-dd"));
        }
        MPJLambdaWrapper<JkSketchLine> queryWrapper = new MPJLambdaWrapper<JkSketchLine>().selectAll(JkSketchLine.class )
                .selectAs(Cars::getCode,JkSketchLine::getCarCode)
                .selectAs(Category::getName,JkSketchLine::getCategoryName)
                .selectAs(JkLine::getName,JkSketchLine::getLineName)
                .select(" ifnull((select count(1) from jk_sketch_customer jc where jc.ISDELETED= 0  and jc.SKETCH_LINE_ID = t.id),0)" ,JkSketchLine::getMaxCustomer)
                .leftJoin(JkSketch.class,JkSketch::getId,JkSketchLine::getSketchId)
                .leftJoin(JkLine.class,JkLine::getId,JkSketchLine::getLineId)
                .leftJoin(Category.class,Category::getId,JkLine::getCategoryId )
                .leftJoin(Cars.class,Cars::getId,JkLine::getCarId)
                .and(StringUtils.isNotBlank(telecomLineInfoDTO.getSearchInfo()),i->i.like(Cars::getCode,telecomLineInfoDTO.getSearchInfo()).or().like(JkLine::getName,telecomLineInfoDTO.getSearchInfo()))
                .eq(StringUtils.isNotBlank(telecomLineInfoDTO.getDateInfo()),JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo())
                .eq(Objects.nonNull(telecomLineInfoDTO.getCategoryId()),JkLine::getCategoryId, telecomLineInfoDTO.getCategoryId())
                .eq(Objects.nonNull(telecomLineInfoDTO.getLineId()),JkLine::getId, telecomLineInfoDTO.getLineId());
        List<JkSketchLine> jkSketchLineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper);
        List<TelecomJkLineListVO> telecomJkLineListVOList = new ArrayList<>();
        if(org.apache.commons.collections.CollectionUtils.isNotEmpty(jkSketchLineList)){
            //优化前数据
            List<JkSketchLine> beforeList = jkSketchLineList.stream()
                    .filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList());
            //优化后数据
            List<JkSketchLine> afterList = jkSketchLineList.stream()
                    .filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
            for (JkSketchLine sketchLine:beforeList) {
                JkSketchLine finalSketchLine = sketchLine;
                List<JkSketchLine> afterSelectList = afterList.stream().filter(i->Constants.equalsInteger(i.getLineId(), finalSketchLine.getLineId())).collect(Collectors.toList());
                if(afterSelectList.size()>Constants.ZERO){
                    sketchLine = afterSelectList.get(Constants.ZERO);
                }
                TelecomJkLineListVO telecomJkLineListVO = new TelecomJkLineListVO();
                telecomJkLineListVO.setCategoryName(sketchLine.getCategoryName());
                telecomJkLineListVO.setName(sketchLine.getLineName());
                telecomJkLineListVO.setCarCode(sketchLine.getCarCode());
                telecomJkLineListVO.setCustomerNum(sketchLine.getMaxCustomer());
                telecomJkLineListVOList.add(telecomJkLineListVO);
            }
        }
        return telecomJkLineListVOList;
    }
    @Override
    public TelecomLineCountVO getTelecomLineCount(TelecomLineInfoDTO telecomLineInfoDTO){
        if(StringUtils.isBlank(telecomLineInfoDTO.getDateInfo())){
            telecomLineInfoDTO.setDateInfo(DateUtil.getDate(new Date(),"yyyy-MM-dd"));
        }
        TelecomLineCountVO telecomLineCountVO = new TelecomLineCountVO();
        telecomLineCountVO.setLineNum(Constants.ZERO);
        telecomLineCountVO.setCategoryNum(Constants.ZERO);
        telecomLineCountVO.setCustomerNum(Constants.ZERO);
        MPJLambdaWrapper<JkSketch> sketchMPJLambdaWrapper = new MPJLambdaWrapper<JkSketch>().selectAll(JkSketch.class )
                .selectAs(Category::getName,JkSketch::getCategoryName)
                .select(" ifnull((select count(1) from jk_sketch_customer jc where jc.ISDELETED= 0 and  jc.SKETCH_ID = t.id),0)" ,JkSketch::getCustomerNum)
                .select(" ifnull((select count(1) from jk_sketch_line jc where   jc.TYPE = 0  and  jc.SKETCH_ID = t.id),0)" ,JkSketch::getBeforeLineNum)
                .leftJoin(Category.class,Category::getId,JkSketch::getCategoryId )
                .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo());
        List<JkSketch> sketchList = jkSketchMapper.selectJoinList(JkSketch.class,sketchMPJLambdaWrapper);
        if(CollectionUtils.isEmpty(sketchList)){
            return telecomLineCountVO;
        }
        MPJLambdaWrapper<JkSketchLine> queryWrapper = new MPJLambdaWrapper<JkSketchLine>().selectAll(JkSketchLine.class )
                .selectAs(Cars::getCode,JkSketchLine::getCarCode)
                .selectAs(Category::getName,JkSketchLine::getCategoryName)
                .selectAs(JkLine::getName,JkSketchLine::getLineName)
                .select(" ifnull((select count(1) from jk_sketch_customer jc where jc.ISDELETED= 0 and jc.SKETCH_LINE_ID = t.id),0)" ,JkSketchLine::getMaxCustomer)
                .leftJoin(JkSketch.class,JkSketch::getId,JkSketchLine::getSketchId)
                .leftJoin(JkLine.class,JkLine::getId,JkSketchLine::getLineId)
                .leftJoin(Category.class,Category::getId,JkLine::getCategoryId )
                .leftJoin(Cars.class,Cars::getId,JkLine::getCarId)
                .in(JkSketchLine::getSketchId,sketchList.stream().map(i->i.getId()).collect(Collectors.toList()));
        List<JkSketchLine> jkSketchLineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper);
        telecomLineCountVO.setCategoryNum(sketchList.size());
        telecomLineCountVO.setLineNum(sketchList.stream().map(i->i.getBeforeLineNum()).reduce(Constants.ZERO,Integer::sum));
        List<TelecomCategoryDataVO> telecomCategoryDataVOList = new ArrayList<>();
        for (JkSketch jkSketch:sketchList) {
            TelecomCategoryDataVO telecomCategoryDataVO = new TelecomCategoryDataVO();
            telecomCategoryDataVO.setId(jkSketch.getCategoryId());
            telecomCategoryDataVO.setName(jkSketch.getCategoryName());
            telecomCategoryDataVO.setCustomerNum(jkSketch.getCustomerNum());
            List<JkSketchLine> childLineList = jkSketchLineList.stream().filter(i->Constants.equalsInteger(i.getSketchId(),jkSketch.getId())).collect(Collectors.toList());
            //优化前数据
            List<JkSketchLine> beforeList = childLineList.stream()
                    .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());
            List<TelecomLineDataVO> telecomLineDataVOList = new ArrayList<>();
            for (JkSketchLine sketchLine:beforeList) {
                JkSketchLine finalSketchLine = sketchLine;
                List<JkSketchLine> afterSelectList = afterList.stream().filter(i->Constants.equalsInteger(i.getLineId(), finalSketchLine.getLineId())).collect(Collectors.toList());
                if(afterSelectList.size()>Constants.ZERO){
                    sketchLine = afterSelectList.get(Constants.ZERO);
                }
                TelecomLineDataVO telecomLineDataVO = new TelecomLineDataVO();
                telecomLineDataVO.setId(sketchLine.getId());
                telecomLineDataVO.setName(sketchLine.getLineName());
                telecomLineDataVOList.add(telecomLineDataVO);
                telecomLineCountVO.setCustomerNum(
                        telecomLineCountVO.getCustomerNum() + sketchLine.getMaxCustomer()
                );
            }
            telecomCategoryDataVO.setTelecomLineDataVOList(telecomLineDataVOList);
            telecomCategoryDataVOList.add(telecomCategoryDataVO);
        }
        telecomLineCountVO.setTelecomCategoryDataVOList(telecomCategoryDataVOList);
        return telecomLineCountVO;
    }
    @Override
    public List<TelecomCategoryDataVO> getTelecomLineDistance(TelecomLineInfoDTO telecomLineInfoDTO){
        if(StringUtils.isBlank(telecomLineInfoDTO.getDateInfo())){
            telecomLineInfoDTO.setDateInfo(DateUtil.getDate(new Date(),"yyyy-MM-dd"));
        }
        MPJLambdaWrapper<JkSketch> sketchMPJLambdaWrapper = new MPJLambdaWrapper<JkSketch>().selectAll(JkSketch.class )
                .selectAs(Category::getName,JkSketch::getCategoryName)
                .leftJoin(Category.class,Category::getId,JkSketch::getCategoryId )
                .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo());
        List<JkSketch> sketchList = jkSketchMapper.selectJoinList(JkSketch.class,sketchMPJLambdaWrapper);
        if(CollectionUtils.isEmpty(sketchList)){
            return new ArrayList<TelecomCategoryDataVO>();
        }
        MPJLambdaWrapper<JkSketchLine> queryWrapper = new MPJLambdaWrapper<JkSketchLine>().selectAll(JkSketchLine.class )
                .selectAs(Cars::getCode,JkSketchLine::getCarCode)
                .selectAs(Category::getName,JkSketchLine::getCategoryName)
                .selectAs(JkLine::getName,JkSketchLine::getLineName)
                .leftJoin(JkSketch.class,JkSketch::getId,JkSketchLine::getSketchId)
                .leftJoin(JkLine.class,JkLine::getId,JkSketchLine::getLineId)
                .leftJoin(Category.class,Category::getId,JkLine::getCategoryId )
                .leftJoin(Cars.class,Cars::getId,JkLine::getCarId)
                .in(JkSketchLine::getSketchId,sketchList.stream().map(i->i.getId()).collect(Collectors.toList()));
        List<JkSketchLine> jkSketchLineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper);
        List<TelecomCategoryDataVO> telecomCategoryDataVOList = new ArrayList<>();
        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)
            );
            //优化后数据
            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());
            if(org.apache.commons.collections.CollectionUtils.isEmpty(afterList)){
                telecomCategoryDataVO.setDistanceAfter(telecomCategoryDataVO.getDistance());
            }else if(beforeList.size()>afterList.size()){
                Long distanceAfter = 0L;
                for (JkSketchLine jkSketchLine:beforeList) {
                    List<JkSketchLine> afterSelectList = afterList.stream().filter(i->Constants.equalsInteger(i.getLineId(),jkSketchLine.getLineId())).collect(Collectors.toList());
                    if(afterSelectList.size()>Constants.ZERO){
                        distanceAfter = distanceAfter + afterSelectList.get(Constants.ZERO).getDistance();
                    }else{
                        distanceAfter = distanceAfter + jkSketchLine.getDistance();
                    }
                }
                telecomCategoryDataVO.setDistanceAfter(distanceAfter);
            }else{
                telecomCategoryDataVO.setDistanceAfter(
                        afterList.stream().map(i->i.getDistance()).reduce(Long.valueOf(0),Long::sum)
                );
            }
            telecomCategoryDataVOList.add(telecomCategoryDataVO);
        }
        return telecomCategoryDataVOList;
    }
    @Override
    public List<TelecomLineDataVO> getTelecomLineInfo(TelecomLineInfoDTO telecomLineInfoDTO){
        if(StringUtils.isBlank(telecomLineInfoDTO.getDateInfo())){
            telecomLineInfoDTO.setDateInfo(DateUtil.getDate(new Date(),"yyyy-MM-dd"));
        }
        MPJLambdaWrapper<JkSketchLine> queryWrapper = new MPJLambdaWrapper<JkSketchLine>().selectAll(JkSketchLine.class )
                .selectAs(Cars::getCode,JkSketchLine::getCarCode)
                .selectAs(Category::getName,JkSketchLine::getCategoryName)
                .selectAs(JkLine::getName,JkSketchLine::getLineName)
                .leftJoin(JkSketch.class,JkSketch::getId,JkSketchLine::getSketchId)
                .leftJoin(JkLine.class,JkLine::getId,JkSketchLine::getLineId)
                .leftJoin(Category.class,Category::getId,JkLine::getCategoryId )
                .leftJoin(Cars.class,Cars::getId,JkLine::getCarId)
                .eq(JkSketchLine::getIsdeleted,Constants.ZERO)
                .eq(Objects.nonNull(telecomLineInfoDTO.getCategoryId()),JkSketchLine::getCategoryId,telecomLineInfoDTO.getCategoryId())
                .eq(Objects.nonNull(telecomLineInfoDTO.getLineId()),JkSketchLine::getLineId,telecomLineInfoDTO.getLineId())
                .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo());
        List<JkSketchLine> jkSketchLineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper);
        //优化前数据
        List<JkSketchLine> beforeList = jkSketchLineList.stream()
                .filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList());
        //优化后数据
        List<JkSketchLine> afterList = jkSketchLineList.stream()
                .filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Constants.equalsInteger(i.getIsdeleted(),Constants.ZERO)).collect(Collectors.toList());
        List<JkSketchLine> returnLineList = new ArrayList<>();
        for (JkSketchLine jkSketchLine:beforeList) {
            List<JkSketchLine> afterSelectList = afterList.stream().filter(i->Constants.equalsInteger(i.getLineId(),jkSketchLine.getLineId())).collect(Collectors.toList());
            if(afterSelectList.size()>Constants.ZERO){
                returnLineList.add(afterList.get(Constants.ZERO));
            }else{
                returnLineList.add(jkSketchLine);
            }
        }
        List<TelecomLineDataVO> dataVOList = new ArrayList<>();
        if(org.apache.commons.collections.CollectionUtils.isNotEmpty(returnLineList)){
            //获取所有地图经纬度数据
            MPJLambdaWrapper<JkSketchCustomer> jkSketchCustomerMPJLambdaWrapper = new MPJLambdaWrapper<>();
            jkSketchCustomerMPJLambdaWrapper.selectAll(JkSketchCustomer.class )
                    .selectAs(JkCustomer::getName,JkSketchCustomer::getName)
                    .selectAs(JkCustomer::getCode,JkSketchCustomer::getCode)
                    .selectAs(JkCustomer::getStartDistance,JkSketchCustomer::getStartDistance)
                    .selectAs(JkCustomer::getEndDistance,JkSketchCustomer::getEndDistance)
                    .selectAs(JkCustomer::getLatitude,JkSketchCustomer::getLatitude)
                    .selectAs(JkCustomer::getLongitude,JkSketchCustomer::getLongitude)
                    .selectAs(JkCustomer::getStartSteps,JkSketchCustomer::getStartSteps)
                    .selectAs(JkCustomer::getEndSteps,JkSketchCustomer::getEndSteps)
                    .selectAs(JkCustomer::getLocation,JkSketchCustomer::getLocation)
                    .leftJoin(JkCustomer.class,JkCustomer::getId,JkSketchCustomer::getCustomerId )
                    .eq( JkSketchCustomer::getIsdeleted,Constants.ZERO)
                    .in( JkSketchCustomer::getSketchLineId,returnLineList.stream().map(i->i.getId()).collect(Collectors.toList()));
            List<JkSketchCustomer> allList =  jkSketchCustomerMapper.selectJoinList(JkSketchCustomer.class,jkSketchCustomerMPJLambdaWrapper);
            BigDecimal cLatitude =new BigDecimal(0);
            BigDecimal cLongitude =new BigDecimal(0);
            String comLocation = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.COMPANY_LOCATION).getCode();
            try {
                String[] ss = comLocation.split(",");
                cLongitude = new BigDecimal(ss[0]);
                cLatitude =  new BigDecimal(ss[1]);
            }catch (Exception e){
            }
            for (JkSketchLine line:returnLineList) {
                TelecomLineDataVO telecomLineDataVO = new TelecomLineDataVO();
                telecomLineDataVO.setId(line.getLineId());
                telecomLineDataVO.setName(line.getLineName());
                List<JkSketchCustomer> sketchCustomerList = allList.stream().filter(i->Constants.equalsInteger(i.getSketchLineId(),line.getId())).collect(Collectors.toList());
                if(org.apache.commons.collections.CollectionUtils.isNotEmpty(sketchCustomerList)){
                    telecomLineDataVO.setNavigationList(this.dealLineCustomerInfo(cLatitude,cLongitude,comLocation,sketchCustomerList));
                }
                dataVOList.add(telecomLineDataVO);
            }
        }
        return dataVOList;
    }
    public List<JkCustomerNavigation> dealLineCustomerInfo(BigDecimal cLatitude,BigDecimal cLongitude,String comLocation,List<JkSketchCustomer> allList){
        List<JkCustomerNavigation> list = new ArrayList<>();
        JkCustomerNavigation startmodel = new JkCustomerNavigation();
        startmodel.setStartId(-1);
        startmodel.setName("园区");
        startmodel.setStartLatitude(cLatitude);
        startmodel.setStartLogitude(cLongitude);
        startmodel.setEndLatitude(allList.get(0).getLatitude());
        startmodel.setEndLogitude(allList.get(0).getLongitude());
        startmodel.setDistance(allList.get(0).getStartDistance());
        startmodel.setSteps(allList.get(0).getStartSteps());
        if(StringUtils.isBlank(startmodel.getSteps())){
            startmodel.setSteps(comLocation +";"+allList.get(0).getLongitude()+","+allList.get(0).getLatitude());
        }
        list.add(startmodel);
        for (int i = 0; i < allList.size(); i++) {
            if(allList.size() == i+1){
                JkCustomerNavigation endmodel = new JkCustomerNavigation();
                endmodel.setStartId(-1);
                endmodel.setLocation(allList.get(i).getLocation());
                endmodel.setName(allList.get(i).getName());
                endmodel.setSteps(allList.get(i).getEndSteps());
                endmodel.setStartLatitude(allList.get(i).getLatitude());
                endmodel.setStartLogitude(allList.get(i).getLongitude());
                endmodel.setDistance(allList.get(0).getEndDistance());
                endmodel.setEndLatitude(cLatitude);
                endmodel.setEndLogitude(cLongitude);
                if(StringUtils.isBlank(startmodel.getSteps())){
                    startmodel.setSteps(allList.get(i).getLongitude()+","+allList.get(i).getLatitude()+";"+comLocation);
                }
                list.add(endmodel);
                break;
            }
            JkSketchCustomer start = allList.get(i);
            JkSketchCustomer end = allList.get(i+1);
            JkCustomerNavigation tt = jkCustomerNavigationMapper.selectOne(new QueryWrapper<JkCustomerNavigation>().lambda()
                    .eq(JkCustomerNavigation::getIsdeleted,Constants.ZERO)
                    .eq(JkCustomerNavigation::getIdIndex, allList.get(i).getCustomerId()+"-"+ allList.get(i+1).getCustomerId())
                    .orderByDesc(JkCustomerNavigation::getId)
                    .last("limit 1")
            );
            if(tt==null){
                //只有起止点
                tt = new JkCustomerNavigation();
                tt.setStartLatitude(start.getLatitude());
                tt.setStartLogitude(start.getLongitude());
                tt.setEndLatitude(end.getLatitude());
                tt.setEndLogitude(end.getLongitude());
            }
            tt.setLocation(allList.get(i).getLocation());
            tt.setName(allList.get(i).getName());
            if(StringUtils.isBlank(tt.getSteps())){
                tt.setSteps(start.getLongitude()+","+end.getLatitude()+";"+end.getLongitude()+","+end.getLatitude());
            }
            list.add(tt);
        }
        return list;
    }
}