|
@@ -6,10 +6,11 @@ import cn.cslg.pas.common.model.vo.TaskParams;
|
|
import cn.cslg.pas.common.model.vo.UploadParamsVO;
|
|
import cn.cslg.pas.common.model.vo.UploadParamsVO;
|
|
import cn.cslg.pas.common.utils.DateUtils;
|
|
import cn.cslg.pas.common.utils.DateUtils;
|
|
import cn.cslg.pas.common.utils.JsonUtils;
|
|
import cn.cslg.pas.common.utils.JsonUtils;
|
|
|
|
+import cn.cslg.pas.domain.PatentInstructionText;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ReflectionUtils;
|
|
import org.springframework.util.ReflectionUtils;
|
|
|
|
|
|
-import java.lang.reflect.Field;
|
|
|
|
|
|
+import java.lang.reflect.*;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -40,6 +41,8 @@ public class UploadSettingTest {
|
|
jsonData = constant.getColumn();
|
|
jsonData = constant.getColumn();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // TODO: 2022/7/1 从解析出来的配置文件Json里面和Excel解析出来的栏位进行匹配 FOR循环 能不能在减少一层?
|
|
|
|
+ // TODO: 2022/7/1 接入分割处理方法 处理Excel解析数据 然后作为参数装配进 UploadParamsVO里面 如何实现?
|
|
|
|
|
|
try {
|
|
try {
|
|
for (int i = 0; i < taskParams.getRowList().size(); i++) {
|
|
for (int i = 0; i < taskParams.getRowList().size(); i++) {
|
|
@@ -58,6 +61,16 @@ public class UploadSettingTest {
|
|
ReflectionUtils.setField(propertyList, uploadParamsVO, DateUtils.getDateTime(value.toString()));
|
|
ReflectionUtils.setField(propertyList, uploadParamsVO, DateUtils.getDateTime(value.toString()));
|
|
break;
|
|
break;
|
|
case "String":
|
|
case "String":
|
|
|
|
+ if (!jsonDatum.getSplitSymbol().equals("")) {
|
|
|
|
+ // TODO: 2022/7/1 进入到数据拆分流程 新建方法将分隔符以参数的形式传入拆分公用方法内
|
|
|
|
+ System.out.println("此处为进行数据拆分部分 待开发");
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ PatentInstructionText patentInstructionText = new PatentInstructionText();
|
|
|
|
+ patentInstructionText.setManual(value.toString());
|
|
|
|
+ ReflectionUtils.setField(propertyList, uploadParamsVO.getPatentInstructionTextList()
|
|
|
|
+ .add(patentInstructionText), value.toString());
|
|
|
|
+ }
|
|
ReflectionUtils.setField(propertyList, uploadParamsVO, value.toString());
|
|
ReflectionUtils.setField(propertyList, uploadParamsVO, value.toString());
|
|
break;
|
|
break;
|
|
case "Integer":
|
|
case "Integer":
|
|
@@ -69,8 +82,69 @@ public class UploadSettingTest {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- System.out.println(uploadParamsVO.getPatentNo());
|
|
|
|
- System.out.println(uploadParamsVO.getApplicationDate());
|
|
|
|
|
|
+// System.out.println(uploadParamsVO.getPatentNo());
|
|
|
|
+// System.out.println(uploadParamsVO.getApplicationDate());
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ UploadParamsVO obj = new UploadParamsVO();
|
|
|
|
+ PatentInstructionText a = new PatentInstructionText();
|
|
|
|
+ a.setManual("1");
|
|
|
|
+ a.setManualOut("1");
|
|
|
|
+ a.setPatentId(1);
|
|
|
|
+ List<PatentInstructionText> aa = new ArrayList<>();
|
|
|
|
+ aa.add(a);
|
|
|
|
+ obj.setPatentInstructionTextList(aa);
|
|
|
|
+ List<PatentInstructionText> B = obj.getPatentInstructionTextList();
|
|
|
|
+ B.add(a);
|
|
|
|
+ B.add(a);
|
|
|
|
+ B.add(a);
|
|
|
|
+ obj.setPatentInstructionTextList(B);
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Field[] fields = obj.getClass().getDeclaredFields();
|
|
|
|
+ for (Field field : fields) {
|
|
|
|
+ if (!field.isAccessible()) {
|
|
|
|
+ field.setAccessible(true);
|
|
|
|
+ }
|
|
|
|
+ if (List.class.isAssignableFrom(field.getType())) {
|
|
|
|
+ Method vvv = List.class.getDeclaredMethod("get", int.class);
|
|
|
|
+ System.out.println(vvv);
|
|
|
|
+ Method m = List.class.getDeclaredMethod("size");
|
|
|
|
+ int size = 0;//调用list的size方法,得到list的长度
|
|
|
|
+ //size = (Integer) m.invoke(field.get(obj));
|
|
|
|
+ System.out.println(size);
|
|
|
|
+ Type t = field.getGenericType();
|
|
|
|
+ if (t instanceof ParameterizedType) {
|
|
|
|
+ ParameterizedType pt = (ParameterizedType) t;
|
|
|
|
+ Class clz = (Class) pt.getActualTypeArguments()[0];//得到对象list中实例的类型
|
|
|
|
+ System.out.println(clz.getName());//获得List的泛型类型
|
|
|
|
+ Field gg = clz.getDeclaredField("manual");
|
|
|
|
+ gg.setAccessible(true);
|
|
|
|
+ gg.set(obj.getPatentInstructionTextList().get(0).getManual(),"1");
|
|
|
|
+ obj.getPatentInstructionTextList().get(0).getId();
|
|
|
|
+ System.out.println("1");
|
|
|
|
+ //获取集合的第一个对象
|
|
|
|
+ for (int i = 0; i < size; i++) {//遍历list,调用get方法,获取list中的对象实例
|
|
|
|
+ Method getM = List.class.getDeclaredMethod("get", int.class);
|
|
|
|
+ if (!getM.isAccessible()) {
|
|
|
|
+ getM.setAccessible(true);
|
|
|
|
+ }
|
|
|
|
+ Object list_i_Obj = getM.invoke(field.get(obj), i);
|
|
|
|
+ System.out.println(list_i_Obj);
|
|
|
|
+ //集合中的每个元素对象
|
|
|
|
+ //获取每个对象的cargoNumber属性值
|
|
|
|
+ Field cnField = clz.getDeclaredField("cargoNumber");
|
|
|
|
+ cnField.setAccessible(true);
|
|
|
|
+ Object o = cnField.get(list_i_Obj);//每个元素对象中的cargoNumber值
|
|
|
|
+ System.out.println(o.toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|