From 20b11236b4364034f52df294b9240776f539ede1 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 16 七月 2024 14:49:01 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia
---
server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java | 102 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 95 insertions(+), 7 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
index 6223904..62ed2f3 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
+import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.excel.ExcelImporter;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
@@ -12,15 +13,15 @@
import com.doumee.dao.admin.request.FcodeImport;
import com.doumee.dao.admin.request.ShopImport;
import com.doumee.dao.admin.request.UpdateShopSortDTO;
-import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.CategorySegMapper;
+import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.SegmentsMapper;
-import com.doumee.dao.business.ShopMapper;
+import com.doumee.dao.business.UsersMapper;
import com.doumee.dao.business.join.ShopJoinMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.ShopTree;
import com.doumee.dao.business.vo.ShopTreeVo;
-import com.doumee.dao.system.model.SystemUser;
+import com.doumee.dao.web.reqeust.ShopQueryByLLDTO;
import com.doumee.service.business.ShopService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -41,7 +42,6 @@
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
/**
* 蹇楅偊缁勭粐淇℃伅琛⊿ervice瀹炵幇
@@ -55,10 +55,17 @@
private RedisTemplate<String, Object> redisTemplate;
@Autowired
private ShopJoinMapper shopMapper;
+
@Autowired
private SegmentsMapper segmentsMapper;
@Autowired
private CategorySegMapper categorySegMapper;
+ @Autowired
+ private UsersMapper usersMapper;
+ @Autowired
+ private SystemDictDataBiz systemDictDataBiz;
+ @Autowired
+ private MemberMapper memberMapper;
@Override
public Long create(Shop shop) {
@@ -841,10 +848,16 @@
s.setIdPath(s.getId()+"/");
shopMapper.updateById(s);
}else{
+ String idPath = StringUtils.defaultString(parent.getIdPath(),"")+ shop.getId()+"/";
+ String namePath =StringUtils.defaultString(parent.getNamePath(),"")+"/"+shop.getName();
s.setParentId(parent.getId());
- s.setNamePath(parent.getNamePath()+"/"+s.getName());
- s.setIdPath(parent.getIdPath()+s.getId()+"/");
- shopMapper.updateById(s);
+ s.setNamePath(namePath);
+ s.setIdPath(idPath);
+ if(!(Constants.equalsLong(parent.getId(),shop.getParentId())
+ && StringUtils.equals(idPath,shop.getIdPath())
+ &&StringUtils.equals(namePath,shop.getNamePath())) ){
+ shopMapper.updateById(s);
+ }
}
if(shop.getChildList()!=null && shop.getChildList().size()>0){
updateNamePath(s,shop.getChildList());
@@ -852,4 +865,79 @@
}
}
}
+
+
+
+ @Override
+ public PageData<Shop> queryShopByLL(PageWrap<Shop> pageWrap) {
+ if(Objects.isNull(pageWrap.getModel())
+ || Objects.isNull(pageWrap.getModel().getLatitude())
+ || Objects.isNull(pageWrap.getModel().getLongitude())){
+ return null;
+ }
+ IPage<Shop> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ MPJLambdaWrapper<Shop> queryWrapper = new MPJLambdaWrapper<>();
+ queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE," +
+ " CONVERT (ST_Distance_Sphere (point ("+pageWrap.getModel().getLongitude()+", "+pageWrap.getModel().getLatitude()+" ), point ( LONGITUDE, LATITUDE )) /1000,decimal(15,2)) as distance ")
+ .eq("isdeleted",Constants.ZERO)
+ .isNotNull("LATITUDE")
+ .isNotNull("LONGITUDE")
+ .eq("ATTRIBUTE",Constants.ONE)
+ .orderByAsc(" distance ");
+ Utils.MP.blankToNull(pageWrap.getModel());
+ PageData<Shop> pageData = PageData.from(shopMapper.selectPage(page, queryWrapper));
+ String prefix = StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.RESOURCE_PATH).getCode()) +
+ StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.USERS_FILE).getCode());
+ for (Shop shop:pageData.getRecords()) {
+ //鏌ヨ闂ㄥ簵涓嬪璐暟鎹�
+ List<Users> usersList =usersMapper.selectList(new QueryWrapper<Users>().lambda().eq(Users::getDepartmentId,shop.getId())
+ .eq(Users::getIsdeleted,Constants.ZERO)
+ .eq(Users::getStatus,Constants.ONE)
+ .eq(Users::getType,Constants.ZERO)
+ );
+ for (Users users:usersList) {
+ if(StringUtils.isNotBlank(users.getImgurl())){
+ users.setImgurlFull(prefix + users.getImgurl());
+ }
+ }
+ shop.setUsersList(usersList);
+ }
+ return pageData;
+ }
+
+ @Override
+ public Shop shopDetail(Long id,Long memberId) {
+ Member member = memberMapper.selectById(memberId);
+ if(Objects.isNull(member)){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鐢ㄦ埛淇℃伅");
+ }
+ QueryWrapper<Shop> queryWrapper = new QueryWrapper<Shop>();
+ //濡傛灉浜哄憳娌℃湁缁忕含搴︿俊鎭紝鍒欎笉鏌ヨ璺濈
+ if(Objects.nonNull(member.getLatitude())&&Objects.nonNull(member.getLongitude())){
+ queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE," +
+ " CONVERT (ST_Distance_Sphere (point ("+member.getLongitude()+", "+member.getLatitude()+" ), point ( LONGITUDE, LATITUDE )) /1000,decimal(15,2)) as distance ");
+ }
+ queryWrapper.eq("id",id);
+ Shop shop = shopMapper.selectOne(queryWrapper);
+ if(Objects.isNull(shop)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ String prefix = StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.RESOURCE_PATH).getCode()) +
+ StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.USERS_FILE).getCode());
+ List<Users> usersList =usersMapper.selectList(new QueryWrapper<Users>().lambda().eq(Users::getDepartmentId,shop.getId())
+ .eq(Users::getIsdeleted,Constants.ZERO)
+ .eq(Users::getStatus,Constants.ONE)
+ .eq(Users::getType,Constants.ZERO)
+ );
+ for (Users users:usersList) {
+ if(StringUtils.isNotBlank(users.getImgurl())){
+ users.setImgurlFull(prefix + users.getImgurl());
+ }
+ }
+ shop.setUsersList(usersList);
+ return shop;
+ }
+
+
+
}
--
Gitblit v1.9.3