合并分支 'dev' 到 'test'
Dev 查看合并请求 !31
正在显示
5 个修改的文件
包含
56 行增加
和
25 行删除
1 | +/** | ||
2 | + @author: stevechan | ||
3 | + @date: 2021/2/2 | ||
4 | + @note: | ||
5 | +**/ | ||
6 | + | ||
7 | +package query | ||
8 | + | ||
9 | +type ListOrderBonusForExcelQuery struct { | ||
10 | + Type string `json:"type"` // 操作类型 ORDER_BASE | ||
11 | + Where BonusWhere `json:"where"` // 导出条件 | ||
12 | + IDS []int `json:"ids"` // 勾选id | ||
13 | +} | ||
14 | + | ||
15 | +type BonusWhere struct { | ||
16 | + SearchWord string `json:"searchWord"` | ||
17 | + OrderType int `json:"orderType"` | ||
18 | + PageSize int `json:"pageSize"` | ||
19 | + PageNumber int `json:"pageNumber"` | ||
20 | + PartnerCategoryId int `json:"partnerCategoryId"` | ||
21 | + CreateTime []string `json:"createTime"` | ||
22 | +} |
@@ -352,7 +352,7 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error | @@ -352,7 +352,7 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error | ||
352 | if err = usersRepository.Remove(data.Ids); err != nil { | 352 | if err = usersRepository.Remove(data.Ids); err != nil { |
353 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 353 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
354 | } | 354 | } |
355 | - // TODO 删除栏目设置 | 355 | + // 删除栏目设置 |
356 | var columnSettingRepository domain.ColumnSettingRepository | 356 | var columnSettingRepository domain.ColumnSettingRepository |
357 | if value, errFac := factory.CreateColumnSettingRepository(map[string]interface{}{ | 357 | if value, errFac := factory.CreateColumnSettingRepository(map[string]interface{}{ |
358 | "transactionContext": transactionContext, | 358 | "transactionContext": transactionContext, |
@@ -325,7 +325,8 @@ func (dao OrderBaseDao) OrderListForExcel(companyId int64, partnerName string, o | @@ -325,7 +325,8 @@ func (dao OrderBaseDao) OrderListForExcel(companyId int64, partnerName string, o | ||
325 | sqlstr += ` AND t1.partner_category@>'{"id":?}' ` | 325 | sqlstr += ` AND t1.partner_category@>'{"id":?}' ` |
326 | } | 326 | } |
327 | if len(partnerCategoryName) > 0 { | 327 | if len(partnerCategoryName) > 0 { |
328 | - params = append(params, partnerCategoryName) | 328 | + like := "%" + partnerCategoryName + "%" |
329 | + params = append(params, like) | ||
329 | sqlstr += ` AND t1.partner_category->> 'name' like ?` | 330 | sqlstr += ` AND t1.partner_category->> 'name' like ?` |
330 | } | 331 | } |
331 | if len(updateTime[0]) > 0 { | 332 | if len(updateTime[0]) > 0 { |
@@ -67,8 +67,8 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett | @@ -67,8 +67,8 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett | ||
67 | func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSetting, columnSettings []*domain.ColumnSetting) (*domain.ColumnSetting, []*domain.ColumnSetting, error) { | 67 | func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSetting, columnSettings []*domain.ColumnSetting) (*domain.ColumnSetting, []*domain.ColumnSetting, error) { |
68 | tx := repository.transactionContext.PgTx | 68 | tx := repository.transactionContext.PgTx |
69 | 69 | ||
70 | + // 单个删除 | ||
70 | if columnSetting != nil { | 71 | if columnSetting != nil { |
71 | - // 单个删除 | ||
72 | columnSettingModel := new(models.ColumnSetting) | 72 | columnSettingModel := new(models.ColumnSetting) |
73 | columnSettingModel.Id = columnSetting.Identify().(int64) | 73 | columnSettingModel.Id = columnSetting.Identify().(int64) |
74 | if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil { | 74 | if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil { |
@@ -88,6 +88,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe | @@ -88,6 +88,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe | ||
88 | return nil, columnSettings, err | 88 | return nil, columnSettings, err |
89 | } | 89 | } |
90 | } | 90 | } |
91 | + | ||
91 | return columnSetting, columnSettings, nil | 92 | return columnSetting, columnSettings, nil |
92 | } | 93 | } |
93 | 94 | ||
@@ -123,7 +124,7 @@ func (repository *ColumnSettingRepository) Find(queryOptions map[string]interfac | @@ -123,7 +124,7 @@ func (repository *ColumnSettingRepository) Find(queryOptions map[string]interfac | ||
123 | var columnSettingModels []*models.ColumnSetting | 124 | var columnSettingModels []*models.ColumnSetting |
124 | columnSettings := make([]*domain.ColumnSetting, 0) | 125 | columnSettings := make([]*domain.ColumnSetting, 0) |
125 | query := tx.Model(&columnSettingModels) | 126 | query := tx.Model(&columnSettingModels) |
126 | - if ids, ok := queryOptions["ids"]; ok { | 127 | + if ids, ok := queryOptions["ids"]; ok && len(ids.([]int64)) != 0 { |
127 | query = query.Where("column_setting.uid IN (?)", pg.In(ids.([]int64))) | 128 | query = query.Where("column_setting.uid IN (?)", pg.In(ids.([]int64))) |
128 | } | 129 | } |
129 | if uid, ok := queryOptions["uid"]; ok { | 130 | if uid, ok := queryOptions["uid"]; ok { |
@@ -292,16 +292,18 @@ func (c *OrderDividendController) EditOrderRemarkBonus() { | @@ -292,16 +292,18 @@ func (c *OrderDividendController) EditOrderRemarkBonus() { | ||
292 | } | 292 | } |
293 | 293 | ||
294 | func (c *OrderDividendController) ListOrderBonusForExcel() { | 294 | func (c *OrderDividendController) ListOrderBonusForExcel() { |
295 | - type Parameter struct { | ||
296 | - SearchWord string `json:"searchWord"` | ||
297 | - OrderType int `json:"orderType"` | ||
298 | - PageSize int `json:"pageSize"` | ||
299 | - PageNumber int `json:"pageNumber"` | ||
300 | - PartnerCategoryId int `json:"partnerCategoryId"` | ||
301 | - CreateTime []string `json:"createTime"` | ||
302 | - } | 295 | + //type Parameter struct { |
296 | + // SearchWord string `json:"searchWord"` | ||
297 | + // OrderType int `json:"orderType"` | ||
298 | + // PageSize int `json:"pageSize"` | ||
299 | + // PageNumber int `json:"pageNumber"` | ||
300 | + // PartnerCategoryId int `json:"partnerCategoryId"` | ||
301 | + // CreateTime []string `json:"createTime"` | ||
302 | + //} | ||
303 | + | ||
303 | var ( | 304 | var ( |
304 | - param Parameter | 305 | + //param Parameter |
306 | + param orderQuery.ListOrderBonusForExcelQuery | ||
305 | err error | 307 | err error |
306 | ) | 308 | ) |
307 | if err = c.BindJsonData(¶m); err != nil { | 309 | if err = c.BindJsonData(¶m); err != nil { |
@@ -309,9 +311,14 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | @@ -309,9 +311,14 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | ||
309 | c.ResponseError(errors.New("json数据解析失败")) | 311 | c.ResponseError(errors.New("json数据解析失败")) |
310 | return | 312 | return |
311 | } | 313 | } |
312 | - if !(param.OrderType == 0 || | ||
313 | - param.OrderType == domain.OrderReal || | ||
314 | - param.OrderType == domain.OrderTypeBestShop) { | 314 | + if param.Type != "ORDER_DIVIDEND" { |
315 | + logs.Error(err) | ||
316 | + c.ResponseError(errors.New("错误的操作类型")) | ||
317 | + return | ||
318 | + } | ||
319 | + if !(param.Where.OrderType == 0 || | ||
320 | + param.Where.OrderType == domain.OrderReal || | ||
321 | + param.Where.OrderType == domain.OrderTypeBestShop) { | ||
315 | c.ResponseError(errors.New("参数异常")) | 322 | c.ResponseError(errors.New("参数异常")) |
316 | return | 323 | return |
317 | } | 324 | } |
@@ -319,9 +326,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | @@ -319,9 +326,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | ||
319 | createTimeBegin string | 326 | createTimeBegin string |
320 | createTimeEnd string | 327 | createTimeEnd string |
321 | ) | 328 | ) |
322 | - if len(param.CreateTime) > 0 { | ||
323 | - if len(param.CreateTime[0]) > 0 { | ||
324 | - t, err := time.ParseInLocation("2006-01-02", param.CreateTime[0], time.Local) | 329 | + if len(param.Where.CreateTime) > 0 { |
330 | + if len(param.Where.CreateTime[0]) > 0 { | ||
331 | + t, err := time.ParseInLocation("2006-01-02", param.Where.CreateTime[0], time.Local) | ||
325 | if err != nil { | 332 | if err != nil { |
326 | c.ResponseError(errors.New("UpdateTimeBegin 时间格式错误")) | 333 | c.ResponseError(errors.New("UpdateTimeBegin 时间格式错误")) |
327 | return | 334 | return |
@@ -329,9 +336,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | @@ -329,9 +336,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | ||
329 | createTimeBegin = t.Format("2006-01-02 15:04:05-07") | 336 | createTimeBegin = t.Format("2006-01-02 15:04:05-07") |
330 | } | 337 | } |
331 | } | 338 | } |
332 | - if len(param.CreateTime) > 1 { | ||
333 | - if len(param.CreateTime[1]) > 0 { | ||
334 | - t, err := time.ParseInLocation("2006-01-02", param.CreateTime[1], time.Local) | 339 | + if len(param.Where.CreateTime) > 1 { |
340 | + if len(param.Where.CreateTime[1]) > 0 { | ||
341 | + t, err := time.ParseInLocation("2006-01-02", param.Where.CreateTime[1], time.Local) | ||
335 | if err != nil { | 342 | if err != nil { |
336 | c.ResponseError(errors.New("UpdateTimeEnd 时间格式错误")) | 343 | c.ResponseError(errors.New("UpdateTimeEnd 时间格式错误")) |
337 | return | 344 | return |
@@ -345,10 +352,10 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | @@ -345,10 +352,10 @@ func (c *OrderDividendController) ListOrderBonusForExcel() { | ||
345 | orderSrv := orderService.NewOrderInfoService(nil) | 352 | orderSrv := orderService.NewOrderInfoService(nil) |
346 | dataResult, column, err := orderSrv.ListOrderBonusForExcel( | 353 | dataResult, column, err := orderSrv.ListOrderBonusForExcel( |
347 | orderQuery.ListOrderBonusQuery{ | 354 | orderQuery.ListOrderBonusQuery{ |
348 | - OrderType: param.OrderType, | ||
349 | - PartnerOrCode: param.SearchWord, | 355 | + OrderType: param.Where.OrderType, |
356 | + PartnerOrCode: param.Where.SearchWord, | ||
350 | CompanyId: companyId, | 357 | CompanyId: companyId, |
351 | - PartnerCategory: param.PartnerCategoryId, | 358 | + PartnerCategory: param.Where.PartnerCategoryId, |
352 | CreateTimeBegin: createTimeBegin, | 359 | CreateTimeBegin: createTimeBegin, |
353 | CreateTimeEnd: createTimeEnd, | 360 | CreateTimeEnd: createTimeEnd, |
354 | }) | 361 | }) |
-
请 注册 或 登录 后发表评论