作者 陈志颖

chore:增加栏目设置领域描述语言

正在显示 33 个修改的文件 包含 424 行增加49 行删除
version: v1
kind: HttpApi
metadata:
service: column_setting
path: /column-settings
endpoints:
- method: createColumn
route:
post: /
- method: updateColumn
route:
post: /{columnSettingId}
- method: getColumnSetting
route:
post: /{columnSettingId}
- method: resetColumn
route:
post: /
- method: listColumn
route:
post: /
params:
- name: offset
- name: limit
... ...
version: v1
kind: Attribute
metadata:
name: columnId
description: 列标记
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: paramCn
description: 列标记中文
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: paramFix
description: 列标记是否固定,1:固定,2:不固定
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: columnSettingId
description: 栏目设置id
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: companyId
description: 栏目设置关联用户公司id
type:
primitive: int32
... ...
version: v1
kind: Attribute
metadata:
name: createdAt
description: 栏目设置创建时间
type:
primitive: datetime
... ...
version: v1
kind: Attribute
metadata:
name: description
description: 栏目设置描述
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: key
description: 栏目设置模块名称
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: uid
description: 栏目设置关联用户uid
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: updatedAt
description: 栏目设置更新时间
type:
primitive: datetime
... ...
version: v1
kind: Attribute
metadata:
name: userName
description: 栏目设置关联用户名称
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: value
description: 栏目设置项
type:
array: column
\ No newline at end of file
... ...
package domain
// 栏目项
type Column struct {
// 列标记
ColumnId string `json:"columnId"`
// 列标记中文
ParamCn string `json:"paramCn"`
// 列标记是否固定,1:固定,2:不固定
ParamFix int `json:"paramFix"`
}
... ...
version: v1
kind: Schema
metadata:
name: column
description: 栏目项
attributes:
- ref: columnId
required: true
- ref: paramCn
required: true
- ref: paramFix
required: true
... ...
version: v1
kind: Schema
metadata:
name: column_setting
description: 栏目设置
attributes:
- ref: companyId
required: true
- ref: createdAt
required: true
- ref: description
required: true
- ref: key
required: true
- ref: settingId
required: true
- ref: uid
required: true
- ref: updatedAt
required: true
- ref: userName
required: true
- ref: value
required: true
... ...
version: v1
kind: Method
metadata:
name: createColumnSetting
type: command
description: 创建
payload:
- ref: companyId
required: true
- ref: description
required: true
- ref: createdAt
required: true
- ref: key
required: true
- ref: settingId
required: true
- ref: uid
required: true
- ref: updatedAt
required: true
- ref: userName
required: true
- ref: value
required: true
- ref: count
required: true
- ref: limit
required: true
- ref: offset
required: true
result:
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Method
metadata:
name: getColumnSetting
type: query
description: 返回
payload:
- ref: columnSettingId
required: true
result:
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Method
metadata:
name: listColumnSetting
type: query
description: 返回列表
payload:
- ref: offset
required: true
- ref: limit
required: true
result:
- ref: count
required: true
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Method
metadata:
name: removeColumnSetting
type: command
description: 移除
payload:
- ref: columnSettingId
required: true
result:
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Method
metadata:
name: resetColumn
type: command
description: 重置栏目
result:
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Method
metadata:
name: updateColumnSetting
type: command
description: 更新
payload:
- ref: companyId
required: true
- ref: description
required: true
- ref: createdAt
required: true
- ref: key
required: true
- ref: settingId
required: true
- ref: uid
required: true
- ref: updatedAt
required: true
- ref: userName
required: true
- ref: value
required: true
- ref: count
required: true
- ref: limit
required: true
- ref: offset
required: true
- ref: columnSettingId
required: true
result:
- name: column_setting
type:
schema: column_setting
... ...
version: v1
kind: Service
metadata:
name: column_setting
description: 栏目设置服务
\ No newline at end of file
... ...
package command
import "errors"
import (
"errors"
"time"
)
//创建订单
type CreateOrderCommand struct {
... ... @@ -32,6 +35,8 @@ type CreateOrderCommand struct {
Code string `json:"code"`
//合伙人类型名称-错误信息返回
PartnerCategoryName string `json:"partnerCategoryName"`
//销售日期
SaleDate time.Time `json:"saleDate"`
}
func (postData *CreateOrderCommand) Valid() error {
... ...
package command
import "time"
//UpdateOrderPurposeCommand 更新订单单
type UpdateOrderCommand struct {
Id int64 `json:"id"`
... ... @@ -21,6 +23,8 @@ type UpdateOrderCommand struct {
Goods []OrderGoodData `json:"goods"`
//公司id
CompanyId int64 `json:"companyId"`
// 合伙人类型
//合伙人类型
PartnerCategory int64 `json:"partner_category"`
//销售日期
SaleDate time.Time `json:"saleDate"`
}
... ...
... ... @@ -28,4 +28,8 @@ type ListOrderBaseQuery struct {
CreateTimeBegin string `json:"createTimeBegin"`
//创建时间截止
CreateTimeEnd string `json:"createTimeEnd"`
//销售时间开始
SaleDateStart string `json:"saleDateStart"`
//销售时间结束
SaleDateEnd string `json:"sateDateEnd"`
}
... ...
... ... @@ -62,8 +62,9 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
listOrderQuery.PartnerName, // 合伙人姓名
listOrderQuery.OrderCode, // 订单号
listOrderQuery.DeliveryCode, // 发货单号
[2]string{listOrderQuery.UpdateTimeBegin, listOrderQuery.UpdateTimeEnd},
[2]string{listOrderQuery.CreateTimeBegin, listOrderQuery.CreateTimeEnd},
[2]string{listOrderQuery.UpdateTimeBegin, listOrderQuery.UpdateTimeEnd}, // 订单创建时间
[2]string{listOrderQuery.CreateTimeBegin, listOrderQuery.CreateTimeEnd}, // 订单更新时间
[2]string{listOrderQuery.SaleDateStart, listOrderQuery.SaleDateEnd}, // 销售日期
listOrderQuery.PartnerCategory,
listOrderQuery.Limit, listOrderQuery.Offset,
)
... ... @@ -94,6 +95,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
"index": listIndex,
"createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"),
"updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
"saleDate": orders[i].SaleDate.Local().Format("2006-01-02 15:04:05"),
"buyer": orders[i].Buyer.BuyerName,
"id": fmt.Sprint(orders[i].Id),
"orderId": orders[i].OrderCode,
... ... @@ -188,7 +190,13 @@ func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery
return order, nil
}
//CreateNewOrder 创建订单
/**
* @Author SteveChan
* @Description //TODO 创建订单,增加销售日期
* @Date 11:57 2021/1/26
* @Param
* @return
**/
func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (*domain.OrderBase, error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
... ... @@ -255,7 +263,8 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
goodMap[goodname] = 1
}
newOrder := &domain.OrderBase{
OrderType: cmd.OrderType, OrderCode: cmd.OrderCode,
OrderType: cmd.OrderType,
OrderCode: cmd.OrderCode,
DeliveryCode: cmd.DeliveryCode,
Buyer: domain.Buyer{
BuyerName: cmd.BuyerName,
... ... @@ -263,6 +272,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
RegionInfo: domain.RegionInfo{
RegionName: cmd.OrderRegion,
},
SaleDate: cmd.SaleDate,
PartnerId: cmd.PartnerId,
PartnerInfo: partnerData.Partner,
SalesmanBonusPercent: cmd.SalesmanBonusPercent,
... ... @@ -277,15 +287,15 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
var cmdPartnerCategoryOk bool
for _, v := range partnerData.PartnerCategoryInfos {
if v.Id == cmd.PartnerCategory {
_, categorys, err := categoryRepository.Find(domain.PartnerCategoryFindQuery{
_, categories, err := categoryRepository.Find(domain.PartnerCategoryFindQuery{
Ids: []int64{v.Id},
})
if err != nil {
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
if len(categorys) > 0 {
newOrder.PartnerCategory = categorys[0]
if len(categories) > 0 {
newOrder.PartnerCategory = categories[0]
cmdPartnerCategoryOk = true
}
break
... ... @@ -511,6 +521,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
oldOrderData.DeliveryCode = cmd.DeliveryCode
oldOrderData.Buyer.BuyerName = cmd.BuyerName
oldOrderData.RegionInfo.RegionName = cmd.OrderRegion
oldOrderData.SaleDate = cmd.SaleDate
oldOrderData.PartnerId = cmd.PartnerId
oldOrderData.PartnerInfo = partnerData.Partner
oldOrderData.SalesmanBonusPercent = cmd.SalesmanBonusPercent
... ...
/**
@author: stevechan
@date: 2021/1/26
@note:
**/
package domain
... ...
/**
@author: stevechan
@date: 2021/1/26
@note:
**/
package domain
... ...
... ... @@ -191,7 +191,7 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p
//@param updateTime 订单更新时间范围"[开始时间,结束时间]",时间格式"2006-01-02 15:04:05+07"
//@param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"
func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerName string, orderCode string, deliveryCode string,
updateTime [2]string, createTime [2]string, partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) {
updateTime [2]string, createTime [2]string, saleDate [2]string, partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) {
tx := dao.transactionContext.GetDB()
var orders []models.OrderBase
query := tx.Model(&orders).Where("order_base.company_id=?", companyId)
... ...
... ... @@ -45,6 +45,8 @@ type OrderBase struct {
DeliveryTime time.Time
//更新时间
UpdateTime time.Time
//销售时间
SaleDate time.Time
//合伙人应收分红
PlanPartnerBonus float64 `pg:",use_zero"`
//调整后的合伙人应收分红 (初始值=-1);
... ... @@ -62,7 +64,8 @@ type OrderBase struct {
IsDisable int `pg:",use_zero"`
//分红支付状态
BonusStatus int
CompanyId int64
//公司id
CompanyId int64
//数据来源
DataFrom domain.OrderDataFrom ``
//备注
... ...
... ... @@ -29,6 +29,7 @@ func (reponsitory OrderBaseRepository) transformPgModelToDomainModel(orderModel
DeliveryCode: orderModel.DeliveryCode, Buyer: orderModel.Buyer, RegionInfo: orderModel.RegionInfo,
PartnerId: orderModel.PartnerId, SalesmanBonusPercent: orderModel.SalesmanBonusPercent,
CreateTime: orderModel.CreateTime, DeliveryTime: orderModel.DeliveryTime, UpdateTime: orderModel.UpdateTime,
SaleDate: orderModel.SaleDate,
IsDisable: orderModel.IsDisable,
OrderCompute: domain.OrderCompute{
PlanPartnerBonus: orderModel.PlanPartnerBonus, UsePartnerBonus: orderModel.UsePartnerBonus,
... ... @@ -49,10 +50,10 @@ func (reponsitory OrderBaseRepository) transformPgModelToDomainModel(orderModel
return order, nil
}
func (repository OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
func (reponsitory OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
var (
err error
tx = repository.transactionContext.PgTx
tx = reponsitory.transactionContext.PgTx
)
m := &models.OrderBase{
Id: orderInfo.Id, OrderType: orderInfo.OrderType, OrderCode: orderInfo.OrderCode,
... ... @@ -68,6 +69,9 @@ func (repository OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
CompanyId: orderInfo.CompanyId, DataFrom: orderInfo.DataFrom,
Remark: orderInfo.Remark, PartnerCategory: orderInfo.PartnerCategory,
}
if m.OrderType > 2 { // TODO 非平台自建订单,默认销售日期取订单创建日期
m.SaleDate = orderInfo.CreateTime
}
if m.Id == 0 {
_, err = tx.Model(m).
Returning("*").
... ... @@ -75,6 +79,7 @@ func (repository OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
orderInfo.Id = m.Id
orderInfo.CreateTime = m.CreateTime
orderInfo.UpdateTime = m.UpdateTime
orderInfo.SaleDate = m.CreateTime
} else {
_, err = tx.Model(m).
WherePK().
... ... @@ -85,8 +90,8 @@ func (repository OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
return err
}
func (repository OrderBaseRepository) Find(queryOption domain.OrderBaseFindQuery) ([]domain.OrderBase, int, error) {
db := repository.transactionContext.GetDB()
func (reponsitory OrderBaseRepository) Find(queryOption domain.OrderBaseFindQuery) ([]domain.OrderBase, int, error) {
db := reponsitory.transactionContext.GetDB()
orderModels := []models.OrderBase{}
query := db.Model(&orderModels)
if queryOption.PartnerId > 0 {
... ... @@ -122,7 +127,7 @@ func (repository OrderBaseRepository) Find(queryOption domain.OrderBaseFindQuery
return ordersReturn, 0, err
}
for i := range orderModels {
domainOrder, err := repository.transformPgModelToDomainModel(&orderModels[i])
domainOrder, err := reponsitory.transformPgModelToDomainModel(&orderModels[i])
if err != nil {
return ordersReturn, 0, err
}
... ... @@ -131,10 +136,10 @@ func (repository OrderBaseRepository) Find(queryOption domain.OrderBaseFindQuery
return ordersReturn, count, nil
}
func (repository OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindOneQuery) (*domain.OrderBase, error) {
func (reponsitory OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindOneQuery) (*domain.OrderBase, error) {
var (
err error
tx = repository.transactionContext.PgDd
tx = reponsitory.transactionContext.PgDd
)
m := new(models.OrderBase)
query := tx.Model(m).
... ... @@ -146,14 +151,14 @@ func (repository OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindO
if err != nil {
return nil, err
}
result, err := repository.transformPgModelToDomainModel(m)
result, err := reponsitory.transformPgModelToDomainModel(m)
return &result, err
}
func (repository OrderBaseRepository) Remove(id int64, companyId int64) error {
func (reponsitory OrderBaseRepository) Remove(id int64, companyId int64) error {
var (
err error
tx = repository.transactionContext.PgTx
tx = reponsitory.transactionContext.PgTx
)
m := &models.OrderBase{
Id: id,
... ...
... ... @@ -160,15 +160,15 @@ func (postData *postOrderPurposeDelivery) Valid() error {
**/
func (c *OrderInfoController) PageListOrderReal() {
type Parameter struct {
//SearchText string `json:"searchText"`
PartnerName string `json:"partnerName"` // 合伙人姓名
OrderCode string `json:"orderCode"` // 订单号
DeliveryCode string `json:"deliveryCode"` // 发货单号
PartnerCategory int `json:"PartnerCategory"`
PartnerName string `json:"partnerName"` // 合伙人姓名
OrderCode string `json:"orderCode"` // 订单号
DeliveryCode string `json:"deliveryCode"` // 发货单号
PartnerCategory int `json:"PartnerCategory"` // 合伙人类型id
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
UpdateTime []string `json:"updateTime"`
CreateTime []string `json:"createTime"`
UpdateTime []string `json:"updateTime"` // 订单更新时间
CreateTime []string `json:"createTime"` // 订单创建时间
SaleDate []string `json:"saleDate"` // 销售时间
}
var (
param Parameter
... ... @@ -185,6 +185,7 @@ func (c *OrderInfoController) PageListOrderReal() {
if param.PageSize == 0 {
param.PageSize = 20
}
// 订单更新时间处理
var (
updateTimeBegin string
updateTimeEnd string
... ... @@ -211,6 +212,7 @@ func (c *OrderInfoController) PageListOrderReal() {
updateTimeEnd = t.Format("2006-01-02 15:04:05-07")
}
}
// 订单创建时间处理
var (
createTimeBegin string
createTimeEnd string
... ... @@ -237,11 +239,36 @@ func (c *OrderInfoController) PageListOrderReal() {
createTimeEnd = t.Format("2006-01-02 15:04:05-07")
}
}
// 订单销售时间处理
var (
saleDateBegin string
saleDateEnd string
)
if len(param.SaleDate) > 0 {
if len(param.SaleDate[0]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.SaleDate[0], time.Local)
if err != nil {
c.ResponseError(errors.New("销售开始时间格式错误"))
return
}
saleDateBegin = t.Format("2006-01-02 15:04:05-07")
}
}
if len(param.SaleDate) > 1 {
if len(param.SaleDate[1]) > 0 {
t, err := time.ParseInLocation("2006-01-02", param.SaleDate[1], time.Local)
if err != nil {
c.ResponseError(errors.New("销售结束时间格式错误"))
return
}
//设定时间边界
t = t.Add(86399 * time.Second)
saleDateEnd = t.Format("2006-01-02 15:04:05-07")
}
}
companyId := c.GetUserCompany()
orderSrv := orderService.NewOrderInfoService(nil)
orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{
//PartnerOrCode: param.SearchText,
orderInfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{
PartnerName: param.PartnerName,
OrderCode: param.OrderCode,
DeliveryCode: param.DeliveryCode,
... ... @@ -254,12 +281,14 @@ func (c *OrderInfoController) PageListOrderReal() {
UpdateTimeEnd: updateTimeEnd,
CreateTimeBegin: createTimeBegin,
CreateTimeEnd: createTimeEnd,
SaleDateStart: saleDateBegin,
SaleDateEnd: saleDateEnd,
})
if err != nil {
c.ResponseError(err)
return
}
c.ResponsePageList(orderinfos, cnt, param.PageNumber)
c.ResponsePageList(orderInfos, cnt, param.PageNumber)
return
}
... ... @@ -332,6 +361,7 @@ func (c *OrderInfoController) GetOrderReal() {
"product": allGoods,
"create_time": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:06"),
"update_time": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:06"),
"sale_date": orderinfo.SaleDate.Local().Format("2006-01-02 15:04:06"),
"partnerCategoryId": orderinfo.PartnerCategory.Id,
"partnerCategoryName": orderinfo.PartnerCategory.Name,
}
... ... @@ -862,7 +892,16 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
}
case 4: // TODO 销售日期格式和有效性校验
{
regexpStr := `(\d{4})/(\d{2})/(\d{2})`
//cellStr := strings.TrimSpace(cell)
ok := regexp.MustCompile(regexpStr).MatchString(cell)
if !ok {
var tmpRow []string
tmpRow = append(tmpRow, "第"+r+"行第"+col+"列销售日期格式错误,请输入正确的销售日期") // 错误信息
tmpRow = append(tmpRow, r) // 行号
tmpRow = append(tmpRow, row...) // 错误行数据
myRow = tmpRow
}
}
case 7: // 合伙人类型校验(事业合伙、业务合伙、研发合伙、业务-产品应用合伙)
{
... ... @@ -1015,29 +1054,30 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
var orderCommands = make(map[string]*orderCmd.CreateOrderCommand, 0)
for i, row := range rows {
if i > 2 && len(row) == constant.EXCEL_COLUMN {
hashValue := md5.Sum([]byte(row[0] + row[1] + row[4] + row[6])) // 根据:订单号+发货单号+合伙人编号+合伙类型计算哈希值
hashValue := md5.Sum([]byte(row[0] + row[1] + row[5] + row[7])) // 根据:订单号+发货单号+合伙人编号+合伙类型计算哈希值
hashString := hex.EncodeToString(hashValue[:])
if _, ok := orderCommands[hashString]; !ok {
//订单相关,0: 订单号, 1: 发货单号, 2: 客户名称, 3: 订单区域, 4: 编号, 5: 合伙人, 6: 类型, 7: 业务抽成比例,
sbPercent, _ := strconv.ParseFloat(row[7], 64) //业务抽成比例
//订单相关,0: 订单号, 1: 发货单号, 2: 客户名称, 3: 订单区域, 4: 销售日期, 5: 编号, 6: 合伙人, 7: 类型, 8: 业务抽成比例,
sbPercent, _ := strconv.ParseFloat(row[8], 64) //业务抽成比例
//产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
amount, _ := strconv.ParseInt(row[9], 10, 64) // 数量
price, _ := strconv.ParseFloat(row[10], 64) // 单价
percent, _ := strconv.ParseFloat(row[11], 64) // 合伙人分红比例
//产品相关,9: 产品名称, 10: 数量, 11: 单价, 12: 合伙人分红比例
amount, _ := strconv.ParseInt(row[10], 10, 64) // 数量
price, _ := strconv.ParseFloat(row[11], 64) // 单价
percent, _ := strconv.ParseFloat(row[12], 64) // 合伙人分红比例
// 获取partnerId
var partnerInfo *domain.PartnerInfo
// 5: 合伙人编号
orderQueryData := orderQuery.GetPartnerIdQuery{
Code: row[4],
Code: row[5],
PartnerCategory: 0,
CompanyId: companyId,
}
// 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
switch row[6] {
// 7: 合伙人类型 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
switch row[7] {
case "事业合伙":
orderQueryData.PartnerCategory = 1
case "业务合伙":
... ... @@ -1050,6 +1090,9 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
orderQueryData.PartnerCategory = 0
}
//TODO 销售日期时间格式转换
timeValue, _ := time.Parse(row[4], "2015/02/08")
// 初始化建订单命令集
orderCommands[hashString] = &orderCmd.CreateOrderCommand{
OrderType: 0,
... ... @@ -1057,11 +1100,12 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
DeliveryCode: row[1],
BuyerName: row[2],
OrderRegion: row[3],
SaleDate: timeValue,
PartnerId: 0, // 根据合伙人类型+合伙人编号查找合伙人id
SalesmanBonusPercent: sbPercent,
Goods: []orderCmd.OrderGoodData{
{
GoodName: row[8],
GoodName: row[9],
PlanGoodNumber: int(amount),
Price: price,
PartnerBonusPercent: percent,
... ... @@ -1086,14 +1130,14 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
orderCommands[hashString].PartnerId = partnerInfo.Partner.Id
}
} else {
//产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
amount, _ := strconv.ParseInt(row[9], 10, 64) // 数量
price, _ := strconv.ParseFloat(row[10], 64) // 单价
percent, _ := strconv.ParseFloat(row[11], 64) // 合伙人分红比例
//产品相关,9: 产品名称, 10: 数量, 11: 单价, 12: 合伙人分红比例
amount, _ := strconv.ParseInt(row[10], 10, 64) // 数量
price, _ := strconv.ParseFloat(row[11], 64) // 单价
percent, _ := strconv.ParseFloat(row[12], 64) // 合伙人分红比例
// 记录同一笔订单产品
orderCommands[hashString].Goods = append(orderCommands[hashString].Goods, orderCmd.OrderGoodData{
GoodName: row[8],
GoodName: row[9],
PlanGoodNumber: int(amount),
Price: price,
PartnerBonusPercent: percent,
... ...