From a768dc3daa04d35fedfbe75c0a59b9b2545b85c4 Mon Sep 17 00:00:00 2001 From: gongzuming <gongzuming> Date: 星期四, 19 九月 2024 16:59:33 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master-v2' --- src/main/java/com/mzl/flower/service/customer/CustomerService.java | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/mzl/flower/service/customer/CustomerService.java b/src/main/java/com/mzl/flower/service/customer/CustomerService.java index 187c75b..1933dc4 100644 --- a/src/main/java/com/mzl/flower/service/customer/CustomerService.java +++ b/src/main/java/com/mzl/flower/service/customer/CustomerService.java @@ -10,29 +10,37 @@ import com.mzl.flower.dto.request.customer.ChangePartnerDTO; import com.mzl.flower.dto.request.customer.QueryCustomerDTO; import com.mzl.flower.dto.request.customer.UpdateCustomerDTO; +import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; import com.mzl.flower.dto.response.customer.CustomerDTO; import com.mzl.flower.dto.response.partner.PartnerDTO; import com.mzl.flower.entity.customer.Customer; import com.mzl.flower.entity.partner.Partner; +import com.mzl.flower.enums.TrueOrFalseEnum; import com.mzl.flower.mapper.customer.CustomerMapper; import com.mzl.flower.mapper.partner.PartnerMapper; +import com.mzl.flower.service.menber.MemberGrowthRecordService; +import lombok.extern.slf4j.Slf4j; import com.mzl.flower.service.BaseService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.util.List; @Service @Transactional +@Slf4j public class CustomerService { private final CustomerMapper customerMapper; private final PartnerMapper partnerMapper; + @Resource + private MemberGrowthRecordService memberGrowthRecordService; @Resource private BaseService baseService; @@ -43,7 +51,12 @@ } public CustomerDTO getCurrentCustomer() { - return customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); + CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); + UserGrowthRecordDTO userGrowthRecordDTO = memberGrowthRecordService.getInfoByUserId(SecurityUtils.getUserId()); + if(!ObjectUtils.isEmpty(userGrowthRecordDTO)){ + currentCustomer.setUserGrowthRecord(userGrowthRecordDTO); + } + return currentCustomer; } public PartnerDTO getCurrentBindPartner() { @@ -71,6 +84,7 @@ customer.create(SecurityUtils.getUserId()); customer.setIsEnabled(true); + customer.setLevelId(Long.valueOf(Constants.DEFAULT_MEMBER_ID)); customerMapper.insert(customer); } else {//重新修改 customer = customerMapper.selectById(dto.getId()); @@ -221,4 +235,21 @@ customer.update(SecurityUtils.getUserId()); customerMapper.updateById(customer); } + + /** + * 根据会员等级获取等级下的customer信息 + * @param levelId + * @return + */ + public List<Customer> getCustomerListByLevelId(Integer levelId){ + if(null != levelId){ + QueryWrapper<Customer> customerQueryWrapper=new QueryWrapper<>(); + customerQueryWrapper.lambda() + .eq(Customer::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) + .eq(Customer::getLevelId,levelId); + return customerMapper.selectList(customerQueryWrapper); + } + return null; + } + } -- Gitblit v1.9.3