You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.0 KiB
Java
118 lines
4.0 KiB
Java
3 years ago
|
import com.caucho.xml.SAXBuilder;
|
||
|
import org.dom4j.Document;
|
||
|
import org.dom4j.DocumentHelper;
|
||
|
import org.dom4j.Element;
|
||
|
import weaver.conn.RecordSet;
|
||
|
import weaver.general.BaseBean;
|
||
|
import weaver.general.Util;
|
||
|
import weaver.interfaces.tisco.dzbz.DzbzUtil;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* 电子报账信息接口
|
||
|
*/
|
||
|
public class DzbzDBWbsImpl extends BaseBean implements DzbzDBWbs {
|
||
|
public String PROCESSDBSYReturn = "SUCCESS";
|
||
|
/**
|
||
|
* 获取电子报账待办
|
||
|
* @param DBSYINFO
|
||
|
* @return
|
||
|
*/
|
||
|
public String PROCESSDBSY(String DBSYINFO){
|
||
|
|
||
|
System.out.println("dbxml======="+DBSYINFO);
|
||
|
int modeid = Util.getIntValue(getPropValue("dzbz","dzbzmodeid"));
|
||
|
SAXBuilder sb = new SAXBuilder();
|
||
|
try {
|
||
|
Map map = new HashMap();
|
||
|
String loginid = "";
|
||
|
Document doc = DocumentHelper.parseText(DBSYINFO); //将字符串转为XML
|
||
|
// 取的根元素
|
||
|
Element rootElt = doc.getRootElement();
|
||
|
// 得到根元素所有子元素的集合
|
||
|
List<Element> sons = rootElt.elements();//获取当前节点的子节点
|
||
|
if(0 != sons.size()) {
|
||
|
for (Element el : sons) {
|
||
|
String key = el.getName().trim();
|
||
|
String value = el.getText().trim();
|
||
|
System.out.println(key+"============"+value);
|
||
|
if("todouserid".equals(key)){
|
||
|
loginid=value;
|
||
|
}
|
||
|
// setFieldValueByName(key,dzbzBean,value);
|
||
|
map.put(key,value);
|
||
|
}
|
||
|
}
|
||
|
RecordSet rs = new RecordSet();
|
||
|
rs.execute("select id from hrmresource where loginid='"+loginid+"'");
|
||
|
rs.next();
|
||
|
int userid = Util.getIntValue(rs.getString("id"),0);
|
||
|
DzbzUtil.createmodedata(modeid,userid,map);
|
||
|
}catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
return PROCESSDBSYReturn;
|
||
|
}
|
||
|
|
||
|
|
||
|
// private void setFieldValueByName(String fieldName, Object o,Object value) {
|
||
|
// try {
|
||
|
// String firstLetter = fieldName.substring(0, 1).toUpperCase();
|
||
|
// String getter = "set" + firstLetter + fieldName.substring(1);
|
||
|
// Method method = o.getClass().getMethod(getter, new Class[] {o.getClass().getDeclaredField(fieldName).getType()});
|
||
|
// method.invoke(o, new Object[] {getClassTypeValue(o.getClass().getDeclaredField(fieldName).getType(),value)});
|
||
|
// } catch (Exception e) {
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
//
|
||
|
// private static Object getClassTypeValue(Class<?> typeClass, Object value){
|
||
|
// if(typeClass == int.class || value instanceof Integer){
|
||
|
// if(null == value){
|
||
|
// return 0;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == short.class){
|
||
|
// if(null == value){
|
||
|
// return 0;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == byte.class){
|
||
|
// if(null == value){
|
||
|
// return 0;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == double.class){
|
||
|
// if(null == value){
|
||
|
// return 0;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == long.class){
|
||
|
// if(null == value){
|
||
|
// return 0;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == String.class){
|
||
|
// if(null == value){
|
||
|
// return "";
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == boolean.class){
|
||
|
// if(null == value){
|
||
|
// return true;
|
||
|
// }
|
||
|
// return value;
|
||
|
// }else if(typeClass == BigDecimal.class){
|
||
|
// if(null == value){
|
||
|
// return new BigDecimal(0);
|
||
|
// }
|
||
|
// return new BigDecimal(value+"");
|
||
|
// }else {
|
||
|
// return typeClass.cast(value);
|
||
|
// }
|
||
|
// }
|
||
|
}
|