| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Domainitem |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.DomainitemMapper |
| | | import cn.flightfeather.supervision.lightshare.service.DomainitemService |
| | |
| | | val domainitemVoList = mutableListOf<DomainitemVo>() |
| | | val domainitem = Domainitem() |
| | | domainitem.dcguid = guid |
| | | val domainitemList = domainitemMapper.select(domainitem) |
| | | val domainitemList = domainitemMapper.select(domainitem).also { it.sortBy { it1 -> it1.index } } |
| | | domainitemList.forEach { |
| | | val domainitemVo = DomainitemVo() |
| | | BeanUtils.copyProperties(it, domainitemVo) |
| | |
| | | return domainitemVoList |
| | | } |
| | | |
| | | override fun save(domainitem: Domainitem): Int = domainitemMapper.insert(domainitem) |
| | | override fun save(domainitem: Domainitem): Domainitem{ |
| | | if (domainitem.guid == null) { |
| | | domainitem.guid = UUIDGenerator.generate16ShortUUID() |
| | | } |
| | | return if (domainitemMapper.insert(domainitem) == 1) { |
| | | domainitem |
| | | } else { |
| | | throw BizException("值域项新增失败") |
| | | } |
| | | } |
| | | |
| | | override fun update(domainitem: Domainitem): Int = domainitemMapper.updateByPrimaryKey(domainitem) |
| | | override fun update(domainitem: Domainitem): Domainitem { |
| | | // 2025.11.11 新增版本号对比逻辑,若更新的配置信息版本号等于数据历史版本号,才能更新 |
| | | val oldOne = domainitemMapper.selectByPrimaryKey(domainitem.guid) |
| | | if ((domainitem.remark == oldOne.remark)) { |
| | | // 更新时,版本号递增 |
| | | domainitem.remark = domainitem.remark?.toInt()?.plus(1)?.toString() ?: "1" |
| | | domainitemMapper.updateByPrimaryKey(domainitem) |
| | | } else { |
| | | throw BizException("值域项更新失败,版本号不一致") |
| | | } |
| | | return domainitem |
| | | } |
| | | |
| | | override fun delete(id: String): Int = domainitemMapper.deleteByPrimaryKey(id) |
| | | |
| | | override fun getLocation(sceneType: Int): List<Domainitem> { |
| | | val lId = when (sceneType.toString()) { |
| | | Constant.ScenseType.TYPE1.value -> Constant.INDUSTRY_LOCATION_ID |
| | | Constant.ScenseType.TYPE2.value -> Constant.WHARF_LOCATION_ID |
| | | Constant.ScenseType.TYPE14.value -> Constant.STORAGE_YARD_LOCATION_ID |
| | | Constant.ScenseType.TYPE3.value -> Constant.MIX_LOCATION_ID |
| | | Constant.ScenseType.TYPE5.value -> Constant.RESTAURANT_LOCATION_ID |
| | | Constant.ScenseType.TYPE6.value -> Constant.Vehicle_LOCATION_ID |
| | | Constant.SceneType.TYPE1.value -> Constant.INDUSTRY_LOCATION_ID |
| | | Constant.SceneType.TYPE2.value -> Constant.WHARF_LOCATION_ID |
| | | Constant.SceneType.TYPE14.value -> Constant.STORAGE_YARD_LOCATION_ID |
| | | Constant.SceneType.TYPE3.value -> Constant.MIX_LOCATION_ID |
| | | Constant.SceneType.TYPE5.value -> Constant.RESTAURANT_LOCATION_ID |
| | | Constant.SceneType.TYPE6.value -> Constant.Vehicle_LOCATION_ID |
| | | else -> Constant.INDUSTRY_LOCATION_ID |
| | | } |
| | | |
| | |
| | | orderBy("index") |
| | | }) |
| | | } |
| | | |
| | | override fun getTaskType(): List<Domainitem> { |
| | | return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply { |
| | | createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_TYPE) |
| | | orderBy("index") |
| | | }) |
| | | } |
| | | |
| | | override fun getDeadlineType(): List<Domainitem> { |
| | | return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply { |
| | | createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_DEADLINE_TYPE) |
| | | orderBy("index") |
| | | }) |
| | | } |
| | | |
| | | override fun getLevelType(): List<Domainitem> { |
| | | return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply { |
| | | createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_LEVEL) |
| | | orderBy("index") |
| | | }) |
| | | } |
| | | |
| | | override fun getMediaFileType(sceneType: Int?): MutableMap<String?, String?> { |
| | | val res = mutableMapOf<String?, String?>() |
| | | val type = Constant.SceneType.getByValue(sceneType.toString()) |
| | | when (type) { |
| | | // 工地 |
| | | Constant.SceneType.TYPE1 -> { |
| | | val domainItems = domainitemMapper.selectByExample(Example(Domainitem::class.java).apply { |
| | | createCriteria().andEqualTo("dcguid", Constant.MEDIA_FILE_TYPE_INDUSTRY) |
| | | orderBy("index") |
| | | }) |
| | | domainItems.forEach { res[it.value] = it.text } |
| | | // 工地中的任意拍包含“常规记录”类型 |
| | | res[Constant.MediaFileType.RoutineRecord.value.toString()] = Constant.MediaFileType.RoutineRecord.des |
| | | return res |
| | | } |
| | | // 餐饮 |
| | | Constant.SceneType.TYPE5 -> { |
| | | val domainItems = domainitemMapper.selectByExample(Example(Domainitem::class.java).apply { |
| | | createCriteria().andEqualTo("dcguid", Constant.MEDIA_FILE_TYPE_RESTAURANT) |
| | | orderBy("index") |
| | | }) |
| | | domainItems.forEach { res[it.value] = it.text } |
| | | // 餐饮中的任意拍包含“常规记录”类型 |
| | | res[Constant.MediaFileType.RoutineRecord.value.toString()] = Constant.MediaFileType.RoutineRecord.des |
| | | return res |
| | | } |
| | | // 其余类型场景,使用默认的分类 |
| | | else -> { |
| | | listOf( |
| | | Constant.MediaFileType.Nameplate, |
| | | Constant.MediaFileType.MonitorDevice, |
| | | Constant.MediaFileType.RoutineRecord, |
| | | ).forEach { |
| | | res[it.value.toString()] = it.des |
| | | } |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | } |