Browse Source

专项调研流水明细修改

zhangchuanxing 4 days ago
parent
commit
673ce8d1cc

+ 10 - 40
controllers/company.go

@@ -9684,50 +9684,20 @@ func (this *CompanyTodoController) CompanyActivitySpecialPointsBill() {
 			ChartPermissionId:   v.ChartPermissionId,
 			ChartPermissionName: v.ChartPermissionName,
 			Total:               v.Total,
+			Content:             v.Content,
 		}
-		if v.ActivityId == 0 {
-			item.Content = v.Content
-		} else {
-			if v.DoType == 1 && v.Way != 4 && v.Way != 3 {
-				item.Content = item.ActivityName + "--报名"
-			} else if v.DoType == 2 && v.Way != 4 && v.Way != 3 {
-				item.Content = item.ActivityName + "--取消报名"
-			} else if v.Way == 4 {
-				item.Content = item.ActivityName + "--活动取消"
-			}
-		}
-		//if userType == 2 {
-		//	if i== 0 {
-		//		item.Total += strconv.Itoa(tripRemaining) + "次"
-		//	} else {
-		//		item.Total += strconv.Itoa(tripRemaining-list[i-1].BillDetailed) + "次"
-		//	}
-		//	//if v.BillDetailed < 4 {
-		//	//	item.Total += strconv.Itoa(lastTripRemaining-list[i-1].BillDetailed) + "次"
-		//	//} else {
-		//	//	item.Total += strconv.Itoa(lastTripRemaining) + "次"
-		//	//}
+		//if v.ActivityId == 0 {
+		//	item.Content = v.Content
 		//} else {
-		//	for k, num := range mapChartName {
-		//		if i== 0 {
-		//			item.Total += k + strconv.Itoa(num) + "次+"
-		//		} else {
-		//			if list[i-1].ActivityId == 0 {
-		//				item.Total += k + strconv.Itoa(num) + "次+"
-		//			} else {
-		//				item.Total += k + strconv.Itoa(num-list[i-1].BillDetailed) + "次+"
-		//			}
-		//		}
-		//		//if num > 0 {
-		//		//	if i== 0{
-		//		//		item.Total += k + strconv.Itoa(num) + "次+"
-		//		//	} else {
-		//		//		item.Total += k + strconv.Itoa(num-v.BillDetailed) + "次+"
-		//		//	}
-		//		//}
+		//	if v.DoType == 1 && v.Way != 4 && v.Way != 3 {
+		//		item.Content = item.ActivityName + "--报名"
+		//	} else if v.DoType == 2 && v.Way != 4 && v.Way != 3 {
+		//		item.Content = item.ActivityName + "--取消报名"
+		//	} else if v.Way == 4 {
+		//		item.Content = item.ActivityName + "--活动取消"
 		//	}
-		//	item.Total = strings.TrimRight(item.Total, "+")
 		//}
+
 		resp.List = append(resp.List, &item)
 	}
 

+ 7 - 0
controllers/cygx/activity.go

@@ -618,6 +618,13 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 				}
 			}
 
+			userPointsNum, _ := strconv.Atoi(itemPointsSet.UserPointsNum)
+			if userPointsNum > 0 {
+				//扣点的研选活动,价格按照4000块一个点进行扣除
+				item.ActivityPrice = 4000 * float64(userPointsNum)
+				item.ActivityOriginalPrice = 4000 * float64(userPointsNum)
+			}
+
 			items = append(items, item)
 
 			var errAct error

+ 40 - 0
controllers/cygx/activity_special.go

@@ -2,6 +2,7 @@ package cygx
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"github.com/tealeg/xlsx"
 	"hongze/hz_crm_api/controllers"
@@ -1188,3 +1189,42 @@ func (this *ActivitySpecialCoAntroller) Offline() {
 	br.Msg = "操作成功"
 	br.IsAddLog = true
 }
+
+//func init() {
+//	initCygx14_5()
+//}
+
+// 查研观向14_5上线脚本
+func initCygx14_5() {
+	// 获取流水信息
+	var condition string
+	var pars []interface{}
+	condition += ` AND b.activity_id > 0  AND  	 b.table_source IS NULL  `
+	list, err := cygx.GetCygxActivitySpecialTripBillDetailListAllInit14_5(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	var content string
+	for _, v := range list {
+		if v.ActivityId == 0 {
+			continue
+		} else {
+			if v.DoType == 1 && v.Way != 4 && v.Way != 3 {
+				content = v.ResearchTheme + "--报名"
+			} else if v.DoType == 2 && v.Way != 4 && v.Way != 3 {
+				content = v.ResearchTheme + "--取消报名"
+			} else if v.Way == 4 {
+				content = v.ResearchTheme + "--活动取消"
+			}
+		}
+		fmt.Println(v.Id, "content", content)
+
+		err = cygx.Updatecygx_activity_special_trip_bill(content, v.Id)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+	}
+	fmt.Println("enddd145")
+}

+ 4 - 0
models/cygx/activity.go

@@ -257,6 +257,8 @@ type CygxActivity struct {
 	AreaType                  int       `description:"地区,1国内,2海外,默认1"`
 	IsZoom                    int       `description:"是否是Zoom模版  1是,0否"`
 	MeetingId                 string    `description:"会议ID"`
+	ActivityPrice             float64   `description:"单场活动价格"`
+	ActivityOriginalPrice     float64   `description:"单场活动原价格"`
 }
 
 type CygxActivityEditDetail struct {
@@ -432,6 +434,8 @@ func EditActivity(item *CygxActivity, oldPublishStatus int, industrialActivityIt
 	updateParams["AreaType"] = item.AreaType
 	updateParams["MeetingId"] = item.MeetingId
 	updateParams["IsZoom"] = item.IsZoom
+	updateParams["ActivityPrice"] = item.ActivityPrice
+	updateParams["ActivityOriginalPrice"] = item.ActivityOriginalPrice
 	//修改活动信息
 	ptrStructOrTableName := "cygx_activity"
 	whereParam := map[string]interface{}{"activity_id": item.ActivityId}

+ 22 - 42
models/cygx/activity_special_trip_bill.go

@@ -86,32 +86,6 @@ type AirborneCount struct {
 	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.NewOrmUsingDB("hz_cygx")
-	_, 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.NewOrmUsingDB("hz_cygx")
-	err = o.Raw(sqlCount, pars).QueryRow(&count)
-	return
-}
-
 type CygxActivitySpecialTripBillDetailList struct {
 	Id                  int       `orm:"column(id);pk"`
 	UserId              int       `description:"用户id,多个用,隔开"`
@@ -135,22 +109,6 @@ type CygxActivitySpecialTripBillDetailList struct {
 	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" `                                 // 内容说明
@@ -170,6 +128,20 @@ type CygxActivitySpecialPointsBillResp struct {
 }
 
 func GetCygxActivitySpecialTripBillDetailListAll(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT
+			b.*
+		FROM
+			cygx_activity_special_trip_bill AS b
+		WHERE
+			1 = 1` + condition
+
+	sql += ` ORDER BY b.create_time DESC , b.id DESC `
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+func GetCygxActivitySpecialTripBillDetailListAllInit14_5(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := `SELECT
 			b.*,
@@ -226,3 +198,11 @@ GROUP BY
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }
+
+// CygxCompanyUserType 更新权益客户身份类型
+func Updatecygx_activity_special_trip_bill(content string, id int) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `UPDATE cygx_activity_special_trip_bill SET content=?  WHERE id=? `
+	_, err = o.Raw(sql, content, id).Exec()
+	return
+}