43 lines
1.8 KiB
Java
43 lines
1.8 KiB
Java
|
|
package it.acxent.cc;
|
||
|
|
|
||
|
|
import it.acxent.art.Articolo;
|
||
|
|
import it.acxent.art.ArticoloCR;
|
||
|
|
import it.acxent.common.CrontabInterface;
|
||
|
|
import it.acxent.db.ApplParmFull;
|
||
|
|
import it.acxent.db.DBAdapter;
|
||
|
|
import it.acxent.db.ResParm;
|
||
|
|
import it.acxent.util.Vectumerator;
|
||
|
|
|
||
|
|
public class CCCronSendGoogleXml implements CrontabInterface {
|
||
|
|
public ResParm crontabJob(ApplParmFull ap) {
|
||
|
|
ResParm rp = new ResParm(true);
|
||
|
|
System.out.println("CCCronSendGoogleXml start...");
|
||
|
|
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import SEND GOOGLE XML OFFERTE CC (" +
|
||
|
|
DBAdapter.getNow().toString() + ")\n#################");
|
||
|
|
long t0 = System.currentTimeMillis();
|
||
|
|
ArticoloCR CR = new ArticoloCR(ap);
|
||
|
|
CR.setFlgQta(0L);
|
||
|
|
CR.setFlgGoogle(1L);
|
||
|
|
CR.setGoogleFeedFileName("merchant");
|
||
|
|
CR.setFileNameGoogle("merchant.xml");
|
||
|
|
Articolo art = new Articolo(ap);
|
||
|
|
Vectumerator<Articolo> vec = art.findByCR(CR, 0, 0);
|
||
|
|
System.out.println("numero record;" + vec.getTotNumberOfRecords());
|
||
|
|
CCImport bean = new CCImport();
|
||
|
|
if (!art.isLocalhost()) {
|
||
|
|
rp = bean.startGoogleFtp(ap, CR);
|
||
|
|
msg.append("Numero record inviati a google via ftp feed " + CR.getGoogleFeedFileName() + ": " + vec.getTotNumberOfRecords() + "\n");
|
||
|
|
msg.append(rp.getMsg());
|
||
|
|
} else {
|
||
|
|
msg.append("thread google xml non avviato sulla crontab perché localhost!!\n");
|
||
|
|
msg.append(rp.getMsg());
|
||
|
|
}
|
||
|
|
msg.append("\n################# Fine crontab Import SEND GOOGLE XML OFFERTE CC (" + DBAdapter.getNow().toString() + ")\n#################");
|
||
|
|
long tn = System.currentTimeMillis();
|
||
|
|
long duration = (tn - t0) / 60000L;
|
||
|
|
msg.append("Durata aggiornamento: " + duration + " minuti.\n");
|
||
|
|
rp.setMsg(msg.toString());
|
||
|
|
System.out.println(msg.toString());
|
||
|
|
return rp;
|
||
|
|
}
|
||
|
|
}
|