From 9b8db73dbec26af11e80ee36926ac6d039b921ff Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期三, 02 四月 2025 14:01:16 +0800 Subject: [PATCH] add 默认头像 --- src/main/java/com/mzl/flower/service/customer/CustomerService.java | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 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 1933dc4..1c9ae43 100644 --- a/src/main/java/com/mzl/flower/service/customer/CustomerService.java +++ b/src/main/java/com/mzl/flower/service/customer/CustomerService.java @@ -13,6 +13,7 @@ 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.dto.response.supplier.SupplierDTO; import com.mzl.flower.entity.customer.Customer; import com.mzl.flower.entity.partner.Partner; import com.mzl.flower.enums.TrueOrFalseEnum; @@ -25,9 +26,12 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; @Service @@ -252,4 +256,24 @@ return null; } + public CustomerDTO findCustomerByPhone(String phone) { + CustomerDTO customerByPhone = customerMapper.findCustomerByPhone(phone); + if (customerByPhone != null && customerByPhone.getMemberOvertime() != null) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + customerByPhone.setMemberOverDate(customerByPhone.getMemberOvertime().format(formatter)); + } + customerByPhone.setContactTel(phone); + return customerByPhone; + } + public Customer getByUserId(String userId) { + List<Customer> customers = customerMapper.selectList(new LambdaQueryWrapper<Customer>().eq(Customer::getUserId, userId).eq(Customer::getDeleted, TrueOrFalseEnum.FALSE.isFlag())); + if(!CollectionUtils.isEmpty(customers)){ + return customers.get(0); + } + return null; + } + + public void updateMemberInfo(Customer customer) { + customerMapper.updateById(customer); + } } -- Gitblit v1.9.3