| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- /**
- * @Author: zou.yingbin
- * @Create : 2021/2/4 11:27
- * @Modify : 2021/2/4 11:27
- */
- package ermcp
- import (
- "github.com/gin-gonic/gin"
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/models"
- "net/http"
- )
- // 财务日报表请求
- type QryReportDayReq struct {
- UserId int64 `form:"userid" binding:"required"` //用户ID
- TradeDate string `form:"tradedate" binding:"required"` // 交易日
- }
- type QryReportFinanceDayRsp models.ErmcpReportDayFR
- // @Summary 查询财务日报表(菜单:报表查询/财务报表/日报表)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportFinanceDayRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDayFinance [get]
- // @Tags 企业风险管理(app)
- func QryReportDayFinance(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDayReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportDayFR{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
- a.DoGetDataEx(&m)
- }
- // 财务日报表款项明细
- type QryReportFinanceKxRsp models.ErmcpReportOPLog
- // @Summary 查询财务日报表款项(菜单:报表查询/财务报表/日报表/款项)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportFinanceKxRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDayFinanceKx [get]
- // @Tags 企业风险管理(app)
- func QryReportDayFinanceKx(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDayReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportDayFRKx{USERID: req.UserId, TRADEDATE: req.TradeDate}
- a.DoGetDataEx(&m)
- }
- // 财务日报表发票明细
- type QryReportFinanceFpRsp models.ErmcpReportOPLog
- // @Summary 查询财务日报表发票(菜单:报表查询/财务报表/日报表/发票)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportFinanceKxRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDayFinanceFp [get]
- // @Tags 企业风险管理(app)
- func QryReportDayFinanceFp(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDayReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportOPLog{USERID: req.UserId, TRADEDATE: req.TradeDate, LogTypeFilter: "11, 12"}
- a.DoGetDataEx(&m)
- }
- // 财务月报表请求
- type QryReportMonthReq struct {
- UserId int64 `form:"userid" binding:"required"` //用户ID
- CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
- }
- // 财务月报表应答
- type QryReportFinanceMonRsp models.ErmcpReportMonthFR
- // @Summary 查询财务月报表(菜单:报表查询/财务报表/月报表)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
- // @Success 200 {array} QryReportFinanceMonRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportMonthFinance [get]
- // @Tags 企业风险管理(app)
- func QryReportMonthFinance(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportMonthReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportMonthFR{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
- a.DoGetDataEx(&m)
- }
- // 敞口日报表
- type QryReportExposureDayRsp models.ErmcpReportDayExposure
- // @Summary 查询敞口日报表(菜单:报表查询/敞口报表/敞口日报表)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportExposureDayRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDayExposure [get]
- // @Tags 企业风险管理(app)
- func QryReportDayExposure(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDayReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportDayExposure{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
- a.DoGetDataEx(&m)
- }
- // 现货日报表
- type QryReportSpotDayRsp models.ErmcpReportDaySpot
- // @Summary 查询现货日报表(菜单:报表查询/现货报表/现货日报表)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportSpotDayRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDaySpot [get]
- // @Tags 企业风险管理(app)
- func QryReportDaySpot(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDayReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
- a.DoGetDataEx(&m)
- }
- // 现货日报表明细请求
- type QryReportDaySpotDetailReq struct {
- UserId int64 `form:"userid" binding:"required"` //用户ID
- Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
- TradeDate string `form:"tradedate" binding:"required"` // 交易日
- }
- // 现货日报表明细应答
- type QryReportDaySpotDetailRsp models.ErmcpReportOPLog
- // @Summary 查询现货日报表详情(菜单:报表查询/现货报表/现货日报表详情)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param wrstandardid query int true "现货商品id"
- // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
- // @Success 200 {array} QryReportDaySpotDetailRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportDaySpotDetail [get]
- // @Tags 企业风险管理(app)
- func QryReportDaySpotDetail(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportDaySpotDetailReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportOPLog{USERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
- TRADEDATE: req.TradeDate, LogTypeFilter: "2,3"}
- a.DoGetDataEx(&m)
- }
- // 现货月报表应答
- type QryReportSpotMonRsp models.ErmcpReportMonSpot
- // @Summary 查询现货月报表(菜单:报表查询/现货报表/现货月报表)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
- // @Success 200 {array} QryReportSpotMonRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportMonthSpot [get]
- // @Tags 企业风险管理(app)
- func QryReportMonthSpot(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportMonthReq{}
- a.DoBindReq(&req)
- m := models.ErmcpReportMonSpot{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
- a.DoGetDataEx(&m)
- }
- // 现货月报表详情请求
- type QryReportSpotMonthDetailReq struct {
- UserId int64 `form:"userid" binding:"required"` //用户ID
- Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
- CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
- }
- // 现货月报表详情应答
- type QryReportSpotMonthDetailRsp models.ErmcpReportDaySpot
- // @Summary 查询现货月报表详情(菜单:报表查询/现货月报表/现货月报表详情)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param wrstandardid query int true "现货商品id"
- // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
- // @Success 200 {array} QryReportSpotMonthDetailRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QryReportMonthSpotDetail [get]
- // @Tags 企业风险管理(app)
- func QryReportMonthSpotDetail(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- req := QryReportSpotMonthDetailReq{}
- a.DoBindReq(&req)
- if len(req.CycleTime) != 6 {
- // 月报表的日期应是6位,如 202101
- a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- t1 := req.CycleTime + "01"
- t2 := req.CycleTime + "31"
- m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
- 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)
- }
- }
|