Compare commits

...

10 Commits

Author SHA1 Message Date
邹宗楠
351521c5a7 1 2025-11-18 11:22:25 +08:00
邹宗楠
48e0b2d749 1 2025-11-18 11:20:16 +08:00
邹宗楠
733940fa50 1 2025-11-18 11:01:40 +08:00
邹宗楠
2c4fbe7ba6 jdshop添加bee 2025-11-18 10:57:04 +08:00
邹宗楠
8d00041945 修改错误的包引用 2025-11-18 09:50:01 +08:00
邹宗楠
9384316741 修改提交日志 2025-11-17 10:19:46 +08:00
邹宗楠
474d3da18f 1 2025-11-10 09:52:12 +08:00
邹宗楠
487724645b 1 2025-10-31 17:09:02 +08:00
邹宗楠
00d7d38a49 1 2025-10-31 17:03:39 +08:00
邹宗楠
291d5727cf 1 2025-10-27 09:43:49 +08:00
21 changed files with 122489 additions and 43 deletions

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
jx-callback
*.tmp
swagger/
debug
.DS_Store
*.log

View File

@@ -63,17 +63,17 @@ var (
}
refreshPageActTimeList = []string{
"7:00:00",
"8:00:00",
//"8:00:00",
"9:00:00",
"10:00:00",
//"10:00:00",
"11:00:00",
"12:00:00",
//"12:00:00",
"13:00:00",
"14:00:00",
//"14:00:00",
"15:00:00",
"16:00:00",
//"16:00:00",
"17:00:00",
"18:00:00",
//"18:00:00",
"19:00:00",
"22:00:00",
}

View File

@@ -2,7 +2,6 @@ package dao
import (
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-print/dao"
"sort"
"time"
)
@@ -21,11 +20,11 @@ func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameL
endTime,
})
if len(foodNameList) != 0 {
sql += `AND s.sku_name IN (` + dao.GenQuestionMarks(len(foodNameList)) + `) GROUP BY s.vendor_order_id ORDER BY count desc LIMIT 0, 10`
sql += `AND s.sku_name IN (` + GenQuestionMarks(len(foodNameList)) + `) GROUP BY s.vendor_order_id ORDER BY count desc LIMIT 0, 10`
sqlParams = append(sqlParams, foodNameList)
}
if len(skuList) != 0 {
sql += `AND s.sku_id IN (` + dao.GenQuestionMarks(len(skuList)) + `) GROUP BY s.vendor_order_id ORDER BY count desc LIMIT 0, 10`
sql += `AND s.sku_id IN (` + GenQuestionMarks(len(skuList)) + `) GROUP BY s.vendor_order_id ORDER BY count desc LIMIT 0, 10`
sqlParams = append(sqlParams, skuList)
}

View File

