|
@@ -1136,9 +1136,18 @@ func CentralKitchenForSchoolReserveDetail(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func CentralKitchenForSchoolOrdRefund(c *gin.Context) { |
|
|
func CentralKitchenForSchoolOrdRefund(c *gin.Context) { |
|
|
|
|
|
//TODO:: 加锁 Redis 锁,防并发 |
|
|
|
|
|
getString, _ := cache.GetString(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
|
|
|
if getString != "" { |
|
|
|
|
|
e.OutErr(c, e.ERR, "请稍等,存在其他订单退款处理中!") |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
cache.Set(md.OrdRefundLockKeyForCentralKitchenSchool, "running") |
|
|
|
|
|
|
|
|
var req md.CentralKitchenForSchoolOrdRefundReq |
|
|
var req md.CentralKitchenForSchoolOrdRefundReq |
|
|
err := c.ShouldBindJSON(&req) |
|
|
err := c.ShouldBindJSON(&req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|
|
|
cache.Del(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err1 := err.(e.E) |
|
|
err1 := err.(e.E) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
@@ -1148,18 +1157,23 @@ func CentralKitchenForSchoolOrdRefund(c *gin.Context) { |
|
|
enterpriseDb.Set() |
|
|
enterpriseDb.Set() |
|
|
enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId) |
|
|
enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|
|
|
cache.Del(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if enterprise == nil { |
|
|
if enterprise == nil { |
|
|
|
|
|
cache.Del(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") |
|
|
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
err = svc2.CentralKitchenForSchoolOrdRefund(req) |
|
|
err = svc2.CentralKitchenForSchoolOrdRefund(req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|
|
|
cache.Del(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cache.Del(md.OrdRefundLockKeyForCentralKitchenSchool) |
|
|
e.OutSuc(c, "success", nil) |
|
|
e.OutSuc(c, "success", nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -1190,7 +1204,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
e.OutErr(c, e.ERR, "请稍等,存在其他退款处理中!") |
|
|
e.OutErr(c, e.ERR, "请稍等,存在其他退款处理中!") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
cache.Set(md.AuditLockKeyForCentralKitchenLockKey, "running") |
|
|
|
|
|
|
|
|
cache.Set(md.BatchAskForLeaveLockKeyForCentralKitchen, "running") |
|
|
utils.FilePutContents("DealCentralKitchenForSchoolBatchAskForLeave", "批量请假处理,开始时间:::"+time.Now().Format("2006-01-02 15:04:05")) |
|
|
utils.FilePutContents("DealCentralKitchenForSchoolBatchAskForLeave", "批量请假处理,开始时间:::"+time.Now().Format("2006-01-02 15:04:05")) |
|
|
|
|
|
|
|
|
Kind := c.DefaultQuery("kind", "1") |
|
|
Kind := c.DefaultQuery("kind", "1") |
|
@@ -1200,7 +1214,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqBySchool |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqBySchool |
|
|
err := c.ShouldBindJSON(&req) |
|
|
err := c.ShouldBindJSON(&req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err1 := err.(e.E) |
|
|
err1 := err.(e.E) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
@@ -1218,7 +1232,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
|
|
|
|
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveBySchool(req) |
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveBySchool(req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -1228,7 +1242,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByGrade |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByGrade |
|
|
err := c.ShouldBindJSON(&req) |
|
|
err := c.ShouldBindJSON(&req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err1 := err.(e.E) |
|
|
err1 := err.(e.E) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
@@ -1246,7 +1260,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
|
|
|
|
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveByGrade(req) |
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveByGrade(req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -1256,7 +1270,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByClass |
|
|
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByClass |
|
|
err := c.ShouldBindJSON(&req) |
|
|
err := c.ShouldBindJSON(&req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err = validate.HandleValidateErr(err) |
|
|
err1 := err.(e.E) |
|
|
err1 := err.(e.E) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
@@ -1274,14 +1288,14 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) { |
|
|
|
|
|
|
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveByClass(req) |
|
|
err = svc2.CentralKitchenForSchoolBatchAskForLeaveByClass(req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
cache.Del(md.AuditLockKeyForCentralKitchenLockKey) |
|
|
|
|
|
|
|
|
cache.Del(md.BatchAskForLeaveLockKeyForCentralKitchen) |
|
|
e.OutSuc(c, "success", nil) |
|
|
e.OutSuc(c, "success", nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|