Kaynağa Gözat

update

consumeLimit
DengBiao 11 ay önce
ebeveyn
işleme
53fbade94f
12 değiştirilmiş dosya ile 219 ekleme ve 36 silme
  1. +30
    -0
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +4
    -0
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  3. +23
    -35
      app/admin/hdl/hdl_demo.go
  4. +5
    -0
      app/admin/md/md_enterprise_manage.go
  5. +68
    -0
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  6. +44
    -0
      app/customer/hdl/hdl_demo.go
  7. +4
    -0
      app/customer/hdl/hdl_self_support_for_school_order.go
  8. +27
    -0
      app/db/db_enterprise_with_alipay_app_auth_token.go
  9. +9
    -0
      app/db/db_self_support_for_user_face_info.go
  10. +1
    -1
      app/db/model/self_support_for_school_ord.go
  11. +3
    -0
      app/enum/enum_central_kitchen_for_school_package_ord.go
  12. +1
    -0
      app/router/admin_router.go

+ 30
- 0
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go Dosyayı Görüntüle

@@ -1147,6 +1147,36 @@ func CentralKitchenForSchoolOrdRefund(c *gin.Context) {
return
}

func SelfSupportForSchoolOrdRefund(c *gin.Context) {
var req md.SelfSupportForSchoolOrdRefundReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}

err = svc2.SelfSupportForSchoolOrdRefund(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func CentralKitchenForSchoolBatchAskForLeave(c *gin.Context) {
Kind := c.DefaultQuery("kind", "1")
switch Kind {


+ 4
- 0
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go Dosyayı Görüntüle

@@ -1092,6 +1092,10 @@ func SelfSupportForSchoolOrdList(c *gin.Context) {
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForSuccess),
"value": enum.SelfSupportForSchoolOrdOrderStatusForSuccess,
},
{
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForRefund),
"value": enum.SelfSupportForSchoolOrdOrderStatusForRefund,
},
},
}, nil)
return


+ 23
- 35
app/admin/hdl/hdl_demo.go Dosyayı Görüntüle

@@ -1,12 +1,12 @@
package hdl

import (
"applet/app/customer/md"
"applet/app/customer/svc"
md2 "applet/app/customer/md"
svc2 "applet/app/customer/svc"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"fmt"
"github.com/gin-gonic/gin"
"time"
@@ -14,41 +14,29 @@ import (

// Demo 测试
func Demo(c *gin.Context) {
var m []model.CentralKitchenForSchoolPackageOrd
sess := db.Db.Desc("id").Where("state =1")
sess.Find(&m)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)

centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
for _, v := range m {
err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: v.OutTradeNo,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
})
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
centralKitchenForSchoolPackageOrd.Set(v.OutTradeNo)
v.CreateAt = result.Date
update, err := centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(&v, "create_at")
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

fmt.Println(">>>>>>>>>>>>", v.OutTradeNo, update)
//调用支付宝进行退款
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: "SMIT1D20238140046521695702623232",
RefundAmount: "2.00",
RefundReason: "测试刷脸支付退款",
OutRequestNo: utils.OrderUUID(1997),
AppAuthToken: "202309BB893c46c0d6214c16913fb2268e5bdE03",
})
if err6 != nil {
fmt.Println(err6.Error())
}
return
qrcodeWithBatchRecordsDb := db.AdminDb{}


+ 5
- 0
app/admin/md/md_enterprise_manage.go Dosyayı Görüntüle

@@ -213,6 +213,11 @@ type CentralKitchenForSchoolOrdRefundReq struct {
Ids []string `json:"ids" label:"ids" binding:"required"`
}

type SelfSupportForSchoolOrdRefundReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Ids []string `json:"ids" label:"ids" binding:"required"`
}

