|
@@ -13,6 +13,7 @@ import (
|
|
|
"hongze/fms_api/utils"
|
|
|
"os"
|
|
|
"regexp"
|
|
|
+ "sort"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
@@ -303,12 +304,14 @@ func FixContractSummaryData() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetContractServiceNameFormat(registerIds []int) (serviceNameMap map[int]string, err error) {
|
|
|
+
|
|
|
+func GetContractServiceNameFormat(registerIds []int) (serviceNameMap map[int]string, serviceFormatMap map[int][]fms.ContractServiceTemplateFormat, err error) {
|
|
|
serviceNameMap = make(map[int]string)
|
|
|
serviceMap := make(map[int][]string, 0)
|
|
|
+ serviceFormatMap = make(map[int][]fms.ContractServiceTemplateFormat, 0)
|
|
|
serviceIndustryStr := "医药,消费,科技,智造"
|
|
|
serviceIdMap := make(map[int]*fms.ContractServiceTemplateFullName, 0)
|
|
|
- serviceIndustryMap := make(map[int]map[string][]string, 0)
|
|
|
+ serviceIndustryMap := make(map[int]map[string][]*fms.ContractServiceTemplateFullName, 0)
|
|
|
allServiceList, e := fms.GetContractServiceTemplateFullName()
|
|
|
if e != nil {
|
|
|
err = fmt.Errorf("获取所有套餐失败, Err: "+e.Error())
|
|
@@ -335,35 +338,63 @@ func GetContractServiceNameFormat(registerIds []int) (serviceNameMap map[int]str
|
|
|
if fullItem.ParentTitle != "" {
|
|
|
if strings.Contains(serviceIndustryStr, fullItem.ParentTitle) {
|
|
|
if _, ok1 := serviceIndustryMap[item.ContractRegisterId]; !ok1 {
|
|
|
- serviceIndustryMap[item.ContractRegisterId] = make(map[string][]string)
|
|
|
+ serviceIndustryMap[item.ContractRegisterId] = make(map[string][]*fms.ContractServiceTemplateFullName)
|
|
|
}
|
|
|
- serviceIndustryMap[item.ContractRegisterId][fullItem.ParentTitle] = append(serviceIndustryMap[item.ContractRegisterId][fullItem.ParentTitle], item.Title)
|
|
|
+ serviceIndustryMap[item.ContractRegisterId][fullItem.ParentTitle] = append(serviceIndustryMap[item.ContractRegisterId][fullItem.ParentTitle], fullItem)
|
|
|
} else {
|
|
|
+ formatTitle := ""
|
|
|
if fullItem.ParentTitle == "策略" {
|
|
|
- serviceMap[item.ContractRegisterId] = append(serviceMap[item.ContractRegisterId], fullItem.Title)
|
|
|
+ formatTitle = fullItem.Title
|
|
|
}else{
|
|
|
- serviceMap[item.ContractRegisterId] = append(serviceMap[item.ContractRegisterId], fullItem.ParentTitle+"("+fullItem.Title+")")
|
|
|
+ formatTitle = fullItem.ParentTitle+"("+fullItem.Title+")"
|
|
|
}
|
|
|
-
|
|
|
+ serviceMap[item.ContractRegisterId] = append(serviceMap[item.ContractRegisterId], formatTitle)
|
|
|
+ tmp := fms.ContractServiceTemplateFormat{
|
|
|
+ FormatTitle: formatTitle,
|
|
|
+ ServiceTemplateId: fullItem.ServiceTemplateId,
|
|
|
+ ServiceTemplatePid: fullItem.Pid,
|
|
|
+ }
|
|
|
+ serviceFormatMap[item.ContractRegisterId] = append(serviceFormatMap[item.ContractRegisterId], tmp)
|
|
|
}
|
|
|
}else{
|
|
|
serviceMap[item.ContractRegisterId] = append(serviceMap[item.ContractRegisterId], fullItem.Title)
|
|
|
+ tmp := fms.ContractServiceTemplateFormat{
|
|
|
+ FormatTitle: fullItem.Title,
|
|
|
+ ServiceTemplateId: fullItem.ServiceTemplateId,
|
|
|
+ ServiceTemplatePid: fullItem.Pid,
|
|
|
+ }
|
|
|
+ serviceFormatMap[item.ContractRegisterId] = append(serviceFormatMap[item.ContractRegisterId], tmp)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
for k, v := range serviceIndustryMap {
|
|
|
for sk, sv := range v {
|
|
|
+ formatTitle := ""
|
|
|
+ templateId := 0
|
|
|
+ pid := 0
|
|
|
if len(sv) >= 2 {
|
|
|
- serviceMap[k] = append(serviceMap[k], sk)
|
|
|
+ formatTitle = sk
|
|
|
+ templateId = sv[0].Pid
|
|
|
}else{
|
|
|
- serviceMap[k] = append(serviceMap[k], sk+"("+sv[0]+")")
|
|
|
+ formatTitle = sk+"("+sv[0].Title+")"
|
|
|
+ templateId = sv[0].ServiceTemplateId
|
|
|
+ pid = sv[0].Pid
|
|
|
+ }
|
|
|
+ serviceMap[k] = append(serviceMap[k], formatTitle)
|
|
|
+ tmp := fms.ContractServiceTemplateFormat{
|
|
|
+ FormatTitle: formatTitle,
|
|
|
+ ServiceTemplateId: templateId,
|
|
|
+ ServiceTemplatePid: pid,
|
|
|
}
|
|
|
+ serviceFormatMap[k] = append(serviceFormatMap[k], tmp)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for k, v := range serviceMap {
|
|
|
+ // 给套餐内容排序
|
|
|
+ for k, v := range serviceFormatMap {
|
|
|
+ sort.Sort(fms.ContractServiceTemplateFormatList(v))
|
|
|
for _, sv := range v {
|
|
|
- serviceNameMap[k] += sv+","
|
|
|
+ serviceNameMap[k] += sv.FormatTitle+","
|
|
|
}
|
|
|
serviceNameMap[k] = strings.Trim(serviceNameMap[k], ",")
|
|
|
}
|