Bladeren bron

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

wangxiaoming 7 jaren geleden
bovenliggende
commit
fc588905ac
17 gewijzigde bestanden met toevoegingen van 3160 en 1095 verwijderingen
  1. 23 5
      watero-rst-core/src/main/java/com.iamberry.rst.core/customer/ChannelSaleInfo.java
  2. 1 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/customer/DockedContactInfo.java
  3. 0 134
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicInfoSaveService.java
  4. 169 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicService.java
  5. 0 131
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicInfoSaveServiceImpl.java
  6. 248 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicServiceImpl.java
  7. 0 130
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.java
  8. 0 311
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.xml
  9. 175 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.java
  10. 459 3
      watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.xml
  11. 346 3
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicController.java
  12. 0 263
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicInfoSaveController.java
  13. 3 1
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java
  14. 35 35
      watero-rst-web/src/main/webapp/WEB-INF/views/customer/custome_basic_detail.ftl
  15. 24 6
      watero-rst-web/src/main/webapp/WEB-INF/views/customer/customer_basic_list.ftl
  16. 530 73
      watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl
  17. 1147 0
      watero-rst-web/src/main/webapp/WEB-INF/views/customer/update_customer_info.ftl

+ 23 - 5
watero-rst-core/src/main/java/com.iamberry.rst.core/customer/ChannelSaleInfo.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 /**
+ * 客户渠道销售信息备案
  * Created by Administrator on 2018/4/19.
  */
 public class ChannelSaleInfo implements Serializable{
@@ -14,10 +15,27 @@ public class ChannelSaleInfo implements Serializable{
     private String promotingProducts;//销售产品
     private Integer supplyPrice;//供货价格
     private Integer accountPeriod;//账期 1:先款 2:月结 3:两个月
-    private Date create_date;//创建时间
+    private Date createDate;//创建时间
     private Integer channelCategory;//渠道类别 1:电商 2:特殊渠道 3:线下 4:海外
     private String channelType;//渠道类型
+    private String channelName;//渠道名称
+    private String channelCode;//渠道编码
 
+    public String getChannelCode() {
+        return channelCode;
+    }
+
+    public void setChannelCode(String channelCode) {
+        this.channelCode = channelCode;
+    }
+
+    public String getChannelName() {
+        return channelName;
+    }
+
+    public void setChannelName(String channelName) {
+        this.channelName = channelName;
+    }
     public Integer getChannelSaleId() {
         return channelSaleId;
     }
@@ -66,12 +84,12 @@ public class ChannelSaleInfo implements Serializable{
         this.accountPeriod = accountPeriod;
     }
 
-    public Date getCreate_date() {
-        return create_date;
+    public Date getCreateDate() {
+        return createDate;
     }
 
-    public void setCreate_date(Date create_date) {
-        this.create_date = create_date;
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
     }
 
     public Integer getChannelCategory() {

+ 1 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/customer/DockedContactInfo.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 /**
+ * 对接联系人信息
  * Created by Administrator on 2018/4/19.
  */
 public class DockedContactInfo implements Serializable {

+ 0 - 134
watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicInfoSaveService.java

@@ -1,134 +0,0 @@
-package com.iamberry.rst.faces.customer;
-
-
-import com.iamberry.rst.core.address.*;
-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.order.ProductType;
-
-import java.util.List;
-
-public interface CustomerBasicInfoSaveService {
-
-    /**
-     * 根据客户id查询客户基本信息
-     * @param queryCustomerId
-     * @return
-     */
-    public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询对接联系人信息
-     * @param queryCustomerId
-     * @return
-     */
-    public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户销售渠道备案信息
-     * @param queryCustomerId
-     * @return
-     */
-    public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户付款/退款信息
-     * @param queryCustomerId
-     * @return
-     */
-    public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户开票信息
-     * @param queryCustomerId
-     * @return
-     */
-    public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId);
-
-    /**
-     * 添加客户基本信息
-     *
-     * @param customerBasicInfo
-     * @return
-     */
-    public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
-                                     BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo);
-
-    /**
-     * 查询所有省份
-     * @param provinceId
-     * @return
-     */
-    public List<Province> queryProvinceList(String provinceId);
-
-    /**
-     * 根据省份代号查询所有城市
-     * @param provinceId
-     * @return
-     */
-    public List<City> queryCityList(String provinceId);
-
-    /**
-     * 查询所有渠道类别
-     * @param channelCategoryId
-     * @return
-     */
-    public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId);
-
-    /**
-     * 根据渠道类别查询渠道类型
-     * @param channelCategoryId
-     * @return
-     */
-    public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId);
-
-    /**
-     * 查询销售产品
-     * @param promotingProductsInfo
-     * @return
-     */
-    public List<Product> queryPromotingProductsList(String promotingProductsInfo);
-
-    /**
-     * 根据产品初始化价格
-     * @param promotingProductsId
-     * @return
-     */
-    public List<ProductColor> querySupplyPriceList(String promotingProductsId);
-
-
-    /**
-     * 添加对接联系人信息
-     *
-     * @param dockedContactInfo
-     * @return
-     */
-    /*public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);*/
-
-    /**
-     * 添加客户销售渠道备案信息
-     *
-     * @param channelSaleInfo
-     * @return
-     */
-    /*public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);*/
-
-    /**
-     * 添加付款/退款信息
-     *
-     * @param billingInfo
-     * @return
-     */
-    /*public void saveBillingInfo(BillingInfo billingInfo);*/
-
-    /**
-     * 添加对开票信息
-     *
-     * @param ticketOpeningInfo
-     * @return
-     */
-    /*public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);*/
-}

+ 169 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicService.java

@@ -1,6 +1,10 @@
 package com.iamberry.rst.faces.customer;
 
+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;
 
@@ -48,4 +52,169 @@ public interface CustomerBasicService {
      *  根据客户id渠道划分信息集合
      */
     List<ChannelDivisionInfo> listChannelDivisionInfo(Integer coustomerId);
+
+    /**
+     * 根据客户id查询客户基本信息
+     * @param queryCustomerId
+     * @return
+     */
+    public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询对接联系人信息
+     * @param queryCustomerId
+     * @return
+     */
+    public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户销售渠道备案信息
+     * @param queryCustomerId
+     * @return
+     */
+    public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户付款/退款信息
+     * @param queryCustomerId
+     * @return
+     */
+    public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户开票信息
+     * @param queryCustomerId
+     * @return
+     */
+    public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId);
+
+    /**
+     * 添加客户基本信息
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
+                                      BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception;
+
+    /**
+     * 修改客户基本信息
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public void updateCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
+                                      BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception;
+    /**
+     * 查询所有省份
+     * @param provinceId
+     * @return
+     */
+    public List<Province> queryProvinceList(String provinceId);
+
+    /**
+     * 根据省份代号查询所有城市
+     * @param provinceId
+     * @return
+     */
+    public List<City> queryCityList(String provinceId);
+
+    /**
+     * 查询所有渠道类别
+     * @param channelCategoryId
+     * @return
+     */
+    public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId);
+
+    /**
+     * 根据渠道类别查询渠道类型
+     * @param channelCategoryId
+     * @return
+     */
+    public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId);
+
+    /**
+     * 查询销售产品
+     * @param promotingProductsInfo
+     * @return
+     */
+    public List<Product> queryPromotingProductsList(String promotingProductsInfo);
+
+    /**
+     * 根据产品初始化价格
+     * @param promotingProductsId
+     * @return
+     */
+    public List<ProductColor> querySupplyPriceList(String promotingProductsId);
+
+
+    /**
+     * 添加对接联系人信息
+     *
+     * @param dockedContactInfo
+     * @return
+     */
+    /*public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);*/
+
+    /**
+     * 添加客户销售渠道备案信息
+     *
+     * @param channelSaleInfo
+     * @return
+     */
+    /*public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);*/
+
+    /**
+     * 添加付款/退款信息
+     *
+     * @param billingInfo
+     * @return
+     */
+    /*public void saveBillingInfo(BillingInfo billingInfo);*/
+
+    /**
+     * 添加对开票信息
+     *
+     * @param ticketOpeningInfo
+     * @return
+     */
+    /*public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);*/
+
+    /**
+     * 修改客户基本信息
+     * @param customerBasicInfo
+     * @return
+     */
+    Integer updateCustomerBasic(CustomerBasicInfo customerBasicInfo);
+
+    /**
+     * 修改付款/退款信息
+     * @return
+     */
+    Integer updateBillingInfo(BillingInfo billingInfo);
+
+    /**
+     * 修改开票信息
+     * @return
+     */
+    Integer updateOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
+
+    /**
+     * 删除联系人信息
+     * @return
+     */
+    Integer deleteContactInfo(Integer customerId);
+
+    /**
+     * 删除渠道销售信息
+     * @return
+     */
+    Integer deleteSaleInfo(Integer customerId);
+
+    /**
+     * 删除渠道划分信息
+     * @return
+     */
+    Integer deleteDivisionInfo(Integer channelDivisionId);
+
 }

+ 0 - 131
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicInfoSaveServiceImpl.java

@@ -1,131 +0,0 @@
-package com.iamberry.rst.service.customer;
-
-import com.iamberry.rst.core.address.*;
-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.faces.customer.CustomerBasicInfoSaveService;
-import com.iamberry.rst.service.customer.mapper.CustomerBasicInfoSaveMapper;
-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;
-
-@Service
-public class CustomerBasicInfoSaveServiceImpl implements CustomerBasicInfoSaveService {
-
-    private Logger logger = LoggerFactory.getLogger(CustomerBasicInfoSaveServiceImpl.class);
-
-    @Autowired
-    private CustomerBasicInfoSaveMapper customerBasicInfoSaveMapper;
-
-
-    @Override
-    public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId) {
-        return customerBasicInfoSaveMapper.queryCustomerBasicInfoByCustomerId(queryCustomerId);
-    }
-
-    @Override
-    public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId) {
-        return customerBasicInfoSaveMapper.queryDockedContactInfoListByCustomerId(queryCustomerId);
-    }
-
-    @Override
-    public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId) {
-        return customerBasicInfoSaveMapper.queryChannelSaleInfoListByCustomerId(queryCustomerId);
-    }
-
-    @Override
-    public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId) {
-        return customerBasicInfoSaveMapper.queryBillingInfoByCustomerId(queryCustomerId);
-    }
-
-    @Override
-    public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId) {
-        return customerBasicInfoSaveMapper.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 = customerBasicInfoSaveMapper.saveCustomerBasicInfo(customerBasicInfo);
-            if(customerBasicInfo != null){
-                customerId = customerBasicInfo.getCustomerId();
-                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);
-                            customerBasicInfoSaveMapper.saveChannelSaleInfo(channelSaleInfo);
-                        }
-                    }
-                    billingInfo.setCustomerId(customerId);
-                    ticketOpeningInfo.setCustomerId(customerId);
-                    customerBasicInfoSaveMapper.saveBillingInfo(billingInfo);
-                    customerBasicInfoSaveMapper.saveTicketOpeningInfo(ticketOpeningInfo);
-                }
-            }
-            logger.info("saveCustomerBasicInfo end...");
-        }catch (Exception e){
-            logger.error("添加客户信息失败"+e.getMessage());
-        }
-
-    }
-
-    public List<Province> queryProvinceList(String provinceId){
-        return (List<Province>)customerBasicInfoSaveMapper.queryProvinceList(provinceId);
-    }
-
-    public List<City> queryCityList(String provinceId){
-        return (List<City>)customerBasicInfoSaveMapper.queryCityList(provinceId);
-    }
-
-    public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId){
-        return (List<ChannelDivisionInfo>)customerBasicInfoSaveMapper.queryChannelCategoryList(channelCategoryId);
-    }
-
-    public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId){
-        return (List<ChannelDivisionInfo>)customerBasicInfoSaveMapper.queryChannelTypeList(channelCategoryId);
-    }
-
-    public List<Product> queryPromotingProductsList(String promotingProductsInfo){
-        return (List<Product>)customerBasicInfoSaveMapper.queryPromotingProductsList(promotingProductsInfo);
-    }
-
-    public List<ProductColor> querySupplyPriceList(String 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);
-    }*/
-}

+ 248 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicServiceImpl.java

@@ -1,14 +1,22 @@
 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 com.iamberry.wechat.tools.payUtil.StringUtil;
+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;
 
@@ -61,4 +69,244 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
     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) throws Exception{
+        logger.info("saveCustomerBasicInfo start...");
+        int customerId = -1;
+        String channelDivisionId = "";
+        int cooperativeState = customerBasicInfo.getCooperativeState();
+        try {
+            customerBasicMapper.saveCustomerBasicInfo(customerBasicInfo);
+            customerId = customerBasicInfo.getCustomerId();
+            if(customerId != -1){
+                if(dockedContactInfoList != null && dockedContactInfoList.size()>1){
+                    dockedContactInfoList.remove(0);
+                    for (DockedContactInfo dockedContactInfo: dockedContactInfoList) {
+                        dockedContactInfo.setCustomerId(customerId);
+                        customerBasicMapper.saveDockedContactInfo(dockedContactInfo);
+                    }
+                }
+                if(channelSaleInfoList != null && channelSaleInfoList.size()>1){
+                    channelSaleInfoList.remove(0);
+                    for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
+                        channelSaleInfo.setCustomerId(customerId);
+                        String channelName = channelSaleInfo.getChannelName();
+                        channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo);
+                        if(StringUtil.isNotEmpty(channelDivisionId)){
+                            if(Integer.valueOf(channelDivisionId)>0){
+                                channelSaleInfo.setChannelDivisionId(Integer.valueOf(channelDivisionId));
+                                customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                            }else{
+                                customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
+                                customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                            }
+                        }else{
+                            customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
+                            customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                        }
+                    }
+                }
+                if(cooperativeState == 2 || cooperativeState ==3){
+                    billingInfo.setCustomerId(customerId);
+                    ticketOpeningInfo.setCustomerId(customerId);
+                    customerBasicMapper.saveBillingInfo(billingInfo);
+                    customerBasicMapper.saveTicketOpeningInfo(ticketOpeningInfo);
+                }
+            }
+            logger.info("saveCustomerBasicInfo end...");
+        }catch (Exception e){
+            logger.error("添加客户信息失败"+e.getMessage());
+            throw new RuntimeException("添加客户信息失败");
+        }
+
+    }
+
+    @Override
+    @Transactional
+    public void updateCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
+                                      BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
+        int customerId = -1;
+        String channelDivisionId = "";
+        try {
+            customerBasicMapper.updateCustomerBasic(customerBasicInfo);
+            customerId = customerBasicInfo.getCustomerId();
+
+            //删除旧联系人数据和渠道销售信息
+            customerBasicMapper.deleteContactInfo(customerId);
+            List<ChannelSaleInfo> listChannelSale = customerBasicMapper.queryChannelSaleInfoListByCustomerId(customerId);
+            if(listChannelSale.size() > 0){
+                for(ChannelSaleInfo channelSaleInfo : listChannelSale){
+                    customerBasicMapper.deleteDivisionInfo(channelSaleInfo.getChannelDivisionId());
+                }
+                customerBasicMapper.deleteSaleInfo(customerId);
+            }
+
+            if(customerId != -1){
+                if(dockedContactInfoList != null && dockedContactInfoList.size()>1){
+                    dockedContactInfoList.remove(0);
+                    for (DockedContactInfo dockedContactInfo: dockedContactInfoList) {
+                        dockedContactInfo.setCustomerId(customerId);
+                        customerBasicMapper.saveDockedContactInfo(dockedContactInfo);
+                    }
+                }
+                if(channelSaleInfoList != null && channelSaleInfoList.size()>1){
+                    channelSaleInfoList.remove(0);
+                    for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
+                        channelSaleInfo.setCustomerId(customerId);
+                        channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo);
+                        if(StringUtil.isNotEmpty(channelDivisionId)){
+                            if(Integer.valueOf(channelDivisionId)>0){
+                                channelSaleInfo.setChannelDivisionId(Integer.valueOf(channelDivisionId));
+                                customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                            }else{
+                                customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
+                                customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                            }
+                        }else{
+                            customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
+                            customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
+                        }
+                    }
+                }
+                billingInfo.setCustomerId(customerId);
+                ticketOpeningInfo.setCustomerId(customerId);
+                if(billingInfo.getBillingId()!=null){
+                    customerBasicMapper.updateBillingInfo(billingInfo);
+                }else{
+                    customerBasicMapper.saveBillingInfo(billingInfo);
+                }
+                if(ticketOpeningInfo.getTicketOpeningId()!=null){
+                    customerBasicMapper.updateOpeningInfo(ticketOpeningInfo);
+                }else{
+                    customerBasicMapper.saveTicketOpeningInfo(ticketOpeningInfo);
+                }
+
+            }
+        }catch (Exception e){
+            logger.error("修改客户信息失败"+e.getMessage());
+            throw new RuntimeException("修改客户信息失败");
+        }
+
+    }
+    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 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);
+    }
+
+    @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);
+    }*/
 }

