From f30a3556e3a5f049589d8ce53c3958e21c54cb76 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Mon, 27 Nov 2023 18:28:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fuintAdmin/src/views/member/index.vue | 2 +- .../service/impl/OilConfigServiceImpl.java | 24 +++--- .../controller/LJStoreController.java | 11 +++ .../service/ILJStoreService.java | 7 ++ .../service/impl/LJStoreServiceImpl.java | 51 ++++++++++++ .../userManager/mapper/xml/LJUserMapper.xml | 3 + .../fuint/common/shiroConfig/ShiroConfig.java | 2 + .../views/cashier/NewComponents/credit.vue | 15 ++++ .../views/cashier/NewComponents/homeindex.vue | 22 ++++- gasStation-uni/manifest.json | 13 ++- gasStation-uni/pages/index/index.vue | 80 +++++++++++++++---- gasStation-uni/request/index.js | 2 +- 12 files changed, 202 insertions(+), 30 deletions(-) diff --git a/fuintAdmin/src/views/member/index.vue b/fuintAdmin/src/views/member/index.vue index 7bcc34370..baae09bbf 100644 --- a/fuintAdmin/src/views/member/index.vue +++ b/fuintAdmin/src/views/member/index.vue @@ -538,7 +538,7 @@ export default { name: '', gradeId: '', status: '', - storeIds: '', + storeId: '', official:'', cardBalance:'', }, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/OilConfigServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/OilConfigServiceImpl.java index 51ec8062d..bb3954845 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/OilConfigServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/OilConfigServiceImpl.java @@ -15,9 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * 支付配置信息 业务层 @@ -78,14 +76,18 @@ public class OilConfigServiceImpl extends ServiceImpl map){ + return getSuccessResult(storeService.selectStoreByPosition(map)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java index cb8300726..170510504 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/ILJStoreService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.storeInformation.entity.LJStore; import java.util.List; +import java.util.Map; /** * 店铺信息 业务层 @@ -15,6 +16,12 @@ public interface ILJStoreService extends IService { */ public LJStore selectStoreById(); + /** + * 根据定位查询距离最近的店铺信息 + * @return + */ + public Map selectStoreByPosition(Map map); + /** * 查询店铺信息 * @return diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java index c421e6b1c..8f482fc36 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java @@ -5,10 +5,14 @@ import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.mapper.LJStoreMapper; import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 店铺信息 业务层 @@ -27,6 +31,53 @@ public class LJStoreServiceImpl extends ServiceImpl impl return store; } + @Override + public Map selectStoreByPosition(Map map) { +// 经度 + Double lon = Double.valueOf(map.get("lon")); + Double lat = Double.valueOf(map.get("lat")); + List list = baseMapper.selectList(null); + LJStore ljStore = new LJStore(); + Double distance = 0.0; + double earthRadius = 6371; // 地球半径,单位为公里 + + double dLat = Math.toRadians(Double.parseDouble(list.get(0).getLatitude()) - lat); + double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon); + + double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + + Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(0).getLatitude()))) * + Math.sin(dLon / 2) * Math.sin(dLon / 2); + + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); + + double min = earthRadius * c; + +// 计算最小距离 + for (int i = 0; i < list.size(); i++){ + if (StringUtils.isNotEmpty(list.get(i).getLatitude()) && StringUtils.isNotEmpty(list.get(i).getLongitude())){ + double dLat1 = Math.toRadians(Double.parseDouble(list.get(i).getLatitude()) - lat); + double dLon1 = Math.toRadians(Double.parseDouble(list.get(i).getLongitude()) - lon); + + double a1 = Math.sin(dLat1 / 2) * Math.sin(dLat1 / 2) + + Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(i).getLatitude()))) * + Math.sin(dLon1 / 2) * Math.sin(dLon1 / 2); + + double c1 = 2 * Math.atan2(Math.sqrt(a1), Math.sqrt(1 - a1)); + + if ((earthRadius * c1) < min){ + min = earthRadius * c1; + ljStore = list.get(i); + } + } + } + distance = min; + + Map map1 = new HashMap<>(); + map1.put("distance",distance); + map1.put("store",ljStore); + return map1; + } + /** * 查询店铺信息 * @return diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml index 3def76f99..9b19f5ebe 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml @@ -12,6 +12,9 @@ and mu.store_id = #{user.storeId} + + and mu.store_id = #{user.storeId} + and mu.mobile like concat('%', #{user.mobile}, '%') diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java index 40cd020bd..153f5631f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java @@ -37,6 +37,8 @@ public class ShiroConfig { filterMap.put("/static/**","anon"); //会员模板导出 filterMap.put("/excel/export","anon"); + //根据地理位置获取最近的店铺信息 + filterMap.put("/business/storeInformation/store/recentlyStore","anon"); filterMap.put("/**","commonFilter"); filter.setFilterChainDefinitionMap(filterMap); filter.setLoginUrl("/login"); diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue index 6ad96d2f1..7b6ce3f63 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue @@ -480,6 +480,7 @@
@@ -501,6 +502,7 @@
{ + // this.$refs.getFocus.focus() + // }) + }, + }, + }, methods:{ getPayMeth(list,val){ let name = ""; diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index 3daf3e3b0..31c332f0f 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -491,7 +491,8 @@
@@ -1072,6 +1074,19 @@ this.getCouponList(); this.getUnitList(); }, + directives: { + // 注册一个局部的自定义指令 v-focus + focus: { + // 指令的定义 + inserted: function (el) { + // 聚焦元素 + el.querySelector('input').focus() + // this.$nextTick( () =>{ + // this.$refs.getFocus.focus() + // }) + }, + }, + }, methods:{ clear(){ this.dialogVisiblej = false @@ -1887,6 +1902,9 @@ if (response.data.length>0){ _this.fullReduceDiscount = [] response.data.forEach(item => { + if (item.participationCondition==1){ + _this.exclusion = 0 + } let discount = {type:item.name,full:0,reduce:0,discount:0,exclusion:item.participationCondition} let activeList = item.activeDiscountChildList; for (let i = 1;i<=activeList.length;i++){ diff --git a/gasStation-uni/manifest.json b/gasStation-uni/manifest.json index 0c2449e85..c8ea511bd 100644 --- a/gasStation-uni/manifest.json +++ b/gasStation-uni/manifest.json @@ -73,5 +73,16 @@ "uniStatistics" : { "enable" : false }, - "vueVersion" : "2" + "vueVersion" : "2", + "h5" : { + "sdkConfigs" : { + "maps" : { + "amap" : { + "key" : "b5abec514cab7c71cb0572765131e6fc", + "securityJsCode" : "6e7d904a9f6e98a02fe4f0bb8f276f98", + "serviceHost" : "6e7d904a9f6e98a02fe4f0bb8f276f98" + } + } + } + } } diff --git a/gasStation-uni/pages/index/index.vue b/gasStation-uni/pages/index/index.vue index 50a2fa7be..7837963a2 100644 --- a/gasStation-uni/pages/index/index.vue +++ b/gasStation-uni/pages/index/index.vue @@ -27,13 +27,13 @@ 本站活动 - + 油卡充值 - + @@ -70,15 +70,17 @@ - 顺通石化加油站(工业南路站) - 全天营业 + {{store.name}}{{store.description ? "("+store.description+")" : ""}} + + {{item}} + - 济南市历城区工业南路 - 891.9km + {{ store.address }} + {{ distance }}km - 984.6米 + {{ distance*1000 }}米 - + 一键加油 @@ -107,6 +109,7 @@