feiyu02
2025-09-30 6904763f0e74d9a9fa4dbc39f635d2aee39416c6
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package cn.flightfeather.supervision.lightshare.vo
 
import cn.flightfeather.supervision.domain.entity.BaseInfo
import cn.flightfeather.supervision.domain.entity.FumePurifyDevice
import cn.flightfeather.supervision.domain.entity.MonitorDevice
import cn.flightfeather.supervision.domain.entity.RestaurantBaseInfo
import cn.flightfeather.supervision.infrastructure.utils.UUIDGenerator
import org.springframework.beans.BeanUtils
import java.util.*
import kotlin.math.round
 
/**
 * 餐饮店认证信息
 */
class AuthSceneRestVo : AuthSceneVo() {
    //经营菜系
    var rbCuisine: String? = null
    //就餐位总数
    var rbTotalSeating: Int? = null
    //灶头数
    var rbCookingRangeNum: Int? = null
    //年均用油量(数据库记录为月度用油量)
    var rbCookingOilCapacity: Int? = null
    //用油类型
    var rbCookingOilType: String? = null
    //所属集中区
    var rbConcentrationArea: String? = null
    //排口数量
    var rbOutfallCount: Int? = null
    //排口位置
    var rbOutfallLocation: String? = null
    //排口编号
    var rbOutfallNum: String? = null
 
    //净化设备数量
    var fpNum: String? = null
    //监测设备数量
    var mdNum: String? = null
 
    /**
     * 生成新的餐饮信息对象
     */
    fun toNewRestInfo(userId: String) = RestaurantBaseInfo().apply {
        rbGuid = userId
        updateRestInfo(this)
    }
 
    /**
     * 更新至餐饮信息
     */
    fun updateRestInfo(restInfo: RestaurantBaseInfo) {
        restInfo.apply {
//            rbCuisine = rbCuisine
//            rbTotalSeating = rbTotalSeating
//            rbCookingRangeNum = rbCookingRangeNum
//            rbCookingOilType = rbCookingOilType
//            rbConcentrationArea = rbConcentrationArea
//            rbOutfallCount = rbOutfallCount
//            rbOutfallLocation = rbOutfallLocation
//            rbOutfallNum = rbOutfallNum
            BeanUtils.copyProperties(this@AuthSceneRestVo, this)
            val o = this@AuthSceneRestVo.rbCookingOilCapacity?.toDouble()?.div(12)
            rbCookingOilCapacity = round(o?.times(100) ?: .0).div(100).toString()
        }
    }
 
    /**
     * 生成新的餐饮油烟净化装置信息对象
     */
    fun toNewFpdInfo(baseInfo: BaseInfo) = FumePurifyDevice().apply {
        fpGuid = UUIDGenerator.generate16ShortUUID()
        fpUserId = baseInfo.biGuid
        fpUserName = baseInfo.biName
        fpUpdatingTime = Date()
        updateFpdInfo(this)
    }
 
    /**
     * 更新至餐饮油烟净化装置信息
     */
    fun updateFpdInfo(fpdInfo: FumePurifyDevice) {
        fpdInfo.apply {
            fpNum = this@AuthSceneRestVo.fpNum
        }
    }
 
    /**
     * 生成新的餐饮油烟监测设备信息对象
     */
    fun toNewMdInfo(baseInfo: BaseInfo) = MonitorDevice().apply {
        mdGuid = UUIDGenerator.generate16ShortUUID()
        mdUserId = baseInfo.biGuid
        mdUserName = baseInfo.biName
        mdUpdatingTime = Date()
        updateMdInfo(this)
    }
 
    /**
     * 更新至餐饮油烟监测设备信息
     */
    fun updateMdInfo(mdInfo: MonitorDevice) {
        mdInfo.apply {
            mdNum = this@AuthSceneRestVo.mdNum
        }
    }
}