|
@@ -746,237 +746,237 @@ func (srv TaskService) CancelAttention(param *command.CancelAttentionCommand) er |
|
@@ -746,237 +746,237 @@ func (srv TaskService) CancelAttention(param *command.CancelAttentionCommand) er |
746
|
}
|
746
|
}
|
747
|
|
747
|
|
748
|
// 员工绩效-任务管理-列表
|
748
|
// 员工绩效-任务管理-列表
|
749
|
-func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
750
|
- transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
751
|
- if err != nil {
|
|
|
752
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
753
|
- }
|
|
|
754
|
- if err := transactionContext.StartTransaction(); err != nil {
|
|
|
755
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
756
|
- }
|
|
|
757
|
- defer func() {
|
|
|
758
|
- _ = transactionContext.RollbackTransaction()
|
|
|
759
|
- }()
|
|
|
760
|
- hrbpFlag, err := roleService.GetHrBp(transactionContext, int(param.CompanyId), int(param.UserId))
|
|
|
761
|
- if err != nil {
|
|
|
762
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
|
|
|
763
|
- }
|
|
|
764
|
- if len(param.SearchWord) > 0 {
|
|
|
765
|
- param.SearchWord = "%" + param.SearchWord + "%"
|
|
|
766
|
- }
|
|
|
767
|
- if hrbpFlag == domain.RoleTypeSystem {
|
|
|
768
|
- listData, err := srv.listTask2ForHrbp(param)
|
|
|
769
|
- return listData, err
|
|
|
770
|
- }
|
|
|
771
|
- var limit = 20
|
|
|
772
|
- var offset = 0
|
|
|
773
|
- if param.PageSize > 0 {
|
|
|
774
|
- limit = param.PageSize
|
|
|
775
|
- if param.PageNumber > 0 {
|
|
|
776
|
- offset = (param.PageNumber - 1) * param.PageSize
|
|
|
777
|
- }
|
|
|
778
|
- }
|
|
|
779
|
- condition := dao.ListTaskCondition{
|
|
|
780
|
- Limit: limit,
|
|
|
781
|
- Offset: offset,
|
|
|
782
|
- UserId: param.UserId,
|
|
|
783
|
- CompanyId: param.CompanyId,
|
|
|
784
|
- OnlyMy: param.OnlyMy,
|
|
|
785
|
- SearchWord: param.SearchWord,
|
|
|
786
|
- }
|
749
|
+// func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
750
|
+// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
751
|
+// if err != nil {
|
|
|
752
|
+// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
753
|
+// }
|
|
|
754
|
+// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
755
|
+// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
756
|
+// }
|
|
|
757
|
+// defer func() {
|
|
|
758
|
+// _ = transactionContext.RollbackTransaction()
|
|
|
759
|
+// }()
|
|
|
760
|
+// hrbpFlag, err := roleService.GetHrBp(transactionContext, int(param.CompanyId), int(param.UserId))
|
|
|
761
|
+// if err != nil {
|
|
|
762
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
|
|
|
763
|
+// }
|
|
|
764
|
+// if len(param.SearchWord) > 0 {
|
|
|
765
|
+// param.SearchWord = "%" + param.SearchWord + "%"
|
|
|
766
|
+// }
|
|
|
767
|
+// if hrbpFlag == domain.RoleTypeSystem {
|
|
|
768
|
+// listData, err := srv.listTask2ForHrbp(param)
|
|
|
769
|
+// return listData, err
|
|
|
770
|
+// }
|
|
|
771
|
+// var limit = 20
|
|
|
772
|
+// var offset = 0
|
|
|
773
|
+// if param.PageSize > 0 {
|
|
|
774
|
+// limit = param.PageSize
|
|
|
775
|
+// if param.PageNumber > 0 {
|
|
|
776
|
+// offset = (param.PageNumber - 1) * param.PageSize
|
|
|
777
|
+// }
|
|
|
778
|
+// }
|
|
|
779
|
+// condition := dao.ListTaskCondition{
|
|
|
780
|
+// Limit: limit,
|
|
|
781
|
+// Offset: offset,
|
|
|
782
|
+// UserId: param.UserId,
|
|
|
783
|
+// CompanyId: param.CompanyId,
|
|
|
784
|
+// OnlyMy: param.OnlyMy,
|
|
|
785
|
+// SearchWord: param.SearchWord,
|
|
|
786
|
+// }
|
787
|
|
787
|
|
788
|
- taskDao := dao.NewTaskDao(map[string]interface{}{
|
|
|
789
|
- "transactionContext": transactionContext,
|
|
|
790
|
- })
|
|
|
791
|
- //任务列表数据
|
|
|
792
|
- tasklistData, err := taskDao.ListTaskStageNotHrbp(condition)
|
|
|
793
|
- if err != nil {
|
|
|
794
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
795
|
- }
|
|
|
796
|
- //查到的任务数据总数
|
|
|
797
|
- taskCount, err := taskDao.CountTaskNotHrbp(condition)
|
|
|
798
|
- if err != nil {
|
|
|
799
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
|
|
|
800
|
- }
|
|
|
801
|
- //
|
|
|
802
|
- taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
|
|
|
803
|
- if err != nil {
|
|
|
804
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
805
|
- }
|
|
|
806
|
- taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition)
|
|
|
807
|
- if err != nil {
|
|
|
808
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
809
|
- }
|
|
|
810
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
811
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
812
|
- }
|
788
|
+// taskDao := dao.NewTaskDao(map[string]interface{}{
|
|
|
789
|
+// "transactionContext": transactionContext,
|
|
|
790
|
+// })
|
|
|
791
|
+// //任务列表数据
|
|
|
792
|
+// tasklistData, err := taskDao.ListTaskStageNotHrbp(condition)
|
|
|
793
|
+// if err != nil {
|
|
|
794
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
795
|
+// }
|
|
|
796
|
+// //查到的任务数据总数
|
|
|
797
|
+// taskCount, err := taskDao.CountTaskNotHrbp(condition)
|
|
|
798
|
+// if err != nil {
|
|
|
799
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
|
|
|
800
|
+// }
|
|
|
801
|
+// //
|
|
|
802
|
+// taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
|
|
|
803
|
+// if err != nil {
|
|
|
804
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
805
|
+// }
|
|
|
806
|
+// taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition)
|
|
|
807
|
+// if err != nil {
|
|
|
808
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
809
|
+// }
|
|
|
810
|
+// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
811
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
812
|
+// }
|
813
|
|
813
|
|
814
|
- taskResult := []*adapter.TaskItem{}
|
|
|
815
|
- taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
816
|
- for _, val := range tasklistData {
|
|
|
817
|
- if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
818
|
- continue
|
|
|
819
|
- }
|
|
|
820
|
- tk := adapter.TaskItem{
|
|
|
821
|
- Id: val.TaskId,
|
|
|
822
|
- Name: val.TaskName,
|
|
|
823
|
- Alias: val.TaskAliasName,
|
|
|
824
|
- Leader: val.LeaderName,
|
|
|
825
|
- Status: val.TaskStatus,
|
|
|
826
|
- Level: val.Level,
|
|
|
827
|
- LevelName: val.LevelName,
|
|
|
828
|
- UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
829
|
- Anomaly: val.Anomaly,
|
|
|
830
|
- WarnFlag: val.WarnFlag,
|
|
|
831
|
- }
|
|
|
832
|
- taskMapResult[val.TaskId] = &tk
|
|
|
833
|
- taskResult = append(taskResult, &tk)
|
|
|
834
|
- }
|
|
|
835
|
- for _, val := range tasklistData {
|
|
|
836
|
- taskData, ok := taskMapResult[val.TaskId]
|
|
|
837
|
- if !ok {
|
|
|
838
|
- continue
|
|
|
839
|
- }
|
|
|
840
|
- stage := adapter.TaskStage{
|
|
|
841
|
- Id: val.StageId,
|
|
|
842
|
- Name: val.StageName,
|
|
|
843
|
- SortBy: val.StageSortBy,
|
|
|
844
|
- PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
|
|
845
|
- RealCompletedAt: "",
|
|
|
846
|
- }
|
|
|
847
|
- if val.RealCompletedAt > 0 {
|
|
|
848
|
- stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
|
849
|
- }
|
|
|
850
|
- switch val.StageSortBy {
|
|
|
851
|
- case 1:
|
|
|
852
|
- taskData.StageA = stage
|
|
|
853
|
- case 2:
|
|
|
854
|
- taskData.StageB = stage
|
|
|
855
|
- case 3:
|
|
|
856
|
- taskData.StageC = stage
|
|
|
857
|
- case 4:
|
|
|
858
|
- taskData.StageD = stage
|
|
|
859
|
- case 5:
|
|
|
860
|
- taskData.StageE = stage
|
|
|
861
|
- }
|
814
|
+// taskResult := []*adapter.TaskItem{}
|
|
|
815
|
+// taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
816
|
+// for _, val := range tasklistData {
|
|
|
817
|
+// if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
818
|
+// continue
|
|
|
819
|
+// }
|
|
|
820
|
+// tk := adapter.TaskItem{
|
|
|
821
|
+// Id: val.TaskId,
|
|
|
822
|
+// Name: val.TaskName,
|
|
|
823
|
+// Alias: val.TaskAliasName,
|
|
|
824
|
+// Leader: val.LeaderName,
|
|
|
825
|
+// Status: val.TaskStatus,
|
|
|
826
|
+// Level: val.Level,
|
|
|
827
|
+// LevelName: val.LevelName,
|
|
|
828
|
+// UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
829
|
+// Anomaly: val.Anomaly,
|
|
|
830
|
+// WarnFlag: val.WarnFlag,
|
|
|
831
|
+// }
|
|
|
832
|
+// taskMapResult[val.TaskId] = &tk
|
|
|
833
|
+// taskResult = append(taskResult, &tk)
|
|
|
834
|
+// }
|
|
|
835
|
+// for _, val := range tasklistData {
|
|
|
836
|
+// taskData, ok := taskMapResult[val.TaskId]
|
|
|
837
|
+// if !ok {
|
|
|
838
|
+// continue
|
|
|
839
|
+// }
|
|
|
840
|
+// stage := adapter.TaskStage{
|
|
|
841
|
+// Id: val.StageId,
|
|
|
842
|
+// Name: val.StageName,
|
|
|
843
|
+// SortBy: val.StageSortBy,
|
|
|
844
|
+// PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
|
|
845
|
+// RealCompletedAt: "",
|
|
|
846
|
+// }
|
|
|
847
|
+// if val.RealCompletedAt > 0 {
|
|
|
848
|
+// stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
|
849
|
+// }
|
|
|
850
|
+// switch val.StageSortBy {
|
|
|
851
|
+// case 1:
|
|
|
852
|
+// taskData.StageA = stage
|
|
|
853
|
+// case 2:
|
|
|
854
|
+// taskData.StageB = stage
|
|
|
855
|
+// case 3:
|
|
|
856
|
+// taskData.StageC = stage
|
|
|
857
|
+// case 4:
|
|
|
858
|
+// taskData.StageD = stage
|
|
|
859
|
+// case 5:
|
|
|
860
|
+// taskData.StageE = stage
|
|
|
861
|
+// }
|
862
|
|
862
|
|
863
|
- }
|
|
|
864
|
- result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
865
|
- result["taskStageAnomaly"] = taskStageAnomalyCnt
|
|
|
866
|
- result["taskAnomalyCnt"] = taskAnomalyCnt
|
|
|
867
|
- return result, nil
|
|
|
868
|
-}
|
863
|
+// }
|
|
|
864
|
+// result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
865
|
+// result["taskStageAnomaly"] = taskStageAnomalyCnt
|
|
|
866
|
+// result["taskAnomalyCnt"] = taskAnomalyCnt
|
|
|
867
|
+// return result, nil
|
|
|
868
|
+// }
|
869
|
|
869
|
|
870
|
// 以hrbp角色权限获取任务列表
|
870
|
// 以hrbp角色权限获取任务列表
|
871
|
// 统计里程碑异常数,反馈异常数
|
871
|
// 统计里程碑异常数,反馈异常数
|
872
|
-func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
873
|
- var limit = 20
|
|
|
874
|
- var offset = 0
|
|
|
875
|
- if param.PageSize > 0 {
|
|
|
876
|
- limit = param.PageSize
|
|
|
877
|
- if param.PageNumber > 0 {
|
|
|
878
|
- offset = (param.PageNumber - 1) * param.PageSize
|
|
|
879
|
- }
|
|
|
880
|
- }
|
|
|
881
|
- condition := dao.ListTaskCondition{
|
|
|
882
|
- Limit: limit,
|
|
|
883
|
- Offset: offset,
|
|
|
884
|
- UserId: param.UserId,
|
|
|
885
|
- CompanyId: param.CompanyId,
|
|
|
886
|
- OnlyMy: param.OnlyMy,
|
|
|
887
|
- SearchWord: param.SearchWord,
|
|
|
888
|
- }
|
|
|
889
|
- transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
890
|
- if err != nil {
|
|
|
891
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
892
|
- }
|
|
|
893
|
- if err := transactionContext.StartTransaction(); err != nil {
|
|
|
894
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
895
|
- }
|
|
|
896
|
- defer func() {
|
|
|
897
|
- _ = transactionContext.RollbackTransaction()
|
|
|
898
|
- }()
|
|
|
899
|
- taskDao := dao.NewTaskDao(map[string]interface{}{
|
|
|
900
|
- "transactionContext": transactionContext,
|
|
|
901
|
- })
|
|
|
902
|
- tasklistData, err := taskDao.ListTaskStageByHrbp(condition)
|
|
|
903
|
- if err != nil {
|
|
|
904
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
905
|
- }
|
|
|
906
|
- taskCount, err := taskDao.CountTaskByHrbp(condition)
|
|
|
907
|
- if err != nil {
|
|
|
908
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
|
|
|
909
|
- }
|
|
|
910
|
- taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyByHrbp(condition)
|
|
|
911
|
- if err != nil {
|
|
|
912
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
913
|
- }
|
|
|
914
|
- taskAnomalyCnt, err := taskDao.CountTaskAnomalyByHrbp(condition)
|
|
|
915
|
- if err != nil {
|
|
|
916
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
917
|
- }
|
|
|
918
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
919
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
920
|
- }
|
|
|
921
|
- taskResult := []*adapter.TaskItem{}
|
|
|
922
|
- taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
923
|
- for _, val := range tasklistData {
|
|
|
924
|
- if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
925
|
- continue
|
|
|
926
|
- }
|
|
|
927
|
- tk := adapter.TaskItem{
|
|
|
928
|
- Id: val.TaskId,
|
|
|
929
|
- Name: val.TaskName,
|
|
|
930
|
- Alias: val.TaskAliasName,
|
|
|
931
|
- Leader: val.LeaderName,
|
|
|
932
|
- Status: val.TaskStatus,
|
|
|
933
|
- Level: val.Level,
|
|
|
934
|
- LevelName: val.LevelName,
|
|
|
935
|
- UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
936
|
- Anomaly: val.Anomaly,
|
|
|
937
|
- WarnFlag: val.WarnFlag,
|
|
|
938
|
- // StageA: adapter.TaskStage{},
|
|
|
939
|
- // StageB: adapter.TaskStage{},
|
|
|
940
|
- // StageC: adapter.TaskStage{},
|
|
|
941
|
- // StageD: adapter.TaskStage{},
|
|
|
942
|
- // StageE: adapter.TaskStage{},
|
|
|
943
|
- }
|
|
|
944
|
- taskMapResult[val.TaskId] = &tk
|
|
|
945
|
- taskResult = append(taskResult, &tk)
|
|
|
946
|
- }
|
|
|
947
|
- for _, val := range tasklistData {
|
|
|
948
|
- taskData, ok := taskMapResult[val.TaskId]
|
|
|
949
|
- if !ok {
|
|
|
950
|
- continue
|
|
|
951
|
- }
|
|
|
952
|
- stage := adapter.TaskStage{
|
|
|
953
|
- Id: val.StageId,
|
|
|
954
|
- Name: val.StageName,
|
|
|
955
|
- SortBy: val.StageSortBy,
|
|
|
956
|
- PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
|
|
957
|
- RealCompletedAt: "",
|
|
|
958
|
- }
|
|
|
959
|
- if val.RealCompletedAt > 0 {
|
|
|
960
|
- stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
|
961
|
- }
|
|
|
962
|
- switch val.StageSortBy {
|
|
|
963
|
- case 1:
|
|
|
964
|
- taskData.StageA = stage
|
|
|
965
|
- case 2:
|
|
|
966
|
- taskData.StageB = stage
|
|
|
967
|
- case 3:
|
|
|
968
|
- taskData.StageC = stage
|
|
|
969
|
- case 4:
|
|
|
970
|
- taskData.StageD = stage
|
|
|
971
|
- case 5:
|
|
|
972
|
- taskData.StageE = stage
|
|
|
973
|
- }
|
|
|
974
|
- }
|
|
|
975
|
- result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
976
|
- result["taskStageAnomaly"] = taskStageAnomalyCnt
|
|
|
977
|
- result["taskAnomalyCnt"] = taskAnomalyCnt
|
|
|
978
|
- return result, nil
|
|
|
979
|
-}
|
872
|
+// func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
873
|
+// var limit = 20
|
|
|
874
|
+// var offset = 0
|
|
|
875
|
+// if param.PageSize > 0 {
|
|
|
876
|
+// limit = param.PageSize
|
|
|
877
|
+// if param.PageNumber > 0 {
|
|
|
878
|
+// offset = (param.PageNumber - 1) * param.PageSize
|
|
|
879
|
+// }
|
|
|
880
|
+// }
|
|
|
881
|
+// condition := dao.ListTaskCondition{
|
|
|
882
|
+// Limit: limit,
|
|
|
883
|
+// Offset: offset,
|
|
|
884
|
+// UserId: param.UserId,
|
|
|
885
|
+// CompanyId: param.CompanyId,
|
|
|
886
|
+// OnlyMy: param.OnlyMy,
|
|
|
887
|
+// SearchWord: param.SearchWord,
|
|
|
888
|
+// }
|
|
|
889
|
+// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
890
|
+// if err != nil {
|
|
|
891
|
+// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
892
|
+// }
|
|
|
893
|
+// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
894
|
+// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
895
|
+// }
|
|
|
896
|
+// defer func() {
|
|
|
897
|
+// _ = transactionContext.RollbackTransaction()
|
|
|
898
|
+// }()
|
|
|
899
|
+// taskDao := dao.NewTaskDao(map[string]interface{}{
|
|
|
900
|
+// "transactionContext": transactionContext,
|
|
|
901
|
+// })
|
|
|
902
|
+// tasklistData, err := taskDao.ListTaskStageByHrbp(condition)
|
|
|
903
|
+// if err != nil {
|
|
|
904
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
905
|
+// }
|
|
|
906
|
+// taskCount, err := taskDao.CountTaskByHrbp(condition)
|
|
|
907
|
+// if err != nil {
|
|
|
908
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
|
|
|
909
|
+// }
|
|
|
910
|
+// taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyByHrbp(condition)
|
|
|
911
|
+// if err != nil {
|
|
|
912
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
913
|
+// }
|
|
|
914
|
+// taskAnomalyCnt, err := taskDao.CountTaskAnomalyByHrbp(condition)
|
|
|
915
|
+// if err != nil {
|
|
|
916
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
|
|
|
917
|
+// }
|
|
|
918
|
+// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
919
|
+// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
920
|
+// }
|
|
|
921
|
+// taskResult := []*adapter.TaskItem{}
|
|
|
922
|
+// taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
923
|
+// for _, val := range tasklistData {
|
|
|
924
|
+// if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
925
|
+// continue
|
|
|
926
|
+// }
|
|
|
927
|
+// tk := adapter.TaskItem{
|
|
|
928
|
+// Id: val.TaskId,
|
|
|
929
|
+// Name: val.TaskName,
|
|
|
930
|
+// Alias: val.TaskAliasName,
|
|
|
931
|
+// Leader: val.LeaderName,
|
|
|
932
|
+// Status: val.TaskStatus,
|
|
|
933
|
+// Level: val.Level,
|
|
|
934
|
+// LevelName: val.LevelName,
|
|
|
935
|
+// UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
936
|
+// Anomaly: val.Anomaly,
|
|
|
937
|
+// WarnFlag: val.WarnFlag,
|
|
|
938
|
+// // StageA: adapter.TaskStage{},
|
|
|
939
|
+// // StageB: adapter.TaskStage{},
|
|
|
940
|
+// // StageC: adapter.TaskStage{},
|
|
|
941
|
+// // StageD: adapter.TaskStage{},
|
|
|
942
|
+// // StageE: adapter.TaskStage{},
|
|
|
943
|
+// }
|
|
|
944
|
+// taskMapResult[val.TaskId] = &tk
|
|
|
945
|
+// taskResult = append(taskResult, &tk)
|
|
|
946
|
+// }
|
|
|
947
|
+// for _, val := range tasklistData {
|
|
|
948
|
+// taskData, ok := taskMapResult[val.TaskId]
|
|
|
949
|
+// if !ok {
|
|
|
950
|
+// continue
|
|
|
951
|
+// }
|
|
|
952
|
+// stage := adapter.TaskStage{
|
|
|
953
|
+// Id: val.StageId,
|
|
|
954
|
+// Name: val.StageName,
|
|
|
955
|
+// SortBy: val.StageSortBy,
|
|
|
956
|
+// PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
|
|
957
|
+// RealCompletedAt: "",
|
|
|
958
|
+// }
|
|
|
959
|
+// if val.RealCompletedAt > 0 {
|
|
|
960
|
+// stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
|
961
|
+// }
|
|
|
962
|
+// switch val.StageSortBy {
|
|
|
963
|
+// case 1:
|
|
|
964
|
+// taskData.StageA = stage
|
|
|
965
|
+// case 2:
|
|
|
966
|
+// taskData.StageB = stage
|
|
|
967
|
+// case 3:
|
|
|
968
|
+// taskData.StageC = stage
|
|
|
969
|
+// case 4:
|
|
|
970
|
+// taskData.StageD = stage
|
|
|
971
|
+// case 5:
|
|
|
972
|
+// taskData.StageE = stage
|
|
|
973
|
+// }
|
|
|
974
|
+// }
|
|
|
975
|
+// result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
976
|
+// result["taskStageAnomaly"] = taskStageAnomalyCnt
|
|
|
977
|
+// result["taskAnomalyCnt"] = taskAnomalyCnt
|
|
|
978
|
+// return result, nil
|
|
|
979
|
+// }
|
980
|
|
980
|
|
981
|
// ReplyTaskStage 根据每日的任务反馈 ,更新任务里程碑
|
981
|
// ReplyTaskStage 根据每日的任务反馈 ,更新任务里程碑
|
982
|
func (srv TaskService) ReplyTaskStage(transactionContext application.TransactionContext, param []*domain.TaskRecord, isFirstSubmit bool) error {
|
982
|
func (srv TaskService) ReplyTaskStage(transactionContext application.TransactionContext, param []*domain.TaskRecord, isFirstSubmit bool) error {
|