feat:1.添加无量云调用日志

2.添加无量云失败回调接口
pull/151/head
sunchenliang 1 year ago
parent 23c46f5553
commit 28fb1924e7

@ -37,6 +37,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -54,6 +56,7 @@ import java.util.stream.Collectors;
@RequestMapping("/flow/task") @RequestMapping("/flow/task")
public class FlowTaskController extends BaseController { public class FlowTaskController extends BaseController {
private static final Logger log = LoggerFactory.getLogger(FlowTaskController.class);
@Resource @Resource
IFlowTaskService flowTaskService; IFlowTaskService flowTaskService;
@ -676,8 +679,10 @@ public class FlowTaskController extends BaseController {
}) })
@GetMapping("/repetitionTask") @GetMapping("/repetitionTask")
@ResponseBody @ResponseBody
public ResultVo repetitionTask(@RequestParam(value = "type",required = false,defaultValue = "1") Integer type) { public ResultVo repetitionTask(HttpServletRequest request,
return flowTaskService.repetitionTask(type); @RequestParam(value = "type",required = false,defaultValue = "1") Integer type) {
String tenantId = request.getHeader("X-Tenant-Id");
return flowTaskService.repetitionTask(type,tenantId);
} }
/** /**
@ -691,10 +696,36 @@ public class FlowTaskController extends BaseController {
}) })
@GetMapping("/repetitionTaskList") @GetMapping("/repetitionTaskList")
@ResponseBody @ResponseBody
public ResultVo repetitionTaskList(@RequestParam(name = "pageNo") Integer pageNo, public ResultVo repetitionTaskList(HttpServletRequest request,
@RequestParam(name = "pageNo") Integer pageNo,
@RequestParam(name = "pageSize") Integer pageSize, @RequestParam(name = "pageSize") Integer pageSize,
@RequestParam(value = "type",required = false,defaultValue = "1") Integer type) { @RequestParam(value = "type",required = false,defaultValue = "1") Integer type) {
Page<OcrTaskchildPicture> result = flowTaskService.repetitionTaskList(pageNo, pageSize,type); String tenantId = request.getHeader("X-Tenant-Id");
Page<OcrTaskchildPicture> result = flowTaskService.repetitionTaskList(pageNo, pageSize,type,tenantId);
return ResultVoUtil.success(result);
}
/**
*
*
* @return
*/
@ApiOperation(value = "失败重试无量云", notes = "失败重试无量云")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", name = "X-Tenant-Id", value = "租户主键,用户登录时的信息“tenantList”中获得。", dataType = "String", required = true),
})
@GetMapping("/retryPrevailCloud")
@ResponseBody
public ResultVo retryPrevailCloud(HttpServletRequest request,
@RequestParam(name = "formId") String formId) {
String tenantId = request.getHeader("X-Tenant-Id");
Boolean result = null;
try {
result = flowTaskService.retryPrevailCloud(tenantId,formId);
} catch (Exception e) {
log.error(e.getMessage());
result =false;
}
return ResultVoUtil.success(result); return ResultVoUtil.success(result);
} }
} }

@ -193,7 +193,9 @@ public interface IFlowTaskService {
* *
* @return * @return
*/ */
ResultVo repetitionTask(Integer type); ResultVo repetitionTask(Integer type, String tenantId);
Page<OcrTaskchildPicture> repetitionTaskList(Integer pageNo, Integer pageSize,Integer type); Page<OcrTaskchildPicture> repetitionTaskList(Integer pageNo, Integer pageSize, Integer type, String tenantId);
Boolean retryPrevailCloud(String tenantId, String formId) throws Exception;
} }

