|
|
@ -3,26 +3,22 @@ package cn.jyjz.xiaoyao.ocr.controller;
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.LogService;
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.LogService;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.RequestBaseUtil;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.RequestBaseUtil;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
import cn.jyjz.xiaoyao.common.mybatisplus.util.SearchQueryFormat;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureclass;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureclass;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureclassService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureclassService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrTaskchildPictureService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrTaskchildPictureService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.DataUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.DataUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchConfigEnum;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchConfigEnum;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchParaFormatting;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
@ -32,15 +28,11 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.UserService;
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.UserService;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.controller.BaseController;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.controller.BaseController;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.param.ParamterPage;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.requestFormat.SearchQuery;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVo;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVo;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@ -148,11 +140,15 @@ public class OcrPictureController extends BaseController{
|
|
|
|
String buessinessno = req.getParameter("buessinessno");
|
|
|
|
String buessinessno = req.getParameter("buessinessno");
|
|
|
|
|
|
|
|
|
|
|
|
//搜索时间段
|
|
|
|
//搜索时间段
|
|
|
|
|
|
|
|
// String search_month = req.getParameter("search_month");
|
|
|
|
|
|
|
|
// if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0){
|
|
|
|
|
|
|
|
// queryWrapper.le("create_time", DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
|
|
|
|
|
|
|
|
// }else if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) > 20){
|
|
|
|
|
|
|
|
// queryWrapper.le("create_time",DataUtil.afterDateByWeek(Integer.parseInt(search_month) - 20));
|
|
|
|
|
|
|
|
// }
|
|
|
|
String search_month = req.getParameter("search_month");
|
|
|
|
String search_month = req.getParameter("search_month");
|
|
|
|
if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0){
|
|
|
|
if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0){
|
|
|
|
queryWrapper.le("create_time", DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
|
|
|
|
queryWrapper.le("create_time",DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
|
|
|
|
}else if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) > 20){
|
|
|
|
|
|
|
|
queryWrapper.le("create_time",DataUtil.afterDateByWeek(Integer.parseInt(search_month) - 20));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否需要查询历史记录
|
|
|
|
//判断是否需要查询历史记录
|
|
|
@ -160,6 +156,18 @@ public class OcrPictureController extends BaseController{
|
|
|
|
queryWrapper.eq("taskstatus", search_history);
|
|
|
|
queryWrapper.eq("taskstatus", search_history);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据参数枚举,获取检索参数,并映射为数据库的字段的key-v map
|
|
|
|
|
|
|
|
Map<String,Object> paraMap = new HashMap<>();
|
|
|
|
|
|
|
|
for(SearchConfigEnum config : SearchConfigEnum.values()){
|
|
|
|
|
|
|
|
String searchvalue = req.getParameter(config.getId());
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(searchvalue)){
|
|
|
|
|
|
|
|
paraMap.put(config.getMeaning(),searchvalue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//调用查询参数解析方法,解析为queryWrapper
|
|
|
|
|
|
|
|
queryWrapper = SearchParaFormatting.searchParaParse(queryWrapper,paraMap);
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.eq("tenant_id",tenantId);
|
|
|
|
queryWrapper.eq("tenant_id",tenantId);
|
|
|
|
|
|
|
|
|
|
|
|
List<OcrPicture> pageList = ocrPictureService.listPage(queryWrapper);
|
|
|
|
List<OcrPicture> pageList = ocrPictureService.listPage(queryWrapper);
|
|
|
@ -173,7 +181,6 @@ public class OcrPictureController extends BaseController{
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
return ResultVoUtil.error("没有查重数据。");
|
|
|
|
return ResultVoUtil.error("没有查重数据。");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//return Result.error("失败。");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -217,41 +224,16 @@ public class OcrPictureController extends BaseController{
|
|
|
|
queryWrapper.le("create_time",DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
|
|
|
|
queryWrapper.le("create_time",DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据参数枚举,获取检索参数,并映射为数据库的字段的key-v map
|
|
|
|
|
|
|
|
Map<String,Object> paraMap = new HashMap<>();
|
|
|
|
for(SearchConfigEnum config : SearchConfigEnum.values()){
|
|
|
|
for(SearchConfigEnum config : SearchConfigEnum.values()){
|
|
|
|
|
|
|
|
String searchvalue = req.getParameter(config.getId());
|
|
|
|
//相似度不在搜索范围内
|
|
|
|
if(StringUtils.isNotBlank(searchvalue)){
|
|
|
|
if(!config.getId().equals("izSimilarity")){
|
|
|
|
paraMap.put(config.getMeaning(),searchvalue);
|
|
|
|
String searchvalue = req.getParameter(config.getId());
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(searchvalue)){
|
|
|
|
|
|
|
|
if(config.getId().equals("izYear")){
|
|
|
|
|
|
|
|
//针对年份搜索,需要拆分
|
|
|
|
|
|
|
|
String[] year = searchvalue.split(",");
|
|
|
|
|
|
|
|
//当前数据必须是两条
|
|
|
|
|
|
|
|
if(year.length == 2){
|
|
|
|
|
|
|
|
java.text.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
|
|
Date start = null;
|
|
|
|
|
|
|
|
Date end = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
start = sdf.parse(year[0]);
|
|
|
|
|
|
|
|
end = sdf.parse(year[1]);
|
|
|
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.ge(config.getMeaning(),start);
|
|
|
|
|
|
|
|
queryWrapper.le(config.getMeaning(),end);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
queryWrapper.eq(config.getMeaning(),searchvalue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//调用查询参数解析方法,解析为queryWrapper
|
|
|
|
|
|
|
|
queryWrapper = SearchParaFormatting.searchParaParse(queryWrapper,paraMap);
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.eq("tenant_id",tenantId);
|
|
|
|
queryWrapper.eq("tenant_id",tenantId);
|
|
|
|
Page<OcrPicture> page = new Page<OcrPicture>(pageNo, pageSize);
|
|
|
|
Page<OcrPicture> page = new Page<OcrPicture>(pageNo, pageSize);
|
|
|
|