From aee5abdde781ab426771f2024d57e3429aa2b95a Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 15 十月 2025 10:29:40 +0800
Subject: [PATCH] 最新版本541200007
---
server/system_service/src/main/java/com/doumee/core/utils/Constants.java | 1
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/JkCustomerNavigationMapper.java | 3
admin/src/views/business/jkSketch.vue | 2
server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java | 8 +
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomerNavigation.java | 4
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketchCustomer.java | 19 ++++
admin/src/assets/style/lib.css | 5
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java | 9 ++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCustomerServiceImpl.java | 2
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java | 14 ++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java | 127 ++++++++++++++++++++++++-------
server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceModel.java | 2
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomer.java | 15 +++
admin/.env.development | 2
14 files changed, 169 insertions(+), 44 deletions(-)
diff --git a/admin/.env.development b/admin/.env.development
index 3661935..80a0588 100644
--- a/admin/.env.development
+++ b/admin/.env.development
@@ -2,7 +2,7 @@
NODE_ENV = 'development'
# VUE_APP_API_URL = 'https://atwl.ahzyssl.com/zhyq_interface'
-VUE_APP_API_URL = 'http://192.168.1.54:10010'
+VUE_APP_API_URL = 'http://localhost:10010'
# VUE_APP_API_URL = 'https://atwl.ahzyssl.com/zhyq_interface'
# VUE_APP_API_URL = 'http://10.50.250.253:8088/gateway_interface'
diff --git a/admin/src/assets/style/lib.css b/admin/src/assets/style/lib.css
index 2fd7178..9b309b9 100644
--- a/admin/src/assets/style/lib.css
+++ b/admin/src/assets/style/lib.css
@@ -97,8 +97,8 @@
.cY{ display: flex; align-items: center;}
.cX{display: flex; justify-content: center}
.rowW{ display: flex; flex-wrap: wrap;}
-.bX{ display: flex; flex-direction: row; justify-content: space-between;}
-.bY{ display: flex; flex-direction:column; justify-content: space-between;}
+.bX{ display: flex; flex-direction: row; justify-content: space-between;}
+.bY{ display: flex; flex-direction:column; justify-content: space-between;}
.bcX{ display: flex; justify-content: space-between; align-items: center;}
.fx1{ flex: 1; overflow: hidden; }
@@ -112,6 +112,7 @@
.green{ color: #65C35D;}
.blue{ color: #3C77DA;}
.red{ color: #f00;}
+.grey{ color: #666666;}
/* /deep/ .uicon-close .u-icon--right{ position: absolute; right: 30px; top: 30px; z-index: 999;} */
.popCloseBtn{ position: absolute; width:50px; height:50px; right: 20px; top: 20px;}
.fixedHeader{ position: absolute; left: 0; top: 0;}
diff --git a/admin/src/views/business/jkSketch.vue b/admin/src/views/business/jkSketch.vue
index 96b57a0..59b2a53 100644
--- a/admin/src/views/business/jkSketch.vue
+++ b/admin/src/views/business/jkSketch.vue
@@ -52,7 +52,7 @@
<span v-if="row.status === 0" class="blue">鏈紭鍖�</span>
<span v-if="row.status === 1" class="red">浼樺寲涓� 銆� {{row.planLineNum||0}} 銆戞潯绾胯矾</span>
<span v-if="row.status === 2" class="green">宸蹭紭鍖�</span>
- <span v-if="row.status === 3" class="green">浼樺寲澶辫触</span>
+ <span v-if="row.status === 3" class="grey">浼樺寲澶辫触</span>
</template>
</el-table-column>
<el-table-column
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index 05b8303..2d14098 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -38,6 +38,7 @@
public static final String HK_HTTPS ="HK_HTTPS" ;
public static final String HK_PUSH_URL = "HK_PUSH_URL";
public static final String HK_CARS_OPENAPI_ACCESS_KEY = "HK_CARS_OPENAPI_ACCESS_KEY";
+ public static final String GAODE_DISTANCE_GEOAPI_URL = "GAODE_DISTANCE_GEOAPI_URL";
public static final String HK_CARS_OPENAPI_ACCESS_SECRET = "HK_CARS_OPENAPI_ACCESS_SECRET";
public static final String HK_CARS_OPENAPI_URL = "HK_CARS_OPENAPI_URL";
public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ;
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java
index 7f76135..239e1dc 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java
@@ -30,6 +30,7 @@
r.setStart(c1);
r.setEnd(c2);
r.setDistance(0);
+ r.setCode(0);
r.setLocations( new ArrayList<>());
try {
String url =urlStr.replace("${lat1}", Constants.formatBigdecimalScale(c1.getLatitude(),6)+"")
@@ -47,7 +48,7 @@
JSONArray array = json.getJSONObject("route").getJSONArray("paths");
JSONObject model = array.getJSONObject(0);//鍙栫涓�涓�
Long distance = Long.parseLong(model.getString("distance"));
- r.setDistance(distance*1000);
+ r.setDistance(distance);
JSONArray steps = model.getJSONArray("steps");
String tl = "";
if(steps!=null && steps.size()>0){
@@ -61,9 +62,12 @@
tl+= steps.getJSONObject(i).getString("polyline" );
}
}
+ r.setPolyline(tl);
r.setLocations(Arrays.asList(tl.split(";")));
+ r.setCode(1);
+ log.error("鑾峰彇浜ら�氳鍒掔嚎璺俊鎭垚鍔�==============");
}else{
- log.error("鑾峰彇浜ら�氳鍒掔嚎璺俊鎭垚鍔�==============");
+ log.error("鑾峰彇浜ら�氳鍒掔嚎璺俊鎭垚鍔�=====澶辫触锛侊紒=========");
}
}catch (Exception e){
log.error("鑾峰彇浜ら�氳鍒掔嚎璺俊鎭垚鍔�=====澶辫触==========");
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceModel.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceModel.java
index 0972223..abfde9f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceModel.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceModel.java
@@ -12,8 +12,10 @@
public class DistanceModel {
private long distance;
private List<String> locations;
+ private String polyline;
private JkSketchCustomer start;
private JkSketchCustomer end;
+ private int code;//0澶辫触 1鎴愬姛
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/JkCustomerNavigationMapper.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/JkCustomerNavigationMapper.java
index 7c63700..0801b94 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/JkCustomerNavigationMapper.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/JkCustomerNavigationMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.JkCustomerNavigation;
+import com.github.yulichang.base.MPJBaseMapper;
/**
* @author 姹熻箘韫�
* @date 2025/10/13 15:48
*/
-public interface JkCustomerNavigationMapper extends BaseMapper<JkCustomerNavigation> {
+public interface JkCustomerNavigationMapper extends MPJBaseMapper<JkCustomerNavigation> {
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
index 1710745..38fbbec 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
@@ -95,6 +95,15 @@
@ApiModelProperty(value = "瀹屾暣鍥剧墖鍦板潃 ")
@TableField(exist = false)
private String imgurlFull;
+ @ApiModelProperty(value = "绾胯矾鏁� ")
+ @TableField(exist = false)
+ private int lineNum;
+ @ApiModelProperty(value = "瀹屾垚绾胯矾璁$畻瀹㈡埛鏁� ")
+ @TableField(exist = false)
+ private int customerDoneNum;
+ @ApiModelProperty(value = "瀹㈡埛鏁� ")
+ @TableField(exist = false)
+ private int customerNum;
@ApiModelProperty(value = "瀛愰泦鍒嗙被")
@TableField(exist = false)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomer.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomer.java
index 2a7586a..cf21153 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomer.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomer.java
@@ -89,9 +89,24 @@
@ApiModelProperty(value = "鐘舵�� 0姝e父 绂佺敤", example = "1")
//@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
private Integer status;
+ @ApiModelProperty(value = "璺濈璁$畻鐘舵�� 0鏈绠� 1宸茶绠�", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private Integer distanceStatus;
@ApiModelProperty(value = "瀹㈡埛闂磋窛绂婚泦鍚�", example = "1")
//@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
private String distance;
+ @ApiModelProperty(value = "鍥尯璺濈璇ュ鎴风殑璺濈锛堢背锛�", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private Long startDistance;
+ @ApiModelProperty(value = "璇ュ鎴疯繑鍥炲洯鍖虹殑璺濈锛堢背锛�", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private Long endDistance;
+ @ApiModelProperty(value = "鍥尯璺濈璇ュ鎴风殑璺緞缁忕含搴﹂泦鍚堬紝鍒嗗彿闅斿紑", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private String startSteps;
+ @ApiModelProperty(value = "璇ュ鎴疯繑鍥炲洯鍖虹殑璺緞缁忕含搴﹂泦鍚堬紝鍒嗗彿闅斿紑", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private String endSteps;
@ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
//@ExcelColumn(name="鎺掑簭鐮�")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomerNavigation.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomerNavigation.java
index 736c75d..c83b38f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomerNavigation.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkCustomerNavigation.java
@@ -54,11 +54,11 @@
@ApiModelProperty(value = "璧峰瀹㈡埛缂栫爜锛堣捣鐐逛綅-1锛�", example = "1")
@ExcelColumn(name="璧峰瀹㈡埛缂栫爜锛堣捣鐐逛綅-1锛�")
- private Long startId;
+ private Integer startId;
@ApiModelProperty(value = "缁堢瀹㈡埛缂栫爜锛堣捣鐐逛綅-1锛�", example = "1")
@ExcelColumn(name="缁堢瀹㈡埛缂栫爜锛堣捣鐐逛綅-1锛�")
- private Long endId;
+ private Integer endId;
@ApiModelProperty(value = "璺濈锛堢背锛�", example = "1")
@ExcelColumn(name="璺濈锛堢背锛�")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketchCustomer.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketchCustomer.java
index 80b2342..6f81fd5 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketchCustomer.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/JkSketchCustomer.java
@@ -119,9 +119,26 @@
//@ExcelColumn(name="缁村害")
@TableField(exist = false)
private BigDecimal latitude;
- @ApiModelProperty(value = "绾胯矾鍚嶇О", example = "1")
+ @ApiModelProperty(value = "绾胯矾璺濈", example = "1")
@TableField(exist = false)
private String distanceJson;
+
+ @ApiModelProperty(value = "鍥尯璺濈璇ュ鎴风殑璺濈锛堢背锛�", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ @TableField(exist = false)
+ private Long startDistance;
+ @ApiModelProperty(value = "璇ュ鎴疯繑鍥炲洯鍖虹殑璺濈锛堢背锛�", example = "1")
+ @TableField(exist = false)
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ private Long endDistance;
+ @ApiModelProperty(value = "鍥尯璺濈璇ュ鎴风殑璺緞缁忕含搴﹂泦鍚堬紝鍒嗗彿闅斿紑", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ @TableField(exist = false)
+ private String startSteps;
+ @ApiModelProperty(value = "璇ュ鎴疯繑鍥炲洯鍖虹殑璺緞缁忕含搴﹂泦鍚堬紝鍒嗗彿闅斿紑", example = "1")
+ //@ExcelColumn(name="鐘舵�� 0姝e父 绂佺敤")
+ @TableField(exist = false)
+ private String endSteps;
@ApiModelProperty(value = "鍚岀彮缁勯棿瀹㈡埛浣嶇疆璺濈鏁扮粍锛孾{a:12,b:100},{a:13,b:200},...],a锛氬鎴风紪鐮侊紝b锛氫笌瀹㈡埛a涔嬮棿鐨勮窛绂�")
@TableField(exist = false)
private List<Map<String,Object>> distanceList;
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
index f1808a3..5bb5632 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -15,6 +15,8 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.query.MPJQueryWrapper;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.checkerframework.checker.units.qual.C;
@@ -156,12 +158,18 @@
@Override
public PageData<Category> findPage(PageWrap<Category> pageWrap) {
IPage<Category> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
- QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
+ MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>();
Utils.MP.blankToNull(pageWrap.getModel());
String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() +
systemDictDataBiz.queryByCode(Constants.FTP,Constants.BANNER_IMG).getCode();
-
- queryWrapper.lambda().eq(Category::getIsdeleted,Constants.ZERO)
+ queryWrapper.selectAll(Category.class );
+ if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.FOUR)){
+ //濡傛灉鏄富绾胯矾锛屾煡璇㈢嚎璺暟鍜屽鎴锋暟
+ queryWrapper.select( "(select count(1) from jk_line b where b.isdeleted=0 and b.CATEGORY_ID = t.id)",Category::getLineNum);
+ queryWrapper.select( "(select count(1) from jk_customer b left join jk_line c on b.line_id=c.id where c.isdeleted=0 and b.isdeleted=0 and c.CATEGORY_ID = t.id)",Category::getCustomerNum);
+ queryWrapper.select( "(select count(1) from jk_customer b left join jk_line c on b.line_id=c.id where c.isdeleted=0 and b.isdeleted=0 and c.CATEGORY_ID = t.id b.DISTANCE_STATUS = 1)",Category::getCustomerDoneNum);
+ }
+ queryWrapper.eq(Category::getIsdeleted,Constants.ZERO)
.eq(Objects.nonNull(pageWrap.getModel().getType()),Category::getType,pageWrap.getModel().getType())
.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Category::getName,pageWrap.getModel().getName())
.isNull(Category::getParentId)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCustomerServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCustomerServiceImpl.java
index a2aa471..85cf953 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCustomerServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCustomerServiceImpl.java
@@ -390,6 +390,8 @@
tModel.setCreator(loginUserInfo.getId());
tModel.setCreateDate(new Date());
tModel.setIsnew(Constants.ONE);
+ tModel.setStatus(Constants.ZERO);
+ tModel.setDistanceStatus(Constants.ZERO);
newList.add(tModel);
}else{
tModel.setIsnew(Constants.ZERO);
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 d4fddbd..c7669ef 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
@@ -54,6 +54,8 @@
@Autowired
private JkCustomerMapper jkCustomerMapper;
@Autowired
+ private JkCustomerNavigationMapper jkCustomerNavigationMapper;
+ @Autowired
private JkLineMapper jkLineMapper;
@Autowired
@@ -98,11 +100,11 @@
if( model.getDateInfo() == null){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺棩鏈熶俊鎭笉姝g‘锛屼笉鏀寔浼樺寲锛�");
}
- if(Constants.equalsInteger(Constants.ZERO,jkSketch.getForceUpdate()) && Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+ if(Constants.equalsInteger(Constants.ZERO,jkSketch.getForceUpdate()) && Constants.equalsInteger(model.getStatus(),Constants.ONE)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺瓨鍦ㄦ鍦ㄤ紭鍖栦腑锛岃鑰愬績绛夊緟浼樺寲瀹屾垚鎴栬�呴�夋嫨寮哄埗浼樺寲鎿嶄綔锛�");
}
- if( jkSketch.getLineIdList() ==null || jkSketch.getLineIdList().size()==0 ){
+ if( jkSketch.getLineIdList() ==null || jkSketch.getLineIdList().size()==0 ){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇烽�夋嫨鏈夋晥鍚堢悊鐨勭嚎璺繘琛屼紭鍖栨搷浣滐紒");
}
//褰撳墠鎵�鏈夌嚎璺�(绗﹀悎鏉′欢鐨勭嚎璺級
@@ -117,7 +119,6 @@
totalCus += Constants.formatIntegerNum(line.getMaxCustomer());//鎬诲鎴烽噺
totalNum += Constants.formatIntegerNum(line.getMaxOrder());//鎬婚�佽揣閲�
}
-
if( totalCus < Constants.formatIntegerNum(model.getOrderNum()) ){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇ョ嚎璺鍗曞鎴锋暟閲忚秴杩囦簡绾胯矾鎬诲鎴烽噺闄愬埗锛屾棤娉曡繘琛屼紭鍖栵紒");
}
@@ -151,25 +152,17 @@
long[] demands1 = new long[customerList.size()+1]; //鍚勪釜鐐圭殑璁㈠崟閲�
long[][] distanceMatrix1 = new long[customerList.size()+1][customerList.size()+1];
demands1[0] =0;//鍘熺偣
- double cLatitude =0;
- double cLongitude =0;
- String location = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.COMPANY_LOCATION).getCode();
- try {
- String[] ss = location.split(",");
- cLongitude = Double.parseDouble(ss[0]);
- cLatitude = Double.parseDouble(ss[1]);
- }catch (Exception e){
-
- }
-
for (int i = 0; i < customerList.size(); i++) {
- distanceMatrix1[0][i] = DistanceCalculator.calculateDistance(cLatitude,cLongitude,customerList.get(i).getLatitude().doubleValue(),customerList.get(i).getLongitude().doubleValue())/1000;
- distanceMatrix1[i][0] = distanceMatrix1[0][i];
+ List<DistanceMapParam> disList = customerList.get(i).getDistanceMapParamList();
+ distanceMatrix1[0][i] = disList.get(0).getDistance();
+ distanceMatrix1[i][0] = disList.get(disList.size() -1).getDistance();
demands1[i+1] = Constants.formatBigdecimal( customerList.get(i).getTotalNum()).longValue(); //鍚勪釜鐐圭殑璁㈠崟閲�
- List<Map<String,Object>> disList = customerList.get(i).getDistanceList();
- for (int j = 0; j< disList.size(); j++) {
- if(disList.size()>j){
- distanceMatrix1[i+1][j+1] = (Long) disList.get(j).get("b")/1000;//鏋勯�犺窛绂荤煩闃�
+ for (int j = 0; j< disList.size()-2; j++) {
+ if(j+1 >=10){
+ break;
+ }
+ if(disList.size()>j+1){
+ distanceMatrix1[i+1][j+1] = disList.get(j+1).getDistance()/1000;//鏋勯�犺窛绂荤煩闃�
}else{
distanceMatrix1[i+1][j+1] = 1l;
}
@@ -195,20 +188,65 @@
}
private void initCustomerDistance(JkSketch model) {
- String url = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GAODE_LOCATION_GEOAPI_URL).getCode();
+ String url = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GAODE_DISTANCE_GEOAPI_URL).getCode();
List<JkCustomer> updateCustomerList = new ArrayList<>();
+ List<JkCustomerNavigation> navigationList = new ArrayList<>();
List<JkSketchCustomer> customerList = model.getCustomerList();
+
+ Date date = new Date();
+ BigDecimal cLatitude =new BigDecimal(0);
+ BigDecimal cLongitude =new BigDecimal(0);
+
+ String location = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.COMPANY_LOCATION).getCode();
+ try {
+ String[] ss = location.split(",");
+ cLongitude = new BigDecimal(ss[0]);
+ cLatitude = new BigDecimal(ss[1]);
+ }catch (Exception e){
+ }
for(JkSketchCustomer c : customerList){
List<DistanceMapParam> tmpList = new ArrayList<>();
List<DistanceMapParam> distanceMapParamList = getListFromJsonStr(c.getDistanceJson());
+ boolean isNew = false;
+ JkCustomer u =new JkCustomer();
+ DistanceMapParam t0 = new DistanceMapParam();
+ t0.setId(-2);//琛ㄧず杩斿洖鍥尯
+ t0.setDistance(Constants.formatLongNum(c.getStartDistance()) );
+ if(Constants.formatLongNum(c.getStartDistance()) <= 0){
+ //鍥尯鍓嶅線璇ュ鎴风殑璺濈锛屽鏋滀箣鍓嶆湭鑾峰彇杩�
+ isNew = true;
+ JkSketchCustomer start = new JkSketchCustomer();
+ start.setId(-1);
+ start.setLongitude(cLongitude);
+ start.setLatitude(cLatitude);
+ DistanceModel dm = DistanceCalculator.calculateDistanceGaode(url,start,c);
+ c.setStartDistance(dm.getDistance() );
+ t0.setDistance(dm.getDistance());
+ u.setStartDistance(dm.getDistance());
+ if(dm.getLocations().size()>0){
+ //濡傛灉鏈夎矾寰勪俊鎭�
+ u.setStartSteps(dm.getPolyline());
+ }
+ }
+ tmpList.add(t0);
for(JkSketchCustomer cm : customerList){
- boolean isNew = false;
+ //瀹㈡埛鍜屽鎴蜂箣闂寸殑璺濈淇℃伅
DistanceMapParam t = new DistanceMapParam();
t.setId(cm.getId());
DistanceMapParam param = getParamByCustomerIds( cm.getId(),distanceMapParamList);
if(param!=null){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
t = param;
}else{
+ JkCustomerNavigation navigation = new JkCustomerNavigation();
+ navigation.setStartId(c.getId());
+ navigation.setEndId(cm.getId());
+ navigation.setIsdeleted(Constants.ZERO);
+ navigation.setCreateDate(date);
+ navigation.setEditDate(date);
+ navigation.setEndLatitude(cm.getLatitude());
+ navigation.setEndLogitude(cm.getLongitude());
+ navigation.setStartLatitude(c.getLatitude());
+ navigation.setStartLogitude(c.getLongitude());
isNew = true;
if(Constants.equalsInteger(c.getCustomerId(),cm.getCustomerId())){
t.setDistance(0l);
@@ -217,16 +255,40 @@
t.setDistance(dm.getDistance() );
if(dm.getLocations().size()>0){
//濡傛灉鏈夎矾寰勪俊鎭�
-
+ navigation.setSteps(dm.getPolyline());
}
}
+ navigation.setIdIndex(c.getId()+"-"+cm.getId());
+ navigation.setDistance(t.getDistance());
+ navigationList.add(navigation);
}
tmpList.add(t);
- if(isNew){//
- JkCustomer u =new JkCustomer();
- u.setId(c.getId());
- u.setDistance(JSONObject.toJSONString(tmpList));
+ }
+ DistanceMapParam tt = new DistanceMapParam();
+ tt.setId(-2);//琛ㄧず杩斿洖鍥尯
+ tt.setDistance(Constants.formatLongNum(c.getEndDistance()));
+ if(Constants.formatLongNum(c.getEndDistance()) <= 0){
+ //璇ュ鎴疯繑鍥炲洯鍖虹殑璺濈 ,濡傛灉涔嬪墠鏈幏鍙栬繃
+ isNew = true;
+ JkSketchCustomer start = new JkSketchCustomer();
+ start.setId(-1);
+ start.setLongitude(cLongitude);
+ start.setLatitude(cLatitude);
+
+ DistanceModel dm = DistanceCalculator.calculateDistanceGaode(url,c,start);
+ c.setEndDistance(dm.getDistance() );
+ tt.setDistance(dm.getDistance());
+ u.setEndDistance(dm.getDistance());
+ if(dm.getLocations().size()>0){
+ //濡傛灉鏈夎矾寰勪俊鎭�
+ u.setEndSteps(dm.getPolyline());
}
+ }
+ tmpList.add(tt);
+ if(isNew){//
+ u.setId(c.getCustomerId());
+ u.setDistance(JSONObject.toJSONString(tmpList));
+ updateCustomerList.add(u);
}
c.setDistanceMapParamList(tmpList);
}
@@ -234,6 +296,9 @@
for(JkCustomer c : updateCustomerList){
jkCustomerMapper.updateById(c);//鏇存柊瀹㈡埛涓庡叾浠栫偣涔嬮棿鐨勮窛绂�
}
+ }
+ if(navigationList.size()>0){
+ jkCustomerNavigationMapper.insert(navigationList);
}
}
@@ -288,7 +353,7 @@
tModel.setCustomerList( new ArrayList<>());
//鏈夋晥璺緞
for (Integer cIndex : routes){
- if(cIndex ==0 || cIndex == routes.size()-1){
+ if(cIndex ==0){
continue; //璧峰鐐逛笉澶勭悊
}
JkSketchCustomer customer = model.getCustomerList().get(cIndex-1);
@@ -306,9 +371,7 @@
cModel.setSketchId(model.getId());
cModel.setCustomerId(customer.getCustomerId());
tModel.getCustomerList().add(cModel);
- if(cIndex ==0 || cIndex == routes.size()-1){
- continue; //璧峰鐐逛笉澶勭悊
- }
+
}
}
}
@@ -361,6 +424,8 @@
.selectAs(JkCustomer::getDistance,JkSketchCustomer::getDistanceJson)
.selectAs(JkCustomer::getLongitude,JkSketchCustomer::getLongitude)
.selectAs(JkCustomer::getLatitude,JkSketchCustomer::getLatitude)
+ .selectAs(JkCustomer::getStartDistance,JkSketchCustomer::getStartDistance)
+ .selectAs(JkCustomer::getEndDistance,JkSketchCustomer::getEndDistance)
.leftJoin(JkCustomer.class,JkCustomer::getId,JkSketchCustomer::getCustomerId )
.eq(JkSketchCustomer::getSketchId, model.getId())
.eq(JkSketchCustomer::getIsdeleted,Constants.ZERO)
--
Gitblit v1.9.3