@Override
  public Response<SupplierInfoChanged> checkSupplierInfoChanged(Long userId) {
    Response<SupplierInfoChanged> result = new Response<SupplierInfoChanged>();
    if (userId == null) {
      log.error("use id can not be null");
      result.setError("user.id.not.null.fail");
      return result;
    }

    try {

      SupplierInfoChanged supplierInfoChanged = new SupplierInfoChanged();
      supplierInfoChanged.setCompanyChanged(
          supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.companyTab()));
      supplierInfoChanged.setPaperworkChanged(
          supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.paperworkTab()));
      supplierInfoChanged.setContactInfoChanged(
          supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.contactInfoTab()));
      supplierInfoChanged.setFinanceChanged(
          supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.financeTab()));
      supplierInfoChanged.setQualityChanged(
          supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.qualityTab()));

      result.setResult(supplierInfoChanged);
    } catch (Exception e) {
      log.error(
          "fail to check supplier info changed where userId={},cause:{}",
          userId,
          Throwables.getStackTraceAsString(e));
      result.setError("check.supplier.info.changed.fail");
    }

    return result;
  }
  @Override
  public SupplierUpdatedInfoDto<Finance> getNewFinance(Long userId, Finance oldFinance) {

    SupplierUpdatedInfoDto<Finance> supplierUpdatedInfoDto = new SupplierUpdatedInfoDto<Finance>();
    Map<String, Object> oldValues = Maps.newHashMap();

    boolean financeChanged =
        supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.financeTab());
    if (!financeChanged) {
      supplierUpdatedInfoDto.setSupplierInfo(oldFinance);
      supplierUpdatedInfoDto.setOldValues(oldValues);
      return supplierUpdatedInfoDto;
    }

    Map<String, String> changedInfo = supplierChangedInfoRedisDao.getChangedInfos(userId);

    Finance newFinance = new Finance();
    BeanMapper.copy(oldFinance, newFinance);

    if (changedInfo.containsKey(ChangedInfoKeys.financeOpeningBank())) {
      newFinance.setOpeningBank(changedInfo.get(ChangedInfoKeys.financeOpeningBank()));
      oldValues.put(ChangedInfoKeys.financeOpeningBank(), oldFinance.getOpeningBank());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeOpenLicense())) {
      newFinance.setOpenLicense(changedInfo.get(ChangedInfoKeys.financeOpenLicense()));
      oldValues.put(ChangedInfoKeys.financeOpenLicense(), oldFinance.getOpenLicense());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeRecentFinance())) {
      newFinance.setRecentFinance(changedInfo.get(ChangedInfoKeys.financeRecentFinance()));
      oldValues.put(ChangedInfoKeys.financeRecentFinance(), oldFinance.getRecentFinance());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeCoinType())) {
      String coinType = changedInfo.get(ChangedInfoKeys.financeCoinType());
      newFinance.setCoinType("null".equals(coinType) ? null : Integer.parseInt(coinType));
      oldValues.put(ChangedInfoKeys.financeCoinType(), oldFinance.getCoinType());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeBankCode())) {
      newFinance.setBankCode(changedInfo.get(ChangedInfoKeys.financeBankCode()));
      oldValues.put(ChangedInfoKeys.financeBankCode(), oldFinance.getBankCode());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeBankAccount())) {
      newFinance.setBankAccount(changedInfo.get(ChangedInfoKeys.financeBankAccount()));
      oldValues.put(ChangedInfoKeys.financeBankAccount(), oldFinance.getBankAccount());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.financeCountry())) {
      String country = changedInfo.get(ChangedInfoKeys.financeCountry());
      newFinance.setCountry("null".equals(country) ? null : Integer.parseInt(country));
      oldValues.put(ChangedInfoKeys.financeCountry(), oldFinance.getCountry());
    }

    supplierUpdatedInfoDto.setSupplierInfo(newFinance);
    supplierUpdatedInfoDto.setOldValues(oldValues);
    return supplierUpdatedInfoDto;
  }
  @Override
  public SupplierUpdatedInfoDto<ContactInfo> getNewContactInfo(
      Long userId, ContactInfo oldContactInfo) {

    SupplierUpdatedInfoDto<ContactInfo> supplierUpdatedInfoDto =
        new SupplierUpdatedInfoDto<ContactInfo>();
    Map<String, Object> oldValues = Maps.newHashMap();

    boolean contactInfoChanged =
        supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.contactInfoTab());
    if (!contactInfoChanged) {
      supplierUpdatedInfoDto.setSupplierInfo(oldContactInfo);
      supplierUpdatedInfoDto.setOldValues(oldValues);
      return supplierUpdatedInfoDto;
    }

    Map<String, String> changedInfo = supplierChangedInfoRedisDao.getChangedInfos(userId);

    ContactInfo newContactInfo = new ContactInfo();
    BeanMapper.copy(oldContactInfo, newContactInfo);

    if (changedInfo.containsKey(ChangedInfoKeys.contactInfoName())) {
      newContactInfo.setName(changedInfo.get(ChangedInfoKeys.contactInfoName()));
      oldValues.put(ChangedInfoKeys.contactInfoName(), oldContactInfo.getName());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.contactInfoEmail())) {
      newContactInfo.setEmail(changedInfo.get(ChangedInfoKeys.contactInfoEmail()));
      oldValues.put(ChangedInfoKeys.contactInfoEmail(), oldContactInfo.getEmail());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.contactInfoMobile())) {
      newContactInfo.setMobile(changedInfo.get(ChangedInfoKeys.contactInfoMobile()));
      oldValues.put(ChangedInfoKeys.contactInfoMobile(), oldContactInfo.getMobile());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.contactInfoPhone())) {
      newContactInfo.setOfficePhone(changedInfo.get(ChangedInfoKeys.contactInfoPhone()));
      oldValues.put(ChangedInfoKeys.contactInfoPhone(), oldContactInfo.getOfficePhone());
    }

    supplierUpdatedInfoDto.setSupplierInfo(newContactInfo);
    supplierUpdatedInfoDto.setOldValues(oldValues);
    return supplierUpdatedInfoDto;
  }
  @Override
  public SupplierUpdatedInfoDto<CompanyExtraQuality> getNewCompanyExtraQuality(
      Long userId, CompanyExtraQuality oldCompanyExtraQuality) {

    SupplierUpdatedInfoDto<CompanyExtraQuality> supplierUpdatedInfoDto =
        new SupplierUpdatedInfoDto<CompanyExtraQuality>();
    Map<String, Object> oldValues = Maps.newHashMap();

    boolean qualityChanged =
        supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.qualityTab());
    if (!qualityChanged) {
      supplierUpdatedInfoDto.setSupplierInfo(oldCompanyExtraQuality);
      supplierUpdatedInfoDto.setOldValues(oldValues);
      return supplierUpdatedInfoDto;
    }

    Map<String, String> changedInfo = supplierChangedInfoRedisDao.getChangedInfos(userId);

    CompanyExtraQuality newCompanyExtraQuality = new CompanyExtraQuality();
    BeanMapper.copy(oldCompanyExtraQuality, newCompanyExtraQuality);

    if (changedInfo.containsKey(ChangedInfoKeys.qualityRohsId())) {
      newCompanyExtraQuality.setRohsId(changedInfo.get(ChangedInfoKeys.qualityRohsId()));
      oldValues.put(ChangedInfoKeys.qualityRohsId(), oldCompanyExtraQuality.getRohsId());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityRohsAttachUrl())) {
      newCompanyExtraQuality.setRohsAttachUrl(
          changedInfo.get(ChangedInfoKeys.qualityRohsAttachUrl()));
      oldValues.put(
          ChangedInfoKeys.qualityRohsAttachUrl(), oldCompanyExtraQuality.getRohsAttachUrl());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityRohsValidDate())) {
      String rohsValidDate = changedInfo.get(ChangedInfoKeys.qualityRohsValidDate());
      newCompanyExtraQuality.setRohsValidDate(DateTime.parse(rohsValidDate, FORMATTER).toDate());
      oldValues.put(
          ChangedInfoKeys.qualityRohsValidDate(), oldCompanyExtraQuality.getRohsValidDate());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO9001Id())) {
      newCompanyExtraQuality.setIso9001Id(changedInfo.get(ChangedInfoKeys.qualityISO9001Id()));
      oldValues.put(ChangedInfoKeys.qualityISO9001Id(), oldCompanyExtraQuality.getIso9001Id());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO9001AttachUrl())) {
      newCompanyExtraQuality.setIso9001AttachUrl(
          changedInfo.get(ChangedInfoKeys.qualityISO9001AttachUrl()));
      oldValues.put(
          ChangedInfoKeys.qualityISO9001AttachUrl(), oldCompanyExtraQuality.getIso9001AttachUrl());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO9001ValidDate())) {
      String iso900ValidDate = changedInfo.get(ChangedInfoKeys.qualityISO9001ValidDate());
      newCompanyExtraQuality.setIso9001ValidDate(
          DateTime.parse(iso900ValidDate, FORMATTER).toDate());
      oldValues.put(
          ChangedInfoKeys.qualityISO9001ValidDate(), oldCompanyExtraQuality.getIso9001ValidDate());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO14001Id())) {
      newCompanyExtraQuality.setIso14001Id(changedInfo.get(ChangedInfoKeys.qualityISO14001Id()));
      oldValues.put(ChangedInfoKeys.qualityISO14001Id(), oldCompanyExtraQuality.getIso14001Id());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO14001AttachUrl())) {
      newCompanyExtraQuality.setIso14001AttachUrl(
          changedInfo.get(ChangedInfoKeys.qualityISO14001AttachUrl()));
      oldValues.put(
          ChangedInfoKeys.qualityISO14001AttachUrl(),
          oldCompanyExtraQuality.getIso14001AttachUrl());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityISO14001ValidDate())) {
      String iso1400ValidDate = changedInfo.get(ChangedInfoKeys.qualityISO14001ValidDate());
      newCompanyExtraQuality.setIso14001ValidDate(
          DateTime.parse(iso1400ValidDate, FORMATTER).toDate());
      oldValues.put(
          ChangedInfoKeys.qualityISO14001ValidDate(),
          oldCompanyExtraQuality.getIso14001ValidDate());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.qualityTS16949Id())) {
      newCompanyExtraQuality.setTs16949Id(changedInfo.get(ChangedInfoKeys.qualityTS16949Id()));
      oldValues.put(ChangedInfoKeys.qualityTS16949Id(), oldCompanyExtraQuality.getTs16949Id());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityTS16949AttachUrl())) {
      newCompanyExtraQuality.setTs16949AttachUrl(
          changedInfo.get(ChangedInfoKeys.qualityTS16949AttachUrl()));
      oldValues.put(
          ChangedInfoKeys.qualityTS16949AttachUrl(), oldCompanyExtraQuality.getTs16949AttachUrl());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.qualityTS16949ValidDate())) {
      String ts16949ValidDate = changedInfo.get(ChangedInfoKeys.qualityTS16949ValidDate());
      newCompanyExtraQuality.setTs16949ValidDate(
          DateTime.parse(ts16949ValidDate, FORMATTER).toDate());
      oldValues.put(
          ChangedInfoKeys.qualityTS16949ValidDate(), oldCompanyExtraQuality.getTs16949ValidDate());
    }

    supplierUpdatedInfoDto.setSupplierInfo(newCompanyExtraQuality);
    supplierUpdatedInfoDto.setOldValues(oldValues);
    return supplierUpdatedInfoDto;
  }
  @Override
  public SupplierUpdatedInfoDto<PaperworkDto> getNewPaperwork(Long userId, Company oldPaperwork) {
    SupplierUpdatedInfoDto<PaperworkDto> supplierUpdatedInfoDto =
        new SupplierUpdatedInfoDto<PaperworkDto>();
    PaperworkDto paperworkDto = new PaperworkDto();
    Map<String, Object> oldValues = Maps.newHashMap();

    BeanMapper.copy(oldPaperwork, paperworkDto);

    boolean paperworkChanged =
        supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.paperworkTab());
    if (!paperworkChanged) {
      supplierUpdatedInfoDto.setSupplierInfo(paperworkDto);
      supplierUpdatedInfoDto.setOldValues(oldValues);
      return supplierUpdatedInfoDto;
    }

    Map<String, String> changedInfo = supplierChangedInfoRedisDao.getChangedInfos(userId);

    if (changedInfo.containsKey(ChangedInfoKeys.companyBusinessLicense())) {
      paperworkDto.setBusinessLicense(changedInfo.get(ChangedInfoKeys.companyBusinessLicense()));
      oldValues.put(ChangedInfoKeys.companyBusinessLicense(), oldPaperwork.getBusinessLicense());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyBusinessLicenseId())) {
      paperworkDto.setBusinessLicenseId(
          changedInfo.get(ChangedInfoKeys.companyBusinessLicenseId()));
      oldValues.put(
          ChangedInfoKeys.companyBusinessLicenseId(), oldPaperwork.getBusinessLicenseId());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyBusinessLicenseDate())) {
      String blDate = changedInfo.get(ChangedInfoKeys.companyBusinessLicenseDate());
      paperworkDto.setBlDate(DateTime.parse(blDate, FORMATTER).toDate());
      oldValues.put(ChangedInfoKeys.companyBusinessLicenseDate(), oldPaperwork.getBlDate());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.companyTaxNo())) {
      paperworkDto.setTaxNo(changedInfo.get(ChangedInfoKeys.companyTaxNo()));
      oldValues.put(ChangedInfoKeys.companyTaxNo(), oldPaperwork.getTaxNo());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyTaxNoId())) {
      paperworkDto.setTaxNoId(changedInfo.get(ChangedInfoKeys.companyTaxNoId()));
      oldValues.put(ChangedInfoKeys.companyTaxNoId(), oldPaperwork.getTaxNoId());
    }

    if (changedInfo.containsKey(ChangedInfoKeys.companyOrgCert())) {
      paperworkDto.setOrgCert(changedInfo.get(ChangedInfoKeys.companyOrgCert()));
      oldValues.put(ChangedInfoKeys.companyOrgCert(), oldPaperwork.getOrgCert());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyOrgCertId())) {
      paperworkDto.setOrgCertId(changedInfo.get(ChangedInfoKeys.companyOrgCertId()));
      oldValues.put(ChangedInfoKeys.companyOrgCertId(), oldPaperwork.getOrgCertId());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyOrgCertDate())) {
      String ocDate = changedInfo.get(ChangedInfoKeys.companyOrgCertDate());
      paperworkDto.setOcDate(DateTime.parse(ocDate, FORMATTER).toDate());
      oldValues.put(ChangedInfoKeys.companyOrgCertDate(), oldPaperwork.getOcDate());
    }

    supplierUpdatedInfoDto.setSupplierInfo(paperworkDto);
    supplierUpdatedInfoDto.setOldValues(oldValues);
    return supplierUpdatedInfoDto;
  }
  @Override
  public SupplierUpdatedInfoDto<CompanyDto> getNewBaseCompany(
      Long userId,
      Company oldCompany,
      List<CompanyMainBusiness> oldMainBusinesses,
      List<CompanySupplyPark> oldSupplyParks) {
    SupplierUpdatedInfoDto<CompanyDto> supplierUpdatedInfoDto =
        new SupplierUpdatedInfoDto<CompanyDto>();
    CompanyDto companyDto = new CompanyDto();
    Map<String, Object> oldValues = Maps.newHashMap();

    boolean baseCompanyInfoChanged =
        supplierChangedInfoRedisDao.tabInfoChanged(userId, ChangedInfoKeys.companyTab());
    if (!baseCompanyInfoChanged) {
      companyDto.setCompany(oldCompany);
      companyDto.setCompanyMainBusinesses(oldMainBusinesses);
      companyDto.setCompanySupplyParks(oldSupplyParks);

      supplierUpdatedInfoDto.setSupplierInfo(companyDto);
      supplierUpdatedInfoDto.setOldValues(oldValues);
      return supplierUpdatedInfoDto;
    }

    Map<String, String> changedInfo = supplierChangedInfoRedisDao.getChangedInfos(userId);
    Company newCompany = new Company();
    BeanMapper.copy(oldCompany, newCompany);

    if (changedInfo.containsKey(ChangedInfoKeys.companyCorporation())) {
      newCompany.setCorporation(changedInfo.get(ChangedInfoKeys.companyCorporation()));
      oldValues.put(ChangedInfoKeys.companyCorporation(), oldCompany.getCorporation());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyInitAgent())) {
      newCompany.setInitAgent(changedInfo.get(ChangedInfoKeys.companyInitAgent()));
      oldValues.put(ChangedInfoKeys.companyInitAgent(), oldCompany.getInitAgent());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyRegCountry())) {
      String regCountry = changedInfo.get(ChangedInfoKeys.companyRegCountry());
      newCompany.setRegCountry("null".equals(regCountry) ? null : Integer.parseInt(regCountry));
      oldValues.put(ChangedInfoKeys.companyRegCountry(), oldCompany.getRegCountry());
    }
    if (changedInfo.containsKey(ChangedInfoKeys.companyDesc())) {
      newCompany.setDesc(changedInfo.get(ChangedInfoKeys.companyDesc()));
      oldValues.put(ChangedInfoKeys.companyDesc(), oldCompany.getDesc());
    }

    // 如果有V码,则检查是否有待更新的合同信息
    if (!Strings.isNullOrEmpty(oldCompany.getSupplierCode())) {

      if (changedInfo.containsKey(ChangedInfoKeys.companyGroupName())) {
        newCompany.setGroupName(changedInfo.get(ChangedInfoKeys.companyGroupName()));
        oldValues.put(ChangedInfoKeys.companyGroupName(), oldCompany.getGroupName());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyGroupAddr())) {
        newCompany.setGroupAddr(changedInfo.get(ChangedInfoKeys.companyGroupAddr()));
        oldValues.put(ChangedInfoKeys.companyGroupAddr(), oldCompany.getGroupAddr());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyRegCapical())) {
        String regCapital = changedInfo.get(ChangedInfoKeys.companyRegCapical());
        newCompany.setRegCapital("null".equals(regCapital) ? null : Long.parseLong(regCapital));
        oldValues.put(ChangedInfoKeys.companyRegCapical(), oldCompany.getRegCapital());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyRcCoinType())) {
        String reCoinType = changedInfo.get(ChangedInfoKeys.companyRcCoinType());
        newCompany.setRcCoinType("null".equals(reCoinType) ? null : Integer.parseInt(reCoinType));
        oldValues.put(ChangedInfoKeys.companyRcCoinType(), oldCompany.getRcCoinType());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyPersonScale())) {
        newCompany.setPersonScale(changedInfo.get(ChangedInfoKeys.companyPersonScale()));
        oldValues.put(ChangedInfoKeys.companyPersonScale(), oldCompany.getPersonScale());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyRegProvince())) {
        String regProvince = changedInfo.get(ChangedInfoKeys.companyRegProvince());
        newCompany.setRegProvince(
            "null".equals(regProvince) ? null : Integer.parseInt(regProvince));
        oldValues.put(ChangedInfoKeys.companyRegProvince(), oldCompany.getRegProvince());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyRegCity())) {
        String regCity = changedInfo.get(ChangedInfoKeys.companyRegCity());
        newCompany.setRegCity("null".equals(regCity) ? null : Integer.parseInt(regCity));
        oldValues.put(ChangedInfoKeys.companyRegCity(), oldCompany.getRegCity());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyFixedAssets())) {
        String fixedAssets = changedInfo.get(ChangedInfoKeys.companyFixedAssets());
        newCompany.setFixedAssets("null".equals(fixedAssets) ? null : Long.parseLong(fixedAssets));
        oldValues.put(ChangedInfoKeys.companyFixedAssets(), oldCompany.getFixedAssets());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyFaCoinType())) {
        String faCoinType = changedInfo.get(ChangedInfoKeys.companyFaCoinType());
        newCompany.setFaCoinType("null".equals(faCoinType) ? null : Integer.parseInt(faCoinType));
        oldValues.put(ChangedInfoKeys.companyFaCoinType(), oldCompany.getFaCoinType());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyFoundAt())) {
        String foundAt = changedInfo.get(ChangedInfoKeys.companyFoundAt());
        newCompany.setFoundAt(DateTime.parse(foundAt, FORMATTER).toDate());
        oldValues.put(ChangedInfoKeys.companyFoundAt(), oldCompany.getFoundAt());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyOfficialWebSite())) {
        newCompany.setOfficialWebsite(changedInfo.get(ChangedInfoKeys.companyOfficialWebSite()));
        oldValues.put(ChangedInfoKeys.companyOfficialWebSite(), oldCompany.getOfficialWebsite());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyNature())) {
        String nature = changedInfo.get(ChangedInfoKeys.companyNature());
        newCompany.setNature("null".equals(nature) ? null : Integer.parseInt(nature));
        oldValues.put(ChangedInfoKeys.companyNature(), oldCompany.getNature());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyWorldTop())) {
        String worldTop = changedInfo.get(ChangedInfoKeys.companyWorldTop());
        newCompany.setWorldTop("null".equals(worldTop) ? null : Integer.parseInt(worldTop));
        oldValues.put(ChangedInfoKeys.companyWorldTop(), oldCompany.getWorldTop());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyListedStatus())) {
        String listedStatus = changedInfo.get(ChangedInfoKeys.companyListedStatus());
        newCompany.setListedStatus(
            "null".equals(listedStatus) ? null : Integer.parseInt(listedStatus));
        oldValues.put(ChangedInfoKeys.companyListedStatus(), oldCompany.getListedStatus());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyListedRegion())) {
        newCompany.setListedRegion(changedInfo.get(ChangedInfoKeys.companyListedRegion()));
        oldValues.put(ChangedInfoKeys.companyListedRegion(), oldCompany.getListedRegion());
      }

      if (changedInfo.containsKey(ChangedInfoKeys.companyTicker())) {
        newCompany.setTicker(changedInfo.get(ChangedInfoKeys.companyTicker()));
        oldValues.put(ChangedInfoKeys.companyTicker(), oldCompany.getTicker());
      }
    }

    companyDto.setCompany(newCompany);

    if (changedInfo.containsKey(ChangedInfoKeys.companyMainBusiness())) {
      String mainBusinessesJson = changedInfo.get(ChangedInfoKeys.companyMainBusiness());
      JavaType javaType =
          JsonMapper.JSON_NON_EMPTY_MAPPER.createCollectionType(
              List.class, CompanyMainBusiness.class);
      List<CompanyMainBusiness> updatedMainBusinesses =
          JsonMapper.JSON_NON_EMPTY_MAPPER.fromJson(mainBusinessesJson, javaType);
      companyDto.setCompanyMainBusinesses(updatedMainBusinesses);

      oldValues.put(ChangedInfoKeys.companyMainBusiness(), oldMainBusinesses);
    } else {
      companyDto.setCompanyMainBusinesses(oldMainBusinesses);
    }

    if (changedInfo.containsKey(ChangedInfoKeys.companySupplyPark())) {
      String supplyParkJson = changedInfo.get(ChangedInfoKeys.companySupplyPark());
      JavaType javaType =
          JsonMapper.JSON_NON_EMPTY_MAPPER.createCollectionType(
              List.class, CompanySupplyPark.class);
      List<CompanySupplyPark> updatedSupplyParks =
          JsonMapper.JSON_NON_EMPTY_MAPPER.fromJson(supplyParkJson, javaType);
      companyDto.setCompanySupplyParks(updatedSupplyParks);

      oldValues.put(ChangedInfoKeys.companySupplyPark(), oldSupplyParks);
    } else {
      companyDto.setCompanySupplyParks(oldSupplyParks);
    }

    supplierUpdatedInfoDto.setSupplierInfo(companyDto);
    supplierUpdatedInfoDto.setOldValues(oldValues);
    return supplierUpdatedInfoDto;
  }