master
周文涛 2 years ago
parent fb740fa111
commit d789fdc880

@ -0,0 +1,70 @@
package org.jeecg.modules.ocr.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: api
* @Author: jeecg-boot
* @Date: 2023-08-15
* @Version: V1.0
*/
@Data
@TableName("oqc_api_error_log")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="oqc_api_error_log对象", description="api请求错误日志")
public class OqcApiErrorLog implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**错误描述*/
@Excel(name = "错误描述", width = 15)
@ApiModelProperty(value = "错误描述")
private java.lang.String errorMsg;
/**代码信息*/
@Excel(name = "代码信息", width = 15)
@ApiModelProperty(value = "代码信息")
private java.lang.String code;
/**api*/
@Excel(name = "api", width = 15)
@ApiModelProperty(value = "api")
private java.lang.String api;
}

@ -8,9 +8,12 @@ import org.jeecg.common.constant.OcrConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.RestUtil;
import org.jeecg.modules.ocr.entity.OcrIdentify;
import org.jeecg.modules.ocr.entity.OqcApiErrorLog;
import org.jeecg.modules.ocr.model.TaskModel;
import org.jeecg.modules.ocr.service.IOcrIdentifyService;
import org.jeecg.modules.ocr.service.IOqcApiErrorLogService;
import org.jeecg.modules.ocr.service.impl.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@ -38,9 +41,13 @@ public class HandleTransInit implements ApplicationRunner {
@Resource
TaskService taskService;
@Resource
IOqcApiErrorLogService oqcApiErrorLogService;
@Resource
IOcrIdentifyService ocrIdentifyService;
@Value("${system.project.enableHandleTask}")
private boolean enableHandleTask;
public static void main(String[] args) {
}
@ -65,17 +72,27 @@ public class HandleTransInit implements ApplicationRunner {
}
log.info("---------检测是否有任务...");
List<TaskModel> taskList = taskService.getTaskList();
if (taskList.size()==0) {
continue;
}
for (TaskModel taskModel : taskList) {
//刷新redis执行中
flushTask(taskModel.getTaskId(), 1);
//执行
executeTaskp(taskModel);
//刷新待运行任务
log.error("任务已执行:"+taskModel.getTaskId());
try {
List<TaskModel> taskList = taskService.getTaskList();
if (taskList.size()==0) {
continue;
}
for (TaskModel taskModel : taskList) {
//刷新redis执行中
flushTask(taskModel.getTaskId(), 1);
//执行
executeTaskp(taskModel);
//刷新待运行任务
log.error("任务已执行:"+taskModel.getTaskId());
}
}catch (Exception e){
OqcApiErrorLog oqcApiErrorLog = new OqcApiErrorLog();
oqcApiErrorLog.setApi("识别:"+e.getClass().toString());
oqcApiErrorLog.setCode(e.getLocalizedMessage());
oqcApiErrorLog.setErrorMsg(e.getMessage());
oqcApiErrorLogService.save(oqcApiErrorLog);
log.error("-----------------出错了------------------");
log.error(e.getMessage());
}
}
}

@ -0,0 +1,17 @@
package org.jeecg.modules.ocr.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.ocr.entity.OqcApiErrorLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: api
* @Author: jeecg-boot
* @Date: 2023-08-15
* @Version: V1.0
*/
public interface OqcApiErrorLogMapper extends BaseMapper<OqcApiErrorLog> {
}

@ -0,0 +1,5 @@
<?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="org.jeecg.modules.ocr.mapper.OqcApiErrorLogMapper">
</mapper>

@ -0,0 +1,14 @@
package org.jeecg.modules.ocr.service;
import org.jeecg.modules.ocr.entity.OqcApiErrorLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: api
* @Author: jeecg-boot
* @Date: 2023-08-15
* @Version: V1.0
*/
public interface IOqcApiErrorLogService extends IService<OqcApiErrorLog> {
}

@ -0,0 +1,19 @@
package org.jeecg.modules.ocr.service.impl;
import org.jeecg.modules.ocr.entity.OqcApiErrorLog;
import org.jeecg.modules.ocr.mapper.OqcApiErrorLogMapper;
import org.jeecg.modules.ocr.service.IOqcApiErrorLogService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: api
* @Author: jeecg-boot
* @Date: 2023-08-15
* @Version: V1.0
*/
@Service
public class OqcApiErrorLogServiceImpl extends ServiceImpl<OqcApiErrorLogMapper, OqcApiErrorLog> implements IOqcApiErrorLogService {
}
Loading…
Cancel
Save