| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- // Package models 211.3 风险管理系统2020_现货合同
- package models
- import (
- "mtp2_if/db"
- "time"
- )
- // Erms3SpotContractApply 现货合同申请表
- type Erms3SpotContractApply struct {
- SpotContractID int64 `json:"spotcontractid" xorm:"'SPOTCONTRACTID'" binging:"required"` // 现货合同ID(345+Unix秒时间戳(10位)+xxxxxx)
- TradeDate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
- ContractNo string `json:"contractno" xorm:"'CONTRACTNO'"` // 现货合同编号
- ContractType int32 `json:"contracttype" xorm:"'CONTRACTTYPE'"` // 现货合同类型 - 1:采购 -1:销售
- AreaUserID int32 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
- AccountID int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 资金账户ID
- CustomerUserID int32 `json:"customeruserid" xorm:"'CUSTOMERUSERID'"` // 客户ID
- CustomerAccountID int64 `json:"customeraccountid" xorm:"'CUSTOMERACCOUNTID'"` // 客户资金账户ID
- SignDate time.Time `json:"signdate" xorm:"'SIGNDATE'"` // 签订日期
- LastDate time.Time `json:"lastdate" xorm:"'LASTDATE'"` // 交货时间
- ContractAttachment string `json:"contractattachment" xorm:"'CONTRACTATTACHMENT'"` // 合同附件
- OriMarginPayer int32 `json:"orimarginpayer" xorm:"'ORIMARGINPAYER'"` // 初始保证金支付方 -1:买方 2:卖方
- OriMargin float64 `json:"orimargin" xorm:"'ORIMARGIN'"` // 初始保证金
- Remark string `json:"remark" xorm:"'REMARK'"` // 备注
- DetailJSON string `json:"detailjson" xorm:"'DETAILJSON'"` // 明细JSON
- ApplyStatus int32 `json:"applystatus" xorm:"'APPLYSTATUS'"` // 申请状态 - 0:未审核 1:审核通过 2:审核中 3:审核失败 4已撤销 5:审核拒绝
- ApplySrc int32 `json:"applysrc" xorm:"'APPLYSRC'"` // 申请来源 - 1:管理端 2:终端
- MarketID int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
- CreatorID int32 `json:"creatorid" xorm:"'CREATORID'"` // 申请人
- CreateTime time.Time `json:"createtime" xorm:"'CREATETIME'"` // 申请时间
- AuditID int32 `json:"auditid" xorm:"'AUDITID'"` // 审核人
- AuditTime time.Time `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间
- AuditRemark string `json:"auditremark" xorm:"'AUDITREMARK'"` // 审核备注
- }
- // TableName is ERMS3_SPOTCONTRACTAPPLY
- func (Erms3SpotContractApply) TableName() string {
- return "ERMS3_SPOTCONTRACTAPPLY"
- }
- // AddSpotContractApply 插入现货合同记录
- func AddSpotContractApply(spotContractApply Erms3SpotContractApply) error {
- engine := db.GetEngine()
- // 组织sql,插入现货合同申请信息
- sql := `INSERT INTO ERMS3_SPOTCONTRACTAPPLY(SPOTCONTRACTID,
- TRADEDATE,
- CONTRACTNO,
- CONTRACTTYPE,
- AREAUSERID,
- ACCOUNTID,
- CUSTOMERUSERID,
- CUSTOMERACCOUNTID,
- SIGNDATE,
- LASTDATE,
- CONTRACTATTACHMENT,
- ORIMARGINPAYER,
- ORIMARGIN,
- REMARK,
- DETAILJSON,
- APPLYSTATUS,
- APPLYSRC,
- MARKETID,
- CREATORID,
- CREATETIME)
- VALUES(?,
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- to_date(?, 'YYYY-MM-DD HH24:MI:SS'),
- to_date(?, 'YYYY-MM-DD HH24:MI:SS'),
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- ?,
- sysdate)`
- _, err := engine.Exec(sql,
- spotContractApply.SpotContractID,
- spotContractApply.TradeDate,
- spotContractApply.ContractNo,
- spotContractApply.ContractType,
- spotContractApply.AreaUserID,
- spotContractApply.AccountID,
- spotContractApply.CustomerUserID,
- spotContractApply.CustomerAccountID,
- spotContractApply.SignDate,
- spotContractApply.LastDate,
- spotContractApply.ContractAttachment,
- spotContractApply.OriMarginPayer,
- spotContractApply.OriMargin,
- spotContractApply.Remark,
- spotContractApply.DetailJSON,
- spotContractApply.ApplyStatus,
- spotContractApply.ApplySrc,
- spotContractApply.MarketID,
- spotContractApply.CreatorID)
- return err
- }
|