CustomerBasicServiceImpl.java 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package com.iamberry.rst.service.customer;
  2. import com.github.pagehelper.PageHelper;
  3. import com.iamberry.rst.core.address.City;
  4. import com.iamberry.rst.core.address.Province;
  5. import com.iamberry.rst.core.customer.*;
  6. import com.iamberry.rst.core.order.Product;
  7. import com.iamberry.rst.core.order.ProductColor;
  8. import com.iamberry.rst.core.page.PageRequest;
  9. import com.iamberry.rst.core.page.PagedResult;
  10. import com.iamberry.rst.faces.customer.CustomerBasicService;
  11. import com.iamberry.rst.service.customer.mapper.CustomerBasicMapper;
  12. import com.iamberry.rst.util.PageUtil;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.stereotype.Service;
  17. import org.springframework.transaction.annotation.Transactional;
  18. import java.util.List;
  19. /**
  20. * Created by Administrator on 2018/4/20.
  21. */
  22. @Service
  23. public class CustomerBasicServiceImpl implements CustomerBasicService{
  24. @Autowired
  25. private CustomerBasicMapper customerBasicMapper;
  26. @Override
  27. public PagedResult<CustomerBasicInfo> listCustomerBasic(PageRequest<CustomerBasicInfo> pageRequest) {
  28. PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
  29. List<CustomerBasicInfo> customerBasicList = customerBasicMapper.listCustomerBasic(pageRequest.getData());
  30. return PageUtil.getPage(customerBasicList);
  31. }
  32. @Override
  33. public CustomerBasicInfo getCustomerBasic(CustomerBasicInfo customerBasicInfo) {
  34. return customerBasicMapper.getCustomerBasic(customerBasicInfo);
  35. }
  36. @Override
  37. public Integer updateState(CustomerBasicInfo customerBasicInfo) {
  38. return customerBasicMapper.updateState(customerBasicInfo);
  39. }
  40. @Override
  41. public BillingInfo getBillingInfo(BillingInfo billingInfo) {
  42. return customerBasicMapper.getBillingInfo(billingInfo);
  43. }
  44. @Override
  45. public TicketOpeningInfo getOpeningInfo(TicketOpeningInfo ticketOpeningInfo) {
  46. return customerBasicMapper.getOpeningInfo(ticketOpeningInfo);
  47. }
  48. @Override
  49. public List<DockedContactInfo> listDockedContactInfo(DockedContactInfo dockedContactInfo) {
  50. return customerBasicMapper.listDockedContactInfo(dockedContactInfo);
  51. }
  52. @Override
  53. public List<ChannelSaleInfo> listChannelSaleInfo(ChannelSaleInfo channelSaleInfo) {
  54. return customerBasicMapper.listChannelSaleInfo(channelSaleInfo);
  55. }
  56. @Override
  57. public List<ChannelDivisionInfo> listChannelDivisionInfo(Integer coustomerId) {
  58. return customerBasicMapper.listChannelDivisionInfo(coustomerId);
  59. }
  60. private Logger logger = LoggerFactory.getLogger(CustomerBasicServiceImpl.class);
  61. @Override
  62. public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId) {
  63. return customerBasicMapper.queryCustomerBasicInfoByCustomerId(queryCustomerId);
  64. }
  65. @Override
  66. public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId) {
  67. return customerBasicMapper.queryDockedContactInfoListByCustomerId(queryCustomerId);
  68. }
  69. @Override
  70. public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId) {
  71. return customerBasicMapper.queryChannelSaleInfoListByCustomerId(queryCustomerId);
  72. }
  73. @Override
  74. public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId) {
  75. return customerBasicMapper.queryBillingInfoByCustomerId(queryCustomerId);
  76. }
  77. @Override
  78. public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId) {
  79. return customerBasicMapper.queryTicketOpeningInfoByCustomerId(queryCustomerId);
  80. }
  81. @Override
  82. @Transactional
  83. public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
  84. BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) {
  85. logger.info("saveCustomerBasicInfo start...");
  86. int customerId = -1;
  87. try {
  88. customerBasicInfo = customerBasicMapper.saveCustomerBasicInfo(customerBasicInfo);
  89. if(customerBasicInfo != null){
  90. customerId = customerBasicInfo.getCustomerId();
  91. if(customerId != -1){
  92. if(dockedContactInfoList != null && dockedContactInfoList.size()>0){
  93. for (DockedContactInfo dockedContactInfo: dockedContactInfoList) {
  94. dockedContactInfo.setCustomerId(customerId);
  95. customerBasicMapper.saveDockedContactInfo(dockedContactInfo);
  96. }
  97. }
  98. if(channelSaleInfoList != null && channelSaleInfoList.size()>0){
  99. for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
  100. channelSaleInfo.setCustomerId(customerId);
  101. customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
  102. }
  103. }
  104. billingInfo.setCustomerId(customerId);
  105. ticketOpeningInfo.setCustomerId(customerId);
  106. customerBasicMapper.saveBillingInfo(billingInfo);
  107. customerBasicMapper.saveTicketOpeningInfo(ticketOpeningInfo);
  108. }
  109. }
  110. logger.info("saveCustomerBasicInfo end...");
  111. }catch (Exception e){
  112. logger.error("添加客户信息失败"+e.getMessage());
  113. }
  114. }
  115. public List<Province> queryProvinceList(String provinceId){
  116. return (List<Province>)customerBasicMapper.queryProvinceList(provinceId);
  117. }
  118. public List<City> queryCityList(String provinceId){
  119. return (List<City>)customerBasicMapper.queryCityList(provinceId);
  120. }
  121. public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId){
  122. return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelCategoryList(channelCategoryId);
  123. }
  124. public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId){
  125. return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelTypeList(channelCategoryId);
  126. }
  127. public List<Product> queryPromotingProductsList(String promotingProductsInfo){
  128. return (List<Product>)customerBasicMapper.queryPromotingProductsList(promotingProductsInfo);
  129. }
  130. public List<ProductColor> querySupplyPriceList(String promotingProductsId){
  131. return (List<ProductColor>)customerBasicMapper.querySupplyPriceList(promotingProductsId);
  132. }
  133. @Override
  134. public Integer updateCustomerBasic(CustomerBasicInfo customerBasicInfo) {
  135. return customerBasicMapper.updateCustomerBasic(customerBasicInfo);
  136. }
  137. @Override
  138. public Integer updateBillingInfo(BillingInfo billingInfo) {
  139. return customerBasicMapper.updateBillingInfo(billingInfo);
  140. }
  141. @Override
  142. public Integer updateOpeningInfo(TicketOpeningInfo ticketOpeningInfo) {
  143. return customerBasicMapper.updateOpeningInfo(ticketOpeningInfo);
  144. }
  145. @Override
  146. public Integer deleteContactInfo(Integer customerId) {
  147. return customerBasicMapper.deleteContactInfo(customerId);
  148. }
  149. @Override
  150. public Integer deleteSaleInfo(Integer customerId) {
  151. return customerBasicMapper.deleteSaleInfo(customerId);
  152. }
  153. @Override
  154. public Integer deleteDivisionInfo(Integer channelDivisionId) {
  155. return customerBasicMapper.deleteDivisionInfo(channelDivisionId);
  156. }
  157. /*@Override
  158. public void saveDockedContactInfo(DockedContactInfo dockedContactInfo) {
  159. customerBasicInfoSaveMapper.saveDockedContactInfo(dockedContactInfo);
  160. }
  161. @Override
  162. public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo) {
  163. customerBasicInfoSaveMapper.saveChannelSaleInfo(channelSaleInfo);
  164. }
  165. @Override
  166. public void saveBillingInfo(BillingInfo billingInfo) {
  167. customerBasicInfoSaveMapper.saveBillingInfo(billingInfo);
  168. }
  169. @Override
  170. public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo) {
  171. customerBasicInfoSaveMapper.saveTicketOpeningInfo(ticketOpeningInfo);
  172. }*/
  173. }