Преглед на файлове

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zhou.xiaoning преди 4 години
родител
ревизия
02455d17ea

+ 19 - 0
controllers/ermcp/qryErmcp.go

@@ -103,3 +103,22 @@ func QueryContract(c *gin.Context) {
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// QueryTradeConfigTMP
+// @Summary 查询交易模板配置
+// @Produce json
+// @Security ApiKeyAuth
+// @Param areauserid query int true "所属机构id"
+// @Success 200 {array} models.ErmcpTradeConfigTMP
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryTradeConfigTMP [get]
+// @Tags 企业风险管理(app)
+func QueryTradeConfigTMP(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		Areauserid int64 `form:"areauserid" binding:"required"` // 机构id
+	}{}
+	a.DoBindReq(&req)
+	m := models.ErmcpTradeConfigTMP{AREAUSERID: req.Areauserid}
+	a.DoGetDataI(&m)
+}

+ 27 - 0
controllers/ermcp/qryFuturesCompany.go

@@ -0,0 +1,27 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/13 10:35
+* @Modify  : 2021/4/13 10:35
+ */
+
+package ermcp
+
+import (
+	"github.com/gin-gonic/gin"
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+)
+
+// QueryFuturesCompany
+// @Summary 查询期货公司
+// @Produce json
+// @Security ApiKeyAuth
+// @Success 200 {array} models.ErmcpFuturesCompany
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryFuturesCompany [get]
+// @Tags 企业风险管理(app)
+func QueryFuturesCompany(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.ErmcpFuturesCompany{}
+	a.DoGetDataI(&m)
+}

+ 38 - 0
controllers/ermcp/qryReport.go

@@ -229,3 +229,41 @@ func QryReportMonthSpotDetail(c *gin.Context) {
 		BeginDate: t1, EndDate: t2}
 	a.DoGetDataEx(&m)
 }
