|
@@ -27,15 +27,13 @@ import com.zbkj.common.model.page.PageDiy;
|
|
|
import com.zbkj.common.model.system.GroupConfig;
|
|
|
import com.zbkj.common.model.system.SystemNotification;
|
|
|
import com.zbkj.common.page.CommonPage;
|
|
|
+import com.zbkj.common.query.IndexMerchantQuery;
|
|
|
import com.zbkj.common.request.PageParamRequest;
|
|
|
import com.zbkj.common.request.merchant.*;
|
|
|
import com.zbkj.common.response.*;
|
|
|
import com.zbkj.common.result.CommonResultCode;
|
|
|
import com.zbkj.common.result.MerchantResultCode;
|
|
|
-import com.zbkj.common.utils.CrmebDateUtil;
|
|
|
-import com.zbkj.common.utils.CrmebUtil;
|
|
|
-import com.zbkj.common.utils.RedisUtil;
|
|
|
-import com.zbkj.common.utils.SecurityUtil;
|
|
|
+import com.zbkj.common.utils.*;
|
|
|
import com.zbkj.common.vo.DateLimitUtilVo;
|
|
|
import com.zbkj.common.vo.LoginUserVo;
|
|
|
import com.zbkj.common.vo.MerchantConfigInfoVo;
|
|
@@ -51,10 +49,7 @@ import org.springframework.transaction.support.TransactionTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -1091,7 +1086,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantDao, Merchant> impl
|
|
|
* 首页商户列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<IndexMerchantResponse> findIndexList(Integer recomdProdsNum) {
|
|
|
+ public List<IndexMerchantResponse> findIndexList(IndexMerchantQuery indexMerchantQuery, Integer recomdProdsNum) {
|
|
|
LambdaQueryWrapper<Merchant> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(Merchant::getIsSwitch, true);
|
|
|
lqw.eq(Merchant::getIsDel, false);
|
|
@@ -1101,13 +1096,28 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantDao, Merchant> impl
|
|
|
return merchantList.stream().map(mer -> {
|
|
|
IndexMerchantResponse response = new IndexMerchantResponse();
|
|
|
BeanUtils.copyProperties(mer, response);
|
|
|
- // 根据商户再获取三条商户对应的3条推荐商品 适用于DIY样式
|
|
|
- response.setProList(productService.getRecommendedProductsByMerId(mer.getId(), 3));
|
|
|
+ // 根据商户再获取1条商户对应的1条推荐商品 适用于DIY样式
|
|
|
+ //response.setProList(productService.getRecommendedProductsByMerId(mer.getId(), 1));
|
|
|
// 店铺关注人数
|
|
|
- response.setFollowerNum(userMerchantCollectService.getCountByMerId(mer.getId()));
|
|
|
+ //response.setFollowerNum(userMerchantCollectService.getCountByMerId(mer.getId()));
|
|
|
+ if(indexMerchantQuery.getLatitude()!=null && indexMerchantQuery.getLongitude()!=null) {
|
|
|
+ Double distance = GeoUtils.haversineDistance(indexMerchantQuery.getLatitude(), indexMerchantQuery.getLongitude(), Double.parseDouble(mer.getLatitude()), Double.parseDouble(mer.getLongitude()));
|
|
|
|
|
|
- response.setPcLogo(mer.getPcLogo());
|
|
|
- response.setPcGoodStoreCoverImage(mer.getPcGoodStoreCoverImage());
|
|
|
+ response.setDistance(distance.intValue() + "km");//距离
|
|
|
+ response.setDeliverTime(DistanceCalculator.distanceToTimeInMinutes(distance, DistanceCalculator.AVERAGE_SPEED));//时间
|
|
|
+ }
|
|
|
+ response.setPerCapita(Double.parseDouble("15"));//人均费用
|
|
|
+ response.setDistCosts(Double.parseDouble("15"));//起送费用
|
|
|
+ response.setScore(mer.getStarLevel()+"分");//评分
|
|
|
+ response.setSalesVolume(200);//销售量
|
|
|
+ response.setIsFreeDeliverFee(true);
|
|
|
+ response.setFreeDeliverFee(Double.parseDouble("3"));
|
|
|
+ List<String> discountLabel =new ArrayList<>();
|
|
|
+ discountLabel.add("首单立减5元");
|
|
|
+ discountLabel.add("减配送费");
|
|
|
+ response.setDiscountLabel(discountLabel);//优惠标签
|
|
|
+ response.setPcLogo(mer.getPcLogo());//商户头像logo
|
|
|
+ //response.setPcGoodStoreCoverImage(mer.getPcGoodStoreCoverImage());
|
|
|
return response;
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
@@ -1302,6 +1312,22 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantDao, Merchant> impl
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ProMerchantProductResponse> findProIndexList(Integer recomdProdsNum) {
|
|
|
+ List<ProMerchantProductResponse> merchantProductResponseList=new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<Merchant> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(Merchant::getIsSwitch, true);
|
|
|
+ lqw.eq(Merchant::getIsDel, false);
|
|
|
+ lqw.orderByDesc(Merchant::getIsRecommend, Merchant::getSort, Merchant::getId);
|
|
|
+ lqw.last(" limit " + recomdProdsNum);
|
|
|
+ List<Merchant> merchantList = dao.selectList(lqw);
|
|
|
+ for(Merchant mer:merchantList){
|
|
|
+ // 根据商户再获取1条商户对应的1条推荐商品 适用于DIY样;
|
|
|
+ merchantProductResponseList.addAll(productService.getRecommendedProductsByMerId(mer.getId(), 1));
|
|
|
+ }
|
|
|
+ return merchantProductResponseList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检查商户手机号是否重复
|
|
|
*
|