@ -35,10 +35,12 @@ import cn.jyjz.xiaoyao.oa.from.service.*;
import cn.jyjz.xiaoyao.oa.from.vo.FlowUnionVo; import cn.jyjz.xiaoyao.oa.from.vo.FlowUnionVo;
import cn.jyjz.xiaoyao.oa.from.vo.RepeatedContentVo; import cn.jyjz.xiaoyao.oa.from.vo.RepeatedContentVo;
import cn.jyjz.xiaoyao.ocr.api.PrevailCloudApi;
import cn.jyjz.xiaoyao.ocr.dataobject.*; import cn.jyjz.xiaoyao.ocr.dataobject.*;
import cn.jyjz.xiaoyao.ocr.service.*; import cn.jyjz.xiaoyao.ocr.service.*;
import cn.jyjz.xiaoyao.ocr.util.SearchParaFormatting; import cn.jyjz.xiaoyao.ocr.util.SearchParaFormatting;
import cn.jyjz.xiaoyao.ocr.vo.OcrTaskchildPictureApproVo; import cn.jyjz.xiaoyao.ocr.vo.OcrTaskchildPictureApproVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -117,6 +119,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
private IOcrMsgService ocrMsgService; private IOcrMsgService ocrMsgService;
@Resource @Resource
private UserdistionaryService userdistionaryService; private UserdistionaryService userdistionaryService;
@Resource
private OcrPrevailCloudLogService prevailCloudLogService;
@Resource
private PrevailCloudApi prevailCloudApi;
@Override @Override
public void myTodoTaskList(PageUtils vo, HttpServletRequest request) { public void myTodoTaskList(PageUtils vo, HttpServletRequest request) {
@ -599,7 +605,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
model.setFinishtime(System.currentTimeMillis()); model.setFinishtime(System.currentTimeMillis());
model.setStates(SystemConstantsOa.OA_STATUS_TYPE_END); model.setStates(SystemConstantsOa.OA_STATUS_TYPE_END);
OcrPicture picture = ocrPictureService.getById(model.getPictureid()); OcrPicture picture = ocrPictureService.getById(model.getPictureid());
ocrTaskchildPictureService.sendFlowTaskResult(childPicture, picture, approve); Boolean result = ocrTaskchildPictureService.sendFlowTaskResult(childPicture, picture, approve);
model.setSendResult(result ? 1 : 0);
} else { } else {
childPicture.setTaskNode(taskData.getDescription()); childPicture.setTaskNode(taskData.getDescription());
//判断节点上的描述字段是否伟finale_judgment,如果是,记录到终审表中,如果终审表已经存在,不再重复记录 //判断节点上的描述字段是否伟finale_judgment,如果是,记录到终审表中,如果终审表已经存在,不再重复记录
@ -1565,7 +1572,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
//审批节点 当前如果没有历史操作,则将当前节点赋值到历史审批节点中. //审批节点 当前如果没有历史操作,则将当前节点赋值到历史审批节点中.
if (StringUtils.isBlank(ocrTaskchildPictureAppro.getTasknamehis())) { if (StringUtils.isBlank(ocrTaskchildPictureAppro.getTasknamehis())) {
ocrTaskchildPictureAppro.setTasknamehis(ocrTaskchildPictureAppro.getTaskname()); ocrTaskchildPictureAppro.setTasknamehis(ocrTaskchildPictureAppro.getTaskname());
}else{ } else {
if (assignee.contains(",")) { if (assignee.contains(",")) {
String[] split = assignee.split(","); String[] split = assignee.split(",");
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
@ -1955,8 +1962,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
} }
@Override @Override
public ResultVo repetitionTask(Integer type) { public ResultVo repetitionTask(Integer type, String tenantId) {
List<RepeatedContentVo> repeatedContentVoList = flowableccMybatisDao.repetitionTask(type); List<RepeatedContentVo> repeatedContentVoList = flowableccMybatisDao.repetitionTask(type, tenantId);
List<String> formIdsToUpdate = new ArrayList<>(); List<String> formIdsToUpdate = new ArrayList<>();
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(repeatedContentVoList)) { if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(repeatedContentVoList)) {
List<OcrCheckDescribeHis> checkDescribeHis = new ArrayList<>(); List<OcrCheckDescribeHis> checkDescribeHis = new ArrayList<>();
@ -2004,12 +2011,18 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
} }
@Override @Override
public Page<OcrTaskchildPicture> repetitionTaskList(Integer pageNo, Integer pageSize, Integer type) { public Page<OcrTaskchildPicture> repetitionTaskList(Integer pageNo, Integer pageSize, Integer type, String tenantId) {
Page<OcrTaskchildPicture> page = new Page<>(pageNo, pageSize); Page<OcrTaskchildPicture> page = new Page<>(pageNo, pageSize);
Page<OcrTaskchildPicture> result = flowableccMybatisDao.repetitionTaskList(page, type); Page<OcrTaskchildPicture> result = flowableccMybatisDao.repetitionTaskList(page, type, tenantId);
return result; return result;
} }
@Override
public Boolean retryPrevailCloud(String tenantId, String formId) throws Exception {
OcrPrevailCloudLog one = prevailCloudLogService.getOne(new LambdaQueryWrapper<OcrPrevailCloudLog>().eq(OcrPrevailCloudLog::getFormId, formId));
return prevailCloudApi.sendFlowTaskResult(formId, one.getRequestParam(), one.getPictureId(), one.getTaskId());
}
/** /**
* *
* *

@ -40,7 +40,7 @@ public interface FlowableccMybatisDao extends BaseMapper<Flowablecc> {
*/ */
List<UserDistionaryVo> selectUserByFromid(String fromid); List<UserDistionaryVo> selectUserByFromid(String fromid);
List<RepeatedContentVo> repetitionTask(@Param("type") Integer type); List<RepeatedContentVo> repetitionTask(@Param("type") Integer type, @Param("tenantId") String tenantId);
Page<OcrTaskchildPicture> repetitionTaskList(Page<OcrTaskchildPicture> page, @Param("type") Integer type); Page<OcrTaskchildPicture> repetitionTaskList(Page<OcrTaskchildPicture> page, @Param("type") Integer type, @Param("tenantId") String tenantId);
} }

@ -3,7 +3,6 @@ package cn.jyjz.xiaoyao.ocr.api;
import cn.jyjz.xiaoyao.ocr.api.entity.PictureSourceParameter; import cn.jyjz.xiaoyao.ocr.api.entity.PictureSourceParameter;
import cn.jyjz.xiaoyao.ocr.api.entity.PictureSourceResult; import cn.jyjz.xiaoyao.ocr.api.entity.PictureSourceResult;
import cn.jyjz.xiaoyao.ocr.api.utils.ApiPage; import cn.jyjz.xiaoyao.ocr.api.utils.ApiPage;
import org.apache.commons.compress.utils.Lists;
import java.util.List; import java.util.List;
@ -23,7 +22,7 @@ public interface PrevailCloudApi {
*/ */
ApiPage<PictureSourceResult> pullPictureSource(PictureSourceParameter pictureSourceParameter) throws Exception; ApiPage<PictureSourceResult> pullPictureSource(PictureSourceParameter pictureSourceParameter) throws Exception;
void sendFlowTaskResult(String tenantId,String data) throws Exception; Boolean sendFlowTaskResult(String formId, String data, Long pictureId, String remark) throws Exception;
/** /**
* id * id

@ -11,8 +11,11 @@ import cn.jyjz.xiaoyao.ocr.api.utils.ApiHelper;
import cn.jyjz.xiaoyao.ocr.api.utils.ApiPage; import cn.jyjz.xiaoyao.ocr.api.utils.ApiPage;
import cn.jyjz.xiaoyao.ocr.api.utils.RequestData; import cn.jyjz.xiaoyao.ocr.api.utils.RequestData;
import cn.jyjz.xiaoyao.ocr.api.utils.ResultData; import cn.jyjz.xiaoyao.ocr.api.utils.ResultData;
import cn.jyjz.xiaoyao.ocr.common.PrevailCloudConstant;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture; import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog;
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService; import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
import cn.jyjz.xiaoyao.ocr.service.OcrPrevailCloudLogService;
import cn.jyjz.xiaoyao.ocr.thread.TaskQueue; import cn.jyjz.xiaoyao.ocr.thread.TaskQueue;
import cn.jyjz.xiaoyao.ocr.thread.entity.PictureImgToLocalEntity; import cn.jyjz.xiaoyao.ocr.thread.entity.PictureImgToLocalEntity;
import cn.jyjz.xiaoyao.ocr.util.httputil.HttpClient; import cn.jyjz.xiaoyao.ocr.util.httputil.HttpClient;
@ -28,6 +31,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -51,6 +55,9 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
@Autowired @Autowired
private ApiConfig apiConfig; private ApiConfig apiConfig;
@Resource
private OcrPrevailCloudLogService prevailCloudLogService;
/** /**
* *
*/ */
@ -78,7 +85,9 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
if (!apiConfig.checkConfig()) { if (!apiConfig.checkConfig()) {
return null; return null;
} }
OcrPrevailCloudLog prevailCloudLog = new OcrPrevailCloudLog();
prevailCloudLog.setType(PrevailCloudConstant.PULL_PICTURE_SOURCE);
prevailCloudLog.setRequestParam(JSONUtil.toJsonStr(pictureSourceParameter));
//2.对象转map //2.对象转map
Map<String, Object> queryParam = BeanUtil.beanToMap(pictureSourceParameter); Map<String, Object> queryParam = BeanUtil.beanToMap(pictureSourceParameter);
Map<String, String> queryParamStr = new HashMap<>(); Map<String, String> queryParamStr = new HashMap<>();
@ -108,6 +117,8 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout()); String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout());
System.out.println(responseJsonStr); System.out.println(responseJsonStr);
ResultData<String> resultData = JSONUtil.toBean(responseJsonStr, ResultData.class); ResultData<String> resultData = JSONUtil.toBean(responseJsonStr, ResultData.class);
prevailCloudLog.setResponseParam(responseJsonStr);
prevailCloudLog.setStatus(resultData.getStatus());
//解密请求数据 //解密请求数据
if (resultData.getStatus() == 100) { if (resultData.getStatus() == 100) {
@ -126,11 +137,18 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
logger.debug("请求图片接口数据失败,参数:{},返回值:{}", json, responseJsonStr); logger.debug("请求图片接口数据失败,参数:{},返回值:{}", json, responseJsonStr);
} }
prevailCloudLogService.save(prevailCloudLog);
return null; return null;
} }
@Override @Override
public void sendFlowTaskResult(String tenantId, String data) throws Exception { public Boolean sendFlowTaskResult(String formId, String data, Long pictureId, String remark) throws Exception {
OcrPrevailCloudLog prevailCloudLog = new OcrPrevailCloudLog();
prevailCloudLog.setType(PrevailCloudConstant.SEND_FLOW_RESULT);
prevailCloudLog.setRequestParam(data);
prevailCloudLog.setFormId(Long.parseLong(formId));
prevailCloudLog.setTaskId(remark);
prevailCloudLog.setPictureId(pictureId);
ResultData<String> stringResultData = ApiHelper.buildResponse(apiConfig.getAccessCode(), data); ResultData<String> stringResultData = ApiHelper.buildResponse(apiConfig.getAccessCode(), data);
// RequestData requestData = ApiHelper.buildRequest(tenantId, apiConfig.getAccessKey(), apiConfig.getAccessCode(),data);//组装请求参数 // RequestData requestData = ApiHelper.buildRequest(tenantId, apiConfig.getAccessKey(), apiConfig.getAccessCode(),data);//组装请求参数
String url = apiConfig.getInterfaceDomain() + sendResultUrl; String url = apiConfig.getInterfaceDomain() + sendResultUrl;
@ -141,11 +159,21 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
httpParamers.setJsonParamer(requestBodyJson); httpParamers.setJsonParamer(requestBodyJson);
//发起请求 //发起请求
String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout()); String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout());
System.out.println(responseJsonStr); prevailCloudLog.setResponseParam(responseJsonStr);
ResultData<String> resultData = JSONUtil.toBean(responseJsonStr, ResultData.class);
prevailCloudLog.setStatus(resultData.getStatus());
prevailCloudLogService.save(prevailCloudLog);
if (resultData.getStatus() == 100) {
return true;
}
return false;
} }
@Override @Override
public void pullAccountInfo(long tenantNo) throws Exception { public void pullAccountInfo(long tenantNo) throws Exception {
OcrPrevailCloudLog prevailCloudLog = new OcrPrevailCloudLog();
prevailCloudLog.setType(PrevailCloudConstant.PULL_ACCOUNT_INFO);
prevailCloudLog.setRequestParam(String.valueOf(tenantNo));
Map<String, Object> queryParam = new HashMap<>(); Map<String, Object> queryParam = new HashMap<>();
queryParam.put("tenantNo", tenantNo); queryParam.put("tenantNo", tenantNo);
String json = JSONObject.toJSONString(queryParam); String json = JSONObject.toJSONString(queryParam);
@ -159,8 +187,9 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout()); String responseJsonStr = HttpClient.doPost(url, httpParamers, null, apiConfig.getConnectTimeout(), apiConfig.getReadTimeout());
System.out.println(responseJsonStr); System.out.println(responseJsonStr);
ResultData<String> resultData = JSONUtil.toBean(responseJsonStr, ResultData.class); ResultData<String> resultData = JSONUtil.toBean(responseJsonStr, ResultData.class);
prevailCloudLog.setResponseParam(responseJsonStr);
prevailCloudLog.setStatus(resultData.getStatus());
if (resultData.getStatus() == 100) { if (resultData.getStatus() == 100) {
;
//解析基础数据 //解析基础数据
String data = ApiHelper.decryptResponse(apiConfig.getAccessCode(), resultData); String data = ApiHelper.decryptResponse(apiConfig.getAccessCode(), resultData);
ApiPage<String> apiPage = JSONUtil.toBean(data, ApiPage.class); ApiPage<String> apiPage = JSONUtil.toBean(data, ApiPage.class);
@ -174,6 +203,8 @@ public class PrevailCloudApiImpl implements PrevailCloudApi {
// resultApiPage.setRecords(listResult); // resultApiPage.setRecords(listResult);
// return resultApiPage; // return resultApiPage;
} }
prevailCloudLogService.save(prevailCloudLog);
} }
/** /**

@ -0,0 +1,19 @@
package cn.jyjz.xiaoyao.ocr.common;
/**
* ClassName PrevailCloudConstant$.java
* Description:
* Author scl.
* Date 2024/4/25 8:36
*/
public class PrevailCloudConstant {
public static Integer PULL_PICTURE_SOURCE = 0;
public static Integer SEND_FLOW_RESULT = 1;
public static Integer PULL_ACCOUNT_INFO = 2;
}

