|
@@ -1507,38 +1507,39 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice5 := new(fms.ContractInvoice)
|
|
|
rowInvoice6 := new(fms.ContractInvoice)
|
|
|
for k, cell := range cells {
|
|
|
+ v := utils.TrimStr(cell.String())
|
|
|
// 客户名称
|
|
|
if k == 0 {
|
|
|
- rowRegister.CompanyName = utils.TrimStr(cell.String())
|
|
|
+ rowRegister.CompanyName = v
|
|
|
}
|
|
|
// 续约/新增
|
|
|
if k == 1 {
|
|
|
- if !utils.InArrayByStr(contractTypeArr, utils.TrimStr(cell.String())) {
|
|
|
+ if !utils.InArrayByStr(contractTypeArr, v) {
|
|
|
resp.Fail("合同类型有误, 请按模板导入", c)
|
|
|
return
|
|
|
}
|
|
|
- if utils.TrimStr(cell.String()) == "0" {
|
|
|
+ if v == "0" {
|
|
|
rowRegister.ContractType = fms.ContractTypeRenew
|
|
|
}
|
|
|
- if utils.TrimStr(cell.String()) == "1" {
|
|
|
+ if v == "1" {
|
|
|
rowRegister.ContractType = fms.ContractTypeNew
|
|
|
}
|
|
|
- if utils.TrimStr(cell.String()) == "2" {
|
|
|
+ if v == "2" {
|
|
|
rowRegister.ContractType = fms.ContractTypeAgentPay
|
|
|
}
|
|
|
- if utils.TrimStr(cell.String()) == "3" {
|
|
|
+ if v == "3" {
|
|
|
rowRegister.ContractType = fms.ContractTypePlus
|
|
|
rowRegister.RegisterStatus = fms.ContractRegisterStatusComplete // 补充协议标记已完成
|
|
|
}
|
|
|
}
|
|
|
// 销售
|
|
|
if k == 2 {
|
|
|
- rowRegister.SellerName = utils.TrimStr(cell.String())
|
|
|
+ rowRegister.SellerName = v
|
|
|
rowRegister.SellerId = sellerNameIdMap[rowRegister.SellerName]
|
|
|
}
|
|
|
// FICC大套餐
|
|
|
if k == 3 {
|
|
|
- if utils.TrimStr(cell.String()) == "是" {
|
|
|
+ if v == "是" {
|
|
|
tempItem := serviceTempNameMap[titleMap[k]]
|
|
|
if tempItem == nil {
|
|
|
resp.Fail("套餐名称不匹配, 请按模板导入", c)
|
|
@@ -1559,13 +1560,13 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
// FICC小套餐
|
|
|
if k >= 4 && k <= 23 {
|
|
|
// 小套餐权限
|
|
|
- if utils.TrimStr(cell.String()) == "是" {
|
|
|
+ if v == "是" {
|
|
|
rowChartPermissionIdArr = append(rowChartPermissionIdArr, strconv.Itoa(chartPermissionNameIdMap[titleMap[k]]))
|
|
|
}
|
|
|
}
|
|
|
// 市场策略/财富管理
|
|
|
if k == 24 || k == 25 {
|
|
|
- if utils.TrimStr(cell.String()) == "是" {
|
|
|
+ if v == "是" {
|
|
|
tempItem := serviceTempNameMap[titleMap[k]]
|
|
|
if tempItem == nil {
|
|
|
resp.Fail("市场策略/财富管理套餐名称不匹配, 请按模板导入", c)
|
|
@@ -1585,11 +1586,11 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 套餐备注
|
|
|
if k == 26 {
|
|
|
- rowRegister.ServiceRemark = utils.TrimStr(cell.String())
|
|
|
+ rowRegister.ServiceRemark = v
|
|
|
}
|
|
|
// 开始时间/到期时间
|
|
|
if k == 27 {
|
|
|
- startDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ startDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("开始时间格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1597,7 +1598,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowRegister.StartDate = startDate
|
|
|
}
|
|
|
if k == 28 {
|
|
|
- endDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ endDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("到期时间格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1606,7 +1607,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 合同金额
|
|
|
if k == 29 {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("合同金额有误, 请按模板导入", c)
|
|
@@ -1616,12 +1617,12 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 约定付款日期
|
|
|
if k == 30 {
|
|
|
- rowRegister.AgreedPayTime = utils.TrimStr(cell.String())
|
|
|
+ rowRegister.AgreedPayTime = v
|
|
|
}
|
|
|
// 签订日
|
|
|
// k == 32为签订月,可忽略
|
|
|
if k == 31 {
|
|
|
- signDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ signDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("开始时间格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1630,11 +1631,11 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 合同状态
|
|
|
if k == 33 {
|
|
|
- rowRegister.ContractStatus = fms.ContractStatusNameKeyMap[utils.TrimStr(cell.String())]
|
|
|
+ rowRegister.ContractStatus = fms.ContractStatusNameKeyMap[v]
|
|
|
}
|
|
|
// 合同编号
|
|
|
if k == 34 {
|
|
|
- rowContractCode := utils.TrimStr(cell.String())
|
|
|
+ rowContractCode := v
|
|
|
if rowContractCode == "" {
|
|
|
resp.Fail("合同编号不可为空, 请按模板导入", c)
|
|
|
return
|
|
@@ -1647,13 +1648,13 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 备注
|
|
|
if k == 35 {
|
|
|
- rowRegister.Remark = utils.TrimStr(cell.String())
|
|
|
+ rowRegister.Remark = v
|
|
|
}
|
|
|
// 开票日/开票金额
|
|
|
if k == 36 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- fmt.Println("36", utils.TrimStr(cell.String()))
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ fmt.Println("36", v)
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票时间1格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1663,8 +1664,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice1.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
}
|
|
|
- if k == 37 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 37 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票金额1有误, 请按模板导入", c)
|
|
@@ -1674,8 +1675,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice1)
|
|
|
}
|
|
|
if k == 38 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票时间2格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1685,8 +1686,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice2.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
}
|
|
|
- if k == 39 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 39 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票金额2有误, 请按模板导入", c)
|
|
@@ -1696,8 +1697,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice2)
|
|
|
}
|
|
|
if k == 40 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票时间3格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1707,8 +1708,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice3.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
}
|
|
|
- if k == 41 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 41 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("开票金额3有误, 请按模板导入", c)
|
|
@@ -1719,8 +1720,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
// 收款日/收款金额
|
|
|
if k == 42 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款时间1格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1730,8 +1731,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice4.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
}
|
|
|
- if k == 43 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 43 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款金额1有误, 请按模板导入", c)
|
|
@@ -1741,8 +1742,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice4)
|
|
|
}
|
|
|
if k == 44 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款时间2格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1752,8 +1753,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice5.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
}
|
|
|
- if k == 45 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 45 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款金额2有误, 请按模板导入", c)
|
|
@@ -1763,8 +1764,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice5)
|
|
|
}
|
|
|
if k == 46 {
|
|
|
- if utils.TrimStr(cell.String()) != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", utils.TrimStr(cell.String()), time.Local)
|
|
|
+ if v != "" {
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款时间3格式有误, 请按模板导入", c)
|
|
|
return
|
|
@@ -1774,8 +1775,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice6.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
}
|
|
|
- if k == 47 && utils.TrimStr(cell.String()) != "" {
|
|
|
- amountStr := utils.TrimStr(cell.String())
|
|
|
+ if k == 47 && v != "" {
|
|
|
+ amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
|
resp.Fail("收款金额3有误, 请按模板导入", c)
|