@@ -3,27 +3,25 @@ package legacymodel
import "time"
type JxBadComments struct {
Id int `json:"id" orm:"column(id)"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"`
OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"` // 评价ID+订单ID
VendorOrderId string `json:"vendor_order_id" orm:"column(vendor_order_id);size(64)" description:"平台订单ID"`
Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"`
Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
Createtime string `json:"createTime" orm:"column(createtime);size(255);null;index" description:"评论的创建时间"`
Score int `json:"score4" orm:"column(score)" description:"评论的星级"`
Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(1024);null" description:"评论的内容"`
Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"`
Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"`
UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"`
UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"`
Id int `json:"id" orm:"column(id)"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"`
OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"` // 评价ID+订单ID
VendorOrderId string `json:"vendor_order_id" orm:"column(vendor_order_id);size(64)" description:"平台订单ID"`
Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"`
Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
Createtime string `json:"createTime" orm:"column(createtime);size(255);null;index" description:"评论的创建时间"`
Score int `json:"score4" orm:"column(score)" description:"评论的星级"`
Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(1024);null" description:"评论的内容"`
Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"`
Msg string `json:"msg" orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"`
UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"`
UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"`
LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"`
PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"`

View File

@@ -172,7 +172,7 @@ type IPurchasePlatformStoreSkuHandler interface {
// GetVendorAllSkuList 同平台商品复制(饿了么复制饿了么,美团复制美团),获取商品
// UploadInvoice 发票回复
UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error)
UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error)
}
type ISingleStoreStoreSkuHandler interface {

View File

@@ -1076,7 +1076,7 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
goodsOrder, err := partner.CurOrderManager.LoadOrder(param.OrderId, param.VendorID)
if err != nil {
return nil, nil, err

View File

@@ -0,0 +1,103 @@
package jd
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/im"
)
func (c *PurchaseHandler) GetOrderInvoice(vendorOrderId string, msg *jdapi.CallbackInvoiceMsg) (response *jdapi.CallbackResponse) {
var (
db = dao.GetDB()
a = getAPI(vendorOrderId)
)
localOrder, _ := partner.CurOrderManager.LoadOrder(msg.BillID, model.VendorIDJD)
if localOrder == nil {
return jdapi.Err2CallbackResponse(fmt.Errorf("订单不存在:%s", msg.BillID), "jd invoice")
}
invoiceData, _ := dao.GetInvoiceInfo(db, msg.BillID)
invoice, err := a.QueryInvoiceDetail(msg.BillID)
if err != nil {
return jdapi.Err2CallbackResponse(err, "query invoice err")
}
if invoiceData == nil {
invoiceObj := &model.InvoiceMsg{
ModelIDCUL: model.ModelIDCUL{},
OrderId: utils.Int64ToStr(invoice.OrderId),
StoreID: localOrder.JxStoreID,
VendorID: model.VendorIDJD,
Status: model.InvoiceStatusInit,
InvoiceTaskId: utils.Int64ToStr(invoice.ApplyId),
PushType: invoice.InvoiceType,
InvoiceTitle: invoice.InvoiceTitle,
TaxpayerId: invoice.ConsumerTaxId,
NeedInvoiceByCategory: invoice.IvcContentType,
CompanyAddress: invoice.ConsumerAddress,
CompanyPhone: invoice.ConsumerPhone,
AccountBank: invoice.ConsumerBankName,
AccountNumber: invoice.ConsumerBankAccount,
Email: invoice.CustomerEmail,
InvoiceAmount: utils.Float64TwoInt64(invoice.ShouldInvoiceAmount * 100),
InvoiceUrl: "",
InvoiceId: "",
}
// 发票状态 1:待开票, 3:开票中, 4:开票成功, 5:开票失败, 6:冲红中, 7:冲红成功, 8:冲红失败, 9:已驳回, 11:蓝票审核失败, 12:红票审核失败, 13:待换开, 14:换开中, 15:换开驳回, 16:退款关闭, 17:驳回关闭
switch invoice.InvoiceStatus {
case 1:
invoiceObj.Status = model.InvoiceStatusInit
case 3, 6:
invoiceObj.Status = model.InvoiceStatusBilling
case 4, 7:
invoiceObj.Status = model.InvoiceStatusBillingSuccess
case 5, 8, 9, 11, 12, 15, 16, 17:
invoiceObj.Status = model.InvoiceStatusBillingFail
case 13, 14:
invoiceObj.Status = utils.Int2Str(invoice.InvoiceStatus)
}
dao.WrapAddIDCULEntity(invoiceObj, "system")
if err = dao.CreateEntity(db, invoiceObj); err != nil {
return jdapi.Err2CallbackResponse(err, "CreateEntity invoice err")
}
} else {
// 发票状态 1:待开票, 3:开票中, 4:开票成功, 5:开票失败, 6:冲红中, 7:冲红成功, 8:冲红失败, 9:已驳回, 11:蓝票审核失败, 12:红票审核失败, 13:待换开, 14:换开中, 15:换开驳回, 16:退款关闭, 17:驳回关闭
switch invoice.InvoiceStatus {
case 1:
invoiceData.Status = model.InvoiceStatusInit
case 3, 6:
invoiceData.Status = model.InvoiceStatusBilling
case 4, 7:
invoiceData.Status = model.InvoiceStatusBillingSuccess
case 5, 8, 9, 11, 12, 15, 16, 17:
invoiceData.Status = model.InvoiceStatusBillingFail
case 13, 14:
invoiceData.Status = utils.Int2Str(invoice.InvoiceStatus)
}
invoiceData.UpdatedAt = utils.Str2Time(msg.Modified)
dao.UpdateEntity(db, invoiceData, "Status", "UpdatedAt")
//invoiceData.InvoiceTaskId = utils.Int64ToStr(invoice.ApplyId)
//invoiceData.PushType = invoice.InvoiceType
//invoiceData.InvoiceTitle = invoice.InvoiceTitle
//invoiceData.TaxpayerId = invoice.ConsumerTaxId
//invoiceData.NeedInvoiceByCategory = invoice.IvcContentType
//invoiceData.CompanyAddress = invoice.ConsumerAddress
//invoiceData.CompanyPhone = invoice.ConsumerPhone
//invoiceData.AccountBank = invoice.ConsumerBankName
//invoiceData.AccountNumber = invoice.ConsumerBankAccount
//invoiceData.Email = invoice.CustomerEmail
//invoiceData.InvoiceAmount = utils.Float64TwoInt64(invoice.ShouldInvoiceAmount * 100)
//dao.UpdateEntity(db, invoiceData)
}
content2 := fmt.Sprintf("订单:%s,用户申请发票,请老板提供发票信息!", localOrder.VendorOrderID)
im.PushMsgByCid(localOrder.VendorStoreID, localOrder.VendorID, content2)
weixinmsg.SendStoreMessage(jxcontext.AdminCtx, fmt.Sprintf("京东用户申请发票:%s", localOrder.StoreName), content2, []int{localOrder.JxStoreID}, nil, "", model.MessageTypeStore, true, true)
return jdapi.Err2CallbackResponse(nil, "")
}

View File

@@ -1,7 +1,11 @@
package jd
import (
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/globals"
)
func OnOrderMsg(msg *jdapi.CallbackOrderMsg, a *jdapi.API) (retVal *jdapi.CallbackResponse) {
@@ -31,3 +35,12 @@ func OnOrderInfoChangeMsg(msg *jdapi.CallbackOrderInfoChangeMsg) (retVal *jdapi.
}
return retVal
}
func OnInvoiceMsg(msg *jdapi.CallbackInvoiceMsg) (retVal *jdapi.CallbackResponse) {
if CurPurchaseHandler != nil {
globals.SugarLogger.Debugf("-jd-----Invoice:= %s", utils.Format4Output(msg, false))
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "jdController发票推送", utils.Format4Output(msg, false))
retVal = CurPurchaseHandler.GetOrderInvoice(AppKey2OrgCode(msg.AppKey), msg)
}
return retVal
}

View File

@@ -708,6 +708,29 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
return nil, nil, nil
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
order, _ := partner.CurOrderManager.LoadOrder(param.OrderId, model.VendorIDJD)
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(order.JxStoreID, model.VendorIDJD)
if err != nil {
return nil, nil, err
}
if storeDetail == nil {
return nil, nil, fmt.Errorf("未查询到门店[%d]", order.JxStoreID)
}
if storeDetail.LicenceCode == "" {
return nil, nil, fmt.Errorf("未查询到门店营业执照编号,请天假门店营业执照信息[%s]", storeDetail.Name)
}
blue := &jdapi.BlueTicketParam{
OrderId: order.VendorOrderID,
ReceiverTaxNo: storeDetail.LicenceCode,
ReceiverName: storeDetail.Name,
InvoiceCode: param.InvoiceId,
IvcTitle: "个人", // 4-个人,5-公司
TotalPrice: utils.Float64ToStr(float64(param.InvoiceAmount) / float64(100)),
InvoiceTime: utils.Time2DateStr(time.Now()),
PdfInfo: base64,
FullEleInvoiceNo: param.InvoiceId,
}
return nil, nil, getAPI(order.VendorOrgCode).UploadBlueTicket(blue)
}

View File

@@ -345,6 +345,6 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
return nil, nil, nil
}

