Commit b0c97c63 authored by Quxl's avatar Quxl

x

parent 305a8c28
......@@ -23,6 +23,7 @@ import com.egolm.sso.clients.SAPServiceFactory;
import com.egolm.sso.config.XRException;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.TraceService;
import com.egolm.sso.util.BeanUtil;
import com.egolm.sso.util.CollectionUtil;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.FileUtil;
......@@ -131,6 +132,7 @@ public class SI004INVENTORYSyncOutServiceTask {
NVENTORYR_ITEM.setZVALU(jsonObject.getString("DIS_TAX_AMOUNT"));
NVENTORYR_ITEM_LIST.add(NVENTORYR_ITEM);
}
BeanUtil.setEmptyStringIfNull(mt004INVENTORY);
SI004INVENTORYSyncOut.si004INVENTORYSyncOut(mt004INVENTORY);
String updateSql = "UPDATE t_dis_inventory SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID IN (" + StringUtil.join("?", ", ", idList.size(), "", "") + ")";
jdbcTemplate.update(updateSql, idList.toArray());
......
......@@ -24,6 +24,7 @@ import com.egolm.sso.clients.SI_009_SO_CREATION_AsynOutService.ZDTSD009SOCREATIO
import com.egolm.sso.config.XRException;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.TraceService;
import com.egolm.sso.util.BeanUtil;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.FileUtil;
import com.egolm.sso.util.SqlUtil;
......@@ -142,6 +143,7 @@ public class SI009SOCREATIONAsynOutServiceTask {
}
ZDTSD009SOCREATIONBean.getITEM().add(item);
}
BeanUtil.setEmptyStringIfNull(ZDTSD009SOCREATIONBean);
sI009SOCREATIONAsynOut.si009SOCREATIONAsynOut(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
} catch (Throwable e) {
......
......@@ -265,17 +265,17 @@ public class ZDTSD009SOCREATION {
public static class Header {
@XmlElement(name = "BSTKD_E")
protected String bstkde = "";
protected String bstkde;
@XmlElement(name = "VBELN")
protected String vbeln = "";
protected String vbeln;
@XmlElement(name = "BSTDK")
protected String bstdk = "";
protected String bstdk;
@XmlElement(name = "KUNNR")
protected String kunnr = "";
protected String kunnr;
@XmlElement(name = "KGNNR")
protected String kgnnr = "";
protected String kgnnr;
@XmlElement(name = "QTFLAG")
protected String qtflag = "";
protected String qtflag;
/**
* 获取bstkde属性的值。
......@@ -488,15 +488,15 @@ public class ZDTSD009SOCREATION {
public static class ITEM {
@XmlElement(name = "POSNR")
protected String posnr = "";
protected String posnr;
@XmlElement(name = "VTEXT")
protected String vtext = "";
protected String vtext;
@XmlElement(name = "MATNR")
protected String matnr = "";
protected String matnr;
@XmlElement(name = "KWMENG")
protected String kwmeng = "";
protected String kwmeng;
@XmlElement(name = "EDATU")
protected String edatu = "";
protected String edatu;
/**
* 获取posnr属性的值。
......
......@@ -23,6 +23,7 @@ import com.egolm.sso.clients.SAPServiceFactory;
import com.egolm.sso.config.XRException;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.services.TraceService;
import com.egolm.sso.util.BeanUtil;
import com.egolm.sso.util.CollectionUtil;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.FileUtil;
......@@ -138,6 +139,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
item.setYLZD3(itemObject.getString("YLZD3"));
itemList.add(item);
}
BeanUtil.setEmptyStringIfNull(mt011ACTUALSALES);
SI011ACTUALSALESSyncOut.si011ACTUALSALESSyncOut(mt011ACTUALSALES);
String updateSql = "UPDATE t_dis_sales SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID IN (" + StringUtil.join("?", ", ", idList.size(), "", "") + ")";
jdbcTemplate.update(updateSql, idList.toArray());
......
package com.egolm.sso.util;
import java.lang.reflect.Field;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class BeanUtil {
private static Log logger = LogFactory.getLog(BeanUtil.class);
public static void setEmptyStringIfNull(Object o) {
if(o != null) {
Class<?> clz = o.getClass();
Field[] fields = clz.getDeclaredFields();
for(Field field : fields) {
Class<?> ftype = field.getType();
try {
field.setAccessible(true);
Object fvalue = field.get(o);
if(ftype == String.class) {
if(fvalue == null) {
field.set(o, "");
}
} else if(ftype == List.class) {
List<?> list = (List<?>)fvalue;
for(Object obj : list) {
setEmptyStringIfNull(obj);
}
} else {
setEmptyStringIfNull(fvalue);
}
} catch (Throwable e) {
logger.warn("Null field filling error", e);
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment