| | |
| | | package cn.flightfeather.supervision.lightshare.service.Impl |
| | | |
| | | import cn.flightfeather.supervision.common.exception.ResponseErrorException |
| | | import cn.flightfeather.supervision.domain.entity.CommitmentTemplate |
| | | import cn.flightfeather.supervision.domain.entity.SceneType |
| | | import cn.flightfeather.supervision.domain.entity.UserConfig |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.entity.* |
| | | import cn.flightfeather.supervision.domain.mapper.* |
| | | import cn.flightfeather.supervision.domain.repository.UserConfigRep |
| | | import cn.flightfeather.supervision.lightshare.service.ConfigService |
| | |
| | | private val baseInfoMapper: BaseInfoMapper, |
| | | private val commitmentTemplateMapper: CommitmentTemplateMapper, |
| | | private val sceneTypeMapper: SceneTypeMapper, |
| | | private val userConfigRep: UserConfigRep |
| | | private val userConfigRep: UserConfigRep, |
| | | private val userSettingRecordMapper: UserSettingRecordMapper, |
| | | ) : ConfigService { |
| | | |
| | | override fun getSceneRange(userId: String): List<Pair<String?, String?>>? { |
| | |
| | | val result = if (config == null || config.ucSceneRange == null) { |
| | | val types = sceneTypeMapper.selectByExample(Example(SceneType::class.java).apply { |
| | | createCriteria().andIsNull("scTag") |
| | | orderBy("scIndex") |
| | | }) |
| | | if (types.isNotEmpty()) { |
| | | types.map { Pair(it?.scId.toString(), it?.scName) } |
| | |
| | | config.ucSceneRange?.split(";")?.let {sr -> |
| | | sceneTypeMapper.selectByExample(Example(SceneType::class.java).apply { |
| | | createCriteria().andIn("scId", sr) |
| | | orderBy("scIndex") |
| | | }).map { Pair(it?.scId.toString(), it?.scName) } |
| | | } |
| | | } |
| | |
| | | .andIn("ctSceneTypeId", condition.sceneTypes) |
| | | }).let { |
| | | if (it.isEmpty()) { |
| | | throw ResponseErrorException("无相关承诺书模板") |
| | | throw BizException("无相关承诺书模板") |
| | | } |
| | | return it[0] |
| | | } |
| | |
| | | override fun getUserConfig(userId: String): UserConfig? { |
| | | return userConfigRep.getUserConfigBySubType(userId) |
| | | } |
| | | |
| | | override fun getUserSetting(userId: String): UserSetting? { |
| | | return userConfigRep.getUserSetting(userId) |
| | | } |
| | | |
| | | override fun getUserSettingRecord(userId: String): UserSettingRecord? { |
| | | return userSettingRecordMapper.selectByPrimaryKey(userId) |
| | | } |
| | | } |