Просмотр исходного кода

查询结算操作记录增加过滤条件

zou.yingbin 4 лет назад
Родитель
Сommit
39eab8c61d
5 измененных файлов с 34 добавлено и 12 удалено
  1. 14 12
      controllers/ermcp/qryOPApply.go
  2. 6 0
      docs/docs.go
  3. 6 0
      docs/swagger.json
  4. 4 0
      docs/swagger.yaml
  5. 4 0
      models/ermcpOPApply.go

+ 14 - 12
controllers/ermcp/qryOPApply.go

@@ -48,7 +48,7 @@ type KxData struct {
 }
 
 // 获取款项类型,1-收付款(PayAmount字段有值) 2-退款(DeductAmount字段有值) 3-收付款/退款(2个字段都有)
-func (r *KxData) CalcKxType(contractType int32) {
+func (r *KxData) CalcKxType() {
 	if r.PayAmount != nil && r.DeductAmount != nil {
 		r.KxType = 3
 	} else if r.PayAmount != nil {
@@ -65,8 +65,9 @@ type KpData struct {
 
 // 查询合同操作请求
 type QryOPApplyReq struct {
-	UserId    int64  `form:"UserId" binding:"required"`    //用户ID
-	RelatedId string `form:"relatedid" binding:"required"` //现货合同ID, 不填则查所有
+	UserId         int64  `form:"UserId" binding:"required"`    //用户ID
+	RelatedId      string `form:"relatedid" binding:"required"` //现货合同ID, 不填则查所有
+	OperateapplyId string `form:"operateapplyid"`               //操作申请id
 }
 
 // 查询业务管理/点价应答
@@ -121,6 +122,7 @@ type QryBussinessJsRsp struct {
 // @Security ApiKeyAuth
 // @Param UserId query int true "用户ID"
 // @Param relatedid query string false "现货合同ID, 不填则查所有"
+// @Param operateapplyid query string false "操作申请id"
 // @Success 200 {array} QryBussinessJsRsp
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryBusinessJs [get]
@@ -129,7 +131,7 @@ func QueryBusinessJs(c *gin.Context) {
 	appG := app.Gin{C: c}
 	var req QryOPApplyReq
 	_ = c.ShouldBind(&req)
-	m := models.ErmcpOPApplyModel{RELATEDID: req.RelatedId, USERID: req.UserId}
+	m := models.ErmcpOPApplyModel{RELATEDID: req.RelatedId, USERID: req.UserId, OPERATEAPPLYID: req.OperateapplyId}
 	if d, err := m.GetData(2); err == nil {
 		//构建应答数据
 		sData := make([]QryBussinessJsRsp, 0)
@@ -176,33 +178,33 @@ func QueryBusinessJsEx(c *gin.Context) {
 			var rd ReckonData
 			rsp.ErmcpOPApplyModel = v
 			if len(rsp.DETAILJSON) > 0 {
-				if err := json.Unmarshal([]byte(rsp.DETAILJSON), &rd); err == nil{
-					if rd.ReckonRealQty != nil{
+				if err := json.Unmarshal([]byte(rsp.DETAILJSON), &rd); err == nil {
+					if rd.ReckonRealQty != nil {
 						rsp.ReckonType = "确定量"
 						rsp.ReckonValue = *rd.ReckonRealQty
 						sData = append(sData, rsp)
 					}
-					if rd.ReckonOtherAmount != nil{
+					if rd.ReckonOtherAmount != nil {
 						rsp.ReckonType = "其它费用"
 						rsp.ReckonValue = *rd.ReckonOtherAmount
 						sData = append(sData, rsp)
 					}
-					if rd.ReckonAdjustAmount != nil{
+					if rd.ReckonAdjustAmount != nil {
 						rsp.ReckonType = "调整金额"
 						rsp.ReckonValue = *rd.ReckonAdjustAmount
 						sData = append(sData, rsp)
 					}
-					if rd.AddMargin != nil{
+					if rd.AddMargin != nil {
 						rsp.ReckonType = "追加保证金"
 						rsp.ReckonValue = *rd.AddMargin
 						sData = append(sData, rsp)
 					}
-					if rd.DecMargin != nil{
+					if rd.DecMargin != nil {
 						rsp.ReckonType = "退还保证金"
 						rsp.ReckonValue = *rd.DecMargin
 						sData = append(sData, rsp)
 					}
-					if rd.ReckonOsAmount != nil{
+					if rd.ReckonOsAmount != nil {
 						rsp.ReckonType = "溢短金额"
 						rsp.ReckonValue = *rd.ReckonOsAmount
 						sData = append(sData, rsp)
@@ -245,7 +247,7 @@ func QueryBusinessKx(c *gin.Context) {
 			rsp.ErmcpOPApplyModel = v
 			if len(rsp.DETAILJSON) > 0 {
 				if err := json.Unmarshal([]byte(rsp.DETAILJSON), &rsp.KxData); err == nil {
-					rsp.KxData.CalcKxType(rsp.CONTRACTTYPE)
+					rsp.KxData.CalcKxType()
 					sData = append(sData, rsp)
 				}
 			}

+ 6 - 0
docs/docs.go

@@ -1822,6 +1822,12 @@ var doc = `{
                         "description": "现货合同ID, 不填则查所有",
                         "name": "relatedid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "操作申请id",
+                        "name": "operateapplyid",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 6 - 0
docs/swagger.json

@@ -1806,6 +1806,12 @@
                         "description": "现货合同ID, 不填则查所有",
                         "name": "relatedid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "操作申请id",
+                        "name": "operateapplyid",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 4 - 0
docs/swagger.yaml

@@ -10792,6 +10792,10 @@ paths:
         in: query
         name: relatedid
         type: string
+      - description: 操作申请id
+        in: query
+        name: operateapplyid
+        type: string
       produces:
       - application/json
       responses:

+ 4 - 0
models/ermcpOPApply.go

@@ -93,6 +93,10 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		sqlId = sqlId + " and t.relatedid=" + r.RELATEDID
 	}
 
+	if len(r.OPERATEAPPLYID) > 0 {
+		sqlId += " and t.operateapplyid =" + r.OPERATEAPPLYID
+	}
+
 	return fmt.Sprintf(sqlId, opType, r.USERID)
 }