View File

@@ -1058,7 +1058,7 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
})
}
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
goodsOrder, err := partner.CurOrderManager.LoadOrder(param.OrderId, param.VendorID)
if err != nil {
return nil, nil, err

View File

@@ -1000,6 +1000,6 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
return nil, nil, nil
}

View File

@@ -1118,6 +1118,6 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
return nil, nil, nil
}

View File

@@ -124,6 +124,6 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
}
// UploadInvoice 回复用户发票申请
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg) ([]string, []string, error) {
func (c *PurchaseHandler) UploadInvoice(param *model.InvoiceMsg, base64 string) ([]string, []string, error) {
return nil, nil, nil
}

View File

@@ -229,6 +229,21 @@ func (c *DjswController) OrderInfoChange() {
}
}
// ApplyOrderInvoiceStatus 发票申请
func (c *DjswController) ApplyOrderInvoiceStatus() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
callbackResponse = jd.OnInvoiceMsg(obj.(*jdapi.CallbackInvoiceMsg))
return callbackResponse
})
callbackResponse = jdapi.Err2CallbackResponse(nil, "")
c.Data["json"] = c.transferResponse("StoreCrud", callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
}
//免费开卡接不到回调
//func (c *DjswController) MemberCreateCard() {
// if c.Ctx.Input.Method() == http.MethodPost {

View File

@@ -1527,6 +1527,7 @@ func (c *OrderController) GetInvoiceRecord() {
// @Param orderId formData string true "订单ID"
// @Param invoiceUrl formData string true "发票地址[10M内pdf/png/jpeg/jpg]"
// @Param invoiceId formData string true "发票号码"
// @Param imgBase64 formData string false "京东发票pdf二进制文件流"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UploadOrderInvoice [post]
@@ -1542,7 +1543,7 @@ func (c *OrderController) UploadOrderInvoice() {
invoice.InvoiceUrl = params.InvoiceUrl
invoice.InvoiceId = params.InvoiceId
handler, _ := partner.GetPurchasePlatformFromVendorID(invoice.VendorID).(partner.IPurchasePlatformStoreSkuHandler)
success, _, err := handler.UploadInvoice(invoice)
success, _, err := handler.UploadInvoice(invoice, params.ImgBase64)
if err != nil {
return nil, "", err
}
@@ -1555,6 +1556,7 @@ func (c *OrderController) UploadOrderInvoice() {
invoice.Status = model.InvoiceStatusBillingSuccess
}
}
case model.VendorIDJD:
}
dao.UpdateEntity(db, invoice, "InvoiceUrl", "InvoiceId", "Status")

View File

@@ -154,8 +154,6 @@ func (c *MtwmController) Invoice() {
return
}
//ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "MtwmController发票推送", utils.Format4Output(msg, false))
globals.SugarLogger.Debugf("-----Invoice:data %s", utils.Format4Output(msg, false))
data := &mtwmapi.InvoiceCallback{}
utils.Map2StructByJson(utils.URLValues2Map(msg.FormData), data, false)

View File

@@ -1,5 +1,6 @@
if [ -f "controllers/param_parser.go" ]; then
rm controllers/param_parser.go
fi
bee generate docs
cp swagger/param_parser.go.txt controllers/param_parser.go

75757
swagger/param_parser.go.txt Normal file

File diff suppressed because it is too large Load Diff

27734
swagger/swagger.json Normal file

File diff suppressed because it is too large Load Diff

18804
swagger/swagger.yml Normal file

File diff suppressed because it is too large Load Diff