作者 yangfu

公司审核 启用修改

... ... @@ -20,7 +20,18 @@ type AuditCompanyCommand struct {
}
func (updateCompanyCommand *AuditCompanyCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
if !(updateCompanyCommand.Status == 1 || updateCompanyCommand.Status == 2) {
validation.Error("状态有误")
return
}
if updateCompanyCommand.Status == 1 {
updateCompanyCommand.Status = 2
return
}
if updateCompanyCommand.Status == 2 {
updateCompanyCommand.Status = 3
return
}
}
func (updateCompanyCommand *AuditCompanyCommand) ValidateCommand() error {
... ...
... ... @@ -17,6 +17,18 @@ type EnableCompanyCommand struct {
func (updateCompanyCommand *EnableCompanyCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
if !(updateCompanyCommand.Status == 1 || updateCompanyCommand.Status == 2) {
validation.Error("状态有误")
return
}
if updateCompanyCommand.Status == 1 {
updateCompanyCommand.Status = 2
return
}
if updateCompanyCommand.Status == 2 {
updateCompanyCommand.Status = 4
return
}
}
func (updateCompanyCommand *EnableCompanyCommand) ValidateCommand() error {
... ...
... ... @@ -46,6 +46,9 @@ func (companyService *CompanyService) GetCompany(getCompanyQuery *query.GetCompa
}
func (companyService *CompanyService) AuditCompany(cmd *command.AuditCompanyCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err := creationUserGateway.AuditCompany(allied_creation_user.ReqCompanyAudit{
CompanyId: int(cmd.CompanyId),
... ... @@ -72,6 +75,9 @@ func (companyService *CompanyService) AuditCompany(cmd *command.AuditCompanyComm
}
func (companyService *CompanyService) EnableCompany(cmd *command.EnableCompanyCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err := creationUserGateway.EnableCompany(allied_creation_user.ReqCompanyEnable{
CompanyId: int(cmd.CompanyId),
... ...
... ... @@ -34,6 +34,9 @@ func (dto *UserBaseDto) LoadDto(detail allied_creation_user.UserBaseDetail) {
dto.LastLogIn = detail.LastLogIn
var organizations []string
for i := range detail.UserOrg {
if len(detail.UserOrg[i].OrgName) == 0 {
continue
}
organizations = append(organizations, detail.UserOrg[i].OrgName)
}
dto.Organizations = strings.Join(organizations, ",")
... ...