1
This commit is contained in:
@@ -9,9 +9,10 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 获取招标信息
|
||||
// GetBiddingMsg 获取招标信息
|
||||
func GetBiddingMsg(ctx *jxcontext.Context, param map[string]interface{}) (result []*model.BiddingInfo, err error) {
|
||||
sql := `select * from cg a where 1=1`
|
||||
|
||||
@@ -129,3 +130,67 @@ func UpdateTiktokOrderPhoneAddress() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateSupermarketSign 保存超市签约数据
|
||||
func CreateSupermarketSign(supermarket []*model.SupermarketSign, lastOperator string) []string {
|
||||
db := dao.GetDB()
|
||||
errors := make([]string, 0, 0)
|
||||
for i := 0; i < len(supermarket); i++ {
|
||||
dao.WrapAddIDCULDEntity(supermarket[i], lastOperator)
|
||||
if err := dao.CreateEntity(db, supermarket[i]); err != nil {
|
||||
errors = append(errors, fmt.Sprintf("%s-%s:%v", supermarket[i].StoreName, supermarket[i].StoreID, err))
|
||||
}
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
func QuerySupermarketSign(storeId, storeName, cityName, storeType, signPeople string, start, end, page, size int) (result []*model.SupermarketSign, totalCount int, err error) {
|
||||
sql := `SELECT SQL_CALC_FOUND_ROWS * FROM supermarket_sign WHERE 1 = 1 `
|
||||
param := make([]interface{}, 0, 0)
|
||||
|
||||
if start != 0 {
|
||||
startTime := time.Unix(int64(start), 0)
|
||||
sql += ` AND sign_start_time >= ?`
|
||||
param = append(param, startTime)
|
||||
}
|
||||
if end != 0 {
|
||||
endTime := time.Unix(int64(end), 0)
|
||||
sql += ` AND sign_end_time < ?`
|
||||
param = append(param, endTime)
|
||||
}
|
||||
if storeId != "" {
|
||||
sql += ` AND store_id = ?`
|
||||
param = append(param, storeId)
|
||||
}
|
||||
if storeName != "" {
|
||||
sql += ` AND store_name like ?`
|
||||
param = append(param, "%"+storeName+"%")
|
||||
}
|
||||
if cityName != "" {
|
||||
sql += ` AND code_name like ?`
|
||||
param = append(param, "%"+cityName+"%")
|
||||
}
|
||||
if storeType != "" {
|
||||
sql += ` AND store_type = ?`
|
||||
param = append(param, storeType)
|
||||
}
|
||||
if signPeople != "" {
|
||||
sql += ` AND sign_people = ?`
|
||||
param = append(param, signPeople)
|
||||
}
|
||||
|
||||
sql += " limit ? offset ? "
|
||||
param = append(param, size)
|
||||
param = append(param, (utils.MustInterface2Int64(page)-1)*utils.MustInterface2Int64(size))
|
||||
|
||||
db := dao.GetDB()
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer dao.Commit(db, txDB)
|
||||
if err = dao.GetRowsTx(txDB, &result, sql, param...); err == nil {
|
||||
totalCount = dao.GetLastTotalRowCount2(db, txDB)
|
||||
return result, totalCount, nil
|
||||
}
|
||||
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
@@ -171,6 +171,9 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
if comment2.OrderFlag == "1" {
|
||||
globals.SugarLogger.Debugf("---------------comment2-isNewComment :%s", utils.Format4Output(comment2, false))
|
||||
}
|
||||
if isNewComment {
|
||||
err = dao.CreateEntity(db, comment2)
|
||||
} else if comment2 != nil {
|
||||
@@ -178,12 +181,18 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if comment2.OrderFlag == "1" {
|
||||
globals.SugarLogger.Debugf("---------------comment2-UpdateEntity :%s", utils.Format4Output(comment2, false))
|
||||
}
|
||||
if orderComment.VendorOrderID2 != "" {
|
||||
comment2.VendorOrderId = orderComment.VendorOrderID2
|
||||
_, err = dao.UpdateEntity(db, comment2)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if comment2.OrderFlag == "1" {
|
||||
globals.SugarLogger.Debugf("---------------comment2-UpdateEntity2 :%s", utils.Format4Output(comment2, false))
|
||||
}
|
||||
comment2.VendorOrderId = orderComment.VendorOrderID2
|
||||
_, err = dao.UpdateEntity(db, comment2, "VendorOrderId")
|
||||
}
|
||||
|
||||
28
business/model/supermarket_sign.go
Normal file
28
business/model/supermarket_sign.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type SupermarketSign struct {
|
||||
ModelIDCULD
|
||||
StoreID string `orm:"column(store_id);size(32)" json:"storeID"` // 门店ID
|
||||
StoreName string `orm:"column(store_name);size(128)" json:"storeName"` // 门店名称
|
||||
CodeName string `orm:"column(code_name);size(32)" json:"codeName"` // 门店所属城市
|
||||
StoreType string `orm:"column(store_type);size(16)" json:"storeType"` // 门店类型
|
||||
SalesVolume int64 `orm:"column(sales_volume);size(16)" json:"salesVolume"` // 销量
|
||||
Points float64 `orm:"column(points);size(4)" json:"points"` // 扣点
|
||||
ContractFee float64 `orm:"column(contract_fee);size(8)" json:"contractFee"` // 签约收费
|
||||
SignStartTime time.Time `orm:"column(sign_start_time);type(datetime)" json:"signStartTime"` // 签约开始时间
|
||||
SignEndTime time.Time `orm:"column(sign_end_time);type(datetime)" json:"signEndTime"` // 签约结束时间
|
||||
SignPeople string `orm:"column(sign_people);size(36)" json:"signPeople"` // 签约人
|
||||
Status string `orm:"column(status);size(36)" json:"status"` // 签约状态
|
||||
Remake string `orm:"column(remake);size(512)" json:"remake"` // 备注
|
||||
Reward string `orm:"column(reward);size(512)" json:"reward"` // 奖励信息
|
||||
CreateCrowd string `orm:"column(create_crowd);size(16)" json:"createCrowd"` // 群状态
|
||||
}
|
||||
|
||||
func (*SupermarketSign) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "StoreName", "CodeName"},
|
||||
[]string{"SignStartTime"},
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
|
||||
}
|
||||
// 查询门店差评
|
||||
commentList, _ := getAPI(storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID).CommentQuery(storeDetail.VendorStoreID, startDateStr, endDateStr, 0, 0, mtwmapi.CommentReplyStatusNotReplied)
|
||||
globals.SugarLogger.Debugf("--------------commentList := %d", len(commentList))
|
||||
var orderCommentList []*model.OrderComment
|
||||
if len(commentList) == model.NO || commentList == nil {
|
||||
return nil, nil
|
||||
@@ -130,6 +131,7 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
|
||||
orderComment := result.(*model.OrderComment)
|
||||
orderCommentList = append(orderCommentList, orderComment)
|
||||
}
|
||||
globals.SugarLogger.Debugf("--------------orderCommentList := %d", len(orderCommentList))
|
||||
if len(orderCommentList) > 0 {
|
||||
err = partner.CurOrderManager.OnOrderComments(orderCommentList)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user