作者 陈志颖

fix:分红订单

@@ -653,6 +653,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -653,6 +653,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
653 CreatedAt: time.Now(), 653 CreatedAt: time.Now(),
654 DeletedAt: time.Time{}, 654 DeletedAt: time.Time{},
655 UpdatedAt: time.Time{}, 655 UpdatedAt: time.Time{},
  656 + OrderGoodId: orderGood.OrderGoodId,
  657 + OrderGoodAmount: orderGood.OrderGoodAmount,
656 } 658 }
657 dividendsEstimates = append(dividendsEstimates, dividendsEstimate) 659 dividendsEstimates = append(dividendsEstimates, dividendsEstimate)
658 } 660 }
@@ -696,6 +698,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -696,6 +698,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
696 CreatedAt: time.Now(), 698 CreatedAt: time.Now(),
697 DeletedAt: time.Time{}, 699 DeletedAt: time.Time{},
698 UpdatedAt: time.Time{}, 700 UpdatedAt: time.Time{},
  701 + OrderGoodId: orderGood.OrderGoodId,
  702 + OrderGoodAmount: orderGood.OrderGoodAmount,
699 } 703 }
700 dividendsEstimates = append(dividendsEstimates, dividendsEstimate) 704 dividendsEstimates = append(dividendsEstimates, dividendsEstimate)
701 } 705 }
@@ -11,6 +11,8 @@ import ( @@ -11,6 +11,8 @@ import (
11 type GetDividendsOrderQuery struct { 11 type GetDividendsOrderQuery struct {
12 // 分红订单ID 12 // 分红订单ID
13 DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"` 13 DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"`
  14 + // 分红订单编号
  15 + DividendsOrderNumber string `cname:"分红订单编号" json:"dividendsOrderNumber,omitempty"`
14 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
15 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` 17 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"`
16 // 组织机构ID 18 // 组织机构ID
@@ -41,7 +41,7 @@ type CreateDividendsReturnedOrderCommand struct { @@ -41,7 +41,7 @@ type CreateDividendsReturnedOrderCommand struct {
41 // 退货日期 41 // 退货日期
42 DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` 42 DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
43 // 订单日期 43 // 订单日期
44 - OrderTime time.Time `cname:"订单日期" json:"orderTime" valid:"Required"` 44 + OrderTime string `cname:"订单日期" json:"orderTime" valid:"Required"`
45 // 退货区域名称 45 // 退货区域名称
46 RegionName string `cname:"退货区域名称" json:"regionName,omitempty"` 46 RegionName string `cname:"退货区域名称" json:"regionName,omitempty"`
47 // 订单产品列表 47 // 订单产品列表
@@ -5,7 +5,6 @@ import ( @@ -5,7 +5,6 @@ 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"  
9 ) 8 )
10 9
11 type UpdateDividendsReturnedOrderCommand struct { 10 type UpdateDividendsReturnedOrderCommand struct {
@@ -24,7 +23,7 @@ type UpdateDividendsReturnedOrderCommand struct { @@ -24,7 +23,7 @@ type UpdateDividendsReturnedOrderCommand struct {
24 // 退货区域 23 // 退货区域
25 RegionName string `cname:"退货区域" json:"regionName,omitempty"` 24 RegionName string `cname:"退货区域" json:"regionName,omitempty"`
26 // 订单时间 25 // 订单时间
27 - OrderTime time.Time `cname:"订单日期" json:"orderTime" valid:"Required"` 26 + OrderTime string `cname:"订单日期" json:"orderTime" valid:"Required"`
28 // 订单产品列表 27 // 订单产品列表
29 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` 28 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
30 // 公司ID,通过集成REST上下文获取 29 // 公司ID,通过集成REST上下文获取
@@ -99,15 +99,25 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -99,15 +99,25 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
99 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 99 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
100 } 100 }
101 101
  102 + // 订单时间转换
  103 + orderTimeInt, err := strconv.ParseInt(createDividendsReturnedOrderCommand.OrderTime, 10, 64)
  104 + if err != nil {
  105 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "订单时间错误")
  106 + }
  107 + orderTime := utils.TransformTimestampToTime(orderTimeInt)
  108 +
102 // 校验分红退货单编号是否唯一 109 // 校验分红退货单编号是否唯一
103 - //numberAvailable, _ := dividendsReturnedOrderDao.CheckDividendsReturnedOrderNumberAvailable(map[string]interface{}{  
104 - // "companyId": createDividendsOrderCommand.CompanyId,  
105 - // "orgId": createDividendsOrderCommand.OrgId,  
106 - // "dividendsReturnedOrderNumber": dividendsReturnedOrderNumber,  
107 - //})  
108 - //if !numberAvailable {  
109 - // return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常")  
110 - //} 110 + numberAvailable, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderNumberAvailable(map[string]interface{}{
  111 + "companyId": createDividendsReturnedOrderCommand.CompanyId,
  112 + "orgId": createDividendsReturnedOrderCommand.OrgId,
  113 + "dividendsReturnedOrderNumber": dividendsReturnedOrderNumber,
  114 + })
  115 + if err != nil {
  116 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, err.Error())
  117 + }
  118 + if !numberAvailable {
  119 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红退货单号已存在")
  120 + }
