|
|
|
@ -13,22 +13,21 @@ import cn.jyjz.xiaoyao.ocr.api.entity.PictureSourceResult;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.api.thread.PullAllPictureSourceThread;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.api.utils.ApiConfig;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.api.utils.ApiPage;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.common.PrevailCloudConstant;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPrevailCloudLogService;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.thread.TaskQueue;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.RequestParameterFormat;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import lombok.extern.flogger.Flogger;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import sun.nio.ch.ThreadPool;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
@ -38,7 +37,11 @@ import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
import java.util.concurrent.LinkedBlockingDeque;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 无量云api控制器
|
|
|
|
@ -87,6 +90,7 @@ public class PrevailCloudApiController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 拉取无量云全量任务数据,根据业务主体
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -279,11 +283,23 @@ public class PrevailCloudApiController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/pullPictureByParameter")
|
|
|
|
|
public Boolean pullPictureByParameter(String parameterString) {
|
|
|
|
|
public Boolean pullPictureByParameter(String parameterString, Long id) {
|
|
|
|
|
OcrPrevailCloudLog byId = ocrPrevailCloudLogService.getById(id);
|
|
|
|
|
if (byId == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PictureSourceParameter pictureSourceParameter = RequestParameterFormat.fromString(parameterString);
|
|
|
|
|
List<PictureSourceResult> resultList = prevailCloudApi.getPictureSourceResultApiPage(pictureSourceParameter);
|
|
|
|
|
if (CollectionUtils.isEmpty(resultList)) {
|
|
|
|
|
return false;
|
|
|
|
|
//更新日志
|
|
|
|
|
OcrPrevailCloudLog ocrPrevailCloudLog = OcrPrevailCloudLog.builder()
|
|
|
|
|
.status(100)
|
|
|
|
|
.id(id)
|
|
|
|
|
.time(byId.getTime() + 1)
|
|
|
|
|
.build();
|
|
|
|
|
ocrPrevailCloudLogService.updateById(ocrPrevailCloudLog);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (PictureSourceResult pictureSourceResult : resultList) {
|
|
|
|
@ -299,7 +315,7 @@ public class PrevailCloudApiController {
|
|
|
|
|
//赋值默认参数
|
|
|
|
|
pictureSourceResult.setRequestParam(pictureSourceParameter);
|
|
|
|
|
//将可以处理数据放入处理队列中
|
|
|
|
|
TaskQueue.pictureDisposePushData(pictureSourceResult, ocrPictureService, ocrPrevailCloudLogService);
|
|
|
|
|
TaskQueue.pictureDisposePushDataUpdateLog(pictureSourceResult, id, ocrPictureService, ocrPrevailCloudLogService);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|