作者 唐旭辉

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/partnermg into dev

@@ -709,7 +709,7 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -709,7 +709,7 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
709 // c.ResponseError(errors.New("json数据解析失败")) 709 // c.ResponseError(errors.New("json数据解析失败"))
710 //} 710 //}
711 711
712 - if typeCode != "PARTNER_ORDER_IMPORT" { 712 + if typeCode != "PARTNER_ORDER_FILE" {
713 c.ResponseError(errors.New("类型编码错误")) 713 c.ResponseError(errors.New("类型编码错误"))
714 } 714 }
715 715
@@ -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,35 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1028,27 +1031,35 @@ 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 + }
  1039 + // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
  1040 + switch row[6] {
  1041 + case "事业合伙":
  1042 + orderQueryData.PartnerCategory = 1
  1043 + case "业务合伙":
  1044 + orderQueryData.PartnerCategory = 2
  1045 + case "研发合伙":
  1046 + orderQueryData.PartnerCategory = 3
  1047 + case "业务-产品应用合伙":
  1048 + orderQueryData.PartnerCategory = 4
  1049 + default:
  1050 + orderQueryData.PartnerCategory = 0
  1051 + }
  1052 + partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQueryData)
  1053 + if err != nil || partnerInfo == nil { // 检索合伙人错误
  1054 + var tmpRow []string
  1055 + tmpRow = append(tmpRow, err.Error()) // 错误信息
  1056 + s := strconv.Itoa(i + 1)
  1057 + tmpRow = append(tmpRow, s) // 行号
  1058 + tmpRow = append(tmpRow, row...) // 错误行数据
  1059 + partnerDataList = append(partnerDataList, tmpRow)
1038 } 1060 }
1039 if partnerInfo != nil { 1061 if partnerInfo != nil {
1040 orderCommands[hashString].PartnerId = partnerInfo.Partner.Id 1062 orderCommands[hashString].PartnerId = partnerInfo.Partner.Id
1041 - // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙  
1042 - switch row[6] {  
1043 - case "事业合伙":  
1044 - partnerInfo.PartnerCategory = 1  
1045 - case "业务合伙":  
1046 - partnerInfo.PartnerCategory = 2  
1047 - case "研发合伙":  
1048 - partnerInfo.PartnerCategory = 3  
1049 - case "业务-产品应用合伙":  
1050 - partnerInfo.PartnerCategory = 4  
1051 - }  
1052 } 1063 }
1053 } else { 1064 } else {
1054 //产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例 1065 //产品相关,8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
@@ -1070,6 +1081,17 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1070,6 +1081,17 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
1070 } 1081 }
1071 } 1082 }
1072 } 1083 }
  1084 + if len(partnerDataList) > 0 {
  1085 + ret = map[string]interface{}{
  1086 + "successCount": 0,
  1087 + "fail": map[string]interface{}{
  1088 + "tableHeader": tableHeader,
  1089 + "tableData": partnerDataList,
  1090 + },
  1091 + }
  1092 + c.ResponseData(ret)
  1093 + return
  1094 + }
1073 1095
1074 // 产品数量校验 1096 // 产品数量校验
1075 productNumberError := make([]interface{}, 0) 1097 productNumberError := make([]interface{}, 0)