作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !31
/**
@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"`
}
... ...
... ... @@ -352,7 +352,7 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error
if err = usersRepository.Remove(data.Ids); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
// TODO 删除栏目设置
// 删除栏目设置
var columnSettingRepository domain.ColumnSettingRepository
if value, errFac := factory.CreateColumnSettingRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ...
... ... @@ -325,7 +325,8 @@ func (dao OrderBaseDao) OrderListForExcel(companyId int64, partnerName string, o
sqlstr += ` AND t1.partner_category@>'{"id":?}' `
}
if len(partnerCategoryName) > 0 {
params = append(params, partnerCategoryName)
like := "%" + partnerCategoryName + "%"
params = append(params, like)
sqlstr += ` AND t1.partner_category->> 'name' like ?`
}
if len(updateTime[0]) > 0 {
... ...
... ... @@ -67,8 +67,8 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett
func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSetting, columnSettings []*domain.ColumnSetting) (*domain.ColumnSetting, []*domain.ColumnSetting, error) {
tx := repository.transactionContext.PgTx
// 单个删除
if columnSetting != nil {
// 单个删除
columnSettingModel := new(models.ColumnSetting)
columnSettingModel.Id = columnSetting.Identify().(int64)
if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil {
... ... @@ -88,6 +88,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe
return nil, columnSettings, err
}
}
return columnSetting, columnSettings, nil
}
... ... @@ -123,7 +124,7 @@ func (repository *ColumnSettingRepository) Find(queryOptions map[string]interfac
var columnSettingModels []*models.ColumnSetting
columnSettings := make([]*domain.ColumnSetting, 0)
query := tx.Model(&columnSettingModels)
if ids, ok := queryOptions["ids"]; ok {
if ids, ok := queryOptions["ids"]; ok && len(ids.([]int64)) != 0 {
query = query.Where("column_setting.uid IN (?)", pg.In(ids.([]int64)))
}
if uid, ok := queryOptions["uid"]; ok {
... ...
... ... @@ -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,
})
... ...