Sfoglia il codice sorgente

1.查询成交明细 增加首付比例、支付金额等字段(app)
2.查询充值提现审核 解密银行卡号等字段(pcbweb/app)
3.查询提货单 增加用户类型、登录账号字段(pcweb)
4.查询持仓汇总 成本价保留3位小数(app #96004)
5.#96020 提货门店重复显示(app)

zou.yingbin 4 anni fa
parent
commit
571f902e65
7 ha cambiato i file con 181 aggiunte e 26 eliminazioni
  1. 39 17
      controllers/order/order.go
  2. 45 1
      docs/docs.go
  3. 45 1
      docs/swagger.json
  4. 34 1
      docs/swagger.yaml
  5. 1 0
      go.mod
  6. 15 5
      models/qhj.go
  7. 2 1
      models/qhjPCWeb.go

+ 39 - 17
controllers/order/order.go

@@ -10,12 +10,11 @@ import (
 	"mtp2_if/logger"
 	"mtp2_if/models"
 	"mtp2_if/mtpcache"
-	"mtp2_if/utils"
 	"net/http"
-	"strconv"
 	"time"
 
 	"github.com/gin-gonic/gin"
+	"github.com/shopspring/decimal"
 )
 
 type QtyCovert struct {
@@ -27,6 +26,16 @@ func (r *QtyCovert) CovertQty(v int64) float64 {
 	return float64(v) / math.Pow10(int(r.QTYDECIMALPLACE))
 }
 
+// 成交付款信息
+type TradePayInfo struct {
+	PAYAMOUNT    float64 `json:"payamount"  xorm:"PAYAMOUNT"`       // 支付金额(付款金额)
+	ADVANCERATIO float64 `json:"advanceratio"  xorm:"ADVANCERATIO"` // 首付比率
+	TRADECHARGE  float64 `json:"-"  xorm:"TRADECHARGE"`             // 成交手续费(买方)
+
+	TOTALAMOUNT float64 `json:"totalamount"` // 订单总额 = 成交金额 + 手续费
+	RECVAMOUNT  float64 `json:"recvamount"`  // 到账金额 = 成交金额 - 手续费
+}
+
 // QueryTradePositionReq 持仓汇总查询请求参数(合约市场)
 type QueryTradePositionReq struct {
 	AccountID string `form:"accountID" binding:"required"`
@@ -131,7 +140,7 @@ func QueryTradePosition(c *gin.Context) {
 			if jsonBytes, err := json.Marshal(v); err == nil {
 				c := QtyCovert{QTYDECIMALPLACE: v.QTYDECIMALPLACE}
 				// json -> struct
-				json.Unmarshal(jsonBytes, &tradePosition)
+				_ = json.Unmarshal(jsonBytes, &tradePosition)
 				tradePosition.BuyOrSell = 0
 				tradePosition.PositionQTY = c.CovertQty(v.Buypositionqty)
 				tradePosition.HolderAmount = v.Buyholderamount
@@ -149,7 +158,9 @@ func QueryTradePosition(c *gin.Context) {
 				tradePosition.EnableQTY = c.CovertQty(v.Buycurpositionqty - v.Buyfrozenqty - v.Buyotherfrozenqty)
 				// 计算持仓均价
 				averagePrice := tradePosition.CurHolderAmount / float64(tradePosition.CurPositionQTY) / tradePosition.AgreeUnit
-				tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
+				//tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
+				// #96004 改为固定3位小数
+				tradePosition.AveragePrice, _ = decimal.NewFromFloat(averagePrice).Round(3).Float64()
 				rst = append(rst, tradePosition)
 			}
 		}
@@ -162,7 +173,7 @@ func QueryTradePosition(c *gin.Context) {
 			if jsonBytes, err := json.Marshal(v); err == nil {
 				c := QtyCovert{QTYDECIMALPLACE: v.QTYDECIMALPLACE}
 				// json -> struct
-				json.Unmarshal(jsonBytes, &tradePosition)
+				_ = json.Unmarshal(jsonBytes, &tradePosition)
 				tradePosition.BuyOrSell = 1
 				tradePosition.PositionQTY = c.CovertQty(v.Sellpositionqty)
 				tradePosition.HolderAmount = v.Sellholderamount
@@ -180,7 +191,9 @@ func QueryTradePosition(c *gin.Context) {
 				tradePosition.EnableQTY = c.CovertQty(v.Sellcurpositionqty - v.Sellfrozenqty - v.Sellotherfrozenqty)
 				// 计算持仓均价
 				averagePrice := tradePosition.CurHolderAmount / float64(tradePosition.CurPositionQTY) / tradePosition.AgreeUnit
-				tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
+				//tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
+				// #96004 改为固定3位小数
+				tradePosition.AveragePrice, _ = decimal.NewFromFloat(averagePrice).Round(3).Float64()
 
 				rst = append(rst, tradePosition)
 			}
@@ -445,15 +458,15 @@ type QueryTradeDetailReq struct {
 // QueryTradeDetailRsp 成交单查询返回模型
 type QueryTradeDetailRsp struct {
 	models.Tradetradedetail `xorm:"extends"`
-
-	GoodsCode         string `json:"goodscode" xorm:"GOODSCODE"`                    // 商品代码
-	GoodsName         string `json:"goodsname" xorm:"GOODSNAME"`                    // 商品名称
-	DECIMALPLACE      int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`           // 商品报价小数位
-	QTYDECIMALPLACE   int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`     // 商品报价小数位
-	GOODUNITID        int32  `json:"goodunitid"  xorm:"'GOODUNITID'"`               // 商品单位id
-	Marketname        string `json:"marketname"  xorm:"'MARKETNAME'"`               // 市场名称
-	TradeMode         int32  `json:"trademode"  xorm:"'TRADEMODE'"`                 // 交易模式
-	ListingSelectType int32  `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"` // 关联委托单挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
+	TradePayInfo            `xorm:"extends"`
+	GoodsCode               string `json:"goodscode" xorm:"GOODSCODE"`                    // 商品代码
+	GoodsName               string `json:"goodsname" xorm:"GOODSNAME"`                    // 商品名称
+	DECIMALPLACE            int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`           // 商品报价小数位
+	QTYDECIMALPLACE         int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`     // 商品报价小数位
+	GOODUNITID              int32  `json:"goodunitid"  xorm:"'GOODUNITID'"`               // 商品单位id
+	Marketname              string `json:"marketname"  xorm:"'MARKETNAME'"`               // 市场名称
+	TradeMode               int32  `json:"trademode"  xorm:"'TRADEMODE'"`                 // 交易模式
+	ListingSelectType       int32  `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"` // 关联委托单挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
 
 	Charge      float64 `json:"charge" xorm:"CHARGE"` // 手续费
 	ENUMDICNAME string  `json:"enumdicname"`          // 单位名称
@@ -467,6 +480,9 @@ func (r *QueryTradeDetailRsp) calc() {
 	fCovert(&r.Openqty)
 	fCovert(&r.Closeqty)
 	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODUNITID)
+
+	r.TOTALAMOUNT = r.Tradeamount + r.Opencharge + r.Closecharge
+	r.RECVAMOUNT = r.Tradeamount - r.Opencharge - r.Closecharge
 }
 
 // QueryTradeDetail 成交单查询(合约市场)
@@ -502,10 +518,11 @@ func QueryTradeDetail(c *gin.Context) {
 		Join("LEFT", "GOODS", "GOODS.GOODSID = TRADE_TRADEDETAIL.GOODSID").
 		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_TRADEDETAIL.MARKETID").
 		Join("LEFT", "TRADE_ORDERDETAIL", "TRADE_ORDERDETAIL.ORDERID = TRADE_TRADEDETAIL.ORDERID").
+		Join("LEFT", "TRADE_PAYORDER", "TRADE_PAYORDER.TRADEID = TRADE_TRADEDETAIL.TRADEID").
 		Select(`to_char(TRADE_TRADEDETAIL.TRADEID) as TRADEID, to_char(TRADE_TRADEDETAIL.ORDERID) as ORDERID, 
 				TRADE_TRADEDETAIL.*, CASE TRADE_TRADEDETAIL.BUILDTYPE WHEN 1 THEN TRADE_TRADEDETAIL.OPENCHARGE ELSE TRADE_TRADEDETAIL.CLOSECHARGE END as CHARGE,
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE,GOODS.GOODUNITID, MARKET.MARKETNAME, MARKET.TRADEMODE, 
-				TRADE_ORDERDETAIL.LISTINGSELECTTYPE`).
+				TRADE_ORDERDETAIL.LISTINGSELECTTYPE, TRADE_PAYORDER.ADVANCERATIO, TRADE_PAYORDER.PAYAMOUNT, TRADE_PAYORDER.TRADECHARGE`).
 		Where(fmt.Sprintf("TRADE_TRADEDETAIL.TRADETYPE <= 13 and TRADE_TRADEDETAIL.ACCOUNTID in (%s)", req.AccountID)).
 		Desc("TRADE_TRADEDETAIL.TRADETIME")
 	if req.TradeID > 0 {
@@ -557,6 +574,7 @@ type QueryHisTradeDetailReq struct {
 // QueryHisTradeDetailRsp 历史成交单查询返回模型
 type QueryHisTradeDetailRsp struct {
 	models.Histradetradedetail `xorm:"extends"`
+	TradePayInfo               `xorm:"extends"`
 
 	GoodsCode         string `json:"goodscode" xorm:"GOODSCODE"`                    // 商品代码
 	GoodsName         string `json:"goodsname" xorm:"GOODSNAME"`                    // 商品名称
@@ -579,6 +597,9 @@ func (r *QueryHisTradeDetailRsp) calc() {
 	fCovert(&r.Openqty)
 	fCovert(&r.Closeqty)
 	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODUNITID)
+
+	r.TOTALAMOUNT = r.Tradeamount + r.Opencharge + r.Closecharge
+	r.RECVAMOUNT = r.Tradeamount - r.Opencharge - r.Closecharge
 }
 
 // QueryHisTradeDetail 历史成交单查询(合约市场)
@@ -616,10 +637,11 @@ func QueryHisTradeDetail(c *gin.Context) {
 		Join("LEFT", "GOODS", "GOODS.GOODSID = HIS_TRADE_TRADEDETAIL.GOODSID").
 		Join("LEFT", "MARKET", "MARKET.MARKETID = HIS_TRADE_TRADEDETAIL.MARKETID").
 		Join("LEFT", "HIS_TRADE_ORDERDETAIL", "HIS_TRADE_ORDERDETAIL.ORDERID = HIS_TRADE_TRADEDETAIL.ORDERID").
+		Join("LEFT", "TRADE_PAYORDER", "TRADE_PAYORDER.TRADEID = HIS_TRADE_TRADEDETAIL.TRADEID").
 		Select(`to_char(HIS_TRADE_TRADEDETAIL.TRADEID) as TRADEID, to_char(HIS_TRADE_TRADEDETAIL.ORDERID) as ORDERID, 
 				HIS_TRADE_TRADEDETAIL.*, CASE HIS_TRADE_TRADEDETAIL.BUILDTYPE WHEN 1 THEN HIS_TRADE_TRADEDETAIL.OPENCHARGE ELSE HIS_TRADE_TRADEDETAIL.CLOSECHARGE END as CHARGE,
 				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE, GOODS.GOODUNITID, MARKET.MARKETNAME, MARKET.TRADEMODE, 
-				HIS_TRADE_ORDERDETAIL.LISTINGSELECTTYPE`).
+				HIS_TRADE_ORDERDETAIL.LISTINGSELECTTYPE, TRADE_PAYORDER.ADVANCERATIO, TRADE_PAYORDER.PAYAMOUNT, TRADE_PAYORDER.TRADECHARGE`).
 		Where(fmt.Sprintf("HIS_TRADE_TRADEDETAIL.TRADETYPE <= 13 and HIS_TRADE_TRADEDETAIL.ISVALIDDATA = 1 and HIS_TRADE_TRADEDETAIL.ACCOUNTID in (%s)", req.AccountID)).
 		Desc("HIS_TRADE_TRADEDETAIL.TRADETIME")
 	if req.TradeID > 0 {

+ 45 - 1
docs/docs.go

@@ -23452,6 +23452,10 @@ var doc = `{
         "models.QhjPayOrder": {
             "type": "object",
             "properties": {
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buyaccountid": {
                     "description": "买方账号ID[报价币种]",
                     "type": "integer"
@@ -23501,7 +23505,7 @@ var doc = `{
                     "type": "integer"
                 },
                 "payamount": {
-                    "description": "支付金额=TradeAmount + TradeCharge",
+                    "description": "支付金额",
                     "type": "number"
                 },
                 "payflag": {
@@ -24199,6 +24203,10 @@ var doc = `{
                     "description": "处理状态",
                     "type": "integer"
                 },
+                "logincode": {
+                    "description": "账号(登录代码, 有可能为空)",
+                    "type": "string"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
@@ -24291,6 +24299,10 @@ var doc = `{
                     "description": "用户ID",
                     "type": "integer"
                 },
+                "userinfotype": {
+                    "description": "客户类型 1-个人 2-企业",
+                    "type": "integer"
+                },
                 "username": {
                     "description": "用户名称",
                     "type": "string"
@@ -25837,6 +25849,10 @@ var doc = `{
                     "description": "账户ID[报价币种]",
                     "type": "integer"
                 },
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buildtype": {
                     "description": "委托单据类型 1:建仓 2:平仓 3:先平后建",
                     "type": "integer"
@@ -25985,6 +26001,10 @@ var doc = `{
                     "description": "委托单号",
                     "type": "string"
                 },
+                "payamount": {
+                    "description": "支付金额(付款金额)",
+                    "type": "number"
+                },
                 "performanceplanid": {
                     "description": "履约计划ID[期权]",
                     "type": "integer"
@@ -26005,6 +26025,10 @@ var doc = `{
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "recvamount": {
+                    "description": "到账金额 = 成交金额 - 手续费",
+                    "type": "number"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -26013,6 +26037,10 @@ var doc = `{
                     "description": "处理状态 - 1:待处理 2:已处理 3:处理失败",
                     "type": "integer"
                 },
+                "totalamount": {
+                    "description": "订单总额 = 成交金额 + 手续费",
+                    "type": "number"
+                },
                 "tradeamount": {
                     "description": "成交金额[账户币种,用于所有权]",
                     "type": "number"
@@ -26381,6 +26409,10 @@ var doc = `{
                     "description": "账户ID[报价币种]",
                     "type": "integer"
                 },
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buildtype": {
                     "description": "委托单据类型 1:建仓 2:平仓 3:先平后建",
                     "type": "integer"
@@ -26521,6 +26553,10 @@ var doc = `{
                     "description": "委托单号",
                     "type": "string"
                 },
+                "payamount": {
+                    "description": "支付金额(付款金额)",
+                    "type": "number"
+                },
                 "performanceplanid": {
                     "description": "履约计划ID[期权]",
                     "type": "integer"
@@ -26541,6 +26577,10 @@ var doc = `{
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "recvamount": {
+                    "description": "到账金额 = 成交金额 - 手续费",
+                    "type": "number"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -26549,6 +26589,10 @@ var doc = `{
                     "description": "处理状态 - 1:待处理 2:已处理 3:处理失败",
                     "type": "integer"
                 },
+                "totalamount": {
+                    "description": "订单总额 = 成交金额 + 手续费",
+                    "type": "number"
+                },
                 "tradeamount": {
                     "description": "成交金额[账户币种,用于所有权]",
                     "type": "number"

+ 45 - 1
docs/swagger.json

@@ -23436,6 +23436,10 @@
         "models.QhjPayOrder": {
             "type": "object",
             "properties": {
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buyaccountid": {
                     "description": "买方账号ID[报价币种]",
                     "type": "integer"
@@ -23485,7 +23489,7 @@
                     "type": "integer"
                 },
                 "payamount": {
-                    "description": "支付金额=TradeAmount + TradeCharge",
+                    "description": "支付金额",
                     "type": "number"
                 },
                 "payflag": {
@@ -24183,6 +24187,10 @@
                     "description": "处理状态",
                     "type": "integer"
                 },
+                "logincode": {
+                    "description": "账号(登录代码, 有可能为空)",
+                    "type": "string"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
@@ -24275,6 +24283,10 @@
                     "description": "用户ID",
                     "type": "integer"
                 },
+                "userinfotype": {
+                    "description": "客户类型 1-个人 2-企业",
+                    "type": "integer"
+                },
                 "username": {
                     "description": "用户名称",
                     "type": "string"
@@ -25821,6 +25833,10 @@
                     "description": "账户ID[报价币种]",
                     "type": "integer"
                 },
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buildtype": {
                     "description": "委托单据类型 1:建仓 2:平仓 3:先平后建",
                     "type": "integer"
@@ -25969,6 +25985,10 @@
                     "description": "委托单号",
                     "type": "string"
                 },
+                "payamount": {
+                    "description": "支付金额(付款金额)",
+                    "type": "number"
+                },
                 "performanceplanid": {
                     "description": "履约计划ID[期权]",
                     "type": "integer"
@@ -25989,6 +26009,10 @@
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "recvamount": {
+                    "description": "到账金额 = 成交金额 - 手续费",
+                    "type": "number"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -25997,6 +26021,10 @@
                     "description": "处理状态 - 1:待处理 2:已处理 3:处理失败",
                     "type": "integer"
                 },
+                "totalamount": {
+                    "description": "订单总额 = 成交金额 + 手续费",
+                    "type": "number"
+                },
                 "tradeamount": {
                     "description": "成交金额[账户币种,用于所有权]",
                     "type": "number"
@@ -26365,6 +26393,10 @@
                     "description": "账户ID[报价币种]",
                     "type": "integer"
                 },
+                "advanceratio": {
+                    "description": "首付比率",
+                    "type": "number"
+                },
                 "buildtype": {
                     "description": "委托单据类型 1:建仓 2:平仓 3:先平后建",
                     "type": "integer"
@@ -26505,6 +26537,10 @@
                     "description": "委托单号",
                     "type": "string"
                 },
+                "payamount": {
+                    "description": "支付金额(付款金额)",
+                    "type": "number"
+                },
                 "performanceplanid": {
                     "description": "履约计划ID[期权]",
                     "type": "integer"
@@ -26525,6 +26561,10 @@
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "recvamount": {
+                    "description": "到账金额 = 成交金额 - 手续费",
+                    "type": "number"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -26533,6 +26573,10 @@
                     "description": "处理状态 - 1:待处理 2:已处理 3:处理失败",
                     "type": "integer"
                 },
+                "totalamount": {
+                    "description": "订单总额 = 成交金额 + 手续费",
+                    "type": "number"
+                },
                 "tradeamount": {
                     "description": "成交金额[账户币种,用于所有权]",
                     "type": "number"

+ 34 - 1
docs/swagger.yaml

@@ -10203,6 +10203,9 @@ definitions:
     type: object
   models.QhjPayOrder:
     properties:
+      advanceratio:
+        description: 首付比率
+        type: number
       buyaccountid:
         description: 买方账号ID[报价币种]
         type: integer
@@ -10240,7 +10243,7 @@ definitions:
         description: 买委托操作类型 - 1:正常下单 16:融资买入
         type: integer
       payamount:
-        description: 支付金额=TradeAmount + TradeCharge
+        description: 支付金额
         type: number
       payflag:
         description: 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止
@@ -10758,6 +10761,9 @@ definitions:
       handlestatus:
         description: 处理状态
         type: integer
+      logincode:
+        description: 账号(登录代码, 有可能为空)
+        type: string
       marketid:
         description: 市场ID
         type: integer
@@ -10828,6 +10834,9 @@ definitions:
       userid:
         description: 用户ID
         type: integer
+      userinfotype:
+        description: 客户类型 1-个人 2-企业
+        type: integer
       username:
         description: 用户名称
         type: string
@@ -11966,6 +11975,9 @@ definitions:
       accountid:
         description: 账户ID[报价币种]
         type: integer
+      advanceratio:
+        description: 首付比率
+        type: number
       buildtype:
         description: 委托单据类型 1:建仓 2:平仓 3:先平后建
         type: integer
@@ -12077,6 +12089,9 @@ definitions:
       orderid:
         description: 委托单号
         type: string
+      payamount:
+        description: 支付金额(付款金额)
+        type: number
       performanceplanid:
         description: 履约计划ID[期权]
         type: integer
@@ -12092,12 +12107,18 @@ definitions:
       qtydecimalplace:
         description: 商品报价小数位
         type: integer
+      recvamount:
+        description: 到账金额 = 成交金额 - 手续费
+        type: number
       relatedouttradeid:
         description: 关联外部成交单ID
         type: integer
       status:
         description: 处理状态 - 1:待处理 2:已处理 3:处理失败
         type: integer
+      totalamount:
+        description: 订单总额 = 成交金额 + 手续费
+        type: number
       tradeamount:
         description: 成交金额[账户币种,用于所有权]
         type: number
@@ -12386,6 +12407,9 @@ definitions:
       accountid:
         description: 账户ID[报价币种]
         type: integer
+      advanceratio:
+        description: 首付比率
+        type: number
       buildtype:
         description: 委托单据类型 1:建仓 2:平仓 3:先平后建
         type: integer
@@ -12491,6 +12515,9 @@ definitions:
       orderid:
         description: 委托单号
         type: string
+      payamount:
+        description: 支付金额(付款金额)
+        type: number
       performanceplanid:
         description: 履约计划ID[期权]
         type: integer
@@ -12506,12 +12533,18 @@ definitions:
       qtydecimalplace:
         description: 商品报价小数位
         type: integer
+      recvamount:
+        description: 到账金额 = 成交金额 - 手续费
+        type: number
       relatedouttradeid:
         description: 关联外部成交单ID
         type: integer
       status:
         description: 处理状态 - 1:待处理 2:已处理 3:处理失败
         type: integer
+      totalamount:
+        description: 订单总额 = 成交金额 + 手续费
+        type: number
       tradeamount:
         description: 成交金额[账户币种,用于所有权]
         type: number

+ 1 - 0
go.mod

@@ -41,6 +41,7 @@ require (
 	github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
 	github.com/russross/blackfriday/v2 v2.1.0 // indirect
 	github.com/satori/go.uuid v1.2.0 // indirect
+	github.com/shopspring/decimal v1.2.0
 	github.com/sirupsen/logrus v1.4.2
 	github.com/streadway/amqp v1.0.0
 	github.com/stretchr/objx v0.2.0 // indirect

+ 15 - 5
models/qhj.go

@@ -523,6 +523,8 @@ type QhjTradeGoodsPickup struct {
 	GOODSNAME            string  `json:"goodsname"  xorm:"'GOODSNAME'"`                     // 商品名称
 	GOODSCODE            string  `json:"goodscode"  xorm:"'GOODSCODE'"`                     // 商品代码
 	DECIMALPLACE         int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`               // 商品报价小数位
+	LOGINCODE            string  `json:"logincode"  xorm:"'LOGINCODE'"`                     // 账号(登录代码, 有可能为空)
+	USERINFOTYPE         int32   `json:"userinfotype"  xorm:"'USERINFOTYPE'"`               // 客户类型 1-个人 2-企业
 
 	ENUMDICNAME   string `json:"enumdicname"`   // 单位名称(提货商品)
 	USERNAME      string `json:"username"`      // 用户名称
@@ -544,7 +546,8 @@ func (r *QhjTradeGoodsPickup) calc() {
 }
 
 func (r *QhjTradeGoodsPickup) buildSql() string {
-	var sqlId utils.SQLVal = "SELECT t.AUDITSRC," +
+	var sqlId utils.SQLVal = "with k as (select t.userid, wm_concat(t.logincode) logincode from loginaccount t group by t.userid)" +
+		"SELECT t.AUDITSRC," +
 		"       t.STOREUSERID," +
 		"       t.ARTRADEDATE," +
 		"       t.EXPRESSCOMPANY," +
@@ -588,7 +591,9 @@ func (r *QhjTradeGoodsPickup) buildSql() string {
 		"       g.PICKUPGOODSUNITID," +
 		"       g2.goodsname," +
 		"       g2.decimalplace," +
-		"       g2.goodscode" +
+		"       g2.goodscode," +
+		"       u.userinfotype," +
+		"       k.logincode" +
 		"  FROM TRADE_GOODSPICKUP t" +
 		"  LEFT JOIN TRADE_GOODSPICKUPDETAIL k" +
 		"    on t.takeorderid = k.takeorderid" +
@@ -598,6 +603,7 @@ func (r *QhjTradeGoodsPickup) buildSql() string {
 		"    on t.goodsid = g2.goodsid" +
 		"  LEFT JOIN USERINFO u" +
 		"    on t.storeuserid = u.userid" +
+		"  LEFT JOIN k on t.userid=k.userid" +
 		" WHERE 1 = 1"
 	// 获取角色=20组织的角色数据, 判断机构类型
 	m := QhjAreaRole{USERID: r.USERID, ROLETYPE: 20}
@@ -741,7 +747,7 @@ func (r *QhjPickArea) calc() {
 }
 
 func (r *QhjPickArea) buildSql() string {
-	var sqlId utils.SQLVal = "SELECT t.FROMUSERID," +
+	var sqlId utils.SQLVal = "SELECT distinct t.FROMUSERID," +
 		"       t.SUBORGTYPE," +
 		"       t.USERID," +
 		"       t.ROLETYPE," +
@@ -767,6 +773,7 @@ func (r *QhjPickArea) buildSql() string {
 		"  LEFT JOIN USERINFO u on t.userid=u.userid" +
 		" WHERE 1 = 1"
 	sqlId.And("t.SUBORGTYPE", 2)
+	sqlId.And("t.roletype", 99)
 	return sqlId.String()
 }
 
@@ -1469,7 +1476,8 @@ type QhjAccountOutInApply struct {
 }
 
 func (r *QhjAccountOutInApply) calc() {
-
+	r.BANKACCOUNTNAME = DecryptField(r.BANKACCOUNTNAME)
+	r.BANKACCOUNTNO = DecryptField(r.BANKACCOUNTNO)
 }
 
 func (r *QhjAccountOutInApply) buildSql() string {
@@ -1580,12 +1588,13 @@ type QhjPayOrder struct {
 	OFFAMOUNT       float64 `json:"offamount"  xorm:"OFFAMOUNT"`               // 优惠金额
 	TRADEPRICE      float64 `json:"tradeprice"  xorm:"TRADEPRICE"`             // 成交价格
 	TRADEQTY        float64 `json:"tradeqty"  xorm:"TRADEQTY"`                 // 成交数量
-	PAYAMOUNT       float64 `json:"payamount"  xorm:"PAYAMOUNT"`               // 支付金额=TradeAmount + TradeCharge
+	PAYAMOUNT       float64 `json:"payamount"  xorm:"PAYAMOUNT"`               // 支付金额
 	GOODSCODE       string  `json:"goodscode"  xorm:"'GOODSCODE'"`             // 商品代码
 	GOODSNAME       string  `json:"goodsname"  xorm:"'GOODSNAME'"`             // 商品名称
 	GOODUNITID      int32   `json:"goodunitid"  xorm:"'GOODUNITID'"`           // 商品单位id
 	DECIMALPLACE    int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`       // 商品报价小数位
 	QTYDECIMALPLACE int     `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"` // 成交量小数位
+	ADVANCERATIO    float64 `json:"advanceratio"  xorm:"ADVANCERATIO"`         // 首付比率
 	ENUMDICNAME     string  `json:"enumdicname"`                               // 单位名称
 }
 
@@ -1615,6 +1624,7 @@ func (r *QhjPayOrder) buildSql() string {
 		"       t.TRADEPRICE," +
 		"       t.TRADEQTY," +
 		"       t.PAYAMOUNT," +
+		"       t.ADVANCERATIO," +
 		"       g.goodscode," +
 		"       g.decimalplace," +
 		"       g.qtydecimalplace," +

+ 2 - 1
models/qhjPCWeb.go

@@ -310,7 +310,8 @@ type QhjMgrAccountOutInApply struct {
 }
 
 func (r *QhjMgrAccountOutInApply) calc() {
-
+	r.BANKACCOUNTNAME = DecryptField(r.BANKACCOUNTNAME)
+	r.BANKACCOUNTNO = DecryptField(r.BANKACCOUNTNO)
 }
 
 func (r *QhjMgrAccountOutInApply) buildSql() string {