作者 yangfu

共创项目列表修改

... ... @@ -19,6 +19,7 @@ require (
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.3
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shopspring/decimal v1.2.0
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/valyala/fasthttp v1.28.0 // indirect
... ... @@ -27,5 +28,4 @@ require (
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
github.com/shopspring/decimal v1.2.0
)
... ...
... ... @@ -223,6 +223,8 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
... ...
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
type CooperationProjectsDto struct {
*domain.CooperationProject
CooperationMode *CooperationMode `json:"cooperationMode"`
}
type CooperationMode struct {
// 共创模式ID
CooperationModeId int64 `json:"cooperationModeId,string"`
// 共创模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,唯一确定
CooperationModeName string `json:"cooperationModeName"`
}
func (dto *CooperationProjectsDto) LoadDto(project *domain.CooperationProject, mode *domain.CooperationMode) {
dto.CooperationProject = project
dto.CooperationMode = &CooperationMode{
CooperationModeId: mode.CooperationModeId,
CooperationModeName: mode.CooperationModeName,
CooperationModeNumber: mode.CooperationModeNumber,
}
}
... ...
... ... @@ -5,6 +5,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
... ... @@ -119,13 +120,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
}
newCooperationProject := &domain.CooperationProject{
CooperationProjectNumber: "",
CooperationProjectNumber: createCooperationProjectCommand.CooperationModeNumber,
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
CooperationProjectSponsor: sponsor,
CooperationProjectPublisher: publisher,
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
CooperationProjectPublishTime: time.Now(),
Company: company,
Department: organization.ToDepartment(),
Org: organization,
Operator: operator,
OperateTime: time.Now(),
... ... @@ -215,13 +218,40 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
if count, cooperationProjects, err := cooperationProjectRepository.Find(tool_funs.SimpleStructToMap(listCooperationProjectQuery)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
//var cooperationModeRepository domain.CooperationModeRepository
//if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// cooperationProjectRepository = value
//}
//var modeMap = make(map[string]*domain.CooperationMode)
//if _, cooperationProjects, err := cooperationModeRepository.Find(map[string]interface{}{"companyId":listCooperationProjectQuery.CompanyId,"orgId":listCooperationProjectQuery.OrgId}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//}else{
// for i:=range cooperationProjects{
// p :=cooperationProjects[i]
// modeMap[p.CooperationModeNumber]=p
// }
//}
//
var res []*dto.CooperationProjectsDto
for i := range cooperationProjects {
p := cooperationProjects[i]
tp := &dto.CooperationProjectsDto{}
tp.LoadDto(p, &domain.CooperationMode{})
res = append(res, tp)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
//"grid": map[string]interface{}{
"total": count,
"list": cooperationProjects,
"list": res,
//},
}, nil
}
... ...
... ... @@ -9,3 +9,10 @@ type Org struct {
// 公司
Company *Company `json:"company"`
}
func (org *Org) ToDepartment() *Department {
return &Department{
DepartmentId: org.OrgId,
DepartmentName: org.OrgName,
}
}
... ...
... ... @@ -7,15 +7,15 @@ type User struct {
// 用户基本id
UserBaseId int64 `json:"userBaseId,string"`
// 用户所属组织机构
Org *Org `json:"org"`
Org *Org `json:"org,omitempty"`
// 用户关联的组织机构
Orgs []*Org `json:"orgs"`
Orgs []*Org `json:"orgs,omitempty"`
// 用户所属的部门
Department *Department `json:"department"`
// 用户角色
Roles []*Role `json:"role"`
Roles []*Role `json:"role,omitempty"`
// 冗余字段,jsonb格式,不限制存放内容
UserInfo *UserInfo `json:"userInfo"`
UserInfo *UserInfo `json:"userInfo,omitempty"`
// 用户类型
UserType int32 `json:"userType"`
// 用户姓名
... ... @@ -25,5 +25,5 @@ type User struct {
// 状态
Status int32 `json:"status"`
// 用户关联公司信息
Company *Company `json:"company"`
Company *Company `json:"company,omitempty"`
}
... ...
... ... @@ -175,12 +175,16 @@ func (translator *UserTranslator) ToOperatorFromRepresentation(user *UserDetail)
Orgs: nil,
Department: nil,
Roles: nil,
UserInfo: nil,
UserType: 0,
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
Status: 0,
Company: nil,
UserInfo: &domain.UserInfo{
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
UserAvatar: user.UserInfo.Avatar,
},
UserType: 0,
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
Status: 0,
Company: nil,
}, nil
}
... ... @@ -192,12 +196,16 @@ func (translator *UserTranslator) ToUserFromRepresentation(user *UserDetail) (*d
Orgs: nil,
Department: nil,
Roles: nil,
UserInfo: nil,
UserType: 0,
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
Status: 0,
Company: nil,
UserInfo: &domain.UserInfo{
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
UserAvatar: user.UserInfo.Avatar,
},
UserType: 0,
UserName: user.UserInfo.UserName,
UserPhone: user.UserInfo.Phone,
Status: 0,
Company: nil,
}, nil
}
... ...