DengBiao пре 9 месеци
родитељ
комит
a82f7b57ae
3 измењених фајлова са 96 додато и 55 уклоњено
  1. +17
    -0
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +11
    -10
      app/admin/md/md_app_redis_key.go
  3. +68
    -45
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go

+ 17
- 0
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go Прегледај датотеку

@@ -10,6 +10,7 @@ import (
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"applet/app/utils/cache"
"fmt"
"github.com/gin-gonic/gin"
"time"
@@ -1183,6 +1184,15 @@ func SelfSupportForSchoolOrdRefund(c *gin.Context) {
}

func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {
//TODO:: 加锁 Redis 锁,防并发
getString, _ := cache.GetString(md.BatchAskForLeaveLockKeyForCentralKitchen)
if getString != "" {
e.OutErr(c, e.ERR, "请稍等,存在其他退款处理中!")
return
}
cache.Set(md.AuditLockKeyForCentralKitchenLockKey, "running")
utils.FilePutContents("DealCentralKitchenForSchoolBatchAskForLeave", "批量请假处理,开始时间:::"+time.Now().Format("2006-01-02 15:04:05"))

Kind := c.DefaultQuery("kind", "1")
switch Kind {
case "1":
@@ -1190,6 +1200,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {
var req md.CentralKitchenForSchoolBatchAskForLeaveReqBySchool
err := c.ShouldBindJSON(&req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
@@ -1207,6 +1218,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {

err = svc2.CentralKitchenForSchoolBatchAskForLeaveBySchool(req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
e.OutErr(c, e.ERR, err.Error())
return
}
@@ -1216,6 +1228,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByGrade
err := c.ShouldBindJSON(&req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
@@ -1233,6 +1246,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {

err = svc2.CentralKitchenForSchoolBatchAskForLeaveByGrade(req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
e.OutErr(c, e.ERR, err.Error())
return
}
@@ -1242,6 +1256,7 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {
var req md.CentralKitchenForSchoolBatchAskForLeaveReqByClass
err := c.ShouldBindJSON(&req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
@@ -1259,12 +1274,14 @@ func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {

err = svc2.CentralKitchenForSchoolBatchAskForLeaveByClass(req)
if err != nil {
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
e.OutErr(c, e.ERR, err.Error())
return
}
break
}

cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
e.OutSuc(c, "success", nil)
return
}


+ 11
- 10
app/admin/md/md_app_redis_key.go Прегледај датотеку

@@ -2,14 +2,15 @@ package md

// 缓存key统一管理
const (
AdminJwtTokenKey = "%s:smart_canteen_admin_jwt_token:%s" // jwt, 占位符:ip, admin:id
JwtTokenCacheTime = 3600 * 24
AdminRolePermissionKey = "%s:smart_canteen_admin_role_permission:%s" // 占位符:ip, admin:id
AdminRolePermissionCacheTime = 3600 * 24 * 0.5
AdminHomePageDataKey = "%s:smart_canteen_admin_home_data:%s" // 占位符:ip, admin:id
AdminHomePageDataCacheTime = 60 * 10
CfgCacheTime = 86400
AppCfgCacheKey = "smart_canteen:%s" // 占位符: key的第一个字母
WxOfficialAccountCacheKey = "wx_official_account" // 占位符: key的第一个字母
AuditLockKeyForCentralKitchenLockKey = "audit_lock_key_for_central_kitchen_lock_key"
AdminJwtTokenKey = "%s:smart_canteen_admin_jwt_token:%s" // jwt, 占位符:ip, admin:id
JwtTokenCacheTime = 3600 * 24
AdminRolePermissionKey = "%s:smart_canteen_admin_role_permission:%s" // 占位符:ip, admin:id
AdminRolePermissionCacheTime = 3600 * 24 * 0.5
AdminHomePageDataKey = "%s:smart_canteen_admin_home_data:%s" // 占位符:ip, admin:id
AdminHomePageDataCacheTime = 60 * 10
CfgCacheTime = 86400
AppCfgCacheKey = "smart_canteen:%s" // 占位符: key的第一个字母
WxOfficialAccountCacheKey = "wx_official_account" // 占位符: key的第一个字母
AuditLockKeyForCentralKitchenLockKey = "audit_lock_key_for_central_kitchen_lock_key"
BatchAskForLeaveLockKeyForCentralKitchen = "batch_ask_for_leave_lock_key_for_central_kitchen"
)

+ 68
- 45
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Прегледај датотеку

@@ -6,7 +6,6 @@ import (
"applet/app/db/model"
enum2 "applet/app/enum"
"applet/app/utils"
"applet/app/utils/logx"
"errors"
"fmt"
"strings"
@@ -1261,12 +1260,15 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1340,10 +1342,10 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
go func() {
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
logx.Error(err2)
println("<<<<JudgePackageOrdOrdState>>>>>Error:::", err2.Error())
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}()
@@ -1418,12 +1420,15 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err1 := JudgePackageOrdOrdState(vv)
if err1 != nil {
return err1
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1539,12 +1544,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1616,12 +1624,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1693,12 +1704,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1803,12 +1817,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1880,12 +1897,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}
@@ -1957,12 +1977,15 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho
}

//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state)
for _, vv := range dealOutTradeNo {
err2 := JudgePackageOrdOrdState(vv)
if err2 != nil {
return err2
go func() {
for _, vv := range dealOutTradeNo {
err11 := JudgePackageOrdOrdState(vv)
if err11 != nil {
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error())
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error())
}
}
}
}()

//5、新增 `central_kitchen_for_school_user_refund_day` 数据
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{}


Loading…
Откажи
Сачувај