1. 添加案件批处理功能
parent
f136c64ed5
commit
5aac77ec1b
@ -0,0 +1,13 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.supervision.police.dto.CaseProcessDTO;
|
||||||
|
import com.supervision.police.vo.CaseProcessReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface MroService {
|
||||||
|
IPage<CaseProcessDTO> queryCaseList(CaseProcessReqVO caseProcessReqVO, Integer page, Integer size);
|
||||||
|
|
||||||
|
void analysisCase(List<String> caseIds);
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.supervision.police.domain.ModelCase;
|
||||||
|
import com.supervision.police.domain.TaskCaseRecord;
|
||||||
|
import com.supervision.police.dto.AnalyseCaseDTO;
|
||||||
|
import com.supervision.police.dto.CaseProcessDTO;
|
||||||
|
import com.supervision.police.service.ModelCaseService;
|
||||||
|
import com.supervision.police.service.ModelService;
|
||||||
|
import com.supervision.police.service.MroService;
|
||||||
|
import com.supervision.police.service.TaskCaseRecordService;
|
||||||
|
import com.supervision.police.vo.CaseProcessReqVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MroServiceImpl implements MroService {
|
||||||
|
|
||||||
|
private final ModelCaseService modelCaseService;
|
||||||
|
|
||||||
|
private final ModelService modelService;
|
||||||
|
|
||||||
|
private final TaskCaseRecordService caseRecordService;
|
||||||
|
@Override
|
||||||
|
public IPage<CaseProcessDTO> queryCaseList(CaseProcessReqVO caseProcessReqVO, Integer page, Integer size) {
|
||||||
|
|
||||||
|
Page<ModelCase> paged = modelCaseService.lambdaQuery()
|
||||||
|
.like(StrUtil.isNotEmpty(caseProcessReqVO.getCaseName()), ModelCase::getCaseName, caseProcessReqVO.getCaseName())
|
||||||
|
.in(CollUtil.isNotEmpty(caseProcessReqVO.getIdentifyResult()), ModelCase::getIdentifyResult, caseProcessReqVO.getIdentifyResult())
|
||||||
|
.in(CollUtil.isNotEmpty(caseProcessReqVO.getAnalysisStatus()), ModelCase::getCaseAnalysisStatus, caseProcessReqVO.getAnalysisStatus())
|
||||||
|
.orderBy(true, StrUtil.equalsIgnoreCase(caseProcessReqVO.getSort(), "asc"), ModelCase::getCaseAnalysisSuccessTime)
|
||||||
|
.page(Page.of(page, size));
|
||||||
|
|
||||||
|
final Set<String> processCaseIds = new HashSet<>();
|
||||||
|
if (!paged.getRecords().isEmpty()){
|
||||||
|
caseRecordService.queryProcessingTaskList().stream().map(TaskCaseRecord::getCaseId).forEach(processCaseIds::add);
|
||||||
|
}
|
||||||
|
return paged.convert(r->{
|
||||||
|
CaseProcessDTO caseProcessDTO = new CaseProcessDTO(r);
|
||||||
|
caseProcessDTO.setEnableAnalyse(processCaseIds.contains(r.getId()) ? "0" : "1");
|
||||||
|
return caseProcessDTO;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void analysisCase(List<String> caseIds) {
|
||||||
|
|
||||||
|
Assert.notEmpty(caseIds, "案件id不能为空!");
|
||||||
|
List<ModelCase> modelCases = modelCaseService.listByIds(caseIds);
|
||||||
|
Assert.notEmpty(modelCases, "案件不存在!");
|
||||||
|
|
||||||
|
for (ModelCase modelCase : modelCases) {
|
||||||
|
int caseAnalysisStatus = modelCase.getCaseAnalysisStatus();
|
||||||
|
if (1 == caseAnalysisStatus) {
|
||||||
|
log.info("案件【{}】正在分析中,跳过", modelCase.getCaseName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AnalyseCaseDTO analyseCaseDTO = new AnalyseCaseDTO();
|
||||||
|
analyseCaseDTO.setCaseId(modelCase.getId());
|
||||||
|
modelService.analyseCaseWrapper(analyseCaseDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.supervision.police.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CaseProcessReqVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件名称
|
||||||
|
*/
|
||||||
|
private String caseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认定结果
|
||||||
|
*/
|
||||||
|
private List<String> identifyResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析状态
|
||||||
|
*/
|
||||||
|
private List<String> analysisStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段 asc/desc
|
||||||
|
*/
|
||||||
|
private String sort;
|
||||||
|
}
|
Loading…
Reference in New Issue