作者 陈志颖

fix:修改合伙人id数据检索

@@ -987,6 +987,9 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -987,6 +987,9 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
987 // 创建订单服务 987 // 创建订单服务
988 orderSrv := orderService.NewOrderInfoService(nil) 988 orderSrv := orderService.NewOrderInfoService(nil)
989 989
  990 + // 合伙人检索错误
  991 + partnerDataList := make([]interface{}, 0)
  992 +
990 // 聚合订单产品 993 // 聚合订单产品
991 var orderCommands = make(map[string]*orderCmd.CreateOrderCommand, 0) 994 var orderCommands = make(map[string]*orderCmd.CreateOrderCommand, 0)
992 for i, row := range rows { 995 for i, row := range rows {
@@ -1028,27 +1031,33 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1028,27 +1031,33 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
1028 1031
1029 // 获取partnerId 1032 // 获取partnerId
1030 var partnerInfo *domain.PartnerInfo 1033 var partnerInfo *domain.PartnerInfo
1031 - partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQuery.GetPartnerIdQuery{ 1034 + orderQueryData := orderQuery.GetPartnerIdQuery{
1032 Code: row[4], 1035 Code: row[4],
1033 PartnerCategory: 0, 1036 PartnerCategory: 0,
1034 CompanyId: companyId, 1037 CompanyId: companyId,
1035 - })  
1036 - if err != nil {  
1037 -  
1038 } 1038 }
1039 - if partnerInfo != nil {  
1040 - orderCommands[hashString].PartnerId = partnerInfo.Partner.Id  
1041 // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙 1039 // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
1042 switch row[6] { 1040 switch row[6] {
1043 case "事业合伙": 1041 case "事业合伙":
1044 - partnerInfo.PartnerCategory = 1 1042 + orderQueryData.PartnerCategory = 1
1045 case "业务合伙": 1043 case "业务合伙":
1046 - partnerInfo.PartnerCategory = 2 1044 + orderQueryData.PartnerCategory = 2
1047 case "研发合伙": 1045 case "研发合伙":
1048 - partnerInfo.PartnerCategory = 3 1046 + orderQueryData.PartnerCategory = 3
1049 case "业务-产品应用合伙": 1047 case "业务-产品应用合伙":
1050 - partnerInfo.PartnerCategory = 4 1048 + orderQueryData.PartnerCategory = 4
  1049 + }
  1050 + partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQueryData)
  1051 + if err != nil { // 检索合伙人错误
  1052 + var tmpRow []string
  1053 + tmpRow = append(tmpRow, err.Error()) // 错误信息
  1054 + s := strconv.Itoa(i + 1)
  1055 + tmpRow = append(tmpRow, s) // 行号
  1056 + tmpRow = append(tmpRow, row...) // 错误行数据
  1057 + partnerDataList = append(partnerDataList, tmpRow)
1051 } 1058 }
  1059 + if partnerInfo != nil {
  1060 + orderCommands[hashString].PartnerId = partnerInfo.Partner.Id
1052 } 1061 }
1053 } else { 1062 } else {
1054 //产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例 1063 //产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
@@ -1070,6 +1079,17 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1070,6 +1079,17 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
1070 } 1079 }
1071 } 1080 }
1072 } 1081 }
  1082 + if len(partnerDataList) > 0 {
  1083 + ret = map[string]interface{}{
  1084 + "successCount": 0,
  1085 + "fail": map[string]interface{}{
  1086 + "tableHeader": tableHeader,
  1087 + "tableData": partnerDataList,
  1088 + },
  1089 + }
  1090 + c.ResponseData(ret)
  1091 + return
  1092 + }
1073 1093
1074 // 产品数量校验 1094 // 产品数量校验
1075 productNumberError := make([]interface{}, 0) 1095 productNumberError := make([]interface{}, 0)