type CentralKitchenForSchoolOrdListResp struct {
EnterpriseId int `json:"enterprise_id" `
EnterpriseName string `json:"enterprise_name" `


+ 68
- 0
app/admin/svc/enterprise_manage/svc_self_support_for_school.go Dosyayı Görüntüle

@@ -2,6 +2,8 @@ package svc

import (
"applet/app/admin/md"
md2 "applet/app/customer/md"
svc2 "applet/app/customer/svc"
"applet/app/db"
"applet/app/db/model"
enum2 "applet/app/enum"
@@ -1036,3 +1038,69 @@ func SelfSupportForSchoolArrearsOrdListExport(req md.SelfSupportForSchoolArrears
}
return
}

func SelfSupportForSchoolOrdRefund(req md.SelfSupportForSchoolOrdRefundReq) (err error) {
//1、查询出所有 `self_support_for_school_ord` 记录
var m []model.SelfSupportForSchoolOrd
selfSupportForSchoolOrd := db.SelfSupportForSchoolOrd{}
selfSupportForSchoolOrd.Set("")
err = selfSupportForSchoolOrd.Db.
Where("order_status = ?", enum2.SelfSupportForSchoolOrdOrderStatusForSuccess).
In("id", req.Ids).Find(&m)
if err != nil {
return err
}

sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.OpenAlipayAppid, enum2.OpenAlipayAppPrivateKey, enum2.OpenAlipayPublicKey)

companyWithAlipayAppAuthTokenDb := db.CompanyWithAlipayAppAuthTokenDb{}
companyWithAlipayAppAuthTokenDb.Set()
companyDb := db.EnterpriseDb{}
companyDb.Set()
for _, v := range m {
//1、公司-支付宝应用授权 记录
enterprise, err1 := companyDb.GetEnterprise(v.EnterpriseId)
if err1 != nil {
return err1
}
if enterprise == nil {
continue
}
companyWithAlipayAppAuthToken, err1 := companyWithAlipayAppAuthTokenDb.GetCoWithAlipayAppAuthToken(enterprise.CompanyId)
if err1 != nil {
return err1
}
if companyWithAlipayAppAuthToken == nil {
continue
}

//2、支付宝进行退款
err1, _ = svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum2.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum2.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum2.OpenAlipayPublicKey],
},
OutTradeNo: v.OutOrderNo,
RefundAmount: v.TradeAmount,
RefundReason: "刷脸就餐-退款",
OutRequestNo: utils.OrderUUID(v.Uid),
AppAuthToken: companyWithAlipayAppAuthToken.AppAuthToken,
})
if err1 != nil {
return err1
}

//3、修改 self_support_for_school_ord 的 `order_status` 字段
v.OrderStatus = enum2.SelfSupportForSchoolOrdOrderStatusForRefund
selfSupportForSchoolOrd.SelfSupportForSchoolOrdUpdate(&v, "order_status")
}

return
}

+ 44
- 0
app/customer/hdl/hdl_demo.go Dosyayı Görüntüle

@@ -10,7 +10,9 @@ import (
"applet/app/e"
"applet/app/enum"
svc3 "applet/app/svc"
"applet/app/utils"
"context"
"fmt"
"github.com/chromedp/chromedp"
"github.com/chromedp/chromedp/device"
"github.com/gin-gonic/gin"
@@ -23,6 +25,48 @@ import (
)

func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(c *gin.Context) {
//查询出所有的用户身份
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
list, err2 := selfSupportForUserFaceInfoDb.FindSchoolFacePaymentStatus(18, "OPEN")
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}

userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
for _, v := range *list {
identity, err := userIdentityDb.GetUserIdentity(v.UserIdentityId)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

var req = md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq{
FaceUid: v.UserId,
ParentUid: v.ParentUserId,
ParentLogonId: v.ParentLogonId,
RosterName: identity.Name,
OutRosterCode: utils.IntToStr(identity.Id),
SchoolCode: v.SchoolCode,
SchoolName: "珠海市斗门区第二实验小学",
ScanFacePayStatus: "ON",
FaceOpenStatus: "ON",
}
err, resp := svc.CurlAlipayPlanetEcocampusApiRosterSignUpInfo(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>", utils.SerializeStr(resp))
}
e.OutSuc(c, "success", nil)
return
var req md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq
err := c.ShouldBindJSON(&req)
if err != nil {


+ 4
- 0
app/customer/hdl/hdl_self_support_for_school_order.go Dosyayı Görüntüle

@@ -45,6 +45,10 @@ func SelfSupportForSchoolOrderList(c *gin.Context) {
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForSuccess),
"value": enum.SelfSupportForSchoolOrdOrderStatusForSuccess,
},
{
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForRefund),
"value": enum.SelfSupportForSchoolOrdOrderStatusForRefund,
},
},
}, nil)
return


+ 27
- 0
app/db/db_enterprise_with_alipay_app_auth_token.go Dosyayı Görüntüle

@@ -0,0 +1,27 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"xorm.io/xorm"
)

type CompanyWithAlipayAppAuthTokenDb struct {
Db *xorm.Engine `json:"db"`
}

func (enterpriseDb *CompanyWithAlipayAppAuthTokenDb) Set() { // set方法
enterpriseDb.Db = Db
}

