|
|
|
@ -21,6 +21,8 @@ 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 io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
|
@ -50,6 +52,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
* @version 1.0
|
|
|
|
|
* @date 2024/3/14 19:47
|
|
|
|
|
*/
|
|
|
|
|
@Api(tags = "ocr_无量云拉取")
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/test/api")
|
|
|
|
@ -94,6 +97,7 @@ public class PrevailCloudApiController {
|
|
|
|
|
* @param request
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "全量拉取", notes = "全量拉取")
|
|
|
|
|
@GetMapping("pullPictureAllByAccountNo")
|
|
|
|
|
public String pullPictureAllByAccountNo(HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
@ -143,6 +147,7 @@ public class PrevailCloudApiController {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("pullPictureByOneAccountNo")
|
|
|
|
|
@ApiOperation(value = "单次拉取", notes = "单业务主体拉取指定条数")
|
|
|
|
|
public String pullPictureByOneAccountNo(HttpServletRequest request) {
|
|
|
|
|
String beginStr = request.getParameter("beginStr");
|
|
|
|
|
String endStr = request.getParameter("endStr");
|
|
|
|
@ -205,83 +210,6 @@ public class PrevailCloudApiController {
|
|
|
|
|
return "处理失败";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("psTest")
|
|
|
|
|
public String psTset(HttpServletRequest request) {
|
|
|
|
|
String beginStr = request.getParameter("beginStr");
|
|
|
|
|
String endStr = request.getParameter("endStr");
|
|
|
|
|
String pageSize = request.getParameter("pageSize");
|
|
|
|
|
String pageNo = request.getParameter("pageNo");
|
|
|
|
|
String tenantNoStr = request.getParameter("tenantNo");
|
|
|
|
|
if (StringUtils.isBlank(tenantNoStr)) {
|
|
|
|
|
return "租户不能为空";
|
|
|
|
|
}
|
|
|
|
|
String accountNoStr = request.getParameter("accountNo");
|
|
|
|
|
if (StringUtils.isBlank(accountNoStr)) {
|
|
|
|
|
return "业务主体不能为空";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Department> departments = departmentMybatisDao.selectList(new QueryWrapper<>());
|
|
|
|
|
if (CollectionUtils.isEmpty(departments)) {
|
|
|
|
|
return "业务主体数据为空";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<Long, Department> departmentMap = Maps.newHashMapWithExpectedSize(departments.size());
|
|
|
|
|
for (Department department : departments) {
|
|
|
|
|
departmentMap.put(department.getId(), department);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (departmentMap.isEmpty()) {
|
|
|
|
|
return "业务主体数据为空";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PictureSourceParameter pictureSourceParameter = new PictureSourceParameter();
|
|
|
|
|
DateTime dateTime = DateUtil.parse(beginStr + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
DateTime dateTime1 = DateUtil.parse(endStr + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Instant binstant = dateTime.toInstant();
|
|
|
|
|
Instant einstant = dateTime1.toInstant();
|
|
|
|
|
pictureSourceParameter.setStartTime(Date.from(binstant));
|
|
|
|
|
pictureSourceParameter.setEndTime(Date.from(einstant));
|
|
|
|
|
pictureSourceParameter.setPageNo(Integer.parseInt(pageNo));
|
|
|
|
|
pictureSourceParameter.setPageSize(Integer.parseInt(pageSize));
|
|
|
|
|
|
|
|
|
|
List<PictureSourceResult> totalList = Lists.newArrayList();
|
|
|
|
|
for (Department department : departments) {
|
|
|
|
|
if (!departmentMap.containsKey(department.getParentid())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Long tenantNo = Long.valueOf(departmentMap.get(department.getParentid()).getDeptno());
|
|
|
|
|
Long accountNo = Long.valueOf(department.getDeptno());
|
|
|
|
|
pictureSourceParameter.setTenantNo(tenantNo);
|
|
|
|
|
pictureSourceParameter.setAccountNo(accountNo);
|
|
|
|
|
|
|
|
|
|
List<PictureSourceResult> resultList = prevailCloudApi.getPictureSourceResultApiPage(pictureSourceParameter, false);
|
|
|
|
|
if (CollectionUtils.isEmpty(resultList)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalList.addAll(resultList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (PictureSourceResult pictureSourceResult : totalList) {
|
|
|
|
|
//1.如果不存在图片默认一个默认图片,方便走测试。
|
|
|
|
|
if (pictureSourceResult.getLivePhoto() == null) {
|
|
|
|
|
List<Map<String, Object>> livePhoto = new ArrayList<>();
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("imgUrl", StringUtils.isEmpty(apiConfig.getDefaultPictureImg()) ? "http://47.93.59.251/api/image/default.png" : apiConfig.getDefaultPictureImg());
|
|
|
|
|
map.put("imgName", "default.png");
|
|
|
|
|
livePhoto.add(map);
|
|
|
|
|
pictureSourceResult.setLivePhoto(livePhoto);
|
|
|
|
|
}
|
|
|
|
|
//赋值默认参数
|
|
|
|
|
pictureSourceResult.setRequestParam(pictureSourceParameter);
|
|
|
|
|
//将可以处理数据放入处理队列中
|
|
|
|
|
TaskQueue.pictureDisposePushData(pictureSourceResult, ocrPictureService, ocrPrevailCloudLogService);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "处理成功";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/pullPictureByParameter")
|
|
|
|
|
public Boolean pullPictureByParameter(String parameterString, Long id) {
|
|
|
|
|
OcrPrevailCloudLog byId = ocrPrevailCloudLogService.getById(id);
|
|
|
|
@ -334,8 +262,9 @@ public class PrevailCloudApiController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("psTest01")
|
|
|
|
|
public String psTset01(HttpServletRequest request) {
|
|
|
|
|
@GetMapping("/pullBatchPictureByParameter")
|
|
|
|
|
@ApiOperation(value = "批量拉取", notes = "时间区间多业务主体拉取")
|
|
|
|
|
public String pullBatchPictureByParameter(HttpServletRequest request) {
|
|
|
|
|
String beginStr = request.getParameter("beginStr");
|
|
|
|
|
String endStr = request.getParameter("endStr");
|
|
|
|
|
String pageSize = request.getParameter("pageSize");
|
|
|
|
|