|
@@ -131,7 +131,7 @@ public class ScheduleTask {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 项目总表表2未填写完成统计
|
|
* 项目总表表2未填写完成统计
|
|
|
- * 每日8点50
|
|
|
|
|
|
|
+ * 每日9点55
|
|
|
*/
|
|
*/
|
|
|
@Scheduled(cron = "0 55 9 * * ?")
|
|
@Scheduled(cron = "0 55 9 * * ?")
|
|
|
public void table2IncompleteStatistics() {
|
|
public void table2IncompleteStatistics() {
|
|
@@ -160,6 +160,7 @@ public class ScheduleTask {
|
|
|
boolean hasMore = true;
|
|
boolean hasMore = true;
|
|
|
int pageNo = 1;
|
|
int pageNo = 1;
|
|
|
JSONArray records;
|
|
JSONArray records;
|
|
|
|
|
+ log.info("查询【表2】项目台账所有项目状态为Pending、Done、Closed的记录");
|
|
|
while(hasMore){
|
|
while(hasMore){
|
|
|
aiTableResult = aiTableClient.queryMultiRecords(baseId,sheetIdOrName,param,aiTableParam);
|
|
aiTableResult = aiTableClient.queryMultiRecords(baseId,sheetIdOrName,param,aiTableParam);
|
|
|
hasMore = aiTableResult.getHasMore();
|
|
hasMore = aiTableResult.getHasMore();
|
|
@@ -195,11 +196,16 @@ public class ScheduleTask {
|
|
|
JSONObject fields;
|
|
JSONObject fields;
|
|
|
String unionIdPM;
|
|
String unionIdPM;
|
|
|
String checkFailureStr;
|
|
String checkFailureStr;
|
|
|
|
|
+ JSONArray pmJSONArray;
|
|
|
// System.out.println("表2PM:");
|
|
// System.out.println("表2PM:");
|
|
|
for(int i=0;i<table2RecordsFilter.size();i++){
|
|
for(int i=0;i<table2RecordsFilter.size();i++){
|
|
|
table2Record = table2RecordsFilter.getJSONObject(i);
|
|
table2Record = table2RecordsFilter.getJSONObject(i);
|
|
|
fields = table2Record.getJSONObject("fields");
|
|
fields = table2Record.getJSONObject("fields");
|
|
|
- unionIdPM = fields.getJSONArray("PM(Owner)【人事】").getJSONObject(0).getString("unionId");
|
|
|
|
|
|
|
+ pmJSONArray = fields.getJSONArray("PM(Owner)【人事】");
|
|
|
|
|
+ if(pmJSONArray == null){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ unionIdPM = pmJSONArray.getJSONObject(0).getString("unionId");
|
|
|
for(String checkEmptyField : checkEmptyFieldArr){
|
|
for(String checkEmptyField : checkEmptyFieldArr){
|
|
|
if(StringUtils.isEmpty(fields.getString(checkEmptyField))){
|
|
if(StringUtils.isEmpty(fields.getString(checkEmptyField))){
|
|
|
checkFailureStr = unionIdPM + "_" + checkEmptyField+"未填写";
|
|
checkFailureStr = unionIdPM + "_" + checkEmptyField+"未填写";
|
|
@@ -208,6 +214,8 @@ public class ScheduleTask {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+// System.out.println("checkEmptyRecordList:");
|
|
|
|
|
+// System.out.println(JSON.toJSONString(checkEmptyRecordList));
|
|
|
/*
|
|
/*
|
|
|
查询【参数表-人事】部门为销售部、客服部的记录
|
|
查询【参数表-人事】部门为销售部、客服部的记录
|
|
|
*/
|
|
*/
|
|
@@ -225,13 +233,15 @@ public class ScheduleTask {
|
|
|
conditions.add(condition);
|
|
conditions.add(condition);
|
|
|
filter.put("conditions",conditions);
|
|
filter.put("conditions",conditions);
|
|
|
aiTableParam.setFilter(filter);
|
|
aiTableParam.setFilter(filter);
|
|
|
|
|
+ log.info("查询【参数表-人事】部门为销售部、客服部的记录");
|
|
|
aiTableResult = aiTableClient.queryMultiRecords(baseId,sheetIdOrName,param,aiTableParam);
|
|
aiTableResult = aiTableClient.queryMultiRecords(baseId,sheetIdOrName,param,aiTableParam);
|
|
|
|
|
+ hasMore = aiTableResult.getHasMore();
|
|
|
|
|
+ log.info("是否有更多数据:"+hasMore);
|
|
|
log.info("销售和PM人员记录数="+aiTableResult.getRecords().size());
|
|
log.info("销售和PM人员记录数="+aiTableResult.getRecords().size());
|
|
|
records = aiTableResult.getRecords();
|
|
records = aiTableResult.getRecords();
|
|
|
for(int i=0;i<records.size();i++){
|
|
for(int i=0;i<records.size();i++){
|
|
|
empRecordsFilter.add(records.getJSONObject(i));
|
|
empRecordsFilter.add(records.getJSONObject(i));
|
|
|
}
|
|
}
|
|
|
- log.info("是否有更多数据:"+hasMore);
|
|
|
|
|
JSONObject empRecord;
|
|
JSONObject empRecord;
|
|
|
String deptId;
|
|
String deptId;
|
|
|
String unionIdPMLeader;
|
|
String unionIdPMLeader;
|
|
@@ -258,7 +268,6 @@ public class ScheduleTask {
|
|
|
JSONObject insertData = new JSONObject();
|
|
JSONObject insertData = new JSONObject();
|
|
|
JSONArray insertRecords = new JSONArray();
|
|
JSONArray insertRecords = new JSONArray();
|
|
|
JSONObject insertRecord;
|
|
JSONObject insertRecord;
|
|
|
- JSONArray pmJSONArray;
|
|
|
|
|
JSONArray pmLeaderJSONArray;
|
|
JSONArray pmLeaderJSONArray;
|
|
|
JSONObject unionIdJSONObject;
|
|
JSONObject unionIdJSONObject;
|
|
|
for(String str : checkEmptyRecordList){
|
|
for(String str : checkEmptyRecordList){
|
|
@@ -279,7 +288,7 @@ public class ScheduleTask {
|
|
|
fields.put("填写情况", str.split("_")[1]);
|
|
fields.put("填写情况", str.split("_")[1]);
|
|
|
insertRecord = new JSONObject();
|
|
insertRecord = new JSONObject();
|
|
|
insertRecord.put("fields",fields);
|
|
insertRecord.put("fields",fields);
|
|
|
- log.info(JSON.toJSONString(insertRecord));
|
|
|
|
|
|
|
+// log.info(JSON.toJSONString(insertRecord));
|
|
|
insertRecords.add(insertRecord);
|
|
insertRecords.add(insertRecord);
|
|
|
}
|
|
}
|
|
|
String result;
|
|
String result;
|
|
@@ -298,7 +307,7 @@ public class ScheduleTask {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
insertData.put("records",newInsertRecords);
|
|
insertData.put("records",newInsertRecords);
|
|
|
- log.info(JSON.toJSONString(insertData));
|
|
|
|
|
|
|
+// log.info(JSON.toJSONString(insertData));
|
|
|
result = aiTableClient.createMultiRecords(baseId,sheetIdOrName,param,insertData);
|
|
result = aiTableClient.createMultiRecords(baseId,sheetIdOrName,param,insertData);
|
|
|
log.info("新增项目台账填写情况表记录结果,第"+pageNo+"页:");
|
|
log.info("新增项目台账填写情况表记录结果,第"+pageNo+"页:");
|
|
|
log.info(result);
|
|
log.info(result);
|
|
@@ -308,7 +317,7 @@ public class ScheduleTask {
|
|
|
}
|
|
}
|
|
|
if(insertRecords.size() > 0){
|
|
if(insertRecords.size() > 0){
|
|
|
insertData.put("records",insertRecords);
|
|
insertData.put("records",insertRecords);
|
|
|
- log.info(JSON.toJSONString(insertData));
|
|
|
|
|
|
|
+// log.info(JSON.toJSONString(insertData));
|
|
|
sheetIdOrName = "OTgxt4G";
|
|
sheetIdOrName = "OTgxt4G";
|
|
|
result = aiTableClient.createMultiRecords(baseId,sheetIdOrName,param,insertData);
|
|
result = aiTableClient.createMultiRecords(baseId,sheetIdOrName,param,insertData);
|
|
|
log.info("新增项目台账填写情况表记录结果,第"+pageNo+"页:");
|
|
log.info("新增项目台账填写情况表记录结果,第"+pageNo+"页:");
|