|
@@ -28,6 +28,7 @@ type (
|
|
Detailed struct {
|
|
Detailed struct {
|
|
AccountId string `xorm:"accountId" form:"accountId" json:"accountId"` //账户标识
|
|
AccountId string `xorm:"accountId" form:"accountId" json:"accountId"` //账户标识
|
|
CompanyId int64 `xorm:"companyId" form:"companyId" json:"companyId"` //企业标识
|
|
CompanyId int64 `xorm:"companyId" form:"companyId" json:"companyId"` //企业标识
|
|
|
|
+ EmpowerId int64 `xorm:"empowerId" form:"empowerId" json:"empowerId"` //企业分配权益
|
|
ResourceType string `xorm:"resourceType" form:"resourceType" json:"resourceType"` //资源类型
|
|
ResourceType string `xorm:"resourceType" form:"resourceType" json:"resourceType"` //资源类型
|
|
Number int64 `xorm:"number" form:"number" json:"number"` //数量
|
|
Number int64 `xorm:"number" form:"number" json:"number"` //数量
|
|
CreateTime time.Time `xorm:"createTime" form:"createTime" json:"createTime"` //创建时间
|
|
CreateTime time.Time `xorm:"createTime" form:"createTime" json:"createTime"` //创建时间
|
|
@@ -39,6 +40,7 @@ type (
|
|
Balance struct {
|
|
Balance struct {
|
|
AccountId string `xorm:"accountId" form:"accountId" json:"accountId"` //账户标识
|
|
AccountId string `xorm:"accountId" form:"accountId" json:"accountId"` //账户标识
|
|
CompanyId int64 `xorm:"companyId" form:"companyId" json:"companyId"` //企业标识
|
|
CompanyId int64 `xorm:"companyId" form:"companyId" json:"companyId"` //企业标识
|
|
|
|
+ EmpowerId int64 `xorm:"empowerId" form:"empowerId" json:"empowerId"` //企业分配权益
|
|
DepartmentId int64 `xorm:"departmentId" form:"departmentId" json:"departmentId"` //组织标识
|
|
DepartmentId int64 `xorm:"departmentId" form:"departmentId" json:"departmentId"` //组织标识
|
|
Name string `xorm:"name" form:"name" json:"name"` //资源名称
|
|
Name string `xorm:"name" form:"name" json:"name"` //资源名称
|
|
ResourceType string `xorm:"resourceType" form:"resourceType" json:"resourceType"` //资源代码
|
|
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 {
|
|
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 (
|
|
var (
|
|
@@ -115,7 +117,7 @@ func flushEnt(ctx context.Context) error {
|
|
}
|
|
}
|
|
|
|
|
|
if len(positionIdArr) != m.UseCount {
|
|
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
|
|
//未分配数量插入占位职位id
|
|
@@ -127,7 +129,7 @@ func flushEnt(ctx context.Context) error {
|
|
if arr := strings.Split(m.EndTime, " "); len(arr) == 2 {
|
|
if arr := strings.Split(m.EndTime, " "); len(arr) == 2 {
|
|
eTime = arr[0]
|
|
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)
|
|
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
|
|
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 {
|
|
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 {
|
|
var insert = func(ResourceType string, num int) error {
|
|
@@ -259,6 +261,8 @@ func (p *packNum) InsertDb(companyId, endTime string, positionId ...string) erro
|
|
if companyId != "" {
|
|
if companyId != "" {
|
|
t.CompanyId = gconv.Int64(companyId)
|
|
t.CompanyId = gconv.Int64(companyId)
|
|
t2.CompanyId = gconv.Int64(companyId)
|
|
t2.CompanyId = gconv.Int64(companyId)
|
|
|
|
+ t.EmpowerId = gconv.Int64(empowerId)
|
|
|
|
+ t2.EmpowerId = gconv.Int64(empowerId)
|
|
}
|
|
}
|
|
sources = append(sources, t)
|
|
sources = append(sources, t)
|
|
balance = append(balance, t2)
|
|
balance = append(balance, t2)
|