|
@@ -1836,6 +1836,10 @@ func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+//func init() {
|
|
|
+// SpecialActivityPointsBillRoadShowReduce(1893)
|
|
|
+//}
|
|
|
+
|
|
|
// 13: 给公司添加路演,对应专项调研扣点处理
|
|
|
func SpecialActivityPointsBillRoadShowReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
|
//func SpecialActivityPointsBillRoadShowReduce(activityId int) (err error) {
|
|
@@ -1893,7 +1897,7 @@ func SpecialActivityPointsBillRoadShowReduce(log models.YanXuanActivityPointsRed
|
|
|
mapActivityPointsBill := make(map[string]*models.CygxActivitySpecialTripBill)
|
|
|
var itemsOld []*models.CygxActivitySpecialTripBill // 之前扣过点的流水记录
|
|
|
for _, v := range activityPointsBillList { //获取这场路演,某个研究员最后一次的扣点记录
|
|
|
- keyBill := fmt.Sprint(v.ResearcherId, "_CID", companyId)
|
|
|
+ keyBill := fmt.Sprint(v.ResearcherId, "_CID", v.CompanyId)
|
|
|
if mapActivityPointsBill[keyBill] == nil {
|
|
|
mapActivityPointsBill[keyBill] = v
|
|
|
if v.BillDetailed <= 0 && v.DoType == 1 {
|
|
@@ -1941,7 +1945,6 @@ func SpecialActivityPointsBillRoadShowReduce(log models.YanXuanActivityPointsRed
|
|
|
err = errors.New("GetRsCalendarResearcherListByIds, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
//return
|
|
|
var items []*models.CygxActivitySpecialTripBill
|
|
|
var itemCompanys []*models.CygxActivitySpecialPermissionPoints
|
|
@@ -1962,23 +1965,50 @@ func SpecialActivityPointsBillRoadShowReduce(log models.YanXuanActivityPointsRed
|
|
|
item.Source = log.Source
|
|
|
item.TableSource = utils.CYGX_OBJ_ROADSHOW
|
|
|
|
|
|
- //如果没有扣点记录就对他们进行扣点处理
|
|
|
- if mapActivityPointsBill[keyBill] == nil || mapActivityPointsBill[keyBill].DoType == 2 {
|
|
|
- points := mapCompanyPoints[companyId] + billDetailed
|
|
|
- item.BillDetailed = billDetailed
|
|
|
- item.DoType = 1
|
|
|
- item.Content = fmt.Sprint(user.StartDate, " ", user.StartTime, "-", user.EndDate, " ", user.EndTime, " ", user.ResearcherName, "路演", companyStatus)
|
|
|
- item.Total = fmt.Sprint(points, "次")
|
|
|
- item.TableSource = utils.CYGX_OBJ_ROADSHOW
|
|
|
- //item.Points = mapCompanyPoints[user.CompanyId] - activityPointsSetDetail.UserPointsNum
|
|
|
- items = append(items, item)
|
|
|
- //更新对应机构的剩余点数
|
|
|
- itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
- itemCompany.CompanyId = companyId
|
|
|
- itemCompany.Points = points
|
|
|
- itemCompany.ModifyTime = time.Now()
|
|
|
- itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- mapCompanyPoints[companyId] = points
|
|
|
+ if user.Status == 2 {
|
|
|
+ //如果没有扣点记录就对他们进行扣点处理
|
|
|
+ if mapActivityPointsBill[keyBill] == nil || mapActivityPointsBill[keyBill].DoType == 2 {
|
|
|
+ points := mapCompanyPoints[companyId] + billDetailed
|
|
|
+ item.BillDetailed = billDetailed
|
|
|
+ item.DoType = 1
|
|
|
+ item.Content = fmt.Sprint(user.StartDate, " ", user.StartTime, "-", user.EndDate, " ", user.EndTime, " ", user.ResearcherName, "路演", companyStatus)
|
|
|
+ item.Total = fmt.Sprint(points, "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ROADSHOW
|
|
|
+ //item.Points = mapCompanyPoints[user.CompanyId] - activityPointsSetDetail.UserPointsNum
|
|
|
+ items = append(items, item)
|
|
|
+ //更新对应机构的剩余点数
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
+ itemCompany.CompanyId = companyId
|
|
|
+ itemCompany.Points = points
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
+ mapCompanyPoints[companyId] = points
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if mapActivityPointsBill[keyBill] != nil && mapActivityPointsBill[keyBill].DoType == 1 {
|
|
|
+ userItem := mapActivityPointsBill[keyBill]
|
|
|
+ points := mapCompanyPoints[companyId] - userItem.BillDetailed
|
|
|
+ item.BillDetailed = -userItem.BillDetailed
|
|
|
+ item.DoType = 2
|
|
|
+ item.Content = strings.Replace(userItem.Content, "路演", "路演--取消", -1)
|
|
|
+ //item.Points =points
|
|
|
+ item.Total = fmt.Sprint(points, "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ROADSHOW
|
|
|
+
|
|
|
+ item.CompanyId = rsCalendar.CompanyId
|
|
|
+ item.CompanyName = rsCalendar.CompanyName
|
|
|
+ item.ResearcherId = user.ResearcherId
|
|
|
+ item.ResearcherName = user.ResearcherName
|
|
|
+ items = append(items, item)
|
|
|
+
|
|
|
+ //更新对应机构的剩余点数
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
+ itemCompany.CompanyId = userItem.CompanyId
|
|
|
+ itemCompany.Points = points
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
+ mapCompanyPoints[userItem.CompanyId] = points
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|