Exemplo n.º 1
0
  /**
   * 新增Customer
   *
   * @param customer
   */
  public void saveCustomer(Customer customer) throws RuntimeException {
    // CustomerPermission.doCheckSave();

    // TODO 根据当前项目的customerOneSale,是否为1,才进行判断
    // 客户来源为来访判断,该项目下电话号码是否重复
    if ("2".equals(customer.getCustomerSource())) {
      PhoneUniqueUtils.isPhoneRepeat(customer);
    }

    // 增加号码归属地(可以改成定时器去执行),CustomerPhoneFromQuartz.java
    // customer = PhoneUtils.postPhone(customer);

    // 根据project_code设置customer的price_num对应的项目的PRICE_AMOUNT值,area_num对应的项目的REQUEST_AREA值
    ProjectCodeFieldUtils.setRriceAndAreaNum(customer);

    // 如果来访日期为空,就增加默认为当天,2013.8.14
    if (CommonUtils.isStrEmpty(customer.getVisitDate())) {
      customer.setVisitDate(CommonUtils.getDateString(new Date()));
    }

    // 设定follow_time,(因为该字段为后来新增的,所以要在这里增加)
    customer.setFollowTime(CommonUtils.getDateFromString(customer.getVisitDate()));

    // 实际保存
    customerMapper.saveCustomer(customer);

    // CacheUtils.removeCache(cacheKeyOne,customer.getId());
  }
Exemplo n.º 2
0
  /**
   * 修改客户,但是不用判断是否只能更新,不能修改的情况
   *
   * @param customer
   */
  @Override
  public void updateCustomerNoCheckNolyFollow(Customer customer) throws RuntimeException {
    CustomerPermission.doCheckUpdate(customer);

    int customerId = customer.getId();
    logCustomer(customerId); // 增加LOG

    // 该项目下电话号码是否重复
    PhoneUniqueUtils.isPhoneRepeat(customer);

    // 根据project_code设置customer的price_num对应的项目的PRICE_AMOUNT值,area_num对应的项目的REQUEST_AREA值
    ProjectCodeFieldUtils.setRriceAndAreaNum(customer);

    customerMapper.updateCustomer(customer);

    CacheUtils.removeCache(cacheKeyOne, customerId);
  }