@ -0,0 +1,13 @@
package cn.jyjz.xiaoyao.ocr.dataDao;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/4/25 9:18
*/
public interface OcrPrevailCloudLogMapper extends BaseMapper<OcrPrevailCloudLog> {
}

@ -0,0 +1,110 @@
package cn.jyjz.xiaoyao.ocr.dataobject;
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 java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/4/25 9:18
*/
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "ocr_prevail_cloud_log")
public class OcrPrevailCloudLog {
/**
* ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* id
*/
@TableField(value = "form_id")
private Long formId;
/**
*
*/
@TableField(value = "request_param")
private String requestParam;
/**
*
*/
@TableField(value = "response_param")
private String responseParam;
/**
*
*/
@TableField(value = "`status`")
private Integer status;
/**
*
*/
@TableField(value = "`type`")
private Integer type;
/**
*
*/
@TableField(value = "create_by")
private String createBy;
/**
*
*/
@TableField(value = "create_time")
private Date createTime;
/**
*
*/
@TableField(value = "update_by")
private String updateBy;
/**
*
*/
@TableField(value = "update_time")
private Date updateTime;
/**
* id
*/
@TableField(value = "task_id")
private String taskId;
/**
* id
*/
@TableField(value = "picture_id")
private Long pictureId;
/**
* id
*/
@TableField(value = "tenant_id")
private String tenantId;
/**
*
*/
@TableField(value = "redundance")
private String redundance;
}