+ 0 - 130
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.java

@@ -1,130 +0,0 @@
-package com.iamberry.rst.service.customer.mapper;
-
-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 java.util.List;
-
-public interface CustomerBasicInfoSaveMapper {
-    /**
-     * 添加客户基本信息
-     *
-     * @param customerBasicInfo
-     * @return
-     */
-    public CustomerBasicInfo saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo);
-
-    /**
-     * 添加对接联系人信息
-     *
-     * @param dockedContactInfo
-     * @return
-     */
-    public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);
-
-    /**
-     * 添加客户销售渠道备案信息
-     *
-     * @param channelSaleInfo
-     * @return
-     */
-    public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);
-
-    /**
-     * 添加付款/退款信息
-     *
-     * @param billingInfo
-     * @return
-     */
-    public void saveBillingInfo(BillingInfo billingInfo);
-
-    /**
-     * 添加开票信息
-     *
-     * @param ticketOpeningInfo
-     * @return
-     */
-    public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
-
-    //查询部分 start
-    /**
-     * 根据客户id查询客户基本信息
-     * @param queryCustomerId
-     * @return
-     */
-    public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询对接联系人信息
-     * @param queryCustomerId
-     * @return
-     */
-    public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户销售渠道备案信息
-     * @param queryCustomerId
-     * @return
-     */
-    public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户付款/退款信息
-     * @param queryCustomerId
-     * @return
-     */
-    public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId);
-
-    /**
-     * 根据客户id查询客户开票信息
-     * @param queryCustomerId
-     * @return
-     */
-    public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId);
-    //查询部分 end
-
-    /**
-     * 查询所有省份
-     * @param provinceId
-     * @return
-     */
-    public List<Province> queryProvinceList(String provinceId);
-
-    /**
-     * 根据省份代号查询所有城市
-     * @param provinceId
-     * @return
-     */
-    public List<City> queryCityList(String provinceId);
-
-    /**
-     * 查询所有渠道类别
-     * @param channelCategoryId
-     * @return
-     */
-    public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId);
-
-    /**
-     * 根据渠道类别查询渠道类型
-     * @param channelCategoryId
-     * @return
-     */
-    public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId);
-
-    /**
-     * 查询销售产品
-     * @param promotingProductsInfo
-     * @return
-     */
-    public List<Product> queryPromotingProductsList(String promotingProductsInfo);
-
-    /**
-     * 查询销售产品价格
-     * @param promotingProductsId
-     * @return
-     */
-    public List<ProductColor> querySupplyPriceList(String promotingProductsId);
-}

+ 0 - 311
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.xml

@@ -1,311 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.iamberry.rst.service.customer.mapper.CustomerBasicInfoSaveMapper" >
-    <!--映射结果集 start-->
-    <!--客户基本信息结果映射-->
-    <resultMap type="com.iamberry.rst.core.customer.CustomerBasicInfo" id="customerBasicInfoResult">
-        <id property="customerId" column="customer_id"/>
-        <result property="customerName" column="customer_name" />
-        <result property="customerIndustry" column="customer_industry" />
-        <result property="customerType" column="customer_type" />
-        <result property="cooperativeState" column="cooperative_state" />
-        <result property="customerProvinceCode" column="customer_province_code" />
-        <result property="customerCityCode" column="customer_city_code" />
-        <result property="customerAddress" column="customer_address" />
-        <result property="customerStatus" column="customer_status" />
-        <result property="createDate" column="create_date" />
-        <result property="updateDate" column="update_date" />
-        <result property="idCreateBy" column="id_create_by" />
-        <result property="customerRemarks" column="customer_remarks" />
-    </resultMap>
-    <!--对接联系人信息结果映射-->
-    <resultMap type="com.iamberry.rst.core.customer.DockedContactInfo" id="dockedContactInfoResult">
-        <id property="dockedContactId" column="docked_contact_id"/>
-        <result property="contactName" column="contact_name" />
-        <result property="contactPhone" column="contact_phone" />
-        <result property="contactType" column="contact_type" />
-        <result property="contactEmail" column="contact_email" />
-        <result property="createDate" column="create_date" />
-    </resultMap>
-    <!--客户渠道销售信息结果映射-->
-    <resultMap type="com.iamberry.rst.core.customer.ChannelSaleInfo" id="channelSaleInfoResult">
-        <id property="channelSaleId" column="channel_sale_id"/>
-        <result property="channelName" column="channel_name" />
-        <result property="promotingProducts" column="promoting_products" />
-        <result property="supplyPrice" column="supply_price" />
-        <result property="accountPeriod" column="account_period" />
-        <result property="createDate" column="create_date" />
-    </resultMap>
-    <!--付款/退款信息结果映射-->
-    <resultMap type="com.iamberry.rst.core.customer.BillingInfo" id="billingInfoResult">
-        <id property="billingId" column="billing_id"/>
-        <result property="accountOpeningBranch" column="account_opening_branch" />
-        <result property="accountName" column="account_name" />
-        <result property="accountNum" column="account_num" />
-        <result property="receivablesName" column="receivables_name" />
-        <result property="receivablesPhone" column="receivables_phone" />
-        <result property="createDate" column="create_date" />
-    </resultMap>
-    <!--开票信息结果映射-->
-    <resultMap type="com.iamberry.rst.core.customer.TicketOpeningInfo" id="ticketOpeningInfoResult">
-        <id property="ticketOpeningId" column="ticket_opening_id"/>
-        <result property="ticketType" column="ticket_type" />
-        <result property="accountOpeningBranch" column="account_opening_branch" />
-        <result property="ticketOpeningAccount" column="ticket_opening_account" />
-        <result property="enterpriseName" column="enterprise_name" />
-        <result property="taxpayerIdentificationNum" column="taxpayer_identification_num" />
-        <result property="ticketOpeningPhone" column="ticket_opening_phone" />
-        <result property="enterpriseAddress" column="enterprise_address" />
-        <result property="createDate" column="create_date" />
-    </resultMap>
-    <!--查询所有省份映射-->
-    <resultMap type="com.iamberry.rst.core.address.Province" id="queryProvinceResult">
-        <id property="provinceId" column="province_id"/>
-        <!--<result property="provinceNum" column="divisionCode" />-->
-        <result property="province" column="province" />
-    </resultMap>
-    <!--根据省份代号查询所有城市映射-->
-    <resultMap type="com.iamberry.rst.core.address.City" id="queryCityResult">
-        <id property="cityId" column="city_id"/>
-        <!--<result property="cityNum" column="city_number" />-->
-        <result property="city" column="city" />
-        <!--<result property="provinceNum" column="provinceid" />-->
-    </resultMap>
-    <!--查询所有渠道类别-->
-    <resultMap type="com.iamberry.rst.core.customer.ChannelDivisionInfo" id="queryChannelCategoryResult">
-        <result property="channelCategory" column="channel_category" />
-        <result property="channelName" column="channel_categoryId" />
-    </resultMap>
-    <!--根据渠道类别查询渠道类型-->
-    <resultMap type="com.iamberry.rst.core.customer.ChannelDivisionInfo" id="queryChannelTypeResult">
-        <!--<id property="channelDivisionId" column="channel_division_id"/>-->
-        <result property="channelType" column="channel_type" />
-        <result property="channelName" column="channel_categoryId" />
-    </resultMap>
-    <!--查询销售产品-->
-    <resultMap type="com.iamberry.rst.core.order.Product" id="queryPromotingProductsResult">
-        <id property="productId" column="product_id"/>
-        <result property="productName" column="product_name" />
-    </resultMap>
-    <!--查询销售产品价格-->
-    <resultMap type="com.iamberry.rst.core.order.ProductColor" id="querySupplyPriceResult">
-        <result property="colorId" column="color_id" />
-        <result property="colorPrice" column="color_price" />
-    </resultMap>
-    <!--映射结果集 end-->
-
-    <!--新增部分 start-->
-    <!-- 添加客户基本信息 -->
-    <insert id="saveCustomerBasicInfo" parameterType="CustomerBasicInfo" useGeneratedKeys="true"  keyProperty="customer_id">
-        INSERT INTO
-        tb_rst_customer_basic_info
-        (
-        customer_name, customer_industry, customer_type, cooperative_state, customer_province_code,customer_city_code,
-        customer_address, customer_status, create_date, update_date,id_create_by,customer_remarks
-        )
-        VALUES
-        (
-        #{customerName},#{customerIndustry},#{customerType},#{cooperativeState},#{customerProvinceCode},#{customerCityCode},
-        #{customerAddress},#{customerStatus},NOW(),NOW(),#{idCreateBy},#{customerRemarks}
-        )
-    </insert>
-
-    <!-- 添加对接联系人信息 -->
-    <insert id="saveDockedContactInfo" parameterType="DockedContactInfo">
-        INSERT INTO
-        tb_rst_docked_contact_info
-        (
-        customer_id, contact_name, contact_phone, contact_type, contact_email,create_date
-        )
-        VALUES
-        (
-        #{customerId},#{contactName},#{contactPhone},#{contactType},#{contactEmail},NOW()
-        )
-    </insert>
-
-    <!-- 添加客户销售渠道备案信息 -->
-    <insert id="saveChannelSaleInfo" parameterType="ChannelSaleInfo">
-        INSERT INTO
-        tb_rst_ channel_sale_info
-        (
-        customer_id, channel_division_id, channel_name, promoting_products, supply_price,account_period,create_date
-        )
-        VALUES
-        (
-        #{customerId},#{channelDivisionId},#{channelName},#{promotingProducts},#{supplyPrice},#{accountPeriod},NOW()
-        )
-    </insert>
-
-    <!-- 添加付款/退款信息 -->
-    <insert id="saveBillingInfo" parameterType="BillingInfo">
-        INSERT INTO
-        tb_rst_billing_info
-        (
-        customer_id, account_opening_branch, account_name, account_num, receivables_name,receivables_phone,create_date
-        )
-        VALUES
-        (
-        #{customerId},#{accountOpeningBranch},#{accountName},#{accountNum},#{receivablesName},#{receivablesPhone},NOW()
-        )
-    </insert>
-
-    <!-- 添加对开票信息 -->
-    <insert id="saveTicketOpeningInfo" parameterType="TicketOpeningInfo">
-        INSERT INTO
-        tb_rst_ticket_opening_info
-        (
-        customer_id, ticket_type, account_opening_branch, ticket_opening_account, enterprise_name,
-        taxpayer_identification_num,ticket_opening_phone, enterprise_address, create_date
-        )
-        VALUES
-        (
-        #{customerId},#{ticketType},#{accountOpeningBranch},#{ticketOpeningAccount},#{enterpriseName},
-        #{taxpayerIdentificationNum},#{ticketOpeningPhone},#{enterpriseAddress},NOW()
-        )
-    </insert>
-    <!--新增部分 end-->
-
-    <!--查询客户信息部分 start-->
-    <!-- 根据客户id查询客户基本信息 -->
-    <select id="queryCustomerBasicInfoByCustomerId" parameterType="Integer" resultMap="customerBasicInfoResult">
-        SELECT * FROM tb_rst_customer_basic_info t WHERE t.customer_id = #{id}
-    </select>
-    <!-- 根据客户id查询对接联系人信息 -->
-    <select id="queryDockedContactInfoListByCustomerId" parameterType="Integer" resultMap="dockedContactInfoResult">
-        SELECT
-          t.docked_contact_id,
-          t.contact_name,
-          t.contact_phone,
-          t.contact_type,
-          t.contact_email,
-          t.create_date
-        FROM
-          tb_rst_docked_contact_info t
-        WHERE
-          t.customer_id = #{id}
-    </select>
-    <!-- 根据客户id查询客户销售渠道备案信息 -->
-    <select id="queryChannelSaleInfoListByCustomerId" parameterType="Integer" resultMap="channelSaleInfoResult">
-        SELECT
-        t.channel_sale_id,
-        t.channel_name,
-        t.promoting_products,
-        t.supply_price,
-        t.account_period,
-        t.create_date
-        FROM
-        tb_rst_channel_sale_info t
-        WHERE
-        t.customer_id = #{id}
-    </select>
-    <!-- 根据客户id查询客户付款/退款信息 -->
-    <select id="queryBillingInfoByCustomerId" parameterType="Integer" resultMap="billingInfoResult">
-        SELECT
-        t.billing_id,
-        t.account_opening_branch,
-        t.account_name,
-        t.account_num,
-        t.receivables_name,
-        t.receivables_phone,
-        t.create_date
-        FROM
-        tb_rst_billing_info t
-        WHERE
-        t.customer_id = #{id}
-    </select>
-    <!-- 根据客户id查询客户开票信息 -->
-    <select id="queryTicketOpeningInfoByCustomerId" parameterType="Integer" resultMap="ticketOpeningInfoResult">
-        SELECT
-        t.ticket_opening_id,
-        t.ticket_type,
-        t.account_opening_branch,
-        t.ticket_opening_account,
-        t.enterprise_name,
-        t.taxpayer_identification_num,
-        t.ticket_opening_phone,
-        t.enterprise_address,
-        t.create_date
-        FROM
-        tb_rst_ticket_opening_info t
-        WHERE
-        t.customer_id = #{id}
-    </select>
-    <!--查询客户信息部分 end-->
-    <!--查询所有省份-->
-    <select id="queryProvinceList" parameterType="java.lang.String" resultMap="queryProvinceResult">
-        SELECT
-            t.province_id,
-            t.province
-        FROM
-            tb_rst_address_province t
-        ORDER BY
-            t.province_id ASC
-    </select>
-    <!--根据省份代号查询所有城市-->
-    <select id="queryCityList" parameterType="java.lang.String" resultMap="queryCityResult">
-        SELECT
-        t.city_id,
-        t.city
-        FROM
-        tb_rst_address_city t
-        WHERE
-        t.province_id = #{id}
-        ORDER BY
-        t.city_id ASC
-    </select>
-    <!--查询所有渠道类别-->
-    <select id="queryChannelCategoryList" parameterType="java.lang.String" resultMap="queryChannelCategoryResult">
-        SELECT
-            DISTINCT (t.channel_category),
-            CASE
-            WHEN t.channel_category = 1 THEN '电商'
-            WHEN t.channel_category = 2 THEN '特殊渠道'
-            WHEN t.channel_category = 3 THEN '线下'
-            ELSE '海外'
-            END AS 'channel_categoryId'
-        FROM
-        tb_rst_channel_division_info t
-        ORDER BY
-        t.channel_division_id ASC
-    </select>
-    <!--根据渠道类别查询渠道类型-->
-    <select id="queryChannelTypeList" parameterType="java.lang.String" resultMap="queryChannelTypeResult">
-        SELECT
-        /*t.channel_division_id,*/
-        DISTINCT (t.channel_type),
-        CASE
-            WHEN t.channel_category = 1 THEN '电商'
-            WHEN t.channel_category = 2 THEN '特殊渠道'
-            WHEN t.channel_category = 3 THEN '线下'
-            ELSE '海外'
-            END AS 'channel_categoryId'
-        FROM
-        tb_rst_channel_division_info t
-        WHERE
-        t.channel_category = #{id}
-        ORDER BY
-        t.channel_division_id ASC
-    </select>
-    <!--查询销售产品-->
-    <select id="queryPromotingProductsList" parameterType="java.lang.String" resultMap="queryPromotingProductsResult">
-        SELECT
-        t.product_id,
-        t.product_name
-        FROM
-        tb_rst_product_info t
-        ORDER BY
-        t.product_id ASC
-    </select>
-    <!--查询销售产品价格-->
-    <select id="querySupplyPriceList" parameterType="java.lang.String" resultMap="querySupplyPriceResult">
-        SELECT
-        t.color_id,
-        t.color_price
-        FROM
-        tb_rst_product_color t
-        WHERE
-        t.color_product_id = #{id}
-        ORDER BY
-        t.color_id ASC
-    </select>
-</mapper>

