作者 陈志颖

fix:更新兑换活动增加重复时间判断

... ... @@ -326,7 +326,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
var t1 = time.Now().Local()
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
fmt.Print(t2, "\n")
// 获取该公司所有兑换现金活动
if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
... ... @@ -930,6 +929,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
// 获取该公司所有兑换现金活动
if _, activities, err := exchangeCashActivityRepository.FindAll(map[string]interface{}{
"companyId": activityFound.CompanyId,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
for _, activity := range activities {
if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
}
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -399,13 +399,22 @@ func (controller *SuMoneyController) ImportExchangeList () {
//fmt.Printf("命令:%+v\n", importExchangeCashListCommand.Where)
//fmt.Print(controller.GetString("where"), "\n")
where := controller.GetString("where")
//fmt.Print(reflect.TypeOf(importExchangeCashListCommand.Where), "\n")
//typeOf := reflect.TypeOf(where)
//if reflect.TypeOf(where) == Type.String() {
// jsonMap := make(map[string]interface{})
// _ := json.Unmarshal([]byte(where), &jsonMap)
// fmt.Printf("%+v\n", jsonMap)
//}
//fmt.Print(reflect.TypeOf(where), "\n")
file, h, _ := controller.GetFile("file")
jsonMap := make(map[string]interface{})
err := json.Unmarshal([]byte(where), &jsonMap)
fmt.Printf("%+v\n", jsonMap)
fmt.Print(jsonMap["activityId"])
tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
fmt.Print(tmp, "\n")
// 错误信息返回
var response utils.JsonResponse
... ...