...
|
...
|
@@ -93,12 +93,70 @@ func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) ( |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
err = l.initSystemData(companyId)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 后台登录时 ,检查/设置公司的初始数据
|
|
|
// 后台登录时检查/设置公司的初始数据
|
|
|
func (l *SystemUserInfoLogic) initSystemData(companyId int64) error {
|
|
|
// TODO 初始设置文章标签
|
|
|
// 初始设置文章标签
|
|
|
queryOption := domain.NewQueryOptions().WithCountOnly()
|
|
|
conn := l.svcCtx.DefaultDBConn()
|
|
|
cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, companyId, queryOption)
|
|
|
if err != nil {
|
|
|
return xerr.NewErrMsgErr("初始话公司数据失败", err)
|
|
|
}
|
|
|
if cnt == 0 {
|
|
|
articleTags := []*domain.ArticleTag{
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "紧急重要", Category: "紧急重要", Remark: "优先解决", SortBy: 1,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "不紧急不重要", Category: "紧急重要", Remark: "给别人做", SortBy: 2,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "紧急不重要", Category: "紧急重要", Remark: "有空再做", SortBy: 3,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "不紧急重要", Category: "紧急重要", Remark: "制定计划去做", SortBy: 4,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "大机会高风险", Category: "机会风险", Remark: "谨慎考虑专项讨论", SortBy: 5,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "大机会中风险", Category: "机会风险", Remark: "加大关注值得尝试", SortBy: 6,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "大机会低风险", Category: "机会风险", Remark: "全员投入抓紧落实", SortBy: 7,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "中机会高风险", Category: "机会风险", Remark: "专人跟踪成立项目", SortBy: 8,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "中机会中风险", Category: "机会风险", Remark: "讨论落实", SortBy: 9,
|
|
|
},
|
|
|
{
|
|
|
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
|
|
|
Name: "中机会低风险", Category: "机会风险", Remark: "解决问题多手准备", SortBy: 10,
|
|
|
},
|
|
|
}
|
|
|
err = l.svcCtx.ArticleTagRepository.CreateInBatches(l.ctx, conn, articleTags)
|
|
|
if err != nil {
|
|
|
return xerr.NewErrMsgErr("初始话公司数据失败", err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return nil
|
|
|
} |
...
|
...
|
|