func (enterpriseDb *CompanyWithAlipayAppAuthTokenDb) GetCoWithAlipayAppAuthToken(companyId int) (m *model.CompanyWithAlipayAppAuthToken, err error) {
m = new(model.CompanyWithAlipayAppAuthToken)
has, err := enterpriseDb.Db.Where("company_id =?", companyId).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 9
- 0
app/db/db_self_support_for_user_face_info.go Dosyayı Görüntüle

@@ -97,6 +97,15 @@ func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) CountSchoolFac
return
}

func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) FindSchoolFacePaymentStatus(enterpriseId int, status string) (*[]model.SelfSupportForUserFaceInfo, error) {
var m []model.SelfSupportForUserFaceInfo
err := selfSupportForUserFaceInfoDb.Db.Where("enterprise_id =? AND school_face_pass_status =? and school_face_payment_status =?", enterpriseId, status, status).Find(&m)
if err != nil {
return nil, err
}
return &m, nil
}

func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) CountCollectFaceType(enterpriseId, collectFaceType int) (total int64, err error) {
var m model.SelfSupportForUserFaceInfo
total, err = selfSupportForUserFaceInfoDb.Db.Where("enterprise_id =? AND collect_face_type =?", enterpriseId, collectFaceType).Count(&m)


+ 1
- 1
app/db/model/self_support_for_school_ord.go Dosyayı Görüntüle

@@ -20,7 +20,7 @@ type SelfSupportForSchoolOrd struct {
CpMerchantId string `json:"cp_merchant_id" xorm:"not null default '' comment('商户编码') CHAR(100)"`
TradeAmount string `json:"trade_amount" xorm:"not null default 0.00 comment('交易总金额') DECIMAL(8,2)"`
FaceTime string `json:"face_time" xorm:"not null default '' comment('刷脸时间') CHAR(100)"`
OrderStatus int `json:"order_status" xorm:"not null default 0 comment('支付状态 (1:待支付 2:支付成功)') TINYINT(1)"`
OrderStatus int `json:"order_status" xorm:"not null default 0 comment('支付状态 (1:待支付 2:支付成功 3:已退款)') TINYINT(1)"`
DebtBusinessCode string `json:"debt_business_code" xorm:"not null default '' comment('欠费订单异常渠道异常码(欠费返回)') CHAR(100)"`
DebtBusinessMsg string `json:"debt_business_msg" xorm:"not null default '' comment('欠费订单欠费原因(欠费返回)') VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null pk default 'CURRENT_TIMESTAMP' DATETIME"`


+ 3
- 0
app/enum/enum_central_kitchen_for_school_package_ord.go Dosyayı Görüntüle

@@ -5,6 +5,7 @@ type SelfSupportForSchoolOrdOrderStatus int32
const (
SelfSupportForSchoolOrdOrderStatusForWait = 1
SelfSupportForSchoolOrdOrderStatusForSuccess = 2
SelfSupportForSchoolOrdOrderStatusForRefund = 3
)

func (gt SelfSupportForSchoolOrdOrderStatus) String() string {
@@ -13,6 +14,8 @@ func (gt SelfSupportForSchoolOrdOrderStatus) String() string {
return "待支付"
case SelfSupportForSchoolOrdOrderStatusForSuccess:
return "支付成功"
case SelfSupportForSchoolOrdOrderStatusForRefund:
return "已退款"
default:
return "未知"
}


+ 1
- 0
app/router/admin_router.go Dosyayı Görüntüle

@@ -95,6 +95,7 @@ func rFinanceManage(r *gin.RouterGroup) {
r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //财务管理-(央厨-学校)订单详情
r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //财务管理-(央厨-学校)订单退款
r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //财务管理-(自营-学校)订单列表
r.POST("/selfSupportForSchool/ordRefund", hdl.SelfSupportForSchoolOrdRefund) //财务管理-(自营-学校)订单退款
r.POST("/selfSupportForSchool/arrearsOrdList", hdl.SelfSupportForSchoolArrearsOrdList) //财务管理-(自营-学校)欠费列表
r.POST("/selfSupportForSchool/arrearsOrdDebtRepay", hdl.SelfSupportForSchoolArrearsOrdDebtRepay) //"自营-学校"订单欠费催缴
r.POST("/selfSupportForSchool/arrearsOrdDebtCancel", hdl.SelfSupportForSchoolArrearsOrdDebtCancel) //"自营-学校"撤销欠款


Yükleniyor…
İptal
Kaydet