sunpengfei
3 天以前 b288e7effa0edc09baad6089433a38b2b29b29db
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
using Furion.DatabaseAccessor;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FlexJobApi.Core
{
    /// <summary>
    /// 企业
    /// </summary>
    public class Enterprise : CommonEntity<MasterDbContextLocator, SyncTargetDbContextLocator>, IEntityTypeBuilder<Enterprise>
    {
        public Enterprise()
        {
            Users = [];
            Departments = [];
            ContractTemplates = [];
            ElectronSignSettings = [];
        }
 
        /// <summary>
        /// 企业认证
        /// </summary>
        public EnterpriseAuth EnterpriseAuth { get; set; }
 
        /// <summary>
        /// 园区Id
        /// </summary>
        public Guid? IndustrialParkId { get; set; }
 
        /// <summary>
        /// 企业全称
        /// </summary>
        [Required]
        [MaxLength(128)]
        public string EnterpriseName { get; set; }
 
        /// <summary>
        /// 统一社会信用代码
        /// </summary>
        [Required]
        [MaxLength(18)]
        public string SocietyCreditCode { get; set; }
 
        /// <summary>
        /// 营业执照照片
        /// </summary>
        public string LicenseImage { get; set; }
 
        /// <summary>
        /// 法人姓名
        /// </summary>
        [MaxLength(32)]
        public string LegalPerson { get; set; }
 
        /// <summary>
        /// 法人身份证号
        /// </summary>
        [MaxLength(18)]
        public string LegalIdentity { get; set; }
 
        /// <summary>
        /// 所在省份编号
        /// </summary>
        public string ProvinceCode { get; set; }
 
        /// <summary>
        /// 所在省份
        /// </summary>
        public DictionaryData Province { get; set; }
 
        /// <summary>
        /// 所在城市编号
        /// </summary>
        public string CityCode { get; set; }
 
        /// <summary>
        /// 所在城市
        /// </summary>
        public DictionaryData City { get; set; }
 
        /// <summary>
        /// 所属行业编号
        /// </summary>
        public string IndustryTypeCode { get; set; }
 
        /// <summary>
        /// 所属行业
        /// </summary>
        public DictionaryData IndustryType { get; set; }
 
        /// <summary>
        /// 企业类型
        /// </summary>
        public string EnterpriseType { get; set; }
 
        /// <summary>
        /// 注册资本
        /// </summary>
        public string RegisteredCapital { get; set; }
 
        /// <summary>
        /// 成立日期
        /// </summary>
        public string EstablishmentDate { get; set; }
 
        /// <summary>
        /// 企业地址
        /// </summary>
        public string Address { get; set; }
 
        /// <summary>
        /// 经营范围
        /// </summary>
        public string MainBusiness { get; set; }
 
        /// <summary>
        /// 联系人
        /// </summary>
        [MaxLength(32)]
        public string Contacts { get; set; }
 
        /// <summary>
        /// 联系电话
        /// </summary>
        [MaxLength(11)]
        public string ContactPhoneNumber { get; set; }
 
        /// <summary>
        /// 联系邮箱
        /// </summary>
        public string ContactEmail { get; set; }
 
        /// <summary>
        /// 支付通道
        /// </summary>
        public EnumPayAccess? PayAccess { get; set; }
 
        /// <summary>
        /// 开户总行
        /// </summary>
        public string BankName { get; set; }
 
        /// <summary>
        /// 开户支行
        /// </summary>
        public string BankBranchName { get; set; }
 
        /// <summary>
        /// 银行账户
        /// </summary>
        [MaxLength(32)]
        public string BankCard { get; set; }
 
        /// <summary>
        /// 是否已校验银行账户
        /// </summary>
        public bool IsCheckedBankCard { get; set; }
 
        /// <summary>
        /// 短信通道
        /// </summary>
        public EnumSmsAccess? SmsAccess { get; set; }
 
        /// <summary>
        /// 短信费用
        /// </summary>
        public decimal SmsCost { get; set; }
 
        /// <summary>
        /// 实名通道
        /// </summary>
        public EnumRealAccess? RealAccess { get; set; }
 
        /// <summary>
        /// 是否实名
        /// </summary>
        public bool IsReal { get; set; }
 
        /// <summary>
        /// 部门
        /// </summary>
        public List<Department> Departments { get; set; }
 
        /// <summary>
        /// 用户信息
        /// </summary>
        public List<User> Users { get; set; }
 
        /// <summary>
        /// 合同模板
        /// </summary>
        public List<ContractTemplate> ContractTemplates { get; set; }
 
        /// <summary>
        /// 电子签配置
        /// </summary>
        public List<EnterpriseElectronSignSetting> ElectronSignSettings { get; set; }
 
        public void Configure(EntityTypeBuilder<Enterprise> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder
                .HasOne(it => it.EnterpriseAuth)
                .WithOne(it => it.Enterprise)
                .HasForeignKey<EnterpriseAuth>(it => it.Id);
            entityBuilder
                .HasOne(it => it.Province)
                .WithMany()
                .HasForeignKey(it => it.ProvinceCode)
                .HasPrincipalKey(it => it.Code)
                .OnDelete(DeleteBehavior.Restrict);
            entityBuilder
                .HasOne(it => it.City)
                .WithMany()
                .HasForeignKey(it => it.CityCode)
                .HasPrincipalKey(it => it.Code)
                .OnDelete(DeleteBehavior.Restrict);
            entityBuilder
                .HasOne(it => it.IndustryType)
                .WithMany()
                .HasForeignKey(it => it.IndustryTypeCode)
                .HasPrincipalKey(it => it.Code)
                .OnDelete(DeleteBehavior.Restrict);
        }
    }
}