作者 郑周

Merge remote-tracking branch 'origin/test' into test

@@ -165,14 +165,14 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -165,14 +165,14 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
165 } 165 }
166 childUserId2 := []string{} 166 childUserId2 := []string{}
167 for _, val := range childUser { 167 for _, val := range childUser {
168 - if val.Level == 3 { 168 + if val.Level >= 3 {
169 childUserId = append(childUserId, strconv.Itoa(val.Id)) 169 childUserId = append(childUserId, strconv.Itoa(val.Id))
170 } 170 }
171 } 171 }
172 // 针对上上级 172 // 针对上上级
173 var taskStageList3 []dao.TaskStageData 173 var taskStageList3 []dao.TaskStageData
174 if len(childUserId) == 0 { 174 if len(childUserId) == 0 {
175 - taskStageList2, err = taskDao.TaskStageAnomaly(childUserId2) 175 + taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2)
176 if err != nil { 176 if err != nil {
177 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error()) 177 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
178 } 178 }
@@ -189,7 +189,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -189,7 +189,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
189 payloadStr, _ := json.Marshal(payload) 189 payloadStr, _ := json.Marshal(payload)
190 newMessage := domain.MessagePersonal{ 190 newMessage := domain.MessagePersonal{
191 Id: 0, 191 Id: 0,
192 - Types: domain.MessageTypesOther, 192 + Types: domain.MessageTypesTaskStage,
193 TargetUserId: param.UserId, 193 TargetUserId: param.UserId,
194 ReadFlag: domain.MessageIsRead, 194 ReadFlag: domain.MessageIsRead,
195 Title: s, 195 Title: s,
@@ -204,7 +204,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -204,7 +204,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
204 } 204 }
205 } 205 }
206 for _, val := range taskStageList2 { 206 for _, val := range taskStageList2 {
207 - s := fmt.Sprintf("您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。", val.LeaderName, val.Name) 207 + s := fmt.Sprintf("【您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.Name)
208 msgList = append(msgList, adapter.MessageListAdapter{ 208 msgList = append(msgList, adapter.MessageListAdapter{
209 Content: s, 209 Content: s,
210 }) 210 })
@@ -214,7 +214,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -214,7 +214,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
214 payloadStr, _ := json.Marshal(payload) 214 payloadStr, _ := json.Marshal(payload)
215 newMessage := domain.MessagePersonal{ 215 newMessage := domain.MessagePersonal{
216 Id: 0, 216 Id: 0,
217 - Types: domain.MessageTypesOther, 217 + Types: domain.MessageTypesTaskStage,
218 TargetUserId: param.UserId, 218 TargetUserId: param.UserId,
219 ReadFlag: domain.MessageIsRead, 219 ReadFlag: domain.MessageIsRead,
220 Title: s, 220 Title: s,
@@ -239,7 +239,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -239,7 +239,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
239 payloadStr, _ := json.Marshal(payload) 239 payloadStr, _ := json.Marshal(payload)
240 newMessage := domain.MessagePersonal{ 240 newMessage := domain.MessagePersonal{
241 Id: 0, 241 Id: 0,
242 - Types: domain.MessageTypesOther, 242 + Types: domain.MessageTypesTaskStage,
243 TargetUserId: param.UserId, 243 TargetUserId: param.UserId,
244 ReadFlag: domain.MessageIsRead, 244 ReadFlag: domain.MessageIsRead,
245 Title: s, 245 Title: s,
@@ -320,7 +320,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -320,7 +320,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
320 } 320 }
321 } 321 }
322 // 针对上级 322 // 针对上级
323 - var taskStageList2 []dao.TaskStageData 323 + var taskStageList2 []dao.TaskData2
324 if len(childUserId) == 0 { 324 if len(childUserId) == 0 {
325 taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4) 325 taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4)
326 if err != nil { 326 if err != nil {
@@ -329,14 +329,14 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -329,14 +329,14 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
329 } 329 }
330 childUserId2 := []string{} 330 childUserId2 := []string{}
331 for _, val := range childUser { 331 for _, val := range childUser {
332 - if val.Level == 3 { 332 + if val.Level >= 3 {
333 childUserId = append(childUserId, strconv.Itoa(val.Id)) 333 childUserId = append(childUserId, strconv.Itoa(val.Id))
334 } 334 }
335 } 335 }
336 // 针对上上级 336 // 针对上上级
337 - var taskStageList3 []dao.TaskStageData 337 + var taskStageList3 []dao.TaskData2
338 if len(childUserId) == 0 { 338 if len(childUserId) == 0 {
339 - taskStageList2, err = taskDao.TaskAnomaly(childUserId2, 5) 339 + taskStageList3, err = taskDao.TaskAnomaly(childUserId2, 5)
340 if err != nil { 340 if err != nil {
341 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error()) 341 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
342 } 342 }
@@ -354,7 +354,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -354,7 +354,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
354 payloadStr, _ := json.Marshal(payload) 354 payloadStr, _ := json.Marshal(payload)
355 newMessage := domain.MessagePersonal{ 355 newMessage := domain.MessagePersonal{
356 Id: 0, 356 Id: 0,
357 - Types: domain.MessageTypesOther, 357 + Types: domain.MessageTypesTaskRecord,
358 TargetUserId: param.UserId, 358 TargetUserId: param.UserId,
359 ReadFlag: domain.MessageIsRead, 359 ReadFlag: domain.MessageIsRead,
360 Title: s, 360 Title: s,
@@ -379,7 +379,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -379,7 +379,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
379 payloadStr, _ := json.Marshal(payload) 379 payloadStr, _ := json.Marshal(payload)
380 newMessage := domain.MessagePersonal{ 380 newMessage := domain.MessagePersonal{
381 Id: 0, 381 Id: 0,
382 - Types: domain.MessageTypesOther, 382 + Types: domain.MessageTypesTaskRecord,
383 TargetUserId: param.UserId, 383 TargetUserId: param.UserId,
384 ReadFlag: domain.MessageIsRead, 384 ReadFlag: domain.MessageIsRead,
385 Title: s, 385 Title: s,
@@ -404,7 +404,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -404,7 +404,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
404 payloadStr, _ := json.Marshal(payload) 404 payloadStr, _ := json.Marshal(payload)
405 newMessage := domain.MessagePersonal{ 405 newMessage := domain.MessagePersonal{
406 Id: 0, 406 Id: 0,
407 - Types: domain.MessageTypesOther, 407 + Types: domain.MessageTypesTaskRecord,
408 TargetUserId: param.UserId, 408 TargetUserId: param.UserId,
409 ReadFlag: domain.MessageIsRead, 409 ReadFlag: domain.MessageIsRead,
410 Title: s, 410 Title: s,
@@ -134,6 +134,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat @@ -134,6 +134,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
134 taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext}) 134 taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
135 // 保存 员工的需要填写的每日任务型 指标项 135 // 保存 员工的需要填写的每日任务型 指标项
136 taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext}) 136 taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
  137 +
  138 + newTaskIdList := []int{}
137 for i := range assessList { 139 for i := range assessList {
138 assessList[i].StaffAssessTaskId = assessTaskData.Id 140 assessList[i].StaffAssessTaskId = assessTaskData.Id
139 _, err = assessRepo.Save(&assessList[i]) 141 _, err = assessRepo.Save(&assessList[i])
@@ -156,13 +158,14 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat @@ -156,13 +158,14 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
156 if err != nil { 158 if err != nil {
157 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人任务型指标项"+err.Error()) 159 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人任务型指标项"+err.Error())
158 } 160 }
159 - err = taskDao.IncreaseAnomaly([]int{val2.TaskId}, 1)  
160 - if err != nil {  
161 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人任务型指标项"+err.Error())  
162 - } 161 + newTaskIdList = append(newTaskIdList, val2.TaskId)
163 } 162 }
164 } 163 }
165 } 164 }
  165 + err = taskDao.IncreaseAnomaly(newTaskIdList, 1)
  166 + if err != nil {
  167 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人任务型指标项"+err.Error())
  168 + }
166 return map[string]interface{}{ 169 return map[string]interface{}{
167 "assessTaskId": assessTaskData.Id, 170 "assessTaskId": assessTaskData.Id,
168 }, nil 171 }, nil
  1 +package adapter
  2 +
  3 +type ConditionSelect struct {
  4 + Name string
  5 +}
  1 +package command
  2 +
  3 +type GetSelcetCommand struct {
  4 + Cmd string `json:"cmd"` // 任务名称,负责人,优先级
  5 + UserId int `json:"-"` //当前用户id
  6 + CompanyId int `json:"-"` //当前公司id
  7 +}
@@ -5,8 +5,9 @@ type SearchTaskCommand struct { @@ -5,8 +5,9 @@ type SearchTaskCommand struct {
5 CompanyId int `json:"-"` 5 CompanyId int `json:"-"`
6 PageNumber int `json:"pageNumber"` //分页 6 PageNumber int `json:"pageNumber"` //分页
7 PageSize int `json:"pageSize"` //分页 7 PageSize int `json:"pageSize"` //分页
8 - TaskName string `json:"taskName"` //任务名称  
9 - LevelName string `json:"levelName"` //优先级  
10 OnlyMy bool `json:"onlyMy"` //只查看我负责的任务 8 OnlyMy bool `json:"onlyMy"` //只查看我负责的任务
11 - LeaderId string `json:"leaderId"` //任务负责人id 9 + SearchWord string `json:"searchWord"`
  10 + // TaskName string `json:"taskName"` //任务名称
  11 + // LevelName string `json:"levelName"` //优先级
  12 + // LeaderName string `json:"leaderId"` //任务负责人id
12 } 13 }
@@ -555,13 +555,16 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte @@ -555,13 +555,16 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
555 for _, val := range taskList { 555 for _, val := range taskList {
556 taskIdList = append(taskIdList, val.Id) 556 taskIdList = append(taskIdList, val.Id)
557 } 557 }
558 -  
559 - _, stageList, err := taskStageRepo.Find(map[string]interface{}{  
560 - "taskIdList": taskIdList,  
561 - })  
562 - if err != nil {  
563 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询任务阶段数据"+err.Error()) 558 + var stageList []*domain.TaskStage
  559 + if len(taskIdList) > 0 {
  560 + _, stageList, err = taskStageRepo.Find(map[string]interface{}{
  561 + "taskIdList": taskIdList,
  562 + })
  563 + if err != nil {
  564 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询任务阶段数据"+err.Error())
  565 + }
564 } 566 }
  567 +
565 if err := transactionContext.CommitTransaction(); err != nil { 568 if err := transactionContext.CommitTransaction(); err != nil {
566 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 569 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
567 } 570 }
@@ -668,6 +671,9 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i @@ -668,6 +671,9 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
668 if err != nil { 671 if err != nil {
669 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error()) 672 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
670 } 673 }
  674 + if len(param.SearchWord) > 0 {
  675 + param.SearchWord = "%" + param.SearchWord + "%"
  676 + }
