Merge branch 'dev-chenzhiying' into dev
正在显示
14 个修改的文件
包含
78 行增加
和
38 行删除
@@ -283,7 +283,6 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -283,7 +283,6 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
283 | if cooperationContract, err := cooperationContractRepository.Save(newCooperationContract); err != nil { | 283 | if cooperationContract, err := cooperationContractRepository.Save(newCooperationContract); err != nil { |
284 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 284 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
285 | } else { | 285 | } else { |
286 | - // | ||
287 | if err := transactionContext.CommitTransaction(); err != nil { | 286 | if err := transactionContext.CommitTransaction(); err != nil { |
288 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 287 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
289 | } | 288 | } |
@@ -2,11 +2,9 @@ package command | @@ -2,11 +2,9 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "github.com/beego/beego/v2/core/validation" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | - "time" | ||
8 | - | ||
9 | - "github.com/beego/beego/v2/core/validation" | ||
10 | ) | 8 | ) |
11 | 9 | ||
12 | type OrderGoods struct { | 10 | type OrderGoods struct { |
@@ -29,14 +27,10 @@ type OrderGoods struct { | @@ -29,14 +27,10 @@ type OrderGoods struct { | ||
29 | type CreateDividendsOrderCommand struct { | 27 | type CreateDividendsOrderCommand struct { |
30 | // 客户名称 | 28 | // 客户名称 |
31 | CustomerName string `cname:"客户名称" json:"customerName" valid:"Required"` | 29 | CustomerName string `cname:"客户名称" json:"customerName" valid:"Required"` |
32 | - // 分红订单金额 | ||
33 | - DividendsOrderAmount float64 `cname:"分红订单金额" json:"dividendsOrderAmount" valid:"Required"` | ||
34 | - // 分红订单号 | ||
35 | - DividendsOrderNumber string `cname:"分红订单号" json:"dividendsOrderNumber,string" valid:"Required"` | ||
36 | // 分红订单原单号 | 30 | // 分红订单原单号 |
37 | - DividendsOriginalOrderNum string `cname:"分红订单原单号" json:"dividendsOriginalOrderNum" valid:"Required"` | ||
38 | - // 订单产生时间 | ||
39 | - OrderTime time.Time `cname:"订单产生时间" json:"orderTime" valid:"Required"` | 31 | + DividendsOriginalOrderNum string `cname:"源单号" json:"dividendsOriginalOrderNum" valid:"Required"` |
32 | + // 订单时间 | ||
33 | + OrderTime string `cname:"订单时间" json:"orderTime" valid:"Required"` | ||
40 | // 备注 | 34 | // 备注 |
41 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` | 35 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` |
42 | // 订单区域名称 | 36 | // 订单区域名称 |
@@ -10,6 +10,7 @@ import ( | @@ -10,6 +10,7 @@ import ( | ||
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" |
12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" |
13 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" | ||
13 | "strconv" | 14 | "strconv" |
14 | "time" | 15 | "time" |
15 | ) | 16 | ) |
@@ -100,22 +101,29 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -100,22 +101,29 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
100 | } else { | 101 | } else { |
101 | dividendsOrderDao = value | 102 | dividendsOrderDao = value |
102 | } | 103 | } |
104 | + | ||
103 | // 生成分红订单号 | 105 | // 生成分红订单号 |
104 | dividendsOrderNumber, err := dividendsOrderDao.GenerateDividendsOrderNumber() | 106 | dividendsOrderNumber, err := dividendsOrderDao.GenerateDividendsOrderNumber() |
105 | if err != nil { | 107 | if err != nil { |
106 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 108 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
107 | } | 109 | } |
110 | + | ||
108 | // 校验分红订单编号是否唯一 | 111 | // 校验分红订单编号是否唯一 |
109 | - numberAvailable, _ := dividendsOrderDao.CheckDividendsOrderNumberAvailable(map[string]interface{}{ | 112 | + numberAvailable, err := dividendsOrderDao.CheckDividendsOrderNumberAvailable(map[string]interface{}{ |
110 | "companyId": createDividendsOrderCommand.CompanyId, | 113 | "companyId": createDividendsOrderCommand.CompanyId, |
111 | "orgId": createDividendsOrderCommand.OrgId, | 114 | "orgId": createDividendsOrderCommand.OrgId, |
112 | "dividendsOrderNumber": dividendsOrderNumber, | 115 | "dividendsOrderNumber": dividendsOrderNumber, |
113 | }) | 116 | }) |
117 | + if err != nil { | ||
118 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
119 | + } | ||
114 | if !numberAvailable { | 120 | if !numberAvailable { |
115 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") | 121 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") |
116 | } | 122 | } |
123 | + | ||
117 | // 获取订单产品 | 124 | // 获取订单产品 |
118 | var orderGoods []*domain.OrderGood | 125 | var orderGoods []*domain.OrderGood |
126 | + var dividendsOrderAmount float64 | ||
119 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { | 127 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { |
120 | orderGoods = append(orderGoods, &domain.OrderGood{ | 128 | orderGoods = append(orderGoods, &domain.OrderGood{ |
121 | OrderGoodId: 0, | 129 | OrderGoodId: 0, |
@@ -126,22 +134,28 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -126,22 +134,28 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
126 | DividendsOrderNumber: dividendsOrderNumber, | 134 | DividendsOrderNumber: dividendsOrderNumber, |
127 | DividendsReturnedOrderNumber: "", | 135 | DividendsReturnedOrderNumber: "", |
128 | CooperationContractNumber: orderGood.CooperationContractNumber, | 136 | CooperationContractNumber: orderGood.CooperationContractNumber, |
129 | - OrderGoodExpense: 0, | 137 | + OrderGoodExpense: orderGood.OrderGoodExpense, |
130 | OrgId: organization.OrgId, | 138 | OrgId: organization.OrgId, |
131 | CompanyId: company.CompanyId, | 139 | CompanyId: company.CompanyId, |
132 | CreatedAt: time.Time{}, | 140 | CreatedAt: time.Time{}, |
133 | DeletedAt: time.Time{}, | 141 | DeletedAt: time.Time{}, |
134 | UpdatedAt: time.Time{}, | 142 | UpdatedAt: time.Time{}, |
135 | }) | 143 | }) |
144 | + // 计算分红订单金额 | ||
145 | + dividendsOrderAmount = dividendsOrderAmount + orderGood.OrderGoodAmount | ||
136 | } | 146 | } |
137 | 147 | ||
148 | + // 订单时间转换 | ||
149 | + orderTimeInt, _ := strconv.ParseInt(createDividendsOrderCommand.OrderTime, 10, 64) | ||
150 | + orderTime := utils.TransformTimestampToTime(orderTimeInt) | ||
151 | + | ||
138 | newDividendsOrder := &domain.DividendsOrder{ | 152 | newDividendsOrder := &domain.DividendsOrder{ |
139 | DividendsOrderId: 0, | 153 | DividendsOrderId: 0, |
140 | DividendsOrderNumber: dividendsOrderNumber, | 154 | DividendsOrderNumber: dividendsOrderNumber, |
141 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, | 155 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, |
142 | - DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount, | 156 | + DividendsOrderAmount: dividendsOrderAmount, |
143 | OrderSalesman: salesman, | 157 | OrderSalesman: salesman, |
144 | - OrderTime: createDividendsOrderCommand.OrderTime, | 158 | + OrderTime: orderTime, |
145 | DividendTime: time.Time{}, | 159 | DividendTime: time.Time{}, |
146 | DividendStatus: 0, | 160 | DividendStatus: 0, |
147 | Region: &domain.RegionInfo{ | 161 | Region: &domain.RegionInfo{ |
@@ -159,6 +173,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -159,6 +173,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
159 | Operator: operator, | 173 | Operator: operator, |
160 | } | 174 | } |
161 | 175 | ||
176 | + // 分红订单仓储初始化 | ||
162 | var dividendsOrderRepository domain.DividendsOrderRepository | 177 | var dividendsOrderRepository domain.DividendsOrderRepository |
163 | if value, err := factory.CreateDividendsOrderRepository(map[string]interface{}{ | 178 | if value, err := factory.CreateDividendsOrderRepository(map[string]interface{}{ |
164 | "transactionContext": transactionContext, | 179 | "transactionContext": transactionContext, |
@@ -2,11 +2,9 @@ package command | @@ -2,11 +2,9 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "github.com/beego/beego/v2/core/validation" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | - "time" | ||
8 | - | ||
9 | - "github.com/beego/beego/v2/core/validation" | ||
10 | ) | 8 | ) |
11 | 9 | ||
12 | type OrderGoods struct { | 10 | type OrderGoods struct { |
@@ -38,7 +36,7 @@ type CreateDividendsReturnedOrderCommand struct { | @@ -38,7 +36,7 @@ type CreateDividendsReturnedOrderCommand struct { | ||
38 | // 备注 | 36 | // 备注 |
39 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` | 37 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` |
40 | // 退货日期 | 38 | // 退货日期 |
41 | - DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` | 39 | + DividendsReturnedDate string `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` |
42 | // 退货区域名称 | 40 | // 退货区域名称 |
43 | RegionName string `cname:"退货区域名称" json:"regionName,omitempty"` | 41 | RegionName string `cname:"退货区域名称" json:"regionName,omitempty"` |
44 | // 订单产品列表 | 42 | // 订单产品列表 |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" |
12 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" | ||
12 | "time" | 13 | "time" |
13 | ) | 14 | ) |
14 | 15 | ||
@@ -80,6 +81,32 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | @@ -80,6 +81,32 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | ||
80 | operator = data | 81 | operator = data |
81 | } | 82 | } |
82 | 83 | ||
84 | + // 分红退货单单DAO初始化 | ||
85 | + var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao | ||
86 | + if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{ | ||
87 | + "transactionContext": transactionContext, | ||
88 | + }); err != nil { | ||
89 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
90 | + } else { | ||
91 | + dividendsReturnedOrderDao = value | ||
92 | + } | ||
93 | + | ||
94 | + // 生成分红订单号 | ||
95 | + dividendsReturnedOrderNumber, err := dividendsReturnedOrderDao.GenerateDividendsReturnedOrderNumber() | ||
96 | + if err != nil { | ||
97 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
98 | + } | ||
99 | + | ||
100 | + // 校验分红退货单编号是否唯一 | ||
101 | + //numberAvailable, _ := dividendsReturnedOrderDao.CheckDividendsReturnedOrderNumberAvailable(map[string]interface{}{ | ||
102 | + // "companyId": createDividendsOrderCommand.CompanyId, | ||
103 | + // "orgId": createDividendsOrderCommand.OrgId, | ||
104 | + // "dividendsReturnedOrderNumber": dividendsReturnedOrderNumber, | ||
105 | + //}) | ||
106 | + //if !numberAvailable { | ||
107 | + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") | ||
108 | + //} | ||
109 | + | ||
83 | // 获取分红退货单产品 | 110 | // 获取分红退货单产品 |
84 | var orderGoods []*domain.OrderGood | 111 | var orderGoods []*domain.OrderGood |
85 | for _, orderGood := range createDividendsReturnedOrderCommand.OrderGoods { | 112 | for _, orderGood := range createDividendsReturnedOrderCommand.OrderGoods { |
@@ -90,7 +117,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | @@ -90,7 +117,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | ||
90 | OrderGoodPrice: orderGood.OrderGoodPrice, | 117 | OrderGoodPrice: orderGood.OrderGoodPrice, |
91 | OrderGoodQuantity: orderGood.OrderGoodQuantity, | 118 | OrderGoodQuantity: orderGood.OrderGoodQuantity, |
92 | DividendsOrderNumber: "", | 119 | DividendsOrderNumber: "", |
93 | - DividendsReturnedOrderNumber: "", // 分红退货单号,规则生成 | 120 | + DividendsReturnedOrderNumber: dividendsReturnedOrderNumber, |
94 | CooperationContractNumber: orderGood.CooperationContractNumber, | 121 | CooperationContractNumber: orderGood.CooperationContractNumber, |
95 | OrderGoodExpense: 0, | 122 | OrderGoodExpense: 0, |
96 | OrgId: organization.OrgId, | 123 | OrgId: organization.OrgId, |
@@ -102,7 +129,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | @@ -102,7 +129,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | ||
102 | } | 129 | } |
103 | 130 | ||
104 | newDividendsReturnedOrder := &domain.DividendsReturnedOrder{ | 131 | newDividendsReturnedOrder := &domain.DividendsReturnedOrder{ |
105 | - DividendsReturnedOrderNumber: "", // 退货单号,生成 | 132 | + DividendsReturnedOrderNumber: dividendsReturnedOrderNumber, |
106 | DividendsReturnedOrderRefund: 0, | 133 | DividendsReturnedOrderRefund: 0, |
107 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, | 134 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, |
108 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, | 135 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, |
@@ -40,6 +40,8 @@ type DividendsOrder struct { | @@ -40,6 +40,8 @@ type DividendsOrder struct { | ||
40 | OperateTime time.Time `json:"operateTime"` | 40 | OperateTime time.Time `json:"operateTime"` |
41 | // 操作人 | 41 | // 操作人 |
42 | Operator *User `json:"operator"` | 42 | Operator *User `json:"operator"` |
43 | + // 备注 | ||
44 | + Remarks string `json:"remarks"` | ||
43 | } | 45 | } |
44 | 46 | ||
45 | type DividendsOrderRepository interface { | 47 | type DividendsOrderRepository interface { |
@@ -5,7 +5,7 @@ import "time" | @@ -5,7 +5,7 @@ import "time" | ||
5 | // DividendsReturnedOrder 分红退货单实体 | 5 | // DividendsReturnedOrder 分红退货单实体 |
6 | type DividendsReturnedOrder struct { | 6 | type DividendsReturnedOrder struct { |
7 | // 分红退货单记录ID | 7 | // 分红退货单记录ID |
8 | - DividendsReturnedOrderId int64 `json:"dividendsReturnedOrderId"` | 8 | + DividendsReturnedOrderId int64 `json:"dividendsReturnedOrderId,string"` |
9 | // 分红退货单号 | 9 | // 分红退货单号 |
10 | DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` | 10 | DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` |
11 | // 退货金额 | 11 | // 退货金额 |
@@ -44,15 +44,20 @@ func (dao *DividendsOrderDao) CheckDividendsOrderNumberAvailable(queryOptions ma | @@ -44,15 +44,20 @@ func (dao *DividendsOrderDao) CheckDividendsOrderNumberAvailable(queryOptions ma | ||
44 | query = query.Where("dividends_order_number = ?", dividendsOrderNumber) | 44 | query = query.Where("dividends_order_number = ?", dividendsOrderNumber) |
45 | } | 45 | } |
46 | if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { | 46 | if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { |
47 | - query = query.Where(`cooperation_contract.company @> '{"companyId":"?"}'`, companyId) | 47 | + query = query.Where(`dividends_order.company @> '{"companyId":"?"}'`, companyId) |
48 | } | 48 | } |
49 | if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { | 49 | if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { |
50 | - query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId) | 50 | + query = query.Where(`dividends_order.org @> '{"orgId":"?"}'`, orgId) |
51 | } | 51 | } |
52 | ok, err := query.Exists() | 52 | ok, err := query.Exists() |
53 | return !ok, err | 53 | return !ok, err |
54 | } | 54 | } |
55 | 55 | ||
56 | +// CalculateDividendsOrderAmount 计算分红订单金额 | ||
57 | +func (dao *DividendsOrderDao) CalculateDividendsOrderAmount(queryOptions map[string]interface{}) (float64, error) { | ||
58 | + return 0, nil | ||
59 | +} | ||
60 | + | ||
56 | func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) { | 61 | func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) { |
57 | if transactionContext == nil { | 62 | if transactionContext == nil { |
58 | return nil, fmt.Errorf("transactionContext参数不能未") | 63 | return nil, fmt.Errorf("transactionContext参数不能未") |
@@ -34,11 +34,13 @@ type DividendsOrder struct { | @@ -34,11 +34,13 @@ type DividendsOrder struct { | ||
34 | // 创建时间 | 34 | // 创建时间 |
35 | CreatedAt time.Time `comment:"创建时间"` | 35 | CreatedAt time.Time `comment:"创建时间"` |
36 | // 删除时间 | 36 | // 删除时间 |
37 | - DeletedAt time.Time `comment:"删除时间"` | 37 | + DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"` |
38 | // 更新时间 | 38 | // 更新时间 |
39 | UpdatedAt time.Time `comment:"更新时间"` | 39 | UpdatedAt time.Time `comment:"更新时间"` |
40 | // 操作时间 | 40 | // 操作时间 |
41 | OperateTime time.Time `comment:"操作时间"` | 41 | OperateTime time.Time `comment:"操作时间"` |
42 | // 操作人 | 42 | // 操作人 |
43 | Operator *domain.User `comment:"操作人"` | 43 | Operator *domain.User `comment:"操作人"` |
44 | + // 备注 | ||
45 | + Remarks string `comment:"备注信息"` | ||
44 | } | 46 | } |
@@ -36,7 +36,7 @@ type DividendsReturnedOrder struct { | @@ -36,7 +36,7 @@ type DividendsReturnedOrder struct { | ||
36 | // 创建时间 | 36 | // 创建时间 |
37 | CreatedAt time.Time `comment:"创建时间"` | 37 | CreatedAt time.Time `comment:"创建时间"` |
38 | // 删除时间 | 38 | // 删除时间 |
39 | - DeletedAt time.Time `comment:"删除时间"` | 39 | + DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"` |
40 | // 更新时间 | 40 | // 更新时间 |
41 | UpdatedAt time.Time `comment:"更新时间"` | 41 | UpdatedAt time.Time `comment:"更新时间"` |
42 | // 操作人 | 42 | // 操作人 |
@@ -45,6 +45,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -45,6 +45,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
45 | "updated_at", | 45 | "updated_at", |
46 | "operate_time", | 46 | "operate_time", |
47 | "operator", | 47 | "operator", |
48 | + "remarks", | ||
48 | } | 49 | } |
49 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 50 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
50 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 51 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
@@ -78,6 +79,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -78,6 +79,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
78 | ÷ndsOrder.UpdatedAt, | 79 | ÷ndsOrder.UpdatedAt, |
79 | ÷ndsOrder.OperateTime, | 80 | ÷ndsOrder.OperateTime, |
80 | ÷ndsOrder.Operator, | 81 | ÷ndsOrder.Operator, |
82 | + ÷ndsOrder.Remarks, | ||
81 | ), | 83 | ), |
82 | fmt.Sprintf("INSERT INTO dividends_orders (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 84 | fmt.Sprintf("INSERT INTO dividends_orders (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
83 | dividendsOrder.DividendsOrderId, | 85 | dividendsOrder.DividendsOrderId, |
@@ -97,6 +99,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -97,6 +99,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
97 | dividendsOrder.UpdatedAt, | 99 | dividendsOrder.UpdatedAt, |
98 | dividendsOrder.OperateTime, | 100 | dividendsOrder.OperateTime, |
99 | dividendsOrder.Operator, | 101 | dividendsOrder.Operator, |
102 | + dividendsOrder.Remarks, | ||
100 | ); err != nil { | 103 | ); err != nil { |
101 | return dividendsOrder, err | 104 | return dividendsOrder, err |
102 | } | 105 | } |
@@ -140,6 +143,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -140,6 +143,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
140 | ÷ndsOrder.UpdatedAt, | 143 | ÷ndsOrder.UpdatedAt, |
141 | ÷ndsOrder.OperateTime, | 144 | ÷ndsOrder.OperateTime, |
142 | ÷ndsOrder.Operator, | 145 | ÷ndsOrder.Operator, |
146 | + ÷ndsOrder.Remarks, | ||
143 | ), | 147 | ), |
144 | fmt.Sprintf("UPDATE dividends_orders SET %s WHERE dividends_order_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 148 | fmt.Sprintf("UPDATE dividends_orders SET %s WHERE dividends_order_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
145 | dividendsOrder.DividendsOrderId, | 149 | dividendsOrder.DividendsOrderId, |
@@ -159,6 +163,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -159,6 +163,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
159 | dividendsOrder.UpdatedAt, | 163 | dividendsOrder.UpdatedAt, |
160 | dividendsOrder.OperateTime, | 164 | dividendsOrder.OperateTime, |
161 | dividendsOrder.Operator, | 165 | dividendsOrder.Operator, |
166 | + dividendsOrder.Remarks, | ||
162 | dividendsOrder.Identify(), | 167 | dividendsOrder.Identify(), |
163 | ); err != nil { | 168 | ); err != nil { |
164 | return dividendsOrder, err | 169 | return dividendsOrder, err |
@@ -112,7 +112,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | @@ -112,7 +112,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | ||
112 | OrderGoodPrice: good.OrderGoodPrice, | 112 | OrderGoodPrice: good.OrderGoodPrice, |
113 | OrderGoodQuantity: good.OrderGoodQuantity, | 113 | OrderGoodQuantity: good.OrderGoodQuantity, |
114 | DividendsOrderNumber: good.DividendsOrderNumber, | 114 | DividendsOrderNumber: good.DividendsOrderNumber, |
115 | - DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber, | 115 | + DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, |
116 | CooperationContractNumber: good.CooperationContractNumber, | 116 | CooperationContractNumber: good.CooperationContractNumber, |
117 | OrderGoodExpense: good.OrderGoodExpense, | 117 | OrderGoodExpense: good.OrderGoodExpense, |
118 | OrgId: good.OrgId, | 118 | OrgId: good.OrgId, |
@@ -18,24 +18,24 @@ func GetDayEnd() time.Time { | @@ -18,24 +18,24 @@ func GetDayEnd() time.Time { | ||
18 | return nextDay | 18 | return nextDay |
19 | } | 19 | } |
20 | 20 | ||
21 | -//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。 | 21 | +// GetFirstDateOfMonth 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。 |
22 | func GetFirstDateOfMonth(d time.Time) time.Time { | 22 | func GetFirstDateOfMonth(d time.Time) time.Time { |
23 | d = d.AddDate(0, 0, -d.Day()+1) | 23 | d = d.AddDate(0, 0, -d.Day()+1) |
24 | return GetZeroTime(d) | 24 | return GetZeroTime(d) |
25 | } | 25 | } |
26 | 26 | ||
27 | -//获取传入的时间所在月份的最后一天,即某月最后一天的23:59:59。如传入time.Now(), 返回当前月份的最后一天的23:59:59。 | 27 | +// GetNextMonthFirstDay 获取传入的时间所在月份的最后一天,即某月最后一天的23:59:59。如传入time.Now(), 返回当前月份的最后一天的23:59:59。 |
28 | func GetNextMonthFirstDay(d time.Time) time.Time { | 28 | func GetNextMonthFirstDay(d time.Time) time.Time { |
29 | d = GetFirstDateOfMonth(d).AddDate(0, 1, 0) | 29 | d = GetFirstDateOfMonth(d).AddDate(0, 1, 0) |
30 | return GetZeroTime(d) | 30 | return GetZeroTime(d) |
31 | } | 31 | } |
32 | 32 | ||
33 | -//获取某一天的0点时间 | 33 | +// GetZeroTime 获取某一天的0点时间 |
34 | func GetZeroTime(d time.Time) time.Time { | 34 | func GetZeroTime(d time.Time) time.Time { |
35 | return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local) | 35 | return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local) |
36 | } | 36 | } |
37 | 37 | ||
38 | -//获取某一天的23点59分59秒 | 38 | +// GetNextDayZeroTime 获取某一天的23点59分59秒 |
39 | func GetNextDayZeroTime(d time.Time) time.Time { | 39 | func GetNextDayZeroTime(d time.Time) time.Time { |
40 | return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, 1) | 40 | return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, 1) |
41 | } | 41 | } |
@@ -14,7 +14,6 @@ func (controller *DividendsReturnedOrderController) CreateDividendsReturnedOrder | @@ -14,7 +14,6 @@ func (controller *DividendsReturnedOrderController) CreateDividendsReturnedOrder | ||
14 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 14 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
15 | createDividendsReturnedOrderCommand := &command.CreateDividendsReturnedOrderCommand{} | 15 | createDividendsReturnedOrderCommand := &command.CreateDividendsReturnedOrderCommand{} |
16 | _ = controller.Unmarshal(createDividendsReturnedOrderCommand) | 16 | _ = controller.Unmarshal(createDividendsReturnedOrderCommand) |
17 | - // 解析头部信息 | ||
18 | header := controller.GetRequestHeader(controller.Ctx) | 17 | header := controller.GetRequestHeader(controller.Ctx) |
19 | createDividendsReturnedOrderCommand.CompanyId = header.CompanyId | 18 | createDividendsReturnedOrderCommand.CompanyId = header.CompanyId |
20 | createDividendsReturnedOrderCommand.OrgId = header.OrgId | 19 | createDividendsReturnedOrderCommand.OrgId = header.OrgId |
@@ -28,7 +27,6 @@ func (controller *DividendsReturnedOrderController) UpdateDividendsReturnedOrder | @@ -28,7 +27,6 @@ func (controller *DividendsReturnedOrderController) UpdateDividendsReturnedOrder | ||
28 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 27 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
29 | updateDividendsReturnedOrderCommand := &command.UpdateDividendsReturnedOrderCommand{} | 28 | updateDividendsReturnedOrderCommand := &command.UpdateDividendsReturnedOrderCommand{} |
30 | _ = controller.Unmarshal(updateDividendsReturnedOrderCommand) | 29 | _ = controller.Unmarshal(updateDividendsReturnedOrderCommand) |
31 | - // 解析头部信息 | ||
32 | header := controller.GetRequestHeader(controller.Ctx) | 30 | header := controller.GetRequestHeader(controller.Ctx) |
33 | updateDividendsReturnedOrderCommand.CompanyId = header.CompanyId | 31 | updateDividendsReturnedOrderCommand.CompanyId = header.CompanyId |
34 | updateDividendsReturnedOrderCommand.OrgId = header.OrgId | 32 | updateDividendsReturnedOrderCommand.OrgId = header.OrgId |
@@ -43,7 +41,6 @@ func (controller *DividendsReturnedOrderController) UpdateDividendsReturnedOrder | @@ -43,7 +41,6 @@ func (controller *DividendsReturnedOrderController) UpdateDividendsReturnedOrder | ||
43 | func (controller *DividendsReturnedOrderController) GetDividendsReturnedOrder() { | 41 | func (controller *DividendsReturnedOrderController) GetDividendsReturnedOrder() { |
44 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 42 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
45 | getDividendsReturnedOrderQuery := &query.GetDividendsReturnedOrderQuery{} | 43 | getDividendsReturnedOrderQuery := &query.GetDividendsReturnedOrderQuery{} |
46 | - // 解析头部信息 | ||
47 | header := controller.GetRequestHeader(controller.Ctx) | 44 | header := controller.GetRequestHeader(controller.Ctx) |
48 | getDividendsReturnedOrderQuery.CompanyId = header.CompanyId | 45 | getDividendsReturnedOrderQuery.CompanyId = header.CompanyId |
49 | getDividendsReturnedOrderQuery.OrgId = header.OrgId | 46 | getDividendsReturnedOrderQuery.OrgId = header.OrgId |
@@ -59,7 +56,6 @@ func (controller *DividendsReturnedOrderController) RemoveDividendsReturnedOrder | @@ -59,7 +56,6 @@ func (controller *DividendsReturnedOrderController) RemoveDividendsReturnedOrder | ||
59 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 56 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
60 | removeDividendsReturnedOrderCommand := &command.RemoveDividendsReturnedOrderCommand{} | 57 | removeDividendsReturnedOrderCommand := &command.RemoveDividendsReturnedOrderCommand{} |
61 | _ = controller.Unmarshal(removeDividendsReturnedOrderCommand) | 58 | _ = controller.Unmarshal(removeDividendsReturnedOrderCommand) |
62 | - // 解析头部信息 | ||
63 | header := controller.GetRequestHeader(controller.Ctx) | 59 | header := controller.GetRequestHeader(controller.Ctx) |
64 | removeDividendsReturnedOrderCommand.CompanyId = header.CompanyId | 60 | removeDividendsReturnedOrderCommand.CompanyId = header.CompanyId |
65 | removeDividendsReturnedOrderCommand.OrgId = header.OrgId | 61 | removeDividendsReturnedOrderCommand.OrgId = header.OrgId |
@@ -74,7 +70,6 @@ func (controller *DividendsReturnedOrderController) RemoveDividendsReturnedOrder | @@ -74,7 +70,6 @@ func (controller *DividendsReturnedOrderController) RemoveDividendsReturnedOrder | ||
74 | func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() { | 70 | func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() { |
75 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 71 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
76 | searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{} | 72 | searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{} |
77 | - // 解析头部信息 | ||
78 | header := controller.GetRequestHeader(controller.Ctx) | 73 | header := controller.GetRequestHeader(controller.Ctx) |
79 | searchDividendsReturnedOrderQuery.CompanyId = header.CompanyId | 74 | searchDividendsReturnedOrderQuery.CompanyId = header.CompanyId |
80 | searchDividendsReturnedOrderQuery.OrgId = header.OrgId | 75 | searchDividendsReturnedOrderQuery.OrgId = header.OrgId |
@@ -88,7 +83,6 @@ func (controller *DividendsReturnedOrderController) ImportDividendsReturnedOrder | @@ -88,7 +83,6 @@ func (controller *DividendsReturnedOrderController) ImportDividendsReturnedOrder | ||
88 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 83 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
89 | importDividendsReturnedOrderCommand := &command.ImportDividendsReturnedOrderCommand{} | 84 | importDividendsReturnedOrderCommand := &command.ImportDividendsReturnedOrderCommand{} |
90 | _ = controller.Unmarshal(importDividendsReturnedOrderCommand) | 85 | _ = controller.Unmarshal(importDividendsReturnedOrderCommand) |
91 | - // 解析头部信息 | ||
92 | header := controller.GetRequestHeader(controller.Ctx) | 86 | header := controller.GetRequestHeader(controller.Ctx) |
93 | importDividendsReturnedOrderCommand.CompanyId = header.CompanyId | 87 | importDividendsReturnedOrderCommand.CompanyId = header.CompanyId |
94 | importDividendsReturnedOrderCommand.OrgId = header.OrgId | 88 | importDividendsReturnedOrderCommand.OrgId = header.OrgId |
@@ -101,7 +95,6 @@ func (controller *DividendsReturnedOrderController) ImportDividendsReturnedOrder | @@ -101,7 +95,6 @@ func (controller *DividendsReturnedOrderController) ImportDividendsReturnedOrder | ||
101 | func (controller *DividendsReturnedOrderController) ListDividendsReturnedOrder() { | 95 | func (controller *DividendsReturnedOrderController) ListDividendsReturnedOrder() { |
102 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 96 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
103 | listDividendsReturnedOrderQuery := &query.ListDividendsReturnedOrderQuery{} | 97 | listDividendsReturnedOrderQuery := &query.ListDividendsReturnedOrderQuery{} |
104 | - // 解析头部信息 | ||
105 | header := controller.GetRequestHeader(controller.Ctx) | 98 | header := controller.GetRequestHeader(controller.Ctx) |
106 | listDividendsReturnedOrderQuery.CompanyId = header.CompanyId | 99 | listDividendsReturnedOrderQuery.CompanyId = header.CompanyId |
107 | listDividendsReturnedOrderQuery.OrgId = header.OrgId | 100 | listDividendsReturnedOrderQuery.OrgId = header.OrgId |
-
请 注册 或 登录 后发表评论