cloudroam
2025-04-02 9b8db73dbec26af11e80ee36926ac6d039b921ff
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);
    }
}