Commit c55906ff by 黄明步

更新

parent e0c8e4a2
......@@ -169,6 +169,13 @@
</exclusion>
</exclusions>
</dependency>
<!--redisson 用于分布式锁-->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.10.6</version>
</dependency>
</dependencies>
<build>
......
package com.gxmailu.ocrCloudPlatform.config;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* @author Hmb
* @since 2023/12/5 15:30
*/
@Component
public class DistributedRedisLock {
@Autowired
private RedissonClient redissonClient;
private static final String LOCK_TITLE = "redisLock_";
/**
* 获取公平锁
* @param lockName
* @return
*/
public boolean getFairLock(String lockName) {
// 声明key对象
String key = LOCK_TITLE + lockName;
// 获取公平锁对象
RLock fairLock = redissonClient.getFairLock(key);
// 尝试加锁,并且设置锁过期时间为3秒,防止死锁的产生
try {
return fairLock.tryLock(0, 3, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
// 在这里需要处理线程中断异常,比如记录日志,或者将异常传递出去
return false;
}
}
/**
* 释放锁
* @param lockName
*/
public void unlock(String lockName) {
// 必须是和加锁时的同一个key
String key = LOCK_TITLE + lockName;
// 获取所对象
RLock lock = redissonClient.getFairLock(key);
// 释放锁
if(lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
package com.gxmailu.ocrCloudPlatform.config;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Hmb
* @since 2023/12/5 15:27
*/
@Configuration
public class RedissonConfig {
@Autowired
private RedisProperties redisProperties;
private static final String REDIS_PROTOCOL = "redis://";
@Bean(destroyMethod = "shutdown")
public RedissonClient redisson() {
Config config = new Config();
RedisProperties.Cluster cluster = redisProperties.getCluster();
String password = redisProperties.getPassword();
if (ObjUtil.isNotNull(cluster) && CollUtil.isNotEmpty(cluster.getNodes())) {
config.useClusterServers()
// 集群状态扫描间隔时间,单位是毫秒
.setScanInterval(2000)
.addNodeAddress(getNodeAddresses())
.setPassword(password);
} else {
// 单机模式
SingleServerConfig serverConfig = config.useSingleServer()
.setAddress(REDIS_PROTOCOL + redisProperties.getHost() + ":" + redisProperties.getPort());
if (StrUtil.isNotBlank(password)) {
serverConfig.setPassword(password);
}
}
return Redisson.create(config);
}
public String[] getNodeAddresses() {
return redisProperties.getCluster().getNodes().stream().map(node -> REDIS_PROTOCOL + node).toArray(String[]::new);
}
}
......@@ -27,10 +27,16 @@ public class RetransmissionController {
}
@PostMapping("/ofs/api/sync/v1/{code}")
public OcrResult CommonRecognition(@PathVariable("code") String code, String fileId,
public OcrResult commonRecognition(@PathVariable("code") String code, String fileId,
MultipartFile file, Boolean createOfd,
HttpServletRequest request) {
return retransmissionService.CommonRecognition(code, fileId, file, createOfd, request);
return retransmissionService.commonRecognition(code, fileId, file, createOfd, request);
}
@PostMapping("/ofs/api/sync/v2/{code}")
public OcrResult commonRecognitionV2(@PathVariable("code") String code, String fileId,
MultipartFile file, Boolean createOfd,
HttpServletRequest request) {
return retransmissionService.commonRecognitionV2(code, fileId, file, createOfd, request);
}
@PostMapping("/ofs/api/sync/v1/pdf")
......@@ -38,16 +44,31 @@ public class RetransmissionController {
retransmissionService.downloadDoubleDeckPdf(body, request, response);
}
@PostMapping("/ofs/api/sync/v1/ft/pdf")
public void downloadDoubleDeckPdfByFt(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) {
retransmissionService.downloadDoubleDeckPdf(body, request, response);
}
@PostMapping("/ofs/api/sync/v1/odf")
public void downloadDoubleDeckOfd(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) {
retransmissionService.downloadDoubleDeckOfd(body, request, response);
}
@PostMapping("/ofs/api/sync/v1/ft/odf")
public void downloadDoubleDeckOfdByFt(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) {
retransmissionService.downloadDoubleDeckOfd(body, request, response);
}
@PostMapping("/ofs/api/sync/v1/ft/1001")
public OcrResult fullTextRecognition(String fileId, MultipartFile file, HttpServletRequest request) {
return retransmissionService.fullTextRecognition(fileId, file, request);
}
@PostMapping("/ofs/api/sync/v2/ft/1001")
public OcrResult fullTextRecognitionV2(String fileId, MultipartFile file, HttpServletRequest request) {
return retransmissionService.fullTextRecognitionV2(fileId, file, request);
}
@PostMapping("/ofs/api/sync/v1/kv/{code}")
public OcrResult cardRecognition(@PathVariable("code") Integer code, String fileId, MultipartFile file,
HttpServletRequest request) {
......@@ -66,4 +87,10 @@ public class RetransmissionController {
return retransmissionService.formatRestoration(fileId, file, request);
}
@PostMapping("/ofs/api/file/convert")
public void fileConvert(String fileId, MultipartFile srcFile, String dstFileType,
HttpServletRequest request, HttpServletResponse response) {
retransmissionService.fileConvert(fileId, srcFile, dstFileType, request, response);
}
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Data
public class AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 任务ID
*/
@TableField("task_id")
private String taskId;
/**
* 应用ID
*/
@TableField("application_id")
private Long applicationId;
/**
* 用户ID
*/
@TableField("user_id")
private Long userId;
/**
* 能力ID
*/
@TableField("ability_id")
private Long abilityId;
/**
* IP地址
*/
@TableField("ip")
private String ip;
/**
* 调用时间
*/
@TableField("call_time")
private LocalDateTime callTime;
/**
* 识别状态
*/
@TableField("ocr_state")
private Byte ocrState;
/**
* 客户端传的文件唯一标识
*/
@TableField("file_id")
private String fileId;
/**
* 待识别文件原始文件名
*/
@TableField("origin_name")
private String originName;
/**
* 待识别文件保存文件名
*/
@TableField("ocr_file_name")
private String ocrFileName;
/**
* 待识别文件url
*/
@TableField("src_url")
private String srcUrl;
/**
* 文件大小
*/
@TableField("length")
private Long length;
/**
* 文件CRC32校验码
*/
@TableField("crc32")
private Long crc32;
/**
* 文件的CheckSum
*/
@TableField("`checksum`")
private String checksum;
/**
* 识别结果
*/
@TableField("result")
private String result;
/**
* 结果类型
*/
@TableField("result_type")
private Integer resultType;
/**
* 识别结果保存路径
*/
@TableField("dst_url")
private String dstUrl;
/**
* 识别结果JSON文件url
*/
@TableField("jsons")
private String jsons;
/**
* 合并后双层PDF文件url
*/
@TableField("pdf")
private String pdf;
/**
* 是否需要回调通知结果
*/
@TableField("is_callback")
private Boolean isCallback;
/**
* 回调URL
*/
@TableField("callback_url")
private String callbackUrl;
/**
* 回调参数
*/
@TableField("callback_params")
private String callbackParams;
/**
* 创建时间
*/
@TableField("created_time")
private LocalDateTime createdTime;
/**
* 更新时间
*/
@TableField("updated_time")
private LocalDateTime updatedTime;
@TableField("server_ip")
private String serverIp;
@TableField("file_count")
private Integer fileCount;
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_1")
public class AppAbilityRecord1 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_2")
public class AppAbilityRecord2 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_3")
public class AppAbilityRecord3 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_6")
public class AppAbilityRecord6 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_7")
public class AppAbilityRecord7 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_8")
public class AppAbilityRecord8 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
package com.gxmailu.ocrCloudPlatform.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
* 应用调用能力记录
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@TableName("app_ability_record_9")
public class AppAbilityRecord9 extends AppAbilityRecord implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 唯一标识
// */
// @TableId(value = "id", type = IdType.AUTO)
// private Long id;
//
// /**
// * 任务ID
// */
// @TableField("task_id")
// private String taskId;
//
// /**
// * 应用ID
// */
// @TableField("application_id")
// private Long applicationId;
//
// /**
// * 用户ID
// */
// @TableField("user_id")
// private Long userId;
//
// /**
// * 能力ID
// */
// @TableField("ability_id")
// private Long abilityId;
//
// /**
// * IP地址
// */
// @TableField("ip")
// private String ip;
//
// /**
// * 调用时间
// */
// @TableField("call_time")
// private LocalDateTime callTime;
//
// /**
// * 识别状态
// */
// @TableField("ocr_state")
// private Byte ocrState;
//
// /**
// * 客户端传的文件唯一标识
// */
// @TableField("file_id")
// private String fileId;
//
// /**
// * 待识别文件原始文件名
// */
// @TableField("origin_name")
// private String originName;
//
// /**
// * 待识别文件保存文件名
// */
// @TableField("ocr_file_name")
// private String ocrFileName;
//
// /**
// * 待识别文件url
// */
// @TableField("src_url")
// private String srcUrl;
//
// /**
// * 文件大小
// */
// @TableField("length")
// private Long length;
//
// /**
// * 文件CRC32校验码
// */
// @TableField("crc32")
// private Long crc32;
//
// /**
// * 文件的CheckSum
// */
// @TableField("`checksum`")
// private String checksum;
//
// /**
// * 识别结果
// */
// @TableField("result")
// private String result;
//
// /**
// * 结果类型
// */
// @TableField("result_type")
// private Integer resultType;
//
// /**
// * 识别结果保存路径
// */
// @TableField("dst_url")
// private String dstUrl;
//
// /**
// * 识别结果JSON文件url
// */
// @TableField("jsons")
// private String jsons;
//
// /**
// * 合并后双层PDF文件url
// */
// @TableField("pdf")
// private String pdf;
//
// /**
// * 是否需要回调通知结果
// */
// @TableField("is_callback")
// private Boolean isCallback;
//
// /**
// * 回调URL
// */
// @TableField("callback_url")
// private String callbackUrl;
//
// /**
// * 回调参数
// */
// @TableField("callback_params")
// private String callbackParams;
//
// /**
// * 创建时间
// */
// @TableField("created_time")
// private LocalDateTime createdTime;
//
// /**
// * 更新时间
// */
// @TableField("updated_time")
// private LocalDateTime updatedTime;
//
// @TableField("server_ip")
// private String serverIp;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getTaskId() {
// return taskId;
// }
//
// public void setTaskId(String taskId) {
// this.taskId = taskId;
// }
//
// public Long getApplicationId() {
// return applicationId;
// }
//
// public void setApplicationId(Long applicationId) {
// this.applicationId = applicationId;
// }
//
// public Long getUserId() {
// return userId;
// }
//
// public void setUserId(Long userId) {
// this.userId = userId;
// }
//
// public Long getAbilityId() {
// return abilityId;
// }
//
// public void setAbilityId(Long abilityId) {
// this.abilityId = abilityId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public LocalDateTime getCallTime() {
// return callTime;
// }
//
// public void setCallTime(LocalDateTime callTime) {
// this.callTime = callTime;
// }
//
// public Byte getOcrState() {
// return ocrState;
// }
//
// public void setOcrState(Byte ocrState) {
// this.ocrState = ocrState;
// }
//
// public String getFileId() {
// return fileId;
// }
//
// public void setFileId(String fileId) {
// this.fileId = fileId;
// }
//
// public String getOriginName() {
// return originName;
// }
//
// public void setOriginName(String originName) {
// this.originName = originName;
// }
//
// public String getOcrFileName() {
// return ocrFileName;
// }
//
// public void setOcrFileName(String ocrFileName) {
// this.ocrFileName = ocrFileName;
// }
//
// public String getSrcUrl() {
// return srcUrl;
// }
//
// public void setSrcUrl(String srcUrl) {
// this.srcUrl = srcUrl;
// }
//
// public Long getLength() {
// return length;
// }
//
// public void setLength(Long length) {
// this.length = length;
// }
//
// public Long getCrc32() {
// return crc32;
// }
//
// public void setCrc32(Long crc32) {
// this.crc32 = crc32;
// }
//
// public String getChecksum() {
// return checksum;
// }
//
// public void setChecksum(String checksum) {
// this.checksum = checksum;
// }
//
// public String getResult() {
// return result;
// }
//
// public void setResult(String result) {
// this.result = result;
// }
//
// public Integer getResultType() {
// return resultType;
// }
//
// public void setResultType(Integer resultType) {
// this.resultType = resultType;
// }
//
// public String getDstUrl() {
// return dstUrl;
// }
//
// public void setDstUrl(String dstUrl) {
// this.dstUrl = dstUrl;
// }
//
// public String getJsons() {
// return jsons;
// }
//
// public void setJsons(String jsons) {
// this.jsons = jsons;
// }
//
// public String getPdf() {
// return pdf;
// }
//
// public void setPdf(String pdf) {
// this.pdf = pdf;
// }
//
// public Boolean getIsCallback() {
// return isCallback;
// }
//
// public void setIsCallback(Boolean isCallback) {
// this.isCallback = isCallback;
// }
//
// public String getCallbackUrl() {
// return callbackUrl;
// }
//
// public void setCallbackUrl(String callbackUrl) {
// this.callbackUrl = callbackUrl;
// }
//
// public String getCallbackParams() {
// return callbackParams;
// }
//
// public void setCallbackParams(String callbackParams) {
// this.callbackParams = callbackParams;
// }
//
// public LocalDateTime getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(LocalDateTime createdTime) {
// this.createdTime = createdTime;
// }
//
// public LocalDateTime getUpdatedTime() {
// return updatedTime;
// }
//
// public void setUpdatedTime(LocalDateTime updatedTime) {
// this.updatedTime = updatedTime;
// }
//
// public String getServerIp() {
// return serverIp;
// }
//
// public void setServerIp(String serverIp) {
// this.serverIp = serverIp;
// }
//
// @Override
// public String toString() {
// return "AppAbilityRecord4{" +
// "id = " + id +
// ", taskId = " + taskId +
// ", applicationId = " + applicationId +
// ", userId = " + userId +
// ", abilityId = " + abilityId +
// ", ip = " + ip +
// ", callTime = " + callTime +
// ", ocrState = " + ocrState +
// ", fileId = " + fileId +
// ", originName = " + originName +
// ", ocrFileName = " + ocrFileName +
// ", srcUrl = " + srcUrl +
// ", length = " + length +
// ", crc32 = " + crc32 +
// ", checksum = " + checksum +
// ", result = " + result +
// ", resultType = " + resultType +
// ", dstUrl = " + dstUrl +
// ", jsons = " + jsons +
// ", pdf = " + pdf +
// ", isCallback = " + isCallback +
// ", callbackUrl = " + callbackUrl +
// ", callbackParams = " + callbackParams +
// ", createdTime = " + createdTime +
// ", updatedTime = " + updatedTime +
// ", serverIp = " + serverIp +
// "}";
// }
}
......@@ -174,6 +174,12 @@ public class AppAbilityRecordAll implements Serializable {
@TableField("server_ip")
private String serverIp;
/**
* 文件页数
*/
@TableField("file_count")
private Integer fileCount;
public Long getId() {
return id;
}
......@@ -382,6 +388,14 @@ public class AppAbilityRecordAll implements Serializable {
this.serverIp = serverIp;
}
public Integer getFileCount() {
return fileCount;
}
public void setFileCount(Integer fileCount) {
this.fileCount = fileCount;
}
@Override
public String toString() {
return "AppAbilityRecordAll{" +
......@@ -411,6 +425,7 @@ public class AppAbilityRecordAll implements Serializable {
", createdTime = " + createdTime +
", updatedTime = " + updatedTime +
", serverIp = " + serverIp +
", fileCount = " + fileCount +
"}";
}
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord1;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord1Mapper extends BaseMapper<AppAbilityRecord1> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord2;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord2Mapper extends BaseMapper<AppAbilityRecord2> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord3;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord3Mapper extends BaseMapper<AppAbilityRecord3> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord6;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord6Mapper extends BaseMapper<AppAbilityRecord6> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord7;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord7Mapper extends BaseMapper<AppAbilityRecord7> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord8;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord8Mapper extends BaseMapper<AppAbilityRecord8> {
}
package com.gxmailu.ocrCloudPlatform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecord9;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* 应用调用能力记录 Mapper 接口
* </p>
*
* @author zyz
* @since 2023-05-10
*/
@Mapper
@Component
public interface AppAbilityRecord9Mapper extends BaseMapper<AppAbilityRecord9> {
}
......@@ -286,7 +286,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
}
}
}
System.out.println(brokenLineData);
// System.out.println(brokenLineData);
return Result.success("获取折线数据成功", brokenLineData);
} catch (Exception e) {
log.error("获取折线数据失败", e);
......
......@@ -193,5 +193,16 @@ public class RedisService {
}
return null;
}
/**
* 自增
* @param key
* @return {@link Long}
*/
public Long incr(String key, long delta) {
Long value = redisTemplate.opsForValue().increment(key, delta);
redisTemplate.expire(key, 30, TimeUnit.SECONDS);
return value;
}
}
package com.gxmailu.ocrCloudPlatform.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -94,24 +97,26 @@ public class ServerInfoServiceImpl implements ServerInfoService {
public Result getOcrTask() {
try {
List<ServerInfo> serverInfos = getCacheList();
if (serverInfos.size() == 0) {
if (CollUtil.isEmpty(serverInfos)) {
serverInfos = serverInfoMapper.selectList(Wrappers.lambdaQuery(ServerInfo.class)
.eq(ServerInfo::getAccessService,true));
if (serverInfos == null || serverInfos.size() == 0) {
if (serverInfos == null || CollUtil.isEmpty(serverInfos)) {
return Result.error("OCR云平台未配置服务器信息");
}
}
List<ServerVo> serverVos = new ArrayList<>();
for (ServerInfo serverInfo : serverInfos) {
List<Object> list = redisService.getList("ocrTask-" + serverInfo.getIp() + "-");
ServerVo serverVo = new ServerVo();
BeanUtils.copyProperties(serverInfo, serverVo, ServerVo.class);
if (list == null) {
serverVo.setOcrTask(0L);
} else {
serverVo.setOcrTask((long) list.size());
}
serverVos.add(serverVo);
// List<Object> list = redisService.getList("ocrTask-" + serverInfo.getIp() + "-");
// ServerVo serverVo = new ServerVo();
// BeanUtils.copyProperties(serverInfo, serverVo, ServerVo.class);
// if (list == null) {
// serverVo.setOcrTask(0L);
// } else {
// serverVo.setOcrTask((long) list.size());
// }
// serverVos.add(serverVo);
serverVos.add(getTaskCount(serverInfo));
}
serverVos = serverVos.stream().sorted(Comparator.comparing(ServerVo::getOcrTask).reversed()).collect(Collectors.toList());
return Result.success("获取OCR任务成功", serverVos);
......@@ -126,7 +131,7 @@ public class ServerInfoServiceImpl implements ServerInfoService {
try {
List<ServerInfo> serverInfos = serverInfoMapper.selectList(Wrappers.lambdaQuery(ServerInfo.class)
.eq(ServerInfo::getAccessService,true));
if (serverInfos.size() == 0) {
if (CollUtil.isEmpty(serverInfos)) {
return Result.error("OCR云平台未配置服务器信息");
}
redisService.set("ocrServerList", serverInfos);
......@@ -139,15 +144,15 @@ public class ServerInfoServiceImpl implements ServerInfoService {
@Override
public List<ServerInfo> getCacheList() {
return serverInfoMapper.selectList(new ServerInfo(true));
/*Object object = redisService.getValue("ocrServerList");
// return serverInfoMapper.selectList(new ServerInfo(true));
Object object = redisService.getValue("ocrServerList");
if (object == null) {
List<ServerInfo> serverInfos = serverInfoMapper.selectList(new ServerInfo(true));
redisService.set("ocrServerList", serverInfos);
return serverInfos;
} else {
return JSONArray.parseArray(object.toString(), ServerInfo.class);
}*/
}
}
@Override
......@@ -213,44 +218,54 @@ public class ServerInfoServiceImpl implements ServerInfoService {
public Result getServerStatus() {
try {
List<ServerInfo> serverInfos = getCacheList();
if (serverInfos == null || serverInfos.size() == 0) {
if (CollUtil.isEmpty(serverInfos)) {
serverInfos = serverInfoMapper.selectList(Wrappers.lambdaQuery(ServerInfo.class)
.eq(ServerInfo::getAccessService,true));
if (serverInfos == null || serverInfos.size() == 0) {
if (CollUtil.isEmpty(serverInfos)) {
return Result.error("OCR云平台未配置服务器信息");
}
}
List<ServerVo> serverVos = new ArrayList<>();
// List<ServerVo> serverVos = new ArrayList<>();
List<ServerVo> ocrTaskServerVos = new ArrayList<>();
for (ServerInfo serverInfo : serverInfos) {
// 获取状态
Object activeServer = redisService.getValue("activeServer-" + serverInfo.getIp());
ServerVo serverVo = new ServerVo();
BeanUtils.copyProperties(serverInfo, serverVo, ServerVo.class);
serverVo.setActive(activeServer != null);
serverVos.add(serverVo);
// Object activeServer = redisService.getValue("activeServer-" + serverInfo.getIp());
// ServerVo serverVo = new ServerVo();
// BeanUtils.copyProperties(serverInfo, serverVo, ServerVo.class);
// serverVo.setActive(activeServer != null);
// serverVos.add(serverVo);
// 获取调用量
List<Object> list = redisService.getList("ocrTask-" + serverInfo.getIp() + "-");
ServerVo ocrServerVo = new ServerVo();
BeanUtils.copyProperties(serverInfo, ocrServerVo, ServerVo.class);
if (list == null) {
ocrServerVo.setOcrTask(0L);
} else {
ocrServerVo.setOcrTask((long) list.size());
}
ocrTaskServerVos.add(ocrServerVo);
// List<Object> list = redisService.getList("ocrTask-" + serverInfo.getIp() + "-");
// ServerVo ocrServerVo = new ServerVo();
// BeanUtils.copyProperties(serverInfo, ocrServerVo, ServerVo.class);
// if (list == null) {
// ocrServerVo.setOcrTask(0L);
// } else {
// ocrServerVo.setOcrTask((long) list.size());
// }
// ocrTaskServerVos.add(ocrServerVo);
// ServerVo taskCount = getTaskCount(serverInfo);
// // 获取状态
// ServerVo serverVo = new ServerVo();
// BeanUtils.copyProperties(serverInfo, serverVo, ServerVo.class);
// serverVos.add(taskCount);
ocrTaskServerVos.add(getTaskCount(serverInfo));
}
serverVos.sort((o1, o2) -> {
if (o1.getActive() ^ o2.getActive()) {
return o1.getActive() ? -1 : 1;
} else {
return 0;
}
});
// ocrTaskServerVos.sort((o1, o2) -> {
// if (o1.getActive() ^ o2.getActive()) {
// return o1.getActive() ? -1 : 1;
// } else {
// return 0;
// }
// });
ocrTaskServerVos.sort((o1, o2) -> Boolean.compare(o2.getActive(), o1.getActive()));
ocrTaskServerVos = ocrTaskServerVos.stream().sorted(Comparator.comparing(ServerVo::getOcrTask).reversed()).collect(Collectors.toList());
JSONObject data = new JSONObject();
data.put("serverStatus", serverVos);
data.put("serverStatus", ocrTaskServerVos);
data.put("ocrTask", ocrTaskServerVos);
return Result.success("获取服务器状态和OCR调用量成功", data);
} catch (Exception e) {
......@@ -272,4 +287,18 @@ public class ServerInfoServiceImpl implements ServerInfoService {
}
/**
* 获取服务器任务数量
*
* @param serverInfo 服务器信息
*/
private ServerVo getTaskCount(ServerInfo serverInfo) {
Object count = redisService.getValue("server-request-task-" + serverInfo.getIp());
ServerVo ocrServerVo = new ServerVo();
BeanUtils.copyProperties(serverInfo, ocrServerVo, ServerVo.class);
ocrServerVo.setOcrTask(ObjUtil.isNull(count) ? 0L : Long.parseLong(count.toString()));
ocrServerVo.setActive(ObjUtil.isNotNull(count) && Long.parseLong(count.toString()) > 0);
return ocrServerVo;
}
}
spring:
datasource:
username: root
password: 123456
password: Dk2019!23456
# password: Docimax@123
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/yuntu_ofs?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
url: jdbc:mysql://119.45.183.210:13308/ocr_cloud?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
# url: jdbc:mysql://147.1.5.77:3306/yuntu_ofs?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
# redis:
# cluster:
......@@ -27,7 +27,7 @@ spring:
redis:
host: 127.0.0.1
port: 6379
database: 1
database: 0
password:
jedis:
pool:
......
......@@ -30,11 +30,12 @@
<result column="created_time" property="createdTime" />
<result column="updated_time" property="updatedTime" />
<result column="server_ip" property="serverIp" />
<result column="file_count" property="fileCount" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, task_id, application_id, user_id, ability_id, ip, call_time, ocr_state, file_id, origin_name, ocr_file_name, src_url, length, crc32, `checksum`, result, result_type, dst_url, jsons, pdf, is_callback, callback_url, callback_params, created_time, updated_time, server_ip
id, task_id, application_id, user_id, ability_id, ip, call_time, ocr_state, file_id, origin_name, ocr_file_name, src_url, length, crc32, `checksum`, result, result_type, dst_url, jsons, pdf, is_callback, callback_url, callback_params, created_time, updated_time, server_ip, file_count
</sql>
......
package com.gxmailu.ocrCloudPlatform;
import com.gxmailu.ocrCloudPlatform.entity.ServerInfo;
import com.gxmailu.ocrCloudPlatform.service.ServerInfoService;
import com.gxmailu.ocrCloudPlatform.service.impl.RedisService;
import com.gxmailu.ocrCloudPlatform.service.impl.RetransmissionService;
import com.gxmailu.ocrCloudPlatform.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@SpringBootTest
@Slf4j
class RetransmissionServiceTest {
@Autowired
private ServerInfoService serverInfoService;
@Autowired
private RedisService redisService;
@Autowired
private RetransmissionService retransmissionService;
@BeforeEach
void setUp() {
ServerInfo serverInfo1 = new ServerInfo();
ServerInfo serverInfo2 = new ServerInfo();
ServerInfo serverInfo3 = new ServerInfo();
ServerInfo serverInfo4 = new ServerInfo();
ServerInfo serverInfo5 = new ServerInfo();
ServerInfo serverInfo6 = new ServerInfo();
ServerInfo serverInfo7 = new ServerInfo();
ServerInfo serverInfo8 = new ServerInfo();
ServerInfo serverInfo9 = new ServerInfo();
ServerInfo serverInfo10 = new ServerInfo();
serverInfo1.setIp("127.0.0.1");
serverInfo2.setIp("172.0.0.2");
serverInfo3.setIp("192.168.0.1");
serverInfo4.setIp("192.168.0.4");
serverInfo5.setIp("192.168.0.5");
serverInfo6.setIp("192.168.0.6");
serverInfo7.setIp("192.168.0.7");
serverInfo8.setIp("192.168.0.8");
serverInfo9.setIp("192.168.0.9");
serverInfo10.setIp("192.168.0.10");
// Mocking OCR server list
List<ServerInfo> ocrServerList = new ArrayList<>();
ocrServerList.add(serverInfo1);
ocrServerList.add(serverInfo2);
ocrServerList.add(serverInfo3);
ocrServerList.add(serverInfo4);
ocrServerList.add(serverInfo5);
ocrServerList.add(serverInfo6);
ocrServerList.add(serverInfo7);
ocrServerList.add(serverInfo8);
ocrServerList.add(serverInfo9);
ocrServerList.add(serverInfo10);
redisService.set("ocrServerList", ocrServerList, 30, TimeUnit.MINUTES);
}
@Test
public void testAddServerRequestCount() throws InterruptedException {
// 创建一个计数器跟踪完成的任务数量
final CountDownLatch latch = new CountDownLatch(20);
// 假设有一个服务器IP为"192.168.1.1"
String ip = "192.168.1.1";
// 创建100个线程并发地增加请求计数
for (int i = 0; i < 10; i++) {
new Thread(() -> {
retransmissionService.addServerRequestCount(ip, 1);
// retransmissionService.addServerRequestCount(ip, -1);
latch.countDown(); // 完成一个任务,计数器减1
}).start();
}
// 创建100个线程并发地减少请求计数
for (int i = 0; i < 10; i++) {
new Thread(() -> {
retransmissionService.addServerRequestCount(ip, -1); // 假设addServerRequestCount支持负值表示减少
latch.countDown(); // 完成一个任务,计数器减1
}).start();
}
// 等待所有任务完成
latch.await();
Thread.sleep(5000);
// 检查结果。如果没有线程竞争问题,那么最终的计数应该等于0
Object value = redisService.getValue("server-request-task-" + ip);
if (value != null) {
Long count = ((Number) value).longValue();
log.info("IP: {} 请求量:{}", ip, count);
} else {
log.info("IP: {} 请求量:未知", ip);
}
}
@Test
void getStatus() {
Result serverStatus = serverInfoService.getServerStatus();
System.out.println(serverStatus);
Result ocrTask = serverInfoService.getOcrTask();
System.out.println(ocrTask);
}
@Test
void testGetServerAddressByRandom() throws Exception {
long st = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
ServerInfo serverInfo = retransmissionService.getServerAddressByRequestCount();
Thread thread = new Thread(() -> {
try {
// Thread.sleep(500);
retransmissionService.addServerRequestCount(serverInfo.getIp(), 1);
// redisService.incr("server-request-task-" + serverInfo.getIp(), 1);
// retransmissionService.setActiveServer(serverInfo.getIp());
} catch (Exception e) {
throw new RuntimeException(e);
}
});
thread.start();
thread.join();
// log.info("线程{}获取到IP: {} 请求量:{}", thread.getName(), serverInfo.getIp(), redisService.getValue("server-request-task-" + serverInfo.getIp()));
}
log.info("耗时:{}", System.currentTimeMillis() - st);
serverInfoService.getCacheList().forEach(serverInfo -> {
log.info("IP: {} 请求量:{}", serverInfo.getIp(), redisService.getValue("server-request-task-" + serverInfo.getIp()));
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment