|
@@ -326,7 +326,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang |
|
@@ -326,7 +326,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang |
326
|
var t1 = time.Now().Local()
|
326
|
var t1 = time.Now().Local()
|
327
|
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
327
|
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
328
|
|
328
|
|
329
|
- fmt.Print(t2, "\n")
|
|
|
330
|
|
329
|
|
331
|
// 获取该公司所有兑换现金活动
|
330
|
// 获取该公司所有兑换现金活动
|
332
|
if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
|
331
|
if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
|
|
@@ -930,6 +929,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -930,6 +929,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
930
|
if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
|
929
|
if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
|
931
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
930
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
932
|
} else {
|
931
|
} else {
|
|
|
932
|
+ // 获取该公司所有兑换现金活动
|
|
|
933
|
+ if _, activities, err := exchangeCashActivityRepository.FindAll(map[string]interface{}{
|
|
|
934
|
+ "companyId": activityFound.CompanyId,
|
|
|
935
|
+ }); err != nil {
|
|
|
936
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
937
|
+ } else {
|
|
|
938
|
+ for _, activity := range activities {
|
|
|
939
|
+ if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
|
|
|
940
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
|
|
|
941
|
+ }
|
|
|
942
|
+ }
|
|
|
943
|
+ }
|
|
|
944
|
+
|
933
|
if err := transactionContext.CommitTransaction(); err != nil {
|
945
|
if err := transactionContext.CommitTransaction(); err != nil {
|
934
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
946
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
935
|
}
|
947
|
}
|