+ 175 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.java

@@ -1,6 +1,10 @@
 package com.iamberry.rst.service.customer.mapper;
 
+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 java.util.List;
 
@@ -24,4 +28,175 @@ public interface CustomerBasicMapper {
     List<ChannelSaleInfo> listChannelSaleInfo(ChannelSaleInfo channelSaleInfo);
     /*根据客户id渠道划分信息集合*/
     List<ChannelDivisionInfo> listChannelDivisionInfo(Integer coustomerId);
+    /**
+     * 添加客户基本信息
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo);
+
+    /**
+     * 添加对接联系人信息
+     *
+     * @param dockedContactInfo
+     * @return
+     */
+    public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);
+
+    /**
+     * 添加客户销售渠道备案信息-销售产品表
+     *
+     * @param channelSaleInfo
+     * @return
+     */
+    public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);
+
+    /**
+     * 添加客户销售渠道备案信息-渠道表
+     *
+     * @param channelSaleInfo
+     * @return
+     */
+    public void saveChannelDivisionInfo(ChannelSaleInfo channelSaleInfo);
+
+    /**
+     * 添加付款/退款信息
+     *
+     * @param billingInfo
+     * @return
+     */
+    public void saveBillingInfo(BillingInfo billingInfo);
+
+    /**
+     * 添加开票信息
+     *
+     * @param ticketOpeningInfo
+     * @return
+     */
+    public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
+
+    //查询部分 start
+    /**
+     * 根据客户id查询客户基本信息
+     * @param queryCustomerId
+     * @return
+     */
+    public CustomerBasicInfo queryCustomerBasicInfoByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询对接联系人信息
+     * @param queryCustomerId
+     * @return
+     */
+    public List<DockedContactInfo> queryDockedContactInfoListByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户销售渠道备案信息
+     * @param queryCustomerId
+     * @return
+     */
+    public List<ChannelSaleInfo> queryChannelSaleInfoListByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户付款/退款信息
+     * @param queryCustomerId
+     * @return
+     */
+    public BillingInfo queryBillingInfoByCustomerId(int queryCustomerId);
+
+    /**
+     * 根据客户id查询客户开票信息
+     * @param queryCustomerId
+     * @return
+     */
+    public TicketOpeningInfo queryTicketOpeningInfoByCustomerId(int queryCustomerId);
+    //查询部分 end
+
+    /**
+     * 查询所有省份
+     * @param provinceId
+     * @return
+     */
+    public List<Province> queryProvinceList(String provinceId);
+
+    /**
+     * 根据省份代号查询所有城市
+     * @param provinceId
+     * @return
+     */
+    public List<City> queryCityList(String provinceId);
+
+    /**
+     * 查询所有渠道类别
+     * @param channelCategoryId
+     * @return
+     */
+    public List<ChannelDivisionInfo> queryChannelCategoryList(String channelCategoryId);
+
+    /**
+     * 根据渠道类别查询渠道类型
+     * @param channelCategoryId
+     * @return
+     */
+    public List<ChannelDivisionInfo> queryChannelTypeList(String channelCategoryId);
+
+    /**
+     * 查询销售产品
+     * @param promotingProductsInfo
+     * @return
+     */
+    public List<Product> queryPromotingProductsList(String promotingProductsInfo);
+
+    /**
+     * 查询销售产品价格
+     * @param promotingProductsId
+     * @return
+     */
+    public List<ProductColor> querySupplyPriceList(String promotingProductsId);
+
+
+    /**
+     * 修改客户基本信息
+     * @param customerBasicInfo
+     * @return
+     */
+    Integer updateCustomerBasic(CustomerBasicInfo customerBasicInfo);
+
+    /**
+     * 修改付款/退款信息
+     * @return
+     */
+    Integer updateBillingInfo(BillingInfo billingInfo);
+
+    /**
+     * 修改开票信息
+     * @return
+     */
+    Integer updateOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
+
+    /**
+     * 删除联系人信息
+     * @return
+     */
+    Integer deleteContactInfo(Integer customerId);
+
+    /**
+     * 删除渠道销售信息
+     * @return
+     */
+    Integer deleteSaleInfo(Integer customerId);
+
+    /**
+     * 删除渠道划分信息
+     * @return
+     */
+    Integer deleteDivisionInfo(Integer channelDivisionId);
+
+    /**
+     * 判断是否存在渠道名称
+     * @param channelSaleInfo
+     * @return
+     */
+    String queryIsExsitChannelNameChannelName(ChannelSaleInfo channelSaleInfo);
 }

+ 459 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.xml

@@ -62,6 +62,8 @@
           AND bi.customer_status = #{isSelectAll}
         </if>-->
       </where>
+        GROUP BY bi.customer_id
+        ORDER BY bi.create_date DESC
   </select>
 
 
@@ -166,10 +168,14 @@
         si.promoting_products as promotingProducts,
         si.supply_price as supplyPrice,
         si.account_period as account_period,
-        si.create_date as createDate
+        si.create_date as createDate,
+		di.channel_category as channelCategory,
+		di.channel_type as channelType,
+		di.channel_name as channelName
         from tb_rst_channel_sale_info si
+		LEFT JOIN tb_rst_channel_division_info di ON si.channel_division_id = di.channel_division_id
         where
-            si.channel_division_id  = #{channelDivisionId}
+            si.customer_id  = #{customerId}
     </select>
 
     <resultMap type="ChannelDivisionInfo" id="listChannelDivisionMap">
@@ -180,7 +186,7 @@
         <result property="channelCode" column="channel_code" />
         <result property="receivablesPhone" column="receivables_phone" />
         <result property="createDate" column="create_date" />
-        <collection property="listChannelSaleInfo" column="channel_division_id" ofType="ChannelDivisionInfo" select="listChannelSaleInfo"/>
+        <collection property="listChannelSaleInfo" column="channel_division_id" ofType="ChannelDivisionInfo" select="listSaleInfoByChannelDivisionId"/>
     </resultMap>
     <select id="listChannelDivisionInfo" resultMap="listChannelDivisionMap" parameterType="ChannelDivisionInfo">
         SELECT
@@ -194,4 +200,454 @@
         WHERE
         customer_id = #{customerId}
     </select>