+
+// QueryReportAreaSpotPLReq
+type QueryReportAreaSpotPLReq struct {
+	USERID           int64  `form:"userid" binding:"required"`    // 用户id
+	WRSTANDARDID     int64  `form:"wrstandardid"`                 // 现货商品ID
+	SPOTGOODSBRANDID int32  `form:"spotgoodsbrandid"`             // 品牌ID
+	SPOTGOODSMODELID int32  `form:"spotgoodsmodelid"`             // 型号ID
+	QUERYTYPE        int32  `form:"querytype" binding:"required"` // 查询类型 1-日报表(或明细) 2-月报表(或明细)
+	QUERYDATE        string `form:"querydate" binding:"required"` // 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+}
+
+// QryReportAreaSpotPL
+// @Summary 查询现货损益报表(现货损益报表)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param querytype query int true "查询类型 1-日报表 2-月报表"
+// @Param querydate query string true "查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)"
+// @Param wrstandardid query int false "现货商品ID"
+// @Param spotgoodsbrandid query int false "品牌ID"
+// @Param spotgoodsmodelid query int false "型号ID"
+// @Success 200 {array} models.ErmcpReportAreaSpotPL
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QryReportAreaSpotPL [get]
+// @Tags 企业风险管理(app)
+func QryReportAreaSpotPL(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := QueryReportAreaSpotPLReq{}
+	a.DoBindReq(&req)
+	if QueryDate(req.QUERYDATE).IsNumberic(req.QUERYTYPE) {
+		m := models.ErmcpReportAreaSpotPL{AREAUSERID: req.USERID, WRSTANDARDID: req.WRSTANDARDID,
+			SPOTGOODSBRANDID: req.SPOTGOODSBRANDID, SPOTGOODSMODELID: req.SPOTGOODSMODELID,
+			ReportDate: req.QUERYDATE, ReportType: req.QUERYTYPE}
+		a.DoGetDataI(&m)
+	} else {
+		a.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+	}
+}

+ 53 - 0
controllers/ermcp/qrySpotGoodsPrice.go

@@ -0,0 +1,53 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/12 10:39
+* @Modify  : 2021/4/12 10:39
+ */
+
+package ermcp
+
+import (
+	"github.com/gin-gonic/gin"
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+)
+
+// QuerySpotGoodsPrice
+// @Summary 查询现货市价(现货市价)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Success 200 {array} models.ErmcpSpotGoodsPrice
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QuerySpotGoodsPrice [get]
+// @Tags 企业风险管理(app)
+func QuerySpotGoodsPrice(c *gin.Context) {
+	req := struct {
+		UserId int64 `form:"userid" binding:"required"` // 用户id
+	}{}
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	a.DoBindReq(&req)
+	m := models.ErmcpSpotGoodsPrice{AREAUSERID: req.UserId}
+	a.DoGetDataI(&m)
+}
+
+// QuerySpotGoodsPriceLog
+// @Summary 查询现货市价详情(现货市价/详情)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param wrstandardid query int true "现货商品ID"
+// @Success 200 {array} models.ErmcpSpotGoodsPriceLog
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QuerySpotGoodsPriceLog [get]
+// @Tags 企业风险管理(app)
+func QuerySpotGoodsPriceLog(c *gin.Context) {
+	req := struct {
+		UserId       int64 `form:"userid" binding:"required"`       // 用户id
+		Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
+	}{}
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	a.DoBindReq(&req)
+	m := models.ErmcpSpotGoodsPriceLog{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid}
+	a.DoGetDataI(&m)
+}

Файловите разлики са ограничени, защото са твърде много
+ 528 - 314
docs/docs.go


Файловите разлики са ограничени, защото са твърде много
+ 528 - 314
docs/swagger.json


Файловите разлики са ограничени, защото са твърде много
+ 3128 - 3341
docs/swagger.yaml


+ 53 - 15
models/ermcp.go

@@ -12,6 +12,7 @@ import (
 	"mtp2_if/db"
 	"mtp2_if/logger"
 	"mtp2_if/mtpcache"
+	"mtp2_if/utils"
 )
 
 // ErmcpSpotContractModel 现货合同结构(对应现货合同菜单)
@@ -295,7 +296,7 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		"       t.pricedamount + t.ReckonAdjustAmount as LoanAmount" +
 		"  from ermcp_spotcontract t" +
 		"  left join useraccount u" +
-		"    on t.%v = u.userid" +
+		"    on t.userid = u.userid" +
 		"  left join deliverygoods g" +
 		"    on t.deliverygoodsid = g.deliverygoodsid" +
 		"  left join goods g2" +
@@ -314,32 +315,25 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		str += fmt.Sprintf(" and t.SpotContractId=%v", r.SpotContractId)
 	}
 
+	var orderBy string
 	var status string
 	if 1 == nQueryType {
 		// 全部
 		status = "2,3"
-		str = str + " order by t.audittime desc"
+		orderBy = " order by t.audittime desc"
 	} else if 2 == nQueryType {
 		// 待点价
 		status = "2"
-		str = str + "  and t.qty - t.pricedqty > 0 and t.pricetype !=1 " +
-			"order by unpricedqty desc, t.audittime desc"
+		str = str + " and t.qty - t.pricedqty > 0 and t.pricetype !=1 "
+		orderBy = " order by unpricedqty desc, t.audittime desc"
 	} else {
 		// 履约
 		status = "2"
-		str = str + " order by t.audittime desc"
+		orderBy = " order by t.audittime desc"
 	}
 
-	var usrId string
-
-	switch nContractType {
-	case 1: // 采购
-		usrId = "buyuserid"
-	case -1: // 销售
-		usrId = "selluserid"
-	}
-
-	sqlId := fmt.Sprintf(str, usrId, status, nContractType, r.UserID)
+	str += orderBy
+	sqlId := fmt.Sprintf(str, status, nContractType, r.UserID)
 
 	return sqlId
 }
