作者 陈志颖

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

... ... @@ -358,9 +358,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
if count, activities, err := exchangeActivityRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashActivityQuery)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
// TODO 更新兑换活动结束倒计时,增加倒计时结束判断
for _, activity := range activities {
var timeNow = time.Now()
var deadline = activity.Deadline
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
Deadline: activity.Deadline,
}
// 倒计时结束
if t2.Before(t1) {
updateExchangeCashActivity.CountDown = 0
updateExchangeCashActivity.Deadline = activity.Deadline
}
if err := activity.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivity)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -283,7 +283,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.
// }, nil
//}
// TODO 排行榜统计,增加分页
// 排行榜统计
func (dao *EmployeeDao) CalculateEmployeesRankingList(companyId int, startTime time.Time, endTime time.Time, offset int, limit int) (map[string]interface{}, error) {
var retWealth []struct {
Uid int
... ...
... ... @@ -137,7 +137,7 @@ func (controller *StatisticsController) EmployeesContributionsStatistics() {
controller.ServeJSON()
}
// TODO 合并员工财富值、贡献值排行榜
// 员工财富值、贡献值排行榜
func (controller *StatisticsController) RankingListStatistics() {
statisticsService := service.NewStatisticsService(nil)
employeesRankingListStatisticsCommand := &command.EmployeesRankingListStatisticsCommand{}
... ...
... ... @@ -341,7 +341,7 @@ func (controller *SuMoneyController) ImportExchangeList () {
fmt.Println(err)
return
}
// TODO 增加导入失败原因返回
// TODO 增加非空校验,导入失败原因返回
var response utils.JsonResponse
dataList := make([]interface{}, 0)
rows, _ := xlsx.GetRows("Sheet1")
... ... @@ -353,9 +353,9 @@ func (controller *SuMoneyController) ImportExchangeList () {
if i > 2 {
for _, _ = range row {
createExchangeCashPersonCommand.ExchangeCashActivityId = activityId
// TODO 非空校验
if row[0] == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{
controller.Ctx.WriteString( "空字段" )
r2, _ := strconv.ParseFloat(row[2], 64)
if row[0] == "" || row[1] == "" || r2 == 0 {
controller.Ctx.WriteString("单元格包含空字段")
return
}
createExchangeCashPersonCommand.Operator = operator
... ... @@ -402,7 +402,6 @@ func (controller *SuMoneyController) ExportExchangeList() {
cashPoolService := service.NewCashPoolService(nil)
exportExchangeCashListCommand := &command.ExportExchangeCashListCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exportExchangeCashListCommand)
fmt.Print(exportExchangeCashListCommand, "\n")
// 列标题
titles := []string{
"姓名","手机账号","已兑换现金","已兑换素币",
... ... @@ -423,7 +422,6 @@ func (controller *SuMoneyController) ExportExchangeList() {
}
data = append(data, p)
}
fmt.Print(data, "\n")
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
... ... @@ -457,21 +455,17 @@ func (controller *SuMoneyController) ExportExchangeList() {
}
}
f.SetActiveSheet(index)
// 创建下载文件夹
mkErr :=os.Mkdir("download", os.ModePerm)
if err!=nil{
fmt.Println(mkErr)
}
//保存为文件
f.Path="download/素币兑换清单.xlsx"
if err := f.Save(); err != nil {
fmt.Println(err)
}
controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx")
// 下载完成删除文件
removeErr := os.Remove(f.Path)
if err != nil {
... ...