作者 tangxuhui

修正添加项目

... ... @@ -23,7 +23,7 @@ type CreateCooperationProjectCommand struct {
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
//图片
Images []string `json:"images"`
Images []*domain.Attachment `json:"images"`
}
func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -25,7 +25,7 @@ type UpdateCooperationProjectCommand struct {
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
//图片
Images []string `json:"images"`
Images []domain.Attachment `json:"images"`
}
func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -7,7 +7,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
... ... @@ -22,12 +21,6 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationProjectCommand.Operator)
var images []*domain.Attachment
for _, v := range createCooperationProjectCommand.Images {
images = append(images, &domain.Attachment{
Url: v,
})
}
result, err := creationCooperationGateway.CooperationProjectAdd(allied_creation_cooperation.ReqCooperationProjectAdd{
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
... ... @@ -36,7 +29,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
SponsorUid: createCooperationProjectCommand.CooperationProjectSponsor,
DepartmentId: int(createCooperationProjectCommand.DepartmentId),
CooperationProjectUndertakerType: createCooperationProjectCommand.CooperationProjectUndertakerType,
Attachment: images,
Attachment: createCooperationProjectCommand.Images,
})
if err != nil {
... ... @@ -141,12 +134,6 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
var images []domain.Attachment
for _, v := range updateCooperationProjectCommand.Images {
images = append(images, domain.Attachment{
Url: v,
})
}
_, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{
CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId,
CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName,
... ... @@ -155,7 +142,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
SponsorUid: updateCooperationProjectCommand.CooperationProjectSponsor,
PublisherUid: strconv.Itoa(int(updateCooperationProjectCommand.Operator.UserId)),
CooperationProjectDescription: updateCooperationProjectCommand.CooperationProjectDescription,
Attachment: images,
Attachment: updateCooperationProjectCommand.Images,
DepartmentId: updateCooperationProjectCommand.DepartmentId,
})
if err != nil {
... ... @@ -165,7 +152,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
return updateCooperationProjectCommand, nil
}
// 返回共创项目管理列表
// 返回共创项目管理列表下拉选择框
func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) {
listCooperationProjectQuery.PageSize = 999
if err := listCooperationProjectQuery.ValidateQuery(); err != nil {
... ...
... ... @@ -350,7 +350,7 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
}
var deadline int64
if !result.CooperationInfo.CooperationDeadline.IsZero() {
deadline = result.CooperationInfo.CooperationDeadline.Unix()
deadline = result.CooperationInfo.CooperationDeadline.UnixNano() / 1e6
}
userInfo := dto.CooperationUserInfo{
UserId: strconv.Itoa(result.UserId),
... ... @@ -435,10 +435,15 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe
func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCommand *command.CooperationUserUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserUpdateCommand.Operator)
var cooperationDeadline time.Time
if cooperationUserUpdateCommand.CooperationDeadline > 0 {
cooperationDeadline = time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0)
}
_, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{
UserId: cooperationUserUpdateCommand.UserId,
CooperationCompany: cooperationUserUpdateCommand.CooperationCompany,
CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0),
CooperationDeadline: cooperationDeadline,
Email: cooperationUserUpdateCommand.Email,
EnableStatus: cooperationUserUpdateCommand.EnableStatus,
UserCode: cooperationUserUpdateCommand.UserCode,
... ... @@ -550,7 +555,7 @@ func (usersService *UsersService) GetInitPassword(operator domain.Operator) (str
var password string
alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(operator)
reqResult, err := alliedCreationBasic.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{
domain.InitPasswordSettingKey,
SettingCode: domain.InitPasswordSettingKey,
})
if err != nil {
log.Logger.Error(err.Error())
... ...
... ... @@ -17,7 +17,7 @@ type CooperationApplication struct {
UserAccount string `json:"userAccount"`
} `json:"userInfo"`
Department struct {
// 部门ID,通过REST集成上下文获取
// 部门ID,
DepartmentId int64 `json:"departmentId"`
// 部门名称
DepartmentName string `json:"departmentName"`
... ...