@@ -358,3 +352,47 @@ func (r *ErmcpModel) GetData(contractType, nQueryType int32) ([]ErmcpModel, erro
 	}
 	return sData, nil
 }
+
+// ErmcpTradeConfigTMP 交易模板配置
+type ErmcpTradeConfigTMP struct {
+	TRADECONFIGTMPID   int64  `json:"tradeconfigtmpid"  xorm:"'TRADECONFIGTMPID'"`     // 交易配置模板ID(SEQ_TRADECONFIGTMP)
+	TRADECONFIGTMPTYPE int32  `json:"tradeconfigtmptype"  xorm:"'TRADECONFIGTMPTYPE'"` // 交易配置模板类型 - 1:保证金 2:手续费 3:汇率
+	TRADECONFIGTMPNAME string `json:"tradeconfigtmpname"  xorm:"'TRADECONFIGTMPNAME'"` // 交易配置模板名称
+	REMARK             string `json:"remark"  xorm:"'REMARK'"`                         // 备注
+	UPDATETIME         string `json:"updatetime"  xorm:"'UPDATETIME'"`                 // 更新时间
+	MODIFIERID         int32  `json:"modifierid"  xorm:"'MODIFIERID'"`                 // 修改人
+	AREAUSERID         int64  `json:"areauserid"  xorm:"'AREAUSERID'"`                 // 所属机构
+	BASICCURRENCYID    int64  `json:"basiccurrencyid"  xorm:"'BASICCURRENCYID'"`       // 基本币种ID[汇率] - 目标币种
+	MAINACCOUNTID      int64  `json:"mainaccountid"  xorm:"'MAINACCOUNTID'"`           // 主账户ID
+}
+
+func (r *ErmcpTradeConfigTMP) calc() {
+}
+
+func (r *ErmcpTradeConfigTMP) buildSql() string {
+	var sqlId utils.SQLVal = "select t.areauserid," +
+		"       t.tradeconfigtmpid," +
+		"       t.tradeconfigtmptype," +
+		"       t.tradeconfigtmpname," +
+		"       t.basiccurrencyid," +
+		"       t.mainaccountid," +
+		"       t.modifierid," +
+		"       t.remark," +
+		"       to_char(t.updatetime, 'yyyy-mm-dd hh24:mi:ss') updatetime" +
+		"  from TRADECONFIGTMP t" +
+		"  where 1=1"
+	if r.AREAUSERID > 0 {
+		sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	}
+	return sqlId.String()
+}
+
+// GetDataEx 获取交易配置模板
+func (r *ErmcpTradeConfigTMP) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpTradeConfigTMP, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 9 - 0
models/ermcpCommon.go

@@ -12,6 +12,15 @@ import (
 	"mtp2_if/utils"
 )
 
