|
@@ -684,6 +684,10 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
permissionLen := len(permissionList)
|
|
|
+ permissionNameIdMap := make(map[string]int)
|
|
|
+ for i := range permissionList {
|
|
|
+ permissionNameIdMap[permissionList[i].PermissionName] = permissionList[i].ChartPermissionId
|
|
|
+ }
|
|
|
|
|
|
// 获取套餐服务
|
|
|
//serviceList, e := fms.GetContractServiceTemplateMapByProductId(crm.CompanyProductFicc)
|
|
@@ -708,6 +712,7 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
|
|
|
// 套餐/开票/到款列表
|
|
|
serviceMap := make(map[int][]*fms.ContractService)
|
|
|
+ serviceChartPermissionsMap := make(map[int][]int)
|
|
|
invoiceMap := make(map[int][]*fms.ContractInvoice)
|
|
|
paymentMap := make(map[int][]*fms.ContractInvoice)
|
|
|
maxInvoice := 0
|
|
@@ -729,10 +734,16 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
serviceMap[cid] = make([]*fms.ContractService, 0)
|
|
|
}
|
|
|
serviceMap[cid] = append(serviceMap[cid], serviceList[i])
|
|
|
+ // 小套餐权限
|
|
|
+ if serviceChartPermissionsMap[cid] == nil {
|
|
|
+ serviceChartPermissionsMap[cid] = make([]int, 0)
|
|
|
+ }
|
|
|
+ if serviceList[i].ChartPermissionIds != "" {
|
|
|
+ ids := utils.JoinStr2IntArr(serviceList[i].ChartPermissionIds, ",")
|
|
|
+ serviceChartPermissionsMap[cid] = append(serviceChartPermissionsMap[cid], ids...)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // TODO:获取小套餐权限
|
|
|
-
|
|
|
// 获取开票/到款详情, 并取最大的开票/到款数(用于动态扩展第二列表头)
|
|
|
ci := new(fms.ContractInvoice)
|
|
|
invoiceList, e := ci.List(csCond, csPars)
|
|
@@ -871,6 +882,11 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
c2.SetStyle(style)
|
|
|
row2Title = append(row2Title, t1, t2)
|
|
|
}
|
|
|
+ // 此处取第二行标题NameKeyMap, 后面的动态匹配
|
|
|
+ row2NameKeyMap := make(map[string]int)
|
|
|
+ for i := range row2Title {
|
|
|
+ row2NameKeyMap[row2Title[i]] = i
|
|
|
+ }
|
|
|
|
|
|
contractTMap := map[int]int{
|
|
|
fms.ContractTypeNew: 1,
|
|
@@ -880,24 +896,64 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
k := -1
|
|
|
dataRow := sheet.AddRow()
|
|
|
dataRow.SetHeight(20)
|
|
|
+ k += 3
|
|
|
dataRow.AddCell().SetString(v.CompanyName)
|
|
|
dataRow.AddCell().SetString(fmt.Sprint(contractTMap[v.ContractType]))
|
|
|
dataRow.AddCell().SetString(v.SellerName)
|
|
|
- k += 3
|
|
|
- // TODO:大套餐
|
|
|
+
|
|
|
+ // 大套餐
|
|
|
+ k += 1
|
|
|
+ col4Name := row2Title[k]
|
|
|
svList := serviceMap[v.ContractRegisterId]
|
|
|
+ col4 := ""
|
|
|
if svList != nil && len(svList) > 0 {
|
|
|
-
|
|
|
+ for isv := range svList {
|
|
|
+ if svList[isv].Title == col4Name {
|
|
|
+ col4 = "是"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // TODO: 财富管理/市场策略
|
|
|
- dataRow.AddCell().SetString("大套餐占位1")
|
|
|
- dataRow.AddCell().SetString("大套餐占位2")
|
|
|
- dataRow.AddCell().SetString("大套餐占位3")
|
|
|
+ dataRow.AddCell().SetString(col4)
|
|
|
|
|
|
- // TODO:小套餐
|
|
|
+ // 小套餐
|
|
|
+ serviceChartPermissionIds := serviceChartPermissionsMap[v.ContractRegisterId]
|
|
|
for i := 0; i < permissionLen; i++ {
|
|
|
- dataRow.AddCell().SetString("小套餐占位")
|
|
|
+ k += 1
|
|
|
+ colName := row2Title[k]
|
|
|
+ chartPermissionId := permissionNameIdMap[colName]
|
|
|
+ if utils.InArray(chartPermissionId, serviceChartPermissionIds) {
|
|
|
+ dataRow.AddCell().SetString("是")
|
|
|
+ } else {
|
|
|
+ dataRow.AddCell().SetString("")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 财富管理/市场策略(处理方式其实跟上面的大套餐一样, 只是中间隔了小套餐按照顺序要这么处理=_=!)
|
|
|
+ k += 1
|
|
|
+ col5Name := row2Title[k]
|
|
|
+ col5 := ""
|
|
|
+ if svList != nil && len(svList) > 0 {
|
|
|
+ for isv := range svList {
|
|
|
+ if svList[isv].Title == col5Name {
|
|
|
+ col5 = "是"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataRow.AddCell().SetString(col5)
|
|
|
+ k += 1
|
|
|
+ col6Name := row2Title[k]
|
|
|
+ col6 := ""
|
|
|
+ if svList != nil && len(svList) > 0 {
|
|
|
+ for isv := range svList {
|
|
|
+ if svList[isv].Title == col6Name {
|
|
|
+ col6 = "是"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ dataRow.AddCell().SetString(col6)
|
|
|
|
|
|
// 其他信息
|
|
|
dataRow.AddCell().SetString(utils.TimeTransferString("2006/01/02", v.StartDate)) // 开始时间
|