|
@@ -116,12 +116,6 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //total, errtotal := cygx.GetActivitySpecialTripCount(uid, activityId)
|
|
|
|
- //if errtotal != nil {
|
|
|
|
- // br.Msg = "获取失败"
|
|
|
|
- // br.ErrMsg = "获取失败,Err:" + errtotal.Error()
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
infoUser, err := cygx.GetUserAndCompanyNameList(uid)
|
|
infoUser, err := cygx.GetUserAndCompanyNameList(uid)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
@@ -138,36 +132,6 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
if totalAll > 0 {
|
|
if totalAll > 0 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- //流水记录表
|
|
|
|
- itemBill := new(cygx.CygxActivitySpecialTripBill)
|
|
|
|
- itemBill.UserId = infoUser.UserId
|
|
|
|
- itemBill.ActivityId = activityInfo.ActivityId
|
|
|
|
- itemBill.CreateTime = time.Now()
|
|
|
|
- itemBill.Mobile = infoUser.Mobile
|
|
|
|
- itemBill.Email = infoUser.Email
|
|
|
|
- itemBill.CompanyId = infoUser.CompanyId
|
|
|
|
- itemBill.CompanyName = infoUser.CompanyName
|
|
|
|
- itemBill.RealName = infoUser.RealName
|
|
|
|
- itemBill.Source = 2
|
|
|
|
- itemBill.DoType = 1
|
|
|
|
- itemBill.BillDetailed = -1 // 流水减一
|
|
|
|
- itemBill.RegisterPlatform = 3
|
|
|
|
- itemBill.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
- itemBill.ChartPermissionName = activityInfo.ChartPermissionName
|
|
|
|
- itemBill.AdminId = AdminUser.AdminId
|
|
|
|
-
|
|
|
|
- //if activityInfo.ChartPermissionName == utils.CE_LUE_NAME || activityInfo.ChartPermissionName == utils.GU_SHOU_NAME {
|
|
|
|
- if utils.InArrayByStr(utils.ACTIVITY_SPECIAL_TRIP_PERMISSION_NAME_OTHER, activityInfo.ChartPermissionName) {
|
|
|
|
- //如果是策略、固收、周期行业,把代扣行业信息放入流水表,取消报名的时候,返点使用
|
|
|
|
- maxChartPermissionId, maxChartPermissionName, err := cygxService.GetSpecialBillMaxChartPermissionId(infoUser)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "获取销售信息失败,GetSpecialBillMaxChartPermissionId Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- itemBill.ChartPermissionId = maxChartPermissionId
|
|
|
|
- itemBill.ChartPermissionName = maxChartPermissionName
|
|
|
|
- }
|
|
|
|
|
|
|
|
if totalAll == 0 {
|
|
if totalAll == 0 {
|
|
item := new(cygx.CygxActivitySpecialTrip)
|
|
item := new(cygx.CygxActivitySpecialTrip)
|
|
@@ -212,46 +176,7 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
|
|
br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
|
|
|
|
- //48小时之内的取消也扣除一次参会记录
|
|
|
|
- if time.Now().Add(+time.Hour * 48).After(resultTime) {
|
|
|
|
- itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
|
|
|
|
- } else {
|
|
|
|
- err = cygxService.DeductTripRemainingtimesByUser(infoUser, activityInfo, roleTypeCode) //扣除用户专项调研剩余次数
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(infoUser.CompanyId)
|
|
|
|
- //if err != nil {
|
|
|
|
- // br.Msg = "获取专项调研剩余次数失败"
|
|
|
|
- // br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //if userType == 2 {
|
|
|
|
- // tripRemaining = tripRemaining + itemBill.BillDetailed - i
|
|
|
|
- // itemBill.Total = strconv.Itoa(tripRemaining) + "次"
|
|
|
|
- //} else {
|
|
|
|
- // for k, num := range mapChartName {
|
|
|
|
- // if activityInfo.ChartPermissionName == k {
|
|
|
|
- // num = num + itemBill.BillDetailed - i
|
|
|
|
- // }
|
|
|
|
- // itemBill.Total += k + strconv.Itoa(num) + "次+"
|
|
|
|
- // }
|
|
|
|
- // itemBill.Total = strings.TrimRight(itemBill.Total, "+")
|
|
|
|
- //}
|
|
|
|
- totalText, err := cygxService.HandleActivitySpecialTripBillTotalText(infoUser.CompanyId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "报名失败,"
|
|
|
|
- br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
}
|
|
}
|
|
- itemBill.Total = totalText
|
|
|
|
- itemsBill = append(itemsBill, itemBill)
|
|
|
|
- //}
|
|
|
|
|
|
|
|
var itemMeeting = new(cygx.CygxActivitySpecialMeetingDetail)
|
|
var itemMeeting = new(cygx.CygxActivitySpecialMeetingDetail)
|
|
itemMeeting.UserId = v.UserId
|
|
itemMeeting.UserId = v.UserId
|
|
@@ -265,12 +190,20 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
itemsMeet = append(itemsMeet, itemMeeting)
|
|
itemsMeet = append(itemsMeet, itemMeeting)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
err = cygx.AddCygxActivitySpecialTrip(items, itemsBill, itemsMeet)
|
|
err = cygx.AddCygxActivitySpecialTrip(items, itemsBill, itemsMeet)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "操作失败"
|
|
br.Msg = "操作失败"
|
|
br.ErrMsg = "新增用户失败,Err:" + err.Error()
|
|
br.ErrMsg = "新增用户失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if len(items) > 0 {
|
|
|
|
+ //9用户报名添加到处理研选扣点
|
|
|
|
+ for _, v := range items {
|
|
|
|
+ time.Sleep(100 * time.Millisecond) // 添加0.1秒的延时
|
|
|
|
+ cygxService.SpecialActivityPointsBillSignupAddSpecial(v.ActivityId, v.UserId, AdminUser.AdminId)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "操作成功"
|
|
br.Msg = "操作成功"
|
|
@@ -555,42 +488,42 @@ func (this *ActivitySpecialTripCoAntroller) TripCancel() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
//流水记录表
|
|
//流水记录表
|
|
- itemBill := new(cygx.CygxActivitySpecialTripBill)
|
|
|
|
- itemBill.UserId = infoUser.UserId
|
|
|
|
- itemBill.ActivityId = activityInfo.ActivityId
|
|
|
|
- itemBill.CreateTime = time.Now()
|
|
|
|
- itemBill.Mobile = infoUser.Mobile
|
|
|
|
- itemBill.Email = infoUser.Email
|
|
|
|
- itemBill.CompanyId = infoUser.CompanyId
|
|
|
|
- itemBill.CompanyName = infoUser.CompanyName
|
|
|
|
- itemBill.RealName = infoUser.RealName
|
|
|
|
- itemBill.Source = 2
|
|
|
|
- itemBill.DoType = 2
|
|
|
|
- itemBill.BillDetailed = 1 // 流水加一
|
|
|
|
- itemBill.RegisterPlatform = 3
|
|
|
|
- itemBill.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
- itemBill.ChartPermissionName = activityInfo.ChartPermissionName
|
|
|
|
- itemBill.AdminId = sysUser.AdminId
|
|
|
|
|
|
+ //itemBill := new(cygx.CygxActivitySpecialTripBill)
|
|
|
|
+ //itemBill.UserId = infoUser.UserId
|
|
|
|
+ //itemBill.ActivityId = activityInfo.ActivityId
|
|
|
|
+ //itemBill.CreateTime = time.Now()
|
|
|
|
+ //itemBill.Mobile = infoUser.Mobile
|
|
|
|
+ //itemBill.Email = infoUser.Email
|
|
|
|
+ //itemBill.CompanyId = infoUser.CompanyId
|
|
|
|
+ //itemBill.CompanyName = infoUser.CompanyName
|
|
|
|
+ //itemBill.RealName = infoUser.RealName
|
|
|
|
+ //itemBill.Source = 2
|
|
|
|
+ //itemBill.DoType = 2
|
|
|
|
+ //itemBill.BillDetailed = 1 // 流水加一
|
|
|
|
+ //itemBill.RegisterPlatform = 3
|
|
|
|
+ //itemBill.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ //itemBill.ChartPermissionName = activityInfo.ChartPermissionName
|
|
|
|
+ //itemBill.AdminId = sysUser.AdminId
|
|
|
|
|
|
//if activityInfo.ChartPermissionName == utils.CE_LUE_NAME || activityInfo.ChartPermissionName == utils.GU_SHOU_NAME {
|
|
//if activityInfo.ChartPermissionName == utils.CE_LUE_NAME || activityInfo.ChartPermissionName == utils.GU_SHOU_NAME {
|
|
- if utils.InArrayByStr(utils.ACTIVITY_SPECIAL_TRIP_PERMISSION_NAME_OTHER, activityInfo.ChartPermissionName) {
|
|
|
|
- //如果是策略、固收行业,把代扣行业信息放入流水表,取消报名的时候,返点使用
|
|
|
|
- lastTripBill, err := cygx.GetCygxActivitySpecialTripBillLastDetialByActivityId(activityInfo.ActivityId, userId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "获取销售信息失败,GetCygxActivitySpecialTripBillLastDetialByActivityId Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- itemBill.ChartPermissionId = lastTripBill.ChartPermissionId
|
|
|
|
- itemBill.ChartPermissionName = lastTripBill.ChartPermissionName
|
|
|
|
- }
|
|
|
|
|
|
+ //if utils.InArrayByStr(utils.ACTIVITY_SPECIAL_TRIP_PERMISSION_NAME_OTHER, activityInfo.ChartPermissionName) {
|
|
|
|
+ // //如果是策略、固收行业,把代扣行业信息放入流水表,取消报名的时候,返点使用
|
|
|
|
+ // lastTripBill, err := cygx.GetCygxActivitySpecialTripBillLastDetialByActivityId(activityInfo.ActivityId, userId)
|
|
|
|
+ // if err != nil {
|
|
|
|
+ // br.Msg = "操作失败"
|
|
|
|
+ // br.ErrMsg = "获取销售信息失败,GetCygxActivitySpecialTripBillLastDetialByActivityId Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // itemBill.ChartPermissionId = lastTripBill.ChartPermissionId
|
|
|
|
+ // itemBill.ChartPermissionName = lastTripBill.ChartPermissionName
|
|
|
|
+ //}
|
|
|
|
|
|
resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
|
|
resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
|
|
//48小时之内的取消也扣除一次参会记录
|
|
//48小时之内的取消也扣除一次参会记录
|
|
var isValid int
|
|
var isValid int
|
|
if time.Now().Add(+time.Hour * 48).After(resultTime) {
|
|
if time.Now().Add(+time.Hour * 48).After(resultTime) {
|
|
isValid = 1
|
|
isValid = 1
|
|
- itemBill.BillDetailed = 0 // 48小时之内取消的,照样扣点,流水不进行加一
|
|
|
|
|
|
+ //itemBill.BillDetailed = 0 // 48小时之内取消的,照样扣点,流水不进行加一
|
|
} else {
|
|
} else {
|
|
err = cygxService.RebateTripRemainingtimesByUser(infoUser, activityInfo) // 返点
|
|
err = cygxService.RebateTripRemainingtimesByUser(infoUser, activityInfo) // 返点
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -623,19 +556,20 @@ func (this *ActivitySpecialTripCoAntroller) TripCancel() {
|
|
// }
|
|
// }
|
|
// itemBill.Total = strings.TrimRight(itemBill.Total, "+")
|
|
// itemBill.Total = strings.TrimRight(itemBill.Total, "+")
|
|
//}
|
|
//}
|
|
- totalText, err := cygxService.HandleActivitySpecialTripBillTotalText(infoUser.CompanyId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "报名失败,"
|
|
|
|
- br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- itemBill.Total = totalText
|
|
|
|
- err = cygx.AddCygxActivitySpecialTripBill(itemBill)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "修改失败"
|
|
|
|
- br.ErrMsg = "修改失败流水记录添加失败 Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ //totalText, err := cygxService.HandleActivitySpecialTripBillTotalText(infoUser.CompanyId)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // br.Msg = "报名失败,"
|
|
|
|
+ // br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ //itemBill.Total = totalText
|
|
|
|
+ //err = cygx.AddCygxActivitySpecialTripBill(itemBill)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // br.Msg = "修改失败"
|
|
|
|
+ // br.ErrMsg = "修改失败流水记录添加失败 Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ go cygxService.ActivityPointsBillSignupCancelSpecial(activityId, userId, sysUser.AdminId) // 用户取消报名专项调研活动扣点处理
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "操作成功"
|
|
br.Msg = "操作成功"
|