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

topo_dev
liu 10 months ago
parent cf178bd016
commit 2fb1a8feb9

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

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

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

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

@ -23,7 +23,8 @@
</foreach> </foreach>
</if> </if>
<if test="modelCase.involvedPerson != null and modelCase.involvedPerson != ''"> <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>
<if test="modelCase.lawActor != null and modelCase.lawActor != ''"> <if test="modelCase.lawActor != null and modelCase.lawActor != ''">
and law_actor like concat('%', #{modelCase.lawActor}, '%') and law_actor like concat('%', #{modelCase.lawActor}, '%')
@ -53,23 +54,29 @@
and mi.index_type = #{indexType} and mi.index_type = #{indexType}
</select> </select>
<select id="getAtomicDetail" resultType="com.supervision.police.dto.AtomicIndexDTO"> <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, mar.atomic_result as atomicResult,
concat(nrs.question, nrs.answer) as record concat(nrs.question, nrs.answer) as record
from model_atomic_result mar from model_atomic_result mar
left join model_atomic_index mai on mar.atomic_id = mai.id 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 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=","> <foreach collection="atomicIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="getIndexDetail" resultType="com.supervision.police.dto.IndexDetail"> <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 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' WHERE mi.data_status = '1'
and mi.index_type = #{indexType} and mi.index_type = #{indexType}
order by mir.index_result desc order by mir.index_result, mi.id desc
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save