+type ReportType int
+
+const (
+	_ ReportType = iota
+
+	RTypeDay   // 日报表
+	RTypeMonth // 月报表
+)
+
 // IErmcp 通用接口
 type IErmcp interface {
 	calc()                           // 相关计算和数据处理

+ 65 - 0
models/ermcpFuturesCompany.go

@@ -0,0 +1,65 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/13 9:52
+* @Modify  : 2021/4/13 9:52
+ */
+
+package models
+
+import (
+	"mtp2_if/db"
+	"mtp2_if/utils"
+)
+
+// ErmcpFuturesCompany 期货公司
+type ErmcpFuturesCompany struct {
+	MHPADDRESS       string `json:"mhpaddress"  xorm:"'MHPADDRESS'"`             // MHP服务地址(IP:Port)
+	FCID             int32  `json:"fcid"  xorm:"'FCID'"`                         // 期货公司ID(SEQ_ERMCP_FUTURESCOMPANY)
+	FCNAME           string `json:"fcname"  xorm:"'FCNAME'"`                     // 期货公司名称
+	CHANNELID        string `json:"channelid"  xorm:"'CHANNELID'"`               // 对冲渠道ID
+	BROKERID         string `json:"brokerid"  xorm:"'BROKERID'"`                 // 经纪公司代码
+	CHANNELADDRESS   string `json:"channeladdress"  xorm:"'CHANNELADDRESS'"`     // 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
+	RISKRULEGROUPID  string `json:"riskrulegroupid"  xorm:"'RISKRULEGROUPID'"`   // 风控规则组ID
+	TRADEMARGINTMPID string `json:"trademargintmpid"  xorm:"'TRADEMARGINTMPID'"` // 保证金模板ID [TradeConfigTmpType为1]
+	TRADEFEETMPID    string `json:"tradefeetmpid"  xorm:"'TRADEFEETMPID'"`       // 手续费模板ID[TradeConfigTmpType为2]
+	TRADERATETMPID   string `json:"traderatetmpid"  xorm:"'TRADERATETMPID'"`     // 汇率模板ID[TradeConfigTmpType为3]
+	CREATORID        string `json:"creatorid"  xorm:"'CREATORID'"`               // 创建人
+	CREATETIME       string `json:"createtime"  xorm:"'CREATETIME'"`             // 创建时间
+	UPDATORID        string `json:"updatorid"  xorm:"'UPDATORID'"`               // 更新人
+	UPDATETIME       string `json:"updatetime"  xorm:"'UPDATETIME'"`             // 更新时间
+	ISVALID          int32  `json:"isvalid"  xorm:"'ISVALID'"`                   // 是否有效 - 0:无效 1:有效
+}
+
+func (r *ErmcpFuturesCompany) calc() {
+}
+
+func (r *ErmcpFuturesCompany) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.MHPADDRESS," +
+		"       t.FCID," +
+		"       t.FCNAME," +
+		"       t.CHANNELID," +
+		"       t.BROKERID," +
+		"       t.CHANNELADDRESS," +
+		"       t.RISKRULEGROUPID," +
+		"       t.TRADEMARGINTMPID," +
+		"       t.TRADEFEETMPID," +
+		"       t.TRADERATETMPID," +
+		"       t.CREATORID," +
+		"       to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
+		"       t.UPDATORID," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       to_char(t.ISVALID) ISVALID" +
+		"  FROM ERMCP_FUTURESCOMPANY t" +
+		" WHERE t.isvalid=1"
+	return sqlId.String()
+}
+
+// GetDataEx 获取期货公司
+func (r *ErmcpFuturesCompany) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpFuturesCompany, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 127 - 0
models/ermcpReport.go

