パッケージcom.hopechart.platform.provider.test;
インポートjava.lang.reflect.Field;
インポートjava.lang.reflect.Method;
インポートjava.util.Arrays;
import java.util.Date;
インポートjava.util.LinkedHashSet;
インポートjava.util.Random;
import java.util.Set;
インポートcom.fasterxml.jackson.module.scala.introspect.PropertyDescriptor;
インポートcom.hopechart.dataquery.typecrane.ChassisLTDataPer10Min;
インポートcom.hopechart.dataquery.typecrane.ChassisLTDataPer1Sec;
インポートcom.hopechart.dataquery.typecrane.ChassisLTDataPer5Min;
インポートcom.hopechart.dataquery.typecrane.CraneLTDataPer1Sec;
インポートcom.hopechart.dataquery.typecrane.CraneLTDataPer5Min;
インポートcom.hopechart.dataquery.typecrane.CraneLTDataSwitch;
インポートcom.hopechart.platform.provider.component.cc.util.FormatCanData;
インポートcom.hopechart.platform.provider.component.cc.vo.crane.CDBase;
インポートcom.hopechart.platform.provider.component.cc.vo.crane.CDSwitch;
インポートcom.hopechart.platform.provider.component.cc.vo.crane.CDSwitchDown;
インポートcom.hopechart.platform.provider.component.cc.vo.crane.ResultCraneData;
インポートcom.hopechart.platform.provider.component.log.annotation.FieldMeta;
インポートcom.hopechart.platform.provider.component.redis.pojo.MonitorBaseData;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CBaseWatch;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CGPSWatch;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CSwitchWatch;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CWorkCondWatch;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CWorkWatch;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.CraneMonitorData;
インポートcom.hopechart.platform.provider.component.redis.pojo.crane.StockEqMonitorInfoVo;
インポートcom.hopechart.platform.provider.modules.carTrack.pojo.CarTrackParamVo;
インポートcom.hopechart.platform.provider.modules.video.pojo.LoginYSYParam;
インポートcom.hopechart.platform.provider.util.DataUtil;
インポートcom.hopechart.platform.provider.util.MGDecoder;
インポートcom.hopechart.platform.provider.util.TimeUtil;
public class test { public static void main(String [] args){
CSwitchWatch s = new CSwitchWatch();
// for(int i = 8; i <16; i ++){ // System.out.println( "String val" +(i)+ "= cd.get(FormatCanData.formatCanDateKey(Constant.cId18ff6831、@ ! "+ i +" @!、@!@!))+ @!@!; "); // System.out.println( "this.switch" +(i)+ "= checkSwitchData(val" + i + ")?invalidData:stateTags [Integer.parseInt(val" + i + ")];"); //} // LoginYSYParam s = new LoginYSYParam(); // s.setLoginType((byte)0); // s.setUserName( "test"); // s.setUserPassword( "12344"); getFiledName(s); // System.out.println(formatHttpGetParam(s)); // test123 s = new test123(); // getFiledName(s);
// Set <Integer> r = new LinkedHashSet <Integer>(10);
//ランダムランダム= new Random();
//
// while(r.size()<10){ // int i = random.nextInt(5); // r.add(i); //} // System.out.println(Arrays.toString(r.toArray())); }
private static String [] getFiledName(Object o){
Field [] fields = o.getClass()。getDeclaredFields();
String [] fieldNames = new String [fields.length];
for(int i = 0; i <fields.length; i ++){
文字列fieldName = fields [i] .getName();
文字列firstLetter = fieldName.substring(0、1).toUpperCase();
System.out.println( "originalMap.put(!@" + fieldName + "!@、data.get" + firstLetter + fieldName.substring(1)+ "());");
// System.out.println( "re.put(@!" + fieldName + "@!、monitor.get" + firstLetter + fieldName.substring(1)+ "()!= null?monitor.get" + firstLetter + fieldName.substring(1)+ "():@!@!);");
// String str = "upBaseList.add(new CarTrackParamVo(codeMap.get(Constant。" + fieldName + "Id).getCodeName()、data.getBaseSaveTime()、data.getBaseSaveTime()、data.get" + firstLetter + fieldName .substring(1)+ "()、null、null、this.carVin、Constant.code_type_base、Constant。"
// String str = "downWorkCondList.add(new CarTrackParamVo(codeMap.get(Constant。" + fieldName + "Id).getCodeName()、data.getWorkCondSaveTime()、data.getWorkCondSaveTime()、data.get" + firstLetter + fieldName .substring(1)+ "()、null、null、this.carVin、Constant.code_type_work_cond、Constant。" + fieldName + "Id + 12));";
//
// String str = "downSwitchList.add(new CarTrackParamVo(codeMap.get(Constant。" + fieldName + "Id).getCodeName()、data.getSwitchSaveTime()、data.getSwitchSaveTime()、data.get" + firstLetter + fieldName.substring(1)+ "()、null、null、this.carVin、Constant.code_type_switch、Constant。" + fieldName + "Id + 12));";
// String str = "downWorkList.add(new CarTrackParamVo(codeMap.get(Constant。" + fieldName + "Id).getCodeName()、data.getWorkSaveTime()、data.getWorkSaveTime()、data.get" + firstLetter + fieldName .substring(1)+ "()、null、null、this.carVin、Constant.code_type_work、Constant。" + fieldName + "Id + 12));";
// System.out.println(str); '
// String str = "switchMap.put(Constant。" + fieldName + "Id、cd.getValueByID(Constant。" + fieldName + "Id));";
// System.out.println(str);
// System.out.println( "this。" + fieldName + "= cd.get" + firstLetter + fieldName.substring(1)+ "();");
//System.out.println("this。"+fieldName + "= defaultData;");
// String getter = "data.set" + firstLetter + fieldName.substring(1)+ "(" + fieldName + ");";
// System.out.println(getter);
// String getter = null;
// if(i <33){ // getter = "data.set" + firstLetter + fieldName.substring(1)+ "(switchWatch.get" + firstLetter + fieldName.substring(1)+ "()!= null ?switchWatch.get "+ firstLetter + fieldName.substring(1)+"()。toString():Constant.NO_DATA_TAG); "; //} else { // getter = "data.set" + firstLetter + fieldName.substring(1)+ "(switchWatch.get" + firstLetter + fieldName.substring(1)+ "()!= null?CSwitchWatch.stateTags [switchWatch.get "+ firstLetter + fieldName。 substring(1)+ "()。intValue()]:Constant.NO_DATA_TAG);"; //}
//
// this.switch158 = checkSwitchData(cd.getValueByID(Constant.switch158Id))?invalidData
//:alamTags [Integer.parseInt(cd
// .getValueByID(Constant.switch158Id))];
// getter = "this。" + fieldName + "= checkSwitchData(cd.getValueByID(Constant。" + fieldName + "Id))?invalidData:cd.getValueByID(Constant。" + fieldName + "Id);";
// String getter = "re。" + fieldName + "= per.get" + firstLetter + fieldName.substring(1)+ "();";
//System.out.println(getter);
// String getter = "data.set" + firstLetter + fieldName.substring(1)+ "(Constant.NO_DATA_TAG);" ;
// String getter = "data.set" + firstLetter + fieldName.substring(1)+ "(stockWatchData.get" + firstLetter + fieldName.substring(1)+ "()!= null?String.valueOf(stockWatchData.get "+ firstLetter + fieldName.substring(1)+"()):Constant.NO_DATA_TAG); " ;
// System.out.println(getter);
//System.out.println(withinRange);
// System.out.println( "if(per.get" + firstLetter + fieldName.substring(1)+ "()!= null){");
// System.out.println( "re。" + fieldName + "=(DataUtil.byteBoundary(DataUtil.parseInt(per.get" + firstLetter + fieldName.substring(1)+ "())、DataUtil.BYTE_BOUNDARY_WORD)?" );
// System.out.println( "invalidData");
//System.out。
// System.out.println( "} else {");
// System.out.println( "re。" + fieldName + "= invalidData;");
// System.out.println( "}");
// System.out.println( "re。" + fieldName + "= DataUtil.byteBoundary(per.get" + firstLetter + fieldName.substring(1)+ "()、DataUtil.BYTE_BOUNDARY_BYTE_FF)?invalidData" +
// ": String.valueOf(per.get "+ firstLetter + fieldName.substring(1)+"()); ");
// System.out.println( "caseConstant。" + fields [i] .getName()+ "Id:");
// System.out.println( "re。" + fieldName + "= per.get" + firstLetter + fieldName.substring(1)+ "();");
// System.out.println( "" + fields [i]。getName()+ "=((Number)value).longValue();");
// System.out.println( "break;");
// System.out.println( "this。" + fieldName + "= cd.getValueByID(Constant。" + fieldName + "Id);");
// System.out.println( "switchMap.put(Constant。" + fieldName + "Id、cd.getValueByID(Constant。" + fieldName + "Id));");
//必要态データセット
//System.out.println("data.set"+firstLetter+ fieldName.substring(1)+ "(switchWatch.get" + firstLetter + fieldName.substring(1)+ "()!= null? CDSwitch.stateTags [switchWatch.get "+ firstLetter + fieldName.substring(1)+"()。intValue()]:Constant.NO_DATA_TAG); ");
// System.out.println( "caseConstant。" + fieldName + ":");
//
// System.out.println( "productModel = Constant。" + fieldName + "_ STR;
// System.out.println( "public static final String" + fieldName + "_ STR = '" + fieldName.replace( "CCWC_"、 "")+ "';");
}
return fieldNames;
}
private static String formatHttpGetParam(Object obj){ StringBuffer ret = new StringBuffer(); { Field [] fields = obj.getClass()。getDeclaredFields();を試してください 。 for(int i = 0; i <fields.length; i ++){ Field f = fields [i]; f.setAccessible(true); //コード名=言語值& ret.append(f.getName())。append( "=")。append(f.get(obj)== null? "":f.get(obj))。append ( "&"); } } catch(例外e){ ret = null; } return ret.toString(); }
/ *根被言語名获取言語值
*
private static Object getFieldValueByName(String fieldName、Object o){
try {
String firstLetter = fieldName.substring(0、1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
//メソッドmethod = o.getClass()。getMethod(getter、new Class [] {});
//オブジェクト値= method.invoke(o、new Object [] {});
nullを返します。
} catch(Exception e){
return null;
}
} * /
}