| | |
| | | clueConclusion.cId ?: throw BizException("线索id缺失") |
| | | clueConclusion.ccUploaded = false |
| | | clueConclusion.ccCreateTime = Date() |
| | | if (clueConclusion.ccInternal == null) clueConclusion.ccInternal = false |
| | | val conclusion: ClueConclusion? |
| | | try { |
| | | val conclusion = clueConclusionMapper.selectOne(ClueConclusion().apply { cId = clueConclusion.cId }) |
| | | // 更新 |
| | | return if (conclusion != null) { |
| | | if (conclusion.ccUploaded) throw BizException("线索结论已推送,无法修改") |
| | | clueConclusion.ccId = conclusion.ccId |
| | | val res = clueConclusionMapper.updateByPrimaryKeySelective(clueConclusion) |
| | | res == 1 |
| | | } |
| | | // 插入 |
| | | else { |
| | | val res = clueConclusionMapper.insert(clueConclusion) |
| | | res == 1 |
| | | } |
| | | conclusion = clueConclusionMapper.selectOne(ClueConclusion().apply { |
| | | cId = clueConclusion.cId |
| | | ccInternal = clueConclusion.ccInternal |
| | | }) |
| | | } catch (e: Exception) { |
| | | throw BizException("每条线索最多能有一条结论,该线索结论存在多条,请检查系统逻辑") |
| | | } |
| | | // 更新 |
| | | return if (conclusion != null) { |
| | | if (conclusion.ccUploaded) throw BizException("线索结论已推送,无法修改") |
| | | clueConclusion.ccId = conclusion.ccId |
| | | val res = clueConclusionMapper.updateByPrimaryKeySelective(clueConclusion) |
| | | res == 1 |
| | | } |
| | | // 插入 |
| | | else { |
| | | val res = clueConclusionMapper.insert(clueConclusion) |
| | | res == 1 |
| | | } |
| | | |
| | | } |
| | | |
| | | override fun getClueConclusion(clueId: String): ClueConclusion? { |
| | | override fun getClueConclusion(clueId: String, internal: Boolean?): ClueConclusion? { |
| | | val res = clueConclusionMapper.selectByExample(Example(ClueConclusion::class.java).apply { |
| | | createCriteria().andEqualTo("cId", clueId) |
| | | .apply { |
| | | if (internal == true) { |
| | | andEqualTo("ccInternal", true) |
| | | } else { |
| | | and( |
| | | createCriteria().orIsNull("ccInternal") |
| | | .orEqualTo("ccInternal", false) |
| | | ) |
| | | } |
| | | } |
| | | }) |
| | | return if (res.isNotEmpty()) res[0] else null |
| | | } |
| | | |
| | | override fun pushConclusion(conclusionIdList: List<String>?): Boolean { |
| | | clueConclusionMapper.selectByExample(Example(ClueConclusion::class.java).apply { |
| | | createCriteria().andEqualTo("ccUploaded", false).apply { |
| | | conclusionIdList?.let { |
| | | andIn("ccId", it) |
| | | createCriteria() |
| | | .andEqualTo("ccUploaded", false) |
| | | .apply { |
| | | conclusionIdList?.let { |
| | | andIn("ccId", it) |
| | | } |
| | | // 排除掉内部线索结论 |
| | | and( |
| | | createCriteria().orIsNull("ccInternal") |
| | | .orEqualTo("ccInternal", false) |
| | | ) |
| | | } |
| | | } |
| | | }).forEach { |
| | | it?.let { |
| | | clueHttpService.uploadConclusion(it) |