Jelajahi Sumber

增加“商品提货单查询”接口

Simon Zhou 5 tahun lalu
induk
melakukan
6460f28fa2
7 mengubah file dengan 445 tambahan dan 3 penghapusan
  1. 3 3
      controllers/order/order.go
  2. 49 0
      controllers/szdz/szdz.go
  3. 133 0
      docs/docs.go
  4. 133 0
      docs/swagger.json
  5. 93 0
      docs/swagger.yaml
  6. 32 0
      models/szdzModels.go
  7. 2 0
      routers/router.go

+ 3 - 3
controllers/order/order.go

@@ -255,13 +255,13 @@ func QueryTradeOrderDetail(c *gin.Context) {
 		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_ORDERDETAIL.MARKETID").
 		Select(`TRADE_ORDERDETAIL.*, TRADE_ORDERDETAIL.ORDERPRICE - TRADE_ORDERDETAIL.TRADEQTY - TRADE_ORDERDETAIL.CANCELQTY as ENABLEQTY, 
 				GOODS.GOODSCODE, GOODS.GOODSNAME, MARKET.MARKETNAME, MARKET.TRADEMODE`).
-		Where("TRADE_ORDERDETAIL.ORDERSRC != 10 and TRADE_ORDERDETAIL.ACCOUNTID in (?)", req.AccountID).
+		Where(fmt.Sprintf(`TRADE_ORDERDETAIL.ORDERSRC != 10 and TRADE_ORDERDETAIL.ACCOUNTID in (%s)`, req.AccountID)).
 		Desc("TRADE_ORDERDETAIL.ORDERTIME")
 	if len(req.OrderStatus) > 0 {
-		s = s.And("TRADE_ORDERDETAIL.ORDERSTATUS in (?)", req.OrderStatus)
+		s = s.And(fmt.Sprintf(`TRADE_ORDERDETAIL.ORDERSTATUS in (%s)`, req.OrderStatus))
 	}
 	if len(req.TradeMode) > 0 {
-		s = s.And("TRADE_ORDERDETAIL.TRADEMODE in (?)", req.TradeMode)
+		s = s.And(fmt.Sprintf(`TRADE_ORDERDETAIL.TRADEMODE in (%s)`, req.TradeMode))
 	}
 	if req.OrderID > 0 {
 		s = s.And("TRADE_ORDERDETAIL.ORDERID = ?", req.OrderID)

+ 49 - 0
controllers/szdz/szdz.go

@@ -1,10 +1,12 @@
 package szdz
 
 import (
+	"fmt"
 	"mtp2_if/db"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
+	"mtp2_if/models"
 	"net/http"
 
 	"github.com/gin-gonic/gin"
@@ -99,7 +101,54 @@ func QueryRecieptOrder(c *gin.Context) {
 	}
 	datas = append(datas, d2...)
 
+	// FIXME: - 排序 & 分页
+
 	// 查询成功返回
 	logger.GetLogger().Infof("QueryRecieptOrder successed: %v", datas)
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+// QueryGoodsPickupReq 商品提货单查询请求参数
+type QueryGoodsPickupReq struct {
+	AccountID       string `form:"accountID" binding:"required"`
+	TakeOrderStatus int    `form:"takeOrderStatus"`
+}
+
+// QueryGoodsPickup 商品提货单查询
+// @Summary 商品提货单查询
+// @Produce json
+// @Security ApiKeyAuth
+// @Param accountID query string true "资金账户 - 格式:1,2,3"
+// @Param takeOrderStatus query int false "提货状态 - 1:待发货 2:已发货 3:已收货"
+// @Success 200 {object} models.Szdz3goodspickup
+// @Failure 500 {object} app.Response
+// @Router /SZDZ/QueryGoodsPickup [get]
+// @Tags 尚志大宗
+func QueryGoodsPickup(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryGoodsPickupReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryGoodsPickup failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	datas := make([]models.Szdz3goodspickup, 0)
+	engine := db.GetEngine()
+	s := engine.Where(fmt.Sprintf(`ACCOUNTID in (%s)`, req.AccountID))
+	if req.TakeOrderStatus > 0 {
+		s = s.And("TAKEORDERSTATUS = ?", req.TakeOrderStatus)
+	}
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryGoodsPickup failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Infof("QueryGoodsPickup successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 133 - 0
docs/docs.go

@@ -717,6 +717,51 @@ var doc = `{
                 }
             }
         },
+        "/SZDZ/QueryGoodsPickup": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "尚志大宗"
+                ],
+                "summary": "商品提货单查询",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "提货状态 - 1:待发货 2:已发货 3:已收货",
+                        "name": "takeOrderStatus",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Szdz3goodspickup"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/SZDZ/QueryRecieptOrder": {
             "get": {
                 "security": [
@@ -2453,6 +2498,94 @@ var doc = `{
                 }
             }
         },
+        "models.Szdz3goodspickup": {
+            "type": "object",
+            "required": [
+                "takeorderid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "address": {
+                    "description": "提货人详细地址",
+                    "type": "string"
+                },
+                "auditer": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "cardnum": {
+                    "description": "提货人证件号码",
+                    "type": "string"
+                },
+                "cardtypeid": {
+                    "description": "提货人证件类型",
+                    "type": "integer"
+                },
+                "checkremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "phonenum": {
+                    "description": "提货人联系方式",
+                    "type": "string"
+                },
+                "qty": {
+                    "description": "提货数量",
+                    "type": "number"
+                },
+                "recivername": {
+                    "description": "提货人姓名",
+                    "type": "string"
+                },
+                "reqtime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "takemode": {
+                    "description": "提货方式 - 2:自提 3:配送",
+                    "type": "integer"
+                },
+                "takeorderid": {
+                    "description": "提货单号(905+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "takeorderstatus": {
+                    "description": "提货状态 - 1:待发货 2:已发货 3:已收货",
+                    "type": "integer"
+                },
+                "takeremark": {
+                    "description": "提货备注",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Tablecolumnconfig": {
             "type": "object",
             "required": [

+ 133 - 0
docs/swagger.json

@@ -701,6 +701,51 @@
                 }
             }
         },
+        "/SZDZ/QueryGoodsPickup": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "尚志大宗"
+                ],
+                "summary": "商品提货单查询",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "提货状态 - 1:待发货 2:已发货 3:已收货",
+                        "name": "takeOrderStatus",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Szdz3goodspickup"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/SZDZ/QueryRecieptOrder": {
             "get": {
                 "security": [
@@ -2437,6 +2482,94 @@
                 }
             }
         },
