config.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. package main
  2. import "time"
  3. type GlobalConf struct {
  4. Mongob MgoConf
  5. Cron CronConf
  6. Mongop MgoConf
  7. Mysql MysqlConf
  8. Log Log
  9. Mongospider MgoConf
  10. Email EmailConf
  11. Clickhouse CkConf
  12. }
  13. type MgoConf struct {
  14. Host string
  15. DB string
  16. Coll string // 查询表
  17. Username string
  18. Password string
  19. Size int
  20. Direct bool
  21. List string
  22. Detail string
  23. }
  24. // CronConf 定时任务
  25. type CronConf struct {
  26. Spec string
  27. Url string
  28. Start int
  29. End int
  30. Delete int
  31. }
  32. type CkConf struct {
  33. Host string
  34. Username string
  35. Password string
  36. DB string
  37. }
  38. type MysqlConf struct {
  39. Address string
  40. Dbname string
  41. Username string
  42. Password string
  43. Prefix string //数据表前缀
  44. Table string
  45. Stime string
  46. Etime string
  47. Test bool
  48. }
  49. type Log struct {
  50. LogPath string
  51. MaxSize int
  52. Compress bool
  53. MaxAge int
  54. MaxBackups int
  55. LogLevel string
  56. Format string
  57. }
  58. type EmailConf struct {
  59. Api string
  60. To string
  61. }
  62. // ProjectBaseInfo 项目基本信息
  63. type ProjectBaseInfo struct {
  64. ID int `json:"id" gorm:"primaryKey;autoIncrement;column:id;comment:主键自增"`
  65. ProjectName string `json:"project_name" gorm:"size:255;index;not null;column:project_name;comment:项目名称,索引"`
  66. TotalInvestment float64 `json:"total_investment" gorm:"column:total_investment;comment:总投资(万元)"`
  67. Area string `json:"area" gorm:"size:255;column:area;comment:省份"`
  68. City string `json:"city" gorm:"size:255;column:city;comment:城市"`
  69. District string `json:"district" gorm:"size:255;column:district;comment:区县"`
  70. Capital float64 `json:"capital" gorm:"column:capital;comment:不含专项债的资本金(万元)"`
  71. ApplyTotalBonds float64 `json:"apply_total_bonds" gorm:"column:apply_total_bonds;comment:申请专项债总额(万元)"`
  72. OtherDebtFinancing float64 `json:"other_debt_financing" gorm:"column:other_debt_financing;comment:其他债务融资(万元)"`
  73. SpecialDebtCapital float64 `json:"special_debt_capital" gorm:"column:special_debt_capital;comment:专项债作资本金(万元)"`
  74. ExpectedReturn float64 `json:"expected_return" gorm:"column:expected_return;comment:预期收入(万元)"`
  75. ProjectCost int `json:"project_cost" gorm:"column:project_cost;comment:成本"`
  76. ProjectDomain string `json:"project_domain" gorm:"size:255;column:project_domain;comment:项目领域"`
  77. ProjectOwner string `json:"project_owner" gorm:"size:255;column:project_owner;comment:项目业主"`
  78. StartDate string `json:"start_date" gorm:"size:255;column:start_date;comment:建设期开始"`
  79. EndDate string `json:"end_date" gorm:"size:255;column:end_date;comment:建设期结束"`
  80. OperationStartDate string `json:"operation_start_date" gorm:"size:255;column:operation_start_date;comment:运营期开始"`
  81. OperationEndDate string `json:"operation_end_date" gorm:"size:255;column:operation_end_date;comment:运营期结束"`
  82. SourceIncome string `json:"source_income" gorm:"size:500;column:source_income;comment:收入来源"`
  83. ConstructionContent string `json:"construction_content" gorm:"size:500;column:construction_content;comment:建设内容"`
  84. Remarks string `json:"remarks" gorm:"size:500;column:remarks;comment:特殊情况备注"`
  85. OtherDebtFinancingSource string `json:"other_debt_financing_source" gorm:"size:500;column:other_debt_financing_source;comment:其他债务融资来源"`
  86. CostIncomePercent string `json:"cost_income_percent" gorm:"size:50;column:cost_income_percent;comment:成本/收入(%)"`
  87. CoverageMultiple float64 `json:"coverage_multiple" gorm:"column:coverage_multiple;comment:覆盖倍数"`
  88. CompetentDepartment string `json:"competent_department" gorm:"size:255;column:competent_department;comment:主管部门"`
  89. AccountingFirm string `json:"accounting_firm" gorm:"size:255;column:accounting_firm;comment:会计所"`
  90. LawFirm string `json:"law_firm" gorm:"size:255;column:law_firm;comment:律所"`
  91. CreateDate string `json:"create_date" gorm:"size:255;column:create_date;comment:原网站创建时间"`
  92. UpdateDate string `json:"update_date" gorm:"size:255;column:update_date;comment:原网站更新时间"`
  93. }
  94. // TableName 指定数据库表名
  95. func (ProjectBaseInfo) TableName() string {
  96. if GF.Mysql.Prefix != "" {
  97. return GF.Mysql.Prefix + "_project_base_info"
  98. } else {
  99. return "project_base_info"
  100. }
  101. }
  102. // ProjectChange 项目变更记录
  103. type ProjectChange struct {
  104. ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键自增"`
  105. ProjectID int `json:"project_id" gorm:"column:project_id;comment:项目ID" `
  106. ProjectName string `json:"project_name" gorm:"column:project_name;size:255;index;not null;comment:项目名称,索引"`
  107. ChangeContent string `json:"change_content,omitempty" gorm:"column:change_content;size:1000;comment:变更内容"`
  108. UpdateReason string `json:"update_reason" gorm:"column:update_reason;size:1000;comment:变更原因"`
  109. SubmitTime string `json:"submit_time" gorm:"column:submit_time;size:1000;comment:提交时间"`
  110. Comeintime *time.Time `json:"comeintime" gorm:"column:comeintime;autoCreateTime"` // 入库时间
  111. Updatetime *time.Time `json:"updatetime" gorm:"column:updatetime;autoUpdateTime"` // 更新时间
  112. }
  113. // TableName 指定数据库表名
  114. func (ProjectChange) TableName() string {
  115. if GF.Mysql.Prefix != "" {
  116. return GF.Mysql.Prefix + "_project_change"
  117. } else {
  118. return "project_change"
  119. }
  120. }
  121. // ProjectRepayment 项目还本付息
  122. type ProjectRepayment struct {
  123. ID int `json:"id" gorm:"primaryKey;autoIncrement;column:id;comment:主键自增"`
  124. ProjectID int `json:"project_id" gorm:"column:project_id;comment:项目ID" `
  125. ProjectName string `json:"project_name" gorm:"size:255;index;not null;column:project_name;comment:项目名称"`
  126. BondName string `json:"bond_name" gorm:"size:255;column:bond_name;comment:债券名称"`
  127. IssueTerm int `json:"issue_term" gorm:"column:issue_term;comment:发行期限(年)"`
  128. PayInterestMethodName string `json:"pay_interest_method_name" gorm:"size:255;column:pay_interest_method_name;comment:付息方式"`
  129. ValueDate string `json:"value_date" gorm:"size:50;column:value_date;comment:起息日"`
  130. InterestDate string `json:"interest_date" gorm:"size:50;column:interest_date;comment:付息日"`
  131. LastInterestDate string `json:"last_interest_date" gorm:"size:50;column:last_interest_date;comment:最近付息日"`
  132. ReminderRepayDays int `json:"reminder_repay_days" gorm:"column:reminder_repay_days;comment:提醒还款(天)"`
  133. MaturityDate string `json:"maturity_date" gorm:"size:50;column:maturity_date;comment:到期日"`
  134. DebtService float64 `json:"debt_service" gorm:"column:debt_service;comment:还本付息(万元)"`
  135. RedemptionMethod string `json:"redemption_method" gorm:"size:255;column:redemption_method;comment:赎回方式"`
  136. CumulativePayInterest int `json:"cumulative_pay_interest" gorm:"column:cumulative_pay_interest;comment:累计付息(万元)"`
  137. IsEarlyRepayPrincipal string `json:"is_early_repay_principal" gorm:"size:50;column:is_early_repay_principal;comment:提前还本"`
  138. Remarks string `json:"remarks" gorm:"size:5000;column:remarks;comment:备注"`
  139. }
  140. // TableName 指定数据库表名
  141. func (ProjectRepayment) TableName() string {
  142. if GF.Mysql.Prefix != "" {
  143. return GF.Mysql.Prefix + "_project_repayment"
  144. } else {
  145. return "project_repayment"
  146. }
  147. }
  148. // ProjectIssueDetails 项目发行明细表
  149. type ProjectIssueDetails struct {
  150. ID int `json:"id" gorm:"primaryKey;autoIncrement;column:id;comment:主键自增"`
  151. ProjectID int `json:"project_id" gorm:"column:project_id;comment:项目ID" `
  152. ProjectName string `json:"project_name" gorm:"size:255;index;not null;column:project_name;comment:项目名称"`
  153. ProjectBachName string `json:"project_bach_name" gorm:"size:255;index;not null;column:project_bach_name;comment:项目名称"`
  154. BondName string `json:"bond_name" gorm:"size:255;column:bond_name;comment:债券名称"`
  155. FirstPublishDate string `json:"first_publish_date" gorm:"size:50;column:first_publish_date;comment:发布时间"`
  156. BatchNum int `json:"batch_num" gorm:"column:batch_num;comment:批次"`
  157. PresentIssueAmount float64 `json:"present_issue_amount" gorm:"column:present_issue_amount;comment:发行额"`
  158. IssueInterestRate float64 `json:"issue_interest_rate" gorm:"column:issue_interest_rate;comment:发行利率"`
  159. PresentAsSpecialAmount float64 `json:"present_as_special_amount" gorm:"column:present_as_special_amount;comment:专项债作为资本金发行额"`
  160. TotalIssueAmount float64 `json:"total_issue_amount" gorm:"column:total_issue_amount;comment:累计发行金额"`
  161. ReviseLog string `json:"revise_log" gorm:"size:1000;column:revise_log;comment:调整记录"`
  162. }
  163. // TableName 指定数据库表名
  164. func (ProjectIssueDetails) TableName() string {
  165. if GF.Mysql.Prefix != "" {
  166. return GF.Mysql.Prefix + "_project_issue_details"
  167. } else {
  168. return "project_issue_details"
  169. }
  170. }
  171. // BondInfo 债券基本信息
  172. type BondInfo struct {
  173. ID int `json:"id" gorm:"primaryKey;autoIncrement;column:id;comment:主键自增"`
  174. BondName string `json:"bond_name" gorm:"size:255;index;not null;column:bond_name;comment:债券名称"`
  175. BondShortName string `json:"bond_short_name" gorm:"size:255;column:bond_short_name;comment:债券简称"`
  176. BondNo string `json:"bond_no" gorm:"size:100;column:bond_no;comment:债券编码"`
  177. Area string `json:"area" gorm:"size:100;column:area;comment:省份"`
  178. BondNature string `json:"bond_nature" gorm:"size:255;column:bond_nature;comment:债券性质"`
  179. BondType string `json:"bond_type" gorm:"size:255;column:bond_type;comment:债券类型"`
  180. OfficialProjectType string `json:"official_project_type" gorm:"size:255;column:official_project_type;comment:官方项目类型"`
  181. TotalAmount float64 `json:"total_amount" gorm:"column:total_amount;comment:发行金额(万元)"`
  182. IssueDate string `json:"issue_date" gorm:"type:datetime;column:issue_date;comment:发行日期"`
  183. IssuePlace string `json:"issue_place" gorm:"size:255;column:issue_place;comment:发行场所"`
  184. IssueTerm int `json:"issue_term" gorm:"column:issue_term;comment:发行期限(年)"`
  185. IssueInterestRate string `json:"issue_interest_rate" gorm:"size:50;column:issue_interest_rate;comment:发行利率(%)"`
  186. IssuePhase string `json:"issue_phase" gorm:"size:50;column:issue_phase;comment:发行期数"`
  187. WayOfPayInterest string `json:"way_of_pay_interest" gorm:"size:255;column:way_of_pay_interest;comment:付息方式"`
  188. NewBondAmount float64 `json:"new_bond_amount" gorm:"column:new_bond_amount;comment:新增债券(亿元)"`
  189. CounterBondAmount float64 `json:"counter_bond_amount" gorm:"column:counter_bond_amount;comment:置换债券(亿元)"`
  190. RefinancingBondAmount float64 `json:"refinancing_bond_amount" gorm:"column:refinancing_bond_amount;comment:再融资债券(亿元)"`
  191. RedemptionMethod string `json:"redemption_method" gorm:"size:255;column:redemption_method;comment:赎回方式"`
  192. ValueDate string `json:"value_date" gorm:"size:50;column:value_date;comment:起息日"`
  193. ExpiryDate string `json:"expiry_date" gorm:"size:50;column:expiry_date;comment:到息日"`
  194. PayInterestDate string `json:"pay_interest_date" gorm:"size:50;column:pay_interest_date;comment:付息日"`
  195. LatePayInterestDate string `json:"late_pay_interest_date" gorm:"size:50;column:late_pay_interest_date;comment:最近付息日"`
  196. RemindPayDays int `json:"remind_pay_days" gorm:"column:remind_pay_days;comment:提醒还款(天)"`
  197. LastPayInterest float64 `json:"last_pay_interest" gorm:"column:last_pay_interest;comment:上期已付息(亿元)"`
  198. IsEarlyRepayPrincipal string `json:"is_early_repay_prinipal" gorm:"size:50;column:is_early_repay_prinipal;comment:提前还本"`
  199. CumulativePayInterest float64 `json:"cumulative_pay_interest" gorm:"column:cumulative_pay_interest;comment:累计付息(亿元)"`
  200. IsCounterBond string `json:"is_counter_bond" gorm:"size:50;column:is_counter_bond;comment:柜台债"`
  201. }
  202. // TableName 指定数据库表名
  203. func (BondInfo) TableName() string {
  204. if GF.Mysql.Prefix != "" {
  205. return GF.Mysql.Prefix + "_bond_info"
  206. } else {
  207. return "bond_info"
  208. }
  209. }
  210. // BondAttachment 债券相关附件
  211. type BondAttachment struct {
  212. ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键自增"`
  213. BondName string `json:"bondName" gorm:"column:bondName;size:255;index;not null;comment:债券名称,索引"`
  214. File string `json:"file" gorm:"column:file;size:500;not null;comment:附件"`
  215. FileType string `json:"fileType,omitempty" gorm:"column:fileType;size:100;comment:附件类型"`
  216. Source string `json:"source,omitempty" gorm:"column:source;size:255;comment:资料来源"`
  217. PublishTime string `json:"publishTime,omitempty" gorm:"column:publishTime;size:50;comment:发布时间"`
  218. Comeintime *time.Time `json:"comeintime" gorm:"column:comeintime;autoCreateTime"` // 入库时间
  219. Updatetime *time.Time `json:"updatetime" gorm:"column:updatetime;autoUpdateTime"` // 更新时间
  220. }
  221. // TableName 指定数据库表名
  222. func (BondAttachment) TableName() string {
  223. if GF.Mysql.Prefix != "" {
  224. return GF.Mysql.Prefix + "_bond_attachment"
  225. } else {
  226. return "bond_attachment"
  227. }
  228. }
  229. // BondChangeLog 债券修改记录
  230. type BondChangeLog struct {
  231. ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键自增"`
  232. BondName string `json:"bondName" gorm:"column:bondName;size:255;index;not null;comment:债券名称"`
  233. ProjectName string `json:"projectName,omitempty" gorm:"column:projectName;size:255;comment:项目名称"`
  234. ChangeReason string `json:"changeReason,omitempty" gorm:"column:changeReason;size:500;comment:变更原因"`
  235. ChangeDetail string `json:"changeDetail,omitempty" gorm:"column:changeDetail;size:1000;comment:变更内容"`
  236. Comeintime *time.Time `json:"comeintime" gorm:"column:comeintime;autoCreateTime"` // 入库时间
  237. Updatetime *time.Time `json:"updatetime" gorm:"column:updatetime;autoUpdateTime"` // 更新时间
  238. }
  239. // TableName 指定数据库表名
  240. func (BondChangeLog) TableName() string {
  241. if GF.Mysql.Prefix != "" {
  242. return GF.Mysql.Prefix + "_bond_change_log"
  243. } else {
  244. return "bond_change_log"
  245. }
  246. }
  247. type ProjectBondRelation struct {
  248. ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键自增"`
  249. ProjectID int `json:"project_id" gorm:"column:project_id;comment:项目ID"`
  250. BondID int `json:"bond_id" gorm:"column:bond_id;comment:债券ID"`
  251. }
  252. // TableName 指定数据库表名
  253. func (ProjectBondRelation) TableName() string {
  254. if GF.Mysql.Prefix != "" {
  255. return GF.Mysql.Prefix + "_project_bond_relation"
  256. } else {
  257. return "project_bond_relation"
  258. }
  259. }
  260. // ProjectListInfo ProjectListInfo
  261. type ProjectListInfo struct {
  262. ID uint `gorm:"primaryKey;autoIncrement;column:id" json:"id"`
  263. ProjectName string `gorm:"column:project_name" json:"project_name"`
  264. TotalInvestment float64 `gorm:"column:total_investment" json:"total_investment"` // 总投资(亿元)
  265. Area string `gorm:"column:area" json:"area"` // 省份
  266. City string `gorm:"column:city" json:"city"` // 城市
  267. PresentIssueAmount float64 `gorm:"column:present_issue_amount" json:"present_issue_amount"` // 累计发行额(亿元)
  268. IssueTerm string `gorm:"column:issue_term" json:"issue_term"` // 发行期限(年)
  269. IssueInterestRate string `gorm:"column:issue_interest_rate" json:"issue_interest_rate"` // 发行利率(%)
  270. IssueDate string `gorm:"column:issue_date" json:"issue_date"` // 发行时间
  271. District string `gorm:"column:district" json:"district"` // 区县
  272. }
  273. func (ProjectListInfo) TableName() string {
  274. if GF.Mysql.Prefix != "" {
  275. return GF.Mysql.Prefix + "_project_list_info"
  276. } else {
  277. return "project_list_info"
  278. }
  279. }