Skip to content

Instantly share code, notes, and snippets.

@levymoreira
Created October 17, 2016 01:42
Show Gist options
  • Save levymoreira/0fe6a387960dd532a5aee1892c0def9b to your computer and use it in GitHub Desktop.
Save levymoreira/0fe6a387960dd532a5aee1892c0def9b to your computer and use it in GitHub Desktop.
sdf234
package com.dluxdays.service.csv;
import com.dluxdays.service.util.OfferCSVDTO;
import com.dluxdays.service.util.OfferCSVDTOBuilder;
import com.dluxdays.web.rest.CSVResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
@Service
@Transactional
public class MonnierUpdater extends Updater {
public Map<String, String> getDownloadConfiguration() {
Map config = new HashMap();
config.put("URL", "http://datatransfer.cj.com/datatransfer/files/4756211/outgoing/productcatalog/190452/Monnier_Frères_UK-Product_Catalog.txt.gz");
config.put("user", "4756211");
config.put("password", "ozMD_ZQY");
return config;
}
public OfferCSVDTO convertToOfferCSVDTO(String[] params) throws Exception{
return new OfferCSVDTOBuilder()
.setMerchantProductId(this.getMerchantProductIdPrefix() + "_" + params[7])
.setOfferUrl(params[17])
.setImagePath(params[19])
.setPrice(params[14])
.setDescription(params[6])
.setProductName(params[4])
.setTagline(params[4])
.setBrandName(params[8])
.setPreviousPrice(params[15])
.setCategoryName(params[20])
.setGender("f")
.createOfferCSVDTO();
}
public Long getMerchantId() {
return CSVResource.ESCADA_ID;
}
public Long getCurrencyExchangeId() {
return CSVResource.GBP_CURRENCY_ID;
}
public String getMerchantProductIdPrefix() {
return CSVResource.ESCADA;
}
public char getPropertySeparator() {
return ',';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment