|
@@ -911,11 +911,19 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
// 获取套餐服务
|
|
|
- //serviceList, e := fms.GetContractServiceTemplateMapByProductId(crm.CompanyProductFicc)
|
|
|
- //if e != nil {
|
|
|
- // resp.FailData("获取套餐服务失败", "Err:"+e.Error(), c)
|
|
|
- // return
|
|
|
- //}
|
|
|
+ serviceList, e := fms.GetContractServiceTemplateMapByProductId(crm.CompanyProductFicc)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailData("获取套餐服务失败", "Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 除大小套餐外的其他套餐(下面的导出需要以此动态处理)
|
|
|
+ otherService := make([]*fms.ContractServiceTemplateItem, 0)
|
|
|
+ for i := range serviceList {
|
|
|
+ if serviceList[i].Title != "FICC大套餐" && serviceList[i].Title != "FICC小套餐" {
|
|
|
+ otherService = append(otherService, serviceList[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ otherServiceLen := len(otherService)
|
|
|
|
|
|
// 套餐/开票/到款列表
|
|
|
serviceMap := make(map[int][]*fms.ContractService)
|
|
@@ -1056,8 +1064,15 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
for i := range permissionList {
|
|
|
row2Title = append(row2Title, permissionList[i].PermissionName)
|
|
|
}
|
|
|
- row2Title = append(row2Title, "市场策略", "财富管理", "套餐备注", "开始时间", "到期时间", "2022年合同金额", "约定付款时间", "签订日",
|
|
|
- "签订月", "合同状态", "合同编号", "备注")
|
|
|
+
|
|
|
+ // 其他套餐
|
|
|
+ for i := range otherService {
|
|
|
+ row2Title = append(row2Title, otherService[i].Title)
|
|
|
+ }
|
|
|
+ row2Title = append(row2Title, "套餐备注", "开始时间", "到期时间", "2022年合同金额", "约定付款时间", "签订日", "签订月",
|
|
|
+ "合同状态", "合同编号", "备注")
|
|
|
+
|
|
|
+ // 设置表头
|
|
|
for i := range row2Title {
|
|
|
v := titleRow2.AddCell()
|
|
|
v.SetValue(row2Title[i])
|
|
@@ -1138,7 +1153,23 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 财富管理/市场策略(处理方式其实跟上面的大套餐一样, 只是中间隔了小套餐按照顺序要这么处理=_=!)
|
|
|
+ // 除大小套餐外的其他套餐(处理方式其实跟上面的大套餐一样, 只是中间隔了小套餐按照顺序要这么处理=_=!)
|
|
|
+ for i := 0; i < otherServiceLen; i++ {
|
|
|
+ k += 1
|
|
|
+ otherColName := row2Title[k]
|
|
|
+ otherCol := ""
|
|
|
+ if svList != nil && len(svList) > 0 {
|
|
|
+ for isv := range svList {
|
|
|
+ if svList[isv].Title == otherColName {
|
|
|
+ otherCol = "是"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataRow.AddCell().SetString(otherCol)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 财富管理/市场策略
|
|
|
k += 1
|
|
|
col5Name := row2Title[k]
|
|
|
col5 := ""
|
|
@@ -1632,12 +1663,12 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- // 市场策略/财富管理
|
|
|
- if k == 24 || k == 25 {
|
|
|
+ // 其他类型套餐
|
|
|
+ if k >= 24 && k <= 30 {
|
|
|
if v == "是" {
|
|
|
tempItem := serviceTempNameMap[titleMap[k]]
|
|
|
if tempItem == nil {
|
|
|
- resp.Fail(fmt.Sprintf("第%d行市场策略/财富管理套餐名称不匹配, 请按模板导入", i+1), c)
|
|
|
+ resp.Fail(fmt.Sprintf("第%d行套餐名称不匹配, 请按模板导入", i+1), c)
|
|
|
return
|
|
|
}
|
|
|
cs := &fms.ContractService{
|
|
@@ -1654,12 +1685,12 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 套餐备注
|
|
|
- if k == 26 {
|
|
|
+ if k == 31 {
|
|
|
rowRegister.ServiceRemark = v
|
|
|
continue
|
|
|
}
|
|
|
// 开始时间/到期时间
|
|
|
- if k == 27 {
|
|
|
+ if k == 32 {
|
|
|
// 转换失败可能是因为格式为Excel日期格式, 读取出来会是一串数字, 将其转换成日期字符串再处理
|
|
|
va := cell.Value
|
|
|
if va == "" {
|
|
@@ -1683,7 +1714,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowRegister.StartDate = startDate
|
|
|
continue
|
|
|
}
|
|
|
- if k == 28 {
|
|
|
+ if k == 33 {
|
|
|
va := cell.Value
|
|
|
if va == "" {
|
|
|
resp.Fail(fmt.Sprintf("第%d行到期时间不可为空, 请按模板导入", i+1), c)
|
|
@@ -1706,7 +1737,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 合同金额
|
|
|
- if k == 29 {
|
|
|
+ if k == 34 {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1717,13 +1748,13 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 约定付款日期
|
|
|
- if k == 30 {
|
|
|
+ if k == 35 {
|
|
|
rowRegister.AgreedPayTime = v
|
|
|
continue
|
|
|
}
|
|
|
// 签订日
|
|
|
// k == 32为签订月,可忽略
|
|
|
- if k == 31 {
|
|
|
+ if k == 36 {
|
|
|
va := cell.Value
|
|
|
if va == "" {
|
|
|
continue
|
|
@@ -1745,7 +1776,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 合同状态
|
|
|
- if k == 33 {
|
|
|
+ if k == 38 {
|
|
|
rowRegister.ContractStatus = fms.ContractStatusNameKeyMap[v]
|
|
|
if rowRegister.ContractStatus == 0 {
|
|
|
resp.Fail(fmt.Sprintf("第%d行合同状态不匹配, 请按模板导入", i+1), c)
|
|
@@ -1754,7 +1785,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 合同编号
|
|
|
- if k == 34 {
|
|
|
+ if k == 39 {
|
|
|
rowContractCode := v
|
|
|
if rowContractCode == "" {
|
|
|
resp.Fail(fmt.Sprintf("第%d行合同编号不可为空, 请按模板导入", i+1), c)
|
|
@@ -1769,12 +1800,12 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 备注
|
|
|
- if k == 35 {
|
|
|
+ if k == 40 {
|
|
|
rowRegister.Remark = v
|
|
|
continue
|
|
|
}
|
|
|
// 开票日/开票金额
|
|
|
- if k == 36 {
|
|
|
+ if k == 41 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1796,7 +1827,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 37 && v != "" {
|
|
|
+ if k == 42 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1807,7 +1838,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice1)
|
|
|
continue
|
|
|
}
|
|
|
- if k == 38 {
|
|
|
+ if k == 43 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1829,7 +1860,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 39 && v != "" {
|
|
|
+ if k == 44 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1840,7 +1871,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice2)
|
|
|
continue
|
|
|
}
|
|
|
- if k == 40 {
|
|
|
+ if k == 45 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1862,7 +1893,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 41 && v != "" {
|
|
|
+ if k == 46 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1874,7 +1905,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
// 收款日/收款金额
|
|
|
- if k == 42 {
|
|
|
+ if k == 47 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1896,7 +1927,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 43 && v != "" {
|
|
|
+ if k == 48 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1907,7 +1938,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice4)
|
|
|
continue
|
|
|
}
|
|
|
- if k == 44 {
|
|
|
+ if k == 49 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1929,7 +1960,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 45 && v != "" {
|
|
|
+ if k == 50 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|
|
@@ -1940,7 +1971,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
rowInvoices = append(rowInvoices, rowInvoice5)
|
|
|
continue
|
|
|
}
|
|
|
- if k == 46 {
|
|
|
+ if k == 51 {
|
|
|
if v != "" {
|
|
|
va := cell.Value
|
|
|
invoiceDate, e := time.ParseInLocation("2006/01/02", va, time.Local)
|
|
@@ -1962,7 +1993,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
}
|
|
|
continue
|
|
|
}
|
|
|
- if k == 47 && v != "" {
|
|
|
+ if k == 52 && v != "" {
|
|
|
amountStr := v
|
|
|
amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
if e != nil {
|