From 1515a0aacd2227d2850e023287405c0fd79b9e2d Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期六, 08 五月 2021 11:18:52 +0800
Subject: [PATCH] bugfixed: 78891 78567

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComCvtBusinessServiceImpl.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComCvtBusinessServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComCvtBusinessServiceImpl.java
index 57e27d8..8117877 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComCvtBusinessServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComCvtBusinessServiceImpl.java
@@ -1,5 +1,6 @@
 package com.panzhihua.service_community.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -24,9 +25,11 @@
 import com.panzhihua.service_community.service.ComCvtBusinessService;
 import com.panzhihua.service_community.service.ComCvtServeService;
 import org.springframework.beans.BeanUtils;
+import org.springframework.boot.util.LambdaSafe;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -143,7 +146,7 @@
     }
 
     @Override
-    public R getComCvtBusiness(Long id) {
+    public R getComCvtBusiness(Long id, String cityCode) {
         ComCvtBusinessDO comCvtBusinessDO = comCvtBusinessDAO.selectById(id);
         if (null == comCvtBusinessDO) {
             return R.fail("商家不存在");
@@ -153,11 +156,19 @@
         List<ComActDO> comActDOS = new ArrayList<>();
 
         if(comCvtBusinessDO.getAreaFlag()==1){
-            comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState,0));
+            LambdaQueryWrapper<ComActDO> lambdaQueryWrapper = new LambdaQueryWrapper<ComActDO>().eq(ComActDO::getState,0);
+            if(!StringUtils.isEmpty(cityCode)){
+                lambdaQueryWrapper.eq(ComActDO::getCityCode, cityCode);
+            }
+            comActDOS = comActDAO.selectList(lambdaQueryWrapper);
         }else{
             List<Long> areaIds = comCvtBusinessAreaService.getBusinessServiceAreaIds(comCvtBusinessDO.getId());
             if(!ObjectUtils.isEmpty(areaIds)){
-                comActDOS = comActDAO.selectBatchIds(areaIds);
+                List<ComActDO> busiDO = comActDAO.selectBatchIds(areaIds);
+                if(!StringUtils.isEmpty(cityCode) && busiDO!=null && busiDO.size()>0){
+                    comActDOS = busiDO.stream().filter(comActDO -> cityCode.equals(comActDO.getCityCode()))
+                            .collect(Collectors.toList());
+                }
             }
         }
 

--
Gitblit v1.7.1