...
|
...
|
@@ -709,7 +709,7 @@ func (c *OrderInfoController) ImportOrderFromExcel() { |
|
|
// c.ResponseError(errors.New("json数据解析失败"))
|
|
|
//}
|
|
|
|
|
|
if typeCode != "PARTNER_ORDER_IMPORT" {
|
|
|
if typeCode != "PARTNER_ORDER_FILE" {
|
|
|
c.ResponseError(errors.New("类型编码错误"))
|
|
|
}
|
|
|
|
...
|
...
|
@@ -987,6 +987,9 @@ func (c *OrderInfoController) ImportOrderFromExcel() { |
|
|
// 创建订单服务
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
|
|
|
// 合伙人检索错误
|
|
|
partnerDataList := make([]interface{}, 0)
|
|
|
|
|
|
// 聚合订单产品
|
|
|
var orderCommands = make(map[string]*orderCmd.CreateOrderCommand, 0)
|
|
|
for i, row := range rows {
|
...
|
...
|
@@ -1028,27 +1031,35 @@ func (c *OrderInfoController) ImportOrderFromExcel() { |
|
|
|
|
|
// 获取partnerId
|
|
|
var partnerInfo *domain.PartnerInfo
|
|
|
partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQuery.GetPartnerIdQuery{
|
|
|
orderQueryData := orderQuery.GetPartnerIdQuery{
|
|
|
Code: row[4],
|
|
|
PartnerCategory: 0,
|
|
|
CompanyId: companyId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
|
|
|
}
|
|
|
// 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
|
|
|
switch row[6] {
|
|
|
case "事业合伙":
|
|
|
orderQueryData.PartnerCategory = 1
|
|
|
case "业务合伙":
|
|
|
orderQueryData.PartnerCategory = 2
|
|
|
case "研发合伙":
|
|
|
orderQueryData.PartnerCategory = 3
|
|
|
case "业务-产品应用合伙":
|
|
|
orderQueryData.PartnerCategory = 4
|
|
|
default:
|
|
|
orderQueryData.PartnerCategory = 0
|
|
|
}
|
|
|
partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQueryData)
|
|
|
if err != nil || partnerInfo == nil { // 检索合伙人错误
|
|
|
var tmpRow []string
|
|
|
tmpRow = append(tmpRow, err.Error()) // 错误信息
|
|
|
s := strconv.Itoa(i + 1)
|
|
|
tmpRow = append(tmpRow, s) // 行号
|
|
|
tmpRow = append(tmpRow, row...) // 错误行数据
|
|
|
partnerDataList = append(partnerDataList, tmpRow)
|
|
|
}
|
|
|
if partnerInfo != nil {
|
|
|
orderCommands[hashString].PartnerId = partnerInfo.Partner.Id
|
|
|
// 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
|
|
|
switch row[6] {
|
|
|
case "事业合伙":
|
|
|
partnerInfo.PartnerCategory = 1
|
|
|
case "业务合伙":
|
|
|
partnerInfo.PartnerCategory = 2
|
|
|
case "研发合伙":
|
|
|
partnerInfo.PartnerCategory = 3
|
|
|
case "业务-产品应用合伙":
|
|
|
partnerInfo.PartnerCategory = 4
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
|
...
|
...
|
@@ -1070,6 +1081,17 @@ func (c *OrderInfoController) ImportOrderFromExcel() { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if len(partnerDataList) > 0 {
|
|
|
ret = map[string]interface{}{
|
|
|
"successCount": 0,
|
|
|
"fail": map[string]interface{}{
|
|
|
"tableHeader": tableHeader,
|
|
|
"tableData": partnerDataList,
|
|
|
},
|
|
|
}
|
|
|
c.ResponseData(ret)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 产品数量校验
|
|
|
productNumberError := make([]interface{}, 0)
|
...
|
...
|
|