|
@@ -63,6 +63,7 @@ func ScheduleApiRegistRouters() {
|
63
|
63
|
|
64
|
64
|
beego.Router("/api/schedule/weekpanelone", &ScheduleApiController{}, "Get:GetWeekPanelsOne")
|
65
|
65
|
beego.Router("/api/schedule/schedulesone", &ScheduleApiController{}, "Get:GetScheduleOne")
|
|
66
|
+ beego.Router("/api/schedule/scheduletwo", &ScheduleApiController{}, "Get:GetScheduleTwo")
|
66
|
67
|
beego.Router("/api/schedule/postscheduletemplate", &ScheduleApiController{}, "Get:SaveScheduleTemplate")
|
67
|
68
|
beego.Router("/api/schedule/getscheduletemplate", &ScheduleApiController{}, "Get:GetScheduleTemplate")
|
68
|
69
|
beego.Router("/api/order/changefuncprint", &ScheduleApiController{}, "Get:ChangeFuncPrint")
|
|
@@ -3994,6 +3995,72 @@ func (c *ScheduleApiController) GetScheduleOne() {
|
3994
|
3995
|
return
|
3995
|
3996
|
}
|
3996
|
3997
|
|
|
3998
|
+func (c *ScheduleApiController) GetScheduleTwo() {
|
|
3999
|
+
|
|
4000
|
+ week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
|
|
4001
|
+ patitionIdStr := c.GetString("patitionid")
|
|
4002
|
+
|
|
4003
|
+ ids := strings.Split(patitionIdStr, ",")
|
|
4004
|
+
|
|
4005
|
+ schedule_type, _ := c.GetInt64("schedule_type")
|
|
4006
|
+
|
|
4007
|
+ adminInfo := c.GetAdminUserInfo()
|
|
4008
|
+ weekDateStr := c.GetString("week_date")
|
|
4009
|
+ WeekDayIds := strings.Split(weekDateStr, ",")
|
|
4010
|
+
|
|
4011
|
+ thisTime := time.Now()
|
|
4012
|
+ today := thisTime.Format("2006-01-02")
|
|
4013
|
+ if week < 1 || week > 4 {
|
|
4014
|
+ week = 2
|
|
4015
|
+ }
|
|
4016
|
+ if week == 1 {
|
|
4017
|
+ thisTime = thisTime.AddDate(0, 0, -7)
|
|
4018
|
+ } else if week == 3 {
|
|
4019
|
+ thisTime = thisTime.AddDate(0, 0, 7)
|
|
4020
|
+ } else if week == 4 {
|
|
4021
|
+ thisTime = thisTime.AddDate(0, 0, 14)
|
|
4022
|
+ }
|
|
4023
|
+
|
|
4024
|
+ weekDay := int(thisTime.Weekday())
|
|
4025
|
+ if weekDay == 0 {
|
|
4026
|
+ weekDay = 7
|
|
4027
|
+ }
|
|
4028
|
+ weekEnd := 7 - weekDay
|
|
4029
|
+ weekStart := weekEnd - 6
|
|
4030
|
+ weekTitle := make([]string, 0)
|
|
4031
|
+ days := make([]string, 0)
|
|
4032
|
+ for index := weekStart; index <= weekEnd; index++ {
|
|
4033
|
+ theDay := thisTime.AddDate(0, 0, index)
|
|
4034
|
+ indexYear, indexMonthTime, indexDay := theDay.Date()
|
|
4035
|
+ indexMonth := int(indexMonthTime)
|
|
4036
|
+ indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
|
|
4037
|
+ weekTitle = append(weekTitle, indexWeek)
|
|
4038
|
+ days = append(days, theDay.Format("2006-01-02"))
|
|
4039
|
+ }
|
|
4040
|
+
|
|
4041
|
+ weekStartDay := thisTime.AddDate(0, 0, weekStart)
|
|
4042
|
+ weekEndDay := thisTime.AddDate(0, 0, weekEnd)
|
|
4043
|
+ weekStartTime := weekStartDay.Format("2006-01-02") + " 00:00:00"
|
|
4044
|
+ weekEndTime := weekEndDay.Format("2006-01-02") + " 23:59:59"
|
|
4045
|
+
|
|
4046
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
4047
|
+ loc, _ := time.LoadLocation("Local")
|
|
4048
|
+ theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
|
|
4049
|
+ theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
|
|
4050
|
+ weekStartPoint := theStarTime.Unix()
|
|
4051
|
+ weekEndPoint := theEndTime.Unix()
|
|
4052
|
+
|
|
4053
|
+ schdules, _ := service.GetWeekScheduleThree(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type, WeekDayIds)
|
|
4054
|
+
|
|
4055
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4056
|
+ "days": days,
|
|
4057
|
+ "weekTitle": weekTitle,
|
|
4058
|
+ "schdules": schdules,
|
|
4059
|
+ "today": today,
|
|
4060
|
+ })
|
|
4061
|
+ return
|
|
4062
|
+}
|
|
4063
|
+
|
3997
|
4064
|
func (c *ScheduleApiController) SaveScheduleTemplate() {
|
3998
|
4065
|
|
3999
|
4066
|
template_id, _ := c.GetInt64("template_id")
|
|
@@ -4043,7 +4110,6 @@ func (c *ScheduleApiController) ChangeFuncPrint() {
|
4043
|
4110
|
}
|
4044
|
4111
|
|
4045
|
4112
|
_, errcode := service.GetDataPrintByOrgId(orgId)
|
4046
|
|
- fmt.Println("errcode222234444555556t66", errcode)
|
4047
|
4113
|
if errcode == gorm.ErrRecordNotFound {
|
4048
|
4114
|
service.CreateDataPrint(&dataPrint)
|
4049
|
4115
|
c.ServeSuccessJSON(map[string]interface{}{
|