Merge pull request 'feat/ocrPictureLog_20240419' (#132) from feat/ocrPictureLog_20240419 into test

Reviewed-on: #132
pull/133/head
guanzheng 1 year ago
commit 0ceb8f614f

@ -0,0 +1,146 @@
<#include "/common/taglibs.html" />
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>查重模型日志</title>
<#include "/head/headlist.html" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox ">
<div class="ibox-content">
<div class="ibox-content">
<form id="searcheuser" class="form-inline">
<!-- <div class="form-group">
<input name='search_callTime' id='search_callTime' class='form-control' placeholder='字段名称'/>
</div>-->
<div class="form-group">
<select class="form-control" name='callStatus' id='callStatus'>
<option value="1">成功</option>
<option value="2">失败</option>
<option value="3">异常</option>
</select>
</div>
<div class="form-group">
<a class="btn btn-primary btn-rounded btn-sm" onclick="refreshTable()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$('#searcheuser')[0].reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</div>
</form>
</div>
</div>
</div>
<div class="ibox-content">
<div class="row row-lg">
<div class="col-sm-12">
<div class="container-div">
<div class="btn-group-sm" id="_mybutton" role="group">
</div>
<br/>
</div>
</div>
<div class="col-sm-12 select-table table-striped" >
<table id="Post_list" ></table>
</div>
</div>
</div>
</div>
<#include "/head/footlist.html" />
</body>
</html>
<script type="text/javascript">
var _tableListPost;
var jsptoolbar = '';
var jspOperation = '';
jQuery(document).ready(function($){
parent.axgetXiaoyao("${ctx}/backstage/admin/user/toolsbarOperation?" + "resourceid=${resourceid}",null,true ,
function(data){
if(data.code == "OK"){
jsptoolbar = data.data.Jsptoolbar;
jspOperation = data.data.JspOperation;
$("#_mybutton").empty();
$(jsptoolbar).each(function (i, toolbar) {
if(toolbar.methodid != '104'){
$("#_mybutton").append('<button class="btn sbold ' + toolbar.img + '" onClick="' + toolbar.actionmethod + '(\'${resourceid}' + toolbar.methodid + '\')"> ' + ' <i class="fa ' + toolbar.methodkey + '"></i> ' + toolbar.text + '</button>&nbsp');
}
});
_tableListPost = $('#Post_list').bootstrapTable({
url: '${ctx}/ocr/picturelog/page',
pagination: true, //是否显示分页(*
pageNumber:1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*
sidePagination: "server",
pageList: [10, 25, 50],
ajaxOptions:{
headers: {"logintoken": parent.getLoginToken()}
},
queryParams: function queryParams(params) {
return {
sortorder: params.order,
sortname: params.sort,
pagesize: params.limit,
start: (params.offset / params.limit) + 1,
callStatus: $("#callStatus").val(),
callTimeStart: params.callTimeStart,
callTimeEnd: params.callTimeEnd,
//search_callStatus:'{"value":"' + $("#search_callStatus").val() + '","op":"equal","type":"string"}',
//search_callTime:'{"value":"' + $("#search_callTime").val() + '","op":"equal","type":"string"}',
};
},
responseHandler:function(res){
return{"rows": res.data.records, "total": res.data.total};
},
columns: [
{checkbox: true},
{ width:100,valign: "middle",field:'callTime',title:'调用时间',sortable:true},
{ width:150,valign: "middle",field:'pictureUrl',title:'图片地址',sortable:true,
formatter: function(value,row,index){
/*if(undefined != row.pictureUrl && null != row.pictureUrl && "null" != row.pictureUrl ){
return '<img src="' + row.pictureUrl + '" style="width:34px;height: 50px;" onerror="noheadimg(this)">';
}else{
return row.pictureUrl;
}*/
return row.pictureUrl
}},
{ width:80,valign: "middle",field:'callStatus',title:'调用状态',sortable:true,
formatter:function(value,oData,index) {
var listOperation = "";
if(oData.callStatus == 1){
listOperation = "成功";
}
else if(oData.callStatus == 2) {
listOperation = "失败";
}
else if(oData.callStatus == 3) {
listOperation = "异常";
}
else{
listOperation = "成功";
}
return listOperation;
}
},
{ width:150,valign: "middle",field:'callMsg',title:'调用信息',sortable:true,}
]
});
}
}
);
});
function getIdSelections() {
return $.map(_tableListPost.bootstrapTable('getSelections'), function(row) {
return row.id
});
}
function refreshTable(sourceid){
_tableListPost.bootstrapTable('refreshOptions',{pageNumber:1});
}
</script>

@ -0,0 +1,58 @@
package cn.jyjz.xiaoyao.ocr.controller;
import cn.jyjz.xiaoyao.admin.service.UserService;
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.mybatisplus.util.SearchQueryFormat;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrField;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog;
import cn.jyjz.xiaoyao.ocr.service.OcrPictureLogService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/ocr/picturelog")
public class OcrPictureLogController extends BaseController {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private OcrPictureLogService ocrPictureLogService;
@Autowired
private UserService userService;
/**
*
* @return
*/
@ApiOperation(value="根据评审类型查询字段列表", notes="根据评审类型查询字段列表")
@GetMapping(value = "/page")
public ResultVo<IPage<OcrPictureLog>> list(@RequestParam(name="start", defaultValue="1") Integer start,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="callStatus", defaultValue="1") Integer callStatus,
HttpServletRequest request) {
QueryWrapper<OcrPictureLog> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("call_status",callStatus);
ResultVo<IPage<OcrPictureLog>> resultVo = new ResultVo<>();
ParamterPage paramterPage = new ParamterPage();
paramterPage.setPagesize(pageSize);
paramterPage.setStart(start);
IPage<OcrPictureLog> ocrPictureLogIPage = ocrPictureLogService.selectSearchListPage(paramterPage, queryWrapper);
resultVo.setData(ocrPictureLogIPage);
resultVo.addOK("查询成功");
return resultVo;
}
}

