切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
庄敏学
2 years ago
提交
7177400d6169ef0b3c0658b03a222112e9c86ca6
2 个父辈
b92074a8
f9ce9e7e
Merge branch 'test' of
http://gitlab.fjmaimaimai.com/allied-creation/performance
into test
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
68 行增加
和
3 行删除
pkg/application/evaluation_rule/adapter/rule_adapter.go
pkg/application/evaluation_rule/command/rule_query.go
pkg/application/evaluation_rule/rule_service.go
pkg/port/beego/controllers/evaluation_rule_controller.go
pkg/port/beego/controllers/evaluation_template_controller.go
pkg/port/beego/routers/evaluation_rule_router.go
pkg/port/beego/routers/evaluation_template_router.go
pkg/application/evaluation_rule/adapter/rule_adapter.go
查看文件 @
7177400
...
...
@@ -8,3 +8,8 @@ type RuleAdapter struct {
*
domain
.
EvaluationRule
CreatorName
string
`json:"creatorName" comment:"创建人名称"`
}
type
CreatorAdapter
struct
{
Id
int64
`json:"id,string" comment:"创建人ID"`
Name
string
`json:"name" comment:"创建人名称"`
}
...
...
pkg/application/evaluation_rule/command/rule_query.go
查看文件 @
7177400
...
...
@@ -11,9 +11,20 @@ type QueryRuleCommand struct {
PageSize
int64
`cname:"分页数量" json:"pageSize" valid:"Required"`
}
type
QueryCreatorCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
}
func
(
in
*
QueryRuleCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
in
.
CompanyId
==
0
{
validation
.
SetError
(
"companyId"
,
"公司ID无效"
)
return
}
}
func
(
in
*
QueryCreatorCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
in
.
CompanyId
==
0
{
validation
.
SetError
(
"companyId"
,
"公司ID无效"
)
return
}
}
...
...
pkg/application/evaluation_rule/rule_service.go
查看文件 @
7177400
...
...
@@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i
}
return
tool_funs
.
SimpleWrapGridMap
(
total
,
ras
),
nil
}
func
(
rs
*
EvaluationRuleService
)
ListCreator
(
in
*
command
.
QueryCreatorCommand
)
(
interface
{},
error
)
{
transactionContext
,
err
:=
factory
.
StartTransaction
()
if
err
!=
nil
{
return
nil
,
err
}
defer
func
()
{
transactionContext
.
RollbackTransaction
()
}()
ruleRepository
:=
factory
.
CreateEvaluationRuleRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
userRepository
:=
factory
.
CreateUserRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
rules
,
err
:=
ruleRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
in
))
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 获取所有创建人ID
creatorMap
:=
map
[
int64
]
int64
{}
for
i
:=
range
rules
{
creatorMap
[
rules
[
i
]
.
CreatorId
]
=
rules
[
i
]
.
CreatorId
}
creatorIds
:=
make
([]
int64
,
0
)
for
k
:=
range
creatorMap
{
creatorIds
=
append
(
creatorIds
,
k
)
}
_
,
users
,
_
:=
userRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
creatorIds
,
"limit"
:
len
(
creatorIds
)})
cas
:=
make
([]
*
adapter
.
CreatorAdapter
,
0
)
for
i
:=
range
users
{
ca
:=
&
adapter
.
CreatorAdapter
{
Id
:
users
[
i
]
.
Id
,
Name
:
users
[
i
]
.
Name
,
}
cas
=
append
(
cas
,
ca
)
}
return
map
[
string
]
interface
{}{
"list"
:
cas
},
nil
}
...
...
pkg/port/beego/controllers/evaluation_rule_controller.go
查看文件 @
7177400
...
...
@@ -85,7 +85,19 @@ func (controller *RuleController) ListRuleRelCreator() {
}
ua
:=
middlewares
.
GetUser
(
controller
.
Ctx
)
in
.
CompanyId
=
ua
.
CompanyId
//in.CompanyId = middlewares.GetCompanyId(controller.Ctx)
controller
.
Response
(
ruService
.
ListRelCreator
(
in
))
}
}
func
(
controller
*
RuleController
)
ListCreator
()
{
ruService
:=
service
.
NewEvaluationRuleService
()
in
:=
&
command
.
QueryCreatorCommand
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
ua
:=
middlewares
.
GetUser
(
controller
.
Ctx
)
in
.
CompanyId
=
ua
.
CompanyId
controller
.
Response
(
ruService
.
ListCreator
(
in
))
}
}
...
...
pkg/port/beego/controllers/evaluation_template_controller.go
查看文件 @
7177400
...
...
@@ -111,8 +111,6 @@ func (controller *TemplateController) CopyTemplate() {
ua
:=
middlewares
.
GetUser
(
controller
.
Ctx
)
in
.
CompanyId
=
ua
.
CompanyId
in
.
CreatorId
=
ua
.
UserId
//in.CompanyId = middlewares.GetCompanyId(controller.Ctx)
//in.CreatorId = middlewares.GetUserId(controller.Ctx)
controller
.
Response
(
ruService
.
Copy
(
in
))
}
}
...
...
pkg/port/beego/routers/evaluation_rule_router.go
查看文件 @
7177400
...
...
@@ -15,6 +15,7 @@ func init() {
web
.
NSRouter
(
"/"
,
&
controllers
.
RuleController
{},
"Delete:RemoveRule"
),
web
.
NSRouter
(
"/:Id"
,
&
controllers
.
RuleController
{},
"Get:GetRule"
),
web
.
NSRouter
(
"/list"
,
&
controllers
.
RuleController
{},
"Post:ListRuleRelCreator"
),
web
.
NSRouter
(
"/list-creator"
,
&
controllers
.
RuleController
{},
"Post:ListCreator"
),
)
web
.
AddNamespace
(
ns
)
}
...
...
pkg/port/beego/routers/evaluation_template_router.go
查看文件 @
7177400
...
...
@@ -16,6 +16,7 @@ func init() {
web
.
NSRouter
(
"/:Id"
,
&
controllers
.
TemplateController
{},
"Get:GetTemplate"
),
web
.
NSRouter
(
"/list"
,
&
controllers
.
TemplateController
{},
"Post:ListTemplate"
),
web
.
NSRouter
(
"/list-enable"
,
&
controllers
.
TemplateController
{},
"Post:ListEnableTemplate"
),
web
.
NSRouter
(
"/copy"
,
&
controllers
.
TemplateController
{},
"Post:CopyTemplate"
),
)
web
.
AddNamespace
(
ns
)
}
...
...
请
注册
或
登录
后发表评论