浏览代码

wip:提交

wangkaiyue 1 年之前
父节点
当前提交
13a7d4f2db
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 8 4
      run/flushDb/pdfFlushPower/flushEnt.go
  2. 1 1
      run/flushDb/pdfFlushPower/flushPersonal.go

+ 8 - 4
run/flushDb/pdfFlushPower/flushEnt.go

@@ -28,6 +28,7 @@ type (
 	Detailed struct {
 		AccountId    string    `xorm:"accountId" form:"accountId" json:"accountId"`          //账户标识
 		CompanyId    int64     `xorm:"companyId" form:"companyId" json:"companyId"`          //企业标识
+		EmpowerId    int64     `xorm:"empowerId" form:"empowerId" json:"empowerId"`          //企业分配权益
 		ResourceType string    `xorm:"resourceType" form:"resourceType" json:"resourceType"` //资源类型
 		Number       int64     `xorm:"number" form:"number" json:"number"`                   //数量
 		CreateTime   time.Time `xorm:"createTime" form:"createTime" json:"createTime"`       //创建时间
@@ -39,6 +40,7 @@ type (
 	Balance struct {
 		AccountId    string `xorm:"accountId" form:"accountId" json:"accountId"`          //账户标识
 		CompanyId    int64  `xorm:"companyId" form:"companyId" json:"companyId"`          //企业标识
+		EmpowerId    int64  `xorm:"empowerId" form:"empowerId" json:"empowerId"`          //企业分配权益
 		DepartmentId int64  `xorm:"departmentId" form:"departmentId" json:"departmentId"` //组织标识
 		Name         string `xorm:"name" form:"name" json:"name"`                         //资源名称
 		ResourceType string `xorm:"resourceType" form:"resourceType" json:"resourceType"` //资源代码
@@ -91,7 +93,7 @@ func flushEnt(ctx context.Context) error {
 			}
 
 			if len(userDetail.List()) != m.UseCount || m.UseCount > m.EmpowerCount {
-				g.Log().Errorf(ctx, "entBuyQuery权益分配异%s %s 常 总量%d 已分配%d", entId, m.Id, m.EmpowerCount, m.UseCount)
+				g.Log().Infof(ctx, "entBuyQuery权益分配异%s %s 常 总量%d 已分配%d", entId, m.Id, m.EmpowerCount, m.UseCount)
 			}
 
 			var (
@@ -115,7 +117,7 @@ func flushEnt(ctx context.Context) error {
 			}
 
 			if len(positionIdArr) != m.UseCount {
-				g.Log().Errorf(ctx, "entBuyQuery查询queryPosId已分配数量和查询到的职位id数量不一致%s %s %v", entId, m.Id, positionIdArr)
+				g.Log().Infof(ctx, "entBuyQuery查询queryPosId已分配数量和查询到的职位id数量不一致%s %s %v", entId, m.Id, positionIdArr)
 			}
 
 			//未分配数量插入占位职位id
@@ -127,7 +129,7 @@ func flushEnt(ctx context.Context) error {
 			if arr := strings.Split(m.EndTime, " "); len(arr) == 2 {
 				eTime = arr[0]
 			}
-			if err := pack.InsertDb(entId, eTime, positionIdArr...); err != nil {
+			if err := pack.InsertDb(entId, m.Id, eTime, positionIdArr...); err != nil {
 				g.Log().Errorf(ctx, "entBuyQuery插入权益包异常%s %s %v %v", entId, m.Id, positionIdArr, err)
 			}
 		}
@@ -222,7 +224,7 @@ func getPackNum(entId string, pMap []*entBuy) (map[string]*packNum, error) {
 	return returnData, nil
 }
 
-func (p *packNum) InsertDb(companyId, endTime string, positionId ...string) error {
+func (p *packNum) InsertDb(companyId, empowerId, endTime string, positionId ...string) error {
 	err := g.DB("jy_user_center").Transaction(gctx.New(), func(ctx context.Context, tx gdb.TX) error {
 		// 资源中台操作
 		var insert = func(ResourceType string, num int) error {
@@ -259,6 +261,8 @@ func (p *packNum) InsertDb(companyId, endTime string, positionId ...string) erro
 				if companyId != "" {
 					t.CompanyId = gconv.Int64(companyId)
 					t2.CompanyId = gconv.Int64(companyId)
+					t.EmpowerId = gconv.Int64(empowerId)
+					t2.EmpowerId = gconv.Int64(empowerId)
 				}
 				sources = append(sources, t)
 				balance = append(balance, t2)

+ 1 - 1
run/flushDb/pdfFlushPower/flushPersonal.go

@@ -41,7 +41,7 @@ func flushPersonal(ctx context.Context) error {
 		if gconv.Int(m["buy_count"]) > 0 { //个人版主张号共享额度
 			finalUserId = fmt.Sprintf("p_share_%s", userId)
 		}
-		if err := pack.InsertDb("", eTime, finalUserId); err != nil {
+		if err := pack.InsertDb("", "", eTime, finalUserId); err != nil {
 			g.Log().Errorf(ctx, "flushPersonal插入权益包异常%s %s %v", userId, order_code, err)
 		}
 	}