| | |
| | | package cn.flightfeather.supervision.lightshare.service.Impl |
| | | |
| | | import cn.flightfeather.supervision.common.nlp.NlpController |
| | | import cn.flightfeather.supervision.domain.entity.* |
| | | import cn.flightfeather.supervision.domain.enumeration.* |
| | | import cn.flightfeather.supervision.domain.mapper.* |
| | |
| | | private val userinfoMapper: UserinfoMapper, |
| | | private val cstQuestionMapper: CstQuestionMapper, |
| | | private val settingAnswerMapper: SettingAnswerMapper, |
| | | private val enforceCaseMapper: EnforceCaseMapper |
| | | private val enforceCaseMapper: EnforceCaseMapper, |
| | | private val nlpController: NlpController |
| | | ) : OnLineQuestionService { |
| | | @Resource |
| | | private val onLineQuestionMapper: OnLineQuestionMapper? = null |
| | |
| | | } |
| | | |
| | | override fun searchLaw(userId: String, keyword: String, type: Byte?, page: Int, perPage: Int): BaseResponse<List<ConsultResultVo>> { |
| | | val keywordList = if (keyword.isBlank()) { |
| | | emptyList() |
| | | } else { |
| | | nlpController.execute(keyword) |
| | | } |
| | | val userInfo = userinfoMapper.selectByPrimaryKey(userId) ?: return BaseResponse(false) |
| | | val response = BaseResponse<List<ConsultResultVo>>(false, head = DataHead(page, perPage)) |
| | | val result = mutableListOf<ConsultResultVo>() |
| | |
| | | if (type == null || type == ConsultResultType.TYPE1.value) { |
| | | val p = PageHelper.startPage<MgtFile>(_page, _perPage) |
| | | val example = Example(MgtFile::class.java).apply { |
| | | if (keyword.isNotBlank()) { |
| | | createCriteria().orLike("mfName", "%${keyword}%") |
| | | .orLike("mfShortName", "%${keyword}%") |
| | | .orLike("mfSummary", "%${keyword}%") |
| | | .orLike("mfKeywordLv1", "%${keyword}%") |
| | | .orLike("mfKeywordLv2", "%${keyword}%") |
| | | .orLike("mfKeywordLv3", "%${keyword}%") |
| | | .orLike("mfKeywordLv4", "%${keyword}%") |
| | | if (keywordList.isNotEmpty()) { |
| | | createCriteria().apply { |
| | | keywordList.forEach { k -> |
| | | orLike("mfName", "%${k}%") |
| | | orLike("mfShortName", "%${k}%") |
| | | orLike("mfSummary", "%${k}%") |
| | | orLike("mfKeywordLv1", "%${k}%") |
| | | orLike("mfKeywordLv2", "%${k}%") |
| | | orLike("mfKeywordLv3", "%${k}%") |
| | | orLike("mfKeywordLv4", "%${k}%") |
| | | } |
| | | } |
| | | and(createCriteria().orLike("mfExtension1", "%${userInfo.extension2}%") |
| | | .orEqualTo("mfExtension1", "") |
| | | .orIsNull("mfExtension1")) |
| | | } else { |
| | | // TODO: 2022/9/8 没有关键字时,按照热门获取机制获取 |
| | | createCriteria().orLike("mfExtension1", "%${userInfo.extension2}%") |
| | |
| | | |
| | | fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) |
| | | itemType = EnElementType.getNameByValue(it.mfEpItemType) |
| | | itemSubType = EnElementSubType.getNameByValue(it.mfEpItemSubtype) |
| | | itemSubType = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) |
| | | fileUrl = it.mfFileUrl |
| | | val keyList = it.mfKeywordLv1.split("、") |
| | | for (i in keyList.indices) { |
| | |
| | | val map = mutableMapOf<String, MgtFile>() |
| | | val p = PageHelper.startPage<MgtItem>(_page, _perPage) |
| | | val example = Example(MgtItem::class.java).apply { |
| | | if (keyword.isNotBlank()) { |
| | | createCriteria().orLike("miChapterKeyword", "%${keyword}%") |
| | | .orLike("miKeyword", "%${keyword}%") |
| | | if (keywordList.isNotEmpty()) { |
| | | createCriteria().apply { |
| | | keywordList.forEach { k -> |
| | | orLike("miChapterKeyword", "%${k}%") |
| | | orLike("miKeyword", "%${k}%") |
| | | } |
| | | } |
| | | } else { |
| | | // TODO: 2022/9/8 没有关键字时,按照热门获取机制获取条目 |
| | | } |
| | | } |
| | | mgtItemMapper.selectByExample(example).forEach { |
| | | |
| | | if (!map.containsKey(it.mfGuid)) { |
| | | map[it.mfGuid] = mgtFileMapper.selectByPrimaryKey(it.mfGuid) |
| | | } |
| | |
| | | if (type == null || type == ConsultResultType.TYPE4.value) { |
| | | val p = PageHelper.startPage<CstQuestion>(_page, _perPage) |
| | | val example = Example(CstQuestion::class.java).apply { |
| | | if (keyword.isNotBlank()) { |
| | | if (keywordList.isNotEmpty()) { |
| | | createCriteria().orLike("cqScenes", "%${userInfo.extension2}%") |
| | | .orEqualTo("cqScenes", "") |
| | | .orIsNull("cqScenes") |
| | | and( |
| | | createCriteria().orLike("cqContent", "%${keyword}%") |
| | | .orLike("cqKeywords", "%${keyword}%") |
| | | createCriteria().apply { |
| | | keywordList.forEach { k -> |
| | | orLike("cqContent", "%${k}%") |
| | | orLike("cqKeywords", "%${k}%") |
| | | } |
| | | } |
| | | ) |
| | | } else { |
| | | // TODO: 2022/9/8 没有关键字时,按照热门获取机制获取 |
| | |
| | | |
| | | // fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) |
| | | itemType = EnElementType.getNameByValue(it.cqKind) |
| | | itemSubType = EnElementSubType.getNameByValue(it.cqSubkind) |
| | | itemSubType = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) |
| | | // fileUrl = it.mfFileUrl |
| | | // val keyList = it.mfKeywordLv1.split("、") |
| | | // for (i in keyList.indices) { |
| | |
| | | // } |
| | | // } |
| | | time = it.cqCreateTime |
| | | punish = it.cqIsPunish |
| | | illegal = it.cqIsIllegal |
| | | shotSpot = it.cqIsShotspot |
| | | supervise = it.cqIsSupervise |
| | | }) |
| | | } |
| | | response.success = true |
| | |
| | | if (type == null || type == ConsultResultType.TYPE3.value) { |
| | | val p = PageHelper.startPage<EnforceCase>(_page, _perPage) |
| | | val example = Example(EnforceCase::class.java).apply { |
| | | if (keyword.isNotBlank()) { |
| | | if (keywordList.isNotEmpty()) { |
| | | createCriteria().orLike("ecScenes", "%${userInfo.extension2}%") |
| | | .orEqualTo("ecScenes", "") |
| | | .orIsNull("ecScenes") |
| | | and( |
| | | createCriteria().orLike("ecTitle", "%${keyword}%") |
| | | .orLike("ecKeywords", "%${keyword}%") |
| | | createCriteria().apply { |
| | | keywordList.forEach { k -> |
| | | orLike("ecTitle", "%${k}%") |
| | | orLike("ecKeywords", "%${k}%") |
| | | } |
| | | } |
| | | ) |
| | | } else { |
| | | // TODO: 2022/9/8 没有关键字时,按照热门获取机制获取 |
| | |
| | | |
| | | // fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) |
| | | itemType = EnElementType.getNameByValue(it.ecEpItemType) |
| | | itemSubType = EnElementSubType.getNameByValue(it.ecEpItemSubtype) |
| | | itemSubType = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) |
| | | imgUrl = it.ecAppendixUrl?.split(";")?.get(0) |
| | | time = it.ecCreateTime |
| | | |
| | |
| | | mfMgtLevel = ManageLevelType.getNameByValue(it.mfMgtLevel) |
| | | mfFileType = ConsultFileType.getNameByValue(it.mfFileType) |
| | | mfEpItemType = EnElementType.getNameByValue(it.mfEpItemType) |
| | | mfEpItemSubtype = EnElementSubType.getNameByValue(it.mfEpItemSubtype) |
| | | mfEpItemSubtype = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) |
| | | mfSaveType = FileSaveType.getNameByValue(it.mfSaveType) |
| | | } |
| | | result.add(vo) |
| | |
| | | mfMgtLevel = ManageLevelType.getNameByValue(it.mfMgtLevel) |
| | | mfFileType = ConsultFileType.getNameByValue(it.mfFileType) |
| | | mfEpItemType = EnElementType.getNameByValue(it.mfEpItemType) |
| | | mfEpItemSubtype = EnElementSubType.getNameByValue(it.mfEpItemSubtype) |
| | | mfEpItemSubtype = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) |
| | | mfSaveType = FileSaveType.getNameByValue(it.mfSaveType) |
| | | } |
| | | } |
| | |
| | | BeanUtils.copyProperties(it, vo) |
| | | vo.apply { |
| | | cqKind = EnElementType.getNameByValue(it.cqKind) |
| | | cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) |
| | | cqSubkind = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) |
| | | } |
| | | |
| | | if (answers.isNotEmpty()) { |
| | |
| | | typeId = ConsultResultType.TYPE4.value |
| | | typeName = ConsultResultType.TYPE4.des |
| | | itemType = EnElementType.getNameByValue(it.cqKind) |
| | | itemSubType = EnElementSubType.getNameByValue(it.cqSubkind) |
| | | itemSubType = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) |
| | | time = it.cqCreateTime |
| | | }) |
| | | |
| | |
| | | // BeanUtils.copyProperties(it, vo) |
| | | // vo.apply { |
| | | // cqKind = EnElementType.getNameByValue(it.cqKind) |
| | | // cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) |
| | | // cqSubkind = EnElementSubType.getSubType(it.ecEpItemType, it.cqSubkind) |
| | | // } |
| | | // |
| | | // if (answers.isNotEmpty()) { |
| | |
| | | BeanUtils.copyProperties(it, result) |
| | | result.apply { |
| | | cqKind = EnElementType.getNameByValue(it.cqKind) |
| | | cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) |
| | | cqSubkind = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) |
| | | } |
| | | } |
| | | |
| | |
| | | BeanUtils.copyProperties(it, vo) |
| | | vo.apply { |
| | | ecEpItemType = EnElementType.getNameByValue(it.ecEpItemType) |
| | | ecEpItemSubtype = EnElementSubType.getNameByValue(it.ecEpItemSubtype) |
| | | ecEpItemSubtype = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) |
| | | ecType = EnforceCaseType.getNameByValue(it.ecType) |
| | | } |
| | | result.add(vo) |
| | |
| | | BeanUtils.copyProperties(it, result) |
| | | result.apply { |
| | | ecEpItemType = EnElementType.getNameByValue(it.ecEpItemType) |
| | | ecEpItemSubtype = EnElementSubType.getNameByValue(it.ecEpItemSubtype) |
| | | ecEpItemSubtype = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) |
| | | ecType = EnforceCaseType.getNameByValue(it.ecType) |
| | | } |
| | | } |