671 if hrbpFlag == domain.RoleTypeSystem { 677 if hrbpFlag == domain.RoleTypeSystem {
672 listData, err := srv.listTask2ForHrbp(param) 678 listData, err := srv.listTask2ForHrbp(param)
673 return listData, err 679 return listData, err
@@ -681,13 +687,12 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i @@ -681,13 +687,12 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
681 } 687 }
682 } 688 }
683 condition := dao.ListTaskCondition{ 689 condition := dao.ListTaskCondition{
684 - Limit: limit,  
685 - Offset: offset,  
686 - UserId: param.UserId,  
687 - TaskName: param.TaskName,  
688 - LevelName: param.LevelName,  
689 - OnlyMy: param.OnlyMy,  
690 - LeaderId: param.LeaderId, 690 + Limit: limit,
  691 + Offset: offset,
  692 + UserId: param.UserId,
  693 + CompanyId: param.CompanyId,
  694 + OnlyMy: param.OnlyMy,
  695 + SearchWord: param.SearchWord,
691 } 696 }
692 697
693 taskDao := dao.NewTaskDao(map[string]interface{}{ 698 taskDao := dao.NewTaskDao(map[string]interface{}{
@@ -780,13 +785,12 @@ func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[s @@ -780,13 +785,12 @@ func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[s
780 } 785 }
781 } 786 }
782 condition := dao.ListTaskCondition{ 787 condition := dao.ListTaskCondition{
783 - Limit: limit,  
784 - Offset: offset,  
785 - UserId: param.UserId,  
786 - TaskName: param.TaskName,  
787 - LevelName: param.LevelName,  
788 - OnlyMy: param.OnlyMy,  
789 - LeaderId: param.LeaderId, 788 + Limit: limit,
  789 + Offset: offset,
  790 + UserId: param.UserId,
  791 + CompanyId: param.CompanyId,
  792 + OnlyMy: param.OnlyMy,
  793 + SearchWord: param.SearchWord,
790 } 794 }
791 transactionContext, err := factory.CreateTransactionContext(nil) 795 transactionContext, err := factory.CreateTransactionContext(nil)
792 if err != nil { 796 if err != nil {
@@ -987,7 +991,7 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map @@ -987,7 +991,7 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map
987 return result, nil 991 return result, nil
988 } 992 }
989 993
990 -// 获取任务详情 994 +// 删除任务
991 func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.TaskInfoAdapter, error) { 995 func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.TaskInfoAdapter, error) {
992 transactionContext, err := factory.CreateTransactionContext(nil) 996 transactionContext, err := factory.CreateTransactionContext(nil)
993 if err != nil { 997 if err != nil {
@@ -1022,3 +1026,74 @@ func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.T @@ -1022,3 +1026,74 @@ func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.T
1022 } 1026 }
1023 return nil, nil 1027 return nil, nil
1024 } 1028 }
  1029 +
  1030 +// 员工绩效-任务管理-列表筛选项
  1031 +func (srv TaskService) ConditionForListTask2(param *command.GetSelcetCommand) (map[string]interface{}, error) {
  1032 + transactionContext, err := factory.CreateTransactionContext(nil)
  1033 + if err != nil {
  1034 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1035 + }
  1036 + if err := transactionContext.StartTransaction(); err != nil {
  1037 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1038 + }
  1039 + defer func() {
  1040 + _ = transactionContext.RollbackTransaction()
  1041 + }()
  1042 + taskDao := dao.NewTaskDao(map[string]interface{}{
  1043 + "transactionContext": transactionContext,
  1044 + })
  1045 + hrbpFlag, err := roleService.GetHrBp(transactionContext, int(param.CompanyId), int(param.UserId))
  1046 + if err != nil {
  1047 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
  1048 + }
  1049 + var tasklistData []dao.TaskData1
  1050 + if hrbpFlag == domain.RoleTypeSystem {
  1051 + tasklistData, err = taskDao.ListTask2ForHrbp(param.UserId, param.CompanyId)
  1052 + if err != nil {
  1053 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
  1054 + }
  1055 + } else {
  1056 + tasklistData, err = taskDao.ListTask2(param.UserId)
  1057 + if err != nil {
  1058 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
  1059 + }
  1060 + }
  1061 + if err := transactionContext.CommitTransaction(); err != nil {
  1062 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1063 + }
  1064 + selectList := []adapter.ConditionSelect{}
  1065 + uniqueMap := map[string]struct{}{}
  1066 + // 任务名称,负责人,优先级
  1067 + switch param.Cmd {
  1068 + case "任务名称":
  1069 + for _, val := range tasklistData {
  1070 + if _, ok := uniqueMap[val.Name]; ok {
  1071 + continue
  1072 + }
  1073 + uniqueMap[val.Name] = struct{}{}
  1074 + selectList = append(selectList, adapter.ConditionSelect{Name: val.Name})
  1075 + }
  1076 + case "负责人":
  1077 + for _, val := range tasklistData {
  1078 + if _, ok := uniqueMap[val.LeaderName]; ok {
  1079 + continue
  1080 + }
  1081 + uniqueMap[val.LeaderName] = struct{}{}
  1082 + selectList = append(selectList, adapter.ConditionSelect{Name: val.LeaderName})
  1083 + }
  1084 + case "优先级":
  1085 + for _, val := range tasklistData {
  1086 + if _, ok := uniqueMap[val.LevelName]; ok {
  1087 + continue
  1088 + }
  1089 + uniqueMap[val.LevelName] = struct{}{}
  1090 + if len(val.LevelName) > 0 {
  1091 + selectList = append(selectList, adapter.ConditionSelect{Name: val.LevelName})
  1092 + }
  1093 + }
  1094 + }
  1095 + result := map[string]interface{}{
  1096 + "list": selectList,
  1097 + }
  1098 + return result, nil
  1099 +}