+        "models.Szdz3goodspickup": {
+            "type": "object",
+            "required": [
+                "takeorderid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "address": {
+                    "description": "提货人详细地址",
+                    "type": "string"
+                },
+                "auditer": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "cardnum": {
+                    "description": "提货人证件号码",
+                    "type": "string"
+                },
+                "cardtypeid": {
+                    "description": "提货人证件类型",
+                    "type": "integer"
+                },
+                "checkremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "phonenum": {
+                    "description": "提货人联系方式",
+                    "type": "string"
+                },
+                "qty": {
+                    "description": "提货数量",
+                    "type": "number"
+                },
+                "recivername": {
+                    "description": "提货人姓名",
+                    "type": "string"
+                },
+                "reqtime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "takemode": {
+                    "description": "提货方式 - 2:自提 3:配送",
+                    "type": "integer"
+                },
+                "takeorderid": {
+                    "description": "提货单号(905+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "takeorderstatus": {
+                    "description": "提货状态 - 1:待发货 2:已发货 3:已收货",
+                    "type": "integer"
+                },
+                "takeremark": {
+                    "description": "提货备注",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Tablecolumnconfig": {
             "type": "object",
             "required": [

+ 93 - 0
docs/swagger.yaml

@@ -1179,6 +1179,71 @@ definitions:
     required:
     - spotcontractid
     type: object
+  models.Szdz3goodspickup:
+    properties:
+      accountid:
+        description: 账户ID
+        type: integer
+      address:
+        description: 提货人详细地址
+        type: string
+      auditer:
+        description: 审核人
+        type: integer
+      audittime:
+        description: 审核时间
+        type: string
+      cardnum:
+        description: 提货人证件号码
+        type: string
+      cardtypeid:
+        description: 提货人证件类型
+        type: integer
+      checkremark:
+        description: 审核备注
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      handlestatus:
+        description: 处理状态
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      phonenum:
+        description: 提货人联系方式
+        type: string
+      qty:
+        description: 提货数量
+        type: number
+      recivername:
+        description: 提货人姓名
+        type: string
+      reqtime:
+        description: 更新时间
+        type: string
+      takemode:
+        description: 提货方式 - 2:自提 3:配送
+        type: integer
+      takeorderid:
+        description: 提货单号(905+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      takeorderstatus:
+        description: 提货状态 - 1:待发货 2:已发货 3:已收货
+        type: integer
+      takeremark:
+        description: 提货备注
+        type: string
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      userid:
+        description: 用户ID
+        type: integer
+    required:
+    - takeorderid
+    type: object
   models.Tablecolumnconfig:
     properties:
       aligntype:
@@ -1910,6 +1975,34 @@ paths:
       summary: 持仓汇总查询(合约市场)
       tags:
       - 通用单据
+  /SZDZ/QueryGoodsPickup:
+    get:
+      parameters:
+      - description: 资金账户 - 格式:1,2,3
+        in: query
+        name: accountID
+        required: true
+        type: string
+      - description: 提货状态 - 1:待发货 2:已发货 3:已收货
+        in: query
+        name: takeOrderStatus
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Szdz3goodspickup'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 商品提货单查询
+      tags:
+      - 尚志大宗
   /SZDZ/QueryRecieptOrder:
     get:
       parameters:

+ 32 - 0
models/szdzModels.go

@@ -0,0 +1,32 @@
+package models
+
+import "time"
+
+// Szdz3goodspickup 商品提货单表
+type Szdz3goodspickup struct {
+	Takeorderid     uint64    `json:"takeorderid"  xorm:"'TAKEORDERID'" binding:"required"` // 提货单号(905+Unix秒时间戳(10位)+xxxxxx)
+	Accountid       uint64    `json:"accountid"  xorm:"'ACCOUNTID'"`                        // 账户ID
+	Goodsid         uint64    `json:"goodsid"  xorm:"'GOODSID'"`                            // 商品ID
+	Userid          uint64    `json:"userid"  xorm:"'USERID'"`                              // 用户ID
+	Qty             float64   `json:"qty"  xorm:"'QTY'"`                                    // 提货数量
+	Reqtime         time.Time `json:"reqtime"  xorm:"'REQTIME'"`                            // 更新时间
+	Recivername     string    `json:"recivername"  xorm:"'RECIVERNAME'"`                    // 提货人姓名
+	Cardtypeid      uint32    `json:"cardtypeid"  xorm:"'CARDTYPEID'"`                      // 提货人证件类型
+	Cardnum         string    `json:"cardnum"  xorm:"'CARDNUM'"`                            // 提货人证件号码
+	Phonenum        string    `json:"phonenum"  xorm:"'PHONENUM'"`                          // 提货人联系方式
+	Takemode        uint32    `json:"takemode"  xorm:"'TAKEMODE'"`                          // 提货方式 - 2:自提 3:配送
+	Address         string    `json:"address"  xorm:"'ADDRESS'"`                            // 提货人详细地址
+	Takeremark      string    `json:"takeremark"  xorm:"'TAKEREMARK'"`                      // 提货备注
+	Takeorderstatus uint32    `json:"takeorderstatus"  xorm:"'TAKEORDERSTATUS'"`            // 提货状态 - 1:待发货 2:已发货 3:已收货
+	Auditer         uint32    `json:"auditer"  xorm:"'AUDITER'"`                            // 审核人
+	Audittime       time.Time `json:"audittime"  xorm:"'AUDITTIME'"`                        // 审核时间
+	Checkremark     string    `json:"checkremark"  xorm:"'CHECKREMARK'"`                    // 审核备注
+	Tradedate       string    `json:"tradedate"  xorm:"'TRADEDATE'"`                        // 交易日(yyyyMMdd)
+	Marketid        uint32    `json:"marketid"  xorm:"'MARKETID'"`                          // 市场ID
+	Handlestatus    uint32    `json:"handlestatus"  xorm:"'HANDLESTATUS'"`                  // 处理状态
+}
+
+// TableName is SZDZ3_GOODSPICKUP
+func (Szdz3goodspickup) TableName() string {
+	return "SZDZ3_GOODSPICKUP"
+}

+ 2 - 0
routers/router.go

@@ -117,6 +117,8 @@ func InitRouter() *gin.Engine {
 	{
 		// 点选挂牌委托单据查询(摘牌大厅)
 		szdzR.GET("/QueryRecieptOrder", szdz.QueryRecieptOrder)
+		// 商品提货单查询
+		szdzR.GET("/QueryGoodsPickup", szdz.QueryGoodsPickup)
 	}
 
 	return r