|
@@ -578,6 +578,13 @@ func GetChartPermissionSpecialSurplusByCompany(companyId int) (userType int, tri
|
|
|
// 审批通过的时候专项调研次数更新
|
|
|
func ActivitySpecialCompanyApproval(companyId int, companyName string) (err error) {
|
|
|
userType, packageType, _, _, _ := GetUserType(companyId)
|
|
|
+ // 获取继承点数
|
|
|
+ inheritList, e := cygx.GetCygxActivitySpecialInheritPointsByCompanyId(companyId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetCygxActivitySpecialInheritPointsByCompanyId, Err: " + e.Error())
|
|
|
+ }
|
|
|
+ chartNameMap := map[string]int{utils.YI_YAO_NAME: 0, utils.XIAO_FEI_NAME: 0, utils.KE_JI_NAME: 0, utils.ZHI_ZAO_NAME: 0}
|
|
|
+
|
|
|
itemBill := new(cygx.CygxActivitySpecialTripBill)
|
|
|
itemBill.CreateTime = time.Now()
|
|
|
itemBill.CompanyId = companyId
|
|
@@ -585,11 +592,22 @@ func ActivitySpecialCompanyApproval(companyId int, companyName string) (err erro
|
|
|
itemBill.Source = 2
|
|
|
itemBill.DoType = 2
|
|
|
itemBill.Way = 3
|
|
|
- if userType == 2 {
|
|
|
+ if userType == 2{
|
|
|
packageTypeMap := map[int]int{1: 16, 2: 10}
|
|
|
totalTrip := packageTypeMap[packageType]
|
|
|
- itemBill.BillDetailed = totalTrip
|
|
|
- itemBill.Total = strconv.Itoa(totalTrip) + "次"
|
|
|
+ if len(inheritList) > 0 {
|
|
|
+ for _, v := range inheritList {
|
|
|
+ if v.ChartPermissionId == 0 {
|
|
|
+ itemBill.BillDetailed = totalTrip + v.Points
|
|
|
+ } else {
|
|
|
+ itemBill.BillDetailed = totalTrip
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ itemBill.BillDetailed = totalTrip
|
|
|
+ }
|
|
|
+
|
|
|
+ itemBill.Total = strconv.Itoa(itemBill.BillDetailed) + "次"
|
|
|
if totalTrip == 10 {
|
|
|
itemBill.Content = "45w大套餐转正"
|
|
|
} else {
|
|
@@ -605,6 +623,7 @@ func ActivitySpecialCompanyApproval(companyId int, companyName string) (err erro
|
|
|
}
|
|
|
var chartPermissionIdSlice []string
|
|
|
mapChartName := make(map[string]int)
|
|
|
+ mapInheritChartName := make(map[string]int)
|
|
|
mapPermissionNameTrip := make(map[string]int)
|
|
|
//mapPermissionName := make(map[int]string)
|
|
|
for _, v := range list {
|
|
@@ -621,9 +640,19 @@ func ActivitySpecialCompanyApproval(companyId int, companyName string) (err erro
|
|
|
for _, v := range chartList {
|
|
|
mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
|
|
|
}
|
|
|
+ for _, v := range inheritList {
|
|
|
+ mapInheritChartName[v.ChartPermissionName] = v.Points
|
|
|
+ }
|
|
|
+ for k, _ := range chartNameMap {
|
|
|
+ if _, ok := mapChartName[k]; ok {
|
|
|
+ if inherit, ok2 := mapInheritChartName[k]; ok2 {
|
|
|
+ mapChartName[k] += inherit
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
for k, v := range mapChartName {
|
|
|
if v > 0 {
|
|
|
- itemBill.BillDetailed += 5
|
|
|
+ itemBill.BillDetailed += v
|
|
|
itemBill.Total += k + strconv.Itoa(v) + "次+"
|
|
|
}
|
|
|
}
|