From 3da01b2a6cf247f90aed86fc37d8cb0ab51a4b4c Mon Sep 17 00:00:00 2001
From: yanghui <2536613402@qq.com>
Date: 星期二, 29 十一月 2022 15:58:02 +0800
Subject: [PATCH] #feat .

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java
index 7f0508e..f558c61 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java
@@ -25,6 +25,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import static java.util.Objects.isNull;
 import static java.util.Objects.nonNull;
@@ -67,6 +68,10 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public R addPoint(ConvenientElevatingPointDTO convenientElevatingPointDTO) {
+        ConvenientElevatingPointDO convenientElevatingPointDODB = this.baseMapper.selectOne(new LambdaQueryWrapper<ConvenientElevatingPointDO>().eq(ConvenientElevatingPointDO::getWechatAccount, convenientElevatingPointDTO.getWechatAccount()));
+        if (!Objects.isNull(convenientElevatingPointDODB)){
+            return  R.fail("该微信手机号已使用,请更换");
+        }
         ConvenientElevatingPointDO convenientElevatingPointDO = new ConvenientElevatingPointDO();
         BeanUtils.copyProperties(convenientElevatingPointDTO, convenientElevatingPointDO);
         String communityId = convenientElevatingPointDTO.getCommunityId();
@@ -89,10 +94,15 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public R putPoint(ConvenientElevatingPointDTO convenientElevatingPointDTO) {
+        ConvenientElevatingPointDO convenientElevatingPointDODB = this.baseMapper.selectOne(new LambdaQueryWrapper<ConvenientElevatingPointDO>().eq(ConvenientElevatingPointDO::getWechatAccount, convenientElevatingPointDTO.getWechatAccount()));
+
         Long id = convenientElevatingPointDTO.getId();
         ConvenientElevatingPointDO convenientElevatingPointDO = this.baseMapper.selectById(id);
         if (isNull(convenientElevatingPointDO)) {
             return R.fail("自提点不存在");
+        }
+        if (nonNull(convenientElevatingPointDODB) && !convenientElevatingPointDODB.getId().equals(convenientElevatingPointDO.getId())) {
+            R.fail("该微信手机号:" + convenientElevatingPointDTO.getWechatAccount() + "已被使用!请更换");
         }
         String communityId = convenientElevatingPointDTO.getCommunityId();
         if (nonNull(communityId)) {
@@ -123,7 +133,9 @@
     @Override
     public R detailPoint(Long pointId) {
         ConvenientElevatingPointDO convenientElevatingPointDO = this.baseMapper.selectById(pointId);
-        return R.ok(convenientElevatingPointDO);
+        ConvenientElevatingPointVO convenientElevatingPointVO = new ConvenientElevatingPointVO();
+        BeanUtils.copyProperties(convenientElevatingPointDO,convenientElevatingPointVO);
+        return R.ok(convenientElevatingPointVO);
     }
 
     public R findPointByMerchantId(Long merchantId, String lat, String lng) {
@@ -131,7 +143,7 @@
         //服务最远距离 km
         Integer serviceRange = convenientMerchantDO.getServiceRange();
 
-        Map<Object, Object> around = MapDistance.getAround(convenientMerchantDO.getLat(), convenientMerchantDO.getLon(), serviceRange * 1000 + "");
+        Map<Object, Object> around = MapDistance.getAround(convenientMerchantDO.getLat(), convenientMerchantDO.getLon(), serviceRange * 1000d);
         String maxLat = around.get("maxLat").toString();
         String minLat = around.get("minLat").toString();
         String minLng = around.get("minLng").toString();
@@ -146,7 +158,7 @@
         convenientElevatingPointDOS.forEach(f -> {
             ConvenientElevatingPointVO convenientElevatingPointVO = new ConvenientElevatingPointVO();
             BeanUtils.copyProperties(f, convenientElevatingPointVO);
-            Double distance = MapDistance.distanceOfTwoPoints(lng, lat, f.getLon(), f.getLat());
+            Double distance = MapDistance.distanceOfTwoPoints(lat, lng, f.getLon(), f.getLat());
             convenientElevatingPointVO.setDistance(distance);
             convenientElevatingPointVOS.add(convenientElevatingPointVO);
         });

--
Gitblit v1.7.1