123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package roadshow
- import (
- "fmt"
- "hongze/hongze_task/models/roadshow"
- "hongze/hongze_task/utils"
- "strconv"
- "time"
- "context"
- )
- func SetPublicMeetingUnionCode(cont context.Context)(err error) {
- now:=time.Now().Format(utils.FormatDate)
- list, err := roadshow.GetPublicMeetingList(now)
- if err != nil {
- return
- }
- for _, v := range list {
- calendarResearchItem, err := roadshow.GetRsCalendarResearcherById(v.RsCalendarResearcherId)
- if err != nil {
- fmt.Println("GetRsCalendarById Err:" + err.Error())
- return
- }
- if calendarResearchItem == nil {
- continue
- }
- if calendarResearchItem.UnionCode != "" {
- continue
- }
- //生成当前公开会议联合编码
- unionCodeStr := strconv.Itoa(v.RsCalendarId) + "_" + strconv.Itoa(int(time.Now().Unix()))
- unionCode := utils.MD5(unionCodeStr)
- err = roadshow.ModifyCalendarUnionCode(unionCode, v.RsCalendarId)
- if err != nil {
- fmt.Println("ModifyCalendarUnionCode Err:" + err.Error())
- return
- }
- startDateTime := v.StartDate + " " + v.StartTime
- endDateTime := v.EndDate + " " + v.EndTime
- coincideList, err := roadshow.GetCoincideMeeting(startDateTime, endDateTime)
- if err != nil {
- return
- }
- for _, cv := range coincideList {
- err = roadshow.ModifyCalendarUnionCode(unionCode, cv.RsCalendarId)
- if err != nil {
- fmt.Println("ModifyCalendarUnionCode Err:" + err.Error())
- return
- }
- }
- }
- return
- }
|