@@ -561,3 +561,130 @@ func (r *ErmcpReportMonSpot) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// ErmcpReportAreaSpotPL 现货损益日/月表
+type ErmcpReportAreaSpotPL struct {
+	AREAUSERID            int64   `json:"areauserid"  xorm:"'AREAUSERID'"`                       // 所属机构
+	WRSTANDARDID          int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                   // 现货商品ID
+	SPOTGOODSMODELID      int32   `json:"spotgoodsmodelid"  xorm:"'SPOTGOODSMODELID'"`           // 现货品类ID
+	SPOTGOODSBRANDID      int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`           // 现货品牌ID
+	ORIBUYQTY             float64 `json:"oribuyqty"  xorm:"'ORIBUYQTY'"`                         // 期初采购总量
+	ORIBUYAMOUNT          float64 `json:"oribuyamount"  xorm:"'ORIBUYAMOUNT'"`                   // 期初采购总额
+	ORISELLQTY            float64 `json:"orisellqty"  xorm:"'ORISELLQTY'"`                       // 期初销售总量
+	ORISELLAMOUNT         float64 `json:"orisellamount"  xorm:"'ORISELLAMOUNT'"`                 // 期初销售总额
+	ORIQTY                float64 `json:"oriqty"  xorm:"'ORIQTY'"`                               // 期初量
+	ORIAVERAGEPRICE       float64 `json:"oriaverageprice"  xorm:"'ORIAVERAGEPRICE'"`             // 期初均价
+	ORIAMOUNT             float64 `json:"oriamount"  xorm:"'ORIAMOUNT'"`                         // 期初额
+	TODAYBUYQTY           float64 `json:"todaybuyqty"  xorm:"'TODAYBUYQTY'"`                     // 今日采购量(采购增量)
+	TODAYBUYAMOUNT        float64 `json:"todaybuyamount"  xorm:"'TODAYBUYAMOUNT'"`               // 今日采购额
+	TODAYBUYAVERAGEPRICE  float64 `json:"todaybuyaverageprice"  xorm:"'TODAYBUYAVERAGEPRICE'"`   // 今日采购均价(采购均价)
+	TODAYSELLQTY          float64 `json:"todaysellqty"  xorm:"'TODAYSELLQTY'"`                   // 今日销售量(销售增量)
+	TODAYSELLAMOUNT       float64 `json:"todaysellamount"  xorm:"'TODAYSELLAMOUNT'"`             // 今日销售额
+	TODAYSELLAVERAGEPRICE float64 `json:"todaysellaverageprice"  xorm:"'TODAYSELLAVERAGEPRICE'"` // 今日销售均价(销售均价)
+	CURBUYQTY             float64 `json:"curbuyqty"  xorm:"'CURBUYQTY'"`                         // 期末采购总量
+	CURBUYAMOUNT          float64 `json:"curbuyamount"  xorm:"'CURBUYAMOUNT'"`                   // 期末采购总额(采购额)
+	CURSELLQTY            float64 `json:"cursellqty"  xorm:"'CURSELLQTY'"`                       // 期末销售总量
+	CURSELLAMOUNT         float64 `json:"cursellamount"  xorm:"'CURSELLAMOUNT'"`                 // 期末销售总额(销售额)
+	CURQTY                float64 `json:"curqty"  xorm:"'CURQTY'"`                               // 期末量
+	CURAVERAGEPRICE       float64 `json:"curaverageprice"  xorm:"'CURAVERAGEPRICE'"`             // 期末均价
+	CURAMOUNT             float64 `json:"curamount"  xorm:"'CURAMOUNT'"`                         // 期末额
+	CURSPOTPRICE          float64 `json:"curspotprice"  xorm:"'CURSPOTPRICE'"`                   // 参考市价
+	CURMARKETVALUE        float64 `json:"curmarketvalue"  xorm:"'CURMARKETVALUE'"`               // 参考市值
+	ACTUALPL              float64 `json:"actualpl"  xorm:"'ACTUALPL'"`                           // 实际损益
+	FLOATPL               float64 `json:"floatpl"  xorm:"'FLOATPL'"`                             // 浮动损益
+	UPDATETIME            string  `json:"updatetime"  xorm:"'UPDATETIME'"`                       // 更新时间
+	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`               // 现货商品代码
+	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`               // 现货商品名称
+	UNITID                int32   `json:"unitid"  xorm:"'UNITID'"`                               // 现货商品单位id
+	BRANDNAME             string  `json:"brandname"  xorm:"'BRANDNAME'"`                         // 品牌名称
+	MODELNAME             string  `json:"modelname"  xorm:"'MODELNAME'"`                         // 品类名称
+	GBUNITID              int32   `json:"gbunitid"  xorm:"'GBUNITID'"`                           // 品类单位id
+
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+
+	ReportType int32  `json:"-"` // 报表类型 1-日报表 2-月报表
+	ReportDate string `json:"-"` // 格式 日报表(YYYYMMDD) 月报表(YYYYMM)
+}
+
+func (r *ErmcpReportAreaSpotPL) calc() {
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GBUNITID)
+}
+
+func (r *ErmcpReportAreaSpotPL) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.AREAUSERID," +
+		"       t.WRSTANDARDID," +
+		"       t.SPOTGOODSMODELID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.ORIBUYQTY," +
+		"       t.ORIBUYAMOUNT," +
+		"       t.ORISELLQTY," +
+		"       t.ORISELLAMOUNT," +
+		"       t.ORIQTY," +
+		"       t.ORIAVERAGEPRICE," +
+		"       t.ORIAMOUNT," +
+		"       t.TODAYBUYQTY," +
+		"       t.TODAYBUYAMOUNT," +
+		"       t.TODAYBUYAVERAGEPRICE," +
+		"       t.TODAYSELLQTY," +
+		"       t.TODAYSELLAMOUNT," +
+		"       t.TODAYSELLAVERAGEPRICE," +
+		"       t.CURBUYQTY," +
+		"       t.CURBUYAMOUNT," +
+		"       t.CURSELLQTY," +
+		"       t.CURSELLAMOUNT," +
+		"       t.CURQTY," +
+		"       t.CURAVERAGEPRICE," +
+		"       t.CURAMOUNT," +
+		"       t.CURSPOTPRICE," +
+		"       t.CURMARKETVALUE," +
+		"       t.ACTUALPL," +
+		"       t.FLOATPL," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname," +
+		"       gm.unitid gbunitid" +
+		"  FROM %v t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on t.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on t.spotgoodsmodelid = gm.modelid" +
+		" WHERE 1 = 1"
+	sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	if r.ReportType == 1 {
+		// 日报表
+		sqlId.FormatParam("RECKON_ERMCP_AREASPOTPL")
+		sqlId.And("t.reckondate", r.ReportDate)
+	} else {
+		// 月报表
+		sqlId.FormatParam("REPORT_ERMCP_AREASPOTPL")
+		sqlId.And("t.cycletype", 1)
+		sqlId.And("t.cycletime", r.ReportDate)
+	}
+	if r.WRSTANDARDID > 0 {
+		sqlId.And("t.wrstandardid", r.WRSTANDARDID)
+	}
+	if r.SPOTGOODSBRANDID > 0 {
+		sqlId.And("t.spotgoodsbrandid", r.SPOTGOODSBRANDID)
+	}
+	if r.SPOTGOODSMODELID > 0 {
+		sqlId.And("t.spotgoodsmodelid", r.SPOTGOODSMODELID)
+	}
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货损益日(月)报表
+func (r *ErmcpReportAreaSpotPL) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpReportAreaSpotPL, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 168 - 0
models/ermcpSpotGoodsPrice.go

@@ -0,0 +1,168 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/12 10:07
+* @Modify  : 2021/4/12 10:07
+ */
+
+package models
+
+import (
+	"mtp2_if/db"
+	"mtp2_if/mtpcache"
+	"mtp2_if/utils"
+)
+
+// ErmcpSpotGoodsPrice 现货市价
+type ErmcpSpotGoodsPrice struct {
+	WRSTANDARDID     int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`         // 现货商品ID
+	SPOTGOODSMODELID int32   `json:"spotgoodsmodelid"  xorm:"'SPOTGOODSMODELID'"` // 现货品类ID(通用则为0)
+	SPOTGOODSBRANDID int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+	CURRENCYID       int64   `json:"currencyid"  xorm:"'CURRENCYID'"`             // 报价货币ID
+	SPOTGOODSPRICE   float64 `json:"spotgoodsprice"  xorm:"'SPOTGOODSPRICE'"`     // 现货价格
+	TRADEDATE        string  `json:"tradedate"  xorm:"'TRADEDATE'"`               // 交易日(yyyyMMdd)
+	OPERATESRC       int32   `json:"operatesrc"  xorm:"'OPERATESRC'"`             // 最后操作来源 - 1:管理端 2:终端
+	OPERATEID        int64   `json:"operateid"  xorm:"'OPERATEID'"`               // 最后操作人
+	OPERATETIME      string  `json:"operatetime"  xorm:"'OPERATETIME'"`           // 最后操作时间
+	ISVALID          int32   `json:"isvalid"  xorm:"'ISVALID'"`                   // 是否有效 - 0:无效 1:有效
+	AREAUSERID       int64   `json:"areauserid"  xorm:"'AREAUSERID'"`             // 所属机构id
+	WRSTANDARDCODE   string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`     // 现货商品代码
+	WRSTANDARDNAME   string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`     // 现货商品名称
+	UNITID           int32   `json:"unitid"  xorm:"'UNITID'"`                     // 现货商品单位id
+	BRANDNAME        string  `json:"brandname"  xorm:"'BRANDNAME'"`               // 品牌名称
+	MODELNAME        string  `json:"modelname"  xorm:"'MODELNAME'"`               // 品类名称
+	GMUNITID         int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                 // 品类单位id
+
+	OPERATORNAME  string // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *ErmcpSpotGoodsPrice) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetUserNameByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *ErmcpSpotGoodsPrice) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       t.SPOTGOODSMODELID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.CURRENCYID," +
+		"       t.SPOTGOODSPRICE," +
+		"       t.TRADEDATE," +
+		"       t.OPERATESRC," +
+		"       t.OPERATEID," +
+		"       to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
+		"       t.ISVALID," +
+		"       w.areauserid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname," +
+		"       gm.unitid gmunitid" +
+		"  FROM ERMCP_SPOTGOODSPRICE t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on t.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on t.spotgoodsmodelid = gm.modelid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价
+func (r *ErmcpSpotGoodsPrice) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpSpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}
+
+// ErmcpSpotGoodsPriceLog 现货市价操作日志
+type ErmcpSpotGoodsPriceLog struct {
+	LOGID            int64   `json:"logid"  xorm:"'LOGID'"`                       // 日志id
+	WRSTANDARDID     int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`         // 现货商品ID
+	SPOTGOODSMODELID int32   `json:"spotgoodsmodelid"  xorm:"'SPOTGOODSMODELID'"` // 现货品类ID(通用则为0)
+	SPOTGOODSBRANDID int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+	CURRENCYID       int64   `json:"currencyid"  xorm:"'CURRENCYID'"`             // 报价货币ID
+	SPOTGOODSPRICE   float64 `json:"spotgoodsprice"  xorm:"'SPOTGOODSPRICE'"`     // 现货价格
+	TRADEDATE        string  `json:"tradedate"  xorm:"'TRADEDATE'"`               // 交易日(yyyyMMdd)
+	OPERATESRC       int32   `json:"operatesrc"  xorm:"'OPERATESRC'"`             // 最后操作来源 - 1:管理端 2:终端
+	OPERATEID        int64   `json:"operateid"  xorm:"'OPERATEID'"`               // 最后操作人
+	OPERATETIME      string  `json:"operatetime"  xorm:"'OPERATETIME'"`           // 最后操作时间
+	AREAUSERID       int64   `json:"areauserid"  xorm:"'AREAUSERID'"`             // 所属机构id
+	WRSTANDARDCODE   string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`     // 现货商品代码
+	WRSTANDARDNAME   string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`     // 现货商品名称
+	UNITID           int32   `json:"unitid"  xorm:"'UNITID'"`                     // 现货商品单位id
+	BRANDNAME        string  `json:"brandname"  xorm:"'BRANDNAME'"`               // 品牌名称
+	MODELNAME        string  `json:"modelname"  xorm:"'MODELNAME'"`               // 品类名称
+	GMUNITID         int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                 // 品类单位id
+
+	OPERATORNAME  string // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *ErmcpSpotGoodsPriceLog) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetUserNameByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *ErmcpSpotGoodsPriceLog) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       t.SPOTGOODSMODELID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.CURRENCYID," +
+		"       t.SPOTGOODSPRICE," +
+		"       t.TRADEDATE," +
+		"       t.OPERATESRC," +
+		"       t.OPERATEID," +
+		"       to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
+		"       t.LOGID," +
+		"       w.areauserid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname," +
+		"       gm.unitid gmunitid" +
+		"  FROM ERMCP_SPOTGOODSPRICELOG t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on t.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on t.spotgoodsmodelid = gm.modelid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	sqlId.And("t.wrstandardid", r.WRSTANDARDID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价信息日志
+func (r *ErmcpSpotGoodsPriceLog) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpSpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}

+ 3 - 0
models/ermcpUser.go

@@ -38,6 +38,7 @@ type ErmcpUserModel struct {
 	CREATETIME        string `json:"createtime"  xorm:"'CREATETIME'"`               // 创建时间
 	MODIFYTIME        string `json:"modifytime"  xorm:"'MODIFYTIME'"`               // 修改时间
 	AUDITTIME         string `json:"audittime"  xorm:"'AUDITTIME'"`                 // 审核时间
+	NICKNAME          string `json:"nickname"  xorm:"'NICKNAME'"`                   // 昵称
 }
 
 func (r *ErmcpUserModel) buildWskhSql(accStatus string) string {
@@ -45,6 +46,7 @@ func (r *ErmcpUserModel) buildWskhSql(accStatus string) string {
 		"       t.memberareaid      MEMBERUSERID," +
 		"       t.USERINFOTYPE," +
 		"       t.CUSTOMERNAME," +
+		"       t.NICKNAME," +
 		"       t.CARDTYPE," +
 		"       e.enumdicname       CARDTYPENAME," +
 		"       t.CARDNUM," +
@@ -78,6 +80,7 @@ func (r *ErmcpUserModel) buildSql(accStatus string) string {
 		"       t.memberuserid," +
 		"       u.USERINFOTYPE," +
 		"       u.CUSTOMERNAME," +
+		"       u.NICKNAME," +
 		"       u.CARDTYPEID        CARDTYPE," +
 		"       e.enumdicname       CARDTYPENAME," +
 		"       u.CARDNUM," +

+ 5 - 0
routers/router.go

@@ -361,6 +361,7 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QryReportDaySpotDetail", ermcp.QryReportDaySpotDetail)
 		ermcpR.GET("/QryReportMonthSpot", ermcp.QryReportMonthSpot)
 		ermcpR.GET("/QryReportMonthSpotDetail", ermcp.QryReportMonthSpotDetail)
+		ermcpR.GET("/QryReportAreaSpotPL", ermcp.QryReportAreaSpotPL)
 		ermcpR.GET("/QueryExposureHedgePositionDetail", ermcp.QueryExposureHedgePositionDetail)
 		ermcpR.GET("/QueryPendingAuditInfo", ermcp.QueryPendingAuditInfo)
 		ermcpR.GET("/QueryWarehouseInfo", ermcp.QueryWarehouseInfo)
@@ -378,6 +379,10 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QueryAccMgrRoleMenu", ermcp.QueryAccMgrRoleMenu)
 		ermcpR.GET("/QueryAccMgrBizGroupSet", ermcp.QueryAccMgrBizGroupSet)
 		ermcpR.GET("/QueryAccMgrTaAccountInfo", ermcp.QueryAccMgrTaAccountInfo)
+		ermcpR.GET("/QuerySpotGoodsPrice", ermcp.QuerySpotGoodsPrice)
+		ermcpR.GET("/QuerySpotGoodsPriceLog", ermcp.QuerySpotGoodsPriceLog)
+		ermcpR.GET("/QueryFuturesCompany", ermcp.QueryFuturesCompany)
+		ermcpR.GET("/QueryTradeConfigTMP", ermcp.QueryTradeConfigTMP)
 
 		// 期货相关
 		// 查询企业风管期货商品信息

Някои файлове не бяха показани, защото твърде много файлове са промени