作者 tangxvhui

调整异常详情输出详情

@@ -4,4 +4,5 @@ package command @@ -4,4 +4,5 @@ package command
4 type GetTaskAnomalyCommand struct { 4 type GetTaskAnomalyCommand struct {
5 Id int `json:"id,string"` 5 Id int `json:"id,string"`
6 CompanyId int `json:"-"` 6 CompanyId int `json:"-"`
  7 + UserId int `json:"-"`
7 } 8 }
@@ -829,6 +829,12 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a @@ -829,6 +829,12 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
829 if err != nil { 829 if err != nil {
830 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 830 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
831 } 831 }
  832 + userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
  833 + // 获取员工全部子集
  834 + childUser, err := userDao.AllChildUser(param.UserId)
  835 + if err != nil {
  836 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取下级员工"+err.Error())
  837 + }
832 if err := transactionContext.CommitTransaction(); err != nil { 838 if err := transactionContext.CommitTransaction(); err != nil {
833 return nil, nil 839 return nil, nil
834 } 840 }
@@ -877,16 +883,55 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a @@ -877,16 +883,55 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
877 TaskEndTime: taskData.EndTime, 883 TaskEndTime: taskData.EndTime,
878 TaskSortBy: int(taskData.SortBy), 884 TaskSortBy: int(taskData.SortBy),
879 RecordBegin: anomalyData.RecordBegin, 885 RecordBegin: anomalyData.RecordBegin,
880 - CreatedAt: anomalyData.CreatedAt.Local().Format("066-017"),  
881 - MarkA: anomalyData.Marks["a"],  
882 - MarkB: anomalyData.Marks["b"],  
883 - MarkC: anomalyData.Marks["c"],  
884 - MarkD: anomalyData.Marks["d"], 886 + CreatedAt: anomalyData.CreatedAt.Local().Format("2006-01-02"),
  887 + MarkA: "",
  888 + MarkB: "",
  889 + MarkC: "",
  890 + MarkD: "",
885 AnomalyDesc: "", 891 AnomalyDesc: "",
886 AnomalyDesc2: map[string]string{ 892 AnomalyDesc2: map[string]string{
887 "": "", 893 "": "",
888 }, 894 },
889 } 895 }
  896 + // 设置操作标记
  897 + {
  898 + isChildUser := false
  899 + for _, child := range childUser {
  900 + if int64(child.Id) == taskData.Leader.Id {
  901 + isChildUser = true
  902 + break
  903 + }
  904 + }
  905 + switch anomalyData.Category {
  906 + case domain.AnomalyCategoryType1:
  907 + // 里程碑异常
  908 + if param.UserId == int(taskData.Leader.Id) {
  909 + // 去更新
  910 + result.MarkA = anomalyData.Marks["a"]
  911 + // 找上级
  912 + result.MarkC = anomalyData.Marks["c"]
  913 + } else if isChildUser {
  914 + // 去辅导
  915 + result.MarkD = anomalyData.Marks["d"]
  916 + }
  917 + case domain.AnomalyCategoryType2:
  918 + if param.UserId == int(taskData.Leader.Id) {
  919 + // 去反馈
  920 + result.MarkB = anomalyData.Marks["b"]
  921 + } else if isChildUser {
  922 + // 去辅导
  923 + result.MarkD = anomalyData.Marks["d"]
  924 + }
  925 + case domain.AnomalyCategoryType3:
  926 + if param.UserId == int(taskData.Leader.Id) {
  927 + //空
  928 + } else if isChildUser {
  929 + // 去辅导
  930 + result.MarkD = anomalyData.Marks["d"]
  931 + }
  932 + }
  933 + }
  934 +
890 noticeWho := []string{} 935 noticeWho := []string{}
891 for _, val2 := range anomalyData.NoticeWho { 936 for _, val2 := range anomalyData.NoticeWho {
892 if name, ok := val2["name"]; ok { 937 if name, ok := val2["name"]; ok {
@@ -383,6 +383,7 @@ func (c *TaskController) TaskAnomalyInfo() { @@ -383,6 +383,7 @@ func (c *TaskController) TaskAnomalyInfo() {
383 } 383 }
384 userReq := middlewares.GetUser(c.Ctx) 384 userReq := middlewares.GetUser(c.Ctx)
385 paramReq.CompanyId = int(userReq.CompanyId) 385 paramReq.CompanyId = int(userReq.CompanyId)
  386 + userReq.UserId = userReq.UserId
386 resp, err := srv.TaskAnomalyInfo(paramReq) 387 resp, err := srv.TaskAnomalyInfo(paramReq)
387 c.Response(resp, err) 388 c.Response(resp, err)
388 } 389 }
@@ -399,6 +400,7 @@ func (c *TaskController) TaskAnomalyMarkByTask() { @@ -399,6 +400,7 @@ func (c *TaskController) TaskAnomalyMarkByTask() {
399 } 400 }
400 userReq := middlewares.GetUser(c.Ctx) 401 userReq := middlewares.GetUser(c.Ctx)
401 paramReq.CompanyId = int(userReq.CompanyId) 402 paramReq.CompanyId = int(userReq.CompanyId)
  403 + paramReq.UserId = int(userReq.UserId)
402 resp, err := srv.MarkTaskAnomalyByTask(paramReq) 404 resp, err := srv.MarkTaskAnomalyByTask(paramReq)
403 c.Response(resp, err) 405 c.Response(resp, err)
404 406