|
@@ -940,3 +940,578 @@ func getTitle(activityType, roadshowType, activityCategory, roadshowPlatform, pr
|
|
|
}
|
|
|
return title
|
|
|
}
|
|
|
+
|
|
|
+//// @Title 编辑路演活动接口
|
|
|
+//// @Description编辑路演活动接口
|
|
|
+//// @Param request body roadshow.EditActivityReq true "type json string"
|
|
|
+//// @Success Ret=200 保存成功
|
|
|
+//// @router /edit [post]
|
|
|
+//func (this *CalendarController) Edit() {
|
|
|
+// sysUser := this.AdminWx
|
|
|
+// if sysUser == nil {
|
|
|
+// this.FailWithMessage("请登录", "请登录,SysUser Is Empty")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// deleteCache := true
|
|
|
+// cacheKey := "CACHE_RS_ACTIVITY_WX_EDIT_" + strconv.Itoa(sysUser.AdminId)
|
|
|
+// defer func() {
|
|
|
+// if deleteCache {
|
|
|
+// utils.Rc.Delete(cacheKey)
|
|
|
+// }
|
|
|
+// }()
|
|
|
+// if !utils.Rc.SetNX(cacheKey, 1, 5*time.Second) {
|
|
|
+// deleteCache = false
|
|
|
+// this.FailWithMessage("系统处理中,请稍后重试!", "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(this.Ctx.Input.RequestBody))
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// var req roadshow.EditActivityReq
|
|
|
+// err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+// if err != nil {
|
|
|
+// this.FailWithMessage("参数解析异常", "参数解析失败,Err:" + err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.RsCalendarId <= 0 {
|
|
|
+// this.FailWithMessage("参数错误", "参数错误,RsCalendarId<=0")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.RsCalendarResearcherId <= 0 {
|
|
|
+// this.FailWithMessage("参数错误", "参数错误,RsCalendarResearcherId<=0")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.ActivityType == "" {
|
|
|
+// this.FailWithMessage("请选择活动类型", "请选择活动类型")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if len(req.ResearcherList) <= 0 {
|
|
|
+// this.FailWithMessage("请选择研究员!", "请选择研究员!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// researcherMap := make(map[int]string)
|
|
|
+// var checkIsAdd []string
|
|
|
+// for _, v := range req.ResearcherList {
|
|
|
+// if v.ResearcherId <= 0 {
|
|
|
+// this.FailWithMessage("请选择研究员!", "请选择研究员!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.ResearcherName == "" {
|
|
|
+// this.FailWithMessage("请选择研究员!", "请选择研究员!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.StartDate == "" {
|
|
|
+// this.FailWithMessage("请选择开始日期!", "请选择开始日期!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.EndDate == "" {
|
|
|
+// this.FailWithMessage("请选择结束日期!", "请选择结束日期!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.StartTime == "" {
|
|
|
+// this.FailWithMessage("请选择开始时间!", "请选择开始时间!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.EndTime == "" {
|
|
|
+// this.FailWithMessage("请选择结束时间!", "请选择结束时间!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if v.StartWeek == "" {
|
|
|
+// this.FailWithMessage("请选择周!", "请选择周!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if v.EndWeek == "" {
|
|
|
+// this.FailWithMessage("请选择周!", "请选择周!")
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if realName, ok := researcherMap[v.ResearcherId]; ok {
|
|
|
+// br.Msg = "研究员:" + realName + " 被重复选择"
|
|
|
+// return
|
|
|
+// }
|
|
|
+// researcherMap[v.ResearcherId] = v.ResearcherName
|
|
|
+//
|
|
|
+// startDateTime := v.StartDate + " " + v.StartTime
|
|
|
+// endDateTime := v.EndDate + " " + v.EndTime
|
|
|
+//
|
|
|
+// startP, _ := time.ParseInLocation(utils.FormatDateTime, startDateTime, time.Local)
|
|
|
+// endP, _ := time.ParseInLocation(utils.FormatDateTime, endDateTime, time.Local)
|
|
|
+//
|
|
|
+// if startP.Before(time.Now()) || startP.Equal(time.Now()) {
|
|
|
+// br.Msg = "活动开始时间不能小于当前时间!"
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if endP.Before(time.Now()) || endP.Equal(time.Now()) {
|
|
|
+// br.Msg = "活动结束时间不能小于当前时间!"
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if startP.After(endP) || startP.Equal(endP) {
|
|
|
+// br.Msg = "活动开始时间应小于结束时间!"
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// /*
|
|
|
+// 时间冲突时,提示:xxx时间已被占用
|
|
|
+// 当有任意一个研究员时间有冲突时,所有申请订单都不发送。
|
|
|
+// */
|
|
|
+//
|
|
|
+// rsCalendarResearcherItem, err := roadshow.GetRsCalendarResearcherByRsCalendarIdAndResearcherId(req.RsCalendarId, v.ResearcherId)
|
|
|
+// var isAdd bool
|
|
|
+// if err != nil {
|
|
|
+// if err.Error() == utils.ErrNoRow() {
|
|
|
+// isAdd = true
|
|
|
+// } else {
|
|
|
+// br.Msg = "获取数据失败!"
|
|
|
+// br.ErrMsg = "获取数据失败!GetRsCalendarResearcherByRsCalendarIdAndResearcherId:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// }
|
|
|
+// var rsCalendarResearcherId int
|
|
|
+// if rsCalendarResearcherItem == nil {
|
|
|
+// isAdd = true
|
|
|
+// } else {
|
|
|
+// rsCalendarResearcherId = rsCalendarResearcherItem.RsCalendarResearcherId
|
|
|
+// }
|
|
|
+//
|
|
|
+// //同步上海数据
|
|
|
+// researcherInfo, err := system.GetSysAdminById(v.ResearcherId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "研究员异常"
|
|
|
+// return
|
|
|
+// }
|
|
|
+// _ = roadshowService.SyncCalendarFromShanghai(researcherInfo.Mobile, v.StartDate, v.EndDate)
|
|
|
+//
|
|
|
+// //校验事项时间冲突
|
|
|
+// {
|
|
|
+// if isAdd || (rsCalendarResearcherItem != nil && (rsCalendarResearcherItem.StartDate != v.StartDate ||
|
|
|
+// rsCalendarResearcherItem.StartTime != v.StartTime ||
|
|
|
+// rsCalendarResearcherItem.EndDate != v.EndDate ||
|
|
|
+// rsCalendarResearcherItem.EndTime != v.EndTime)) {
|
|
|
+//
|
|
|
+// matterCount, err := roadshowService.CheckMatters(startDateTime, endDateTime, v.ResearcherId, 0)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "时间冲突检测失败!"
|
|
|
+// br.ErrMsg = "时间冲突检测失败-CheckMattersCount!Err:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if matterCount > 0 {
|
|
|
+// checkIsAdd = append(checkIsAdd, v.ResearcherName)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //校验活动时间冲突
|
|
|
+// {
|
|
|
+// if isAdd || (rsCalendarResearcherItem != nil && (rsCalendarResearcherItem.StartDate != v.StartDate ||
|
|
|
+// rsCalendarResearcherItem.StartTime != v.StartTime ||
|
|
|
+// rsCalendarResearcherItem.EndDate != v.EndDate ||
|
|
|
+// rsCalendarResearcherItem.EndTime != v.EndTime)) {
|
|
|
+//
|
|
|
+// calendarCount, err := roadshowService.CheckCalendar(startDateTime, endDateTime, "1,2", v.ResearcherId, rsCalendarResearcherId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "时间冲突检测失败!"
|
|
|
+// br.ErrMsg = "时间冲突检测失败-CheckCalendarResearcherCount!Err:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if calendarCount > 0 {
|
|
|
+// checkIsAdd = append(checkIsAdd, v.ResearcherName)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if len(checkIsAdd) > 0 {
|
|
|
+// br.Msg = strings.Join(checkIsAdd, ",") + "时间已被占用!"
|
|
|
+// br.ErrMsg = "时间冲突检测失败-CheckMattersCount!"
|
|
|
+// br.IsSendEmail = false
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// rsCalendarItem, err := roadshow.GetRsCalendarById(req.RsCalendarId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "获取数据失败!"
|
|
|
+// br.ErrMsg = "获取数据失败!GetRsCalendarById:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// if rsCalendarItem == nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "获取数据失败!GetRsCalendarById:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// calendarWhereParams := make(map[string]interface{})
|
|
|
+// calendarUpdateParams := make(map[string]interface{})
|
|
|
+//
|
|
|
+// calendarWhereParams["rs_calendar_id"] = req.RsCalendarId
|
|
|
+//
|
|
|
+// if req.ActivityType != "" {
|
|
|
+// calendarUpdateParams["activity_type"] = req.ActivityType
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.RoadshowType != "" {
|
|
|
+// calendarUpdateParams["roadshow_type"] = req.RoadshowType
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.RoadshowPlatform != "" {
|
|
|
+// calendarUpdateParams["roadshow_platform"] = req.RoadshowPlatform
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.CompanyId > 0 {
|
|
|
+// calendarUpdateParams["company_id"] = req.CompanyId
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.CompanyName != "" {
|
|
|
+// calendarUpdateParams["company_name"] = req.CompanyName
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.ActivityCategory != "" {
|
|
|
+// calendarUpdateParams["activity_category"] = req.ActivityCategory
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.Theme != "" {
|
|
|
+// calendarUpdateParams["theme"] = req.Theme
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.CooperationName != "" {
|
|
|
+// calendarUpdateParams["cooperation_name"] = req.CooperationName
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.Province != "" {
|
|
|
+// calendarUpdateParams["province"] = req.Province
|
|
|
+// }
|
|
|
+//
|
|
|
+// if req.City != "" {
|
|
|
+// calendarUpdateParams["city"] = req.City
|
|
|
+// }
|
|
|
+//
|
|
|
+// calendarUpdateParams["modify_time"] = time.Now()
|
|
|
+// calendarUpdateParams["title"] = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
|
|
|
+// err = roadshow.UpdateRsCalendar(calendarWhereParams, calendarUpdateParams)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "保存失败!UpdateRsCalendar:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// //newResearcherMap := make(map[int]string)
|
|
|
+// go roadshowService.UpdateSHCalendar(req)
|
|
|
+//
|
|
|
+// existList, err := roadshow.GetRsCalendarResearcherByCalendarId(req.RsCalendarId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "保存失败!GetRsCalendarResearcherByCalendarId:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// existResearcherMap := make(map[int]string)
|
|
|
+// for _, ev := range existList {
|
|
|
+// existResearcherMap[ev.ResearcherId] = ev.ResearcherName
|
|
|
+// }
|
|
|
+//
|
|
|
+// if rsCalendarItem.ActivityType == "路演" || rsCalendarItem.ActivityType == "公开会议" {
|
|
|
+// for k, v := range req.ResearcherList {
|
|
|
+// rsCalendarResearcherItem, err := roadshow.GetRsCalendarResearcherById(req.RsCalendarResearcherId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "获取数据失败!"
|
|
|
+// br.ErrMsg = "获取数据失败!GetRsCalendarResearcherById:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// calendarResearcherWhereParams := make(map[string]interface{})
|
|
|
+// calendarResearcherUpdateParams := make(map[string]interface{})
|
|
|
+//
|
|
|
+// calendarResearcherWhereParams["rs_calendar_researcher_id"] = req.RsCalendarResearcherId
|
|
|
+//
|
|
|
+// calendarResearcherUpdateParams["researcher_id"] = v.ResearcherId
|
|
|
+// calendarResearcherUpdateParams["researcher_name"] = v.ResearcherName
|
|
|
+//
|
|
|
+// if rsCalendarResearcherItem.Status == 3 || rsCalendarResearcherItem.Status == 5 {
|
|
|
+// calendarResearcherUpdateParams["status"] = 1
|
|
|
+// }
|
|
|
+// calendarResearcherUpdateParams["start_date"] = v.StartDate
|
|
|
+// calendarResearcherUpdateParams["end_date"] = v.EndDate
|
|
|
+// calendarResearcherUpdateParams["start_time"] = v.StartTime
|
|
|
+// calendarResearcherUpdateParams["end_time"] = v.EndTime
|
|
|
+// calendarResearcherUpdateParams["start_week"] = v.StartWeek
|
|
|
+// calendarResearcherUpdateParams["end_week"] = v.EndWeek
|
|
|
+// calendarResearcherUpdateParams["refuse_reason"] = ""
|
|
|
+// calendarResearcherUpdateParams["refuse_time"] = nil
|
|
|
+// calendarResearcherUpdateParams["delete_reason"] = ""
|
|
|
+// calendarResearcherUpdateParams["approve_time"] = nil
|
|
|
+// calendarResearcherUpdateParams["researcher_sort"] = k + 1
|
|
|
+// calendarResearcherUpdateParams["modify_time"] = time.Now()
|
|
|
+// calendarResearcherUpdateParams["create_time"] = time.Now()
|
|
|
+//
|
|
|
+// err = roadshow.UpdateCalendarResearcher(calendarResearcherWhereParams, calendarResearcherUpdateParams)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "保存失败!UpdateCalendarResearcher:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if req.EditType == 2 {
|
|
|
+// //模板消息通知
|
|
|
+// go func() {
|
|
|
+// sysAdmin, _ := system.GetSysAdminById(v.ResearcherId)
|
|
|
+// if sysAdmin != nil && req.ActivityType != "内部会议" && req.ActivityType != "报告电话会" {
|
|
|
+// first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
|
|
|
+// keyword1 := sysUser.RealName
|
|
|
+// keyword2 := "--"
|
|
|
+// keyword3 := time.Now().Format(utils.FormatDateTime)
|
|
|
+// startDateSub := v.StartDate[5:]
|
|
|
+// startDateSub = strings.Replace(startDateSub, "-", ".", -1)
|
|
|
+// var keyword4 string
|
|
|
+// if req.ActivityType == "路演" {
|
|
|
+// keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// } else {
|
|
|
+// keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// }
|
|
|
+// remark := "请尽快完成审批"
|
|
|
+// wxAppPath := "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(req.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(rsCalendarResearcherItem.RsCalendarResearcherId)
|
|
|
+// openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
|
|
|
+// if len(openIdList) > 0 {
|
|
|
+// services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, openIdList)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// err = roadshow.DeleteRsCalendarResearcher(req.RsCalendarId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "保存失败!DeleteRsCalendarResearcher:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// for k, v := range req.ResearcherList {
|
|
|
+// researcher := new(roadshow.RsCalendarResearcher)
|
|
|
+// researcher.RsCalendarId = req.RsCalendarId
|
|
|
+// researcher.ResearcherId = v.ResearcherId
|
|
|
+// researcher.ResearcherName = v.ResearcherName
|
|
|
+// researcher.StartDate = v.StartDate
|
|
|
+// researcher.EndDate = v.EndDate
|
|
|
+// researcher.StartTime = v.StartTime
|
|
|
+// researcher.EndTime = v.EndTime
|
|
|
+// researcher.StartWeek = v.StartWeek
|
|
|
+// researcher.EndWeek = v.EndWeek
|
|
|
+// researcher.CreateTime = time.Now()
|
|
|
+// researcher.ModifyTime = time.Now()
|
|
|
+// researcher.ResearcherSort = k + 1
|
|
|
+// if req.ActivityType == "路演" || req.ActivityType == "公开会议" {
|
|
|
+// researcher.Status = 1
|
|
|
+// } else {
|
|
|
+// researcher.Status = 2
|
|
|
+// }
|
|
|
+// rsCalendarResearcherId, err := roadshow.AddRsCalendarResearcher(researcher)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败!"
|
|
|
+// br.ErrMsg = "保存日历活动-研究员信息失败!Err:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// go func() {
|
|
|
+// sysAdmin, _ := system.GetSysAdminById(v.ResearcherId)
|
|
|
+// if sysAdmin != nil && req.ActivityType != "内部会议" && req.ActivityType != "报告电话会" {
|
|
|
+// first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
|
|
|
+// keyword1 := sysUser.RealName
|
|
|
+// keyword2 := "--"
|
|
|
+// keyword3 := time.Now().Format(utils.FormatDateTime)
|
|
|
+// startDateSub := v.StartDate[5:]
|
|
|
+// startDateSub = strings.Replace(startDateSub, "-", ".", -1)
|
|
|
+// var keyword4 string
|
|
|
+// if req.ActivityType == "路演" {
|
|
|
+// keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// } else {
|
|
|
+// keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// }
|
|
|
+// remark := "请尽快完成审批"
|
|
|
+// wxAppPath := "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(req.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(int(rsCalendarResearcherId))
|
|
|
+// openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
|
|
|
+// if len(openIdList) > 0 {
|
|
|
+// services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, openIdList)
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }()
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //for k, v := range req.ResearcherList {
|
|
|
+// // rsCalendarResearcherItem, err := roadshow.GetRsCalendarResearcherById(req.RsCalendarResearcherId)
|
|
|
+// // var isAdd bool
|
|
|
+// // if err != nil {
|
|
|
+// // if err.Error() == utils.ErrNoRow() {
|
|
|
+// // isAdd = true
|
|
|
+// // } else {
|
|
|
+// // br.Msg = "获取数据失败!"
|
|
|
+// // br.ErrMsg = "获取数据失败!GetRsCalendarResearcherById:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // if rsCalendarResearcherItem == nil {
|
|
|
+// // isAdd = true
|
|
|
+// // }
|
|
|
+// // if _, ok := existResearcherMap[v.ResearcherId]; !ok {
|
|
|
+// // isAdd = true
|
|
|
+// // }
|
|
|
+// // fmt.Println("isAdd:", isAdd)
|
|
|
+// // if isAdd {
|
|
|
+// // exist, err := roadshow.GetRsCalendarResearcherExist(req.RsCalendarResearcherId, req.RsCalendarId, v.ResearcherId)
|
|
|
+// // if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+// // br.Msg = "保存失败!"
|
|
|
+// // br.ErrMsg = "保存失败!GetRsCalendarResearcherExist:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // if exist > 0 {
|
|
|
+// // br.Msg = "研究员 " + v.ResearcherName + " 已存在相同活动"
|
|
|
+// // br.ErrMsg = "研究员 " + v.ResearcherName + " 已存在相同活动"
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // researcher := new(roadshow.RsCalendarResearcher)
|
|
|
+// // researcher.RsCalendarId = req.RsCalendarId
|
|
|
+// // researcher.ResearcherId = v.ResearcherId
|
|
|
+// // researcher.ResearcherName = v.ResearcherName
|
|
|
+// // researcher.StartDate = v.StartDate
|
|
|
+// // researcher.EndDate = v.EndDate
|
|
|
+// // researcher.StartTime = v.StartTime
|
|
|
+// // researcher.EndTime = v.EndTime
|
|
|
+// // researcher.StartWeek = v.StartWeek
|
|
|
+// // researcher.EndWeek = v.EndWeek
|
|
|
+// // researcher.CreateTime = time.Now()
|
|
|
+// // researcher.ModifyTime = time.Now()
|
|
|
+// // researcher.ResearcherSort = k + 1
|
|
|
+// // if req.ActivityType == "路演" || req.ActivityType == "公开会议" {
|
|
|
+// // researcher.Status = 1
|
|
|
+// // } else {
|
|
|
+// // researcher.Status = 2
|
|
|
+// // }
|
|
|
+// // rsCalendarResearcherId, err := roadshow.AddRsCalendarResearcher(researcher)
|
|
|
+// // if err != nil {
|
|
|
+// // br.Msg = "保存失败!"
|
|
|
+// // br.ErrMsg = "保存日历活动-研究员信息失败!Err:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // //模板消息通知
|
|
|
+// // {
|
|
|
+// // sysAdmin, _ := system.GetSysAdminById(v.ResearcherId)
|
|
|
+// // if sysAdmin != nil && req.ActivityType != "内部会议" && req.ActivityType != "报告电话会" {
|
|
|
+// // first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
|
|
|
+// // keyword1 := sysUser.RealName
|
|
|
+// // keyword2 := "--"
|
|
|
+// // keyword3 := time.Now().Format(utils.FormatDateTime)
|
|
|
+// // startDateSub := v.StartDate[5:]
|
|
|
+// // startDateSub = strings.Replace(startDateSub, "-", ".", -1)
|
|
|
+// // var keyword4 string
|
|
|
+// // if req.ActivityType == "路演" {
|
|
|
+// // keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// // } else {
|
|
|
+// // keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// // }
|
|
|
+// // remark := "请尽快完成审批"
|
|
|
+// // wxAppPath := "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(req.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(int(rsCalendarResearcherId))
|
|
|
+// // openIdList, _ := models.GetOpenIdListByMobile(sysAdmin.Mobile)
|
|
|
+// // if len(openIdList) > 0 {
|
|
|
+// // go services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, openIdList)
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // } else {
|
|
|
+// // calendarResearcherWhereParams := make(map[string]interface{})
|
|
|
+// // calendarResearcherUpdateParams := make(map[string]interface{})
|
|
|
+// //
|
|
|
+// // calendarResearcherWhereParams["rs_calendar_researcher_id"] = req.RsCalendarResearcherId
|
|
|
+// //
|
|
|
+// // exist, err := roadshow.GetRsCalendarResearcherExist(req.RsCalendarResearcherId, req.RsCalendarId, v.ResearcherId)
|
|
|
+// // if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+// // br.Msg = "保存失败!"
|
|
|
+// // br.ErrMsg = "保存失败!GetRsCalendarResearcherExist:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // if exist > 0 {
|
|
|
+// // br.Msg = "研究员 " + v.ResearcherName + " 已存在相同活动"
|
|
|
+// // br.ErrMsg = "研究员 " + v.ResearcherName + " 已存在相同活动"
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // calendarResearcherUpdateParams["researcher_id"] = v.ResearcherId
|
|
|
+// // calendarResearcherUpdateParams["researcher_name"] = v.ResearcherName
|
|
|
+// //
|
|
|
+// // if rsCalendarResearcherItem.Status == 3 || rsCalendarResearcherItem.Status == 5 {
|
|
|
+// // calendarResearcherUpdateParams["status"] = 1
|
|
|
+// // }
|
|
|
+// // calendarResearcherUpdateParams["start_date"] = v.StartDate
|
|
|
+// // calendarResearcherUpdateParams["end_date"] = v.EndDate
|
|
|
+// // calendarResearcherUpdateParams["start_time"] = v.StartTime
|
|
|
+// // calendarResearcherUpdateParams["end_time"] = v.EndTime
|
|
|
+// // calendarResearcherUpdateParams["start_week"] = v.StartWeek
|
|
|
+// // calendarResearcherUpdateParams["end_week"] = v.EndWeek
|
|
|
+// // calendarResearcherUpdateParams["refuse_reason"] = ""
|
|
|
+// // calendarResearcherUpdateParams["refuse_time"] = nil
|
|
|
+// // calendarResearcherUpdateParams["delete_reason"] = ""
|
|
|
+// // calendarResearcherUpdateParams["approve_time"] = nil
|
|
|
+// // calendarResearcherUpdateParams["researcher_sort"] = k + 1
|
|
|
+// // calendarResearcherUpdateParams["modify_time"] = time.Now()
|
|
|
+// // calendarResearcherUpdateParams["create_time"] = time.Now()
|
|
|
+// //
|
|
|
+// // err = roadshow.UpdateCalendarResearcher(calendarResearcherWhereParams, calendarResearcherUpdateParams)
|
|
|
+// // if err != nil {
|
|
|
+// // br.Msg = "保存失败!"
|
|
|
+// // br.ErrMsg = "保存失败!UpdateCalendarResearcher:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // if req.EditType == 2 {
|
|
|
+// // //模板消息通知
|
|
|
+// // {
|
|
|
+// // sysAdmin, _ := system.GetSysAdminById(v.ResearcherId)
|
|
|
+// // if sysAdmin != nil && req.ActivityType != "内部会议" && req.ActivityType != "报告电话会" {
|
|
|
+// // first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
|
|
|
+// // keyword1 := sysUser.RealName
|
|
|
+// // keyword2 := "--"
|
|
|
+// // keyword3 := time.Now().Format(utils.FormatDateTime)
|
|
|
+// // startDateSub := v.StartDate[5:]
|
|
|
+// // startDateSub = strings.Replace(startDateSub, "-", ".", -1)
|
|
|
+// // var keyword4 string
|
|
|
+// // if req.ActivityType == "路演" {
|
|
|
+// // keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// // } else {
|
|
|
+// // keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
|
|
|
+// // }
|
|
|
+// // remark := "请尽快完成审批"
|
|
|
+// // wxAppPath := "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(req.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(rsCalendarResearcherItem.RsCalendarResearcherId)
|
|
|
+// // openIdList, _ := models.GetOpenIdListByMobile(sysAdmin.Mobile)
|
|
|
+// // if len(openIdList) > 0 {
|
|
|
+// // go services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, openIdList)
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // }
|
|
|
+// // newResearcherMap[v.ResearcherId] = v.ResearcherName
|
|
|
+// //}
|
|
|
+// //处理删除情况
|
|
|
+// //{
|
|
|
+// // if req.EditType == 1 {
|
|
|
+// // researchList, err := roadshow.GetRsCalendarResearcherListByRsCalendarId(req.RsCalendarId)
|
|
|
+// // if err != nil {
|
|
|
+// // br.Msg = "保存失败!"
|
|
|
+// // br.ErrMsg = "保存失败!UpdateCalendarResearcher:" + err.Error()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// // for _, ev := range researchList {
|
|
|
+// // if _, ok := newResearcherMap[ev.ResearcherId]; !ok {
|
|
|
+// // roadshow.DeleteCalendar(req.RsCalendarId, ev.RsCalendarResearcherId)
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// //}
|
|
|
+// br.Ret = 200
|
|
|
+// br.Success = true
|
|
|
+// br.Msg = "保存成功"
|
|
|
+// br.IsAddLog = true
|
|
|
+//}
|