|
@@ -388,6 +388,7 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
go utils.SendAlarmMsg("批量更新企业服务明细记录失败: UpdateCygxRaiServeBillByCompanyIds Err"+err.Error(), 2)
|
|
|
}
|
|
|
}()
|
|
|
+ var delBillIds []int
|
|
|
fmt.Println("UpdateCygxRaiServeBillByCompanyIds start")
|
|
|
companyList, e := rai_serve.GetCygxRaiServeCompanyAllList()
|
|
|
if e != nil {
|
|
@@ -585,15 +586,15 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
var parsBill []interface{}
|
|
|
conditionBill = " AND source = 'activity' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
parsBill = append(parsBill, companyIds, createTime)
|
|
|
- listBillByArticle, e := rai_serve.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
+ listBillByActivity, e := rai_serve.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
if e != nil {
|
|
|
err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- mapArticleBill := make(map[string]bool)
|
|
|
- for _, v := range listBillByArticle {
|
|
|
- mapArticleBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
+ mapActivityeBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillByActivity {
|
|
|
+ mapActivityeBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
}
|
|
|
|
|
|
mapArticleBillDel := make(map[string]bool)
|
|
@@ -601,8 +602,18 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
mapArticleBillDel[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] = true
|
|
|
}
|
|
|
|
|
|
+ mapDelActivityBillDel := make(map[string]bool)
|
|
|
for _, v := range signUpDetailList {
|
|
|
- if mapArticleBill[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] { // 如果内容存在就不插入
|
|
|
+ mapDelActivityBillDel[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] = true
|
|
|
+ }
|
|
|
+ for _, v := range listBillByActivity {
|
|
|
+ if !mapDelActivityBillDel[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] { // 如果内容存在就插入删除ID中
|
|
|
+ delBillIds = append(delBillIds, v.BillId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range signUpDetailList {
|
|
|
+ if mapActivityeBill[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] { // 如果内容存在就不插入
|
|
|
continue
|
|
|
}
|
|
|
item := new(rai_serve.CygxRaiServeBill)
|
|
@@ -652,19 +663,29 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
var parsBill []interface{}
|
|
|
conditionBill = " AND source = 'activityspecial' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
parsBill = append(parsBill, companyIds, createTime)
|
|
|
- listBillByArticle, e := rai_serve.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
+ listBillByActivitySpecial, e := rai_serve.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
if e != nil {
|
|
|
err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- mapArticleBill := make(map[string]bool)
|
|
|
- for _, v := range listBillByArticle {
|
|
|
- mapArticleBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
+ mapActivitySpecial := make(map[string]bool)
|
|
|
+ for _, v := range listBillByActivitySpecial {
|
|
|
+ mapActivitySpecial[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ mapDelActivitySpecial := make(map[string]bool)
|
|
|
+ for _, v := range activitySpecialList {
|
|
|
+ mapDelActivitySpecial[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] = true
|
|
|
+ }
|
|
|
+ for _, v := range listBillByActivitySpecial {
|
|
|
+ if !mapDelActivitySpecial[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] { // 如果内容存在就插入删除ID中
|
|
|
+ delBillIds = append(delBillIds, v.BillId)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for _, v := range activitySpecialList {
|
|
|
- if mapArticleBill[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] { // 如果内容存在就不插入
|
|
|
+ if mapActivitySpecial[fmt.Sprint("UID_", v.UserId, "SID_", v.ActivityId)] { // 如果内容存在就不插入
|
|
|
continue
|
|
|
}
|
|
|
item := new(rai_serve.CygxRaiServeBill)
|
|
@@ -753,6 +774,16 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
}
|
|
|
|
|
|
+ mapDelRscalendarBill := make(map[string]bool)
|
|
|
+ for _, v := range calendarMeetingUserList {
|
|
|
+ mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RsCalendarId)] = true
|
|
|
+ }
|
|
|
+ for _, v := range listBillByRscalendar {
|
|
|
+ if !mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] { // 如果内容存在就插入删除ID中
|
|
|
+ delBillIds = append(delBillIds, v.BillId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range calendarMeetingUserList {
|
|
|
if mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RsCalendarId)] { // 如果内容存在就不插入
|
|
|
continue
|
|
@@ -817,6 +848,16 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
}
|
|
|
|
|
|
+ mapDelRscalendarBill := make(map[string]bool)
|
|
|
+ for _, v := range userFeedbackList {
|
|
|
+ mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.UserFeedbackId)] = true
|
|
|
+ }
|
|
|
+ for _, v := range listBillByuserFeedback {
|
|
|
+ if !mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] { // 如果内容存在就插入删除ID中
|
|
|
+ delBillIds = append(delBillIds, v.BillId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range userFeedbackList {
|
|
|
if mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.UserFeedbackId)] { // 如果内容存在就不插入
|
|
|
continue
|
|
@@ -846,11 +887,23 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
}
|
|
|
//交流反馈 end
|
|
|
|
|
|
- e = rai_serve.AddCygxRaiServeBillMulti(items)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("AddCygxRaiServeBillMulti, Err: " + e.Error())
|
|
|
- return
|
|
|
+ if len(items) > 0 {
|
|
|
+ e = rai_serve.AddCygxRaiServeBillMulti(items)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddCygxRaiServeBillMulti, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(delBillIds) > 0 {
|
|
|
+ e = rai_serve.DelCygxRaiServeCompanyMulti(delBillIds)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddCygxRaiServeBillMulti, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ fmt.Println("delBillIds", (delBillIds))
|
|
|
fmt.Println("UpdateCygxRaiServeBillByCompanyIds end")
|
|
|
return
|
|
|
}
|