Browse Source

Merge branch 'fms_2.5' into debug

ziwen 2 years ago
parent
commit
bc4022ed82
1 changed files with 43 additions and 38 deletions
  1. 43 38
      controller/contract/register.go

+ 43 - 38
controller/contract/register.go

@@ -2752,13 +2752,14 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 开始时间/到期时间
-					if k == 58 {
+					if k == 56 {
 						// 转换失败可能是因为格式为Excel日期格式, 读取出来会是一串数字, 将其转换成日期字符串再处理
 						va := cell.Value
 						if va == "" {
 							resp.Fail(fmt.Sprintf("第%d行%d列开始时间不可为空, 请按模板导入", i+1, k+1), c)
 							return
 						}
+						fmt.Println("开始时间:",va)
 						startDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
 						if e != nil {
 							d := utils.ConvertToFormatDay(va, "2006/01/02")
@@ -2776,7 +2777,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						rowRegister.StartDate = startDate
 						continue
 					}
-					if k == 59 {
+					if k == 57 {
 						va := cell.Value
 						if va == "" {
 							resp.Fail(fmt.Sprintf("第%d行到期时间不可为空, 请按模板导入", i+1), c)
@@ -2799,7 +2800,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 合同金额
-					if k == 60 {
+					if k == 58 {
 						amountStr := v
 						amount, e := strconv.ParseFloat(amountStr, 64)
 						if e != nil {
@@ -2810,7 +2811,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 金额单位
-					if k == 61 {
+					if k == 59 {
 						rate := rateMap[v]
 						if rate <= 0 {
 							resp.Fail(fmt.Sprintf("第%d行金额单位有误, 请按模板导入", i+1), c)
@@ -2821,50 +2822,54 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// FICC 套餐总金额
-					if k == 62 {
+					if k == 60 {
 						amountStr := v
-						amount, e := strconv.ParseFloat(amountStr, 64)
-						if e != nil {
-							resp.Fail(fmt.Sprintf("第%d行FICC套餐总金额有误, 请按模板导入", i+1), c)
-							return
-						}
-						if amount > 0 {
-							tmp := &fms.ContractServiceAmount{
-								ProductId:     crm.CompanyProductFicc,
-								ServiceAmount: amount,
-								CurrencyUnit:  rowRegister.CurrencyUnit,
-								TimeBase:      base.TimeBase{},
+						if v != ""{
+							amount, e := strconv.ParseFloat(amountStr, 64)
+							if e != nil {
+								resp.Fail(fmt.Sprintf("第%d行FICC套餐总金额有误, 请按模板导入", i+1), c)
+								return
 							}
-							rowServiceAmount = append(rowServiceAmount, tmp)
+							if amount > 0 {
+								tmp := &fms.ContractServiceAmount{
+									ProductId:     crm.CompanyProductFicc,
+									ServiceAmount: amount,
+									CurrencyUnit:  rowRegister.CurrencyUnit,
+									TimeBase:      base.TimeBase{},
+								}
+								rowServiceAmount = append(rowServiceAmount, tmp)
+							}
+							continue
 						}
-						continue
 					}
 					// 权益套餐总金额
-					if k == 63 {
+					if k == 61 {
 						amountStr := v
-						amount, e := strconv.ParseFloat(amountStr, 64)
-						if e != nil {
-							resp.Fail(fmt.Sprintf("第%d行权益套餐总金额有误, 请按模板导入", i+1), c)
-							return
-						}
-						if amount > 0 {
-							tmp := &fms.ContractServiceAmount{
-								ProductId:     crm.CompanyProductRai,
-								ServiceAmount: amount,
-								CurrencyUnit:  rowRegister.CurrencyUnit,
-								TimeBase:      base.TimeBase{},
+						if v != ""{
+							amount, e := strconv.ParseFloat(amountStr, 64)
+							if e != nil {
+								resp.Fail(fmt.Sprintf("第%d行权益套餐总金额有误, 请按模板导入", i+1), c)
+								return
 							}
-							rowServiceAmount = append(rowServiceAmount, tmp)
+							if amount > 0 {
+								tmp := &fms.ContractServiceAmount{
+									ProductId:     crm.CompanyProductRai,
+									ServiceAmount: amount,
+									CurrencyUnit:  rowRegister.CurrencyUnit,
+									TimeBase:      base.TimeBase{},
+								}
+								rowServiceAmount = append(rowServiceAmount, tmp)
+							}
+							continue
 						}
-						continue
 					}
 					// 约定付款日期
-					if k == 64 {
+					if k == 62 {
 						rowRegister.AgreedPayTime = v
 						continue
 					}
 					// 签订日
-					if k == 65 {
+					if k == 63 {
 						va := cell.Value
 						if va == "" {
 							continue
@@ -2886,7 +2891,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 合同状态
-					if k == 66 {
+					if k == 64 {
 						rowRegister.ContractStatus = fms.ContractStatusNameKeyMap[v]
 						if rowRegister.ContractStatus == 0 {
 							resp.Fail(fmt.Sprintf("第%d行合同状态不匹配, 请按模板导入", i+1), c)
@@ -2895,7 +2900,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 合同编号
-					if k == 67 {
+					if k == 65 {
 						rowContractCode := v
 						if rowContractCode == "" {
 							resp.Fail(fmt.Sprintf("第%d行合同编号不可为空, 请按模板导入", i+1), c)
@@ -2910,12 +2915,12 @@ func (rg *RegisterController) Import(c *gin.Context) {
 						continue
 					}
 					// 合规备注
-					if k == 68 {
+					if k == 66 {
 						rowRegister.Remark = v
 						continue
 					}
 					// 开票列表
-					k2 := 68
+					k2 := 66
 					for ir := 0; ir < invoiceMax; ir++ {
 						n := ir + 1
 						// 开票日