|
|
@@ -4,6 +4,7 @@ import ( |
|
|
|
"applet/app/admin/enum" |
|
|
|
"applet/app/admin/md" |
|
|
|
"applet/app/admin/svc" |
|
|
|
"applet/app/cfg" |
|
|
|
"applet/app/db" |
|
|
|
"applet/app/db/model" |
|
|
|
"applet/app/e" |
|
|
@@ -1549,6 +1550,11 @@ func CentralKitchenForSchoolOrdRefund(req md.CentralKitchenForSchoolOrdRefundReq |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if len(m) > 0 { |
|
|
|
//2、更改 `central_kitchen_for_school_user_with_day` 的 state 为 退款中 |
|
|
|
sql := "update central_kitchen_for_school_user_with_day set state = %d where id In (%s)" |
|
|
@@ -1584,7 +1590,7 @@ func CentralKitchenForSchoolOrdRefund(req md.CentralKitchenForSchoolOrdRefundReq |
|
|
|
|
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态(ord_state) |
|
|
|
for _, v := range dealOutTradeNo { |
|
|
|
err1 := JudgePackageOrdOrdState(v) |
|
|
|
err1 := JudgePackageOrdOrdState(v, rabbitMqCh) |
|
|
|
if err1 != nil { |
|
|
|
return err1 |
|
|
|
} |
|
|
@@ -1601,6 +1607,11 @@ func CentralKitchenForSchoolOrdRefund(req md.CentralKitchenForSchoolOrdRefundReq |
|
|
|
func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSchoolBatchAskForLeaveReqBySchool) (err error) { |
|
|
|
enterpriseDb := db.EnterpriseDb{} |
|
|
|
enterpriseDb.Set() |
|
|
|
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for _, v := range req.EnterpriseIds { |
|
|
|
//1、查询学校 |
|
|
|
enterprise, err1 := enterpriseDb.GetEnterprise(v) |
|
|
@@ -1675,7 +1686,7 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -1758,7 +1769,7 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -1841,7 +1852,7 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -1877,6 +1888,10 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho |
|
|
|
if enterprise == nil { |
|
|
|
return errors.New("未查询到id:【" + utils.IntToStr(req.EnterpriseId) + "】公司对应记录") |
|
|
|
} |
|
|
|
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
classDb := db.ClassDb{} |
|
|
|
var classWithUser *[]model.ClassWithUser |
|
|
@@ -1968,7 +1983,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2051,7 +2066,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2134,7 +2149,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2170,6 +2185,10 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho |
|
|
|
if enterprise == nil { |
|
|
|
return errors.New("未查询到id:【" + utils.IntToStr(req.EnterpriseId) + "】公司对应记录") |
|
|
|
} |
|
|
|
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var classWithUser *[]model.ClassWithUser |
|
|
|
for _, v := range req.ClassIds { |
|
|
@@ -2250,7 +2269,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2333,7 +2352,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2416,7 +2435,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho |
|
|
|
//4、处理 `central_kitchen_for_school_package_ord` 的 订单状态 (ord_state) |
|
|
|
go func() { |
|
|
|
for _, vv := range dealOutTradeNo { |
|
|
|
err11 := JudgePackageOrdOrdState(vv) |
|
|
|
err11 := JudgePackageOrdOrdState(vv, rabbitMqCh) |
|
|
|
if err11 != nil { |
|
|
|
fmt.Println("batchAskForLeaveJudgePackageOrdOrdStateErr>>>>>>>>>>>>>>>>>>>>>", err11.Error()) |
|
|
|
utils.FilePutContents("batchAskForLeaveJudgePackageOrdOrdStateErr", err11.Error()) |
|
|
@@ -2440,15 +2459,18 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho |
|
|
|
} |
|
|
|
|
|
|
|
// JudgePackageOrdOrdState 判断订单状态 |
|
|
|
func JudgePackageOrdOrdState(outTradeNo string) (err error) { |
|
|
|
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err != nil { |
|
|
|
fmt.Println("err:::::11111:::::HoneyCollectContribution", err.Error()) |
|
|
|
return |
|
|
|
func JudgePackageOrdOrdState(outTradeNo string, ch *rabbit.Channel) (err error) { |
|
|
|
if cfg.Prd { |
|
|
|
if err != nil { |
|
|
|
fmt.Println("err:::::11111:::::JudgePackageOrdOrdState", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
ch.Publish(md2.OrdExchange, md2.JudgePackageOrdOrdState{ |
|
|
|
OrdNo: outTradeNo, |
|
|
|
}, md2.OrdRoutKeyForJudgePackageOrdOrdState) |
|
|
|
} else { |
|
|
|
DealJudgePackageOrdOrdState(outTradeNo) |
|
|
|
} |
|
|
|
rabbitMqCh.Publish(md2.OrdExchange, md2.JudgePackageOrdOrdState{ |
|
|
|
OrdNo: outTradeNo, |
|
|
|
}, md2.OrdRoutKeyForJudgePackageOrdOrdState) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|