修改-修复排序错乱的问题

topo_dev
liu 9 months ago
parent cf178bd016
commit 2fb1a8feb9

@ -3,6 +3,7 @@ package com.supervision.common.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -12,14 +13,14 @@ import static com.supervision.common.constant.Constants.TOTAL_COUNT;
public class IPages {
public static Map<String, Object> buildDataMap(IPage<?> iPage) {
Map<String, Object> dataMap = new HashMap<>();
Map<String, Object> dataMap = new LinkedHashMap<>();
dataMap.put(TOTAL_COUNT, iPage.getTotal());
dataMap.put(RESULT_LIST, iPage.getRecords());
return dataMap;
}
public static Map<String, Object> buildDataMap(List list, int total) {
Map<String, Object> dataMap = new HashMap();
Map<String, Object> dataMap = new LinkedHashMap<>();
dataMap.put(TOTAL_COUNT, total);
dataMap.put(RESULT_LIST, list);
return dataMap;

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.supervision.common.domain.R;
import com.supervision.police.domain.CasePerson;
import com.supervision.police.domain.ModelCase;
import com.supervision.police.dto.IndexDetail;
import com.supervision.police.dto.ModelCaseBase;
import com.supervision.police.dto.ModelCaseDTO;
import com.supervision.police.service.ModelCaseService;
@ -27,6 +28,7 @@ public class ModelCaseController {
/**
*
*
* @param modelCase
* @param page
* @param size
@ -35,25 +37,27 @@ public class ModelCaseController {
@Operation(summary = "查询案件列表")
@PostMapping("/queryList")
public R<IPage<ModelCaseDTO>> queryList(@RequestBody ModelCaseVO modelCase,
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) {
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) {
IPage<ModelCaseDTO> modelCaseDTOIPage = modelCaseService.queryList(modelCase, page, size);
return R.ok(modelCaseDTOIPage);
}
/**
*
*
* @param caseNo
* @return
*/
@GetMapping("/checkCaseNo")
public R<?> checkCaseNo(@RequestParam @Parameter(name = "caseNo",description = "案件编号") String caseNo,
@RequestParam(required = false) @Parameter(name = "caseId",description = "案件id") String caseId) {
return modelCaseService.checkCaseNo(caseNo,caseId);
public R<?> checkCaseNo(@RequestParam @Parameter(name = "caseNo", description = "案件编号") String caseNo,
@RequestParam(required = false) @Parameter(name = "caseId", description = "案件id") String caseId) {
return modelCaseService.checkCaseNo(caseNo, caseId);
}
/**
*
*
* @param modelCaseBase
* @return
*/
@ -64,6 +68,7 @@ public class ModelCaseController {
/**
*
*
* @param id
* @return
*/
@ -74,6 +79,7 @@ public class ModelCaseController {
/**
*
*
* @param name
* @return
*/
@ -97,6 +103,7 @@ public class ModelCaseController {
/**
*
*
* @param file
* @return
*/
@ -107,16 +114,18 @@ public class ModelCaseController {
/**
*
*
* @param caseId
* @param indexType
* @return
*/
@PostMapping("/getIndexDetail")
public R<?> getIndexDetail(@RequestParam String caseId,
public R<IPage<IndexDetail>> getIndexDetail(@RequestParam String caseId,
@RequestParam String indexType,
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) {
return modelCaseService.getIndexDetail(caseId, indexType, page, size);
IPage<IndexDetail> indexDetail = modelCaseService.getIndexDetail(caseId, indexType, page, size);
return R.ok(indexDetail);
}
}

@ -10,6 +10,8 @@ import java.util.Objects;
@Data
public class AtomicIndexDTO {
private String indexId;
private String atomicIndexId;
/**

@ -7,6 +7,8 @@ import java.util.List;
@Data
public class IndexDetail {
private String indexId;
/**
*
*/

@ -45,6 +45,7 @@ public interface ModelCaseMapper extends BaseMapper<ModelCase> {
@Param("indexType") String indexType);
List<AtomicIndexDTO> getAtomicDetail(@Param("caseId") String caseId,
@Param("indexId") String indexId,
@Param("atomicIds") List<String> atomicIds);
}

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.supervision.common.domain.R;
import com.supervision.police.domain.CasePerson;
import com.supervision.police.domain.ModelCase;
import com.supervision.police.dto.IndexDetail;
import com.supervision.police.dto.ModelCaseBase;
import com.supervision.police.dto.ModelCaseDTO;
import com.supervision.police.vo.ModelCaseVO;
@ -41,7 +42,7 @@ public interface ModelCaseService extends IService<ModelCase> {
R<?> uploadCase(MultipartFile file);
R<?> getIndexDetail(String caseId, String indexType, Integer page, Integer size);
IPage<IndexDetail> getIndexDetail(String caseId, String indexType, Integer page, Integer size);
}

@ -108,7 +108,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
if (CollUtil.isNotEmpty(casePersonMap)) {
Optional<CasePerson> optionalCasePerson = casePersonMap.getOrDefault("1", new ArrayList<>())
.stream().filter(person -> Integer.valueOf(1).equals(person.getCaseActorFlag())).findAny();
if (optionalCasePerson.isPresent()){
if (optionalCasePerson.isPresent()) {
modelCaseDTO.setLawActor(optionalCasePerson.get());
modelCaseDTO.floatLawActorInfo();
}
@ -180,7 +180,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
ModelCase modelCase = modelCaseMapper.selectById(id);
LangChainChatRes langChainChatRes = langChainChatService.deleteBase(modelCase.getCaseNo());
if (200 != langChainChatRes.getCode()){
if (200 != langChainChatRes.getCode()) {
log.info("删除知识库失败");
}
modelCase.setDataStatus(DataStatus.NOT_AVAILABLE.getCode());
@ -245,7 +245,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
.set(CasePerson::getName, person.getName())
.set(CasePerson::getRoleCode, person.getRoleCode())
.update();
if (update){
if (update) {
caseStatusManageService.whenSaveCasePeople(person.getCaseId(), person);
}
@ -316,7 +316,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
}
@Override
public R<?> getIndexDetail(String caseId, String indexType, Integer page, Integer size) {
public IPage<IndexDetail> getIndexDetail(String caseId, String indexType, Integer page, Integer size) {
IPage<IndexDetail> iPage = new Page<>(page, size);
iPage = modelCaseMapper.getIndexDetail(iPage, caseId, indexType);
List<IndexDetail> records = iPage.getRecords();
@ -332,7 +332,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
Map<String, String> indexJundgeLogicMap = parseLogicMap(judgeLogic);
String[] array = record.getAtomicIds().split(",");
List<String> atomicIds = Arrays.asList(array);
List<AtomicIndexDTO> atomics = modelCaseMapper.getAtomicDetail(caseId, atomicIds);
List<AtomicIndexDTO> atomics = modelCaseMapper.getAtomicDetail(caseId, record.getIndexId(), atomicIds);
for (AtomicIndexDTO atomic : atomics) {
// 需要和原子指标的规则判断是否一致(解决出罪和入罪冲突的问题)
String s = indexJundgeLogicMap.get(atomic.getAtomicIndexId());
@ -348,8 +348,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
}
record.setChildren(atomics);
}
iPage.setRecords(records);
return R.ok(IPages.buildDataMap(iPage));
return iPage;
}
private Map<String, String> parseLogicMap(String judgeLogic) {

@ -23,7 +23,8 @@
</foreach>
</if>
<if test="modelCase.involvedPerson != null and modelCase.involvedPerson != ''">
and ( law_actor like concat('%', #{modelCase.involvedPerson}, '%') or law_party like concat('%', #{modelCase.involvedPerson}, '%'))
and ( law_actor like concat('%', #{modelCase.involvedPerson}, '%') or law_party like concat('%',
#{modelCase.involvedPerson}, '%'))
</if>
<if test="modelCase.lawActor != null and modelCase.lawActor != ''">
and law_actor like concat('%', #{modelCase.lawActor}, '%')
@ -53,23 +54,29 @@
and mi.index_type = #{indexType}
</select>
<select id="getAtomicDetail" resultType="com.supervision.police.dto.AtomicIndexDTO">
select mai.id as atomicIndexId,mai.name as indexName,mai.index_source as indexSource,
select mar.index_id as indexId, mai.id as atomicIndexId,mai.name as indexName,mai.index_source as indexSource,
mar.atomic_result as atomicResult,
concat(nrs.question, nrs.answer) as record
from model_atomic_result mar
left join model_atomic_index mai on mar.atomic_id = mai.id
left join note_record_split nrs on mar.record_split_id = nrs.id
where mar.case_id = #{caseId} and mar.atomic_id in
where mar.case_id = #{caseId} and mar.index_id = #{indexId} and mar.atomic_id in
<foreach collection="atomicIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getIndexDetail" resultType="com.supervision.police.dto.IndexDetail">
select mi.name as indexName, mi.index_score as score, mir.index_result,mir.pre_result as preResult, mir.atomic_ids,mi.judge_logic as judgeLogic
select mi.id as indexId,
mi.name as indexName,
mi.index_score as score,
mir.index_result,
mir.pre_result as preResult,
mir.atomic_ids,
mi.judge_logic as judgeLogic
from model_index mi
left join model_index_result mir on ( mi.id = mir.index_id and mir.case_id = #{caseId} )
left join model_index_result mir on (mi.id = mir.index_id and mir.case_id = #{caseId})
WHERE mi.data_status = '1'
and mi.index_type = #{indexType}
order by mir.index_result desc
order by mir.index_result, mi.id desc
</select>
</mapper>
Loading…
Cancel
Save