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

联调问题修改、增加现货市价ermcp3接口

zou.yingbin преди 4 години
родител
ревизия
6626da45a4
променени са 5 файла, в които са добавени 259 реда и са изтрити 34 реда
  1. 43 3
      controllers/ermcp3/qryErmcp3.go
  2. 185 24
      models/ermcp3.go
  3. 19 6
      models/ermcpAccMgr.go
  4. 10 1
      models/ermcpUser.go
  5. 2 0
      routers/router.go

+ 43 - 3
controllers/ermcp3/qryErmcp3.go

@@ -274,7 +274,7 @@ func QueryAreaStockApply(c *gin.Context) {
 	a := app.NewGinUtils(c)
 	req := struct {
 		USERID           int64  `form:"userid" binding:"required"` // 用户
-		WRSTANDARDID     string `form:"wrstandardid"`              // 品类
+		WRSTANDARDID     int32  `form:"wrstandardid"`              // 品类
 		SPOTGOODSBRANDID int32  `form:"spotgoodsbrandid"`          // 品牌
 		SPOTCONTRACTID   string `form:"spotcontractid"`            // 合同id
 		WAREHOUSEINFOID  string `form:"warehouseinfoid"`           // 仓库id
@@ -334,7 +334,7 @@ func QueryAreaStockReport(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	req := struct {
 		USERID           int64  `form:"userid" binding:"required"` // 机构ID
-		WRSTANDARDID     string `form:"wrstandardid"`              // 品类ID
+		WRSTANDARDID     int32  `form:"wrstandardid"`              // 品类ID
 		SPOTGOODSBRANDID int32  `form:"spotgoodsbrandid"`          // 现货品牌ID
 		WAREHOUSEINFOID  string `form:"warehouseinfoid"`           // 仓库ID
 		DELIVERYGOODSID  int32  `form:"deliverygoodsid"`           // 现货品种id
@@ -374,7 +374,7 @@ func QueryAreaStockReportDetail(c *gin.Context) {
 	req := struct {
 		USERID           int64  `form:"userid" binding:"required"`     // 机构ID
 		DELIVERYGOODSID  int32  `form:"deliverygoodsid"`               // 现货品种id
-		WRSTANDARDID     string `form:"wrstandardid"`                  // 品类ID
+		WRSTANDARDID     int32  `form:"wrstandardid"`                  // 品类ID
 		SPOTGOODSBRANDID int32  `form:"spotgoodsbrandid"`              // 品牌id
 		WAREHOUSEINFOID  string `form:"warehouseinfoid"`               // 现货仓库ID
 		QUERYTYPE        int32  `form:"querytype" binding:"required"`  // 查询类型
@@ -405,3 +405,43 @@ func QueryAreaStockReportDetail(c *gin.Context) {
 		a.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 	}
 }
+
+// QuerySpotGoodsPrice
+// @Summary 查询现货市价(现货市价)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Success 200 {array} models.Ermcp3SpotGoodsPrice
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QuerySpotGoodsPrice [get]
+// @Tags 企业风险管理v3(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.Ermcp3SpotGoodsPrice{AREAUSERID: req.UserId}
+	a.DoGetDataI(&m)
+}
+
+// QuerySpotGoodsPriceLog
+// @Summary 查询现货市价详情(现货市价/详情)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param deliverygoodsid query int true "现货商品ID"
+// @Success 200 {array} models.Ermcp3SpotGoodsPriceLog
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QuerySpotGoodsPriceLog [get]
+// @Tags 企业风险管理v3(app)
+func QuerySpotGoodsPriceLog(c *gin.Context) {
+	req := struct {
+		UserId          int64 `form:"userid" binding:"required"`          // 用户id
+		DELIVERYGOODSID int32 `form:"deliverygoodsid" binding:"required"` // 现货商品id
+	}{}
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	a.DoBindReq(&req)
+	m := models.Ermcp3SpotGoodsPriceLog{AREAUSERID: req.UserId, DELIVERYGOODSID: req.DELIVERYGOODSID}
+	a.DoGetDataI(&m)
+}

+ 185 - 24
models/ermcp3.go

@@ -901,22 +901,23 @@ func (r *Ermcp3AreaSpotDetail) GetDataEx() (interface{}, error) {
 
 // Ermcp3Wrstandard 现货品类
 type Ermcp3Wrstandard struct {
-	WRSTANDARDID    int64  `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`       // 品类ID(SEQ_WRSTANDARD)
-	WRSTANDARDCODE  string `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`   // 品类代码
-	DELIVERYGOODSID int32  `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"` // 现货品种ID
-	UNITID          int32  `json:"unitid"  xorm:"'UNITID'"`                   // 品类单位ID
-	MINIVALUE       int32  `json:"minivalue"  xorm:"'MINIVALUE'"`             // 最小变动值
-	MINIVALUEDP     int32  `json:"minivaluedp"  xorm:"'MINIVALUEDP'"`         // 最小变动值小数位
-	REALMINIVALUE   int32  `json:"realminivalue"  xorm:"'REALMINIVALUE'"`     // 实际最小变动值
-	REALMINIVALUEDP int32  `json:"realminivaluedp"  xorm:"'REALMINIVALUEDP'"` // 实际最小变动值小数位
-	CREATORID       int64  `json:"creatorid"  xorm:"'CREATORID'"`             // 创建人
-	CREATETIME      string `json:"createtime"  xorm:"'CREATETIME'"`           // 创建时间
-	WRSTANDARDNAME  string `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`   // 品类名称
-	AREAUSERID      int    `json:"areauserid"  xorm:"'AREAUSERID'"`           // 所属机构
-	EnumdicName     string `json:"enumdicname"`                               // 品类单位名称
-	ISVALID         int32  `json:"isvalid"  xorm:"'ISVALID'"`                 // 是否有效 0-无效(停用) 1-有效(正常)
-	UPDATETIME      string `json:"updatetime"  xorm:"'UPDATETIME'"`           // 更新时间
-	REMARK          string `json:"remark"  xorm:"'REMARK'"`                   // 备注
+	WRSTANDARDID    int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`       // 品类ID(SEQ_WRSTANDARD)
+	WRSTANDARDCODE  string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`   // 品类代码
+	DELIVERYGOODSID int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"` // 现货品种ID
+	UNITID          int32   `json:"unitid"  xorm:"'UNITID'"`                   // 品类单位ID
+	MINIVALUE       int32   `json:"minivalue"  xorm:"'MINIVALUE'"`             // 最小变动值
+	MINIVALUEDP     int32   `json:"minivaluedp"  xorm:"'MINIVALUEDP'"`         // 最小变动值小数位
+	REALMINIVALUE   int32   `json:"realminivalue"  xorm:"'REALMINIVALUE'"`     // 实际最小变动值
+	REALMINIVALUEDP int32   `json:"realminivaluedp"  xorm:"'REALMINIVALUEDP'"` // 实际最小变动值小数位
+	CREATORID       int64   `json:"creatorid"  xorm:"'CREATORID'"`             // 创建人
+	CREATETIME      string  `json:"createtime"  xorm:"'CREATETIME'"`           // 创建时间
+	WRSTANDARDNAME  string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`   // 品类名称
+	AREAUSERID      int     `json:"areauserid"  xorm:"'AREAUSERID'"`           // 所属机构
+	EnumdicName     string  `json:"enumdicname"`                               // 品类单位名称
+	ISVALID         int32   `json:"isvalid"  xorm:"'ISVALID'"`                 // 是否有效 0-无效(停用) 1-有效(正常)
+	UPDATETIME      string  `json:"updatetime"  xorm:"'UPDATETIME'"`           // 更新时间
+	REMARK          string  `json:"remark"  xorm:"'REMARK'"`                   // 备注
+	CONVERTFACTOR   float64 `json:"convertfactor"  xorm:"'CONVERTFACTOR'"`     // 标仓系数
 }
 
 func (r *Ermcp3Wrstandard) calc() {
@@ -938,6 +939,7 @@ func (r *Ermcp3Wrstandard) buildSql() string {
 		"       ISVALID," +
 		"       to_char(UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
 		"       REMARK," +
+		"       CONVERTFACTOR," +
 		"       AREAUSERID" +
 		"  from wrstandard t" +
 		" where t.AREAUSERID=%v"
@@ -968,7 +970,7 @@ type Ermcp3AreaStockApply struct {
 	INOUTAPPLYID      string  `json:"inoutapplyid"  xorm:"'INOUTAPPLYID'"`           // 申请ID(607+Unix秒时间戳(10位)+xxxxxx)
 	USERID            int64   `json:"userid"  xorm:"'USERID'"`                       // 机构ID
 	INOUTTYPE         int32   `json:"inouttype"  xorm:"'INOUTTYPE'"`                 // 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
-	WRSTANDARDID      string  `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`           // 品类ID
+	WRSTANDARDID      int32   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`           // 品类ID
 	SPOTGOODSBRANDID  int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`   // 现货品牌ID
 	SPOTCONTRACTID    string  `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'"`       // 关联现货合同ID
 	WAREHOUSEINFOID   string  `json:"warehouseinfoid"  xorm:"'WAREHOUSEINFOID'"`     // 现货仓库ID
@@ -1004,6 +1006,8 @@ type Ermcp3AreaStockApply struct {
 	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`     // 现货品种id
 	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 现货品种代码
 	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 现货品种名称
+	BUYNICKNAME       string  `json:"buynickname"`                                   // 采购方昵称
+	SELLNICKNAME      string  `json:"sellnickname"`                                  // 销售方昵称
 
 	FilterStatus string `json:"-"` // 查询条件, 申请状态, 逗号隔开
 	FilterType   string `json:"-"` // 查询条件, 出入库类型, 逗号隔开
@@ -1013,9 +1017,9 @@ type Ermcp3AreaStockApply struct {
 
 func (r *Ermcp3AreaStockApply) calc() {
 	// 采购方名称
-	r.BUYUSERNAME = mtpcache.GetUserNameByUserId(r.BUYUSERID)
+	r.BUYUSERNAME, r.BUYNICKNAME = mtpcache.GetUserNameAndNickName(r.BUYUSERID)
 	// 销售方名称
-	r.SELLUSERNAME = mtpcache.GetUserNameByUserId(r.SELLUSERID)
+	r.SELLUSERNAME, r.SELLNICKNAME = mtpcache.GetUserNameAndNickName(r.SELLUSERID)
 	// 申请人名称
 	if r.APPLYSRC == 1 {
 		r.APPLYNAME = mtpcache.GetSystemmangerLoginCode(r.APPLYID)
@@ -1090,7 +1094,7 @@ func (r *Ermcp3AreaStockApply) buildSql() string {
 		sqlId.And("t.DELIVERYGOODSID", r.DELIVERYGOODSID)
 	}
 	// 品类id
-	if len(r.WRSTANDARDID) > 0 {
+	if r.WRSTANDARDID > 0 {
 		sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
 	}
 	// 品牌id
@@ -1287,7 +1291,7 @@ func (r *Ermcp3AreaStock) GetDataEx() (interface{}, error) {
 // Ermcp3AreaStockReport 库存报表
 type Ermcp3AreaStockReport struct {
 	USERID             int64   `json:"userid"  xorm:"'USERID'"`                         // 机构ID
-	WRSTANDARDID       string  `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`             // 品类ID
+	WRSTANDARDID       int32   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`             // 品类ID
 	SPOTGOODSBRANDID   int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`     // 现货品牌ID
 	WAREHOUSEINFOID    string  `json:"warehouseinfoid"  xorm:"'WAREHOUSEINFOID'"`       // 仓库ID
 	ORISTOCK           float64 `json:"oristock"  xorm:"'ORISTOCK'"`                     // 期初库存量
@@ -1368,9 +1372,7 @@ func (r *Ermcp3AreaStockReport) buildSql() string {
 	// 现货商品id
 	sqlId.AndEx("t.DELIVERYGOODSID", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	// 品类id
-	if len(r.WRSTANDARDID) > 0 {
-		sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
-	}
+	sqlId.AndEx("t.WRSTANDARDID", r.WRSTANDARDID, r.WRSTANDARDID > 0)
 	// 品牌id
 	if r.SPOTGOODSBRANDID > 0 {
 		sqlId.And("t.SPOTGOODSBRANDID", r.SPOTGOODSBRANDID)
@@ -1393,3 +1395,162 @@ func (r *Ermcp3AreaStockReport) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// Ermcp3SpotGoodsPrice 现货市价
+type Ermcp3SpotGoodsPrice struct {
+	WRSTANDARDID      int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`           // 现货品类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'"`                 // 品牌名称
+	GMUNITID          int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                   // 品类单位id
+	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`     // 现货商品id
+	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 现货商品代码
+	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 现货商品名称
+
+	OPERATORNAME  string `json:"operatorname"`  // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *Ermcp3SpotGoodsPrice) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetLoginCodeByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *Ermcp3SpotGoodsPrice) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       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 gmunitid," +
+		"       gb.dgfactoryitemvalue brandname," +
+		"       g.deliverygoodsid," +
+		"       g.deliverygoodscode," +
+		"       g.deliverygoodsname," +
+		"       g.goodsunitid unitid" +
+		"  FROM ERMCP_SPOTGOODSPRICE t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join dgfactoryitem gb" +
+		"    on t.spotgoodsbrandid = gb.dgfactoryitemid" +
+		"  left join deliverygoods g" +
+		"    on t.deliverygoodsid = g.deliverygoodsid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价
+func (r *Ermcp3SpotGoodsPrice) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3SpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}
+
+// Ermcp3SpotGoodsPriceLog 现货市价操作日志
+type Ermcp3SpotGoodsPriceLog struct {
+	LOGID             int64   `json:"logid"  xorm:"'LOGID'"`                         // 日志id
+	WRSTANDARDID      int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`           // 现货品类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'"`                 // 品牌名称
+	GMUNITID          int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                   // 品类单位id
+	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`     // 现货商品id
+	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 现货商品代码
+	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 现货商品名称
+
+	OPERATORNAME  string `json:"operatorname"`  // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *Ermcp3SpotGoodsPriceLog) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetLoginCodeByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *Ermcp3SpotGoodsPriceLog) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       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 gmunitid," +
+		"       gb.dgfactoryitemvalue brandname," +
+		"       g.goodsunitid unitid ," +
+		"       g.deliverygoodsid," +
+		"       g.deliverygoodscode," +
+		"       g.deliverygoodsname" +
+		"  FROM ERMCP_SPOTGOODSPRICELOG t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join dgfactoryitem gb" +
+		"    on t.spotgoodsbrandid = gb.dgfactoryitemid" +
+		"  left join deliverygoods g" +
+		"    on t.deliverygoodsid = g.deliverygoodsid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	sqlId.And("t.deliverygoodsid", r.DELIVERYGOODSID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价信息日志
+func (r *Ermcp3SpotGoodsPriceLog) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3SpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}

+ 19 - 6
models/ermcpAccMgr.go

@@ -38,10 +38,12 @@ type ErmcpLoginUser struct {
 	ROLESTATUS   int32  `json:"rolestatus"  xorm:"'ROLESTATUS'"`     // 角色状态 1-启用 2-停用
 	LOGINCODE    string `json:"logincode"  xorm:"'LOGINCODE'"`       // 登录代码
 	LOGINID      int64  `json:"loginid"  xorm:"'LOGINID'"`           // 登录id(LOGINID)
+	PASSWORD     string `json:"password"  xorm:"'PASSWORD'"`         // 密码(不可解密)
+	MOBILE       string `json:"mobile"  xorm:"'MOBILE'"`             // 手机号
 }
 
 func (r *ErmcpLoginUser) calc() {
-
+	r.MOBILE = DecryptField(r.MOBILE)
 }
 
 func (r *ErmcpLoginUser) buildSql() string {
@@ -59,13 +61,16 @@ func (r *ErmcpLoginUser) buildSql() string {
 		"       l.loginid," +
 		"       l.clientroleid," +
 		"       '企业成员' rolename," +
-		"       l.loginstatus" +
+		"       l.loginstatus," +
+		"       l.password," +
+		"       u.mobile" +
 		"  from useraccount t" +
 		"  left join loginaccount l" +
 		"    on t.userid = l.userid" +
+		"  left join userinfo u on t.userid=u.userid" +
 		"  left join tmp r" +
 		"    on t.userid = r.userid" +
-		" where 1=1" +
+		" where 1 = 1" +
 		"   and t.memberuserid = %v" +
 		"   and t.usertype = 7" +
 		" union all " +
@@ -81,12 +86,17 @@ func (r *ErmcpLoginUser) buildSql() string {
 		"       l.loginid," +
 		"       l.clientroleid," +
 		"       Nvl(r.rolename, l.clientroleid) rolename," +
-		"       l.loginstatus" +
+		"       l.loginstatus," +
+		"       l.password," +
+		"       u.mobile" +
 		"  from useraccount t" +
 		"  left join loginaccount l" +
 		"    on t.userid = l.userid" +
-		"  left join systemmanagerrole r on l.clientroleid=r.autoid and r.areauserid=l.userid" +
-		" where 1=1" +
+		"  left join userinfo u on t.userid=u.userid" +
+		"  left join systemmanagerrole r" +
+		"    on l.clientroleid = r.autoid" +
+		"   and r.areauserid = l.userid" +
+		" where 1 = 1" +
 		"   and t.userid = %v" +
 		"   and t.usertype = 2"
 	sqlId.FormatParam(r.USERID, r.USERID)
@@ -131,6 +141,9 @@ func (r *ErmcpLoginUser) GetDataEx() (interface{}, error) {
 	// 查询用户
 	sData := make([]ErmcpLoginUser, 0)
 	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
 	for _, v := range sData {
 		for i := range sDataEx {
 			if v.USERTYPE == 2 {

+ 10 - 1
models/ermcpUser.go

@@ -98,6 +98,9 @@ type ErmcpUserModel struct {
 	MODIFYTIME        string `json:"modifytime"  xorm:"'MODIFYTIME'"`               // 修改时间
 	AUDITTIME         string `json:"audittime"  xorm:"'AUDITTIME'"`                 // 审核时间
 	NICKNAME          string `json:"nickname"  xorm:"'NICKNAME'"`                   // 昵称
+	TAXPAYERNUM       string `json:"taxpayernum"  xorm:"'taxpayernum'"`             // 纳税人识别号
+	LEGALPERSONNAME   string `json:"legalpersonname"  xorm:"'legalpersonname'"`     // 法人姓名(企业)
+	CONTACTNAME       string `json:"contactname"  xorm:"'contactname'"`             // 联系人
 }
 
 func (r *ErmcpUserModel) buildWskhSql(accStatus string) string {
@@ -122,7 +125,10 @@ func (r *ErmcpUserModel) buildWskhSql(accStatus string) string {
 		"       to_char(t.createtime,'yyyy-mm-dd hh24:mi:ss') createtime," +
 		"       t.cityid," +
 		"       to_char(t.modifiedtime,'yyyy-mm-dd hh24:mi:ss') modifytime," +
-		"       to_char(t.auditime,'yyyy-mm-dd hh24:mi:ss') audittime" +
+		"       to_char(t.auditime,'yyyy-mm-dd hh24:mi:ss') audittime," +
+		"       t.taxpayernum," +
+		"       t.legalpersonname," +
+		"       t.contactname" +
 		"  from wskh_userinfo t" +
 		"  left join enumdicitem e" +
 		"    on t.cardtype = e.enumitemname" +
@@ -153,6 +159,9 @@ func (r *ErmcpUserModel) buildSql(accStatus string) string {
 		"       u.countryid," +
 		"       u.provinceid," +
 		"       u.districtid," +
+		"       u.taxpayernum," +
+		"       u.legalpersonname," +
+		"       u.contactname," +
 		"       to_char(t.createtime,'yyyy-mm-dd hh24:mi:ss') createtime," +
 		"       to_char(t.modifytime,'yyyy-mm-dd hh24:mi:ss') modifytime," +
 		"       to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +

+ 2 - 0
routers/router.go

@@ -427,6 +427,8 @@ func InitRouter() *gin.Engine {
 		ermcp3R.GET("/QueryAreaStockApplySum", ermcp3.QueryAreaStockApplySum)
 		ermcp3R.GET("/QueryAreaStockReport", ermcp3.QueryAreaStockReport)
 		ermcp3R.GET("/QueryAreaStockReportDetail", ermcp3.QueryAreaStockReportDetail)
+		ermcp3R.GET("/QuerySpotGoodsPrice", ermcp3.QuerySpotGoodsPrice)
+		ermcp3R.GET("/QuerySpotGoodsPriceLog", ermcp3.QuerySpotGoodsPriceLog)
 	}
 
 	return r