作者 陈志颖

fix:取消共创申请

... ... @@ -98,7 +98,11 @@ func (data *CooperationApplicationDto) LoadDto(a *domain.CooperationApplication)
data.CooperationApplyTime = a.CooperationApplyTime.Unix() * 1000
data.CooperationProject = data.LoadCooperationProject(a.CooperationProject)
data.Org = data.LoadOrg(a.Org)
data.IsCanceled = a.IsCanceled
if a.IsCanceled == 1 {
data.IsCanceled = false
} else {
data.IsCanceled = true
}
data.Company = data.LoadCompany(a.Company)
}
... ...
... ... @@ -113,7 +113,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
CooperationApplyTime: time.Now(),
CooperationProject: cooperationProject,
Org: organization,
IsCanceled: false,
IsCanceled: 1,
Company: company,
CreatedAt: time.Now(),
DeletedAt: time.Time{},
... ... @@ -281,6 +281,7 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova
}
cooperationApplications[i].CooperationApplicationVerifier = verifier
cooperationApplications[i].CooperationApplicationVerifyTime = time.Now()
cooperationApplications[i].IsCanceled = 1
}
cooperationApplicationsApproved, err := cooperationApplicationRepository.UpdateMany(cooperationApplications)
if err != nil {
... ... @@ -463,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) CreateCooper
CooperationApplyTime: time.Now(),
CooperationProject: cooperationProject,
Org: organization,
IsCanceled: false,
IsCanceled: 1,
Company: company,
CreatedAt: time.Now(),
DeletedAt: time.Time{},
... ... @@ -732,7 +733,7 @@ func (cooperationApplicationService *CooperationApplicationService) CancelCooper
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10)))
}
if err := cooperationApplication.Update(map[string]interface{}{
"isCanceled": true,
"isCanceled": int32(2),
}); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -27,7 +27,7 @@ type CooperationApplication struct {
// 数据所属组织机构
Org *Org `json:"org"`
// 是否被取消标志位
IsCanceled bool `json:"isCanceled"`
IsCanceled int32 `json:"isCanceled"`
// 公司
Company *Company `json:"company"`
// 创建时间
... ... @@ -55,7 +55,7 @@ func (cooperationApplication *CooperationApplication) Identify() interface{} {
func (cooperationApplication *CooperationApplication) Update(data map[string]interface{}) error {
if isCanceled, ok := data["isCanceled"]; ok {
cooperationApplication.IsCanceled = isCanceled.(bool)
cooperationApplication.IsCanceled = isCanceled.(int32)
}
if cooperationApplicationAttachment, ok := data["cooperationApplicationAttachment"]; ok {
cooperationApplication.CooperationApplicationAttachment = cooperationApplicationAttachment.([]*Attachment)
... ...
... ... @@ -29,8 +29,8 @@ type CooperationApplication struct {
CooperationProjectNumber string `comment:"共创项目编号"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 是否被取消标志位
IsCanceled bool `comment:"是否被取消标志位"`
// 是否被取消标志位 1正常,2取消
IsCanceled int32 `comment:"是否被取消标志位" pg:",default:1"`
// 公司
Company *domain.Company `comment:"公司"`
// 创建时间
... ...
... ... @@ -268,7 +268,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.Where("is_canceled = ?", false)
query.Where("is_canceled = ?", 1)
query.SetOrderDirect("cooperation_application_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationApplications, err
... ...