You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
530 lines
16 KiB
530 lines
16 KiB
|
4 days ago
|
package customerApp
|
||
|
|
|
||
|
|
import (
|
||
|
|
"appPlatform/models/modelshr"
|
||
|
|
"appPlatform/models/modelssystempermission"
|
||
|
|
"appPlatform/models/teamlog"
|
||
|
|
"appPlatform/overall"
|
||
|
|
"appPlatform/overall/publicmethod"
|
||
|
|
"fmt"
|
||
|
|
"sort"
|
||
|
|
"strconv"
|
||
|
|
"strings"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
// var paichu = []int64{163, 281, 319}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-11 15:33:40
|
||
|
|
@ 功能: 初始化排版页面
|
||
|
|
*/
|
||
|
|
func (a *ApiMethod) TestCompanyDutyInit(c *gin.Context) {
|
||
|
|
context, _ := c.Get(overall.MyContJwt)
|
||
|
|
var userCont modelshr.ManCont
|
||
|
|
userCont.GetLoginCont(context) //当前操作人
|
||
|
|
sendData := publicmethod.MapOut[string]()
|
||
|
|
|
||
|
|
sendData["currentOrg"] = userCont.Company
|
||
|
|
var orgCurre modelshr.AdministrativeOrganization
|
||
|
|
// orgCurre.GetCont(map[string]interface{}{"`id`": userCont.Company}, "`name`")
|
||
|
|
overall.CONSTANT_DB_HrInside.Model(&orgCurre).Select("`name`").Where("`id` = ?", userCont.Company).First(&orgCurre)
|
||
|
|
|
||
|
|
currentTime := time.Now().Unix()
|
||
|
|
yearVal := publicmethod.UnixTimeToDay(currentTime, 16)
|
||
|
|
yearValInt, _ := strconv.Atoi(yearVal)
|
||
|
|
monthVal := publicmethod.UnixTimeToDay(currentTime, 17)
|
||
|
|
monthValInt, _ := strconv.Atoi(monthVal)
|
||
|
|
currentDay := int(time.Now().Day())
|
||
|
|
sendData["title"] = fmt.Sprintf("%v.%v.%v%v值班表", yearVal, monthVal, currentDay, orgCurre.Name)
|
||
|
|
sendData["titlePc"] = fmt.Sprintf("%v年%v月%v值班表", yearVal, monthVal, orgCurre.Name)
|
||
|
|
sendData["year"] = yearValInt
|
||
|
|
sendData["month"] = monthValInt
|
||
|
|
|
||
|
|
endTime := publicmethod.GetDaysInMonth(yearValInt, monthValInt)
|
||
|
|
monthEndDay, _ := strconv.Atoi(endTime.Days)
|
||
|
|
var monthAllDay []string
|
||
|
|
for i := 1; i <= monthEndDay; i++ {
|
||
|
|
monthAllDay = append(monthAllDay, fmt.Sprintf("%v日", i))
|
||
|
|
}
|
||
|
|
|
||
|
|
//角色权限范围判定
|
||
|
|
//1:本岗位;2:本部门;3:本分部;4:指定行政组织;5:所有
|
||
|
|
switch SearchRoleLevev(userCont.Role) {
|
||
|
|
case 5:
|
||
|
|
sendData["orgLevel"] = 5
|
||
|
|
sendData["orgList"] = GetOrgLevel(313, 1)
|
||
|
|
case 4:
|
||
|
|
sendData["orgLevel"] = 4
|
||
|
|
sendData["orgList"] = GetOrgLevel(userCont.Company, 1)
|
||
|
|
case 3:
|
||
|
|
sendData["orgLevel"] = 3
|
||
|
|
sendData["orgList"] = GetOrgLevel(userCont.MainDeparment, 2)
|
||
|
|
case 2:
|
||
|
|
sendData["orgLevel"] = 2
|
||
|
|
sendData["orgList"] = GetOrgLevel(userCont.MainDeparment, 2)
|
||
|
|
case 1:
|
||
|
|
sendData["orgLevel"] = 1
|
||
|
|
sendData["orgList"] = GetOrgLevel(userCont.MainDeparment, 2)
|
||
|
|
default:
|
||
|
|
}
|
||
|
|
|
||
|
|
sendData["currentDay"] = currentDay
|
||
|
|
// sendData["endTime"] = endTime
|
||
|
|
sendData["monthAllDay"] = monthAllDay
|
||
|
|
publicmethod.Result(0, sendData, c)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取行政组织层级
|
||
|
|
func TestGetOrgLevel(partenId int64, types int) (orgList []GaveOrgAry) {
|
||
|
|
|
||
|
|
gormDb := overall.CONSTANT_DB_HrInside.Model(&GaveOrgAry{}).Where("`state` = 1")
|
||
|
|
if types == 1 {
|
||
|
|
gormDb = gormDb.Where("`superior` = ?", partenId)
|
||
|
|
} else {
|
||
|
|
gormDb = gormDb.Where("`id` = ?", partenId)
|
||
|
|
}
|
||
|
|
gormDb.Order("`sort` ASC").Find(&orgList)
|
||
|
|
sort.Slice(orgList, func(i, j int) bool {
|
||
|
|
return orgList[i].Sort < orgList[j].Sort
|
||
|
|
})
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取最大查询范围
|
||
|
|
func TestSearchRoleLevev(roles string) (level int) {
|
||
|
|
roleList := strings.Split(roles, ",")
|
||
|
|
var roleVerify []modelssystempermission.RoleEmpower
|
||
|
|
overall.CONSTANT_DB_System_Permission.Where("`state` = 1 AND `system` = ? AND `id` IN ? ", "appsystem", roleList).Find(&roleVerify)
|
||
|
|
for _, v := range roleVerify {
|
||
|
|
if v.Level >= level {
|
||
|
|
level = v.Level
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-12 08:36:19
|
||
|
|
@ 功能: 获取根据年月获取排班目录表
|
||
|
|
*/
|
||
|
|
func (a *ApiMethod) TestGetYearMonthWorkMan(c *gin.Context) {
|
||
|
|
var requestData PaiBanInfo
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.OrgId == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知行政组织!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
currentTime := time.Now().Unix()
|
||
|
|
yearVal := publicmethod.UnixTimeToDay(currentTime, 16)
|
||
|
|
yearValInt, _ := strconv.Atoi(yearVal)
|
||
|
|
monthVal := publicmethod.UnixTimeToDay(currentTime, 17)
|
||
|
|
monthValInt, _ := strconv.Atoi(monthVal)
|
||
|
|
if requestData.Years != 0 {
|
||
|
|
yearValInt = requestData.Years
|
||
|
|
}
|
||
|
|
if requestData.Months != 0 {
|
||
|
|
monthValInt = requestData.Months
|
||
|
|
}
|
||
|
|
endTime := publicmethod.GetDaysInMonth(yearValInt, monthValInt)
|
||
|
|
monthEndDay, _ := strconv.Atoi(endTime.Days)
|
||
|
|
|
||
|
|
sendCenter := publicmethod.MapOut[string]()
|
||
|
|
var currOrgInfo GaveOrgAry
|
||
|
|
currOrgInfo.GetCont(map[string]interface{}{"`id`": requestData.OrgId}, "`name`")
|
||
|
|
sendCenter["title"] = fmt.Sprintf("%v年%v月%v", yearVal, monthValInt, currOrgInfo.Name)
|
||
|
|
sendCenter["orgId"] = requestData.OrgId
|
||
|
|
|
||
|
|
var sendData []SendCompanyWork
|
||
|
|
var orgList []GaveOrgAry
|
||
|
|
|
||
|
|
if requestData.OrgId == 309 {
|
||
|
|
var gsdaban GaveOrgAry
|
||
|
|
gsdaban.Id = requestData.OrgId * 10000
|
||
|
|
gsdaban.Name = "公司带班"
|
||
|
|
gsdaban.IsCompany = 1
|
||
|
|
orgList = append(orgList, gsdaban)
|
||
|
|
var gszhiban GaveOrgAry
|
||
|
|
gszhiban.Id = requestData.OrgId*10000 + 1
|
||
|
|
gszhiban.Name = "公司值班"
|
||
|
|
gszhiban.IsCompany = 1
|
||
|
|
orgList = append(orgList, gszhiban)
|
||
|
|
} else {
|
||
|
|
var gsld GaveOrgAry
|
||
|
|
gsld.Id = requestData.OrgId * 10000
|
||
|
|
gsld.Name = "公司值班"
|
||
|
|
gsld.IsCompany = 1
|
||
|
|
orgList = append(orgList, gsld)
|
||
|
|
}
|
||
|
|
orgListAry := GetOrgLevel(requestData.OrgId, 1)
|
||
|
|
orgList = append(orgList, orgListAry...)
|
||
|
|
for _, v := range orgList {
|
||
|
|
if !publicmethod.IsInTrue[int64](v.Id, paichu) {
|
||
|
|
var sendInfo SendCompanyWork
|
||
|
|
sendInfo.OrgInfo.Id = v.Id
|
||
|
|
sendInfo.OrgInfo.Name = v.Name
|
||
|
|
sendInfo.OrgInfo.IsCompany = v.IsCompany
|
||
|
|
var comLog []teamlog.Companylog
|
||
|
|
overall.CONSTANT_DB_TeamsLog.Where("`orgid` = ? AND `years` = ? AND `months` = ?", v.Id, yearValInt, monthValInt).Find(&comLog)
|
||
|
|
sendInfo.DutyList = GetOrgParWork(comLog, yearValInt, monthValInt, monthEndDay)
|
||
|
|
sendData = append(sendData, sendInfo)
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
sendCenter["list"] = sendData
|
||
|
|
publicmethod.Result(0, sendCenter, c)
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestGetOrgParWork(comLog []teamlog.Companylog, yearValInt, monthValInt, monthEndDay int) (DutyList []DutyListStruct) {
|
||
|
|
for i := 1; i <= monthEndDay; i++ {
|
||
|
|
var dayWorkMan DutyListStruct
|
||
|
|
|
||
|
|
dayWorkMan.Years = yearValInt
|
||
|
|
dayWorkMan.Months = monthValInt
|
||
|
|
dayWorkMan.Days = i
|
||
|
|
for _, v := range comLog {
|
||
|
|
if i == v.Days {
|
||
|
|
dayWorkMan.Id = v.ID
|
||
|
|
dayWorkMan.Holiday = v.Holiday
|
||
|
|
dayWorkMan.AllDay = GetMAnInfo(v.AllDay, yearValInt, monthValInt, i)
|
||
|
|
dayWorkMan.BaiTian = GetMAnInfo(v.BaiTian, yearValInt, monthValInt, i)
|
||
|
|
dayWorkMan.Night = GetMAnInfo(v.Night, yearValInt, monthValInt, i)
|
||
|
|
dayWorkMan.Morning = GetMAnInfo(v.Morning, yearValInt, monthValInt, i)
|
||
|
|
dayWorkMan.Afternoon = GetMAnInfo(v.Afternoon, yearValInt, monthValInt, i)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
DutyList = append(DutyList, dayWorkMan)
|
||
|
|
}
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-12 10:11:10
|
||
|
|
@ 功能: 值班人员信息
|
||
|
|
*/
|
||
|
|
func TestGetMAnInfo(userKey string) (userList []UserCentor) {
|
||
|
|
if userKey != "" {
|
||
|
|
userAry := strings.Split(userKey, ",")
|
||
|
|
if len(userAry) > 0 {
|
||
|
|
var man []modelshr.ManCont
|
||
|
|
|
||
|
|
overall.CONSTANT_DB_HrInside.Model(&modelshr.ManCont{}).Select("`id`,`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`state` = 1 AND `emp_type` BETWEEN ? AND ? AND `key` IN ?", 1, 10, userAry).Find(&man)
|
||
|
|
for _, v := range man {
|
||
|
|
var userInfo UserCentor
|
||
|
|
userInfo.Id = strconv.FormatInt(v.Id, 10)
|
||
|
|
userInfo.UserKey = strconv.FormatInt(v.Key, 10)
|
||
|
|
userInfo.Coder = v.Number
|
||
|
|
userInfo.Name = v.Name
|
||
|
|
userInfo.Icon = v.Icon
|
||
|
|
if v.IconPhpto != "" {
|
||
|
|
userInfo.Icon = v.IconPhpto
|
||
|
|
}
|
||
|
|
userInfo.Wechat = v.Wechat
|
||
|
|
userInfo.WorkWechat = v.WorkWechat
|
||
|
|
userInfo.Tel = v.Mobilephone
|
||
|
|
userInfo.Gender = v.Gender
|
||
|
|
userList = append(userList, userInfo)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 根据行政组织获取人员信息
|
||
|
|
func (a *ApiMethod) TestGeiOrgAllPeople(c *gin.Context) {
|
||
|
|
var requestData GetOrgPeopel
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.OrgId == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知行政组织!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.IsAll == 0 {
|
||
|
|
requestData.IsAll = 1
|
||
|
|
}
|
||
|
|
if requestData.IsAll == 1 {
|
||
|
|
var sunOrg publicmethod.GetOrgAllParent
|
||
|
|
sunOrg.GetOrgSunNei(requestData.OrgId)
|
||
|
|
sunOrg.Id = append(sunOrg.Id, requestData.OrgId)
|
||
|
|
var userList []UserCentor
|
||
|
|
if len(sunOrg.Id) > 0 {
|
||
|
|
var man []modelshr.ManCont
|
||
|
|
overall.CONSTANT_DB_HrInside.Model(&modelshr.ManCont{}).Select("`id`,`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`state` = 1 AND `emp_type` BETWEEN ? AND ? AND `admin_org` IN ?", 1, 10, sunOrg.Id).Find(&man)
|
||
|
|
for _, v := range man {
|
||
|
|
var userInfo UserCentor
|
||
|
|
userInfo.Id = strconv.FormatInt(v.Id, 10)
|
||
|
|
userInfo.UserKey = strconv.FormatInt(v.Key, 10)
|
||
|
|
userInfo.Coder = v.Number
|
||
|
|
userInfo.Name = fmt.Sprintf("%v(%v)", v.Name, v.Number)
|
||
|
|
userInfo.Icon = v.Icon
|
||
|
|
if v.IconPhpto != "" {
|
||
|
|
userInfo.Icon = v.IconPhpto
|
||
|
|
}
|
||
|
|
userInfo.Wechat = v.Wechat
|
||
|
|
userInfo.WorkWechat = v.WorkWechat
|
||
|
|
userInfo.Tel = v.Mobilephone
|
||
|
|
userInfo.Gender = v.Gender
|
||
|
|
userList = append(userList, userInfo)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
publicmethod.Result(0, userList, c)
|
||
|
|
} else {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-13 08:42:32
|
||
|
|
@ 功能: 编辑值班信息
|
||
|
|
*/
|
||
|
|
func (a *ApiMethod) TestSaveEditDutyInfo(c *gin.Context) {
|
||
|
|
var requestData DutyOrgInfo
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.Orgid == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知行政组织!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.Years == 0 || requestData.Months == 0 || requestData.Days == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知时间安排!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
holiday := 2
|
||
|
|
if requestData.Holiday != "" {
|
||
|
|
holiday, _ = strconv.Atoi(requestData.Holiday)
|
||
|
|
if holiday == 0 {
|
||
|
|
holiday = 2
|
||
|
|
}
|
||
|
|
}
|
||
|
|
isAdd := true
|
||
|
|
monthval := fmt.Sprintf("%v", requestData.Months)
|
||
|
|
if requestData.Months < 10 {
|
||
|
|
monthval = fmt.Sprintf("0%v", requestData.Months)
|
||
|
|
}
|
||
|
|
daysval := fmt.Sprintf("%v", requestData.Days)
|
||
|
|
if requestData.Days < 10 {
|
||
|
|
daysval = fmt.Sprintf("0%v", requestData.Days)
|
||
|
|
}
|
||
|
|
timeStr := fmt.Sprintf("%v-%v-%v 12:00:00", requestData.Years, monthval, daysval)
|
||
|
|
var timeVal publicmethod.DateTimeTotimes
|
||
|
|
timeVal.BaisStrToTime(timeStr)
|
||
|
|
if requestData.Id != 0 {
|
||
|
|
var oldDutyCont teamlog.Companylog
|
||
|
|
err = oldDutyCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
|
||
|
|
if err == nil {
|
||
|
|
isAdd = false
|
||
|
|
saveEitd := publicmethod.MapOut[string]()
|
||
|
|
saveEitd["`holiday`"] = holiday
|
||
|
|
saveEitd["allDay"] = strings.Join(requestData.AllDay, ",")
|
||
|
|
saveEitd["baiTian"] = strings.Join(requestData.BaiTian, ",")
|
||
|
|
saveEitd["night"] = strings.Join(requestData.Night, ",")
|
||
|
|
saveEitd["morning"] = strings.Join(requestData.Morning, ",")
|
||
|
|
saveEitd["afternoon"] = strings.Join(requestData.Afternoon, ",")
|
||
|
|
saveEitd["saveTime"] = time.Now().Unix()
|
||
|
|
var newDutyCont teamlog.Companylog
|
||
|
|
err = newDutyCont.EiteCont(map[string]interface{}{"`id`": requestData.Id}, saveEitd)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(106, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if isAdd {
|
||
|
|
var saveConter teamlog.Companylog
|
||
|
|
saveConter.Orgid = requestData.Orgid // 行政组织ID
|
||
|
|
saveConter.RunTime = timeVal.AllTime // 执行时间
|
||
|
|
saveConter.Years = requestData.Years // 年
|
||
|
|
saveConter.Months = requestData.Months // 月
|
||
|
|
saveConter.Days = requestData.Days // 日
|
||
|
|
saveConter.Holiday = holiday // 假日(1:是;2:否)
|
||
|
|
saveConter.AllDay = strings.Join(requestData.AllDay, ",") // 全天值班人员
|
||
|
|
saveConter.BaiTian = strings.Join(requestData.BaiTian, ",") // 白天值班人员
|
||
|
|
saveConter.Night = strings.Join(requestData.Night, ",") // 夜晚值班人员
|
||
|
|
saveConter.Morning = strings.Join(requestData.Morning, ",") // 夜晚值班人员
|
||
|
|
saveConter.Afternoon = strings.Join(requestData.Afternoon, ",") // 夜晚值班人员
|
||
|
|
saveConter.SaveTime = time.Now().Unix() // 编辑时间
|
||
|
|
err = overall.CONSTANT_DB_TeamsLog.Create(&saveConter).Error
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(106, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
}
|
||
|
|
publicmethod.Result(0, err, c)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 根据日期获取行政组织排班列表
|
||
|
|
func (a *ApiMethod) TestGeyOneDayDuty(c *gin.Context) {
|
||
|
|
var requestData OenDayDuty
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.OrgId == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知行政组织!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
currentTime := time.Now().Unix()
|
||
|
|
yearVal := publicmethod.UnixTimeToDay(currentTime, 16)
|
||
|
|
yearValInt, _ := strconv.Atoi(yearVal)
|
||
|
|
monthVal := publicmethod.UnixTimeToDay(currentTime, 17)
|
||
|
|
monthValInt, _ := strconv.Atoi(monthVal)
|
||
|
|
dayhVal := publicmethod.UnixTimeToDay(currentTime, 18)
|
||
|
|
dayhValInt, _ := strconv.Atoi(dayhVal)
|
||
|
|
if requestData.Years != 0 {
|
||
|
|
yearValInt = requestData.Years
|
||
|
|
}
|
||
|
|
if requestData.Months != 0 {
|
||
|
|
monthValInt = requestData.Months
|
||
|
|
}
|
||
|
|
if requestData.Days != 0 {
|
||
|
|
dayhValInt = requestData.Days
|
||
|
|
}
|
||
|
|
sendCenter := publicmethod.MapOut[string]()
|
||
|
|
var currOrgInfo GaveOrgAry
|
||
|
|
// currOrgInfo.GetCont(map[string]interface{}{"`id`": requestData.OrgId}, "`name`")
|
||
|
|
overall.CONSTANT_DB_HrInside.Model(&currOrgInfo).Select("`name`").Where("`id` = ?", requestData.OrgId).First(&currOrgInfo)
|
||
|
|
sendCenter["title"] = fmt.Sprintf("%v.%v.%v%v", yearVal, monthValInt, dayhValInt, currOrgInfo.Name)
|
||
|
|
sendCenter["orgId"] = requestData.OrgId
|
||
|
|
var orgList []GaveOrgAry
|
||
|
|
|
||
|
|
if requestData.OrgId == 309 {
|
||
|
|
var gsdaban GaveOrgAry
|
||
|
|
gsdaban.Id = requestData.OrgId * 10000
|
||
|
|
gsdaban.Name = "公司带班"
|
||
|
|
gsdaban.IsCompany = 1
|
||
|
|
orgList = append(orgList, gsdaban)
|
||
|
|
var gszhiban GaveOrgAry
|
||
|
|
gszhiban.Id = requestData.OrgId*10000 + 1
|
||
|
|
gszhiban.Name = "公司值班"
|
||
|
|
gsdaban.IsCompany = 1
|
||
|
|
orgList = append(orgList, gszhiban)
|
||
|
|
} else {
|
||
|
|
var gsld GaveOrgAry
|
||
|
|
gsld.Id = requestData.OrgId * 10000
|
||
|
|
gsld.Name = "公司值班"
|
||
|
|
gsld.IsCompany = 1
|
||
|
|
orgList = append(orgList, gsld)
|
||
|
|
}
|
||
|
|
orgListAry := GetOrgLevel(requestData.OrgId, 1)
|
||
|
|
orgList = append(orgList, orgListAry...)
|
||
|
|
|
||
|
|
var sendData []WebSendTo
|
||
|
|
for _, v := range orgList {
|
||
|
|
if !publicmethod.IsInTrue[int64](v.Id, paichu) {
|
||
|
|
var sendInfo WebSendTo
|
||
|
|
sendInfo.OrgId = v.Id
|
||
|
|
sendInfo.OrgName = v.Name
|
||
|
|
sendInfo.IsCompany = v.IsCompany
|
||
|
|
var comLog teamlog.Companylog
|
||
|
|
err = overall.CONSTANT_DB_TeamsLog.Where("`orgid` = ? AND `years` = ? AND `months` = ? AND `days` = ?", v.Id, yearValInt, monthValInt, dayhValInt).First(&comLog).Error
|
||
|
|
if err == nil {
|
||
|
|
sendInfo.Id = strconv.FormatInt(comLog.ID, 10)
|
||
|
|
sendInfo.Holiday = comLog.Holiday
|
||
|
|
sendInfo.AllDay = GetMAnInfo(comLog.AllDay, yearValInt, monthValInt, dayhValInt)
|
||
|
|
sendInfo.BaiTian = GetMAnInfo(comLog.BaiTian, yearValInt, monthValInt, dayhValInt)
|
||
|
|
sendInfo.Night = GetMAnInfo(comLog.Night, yearValInt, monthValInt, dayhValInt)
|
||
|
|
sendInfo.Morning = GetMAnInfo(comLog.Morning, yearValInt, monthValInt, dayhValInt)
|
||
|
|
sendInfo.Afternoon = GetMAnInfo(comLog.Afternoon, yearValInt, monthValInt, dayhValInt)
|
||
|
|
sendData = append(sendData, sendInfo)
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
sendCenter["list"] = sendData
|
||
|
|
publicmethod.Result(0, sendCenter, c)
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-13 21:24:02
|
||
|
|
@ 功能: 清空日期值班
|
||
|
|
*/
|
||
|
|
func (a *ApiMethod) TestDelOneDayDuty(c *gin.Context) {
|
||
|
|
var requestData publicmethod.CommonId[int64]
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.Id == 0 {
|
||
|
|
publicmethod.Result(1, err, c, "未知删除项目!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
var comLog teamlog.Companylog
|
||
|
|
err = comLog.DelCont(map[string]interface{}{"`id`": requestData.Id})
|
||
|
|
publicmethod.Result(0, err, c)
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-08-14 11:20:51
|
||
|
|
@ 功能: 获取排版信息
|
||
|
|
*/
|
||
|
|
func (a *ApiMethod) TestGetDutyCont(c *gin.Context) {
|
||
|
|
var requestData publicmethod.PublicId
|
||
|
|
err := c.ShouldBindJSON(&requestData)
|
||
|
|
if err != nil {
|
||
|
|
publicmethod.Result(100, err, c)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if requestData.Id == "" {
|
||
|
|
publicmethod.Result(1, err, c, "未知项目!")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
var comLog CompanyDutyCont
|
||
|
|
comLog.GetCont(map[string]interface{}{"`id`": requestData.Id})
|
||
|
|
if comLog.AllDay != "" {
|
||
|
|
comLog.AllDayAry = strings.Split(comLog.AllDay, ",")
|
||
|
|
} else {
|
||
|
|
comLog.AllDayAry = []string{}
|
||
|
|
}
|
||
|
|
if comLog.BaiTian != "" {
|
||
|
|
comLog.BaiTianAry = strings.Split(comLog.BaiTian, ",")
|
||
|
|
} else {
|
||
|
|
comLog.BaiTianAry = []string{}
|
||
|
|
}
|
||
|
|
if comLog.Night != "" {
|
||
|
|
comLog.NightAry = strings.Split(comLog.Night, ",")
|
||
|
|
} else {
|
||
|
|
comLog.NightAry = []string{}
|
||
|
|
}
|
||
|
|
if comLog.Morning != "" {
|
||
|
|
comLog.MorningAry = strings.Split(comLog.Morning, ",")
|
||
|
|
} else {
|
||
|
|
comLog.MorningAry = []string{}
|
||
|
|
}
|
||
|
|
if comLog.Afternoon != "" {
|
||
|
|
comLog.AfternoonAry = strings.Split(comLog.Afternoon, ",")
|
||
|
|
} else {
|
||
|
|
comLog.AfternoonAry = []string{}
|
||
|
|
}
|
||
|
|
publicmethod.Result(0, comLog, c)
|
||
|
|
}
|