|
@@ -208,10 +208,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
@@ -208,10 +208,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
208
|
}
|
208
|
}
|
209
|
}
|
209
|
}
|
210
|
}
|
210
|
}
|
211
|
- //未参与的,不算在个人的评估环节里
|
|
|
212
|
- if stepItem.Status != "" {
|
|
|
213
|
- result.StepList = append(result.StepList, stepItem)
|
|
|
214
|
- }
|
211
|
+ result.StepList = append(result.StepList, stepItem)
|
215
|
}
|
212
|
}
|
216
|
if err := transactionContext.CommitTransaction(); err != nil {
|
213
|
if err := transactionContext.CommitTransaction(); err != nil {
|
217
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
214
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T |
|
@@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T |
1598
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
1595
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
1599
|
"transactionContext": transactionContext,
|
1596
|
"transactionContext": transactionContext,
|
1600
|
})
|
1597
|
})
|
|
|
1598
|
+ // //查找员工的部门
|
|
|
1599
|
+ // var departmentList []*domain.Department
|
|
|
1600
|
+ // if len(userData.DepartmentId) > 0 {
|
|
|
1601
|
+
|
|
|
1602
|
+ // }
|
|
|
1603
|
+
|
1601
|
var supperUserList []*domain.User
|
1604
|
var supperUserList []*domain.User
|
1602
|
if len(userData.DepartmentId) > 0 {
|
1605
|
if len(userData.DepartmentId) > 0 {
|
1603
|
_, departmentList, err := departmentRepo.Find(map[string]interface{}{
|
1606
|
_, departmentList, err := departmentRepo.Find(map[string]interface{}{
|
|
@@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
@@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
1659
|
if endTimeInt < time.Now().Unix() {
|
1662
|
if endTimeInt < time.Now().Unix() {
|
1660
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容")
|
1663
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容")
|
1661
|
}
|
1664
|
}
|
1662
|
-
|
1665
|
+ //检查执行人
|
|
|
1666
|
+ if assessData.CompanyId != param.CompanyId {
|
|
|
1667
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
|
|
|
1668
|
+ }
|
|
|
1669
|
+ if assessData.Executor.UserId != param.ExecutorId {
|
|
|
1670
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
|
|
|
1671
|
+ }
|
1663
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
1672
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
1664
|
"transactionContext": transactionContext,
|
1673
|
"transactionContext": transactionContext,
|
1665
|
})
|
1674
|
})
|
|
@@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
|
@@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
1763
|
|
1772
|
|
1764
|
return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
|
1773
|
return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
|
1765
|
}
|
1774
|
}
|
|
|
1775
|
+
|
|
|
1776
|
+//获取员工的上级是谁 ,TODO
|
|
|
1777
|
+func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]domain.User, error) {
|
|
|
1778
|
+ departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
1779
|
+ "transactionContext": transactionContext,
|
|
|
1780
|
+ })
|
|
|
1781
|
+ userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
1782
|
+ "transactionContext": transactionContext,
|
|
|
1783
|
+ })
|
|
|
1784
|
+
|
|
|
1785
|
+ var departmemtList []*domain.Department
|
|
|
1786
|
+ var err error
|
|
|
1787
|
+ if len(targetUser.DepartmentId) > 0 {
|
|
|
1788
|
+ _, departmemtList, err = departmentRepo.Find(map[string]interface{}{
|
|
|
1789
|
+ "ids": targetUser.DepartmentId,
|
|
|
1790
|
+ })
|
|
|
1791
|
+ if err != nil {
|
|
|
1792
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的部门列表"+err.Error())
|
|
|
1793
|
+ }
|
|
|
1794
|
+ }
|
|
|
1795
|
+ if len(departmemtList) == 0 {
|
|
|
1796
|
+
|
|
|
1797
|
+ }
|
|
|
1798
|
+ //获取部门管理员
|
|
|
1799
|
+ var chargeUserIds []int64
|
|
|
1800
|
+ var targetUserAsManager *domain.Department
|
|
|
1801
|
+loop:
|
|
|
1802
|
+ for _, v := range departmemtList {
|
|
|
1803
|
+ if len(v.ChargeUserIds) == 0 {
|
|
|
1804
|
+ continue
|
|
|
1805
|
+ }
|
|
|
1806
|
+ //检查员工自身是否是管理员
|
|
|
1807
|
+ for _, vv := range v.ChargeUserIds {
|
|
|
1808
|
+ if vv == targetUser.Id {
|
|
|
1809
|
+ targetUserAsManager = v
|
|
|
1810
|
+ break loop
|
|
|
1811
|
+ }
|
|
|
1812
|
+ }
|
|
|
1813
|
+ chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
1814
|
+ }
|
|
|
1815
|
+ if targetUserAsManager != nil {
|
|
|
1816
|
+ //清空原有的管理员
|
|
|
1817
|
+ chargeUserIds = []int64{}
|
|
|
1818
|
+ //员工自身是否是管理员,查找父级部门
|
|
|
1819
|
+ _, parentDepartment, err := departmentRepo.Find(map[string]interface{}{
|
|
|
1820
|
+ "id": targetUserAsManager.ParentId,
|
|
|
1821
|
+ })
|
|
|
1822
|
+ if err != nil {
|
|
|
1823
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工现在部门的父级"+err.Error())
|
|
|
1824
|
+ }
|
|
|
1825
|
+ for _, v := range parentDepartment {
|
|
|
1826
|
+ chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
1827
|
+ }
|
|
|
1828
|
+ }
|
|
|
1829
|
+
|
|
|
1830
|
+ var chargeUserList []*domain.User
|
|
|
1831
|
+ if len(chargeUserIds) > 0 {
|
|
|
1832
|
+ _, chargeUserList, err = userRepo.Find(map[string]interface{}{
|
|
|
1833
|
+ "ids": chargeUserIds,
|
|
|
1834
|
+ })
|
|
|
1835
|
+ if err != nil {
|
|
|
1836
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
|
|
|
1837
|
+ }
|
|
|
1838
|
+ }
|
|
|
1839
|
+ if len(chargeUserList) == 0 {
|
|
|
1840
|
+ //如果都找不到数据
|
|
|
1841
|
+
|
|
|
1842
|
+ }
|
|
|
1843
|
+
|
|
|
1844
|
+ // _, chargeUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
1845
|
+ // "ids": chargeUserIds,
|
|
|
1846
|
+ // })
|
|
|
1847
|
+
|
|
|
1848
|
+ return nil, nil
|
|
|
1849
|
+} |