作者 陈志颖

fix:分红退货单增加订单时间

@@ -31,12 +31,6 @@ type CooperationApplicationDto struct { @@ -31,12 +31,6 @@ type CooperationApplicationDto struct {
31 IsCanceled bool `json:"isCanceled"` 31 IsCanceled bool `json:"isCanceled"`
32 // 公司 32 // 公司
33 Company *Company `json:"company"` 33 Company *Company `json:"company"`
34 - // 创建时间  
35 - //CreatedAt time.Time `json:"createdAt"`  
36 - // 删除时间  
37 - //DeletedAt time.Time `json:"deletedAt"`  
38 - // 更新时间  
39 - //UpdatedAt time.Time `json:"updatedAt"`  
40 } 34 }
41 35
42 // User 用户第三方服务防腐模型 36 // User 用户第三方服务防腐模型
@@ -446,6 +446,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -446,6 +446,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
446 defer func() { 446 defer func() {
447 _ = transactionContext.RollbackTransaction() 447 _ = transactionContext.RollbackTransaction()
448 }() 448 }()
  449 + // 共创项目仓储初始化
449 var cooperationProjectRepository domain.CooperationProjectRepository 450 var cooperationProjectRepository domain.CooperationProjectRepository
450 if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{ 451 if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
451 "transactionContext": transactionContext, 452 "transactionContext": transactionContext,
@@ -454,7 +455,14 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -454,7 +455,14 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
454 } else { 455 } else {
455 cooperationProjectRepository = value 456 cooperationProjectRepository = value
456 } 457 }
457 - cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": updateCooperationProjectCommand.CooperationProjectId}) 458 +
  459 + cooperationProjectId, err := strconv.ParseInt(updateCooperationProjectCommand.CooperationProjectId, 10, 64)
  460 + if err != nil {
  461 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创项目编号类型错误")
  462 + }
  463 +
  464 + // 查找共创项目
  465 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": cooperationProjectId})
458 if err != nil { 466 if err != nil {
459 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 467 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
460 } 468 }
@@ -40,6 +40,8 @@ type CreateDividendsReturnedOrderCommand struct { @@ -40,6 +40,8 @@ type CreateDividendsReturnedOrderCommand struct {
40 Remarks string `cname:"备注" json:"remarks" valid:"Required"` 40 Remarks string `cname:"备注" json:"remarks" valid:"Required"`
41 // 退货日期 41 // 退货日期
42 DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` 42 DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
  43 + // 订单日期
  44 + OrderTime time.Time `cname:"订单日期" json:"orderTime" valid:"Required"`
43 // 退货区域名称 45 // 退货区域名称
44 RegionName string `cname:"退货区域名称" json:"regionName,omitempty"` 46 RegionName string `cname:"退货区域名称" json:"regionName,omitempty"`
45 // 订单产品列表 47 // 订单产品列表
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "github.com/beego/beego/v2/core/validation" 5 "github.com/beego/beego/v2/core/validation"
6 "reflect" 6 "reflect"
7 "strings" 7 "strings"
  8 + "time"
8 ) 9 )
9 10
10 type UpdateDividendsReturnedOrderCommand struct { 11 type UpdateDividendsReturnedOrderCommand struct {
@@ -22,6 +23,8 @@ type UpdateDividendsReturnedOrderCommand struct { @@ -22,6 +23,8 @@ type UpdateDividendsReturnedOrderCommand struct {
22 DividendsReturnedDate string `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` 23 DividendsReturnedDate string `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
23 // 退货区域 24 // 退货区域
24 RegionName string `cname:"退货区域" json:"regionName,omitempty"` 25 RegionName string `cname:"退货区域" json:"regionName,omitempty"`
  26 + // 订单时间
  27 + OrderTime time.Time `cname:"订单日期" json:"orderTime" valid:"Required"`
25 // 订单产品列表 28 // 订单产品列表
26 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` 29 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
27 // 公司ID,通过集成REST上下文获取 30 // 公司ID,通过集成REST上下文获取
@@ -234,6 +234,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -234,6 +234,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
234 var cooperationProjectModels []*models.CooperationProject 234 var cooperationProjectModels []*models.CooperationProject
235 cooperationProjects := make([]*domain.CooperationProject, 0) 235 cooperationProjects := make([]*domain.CooperationProject, 0)
236 query := sqlbuilder.BuildQuery(tx.Model(&cooperationProjectModels), queryOptions) 236 query := sqlbuilder.BuildQuery(tx.Model(&cooperationProjectModels), queryOptions)
  237 + if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" {
  238 + query.Where("cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName))
  239 + }
237 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { 240 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
238 query.Where("company->>'companyId' = '?'", companyId) 241 query.Where("company->>'companyId' = '?'", companyId)
239 } 242 }