riku
2021-09-24 4f1b7973c53b45f57e451191bfd5a3d2136a004c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package cn.flightfeather.supervision.lightshare.repository.impl
 
import cn.flightfeather.supervision.domain.entity.MeetingInfo
import cn.flightfeather.supervision.domain.entity.VMRoom
import cn.flightfeather.supervision.domain.mapper.UserinfoMapper
import cn.flightfeather.supervision.domain.mapper.VMRoomMapper
import cn.flightfeather.supervision.infrastructure.utils.UUIDGenerator
import cn.flightfeather.supervision.lightshare.repository.CompanyRepository
import cn.flightfeather.supervision.lightshare.repository.MeetingVMRoomRepository
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
 
/**
 * @author riku
 * Date: 2019/12/19
 */
@Repository
class MeetingVMRoomRepositoryImpl(
        val vmRoomMapper: VMRoomMapper,
        val userinfoMapper: UserinfoMapper,
        val companyRepository: CompanyRepository
) : MeetingVMRoomRepository {
    override fun createVMRoom(userId: String, meeting: MeetingInfo): VMRoom {
        val company = companyRepository.findCompanyByUserId(userId)
        val user = userinfoMapper.selectByPrimaryKey(userId)
        val room = VMRoom().apply {
            vmrGuid = UUIDGenerator.generate16ShortUUID()
            vmrMguid = meeting.miGuid
            vmrIsmainroom = true
            vmrRoomtitle = meeting.miTitle
            vmrCreateentguid = company.ciGuid
            vmrCreateentname=company.ciName
            vmrCreatorid = userId
            vmrCreator = user.acountname
            vmrUpdatedate= Date()
            vmrModifierid = userId
            vmrModifier = user.acountname
 
            vmrRoomcode=UUIDGenerator.generateShortUUID()
        }
 
        val result = vmRoomMapper.insert(room)
        return if (result == 1) {
            room
        } else {
            VMRoom()
        }
    }
 
    override fun getRoom(roomId: String): VMRoom {
        return vmRoomMapper.selectByPrimaryKey(roomId)
    }
 
    override fun getRoomsByMeetingId(meetingId: String): List<VMRoom> {
        return vmRoomMapper.selectByExample(Example(VMRoom::class.java).apply {
            createCriteria().andEqualTo("vmrMguid", meetingId)
        })
    }
}