+    <select id="listSaleInfoByChannelDivisionId" resultType="ChannelSaleInfo" parameterType="java.lang.Integer">
+        SELECT
+            si.channel_sale_id AS channelSaleId,
+            si.customer_id AS customerId,
+            si.channel_division_id AS channelDivisionId,
+            si.promoting_products AS promotingProducts,
+            si.supply_price AS supplyPrice,
+            si.account_period AS account_period,
+            si.create_date AS createDate
+        FROM
+            tb_rst_channel_sale_info si
+        WHERE
+            si.channel_division_id= #{channelDivisionId}
+    </select>
+
+
+    <!--映射结果集 start-->
+    <!--客户基本信息结果映射-->
+    <resultMap type="com.iamberry.rst.core.customer.CustomerBasicInfo" id="customerBasicInfoResult">
+        <id property="customerId" column="customer_id"/>
+        <result property="customerName" column="customer_name" />
+        <result property="customerIndustry" column="customer_industry" />
+        <result property="customerType" column="customer_type" />
+        <result property="cooperativeState" column="cooperative_state" />
+        <result property="customerProvinceCode" column="customer_province_code" />
+        <result property="customerCityCode" column="customer_city_code" />
+        <result property="customerAddress" column="customer_address" />
+        <result property="customerStatus" column="customer_status" />
+        <result property="createDate" column="create_date" />
+        <result property="updateDate" column="update_date" />
+        <result property="idCreateBy" column="id_create_by" />
+        <result property="customerRemarks" column="customer_remarks" />
+    </resultMap>
+    <!--对接联系人信息结果映射-->
+    <resultMap type="com.iamberry.rst.core.customer.DockedContactInfo" id="dockedContactInfoResult">
+        <id property="dockedContactId" column="docked_contact_id"/>
+        <result property="contactName" column="contact_name" />
+        <result property="contactPhone" column="contact_phone" />
+        <result property="contactType" column="contact_type" />
+        <result property="contactEmail" column="contact_email" />
+        <result property="createDate" column="create_date" />
+    </resultMap>
+    <!--客户渠道销售信息结果映射-->
+    <resultMap type="com.iamberry.rst.core.customer.ChannelSaleInfo" id="channelSaleInfoResult">
+        <id property="channelSaleId" column="channel_sale_id"/>
+        <result property="channelName" column="channel_name" />
+        <result property="channelDivisionId" column="channel_division_id" />
+        <result property="promotingProducts" column="promoting_products" />
+        <result property="supplyPrice" column="supply_price" />
+        <result property="accountPeriod" column="account_period" />
+        <result property="createDate" column="create_date" />
+    </resultMap>
+    <!--付款/退款信息结果映射-->
+    <resultMap type="com.iamberry.rst.core.customer.BillingInfo" id="billingInfoResult">
+        <id property="billingId" column="billing_id"/>
+        <result property="accountOpeningBranch" column="account_opening_branch" />
+        <result property="accountName" column="account_name" />
+        <result property="accountNum" column="account_num" />
+        <result property="receivablesName" column="receivables_name" />
+        <result property="receivablesPhone" column="receivables_phone" />
+        <result property="createDate" column="create_date" />
+    </resultMap>
+    <!--开票信息结果映射-->
+    <resultMap type="com.iamberry.rst.core.customer.TicketOpeningInfo" id="ticketOpeningInfoResult">
+        <id property="ticketOpeningId" column="ticket_opening_id"/>
+        <result property="ticketType" column="ticket_type" />
+        <result property="accountOpeningBranch" column="account_opening_branch" />
+        <result property="ticketOpeningAccount" column="ticket_opening_account" />
+        <result property="enterpriseName" column="enterprise_name" />
+        <result property="taxpayerIdentificationNum" column="taxpayer_identification_num" />
+        <result property="ticketOpeningPhone" column="ticket_opening_phone" />
+        <result property="enterpriseAddress" column="enterprise_address" />
+        <result property="createDate" column="create_date" />
+    </resultMap>
+    <!--查询所有省份映射-->
+    <resultMap type="com.iamberry.rst.core.address.Province" id="queryProvinceResult">
+        <id property="provinceId" column="province_id"/>
+        <!--<result property="provinceNum" column="divisionCode" />-->
+        <result property="province" column="province" />
+    </resultMap>
+    <!--根据省份代号查询所有城市映射-->
+    <resultMap type="com.iamberry.rst.core.address.City" id="queryCityResult">
+        <id property="cityId" column="city_id"/>
+        <!--<result property="cityNum" column="city_number" />-->
+        <result property="city" column="city" />
+        <!--<result property="provinceNum" column="provinceid" />-->
+    </resultMap>
+    <!--查询所有渠道类别-->
+    <resultMap type="com.iamberry.rst.core.customer.ChannelDivisionInfo" id="queryChannelCategoryResult">
+        <result property="channelCategory" column="channel_category" />
+        <result property="channelName" column="channel_categoryId" />
+    </resultMap>
+    <!--根据渠道类别查询渠道类型-->
+    <resultMap type="com.iamberry.rst.core.customer.ChannelDivisionInfo" id="queryChannelTypeResult">
+        <!--<id property="channelDivisionId" column="channel_division_id"/>-->
+        <result property="channelType" column="channel_type" />
+        <result property="channelName" column="channel_categoryId" />
+    </resultMap>
+    <!--查询销售产品-->
+    <resultMap type="com.iamberry.rst.core.order.Product" id="queryPromotingProductsResult">
+        <id property="productId" column="product_id"/>
+        <result property="productName" column="product_name" />
+    </resultMap>
+    <!--查询销售产品价格-->
+    <resultMap type="com.iamberry.rst.core.order.ProductColor" id="querySupplyPriceResult">
+        <result property="colorId" column="color_id" />
+        <result property="colorPrice" column="color_price" />
+    </resultMap>
+    <!--映射结果集 end-->
+
+    <!--新增部分 start-->
+    <!-- 添加客户基本信息 -->
+    <insert id="saveCustomerBasicInfo" parameterType="CustomerBasicInfo" useGeneratedKeys="true"  keyProperty="customerId">
+        INSERT INTO
+        tb_rst_customer_basic_info
+        (
+        customer_name, customer_industry, customer_type, cooperative_state, customer_province_code,customer_city_code,
+        customer_address, customer_status, create_date, update_date,id_create_by,customer_remarks
+        )
+        VALUES
+        (
+        #{customerName},#{customerIndustry},#{customerType},#{cooperativeState},#{customerProvinceCode},#{customerCityCode},
+        #{customerAddress},#{customerStatus},NOW(),NOW(),#{idCreateBy},#{customerRemarks}
+        )
+    </insert>
+
+    <!-- 添加对接联系人信息 -->
+    <insert id="saveDockedContactInfo" parameterType="DockedContactInfo">
+        INSERT INTO
+        tb_rst_docked_contact_info
+        (
+        customer_id, contact_name, contact_phone, contact_type, contact_email,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{contactName},#{contactPhone},#{contactType},#{contactEmail},NOW()
+        )
+    </insert>
+
+    <!-- 添加客户销售渠道备案信息(渠道表) -->
+    <insert id="saveChannelDivisionInfo" parameterType="ChannelSaleInfo" useGeneratedKeys="true"  keyProperty="channelDivisionId">
+        INSERT INTO
+        tb_rst_channel_division_info
+        (
+        customer_id, channel_category, channel_type, channel_name, channel_code,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{channelCategory},#{channelType},#{channelName},#{channelCode},NOW()
+        )
+    </insert>
+
+    <!-- 添加客户销售渠道备案信息(产品表) -->
+    <insert id="saveChannelSaleInfo" parameterType="ChannelSaleInfo">
+        INSERT INTO
+        tb_rst_channel_sale_info
+        (
+        customer_id, channel_division_id, channel_name, promoting_products, supply_price,account_period,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{channelDivisionId},#{channelName},#{promotingProducts},#{supplyPrice},#{accountPeriod},NOW()
+        )
+    </insert>
+
+    <!-- 添加付款/退款信息 -->
+    <insert id="saveBillingInfo" parameterType="BillingInfo">
+        INSERT INTO
+        tb_rst_billing_info
+        (
+        customer_id, account_opening_branch, account_name, account_num, receivables_name,receivables_phone,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{accountOpeningBranch},#{accountName},#{accountNum},#{receivablesName},#{receivablesPhone},NOW()
+        )
+    </insert>
+
+    <!-- 添加对开票信息 -->
+    <insert id="saveTicketOpeningInfo" parameterType="TicketOpeningInfo">
+        INSERT INTO
+        tb_rst_ticket_opening_info
+        (
+        customer_id, ticket_type, account_opening_branch, ticket_opening_account, enterprise_name,
+        taxpayer_identification_num,ticket_opening_phone, enterprise_address, create_date
+        )
+        VALUES
+        (
+        #{customerId},#{ticketType},#{accountOpeningBranch},#{ticketOpeningAccount},#{enterpriseName},
+        #{taxpayerIdentificationNum},#{ticketOpeningPhone},#{enterpriseAddress},NOW()
+        )
+    </insert>
+    <!--新增部分 end-->
+
+    <!--查询客户信息部分 start-->
+    <!-- 根据客户id查询客户基本信息 -->
+    <select id="queryCustomerBasicInfoByCustomerId" parameterType="Integer" resultMap="customerBasicInfoResult">
+        SELECT * FROM tb_rst_customer_basic_info t WHERE t.customer_id = #{id}
+    </select>
+    <!-- 根据客户id查询对接联系人信息 -->
+    <select id="queryDockedContactInfoListByCustomerId" parameterType="Integer" resultMap="dockedContactInfoResult">
+        SELECT
+        t.docked_contact_id,
+        t.contact_name,
+        t.contact_phone,
+        t.contact_type,
+        t.contact_email,
+        t.create_date
+        FROM
+        tb_rst_docked_contact_info t
+        WHERE
+        t.customer_id = #{id}
+    </select>
+    <!-- 根据客户id查询客户销售渠道备案信息 -->
+    <!--查询渠道名称是否存在-->
+    <select id="queryIsExsitChannelNameChannelName" parameterType="ChannelSaleInfo" resultType="java.lang.String">
+        SELECT
+        IFNULL(max(t.channel_division_id),0)
+        FROM
+        tb_rst_channel_division_info t
+        WHERE
+        t.channel_name = #{channelName}
+        AND
+        t.channel_category = #{channelCategory}
+        AND
+        t.channel_type = #{channelType}
+    </select>
+    <select id="queryChannelSaleInfoListByCustomerId" parameterType="Integer" resultMap="channelSaleInfoResult">
+        SELECT
+        t.channel_sale_id,
+        t.channel_name,
+        t.channel_division_id,
+        t.promoting_products,
+        t.supply_price,
+        t.account_period,
+        t.create_date
+        FROM
+        tb_rst_channel_sale_info t
+        WHERE
+        t.customer_id = #{id}
+    </select>
+    <!-- 根据客户id查询客户付款/退款信息 -->
+    <select id="queryBillingInfoByCustomerId" parameterType="Integer" resultMap="billingInfoResult">
+        SELECT
+        t.billing_id,
+        t.account_opening_branch,
+        t.account_name,
+        t.account_num,
+        t.receivables_name,
+        t.receivables_phone,
+        t.create_date
+        FROM
+        tb_rst_billing_info t
+        WHERE
+        t.customer_id = #{id}
+    </select>
+    <!-- 根据客户id查询客户开票信息 -->
+    <select id="queryTicketOpeningInfoByCustomerId" parameterType="Integer" resultMap="ticketOpeningInfoResult">
+        SELECT
+        t.ticket_opening_id,
+        t.ticket_type,
+        t.account_opening_branch,
+        t.ticket_opening_account,
+        t.enterprise_name,
+        t.taxpayer_identification_num,
+        t.ticket_opening_phone,
+        t.enterprise_address,
+        t.create_date
+        FROM
+        tb_rst_ticket_opening_info t
+        WHERE
+        t.customer_id = #{id}
+    </select>
+    <!--查询客户信息部分 end-->
+    <!--查询所有省份-->
+    <select id="queryProvinceList" parameterType="java.lang.String" resultMap="queryProvinceResult">
+        SELECT
+        t.province_id,
+        t.province,
+        t.division_code
+        FROM
+        tb_rst_address_province t
+        ORDER BY
+        t.province_id ASC
+    </select>
+    <!--根据省份代号查询所有城市-->
+    <select id="queryCityList" parameterType="java.lang.String" resultMap="queryCityResult">
+        SELECT
+        t.city_id,
+        t.city,
+        t.division_code
+        FROM
+        tb_rst_address_city t
+        WHERE
+        t.province_id = #{id}
+        ORDER BY
+        t.city_id ASC
+    </select>
+    <!--查询所有渠道类别-->
+    <select id="queryChannelCategoryList" parameterType="java.lang.String" resultMap="queryChannelCategoryResult">
+        SELECT
+        DISTINCT (t.channel_category),
+        CASE
+        WHEN t.channel_category = 1 THEN '电商'
+        WHEN t.channel_category = 2 THEN '特殊渠道'
+        WHEN t.channel_category = 3 THEN '线下'
+        WHEN t.channel_category = 4 THEN '海外'
+        END AS 'channel_categoryId'
+        FROM
+        tb_rst_channel_division_info t
+        ORDER BY
+        t.channel_division_id ASC
+    </select>
+    <!--根据渠道类别查询渠道类型-->
+    <select id="queryChannelTypeList" parameterType="java.lang.String" resultMap="queryChannelTypeResult">
+        SELECT
+        /*t.channel_division_id,*/
+        DISTINCT (t.channel_type),
+        CASE
+        WHEN t.channel_category = 1 THEN '电商'
+        WHEN t.channel_category = 2 THEN '特殊渠道'
+        WHEN t.channel_category = 3 THEN '线下'
+        ELSE '海外'
+        END AS 'channel_categoryId'
+        FROM
+        tb_rst_channel_division_info t
+        WHERE
+        t.channel_category = #{id}
+        ORDER BY
+        t.channel_division_id ASC
+    </select>
+    <!--查询销售产品-->
+    <select id="queryPromotingProductsList" parameterType="java.lang.String" resultMap="queryPromotingProductsResult">
+        SELECT
+        t.product_id,
+        t.product_name
+        FROM
+        tb_rst_product_info t
+        ORDER BY
+        t.product_id ASC
+    </select>
+    <!--查询销售产品价格-->
+    <select id="querySupplyPriceList" parameterType="java.lang.String" resultMap="querySupplyPriceResult">
+        SELECT
+        t.color_id,
+        t.color_price
+        FROM
+        tb_rst_product_color t
+        WHERE
+        t.color_product_id = #{id}
+        ORDER BY
+        t.color_id ASC
+    </select>
+
+    <update id="updateCustomerBasic" parameterType="CustomerBasicInfo">
+        UPDATE tb_rst_customer_basic_info
+        <set >
+            <if test="customerName != null and customerName !='' " >
+                customer_name = #{customerName},
+            </if>
+            <if test="customerIndustry != null and customerIndustry !='' " >
+                customer_industry = #{customerIndustry},
+            </if>
+            <if test="customerType != null and customerType !='' " >
+                customer_type = #{customerType},
+            </if>
+            <if test="cooperativeState != null and cooperativeState !='' " >
+                cooperative_state = #{cooperativeState},
+            </if>
+            <if test="customerProvinceCode != null and customerProvinceCode !='' " >
+                customer_province_code = #{customerProvinceCode},
+            </if>
+            <if test="customerCityCode != null and customerCityCode !='' " >
+                customer_city_code = #{customerCityCode},
+            </if>
+            <if test="customerAddress != null and customerAddress !='' " >
+                customer_address = #{customerAddress},
+            </if>
+            <if test="customerStatus != null and customerStatus !='' " >
+                customer_status = #{customerStatus},
+            </if>
+            <if test="updateDate != null and updateDate !='' " >
+                update_date = #{updateDate},
+            </if>
+            <if test="customerRemarks != null and customerRemarks !='' " >
+                customer_remarks = #{customerRemarks}
+            </if>
+        </set>
+        where customer_id = #{customerId}
+    </update>
+
+    <update id="updateBillingInfo" parameterType="BillingInfo">
+        UPDATE tb_rst_billing_info
+        <set >
+            <if test="accountOpeningBranch != null and accountOpeningBranch !='' " >
+                account_opening_branch = #{accountOpeningBranch},
+            </if>
+            <if test="accountName != null and accountName !='' " >
+                account_name = #{accountName},
+            </if>
+            <if test="accountNum != null and accountNum !='' " >
+                account_num = #{accountNum},
+            </if>
+            <if test="receivablesName != null and receivablesName !='' " >
+                receivables_name = #{receivablesName},
+            </if>
+            <if test="receivablesPhone != null and receivablesPhone !='' " >
+                receivables_phone = #{receivablesPhone}
+            </if>
+        </set>
+        where customer_id = #{customerId}
+    </update>
+
+    <update id="updateOpeningInfo" parameterType="TicketOpeningInfo">
+        UPDATE tb_rst_ticket_opening_info
+        <set >
+            <if test="ticketType != null and ticketType !='' " >
+                ticket_type = #{ticketType},
+            </if>
+            <if test="accountOpeningBranch != null and accountOpeningBranch !='' " >
+                account_opening_branch = #{accountOpeningBranch},
+            </if>
+            <if test="ticketOpeningAccount != null and ticketOpeningAccount !='' " >
+                ticket_opening_account = #{ticketOpeningAccount},
+            </if>
+            <if test="enterpriseName != null and enterpriseName !='' " >
+                enterprise_name = #{enterpriseName},
+            </if>
+            <if test="taxpayerIdentificationNum != null and taxpayerIdentificationNum !='' " >
+                taxpayer_identification_num = #{taxpayerIdentificationNum},
+            </if>
+            <if test="ticketOpeningPhone != null and ticketOpeningPhone !='' " >
+                ticket_opening_phone = #{ticketOpeningPhone},
+            </if>
+            <if test="enterpriseAddress != null and enterpriseAddress !='' " >
+                enterprise_address = #{enterpriseAddress}
+            </if>
+        </set>
+        where customer_id = #{customerId}
+    </update>
+
+    <delete id="deleteContactInfo" parameterType="Integer">
+        DELETE FROM tb_rst_docked_contact_info WHERE customer_id = #{customerId}
+    </delete>
+    <delete id="deleteSaleInfo" parameterType="Integer">
+        DELETE FROM tb_rst_channel_sale_info WHERE customer_id = #{customerId}
+    </delete>
+    <delete id="deleteDivisionInfo" parameterType="Integer">
+        DELETE FROM tb_rst_channel_division_info WHERE channel_division_id = #{channelDivisionId}
+    </delete>
 </mapper>

+ 346 - 3
watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicController.java

@@ -1,8 +1,10 @@
 package com.iamberry.rst.controllers.customer;
 
-import com.iamberry.rst.controllers.cm.AdminCustomerController;
-import com.iamberry.rst.core.cm.CustomerInfo;
+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.core.sys.Admin;
@@ -11,6 +13,8 @@ import com.iamberry.rst.faces.sys.SysService;
 import com.iamberry.rst.utils.AdminUtils;
 import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.slf4j.Logger;
