Sfoglia il codice sorgente

增加查待审核信息统计接口
期货品种配置接口增加字段:来源/目标交易所
修改BUG: #93543

zou.yingbin 4 anni fa
parent
commit
46427ad214

+ 4 - 4
controllers/ermcp/qryOPLog.go

@@ -26,7 +26,7 @@ type QryOPLogRsp models.ErmcpOPLogModel
 // @Summary 查询变更记录
 // @Produce json
 // @Security ApiKeyAuth
-// @Param RelatedId query string true "用户ID"
+// @Param RelatedId query string true "合同ID"
 // @Success 200 {array} QryOPLogRsp
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryChangeLog [get]
@@ -34,14 +34,14 @@ type QryOPLogRsp models.ErmcpOPLogModel
 func QueryChangeLog(c *gin.Context) {
 	appG := app.Gin{C: c}
 	var req QryOPLogReq
-	if err := c.ShouldBind(&req); err != nil{
+	if err := c.ShouldBind(&req); err != nil {
 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 		return
 	}
 	m := models.ErmcpOPLogModel{RELATEDID: req.RelatedId}
 	if d, err := m.GetData(); err == nil {
 		appG.Response(http.StatusOK, e.SUCCESS, d)
-	}else{
+	} else {
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
-}
+}

+ 38 - 0
controllers/ermcp/qryPendingAuditInfo.go

@@ -0,0 +1,38 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/2/25 13:32
+* @Modify  : 2021/2/25 13:32
+ */
+
+package ermcp
+
+import (
+	"github.com/gin-gonic/gin"
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+)
+
+// 待审核信息请求
+type PendingAuditCntReq struct {
+	UserId int64 `form:"UserId" binding:"required"` //用户ID
+}
+
+// 待审核信息应答
+type PendingAuditCntRsp models.ErmcpPendingAudit
+
+// QueryPendingAuditInfo  查询待审核数量信息
+// @Summary 查询待审核数量信息(首页/菜单按钮小红点)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param UserId query int true "用户ID"
+// @Success 200 {array} PendingAuditCntRsp
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryPendingAuditInfo [get]
+// @Tags 企业风险管理(app)
+func QueryPendingAuditInfo(c *gin.Context) {
+	a := app.NewGinUtils(c)
+	var req PendingAuditCntReq
+	a.DoBindReq(&req)
+	m := models.ErmcpPendingAudit{UserId: req.UserId}
+	a.DoGetDataEx(&m)
+}

File diff suppressed because it is too large
+ 507 - 703
docs/docs.go


File diff suppressed because it is too large
+ 507 - 703
docs/swagger.json


File diff suppressed because it is too large
+ 2333 - 2478
docs/swagger.yaml


+ 21 - 15
global/app/ginUtils.go

@@ -7,6 +7,7 @@
 package app
 
 import (
+	"github.com/gin-gonic/gin"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
 	"net/http"
@@ -14,12 +15,12 @@ import (
 
 // 获取数据接口
 type IGetData interface {
-	GetData()([]interface{}, error)
+	GetData() ([]interface{}, error)
 }
 
 // 获取数据接口
 type IGetDataEx interface {
-	GetDataEx()(interface{}, error)
+	GetDataEx() (interface{}, error)
 }
 
 // 数据处理接口
@@ -35,7 +36,7 @@ type GinUtils struct {
 
 // 处理参数绑定
 func (r *GinUtils) DoBindReq(req interface{}) {
-	if r.err = r.C.ShouldBind(req); r.err != nil{
+	if r.err = r.C.ShouldBind(req); r.err != nil {
 		r.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 	}
 }
@@ -43,21 +44,21 @@ func (r *GinUtils) DoBindReq(req interface{}) {
 // 处理数据获取, 参数obj为models结构体
 func (r *GinUtils) DoGetData(obj interface{}) {
 	// 如果在参数绑定阶段有错误, 则不执行数据获取
-	if r.err != nil{
+	if r.err != nil {
 		return
 	}
-	if v, ok := obj.(IGetData); ok{
-		if d, err := v.GetData(); err == nil{
+	if v, ok := obj.(IGetData); ok {
+		if d, err := v.GetData(); err == nil {
 			// 执行数据处理
 			for i := range d {
-				if val, ok := d[i].(ICalc); ok{
+				if val, ok := d[i].(ICalc); ok {
 					val.Calc()
-				}else{
+				} else {
 					break
 				}
 			}
 			r.Gin.Response(http.StatusOK, e.SUCCESS, d)
-		}else{
+		} else {
 			logger.GetLogger().Errorf("query fail, %v", err)
 			r.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 		}
@@ -65,17 +66,22 @@ func (r *GinUtils) DoGetData(obj interface{}) {
 }
 
 // 处理数据获取, 参数obj为models结构体
-func (r *GinUtils) DoGetDataEx(modelObj interface{})  {
+func (r *GinUtils) DoGetDataEx(modelObj interface{}) {
 	// 如果在参数绑定阶段有错误, 则不执行数据获取
-	if r.err != nil{
+	if r.err != nil {
 		return
 	}
-	if v, ok := modelObj.(IGetDataEx); ok{
-		if d, err := v.GetDataEx(); err == nil{
+	if v, ok := modelObj.(IGetDataEx); ok {
+		if d, err := v.GetDataEx(); err == nil {
 			r.Gin.Response(http.StatusOK, e.SUCCESS, d)
-		}else{
+		} else {
 			logger.GetLogger().Errorf("query fail, %v", err)
 			r.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 		}
 	}
-}
+}
+
+// 生成处理GinUtils实例
+func NewGinUtils(c *gin.Context) *GinUtils {
+	return &GinUtils{Gin: Gin{C: c}}
+}

+ 1 - 1
models/ermcp.go

@@ -261,7 +261,7 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		"       t.ReckonedAmount," +
 		"       to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +
 		"       to_char(t.createtime,'yyyy-mm-dd hh24:mi:ss') createtime," +
-		"       t.pricedamount + t.ReckonAdjustAmount as LoanAmount" +
+		"       t.pricedamount + t.pricedqty * t.pricemove + t.ReckonAdjustAmount as LoanAmount" +
 		"  from ermcp_spotcontract t" +
 		"  left join useraccount u" +
 		"    on t.%v = u.userid" +

+ 9 - 2
models/ermcpGGConvertconfig.go

@@ -17,10 +17,12 @@ type ErmcpGGConvertCfg struct {
 	Srcgoodsgroupid  int32   `json:"srcgoodsgroupid"  xorm:"'Srcgoodsgroupid'"`   // 源品种ID
 	Destgoodsgroupid int32   `json:"destgoodsgroupid"  xorm:"'Destgoodsgroupid'"` // 目标品种ID
 	Convertratio     float64 `json:"convertratio"  xorm:"'Convertratio'"`         // 折算系数
+	SrcExchangeCode  string  `json:"srcexchangecode"  xorm:"'SrcExchangeCode'"`   // 源期货交易所
 	SrcName          string  `json:"srcname"  xorm:"'SrcName'"`                   // 源品种名称
 	SrcCode          string  `json:"srccode"  xorm:"'SrcCode'"`                   // 源品种代码
 	SrcUnitid        uint32  `json:"srcunitid"  xorm:"'SrcUnitid'"`               // 源品种单位ID
 	SrcUnitidName    string  `json:"srcunitidname"  xorm:"'-'"`                   // 源品种单位名称
+	DstExchangeCode  string  `json:"dstexchangecode"  xorm:"'DstExchangeCode'"`   // 目标期货交易所
 	DstName          string  `json:"dstname"  xorm:"'DstName'"`                   // 目标品种名称
 	DstCode          string  `json:"dstcode"  xorm:"'DstCode'"`                   // 目录品种代码
 	DstUnitid        uint32  `json:"dstunitid"  xorm:"'DstUnitid'"`               // 目标品种单位ID
@@ -49,9 +51,11 @@ func (r *ErmcpGGConvertCfg) buildSql() string {
 	sqlId := "select t.srcgoodsgroupid," +
 		"       t.destgoodsgroupid," +
 		"       t.convertratio," +
+		"       ex1.exexchangecode srcExchangeCode," +
 		"       g1.goodsgroupname  srcName," +
 		"       g1.outergroupcode  srcCode," +
 		"       g1.goodunitid      srcUnitid," +
+		"       ex2.exexchangecode dstExchangeCode," +
 		"       g2.goodsgroupname  dstName," +
 		"       g2.outergroupcode  dstCode," +
 		"       g2.goodunitid      dstUnitid" +
@@ -60,7 +64,11 @@ func (r *ErmcpGGConvertCfg) buildSql() string {
 		"    on t.srcgoodsgroupid = g1.goodsgroupid" +
 		"  left join goodsgroup g2" +
 		"    on t.destgoodsgroupid = g2.goodsgroupid" +
-		"   where 1 = 1 "
+		"  left join externalexchange ex1" +
+		"    on g1.exexchangeid = ex1.autoid" +
+		"  left join externalexchange ex2" +
+		"    on g2.exexchangeid = ex2.autoid" +
+		" where 1 = 1"
 	if r.Destgoodsgroupid > 0 {
 		sqlId = sqlId + fmt.Sprintf("and t.Destgoodsgroupid=%v", r.Destgoodsgroupid)
 	}
@@ -106,4 +114,3 @@ func (r *ErmcpAvalidGoodsGroupModel) buildSql() string {
 	sqlId = fmt.Sprintf(sqlId, r.AreaUserId)
 	return sqlId
 }
-

+ 8 - 7
models/ermcpOPApply.go

@@ -58,8 +58,8 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		"       g.GOODSNAME," +
 		"       g.GOODSCODE," +
 		"       e.EnumdicName," +
-		"       u3.accountname APPLYName," +
-		"       u4.accountname auditName," +
+		"       u3.logincode APPLYName," +
+		"       u4.logincode auditName," +
 		"       u1.accountname buyuserName," +
 		"       u2.accountname selluserName" +
 		"  from ermcp_contractoperateapply t" +
@@ -67,10 +67,10 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		"    on t.relatedid = s.spotcontractid" +
 		"  left join goods g" +
 		"    on s.goodsid = g.goodsid" +
-		"  left join useraccount u3" +
-		"    on t.applyid = u3.userid" +
-		"  left join useraccount u4" +
-		"    on t.auditid = u4.userid" +
+		"  left join loginaccount u3" +
+		"    on t.applyid = u3.loginid" +
+		"  left join loginaccount u4" +
+		"    on t.auditid = u4.loginid" +
 		"  left join useraccount u1" +
 		"    on s.buyuserid = u1.userid" +
 		"  left join useraccount u2" +
@@ -78,7 +78,8 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		"  left join enumdicitem e" +
 		"    on e.enumitemname = g.goodunitid" +
 		"   and e.enumdiccode = 'goodsunit'" +
-		" where t.operateapplytype = %v and s.userid = %v"
+		" where t.operateapplytype = %v" +
+		"   and s.userid = %v"
 
 	if len(r.RELATEDID) > 0 {
 		sqlId = sqlId + " and t.relatedid=" + r.RELATEDID

+ 78 - 0
models/ermcpPendingAuditInfo.go

@@ -0,0 +1,78 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/2/25 13:32
+* @Modify  : 2021/2/25 13:32
+ */
+
+package models
+
+import (
+	"fmt"
+	"mtp2_if/db"
+)
+
+// 待审核信息
+type ErmcpPendingAudit struct {
+	UserQty         int64 `json:"userqty"  xorm:"'UserQty'"`                 // 待审核数量: 用户
+	SpotContractQty int64 `json:"spotcontractqty"  xorm:"'SpotContractQty'"` // 待审核数量: 现货合同
+	HedgePlanQty    int64 `json:"hedgeplanqty"  xorm:"'HedgePlanQty'"`       // 待审核数量: 套保计划
+	BusinessDjQty   int64 `json:"businessdjqty"  xorm:"'BusinessDjQty'"`     // 待审核数量: 点价
+	BusinessJsQty   int64 `json:"businessjsqty"  xorm:"'BusinessJsQty'"`     // 待审核数量: 结算
+	BusinessKxQty   int64 `json:"businesskxqty"  xorm:"'BusinessKxQty'"`     // 待审核数量: 款项
+	BusinessFpQty   int64 `json:"businessfpqty"  xorm:"'BusinessFpQty'"`     // 待审核数量: 发票
+
+	UserId int64 `json:"-"` // 所属用户id
+}
+
+type ErmcpPendingAuditQty struct {
+	CntType int64 `json:"CntType"  xorm:"'CntType'"` // 类型 1-用户 2-合同 3-套保 4-点价申请 5-结算 6-款项 7-发票
+	CntQty  int64 `json:"CntQty"  xorm:"'CntQty'"`   // 数量
+}
+
+func (r *ErmcpPendingAudit) buildSql() string {
+	var sqlId = "select 1 as cnttype, count(1) cntqty from wskh_userinfo t where t.memberareaid = %v and t.userstate in(2,4)" +
+		" union all " +
+		"select 2, count(1) SpotContractQty from ermcp_spotcontract t where t.userid = %v and t.contractstatus = 1" +
+		" union all " +
+		"select 3, count(1) HedgePlanQty from ermcp_hedgeplan t where t.areauserid = %v and t.hedgeplanstatus = 1" +
+		" union all " +
+		"select 4, count(1) BusinessDjQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=1" +
+		" union all " +
+		"select 5, count(1) BusinessJsQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=2" +
+		" union all " +
+		"select 6, count(1) BusinessKxQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=3" +
+		" union all " +
+		"select 7, count(1) BusinessFpQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=4"
+	sqlId = fmt.Sprintf(sqlId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId)
+	return sqlId
+}
+
+func (r *ErmcpPendingAudit) GetDataEx() (interface{}, error) {
+	rspData := make([]ErmcpPendingAudit, 0)
+	sData := make([]ErmcpPendingAuditQty, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		var v ErmcpPendingAudit
+		for _, d := range sData {
+			// 类型 1-用户 2-合同 3-套保 4-点价申请 5-结算 6-款项 7-发票
+			switch d.CntType {
+			case 1:
+				v.UserQty = d.CntQty
+			case 2:
+				v.SpotContractQty = d.CntQty
+			case 3:
+				v.HedgePlanQty = d.CntQty
+			case 4:
+				v.BusinessDjQty = d.CntQty
+			case 5:
+				v.BusinessJsQty = d.CntQty
+			case 6:
+				v.BusinessFpQty = d.CntQty
+			case 7:
+				v.BusinessFpQty = d.CntQty
+			}
+		}
+		rspData = append(rspData, v)
+	}
+	return rspData, err
+}

+ 1 - 0
routers/router.go

@@ -356,6 +356,7 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QryReportMonthSpot", ermcp.QryReportMonthSpot)
 		ermcpR.GET("/QryReportMonthSpotDetail", ermcp.QryReportMonthSpotDetail)
 		ermcpR.GET("/QueryExposureHedgePositionDetail", ermcp.QueryExposureHedgePositionDetail)
+		ermcpR.GET("/QueryPendingAuditInfo", ermcp.QueryPendingAuditInfo)
 
 		// 期货相关
 		// 查询企业风管期货商品信息

Some files were not shown because too many files changed in this diff