123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- 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<CustomerBasicInfo> listCustomerBasic(PageRequest<CustomerBasicInfo> pageRequest) {
- PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
- List<CustomerBasicInfo> 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<DockedContactInfo> listDockedContactInfo(DockedContactInfo dockedContactInfo) {
- return customerBasicMapper.listDockedContactInfo(dockedContactInfo);
- }
- @Override
- public List<ChannelSaleInfo> listChannelSaleInfo(ChannelSaleInfo channelSaleInfo) {
- return customerBasicMapper.listChannelSaleInfo(channelSaleInfo);
- }
- @Override
- public List<ChannelDivisionInfo> 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<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId) {
- return customerBasicMapper.queryDockedContactInfoListByCustomerId(queryCustomerId);
- }
- @Override
- public List<ChannelSaleInfo> 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<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> 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<Province> queryProvinceList(String provinceId){
- return (List<Province>)customerBasicMapper.queryProvinceList(provinceId);
- }
- public List<City> queryCityList(String provinceId){
- return (List<City>)customerBasicMapper.queryCityList(provinceId);
- }
- public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId){
- return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelCategoryList(channelCategoryId);
- }
- public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId){
- return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelTypeList(channelCategoryId);
- }
- public List<Product> queryPromotingProductsList(String promotingProductsInfo){
- return (List<Product>)customerBasicMapper.queryPromotingProductsList(promotingProductsInfo);
- }
- public List<ProductColor> querySupplyPriceList(String promotingProductsId){
- return (List<ProductColor>)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);
- }*/
- }
|