|
@@ -1807,3 +1807,229 @@ func (r *GZGoods) GetDataEx() (interface{}, error) {
|
|
|
sData.calc()
|
|
sData.calc()
|
|
|
return sData, nil
|
|
return sData, nil
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// MyPerformanc 我的履约
|
|
|
|
|
+type MyPerformanc struct {
|
|
|
|
|
+ // PerformancePlan
|
|
|
|
|
+ PERFORMANCEPLANID string `json:"performanceplanid" xorm:"PERFORMANCEPLANID1"` // 履约计划ID(130+yyMMddHHmmss+xxxx)
|
|
|
|
|
+ RELATEDORDERID string `json:"relatedorderid" xorm:"RELATEDORDERID1"` // 关联单号(履约类型的关联单号)
|
|
|
|
|
+ AMOUNT float64 `json:"amount" xorm:"AMOUNT"` // 履约金额
|
|
|
|
|
+ PAYMENTTYPE int32 `json:"paymenttype" xorm:"PAYMENTTYPE"` // 买方支付方式 - 1:冻结 2:扣款
|
|
|
|
|
+ PERFORMANCESTATUS int32 `json:"performancestatus" xorm:"PERFORMANCESTATUS"` // 履约状态 - 1:待激活 2:正常 3:处理错误 4:违约待处理 5:违约处理中 6:完成 7.违约已完成 8:释放冻结失败 9:超时待处理 10:超时关闭
|
|
|
|
|
+ CURSTEPID string `json:"curstepid" xorm:"CURSTEPID1"` // 当前步骤ID
|
|
|
|
|
+ BUYPAIDAMOUNT float64 `json:"buypaidamount" xorm:"BUYPAIDAMOUNT"` // 买方已冻/已扣金额
|
|
|
|
|
+ SELLRECEIVEDAMOUNT float64 `json:"sellreceivedamount" xorm:"SELLRECEIVEDAMOUNT"` // 卖方已收金额
|
|
|
|
|
+ BUYERFREEZEAMOUNT float64 `json:"buyerfreezeamount" xorm:"BUYERFREEZEAMOUNT"` // 买方履约前冻结资金
|
|
|
|
|
+ BUYERFREEZEAMOUNTREMAIN float64 `json:"buyerfreezeamountremain" xorm:"BUYERFREEZEAMOUNTREMAIN"` // 买方履约前冻结资金剩余
|
|
|
|
|
+ SELLERFREEZEAMOUNT float64 `json:"sellerfreezeamount" xorm:"SELLERFREEZEAMOUNT"` // 卖方履约前冻结资金
|
|
|
|
|
+ SELLERFREEZEAMOUNTREMAIN float64 `json:"sellerfreezeamountremain" xorm:"SELLERFREEZEAMOUNTREMAIN"` // 卖方履约前冻结资金剩余
|
|
|
|
|
+ OVERSHORTAMOUNT float64 `json:"overshortamount" xorm:"OVERSHORTAMOUNT"` // 溢短金额
|
|
|
|
|
+ BUYERINFO string `json:"buyerinfo" xorm:"BUYERINFO"` // 买方联系信息 - 存JSON字符串, 根据枚举‘BuyerContactInfo',显示\隐藏字段,若数据不为JSON,则直接显示{ "ContactInfo": "xxxxxxxx", "ReceiveInfo": "xxxxxxxxx", "ReceiptInfo": "xxxxxxxxxxxx"}
|
|
|
|
|
+ SELLERINFO string `json:"sellerinfo" xorm:"SELLERINFO"` // 卖方联系信息 - 存JSON字符串, 根据枚举‘SellerContactInfo',显示\隐藏字段,若数据不为JSON,则直接显示{ "ContactInfo": "xxxxxxxx"}
|
|
|
|
|
+
|
|
|
|
|
+ // PerformanceStep
|
|
|
|
|
+ STEPTYPEID int32 `json:"steptypeid" xorm:"STEPTYPEID"` // 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结 10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款) 用于-1模板“
|
|
|
|
|
+
|
|
|
|
|
+ // useraccount
|
|
|
|
|
+ ACCOUNTNAME string `json:"accountname" xorm:"ACCOUNTNAME"` // [对手方]账户名称(机构名称)
|
|
|
|
|
+
|
|
|
|
|
+ // View_GZ_WRStandard_Ex_Query
|
|
|
|
|
+ ZSALLPROPERTIES string `json:"-" xorm:"ZSALLPROPERTIES" form:"zsallproperties"` // 商品(查询字段-模糊查询)
|
|
|
|
|
+ ZSCATEGORYDISPLAY string `json:"zscategorydisplay" xorm:"ZSCATEGORYDISPLAY"` //
|
|
|
|
|
+ ZSCURRENCYTYPEDISPLAY string `json:"zscurrencytypedisplay" xorm:"ZSCURRENCYTYPEDISPLAY"` //
|
|
|
|
|
+ ZSCURRENCYTYPEDISPLAYUNIT string `json:"zscurrencytypedisplayunit" xorm:"ZSCURRENCYTYPEDISPLAYUNIT"` //
|
|
|
|
|
+ WAREHOUSENAMEDISPLAY string `json:"warehousenamedisplay" xorm:"WAREHOUSENAMEDISPLAY"` //
|
|
|
|
|
+ ZSSHAPETYPEDISPLAY string `json:"zsshapetypedisplay" xorm:"ZSSHAPETYPEDISPLAY"` //
|
|
|
|
|
+ ZSCOLORTYPE1DISPLAY string `json:"zscolortype1display" xorm:"ZSCOLORTYPE1DISPLAY"` //
|
|
|
|
|
+ ZSCOLORTYPE2DISPLAY string `json:"zscolortype2display" xorm:"ZSCOLORTYPE2DISPLAY"` //
|
|
|
|
|
+ ZSCLARITYTYPE1DISPLAY string `json:"zsclaritytype1display" xorm:"ZSCLARITYTYPE1DISPLAY"` //
|
|
|
|
|
+ ZSCLARITYTYPE2DISPLAY string `json:"zsclaritytype2display" xorm:"ZSCLARITYTYPE2DISPLAY"` //
|
|
|
|
|
+ ZSCUTTYPE1DISPLAY string `json:"zscuttype1display" xorm:"ZSCUTTYPE1DISPLAY"` //
|
|
|
|
|
+ ZSCUTTYPE2DISPLAY string `json:"zscuttype2display" xorm:"ZSCUTTYPE2DISPLAY"` //
|
|
|
|
|
+ ZSSYMMETRYTYPE1DISPLAY string `json:"zssymmetrytype1display" xorm:"ZSSYMMETRYTYPE1DISPLAY"` //
|
|
|
|
|
+ ZSSYMMETRYTYPE2DISPLAY string `json:"zssymmetrytype2display" xorm:"ZSSYMMETRYTYPE2DISPLAY"` //
|
|
|
|
|
+ ZSPOLISHTYPE1DISPLAY string `json:"zspolishtype1display" xorm:"ZSPOLISHTYPE1DISPLAY"` //
|
|
|
|
|
+ ZSPOLISHTYPE2DISPLAY string `json:"zspolishtype2display" xorm:"ZSPOLISHTYPE2DISPLAY"` //
|
|
|
|
|
+ ZSFLUORESCENCETYPE1DISPLAY string `json:"zsfluorescencetype1display" xorm:"ZSFLUORESCENCETYPE1DISPLAY"` //
|
|
|
|
|
+ ZSFLUORESCENCETYPE2DISPLAY string `json:"zsfluorescencetype2display" xorm:"ZSFLUORESCENCETYPE2DISPLAY"` //
|
|
|
|
|
+ ZSCERTTYPEDISPLAY string `json:"zscerttypedisplay" xorm:"ZSCERTTYPEDISPLAY"` //
|
|
|
|
|
+ ZSCRYSTALTYPEDISPLAY string `json:"zscrystaltypedisplay" xorm:"ZSCRYSTALTYPEDISPLAY"` //
|
|
|
|
|
+ ZSSTYLETYPEDISPLAY string `json:"zsstyletypedisplay" xorm:"ZSSTYLETYPEDISPLAY"` //
|
|
|
|
|
+ ZSCZCOLOR1TYPEDISPLAY string `json:"zsczcolor1typedisplay" xorm:"ZSCZCOLOR1TYPEDISPLAY"` //
|
|
|
|
|
+ ZSCZCOLOR2TYPEDISPLAY string `json:"zsczcolor2typedisplay" xorm:"ZSCZCOLOR2TYPEDISPLAY"` //
|
|
|
|
|
+ ZSCZCOLOR3TYPEDISPLAY string `json:"zsczcolor3typedisplay" xorm:"ZSCZCOLOR3TYPEDISPLAY"` //
|
|
|
|
|
+ PRICE float64 `json:"price" xorm:"PRICE"` // 价格
|
|
|
|
|
+ PRICEPER string `json:"priceper" xorm:"PRICEPER"` // 克拉单价
|
|
|
|
|
+ SIZEDISPLAY string `json:"sizedisplay" xorm:"SIZEDISPLAY"` // 尺寸
|
|
|
|
|
+
|
|
|
|
|
+ USERID int64 `json:"-" form:"userid" binding:"required"` // 用户ID
|
|
|
|
|
+ BuyOrSell int64 `json:"buyorsell" form:"buyorsell"` // 方向 - 0:买 1:卖
|
|
|
|
|
+ BeginDate string `json:"-" form:"begindate"` // 开始交易日
|
|
|
|
|
+ EndDate string `json:"-" form:"enddate"` // 结束交易日
|
|
|
|
|
+
|
|
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *MyPerformanc) calc() {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *MyPerformanc) buildSql() string {
|
|
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ to_char(pp.PERFORMANCEPLANID) PERFORMANCEPLANID1,
|
|
|
|
|
+ to_char(pp.RELATEDORDERID) RELATEDORDERID1 ,
|
|
|
|
|
+ pp.AMOUNT ,
|
|
|
|
|
+ pp.PAYMENTTYPE ,
|
|
|
|
|
+ pp.PERFORMANCESTATUS ,
|
|
|
|
|
+ to_char(pp.CURSTEPID) CURSTEPID1 ,
|
|
|
|
|
+ pp.BUYPAIDAMOUNT ,
|
|
|
|
|
+ pp.SELLRECEIVEDAMOUNT ,
|
|
|
|
|
+ pp.BUYERFREEZEAMOUNT ,
|
|
|
|
|
+ pp.BUYERFREEZEAMOUNTREMAIN ,
|
|
|
|
|
+ pp.SELLERFREEZEAMOUNT ,
|
|
|
|
|
+ pp.SELLERFREEZEAMOUNTREMAIN,
|
|
|
|
|
+ pp.OVERSHORTAMOUNT ,
|
|
|
|
|
+ pp.BUYERINFO ,
|
|
|
|
|
+ pp.SELLERINFO ,
|
|
|
|
|
+ ps.STEPTYPEID,
|
|
|
|
|
+ ua.ACCOUNTNAME ,
|
|
|
|
|
+ wr.ZSALLPROPERTIES ,
|
|
|
|
|
+ wr.ZSCATEGORYDISPLAY ,
|
|
|
|
|
+ wr.ZSCURRENCYTYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCURRENCYTYPEDISPLAYUNIT ,
|
|
|
|
|
+ wr.WAREHOUSENAMEDISPLAY ,
|
|
|
|
|
+ wr.ZSSHAPETYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCOLORTYPE1DISPLAY ,
|
|
|
|
|
+ wr.ZSCOLORTYPE2DISPLAY ,
|
|
|
|
|
+ wr.ZSCLARITYTYPE1DISPLAY ,
|
|
|
|
|
+ wr.ZSCLARITYTYPE2DISPLAY ,
|
|
|
|
|
+ wr.ZSCUTTYPE1DISPLAY ,
|
|
|
|
|
+ wr.ZSCUTTYPE2DISPLAY ,
|
|
|
|
|
+ wr.ZSSYMMETRYTYPE1DISPLAY ,
|
|
|
|
|
+ wr.ZSSYMMETRYTYPE2DISPLAY ,
|
|
|
|
|
+ wr.ZSPOLISHTYPE1DISPLAY ,
|
|
|
|
|
+ wr.ZSPOLISHTYPE2DISPLAY ,
|
|
|
|
|
+ wr.ZSFLUORESCENCETYPE1DISPLAY,
|
|
|
|
|
+ wr.ZSFLUORESCENCETYPE2DISPLAY,
|
|
|
|
|
+ wr.ZSCERTTYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCRYSTALTYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSSTYLETYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCZCOLOR1TYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCZCOLOR2TYPEDISPLAY ,
|
|
|
|
|
+ wr.ZSCZCOLOR3TYPEDISPLAY ,
|
|
|
|
|
+ wr.PRICE ,
|
|
|
|
|
+ wr.PRICEPER ,
|
|
|
|
|
+ CASE WHEN
|
|
|
|
|
+ wr.SIZE1 IS NOT NULL AND wr.SIZE2 IS NOT NULL AND wr.SIZE2 IS NOT NULL THEN wr.SIZE1 || '*' || wr.SIZE2 || '*' || wr.SIZE3
|
|
|
|
|
+ ELSE wr.SIZE1
|
|
|
|
|
+ END AS SIZEDISPLAY
|
|
|
|
|
+ FROM PerformancePlan pp
|
|
|
|
|
+ inner join PerformanceStep ps on pp.curstepid = ps.performancestepid
|
|
|
|
|
+ inner join wrtrade_tradedetail td on pp.relatedorderid = td.wrtradedetailid
|
|
|
|
|
+ inner join taaccount ta on td.accountid = ta.accountid
|
|
|
|
|
+ inner join taaccount ta2 on td.matchaccountid = ta2.accountid
|
|
|
|
|
+ inner join useraccount ua on ta2.relateduserid = ua.userid
|
|
|
|
|
+ inner join wrfactortype ft on td.wrfactortypeid = ft.wrfactortypeid
|
|
|
|
|
+ inner join View_GZ_WRStandard_Ex_Query wr on ft.wrstandardid = wr.wrstandardid
|
|
|
|
|
+ where 1=1
|
|
|
|
|
+ `
|
|
|
|
|
+
|
|
|
|
|
+ sqlId.And("ta.relateduserid", r.USERID)
|
|
|
|
|
+ sqlId.And("td.buyorsell", r.BuyOrSell)
|
|
|
|
|
+ sqlId.AndLike("wr.ZSALLPROPERTIES", r.ZSALLPROPERTIES)
|
|
|
|
|
+ sqlId.OrderByDesc("pp.PERFORMANCEPLANID")
|
|
|
|
|
+
|
|
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
|
|
+ return sqlId.String()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *MyPerformanc) buildSql_His() string {
|
|
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ to_char(pp.PERFORMANCEPLANID) PERFORMANCEPLANID1,
|
|
|
|
|
+ pp.RELATEDORDERID ,
|
|
|
|
|
+ pp.AMOUNT ,
|
|
|
|
|
+ pp.PAYMENTTYPE ,
|
|
|
|
|
+ pp.PERFORMANCESTATUS ,
|
|
|
|
|
+ pp.CURSTEPID ,
|
|
|
|
|
+ pp.BUYPAIDAMOUNT ,
|
|
|
|
|
+ pp.SELLRECEIVEDAMOUNT ,
|
|
|
|
|
+ pp.BUYERFREEZEAMOUNT ,
|
|
|
|
|
+ pp.BUYERFREEZEAMOUNTREMAIN ,
|
|
|
|
|
+ pp.SELLERFREEZEAMOUNT ,
|
|
|
|
|
+ pp.SELLERFREEZEAMOUNTREMAIN,
|
|
|
|
|
+ pp.OVERSHORTAMOUNT ,
|
|
|
|
|
+ pp.BUYERINFO ,
|
|
|
|
|
+ pp.SELLERINFO ,
|
|
|
|
|
+ ps.STEPTYPEID,
|
|
|
|
|
+ ua.ACCOUNTNAME ,
|
|
|
|
|
+ wr.ZSALLPROPERTIES ,
|
|
|
|
|
+ w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SE wr.SIZE1
|
|
|
|
|
+ END AS SIZEDISPLAY
|
|
|
|
|
+ FROM HIS_PerformancePlan pp
|
|
|
|
|
+ inner join HIS_PerformanceStep ps on pp.curstepid = ps.performancestepid
|
|
|
|
|
+ inner join HIS_wrtrade_tradedetail td on pp.relatedorderid = td.wrtradedetailid
|
|
|
|
|
+ inner join taaccount ta on td.accountid = ta.accountid
|
|
|
|
|
+ inner join taaccount ta2 on td.matchaccountid = ta2.accountid
|
|
|
|
|
+ inner join useraccount ua on ta2.relateduserid = ua.userid
|
|
|
|
|
+ inner join wrfactortype ft on td.wrfactortypeid = ft.wrfactortypeid
|
|
|
|
|
+ inner join View_GZ_WRStandard_Ex_Query wr on ft.wrstandardid = wr.wrstandardid
|
|
|
|
|
+ where pp.isvaliddata =1 and ps.isvaliddata = 1 and td.isvaliddata = 1
|
|
|
|
|
+ `
|
|
|
|
|
+
|
|
|
|
|
+ sqlId.And("ta.relateduserid", r.USERID)
|
|
|
|
|
+ sqlId.And("td.buyorsell", r.BuyOrSell)
|
|
|
|
|
+ sqlId.AndLike("wr.ZSALLPROPERTIES", r.ZSALLPROPERTIES)
|
|
|
|
|
+ if r.BeginDate != "" && r.EndDate != "" {
|
|
|
|
|
+ sqlId.JoinFormat(" AND (pp.createtime between to_date('%v', 'yyyyMMdd') and to_date('%v', 'yyyyMMdd'))", r.BeginDate, r.EndDate)
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlId.OrderByDesc("pp.PERFORMANCEPLANID")
|
|
|
|
|
+
|
|
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
|
|
+ return sqlId.String()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *MyPerformanc) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
|
|
+ sData := make([]MyPerformanc, 0)
|
|
|
|
|
+ sql := ""
|
|
|
|
|
+ if r.BeginDate != "" && r.EndDate != "" {
|
|
|
|
|
+ sql = r.buildSql_His()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sql = r.buildSql()
|
|
|
|
|
+ }
|
|
|
|
|
+ err := db.GetEngine().SQL(sql).Find(&sData)
|
|
|
|
|
+ total := 0
|
|
|
|
|
+ for i := range sData {
|
|
|
|
|
+ sData[i].calc()
|
|
|
|
|
+ total = sData[i].Total
|
|
|
|
|
+ }
|
|
|
|
|
+ return sData, err, r.Page, r.PageSize, total
|
|
|
|
|
+}
|