|
@@ -40,7 +40,6 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
* @param ydClient
|
|
|
*/
|
|
|
public BudgetListenerForProject(YDClient ydClient, String projectId, String yearStr) {
|
|
|
- System.out.println("开始解析数据");
|
|
|
System.out.println("开始解析数据....");
|
|
|
this.ydClient = ydClient;
|
|
|
this.projectId = projectId;
|
|
@@ -59,7 +58,7 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
if(data.getType()==null||data.getType().equals("")){
|
|
|
return;
|
|
|
}
|
|
|
- System.out.println("解析到一条数据:"+ JSON.toJSONString(data));
|
|
|
+// System.out.println("解析到一条数据:"+ JSON.toJSONString(data));
|
|
|
list.add(data);
|
|
|
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
|
|
|
// if (list.size() >= BATCH_COUNT) {
|
|
@@ -78,7 +77,7 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
public void doAfterAllAnalysed(AnalysisContext context) {
|
|
|
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
|
|
saveData();
|
|
|
- System.out.println("所有数据解析完成!");
|
|
|
+// System.out.println("所有数据解析完成!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -97,7 +96,7 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
for (Budget budget:list){
|
|
|
String data=ReflectUtil.invoke(budget, keys[i]);
|
|
|
if(data!=null&&!data.equals("")&&!data.equals("0")){
|
|
|
- System.out.println("月份:"+i+"类型:"+budget.getType()+"数据值:"+data);
|
|
|
+// System.out.println("月份:"+i+"类型:"+budget.getType()+"数据值:"+data);
|
|
|
switch (budget.getType()){
|
|
|
case "收入":
|
|
|
type1= NumberUtil.add(type1,data).toString();
|
|
@@ -119,17 +118,16 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- resultdata.add(UtilMap.map("yearMonth, type1, type2, type3, type4, type5",yearMonth,type1,type2,type3,type4,type5));
|
|
|
+ resultdata.add(UtilMap.map("yearMonth, yearMonthStr, type1, type2, type3, type4, type5",yearMonth,yearMonthStr,type1,type2,type3,type4,type5));
|
|
|
}
|
|
|
saveData(resultdata);
|
|
|
- System.out.println("存储数据库成功!");
|
|
|
+// System.out.println("存储数据库成功!");
|
|
|
}
|
|
|
|
|
|
private void saveData(List<Map> resultdata){
|
|
|
List<Map> list=(List<Map>) ydClient.queryData(YDParam.builder().formUuid("FORM-97BA6C6C8C50416A9E5854F2F4B5C3F3R4WC").appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP").searchCondition(JSONObject.toJSONString(UtilMap.map("textField_ltxrn8h1",projectId))).build(),
|
|
|
YDConf.FORM_QUERY.retrieve_list_all).getData();
|
|
|
- System.out.println(list.size());
|
|
|
if(list==null||list.size()<1){
|
|
|
return;
|
|
|
}
|
|
@@ -161,6 +159,7 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
used5="0";
|
|
|
}
|
|
|
table.get(UtilMap.getInt(detail,"index")).put("numberField_ludre3z5",NumberUtil.sub(String.valueOf(map.get("type5")),used5).toString()); // 剩余设备定额
|
|
|
+ detail.put("textField_luh0k82j",map.get("yearMonthStr"));
|
|
|
}else{
|
|
|
Map detail=new HashMap();
|
|
|
detail.put("dateField_lrru2tnr",yearMonth);
|
|
@@ -168,6 +167,12 @@ public class BudgetListenerForProject extends AnalysisEventListener<Budget> {
|
|
|
detail.put("numberField_lrru2tnt",map.get("type2")); // 人工定额
|
|
|
detail.put("numberField_lrru2tnu",map.get("type3")); // 物耗定额
|
|
|
detail.put("numberField_lrru2tnx",map.get("type4")); // 其他定额
|
|
|
+ detail.put("numberField_lrru2tnw",map.get("type5")); // 设备定额
|
|
|
+ detail.put("numberField_lrru2tnv",map.get("type3"));// 剩余物耗定额
|
|
|
+ detail.put("numberField_ludre3z5",map.get("type5")); // 剩余设备定额
|
|
|
+ detail.put("numberField_ludujw4f",0); // 已用物耗定额
|
|
|
+ detail.put("numberField_ludujw4i",0); // 已用设备定额
|
|
|
+ detail.put("textField_luh0k82j",map.get("yearMonthStr"));
|
|
|
table.add(detail);
|
|
|
}
|
|
|
}
|