Browse Source

查履约信息接口增加履约类型名称字段

zou.yingbin 4 years ago
parent
commit
0f220ad158
4 changed files with 102 additions and 82 deletions
  1. 4 0
      docs/docs.go
  2. 4 0
      docs/swagger.json
  3. 3 0
      docs/swagger.yaml
  4. 91 82
      models/wrTrade2.go

+ 4 - 0
docs/docs.go

@@ -32537,6 +32537,10 @@ var doc = `{
                     "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
                     "type": "integer"
                 },
+                "typename": {
+                    "description": "履约类型 名称",
+                    "type": "string"
+                },
                 "unpaidamount": {
                     "description": "剩余款(待支付金额)",
                     "type": "number"

+ 4 - 0
docs/swagger.json

@@ -32521,6 +32521,10 @@
                     "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
                     "type": "integer"
                 },
+                "typename": {
+                    "description": "履约类型 名称",
+                    "type": "string"
+                },
                 "unpaidamount": {
                     "description": "剩余款(待支付金额)",
                     "type": "number"

+ 3 - 0
docs/swagger.yaml

@@ -14756,6 +14756,9 @@ definitions:
         description: 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票
           8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“
         type: integer
+      typename:
+        description: 履约类型 名称
+        type: string
       unpaidamount:
         description: 剩余款(待支付金额)
         type: number

+ 91 - 82
models/wrTrade2.go

@@ -1267,6 +1267,7 @@ type WrPerformancePlan struct {
 	CURSTEPNAME  string `json:"curstepname"  xorm:"'CURSTEPNAME'"`   // 当前步骤名称
 	BUYUSERNAME  string `json:"buyusername"  xorm:"'BUYUSERNAME'"`   // 买方名字
 	SELLUSERNAME string `json:"sellusername"  xorm:"'SELLUSERNAME'"` // 卖方名字
+	TYPENAME     string `json:"typename"  xorm:"'TYPENAME'"`         // 履约类型 名称
 
 	USERID       int64    `json:"userid" form:"userid" binding:"required"` // 用户id
 	BUYORSELL    int32    `json:"buyorsell" form:"buyorsell"`              // 买卖方向 0-买 1-卖
@@ -1281,88 +1282,96 @@ func (r *WrPerformancePlan) calc() {
 }
 
 func (r *WrPerformancePlan) buildSql() string {
-	var sqlId utils.SQLVal = "with tmp as" +
-		" (select to_char(t.wrfactortypeid) wrfactortypeid," +
-		"         t.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.PERFORMANCEPLANID) PERFORMANCEPLANID," +
-		"       t.PERFORMANCETYPE," +
-		"       to_char(t.RELATEDORDERID) RELATEDORDERID," +
-		"       t.AMOUNT," +
-		"       t.PAYMENTTYPE," +
-		"       t.PERFORMANCESTATUS," +
-		"       to_char(t.CURSTEPID) CURSTEPID," +
-		"       t.BUYACCOUNTID," +
-		"       t.WRTRANSFERUSERID," +
-		"       t.BUYPAIDAMOUNT," +
-		"       t.SELLACCOUNTID," +
-		"       t.SELLRECEIVEDAMOUNT," +
-		"       t.BUYTODAYAMOUNT," +
-		"       t.SELLTODAYAMOUNT," +
-		"       to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
-		"       t.CREATORID," +
-		"       t.REMARK," +
-		"       t.BUYERFREEZEAMOUNT," +
-		"       t.BUYERFREEZEAMOUNTREMAIN," +
-		"       t.SELLERFREEZEAMOUNT," +
-		"       t.SELLERFREEZEAMOUNTREMAIN," +
-		"       t.OVERSHORTAMOUNT," +
-		"       t.HASOVERSHORT," +
-		"       t.SHIPREMARK," +
-		"       t.MIDDLEUSERID," +
-		"       t.MIDDLEACCOUNTID," +
-		"       t.HASWR," +
-		"       t.BUYERINFO," +
-		"       t.SELLERINFO," +
-		"       t.OVERSHORTQTY," +
-		"       t.MARKETID," +
-		"       t.EXPRESSFEECONFIRMED," +
-		"       t.EXPRESSFEE," +
-		"       t.CONTRACTID," +
-		"       to_char(t.CURSTEPDEADLINE, 'yyyy-mm-dd hh24:mi:ss') CURSTEPDEADLINE," +
-		"       t.QTY," +
-		"       t.activatemonth," +
-		"       u1.accountname buyusername," +
-		"       u2.accountname sellusername," +
-		"       s.steptypename CURSTEPNAME," +
-		"       s.steptypeid," +
-		"       to_char(k.starttime, 'yyyy-mm-dd hh24:mi:ss') starttime," +
-		"       tmp.*" +
-		"  from performanceplan t" +
-		"  left join taaccount a1" +
-		"    on t.buyaccountid = a1.accountid" +
-		"  left join useraccount u1" +
-		"    on a1.userid = u1.userid" +
-		"  left join taaccount a2" +
-		"    on t.sellaccountid = a2.accountid" +
-		"  left join useraccount u2" +
-		"    on a2.userid = u2.userid" +
-		"  left join performancestep k on t.curstepid= k.performancestepid" +
-		"  left join performancesteptype s" +
-		"    on k.steptypeid = s.steptypeid" +
-		"  left join performanceplanwr f on t.performanceplanid = f.performanceplanid" +
-		"  left join tmp" +
-		"    on f.wrfactortypeid = tmp.wrfactortypeid" +
-		" where 1 = 1"
+	var sqlId utils.SQLVal = `
+with tmp as
+ (select to_char(t.wrfactortypeid) wrfactortypeid,
+         t.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.PERFORMANCEPLANID) PERFORMANCEPLANID,
+       t.PERFORMANCETYPE,
+       to_char(t.RELATEDORDERID) RELATEDORDERID,
+       t.AMOUNT,
+       t.PAYMENTTYPE,
+       t.PERFORMANCESTATUS,
+       to_char(t.CURSTEPID) CURSTEPID,
+       t.BUYACCOUNTID,
+       t.WRTRANSFERUSERID,
+       t.BUYPAIDAMOUNT,
+       t.SELLACCOUNTID,
+       t.SELLRECEIVEDAMOUNT,
+       t.BUYTODAYAMOUNT,
+       t.SELLTODAYAMOUNT,
+       to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME,
+       t.CREATORID,
+       t.REMARK,
+       t.BUYERFREEZEAMOUNT,
+       t.BUYERFREEZEAMOUNTREMAIN,
+       t.SELLERFREEZEAMOUNT,
+       t.SELLERFREEZEAMOUNTREMAIN,
+       t.OVERSHORTAMOUNT,
+       t.HASOVERSHORT,
+       t.SHIPREMARK,
+       t.MIDDLEUSERID,
+       t.MIDDLEACCOUNTID,
+       t.HASWR,
+       t.BUYERINFO,
+       t.SELLERINFO,
+       t.OVERSHORTQTY,
+       t.MARKETID,
+       t.EXPRESSFEECONFIRMED,
+       t.EXPRESSFEE,
+       t.CONTRACTID,
+       to_char(t.CURSTEPDEADLINE, 'yyyy-mm-dd hh24:mi:ss') CURSTEPDEADLINE,
+       t.QTY,
+       t.activatemonth,
+       u1.accountname buyusername,
+       u2.accountname sellusername,
+       s.steptypename CURSTEPNAME,
+       s.steptypeid,
+       to_char(k.starttime, 'yyyy-mm-dd hh24:mi:ss') starttime,
+       tmp.*,
+       case when m.trademode=17 and t.haswr=1 then '仓单贸易'
+         when m.trademode=17 and t.haswr=0 then '仓单预售' else
+           m.marketname end as typename
+  from performanceplan t
+  left join taaccount a1
+    on t.buyaccountid = a1.accountid
+  left join useraccount u1
+    on a1.userid = u1.userid
+  left join taaccount a2
+    on t.sellaccountid = a2.accountid
+  left join useraccount u2
+    on a2.userid = u2.userid
+  left join performancestep k
+    on t.curstepid = k.performancestepid
+  left join performancesteptype s
+    on k.steptypeid = s.steptypeid
+  left join performanceplanwr f
+    on t.performanceplanid = f.performanceplanid
+  left join tmp
+    on f.wrfactortypeid = tmp.wrfactortypeid
+  left join market m on t.marketid=m.marketid
+ where 1 = 1 and m.trademode > 0
+`
 	if r.BUYORSELL == 0 {
 		sqlId.And("u1.userid", r.USERID)
 	} else {