|
|
@@ -15,30 +15,30 @@ import (
|
|
|
|
|
|
// WrOrderQuote 买卖大厅行情
|
|
|
type WrOrderQuote struct {
|
|
|
- WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"` // 仓单要素id
|
|
|
- BUYPRICE float64 `json:"buyprice" xorm:"'BUYPRICE'"` // 买价
|
|
|
- BUYQTY float64 `json:"buyqty" xorm:"'BUYQTY'"` // 买量
|
|
|
- SELLPRICE float64 `json:"sellprice" xorm:"'SELLPRICE'"` // 卖价
|
|
|
- SELLQTY float64 `json:"sellqty" xorm:"'SELLQTY'"` // 卖量
|
|
|
- WRFACTORTYPENAME string `json:"wrfactortypename" xorm:"'WRFACTORTYPENAME'"` // 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
|
|
|
- DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 品种id
|
|
|
- WRSTANDARDID int32 `json:"wrstandardid" xorm:"'WRSTANDARDID'" form:"wrstandardid"` // 商品id
|
|
|
- WAREHOUSEID int32 `json:"warehouseid" xorm:"'WAREHOUSEID'" form:"warehouseid"` // 仓库id
|
|
|
- DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 品种名称
|
|
|
- DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 品种代码
|
|
|
- WAREHOUSENAME string `json:"warehousename" xorm:"'WAREHOUSENAME'"` // 仓库名称
|
|
|
- WAREHOUSECODE string `json:"warehousecode" xorm:"'WAREHOUSECODE'"` // 仓库代码
|
|
|
- WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 商品名称
|
|
|
- WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 商品代码
|
|
|
- WRGOODSNAME string `json:"wrgoodsname" xorm:"'WRGOODSNAME'"` // 商品(商品名称+仓库要素名称 拼接)
|
|
|
- BUYPRICEMOVE float64 `json:"buypricemove" xorm:"'BUYPRICEMOVE'"` // 买升贴水(基差)
|
|
|
- SELLPRICEMOVE float64 `json:"sellpricemove" xorm:"'SELLPRICEMOVE'"` // 卖升贴水(基差)
|
|
|
- GOODSID int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品id(浮动价列表才有)
|
|
|
- GOODSCODE string `json:"goodscode" xorm:"'GOODSCODE'"` // 商品合约(浮动价列表才有)
|
|
|
- DELIVERYMONTH string `json:"deliverymonth" xorm:"'DELIVERYMONTH'" form:"deliverymonth"` // 交收月
|
|
|
- ENUMDICNAME string `json:"enumdicname" xorm:"'enumdicname'"` // 单位名称
|
|
|
- MINIVALUE int32 `json:"minivalue" xorm:"'MINIVALUE'"` // 现货商品最小变动值
|
|
|
- PageEx `xorm:"extends"` // 页码信息
|
|
|
+ WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"` // 仓单要素id
|
|
|
+ BUYPRICE float64 `json:"buyprice" xorm:"'BUYPRICE'"` // 买价
|
|
|
+ BUYQTY float64 `json:"buyqty" xorm:"'BUYQTY'"` // 买量
|
|
|
+ SELLPRICE float64 `json:"sellprice" xorm:"'SELLPRICE'"` // 卖价
|
|
|
+ SELLQTY float64 `json:"sellqty" xorm:"'SELLQTY'"` // 卖量
|
|
|
+ WRFACTORTYPENAME string `json:"wrfactortypename" xorm:"'WRFACTORTYPENAME'"` // 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
|
|
|
+ DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 品种id
|
|
|
+ WRSTANDARDID int32 `json:"wrstandardid" xorm:"'WRSTANDARDID'" form:"wrstandardid"` // 商品id
|
|
|
+ WAREHOUSEID int32 `json:"warehouseid" xorm:"'WAREHOUSEID'" form:"warehouseid"` // 仓库id
|
|
|
+ DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 品种名称
|
|
|
+ DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 品种代码
|
|
|
+ WAREHOUSENAME string `json:"warehousename" xorm:"'WAREHOUSENAME'"` // 仓库名称
|
|
|
+ WAREHOUSECODE string `json:"warehousecode" xorm:"'WAREHOUSECODE'"` // 仓库代码
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 商品名称
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 商品代码
|
|
|
+ WRGOODSNAME string `json:"wrgoodsname" xorm:"'WRGOODSNAME'"` // 商品(商品名称+仓库要素名称 拼接)
|
|
|
+ BUYPRICEMOVE float64 `json:"buypricemove" xorm:"'BUYPRICEMOVE'"` // 买升贴水(基差)
|
|
|
+ SELLPRICEMOVE float64 `json:"sellpricemove" xorm:"'SELLPRICEMOVE'"` // 卖升贴水(基差)
|
|
|
+ GOODSID int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品id(浮动价列表才有)
|
|
|
+ GOODSCODE string `json:"goodscode" xorm:"'GOODSCODE'"` // 商品合约(浮动价列表才有)
|
|
|
+ DELIVERYMONTH string `json:"deliverymonth" xorm:"'DELIVERYMONTH'" form:"deliverymonth"` // 交收月
|
|
|
+ ENUMDICNAME string `json:"enumdicname" xorm:"'enumdicname'"` // 单位名称
|
|
|
+ MINIVALUE int32 `json:"minivalue" xorm:"'MINIVALUE'"` // 现货商品最小变动值
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
|
|
|
HasWr int32 `json:"-" form:"haswr"` // 是否有仓单 0-没有 1-有
|
|
|
WrPriceType int32 `json:"-" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价 - [挂牌]
|
|
|
@@ -975,6 +975,36 @@ func (r *WrFactorTypeInfo) GetDataEx() (interface{}, error) {
|
|
|
return r.GetData()
|
|
|
}
|
|
|
|
|
|
+// GetItemList 获取要素项列表
|
|
|
+func (r WrFactorTypeInfo) GetItemList() ([]WrTypeItem, error) {
|
|
|
+ d, err := r.GetData()
|
|
|
+ return r.buildItemList(d), err
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrFactorTypeInfo) buildItemList(lst []WrFactorTypeInfo) []WrTypeItem {
|
|
|
+ lstItem := make([]WrTypeItem, 0)
|
|
|
+ if len(lst) > 0 {
|
|
|
+ a := lst[0]
|
|
|
+ lstItem = append(lstItem, WrTypeItem{NAME: "品种", VALUE: a.DELIVERYGOODSNAME})
|
|
|
+ lstItem = append(lstItem, WrTypeItem{NAME: "商品", VALUE: a.WRSTANDARDNAME})
|
|
|
+ for _, b := range lst {
|
|
|
+ lstItem = append(lstItem, WrTypeItem{NAME: b.ITEMTYPENAME, VALUE: b.DGFACTORYITEMVALUE})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return lstItem
|
|
|
+}
|
|
|
+
|
|
|
+// WrFactorTypeInfoEx
|
|
|
+type WrFactorTypeInfoEx struct {
|
|
|
+ WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"`
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取仓单要素选择项
|
|
|
+func (r *WrFactorTypeInfoEx) GetDataEx() (interface{}, error) {
|
|
|
+ m := WrFactorTypeInfo{WRFACTORTYPEID: r.WRFACTORTYPEID}
|
|
|
+ return m.GetItemList()
|
|
|
+}
|
|
|
+
|
|
|
// WrGoodsPerformanceStep 商品履约步骤
|
|
|
type WrGoodsPerformanceStep struct {
|
|
|
AUTOID int64 `json:"autoid" xorm:"AUTOID" form:"autoid"` // AutoID
|
|
|
@@ -998,7 +1028,7 @@ type WrGoodsPerformanceStep struct {
|
|
|
func (r *WrGoodsPerformanceStep) calc() {
|
|
|
switch r.STEPTYPEID {
|
|
|
case 1, 2:
|
|
|
- r.STEPINFO = fmt.Sprintf("%v% v%%", r.STEPTYPENAME, r.STEPVALUE*100)
|
|
|
+ r.STEPINFO = fmt.Sprintf("%v %v%%", r.STEPTYPENAME, r.STEPVALUE*100)
|
|
|
default:
|
|
|
if r.STEPVALUE == 0 {
|
|
|
r.STEPINFO = r.STEPTYPENAME
|
|
|
@@ -1063,13 +1093,8 @@ func (r *WrGoodsInfo) GetDataEx() (interface{}, error) {
|
|
|
if sType, err := mWrType.GetData(); err == nil {
|
|
|
v := WrGoodsInfo{LstItem: make([]WrTypeItem, 0), LstStep: make([]WrGoodsPerformanceStep, 0)}
|
|
|
if len(sType) > 0 {
|
|
|
+ v.LstItem = mWrType.buildItemList(sType)
|
|
|
a := sType[0]
|
|
|
- v.LstItem = append(v.LstItem, WrTypeItem{NAME: "品种", VALUE: a.DELIVERYGOODSNAME})
|
|
|
- v.LstItem = append(v.LstItem, WrTypeItem{NAME: "商品", VALUE: a.WRSTANDARDNAME})
|
|
|
-
|
|
|
- for _, b := range sType {
|
|
|
- v.LstItem = append(v.LstItem, WrTypeItem{NAME: b.ITEMTYPENAME, VALUE: b.DGFACTORYITEMVALUE})
|
|
|
- }
|
|
|
|
|
|
// 获取履约规则
|
|
|
mStep := WrGoodsPerformanceStep{MARKETID: r.MARKETID, WRSTANDARDID: a.WRSTANDARDID, HASWR: r.HASWR}
|
|
|
@@ -1526,35 +1551,34 @@ func (r *WrPerformanPlanSum) GetData() ([]WrPerformanPlanSum, error) {
|
|
|
|
|
|
// WrFAProductDetail 融资产品列表
|
|
|
type WrFAProductDetail struct {
|
|
|
- PRODUCTDETAILID int64 `json:"productdetailid" xorm:"PRODUCTDETAILID"` // 产品组合ID(SEQ_FINANCEAREAPRODUCTDETAIL)
|
|
|
- PRODUCTID int64 `json:"productid" xorm:"PRODUCTID"` // 金融产品ID
|
|
|
- AREAUSERID int64 `json:"areauserid" xorm:"AREAUSERID"` // 金融机构ID
|
|
|
- FINANCINGDAYS int32 `json:"financingdays" xorm:"FINANCINGDAYS"` // 天数(天)
|
|
|
- MARGINRATIO float64 `json:"marginratio" xorm:"MARGINRATIO"` // 保证金比率质押率 - [仓单质押]
|
|
|
- INTERESTRATEMODE int32 `json:"interestratemode" xorm:"INTERESTRATEMODE"` // 利率方式 - 1:年利率 2:日利率
|
|
|
- INTERESTRATE float64 `json:"interestrate" xorm:"INTERESTRATE"` // 利率
|
|
|
- INTERESTMINLEN int32 `json:"interestminlen" xorm:"INTERESTMINLEN"` // 最小起息天数
|
|
|
- INTERESTSETTLEMODE int32 `json:"interestsettlemode" xorm:"INTERESTSETTLEMODE"` // 结息方式 - 1:按日结息 3:按月结息
|
|
|
- INTERESTSETTLEVALUE int32 `json:"interestsettlevalue" xorm:"INTERESTSETTLEVALUE"` // 结息方式值
|
|
|
- UPDATETIME string `json:"updatetime" xorm:"UPDATETIME"` // 更新时间
|
|
|
- ISAUTOLOAN int32 `json:"isautoloan" xorm:"'ISAUTOLOAN'"` // 是否自动放款 0-手动 1-自动 (当为自动放款时,显示"放款快")
|
|
|
- PRODUCTNAME string `json:"productname" xorm:"'PRODUCTNAME'"` // 产品名称
|
|
|
- USERNAME string `json:"username" xorm:"'USERNAME'"` // 融出方
|
|
|
- ACCOUNTID int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 资金账号
|
|
|
-
|
|
|
- LOANTAG string `json:"-"` // 放款标识: "放款快" 或者为空
|
|
|
-
|
|
|
- WRSTANDARDID int64 `json:"-"` // 品类(商品)id
|
|
|
- BRANDID int64 `json:"-"` // 品牌id
|
|
|
- WAREHOUSEID int64 `json:"-"` // 仓库id
|
|
|
- WRFACTORTYPEID string `json:"wrfactortypeid" form:"wrfactortypeid"` // 仓单要素ID
|
|
|
+ PRODUCTDETAILID int64 `json:"productdetailid" xorm:"PRODUCTDETAILID" form:"productdetailid"` // 产品组合ID(SEQ_FINANCEAREAPRODUCTDETAIL)
|
|
|
+ PRODUCTID int64 `json:"productid" xorm:"PRODUCTID"` // 金融产品ID
|
|
|
+ AREAUSERID int64 `json:"areauserid" xorm:"AREAUSERID"` // 金融机构ID
|
|
|
+ FINANCINGDAYS int32 `json:"financingdays" xorm:"FINANCINGDAYS"` // 天数(天)
|
|
|
+ MARGINRATIO float64 `json:"marginratio" xorm:"MARGINRATIO"` // 保证金比率质押率 - [仓单质押]
|
|
|
+ INTERESTRATEMODE int32 `json:"interestratemode" xorm:"INTERESTRATEMODE"` // 利率方式 - 1:年利率 2:日利率 3:日固定值
|
|
|
+ INTERESTRATE float64 `json:"interestrate" xorm:"INTERESTRATE"` // 利率
|
|
|
+ INTERESTMINLEN int32 `json:"interestminlen" xorm:"INTERESTMINLEN"` // 最小起息天数
|
|
|
+ INTERESTSETTLEMODE int32 `json:"interestsettlemode" xorm:"INTERESTSETTLEMODE"` // 结息方式 - 1:按日结息 3:按月结息
|
|
|
+ INTERESTSETTLEVALUE int32 `json:"interestsettlevalue" xorm:"INTERESTSETTLEVALUE"` // 结息方式值
|
|
|
+ UPDATETIME string `json:"updatetime" xorm:"UPDATETIME"` // 更新时间
|
|
|
+ ISAUTOLOAN int32 `json:"isautoloan" xorm:"'ISAUTOLOAN'"` // 是否自动放款 0-手动 1-自动 (当为自动放款时,显示"放款快")
|
|
|
+ PRODUCTNAME string `json:"productname" xorm:"'PRODUCTNAME'"` // 产品名称
|
|
|
+ USERNAME string `json:"username" xorm:"'USERNAME'"` // 融出方
|
|
|
+ ACCOUNTID int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 资金账号
|
|
|
+
|
|
|
+ LOANTAG string `json:"loantag"` // 放款标识: "放款快" 或者为空
|
|
|
+ WRSTANDARDID int64 `json:"-"` // 品类(商品)id
|
|
|
+ BRANDID int64 `json:"-"` // 品牌id
|
|
|
+ WAREHOUSEID int64 `json:"-"` // 仓库id
|
|
|
+ WRFACTORTYPEID string `json:"-" form:"wrfactortypeid"` // 仓单要素ID
|
|
|
}
|
|
|
|
|
|
func (r *WrFAProductDetail) calc() {
|
|
|
r.LOANTAG = IFValue(r.ISAUTOLOAN == 1, "放款快", "").(string)
|
|
|
}
|
|
|
|
|
|
-func (r *WrFAProductDetail) buildSql() string {
|
|
|
+func (r *WrFAProductDetail) buildSqlByWrFactorTypeId() string {
|
|
|
var sqlId utils.SQLVal = "with tmp as" +
|
|
|
" (select distinct f.productid, f.isautoloan" +
|
|
|
" from FinanceAreaProductLimit f" +
|
|
|
@@ -1588,6 +1612,39 @@ func (r *WrFAProductDetail) buildSql() string {
|
|
|
return sqlId.String()
|
|
|
}
|
|
|
|
|
|
+func (r *WrFAProductDetail) buildSqlByProductDetailId() string {
|
|
|
+ var sqlId utils.SQLVal = "select t.PRODUCTDETAILID," +
|
|
|
+ " t.PRODUCTID," +
|
|
|
+ " t.AREAUSERID," +
|
|
|
+ " t.FINANCINGDAYS," +
|
|
|
+ " t.MARGINRATIO," +
|
|
|
+ " t.INTERESTRATEMODE," +
|
|
|
+ " t.INTERESTRATE," +
|
|
|
+ " t.INTERESTMINLEN," +
|
|
|
+ " t.INTERESTSETTLEMODE," +
|
|
|
+ " t.INTERESTSETTLEVALUE," +
|
|
|
+ " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
|
|
|
+ " p.productname," +
|
|
|
+ " p.accountid," +
|
|
|
+ " u.accountname username" +
|
|
|
+ " from FinanceAreaProductDetail t" +
|
|
|
+ " left join FinanceAreaProduct p" +
|
|
|
+ " on t.productid = p.productid" +
|
|
|
+ " left join useraccount u" +
|
|
|
+ " on t.areauserid = u.userid" +
|
|
|
+ " where 1=1"
|
|
|
+ sqlId.And("t.PRODUCTDETAILID", r.PRODUCTDETAILID)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrFAProductDetail) buildSql() string {
|
|
|
+ if r.PRODUCTDETAILID > 0 {
|
|
|
+ return r.buildSqlByProductDetailId()
|
|
|
+ } else {
|
|
|
+ return r.buildSqlByWrFactorTypeId()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// GetDataEx 获取融资产品列表
|
|
|
func (r *WrFAProductDetail) GetDataEx() (interface{}, error) {
|
|
|
sData := make([]WrFAProductDetail, 0)
|
|
|
@@ -1910,3 +1967,142 @@ func (r *WrPerformancePlanStep) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, err
|
|
|
}
|
|
|
+
|
|
|
+// WrFinanceBuyApply 融资购买申请表
|
|
|
+type WrFinanceBuyApply struct {
|
|
|
+ FINANCEAPPLYID string `json:"financeapplyid" xorm:"FINANCEAPPLYID" form:"financeapplyid"` // 融资申请单ID(320+Unix秒时间戳(10位)+xxxxxx)
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"TRADEDATE" form:"tradedate"` // 交易日(yyyyMMdd)
|
|
|
+ BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL" form:"buyorsell"` // 买卖 - 0:买 1:卖
|
|
|
+ MARKETID int64 `json:"marketid" xorm:"MARKETID" form:"marketid"` // 市场ID
|
|
|
+ BUYUSERID int64 `json:"buyuserid" xorm:"BUYUSERID" form:"userid"` // 买方用户ID
|
|
|
+ BUYACCOUNTID int64 `json:"buyaccountid" xorm:"BUYACCOUNTID" form:"buyaccountid"` // 买方资金账号
|
|
|
+ SELLWRTRADEORDERID string `json:"sellwrtradeorderid" xorm:"SELLWRTRADEORDERID" form:"sellwrtradeorderid"` // 卖方委托单ID
|
|
|
+ WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"WRFACTORTYPEID" form:"wrfactortypeid"` // 仓单要素类型ID
|
|
|
+ ORDERQTY float64 `json:"orderqty" xorm:"ORDERQTY" form:"orderqty"` // 委托数量(商品数量)
|
|
|
+ SELLUSERID int64 `json:"selluserid" xorm:"SELLUSERID" form:"selluserid"` // 卖方用户ID
|
|
|
+ SELLACCOUNTID int64 `json:"sellaccountid" xorm:"SELLACCOUNTID" form:"sellaccountid"` // 卖方资金账号
|
|
|
+ PRODUCTDETAILID int64 `json:"productdetailid" xorm:"PRODUCTDETAILID" form:"productdetailid"` // 产品组合ID
|
|
|
+ FINANCEACCOUNTID int64 `json:"financeaccountid" xorm:"FINANCEACCOUNTID" form:"financeaccountid"` // 融资方资金帐户ID
|
|
|
+ FINANCEAREAUSERID string `json:"financeareauserid" xorm:"FINANCEAREAUSERID" form:"financeareauserid"` // 融资方用户ID
|
|
|
+ ISAUTOLOAN int32 `json:"isautoloan" xorm:"ISAUTOLOAN" form:"isautoloan"` // 是否自动放款 - 0:手动 1:自动
|
|
|
+ REMARK string `json:"remark" xorm:"REMARK" form:"remark"` // 备注
|
|
|
+ APPLYSTATUS int32 `json:"applystatus" xorm:"APPLYSTATUS" form:"applystatus"` // 申请状态 - 1:待审核 2.审核中 3:审核通过 4:审核拒绝 5:审核失败 6:已撤销 7:自动审核 8:融资失败
|
|
|
+ APPLYUSERID int64 `json:"applyuserid" xorm:"APPLYUSERID" form:"applyuserid"` // 申请人
|
|
|
+ APPLYDATE string `json:"applydate" xorm:"APPLYDATE" form:"applydate"` // 申请时间
|
|
|
+ AUDITUSERID int64 `json:"audituserid" xorm:"AUDITUSERID" form:"audituserid"` // 审核人
|
|
|
+ AUDITDATE string `json:"auditdate" xorm:"AUDITDATE" form:"auditdate"` // 审核时间
|
|
|
+ AUDITREMARK string `json:"auditremark" xorm:"AUDITREMARK" form:"auditremark"` // 审核备注
|
|
|
+ HANDLESTATUS int32 `json:"handlestatus" xorm:"HANDLESTATUS" form:"handlestatus"` // 处理状态
|
|
|
+ HANDLEREMARK string `json:"handleremark" xorm:"HANDLEREMARK" form:"handleremark"` // 处理备注
|
|
|
+ BUYWRTRADEORDERID string `json:"buywrtradeorderid" xorm:"BUYWRTRADEORDERID" form:"buywrtradeorderid"` // 融资方买委托单ID
|
|
|
+ SCFCONTRACTID string `json:"scfcontractid" xorm:"SCFCONTRACTID" form:"scfcontractid"` // 仓单回购合同ID
|
|
|
+ FREEZEBUYMARGIN float64 `json:"freezebuymargin" xorm:"FREEZEBUYMARGIN" form:"freezebuymargin"` // 冻结融资保证金(买方)
|
|
|
+ WRPRICETYPE int32 `json:"wrpricetype" xorm:"WRPRICETYPE" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价 - [挂牌单]
|
|
|
+ TRADEPRICE float64 `json:"tradeprice" xorm:"TRADEPRICE" form:"tradeprice"` // 成交价格
|
|
|
+ TRADEAMOUNT float64 `json:"tradeamount" xorm:"TRADEAMOUNT" form:"tradeamount"` // 成交金额(借款金额)
|
|
|
+ DELIVERYMONTH string `json:"deliverymonth" xorm:"DELIVERYMONTH" form:"deliverymonth"` // 交收月(yyyy-MM) [无仓单HasWR =0]
|
|
|
+ BUYUSERNAME string `json:"buyusername" xorm:"'BUYUSERNAME'"` // 买方名称
|
|
|
+ FINANCENAME string `json:"financename" xorm:"'FINANCENAME'"` // 融出方名称
|
|
|
+ FINANCETYPE int32 `json:"financetype" xorm:"'FINANCETYPE'"` // 融资类型 1-融资回购
|
|
|
+
|
|
|
+ PRODUCTID int64 `json:"productid" xorm:"PRODUCTID"` // 金融产品ID
|
|
|
+ FINANCINGDAYS int32 `json:"financingdays" xorm:"FINANCINGDAYS"` // 天数(天)
|
|
|
+ MARGINRATIO float64 `json:"marginratio" xorm:"MARGINRATIO"` // 保证金比率质押率 - [仓单质押]
|
|
|
+ INTERESTRATEMODE int32 `json:"interestratemode" xorm:"INTERESTRATEMODE"` // 利率方式 - 1:年利率 2:日利率 3:日固定值
|
|
|
+ INTERESTRATE float64 `json:"interestrate" xorm:"INTERESTRATE"` // 利率
|
|
|
+ INTERESTMINLEN int32 `json:"interestminlen" xorm:"INTERESTMINLEN"` // 最小起息天数
|
|
|
+ INTERESTSETTLEMODE int32 `json:"interestsettlemode" xorm:"INTERESTSETTLEMODE"` // 结息方式 - 1:按日结息 3:按月结息
|
|
|
+ INTERESTSETTLEVALUE int32 `json:"interestsettlevalue" xorm:"INTERESTSETTLEVALUE"` // 结息方式值
|
|
|
+
|
|
|
+ Wr2FactorType `xorm:"extends"`
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrFinanceBuyApply) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrFinanceBuyApply) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "with tmp as" +
|
|
|
+ " (select to_char(t.wrfactortypeid) wrfactortypeid," +
|
|
|
+ " t.wrfactortypename2 wrfactortypename," +
|
|
|
+ " t.wrstandardid," +
|
|
|
+ " t.deliverygoodsid," +
|
|
|
+ " g.deliverygoodscode," +
|
|
|
+ " g.deliverygoodsname," +
|
|
|
+ " w.wrstandardcode," +
|
|
|
+ " w.wrstandardname," +
|
|
|
+ " h.warehousecode," +
|
|
|
+ " h.warehousename," +
|
|
|
+ " e.enumdicname," +
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
+ " from wrfactortype t" +
|
|
|
+ " left join deliverygoods g" +
|
|
|
+ " on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
+ " left join wrstandard w" +
|
|
|
+ " on t.wrstandardid = w.wrstandardid" +
|
|
|
+ " left join warehouseinfo h" +
|
|
|
+ " on t.warehouseid = h.autoid" +
|
|
|
+ " left join enumdicitem e" +
|
|
|
+ " on w.unitid = e.enumitemname" +
|
|
|
+ " and e.enumdiccode = 'goodsunit')" +
|
|
|
+ "SELECT to_char(t.FINANCEAPPLYID) FINANCEAPPLYID," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " t.BUYORSELL," +
|
|
|
+ " t.MARKETID," +
|
|
|
+ " t.BUYUSERID," +
|
|
|
+ " t.BUYACCOUNTID," +
|
|
|
+ " to_char(t.SELLWRTRADEORDERID) SELLWRTRADEORDERID," +
|
|
|
+ " t.WRFACTORTYPEID," +
|
|
|
+ " t.ORDERQTY," +
|
|
|
+ " t.SELLUSERID," +
|
|
|
+ " t.SELLACCOUNTID," +
|
|
|
+ " t.PRODUCTDETAILID," +
|
|
|
+ " t.FINANCEACCOUNTID," +
|
|
|
+ " t.FINANCEAREAUSERID," +
|
|
|
+ " t.ISAUTOLOAN," +
|
|
|
+ " t.REMARK," +
|
|
|
+ " t.APPLYSTATUS," +
|
|
|
+ " t.APPLYUSERID," +
|
|
|
+ " to_char(t.APPLYDATE, 'yyyy-mm-dd hh24:mi:ss') APPLYDATE," +
|
|
|
+ " t.AUDITUSERID," +
|
|
|
+ " to_char(t.AUDITDATE, 'yyyy-mm-dd hh24:mi:ss') AUDITDATE," +
|
|
|
+ " t.AUDITREMARK," +
|
|
|
+ " t.HANDLESTATUS," +
|
|
|
+ " t.HANDLEREMARK," +
|
|
|
+ " to_char(t.BUYWRTRADEORDERID) BUYWRTRADEORDERID," +
|
|
|
+ " t.SCFCONTRACTID," +
|
|
|
+ " t.FREEZEBUYMARGIN," +
|
|
|
+ " t.WRPRICETYPE," +
|
|
|
+ " t.TRADEPRICE," +
|
|
|
+ " t.TRADEAMOUNT," +
|
|
|
+ " t.DELIVERYMONTH," +
|
|
|
+ " p.FINANCINGDAYS," +
|
|
|
+ " p.MARGINRATIO," +
|
|
|
+ " p.INTERESTRATEMODE," +
|
|
|
+ " p.INTERESTRATE," +
|
|
|
+ " p.INTERESTMINLEN," +
|
|
|
+ " p.INTERESTSETTLEMODE," +
|
|
|
+ " p.INTERESTSETTLEVALUE," +
|
|
|
+ " u1.accountname BUYUSERNAME," +
|
|
|
+ " u2.accountname FINANCENAME," +
|
|
|
+ " tmp.*" +
|
|
|
+ " FROM WRTRADE_FINANCEBUYAPPLY t" +
|
|
|
+ " LEFT JOIN FINANCEAREAPRODUCTDETAIL p on t.productdetailid = p.productdetailid" +
|
|
|
+ " LEFT JOIN tmp on t.wrfactortypeid=tmp.wrfactortypeid" +
|
|
|
+ " LEFT JOIN USERACCOUNT u1 on t.BUYUSERID = u1.userid" +
|
|
|
+ " LEFT JOIN USERACCOUNT u2 on t.FINANCEAREAUSERID = u2.userid" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.AndEx("t.BUYUSERID", r.BUYUSERID, r.BUYUSERID > 0)
|
|
|
+ sqlId.AndEx("t.FINANCEAPPLYID", r.FINANCEAPPLYID, r.FINANCEAPPLYID != "")
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取融资购买申请表
|
|
|
+func (r *WrFinanceBuyApply) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]WrFinanceBuyApply, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|