@ -215,6 +215,12 @@ public class OcrTaskchildPicture implements BaseDto, java.io.Serializable {
@TableField(value = "is_repeated_nodules") @TableField(value = "is_repeated_nodules")
private Integer isRepeatedNodules; private Integer isRepeatedNodules;
@Schema(description = "无量云回调结果")
@TableField(value = "send_result")
private Integer sendResult;
@ApiModelProperty(value = "项目对象") @ApiModelProperty(value = "项目对象")
@TableField(exist = false) @TableField(exist = false)
private Category categoryDto; private Category categoryDto;
@ -295,6 +301,7 @@ public class OcrTaskchildPicture implements BaseDto, java.io.Serializable {
@TableField(exist = false) @TableField(exist = false)
private String serverThumbnailUrl; private String serverThumbnailUrl;
public FlowModelVO getFlowModelVO() { public FlowModelVO getFlowModelVO() {
FlowModelVO flowModelVO = new FlowModelVO(); FlowModelVO flowModelVO = new FlowModelVO();
flowModelVO.setFormid(this.getId()); flowModelVO.setFormid(this.getId());

@ -0,0 +1,14 @@
package cn.jyjz.xiaoyao.ocr.service;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/4/25 12:52
*/
public interface OcrPrevailCloudLogService extends IService<OcrPrevailCloudLog>{
}

@ -149,7 +149,7 @@ public interface OcrTaskchildPictureService extends BaseService<OcrTaskchildPict
Page<OcrTaskChildPictureVo> getPackageSimilarityList(Integer pageNo, Integer pageSize, String oderType, String oderName, String checkDuplicateId, String pictureId); Page<OcrTaskChildPictureVo> getPackageSimilarityList(Integer pageNo, Integer pageSize, String oderType, String oderName, String checkDuplicateId, String pictureId);
void sendFlowTaskResult(OcrTaskchildPicture taskchildPicture, OcrPicture picture, FlowApprove flowApprove) throws Exception; Boolean sendFlowTaskResult(OcrTaskchildPicture taskchildPicture, OcrPicture picture, FlowApprove flowApprove) throws Exception;
List<OcrTaskChildPictureVo> getDubiousfileList(List<String> pictureIds, String userNodeType); List<OcrTaskChildPictureVo> getDubiousfileList(List<String> pictureIds, String userNodeType);
} }

@ -0,0 +1,19 @@
package cn.jyjz.xiaoyao.ocr.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog;
import cn.jyjz.xiaoyao.ocr.dataDao.OcrPrevailCloudLogMapper;
import cn.jyjz.xiaoyao.ocr.service.OcrPrevailCloudLogService;
/**
* ClassName $className$.java
* Description:
* Author scl.
* Date 2024/4/25 12:52
*/
@Service
public class OcrPrevailCloudLogServiceImpl extends ServiceImpl<OcrPrevailCloudLogMapper, OcrPrevailCloudLog> implements OcrPrevailCloudLogService{
}

@ -110,7 +110,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
StringBuffer taskType = new StringBuffer(); StringBuffer taskType = new StringBuffer();
for (String childpictureid : cps) { for (String childpictureid : cps) {
OcrTaskchildPicture old = this.listPicturePackageId(childpictureid, Long.parseLong(packageid), null,""); OcrTaskchildPicture old = this.listPicturePackageId(childpictureid, Long.parseLong(packageid), null, "");
//如果是历史图片,不允许进行设置 //如果是历史图片,不允许进行设置
// if(old.isIzHistory()){ // if(old.isIzHistory()){
@ -306,7 +306,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
} }
@Override @Override
public void createTask(List<OcrPicture> ocrPictureList, String tenantId, UserToken userToken,String deptid) { public void createTask(List<OcrPicture> ocrPictureList, String tenantId, UserToken userToken, String deptid) {
if (null != ocrPictureList && !ocrPictureList.isEmpty()) { if (null != ocrPictureList && !ocrPictureList.isEmpty()) {
//用于标记相似度是否存在百分百的情况 //用于标记相似度是否存在百分百的情况
for (OcrPicture ocrPicture : ocrPictureList) { for (OcrPicture ocrPicture : ocrPictureList) {
@ -380,7 +380,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
* @param fromid * @param fromid
* @return * @return
*/ */
public OcrTaskchildPicture listPicturePackageId(String fromid, Long packageid, UserToken userToken,String taskNode) { public OcrTaskchildPicture listPicturePackageId(String fromid, Long packageid, UserToken userToken, String taskNode) {
OcrTaskchildPicture ocrTaskchildPicture = this.getById(fromid); OcrTaskchildPicture ocrTaskchildPicture = this.getById(fromid);
if (ocrTaskchildPicture == null) { if (ocrTaskchildPicture == null) {
return new OcrTaskchildPicture(); return new OcrTaskchildPicture();
@ -398,7 +398,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
if (null != userToken) { if (null != userToken) {
Optional<Userapprove> first = list.stream().filter(userapprove -> userapprove.getUserid().toString().equals(userToken.getUserid()) && userapprove.getTaskindex().equals(taskNode)).findFirst(); Optional<Userapprove> first = list.stream().filter(userapprove -> userapprove.getUserid().toString().equals(userToken.getUserid()) && userapprove.getTaskindex().equals(taskNode)).findFirst();
Userapprove userapprove = new Userapprove(); Userapprove userapprove = new Userapprove();
userapprove.setStatshis(ocrTaskchildPicture.getStates()==3?2:ocrTaskchildPicture.getStates()==5?3:1); userapprove.setStatshis(ocrTaskchildPicture.getStates() == 3 ? 2 : ocrTaskchildPicture.getStates() == 5 ? 3 : 1);
ocrTaskchildPicture.setUserapprove(first.orElse(userapprove)); ocrTaskchildPicture.setUserapprove(first.orElse(userapprove));
} }
//查询图片对象 //查询图片对象
@ -420,13 +420,13 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
} }
String taskId = ocrTaskchildPicture.getTaskId(); String taskId = ocrTaskchildPicture.getTaskId();
String assignee = ocrTaskchildPicture.getAssignee(); String assignee = ocrTaskchildPicture.getAssignee();
if(taskId.contains(",")){ if (taskId.contains(",")) {
String[] split = assignee.split(","); String[] split = assignee.split(",");
String[] taskIds = taskId.split(","); String[] taskIds = taskId.split(",");
String[] taskNames = ocrTaskchildPicture.getTaskname().split(","); String[] taskNames = ocrTaskchildPicture.getTaskname().split(",");
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
if(split[i].equals(userToken.getLoginname())){ if (split[i].equals(userToken.getLoginname())) {
ocrTaskchildPicture.setTaskId(taskIds[i]); ocrTaskchildPicture.setTaskId(taskIds[i]);
ocrTaskchildPicture.setTaskname(taskNames[i]); ocrTaskchildPicture.setTaskname(taskNames[i]);
} }
@ -440,7 +440,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
ocrTaskchildPicture.setOcrPicture(ocrPicture); ocrTaskchildPicture.setOcrPicture(ocrPicture);
//检查如果已经传了节点那就把taskNo改成传入的节点值。 //检查如果已经传了节点那就把taskNo改成传入的节点值。
if(StringUtils.isNotBlank(taskNode) && !"undefined".equals(taskNode)){ if (StringUtils.isNotBlank(taskNode) && !"undefined".equals(taskNode)) {
ocrTaskchildPicture.setTaskNode(taskNode); ocrTaskchildPicture.setTaskNode(taskNode);
} }
@ -620,7 +620,7 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
*/ */
public List<OcrTaskchildPicture> listFinal(Map<String, Object> query) { public List<OcrTaskchildPicture> listFinal(Map<String, Object> query) {
return this.ocrtaskchildpicturemybatisdao.listFinalTask(query); return this.ocrtaskchildpicturemybatisdao.listFinalTask(query);
} }
@ -667,8 +667,8 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
} }
@Override @Override
public List<OcrTaskChildPictureVo> getPictureHistoryList(List<String> pictureIds, String pictureId,String taskNode) { public List<OcrTaskChildPictureVo> getPictureHistoryList(List<String> pictureIds, String pictureId, String taskNode) {
return ocrtaskchildpicturemybatisdao.getPictureHistoryList(pictureIds, pictureId,taskNode); return ocrtaskchildpicturemybatisdao.getPictureHistoryList(pictureIds, pictureId, taskNode);
} }
@Override @Override
@ -693,18 +693,18 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
if (ObjectUtils.isNotEmpty(duplicateHis) && org.apache.commons.lang3.StringUtils.isNotBlank(duplicateHis.getCheckDuplicateResultHisJson())) { if (ObjectUtils.isNotEmpty(duplicateHis) && org.apache.commons.lang3.StringUtils.isNotBlank(duplicateHis.getCheckDuplicateResultHisJson())) {
JSONObject jsonObject = JSONObject.parseObject(duplicateHis.getCheckDuplicateResultHisJson()); JSONObject jsonObject = JSONObject.parseObject(duplicateHis.getCheckDuplicateResultHisJson());
Set<String> pictureIds = jsonObject.keySet(); Set<String> pictureIds = jsonObject.keySet();
List<OcrTaskChildPictureVo> taskChildPicturesOld = this.getPictureHistoryList(new ArrayList<>(pictureIds), pictureId,taskNode); List<OcrTaskChildPictureVo> taskChildPicturesOld = this.getPictureHistoryList(new ArrayList<>(pictureIds), pictureId, taskNode);
List<OcrTaskChildPictureVo> taskChildPictures = new ArrayList<>(); List<OcrTaskChildPictureVo> taskChildPictures = new ArrayList<>();
for (OcrTaskChildPictureVo taskChildPicture : taskChildPicturesOld) { for (OcrTaskChildPictureVo taskChildPicture : taskChildPicturesOld) {
if(taskChildPicture.getPictureId()!=null){ if (taskChildPicture.getPictureId() != null) {
taskChildPictures.add(taskChildPicture); taskChildPictures.add(taskChildPicture);
} }
} }
for (OcrTaskChildPictureVo taskChildPicture : taskChildPictures) { for (OcrTaskChildPictureVo taskChildPicture : taskChildPictures) {
if(jsonObject.getString(taskChildPicture.getPictureId())!=null){ if (jsonObject.getString(taskChildPicture.getPictureId()) != null) {
taskChildPicture.setSimilarityScore(Integer.parseInt(jsonObject.getString(taskChildPicture.getPictureId().toString()))); taskChildPicture.setSimilarityScore(Integer.parseInt(jsonObject.getString(taskChildPicture.getPictureId().toString())));
}else{ } else {
taskChildPicture.setSimilarityScore(1); taskChildPicture.setSimilarityScore(1);
} }
@ -737,14 +737,14 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
} }
@Override @Override
public void sendFlowTaskResult(OcrTaskchildPicture taskchildPicture, OcrPicture picture, FlowApprove flowApprove) throws Exception { public Boolean sendFlowTaskResult(OcrTaskchildPicture taskchildPicture, OcrPicture picture, FlowApprove flowApprove) throws Exception {
FlowResultDto flowResultDto = new FlowResultDto(); FlowResultDto flowResultDto = new FlowResultDto();
flowResultDto.setTenantNo(picture.getTenantId()); flowResultDto.setTenantNo(picture.getTenantId());
flowResultDto.setAccountNo(Long.parseLong(picture.getPictureid())); flowResultDto.setAccountNo(Long.parseLong(picture.getPictureid()));
flowResultDto.setTaskNo(Long.parseLong(picture.getRemark())); flowResultDto.setTaskNo(Long.parseLong(picture.getRemark()));
flowResultDto.setPictureMatchDegree(BigDecimal.valueOf(picture.getSimilarityscore())); flowResultDto.setPictureMatchDegree(BigDecimal.valueOf(picture.getSimilarityscore()));
flowResultDto.setIsPictureRepeat(picture.getField14()==null?0:Integer.valueOf(picture.getField14())); flowResultDto.setIsPictureRepeat(picture.getField14() == null ? 0 : Integer.valueOf(picture.getField14()));
flowResultDto.setIsPictureRight(picture.getIztrueorfalse()==null?0:picture.getIztrueorfalse()); flowResultDto.setIsPictureRight(picture.getIztrueorfalse() == null ? 0 : picture.getIztrueorfalse());
Integer resultStatus = Objects.equals(taskchildPicture.getStates(), SystemConstantsOa.OA_STATUS_TYPE_END) ? SystemConstantsOa.OCR_STATUS_SUCCESS : SystemConstantsOa.OCR_STATUS_FAILURE; Integer resultStatus = Objects.equals(taskchildPicture.getStates(), SystemConstantsOa.OA_STATUS_TYPE_END) ? SystemConstantsOa.OCR_STATUS_SUCCESS : SystemConstantsOa.OCR_STATUS_FAILURE;
flowResultDto.setApproveResult(resultStatus); flowResultDto.setApproveResult(resultStatus);
flowResultDto.setApproveRemark(flowApprove.getComment()); flowResultDto.setApproveRemark(flowApprove.getComment());
@ -757,7 +757,8 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
} }
} }
flowResultDto.setApproveDetailList(nodeList); flowResultDto.setApproveDetailList(nodeList);
prevailCloudApi.sendFlowTaskResult(picture.getTenantId().toString(),JSON.toJSONString(flowResultDto)); return prevailCloudApi.sendFlowTaskResult(taskchildPicture.getId().toString(), JSON.toJSONString(flowResultDto), picture.getId(), picture.getRemark());
} }

@ -229,6 +229,7 @@
HAVING count(field8) > 1) t1 HAVING count(field8) > 1) t1
LEFT JOIN ocr_taskchild_picture t2 ON t1.ID = t2.PICTUREID LEFT JOIN ocr_taskchild_picture t2 ON t1.ID = t2.PICTUREID
LEFT JOIN ocr_picture t3 on t1.id = t3.ID LEFT JOIN ocr_picture t3 on t1.id = t3.ID
where t2.TENANTID = #{tenantId,jdbcType=VARCHAR}
</select> </select>
<select id="repetitionTaskList" resultType="cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture"> <select id="repetitionTaskList" resultType="cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture">
@ -236,11 +237,12 @@
FROM ocr_taskchild_picture t2 FROM ocr_taskchild_picture t2
LEFT JOIN ocr_picture t3 ON t2.PICTUREID = t3.ID LEFT JOIN ocr_picture t3 ON t2.PICTUREID = t3.ID
WHERE WHERE
t2.TENANTID = #{tenantId,jdbcType=VARCHAR}
<if test="type == 0"> <if test="type == 0">
t2.ISFINAIL = 1 and t2.ISFINAIL = 1
</if> </if>
<if test="type == 1"> <if test="type == 1">
t2.ISFINAIL = 1 and t2.ISFINAIL = 1
</if> </if>
and t3.field8 IN (SELECT t3.field8 and t3.field8 IN (SELECT t3.field8
FROM ocr_taskchild_picture t2 FROM ocr_taskchild_picture t2

@ -0,0 +1,27 @@
<?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.OcrPrevailCloudLogMapper">
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.ocr.dataobject.OcrPrevailCloudLog">
<!--@mbg.generated-->
<!--@Table ocr_prevail_cloud_log-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="form_id" jdbcType="BIGINT" property="formId" />
<result column="request_param" jdbcType="VARCHAR" property="requestParam" />
<result column="response_param" jdbcType="VARCHAR" property="responseParam" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="task_id" jdbcType="VARCHAR" property="taskId" />
<result column="picture_id" jdbcType="BIGINT" property="pictureId" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="redundance" jdbcType="VARCHAR" property="redundance" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, form_id, request_param, response_param, `status`, `type`, create_by, create_time,
update_by, update_time, task_id, picture_id, tenant_id, redundance
</sql>
</mapper>
Loading…
Cancel
Save