作者 陈志颖

fix:修复订单分红导出

/**
@author: stevechan
@date: 2021/2/2
@note:
**/
package query
type ListOrderBonusForExcelQuery struct {
Type string `json:"type"` // 操作类型 ORDER_BASE
Where BonusWhere `json:"where"` // 导出条件
IDS []int `json:"ids"` // 勾选id
}
type BonusWhere struct {
SearchWord string `json:"searchWord"`
OrderType int `json:"orderType"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
PartnerCategoryId int `json:"partnerCategoryId"`
CreateTime []string `json:"createTime"`
}
... ...
... ... @@ -292,16 +292,18 @@ func (c *OrderDividendController) EditOrderRemarkBonus() {
}
func (c *OrderDividendController) ListOrderBonusForExcel() {
type Parameter struct {
SearchWord string `json:"searchWord"`
OrderType int `json:"orderType"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
PartnerCategoryId int `json:"partnerCategoryId"`
CreateTime []string `json:"createTime"`
}
//type Parameter struct {
// SearchWord string `json:"searchWord"`
// OrderType int `json:"orderType"`
// PageSize int `json:"pageSize"`
// PageNumber int `json:"pageNumber"`
// PartnerCategoryId int `json:"partnerCategoryId"`
// CreateTime []string `json:"createTime"`
//}
var (
param Parameter
//param Parameter
param orderQuery.ListOrderBonusForExcelQuery
err error
)
if err = c.BindJsonData(&param); err != nil {
... ... @@ -309,9 +311,14 @@ func (c *OrderDividendController) ListOrderBonusForExcel() {
c.ResponseError(errors.New("json数据解析失败"))
return
}
if !(param.OrderType == 0 ||
param.OrderType == domain.OrderReal ||
param.OrderType == domain.OrderTypeBestShop) {
if param.Type != "ORDER_DIVIDEND" {
logs.Error(err)
c.ResponseError(errors.New("错误的操作类型"))
return
}
if !(param.Where.OrderType == 0 ||
param.Where.OrderType == domain.OrderReal ||
param.Where.OrderType == domain.OrderTypeBestShop) {
c.ResponseError(errors.New("参数异常"))
return
}
... ... @@ -319,9 +326,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() {
createTimeBegin string
createTimeEnd string
)
if len(param.CreateTime) > 0 {
if len(param.CreateTime[0]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.CreateTime[0], time.Local)
if len(param.Where.CreateTime) > 0 {
if len(param.Where.CreateTime[0]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.Where.CreateTime[0], time.Local)
if err != nil {
c.ResponseError(errors.New("UpdateTimeBegin 时间格式错误"))
return
... ... @@ -329,9 +336,9 @@ func (c *OrderDividendController) ListOrderBonusForExcel() {
createTimeBegin = t.Format("2006-01-02 15:04:05-07")
}
}
if len(param.CreateTime) > 1 {
if len(param.CreateTime[1]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.CreateTime[1], time.Local)
if len(param.Where.CreateTime) > 1 {
if len(param.Where.CreateTime[1]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.Where.CreateTime[1], time.Local)
if err != nil {
c.ResponseError(errors.New("UpdateTimeEnd 时间格式错误"))
return
... ... @@ -345,10 +352,10 @@ func (c *OrderDividendController) ListOrderBonusForExcel() {
orderSrv := orderService.NewOrderInfoService(nil)
dataResult, column, err := orderSrv.ListOrderBonusForExcel(
orderQuery.ListOrderBonusQuery{
OrderType: param.OrderType,
PartnerOrCode: param.SearchWord,
OrderType: param.Where.OrderType,
PartnerOrCode: param.Where.SearchWord,
CompanyId: companyId,
PartnerCategory: param.PartnerCategoryId,
PartnerCategory: param.Where.PartnerCategoryId,
CreateTimeBegin: createTimeBegin,
CreateTimeEnd: createTimeEnd,
})
... ...