|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package cn.jyjz.xiaoyao.ocr.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.jyjz.flowable.domain.vo.FlowInstanceVo;
|
|
|
|
|
import cn.jyjz.flowable.service.IFlowInstanceService;
|
|
|
|
|
import cn.jyjz.xiaoyao.abase.service.SeqManageService;
|
|
|
|
@ -23,6 +25,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
|
|
|
import org.apache.commons.lang.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hpsf.Decimal;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -37,6 +41,7 @@ import java.io.Serializable;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
/**
|
|
|
|
@ -63,6 +68,12 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
|
private OcrTaskchildPictureService ocrTaskchildPictureService;
|
|
|
|
|
@Resource
|
|
|
|
|
IFlowInstanceService flowInstanceService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OcrUsersearchService ocrUsersearchService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OcrPictureclassService ocrPictureclassService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CategoryService categoryService;
|
|
|
|
|
public ResultVo createTaskChild(List<OcrPicture> ocrPictureList, String tenantId , UserToken sysUser, String search_month, HttpServletRequest request, String buessinessno){
|
|
|
|
@ -468,5 +479,187 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<OcrPicture> queryPageByUserSearchId(Integer pageNo, Integer pageSize, String userSearchId) {
|
|
|
|
|
OcrUsersearch ocrUsersearch= ocrUsersearchService.selectByUserSearchId(userSearchId);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<OcrPicture> queryWrapper = new QueryWrapper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (OcrUsersearchchild usersearchchild : ocrUsersearch.getOcrUsersearchchildList()) {
|
|
|
|
|
this.formattingSearchChild(queryWrapper,usersearchchild);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//分页查询并组装子集数据
|
|
|
|
|
Page<OcrPicture> page = new Page<OcrPicture>(pageNo, pageSize);
|
|
|
|
|
IPage<OcrPicture> pageList = this.page(page, queryWrapper);
|
|
|
|
|
for(OcrPicture ocrPicture1:pageList.getRecords()){
|
|
|
|
|
if(StringUtils.isNotBlank(ocrPicture1.getPictureclassid())){
|
|
|
|
|
OcrPictureclass ocrPictureclass = ocrPictureclassService.getById(ocrPicture1.getPictureclassid());
|
|
|
|
|
ocrPicture1.setOcrPictureclass(ocrPictureclass);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pageList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 格式化筛选关系
|
|
|
|
|
* @param queryWrapper
|
|
|
|
|
* @param usersearchchild
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private QueryWrapper<OcrPicture> formattingSearchChild(QueryWrapper<OcrPicture> queryWrapper,OcrUsersearchchild usersearchchild ){
|
|
|
|
|
switch (usersearchchild.getSearchRelationType()){
|
|
|
|
|
case "where":
|
|
|
|
|
this.formattingSearchType(queryWrapper,usersearchchild);
|
|
|
|
|
break;
|
|
|
|
|
case "and":
|
|
|
|
|
queryWrapper.and(wrapper->this.formattingSearchType(wrapper,usersearchchild));
|
|
|
|
|
break;
|
|
|
|
|
case "or":
|
|
|
|
|
queryWrapper.or(wrapper->this.formattingSearchType(wrapper,usersearchchild));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return queryWrapper;
|
|
|
|
|
}
|
|
|
|
|
return queryWrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 格式化查询类型
|
|
|
|
|
* @param queryWrapper
|
|
|
|
|
* @param usersearchchild
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private QueryWrapper<OcrPicture> formattingSearchType(QueryWrapper<OcrPicture> queryWrapper,OcrUsersearchchild usersearchchild){
|
|
|
|
|
//查询类型 相等true 不相等fase
|
|
|
|
|
boolean queryType = "eq".equals(usersearchchild.getSearchtype());
|
|
|
|
|
|
|
|
|
|
//1.获取检查数据,确定数据类型
|
|
|
|
|
String valueType = clickSearchValue(usersearchchild.getSearchvalue());
|
|
|
|
|
List<String> arrayData = null; //集合型数据
|
|
|
|
|
List<Integer> sectionInts =null; //纯数字区间型数据
|
|
|
|
|
String[] sections =null; //字符串区间型数据
|
|
|
|
|
DateTime beginTime =null; //日期时间区间型数据
|
|
|
|
|
DateTime endTime=null; //日期时间区间型数据
|
|
|
|
|
|
|
|
|
|
//2.根据数据类型,解构数据
|
|
|
|
|
switch (valueType){
|
|
|
|
|
case "array":
|
|
|
|
|
//处理多文件
|
|
|
|
|
String [] datas =usersearchchild.getSearchvalue().split(",");
|
|
|
|
|
arrayData = Arrays.asList(datas);
|
|
|
|
|
break;
|
|
|
|
|
case "section":
|
|
|
|
|
//格式化数据,仅在做区间的时候去除空格,其他地方不进行空格去除.
|
|
|
|
|
sections =usersearchchild.getSearchvalue().trim().replaceAll("\\s+", "").split("-");
|
|
|
|
|
//校验是否纯数字,纯数字的话,要转成int,否则比对时会有问题
|
|
|
|
|
sectionInts= new ArrayList<>();
|
|
|
|
|
for (String data : sections) {
|
|
|
|
|
if(data.matches("\\d+")){
|
|
|
|
|
sectionInts.add(Integer.parseInt(data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "time":
|
|
|
|
|
//格式化时间数据
|
|
|
|
|
String[] times =usersearchchild.getSearchvalue().trim().replaceAll("\\s+", "").split("-");
|
|
|
|
|
beginTime = DateUtil.parse(times[0],"yyyy/MM/dd");
|
|
|
|
|
endTime = DateUtil.parse(times[1],"yyyy/MM/dd");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.根据查询类型 组装查询条件 相等
|
|
|
|
|
switch (valueType){
|
|
|
|
|
case "array":
|
|
|
|
|
//集合数据
|
|
|
|
|
//相等
|
|
|
|
|
if(queryType){
|
|
|
|
|
queryWrapper.in(usersearchchild.getSearchfield(),arrayData);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//不相等
|
|
|
|
|
queryWrapper.notIn(usersearchchild.getSearchfield(),arrayData);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "section":
|
|
|
|
|
//数字区间查询
|
|
|
|
|
if(sectionInts!=null && sectionInts.size()==2){
|
|
|
|
|
if(queryType) {
|
|
|
|
|
//相等
|
|
|
|
|
queryWrapper.between(usersearchchild.getSearchfield(),sectionInts.get(0),sectionInts.get(1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//不相等
|
|
|
|
|
queryWrapper.notBetween(usersearchchild.getSearchfield(),sectionInts.get(0),sectionInts.get(1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//字符串区间查询
|
|
|
|
|
if(queryType) {
|
|
|
|
|
//相等
|
|
|
|
|
queryWrapper.between(usersearchchild.getSearchfield(),sections[0],sections[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//不相等
|
|
|
|
|
queryWrapper.notBetween(usersearchchild.getSearchfield(),sections[0],sections[1]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "time":
|
|
|
|
|
//时间区间数据
|
|
|
|
|
//相等
|
|
|
|
|
if(queryType) {
|
|
|
|
|
queryWrapper.between(usersearchchild.getSearchfield(),beginTime.getTime(),endTime.getTime());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//不相等
|
|
|
|
|
queryWrapper.notBetween(usersearchchild.getSearchfield(),beginTime.getTime(),endTime.getTime());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
if(queryType) {
|
|
|
|
|
queryWrapper.eq(usersearchchild.getSearchfield(), usersearchchild.getSearchvalue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
queryWrapper.ne(usersearchchild.getSearchfield(), usersearchchild.getSearchvalue());
|
|
|
|
|
}
|
|
|
|
|
return queryWrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查数据类型 不同类型处理方案不同
|
|
|
|
|
* 集合型 格式: xxx,xxx (array)
|
|
|
|
|
* 区间型 格式: xxx-xxx (section)
|
|
|
|
|
* 时间区间型 格式: xxxx/xx/xx-xxxx/xx/xx (time)
|
|
|
|
|
* 通用型 格式: xxxx (text)
|
|
|
|
|
* @param searchvalue
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String clickSearchValue(String searchvalue){
|
|
|
|
|
searchvalue = searchvalue.trim().replaceAll("\\s+", "");
|
|
|
|
|
//1.判断是否为数组格式
|
|
|
|
|
if(searchvalue.indexOf(",")>0){
|
|
|
|
|
return "array";
|
|
|
|
|
}
|
|
|
|
|
//2.判断是否为区间
|
|
|
|
|
if(searchvalue.indexOf("-")>0){
|
|
|
|
|
String [] datas = searchvalue.split("-");
|
|
|
|
|
if(datas!=null && datas.length==2){
|
|
|
|
|
//2.1 判断是时间区间,还是数字区间
|
|
|
|
|
try {
|
|
|
|
|
DateTime beginTime = DateUtil.parse(datas[0],"yyyy/MM/dd");
|
|
|
|
|
DateTime endTime = DateUtil.parse(datas[0],"yyyy/MM/dd");
|
|
|
|
|
if(beginTime!=null && endTime!=null){
|
|
|
|
|
return "time";
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
}
|
|
|
|
|
return "section";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//3.都不是就按text文本处理
|
|
|
|
|
return "text";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|