@ -0,0 +1,37 @@
package cn.jyjz.xiaoyao.ocr.controller;
import cn.jyjz.xiaoyao.admin.service.UserService;
import cn.jyjz.xiaoyao.common.base.controller.BaseController;
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
import cn.jyjz.xiaoyao.ocr.service.OcrConfigurationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("/backstage/oa/picturelogHtml")
public class OcrPictureLogHtmlController extends BaseController{
private Logger log = LoggerFactory.getLogger(this.getClass());
/**
*
*mail.zhangyong@gmail.com
*2024-01-14 10:27:01
**/
@GetMapping("/toList")
public String toListOcrConfiguration(HttpServletResponse response,HttpServletRequest request){
String resourceid = request.getParameter("resourceid");
request.setAttribute("resourceid",resourceid);
return "/backstage/oa/ocr/picturelog/list";
}
}

@ -0,0 +1,14 @@
package cn.jyjz.xiaoyao.ocr.dataDao;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureInfo;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/3/22 07:09
*/
public interface OcrPictureLogMapper extends BaseMapper<OcrPictureLog> {
}

@ -0,0 +1,93 @@
package cn.jyjz.xiaoyao.ocr.dataobject;
import cn.jyjz.xiaoyao.common.base.util.requestFormat.SearchQuery;
import cn.jyjz.xiaoyao.common.mybatisplus.dto.BaseDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.sql.Date;
import java.util.AbstractMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "字段信息", title = "字段信息")
@TableName(value = "ocr_picture_log")
public class OcrPictureLog implements BaseDto, Serializable {
private static final long serialVersionUID = 8088861709460050761L;
@Schema(description = "主键")
@TableId(value = "id",type = IdType.AUTO)
@TableField(value="id")
private Long id;
@Schema(description = "调用时间")
@TableField(value="call_time")
private String callTime;
@Schema(description = "图片地址")
@TableField(value="picture_url")
private String pictureUrl;
@Schema(description = "调用状态")
@TableField(value="call_status")
private String callStatus;
@Schema(description = "调用信息")
@TableField(value="call_msg")
private String callMsg;
@Schema(description = "创建人")
@TableField(value="create_by")
private String createBy;
@Schema(description = "创建时间")
@TableField(value="create_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Schema(description = "修改人")
@TableField(value="update_by")
private String updateBy;
@Schema(description = "修改时间")
@TableField(value="update_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
//保存当前登录用户的数据权限范围的搜索条件
@TableField(exist = false)
@JsonIgnore
private SearchQuery searchQueryrolesShowleave;
@TableField(exist = false)
@JsonIgnore
private final Map<String,String> query = Stream.of(
new AbstractMap.SimpleEntry<>("CALLTIME","call_time"),
new AbstractMap.SimpleEntry<>("REVIEWTYPE","call_status")
)
.collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
@Override
public String getQueryFiled(String filedname){
String obj = null;
if(null != query && query.size() > 0){
obj = query.get(filedname);
}
return obj;
}
}

@ -0,0 +1,17 @@
package cn.jyjz.xiaoyao.ocr.service;
import cn.jyjz.xiaoyao.common.mybatisplus.base.BaseService;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureInfo;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/3/22 07:09
*/
public interface OcrPictureLogService extends BaseService<OcrPictureLog> {
}

@ -0,0 +1,19 @@
package cn.jyjz.xiaoyao.ocr.service.impl;
import cn.jyjz.xiaoyao.common.mybatisplus.base.BaseServiceImpl;
import cn.jyjz.xiaoyao.ocr.dataDao.OcrPictureLogMapper;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog;
import cn.jyjz.xiaoyao.ocr.service.OcrPictureLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/3/22 07:09
*/
@Service
public class OcrPictureLogServiceImpl extends BaseServiceImpl<OcrPictureLogMapper, OcrPictureLog> implements OcrPictureLogService {
}

@ -1,5 +1,10 @@
package cn.jyjz.xiaoyao.ocr.util; package cn.jyjz.xiaoyao.ocr.util;
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.json.JSONUtil;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog;
import cn.jyjz.xiaoyao.ocr.service.OcrPictureLogService;
import cn.jyjz.xiaoyao.ocr.util.httputil.HttpClient; import cn.jyjz.xiaoyao.ocr.util.httputil.HttpClient;
import cn.jyjz.xiaoyao.ocr.util.httputil.HttpHeader; import cn.jyjz.xiaoyao.ocr.util.httputil.HttpHeader;
import cn.jyjz.xiaoyao.ocr.util.httputil.HttpParamers; import cn.jyjz.xiaoyao.ocr.util.httputil.HttpParamers;
@ -10,6 +15,10 @@ 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.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import java.util.HashMap;
import java.util.Map;
public class ImageClassUtil { public class ImageClassUtil {
private static Logger logger = LoggerFactory.getLogger(ImageClassUtil.class); private static Logger logger = LoggerFactory.getLogger(ImageClassUtil.class);
@ -80,14 +89,30 @@ public class ImageClassUtil {
paramersVi.setJsonParamer(jsonObjectVi.toJSONString()); paramersVi.setJsonParamer(jsonObjectVi.toJSONString());
HttpHeader headerVi = null; HttpHeader headerVi = null;
String responseDataVi = ""; String responseDataVi = "";
OcrPictureLog ocrPictureLog = new OcrPictureLog();
try { try {
responseDataVi = HttpClient.doService(serverurl, paramersVi, headerVi, 15000, 30000); responseDataVi = HttpClient.doService(serverurl, paramersVi, headerVi, 15000, 30000);
JSONObject jsonObjectSimi = JSON.parseObject(responseDataVi);
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0") && jsonObjectSimi.get("data") != null && jsonObjectSimi.getJSONArray("data").size() > 0) {
ocrPictureLog.setCallStatus("1");
ocrPictureLog.setCallMsg(responseDataVi);
} else {
ocrPictureLog.setCallStatus("2");
ocrPictureLog.setCallMsg(responseDataVi);
}
} catch (Exception e) { } catch (Exception e) {
logger.error("classify={}",e); logger.error("classify={}", e);
return null; ocrPictureLog.setCallStatus("3");
ocrPictureLog.setCallMsg(responseDataVi+"Exception:"+e.getMessage());
} finally {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
OcrPictureLogService ocrPictureLogService = applicationContext.getBean(OcrPictureLogService.class);
ocrPictureLog.setCallTime(DateUtil.now());
ocrPictureLog.setPictureUrl(imgurl);
ocrPictureLogService.save(ocrPictureLog);
} }
JSONObject jsonObject = JSON.parseObject(responseDataVi); JSONObject jsonObject = JSON.parseObject(responseDataVi);
return jsonObject; return jsonObject;
} }
} }

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.jyjz.xiaoyao.ocr.dataDao.OcrPictureLogMapper">
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureLog">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="create_by" property="createBy" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="BIGINT"/>
<result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
<result column="update_time" property="updateTime" jdbcType="BIGINT"/>
<result column="call_time" property="callTime" jdbcType="VARCHAR"/>
<result column="picture_url" property="pictureUrl" jdbcType="VARCHAR"/>
<result column="call_status" property="callStatus" jdbcType="VARCHAR"/>
<result column="call_msg" property="callMsg" jdbcType="VARCHAR"/>
</resultMap>
</mapper>
Loading…
Cancel
Save