Forráskód Böngészése

修改客户信息

liujiankang 7 éve
szülő
commit
7e20e426de

+ 54 - 30
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicServiceImpl.java

@@ -71,92 +71,116 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
 
     private Logger logger = LoggerFactory.getLogger(CustomerBasicServiceImpl.class);
 
+    @Autowired
+    private CustomerBasicMapper customerBasicInfoSaveMapper;
+
+
     @Override
     public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId) {
-        return customerBasicMapper.queryCustomerBasicInfoByCustomerId(queryCustomerId);
+        return customerBasicInfoSaveMapper.queryCustomerBasicInfoByCustomerId(queryCustomerId);
     }
 
     @Override
     public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId) {
-        return customerBasicMapper.queryDockedContactInfoListByCustomerId(queryCustomerId);
+        return customerBasicInfoSaveMapper.queryDockedContactInfoListByCustomerId(queryCustomerId);
     }
 
     @Override
     public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId) {
-        return customerBasicMapper.queryChannelSaleInfoListByCustomerId(queryCustomerId);
+        return customerBasicInfoSaveMapper.queryChannelSaleInfoListByCustomerId(queryCustomerId);
     }
 
     @Override
     public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId) {
-        return customerBasicMapper.queryBillingInfoByCustomerId(queryCustomerId);
+        return customerBasicInfoSaveMapper.queryBillingInfoByCustomerId(queryCustomerId);
     }
 
     @Override
     public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId) {
-        return customerBasicMapper.queryTicketOpeningInfoByCustomerId(queryCustomerId);
+        return customerBasicInfoSaveMapper.queryTicketOpeningInfoByCustomerId(queryCustomerId);
     }
 
     @Override
     @Transactional
     public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
-                                      BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) {
+                                      BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
         logger.info("saveCustomerBasicInfo start...");
         int customerId = -1;
+        int channelDivisionId = -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);
-                        }
+            customerId = customerBasicInfoSaveMapper.saveCustomerBasicInfo(customerBasicInfo);
+            if(customerId != -1){
+                if(dockedContactInfoList != null && dockedContactInfoList.size()>0){
+                    for (DockedContactInfo dockedContactInfo: dockedContactInfoList) {
+                        dockedContactInfo.setCustomerId(customerId);
+                        customerBasicInfoSaveMapper.saveDockedContactInfo(dockedContactInfo);
                     }
-                    if(channelSaleInfoList != null && channelSaleInfoList.size()>0){
-                        for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
-                            channelSaleInfo.setCustomerId(customerId);
-                            customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
-                        }
+                }
+                if(channelSaleInfoList != null && channelSaleInfoList.size()>0){
+                    for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
+                        channelSaleInfo.setCustomerId(customerId);
+                        channelDivisionId = customerBasicInfoSaveMapper.saveChannelDivisionInfo(channelSaleInfo);
+                        channelSaleInfo.setChannelDivisionId(channelDivisionId);
+                        customerBasicInfoSaveMapper.saveChannelSaleInfo(channelSaleInfo);
                     }
-                    billingInfo.setCustomerId(customerId);
-                    ticketOpeningInfo.setCustomerId(customerId);
-                    customerBasicMapper.saveBillingInfo(billingInfo);
-                    customerBasicMapper.saveTicketOpeningInfo(ticketOpeningInfo);
                 }
+                billingInfo.setCustomerId(customerId);
+                ticketOpeningInfo.setCustomerId(customerId);
+                customerBasicInfoSaveMapper.saveBillingInfo(billingInfo);
+                customerBasicInfoSaveMapper.saveTicketOpeningInfo(ticketOpeningInfo);
             }
             logger.info("saveCustomerBasicInfo end...");
         }catch (Exception e){
             logger.error("添加客户信息失败"+e.getMessage());
+            throw new RuntimeException("添加客户信息失败");
         }
 
     }
 
     public List<Province> queryProvinceList(String provinceId){
-        return (List<Province>)customerBasicMapper.queryProvinceList(provinceId);
+        return (List<Province>)customerBasicInfoSaveMapper.queryProvinceList(provinceId);
     }
 
     public List<City> queryCityList(String provinceId){
-        return (List<City>)customerBasicMapper.queryCityList(provinceId);
+        return (List<City>)customerBasicInfoSaveMapper.queryCityList(provinceId);
     }
 
     public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId){
-        return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelCategoryList(channelCategoryId);
+        return (List<ChannelDivisionInfo>)customerBasicInfoSaveMapper.queryChannelCategoryList(channelCategoryId);
     }
 
     public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId){
-        return (List<ChannelDivisionInfo>)customerBasicMapper.queryChannelTypeList(channelCategoryId);
+        return (List<ChannelDivisionInfo>)customerBasicInfoSaveMapper.queryChannelTypeList(channelCategoryId);
     }
 
     public List<Product> queryPromotingProductsList(String promotingProductsInfo){
-        return (List<Product>)customerBasicMapper.queryPromotingProductsList(promotingProductsInfo);
+        return (List<Product>)customerBasicInfoSaveMapper.queryPromotingProductsList(promotingProductsInfo);
     }
 
     public List<ProductColor> querySupplyPriceList(String promotingProductsId){
-        return (List<ProductColor>)customerBasicMapper.querySupplyPriceList(promotingProductsId);
+        return (List<ProductColor>)customerBasicInfoSaveMapper.querySupplyPriceList(promotingProductsId);
+    }
+    /*@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);
+    }*/
+
+    @Override
     public Integer updateCustomerBasic(CustomerBasicInfo customerBasicInfo) {
         return customerBasicMapper.updateCustomerBasic(customerBasicInfo);
     }