作者 陈志颖

fix:增加活动倒计时结束判断

@@ -358,9 +358,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas @@ -358,9 +358,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
358 if count, activities, err := exchangeActivityRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashActivityQuery)); err != nil { 358 if count, activities, err := exchangeActivityRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashActivityQuery)); err != nil {
359 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 359 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
360 } else { 360 } else {
361 - // TODO 更新兑换活动结束倒计时,增加倒计时结束判断  
362 for _, activity := range activities { 361 for _, activity := range activities {
363 -  
364 var timeNow = time.Now() 362 var timeNow = time.Now()
365 var deadline = activity.Deadline 363 var deadline = activity.Deadline
366 var t1 = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local) 364 var t1 = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local)
@@ -372,6 +370,12 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas @@ -372,6 +370,12 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
372 Deadline: activity.Deadline, 370 Deadline: activity.Deadline,
373 } 371 }
374 372
  373 + // 倒计时结束
  374 + if t2.Before(t1) {
  375 + updateExchangeCashActivity.CountDown = 0
  376 + updateExchangeCashActivity.Deadline = activity.Deadline
  377 + }
  378 +
375 if err := activity.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivity)); err != nil { 379 if err := activity.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivity)); err != nil {
376 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 380 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
377 } 381 }
@@ -283,7 +283,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time. @@ -283,7 +283,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.
283 // }, nil 283 // }, nil
284 //} 284 //}
285 285
286 -// TODO 排行榜统计,增加分页 286 +// 排行榜统计
287 func (dao *EmployeeDao) CalculateEmployeesRankingList(companyId int, startTime time.Time, endTime time.Time, offset int, limit int) (map[string]interface{}, error) { 287 func (dao *EmployeeDao) CalculateEmployeesRankingList(companyId int, startTime time.Time, endTime time.Time, offset int, limit int) (map[string]interface{}, error) {
288 var retWealth []struct { 288 var retWealth []struct {
289 Uid int 289 Uid int
@@ -137,7 +137,7 @@ func (controller *StatisticsController) EmployeesContributionsStatistics() { @@ -137,7 +137,7 @@ func (controller *StatisticsController) EmployeesContributionsStatistics() {
137 controller.ServeJSON() 137 controller.ServeJSON()
138 } 138 }
139 139
140 -// TODO 合并员工财富值、贡献值排行榜 140 +// 员工财富值、贡献值排行榜
141 func (controller *StatisticsController) RankingListStatistics() { 141 func (controller *StatisticsController) RankingListStatistics() {
142 statisticsService := service.NewStatisticsService(nil) 142 statisticsService := service.NewStatisticsService(nil)
143 employeesRankingListStatisticsCommand := &command.EmployeesRankingListStatisticsCommand{} 143 employeesRankingListStatisticsCommand := &command.EmployeesRankingListStatisticsCommand{}
@@ -341,7 +341,7 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -341,7 +341,7 @@ func (controller *SuMoneyController) ImportExchangeList () {
341 fmt.Println(err) 341 fmt.Println(err)
342 return 342 return
343 } 343 }
344 - // TODO 增加导入失败原因返回 344 + // TODO 增加非空校验,导入失败原因返回
345 var response utils.JsonResponse 345 var response utils.JsonResponse
346 dataList := make([]interface{}, 0) 346 dataList := make([]interface{}, 0)
347 rows, _ := xlsx.GetRows("Sheet1") 347 rows, _ := xlsx.GetRows("Sheet1")
@@ -353,9 +353,9 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -353,9 +353,9 @@ func (controller *SuMoneyController) ImportExchangeList () {
353 if i > 2 { 353 if i > 2 {
354 for _, _ = range row { 354 for _, _ = range row {
355 createExchangeCashPersonCommand.ExchangeCashActivityId = activityId 355 createExchangeCashPersonCommand.ExchangeCashActivityId = activityId
356 - // TODO 非空校验  
357 - if row[0] == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{  
358 - controller.Ctx.WriteString( "空字段" ) 356 + r2, _ := strconv.ParseFloat(row[2], 64)
  357 + if row[0] == "" || row[1] == "" || r2 == 0 {
  358 + controller.Ctx.WriteString("单元格包含空字段")
359 return 359 return
360 } 360 }
361 createExchangeCashPersonCommand.Operator = operator 361 createExchangeCashPersonCommand.Operator = operator
@@ -402,7 +402,6 @@ func (controller *SuMoneyController) ExportExchangeList() { @@ -402,7 +402,6 @@ func (controller *SuMoneyController) ExportExchangeList() {
402 cashPoolService := service.NewCashPoolService(nil) 402 cashPoolService := service.NewCashPoolService(nil)
403 exportExchangeCashListCommand := &command.ExportExchangeCashListCommand{} 403 exportExchangeCashListCommand := &command.ExportExchangeCashListCommand{}
404 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exportExchangeCashListCommand) 404 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exportExchangeCashListCommand)
405 - fmt.Print(exportExchangeCashListCommand, "\n")  
406 // 列标题 405 // 列标题
407 titles := []string{ 406 titles := []string{
408 "姓名","手机账号","已兑换现金","已兑换素币", 407 "姓名","手机账号","已兑换现金","已兑换素币",
@@ -423,7 +422,6 @@ func (controller *SuMoneyController) ExportExchangeList() { @@ -423,7 +422,6 @@ func (controller *SuMoneyController) ExportExchangeList() {
423 } 422 }
424 data = append(data, p) 423 data = append(data, p)
425 } 424 }
426 - fmt.Print(data, "\n")  
427 var response utils.JsonResponse 425 var response utils.JsonResponse
428 if err != nil { 426 if err != nil {
429 response = utils.ResponseError(controller.Ctx, err) 427 response = utils.ResponseError(controller.Ctx, err)
@@ -457,21 +455,17 @@ func (controller *SuMoneyController) ExportExchangeList() { @@ -457,21 +455,17 @@ func (controller *SuMoneyController) ExportExchangeList() {
457 } 455 }
458 } 456 }
459 f.SetActiveSheet(index) 457 f.SetActiveSheet(index)
460 -  
461 // 创建下载文件夹 458 // 创建下载文件夹
462 mkErr :=os.Mkdir("download", os.ModePerm) 459 mkErr :=os.Mkdir("download", os.ModePerm)
463 if err!=nil{ 460 if err!=nil{
464 fmt.Println(mkErr) 461 fmt.Println(mkErr)
465 } 462 }
466 -  
467 //保存为文件 463 //保存为文件
468 f.Path="download/素币兑换清单.xlsx" 464 f.Path="download/素币兑换清单.xlsx"
469 if err := f.Save(); err != nil { 465 if err := f.Save(); err != nil {
470 fmt.Println(err) 466 fmt.Println(err)
471 } 467 }
472 -  
473 controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx") 468 controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx")
474 -  
475 // 下载完成删除文件 469 // 下载完成删除文件
476 removeErr := os.Remove(f.Path) 470 removeErr := os.Remove(f.Path)
477 if err != nil { 471 if err != nil {