Jelajahi Sumber

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

zhou.xiaoning 4 tahun lalu
induk
melakukan
0a44b4cf53
5 mengubah file dengan 8808 tambahan dan 9856 penghapusan
  1. 2940 3337
      docs/docs.go
  2. 2940 3337
      docs/swagger.json
  3. 2883 3160
      docs/swagger.yaml
  4. 21 0
      models/ermcpOPApply.go
  5. 24 22
      models/ermcpReport.go

File diff ditekan karena terlalu besar
+ 2940 - 3337
docs/docs.go


File diff ditekan karena terlalu besar
+ 2940 - 3337
docs/swagger.json


File diff ditekan karena terlalu besar
+ 2883 - 3160
docs/swagger.yaml


+ 21 - 0
models/ermcpOPApply.go

@@ -10,6 +10,8 @@ import (
 	"fmt"
 	"mtp2_if/db"
 	"mtp2_if/logger"
+	"mtp2_if/mtpcache"
+	"strconv"
 )
 
 // ErmcpOPApplyModel 现货合同操作数据
@@ -32,6 +34,7 @@ type ErmcpOPApplyModel struct {
 	EnumdicName      string  `json:"enumdicname"  xorm:"'ENUMDICNAME'"`           // 单位名称
 	BUYUSERNAME      string  `json:"buyusername"  xorm:"'BUYUSERNAME'"`           // 采购方名称
 	SELLUSERNAME     string  `json:"sellusername"  xorm:"'SELLUSERNAME'"`         // 销售方名字
+	AUDITID          string  `json:"auditid"  xorm:"'AUDITID'"`                   // 审核人ID
 	APPLYNAME        string  `json:"applyname"  xorm:"'APPLYNAME'"`               // 申请人名称
 	AUDITNAME        string  `json:"auditname"  xorm:"'AUDITNAME'"`               // 审核人名称
 	CONTRACTSTATUS   int32   `json:"contractstatus"  xorm:"'CONTRACTSTATUS'"`     // 合同状态- 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
@@ -41,6 +44,21 @@ type ErmcpOPApplyModel struct {
 	WRSTANDARDID     int     `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`         // 现货商品id
 }
 
+func (r *ErmcpOPApplyModel) calc() {
+	// 管理端applyid存的是管理员表的autoid
+	if len(r.APPLYID) < 8 && r.APPLYNAME == "" {
+		if id, err := strconv.ParseInt(r.APPLYID, 10, 64); err == nil {
+			r.APPLYNAME = mtpcache.GetSystemmangerLoginCode(id)
+		}
+	}
+
+	if len(r.AUDITID) < 8 && r.AUDITNAME == "" {
+		if id, err := strconv.ParseInt(r.AUDITID, 10, 64); err == nil {
+			r.AUDITNAME = mtpcache.GetSystemmangerLoginCode(id)
+		}
+	}
+}
+
 func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 	sqlId := "select to_char(t.OPERATEAPPLYID) OPERATEAPPLYID," +
 		"       t.OPERATEAPPLYTYPE," +
@@ -109,5 +127,8 @@ func (r *ErmcpOPApplyModel) GetData(opType int32) ([]ErmcpOPApplyModel, error) {
 		logger.GetLogger().Errorf("ermcp query fail:%v", err)
 		return sData, err
 	}
+	for i := range sData {
+		sData[i].calc()
+	}
 	return sData, nil
 }

+ 24 - 22
models/ermcpReport.go

@@ -107,6 +107,8 @@ type ErmcpReportOPLog struct {
 	OPTYPENAME     string `json:"optypename"`                              // 流水类型名称
 	LOGTYPENAME    string `json:"logtypename"`                             // 合同类型(名称)
 	APPLYNAME      string `json:"applyname"`                               // 操作人名称
+	BRANDNAME      string `json:"brandname"  xorm:"'brandname'"`           // 品牌名称
+	MODELNAME      string `json:"modelname"  xorm:"'modelname'"`           // 型号名称
 
 	LogTypeFilter string `json:"-"` // 查询日志类型, 逗号隔开(如 1,2,4)
 }
@@ -162,6 +164,11 @@ func (r *ErmcpReportOPLog) Calc() {
 		}
 	}
 
+	// 去除多余的0,最后4个0
+	if r.LOGVALUE[len(r.LOGVALUE)-4:] == "0000" {
+		r.LOGVALUE = r.LOGVALUE[:len(r.LOGVALUE)-4]
+	}
+
 	if r.BIZTYPE == 1 {
 		r.LOGTYPENAME += "计划"
 	} else if r.BIZTYPE == 2 {
@@ -170,21 +177,7 @@ func (r *ErmcpReportOPLog) Calc() {
 }
 
 func (r *ErmcpReportOPLog) buildSql() string {
-	var sqlId utils.SQLVal = "with tmp as" +
-		" (select to_char(t.hedgeplanid) relatedid," +
-		"         t.hedgeplanno relatedno," +
-		"         1 as logType," +
-		"         t.contracttype" +
-		"    from ermcp_hedgeplan t" +
-		"   where t.areauserid = %v" +
-		"  union all" +
-		"  select to_char(t.spotcontractid)," +
-		"         t.contractno," +
-		"         2 as logType," +
-		"         t.contracttype" +
-		"    from ermcp_spotcontract t" +
-		"   where t.userid = %v)" +
-		" SELECT to_char(t.LOGID) LOGID," +
+	var sqlId utils.SQLVal = "SELECT to_char(t.LOGID) LOGID," +
 		"       t.BIZTYPE," +
 		"       t.OPERATELOGTYPE," +
 		"       to_char(t.RELATEDID) RELATEDID," +
@@ -195,17 +188,26 @@ func (r *ErmcpReportOPLog) buildSql() string {
 		"       t.CONTRACTTYPE," +
 		"       t.USERID," +
 		"       t.WRSTANDARDID," +
-		"       tmp.relatedno," +
+		"       s.contractno relatedno," +
+		"       s.spotgoodsbrandid," +
+		"       s.spotgoodsmodelid," +
 		"       w.wrstandardname," +
 		"       w.wrstandardcode," +
-		"       w.unitid" +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname" +
 		"  FROM ERMCP_CONTRACTOPERATELOG t" +
-		" inner join tmp" +
-		"    on t.RELATEDID = tmp.RELATEDID" +
+		" inner join ermcp_spotcontract s" +
+		"    on t.RELATEDID = s.spotcontractid" +
 		"   and t.userid = %v" +
-		"   left join wrstandard w on t.wrstandardid=w.wrstandardid" +
-		" WHERE 1 = 1"
-	sqlId = utils.SQLVal(fmt.Sprintf(sqlId.String(), r.USERID, r.USERID, r.USERID))
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on s.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on s.spotgoodsmodelid = gm.modelid" +
+		" WHERE t.biztype = 2"
+	sqlId = utils.SQLVal(fmt.Sprintf(sqlId.String(), r.USERID))
 	// 筛选条件
 	sqlId.And("t.TRADEDATE", r.TRADEDATE)
 	if r.WRSTANDARDID > 0 {

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini