|
@@ -2,11 +2,13 @@ package service |
|
@@ -2,11 +2,13 @@ package service |
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
4
|
"fmt"
|
4
|
"fmt"
|
5
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt"
|
|
|
6
|
"strconv"
|
5
|
"strconv"
|
7
|
"strings"
|
6
|
"strings"
|
8
|
"time"
|
7
|
"time"
|
9
|
|
8
|
|
|
|
9
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt"
|
|
|
10
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime"
|
|
|
11
|
+
|
10
|
"github.com/linmadan/egglib-go/core/application"
|
12
|
"github.com/linmadan/egglib-go/core/application"
|
11
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
13
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
14
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
@@ -1211,8 +1213,9 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
|
@@ -1211,8 +1213,9 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
1211
|
RealCompletedAt: "",
|
1213
|
RealCompletedAt: "",
|
1212
|
IsRef: false,
|
1214
|
IsRef: false,
|
1213
|
},
|
1215
|
},
|
1214
|
- AnomalyDesc: []string{},
|
|
|
1215
|
- Marks: map[string]string{},
|
1216
|
+ AnomalyDesc: []string{},
|
|
|
1217
|
+ AnomalyDesc2: []map[string]string{},
|
|
|
1218
|
+ Marks: map[string]string{},
|
1216
|
}
|
1219
|
}
|
1217
|
if val.LastStage.RealCompletedAt > 0 {
|
1220
|
if val.LastStage.RealCompletedAt > 0 {
|
1218
|
tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
|
1221
|
tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
@@ -1257,26 +1260,94 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
|
@@ -1257,26 +1260,94 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
1257
|
}
|
1260
|
}
|
1258
|
}
|
1261
|
}
|
1259
|
tk.GenStatusDescript()
|
1262
|
tk.GenStatusDescript()
|
1260
|
- for _, val := range taskAnomalyList {
|
|
|
1261
|
- if tk.Id != val.TaskId {
|
1263
|
+ for _, val3 := range taskAnomalyList {
|
|
|
1264
|
+ if tk.Id != val3.TaskId {
|
1262
|
continue
|
1265
|
continue
|
1263
|
}
|
1266
|
}
|
1264
|
- if val.Marks == nil {
|
|
|
1265
|
- val.Marks = map[string]string{}
|
1267
|
+ if val3.Marks == nil {
|
|
|
1268
|
+ val3.Marks = map[string]string{}
|
1266
|
}
|
1269
|
}
|
1267
|
- r := val.Remark + ",该条异常已通知"
|
|
|
1268
|
- for _, val2 := range val.NoticeWho {
|
|
|
1269
|
- r += val2["name"] + " "
|
1270
|
+ noticeWho := []string{}
|
|
|
1271
|
+ for _, val2 := range val3.NoticeWho {
|
|
|
1272
|
+ noticeWho = append(noticeWho, val2["name"])
|
|
|
1273
|
+ }
|
|
|
1274
|
+ switch val3.Category {
|
|
|
1275
|
+ case domain.AnomalyCategoryType1:
|
|
|
1276
|
+ {
|
|
|
1277
|
+ //里程碑异常
|
|
|
1278
|
+ if val3.TaskStageCheck.RealCompletedAt == 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
1279
|
+ //逾期未完成
|
|
|
1280
|
+ planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
1281
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, planCompletedAt)
|
|
|
1282
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s已逾期%d天", val3.TaskStageCheck.Name, subDay))
|
|
|
1283
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1284
|
+ "types": "10",
|
|
|
1285
|
+ "stageName": val3.TaskStageCheck.Name,
|
|
|
1286
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1287
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1288
|
+ })
|
|
|
1289
|
+ } else if val3.TaskStageCheck.RealCompletedAt > 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
1290
|
+ //逾期完成
|
|
|
1291
|
+ planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
1292
|
+ realCompletedAt := time.Unix(val3.TaskStageCheck.RealCompletedAt, 0)
|
|
|
1293
|
+ subDay := xtime.SubDayAbs(realCompletedAt, planCompletedAt)
|
|
|
1294
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s逾期%d天完成", val3.TaskStageCheck.Name, subDay))
|
|
|
1295
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1296
|
+ "types": "11",
|
|
|
1297
|
+ "stageName": val3.TaskStageCheck.Name,
|
|
|
1298
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1299
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1300
|
+ })
|
|
|
1301
|
+ }
|
|
|
1302
|
+ }
|
|
|
1303
|
+ case domain.AnomalyCategoryType2:
|
|
|
1304
|
+ //反馈异常
|
|
|
1305
|
+ {
|
|
|
1306
|
+ recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
1307
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
1308
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
1309
|
+ "本任务自%s未正常反馈项目进度,已异常%d天",
|
|
|
1310
|
+ recordBegin.Local().Format("2006-01-02"),
|
|
|
1311
|
+ subDay,
|
|
|
1312
|
+ ))
|
|
|
1313
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1314
|
+ "types": "2",
|
|
|
1315
|
+ "dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
1316
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1317
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1318
|
+ })
|
|
|
1319
|
+ }
|
|
|
1320
|
+ case domain.AnomalyCategoryType3:
|
|
|
1321
|
+ //辅导异常
|
|
|
1322
|
+ {
|
|
|
1323
|
+ recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
1324
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
1325
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
1326
|
+ "本任务计划于%s完成辅导,已逾期%d天",
|
|
|
1327
|
+ recordBegin.Local().Format("2006-01-02"),
|
|
|
1328
|
+ subDay,
|
|
|
1329
|
+ ))
|
|
|
1330
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1331
|
+ "types": "3",
|
|
|
1332
|
+ "dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
1333
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1334
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1335
|
+ })
|
|
|
1336
|
+ }
|
1270
|
}
|
1337
|
}
|
1271
|
- tk.AnomalyDesc = append(tk.AnomalyDesc, r)
|
|
|
1272
|
- switch val.Category {
|
1338
|
+ userId := strconv.Itoa(param.UserId)
|
|
|
1339
|
+ switch val3.Category {
|
1273
|
case domain.AnomalyCategoryType1:
|
1340
|
case domain.AnomalyCategoryType1:
|
1274
|
- tk.Marks["a"] = val.Marks["a"]
|
|
|
1275
|
- tk.Marks["c"] = val.Marks["c"]
|
1341
|
+ if userId == val.LeaderId {
|
|
|
1342
|
+ tk.Marks["a"] = val3.Marks["a"]
|
|
|
1343
|
+ tk.Marks["c"] = val3.Marks["c"]
|
|
|
1344
|
+ } else {
|
|
|
1345
|
+ tk.Marks["d"] = val3.Marks["d"]
|
|
|
1346
|
+ }
|
1276
|
case domain.AnomalyCategoryType2:
|
1347
|
case domain.AnomalyCategoryType2:
|
1277
|
- tk.Marks["b"] = val.Marks["b"]
|
1348
|
+ tk.Marks["b"] = val3.Marks["b"]
|
1278
|
case domain.AnomalyCategoryType3:
|
1349
|
case domain.AnomalyCategoryType3:
|
1279
|
- tk.Marks["d"] = val.Marks["d"]
|
1350
|
+ tk.Marks["d"] = val3.Marks["d"]
|
1280
|
}
|
1351
|
}
|
1281
|
}
|
1352
|
}
|
1282
|
taskResult = append(taskResult, &tk)
|
1353
|
taskResult = append(taskResult, &tk)
|
|
@@ -1394,6 +1465,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
|
@@ -1394,6 +1465,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
1394
|
PlanCompletedAt: time.Unix(int64(val.CurrentStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
1465
|
PlanCompletedAt: time.Unix(int64(val.CurrentStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
1395
|
RealCompletedAt: "",
|
1466
|
RealCompletedAt: "",
|
1396
|
},
|
1467
|
},
|
|
|
1468
|
+ Marks: map[string]string{},
|
1397
|
}
|
1469
|
}
|
1398
|
if val.LastStage.RealCompletedAt > 0 {
|
1470
|
if val.LastStage.RealCompletedAt > 0 {
|
1399
|
tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
|
1471
|
tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
|
|
@@ -1439,27 +1511,97 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
|
@@ -1439,27 +1511,97 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
1439
|
}
|
1511
|
}
|
1440
|
}
|
1512
|
}
|
1441
|
tk.GenStatusDescript()
|
1513
|
tk.GenStatusDescript()
|
1442
|
- for _, val := range taskAnomalyList {
|
|
|
1443
|
- if tk.Id != val.TaskId {
|
1514
|
+ for _, val3 := range taskAnomalyList {
|
|
|
1515
|
+ if tk.Id != val3.TaskId {
|
1444
|
continue
|
1516
|
continue
|
1445
|
}
|
1517
|
}
|
1446
|
- if len(val.Marks) == 0 {
|
|
|
1447
|
- val.Marks = map[string]string{}
|
1518
|
+ if val3.Marks == nil {
|
|
|
1519
|
+ val3.Marks = map[string]string{}
|
|
|
1520
|
+ }
|
|
|
1521
|
+ noticeWho := []string{}
|
|
|
1522
|
+ for _, val2 := range val3.NoticeWho {
|
|
|
1523
|
+ noticeWho = append(noticeWho, val2["name"])
|
|
|
1524
|
+ }
|
|
|
1525
|
+ switch val3.Category {
|
|
|
1526
|
+ case domain.AnomalyCategoryType1:
|
|
|
1527
|
+ {
|
|
|
1528
|
+ //里程碑异常
|
|
|
1529
|
+ if val3.TaskStageCheck.RealCompletedAt == 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
1530
|
+ //逾期未完成
|
|
|
1531
|
+ planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
1532
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, planCompletedAt)
|
|
|
1533
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s已逾期%d天", val3.TaskStageCheck.Name, subDay))
|
|
|
1534
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1535
|
+ "types": "10",
|
|
|
1536
|
+ "stageName": val3.TaskStageCheck.Name,
|
|
|
1537
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1538
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1539
|
+ })
|
|
|
1540
|
+ } else if val3.TaskStageCheck.RealCompletedAt > 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
1541
|
+ //逾期完成
|
|
|
1542
|
+ planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
1543
|
+ realCompletedAt := time.Unix(val3.TaskStageCheck.RealCompletedAt, 0)
|
|
|
1544
|
+ subDay := xtime.SubDayAbs(realCompletedAt, planCompletedAt)
|
|
|
1545
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s逾期%d天完成", val3.TaskStageCheck.Name, subDay))
|
|
|
1546
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1547
|
+ "types": "11",
|
|
|
1548
|
+ "stageName": val3.TaskStageCheck.Name,
|
|
|
1549
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1550
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1551
|
+ })
|
|
|
1552
|
+ }
|
|
|
1553
|
+ }
|
|
|
1554
|
+ case domain.AnomalyCategoryType2:
|
|
|
1555
|
+ //反馈异常
|
|
|
1556
|
+ {
|
|
|
1557
|
+ recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
1558
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
1559
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
1560
|
+ "本任务自%s未正常反馈项目进度,已异常%d天",
|
|
|
1561
|
+ recordBegin.Local().Format("2006-01-02"),
|
|
|
1562
|
+ subDay,
|
|
|
1563
|
+ ))
|
|
|
1564
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1565
|
+ "types": "2",
|
|
|
1566
|
+ "dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
1567
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1568
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1569
|
+ })
|
|
|
1570
|
+ }
|
|
|
1571
|
+ case domain.AnomalyCategoryType3:
|
|
|
1572
|
+ //辅导异常
|
|
|
1573
|
+ {
|
|
|
1574
|
+ recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
1575
|
+ subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
1576
|
+ tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
1577
|
+ "本任务计划于%s完成辅导,已逾期%d天",
|
|
|
1578
|
+ recordBegin.Local().Format("2006-01-02"),
|
|
|
1579
|
+ subDay,
|
|
|
1580
|
+ ))
|
|
|
1581
|
+ tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
1582
|
+ "types": "3",
|
|
|
1583
|
+ "dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
1584
|
+ "interval": strconv.Itoa(subDay),
|
|
|
1585
|
+ "noticeWho": strings.Join(noticeWho, ","),
|
|
|
1586
|
+ })
|
|
|
1587
|
+ }
|
1448
|
}
|
1588
|
}
|
1449
|
- r := val.Remark + ",该条异常已通知"
|
|
|
1450
|
- for _, val2 := range val.NoticeWho {
|
|
|
1451
|
- r += val2["name"] + " "
|
1589
|
+ if len(val3.Marks) == 0 {
|
|
|
1590
|
+ val3.Marks = map[string]string{}
|
1452
|
}
|
1591
|
}
|
1453
|
- tk.AnomalyDesc = append(tk.AnomalyDesc, r)
|
|
|
1454
|
- tk.Marks = map[string]string{}
|
|
|
1455
|
- switch val.Category {
|
1592
|
+ userId := strconv.Itoa(param.UserId)
|
|
|
1593
|
+ switch val3.Category {
|
1456
|
case domain.AnomalyCategoryType1:
|
1594
|
case domain.AnomalyCategoryType1:
|
1457
|
- tk.Marks["a"] = val.Marks["a"]
|
|
|
1458
|
- tk.Marks["c"] = val.Marks["c"]
|
1595
|
+ if userId == val.LeaderId {
|
|
|
1596
|
+ tk.Marks["a"] = val3.Marks["a"]
|
|
|
1597
|
+ tk.Marks["c"] = val3.Marks["c"]
|
|
|
1598
|
+ } else {
|
|
|
1599
|
+ tk.Marks["d"] = val3.Marks["d"]
|
|
|
1600
|
+ }
|
1459
|
case domain.AnomalyCategoryType2:
|
1601
|
case domain.AnomalyCategoryType2:
|
1460
|
- tk.Marks["b"] = val.Marks["b"]
|
1602
|
+ tk.Marks["b"] = val3.Marks["b"]
|
1461
|
case domain.AnomalyCategoryType3:
|
1603
|
case domain.AnomalyCategoryType3:
|
1462
|
- tk.Marks["d"] = val.Marks["d"]
|
1604
|
+ tk.Marks["d"] = val3.Marks["d"]
|
1463
|
}
|
1605
|
}
|
1464
|
}
|
1606
|
}
|
1465
|
taskResult = append(taskResult, &tk)
|
1607
|
taskResult = append(taskResult, &tk)
|