@@ -34,7 +38,7 @@ import java.util.List;
 @RequestMapping("/admin/customerBasic")
 public class CustomerBasicController {
 
-
+    private Logger logger = LoggerFactory.getLogger(CustomerBasicController.class);
     @Autowired
     private CustomerBasicService customerBasicService;
     @Autowired
@@ -189,4 +193,343 @@ public class CustomerBasicController {
         mv.addObject("listChannelDivisionInfo",listChannelDivisionInfo);
         return mv;
     }
+
+
+    /**
+     * 进入修改客户信息页面
+     * @param request
+     * @return
+     */
+    @ResponseBody
+    @RequiresPermissions("customerBasic:update:customerBasic")
+    @RequestMapping("/to_update_customer_Basic")
+    public ModelAndView to_update_customerBasic(HttpServletRequest request){
+        ModelAndView mv = new ModelAndView("customer/update_customer_info");
+        String customerId = request.getParameter("customerId");
+        if (!StringUtils.isNotEmpty(customerId)) {
+            return mv;
+        }
+        /*查询基本信息*/
+        CustomerBasicInfo customerBasicInfo = new CustomerBasicInfo();
+        customerBasicInfo.setCustomerId(Integer.valueOf(customerId));
+        customerBasicInfo = customerBasicService.getCustomerBasic(customerBasicInfo);
+        /*对接联系人信息*/
+        DockedContactInfo dockedContactInfo = new DockedContactInfo();
+        dockedContactInfo.setCustomerId(Integer.valueOf(customerId));
+        List<DockedContactInfo> listDockedContactInfo = customerBasicService.listDockedContactInfo(dockedContactInfo);
+        /*付款/退款信息*/
+        BillingInfo billingInfo = new BillingInfo();
+        billingInfo.setCustomerId(Integer.valueOf(customerId));
+        billingInfo = customerBasicService.getBillingInfo(billingInfo);
+        /*开票信息*/
+        TicketOpeningInfo ticketOpeningInfo = new TicketOpeningInfo();
+        ticketOpeningInfo.setCustomerId(Integer.valueOf(customerId));
+        ticketOpeningInfo = customerBasicService.getOpeningInfo(ticketOpeningInfo);
+        /*渠道销售信息*/
+        ChannelSaleInfo channelSaleInfo = new ChannelSaleInfo();
+        channelSaleInfo.setCustomerId(Integer.valueOf(customerId));
+        //List<ChannelDivisionInfo> listChannelDivisionInfo = customerBasicService.listChannelDivisionInfo(Integer.valueOf(customerId));
+        List<ChannelSaleInfo> listChannelSaleInfo = customerBasicService.listChannelSaleInfo(channelSaleInfo);
+        mv.addObject("customerBasicInfo",customerBasicInfo);
+        mv.addObject("listDockedContactInfo",listDockedContactInfo);
+        mv.addObject("billingInfo",billingInfo);
+        mv.addObject("ticketOpeningInfo",ticketOpeningInfo);
+        mv.addObject("listChannelSaleInfo",listChannelSaleInfo);
+        return mv;
+    }
+
+    /**
+     * 跳转到添加客户信息页面
+     *
+     * @return
+     */
+    @RequiresPermissions("customerBasic:save:customerInfo")
+    @RequestMapping("/saveCustomerInfo")
+    public ModelAndView toAddCustomer(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("customer/save_customer_info");
+        return mv;
+    }
+
+    /**
+     * 添加客户信息
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("customerBasic:save:customerInfo")
+    @RequestMapping("/save_customer_info")
+    public ResponseJson saveCustomerBasicInfo(HttpServletRequest request,String customerInfoJson,String dockedContactInfoListJson,
+                                              String channelSaleInfoListJson,String billingInfoJson,String ticketOpeningInfoJson) throws Exception {
+        Integer adminId = AdminUtils.getLoginAdminId();
+        JSONArray jsonArray;
+        List<DockedContactInfo> dockedContactInfoList;
+        List<ChannelSaleInfo> channelSaleInfoList;
+        jsonArray = JSONArray.fromObject(dockedContactInfoListJson);
+        dockedContactInfoList = (List) JSONArray.toCollection(jsonArray, DockedContactInfo.class);
+
+        jsonArray = JSONArray.fromObject(channelSaleInfoListJson);
+        channelSaleInfoList = (List) JSONArray.toCollection(jsonArray, ChannelSaleInfo.class);
+        JSONObject customerJsonObject =  JSONObject.fromObject(customerInfoJson);
+        CustomerBasicInfo customerBasicInfo = (CustomerBasicInfo) customerJsonObject.toBean(customerJsonObject,CustomerBasicInfo.class);
+        customerBasicInfo.setIdCreateBy(adminId);
+
+        JSONObject billingInfoJsonObject =  JSONObject.fromObject(billingInfoJson);
+        BillingInfo billingInfo = (BillingInfo) billingInfoJsonObject.toBean(billingInfoJsonObject,BillingInfo.class);
+
+        JSONObject ticketOpeningInfoJsonObject =  JSONObject.fromObject(ticketOpeningInfoJson);
+        TicketOpeningInfo ticketOpeningInfo = (TicketOpeningInfo) ticketOpeningInfoJsonObject.toBean(ticketOpeningInfoJsonObject,TicketOpeningInfo.class);
+        logger.info("-----------------saveCustomerBasicInfo...Start----------------------");
+        ResponseJson rjx = this.isValiData(customerBasicInfo);
+        Boolean isSaveSuccess = false;//是否保存成功标识
+        if(rjx.getResultCode() == 500){
+            return rjx;
+        }
+        logger.info("-----------------添加客户信息开始----------------------");
+        try {
+            customerBasicService.saveCustomerBasicInfo(customerBasicInfo,dockedContactInfoList,channelSaleInfoList,billingInfo,ticketOpeningInfo);
+            isSaveSuccess = true;
+        } catch (RuntimeException e) {
+            isSaveSuccess = false;
+            return new ResponseJson(500, e.getMessage(), 500);
+        }
+        logger.info("-----------------添加客户信息结束----------------------");
+        if (!isSaveSuccess) {
+            return new ResponseJson(500, "添加客户信息失败!", 500);
+        }else{
+            return new ResponseJson(200, "添加客户信息成功!", 200);
+        }
+    }
+
+    /**
+     * 跳转到修改客户信息页面
+     *
+     * @return
+     */
+    @RequiresPermissions("customerBasic:update:customerInfo")
+    @RequestMapping(value = "/_update_customer_info")
+    public ModelAndView updateCustomerInfo(HttpServletRequest request) throws Exception{
+        ModelAndView mv = new ModelAndView("customerInfoAdmin/update_customer_info");
+        String customerId = request.getParameter("customerId");
+        boolean isSuccess = false;
+        if (!StringUtils.isNotEmpty(customerId)) {
+            return mv;
+        }
+        int queryCustomerId = Integer.valueOf(customerId);
+        CustomerBasicInfo customerBasicInfo = new CustomerBasicInfo();
+        List<DockedContactInfo> dockedContactInfoList = new ArrayList<DockedContactInfo>();
+        List<ChannelSaleInfo> channelSaleInfoList = new ArrayList<ChannelSaleInfo>();
+        BillingInfo billingInfo = new BillingInfo();
+        TicketOpeningInfo ticketOpeningInfo = new TicketOpeningInfo();
+        logger.info("-----------------修改客户信息开始----------------------");
+        try {
+            customerBasicInfo = customerBasicService.queryCustomerBasicInfoByCustomerId(queryCustomerId);
+            dockedContactInfoList = customerBasicService.queryDockedContactInfoListByCustomerId(queryCustomerId);
+            channelSaleInfoList = customerBasicService.queryChannelSaleInfoListByCustomerId(queryCustomerId);
+            billingInfo = customerBasicService.queryBillingInfoByCustomerId(queryCustomerId);
+            ticketOpeningInfo = customerBasicService.queryTicketOpeningInfoByCustomerId(queryCustomerId);
+            isSuccess = true;
+        }catch (Exception e){
+            isSuccess = false;
+            logger.error("跳转修改页面失败:"+e.getMessage());
+        }
+        logger.info("----------------修改客户信息结束----------------------");
+        if(!isSuccess){
+            return mv;
+        }else{
+            mv.addObject("customerBasicInfo", customerBasicInfo);
+            mv.addObject("dockedContactInfoList", dockedContactInfoList);
+            mv.addObject("channelSaleInfoList", channelSaleInfoList);
+            mv.addObject("billingInfo", billingInfo);
+            mv.addObject("ticketOpeningInfo", ticketOpeningInfo);
+        }
+        return mv;
+    }
+
+    /**
+     * 修改客户信息
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("customerBasic:update:customerBasic")
+    @RequestMapping("/update_customer_info")
+    public ResponseJson updateCustomerBasicInfo(HttpServletRequest request,String customerInfoJson,String dockedContactInfoListJson,
+                                              String channelSaleInfoListJson,String billingInfoJson,String ticketOpeningInfoJson) throws Exception {
+        Integer adminId = AdminUtils.getLoginAdminId();
+        JSONArray jsonArray;
+        List<DockedContactInfo> dockedContactInfoList;
+        List<ChannelSaleInfo> channelSaleInfoList;
+        jsonArray = JSONArray.fromObject(dockedContactInfoListJson);
+        dockedContactInfoList = (List) JSONArray.toCollection(jsonArray, DockedContactInfo.class);
+
+        jsonArray = JSONArray.fromObject(channelSaleInfoListJson);
+        channelSaleInfoList = (List) JSONArray.toCollection(jsonArray, ChannelSaleInfo.class);
+        JSONObject customerJsonObject =  JSONObject.fromObject(customerInfoJson);
+        CustomerBasicInfo customerBasicInfo = (CustomerBasicInfo) customerJsonObject.toBean(customerJsonObject,CustomerBasicInfo.class);
+        customerBasicInfo.setIdCreateBy(adminId);
+
+        JSONObject billingInfoJsonObject =  JSONObject.fromObject(billingInfoJson);
+        BillingInfo billingInfo = (BillingInfo) billingInfoJsonObject.toBean(billingInfoJsonObject,BillingInfo.class);
+
+        JSONObject ticketOpeningInfoJsonObject =  JSONObject.fromObject(ticketOpeningInfoJson);
+        TicketOpeningInfo ticketOpeningInfo = (TicketOpeningInfo) ticketOpeningInfoJsonObject.toBean(ticketOpeningInfoJsonObject,TicketOpeningInfo.class);
+        ResponseJson rjx = this.isValiData(customerBasicInfo);
+        Boolean isSaveSuccess = false;//是否保存成功标识
+        if(rjx.getResultCode() == 500){
+            return rjx;
+        }
+        logger.info("-----------------修改客户信息开始----------------------");
+            try {
+                customerBasicService.updateCustomerBasicInfo(customerBasicInfo,dockedContactInfoList,channelSaleInfoList,billingInfo,ticketOpeningInfo);
+                isSaveSuccess = true;
+            } catch (RuntimeException e) {
+            isSaveSuccess = false;
+            return new ResponseJson(500, e.getMessage(), 500);
+        }
+        logger.info("-----------------修改客户信息结束----------------------");
+        if (!isSaveSuccess) {
+            return new ResponseJson(500, "修改客户信息失败!", 500);
+        }else{
+            return new ResponseJson(200, "修改客户信息成功!", 200);
+        }
+    }
+
+
+    /**
+     * 查询所有省份
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_provinceList")
+    public ResponseJson queryProvinceList(HttpServletRequest request) {
+        //Province province = new Province();
+        String provinceId =  request.getParameter("provinceListInfo");
+        List<Province> provinceList = null;
+        provinceList = customerBasicService.queryProvinceList(provinceId);
+        if (provinceList != null || provinceList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("provinceList", provinceList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 根据省份代号查询所有城市
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_cityList")
+    public ResponseJson queryCityList(HttpServletRequest request) {
+        //Province province = new Province();
+        String provinceId =  request.getParameter("provinceId");
+        List<City> cityList = null;
+        cityList = customerBasicService.queryCityList(provinceId);
+        if (cityList != null || cityList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("cityList", cityList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 查询所有渠道类别
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_channelCategoryList")
+    public ResponseJson queryChannelCategoryList(HttpServletRequest request) {
+        String channelCategoryId =  request.getParameter("channelCategoryId");
+        List<ChannelDivisionInfo> channelCategoryList = null;
+        channelCategoryList = customerBasicService.queryChannelCategoryList(channelCategoryId);
+        if (channelCategoryList != null || channelCategoryList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("channelCategoryList", channelCategoryList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 根据渠道类别查询渠道类型
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_channelTypeList")
+    public ResponseJson queryChannelTypeList(HttpServletRequest request) {
+        String channelCategoryId =  request.getParameter("channelCategoryId");
+        List<ChannelDivisionInfo> channelTypeList = null;
+        channelTypeList = customerBasicService.queryChannelTypeList(channelCategoryId);
+        if (channelTypeList != null || channelTypeList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("channelTypeList", channelTypeList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 初始化销售产品
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_promotingProductsList")
+    public ResponseJson queryPromotingProductsList(HttpServletRequest request) {
+        String promotingProductsInfo =  request.getParameter("promotingProductsInfo");
+        List<Product> promotingProductsList = null;
+        promotingProductsList = customerBasicService.queryPromotingProductsList(promotingProductsInfo);
+        if (promotingProductsList != null || promotingProductsList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("promotingProductsList", promotingProductsList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 根据销售产品初始化价格
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/query_supplyPriceList")
+    public ResponseJson querySupplyPriceList(HttpServletRequest request) {
+        String promotingProductsId =  request.getParameter("promotingProductsId");
+        List<ProductColor> supplyPriceList = null;
+        supplyPriceList = customerBasicService.querySupplyPriceList(promotingProductsId);
+        if (supplyPriceList != null || supplyPriceList.size() > 0) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("supplyPriceList", supplyPriceList);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
+
+    /**
+     * 验证方法
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public ResponseJson isValiData(CustomerBasicInfo customerBasicInfo) {
+        ResponseJson rj = new ResponseJson();
+        if(customerBasicInfo == null){
+            return new ResponseJson(500, "未填写客户基本信息", 500);
+        }
+        return rj;
+    }
 }

+ 0 - 263
watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicInfoSaveController.java

@@ -1,263 +0,0 @@
-package com.iamberry.rst.controllers.customer;
-
-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.order.ProductType;
-import com.iamberry.rst.faces.customer.CustomerBasicInfoSaveService;
-import com.iamberry.wechat.tools.ResponseJson;
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.servlet.ModelAndView;
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
-
-
-@Controller
-@RequestMapping("/admin/customerBasic")
-public class CustomerBasicInfoSaveController {
-
-    private Logger logger = LoggerFactory.getLogger(CustomerBasicInfoSaveController.class);
-
-    @Autowired
-    private CustomerBasicInfoSaveService customerBasicInfoSaveService;
-
-    /**
-     * 跳转到添加客户信息页面
-     *
-     * @return
-     */
-    @RequiresPermissions("customerBasic:save:customerInfo")
-    @RequestMapping("/saveCustomerInfo")
-    public ModelAndView toAddCustomer(HttpServletRequest request) {
-        ModelAndView mv = new ModelAndView("customer/save_customer_info");
-        return mv;
-    }
-
-    /**
-     * 添加客户信息
-     * @param request
-     * @param customerBasicInfo
-     * @param dockedContactInfoList
-     * @param channelSaleInfoList
-     * @param billingInfo
-     * @param ticketOpeningInfo
-     * @return
-     * @throws Exception
-     */
-    @ResponseBody
-    @RequiresPermissions("customerBasic:save:customerInfo")
-    @RequestMapping("/save_customer_info")
-    public ResponseJson saveCustomerBasicInfo(HttpServletRequest request, CustomerBasicInfo customerBasicInfo, List<DockedContactInfo> dockedContactInfoList,
-                                              List<ChannelSaleInfo> channelSaleInfoList,BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception {
-        ResponseJson rjx = this.isValiData(customerBasicInfo);
-        Boolean isSaveSuccess = false;//是否保存成功标识
-        if(rjx.getResultCode() == 500){
-            return rjx;
-        }
-        logger.info("-----------------添加客户信息开始----------------------");
-        try {
-            customerBasicInfoSaveService.saveCustomerBasicInfo(customerBasicInfo,dockedContactInfoList,channelSaleInfoList,billingInfo,ticketOpeningInfo);
-            isSaveSuccess = true;
-        } catch (RuntimeException e) {
-            isSaveSuccess = false;
-            return new ResponseJson(500, e.getMessage(), 500);
-        }
-        logger.info("-----------------添加客户信息结束----------------------");
-        if (!isSaveSuccess) {
-            return new ResponseJson(500, "添加客户信息失败!", 500);
-        }else{
-            return new ResponseJson(200, "添加客户信息成功!", 200);
-        }
-    }
-
-    /**
-     * 跳转到修改客户信息页面
-     *
-     * @return
-     */
-    @RequiresPermissions("customerBasic:save:customerInfo")
-    @RequestMapping(value = "/update_customer_info")
-    public ModelAndView updateCustomerInfo(HttpServletRequest request) throws Exception{
-        ModelAndView mv = new ModelAndView("customerInfoAdmin/update_customer_info");
-        String customerId = request.getParameter("customerId");
-        boolean isSuccess = false;
-        if (!StringUtils.isNotEmpty(customerId)) {
-            return mv;
-        }
-        int queryCustomerId = Integer.valueOf(customerId);
-        CustomerBasicInfo customerBasicInfo = new CustomerBasicInfo();
-        List<DockedContactInfo> dockedContactInfoList = new ArrayList<DockedContactInfo>();
-        List<ChannelSaleInfo> channelSaleInfoList = new ArrayList<ChannelSaleInfo>();
-        BillingInfo billingInfo = new BillingInfo();
-        TicketOpeningInfo ticketOpeningInfo = new TicketOpeningInfo();
-        logger.info("-----------------修改客户信息开始----------------------");
-        try {
-            customerBasicInfo = customerBasicInfoSaveService.queryCustomerBasicInfoByCustomerId(queryCustomerId);
-            dockedContactInfoList = customerBasicInfoSaveService.queryDockedContactInfoListByCustomerId(queryCustomerId);
-            channelSaleInfoList = customerBasicInfoSaveService.queryChannelSaleInfoListByCustomerId(queryCustomerId);
-            billingInfo = customerBasicInfoSaveService.queryBillingInfoByCustomerId(queryCustomerId);
-            ticketOpeningInfo = customerBasicInfoSaveService.queryTicketOpeningInfoByCustomerId(queryCustomerId);
-            isSuccess = true;
-        }catch (Exception e){
-            isSuccess = false;
-            logger.error("跳转修改页面失败:"+e.getMessage());
-        }
-        logger.info("----------------修改客户信息结束----------------------");
-        if(!isSuccess){
-            return mv;
-        }else{
-            mv.addObject("customerBasicInfo", customerBasicInfo);
-            mv.addObject("dockedContactInfoList", dockedContactInfoList);
-            mv.addObject("channelSaleInfoList", channelSaleInfoList);
-            mv.addObject("billingInfo", billingInfo);
-            mv.addObject("ticketOpeningInfo", ticketOpeningInfo);
-        }
-        return mv;
-    }
-
-    /**
-     * 查询所有省份
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_provinceList")
-    public ResponseJson queryProvinceList(HttpServletRequest request) {
-        //Province province = new Province();
-        String provinceId =  request.getParameter("provinceListInfo");
-        List<Province> provinceList = null;
-        provinceList = customerBasicInfoSaveService.queryProvinceList(provinceId);
-        if (provinceList != null || provinceList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("provinceList", provinceList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 根据省份代号查询所有城市
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_cityList")
-    public ResponseJson queryCityList(HttpServletRequest request) {
-        //Province province = new Province();
-        String provinceId =  request.getParameter("provinceId");
-        List<City> cityList = null;
-        cityList = customerBasicInfoSaveService.queryCityList(provinceId);
-        if (cityList != null || cityList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("cityList", cityList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 查询所有渠道类别
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_channelCategoryList")
-    public ResponseJson queryChannelCategoryList(HttpServletRequest request) {
-        String channelCategoryId =  request.getParameter("channelCategoryId");
-        List<ChannelDivisionInfo> channelCategoryList = null;
-        channelCategoryList = customerBasicInfoSaveService.queryChannelCategoryList(channelCategoryId);
-        if (channelCategoryList != null || channelCategoryList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("channelCategoryList", channelCategoryList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 根据渠道类别查询渠道类型
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_channelTypeList")
-    public ResponseJson queryChannelTypeList(HttpServletRequest request) {
-        String channelCategoryId =  request.getParameter("channelCategoryId");
-        List<ChannelDivisionInfo> channelTypeList = null;
-        channelTypeList = customerBasicInfoSaveService.queryChannelTypeList(channelCategoryId);
-        if (channelTypeList != null || channelTypeList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("channelTypeList", channelTypeList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 初始化销售产品
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_promotingProductsList")
-    public ResponseJson queryPromotingProductsList(HttpServletRequest request) {
-        String promotingProductsInfo =  request.getParameter("promotingProductsInfo");
-        List<Product> promotingProductsList = null;
-        promotingProductsList = customerBasicInfoSaveService.queryPromotingProductsList(promotingProductsInfo);
-        if (promotingProductsList != null || promotingProductsList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("promotingProductsList", promotingProductsList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 根据销售产品初始化价格
-     *
-     * @return
-     */
-    @ResponseBody
-    @RequestMapping(value = "/query_supplyPriceList")
-    public ResponseJson querySupplyPriceList(HttpServletRequest request) {
-        String promotingProductsId =  request.getParameter("promotingProductsId");
-        List<ProductColor> supplyPriceList = null;
-        supplyPriceList = customerBasicInfoSaveService.querySupplyPriceList(promotingProductsId);
-        if (supplyPriceList != null || supplyPriceList.size() > 0) {
-            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
-            rj.addResponseKeyValue("supplyPriceList", supplyPriceList);
-            return rj;
-        } else {
-            return new ResponseJson(500, "查询失败", 500);
-        }
-    }
-
-    /**
-     * 验证方法
-     *
-     * @param customerBasicInfo
-     * @return
-     */
-    public ResponseJson isValiData(CustomerBasicInfo customerBasicInfo) {
-        ResponseJson rj = new ResponseJson();
-        if(customerBasicInfo == null){
-            return new ResponseJson(500, "未填写客户基本信息", 500);
-        }
-        return rj;
-    }
-}

+ 3 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -609,6 +609,7 @@ public class AdminMachineController {
     }
 
 
+    private String producePattern = "WA";//产品型号
     private String productModel = "1X";//产品型号
     private String productFeatures = "A";//产品特性
     private String softwareVersion = "30";//软件版本
@@ -623,10 +624,11 @@ public class AdminMachineController {
         if (month < 10) {
             months = "0" + months;
         }
+        producePattern = produce.getProducePattern();
         productModel = produce.getProduceModel();
         productFeatures = produce.getProduceFeature();
         //拼接
-        String barcode = productModel + productFeatures + softwareVersion + String.valueOf(year).substring(2, 4) + months;
+        String barcode = producePattern + productModel + productFeatures +  String.valueOf(year).substring(2, 4) + months;
         return barcode;
     }
 

+ 35 - 35
watero-rst-web/src/main/webapp/WEB-INF/views/customer/custome_basic_detail.ftl

@@ -61,15 +61,15 @@
             </div>
         </div>
         <div class="row cl">
-            <label class="form-label col-2 col-sm-2">客户类型:</label>
-            <div class="formControls col-4 col-sm-4">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">客户类型:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
 				<label>
                     <#if customerBasicInfo.customerType == 1>个人</#if>
                     <#if customerBasicInfo.customerType == 2>企业</#if>
                 </label>
             </div>
-            <label class="form-label col-2 col-sm-2">合作进度:</label>
-            <div class="formControls col-4 col-sm-4">
+            <label class="form-label col-2 col-sm-2"style="padding:0 0;">合作进度:</label>
+            <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                 <label>
                     <#if customerBasicInfo.cooperativeState == 1>意向合作</#if>
                     <#if customerBasicInfo.cooperativeState == 2>已经合作</#if>
@@ -78,22 +78,22 @@
             </div>
         </div>
         <div class="row cl">
-            <label class="form-label col-2 col-sm-2">客户名称:</label>
-            <div class="formControls col-4 col-sm-4">
+            <label class="form-label col-2 col-sm-2"style="padding:0 0;">客户名称:</label>
+            <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                 <label>
                     ${customerBasicInfo.customerName!''}
                 </label>
             </div>
-            <label class="form-label col-2 col-sm-2">客户行业:</label>
-            <div class="formControls col-4 col-sm-4">
+            <label class="form-label col-2 col-sm-2"style="padding:0 0;">客户行业:</label>
+            <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                 <label>
                     ${customerBasicInfo.customerIndustry!''}
                 </label>
             </div>
         </div>
         <div class="row cl" style="position: relative;">
-            <label class="form-label col-2 col-sm-2">客户地址:</label>
-            <div class="formControls col-4 col-sm-4">
+            <label class="form-label col-2 col-sm-2"style="padding:0 0;">客户地址:</label>
+            <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                 <label>
                 ${customerBasicInfo.provinceName!''}-${customerBasicInfo.cityName!''}-${customerBasicInfo.customerAddress!''}
                 </label>
@@ -222,26 +222,26 @@
         </div>
         <#if billingInfo??>
             <div class="row cl">
-                <label class="form-label col-2 col-sm-2">开户支行:</label>
-                <div class="formControls col-2 col-sm-2">
+                <label class="form-label col-2 col-sm-2"style="padding:0 0;">开户支行:</label>
+                <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                     <label>${billingInfo.accountOpeningBranch!''}</label>
                 </div>
-                <label class="form-label col-2 col-sm-2">账户名称:</label>
-                <div class="formControls col-2 col-sm-2">
+                <label class="form-label col-2 col-sm-2"style="padding:0 0;">账户名称:</label>
+                <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                     <label>${billingInfo.accountName!''}</label>
                 </div>
-                <label class="form-label col-2 col-sm-2">账号:</label>
-                <div class="formControls col-2 col-sm-2">
+                <label class="form-label col-2 col-sm-2"style="padding:0 0;">账号:</label>
+                <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                     <label>${billingInfo.accountNum!''}</label>
                 </div>
             </div>
             <div class="row cl">
-                <label class="form-label col-2 col-sm-2">收款人姓名:</label>
-                <div class="formControls col-4 col-sm-4">
+                <label class="form-label col-2 col-sm-2"style="padding:0 0;">收款人姓名:</label>
+                <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                     <label>${billingInfo.receivablesName!''}</label>
                 </div>
-                <label class="form-label col-2 col-sm-2">收款人电话:</label>
-                <div class="formControls col-4 col-sm-4">
+                <label class="form-label col-2 col-sm-2"style="padding:0 0;">收款人电话:</label>
+                <div class="formControls col-2 col-sm-2"style="padding:0 0;">
                     <label>${billingInfo.receivablesPhone!''}</label>
                 </div>
             </div>
@@ -261,46 +261,46 @@
         </div>
         <#if ticketOpeningInfo??>
         <div class="row cl">
-            <label class="form-label col-2 col-sm-2">发票类型:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">发票类型:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>
                 <#if ticketOpeningInfo.ticketType == 1>专票</#if>
                 <#if ticketOpeningInfo.ticketType == 2>普票</#if>
                 </label>
             </div>
-            <label class="form-label col-2 col-sm-2">开户支行:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">开户支行:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.accountOpeningBranch!''}</label>
             </div>
-            <label class="form-label col-2 col-sm-2">开票账号:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">开票账号:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.ticketOpeningAccount!''}</label>
             </div>
         </div>
 
         <div class="row cl">
-            <label class="form-label col-2 col-sm-2">企业名称:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">企业名称:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.enterpriseName!''}</label>
             </div>
-            <label class="form-label col-2 col-sm-2">纳税人识别号:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">纳税人识别号:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.taxpayerIdentificationNum!''}</label>
             </div>
-            <label class="form-label col-2 col-sm-2">开票电话:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">开票电话:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.ticketOpeningPhone!''}</label>
             </div>
         </div>
         <div class="row cl">
-            <label class="form-label col-2 col-sm-2">企业地址:</label>
-            <div class="formControls col-2 col-sm-2">
+            <label class="form-label col-2 col-sm-2" style="padding:0 0;">企业地址:</label>
+            <div class="formControls col-2 col-sm-2" style="padding:0 0;">
                 <label>${ticketOpeningInfo.enterpriseAddress!''}</label>
             </div>
         </div>
         <#else>
             <div class="row cl">
-                <label class="form-label col-2 col-sm-2"> 不需开票</label>
+                <label class="form-label col-2 col-sm-2" style="padding:0 0;"> 不需开票</label>
             </div>
         </#if>
         <div class="row cl">

+ 24 - 6
watero-rst-web/src/main/webapp/WEB-INF/views/customer/customer_basic_list.ftl

@@ -14,7 +14,13 @@
             .table-bg thead th{background-color: #e2f6ff;}
             input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
             input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
-		</style>
+            .txt2{
+                width:60px;
+                overflow: hidden;
+                white-space: nowrap;
+                text-overflow: ellipsis;
+            }
+        </style>
 	</head>
 	<body>
     <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
@@ -44,7 +50,7 @@
                         </#if>
                     </select>
                     <select class="my-select" name="cooperativeState">
-                        <option value ="1">合作状态</option>
+                        <option value ="">合作状态</option>
                     <#if cooperativeState??>
                         <option value ="1" <#if cooperativeState == 1>selected</#if>>意向合作</option>
                         <option value ="2" <#if cooperativeState == 2>selected</#if>>已经合作</option>
@@ -118,18 +124,23 @@
                             <td class="text-c" width="100">
                                 ${list.provinceName!''}-${list.cityName!''}
                             </td>
-                            <td class="text-c" width="50">${list.customerRemarks!''}</td>
+                            <td class="text-c" width="50">
+                                <span class="txt2" style="display: inline-block;padding: 2px 4px;font-size: 11.844px;" title="${list.customerRemarks!''}" >${list.customerRemarks!''}</span>
+                            </td>
                             <td class="text-c" width="100">${(list.createDate?string("yyyy-MM-dd"))!''}</td>
 							<!-- 遍历操作 -->
 							<td class="td-manage text-c">
+                                <#if !isSelectAll?? ||(isSelectAll != 2) || (adminId == list.idCreateBy)>
+                                        <a href="#" onclick="customerDetail(${list.customerId!''})">详情</a>
+                                </#if>
+                                <#if adminId == list.idCreateBy>
+                                    <a href="#" onclick="customerupdate(${list.customerId!''})">修改</a>
+                                </#if>
                                 <#if list.customerStatus == 2>
                                     <#if adminId == list.idCreateBy>
                                         <a href="#" onclick="deleteState(${list.customerId!''})">删除</a>
                                     </#if>
                                 </#if>
-                                <#if !isSelectAll?? ||(isSelectAll != 2) || (adminId == list.idCreateBy)>
-                                        <a href="#" onclick="customerDetail(${list.customerId!''})">详情</a>
-                                </#if>
                             </td>
 						</tr>
 					</#list>
@@ -183,6 +194,13 @@
             function customerDetail(customerId) {
                 window.location.href= "${path}/admin/customerBasic/customer_Basic_Detail?customerId="+customerId;
             }
+            /**
+             *跳转到修改页面
+             * @param employee
+             */
+            function customerupdate(customerId) {
+                window.location.href= "${path}/admin/customerBasic/to_update_customer_Basic?customerId="+customerId;
+            }
         </script>
 	</body>
 </html>

+ 530 - 73
watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl

@@ -48,6 +48,7 @@
         .update-parts>span{margin-right: 10px;padding: 3px 4px;background-color: #effaff;border: 1px solid #32a3d8;}
         .my-search-input{padding-left: 30px;background: url(${path}/common/images/cm/search.png) 6px center no-repeat;background-size: auto 60%; }
         .txt-red{color:red}
+        .centen{text-align:center;}
     </style>
     <title>增加客户信息</title>
 </head>
@@ -60,7 +61,7 @@
 <div class="pd-20 cl">
     <form action="${path}/admin/customerBasic/saveCustomerInfo" method="post">
     <#--<form action="${path}/admin/customerBasic/save_customer_info" method="post" class="form form-horizontal" id="form-customerInfoAdmin-add"  onkeydown="if(event.keyCode==13)return false;">-->
-        <input type="hidden" id="isNeedSelectOrder" name="isNeedSelectOrder" value="">
+        <input type="hidden" id="saveCustomerInfo" name="saveCustomerInfo" value="">
         <#--客户基本信息 start-->
         <div class="row cl">
             <label class="form-label col-2">
@@ -70,7 +71,7 @@
             </div>
         </div>
         <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>客户类型:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;"><span class="c-red">*</span>客户类型:</label>
             <div class="formControls col-4 col-sm-4">
                  <span class="select-box">
                         <select name="customerType" class="select">
@@ -79,7 +80,7 @@
                         </select>
                  </span>
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>合作进度:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;"><span class="c-red">*</span>合作进度:</label>
             <div class="formControls col-4 col-sm-4">
                 <span class="select-box">
                         <select name="cooperativeState" class="select">
@@ -91,17 +92,17 @@
             </div>
         </div>
         <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>客户名称:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;"><span class="c-red">*</span>客户名称:</label>
             <div class="formControls col-4 col-sm-4">
                 <input type="text" class="input-text trim_input" placeholder="公司/客户 全称" id="customerName" name="customerName" value="">
             </div>
-            <label class="form-label col-2 col-sm-2">客户行业:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;">客户行业:</label>
             <div class="formControls col-4 col-sm-4">
                 <input type="text" class="input-text trim_input" placeholder="请输入行业名称" id="customerIndustry" name="customerIndustry" value="">
             </div>
         </div>
         <div class="row cl" style="position: relative;margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>客户地址:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;"><span class="c-red">*</span>客户地址:</label>
             <div class="formControls col-4 col-sm-4">
                 <span class="select-box">
                         <select name="customerProvinceCode" class="select">
@@ -118,7 +119,7 @@
             </div>
         </div>
         <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"></label>
+            <label class="form-label col-2 col-sm-2" style="width: 110px;"></label>
             <div class="formControls col-9 col-sm-9">
                 <input type="text" class="input-text trim_input" placeholder="请输入客户的详细地址" id="customerAddress" name="customerAddress" value="">
             </div>
@@ -126,7 +127,7 @@
         <#--客户基本信息 end-->
         <#--对接联系人信息-->
         <div class="row cl">
-            <label class="form-label col-3">
+            <label class="form-label col-9">
                 <div class="tit-2">对接联系人信息<span style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:14px;">(请确保真实性,公司将不定期抽验回访)</span></div>
             </label>
             <div class="formControls col-9">
@@ -134,13 +135,14 @@
         </div>
         <div class="row cl">
             <div class="formControls col-9">
-                <span class="c-red">*</span>姓名:<input type="text" class="input-text"  style="width:90px;margin-right: 10px; margin-bottom: 10px;" placeholder="联系人姓名" id="contactName" name="contactName">
-                <span class="c-red">*</span>电话:<input type="text" class="input-text"  style="width:90px;margin-right: 10px;margin-bottom: 10px;"  placeholder="联系人电话" id="contactPhone" name="contactPhone">
-                <span class="c-red">*</span>职位/身份:<input type="text" class="input-text"  style="width:90px;margin-right: 10px;margin-bottom: 10px;"  placeholder="职位或身份" id="contactType" name="contactType">
-                <span class="c-red">*</span>联系邮箱:<input type="text" class="input-text"  style="width:90px;margin-right: 10px;margin-bottom: 10px;"  placeholder="邮箱" id="contactEmail" name="contactEmail">
+                <span class="c-red">*</span>姓名:<input type="text" class="input-text"  style="width:100px;margin-right: 10px; margin-bottom: 10px;" placeholder="联系人姓名" id="contactName" name="contactName">
+                <span class="c-red">*</span>电话:<input type="text" class="input-text"  style="width:100px;margin-right: 10px;margin-bottom: 10px;"  placeholder="联系人电话" id="contactPhone" name="contactPhone">
+                <span class="c-red">*</span>职位/身份:<input type="text" class="input-text"  style="width:100px;margin-right: 10px;margin-bottom: 10px;"  placeholder="职位或身份" id="contactType" name="contactType">
+                <span class="c-red">*</span>联系邮箱:<input type="text" class="input-text"  style="width:100px;margin-right: 10px;margin-bottom: 10px;"  placeholder="邮箱" id="contactEmail" name="contactEmail">
                 <span class="c-red"><button type="button" style="cursor:pointer; float: right;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddDockedContactInfo();">保存</button></span>
             </div>
             <div class="mt-20" style="margin: 20px;">
+                <input type="hidden" id="dockedContactInfoJson" name="dockedContactInfoJson">
                 <table class="table table-border table-bordered table-bg table-hover table-sort" id="contactTable">
                     <thead>
                     <tr class="text-c">
@@ -151,8 +153,8 @@
                         <th width="100">操作</th>
                     </tr>
                     </thead>
-                    <tbody id="listid">
-                        <tr><td colspan="5" class="td-manage text-c" >暂时没有联系人信息,请添加!</td></tr>
+                    <tbody id="contactListId">
+                        <tr><td colspan="5" class="td-manage text-c" id="contactTbodyId" >暂时没有联系人信息,请添加!</td></tr>
                     </tbody>
                 </table>
             </div>
@@ -166,41 +168,47 @@
             </div>
         </div>
         <div class="row cl">
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>渠道类别:</label>
-            <div class="formControls col-1 col-sm-1">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>渠道类别:</label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
                 <span class="select-box">
                     <select name="channelCategory" id="channelCategory" class="select">
+                        <#--<option value="1">电商</option>
+                        <option value="2">特殊渠道</option>
+                        <option value="3">线下</option>
+                        <option value="4">海外</option>-->
                     </select>
                 </span>
             </div>
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>渠道类型:</label>
-            <div class="formControls col-1 col-sm-1">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>渠道类型:</label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
                 <span class="select-box">
                     <select name="channelType" id="channelType" class="select">
                     </select>
                 </span>
             </div>
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>渠道名称:</label>
-            <div class="formControls col-1 col-sm-1">
-                <input type="text" class="input-text"  style="width:90px;margin-right: 0px;margin-bottom: 10px;"  placeholder="填写具体店名" id="channelName" name="channelName">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>渠道名称:</label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
+                <input type="text" class="input-text"  placeholder="填写具体店名" id="channelName" name="channelName">
             </div>
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>销售产品:</label>
-            <div class="formControls col-1 col-sm-1">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>销售产品:</label>
+            <div class="formControls col-2 col-sm-2" style="width:180px; padding:0px 0px; margin-right: 15px;">
                 <span class="select-box">
                     <select name="promotingProducts" id="promotingProducts" class="select">
                     </select>
                 </span>
             </div>
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>供货价格:</label>
-            <div class="formControls col-1 col-sm-1">
+        </div>
+        <div class="row cl">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>供货价格:</label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
                 <span class="select-box">
                     <select name="supplyPrice" id="supplyPrice" class="select">
                     </select>
                 </span>
-                    <input type="text" class="input-text"  style="width:90px;margin-right: 0px;margin-bottom: 10px;"  placeholder="填写供货价格" id="supplyPrice" name="supplyPrice">
+                    <input type="text" class="input-text"  style="width:120px;margin-right: 0px;margin-bottom: 10px;"  placeholder="手动填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice">
             </div>
-            <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>账期:</label>
-            <div class="formControls col-1 col-sm-1">
+            <label class="form-label col-2 col-sm-2" style="width:120px;"><span class="c-red">*</span>账期:</label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
                 <span class="select-box">
                     <select name="accountPeriod" id="accountPeriod" class="select">
                         <option value="1">先款</option>
@@ -209,8 +217,16 @@
                     </select>
                 </span>
             </div>
-            <button type="button" style="cursor:pointer; float: right;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddChannelSaleInfo();">保存</button>
+
+            <label class="form-label col-2 col-sm-2" style="width:150px;">
+                <button type="button" style="cursor:pointer; float: right;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddChannelSaleInfo();">保存</button>
+            </label>
+            <div class="formControls col-2 col-sm-2" style="width:120px; padding:0px 0px;margin-right: 15px;">
+
+            </div>
+
             <div class="mt-20" style="margin: 20px;">
+                <input type="hidden" id="channelSaleInfoJson" name="channelSaleInfoJson">
                 <table class="table table-border table-bordered table-bg table-hover table-sort" id="saleTable">
                     <thead>
                     <tr class="text-c">
@@ -223,55 +239,66 @@
                         <th width="100">操作</th>
                     </tr>
                     </thead>
-                    <tbody id="listid">
-                    <tr><td colspan="7" class="td-manage text-c" >暂时没有联系人信息,请添加!</td></tr>
+                    <tbody id="channelSaleListId">
+                        <tr><td colspan="7" class="td-manage text-c" id="channelTbodyId" >暂时没有客户销售渠道信息,请添加!</td></tr>
                     </tbody>
                 </table>
             </div>
         </div>
         <#--付款/退款信息-->
         <div class="row cl">
-            <label class="form-label col-3">
+            <label class="form-label col-9">
                 <div class="tit-2">付款/退款信息<span style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:14px;">(请真实有效,用于财务收款确认或退款业务)</span></div>
             </label>
             <div class="formControls col-9">
             </div>
         </div>
         <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开户支行:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 125px;"><span class="c-red">*</span>开户支行:</label>
             <div class="formControls col-2 col-sm-2">
-                <input type="text" class="input-text trim_input" placeholder="开户支行" id="accountOpeningBranch" name="accountOpeningBranch" value="">
+                <input type="text" class="input-text trim_input" placeholder="开户支行" id="billAccountOpeningBranch" name="billAccountOpeningBranch" value="">
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>账户名称:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 125px;"><span class="c-red">*</span>账户名称:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="账户名称" id="accountName" name="accountName" value="">
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>账号:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 125px;"><span class="c-red">*</span>账号:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="填写账号" id="accountNum" name="accountNum" value="">
             </div>
         </div>
         <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>收款人姓名:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 125px;"><span class="c-red">*</span>收款人姓名:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="收款人姓名" id="receivablesName" name="receivablesName" value="">
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>收款人手机:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 125px;"><span class="c-red">*</span>收款人手机:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="收款人手机" id="receivablesPhone" name="receivablesPhone" value="">
             </div>
         </div>
 
         <#--开票信息-->
-        <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-3">
-                <div class="tit-2">开票信息</div>
+        <div class="row cl" style="margin-bottom: 10px;" >
+            <label class="form-label col-9 skin-minimal">
+                <span class="tit-2">开票信息</span><span class="c-red">&nbsp;&nbsp;&nbsp;*</span>是否开票
+                <div class="radio-box">
+                    <input type="radio" id="isOpenTicket-1" class="isShowOpenTicket" name="isOpenTicket" value="0" checked="checked"  >
+                    <label for="isOpenTicket-1">开票</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="isOpenTicket-2" class="isShowOpenTicket" name="isOpenTicket" value="1"   >
+                    <label for="isOpenTicket-2">不开票</label>
+                </div>
+                <#--<div class="radio-box"><input type="radio" name="isOpenTicket" value="1" checked="checked">开票</div>
+                <div class="radio-box"><input type="radio" name="isOpenTicket" value="2">不开票</div>-->
             </label>
-            <div class="formControls col-9">
+            <div class="formControls col-3">
             </div>
         </div>
-        <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>发票类型:</label>
+
+        <div class="row cl" style="margin-bottom: 10px;" id="isShowOpenTicket">
+            <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red">*</span>发票类型:</label>
             <div class="formControls col-2 col-sm-2">
                 <span class="select-box">
                     <select name="ticketType" class="select">
@@ -280,32 +307,32 @@
                     </select>
                 </span>
             </div>
-                <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开户支行:</label>
+                <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red normalTicketType">*</span>开户支行:</label>
                 <div class="formControls col-2 col-sm-2 skin-minimal">
-                    <input type="text" class="input-text trim_input" placeholder="开户支行名称" id="accountOpeningBranch" name="accountOpeningBranch" value="">
+                    <input type="text" class="input-text trim_input" placeholder="开户支行名称" id="ticketAccountOpeningBranch" name="ticketAccountOpeningBranch" value="">
                 </div>
-                <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开票账户:</label>
+                <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red normalTicketType">*</span>开票账户:</label>
                 <div class="formControls col-2 col-sm-2 skin-minimal">
                     <input type="text" class="input-text trim_input" placeholder="开票账户" id="ticketOpeningAccount" name="ticketOpeningAccount" value="">
                 </div>
             </div>
-        <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>企业名称:</label>
+        <div class="row cl" style="margin-bottom: 10px;" id="isShowEnterprise">
+            <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red">*</span>企业名称:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="企业名称" id="enterpriseName" name="enterpriseName" value="">
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>纳税人识别号:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 140px;"><span class="c-red">*</span>纳税人识别号:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="纳税人识别号" id="taxpayerIdentificationNum" name="taxpayerIdentificationNum" value="">
             </div>
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开票电话:</label>
+            <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red normalTicketType">*</span>开票电话:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="开票电话" id="ticketOpeningPhone" name="ticketOpeningPhone" value="">
             </div>
         </div>
-        <div class="row cl" style="margin-bottom: 10px;">
-            <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>企业地址:</label>
-            <div class="formControls col-2 col-sm-2 skin-minimal">
+        <div class="row cl" style="margin-bottom: 10px;" id="isShowAddress">
+            <label class="form-label col-2 col-sm-2" style="width: 120px;"><span class="c-red normalTicketType">*</span>企业地址:</label>
+            <div class="formControls col-2 col-sm-2 skin-minimal" style="width: 1105px;">
                 <input type="text" class="input-text trim_input" placeholder="企业地址" id="enterpriseAddress" name="enterpriseAddress" value="">
             </div>
         </div>
@@ -324,24 +351,32 @@
             <label class="form-label">
             </label>
             <div class="formControls col-9">
-                <textarea id="customerRemarks" name="customerRemarks" ></textarea>
+                <textarea id="customerRemarks"  style="width: 100%;height: 100px;" name="customerRemarks" ></textarea>
             </div>
         </div>
         <#--添加保存按钮-->
-        <!-- Unnamed (矩形) -->
-        <div id="u29" class="ax_default _三级标题">
-            <div id="u29_div" class=""></div>
-            <!-- Unnamed () -->
-            <div id="u30" class="text" style="visibility: visible;">
-                <p><span onclick="addCustomerBasicInfo()">添加客户信息</span></p>
+
+        <div  class="row cl">
+            <label class="form-label col-5 col-sm-5"></label>
+            <div class="formControls col-5 col-sm-5 skin-minimal">
+                <span class="c-red"><button type="button" style="cursor:pointer; float: inherit;height: 35px;margin-right: 30px;margin-bottom: 10px;margin-top: 20px;" class="my-btn-search" onclick="addCustomerBasicInfo();">确认提交</button></span>
             </div>
         </div>
     </form>
 </div>
+<script>
+    $('.skin-minimal input').iCheck({
+        checkboxClass: 'icheckbox-blue',
+        radioClass: 'iradio-blue',
+        increaseArea: '20%'
+    });
+</script>
 
 <#--业务js-->
 <#--<script type="text/javascript" src="${path}/common/js/customerSaveAdmin/save_customer_info.js"></script>-->
 <script>
+    $("#writeSupplyPrice").hide();//隐藏手动输入产品价格框
+
     /*初始化页面参数*/
     $(function () {
         /* 初始化单选框样式 */
@@ -370,6 +405,26 @@
         $("[name='promotingProducts']").change(function (){
             initSupplyPrice($(this).val());
         })
+
+        /*监听产品价格选择*/
+        $("[name='supplyPrice']").change(function (){
+            changeSupplyPrice($(this).val());
+        })
+
+        /*监听来源入口选择事件*/
+        $('.isShowOpenTicket').on('ifChecked', function(event){
+            var isOpenTicket = $("input[name='isOpenTicket']:checked").val();
+            isShowOpenTicket(isOpenTicket);
+        });
+        /*监听发票类型*/
+        $("[name='ticketType']").change(function (){
+            isShowRedStar($(this).val());
+        })
+        /*监听输入的价格*/
+        /*$("[name='writeSupplyPrice']").change(function (){
+            writeSupplyPrice($(this).val());
+        })*/
+
     })
 
     /*业务逻辑js控制 start*/
@@ -380,6 +435,27 @@
         $(".dalog-ask").hide();
     });
 
+    function isShowOpenTicket(isOpenTicket) {
+        if(isOpenTicket == "1"){
+            $("#isShowOpenTicket").hide();
+            $("#isShowEnterprise").hide();
+            $("#isShowAddress").hide();
+        }else{
+            $("#isShowOpenTicket").show();
+            $("#isShowEnterprise").show();
+            $("#isShowAddress").show();
+        }
+    }
+
+    function isShowRedStar(ticketType) {
+        if(ticketType == "1"){
+            $(".normalTicketType").show();
+
+        }else{
+            $(".normalTicketType").hide();
+
+        }
+    }
     /*初始化省份*/
     function initProvince() {
         //默认查询参数为空
@@ -447,6 +523,7 @@
     /*初始化渠道类别*/
     function initChannelCategory() {
         //默认查询参数为空
+        var id;
         var channelCategoryListInfo = null;
         $.ajax({
             type: "POST",
@@ -456,8 +533,7 @@
             url: "${path}/admin/customerBasic/query_channelCategoryList",
             async: true,
             success: function(data){
-                var html = '<option value="">请选择渠道类别</option>';
-                var id;
+                var html = '';
                 if (data.returnCode == 200) {
                     for(var i=0;i<data.returnMsg.channelCategoryList.length;i++){
                         channelCategoryListInfo = data.returnMsg.channelCategoryList[i];
@@ -474,6 +550,7 @@
             error: function(XmlHttpRequest, textStatus, errorThrown){
             }
         });
+        initChannelType(id);
     }
 
     /*根据渠道类别初始化渠道类型*/
@@ -491,7 +568,8 @@
                 url: "${path}/admin/customerBasic/query_channelTypeList",
                 async: true,
                 success: function(data){
-                    var html = '<option value="">请选择渠道类型</option>';
+                    //var html = '<option value="">请选择渠道类型</option>';
+                    var html = '';
                     if (data.returnCode == 200) {
                         for(var i=0;i<data.returnMsg.channelTypeList.length;i++){
                             channelTypeListInfo = data.returnMsg.channelTypeList[i];
@@ -520,6 +598,7 @@
             async: true,
             success: function(data){
                 var html = '<option value="">请选择销售产品</option>';
+                //var html = '';
                 var id;
                 if (data.returnCode == 200) {
                     for(var i=0;i<data.returnMsg.promotingProductsList.length;i++){
@@ -544,7 +623,7 @@
         //var supplyPriceInfo = null;
         if(promotingProductsId == null || promotingProductsId == ""){
             var html = '<option value="">请选择销售产品</option>';
-            $("[name='promotingProducts']").html(html);
+            //$("[name='promotingProducts']").html(html);
         }else{
             $.ajax({
                 type: "POST",
@@ -554,16 +633,20 @@
                 url: "${path}/admin/customerBasic/query_supplyPriceList",
                 async: true,
                 success: function(data){
-                    var html = '<option value="">请选择产品价格</option>';
+                    //var html = '<option value="">手动输入产品价格</option>';
+                    var html = '';
+                    var chose = "手动输入产品价格"
                     if (data.returnCode == 200) {
                         for(var i=0;i<data.returnMsg.supplyPriceList.length;i++){
                             var supplyPriceInfo = data.returnMsg.supplyPriceList[i];
-                            html += '<option value="'+ supplyPriceInfo.colorId +'">'+ supplyPriceInfo.colorPrice +'</option>';
+                            html += '<option value="'+ supplyPriceInfo.colorPrice/100 +'">'+ supplyPriceInfo.colorPrice/100 +'</option>';
                         }
+                        html += '<option value="00">'+ chose +'</option>';
                     }else{
                         html = '';
                     }
                     $("[name='supplyPrice']").html(html);
+                    //$("#writeSupplyPrice").show();
                 },
                 error: function(XmlHttpRequest, textStatus, errorThrown){
                 }
@@ -571,75 +654,449 @@
         }
     }
 
+    /*监听产品价格选项*/
+    function changeSupplyPrice(supplyPrice){
+        if(supplyPrice == "00"){
+            $("#writeSupplyPrice").show();
+        }else{
+            $("#writeSupplyPrice").hide();
+        }
+    }
+
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
         var contactName = document.getElementById("contactName").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactType = document.getElementById("contactType").value;
         var contactEmail = document.getElementById("contactEmail").value;
+        if(contactName == "" || contactName == null ){
+            //alert("联系人姓名不能为空");
+            layer.msg("联系人姓名不能为空",{icon:2,time:2000});
+            return;
+        }
+        if(contactPhone == "" || contactPhone == null ){
+            //alert("电话不能为空");
+            layer.msg("电话不能为空",{icon:2,time:1000});
+            return;
+        }else{
+            //var reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
+            var reg =  /^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})$/
+            if(!reg.test(contactPhone)){
+                layer.msg("请填写正确的手机号码!", {icon: 5, time: 3000});
+                return;
+            }
+        }
+        if(contactType == "" || contactType == null ){
+            layer.msg("职位/身份不能为空");
+            return;
+        }
+        if(contactEmail == "" || contactEmail == null ){
+            layer.msg("联系邮箱不能为空");
+            return;
+        }else{
+            var reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
+            if(!reg.test(contactEmail)){
+                layer.msg("请填写正确的邮箱!", {icon: 5, time: 3000});
+                return;
+            }
+        }
         //var operation = "删除";
         var operation = "<a href='javascript:;' onclick='deleteContact(this)'>删除</a>";
         //"<a href='javascript:;' onclick='del(this)'>删除</a>";
         row = document.getElementById("contactTable").insertRow();
         if(row!=null){
             cell=row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=contactName;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=contactPhone;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=contactType;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=contactEmail;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=operation;
         }
+        $("#contactTbodyId").hide();
         return false;
     }
     /*保存客户销售信息到列表*/
     function toAddChannelSaleInfo() {
         var channelCategory = document.getElementById("channelCategory").value;
+        if(channelCategory == "1"){
+            channelCategory = "电商";
+        }else if(channelCategory == "2"){
+            channelCategory = "特殊渠道";
+        }else if(channelCategory == "3"){
+            channelCategory = "线下";
+        }else if(channelCategory == "4"){
+            channelCategory = "海外";
+        }
         var channelType = document.getElementById("channelType").value;
         var channelName = document.getElementById("channelName").value;
         var promotingProducts = document.getElementById("promotingProducts").value;
+        var myselect=document.getElementById("promotingProducts");
+        var promotingProductsText = myselect.options[myselect.selectedIndex].text;
         var supplyPrice = document.getElementById("supplyPrice").value;
+        var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;//手动输入价格
+        if(writeSupplyPrice != null && writeSupplyPrice !=""){
+            /*writeSupplyPrice = writeSupplyPrice.toFixed(2);
+            alert(writeSupplyPrice);*/
+            supplyPrice = writeSupplyPrice;
+        }
         var accountPeriod = document.getElementById("accountPeriod").value;
-        var operation = "删除";
-        //var operation = var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)'>删除</a>";
+        if(accountPeriod == "1"){
+            accountPeriod = "先款";
+        }else if(accountPeriod == "2"){
+            accountPeriod = "月结";
+        }else if(accountPeriod == "3"){
+            accountPeriod = "两个月";
+        }
+        if(channelCategory == "" || channelCategory == null ){
+            layer.msg("渠道类别不能为空");
+            return;
+        }
+        if(channelType == "" || channelType == null ){
+            layer.msg("渠道类型不能为空");
+            return;
+        }
+        if(channelName == "" || channelName == null ){
+            layer.msg("渠道平台/名称不能为空");
+            return;
+        }
+        if(promotingProducts == "" || promotingProducts == null ){
+            layer.msg("销售产品不能为空");
+            return;
+        }
+        if(supplyPrice == "" || supplyPrice == null ){
+            layer.msg("供货价格不能为空");
+            return;
+        }
+        var promotingProductsHtml = '<input type="hidden" value="'+promotingProducts+'">';
+        //var operation = "删除";
+        var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)' name='deleteChannelSale'>删除</a>";
         row = document.getElementById("saleTable").insertRow();
         if(row!=null){
             cell=row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=channelCategory;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=channelType;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=channelName;
             cell = row.insertCell();
-            cell.innerHTML=promotingProducts;
+            cell.style.textAlign = "center";
+            cell.innerHTML=promotingProductsHtml+promotingProductsText;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=supplyPrice;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=accountPeriod;
             cell = row.insertCell();
+            cell.style.textAlign = "center";
             cell.innerHTML=operation;
         }
+        $("#channelTbodyId").hide();
         return false;
     }
     /*添加客户信息*/
     function addCustomerBasicInfo() {
-        alert("addCustomerBasicInfo...");
+        //var customerBasicInfoSaveForm = {};
+        //客户基本信息
+        var customerBasicInfo = {};
+        customerBasicInfo.customerType = $("[name='customerType']").val();
+        customerBasicInfo.cooperativeState = $("[name='cooperativeState']").val();
+        customerBasicInfo.customerName = $("[name='customerName']").val();
+        customerBasicInfo.customerIndustry = $("[name='customerIndustry']").val();
+        customerBasicInfo.customerProvinceCode = $("[name='customerProvinceCode']").val();
+        customerBasicInfo.customerCityCode = $("[name='customerCityCode']").val();
+        customerBasicInfo.customerAddress = $("[name='customerAddress']").val();
+        customerBasicInfo.customerRemarks = $("[name='customerRemarks']").val();
+        customerBasicInfo.customerStatus = "2";
+        if(customerBasicInfo.customerName == "" || customerBasicInfo.customerName == null ){
+            layer.msg("客户名称不能为空");
+            return;
+        }
+        if(customerBasicInfo.customerProvinceCode == "" || customerBasicInfo.customerProvinceCode == null ){
+            layer.msg("客户省份不能为空");
+            return;
+        }
+        if(customerBasicInfo.customerCityCode == "" || customerBasicInfo.customerCityCode == null ){
+            layer.msg("客户城市不能为空");
+            return;
+        }/*if(customerBasicInfo.customerAddress == "" || customerBasicInfo.customerAddress == null ){
+            alert("客户地址不能为空");
+            return;
+        }*/
+        //对接联系人信息
+        var dockedContactInfoList =  new Array();
+        $("#contactListId").find("tr").each(function (index,element){
+            var a = $(element).children();
+            var dockedContactInfo = {};
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        dockedContactInfo.contactName = a.eq(i).text().trim();
+                        break;
+                    case 1:
+                        dockedContactInfo.contactPhone = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        dockedContactInfo.contactType = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        dockedContactInfo.contactEmail = a.eq(i).text().trim();
+                        break;
+                }
+            }
+            dockedContactInfoList.push(dockedContactInfo);
+        })
+        if(dockedContactInfoList.length<1){
+            layer.msg("对接联系人信息不能为空");
+            return;
+        }
+        //var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
+        //客户销售渠道信息
+        var channelSaleInfoList =  new Array();
+        $("#channelSaleListId").find("tr").each(function (index,element){
+            var a = $(element).children();
+            var channelSaleInfo = {};
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        channelSaleInfo.channelCategory = a.eq(i).text().trim();
+                        if(channelSaleInfo.channelCategory == "电商"){
+                            channelSaleInfo.channelCategory = "1";
+                        }else if(channelSaleInfo.channelCategory == "特殊渠道"){
+                            channelSaleInfo.channelCategory = "2";
+                        }else if(channelSaleInfo.channelCategory == "线下"){
+                            channelSaleInfo.channelCategory = "3";
+                        }else if(channelSaleInfo.channelCategory == "海外"){
+                            channelSaleInfo.channelCategory = "4";
+                        }
+                        break;
+                    case 1:
+                        channelSaleInfo.channelType = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        channelSaleInfo.channelName = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        channelSaleInfo.promotingProducts = a.eq(i).text().trim();
+                        break;
+                    case 4:
+                        channelSaleInfo.supplyPrice = a.eq(i).text().trim();
+                        channelSaleInfo.supplyPrice = channelSaleInfo.supplyPrice * 100;
+                        break;
+                    case 5:
+                        channelSaleInfo.accountPeriod = a.eq(i).text().trim();
+                        if(channelSaleInfo.accountPeriod == "先款"){
+                            channelSaleInfo.accountPeriod = "1";
+                        }else if(channelSaleInfo.accountPeriod == "月结"){
+                            channelSaleInfo.accountPeriod = "2";
+                        }else if(channelSaleInfo.accountPeriod == "两个月"){
+                            channelSaleInfo.accountPeriod = "3";
+                        }
+                        break;
+                }
+            }
+
+            channelSaleInfoList.push(channelSaleInfo);
+
+        });
+        if(channelSaleInfoList.length<2){
+            layer.msg("客户销售渠道信息不能为空");
+            return;
+        }
+        //var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
+        //付款/退款信息
+        var billingInfo = {};
+        if(customerBasicInfo.cooperativeState != "1"){
+            billingInfo.accountOpeningBranch = $("[name='billAccountOpeningBranch']").val();
+            billingInfo.accountName = $("[name='accountName']").val();
+            billingInfo.accountNum = $("[name='accountNum']").val();
+            billingInfo.receivablesName = $("[name='receivablesName']").val();
+            billingInfo.receivablesPhone = $("[name='receivablesPhone']").val();
+            if(billingInfo.accountOpeningBranch == "" || billingInfo.accountOpeningBranch == null ){
+                layer.msg("开户支行不能为空");
+                return;
+            }
+            if(billingInfo.accountName == "" || billingInfo.accountName == null ){
+                layer.msg("账号名称不能为空");
+                return;
+            }
+            if(billingInfo.accountNum == "" || billingInfo.accountNum == null ){
+                layer.msg("账号不能为空");
+                return;
+            }
+            if(billingInfo.receivablesName == "" || billingInfo.receivablesName == null ){
+                layer.msg("收款人姓名不能为空");
+                return;
+            }if(billingInfo.receivablesPhone == "" || billingInfo.receivablesPhone == null ){
+                layer.msg("收款人手机不能为空");
+                return;
+            }else{
+                var reg =  /^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})$/
+                if(!reg.test(billingInfo.receivablesPhone)){
+                    layer.msg("请填写正确的手机号码!", {icon: 5, time: 3000});
+                    return;
+                }
+            }
+        }
+        //开票信息
+        var ticketOpeningInfo = {};
+        if(customerBasicInfo.cooperativeState != "1"){
+            ticketOpeningInfo.ticketType = $("[name='ticketType']").val();
+            ticketOpeningInfo.accountOpeningBranch = $("[name='ticketAccountOpeningBranch']").val();
+            ticketOpeningInfo.ticketOpeningAccount = $("[name='ticketOpeningAccount']").val();
+            ticketOpeningInfo.enterpriseName = $("[name='enterpriseName']").val();
+            ticketOpeningInfo.taxpayerIdentificationNum = $("[name='taxpayerIdentificationNum']").val();
+            ticketOpeningInfo.ticketOpeningPhone = $("[name='ticketOpeningPhone']").val();
+            ticketOpeningInfo.enterpriseAddress = $("[name='enterpriseAddress']").val();
+            if(ticketOpeningInfo.ticketType == "1" ){
+                if(ticketOpeningInfo.accountOpeningBranch == "" || ticketOpeningInfo.accountOpeningBranch == null ){
+                    layer.msg("开户支行不能为空");
+                    return;
+                }
+                if(ticketOpeningInfo.ticketOpeningAccount == "" || ticketOpeningInfo.ticketOpeningAccount == null ){
+                    layer.msg("开票账户不能为空");
+                    return;
+                }
+                if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
+                    layer.msg("企业名称不能为空");
+                    return;
+                }
+                if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
+                    layer.msg("纳税人识别号不能为空");
+                    return;
+                }
+                if(ticketOpeningInfo.ticketOpeningPhone == "" || ticketOpeningInfo.ticketOpeningPhone == null ){
+                    layer.msg("开票电话不能为空");
+                    return;
+                }else{
+                    var reg =  /^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})$/
+                    if(!reg.test(ticketOpeningInfo.ticketOpeningPhone)){
+                        layer.msg("请填写正确的手机号码!", {icon: 5, time: 3000});
+                        return;
+                    }
+                }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
+                    layer.msg("企业地址不能为空");
+                    return;
+                }
+            }else{
+                if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
+                    layer.msg("企业名称不能为空");
+                    return;
+                }
+                if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
+                    layer.msg("纳税人识别号不能为空");
+                    return;
+                }
+            }
+        }
+        //发送保存请求
+        /*alert("request ...Start...");
+        customerBasicInfoSaveForm.customerBasicInfo = customerBasicInfo;
+        customerBasicInfoSaveForm.dockedContactInfoList = dockedContactInfoList;
+        customerBasicInfoSaveForm.channelSaleInfoList = channelSaleInfoList;
+        customerBasicInfoSaveForm.billingInfo = billingInfo;
+        customerBasicInfoSaveForm.ticketOpeningInfo = ticketOpeningInfo;*/
+        var saveStates = "";
+        var customerInfoJson = JSON.stringify(customerBasicInfo);
+        var billingInfoJson = JSON.stringify(billingInfo);
+        var ticketOpeningInfoJson = JSON.stringify(ticketOpeningInfo);
+        var dockedContactInfoListJson = JSON.stringify(dockedContactInfoList);
+        var channelSaleInfoListJson = JSON.stringify(channelSaleInfoList);
+
+        //$.post("${path}/admin/customerBasic/save_customer_info",customerBasicInfoSaveForm, function(res){});
+        $.ajax({
+            type: "POST",
+            data: {
+                customerInfoJson:customerInfoJson,
+                dockedContactInfoListJson:dockedContactInfoListJson,
+                channelSaleInfoListJson:channelSaleInfoListJson,
+                billingInfoJson : billingInfoJson,
+                ticketOpeningInfoJson:ticketOpeningInfoJson
+            },
+            url: "${path}/admin/customerBasic/save_customer_info",
+            async: true,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    saveStates = "保存成功";
+                    layer.msg(saveStates);
+                    window.location.href= "${path}/admin/customerBasic/listCustomerBasic";
+                }else{
+                    saveStates = "保存失败";
+                    layer.msg(saveStates);
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+                saveStates = "保存失败";
+                layer.msg(saveStates);
+            }
+        });
     }
 
     // 删除对接联系人函数
     function deleteContact(x){
         $(x).parent().parent().remove();
         // tr.parentNode.removeChild(tr);
+        initContactInfoListBody();
+
     }
     // 删除客户销售渠道信息函数
     function deleteChannelSale(x){
-        var tr = x.parentNode.parentNode;
-        tr.parentNode.removeChild(tr);
+        $(x).parent().parent().remove();
+        /*var tr = x.parentNode.parentNode;
+        tr.parentNode.removeChild(tr);*/
+        initChannelSaleInfoListBody();
+    }
+
+    //监听对接联系人
+    function initContactInfoListBody() {
+        var dockedContactInfoList =  new Array();
+        $("#contactListId").find("tr").each(function (){
+            var dockedContactInfo = {};
+            dockedContactInfo.contactName = $("[name='contactName']").val();
+            dockedContactInfo.contactPhone = $("[name='contactPhone']").val();
+            dockedContactInfo.contactType = $("[name='contactType']").val();
+            dockedContactInfo.contactEmail = $("[name='contactEmail']").val();
+            dockedContactInfoList.push(dockedContactInfo);
+        })
+        if(dockedContactInfoList.length<2){
+            $("#contactTbodyId").show();
+            //document.getElementById("contactListId").innerHTML = "<tr><td colspan=\"5\" class=\"td-manage text-c\" >暂时没有联系人信息,请添加!</td></tr>";
+        }
+    }
+
+    //监听销售渠道
+    function initChannelSaleInfoListBody() {
+        var channelSaleInfoList =  new Array();
+        $("#channelSaleListId").find("tr").each(function (){
+            var channelSaleInfo = {};
+            channelSaleInfo.channelCategory = $("[name='channelCategory']").val();
+            channelSaleInfo.channelType = $("[name='channelType']").val();
+            channelSaleInfo.channelName = $("[name='channelName']").val();
+            channelSaleInfo.promotingProducts = $("[name='promotingProducts']").val();
+            channelSaleInfo.supplyPrice = $("[name='supplyPrice']").val();
+            channelSaleInfo.accountPeriod = $("[name='accountPeriod']").val();
+            channelSaleInfoList.push(channelSaleInfo);
+        })
+        if(channelSaleInfoList.length<2){
+            $("#channelTbodyId").show();
+            //document.getElementById("channelSaleListId").innerHTML = "<tr><td colspan=\"7\" class=\"td-manage text-c\" >暂时没有客户销售渠道信息,请添加!</td></tr>";
+        }
     }
     /*业务逻辑js控制 end*/
+
+
 </script>
 
 </body>

File diff suppressed because it is too large
+ 1147 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/customer/update_customer_info.ftl