|
|
@ -24,7 +24,9 @@ import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.apache.catalina.core.ApplicationContext;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -61,6 +63,50 @@ public class OcrCheckDuplicateController {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@GetMapping(value = "/openCheckDuplicate")
|
|
|
|
@GetMapping(value = "/openCheckDuplicate")
|
|
|
|
public ResultVo checkDuplicate(OcrPicture ocrPicture, HttpServletRequest req) {
|
|
|
|
public ResultVo checkDuplicate(OcrPicture ocrPicture, HttpServletRequest req) {
|
|
|
|
|
|
|
|
// // 1. 查询已有的 2000 多条数据
|
|
|
|
|
|
|
|
// QueryWrapper<OcrPicture> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
// queryWrapper.eq("tenant_id", 1714887674875514880L);
|
|
|
|
|
|
|
|
// queryWrapper.eq("suspiciousfile", "0");
|
|
|
|
|
|
|
|
// queryWrapper.isNotNull("local_pictrue_url");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 获取现有的 2000 多条数据
|
|
|
|
|
|
|
|
// List<OcrPicture> originalList = ocrPictureService.listPage(queryWrapper);
|
|
|
|
|
|
|
|
// if (originalList == null || originalList.isEmpty()) {
|
|
|
|
|
|
|
|
// throw new RuntimeException("未找到符合条件的 OcrPicture 数据");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 2. 扩展到 100,000 条
|
|
|
|
|
|
|
|
// List<OcrPicture> newPictureList = new ArrayList<>();
|
|
|
|
|
|
|
|
// int multiplier = 50; // 每条记录复制 50 次
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// for (OcrPicture ocrPicture1 : originalList) {
|
|
|
|
|
|
|
|
// for (int i = 0; i < multiplier; i++) {
|
|
|
|
|
|
|
|
// OcrPicture newOcrPicture = new OcrPicture();
|
|
|
|
|
|
|
|
// newOcrPicture.setTenantId(ocrPicture1.getTenantId());
|
|
|
|
|
|
|
|
// newOcrPicture.setSuspiciousfile(ocrPicture1.getSuspiciousfile());
|
|
|
|
|
|
|
|
// newOcrPicture.setSubmitDateTimestamp(ocrPicture1.getSubmitDateTimestamp());
|
|
|
|
|
|
|
|
// newOcrPicture.setLocalpictrueurl(ocrPicture1.getLocalpictrueurl());
|
|
|
|
|
|
|
|
// newOcrPicture.setImgHash(ocrPicture1.getImgHash());
|
|
|
|
|
|
|
|
// newOcrPicture.setCreateBy(ocrPicture1.getCreateBy());
|
|
|
|
|
|
|
|
// newOcrPicture.setCreateTime(ocrPicture1.getCreateTime());
|
|
|
|
|
|
|
|
// newPictureList.add(newOcrPicture);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 3. 批量插入数据库
|
|
|
|
|
|
|
|
// if (!newPictureList.isEmpty()) {
|
|
|
|
|
|
|
|
// // 每次批量插入 1000 条,防止数据量过大导致内存溢出
|
|
|
|
|
|
|
|
// int batchSize = 1000;
|
|
|
|
|
|
|
|
// for (int i = 0; i < newPictureList.size(); i += batchSize) {
|
|
|
|
|
|
|
|
// int end = Math.min(i + batchSize, newPictureList.size());
|
|
|
|
|
|
|
|
// List<OcrPicture> batchList = newPictureList.subList(i, end);
|
|
|
|
|
|
|
|
// ocrPictureService.saveBatch(batchList); // saveBatch 为 MyBatis-Plus 的批量插入方法
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// System.out.println("数据扩展并插入完成,新增数据条数: " + newPictureList.size());
|
|
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取当前登录人
|
|
|
|
//获取当前登录人
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(req));
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(req));
|
|
|
@ -110,6 +156,7 @@ public class OcrCheckDuplicateController {
|
|
|
|
queryWrapper.eq("suspiciousfile", "0");
|
|
|
|
queryWrapper.eq("suspiciousfile", "0");
|
|
|
|
queryWrapper.orderBy(true,true,"submit_date_timestamp");
|
|
|
|
queryWrapper.orderBy(true,true,"submit_date_timestamp");
|
|
|
|
queryWrapper.isNotNull("local_pictrue_url");
|
|
|
|
queryWrapper.isNotNull("local_pictrue_url");
|
|
|
|
|
|
|
|
// queryWrapper.isNotNull("img_hash");
|
|
|
|
List<OcrPicture> pageList = ocrPictureService.listPage(queryWrapper);
|
|
|
|
List<OcrPicture> pageList = ocrPictureService.listPage(queryWrapper);
|
|
|
|
if (null != pageList && !pageList.isEmpty()) {
|
|
|
|
if (null != pageList && !pageList.isEmpty()) {
|
|
|
|
if (pageList.size() == 1) {
|
|
|
|
if (pageList.size() == 1) {
|
|
|
|