From 08c6724424adb2acf06b0687752512d15b02539b Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 09:57:13 +0800
Subject: [PATCH] 最新版本541200007
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java | 112 +------------------------------------
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java | 50 +++++++++++-----
2 files changed, 37 insertions(+), 125 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java
index 186ca3f..d059939 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchCustomerServiceImpl.java
@@ -140,109 +140,10 @@
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())){
- // (BigDecimal lat1, BigDecimal lon1, BigDecimal lat2, BigDecimal lon2)
- startmodel.setDistance(DistanceCalculator.calculateDistanceDecinal(startmodel.getStartLatitude(),startmodel.getStartLogitude(),startmodel.getEndLatitude(),startmodel.getEndLogitude()));
- 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")
- );*/
- JkCustomerNavigation tt = null;
- if(tt==null){
- //鍙湁璧锋鐐�
- tt = new JkCustomerNavigation();
- tt.setStartLatitude(start.getLatitude());
- tt.setStartLogitude(start.getLongitude());
- tt.setEndLatitude(end.getLatitude());
- tt.setEndLogitude(end.getLongitude());
- tt.setDistance(DistanceCalculator.calculateDistanceDecinal(tt.getStartLatitude(),tt.getStartLogitude(),tt.getEndLatitude(),tt.getEndLogitude()));
- // //====鏍囪==蹇界暐浜ら�氳鍒掕窛绂�=====
- /* List<DistanceMapParam> distanceMapParamList =JkSketchServiceImpl.getListFromJsonStr(start.getDistanceJson());
- DistanceMapParam param = JkSketchServiceImpl.getParamByCustomerIds( end.getId(),distanceMapParamList);
- if(param!=null && param.getDistance()!=0){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
- tt.setDistance(param.getDistance());
- }else{
- tt.setDistance(DistanceCalculator.calculateDistanceDecinal(tt.getStartLatitude(),tt.getStartLogitude(),tt.getEndLatitude(),tt.getEndLogitude()));
- }*/
- }
- 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;
- }
- public List<JkCustomerNavigation> allMapListOld(JkSketchCustomer jkSketchCustomer) {
- List<JkCustomerNavigation> list = new ArrayList<>();
- MPJLambdaWrapper<JkSketchCustomer> queryWrapper = new MPJLambdaWrapper<>();
- jkSketchCustomer.setIsdeleted(Constants.ZERO);
- queryWrapper.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 ) ;
- queryWrapper.eq( JkSketchCustomer::getSketchLineId,jkSketchCustomer.getSketchLineId())
- .eq( JkSketchCustomer::getIsdeleted,Constants.ZERO);
-
- 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){
- }
- List<JkSketchCustomer> allList = jkSketchCustomerMapper.selectJoinList(JkSketchCustomer.class,queryWrapper);
- if(allList !=null && allList.size()>0){
- 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())){
// (BigDecimal lat1, BigDecimal lon1, BigDecimal lat2, BigDecimal lon2)
- startmodel.setDistance(DistanceCalculator.calculateDistanceDecinal(startmodel.getStartLatitude(),startmodel.getStartLogitude(),startmodel.getEndLatitude(),startmodel.getEndLogitude()));
+ startmodel.setDistance(DistanceCalculator.calculateDistanceDecinal(startmodel.getStartLatitude(),startmodel.getStartLogitude(),startmodel.getEndLatitude(),startmodel.getEndLatitude()));
startmodel.setSteps(comLocation +";"+allList.get(0).getLongitude()+","+allList.get(0).getLatitude());
}
list.add(startmodel);
@@ -280,15 +181,13 @@
tt.setStartLogitude(start.getLongitude());
tt.setEndLatitude(end.getLatitude());
tt.setEndLogitude(end.getLongitude());
- tt.setDistance(DistanceCalculator.calculateDistanceDecinal(tt.getStartLatitude(),tt.getStartLogitude(),tt.getEndLatitude(),tt.getEndLogitude()));
- // //====鏍囪==蹇界暐浜ら�氳鍒掕窛绂�=====
- /* List<DistanceMapParam> distanceMapParamList =JkSketchServiceImpl.getListFromJsonStr(start.getDistanceJson());
+ List<DistanceMapParam> distanceMapParamList =JkSketchServiceImpl.getListFromJsonStr(start.getDistanceJson());
DistanceMapParam param = JkSketchServiceImpl.getParamByCustomerIds( end.getId(),distanceMapParamList);
if(param!=null && param.getDistance()!=0){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
tt.setDistance(param.getDistance());
}else{
- tt.setDistance(DistanceCalculator.calculateDistanceDecinal(tt.getStartLatitude(),tt.getStartLogitude(),tt.getEndLatitude(),tt.getEndLogitude()));
- }*/
+ tt.setDistance(DistanceCalculator.calculateDistanceDecinal(tt.getStartLatitude(),tt.getStartLogitude(),tt.getEndLatitude(),tt.getEndLatitude()));
+ }
}
tt.setLocation(allList.get(i).getLocation());
tt.setName(allList.get(i).getName());
@@ -374,9 +273,6 @@
Utils.MP.blankToNull(pageWrap.getModel());
pageWrap.getModel().setIsdeleted(Constants.ZERO);
queryWrapper.selectAll(JkSketchCustomer.class )
- .selectAs(JkCustomer::getLocation,JkSketchCustomer::getLocation)
- .selectAs(JkCustomer::getLongitude,JkSketchCustomer::getLongitude)
- .selectAs(JkCustomer::getLatitude,JkSketchCustomer::getLatitude)
.selectAs(JkCustomer::getName,JkSketchCustomer::getName)
.selectAs(JkCustomer::getCode,JkSketchCustomer::getCode)
.selectAs(JkLine::getName,JkSketchCustomer::getLineName)
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 29fecf8..d22de24 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
@@ -129,8 +129,7 @@
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(),"璇烽�夋嫨鏈夋晥鍚堢悊鐨勭嚎璺繘琛屼紭鍖栨搷浣滐紒");
}
//褰撳墠鎵�鏈夌嚎璺�(绗﹀悎鏉′欢鐨勭嚎璺級
@@ -256,7 +255,8 @@
@Async
public void distanceCustomer( Category cate) {
try {
- List<JkCustomer> customerList = cate.getCustomerList();
+ List<JkCustomer> allList = cate.getCustomerList();
+ List<JkCustomer> customerList = cate.getNeedList();
String url = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GAODE_DISTANCE_GEOAPI_URL).getCode();
Date date = new Date();
BigDecimal cLatitude =new BigDecimal(0);
@@ -288,7 +288,7 @@
for (int j = start; j < end; j++) {
try {
log.error("浜ら�氳鍒�========"+cate.getId()+"/"+cate.getName()+"/"+customerList.get(j).getName()+"=======cirle/index:"+finalI+"/"+index++);
- dealDistancePerCustomer(customerList.get(j),url,date, finalCLatitude, finalCLongitude,customerList);
+ dealDistancePerCustomer(customerList.get(j),url,date, finalCLatitude, finalCLongitude,allList);
}catch (Exception e){
}
@@ -429,8 +429,10 @@
}
}
if(navigationList.size()>0){
- jkCustomerNavigationMapper.delete(new UpdateWrapper<JkCustomerNavigation>().lambda()
- .eq(JkCustomerNavigation::getStartId,c.getId()));//鍒犻櫎鍘嗗彶鏁版嵁
+ for (JkCustomerNavigation navigation:navigationList) {
+ jkCustomerNavigationMapper.delete(new UpdateWrapper<JkCustomerNavigation>().lambda()
+ .eq(JkCustomerNavigation::getIdIndex,navigation.getIdIndex()));//鍒犻櫎鍘嗗彶鏁版嵁
+ }
jkCustomerNavigationMapper.insert(navigationList);//鎻掑叆鏈�鏂版暟鎹�
}
}
@@ -493,7 +495,8 @@
}
c.setStatus(Constants.TWO);
categoryMapper.updateById(c);//鏇存柊浠诲姟鎵ц鐘舵��
- c.setCustomerList(Constants.equalsInteger(model.getForceUpdate(),0)?needList:customerList);
+ c.setCustomerList(customerList);
+ c.setNeedList(Constants.equalsInteger(model.getForceUpdate(),0)?needList:customerList);
return c;
}
@@ -701,6 +704,15 @@
private void initCustomerDistance( List<JkSketchLine> lineList,JkSketch model,boolean updateLineDistance) {
List<JkSketchCustomer> customerList = model.getCustomerList();
+ 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(JkSketchCustomer c : customerList){
List<DistanceMapParam> tmpList = new ArrayList<>();
List<DistanceMapParam> distanceMapParamList = getListFromJsonStr(c.getDistanceJson());
@@ -709,18 +721,21 @@
t0.setDistance(Constants.formatLongNum(c.getStartDistance()) );
if(Constants.formatLongNum(c.getStartDistance()) <= 0){
//鍥尯鍓嶅線璇ュ鎴风殑璺濈锛屽鏋滀箣鍓嶆湭鑾峰彇杩�
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"浜ら�氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒充紭鍖栨潯浠讹紒");
+ t0.setDistance(DistanceCalculator.calculateDistanceDecinal(cLatitude,cLongitude,c.getLatitude(),c.getLongitude()));
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"浜ら�氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒充紭鍖栨潯浠讹紒");
}
tmpList.add(t0);
for(JkSketchCustomer cm : customerList){
//瀹㈡埛鍜屽鎴蜂箣闂寸殑璺濈淇℃伅
DistanceMapParam t = new DistanceMapParam();
t.setId(cm.getCustomerId());
- DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),distanceMapParamList);
+ DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),distanceMapParamList);
if(param!=null){//濡傛灉涔嬪墠宸茬粡鑾峰彇杩�
t = param;
}else{
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"浜ら�氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒宠矾绋嬭绠楁潯浠讹紒");
+ //濡傛灉鏈鍒掞紝鎸夌収鐩寸嚎璺濈
+ t.setDistance(DistanceCalculator.calculateDistanceDecinal(cm.getLatitude(),cm.getLongitude(),c.getLatitude(),c.getLongitude()));
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"涓庡鎴�:"+cm.getName()+"绠�浜ら�氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒宠矾绋嬭绠楁潯浠讹紒");
}
tmpList.add(t);
}
@@ -729,7 +744,8 @@
tt.setDistance(Constants.formatLongNum(c.getEndDistance()));
if(Constants.formatLongNum(c.getEndDistance()) <= 0){
//璇ュ鎴疯繑鍥炲洯鍖虹殑璺濈 ,濡傛灉涔嬪墠鏈幏鍙栬繃
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"浜ら�氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒宠矾绋嬭绠楁潯浠讹紒");
+ tt.setDistance(DistanceCalculator.calculateDistanceDecinal(cLatitude,cLongitude,c.getLatitude(),c.getLongitude()));
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+c.getName()+"涓庤捣鐐逛氦閫氳鍒掑皻鏈畬鎴愶紝涓嶆弧瓒宠矾绋嬭绠楁潯浠讹紒");
}
tmpList.add(tt);
c.setDistanceMapParamList(tmpList);
@@ -779,7 +795,7 @@
return list;
}
- private DistanceMapParam getParamByCustomerIds( Integer id1, List<DistanceMapParam> distanceMapParamList) {
+ public static DistanceMapParam getParamByCustomerIds( Integer id1, List<DistanceMapParam> distanceMapParamList) {
if(distanceMapParamList!=null){
for(DistanceMapParam p :distanceMapParamList){
if(Constants.equalsInteger(p.getId(),id1)){
@@ -791,7 +807,7 @@
return null;
}
- private List<DistanceMapParam> getListFromJsonStr(String distanceJson) {
+ public static List<DistanceMapParam> getListFromJsonStr(String distanceJson) {
try {
return JSONObject.parseObject(distanceJson, new TypeReference<List<DistanceMapParam>>(){}.getType());
}catch (Exception e){
@@ -923,11 +939,11 @@
String errorMsg1 ="";
for(JkSketchCustomer c : customerList){
if(c.getLatitude()==null || c.getLongitude() ==null){
- errorMsg += c.getName()+"-"+c.getName()+" | ";
+ errorMsg += c.getName()+" | ";
}
- if(!Constants.equalsInteger(c.getDistanceStatus(),Constants.ONE)){
- errorMsg1 += c.getName()+"-"+c.getName()+" | ";
- }
+ /* if(!Constants.equalsInteger(c.getDistanceStatus(),Constants.ONE)){
+ errorMsg1 += c.getName()+" | ";
+ }*/
}
if(StringUtils.isNotBlank(errorMsg)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:銆�"+errorMsg+"銆戝畾浣嶄俊鎭笉瀹屾暣锛屼笉婊¤冻浼樺寲鏉′欢锛�");
--
Gitblit v1.9.3