|
|
@@ -1,23 +1,29 @@
|
|
|
package com.grkj.data.domain.logic.impl
|
|
|
|
|
|
-import com.grkj.data.local.dao.HardwareDao
|
|
|
-import com.grkj.data.local.dao.IsolationPointDao
|
|
|
-import com.grkj.data.local.dao.JobTicketDao
|
|
|
-import com.grkj.data.local.dao.UserDao
|
|
|
import com.grkj.data.data.MMKVConstants
|
|
|
import com.grkj.data.data.MainDomainData
|
|
|
+import com.grkj.data.domain.logic.BaseLogic
|
|
|
+import com.grkj.data.domain.logic.IHardwareLogic
|
|
|
+import com.grkj.data.domain.vo.CardManageFilterVo
|
|
|
+import com.grkj.data.domain.vo.KeyManageFilterVo
|
|
|
+import com.grkj.data.domain.vo.LockManageFilterVo
|
|
|
+import com.grkj.data.domain.vo.PointToMapVo
|
|
|
+import com.grkj.data.domain.vo.RfidTokenManageFilterVo
|
|
|
+import com.grkj.data.entity.local.LockData
|
|
|
+import com.grkj.data.entity.local.PointData
|
|
|
import com.grkj.data.enums.CommonDictDataEnum
|
|
|
import com.grkj.data.enums.HardwareMode
|
|
|
+import com.grkj.data.local.dos.IsIsolationPoint
|
|
|
import com.grkj.data.local.dos.IsJobCard
|
|
|
import com.grkj.data.local.dos.IsJobTicketLock
|
|
|
import com.grkj.data.local.dos.IsKey
|
|
|
import com.grkj.data.local.dos.IsLock
|
|
|
import com.grkj.data.local.dos.IsLockCabinet
|
|
|
import com.grkj.data.local.dos.IsLockCabinetSlots
|
|
|
+import com.grkj.data.local.dos.IsMapPoint
|
|
|
import com.grkj.data.local.dos.IsRfidToken
|
|
|
-import com.grkj.data.entity.local.LockData
|
|
|
-import com.grkj.data.entity.local.PointData
|
|
|
-import com.grkj.data.domain.logic.IHardwareLogic
|
|
|
+import com.grkj.data.local.dos.IsUserWorkstation
|
|
|
+import com.grkj.data.local.dos.IsWorkstation
|
|
|
import com.grkj.data.net.req.LockPointUpdateReq
|
|
|
import com.grkj.data.net.req.LockTakeUpdateReq
|
|
|
import com.grkj.data.net.res.CabinetSlotsRecord
|
|
|
@@ -29,15 +35,11 @@ import com.grkj.data.net.res.KeyPageRes
|
|
|
import com.grkj.data.net.res.LockInfoRes
|
|
|
import com.grkj.data.net.res.LockPageItem
|
|
|
import com.grkj.data.net.res.LockPageRes
|
|
|
-import com.grkj.data.domain.vo.CardManageFilterVo
|
|
|
-import com.grkj.data.domain.vo.KeyManageFilterVo
|
|
|
-import com.grkj.data.domain.vo.LockManageFilterVo
|
|
|
-import com.grkj.data.domain.vo.RfidTokenManageFilterVo
|
|
|
-import com.grkj.data.domain.logic.BaseLogic
|
|
|
-import com.grkj.data.local.dos.IsIsolationPoint
|
|
|
-import com.grkj.data.local.dos.IsMapPoint
|
|
|
-import com.grkj.data.domain.vo.DataExportPointVo
|
|
|
-import com.grkj.data.domain.vo.PointToMapVo
|
|
|
+import com.grkj.data.repository.HardwareRepository
|
|
|
+import com.grkj.data.repository.IsolationPointRepository
|
|
|
+import com.grkj.data.repository.JobTicketRepository
|
|
|
+import com.grkj.data.repository.UserRepository
|
|
|
+import com.grkj.data.repository.WorkstationRepository
|
|
|
import com.grkj.shared.utils.i18n.I18nManager
|
|
|
import com.sik.sikcore.data.BeanUtils
|
|
|
import com.sik.sikcore.date.TimeUtils
|
|
|
@@ -51,11 +53,11 @@ import javax.inject.Singleton
|
|
|
*/
|
|
|
@Singleton
|
|
|
class HardwareLogic @Inject constructor(
|
|
|
- val hardwareDao: HardwareDao,
|
|
|
- val userDao: UserDao,
|
|
|
- val isolationPointDao: IsolationPointDao,
|
|
|
- val jobTicketDao: JobTicketDao,
|
|
|
- val workstationLogic: WorkstationLogic
|
|
|
+ val hardwareRepository: HardwareRepository,
|
|
|
+ val userRepository: UserRepository,
|
|
|
+ val isolationPointRepository: IsolationPointRepository,
|
|
|
+ val jobTicketRepository: JobTicketRepository,
|
|
|
+ val workstationRepository: WorkstationRepository
|
|
|
) : BaseLogic(), IHardwareLogic {
|
|
|
private val updateLock = Any()
|
|
|
|
|
|
@@ -73,7 +75,7 @@ class HardwareLogic @Inject constructor(
|
|
|
* 获取锁信息
|
|
|
*/
|
|
|
override fun getLockInfo(rfid: String): LockInfoRes? {
|
|
|
- val isLock = hardwareDao.getLockInfoByRfid(rfid)
|
|
|
+ val isLock = hardwareRepository.getLockInfoByRfid(rfid)
|
|
|
var lockInfoRes = BeanUtils.copyProperties(isLock, LockInfoRes::class.java)
|
|
|
logger.info("lockInfo:${isLock},${lockInfoRes}")
|
|
|
return lockInfoRes
|
|
|
@@ -93,7 +95,7 @@ class HardwareLogic @Inject constructor(
|
|
|
* 获取钥匙信息
|
|
|
*/
|
|
|
override fun getKeyInfo(rfid: String): KeyInfoRes? {
|
|
|
- val isKey = hardwareDao.getKeyInfoByRfid(rfid)
|
|
|
+ val isKey = hardwareRepository.getKeyInfoByRfid(rfid)
|
|
|
var keyInfoRes = BeanUtils.copyProperties(isKey, KeyInfoRes::class.java)
|
|
|
logger.info("keyInfo:${isKey},${keyInfoRes}")
|
|
|
return keyInfoRes
|
|
|
@@ -113,9 +115,9 @@ class HardwareLogic @Inject constructor(
|
|
|
lockPointUpdateData.forEach { info ->
|
|
|
val keyInfo = getKeyInfo(info.keyNfc ?: "")
|
|
|
val lockInfo = getLockInfo(info.lockNfc ?: "")
|
|
|
- val pointInfo = isolationPointDao.getPointByPointNfc(info.pointNfc)
|
|
|
+ val pointInfo = isolationPointRepository.getPointByPointNfc(info.pointNfc)
|
|
|
if (info.target == 0) {
|
|
|
- hardwareDao.updatePointLockData(
|
|
|
+ hardwareRepository.updatePointLockData(
|
|
|
info.ticketId ?: 0,
|
|
|
keyInfo?.keyId ?: 0,
|
|
|
lockInfo?.lockId ?: 0,
|
|
|
@@ -123,7 +125,7 @@ class HardwareLogic @Inject constructor(
|
|
|
(info.target ?: -1) + 1
|
|
|
)
|
|
|
} else {
|
|
|
- hardwareDao.updatePointUnLockData(
|
|
|
+ hardwareRepository.updatePointUnLockData(
|
|
|
info.ticketId ?: 0,
|
|
|
keyInfo?.keyId ?: 0,
|
|
|
lockInfo?.lockId ?: 0,
|
|
|
@@ -141,12 +143,14 @@ class HardwareLogic @Inject constructor(
|
|
|
synchronized(updateLock) {
|
|
|
lockTakeList.forEach { lockTakeInfo ->
|
|
|
lockTakeInfo.ticketId?.let { ticketId ->
|
|
|
- val isJobTicketPoints = jobTicketDao.getJobTicketPointsDataByTicketId(ticketId)
|
|
|
- val isJobTicketLock = jobTicketDao.getJobTicketLockDataByTicketId(ticketId)
|
|
|
- .filter {
|
|
|
- it.lockId !in isJobTicketPoints.filter { it.groupId == MainDomainData.deviceTakeTicketGroupBound[ticketId] }
|
|
|
- .mapNotNull { it.lockId }
|
|
|
- }
|
|
|
+ val isJobTicketPoints =
|
|
|
+ jobTicketRepository.getJobTicketPointsDataByTicketId(ticketId)
|
|
|
+ val isJobTicketLock =
|
|
|
+ jobTicketRepository.getJobTicketLockDataByTicketId(ticketId)
|
|
|
+ .filter {
|
|
|
+ it.lockId !in isJobTicketPoints.filter { it.groupId == MainDomainData.deviceTakeTicketGroupBound[ticketId] }
|
|
|
+ .mapNotNull { it.lockId }
|
|
|
+ }
|
|
|
logger.info("作业票挂锁信息:${isJobTicketLock.toJson()}-${MainDomainData.deviceTakeTicketGroupBound[ticketId]}")
|
|
|
val emptyTicketLockInfo =
|
|
|
isJobTicketLock.firstOrNull { it.groupId == MainDomainData.deviceTakeTicketGroupBound[ticketId] }
|
|
|
@@ -163,7 +167,7 @@ class HardwareLogic @Inject constructor(
|
|
|
IsJobTicketLock::class.java
|
|
|
)
|
|
|
isJobTicketLock?.let {
|
|
|
- jobTicketDao.updateJobTicketLockData(it)
|
|
|
+ jobTicketRepository.updateJobTicketLockData(it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -174,12 +178,12 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getPointIdByPointNfc(pointRfid: String?): Long {
|
|
|
- return hardwareDao.getPointIdByPointNfc(pointRfid)
|
|
|
+ return hardwareRepository.getPointIdByPointNfc(pointRfid)
|
|
|
}
|
|
|
|
|
|
override fun getIsLockCabinetSlotsPage(callback: (CabinetSlotsRes?) -> Unit) {
|
|
|
val allLockCabinetSlots =
|
|
|
- hardwareDao.getAllLockCabinetSlots()
|
|
|
+ hardwareRepository.getAllLockCabinetSlots()
|
|
|
.mapNotNull { BeanUtils.copyProperties(it, CabinetSlotsRecord::class.java) }
|
|
|
callback(
|
|
|
CabinetSlotsRes(
|
|
|
@@ -192,7 +196,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getIsLockPage(callback: (LockPageRes?) -> Unit) {
|
|
|
- val allLockData = hardwareDao.getAllLockData().mapNotNull {
|
|
|
+ val allLockData = hardwareRepository.getAllLockData().mapNotNull {
|
|
|
BeanUtils.copyProperties(
|
|
|
it,
|
|
|
LockPageItem::class.java
|
|
|
@@ -202,7 +206,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getIsKeyPage(callback: (KeyPageRes?) -> Unit) {
|
|
|
- val allKeyData = hardwareDao.getAllKeyData().mapNotNull {
|
|
|
+ val allKeyData = hardwareRepository.getAllKeyData().mapNotNull {
|
|
|
BeanUtils.copyProperties(
|
|
|
it,
|
|
|
KeyPageItem::class.java
|
|
|
@@ -212,22 +216,50 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getMapPointDataByPointIds(pointIds: List<Long>): List<IsMapPoint> {
|
|
|
- return hardwareDao.getMapPointDataByPointIds(pointIds)
|
|
|
+ return hardwareRepository.getMapPointDataByPointIds(pointIds)
|
|
|
}
|
|
|
|
|
|
override fun updateMapPoint(pointToMapVo: PointToMapVo) {
|
|
|
- val isMapPoint = hardwareDao.getMapPointDataByEntityId(pointToMapVo.pointId)
|
|
|
+ val isMapPoint = hardwareRepository.getMapPointDataByEntityId(pointToMapVo.pointId)
|
|
|
isMapPoint.x = (pointToMapVo.x?.toInt()?.div(50)).toString()
|
|
|
isMapPoint.y = (pointToMapVo.y?.toInt()?.div(50)).toString()
|
|
|
isMapPoint.showInMap = pointToMapVo.showInMap
|
|
|
- hardwareDao.updateMapPoint(isMapPoint)
|
|
|
- val pointData = hardwareDao.getPointDataByPointId(pointToMapVo.pointId)
|
|
|
+ hardwareRepository.updateMapPoint(isMapPoint)
|
|
|
+ val pointData = hardwareRepository.getPointDataByPointId(pointToMapVo.pointId)
|
|
|
pointData.pointSerialNumber = pointToMapVo.pointSerialNumber
|
|
|
- hardwareDao.updatePointData(pointData)
|
|
|
+ hardwareRepository.updatePointData(pointData)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getAllUserWorkstations(): List<IsUserWorkstation> {
|
|
|
+ return hardwareRepository.getAllUserWorkstations()
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getAllJobCard(): List<IsJobCard> {
|
|
|
+ return hardwareRepository.getAllJobCard()
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getAllWorkstation(): List<IsWorkstation> {
|
|
|
+ return workstationRepository.getAllWorkstation()
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getUserIdByCardNfc(cardnfc: String): Long? {
|
|
|
+ return hardwareRepository.getUserIdByCardNfc(cardnfc)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getIsJobCardByUserId(userId: Long): MutableList<IsJobCard> {
|
|
|
+ return hardwareRepository.getIsJobCardByUserId(userId)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getLockInfoById(lockId: Long): IsLock? {
|
|
|
+ return hardwareRepository.getLockInfoById(lockId)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getKeyInfoById(keyId: Long): IsKey? {
|
|
|
+ return hardwareRepository.getKeyInfoById(keyId)
|
|
|
}
|
|
|
|
|
|
override fun saveLocksInfo(lockRfid: List<String>) {
|
|
|
- val defaultLockCodeSize = hardwareDao.getLastLockId()
|
|
|
+ val defaultLockCodeSize = hardwareRepository.getLastLockId()
|
|
|
val isLocks = lockRfid.mapIndexed { index, lockNfc ->
|
|
|
val isLock = IsLock()
|
|
|
isLock.lockCode = "LOCK_${defaultLockCodeSize + index + 1}"
|
|
|
@@ -240,20 +272,20 @@ class HardwareLogic @Inject constructor(
|
|
|
}?.dictValue
|
|
|
isLock
|
|
|
}
|
|
|
- hardwareDao.addLocksInfo(isLocks)
|
|
|
+ hardwareRepository.addLocksInfo(isLocks)
|
|
|
HardwareMode.getCurrentHardwareMode().removeNewHardwareLock(lockRfid)
|
|
|
}
|
|
|
|
|
|
override fun changeShowInMap(pointId: Long, showInMap: Boolean) {
|
|
|
- hardwareDao.changeShowInMap(pointId, showInMap)
|
|
|
+ hardwareRepository.changeShowInMap(pointId, showInMap)
|
|
|
}
|
|
|
|
|
|
override fun removeCardBindByUserIds(userIds: List<Long>) {
|
|
|
- hardwareDao.removeCardBindByUserIds(userIds)
|
|
|
+ hardwareRepository.removeCardBindByUserIds(userIds)
|
|
|
}
|
|
|
|
|
|
override fun removePointFromMap(pointId: Long) {
|
|
|
- hardwareDao.deletePointFromMap(pointId)
|
|
|
+ hardwareRepository.deletePointFromMap(pointId)
|
|
|
}
|
|
|
|
|
|
override fun addPointToMap(pointToMapVo: PointToMapVo) {
|
|
|
@@ -262,22 +294,22 @@ class HardwareLogic @Inject constructor(
|
|
|
isMapPoint.x = (pointToMapVo.x?.toInt()?.div(50)).toString()
|
|
|
isMapPoint.y = (pointToMapVo.y?.toInt()?.div(50)).toString()
|
|
|
isMapPoint.showInMap = pointToMapVo.showInMap
|
|
|
- hardwareDao.insertMapPoint(isMapPoint)
|
|
|
- val pointData = hardwareDao.getPointDataByPointId(pointToMapVo.pointId)
|
|
|
+ hardwareRepository.insertMapPoint(isMapPoint)
|
|
|
+ val pointData = hardwareRepository.getPointDataByPointId(pointToMapVo.pointId)
|
|
|
pointData.pointSerialNumber = pointToMapVo.pointSerialNumber
|
|
|
- hardwareDao.updatePointData(pointData)
|
|
|
+ hardwareRepository.updatePointData(pointData)
|
|
|
}
|
|
|
|
|
|
override fun getRfidDataByRfidId(rfidId: List<Long>): List<IsRfidToken> {
|
|
|
- return hardwareDao.getRfidDataByRfidIds(rfidId)
|
|
|
+ return hardwareRepository.getRfidDataByRfidIds(rfidId)
|
|
|
}
|
|
|
|
|
|
override fun getPointDataByWorkstationId(workstationId: Long): List<IsIsolationPoint> {
|
|
|
- return hardwareDao.getPointDataByWorkstationId(workstationId)
|
|
|
+ return hardwareRepository.getPointDataByWorkstationId(workstationId)
|
|
|
}
|
|
|
|
|
|
override fun getRfidIdByPointIds(inUsePointIds: List<Long>): List<Long> {
|
|
|
- return isolationPointDao.getRfidIdByPointIds(inUsePointIds)
|
|
|
+ return isolationPointRepository.getRfidIdByPointIds(inUsePointIds)
|
|
|
}
|
|
|
|
|
|
override fun getDictData(
|
|
|
@@ -300,19 +332,19 @@ class HardwareLogic @Inject constructor(
|
|
|
}?.dictValue
|
|
|
isJobCard
|
|
|
}
|
|
|
- hardwareDao.addCard(isJobCard)
|
|
|
+ hardwareRepository.addCard(isJobCard)
|
|
|
}
|
|
|
|
|
|
override fun deleteCardByUserIdAndCardCode(userId: Long, cardCode: String) {
|
|
|
- hardwareDao.deleteCardByUserIdAndCardCode(userId, cardCode)
|
|
|
+ hardwareRepository.deleteCardByUserIdAndCardCode(userId, cardCode)
|
|
|
}
|
|
|
|
|
|
override fun getPointNfcDataByPointIds(pointIds: List<Long?>): List<PointData> {
|
|
|
- return hardwareDao.getPointNfcDataByPointIds(pointIds)
|
|
|
+ return hardwareRepository.getPointNfcDataByPointIds(pointIds)
|
|
|
}
|
|
|
|
|
|
override fun getJobTicketPointLockNfcDataListByPointId(pointId: Long): List<LockData> {
|
|
|
- return hardwareDao.getJobTicketPointLockNfcDataListByPointId(pointId)
|
|
|
+ return hardwareRepository.getJobTicketPointLockNfcDataListByPointId(pointId)
|
|
|
}
|
|
|
|
|
|
override fun addRfidTokenHardware(pointRfid: List<String>) {
|
|
|
@@ -328,12 +360,12 @@ class HardwareLogic @Inject constructor(
|
|
|
}?.dictValue
|
|
|
isRfidToken
|
|
|
}
|
|
|
- hardwareDao.addRfidToken(isRfidToken)
|
|
|
+ hardwareRepository.addRfidToken(isRfidToken)
|
|
|
}
|
|
|
|
|
|
override fun saveKeyInfo(keyNfc: String, keyMacAddress: String) {
|
|
|
val isKey = IsKey()
|
|
|
- val defaultKeyCodeSize = hardwareDao.getLastKeyId()
|
|
|
+ val defaultKeyCodeSize = hardwareRepository.getLastKeyId()
|
|
|
isKey.keyCode = "KEY_${defaultKeyCodeSize + 1}"
|
|
|
isKey.keyNfc = keyNfc
|
|
|
isKey.macAddress = keyMacAddress
|
|
|
@@ -343,12 +375,12 @@ class HardwareLogic @Inject constructor(
|
|
|
"normal"
|
|
|
)
|
|
|
}?.dictValue
|
|
|
- hardwareDao.addKeyInfo(isKey)
|
|
|
+ hardwareRepository.addKeyInfo(isKey)
|
|
|
}
|
|
|
|
|
|
override fun saveLockInfo(lockNfc: String) {
|
|
|
val isLock = IsLock()
|
|
|
- val defaultLockCodeSize = hardwareDao.getLastLockId()
|
|
|
+ val defaultLockCodeSize = hardwareRepository.getLastLockId()
|
|
|
isLock.lockCode = "LOCK_${defaultLockCodeSize + 1}"
|
|
|
isLock.lockNfc = lockNfc
|
|
|
isLock.exStatus =
|
|
|
@@ -357,66 +389,66 @@ class HardwareLogic @Inject constructor(
|
|
|
"normal"
|
|
|
)
|
|
|
}?.dictValue
|
|
|
- hardwareDao.addLockInfo(isLock)
|
|
|
+ hardwareRepository.addLockInfo(isLock)
|
|
|
}
|
|
|
|
|
|
override fun clearKeyAndLock() {
|
|
|
- hardwareDao.clearIsKey()
|
|
|
- hardwareDao.clearIsLock()
|
|
|
+ hardwareRepository.clearIsKey()
|
|
|
+ hardwareRepository.clearIsLock()
|
|
|
}
|
|
|
|
|
|
override fun deleteKeyByKeyIds(keyIds: List<Long>) {
|
|
|
- hardwareDao.deleteKeyByKeyIds(keyIds)
|
|
|
+ hardwareRepository.deleteKeyByKeyIds(keyIds)
|
|
|
}
|
|
|
|
|
|
override fun deleteLockByLockIds(lockIds: List<Long>) {
|
|
|
- hardwareDao.deleteLockByLockIds(lockIds)
|
|
|
+ hardwareRepository.deleteLockByLockIds(lockIds)
|
|
|
}
|
|
|
|
|
|
override fun deleteCardByCardIds(cardIds: List<Long>) {
|
|
|
- hardwareDao.deleteCardByCardIds(cardIds)
|
|
|
+ hardwareRepository.deleteCardByCardIds(cardIds)
|
|
|
}
|
|
|
|
|
|
override fun deleteRfidTokenByRfidTokenIds(rfidTokenIds: List<Long>) {
|
|
|
- hardwareDao.deleteRfidTokenByRfidTokenIds(rfidTokenIds)
|
|
|
+ hardwareRepository.deleteRfidTokenByRfidTokenIds(rfidTokenIds)
|
|
|
}
|
|
|
|
|
|
override fun addKeyInfo(isKey: IsKey) {
|
|
|
- hardwareDao.addKeyInfo(isKey)
|
|
|
+ hardwareRepository.addKeyInfo(isKey)
|
|
|
}
|
|
|
|
|
|
override fun addLockInfo(isLock: IsLock) {
|
|
|
- hardwareDao.addLockInfo(isLock)
|
|
|
+ hardwareRepository.addLockInfo(isLock)
|
|
|
}
|
|
|
|
|
|
override fun addCardInfo(isJobCard: IsJobCard) {
|
|
|
- hardwareDao.addCard(isJobCard)
|
|
|
+ hardwareRepository.addCard(isJobCard)
|
|
|
}
|
|
|
|
|
|
override fun addRfidTokenInfo(isRfidToken: IsRfidToken): Long {
|
|
|
- return hardwareDao.addRfidToken(isRfidToken)
|
|
|
+ return hardwareRepository.addRfidToken(isRfidToken)
|
|
|
}
|
|
|
|
|
|
override fun getAllRfidData(): List<IsRfidToken> {
|
|
|
- return hardwareDao.getAllRfidTokenData()
|
|
|
+ return hardwareRepository.getAllRfidTokenData()
|
|
|
}
|
|
|
|
|
|
override fun updateKeyInfo(isKey: IsKey) {
|
|
|
- hardwareDao.updateKeyInfo(isKey)
|
|
|
+ hardwareRepository.updateKeyInfo(isKey)
|
|
|
}
|
|
|
|
|
|
override fun updateLockInfo(isLock: IsLock) {
|
|
|
- hardwareDao.updateLockInfo(isLock)
|
|
|
+ hardwareRepository.updateLockInfo(isLock)
|
|
|
}
|
|
|
|
|
|
override fun updateCardInfo(isJobCard: IsJobCard) {
|
|
|
- val localCardData = hardwareDao.getCardDataByRfid(isJobCard.cardNfc)
|
|
|
+ val localCardData = hardwareRepository.getCardDataByRfid(isJobCard.cardNfc)
|
|
|
isJobCard.cardCode = localCardData?.cardCode ?: ""
|
|
|
- hardwareDao.updateCardInfo(isJobCard)
|
|
|
+ hardwareRepository.updateCardInfo(isJobCard)
|
|
|
}
|
|
|
|
|
|
override fun updateRfidTokenInfo(isRfidToken: IsRfidToken) {
|
|
|
- hardwareDao.updateRfidToken(isRfidToken)
|
|
|
+ hardwareRepository.updateRfidToken(isRfidToken)
|
|
|
}
|
|
|
|
|
|
override fun getKeyInfoPage(
|
|
|
@@ -424,7 +456,7 @@ class HardwareLogic @Inject constructor(
|
|
|
size: Int,
|
|
|
offset: Int
|
|
|
): List<IsKey> {
|
|
|
- return hardwareDao.getKeyInfoPage(
|
|
|
+ return hardwareRepository.getKeyInfoPage(
|
|
|
filterVo?.keyCode,
|
|
|
filterVo?.keyNfc,
|
|
|
filterVo?.macAddress,
|
|
|
@@ -435,7 +467,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getAllKeyInfo(): List<IsKey> {
|
|
|
- return hardwareDao.getAllKeyData()
|
|
|
+ return hardwareRepository.getAllKeyData()
|
|
|
}
|
|
|
|
|
|
override fun getLockInfoPage(
|
|
|
@@ -443,7 +475,7 @@ class HardwareLogic @Inject constructor(
|
|
|
size: Int,
|
|
|
offset: Int
|
|
|
): List<IsLock> {
|
|
|
- return hardwareDao.getLockInfoPage(
|
|
|
+ return hardwareRepository.getLockInfoPage(
|
|
|
filterVo?.lockCode,
|
|
|
filterVo?.lockNfc,
|
|
|
filterVo?.status?.let { if (it) 0 else 2 } ?: null,
|
|
|
@@ -457,7 +489,7 @@ class HardwareLogic @Inject constructor(
|
|
|
size: Int,
|
|
|
offset: Int
|
|
|
): List<IsJobCard> {
|
|
|
- return hardwareDao.getCardInfoPage(
|
|
|
+ return hardwareRepository.getCardInfoPage(
|
|
|
filterVo?.cardNfc,
|
|
|
filterVo?.username,
|
|
|
filterVo?.status?.let { if (it) 0 else 2 } ?: null,
|
|
|
@@ -471,7 +503,7 @@ class HardwareLogic @Inject constructor(
|
|
|
size: Int,
|
|
|
offset: Int
|
|
|
): List<IsRfidToken> {
|
|
|
- return hardwareDao.getRfidTokenInfoPage(
|
|
|
+ return hardwareRepository.getRfidTokenInfoPage(
|
|
|
filterVo?.rfidCode,
|
|
|
filterVo?.rfid,
|
|
|
filterVo?.status?.let { if (it) 0 else 2 } ?: null,
|
|
|
@@ -481,69 +513,69 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun deleteKeyTable() {
|
|
|
- hardwareDao.deleteKeyTable()
|
|
|
+ hardwareRepository.deleteKeyTable()
|
|
|
}
|
|
|
|
|
|
override fun removeCardData() {
|
|
|
- hardwareDao.removeCardData()
|
|
|
+ hardwareRepository.removeCardData()
|
|
|
}
|
|
|
|
|
|
override fun removeRfidTokenData() {
|
|
|
- hardwareDao.removeRfidTokenData()
|
|
|
+ hardwareRepository.removeRfidTokenData()
|
|
|
}
|
|
|
|
|
|
override fun getLastCardId(): Int {
|
|
|
- return hardwareDao.getLastCardId()
|
|
|
+ return hardwareRepository.getLastCardId()
|
|
|
}
|
|
|
|
|
|
override fun getLastRFIDId(): Int {
|
|
|
- return hardwareDao.getLastRFIDId()
|
|
|
+ return hardwareRepository.getLastRFIDId()
|
|
|
}
|
|
|
|
|
|
override fun getLastKeyId(): Int {
|
|
|
- return hardwareDao.getLastKeyId()
|
|
|
+ return hardwareRepository.getLastKeyId()
|
|
|
}
|
|
|
|
|
|
override fun getLastLockId(): Int {
|
|
|
- return hardwareDao.getLastLockId()
|
|
|
+ return hardwareRepository.getLastLockId()
|
|
|
}
|
|
|
|
|
|
override fun getJobCardDataByUserId(userId: Long?): List<IsJobCard> {
|
|
|
if (userId == null) {
|
|
|
return mutableListOf()
|
|
|
}
|
|
|
- return hardwareDao.getIsJobCardByUserId(userId)
|
|
|
+ return hardwareRepository.getIsJobCardByUserId(userId)
|
|
|
}
|
|
|
|
|
|
override fun updateUserJobCard(rfidNo: String, userId: Long) {
|
|
|
- val userJobCardData = hardwareDao.getIsJobCardByUserId(userId)
|
|
|
+ val userJobCardData = hardwareRepository.getIsJobCardByUserId(userId)
|
|
|
if (userJobCardData.any { it.cardNfc == rfidNo }) {
|
|
|
userJobCardData.filter { it.cardNfc != rfidNo }.forEach {
|
|
|
it.userId = null
|
|
|
it.userName = null
|
|
|
- hardwareDao.updateCardInfo(it)
|
|
|
+ hardwareRepository.updateCardInfo(it)
|
|
|
}
|
|
|
logger.info("检测到用户工卡,清除其他工卡")
|
|
|
return
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
logger.info("检测到用户工卡,清除工卡")
|
|
|
userJobCardData.forEach {
|
|
|
it.userId = null
|
|
|
it.userName = null
|
|
|
- hardwareDao.updateCardInfo(it)
|
|
|
+ hardwareRepository.updateCardInfo(it)
|
|
|
}
|
|
|
}
|
|
|
- var jobCardData = hardwareDao.getCardDataByRfid(rfidNo)
|
|
|
- val sysUserDo = userDao.getUserInfoByUserId(userId)
|
|
|
+ var jobCardData = hardwareRepository.getCardDataByRfid(rfidNo)
|
|
|
+ val sysUserDo = userRepository.getUserInfoByUserId(userId)
|
|
|
if (jobCardData != null) {
|
|
|
logger.info("工卡存在,设置值")
|
|
|
jobCardData.userId = userId
|
|
|
jobCardData.userName = sysUserDo?.userName
|
|
|
- hardwareDao.updateCardInfo(jobCardData)
|
|
|
+ hardwareRepository.updateCardInfo(jobCardData)
|
|
|
} else {
|
|
|
logger.info("没有检测到工卡,重新创建工卡")
|
|
|
jobCardData = IsJobCard()
|
|
|
- val defaultCardCodeSize = hardwareDao.getLastCardId()
|
|
|
+ val defaultCardCodeSize = hardwareRepository.getLastCardId()
|
|
|
jobCardData.cardCode = "CARD_${defaultCardCodeSize + 1}"
|
|
|
jobCardData.userId = userId
|
|
|
jobCardData.cardNfc = rfidNo
|
|
|
@@ -554,12 +586,12 @@ class HardwareLogic @Inject constructor(
|
|
|
"normal"
|
|
|
)
|
|
|
}?.dictValue
|
|
|
- hardwareDao.addCard(jobCardData)
|
|
|
+ hardwareRepository.addCard(jobCardData)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun getExceptionKey(): List<IsKey> {
|
|
|
- return hardwareDao.getAllKeyData()
|
|
|
+ return hardwareRepository.getAllKeyData()
|
|
|
.filter {
|
|
|
it.exStatus == CommonDictDataEnum.KEY_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -570,7 +602,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getExceptionLock(): List<IsLock> {
|
|
|
- return hardwareDao.getAllLockData()
|
|
|
+ return hardwareRepository.getAllLockData()
|
|
|
.filter {
|
|
|
it.exStatus == CommonDictDataEnum.PADLOCK_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -581,7 +613,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getExceptionSlots(): List<IsLockCabinetSlots> {
|
|
|
- return hardwareDao.getAllLockCabinetSlots()
|
|
|
+ return hardwareRepository.getAllLockCabinetSlots()
|
|
|
.filter {
|
|
|
it.status == CommonDictDataEnum.SLOT_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -592,7 +624,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun removeSlotsException(row: Int, col: Int) {
|
|
|
- hardwareDao.removeSlotsException(
|
|
|
+ hardwareRepository.removeSlotsException(
|
|
|
row,
|
|
|
col,
|
|
|
CommonDictDataEnum.SLOT_STATUS.commonDictRes.find {
|
|
|
@@ -604,24 +636,24 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun createCabinetData() {
|
|
|
- hardwareDao.clearCabinetData()
|
|
|
+ hardwareRepository.clearCabinetData()
|
|
|
val isLockCabinet = IsLockCabinet()
|
|
|
isLockCabinet.cabinetCode = "CABINET_001"
|
|
|
isLockCabinet.cabinetName = "锁柜1"
|
|
|
- val lockCabinetId = hardwareDao.createCabinetData(isLockCabinet)
|
|
|
+ val lockCabinetId = hardwareRepository.createCabinetData(isLockCabinet)
|
|
|
MMKVConstants.KEY_LOCK_CABINET_ID.saveMMKVData(lockCabinetId)
|
|
|
}
|
|
|
|
|
|
override fun saveCabinetSlots(isLockCabinetSlots: List<IsLockCabinetSlots>) {
|
|
|
- hardwareDao.saveCabinetSlots(isLockCabinetSlots)
|
|
|
+ hardwareRepository.saveCabinetSlots(isLockCabinetSlots)
|
|
|
}
|
|
|
|
|
|
override fun clearCabinetSlots() {
|
|
|
- hardwareDao.clearCabinetSlots()
|
|
|
+ hardwareRepository.clearCabinetSlots()
|
|
|
}
|
|
|
|
|
|
override fun tagSlotsException(row: Int, col: Int, remark: String) {
|
|
|
- hardwareDao.tagSlotsException(
|
|
|
+ hardwareRepository.tagSlotsException(
|
|
|
row,
|
|
|
col,
|
|
|
CommonDictDataEnum.SLOT_STATUS.commonDictRes.find {
|
|
|
@@ -634,7 +666,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun tagKeyException(rfid: String?, remark: String) {
|
|
|
- hardwareDao.tagKeyException(
|
|
|
+ hardwareRepository.tagKeyException(
|
|
|
rfid, remark,
|
|
|
CommonDictDataEnum.KEY_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -645,7 +677,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun tagLockException(rfid: String?, remark: String) {
|
|
|
- hardwareDao.tagLockException(
|
|
|
+ hardwareRepository.tagLockException(
|
|
|
rfid, remark,
|
|
|
CommonDictDataEnum.KEY_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -656,7 +688,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun removeKeyException(rfid: String?) {
|
|
|
- hardwareDao.removeKeyException(
|
|
|
+ hardwareRepository.removeKeyException(
|
|
|
rfid,
|
|
|
CommonDictDataEnum.KEY_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -667,7 +699,7 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun removeLockException(rfid: String?) {
|
|
|
- hardwareDao.removeLockException(
|
|
|
+ hardwareRepository.removeLockException(
|
|
|
rfid,
|
|
|
CommonDictDataEnum.PADLOCK_STATUS.commonDictRes.find {
|
|
|
I18nManager.t(it.dictLabel) == I18nManager.t(
|
|
|
@@ -678,27 +710,27 @@ class HardwareLogic @Inject constructor(
|
|
|
}
|
|
|
|
|
|
override fun getKeyInfoByKeyId(keyId: Long): IsKey? {
|
|
|
- return hardwareDao.getKeyInfoById(keyId)
|
|
|
+ return hardwareRepository.getKeyInfoById(keyId)
|
|
|
}
|
|
|
|
|
|
override fun getLockInfoByLockId(lockId: Long): IsLock? {
|
|
|
- return hardwareDao.getLockInfoById(lockId)
|
|
|
+ return hardwareRepository.getLockInfoById(lockId)
|
|
|
}
|
|
|
|
|
|
override fun getIsLockCabinetSlotBySlotId(slotId: Long): IsLockCabinetSlots? {
|
|
|
- return hardwareDao.getIsLockCabinetSlotBySlotId(slotId)
|
|
|
+ return hardwareRepository.getIsLockCabinetSlotBySlotId(slotId)
|
|
|
}
|
|
|
|
|
|
override fun getAllSlotsData(): List<IsLockCabinetSlots> {
|
|
|
- return hardwareDao.getAllLockCabinetSlots()
|
|
|
+ return hardwareRepository.getAllLockCabinetSlots()
|
|
|
}
|
|
|
|
|
|
override fun getAllLockInfo(): List<IsLock> {
|
|
|
- return hardwareDao.getAllLockData()
|
|
|
+ return hardwareRepository.getAllLockData()
|
|
|
}
|
|
|
|
|
|
override fun updateSlotsInfo(slots: IsLockCabinetSlots) {
|
|
|
- return hardwareDao.updateSlotsInfo(slots)
|
|
|
+ return hardwareRepository.updateSlotsInfo(slots)
|
|
|
}
|
|
|
|
|
|
override fun getAllHardwareCount(): Int {
|
|
|
@@ -720,35 +752,21 @@ class HardwareLogic @Inject constructor(
|
|
|
"normal"
|
|
|
)
|
|
|
}?.dictValue
|
|
|
- val keyData = hardwareDao.getAllKeyData()
|
|
|
- val lockData = hardwareDao.getAllLockData()
|
|
|
- val rfidTokenData = hardwareDao.getAllRfidTokenData()
|
|
|
+ val keyData = hardwareRepository.getAllKeyData()
|
|
|
+ val lockData = hardwareRepository.getAllLockData()
|
|
|
+ val rfidTokenData = hardwareRepository.getAllRfidTokenData()
|
|
|
return keyData.count { it.exStatus == keyStatus } + lockData.count { it.exStatus == lockStatus } + rfidTokenData.count { it.status == rfidTokenStatus }
|
|
|
}
|
|
|
|
|
|
override fun getCardByCardRfid(cardRfid: String): IsJobCard? {
|
|
|
- return hardwareDao.getCardDataByRfid(cardRfid)
|
|
|
+ return hardwareRepository.getCardDataByRfid(cardRfid)
|
|
|
}
|
|
|
|
|
|
override fun getRfidDataByRfid(rfid: String): IsRfidToken? {
|
|
|
- return hardwareDao.getRfidDataByRfid(rfid)
|
|
|
+ return hardwareRepository.getRfidDataByRfid(rfid)
|
|
|
}
|
|
|
|
|
|
override fun getAllPointCount(overviewWorkstationId: Long?): Int {
|
|
|
- return hardwareDao.getAllPointCount(overviewWorkstationId)
|
|
|
- }
|
|
|
-
|
|
|
- override fun getAllDataExportPointData(): List<DataExportPointVo> {
|
|
|
- val allPointData = hardwareDao.getAllPointData()
|
|
|
- val allDataExportPointVo = BeanUtils.copyList(allPointData, DataExportPointVo::class.java)
|
|
|
- val allPointRfid = hardwareDao.getAllRfidTokenData()
|
|
|
- val allWorkstation = workstationLogic.getWorkstationManageData()
|
|
|
- allDataExportPointVo.forEach { point ->
|
|
|
- point.pointFunction = point.remark.toString()
|
|
|
- point.workstationName =
|
|
|
- allWorkstation.find { it.workstationId == point.workstationId }?.workstationName.toString()
|
|
|
- point.pointNfc = allPointRfid.find { it.rfidId == point.rfidId }?.rfid ?: ""
|
|
|
- }
|
|
|
- return allDataExportPointVo
|
|
|
+ return hardwareRepository.getAllPointCount(overviewWorkstationId)
|
|
|
}
|
|
|
}
|