From 7915bccb915fad88e885d54832b120cf2d36a036 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 17 七月 2024 18:26:56 +0800
Subject: [PATCH] 代码提交

---
 server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java |   99 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 77 insertions(+), 22 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 62ed2f3..2c79efd 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
@@ -21,6 +21,8 @@
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.ShopTree;
 import com.doumee.dao.business.vo.ShopTreeVo;
+import com.doumee.dao.business.vo.UnitCodeVo;
+import com.doumee.dao.web.reqeust.EditShopDTO;
 import com.doumee.dao.web.reqeust.ShopQueryByLLDTO;
 import com.doumee.service.business.ShopService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -30,6 +32,7 @@
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.Async;
@@ -42,6 +45,7 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
 
 /**
  * 蹇楅偊缁勭粐淇℃伅琛⊿ervice瀹炵幇
@@ -261,7 +265,30 @@
                 queryWrapper.orderByAsc(sortData.getProperty());
             }
         }
-        return PageData.from(shopMapper.selectPage(page, queryWrapper));
+        PageData<Shop> pageData = PageData.from(shopMapper.selectPage(page, queryWrapper));
+        //鏌ヨ缁忚惀鑼冨洿淇℃伅
+        List<CategorySeg> categorySegAllList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda()
+                .isNotNull(CategorySeg::getOrgId)
+                .eq(CategorySeg::getIsdeleted,Constants.ZERO));
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categorySegAllList)){
+            for (Shop shop:pageData.getRecords()) {
+                if(StringUtils.isBlank(shop.getOrgId())){
+                    continue;
+                }
+                List<CategorySeg> categorySegList = categorySegAllList.stream().filter(i->i.getOrgId().equals(shop.getOrgId())).collect(Collectors.toList());
+                List<UnitCodeVo> unitCodeVoList =systemDictDataBiz.getUnitList();
+                List<String> seqNameList = new ArrayList<>();
+                for(CategorySeg model : categorySegList){
+                    String seqName = systemDictDataBiz.getUnitName(model.getUnitCode(),unitCodeVoList);
+                    if(Objects.nonNull(seqName)){
+                        seqNameList.add(seqName);
+                    }
+                }
+                shop.setSeqNameList(seqNameList);
+            }
+        }
+
+        return pageData;
     }
 
     @Override
@@ -382,7 +409,7 @@
     }
 
     @Async
-    private void dealCategoryDataBiz(List<CategoryImport> dataList, Date date, LoginUserInfo loginUserInfo) {
+    public void dealCategoryDataBiz(List<CategoryImport> dataList, Date date, LoginUserInfo loginUserInfo) {
         try {
             List<CategorySeg> categorySegList = new ArrayList<>();
             List<Segments> segmentsList = new ArrayList<>();
@@ -870,20 +897,23 @@
 
     @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;
-        }
+//        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 ")
+//        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 ")
+        queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE ")
                 .eq("isdeleted",Constants.ZERO)
-                .isNotNull("LATITUDE")
-                .isNotNull("LONGITUDE")
-                .eq("ATTRIBUTE",Constants.ONE)
-                .orderByAsc(" distance ");
+//                .isNotNull("LATITUDE")
+//                .isNotNull("LONGITUDE")
+                .eq("TYPE",Constants.TWO)
+                .eq("SECOND_TYPE",Constants.THREE)
+                .eq("STATUS",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()) +
@@ -907,15 +937,14 @@
 
     @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 ");
+        if(Objects.nonNull(memberId)){
+            Member member = memberMapper.selectById(memberId);
+            //濡傛灉浜哄憳娌℃湁缁忕含搴︿俊鎭紝鍒欎笉鏌ヨ璺濈
+            if(Objects.nonNull(member)&&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);
@@ -935,9 +964,35 @@
             }
         }
         shop.setUsersList(usersList);
+        //鏌ヨ缁忚惀鑼冨洿淇℃伅
+        List<CategorySeg> categorySegList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda().eq(CategorySeg::getOrgId,shop.getOrgId()).eq(CategorySeg::getIsdeleted,Constants.ZERO));
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categorySegList)){
+            List<UnitCodeVo> unitCodeVoList =systemDictDataBiz.getUnitList();
+            List<String> seqNameList = new ArrayList<>();
+            for(CategorySeg model : categorySegList){
+                String seqName = systemDictDataBiz.getUnitName(model.getUnitCode(),unitCodeVoList);
+                if(Objects.nonNull(seqName)){
+                    seqNameList.add(seqName);
+                }
+            }
+            shop.setSeqNameList(seqNameList);
+        }
         return shop;
     }
 
-
+    @Override
+    public void updShop(EditShopDTO editShopDTO) {
+        if(Objects.isNull(editShopDTO)
+        || Objects.isNull(editShopDTO.getId())){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        Shop shop = shopMapper.selectById(editShopDTO.getId());
+        if(Objects.isNull(shop)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Shop updShop = new Shop();
+        BeanUtils.copyProperties(editShopDTO,updShop);
+        shopMapper.updateById(updShop);
+    }
 
 }

--
Gitblit v1.9.3