|
@@ -556,202 +556,146 @@ func GetChartPermissionSpecialSurplusByCompany(companyId int) (userType int, tri
|
|
|
|
|
|
|
|
|
|
|
|
-func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyName string) (err error) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- companyContract, e := company.GetCompanyContractById(companyContractId)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetCompanyContractById, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- packageType := companyContract.RaiPackageType
|
|
|
- var items []*cygx.CygxActivitySpecialPermissionPoints
|
|
|
-
|
|
|
- itemBill := new(cygx.CygxActivitySpecialTripBill)
|
|
|
- itemBill.CreateTime = time.Now()
|
|
|
- itemBill.CompanyId = companyId
|
|
|
- itemBill.CompanyName = companyName
|
|
|
- itemBill.Source = 2
|
|
|
- itemBill.DoType = 2
|
|
|
- itemBill.Way = 3
|
|
|
- if packageType > 0 {
|
|
|
- packageTypeMap := map[int]float64{1: 16, 2: 12}
|
|
|
- totalTrip := packageTypeMap[packageType]
|
|
|
- itemBill.BillDetailed = totalTrip
|
|
|
- itemBill.Total = fmt.Sprint(itemBill.BillDetailed) + "次"
|
|
|
- if packageType == 2 {
|
|
|
- itemBill.Content = "45w大套餐转正"
|
|
|
- } else {
|
|
|
- itemBill.Content = "70w大套餐转正"
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- item := new(cygx.CygxActivitySpecialPermissionPoints)
|
|
|
- item.Points = totalTrip
|
|
|
- item.CompanyId = companyId
|
|
|
- item.CompanyName = companyName
|
|
|
- item.CreateTime = time.Now()
|
|
|
- item.ModifyTime = time.Now()
|
|
|
- items = append(items, item)
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
- pars = make([]interface{}, 0)
|
|
|
- condition = " AND company_contract_id = ? AND is_upgrade = 1 "
|
|
|
- pars = append(pars, companyContractId)
|
|
|
- list, e := company.GetCompanyContractPermissionList(condition, pars)
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetCompanyContractPermissionList, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if len(list) == 0 {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- listRaiSubjectivity, e := models.GetChartPermissionListRaiSubjectivity()
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetChartPermissionListRaiSubjectivity, Err: " + e.Error())
|
|
|
- }
|
|
|
- mapRaiSubjectivity := make(map[int]bool)
|
|
|
- mapPermissionName := make(map[int]string)
|
|
|
- for _, v := range listRaiSubjectivity {
|
|
|
- mapRaiSubjectivity[v.ChartPermissionId] = true
|
|
|
- mapPermissionName[v.ChartPermissionId] = v.ChartPermissionName
|
|
|
- }
|
|
|
- var points float64
|
|
|
- for _, v := range list {
|
|
|
-
|
|
|
- if v.IsUpgrade == 1 && mapRaiSubjectivity[v.ChartPermissionId] {
|
|
|
- points += 4
|
|
|
- }
|
|
|
- }
|
|
|
- item := new(cygx.CygxActivitySpecialPermissionPoints)
|
|
|
- item.Points = points
|
|
|
- item.CompanyId = companyId
|
|
|
- item.CompanyName = companyName
|
|
|
- item.ChartPermissionId = 0
|
|
|
- item.ChartPermissionName = ""
|
|
|
- item.CreateTime = time.Now()
|
|
|
- item.ModifyTime = time.Now()
|
|
|
- items = append(items, item)
|
|
|
- itemBill.Content = "行业升级套餐转正"
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
- e = cygx.MultiAddCygxActivitySpecialPermissionPoints(items)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("MultiAddCygxActivitySpecialPermissionPoints, Err:" + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if packageType == 0 && len(items) > 0 {
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
- pars = make([]interface{}, 0)
|
|
|
- condition = " AND company_id = ? AND points > 0 ORDER BY chart_permission_id DESC "
|
|
|
- pars = append(pars, companyId)
|
|
|
- activitySpecialPermissionPointsList, e := cygx.GetCygxActivitySpecialPermissionPointsList(condition, pars)
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- var itemBillTotal []string
|
|
|
- itemBillTotalMap := make(map[string]string)
|
|
|
- for _, v := range activitySpecialPermissionPointsList {
|
|
|
- itemBillTotal = append(itemBillTotal, fmt.Sprint(v.ChartPermissionName, v.Points, "次"))
|
|
|
- itemBillTotalMap[v.ChartPermissionName] = fmt.Sprint(v.ChartPermissionName, v.Points, "次")
|
|
|
- }
|
|
|
- itemBill.BillDetailed = float64(4 * len(items))
|
|
|
- permissionNameSlice := []string{"医药", "消费", "科技", "智造"}
|
|
|
- var itemBillTotalNew []string
|
|
|
- for _, v := range permissionNameSlice {
|
|
|
- if itemBillTotalMap[v] == "" {
|
|
|
- itemBillTotalNew = append(itemBillTotalNew, fmt.Sprint(v, "0次"))
|
|
|
- } else {
|
|
|
- itemBillTotalNew = append(itemBillTotalNew, itemBillTotalMap[v])
|
|
|
- }
|
|
|
- }
|
|
|
- itemBill.Total = strings.Join(itemBillTotalNew, "+")
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if itemBill.Total != "" {
|
|
|
- e := cygx.AddCygxActivitySpecialTripBill(itemBill)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("AddCygxActivitySpecialTripBill, Err:" + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-func ActivitySpecialPublishAndCancel(activityInfo *cygx.ActivitySpecialDetail) (err error) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|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
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
func GetSpecialSurplusByCompanyNew(companyId int) (specialSurplus string, err error) {
|
|
|
- companyDetail, e := cygx.GetCompanyDetailByIdGroup(companyId)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetCompanyDetailByIdGroup, Err: " + e.Error())
|
|
|
- }
|
|
|
- if companyDetail == nil {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- billItem, e := cygx.GetCygxActivitySpecialTripBillByCompanyId(companyId)
|
|
|
+ points, e := cygx.GetCygxActivitySpecialPermissionPointsCount(companyId)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
err = e
|
|
|
return
|
|
|
}
|
|
|
- if billItem != nil {
|
|
|
- specialSurplus = billItem.Total
|
|
|
- } else {
|
|
|
- specialSurplus = "0次"
|
|
|
- }
|
|
|
+ specialSurplus = fmt.Sprint(points, "次")
|
|
|
return
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1007,7 +951,5 @@ func CheckSpecialActivityPointsByUserIds(userIds string, activityLen int) (err e
|
|
|
err = errors.New("您的专项调研次数已用完,如仍想参加,请与您的对口销售商议")
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return
|
|
|
-
|
|
|
}
|