|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.jyjz.xiaoyao.ocr.controller;
|
|
|
|
package cn.jyjz.xiaoyao.ocr.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.api.PrevailCloudApi;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.api.PrevailCloudApi;
|
|
|
@ -71,4 +72,78 @@ public class ApiTestController {
|
|
|
|
return "处理失败";
|
|
|
|
return "处理失败";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("psTest01")
|
|
|
|
|
|
|
|
public String psTset01(HttpServletRequest request){
|
|
|
|
|
|
|
|
String beginStr = request.getParameter("beginStr");
|
|
|
|
|
|
|
|
String endStr = request.getParameter("endStr");
|
|
|
|
|
|
|
|
String pageSize = request.getParameter("pageSize");
|
|
|
|
|
|
|
|
String pageNo = request.getParameter("pageNo");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PictureSourceParameter pictureSourceParameter = new PictureSourceParameter();
|
|
|
|
|
|
|
|
pictureSourceParameter.setPageSize(Integer.parseInt(pageSize));
|
|
|
|
|
|
|
|
pictureSourceParameter.setTenantNo(1714548920583360512L);
|
|
|
|
|
|
|
|
pictureSourceParameter.setAccountNo(1714887674875514880L);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime startDate = DateUtil.parse(beginStr + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
DateTime endDate = DateUtil.parse(endStr + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
int totalCount = 0;
|
|
|
|
|
|
|
|
int totalLocalCount = 0;
|
|
|
|
|
|
|
|
int totalSize = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (startDate.isBefore(endDate) || startDate.compareTo(endDate) == 0) {
|
|
|
|
|
|
|
|
int currentPage = Integer.parseInt(pageNo);
|
|
|
|
|
|
|
|
boolean hasNextPage = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (hasNextPage) {
|
|
|
|
|
|
|
|
// 设置当天的开始和结束时间
|
|
|
|
|
|
|
|
Instant startInstant = startDate.toInstant();
|
|
|
|
|
|
|
|
Instant endInstant = startDate.offsetNew(DateField.DAY_OF_YEAR, 1).toInstant();
|
|
|
|
|
|
|
|
pictureSourceParameter.setStartTime(Date.from(startInstant));
|
|
|
|
|
|
|
|
pictureSourceParameter.setEndTime(Date.from(endInstant));
|
|
|
|
|
|
|
|
pictureSourceParameter.setPageNo(currentPage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiPage<PictureSourceResult> apiPage = prevailCloudApi.pullPictureSource(pictureSourceParameter);
|
|
|
|
|
|
|
|
List<PictureSourceResult> listResult = apiPage.getRecords();
|
|
|
|
|
|
|
|
int count = apiPage.getTotal();
|
|
|
|
|
|
|
|
int localCount = listResult.size();
|
|
|
|
|
|
|
|
int size = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (PictureSourceResult pictureSourceResult : listResult) {
|
|
|
|
|
|
|
|
if (pictureSourceResult.getLivePhoto() != null) {
|
|
|
|
|
|
|
|
size++;
|
|
|
|
|
|
|
|
//将可以处理数据放入处理队列中
|
|
|
|
|
|
|
|
TaskQueue.pictureDisposePushData(pictureSourceResult);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
totalCount += count;
|
|
|
|
|
|
|
|
totalLocalCount += localCount;
|
|
|
|
|
|
|
|
totalSize += size;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输出当前日期范围内的统计信息
|
|
|
|
|
|
|
|
System.out.println(startDate.toString("yyyy-MM-dd") + " 图片总数:" + count + "条,本次获取:" + localCount + "条,可处理数据:" + size + "条");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 准备处理下一页的数据
|
|
|
|
|
|
|
|
currentPage++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否有下一页
|
|
|
|
|
|
|
|
if (localCount < Integer.parseInt(pageSize)) {
|
|
|
|
|
|
|
|
hasNextPage = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 准备处理下一天的数据
|
|
|
|
|
|
|
|
startDate = startDate.offsetNew(DateField.DAY_OF_YEAR, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "当前区间内图片总数:" + totalCount + "条,本次获取:" + totalLocalCount + "条,可处理数据:" + totalSize + "条";
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "处理失败";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|