注册页打开直接推荐商户->用户点击申请

不再收集用户信息 前筛字段也先不使用
pull/379/head
鲸落 12 months ago
parent 709a83bccf
commit c77ca554c0

@ -142,5 +142,10 @@ public class MerchantController extends BaseController
return merchantService.H5applyMerchant(Long.valueOf(merchantId),request);
}
@GetMapping("/getMatchMerchantNew")
public AjaxResult getMatchMerchantNew(){
return merchantService.getMatchMerchantNew();
}
}

@ -91,4 +91,6 @@ public interface IMerchantService extends IService<Merchant>
* @return
*/
AjaxResult H5applyMerchant(Long merchantId, HttpServletRequest request);
AjaxResult getMatchMerchantNew();
}

@ -1,41 +1,38 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.constant.RedisConstant;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.CustomerTokenService;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.domain.dto.MerchantListDto;
import com.ruoyi.system.mapper.CustomerApplyLogMapper;
import com.ruoyi.system.mapper.CustomerMapper;
import com.ruoyi.system.mapper.MerchantMapper;
import com.ruoyi.system.service.ICustomerApplyLogService;
import com.ruoyi.system.service.IMerchantService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MerchantMapper;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.system.service.IMerchantService;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Service
*
*
* @author ruoyi
* @date 2024-09-15
*/
@ -51,7 +48,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param id
* @return
*/
@ -63,7 +60,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param merchant
* @return
*/
@ -75,7 +72,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param merchant
* @return
*/
@ -88,7 +85,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param merchant
* @return
*/
@ -101,7 +98,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param ids
* @return
*/
@ -113,7 +110,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
/**
*
*
*
* @param id
* @return
*/
@ -221,4 +218,44 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
}
return merchants;
}
@Override
public AjaxResult getMatchMerchantNew() {
List<Merchant> merchantLists = matchMerchantNew();
List<MerchantListDto> results = new ArrayList<>();
for (Merchant merchant : merchantLists) {
MerchantListDto merchantListDto = new MerchantListDto();
merchantListDto.setMerchantName(merchant.getMerchantName());
merchantListDto.setMerchantDescribe(merchant.getMerchantDescribe());
merchantListDto.setMerchantUrl(merchant.getHitUrl());
merchantListDto.setMerchantId(merchant.getId());
results.add(merchantListDto);
}
return AjaxResult.success(results);
}
private List<Merchant> getMerchantLists() {
LambdaQueryWrapper<Merchant> queryWrapper = new LambdaQueryWrapper<Merchant>().eq(Merchant::getStatus, true);
List<Merchant> merchants = merchantMapper.selectList(queryWrapper);
return CollectionUtils.isEmpty(merchants) ? new ArrayList<>() : merchants;
}
private List<Merchant> matchMerchantNew() {
List<Merchant> merchantLists = getMerchantLists();
if (CollectionUtils.isEmpty(merchantLists)) {
return merchantLists;
}
List<Merchant> merchants = new ArrayList<>();
for (Merchant merchant : merchantLists) {
//限量判定
Integer sum = customerApplyLogService.getApplySum(merchant.getId());
if (merchant.getLimitType() != null && merchant.getLimitType() == 1 && merchant.getLimitNum() <= sum) {
continue;
}
merchants.add(merchant);
}
return merchants;
}
}

Loading…
Cancel
Save