package com.iamberry.rst.service.customer; import com.github.pagehelper.PageHelper; import com.iamberry.rst.core.address.City; import com.iamberry.rst.core.address.Province; import com.iamberry.rst.core.customer.*; import com.iamberry.rst.core.order.Product; import com.iamberry.rst.core.order.ProductColor; import com.iamberry.rst.core.page.PageRequest; import com.iamberry.rst.core.page.PagedResult; import com.iamberry.rst.faces.customer.CustomerBasicService; import com.iamberry.rst.service.customer.mapper.CustomerBasicMapper; import com.iamberry.rst.util.PageUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * Created by Administrator on 2018/4/20. */ @Service public class CustomerBasicServiceImpl implements CustomerBasicService{ @Autowired private CustomerBasicMapper customerBasicMapper; @Override public PagedResult listCustomerBasic(PageRequest pageRequest) { PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal()); List customerBasicList = customerBasicMapper.listCustomerBasic(pageRequest.getData()); return PageUtil.getPage(customerBasicList); } @Override public CustomerBasicInfo getCustomerBasic(CustomerBasicInfo customerBasicInfo) { return customerBasicMapper.getCustomerBasic(customerBasicInfo); } @Override public Integer updateState(CustomerBasicInfo customerBasicInfo) { return customerBasicMapper.updateState(customerBasicInfo); } @Override public BillingInfo getBillingInfo(BillingInfo billingInfo) { return customerBasicMapper.getBillingInfo(billingInfo); } @Override public TicketOpeningInfo getOpeningInfo(TicketOpeningInfo ticketOpeningInfo) { return customerBasicMapper.getOpeningInfo(ticketOpeningInfo); } @Override public List listDockedContactInfo(DockedContactInfo dockedContactInfo) { return customerBasicMapper.listDockedContactInfo(dockedContactInfo); } @Override public List listChannelSaleInfo(ChannelSaleInfo channelSaleInfo) { return customerBasicMapper.listChannelSaleInfo(channelSaleInfo); } @Override public List listChannelDivisionInfo(Integer coustomerId) { return customerBasicMapper.listChannelDivisionInfo(coustomerId); } private Logger logger = LoggerFactory.getLogger(CustomerBasicServiceImpl.class); @Override public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId) { return customerBasicMapper.queryCustomerBasicInfoByCustomerId(queryCustomerId); } @Override public List queryDockedContactInfoListByCustomerId(int queryCustomerId) { return customerBasicMapper.queryDockedContactInfoListByCustomerId(queryCustomerId); } @Override public List queryChannelSaleInfoListByCustomerId(int queryCustomerId) { return customerBasicMapper.queryChannelSaleInfoListByCustomerId(queryCustomerId); } @Override public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId) { return customerBasicMapper.queryBillingInfoByCustomerId(queryCustomerId); } @Override public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId) { return customerBasicMapper.queryTicketOpeningInfoByCustomerId(queryCustomerId); } @Override @Transactional public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List dockedContactInfoList, List channelSaleInfoList, BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) { logger.info("saveCustomerBasicInfo start..."); int customerId = -1; try { customerBasicInfo = customerBasicMapper.saveCustomerBasicInfo(customerBasicInfo); if(customerBasicInfo != null){ customerId = customerBasicInfo.getCustomerId(); if(customerId != -1){ if(dockedContactInfoList != null && dockedContactInfoList.size()>0){ for (DockedContactInfo dockedContactInfo: dockedContactInfoList) { dockedContactInfo.setCustomerId(customerId); customerBasicMapper.saveDockedContactInfo(dockedContactInfo); } } if(channelSaleInfoList != null && channelSaleInfoList.size()>0){ for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) { channelSaleInfo.setCustomerId(customerId); customerBasicMapper.saveChannelSaleInfo(channelSaleInfo); } } billingInfo.setCustomerId(customerId); ticketOpeningInfo.setCustomerId(customerId); customerBasicMapper.saveBillingInfo(billingInfo); customerBasicMapper.saveTicketOpeningInfo(ticketOpeningInfo); } } logger.info("saveCustomerBasicInfo end..."); }catch (Exception e){ logger.error("添加客户信息失败"+e.getMessage()); } } public List queryProvinceList(String provinceId){ return (List)customerBasicMapper.queryProvinceList(provinceId); } public List queryCityList(String provinceId){ return (List)customerBasicMapper.queryCityList(provinceId); } public List queryChannelCategoryList(String channelCategoryId){ return (List)customerBasicMapper.queryChannelCategoryList(channelCategoryId); } public List queryChannelTypeList(String channelCategoryId){ return (List)customerBasicMapper.queryChannelTypeList(channelCategoryId); } public List queryPromotingProductsList(String promotingProductsInfo){ return (List)customerBasicMapper.queryPromotingProductsList(promotingProductsInfo); } public List querySupplyPriceList(String promotingProductsId){ return (List)customerBasicMapper.querySupplyPriceList(promotingProductsId); } @Override public Integer updateCustomerBasic(CustomerBasicInfo customerBasicInfo) { return customerBasicMapper.updateCustomerBasic(customerBasicInfo); } @Override public Integer updateBillingInfo(BillingInfo billingInfo) { return customerBasicMapper.updateBillingInfo(billingInfo); } @Override public Integer updateOpeningInfo(TicketOpeningInfo ticketOpeningInfo) { return customerBasicMapper.updateOpeningInfo(ticketOpeningInfo); } @Override public Integer deleteContactInfo(Integer customerId) { return customerBasicMapper.deleteContactInfo(customerId); } @Override public Integer deleteSaleInfo(Integer customerId) { return customerBasicMapper.deleteSaleInfo(customerId); } @Override public Integer deleteDivisionInfo(Integer channelDivisionId) { return customerBasicMapper.deleteDivisionInfo(channelDivisionId); } /*@Override public void saveDockedContactInfo(DockedContactInfo dockedContactInfo) { customerBasicInfoSaveMapper.saveDockedContactInfo(dockedContactInfo); } @Override public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo) { customerBasicInfoSaveMapper.saveChannelSaleInfo(channelSaleInfo); } @Override public void saveBillingInfo(BillingInfo billingInfo) { customerBasicInfoSaveMapper.saveBillingInfo(billingInfo); } @Override public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo) { customerBasicInfoSaveMapper.saveTicketOpeningInfo(ticketOpeningInfo); }*/ }