Browse Source

Merge branch 'cygx_10.9.1' into debug

ziwen 1 year ago
parent
commit
9e6ea6b7fc

+ 56 - 0
models/company_permission.go

@@ -0,0 +1,56 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CompanyReportPermission struct {
+	CompanyReportPermissionId int64 `orm:"column(company_report_permission_id);pk"`
+	CompanyId                 int
+	ReportPermissionId        int
+	CreatedTime               time.Time
+	LastUpdatedTime           time.Time
+	ChartPermissionId         int
+	StartDate                 string    `description:"权限开始日期"`
+	EndDate                   string    `description:"权限结束日期"`
+	ProductId                 int       `description:"产品id"`
+	ProductName               string    `description:"产品名称"`
+	CompanyContractId         int       `description:"合同id"`
+	Status                    string    `description:"'正式','试用','关闭'"`
+	ModifyTime                time.Time `description:"修改时间"`
+	IsUpgrade                 int       `description:"是否升级,1是,0否"`
+	ExpensiveYx               int       `description:"权益研选: 0-3w; 1-5w"`
+}
+
+
+func GetCompanyPermission(companyId int) (permission string, err error) {
+	sql := ` SELECT GROUP_CONCAT(DISTINCT b.remark  ORDER BY b.sort ASC SEPARATOR ',') AS permission
+			FROM company_report_permission AS a
+			INNER JOIN chart_permission AS b ON a.chart_permission_id=b.chart_permission_id
+			INNER JOIN company_product AS c ON a.company_id=c.company_id AND a.product_id=c.product_id
+			WHERE  a.company_id=?
+			AND c.is_suspend=0
+            AND b.cygx_auth=1 
+			AND c.status IN('正式','试用','永续')
+			AND a.status IN('正式','试用','永续') `
+	o := orm.NewOrm()
+	err = o.Raw(sql, companyId).QueryRow(&permission)
+	return
+}
+
+// GetCompanyReportPermissionByCompanyIdAndProductId 获取权限类型
+func GetCompanyReportPermissionByCompanyIdAndProductId(companyId, productId int) (items []*CompanyReportPermission, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	re.*
+FROM
+	company_report_permission  as re 
+	INNER JOIN chart_permission as  c ON c.chart_permission_id = re.chart_permission_id
+WHERE
+	re.company_id = ? 
+	AND re.product_id = ? 
+	AND STATUS = '正式' `
+	_, err = o.Raw(sql, companyId, productId).QueryRows(&items)
+	return
+}

+ 58 - 0
models/cygx/activity_signup.go

@@ -0,0 +1,58 @@
+package cygx
+
+import "github.com/beego/beego/v2/client/orm"
+
+func GetCountCompanyDetailByIdGroup(companyId int) (count int, err error) {
+	sql := ` SELECT COUNT(1) AS count
+            FROM company AS a
+			INNER JOIN company_product AS b ON a.company_id=b.company_id
+			INNER JOIN company_report_permission AS p ON p.company_id = a.company_id
+			INNER JOIN chart_permission AS cp ON cp.chart_permission_id = p.chart_permission_id
+			LEFT JOIN admin AS c ON b.seller_id=c.admin_id
+			WHERE a.company_id=? AND b.product_id = 2    OR (a.company_id = ? AND  cp.permission_name = '策略' )   `
+	o := orm.NewOrm()
+	err = o.Raw(sql, companyId, companyId).QueryRow(&count)
+	return
+}
+
+type CompanyDetail struct {
+	CompanyId   int    `orm:"column(company_id);pk"`
+	CompanyName string `description:"客户名称"`
+	Status      string `description:"客户状态"`
+	SellerId    int    `description:"销售id"`
+	SellerName  string `description:"销售名称"`
+	Mobile      string `description:"销售手机号"`
+	ProductId   int    `description:"1,FICC,2权益"`
+}
+
+
+func GetCompanyDetailByIdGroup(companyId int) (item *CompanyDetail, err error) {
+	sql := ` SELECT a.company_id,a.company_name,b.status,b.seller_id,b.seller_name,c.mobile
+            FROM company AS a
+			INNER JOIN company_product AS b ON a.company_id=b.company_id
+			INNER JOIN company_report_permission AS p ON p.company_id = a.company_id
+			INNER JOIN chart_permission AS cp ON cp.chart_permission_id = p.chart_permission_id
+			LEFT JOIN admin AS c ON b.seller_id=c.admin_id
+			WHERE a.company_id=? AND b.product_id = 2
+			OR (a.company_id = ? AND  cp.permission_name = '策略' )
+			ORDER BY b.product_id DESC  LIMIT 0,1 `
+	o := orm.NewOrm()
+	err = o.Raw(sql, companyId, companyId).QueryRow(&item)
+	return
+}
+
+// 获取正式权限
+func GetCompanyPermissionByUserZhengShi(companyId int) (permission string, err error) {
+	sql := ` SELECT GROUP_CONCAT(DISTINCT b.remark  ORDER BY b.sort ASC  SEPARATOR ',') AS permission
+			FROM company_report_permission AS a
+			INNER JOIN chart_permission AS b ON a.chart_permission_id=b.chart_permission_id
+			INNER JOIN company_product AS c ON a.company_id=c.company_id AND a.product_id=c.product_id
+			WHERE  a.company_id=?
+			AND c.is_suspend=0
+            AND b.cygx_auth=1
+			AND c.status IN('正式')
+			AND a.status IN('正式') `
+	o := orm.NewOrm()
+	err = o.Raw(sql, companyId).QueryRow(&permission)
+	return
+}

+ 199 - 0
models/cygx/activity_special_trip_bill.go

@@ -0,0 +1,199 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivitySpecialTripBill struct {
+	Id                int       `orm:"column(id);pk"`
+	UserId            int       `description:"用户id,多个用,隔开"`
+	ActivityId        int       `description:"活动ID"`
+	CreateTime        time.Time `description:"创建时间"`
+	Mobile            string    `description:"手机号"`
+	Email             string    `description:"邮箱号"`
+	CompanyId         int       `description:"公司ID"`
+	CompanyName       string    `description:"公司名称"`
+	RealName          string    `description:"用户实际名称"`
+	AdminId           int       `description:"销售/管理员ID"`
+	Source            int       `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
+	BillDetailed      int       `description:"流水明细,判断是进账还是出账"`
+	DoType            int       `description:"操作方式,1报名,2取消报名"`
+	RegisterPlatform  int       `description:"来源 1小程序,2:网页"`
+	ChartPermissionId int       `description:"行业id"`
+	Way               int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Content           string    `description:"内容"`
+	Total             string    `description:"总和"`
+}
+
+type CygxActivitySpecialTripBillList struct {
+	Id                  int       `orm:"column(id);pk"`
+	UserId              int       `description:"用户id,多个用,隔开"`
+	ActivityId          int       `description:"活动ID"`
+	CreateTime          time.Time `description:"创建时间"`
+	Mobile              string    `description:"手机号"`
+	Email               string    `description:"邮箱号"`
+	CompanyId           int       `description:"公司ID"`
+	CompanyName         string    `description:"公司名称"`
+	RealName            string    `description:"用户实际名称"`
+	AdminId             int       `description:"销售/管理员ID"`
+	Source              int       `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
+	BillDetailed        int       `description:"流水明细,判断是进账还是出账"`
+	DoType              int       `description:"操作方式,1报名,2取消报名"`
+	RegisterPlatform    int       `description:"来源 1小程序,2:网页"`
+	ChartPermissionId   int       `description:"行业id"`
+	ChartPermissionName string    `description:"行业名称"`
+	Way                 int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Content             string    `description:"内容"`
+}
+
+// 添加
+func AddCygxActivitySpecialTripBill(item *CygxActivitySpecialTripBill) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	if err != nil {
+		return
+	}
+	return
+}
+
+func GetCygxActivitySpecialTripBill(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBill, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *
+			FROM
+			cygx_activity_special_trip_bill  
+			WHERE 1 = 1 ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+func GetCygxActivitySpecialTripBillList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			b.*,
+			c.chart_permission_name 
+		FROM
+			cygx_activity_special_trip_bill AS b
+			LEFT JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+		WHERE
+			1 = 1` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+type AirborneCount struct {
+	Count             int
+	ChartPermissionId int ` description:"品种权限ID"`
+}
+
+// 获取空降的公司报名的记录
+func GetActivitySpecialTripAirborneListByActivitySpecial(condition string, pars []interface{}) (items []*AirborneCount, err error) {
+	sqlCount := ` SELECT chart_permission_id,COUNT(1) AS count
+		FROM
+			cygx_activity_special_meeting_detail AS t
+			INNER JOIN cygx_activity_special AS a ON a.activity_id = t.activity_id 
+		WHERE
+			 1= 1  	AND YEAR ( t.create_time )= YEAR (NOW()) ` + condition + `GROUP BY chart_permission_id`
+	o := orm.NewOrm()
+	_, err = o.Raw(sqlCount, pars).QueryRows(&items)
+	return
+}
+
+// 获取空降的公司报名的记录
+func GetActivitySpecialTripAirborneCountByActivitySpecial(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count
+		FROM
+			cygx_activity_special_meeting_detail AS t
+			INNER JOIN cygx_activity_special AS a ON a.activity_id = t.activity_id 
+		WHERE
+			 1= 1  	AND YEAR ( t.create_time )= YEAR (NOW()) ` + condition
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+type CygxActivitySpecialTripBillDetailList struct {
+	Id                  int       `orm:"column(id);pk"`
+	UserId              int       `description:"用户id,多个用,隔开"`
+	ActivityId          int       `description:"活动ID"`
+	ResearchTheme       string    `description:"调研主题"`
+	CreateTime          time.Time `description:"创建时间"`
+	Mobile              string    `description:"手机号"`
+	Email               string    `description:"邮箱号"`
+	CompanyId           int       `description:"公司ID"`
+	CompanyName         string    `description:"公司名称"`
+	RealName            string    `description:"用户实际名称"`
+	AdminId             int       `description:"销售/管理员ID"`
+	Source              int       `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
+	BillDetailed        int       `description:"流水明细,判断是进账还是出账"`
+	DoType              int       `description:"操作方式,1报名,2取消报名"`
+	RegisterPlatform    int       `description:"来源 1小程序,2:网页"`
+	ChartPermissionId   int       `description:"行业id"`
+	ChartPermissionName string    `description:"行业名称"`
+	Content             string    `description:"内容"`
+	Way                 int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Total               string    `description:"总和"`
+}
+
+func GetCygxActivitySpecialTripBillDetailList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			b.*,
+			a.research_theme,
+			c.chart_permission_name 
+		FROM
+			cygx_activity_special_trip_bill AS b
+			INNER JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+			INNER JOIN cygx_activity_special AS a ON a.activity_id = b.activity_id
+		WHERE
+			1 = 1` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+type CygxActivitySpecialPointsBillRespItem struct {
+	Id                  int    `gorm:"column:id;primary_key;AUTO_INCREMENT"`
+	Content             string `gorm:"column:content" `                                 // 内容说明
+	Total               string `gorm:"column:points;default:0;NOT NULL" `               // 合计
+	CreateTime          string `gorm:"column:create_time" `                             // 创建时间
+	CompanyId           int    `gorm:"column:company_id;default:0" `                    // 公司ID
+	CompanyName         string `gorm:"column:company_name" `                            // 公司名称
+	RealName            string `gorm:"column:real_name"`                                // 用户实际名称
+	BillDetailed        int    `gorm:"column:bill_detailed;default:0;NOT NULL" json:""` // 流水明细,判断是进账还是出账
+	ActivityName        string `description:"活动标题"`
+	ChartPermissionId   int    `description:"行业id"`
+	ChartPermissionName string `description:"行业名称"`
+}
+
+type CygxActivitySpecialPointsBillResp struct {
+	List []*CygxActivitySpecialPointsBillRespItem
+}
+
+func GetCygxActivitySpecialTripBillDetailListAll(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			b.*,
+			a.research_theme,
+			c.chart_permission_name 
+		FROM
+			cygx_activity_special_trip_bill AS b
+			LEFT JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+			LEFT JOIN cygx_activity_special AS a ON a.activity_id = b.activity_id
+		WHERE
+			1 = 1` + condition
+
+	sql += ` ORDER BY b.create_time DESC`
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+func GetCygxActivitySpecialTripBillByCompanyId(companyId int) (item *CygxActivitySpecialTripBill, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			*
+		FROM
+			cygx_activity_special_trip_bill WHERE company_id = ? ORDER BY create_time DESC LIMIT 1
+		`
+	err = o.Raw(sql, companyId).QueryRow(&item)
+	return
+}

+ 39 - 0
models/cygx/cygx_activity_special_points_company.go

@@ -0,0 +1,39 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivitySpecialInheritPointsCompany struct {
+	Id                  int       `orm:"column(id);pk"`
+	CompanyId           int       // 公司ID
+	CompanyName         string    // 公司名称
+	Points              int   // 公司剩余点数
+	CreateTime          time.Time // 创建时间
+	ModifyTime          time.Time // 更新时间
+	ChartPermissionId   int       // 品种ID
+	ChartPermissionName string    // 品种名称
+}
+
+func AddCygxActivitySpecialPointsCompany(item *CygxActivitySpecialInheritPointsCompany) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	if err != nil {
+		return
+	}
+	return
+}
+
+func AddCygxActivitySpecialInheritPointsCompanyMulti(items []*CygxActivitySpecialInheritPointsCompany) (err error) {
+	o := orm.NewOrm()
+	_, err = o.InsertMulti(1, items)
+	return
+}
+
+func GetCygxActivitySpecialInheritPointsByCompanyId(companyId int) (list []*CygxActivitySpecialInheritPointsCompany, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT * FROM cygx_activity_special_inherit_points_company WHERE company_id = ?  `
+	_, err = o.Raw(sql,companyId).QueryRows(&list)
+	return
+}

+ 3 - 0
models/db_init.go

@@ -3,6 +3,7 @@ package models
 import (
 	"github.com/beego/beego/v2/client/orm"
 	_ "github.com/go-sql-driver/mysql"
+	"hongze/hongze_mobile_admin/models/cygx"
 	"hongze/hongze_mobile_admin/models/roadshow"
 	"hongze/hongze_mobile_admin/models/tables/admin"
 	"hongze/hongze_mobile_admin/models/tables/admin_record"
@@ -116,6 +117,8 @@ func init() {
 		new(company_product_try_out_update_permission_log.CompanyProductTryOutUpdatePermissionLog), //客户产品试用变更品种详情表
 		new(english_company.EnglishCompany), // 英文客户表
 		new(cygx_company_user_type.CygxCompanyUserType), // 英文客户表
+		new(cygx.CygxActivitySpecialTripBill), // 专项调研确定行程活动报名流水表
+
 	)
 
 	// 社区问答相关

+ 1 - 1
models/tables/cygx_company_user_type/company_user_type.go

@@ -55,7 +55,7 @@ func GetCygxCompanyUserTypeList() (items []*CygxCompanyUserType, err error) {
 // CygxCompanyUserType 更新权益客户身份类型
 func UpdateCygxCompanyUserTypeAndPackageType(companyId, useType, packageType int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE cygx_company_user_type SET customer_type_id=? AND package_type = ? WHERE company_id=? `
+	sql := `UPDATE cygx_company_user_type SET customer_type_id=?, package_type = ? WHERE company_id=? `
 	_, err = o.Raw(sql, useType, packageType, companyId).Exec()
 	return
 }

+ 23 - 0
services/company_approval/company_approval.go

@@ -408,6 +408,29 @@ func Approved(approvalRecord *contract_approval_record.ContractApprovalRecord, o
 				//处理权益客户的身份信息
 				cygxService.UpdateCygxCompanyUserType(recordInfo.CompanyContractId)
 
+				if recordInfo.ApplyMethod == 1{
+					//获取合同信息
+					contractInfo, tmpErr := company_contract.GetCompanyContractDetail(recordInfo.CompanyId, recordInfo.ProductId, recordInfo.CompanyContractId)
+					if tmpErr != nil {
+						err = errors.New(fmt.Sprint("待审批信息不存在,CompanyId:", recordInfo.CompanyId, ";productId:", recordInfo.ProductId, ";Err:"+tmpErr.Error()))
+						return
+					}
+					if contractInfo == nil {
+						err = errors.New(fmt.Sprint("待审批信息不存在,CompanyId:", recordInfo.CompanyId, ";productId:", recordInfo.ProductId))
+						return
+					}
+
+					//格式化合同开始时间
+					contractStartDate, tmpErr := time.Parse(utils.FormatDate, contractInfo.StartDate)
+					if tmpErr != nil {
+						err = errors.New("合同开始时间转换失败,Err:" + tmpErr.Error())
+						return
+					}
+					if time.Now().After(contractStartDate) {
+						cygxService.ActivitySpecialCompanyApproval(recordInfo.CompanyId, companyInfo.CompanyName) //审批通过的时候专项调研次数更新
+					}
+				}
+
 				//权益销售客户申请转正后,消息群发给所有销售
 				services.AddCompanyApprovalMessageRai(recordInfo.CompanyId, recordInfo.CompanyContractId, recordInfo.ApplyRealName, companyInfo.CompanyName)
 

+ 102 - 0
services/cygx/activity.go

@@ -0,0 +1,102 @@
+package cygxService
+
+import (
+	"hongze/hongze_mobile_admin/models"
+	"hongze/hongze_mobile_admin/models/cygx"
+	"hongze/hongze_mobile_admin/models/tables/cygx_company_user_type"
+	"hongze/hongze_mobile_admin/utils"
+	"strings"
+)
+
+// 获取 用户类型   //1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //3、分行业套餐客户(开通对应行业的正式客户) //4、仅开通专家套餐的正式客户 //5、开通对应行业套餐或专家套餐的试用客户
+func GetUserType(companyId int) (userType, packageType int, permissionStrnew, companyStatus string, err error) {
+	var permissionStr, permissionZhengShiStr string
+	if companyId <= 1 {
+		userType = 0
+	} else {
+		total, errs := cygx.GetCountCompanyDetailByIdGroup(companyId)
+		if errs != nil {
+			err = errs
+			return
+		}
+		if total == 0 {
+			userType = 0
+		} else {
+			companyDetail, errs := cygx.GetCompanyDetailByIdGroup(companyId)
+			if errs != nil {
+				err = errs
+				return
+			}
+			companyStatus = companyDetail.Status
+			permissionStr, errs = models.GetCompanyPermission(companyId)
+			if errs != nil {
+				err = errs
+				return
+			}
+			permissionStrnew = permissionStr
+			//大套餐客户,数据库添加标识,
+			companyUserTypeDetail, errs := cygx_company_user_type.GetCygxCompanyUserType(companyId)
+			if errs != nil && errs.Error() != utils.ErrNoRow() {
+				err = errs
+				return
+			}
+			if companyUserTypeDetail != nil {
+				packageType = companyUserTypeDetail.PackageType
+				if companyUserTypeDetail.CustomerTypeId != 0 {
+					userType = companyUserTypeDetail.CustomerTypeId
+					return
+				}
+			}
+
+			permissionZhengShiStr, errs = cygx.GetCompanyPermissionByUserZhengShi(companyId)
+			if errs != nil {
+				err = errs
+				return
+			}
+			//1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //3、分行业套餐客户(开通对应行业的正式客户) //4、仅开通专家套餐的正式客户 //5、开通对应行业套餐或专家套餐的试用客户、 10: 30W套餐客户
+			//大套餐客户定义:医药、消费、科技、智造、策略。5个行业中任意4个及以上是正式权限的,属于大套餐客户(医药、消费、科技、智造需要主客观都开)
+			if companyDetail.Status == "永续" {
+				userType = 1
+			} else if companyDetail.Status == "试用" {
+				userType = 5
+			} else if companyDetail.Status == "冻结" {
+				userType = 6
+			} else if companyDetail.Status == "流失" {
+				userType = 7
+			}
+			//大套餐客户定义:医药、消费、科技、智造、策略。5个行业中任意4个及以上是正式权限的,属于大套餐客户(医药、消费、科技、智造需要主客观都开)
+			if userType == 0 && companyDetail.Status == "正式" {
+				var permissionZhegnshiNum int
+				if strings.Count(permissionZhengShiStr, "医药") == 2 {
+					permissionZhegnshiNum++
+				}
+				if strings.Count(permissionZhengShiStr, "消费") == 2 {
+					permissionZhegnshiNum++
+				}
+				if strings.Count(permissionZhengShiStr, "科技") == 2 {
+					permissionZhegnshiNum++
+				}
+				if strings.Count(permissionZhengShiStr, "智造") == 2 {
+					permissionZhegnshiNum++
+				}
+				if strings.Count(permissionZhengShiStr, "策略") == 1 {
+					permissionZhegnshiNum++
+				}
+				if strings.Count(permissionZhengShiStr, "路演服务") == 1 {
+					permissionZhegnshiNum++
+				}
+				//if permissionZhegnshiNum == 6 {
+				//	userType = 2
+				//} else
+				//大套餐客户,数据库添加标识,条件大于等于四的都是 30W套餐客户
+				if permissionZhegnshiNum >= 4 {
+					userType = 10
+				} else {
+					userType = 3
+				}
+			}
+		}
+	}
+	permissionStrnew = permissionStr
+	return
+}

+ 117 - 0
services/cygx/activity_special.go

@@ -0,0 +1,117 @@
+package cygxService
+
+import (
+	"errors"
+	"hongze/hongze_mobile_admin/models"
+	"hongze/hongze_mobile_admin/models/cygx"
+	"hongze/hongze_mobile_admin/models/tables/chart_permission"
+	"hongze/hongze_mobile_admin/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// 审批通过的时候专项调研次数更新
+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
+	itemBill.CompanyName = companyName
+	itemBill.Source = 2
+	itemBill.DoType = 2
+	itemBill.Way = 3
+	if userType == 2{
+		packageTypeMap := map[int]int{1: 16, 2: 10}
+		totalTrip := packageTypeMap[packageType]
+		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 {
+			itemBill.Content = "70w大套餐转正"
+		}
+	} else {
+		list, e := models.GetCompanyReportPermissionByCompanyIdAndProductId(companyId, 2)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetCompanyReportPermissionUpgrade, Err: " + e.Error())
+		}
+		if len(list) == 0 {
+			return
+		}
+		var chartPermissionIdSlice []string
+		mapChartName := make(map[string]int)
+		mapUpgradeId := make(map[int]int)
+		mapInheritChartName := make(map[string]int)
+		mapPermissionNameTrip := make(map[string]int)
+		//mapPermissionName := make(map[int]string)
+		for _, v := range list {
+			chartPermissionIdSlice = append(chartPermissionIdSlice, strconv.Itoa(v.ChartPermissionId))
+			//是升级套餐才有点数
+			if v.IsUpgrade == 1 {
+				mapUpgradeId[v.ChartPermissionId] = 1
+			}
+		}
+		chartList := make([]*chart_permission.ChartPermission, 0)
+		if len(chartPermissionIdSlice) > 0 {
+			chartList, e = chart_permission.GetChartPermissionByIds(chartPermissionIdSlice)
+			if e != nil {
+				err = errors.New("获取品种信息失败, Err:" + e.Error())
+				return
+			}
+		}
+		if len(chartList) == 0 {
+			return
+		}
+		for _, v := range chartList {
+			//如果是升级则加点
+			if _, ok := mapUpgradeId[v.ChartPermissionId]; ok {
+				mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
+			} else {
+				mapChartName[v.PermissionName] = 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 += v
+				itemBill.Total += k + strconv.Itoa(v) + "次+"
+			}
+		}
+		itemBill.Content = "行业升级套餐转正"
+		itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+	}
+	err = cygx.AddCygxActivitySpecialTripBill(itemBill)
+	if err != nil {
+		return
+	}
+	return
+}