|
@@ -718,6 +718,10 @@ func ActivitySpecialPublishAndCancel(activityInfo *cygx.ActivitySpecialDetail) (
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+//func init() {
|
|
|
+// fmt.Println(GetSpecialSurplusByCompanyNew(16))
|
|
|
+//}
|
|
|
+
|
|
|
// GetSpecialSurplusByCompanyNew 获取公司专项调研剩余次数-用流水表数据不计算了,计算都丢在流水里
|
|
|
func GetSpecialSurplusByCompanyNew(companyId int) (specialSurplus string, err error) {
|
|
|
companyDetail, e := cygx.GetCompanyDetailByIdGroup(companyId)
|
|
@@ -727,26 +731,28 @@ func GetSpecialSurplusByCompanyNew(companyId int) (specialSurplus string, err er
|
|
|
if companyDetail == nil {
|
|
|
return
|
|
|
}
|
|
|
- if companyDetail.Status != "永续" && companyDetail.Status != "正式" {
|
|
|
- return
|
|
|
- }
|
|
|
- if companyDetail.Status == "永续" {
|
|
|
- specialSurplus = "不限次数"
|
|
|
- }
|
|
|
+ //if companyDetail.Status != "永续" && companyDetail.Status != "正式" {
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //if companyDetail.Status == "永续" {
|
|
|
+ // specialSurplus = "不限次数"
|
|
|
+ //}
|
|
|
//chartMap := map[int]string{utils.YI_YAO_ID:utils.YI_YAO_NAME, utils.XIAO_FEI_ID:utils.XIAO_FEI_NAME, utils.KE_JI_ID:utils.KE_JI_NAME, utils.ZHI_ZAO_ID:utils.ZHI_ZAO_NAME}
|
|
|
//chartNumMap := map[int]int{utils.YI_YAO_ID:0, utils.XIAO_FEI_ID:0, utils.KE_JI_ID:0, utils.ZHI_ZAO_ID:0}
|
|
|
- if companyDetail.Status == "正式" {
|
|
|
- billItem, e := cygx.GetCygxActivitySpecialTripBillByCompanyId(companyId)
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = e
|
|
|
- return
|
|
|
- }
|
|
|
- if billItem != nil {
|
|
|
- specialSurplus = billItem.Total
|
|
|
- }
|
|
|
+ //if companyDetail.Status == "正式" {
|
|
|
+ billItem, e := cygx.GetCygxActivitySpecialTripBillByCompanyId(companyId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = e
|
|
|
return
|
|
|
}
|
|
|
+ if billItem != nil {
|
|
|
+ specialSurplus = billItem.Total
|
|
|
+ } else {
|
|
|
+ specialSurplus = "0次"
|
|
|
+ }
|
|
|
return
|
|
|
+ //}
|
|
|
+ //return
|
|
|
}
|
|
|
|
|
|
// GetSpecialBillMaxChartPermissionId 获取专项调研剩余点数最多的行业
|
|
@@ -799,6 +805,24 @@ func DeductTripRemainingtimesByUser(user *cygx.UserAndCompanyName, activityInfo
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //如果永续客户不存在单独的行业剩余点数记录,那么就添加一条 -1 的记录作为初始化数据
|
|
|
+ if companyProduct.Status == utils.COMPANY_STATUS_FOREVER && len(activitySpecialPermissionPointsList) == 0 {
|
|
|
+ item := new(cygx.CygxActivitySpecialPermissionPoints)
|
|
|
+ item.CompanyId = companyProduct.CompanyId
|
|
|
+ item.Points = -1
|
|
|
+ item.CompanyName = companyProduct.CompanyName
|
|
|
+ //item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
+ //item.ChartPermissionName = activityInfo.ChartPermissionName
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ e = cygx.AddCygxActivitySpecialPermissionPoints(item)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddCygxActivitySpecialPermissionPoints, Err:" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var maxPoints int // 获取最大剩余点数,(写的有点多余)
|
|
|
for _, v := range activitySpecialPermissionPointsList {
|
|
|
if maxPoints < v.Points {
|
|
@@ -896,8 +920,8 @@ func RebateTripRemainingtimesByUser(user *cygx.UserAndCompanyName, activityInfo
|
|
|
}
|
|
|
|
|
|
// 预处理专项调研流水明细表描述内容
|
|
|
-func HandleActivitySpecialTripBillTotalText(user *cygx.UserAndCompanyName) (totalText string, err error) {
|
|
|
- companyId := user.CompanyId
|
|
|
+func HandleActivitySpecialTripBillTotalText(companyId int) (totalText string, err error) {
|
|
|
+ //companyId := user.CompanyId
|
|
|
companyDetail, e := cygx.GetCompanyDetailByIdGroup(companyId)
|
|
|
if e != nil {
|
|
|
err = errors.New("GetCompanyDetailByIdGroup, Err:" + e.Error())
|