Forráskód Böngészése

1.查合同接口状态过滤条件改为多选
2.查客户资料接口增加字段"附件2"

zou.yingbin 4 éve
szülő
commit
c9e3fcfd2c
6 módosított fájl, 58 hozzáadás és 25 törlés
  1. 11 2
      controllers/ermcp3/qryErmcp3.go
  2. 6 2
      docs/docs.go
  3. 6 2
      docs/swagger.json
  4. 5 2
      docs/swagger.yaml
  5. 27 17
      models/ermcp3.go
  6. 3 0
      models/qhj.go

+ 11 - 2
controllers/ermcp3/qryErmcp3.go

@@ -108,7 +108,7 @@ type QryContractReq struct {
 // @Param userid query int true "用户id(当指定contractid, userid可不填)"
 // @Param usertype query int false "用户类型 2-机构 7-企业成员"
 // @Param contracttype query int false "合同类型 1-采购, -1-销售"
-// @Param querytype query int false "查询类型 1-未提交 2-待审核 3-履约中 4-已完成"
+// @Param querytype query string false "查询类型(逗号隔开, 如1,2,3) 1-未提交 2-待审核 3-履约中 4-已完成"
 // @Param contractid query string false "合同ID(SpotContractId)"
 // @Param contractno query string false "合同编号(模糊匹配)"
 // @Param wrstandardname query string false "商品名称(模糊匹配)"
@@ -118,7 +118,16 @@ type QryContractReq struct {
 // @Tags 企业风险管理v3(app)
 func QuerySpotContract(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
-	req := QryContractReq{}
+	req := struct {
+		AreadUserId    int64  `form:"userid"`         // 所属机构Id
+		CONTRACTTYPE   int32  `form:"contracttype"`   // 合同类型 1-采购, -1-销售
+		QUERYTYPE      string `form:"querytype"`      // 查询类型
+		USERID         int64  `form:"userid"`         // 用户Id
+		USERTYPE       int32  `form:"usertype"`       // 用户类型
+		CONTRACTID     string `form:"contractid"`     // 合同ID(SpotContractId)
+		CONTRACTNO     string `form:"contractno"`     // 现货合同编号
+		WRSTANDARDNAME string `form:"wrstandardname"` // 品类名称
+	}{}
 	a.DoBindReq(&req)
 	m := models.Ermcp3Contract{USERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
 		QryType: req.QUERYTYPE, CONTRACTTYPE: req.CONTRACTTYPE,

+ 6 - 2
docs/docs.go

@@ -5171,8 +5171,8 @@ var doc = `{
                         "in": "query"
                     },
                     {
-                        "type": "integer",
-                        "description": "查询类型 1-未提交 2-待审核 3-履约中 4-已完成",
+                        "type": "string",
+                        "description": "查询类型(逗号隔开, 如1,2,3) 1-未提交 2-待审核 3-履约中 4-已完成",
                         "name": "querytype",
                         "in": "query"
                     },
@@ -28686,6 +28686,10 @@ var doc = `{
                     "description": "附件1",
                     "type": "string"
                 },
+                "attachment2": {
+                    "description": "附件2",
+                    "type": "string"
+                },
                 "audittime": {
                     "description": "审核时间",
                     "type": "string"

+ 6 - 2
docs/swagger.json

@@ -5155,8 +5155,8 @@
                         "in": "query"
                     },
                     {
-                        "type": "integer",
-                        "description": "查询类型 1-未提交 2-待审核 3-履约中 4-已完成",
+                        "type": "string",
+                        "description": "查询类型(逗号隔开, 如1,2,3) 1-未提交 2-待审核 3-履约中 4-已完成",
                         "name": "querytype",
                         "in": "query"
                     },
@@ -28670,6 +28670,10 @@
                     "description": "附件1",
                     "type": "string"
                 },
+                "attachment2": {
+                    "description": "附件2",
+                    "type": "string"
+                },
                 "audittime": {
                     "description": "审核时间",
                     "type": "string"

+ 5 - 2
docs/swagger.yaml

@@ -10887,6 +10887,9 @@ definitions:
       attachment1:
         description: 附件1
         type: string
+      attachment2:
+        description: 附件2
+        type: string
       audittime:
         description: 审核时间
         type: string
@@ -22168,10 +22171,10 @@ paths:
         in: query
         name: contracttype
         type: integer
-      - description: 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
+      - description: 查询类型(逗号隔开, 如1,2,3) 1-未提交 2-待审核 3-履约中 4-已完成
         in: query
         name: querytype
-        type: integer
+        type: string
       - description: 合同ID(SpotContractId)
         in: query
         name: contractid

+ 27 - 17
models/ermcp3.go

@@ -661,26 +661,36 @@ type Ermcp3Contract struct {
 	MERUSERNAME        string `json:"merusername"`        // 跟单员名称
 
 	// 筛选条件
-	QryType   int32 `json:"-"` // 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
-	UserType  int32 `json:"-"` // 用户类型  2-管理员 7-企业成员
-	OwnUserId int64 `json:"-"` // 登录用户id
+	QryType   string `json:"-"` // 查询类型(逗号隔开,如1,2,3) 1-未提交 2-待审核 3-履约中 4-已完成
+	UserType  int32  `json:"-"` // 用户类型  2-管理员 7-企业成员
+	OwnUserId int64  `json:"-"` // 登录用户id
 }
 
 func (r *Ermcp3Contract) getQryTypeStatus() string {
-	var status string
-	switch r.QryType {
-	case 1: // 未提交
-		status = "0,4,6"
-	case 2: // 待审核
-		status = "1"
-	case 3: // 履约中
-		status = "2"
-	case 4: // 已完成
-		status = "3,5"
-	default:
-		status = "0,1,2,3,4,5,6"
+	r.QryType = strings.TrimSpace(r.QryType)
+	r.QryType = strings.Trim(r.QryType, " ")
+
+	sTmp := make([]string, 0)
+	for _, v := range r.QryType {
+		var status string
+		switch v {
+		case '1': // 未提交
+			status = "0,4,6"
+		case '2': // 待审核
+			status = "1"
+		case '3': // 履约中
+			status = "2"
+		case '4': // 已完成
+			status = "3,5"
+		}
+		if status != "" {
+			sTmp = append(sTmp, status)
+		}
 	}
-	return status
+
+	newStatus := strings.Join(sTmp, ",")
+
+	return newStatus
 }
 
 func (r *Ermcp3Contract) calc() {
@@ -767,7 +777,7 @@ SELECT to_char(t.SPOTCONTRACTID) SPOTCONTRACTID,
 		sqlId.AndEx("t.CONTRACTTYPE", r.CONTRACTTYPE, r.CONTRACTTYPE != 0)
 		// 用户条件
 		sqlId.Join(fmt.Sprintf(" and %v in(t.userid, t.saleuserid, t.tradeuserid, t.meruserid, l.userid)", r.OwnUserId))
-		if r.QryType > 0 {
+		if len(r.QryType) > 0 {
 			status := r.getQryTypeStatus()
 			if len(status) > 0 {
 				sqlId.Join(fmt.Sprintf(" and t.contractstatus in (%v)", status))

+ 3 - 0
models/qhj.go

@@ -1075,6 +1075,7 @@ type QhjCustomer struct {
 	STATUS            int32  `json:"status"  xorm:"'STATUS'"`                       // 账户状态 -  1:待激活 2:待审核 3:待复审 4:正常 5:审核拒绝 6:注销
 	STATUSDESC        string `json:"statusdesc"`                                    // 账户状态中文描述
 	ATTACHMENT1       string `json:"attachment1"  xorm:"'ATTACHMENT1'"`             // 附件1
+	ATTACHMENT2       string `json:"attachment2"  xorm:"'ATTACHMENT2'"`             // 附件2
 	CARDFRONTPHOTOURL string `json:"cardfrontphotourl"  xorm:"'CARDFRONTPHOTOURL'"` // 证件正面图片地址
 	CARDBACKPHOTOURL  string `json:"cardbackphotourl"  xorm:"'CARDBACKPHOTOURL'"`   // 证件反面图片地址
 	PROXYSTATEMENTURL string `json:"proxystatementurl"  xorm:"'PROXYSTATEMENTURL'"` // 授权委托书
@@ -1165,6 +1166,7 @@ func (r *QhjCustomer) buildSqlWskh() string {
 		"               t.cardaddress ADDRESS," +
 		"               t.REMARK," +
 		"               t.ATTACHMENT1," +
+		"               t.ATTACHMENT2," +
 		"               t.CARDFRONTPHOTOURL," +
 		"               t.CARDBACKPHOTOURL," +
 		"               t.proxystatementurl," +
@@ -1216,6 +1218,7 @@ func (r *QhjCustomer) buildSqlNormal() string {
 		"       u.ADDRESS," +
 		"       u.REMARK," +
 		"       u.ATTACHMENT1," +
+		"       u.ATTACHMENT2," +
 		"       u.CARDFRONTPHOTOURL," +
 		"       u.CARDBACKPHOTOURL," +
 		"       u.proxystatementurl," +