111 121
112 // 获取分红退货单产品 122 // 获取分红退货单产品
113 var orderGoods []*domain.OrderGood 123 var orderGoods []*domain.OrderGood
@@ -152,6 +162,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -152,6 +162,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
152 UpdatedAt: time.Time{}, 162 UpdatedAt: time.Time{},
153 Operator: operator, 163 Operator: operator,
154 OperateTime: time.Now(), 164 OperateTime: time.Now(),
  165 + OrderTime: orderTime,
155 } 166 }
156 167
157 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository 168 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
@@ -563,6 +574,13 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -563,6 +574,13 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
563 } 574 }
564 dividendsReturnedDate := utils.TransformTimestampToTime(dividendsReturnedDateInt) 575 dividendsReturnedDate := utils.TransformTimestampToTime(dividendsReturnedDateInt)
565 576
  577 + // 订单时间转换
  578 + orderTimeInt, err := strconv.ParseInt(updateDividendsReturnedOrderCommand.OrderTime, 10, 64)
  579 + if err != nil {
  580 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "订单时间错误")
  581 + }
  582 + orderTime := utils.TransformTimestampToTime(orderTimeInt)
  583 +
566 // 获取分红退货单 584 // 获取分红退货单
567 dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderId": updateDividendsReturnedOrderCommand.DividendsReturnedOrderId}) 585 dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderId": updateDividendsReturnedOrderCommand.DividendsReturnedOrderId})
568 if err != nil { 586 if err != nil {
@@ -607,6 +625,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -607,6 +625,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
607 dividendsReturnedOrder.DividendsReturnedDate = dividendsReturnedDate 625 dividendsReturnedOrder.DividendsReturnedDate = dividendsReturnedDate
608 dividendsReturnedOrder.DividendsReturnedOrderRefund = dividendsReturnedOrderAmount 626 dividendsReturnedOrder.DividendsReturnedOrderRefund = dividendsReturnedOrderAmount
609 dividendsReturnedOrder.Goods = orderGoods 627 dividendsReturnedOrder.Goods = orderGoods
  628 + dividendsReturnedOrder.OrderTime = orderTime
610 629
611 // 保存分红退货单更新 630 // 保存分红退货单更新
612 if dividendsReturnedOrderSaved, err := dividendsReturnedOrderRepository.Save(dividendsReturnedOrder); err != nil { 631 if dividendsReturnedOrderSaved, err := dividendsReturnedOrderRepository.Save(dividendsReturnedOrder); err != nil {
@@ -7,4 +7,8 @@ type AccountDetail struct { @@ -7,4 +7,8 @@ type AccountDetail struct {
7 DividendsType int32 `json:"dividendsType"` 7 DividendsType int32 `json:"dividendsType"`
8 // 分红金额 8 // 分红金额
9 DividendsAmount float64 `json:"dividendsAmount"` 9 DividendsAmount float64 `json:"dividendsAmount"`
  10 + // 产品ID
  11 + OrderGoodId int64 `json:"orderGoodId"`
  12 + // 订单产品金额
  13 + OrderGoodAmount float64 `json:"orderGoodAmount"`
10 } 14 }
@@ -42,6 +42,8 @@ type CooperationProject struct { @@ -42,6 +42,8 @@ type CooperationProject struct {
42 DeletedAt time.Time `json:"deletedAt"` 42 DeletedAt time.Time `json:"deletedAt"`
43 // 创建时间 43 // 创建时间
44 CreatedAt time.Time `json:"createdAt"` 44 CreatedAt time.Time `json:"createdAt"`
  45 + // 共创申请人计数
  46 + ApplicantCount int32 `json:"applicantCount"`
45 } 47 }
46 48
47 type CooperationProjectRepository interface { 49 type CooperationProjectRepository interface {
@@ -26,6 +26,8 @@ type CreditAccount struct { @@ -26,6 +26,8 @@ type CreditAccount struct {
26 ParticipateType string `json:"participateType"` 26 ParticipateType string `json:"participateType"`
27 // 结算明细 27 // 结算明细
28 AccountDetail []*AccountDetail `json:"accountDetail"` 28 AccountDetail []*AccountDetail `json:"accountDetail"`
  29 + // 产品金额统计
  30 + GoodAmountCount float64 `json:"goodAmountCount"`
29 // 支付凭证附件 31 // 支付凭证附件
30 PaymentDocumentAttachments []*Attachment `json:"paymentDocumentAttachments"` 32 PaymentDocumentAttachments []*Attachment `json:"paymentDocumentAttachments"`
31 // 数据所属组织机构 33 // 数据所属组织机构
@@ -61,6 +61,10 @@ type DividendsEstimate struct { @@ -61,6 +61,10 @@ type DividendsEstimate struct {
61 DeletedAt time.Time `json:"deletedAt"` 61 DeletedAt time.Time `json:"deletedAt"`
62 // 更新时间 62 // 更新时间
63 UpdatedAt time.Time `json:"updatedAt"` 63 UpdatedAt time.Time `json:"updatedAt"`
  64 + // 订单产品ID
  65 + OrderGoodId int64 `json:"orderGoodId"`
  66 + // 订单产品金额
  67 + OrderGoodAmount float64 `json:"orderGoodAmount"`
64 } 68 }
65 69
66 type DividendsEstimateRepository interface { 70 type DividendsEstimateRepository interface {
@@ -35,7 +35,25 @@ func (dao *DividendsReturnedOrderDao) GenerateDividendsReturnedOrderNumber() (st @@ -35,7 +35,25 @@ func (dao *DividendsReturnedOrderDao) GenerateDividendsReturnedOrderNumber() (st
35 } 35 }
36 } 36 }
37 37
38 -// CalculateDividendsOrderAmount 计算分红订单金额 38 +// CheckDividendsReturnedOrderNumberAvailable 校验分红订单是否唯一
  39 +func (dao *DividendsReturnedOrderDao) CheckDividendsReturnedOrderNumberAvailable(queryOptions map[string]interface{}) (bool, error) {
  40 + tx := dao.transactionContext.PgTx
  41 + var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
  42 + query := tx.Model(&dividendsReturnedOrderModels)
  43 + if dividendsOrderNumber, ok := queryOptions["dividendsReturnedOrderNumber"]; ok && dividendsOrderNumber != "" {
  44 + query = query.Where("dividends_returned_order_number = ?", dividendsOrderNumber)
  45 + }
  46 + if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
  47 + query = query.Where(`dividends_returned_order.company @> '{"companyId":"?"}'`, companyId)
  48 + }
  49 + if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
  50 + query = query.Where(`dividends_returned_order.org @> '{"orgId":"?"}'`, orgId)
  51 + }
  52 + ok, err := query.Exists()
  53 + return !ok, err
  54 +}
  55 +
  56 +// CalculateDividendsReturnedOrderAmount 计算分红订单金额
39 func (dao *DividendsReturnedOrderDao) CalculateDividendsReturnedOrderAmount(queryOptions map[string]interface{}) (float64, error) { 57 func (dao *DividendsReturnedOrderDao) CalculateDividendsReturnedOrderAmount(queryOptions map[string]interface{}) (float64, error) {
40 tx := dao.transactionContext.PgTx 58 tx := dao.transactionContext.PgTx
41 var dividendsOrderModel = new(models.DividendsReturnedOrder) 59 var dividendsOrderModel = new(models.DividendsReturnedOrder)
@@ -45,4 +45,6 @@ type CooperationProject struct { @@ -45,4 +45,6 @@ type CooperationProject struct {
45 DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"` 45 DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"`
46 // 创建时间 46 // 创建时间
47 CreatedAt time.Time `comment:"创建时间"` 47 CreatedAt time.Time `comment:"创建时间"`
  48 + // 申请人统计
  49 + ApplicantCount int32 `comment:"申请人统计"`
48 } 50 }
@@ -29,6 +29,8 @@ type CreditAccount struct { @@ -29,6 +29,8 @@ type CreditAccount struct {
29 ParticipateType string `comment:"参与类型,承接人,推荐人,业务员"` 29 ParticipateType string `comment:"参与类型,承接人,推荐人,业务员"`
30 // 结算明细 30 // 结算明细
31 AccountDetail []*domain.AccountDetail `comment:"结算明细"` 31 AccountDetail []*domain.AccountDetail `comment:"结算明细"`
  32 + // 产品金额统计
  33 + GoodAmountCount float64 `comment:"产品金额统计"`
32 // 支付凭证附件 34 // 支付凭证附件
33 PaymentDocumentAttachments []*domain.Attachment `comment:"支付凭证附件"` 35 PaymentDocumentAttachments []*domain.Attachment `comment:"支付凭证附件"`
34 // 数据所属组织机构 36 // 数据所属组织机构
@@ -41,5 +41,6 @@ func TransformToCooperationProjectDomainModelFromPgModels( @@ -41,5 +41,6 @@ func TransformToCooperationProjectDomainModelFromPgModels(
41 UpdatedAt: cooperationProjectModel.UpdatedAt, 41 UpdatedAt: cooperationProjectModel.UpdatedAt,
42 DeletedAt: cooperationProjectModel.DeletedAt, 42 DeletedAt: cooperationProjectModel.DeletedAt,
43 CreatedAt: cooperationProjectModel.CreatedAt, 43 CreatedAt: cooperationProjectModel.CreatedAt,
  44 + ApplicantCount: cooperationProjectModel.ApplicantCount,
44 }, nil 45 }, nil
45 } 46 }
@@ -18,6 +18,7 @@ func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models. @@ -18,6 +18,7 @@ func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.
18 Participator: creditAccountModel.Participator, 18 Participator: creditAccountModel.Participator,
19 ParticipateType: creditAccountModel.ParticipateType, 19 ParticipateType: creditAccountModel.ParticipateType,
20 AccountDetail: creditAccountModel.AccountDetail, 20 AccountDetail: creditAccountModel.AccountDetail,
  21 + GoodAmountCount: creditAccountModel.GoodAmountCount,
21 PaymentDocumentAttachments: creditAccountModel.PaymentDocumentAttachments, 22 PaymentDocumentAttachments: creditAccountModel.PaymentDocumentAttachments,
22 Org: creditAccountModel.Org, 23 Org: creditAccountModel.Org,
23 Company: creditAccountModel.Company, 24 Company: creditAccountModel.Company,
@@ -47,6 +47,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -47,6 +47,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
47 "updated_at", 47 "updated_at",
48 "deleted_at", 48 "deleted_at",
49 "created_at", 49 "created_at",
  50 + "applicant_account",
50 } 51 }
51 insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) 52 insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
52 insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) 53 insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
@@ -82,6 +83,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -82,6 +83,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
82 &cooperationProject.UpdatedAt, 83 &cooperationProject.UpdatedAt,
83 &cooperationProject.DeletedAt, 84 &cooperationProject.DeletedAt,
84 &cooperationProject.CreatedAt, 85 &cooperationProject.CreatedAt,
  86 + &cooperationProject.ApplicantCount,
85 ), 87 ),
86 fmt.Sprintf("INSERT INTO cooperation_projects (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), 88 fmt.Sprintf("INSERT INTO cooperation_projects (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
87 cooperationProject.CooperationProjectId, 89 cooperationProject.CooperationProjectId,
@@ -103,6 +105,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -103,6 +105,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
103 cooperationProject.UpdatedAt, 105 cooperationProject.UpdatedAt,
104 nil, 106 nil,
105 cooperationProject.CreatedAt, 107 cooperationProject.CreatedAt,
  108 + cooperationProject.ApplicantCount,
106 ); err != nil { 109 ); err != nil {
107 return cooperationProject, err 110 return cooperationProject, err
108 } 111 }
@@ -128,6 +131,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -128,6 +131,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
128 &cooperationProject.UpdatedAt, 131 &cooperationProject.UpdatedAt,
129 &cooperationProject.DeletedAt, 132 &cooperationProject.DeletedAt,
130 &cooperationProject.CreatedAt, 133 &cooperationProject.CreatedAt,
  134 + &cooperationProject.ApplicantCount,
131 ), 135 ),
132 fmt.Sprintf("UPDATE cooperation_projects SET %s WHERE cooperation_project_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), 136 fmt.Sprintf("UPDATE cooperation_projects SET %s WHERE cooperation_project_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
133 cooperationProject.CooperationProjectId, 137 cooperationProject.CooperationProjectId,
@@ -149,6 +153,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -149,6 +153,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
149 cooperationProject.UpdatedAt, 153 cooperationProject.UpdatedAt,
150 nil, 154 nil,
151 cooperationProject.CreatedAt, 155 cooperationProject.CreatedAt,
  156 + cooperationProject.ApplicantCount,
152 cooperationProject.Identify(), 157 cooperationProject.Identify(),
153 ); err != nil { 158 ); err != nil {
154 return cooperationProject, err 159 return cooperationProject, err
@@ -181,6 +186,7 @@ func (repository *CooperationProjectRepository) UpdateMany(cooperationProjects [ @@ -181,6 +186,7 @@ func (repository *CooperationProjectRepository) UpdateMany(cooperationProjects [
181 UpdatedAt: time.Now(), 186 UpdatedAt: time.Now(),
182 DeletedAt: cooperationProject.DeletedAt, 187 DeletedAt: cooperationProject.DeletedAt,
183 CreatedAt: cooperationProject.CreatedAt, 188 CreatedAt: cooperationProject.CreatedAt,
  189 + ApplicantCount: cooperationProject.ApplicantCount,
184 }) 190 })
185 } 191 }
186 if _, err := tx.Model(&cooperationProjectModels).WherePK().Update(); err != nil { 192 if _, err := tx.Model(&cooperationProjectModels).WherePK().Update(); err != nil {
@@ -38,6 +38,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -38,6 +38,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
38 "participator", 38 "participator",
39 "participate_type", 39 "participate_type",
40 "account_detail", 40 "account_detail",
  41 + "good_amount_count",
41 "payment_document_attachments", 42 "payment_document_attachments",
42 "org", 43 "org",
43 "company", 44 "company",
@@ -74,6 +75,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -74,6 +75,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
74 &creditAccount.Participator, 75 &creditAccount.Participator,
75 &creditAccount.ParticipateType, 76 &creditAccount.ParticipateType,
76 &creditAccount.AccountDetail, 77 &creditAccount.AccountDetail,
  78 + &creditAccount.GoodAmountCount,
77 &creditAccount.PaymentDocumentAttachments, 79 &creditAccount.PaymentDocumentAttachments,
78 &creditAccount.Org, 80 &creditAccount.Org,
79 &creditAccount.Company, 81 &creditAccount.Company,
@@ -96,6 +98,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -96,6 +98,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
96 creditAccount.Participator, 98 creditAccount.Participator,
97 creditAccount.ParticipateType, 99 creditAccount.ParticipateType,
98 creditAccount.AccountDetail, 100 creditAccount.AccountDetail,
  101 + creditAccount.GoodAmountCount,
99 creditAccount.PaymentDocumentAttachments, 102 creditAccount.PaymentDocumentAttachments,
100 creditAccount.Org, 103 creditAccount.Org,
101 creditAccount.Company, 104 creditAccount.Company,
@@ -122,6 +125,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -122,6 +125,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
122 &creditAccount.Participator, 125 &creditAccount.Participator,
123 &creditAccount.ParticipateType, 126 &creditAccount.ParticipateType,
124 &creditAccount.AccountDetail, 127 &creditAccount.AccountDetail,
  128 + &creditAccount.GoodAmountCount,
125 &creditAccount.PaymentDocumentAttachments, 129 &creditAccount.PaymentDocumentAttachments,
126 &creditAccount.Org, 130 &creditAccount.Org,
127 &creditAccount.Company, 131 &creditAccount.Company,
@@ -144,6 +148,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -144,6 +148,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
144 creditAccount.Participator, 148 creditAccount.Participator,
145 creditAccount.ParticipateType, 149 creditAccount.ParticipateType,
146 creditAccount.AccountDetail, 150 creditAccount.AccountDetail,
  151 + creditAccount.GoodAmountCount,
147 creditAccount.PaymentDocumentAttachments, 152 creditAccount.PaymentDocumentAttachments,
148 creditAccount.Org, 153 creditAccount.Org,
149 creditAccount.Company, 154 creditAccount.Company,
@@ -367,7 +367,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte @@ -367,7 +367,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
367 dividendsOrderModel := new(models.DividendsOrder) 367 dividendsOrderModel := new(models.DividendsOrder)
368 query := sqlbuilder.BuildQuery(tx.Model(dividendsOrderModel), queryOptions) 368 query := sqlbuilder.BuildQuery(tx.Model(dividendsOrderModel), queryOptions)
369 query.SetWhereByQueryOption("dividends_order.dividends_order_id = ?", "dividendsOrderId") 369 query.SetWhereByQueryOption("dividends_order.dividends_order_id = ?", "dividendsOrderId")
370 - query.SetWhereByQueryOption("dividends_order.dividends_order_number = ?", "dividendsOrderNumber") 370 + //query.SetWhereByQueryOption("dividends_order.dividends_order_number = ?", "dividendsOrderNumber")
  371 + if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" {
  372 + query.Where("dividends_order.dividends_order_number = ?", dividendsOrderNumber)
  373 + }
371 if err := query.First(); err != nil { 374 if err := query.First(); err != nil {
372 if err.Error() == "pg: no rows in result set" { 375 if err.Error() == "pg: no rows in result set" {
373 return nil, fmt.Errorf("没有此资源") 376 return nil, fmt.Errorf("没有此资源")
@@ -61,6 +61,8 @@ func (controller *DividendsOrderController) GetDividendsOrder() { @@ -61,6 +61,8 @@ func (controller *DividendsOrderController) GetDividendsOrder() {
61 getDividendsOrderQuery.UserBaseId = header.UserBaseId 61 getDividendsOrderQuery.UserBaseId = header.UserBaseId
62 dividendsOrderId, _ := controller.GetInt64(":dividendsOrderId") 62 dividendsOrderId, _ := controller.GetInt64(":dividendsOrderId")
63 getDividendsOrderQuery.DividendsOrderId = dividendsOrderId 63 getDividendsOrderQuery.DividendsOrderId = dividendsOrderId
  64 + dividendsOrderNumber := controller.GetString("dividendsOrderNumber")
  65 + getDividendsOrderQuery.DividendsOrderNumber = dividendsOrderNumber
64 data, err := dividendsOrderService.GetDividendsOrder(getDividendsOrderQuery) 66 data, err := dividendsOrderService.GetDividendsOrder(getDividendsOrderQuery)
65 controller.Response(data, err) 67 controller.Response(data, err)
66 } 68 }