@@ -26,7 +26,7 @@ type TaskRecord struct { @@ -26,7 +26,7 @@ type TaskRecord struct {
26 TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"` 26 TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"`
27 AssistLevel int `json:"assistLevel" comment:"上级辅导情况"` 27 AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
28 AssistContent string `json:"assistContent" comment:"上级辅导内容"` 28 AssistContent string `json:"assistContent" comment:"上级辅导内容"`
29 - AnomalyState int `json:"anomalyState" comment:"异常反馈状态(0异常、1正常)"` 29 + AnomalyState int `json:"anomalyState" comment:"异常是否反馈状态(0异常、1正常)"`
30 TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"` 30 TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"`
31 TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"` 31 TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"`
32 CreatedAt time.Time `json:"createdAt" comment:"创建时间"` 32 CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
@@ -9,8 +9,8 @@ import ( @@ -9,8 +9,8 @@ import (
9 func TestGenerateToken(t *testing.T) { 9 func TestGenerateToken(t *testing.T) {
10 ut := UserAuth{ 10 ut := UserAuth{
11 CompanyId: 8, 11 CompanyId: 8,
12 - UserId: 3438641393081088,  
13 - Phone: "17711111111", 12 + UserId: 3422174102828544,
  13 + Phone: "17708397664",
14 PlatformId: 29, 14 PlatformId: 29,
15 AdminType: 1, 15 AdminType: 1,
16 } 16 }
@@ -60,13 +60,12 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { @@ -60,13 +60,12 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string {
60 } 60 }
61 61
62 type ListTaskCondition struct { 62 type ListTaskCondition struct {
63 - Limit int //分页  
64 - Offset int //分页  
65 - UserId int //谁要查看任务数据  
66 - TaskName string //任务名称  
67 - LevelName string //优先级  
68 - OnlyMy bool //只查看我负责的任务  
69 - LeaderId string //任务负责人id 63 + Limit int //分页
  64 + Offset int //分页
  65 + CompanyId int //公司id
  66 + UserId int //谁要查看任务数据
  67 + OnlyMy bool //只查看我负责的任务
  68 + SearchWord string
70 } 69 }
71 70
72 // 任务和里程碑列表 71 // 任务和里程碑列表
@@ -125,7 +124,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage @@ -125,7 +124,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
125 from task 124 from task
126 join t_task_1 on task.id=t_task_1.id 125 join t_task_1 on task.id=t_task_1.id
127 join task_stage on task.id =task_stage.task_id 126 join task_stage on task.id =task_stage.task_id
128 - where 1=1 127 + where 1=1 and task.company_id=?
129 order by diff_time,task."level",task.created_at 128 order by diff_time,task."level",task.created_at
130 ), 129 ),
131 -- 按任务数据分页获取 130 -- 按任务数据分页获取
@@ -156,22 +155,15 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage @@ -156,22 +155,15 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
156 where t_task_tage_1.task_id in( 155 where t_task_tage_1.task_id in(
157 select t_task_page.task_id from t_task_page 156 select t_task_page.task_id from t_task_page
158 )` 157 )`
159 - condition := []interface{}{} 158 + condition := []interface{}{param.CompanyId}
160 whereSql := `` 159 whereSql := ``
161 if param.OnlyMy { 160 if param.OnlyMy {
162 condition = append(condition, param.UserId) 161 condition = append(condition, param.UserId)
163 whereSql += ` and t_task_tage_1.leader_id = '?' ` 162 whereSql += ` and t_task_tage_1.leader_id = '?' `
164 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
165 - condition = append(condition, param.LeaderId)  
166 - whereSql += ` and t_task_tage_1.leader_id = ? `  
167 - }  
168 - if len(param.TaskName) > 0 {  
169 - condition = append(condition, param.TaskName)  
170 - whereSql += ` and t_task_tage_1.task_name like ? `  
171 } 163 }
172 - if len(param.LevelName) > 0 {  
173 - condition = append(condition, param.LevelName)  
174 - whereSql += ` and t_task_tage_1.level_name like ? ` 164 + if param.SearchWord != "" {
  165 + condition = append(condition, param.SearchWord, param.SearchWord)
  166 + whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
175 } 167 }
176 condition = append(condition, param.Limit, param.Offset) 168 condition = append(condition, param.Limit, param.Offset)
177 sqlStr := fmt.Sprintf(withSql, whereSql) 169 sqlStr := fmt.Sprintf(withSql, whereSql)
@@ -186,24 +178,18 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { @@ -186,24 +178,18 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) {
186 task1 := d.catchTaskIdByPermission(param.UserId) 178 task1 := d.catchTaskIdByPermission(param.UserId)
187 withSql := task1 + `select count(*) from task 179 withSql := task1 + `select count(*) from task
188 join t_task_1 on task.id =t_task_1.id 180 join t_task_1 on task.id =t_task_1.id
189 - where 1=1 `  
190 - condition := []interface{}{} 181 + where 1=1 and task.company_id=?`
  182 + condition := []interface{}{param.CompanyId}
191 whereSql := `` 183 whereSql := ``
192 if param.OnlyMy { 184 if param.OnlyMy {
193 condition = append(condition, param.UserId) 185 condition = append(condition, param.UserId)
194 whereSql += ` and task.leader ->>'id' = '?' ` 186 whereSql += ` and task.leader ->>'id' = '?' `
195 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
196 - condition = append(condition, param.LeaderId)  
197 - whereSql += ` and task.leader ->>'id' = ? `  
198 } 187 }
199 - if len(param.TaskName) > 0 {  
200 - condition = append(condition, param.TaskName)  
201 - whereSql += ` and task.name like ? `  
202 - }  
203 - if len(param.LevelName) > 0 {  
204 - condition = append(condition, param.LevelName)  
205 - whereSql += ` and task.level_name like ? ` 188 + if param.SearchWord != "" {
  189 + condition = append(condition, param.SearchWord, param.SearchWord)
  190 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
206 } 191 }
  192 +
207 sqlStr := withSql + whereSql 193 sqlStr := withSql + whereSql
208 tx := d.transactionContext.PgTx 194 tx := d.transactionContext.PgTx
209 var cnt int 195 var cnt int
@@ -247,7 +233,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -247,7 +233,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
247 end) as diff_time 233 end) as diff_time
248 from task 234 from task
249 join task_stage on task.id =task_stage.task_id 235 join task_stage on task.id =task_stage.task_id
250 - where 1=1 236 + where 1=1 and task.company_id=?
251 order by diff_time,task."level",task.created_at 237 order by diff_time,task."level",task.created_at
252 ), 238 ),
253 -- 按任务数据分页获取 239 -- 按任务数据分页获取
@@ -280,22 +266,15 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -280,22 +266,15 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
280 where t_task_tage_1.task_id in( 266 where t_task_tage_1.task_id in(
281 select t_task_page.task_id from t_task_page 267 select t_task_page.task_id from t_task_page
282 )` 268 )`
283 - condition := []interface{}{param.UserId} 269 + condition := []interface{}{param.UserId, param.CompanyId}
284 whereSql := `` 270 whereSql := ``
285 if param.OnlyMy { 271 if param.OnlyMy {
286 condition = append(condition, param.UserId) 272 condition = append(condition, param.UserId)
287 whereSql += ` and t_task_tage_1.leader_id = '?' ` 273 whereSql += ` and t_task_tage_1.leader_id = '?' `
288 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
289 - condition = append(condition, param.LeaderId)  
290 - whereSql += ` and t_task_tage_1.leader_id = ? `  
291 } 274 }
292 - if len(param.TaskName) > 0 {  
293 - condition = append(condition, param.TaskName)  
294 - whereSql += ` and t_task_tage_1.task_name like ? `  
295 - }  
296 - if len(param.LevelName) > 0 {  
297 - condition = append(condition, param.LevelName)  
298 - whereSql += ` and t_task_tage_1.level_name like ? ` 275 + if param.SearchWord != "" {
  276 + condition = append(condition, param.SearchWord, param.SearchWord)
  277 + whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
299 } 278 }
300 condition = append(condition, param.Limit, param.Offset) 279 condition = append(condition, param.Limit, param.Offset)
301 sqlStr := fmt.Sprintf(withSql, whereSql) 280 sqlStr := fmt.Sprintf(withSql, whereSql)
@@ -313,23 +292,16 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { @@ -313,23 +292,16 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
313 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =? 292 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
314 )select count(*) from task 293 )select count(*) from task
315 left join t_task_ignore on t_task_ignore.task_id=task.id 294 left join t_task_ignore on t_task_ignore.task_id=task.id
316 - where 1=1 `  
317 - condition := []interface{}{param.UserId} 295 + where 1=1 and task.company_id=?`
  296 + condition := []interface{}{param.UserId, param.CompanyId}
318 whereSql := `` 297 whereSql := ``
319 if param.OnlyMy { 298 if param.OnlyMy {
320 condition = append(condition, param.UserId) 299 condition = append(condition, param.UserId)
321 whereSql += ` and task.leader ->>'id' = '?' ` 300 whereSql += ` and task.leader ->>'id' = '?' `
322 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
323 - condition = append(condition, param.LeaderId)  
324 - whereSql += ` and task.leader ->>'id' = ? `  
325 - }  
326 - if len(param.TaskName) > 0 {  
327 - condition = append(condition, param.TaskName)  
328 - whereSql += ` and task.name like ? `  
329 } 301 }
330 - if len(param.LevelName) > 0 {  
331 - condition = append(condition, param.LevelName)  
332 - whereSql += ` and task.level_name like ? ` 302 + if param.SearchWord != "" {
  303 + condition = append(condition, param.SearchWord, param.SearchWord)
  304 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
333 } 305 }
334 sqlStr := withSql + whereSql 306 sqlStr := withSql + whereSql
335 tx := d.transactionContext.PgTx 307 tx := d.transactionContext.PgTx
@@ -345,28 +317,21 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er @@ -345,28 +317,21 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
345 from task_stage 317 from task_stage
346 join task on task_stage.task_id =task.id 318 join task on task_stage.task_id =task.id
347 join t_task_1 on task.id =t_task_1.id 319 join t_task_1 on task.id =t_task_1.id
348 - where 1=1 320 + where 1=1 and task.company_id=?
349 and( 321 and(
350 (task_stage.plan_completed_at <task_stage.real_completed_at) 322 (task_stage.plan_completed_at <task_stage.real_completed_at)
351 or 323 or
352 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())) 324 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
353 ) ` 325 ) `
354 - condition := []interface{}{} 326 + condition := []interface{}{param.CompanyId}
355 whereSql := `` 327 whereSql := ``
356 if param.OnlyMy { 328 if param.OnlyMy {
357 condition = append(condition, param.UserId) 329 condition = append(condition, param.UserId)
358 whereSql += ` and task.leader ->>'id' = '?' ` 330 whereSql += ` and task.leader ->>'id' = '?' `
359 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
360 - condition = append(condition, param.LeaderId)  
361 - whereSql += ` and task.leader ->>'id' = ? `  
362 - }  
363 - if len(param.TaskName) > 0 {  
364 - condition = append(condition, param.TaskName)  
365 - whereSql += ` and task.name like ? `  
366 } 331 }
367 - if len(param.LevelName) > 0 {  
368 - condition = append(condition, param.LevelName)  
369 - whereSql += ` and task.level_name like ? ` 332 + if param.SearchWord != "" {
  333 + condition = append(condition, param.SearchWord, param.SearchWord)
  334 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
370 } 335 }
371 sqlStr := withSql + whereSql 336 sqlStr := withSql + whereSql
372 tx := d.transactionContext.PgTx 337 tx := d.transactionContext.PgTx
@@ -384,29 +349,23 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -384,29 +349,23 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
384 from task_stage 349 from task_stage
385 join task on task_stage.task_id =task.id 350 join task on task_stage.task_id =task.id
386 left join t_task_ignore on t_task_ignore.task_id=task.id 351 left join t_task_ignore on t_task_ignore.task_id=task.id
387 - where 1=1 352 + where 1=1 and task.company_id=?
388 and( 353 and(
389 (task_stage.plan_completed_at <task_stage.real_completed_at) 354 (task_stage.plan_completed_at <task_stage.real_completed_at)
390 or 355 or
391 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())) 356 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
392 ) ` 357 ) `
393 - condition := []interface{}{param.UserId} 358 + condition := []interface{}{param.UserId, param.CompanyId}
394 whereSql := `` 359 whereSql := ``
395 if param.OnlyMy { 360 if param.OnlyMy {
396 condition = append(condition, param.UserId) 361 condition = append(condition, param.UserId)
397 whereSql += ` and task.leader ->>'id' = '?' ` 362 whereSql += ` and task.leader ->>'id' = '?' `
398 - } else if param.LeaderId != "" && param.LeaderId != "0" {  
399 - condition = append(condition, param.LeaderId)  
400 - whereSql += ` and task.leader ->>'id' = ? `  
401 - }  
402 - if len(param.TaskName) > 0 {  
403 - condition = append(condition, param.TaskName)  
404 - whereSql += ` and task.name like ? `  
405 } 363 }
406 - if len(param.LevelName) > 0 {  
407 - condition = append(condition, param.LevelName)  
408 - whereSql += ` and task.level_name like ? ` 364 + if param.SearchWord != "" {
  365 + condition = append(condition, param.SearchWord, param.SearchWord)
  366 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
409 } 367 }
  368 +
410 sqlStr := withSql + whereSql 369 sqlStr := withSql + whereSql
411 tx := d.transactionContext.PgTx 370 tx := d.transactionContext.PgTx
412 var cnt int 371 var cnt int
@@ -446,16 +405,25 @@ func (d *TaskDao) TaskStageAnomaly(leaderId []string) ([]TaskStageData, error) { @@ -446,16 +405,25 @@ func (d *TaskDao) TaskStageAnomaly(leaderId []string) ([]TaskStageData, error) {
446 return result, err 405 return result, err
447 } 406 }
448 407
449 -// 异常的里程碑任务  
450 -func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData, error) { 408 +type TaskData2 struct {
  409 + Id int `pg:"id"`
  410 + Name string `pg:"name"`
  411 + Alias string `pg:"alias"`
  412 + LeaderName string `pg:"leader_name"`
  413 + Anomaly string `pg:"anomaly"`
  414 +}
  415 +
  416 +// 异常的任务
  417 +func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskData2, error) {
451 sqlStr := `select 418 sqlStr := `select
  419 + task."id",
452 task."name" , 420 task."name" ,
453 task.alias , 421 task.alias ,
454 task.leader ->>'name' as leader_name, 422 task.leader ->>'name' as leader_name,
455 task.anomaly 423 task.anomaly
456 from task 424 from task
457 - where task.anomaly >=? and task.leader ->'id' in(?) `  
458 - result := []TaskStageData{} 425 + where task.anomaly >=? and task.leader ->>'id' in(?) `
  426 + result := []TaskData2{}
459 tx := d.transactionContext.PgTx 427 tx := d.transactionContext.PgTx
460 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId)) 428 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId))
461 return result, err 429 return result, err
@@ -474,17 +442,10 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) @@ -474,17 +442,10 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error)
474 if param.OnlyMy { 442 if param.OnlyMy {
475 condition = append(condition, param.UserId) 443 condition = append(condition, param.UserId)
476 whereSql += ` and task.leader ->>'id' = '?' ` 444 whereSql += ` and task.leader ->>'id' = '?' `
477 - } else if param.LeaderId != "" {  
478 - condition = append(condition, param.LeaderId)  
479 - whereSql += ` and task.leader ->>'id' = ? `  
480 } 445 }
481 - if len(param.TaskName) > 0 {  
482 - condition = append(condition, param.TaskName)  
483 - whereSql += ` and task.name like ? `  
484 - }  
485 - if len(param.LevelName) > 0 {  
486 - condition = append(condition, param.LevelName)  
487 - whereSql += ` and task.level_name like ? ` 446 + if param.SearchWord != "" {
  447 + condition = append(condition, param.SearchWord, param.SearchWord)
  448 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
488 } 449 }
489 sqlStr := withSql + whereSql 450 sqlStr := withSql + whereSql
490 tx := d.transactionContext.PgTx 451 tx := d.transactionContext.PgTx
@@ -501,23 +462,16 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { @@ -501,23 +462,16 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
501 )select count(*) 462 )select count(*)
502 from task 463 from task
503 left join t_task_ignore on t_task_ignore.task_id=task.id 464 left join t_task_ignore on t_task_ignore.task_id=task.id
504 - where 1=1 and task.anomaly>1 `  
505 - condition := []interface{}{param.UserId} 465 + where 1=1 and task.anomaly>1 and task.company_id=?`
  466 + condition := []interface{}{param.UserId, param.CompanyId}
506 whereSql := `` 467 whereSql := ``
507 if param.OnlyMy { 468 if param.OnlyMy {
508 condition = append(condition, param.UserId) 469 condition = append(condition, param.UserId)
509 whereSql += ` and task.leader ->>'id' = '?' ` 470 whereSql += ` and task.leader ->>'id' = '?' `
510 - } else if param.LeaderId != "" {  
511 - condition = append(condition, param.LeaderId)  
512 - whereSql += ` and task.leader ->>'id' = ? `  
513 - }  
514 - if len(param.TaskName) > 0 {  
515 - condition = append(condition, param.TaskName)  
516 - whereSql += ` and task.name like ? `  
517 } 471 }
518 - if len(param.LevelName) > 0 {  
519 - condition = append(condition, param.LevelName)  
520 - whereSql += ` and task.level_name like ? ` 472 + if param.SearchWord != "" {
  473 + condition = append(condition, param.SearchWord, param.SearchWord)
  474 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
521 } 475 }
522 sqlStr := withSql + whereSql 476 sqlStr := withSql + whereSql
523 tx := d.transactionContext.PgTx 477 tx := d.transactionContext.PgTx
@@ -525,3 +479,47 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { @@ -525,3 +479,47 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
525 _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...) 479 _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
526 return cnt, err 480 return cnt, err
527 } 481 }
  482 +
  483 +// 任务数据
  484 +type TaskData1 struct {
  485 + Name string `pg:"name"`
  486 + Alias string `pg:"alias"`
  487 + LeaderId string `pg:"leader_id"`
  488 + LeaderName string `pg:"leader_name"`
  489 + LevelName string `pg:"level_name"`
  490 +}
  491 +
  492 +// 获取任务列表
  493 +func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) {
  494 + task1 := d.catchTaskIdByPermission(userId)
  495 + sqlStr := task1 + ` select task."name" ,task.alias ,
  496 + task.leader ->>'id' as leader_id,
  497 + task.leader ->>'name' as leader_name,
  498 + task.level_name
  499 + from task
  500 + join t_task_1 on task.id =t_task_1.id
  501 + `
  502 + result := []TaskData1{}
  503 + tx := d.transactionContext.PgTx
  504 + _, err := tx.Query(&result, sqlStr)
  505 + return result, err
  506 +}
  507 +
  508 +// 获取任务列表
  509 +func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, error) {
  510 + sqlStr := `with
  511 + t_task_ignore as (
  512 + select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
  513 + )select task."name" ,task.alias ,
  514 + task.leader ->>'id' as leader_id,
  515 + task.leader ->>'name' as leader_name,
  516 + task.level_name
  517 + from task
  518 + left join t_task_ignore on t_task_ignore.task_id=task.id
  519 + where 1=1 and task.company_id=? `
  520 + result := []TaskData1{}
  521 + tx := d.transactionContext.PgTx
  522 + _, err := tx.Query(&result, sqlStr, userId, companyId)
  523 + return result, err
  524 +
  525 +}
@@ -9,20 +9,20 @@ import ( @@ -9,20 +9,20 @@ import (
9 // 任务 9 // 任务
10 type Task struct { 10 type Task struct {
11 tableName struct{} `comment:"任务" pg:"task"` 11 tableName struct{} `comment:"任务" pg:"task"`
12 - Id int `pg:"id,pk"` //  
13 - CreatedAt time.Time `pg:"created_at"` //  
14 - UpdatedAt time.Time `pg:"updated_at"` //  
15 - DeletedAt *time.Time `pg:"deleted_at"` //  
16 - Name string `pg:"name"` // 任务名称  
17 - Alias string `pg:"alias"` //  
18 - CompanyId int `pg:"company_id"` //  
19 - Leader domain.TaskLeader `pg:"leader"` // 任务负责人  
20 - Status int `pg:"status"` // 任务的状态  
21 - Level int `pg:"level"` // 优先级,值越小优先级越高  
22 - LevelName string `pg:"level_name"` // 优先级名称  
23 - RelatedUser []int `pg:"related_user"` //  
24 - RunAt int64 `pg:"run_at"` // 启动的时间  
25 - StopAt int64 `pg:"stop_at"` // 停止的时间  
26 - Anomaly int `pg:"anomaly"` // 异常反馈的数量  
27 - WarnFlag int `pg:"warn_flag"` // 里程碑异常标记 12 + Id int `pg:"id,pk"` //
  13 + CreatedAt time.Time `pg:"created_at"` //
  14 + UpdatedAt time.Time `pg:"updated_at"` //
  15 + DeletedAt *time.Time `pg:"deleted_at"` //
  16 + Name string `pg:"name"` // 任务名称
  17 + Alias string `pg:"alias"` //
  18 + CompanyId int `pg:"company_id"` //
  19 + Leader domain.TaskLeader `pg:"leader"` // 任务负责人
  20 + Status int `pg:"status,use_zero"` // 任务的状态
  21 + Level int `pg:"level,use_zero"` // 优先级,值越小优先级越高
  22 + LevelName string `pg:"level_name"` // 优先级名称
  23 + RelatedUser []int `pg:"related_user"` //
  24 + RunAt int64 `pg:"run_at,use_zero"` // 启动的时间
  25 + StopAt int64 `pg:"stop_at,use_zero" ` // 停止的时间
  26 + Anomaly int `pg:"anomaly,use_zero"` // 异常反馈的数量
  27 + WarnFlag int `pg:"warn_flag,use_zero"` // 里程碑异常标记
28 } 28 }
@@ -172,3 +172,20 @@ func (c *TaskController) DeleteTask() { @@ -172,3 +172,20 @@ func (c *TaskController) DeleteTask() {
172 data, err := srv.DeleteTaskInfo(paramReq) 172 data, err := srv.DeleteTaskInfo(paramReq)
173 c.Response(data, err) 173 c.Response(data, err)
174 } 174 }
  175 +
  176 +// SelectCondition 员工绩效-任务管理-任务列表-筛选条件
  177 +func (c *TaskController) SelectCondition() {
  178 + srv := service.NewTaskService()
  179 + paramReq := &command.GetSelcetCommand{}
  180 + err := c.BindJSON(paramReq)
  181 + if err != nil {
  182 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  183 + c.Response(nil, e)
  184 + return
  185 + }
  186 + userReq := middlewares.GetUser(c.Ctx)
  187 + paramReq.CompanyId = int(userReq.CompanyId)
  188 + paramReq.UserId = int(userReq.UserId)
  189 + data, err := srv.ConditionForListTask2(paramReq)
  190 + c.Response(data, err)
  191 +}
@@ -24,6 +24,7 @@ func init() { @@ -24,6 +24,7 @@ func init() {
24 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 24 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
25 web.NSCtrlPost("/attention/cancel", (*controllers.TaskController).CancelAttention), 25 web.NSCtrlPost("/attention/cancel", (*controllers.TaskController).CancelAttention),
26 web.NSCtrlPost("/list", (*controllers.TaskController).ListTask2), 26 web.NSCtrlPost("/list", (*controllers.TaskController).ListTask2),
  27 + web.NSCtrlPost("/list/select", (*controllers.TaskController).SelectCondition),
27 web.NSCtrlPost("/task_record/list", (*controllers.TaskController).ListTaskRecord), 28 web.NSCtrlPost("/task_record/list", (*controllers.TaskController).ListTaskRecord),
28 web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo), 29 web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo),
29 ) 30 )