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
  /** 更新 */
  @Override
  public void updateUserIdByCustomerId(int userId, int customerId) throws RuntimeException {

    logCustomer(customerId); // 增加LOG

    Customer customer = getCustomerById(customerId);
    customer.setUserId(userId);
    customer.setModId(SessionUser.getUserId());
    customer.setModTime(new Date());

    customerMapper.updateCustomer(customer);

    CacheUtils.removeCache(cacheKeyOne, customerId);
  }
Exemplo n.º 3
0
  /**
   * 修改Customer
   *
   * @param customer
   */
  @Override
  public void updateCustomer(Customer customer) throws RuntimeException {
    CustomerPermission.doCheckUpdate(customer);

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

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

    // 判断是否为只能跟进的客户
    CustomerOnlyFollowUtils.isOnlyFollowCustomerById(customer.getId());

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

    customerMapper.updateCustomerForPart(customer);

    CacheUtils.removeCache(cacheKeyOne, customerId);
  }
Exemplo n.º 4
0
  /**
   * 根据StlLaiDianBean返回Customer
   *
   * @param bean
   * @return
   */
  private Customer beanToCustomer(StlLaiDianBean bean) {

    Customer customer = new Customer();

    customer.setCustomerNo(CustomerUtils.getTmpCustomerNo());

    customer.setCustomerName(bean.getCustomerName());
    customer.setVisitDate(bean.getVisitDate());
    customer.setPhone(bean.getPhone());

    customer.setHomeProvince(17); // 居住省
    customer.setHomeCity(169); // 居住市
    customer.setHomeContent(bean.getHomeContent());

    customer.setAreaNum(bean.getAreaNum()); // 意向面积
    customer.setRemark1(bean.getRemark1()); // 备注

    customer.setCompanyId(29);
    customer.setProjectId(190);

    customer.setTeamId(0);
    customer.setUserId(2400);

    customer.setManagerId(2400);
    customer.setCustomerSource("1"); // 客户来源

    customer.setIsDeleted(CommonUtils.NORMAL);
    customer.setCreatedId(2400);
    customer.setCreatedTime(new Date());
    customer.setModId(2400);
    customer.setModTime(new Date());

    return customer;
  }