|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
package cn.jyjz.xiaoyao.ocr.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.admin.dataobject.User;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.RequestBaseUtil;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVo;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.redis.cache.ICacheManager;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.redis.cache.constants.CacheConstants;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
|
|
|
|
@ -62,18 +65,18 @@ public class OcrSearchHistoryServiceImpl extends ServiceImpl<OcrSearchHistoryMap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultVo toolscount(String tenantid) {
|
|
|
|
|
public ResultVo toolscount(String tenantid,String userId) {
|
|
|
|
|
|
|
|
|
|
//系统中记录的ai统计租户id
|
|
|
|
|
String counttenantid = iCacheManager.get(CacheConstants.TOOLSCOUNT_TENANTID_MODEL_NAME,tenantid);
|
|
|
|
|
String counttenantid = iCacheManager.get(CacheConstants.TOOLSCOUNT_TENANTID_MODEL_NAME,tenantid+"_"+userId);
|
|
|
|
|
// if(!StringUtils.isBlank(counttenantid)){
|
|
|
|
|
// return ResultVoUtil.error("true");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//用户登录信息写入缓存
|
|
|
|
|
iCacheManager.put(CacheConstants.TOOLSCOUNT_TENANTID_MODEL_NAME,tenantid,"true",CacheConstants.TOOLSCOUNT_TENANTID_CACHE_TIME);
|
|
|
|
|
iCacheManager.put(CacheConstants.TOOLSCOUNT_TENANTID_MODEL_NAME,tenantid+"_"+userId,"true",CacheConstants.TOOLSCOUNT_TENANTID_CACHE_TIME);
|
|
|
|
|
|
|
|
|
|
Map<Object, Object> toolscount = ocrsearchhistorymapper.toolscount(tenantid);
|
|
|
|
|
Map<Object, Object> toolscount = ocrsearchhistorymapper.toolscount(userId);
|
|
|
|
|
return ResultVoUtil.success(toolscount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,25 +124,41 @@ public class OcrSearchHistoryServiceImpl extends ServiceImpl<OcrSearchHistoryMap
|
|
|
|
|
mappedResults.put("packageName", resultList.get(0).get("packageName"));
|
|
|
|
|
mappedResults.put("createTime", resultList.get(0).get("createTime"));
|
|
|
|
|
int similarComplete = 0;
|
|
|
|
|
List<Object> pictureIds = new ArrayList<>(); // 存储所有的pictureId
|
|
|
|
|
List<String> pictureIds = new ArrayList<>(); // 存储所有的pictureId
|
|
|
|
|
for (Map<Object, Object> selectaisp : resultList) {
|
|
|
|
|
Object pictureResult = selectaisp.get("pictureResult");
|
|
|
|
|
String pictureResultStr = pictureResult.toString();
|
|
|
|
|
if ("100.0".equals(pictureResultStr)) {
|
|
|
|
|
similarComplete++;
|
|
|
|
|
Long pictureId = (Long) selectaisp.get("pictureId");
|
|
|
|
|
if (pictureId != null) {
|
|
|
|
|
pictureIds.add(String.valueOf(pictureId)); // 转换为String
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Object pictureId = selectaisp.get("pictureId");
|
|
|
|
|
if (pictureId != null) {
|
|
|
|
|
pictureIds.add(pictureId);
|
|
|
|
|
}
|
|
|
|
|
if(similarComplete==0){
|
|
|
|
|
return Collections.emptyMap();
|
|
|
|
|
}
|
|
|
|
|
List<String> pendingApprovalList = new ArrayList<>(); // 存储待审批的pictureId集合
|
|
|
|
|
List<String> approvedList = new ArrayList<>(); // 存储通过的pictureId集合
|
|
|
|
|
List<String> failedList = new ArrayList<>(); // 存储不通过的pictureId集合
|
|
|
|
|
List<OcrPicture> failedPictureIds = ocrPictureService.getPictureNodeStatesList(pictureIds, nodeType);
|
|
|
|
|
for (OcrPicture picture : failedPictureIds) {
|
|
|
|
|
if (picture.getHistoryStates() == 3) {
|
|
|
|
|
failedList.add(picture.getPictureid());
|
|
|
|
|
} else if (picture.getHistoryStates() == 1) {
|
|
|
|
|
pendingApprovalList.add(picture.getPictureid());
|
|
|
|
|
} else if (picture.getHistoryStates() == 2) {
|
|
|
|
|
approvedList.add(picture.getPictureid());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// List<Object> failedPictureIds = fakeInterface.getFailedPictureIds(pictureIds,nodeType); // 假的接口,根据pictureId集合获取不通过的pictureId列表
|
|
|
|
|
// int passedCount = pictureIds.size() - failedPictureIds.size(); // 通过的数量
|
|
|
|
|
// int failedCount = failedPictureIds.size(); // 不通过的数量
|
|
|
|
|
|
|
|
|
|
int pendingApprovaCount = pendingApprovalList.size(); // 待审批的数量
|
|
|
|
|
int passCount = approvedList.size(); // 通过的数量
|
|
|
|
|
mappedResults.put("similarComplete", similarComplete);
|
|
|
|
|
// mappedResults.put("passedCount", passedCount);
|
|
|
|
|
// mappedResults.put("failedCount", failedCount);
|
|
|
|
|
// mappedResults.put("failedPictureIds", failedPictureIds);
|
|
|
|
|
mappedResults.put("passCount", passCount);
|
|
|
|
|
mappedResults.put("pendingApprovaCount", pendingApprovaCount);
|
|
|
|
|
mappedResults.put("pictureIdList", pendingApprovalList);
|
|
|
|
|
return mappedResults;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|