|
@@ -468,6 +468,13 @@ func (rg *RegisterController) Del(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 删除对应的开票到款登记
|
|
|
+ go func() {
|
|
|
+ if e = fms.DeleteContractInvoicesByRegisterId(item.ContractRegisterId); e != nil {
|
|
|
+ alarm_msg.SendAlarmMsg("删除合同登记后, 删除开票到款记录失败, ErrMsg: "+err.Error(), 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
// 操作日志
|
|
|
go func() {
|
|
|
opData := ""
|
|
@@ -1517,11 +1524,15 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoice4 := new(fms.ContractInvoice)
|
|
|
rowInvoice5 := new(fms.ContractInvoice)
|
|
|
rowInvoice6 := new(fms.ContractInvoice)
|
|
|
+
|
|
|
+ isSkip := false
|
|
|
for k, cell := range cells {
|
|
|
v := utils.TrimStr(cell.String())
|
|
|
+ //fmt.Printf("k: %d, v: %s\n", k, v)
|
|
|
// 客户名称
|
|
|
if k == 0 {
|
|
|
rowRegister.CompanyName = v
|
|
|
+ continue
|
|
|
}
|
|
|
// 续约/新增
|
|
|
if k == 1 {
|
|
@@ -1541,11 +1552,13 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
if v == "3" {
|
|
|
rowRegister.ContractType = fms.ContractTypePlus
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
// 销售
|
|
|
if k == 2 {
|
|
|
rowRegister.SellerName = v
|
|
|
rowRegister.SellerId = sellerNameIdMap[rowRegister.SellerName]
|
|
|
+ continue
|
|
|
}
|
|
|
// FICC大套餐
|
|
|
if k == 3 {
|
|
@@ -1566,6 +1579,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
cs.Set()
|
|
|
rowServices = append(rowServices, cs)
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
// FICC小套餐
|
|
|
if k >= 4 && k <= 23 {
|
|
@@ -1573,6 +1587,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
if v == "是" {
|
|
|
rowChartPermissionIdArr = append(rowChartPermissionIdArr, strconv.Itoa(chartPermissionNameIdMap[titleMap[k]]))
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
// 市场策略/财富管理
|
|
|
if k == 24 || k == 25 {
|
|
@@ -1593,27 +1608,42 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
cs.Set()
|
|
|
rowServices = append(rowServices, cs)
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
// 套餐备注
|
|
|
if k == 26 {
|
|
|
rowRegister.ServiceRemark = v
|
|
|
+ continue
|
|
|
}
|
|
|
// 开始时间/到期时间
|
|
|
if k == 27 {
|
|
|
- startDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ // 转换失败可能是因为格式为Excel日期格式, 读取出来会是一串数字, 将其转换成日期字符串再处理
|
|
|
+ va := cell.Value
|
|
|
+ startDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("开始时间格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ startDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("开始时间格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowRegister.StartDate = startDate
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 28 {
|
|
|
- endDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ endDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("到期时间格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ endDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("到期时间格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowRegister.EndDate = endDate
|
|
|
+ continue
|
|
|
}
|
|
|
// 合同金额
|
|
|
if k == 29 {
|
|
@@ -1624,24 +1654,33 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
rowRegister.ContractAmount = amount
|
|
|
+ continue
|
|
|
}
|
|
|
// 约定付款日期
|
|
|
if k == 30 {
|
|
|
rowRegister.AgreedPayTime = v
|
|
|
+ continue
|
|
|
}
|
|
|
// 签订日
|
|
|
// k == 32为签订月,可忽略
|
|
|
if k == 31 {
|
|
|
- signDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ signDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("开始时间格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ signDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("签订日格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowRegister.SignDate = signDate
|
|
|
+ continue
|
|
|
}
|
|
|
// 合同状态
|
|
|
if k == 33 {
|
|
|
rowRegister.ContractStatus = fms.ContractStatusNameKeyMap[v]
|
|
|
+ continue
|
|
|
}
|
|
|
// 合同编号
|
|
|
if k == 34 {
|
|
@@ -1652,27 +1691,35 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
if utils.InArrayByStr(contractCodeArr, rowContractCode) {
|
|
|
// 此合同已登记, 跳过本行的读取
|
|
|
+ isSkip = true
|
|
|
break
|
|
|
}
|
|
|
rowRegister.ContractCode = rowContractCode
|
|
|
+ continue
|
|
|
}
|
|
|
// 备注
|
|
|
if k == 35 {
|
|
|
rowRegister.Remark = v
|
|
|
+ continue
|
|
|
}
|
|
|
// 开票日/开票金额
|
|
|
if k == 36 {
|
|
|
if v != "" {
|
|
|
- fmt.Println("36", v)
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("开票时间1格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("开票时间1格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice1.InvoiceDate = invoiceDate
|
|
|
rowInvoice1.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice1.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 37 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1683,18 +1730,25 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice1.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice1)
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 38 {
|
|
|
if v != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("开票时间2格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("开票时间2格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice2.InvoiceDate = invoiceDate
|
|
|
rowInvoice2.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice2.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 39 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1705,18 +1759,25 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice2.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice2)
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 40 {
|
|
|
if v != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("开票时间3格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("开票时间3格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice3.InvoiceDate = invoiceDate
|
|
|
rowInvoice3.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice3.InvoiceType = fms.ContractInvoiceTypeMake
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 41 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1727,19 +1788,26 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice3.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice3)
|
|
|
+ continue
|
|
|
}
|
|
|
// 收款日/收款金额
|
|
|
if k == 42 {
|
|
|
if v != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("收款时间1格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("收款时间1格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice4.InvoiceDate = invoiceDate
|
|
|
rowInvoice4.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice4.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 43 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1750,18 +1818,25 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice4.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice4)
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 44 {
|
|
|
if v != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("收款时间2格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("收款时间2格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice5.InvoiceDate = invoiceDate
|
|
|
rowInvoice5.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice5.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 45 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1772,18 +1847,25 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice5.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice5)
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 46 {
|
|
|
if v != "" {
|
|
|
- invoiceDate, e := time.ParseInLocation("2006/01/02", v, time.Local)
|
|
|
+ va := cell.Value
|
|
|
+ invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
|
if e != nil {
|
|
|
- resp.Fail("收款时间3格式有误, 请按模板导入", c)
|
|
|
- return
|
|
|
+ d := utils.ConvertToFormatDay(va, "2006/01/02") //录入日期
|
|
|
+ invoiceDate, e = time.ParseInLocation("2006/01/02", d, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ resp.Fail("收款时间3格式有误, 请按模板导入", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
rowInvoice6.InvoiceDate = invoiceDate
|
|
|
rowInvoice6.ContractCode = rowRegister.ContractCode
|
|
|
rowInvoice6.InvoiceType = fms.ContractInvoiceTypePay
|
|
|
}
|
|
|
+ continue
|
|
|
}
|
|
|
if k == 47 && v != "" {
|
|
|
amountStr := v
|
|
@@ -1794,9 +1876,14 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
rowInvoice6.Amount = amount
|
|
|
rowInvoices = append(rowInvoices, rowInvoice6)
|
|
|
+ continue
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if isSkip {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
// 小套餐
|
|
|
if len(rowChartPermissionIdArr) > 0 {
|
|
|
// 说明有小套餐
|