Commit 8ea7302a by HlQ

feat: 有关人员工单查询,添加未完成工单数量查询条件;以及按照有关项目工单查询,返回项目名称字段

1 parent 32be1f8f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<mapstruct-plus.version>1.5.0</mapstruct-plus.version> <mapstruct-plus.version>1.5.0</mapstruct-plus.version>
<mp.version>3.5.14</mp.version> <mp.version>3.5.14</mp.version>
<mp-join.version>1.5.4</mp-join.version> <mp-join.version>1.5.4</mp-join.version>
<wx-mp.version>4.7.7.B</wx-mp.version> <wx-mp.version>4.7.6.B</wx-mp.version>
<sa-token.verion>1.44.0</sa-token.verion> <sa-token.verion>1.44.0</sa-token.verion>
<myexcel.version>4.5.6</myexcel.version> <myexcel.version>4.5.6</myexcel.version>
<maxmind.version>4.4.0</maxmind.version> <maxmind.version>4.4.0</maxmind.version>
......
...@@ -163,8 +163,9 @@ public class TaskController { ...@@ -163,8 +163,9 @@ public class TaskController {
public List<Map<String, Object>> peopleAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate, public List<Map<String, Object>> peopleAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate,
Integer source, Integer source,
@RequestParam(required = false) List<Long> userIds) { @RequestParam(required = false) List<Long> userIds,
return taskService.peopleAnalysis(startDate, endDate, source, userIds); Integer unfinishNum) {
return taskService.peopleAnalysis(startDate, endDate, source, userIds, unfinishNum);
} }
@GetMapping("/task/proAnal") @GetMapping("/task/proAnal")
...@@ -172,8 +173,9 @@ public class TaskController { ...@@ -172,8 +173,9 @@ public class TaskController {
public List<Map<String, Object>> proAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate, public List<Map<String, Object>> proAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate,
Integer source, Integer source,
@RequestParam(required = false) List<Long> userIds) { @RequestParam(required = false) List<Long> userIds,
return taskService.proAnalysis(startDate, endDate, source, userIds); Long storeId) {
return taskService.proAnalysis(startDate, endDate, source, userIds, storeId);
} }
@GetMapping("/task/summaryAnal") @GetMapping("/task/summaryAnal")
...@@ -199,6 +201,7 @@ public class TaskController { ...@@ -199,6 +201,7 @@ public class TaskController {
/** /**
* 客流平台单独使用接口 * 客流平台单独使用接口
* 巡检报告下载 * 巡检报告下载
*
* @param taskId taskId * @param taskId taskId
* @return org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource> * @return org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource>
*/ */
......
...@@ -54,7 +54,7 @@ public class Task { ...@@ -54,7 +54,7 @@ public class Task {
@TableField(condition = SqlCondition.LIKE) @TableField(condition = SqlCondition.LIKE)
private String repairPhone; private String repairPhone;
/** /**
* 状态 * 状态 对应字典值 order_status
*/ */
@OrderBy(asc = true, sort = 1) @OrderBy(asc = true, sort = 1)
private Integer status; private Integer status;
...@@ -68,7 +68,7 @@ public class Task { ...@@ -68,7 +68,7 @@ public class Task {
*/ */
private String faultReason; private String faultReason;
/** /**
* 解决措施:0产品BUG、1使用问题、2需求问题 * 解决措施
*/ */
private Integer solveType; private Integer solveType;
/** /**
......
...@@ -52,7 +52,7 @@ public class TaskTemp { ...@@ -52,7 +52,7 @@ public class TaskTemp {
@TableField(condition = SqlCondition.LIKE) @TableField(condition = SqlCondition.LIKE)
private String repairPhone; private String repairPhone;
/** /**
* 状态(1待确认、2进行中、3已确认) * 状态 对应字典值 order_temp_status
*/ */
@OrderBy(asc = true, sort = 1) @OrderBy(asc = true, sort = 1)
private Integer status; private Integer status;
......
...@@ -28,10 +28,9 @@ public interface ITaskService extends MPJBaseService<Task> { ...@@ -28,10 +28,9 @@ public interface ITaskService extends MPJBaseService<Task> {
String urgeTask(Long taskId, String remark); String urgeTask(Long taskId, String remark);
List<Map<String, Object>> peopleAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Map<String, Object>> peopleAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds, Integer finishNum);
List<Long> userIds);
List<Map<String, Object>> proAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds); List<Map<String, Object>> proAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds, Long storeId);
Map<String, Map<String, List<Task>>> summaryAnalysis(LocalDate startDate, LocalDate endDate, Integer source); Map<String, Map<String, List<Task>>> summaryAnalysis(LocalDate startDate, LocalDate endDate, Integer source);
} }
...@@ -453,13 +453,16 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -453,13 +453,16 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
} }
@Override @Override
public List<Map<String, Object>> peopleAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds) { public List<Map<String, Object>> peopleAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds, Integer unfinishNum) {
List<Task> taskList = this.lambdaQuery() var wrapper = new MPJLambdaWrapper<Task>()
.selectAll(Task.class)
.selectAs(Store::getName, TaskVO::getStoreName)
.leftJoin(Store.class, Store::getId, Task::getStoreId)
.between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate) .between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate)
.isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId) .isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(source, 2), Task::getTaskTempId) .isNull(ObjUtil.equals(source, 2), Task::getTaskTempId)
.in(ArrayUtil.isNotEmpty(userIds), Task::getActiveUser, userIds) .in(ArrayUtil.isNotEmpty(userIds), Task::getActiveUser, userIds);
.list(); var taskList = this.selectJoinList(TaskVO.class, wrapper);
List<Store> storeList = storeService.list(); List<Store> storeList = storeService.list();
Map<Long, String> id2UsernameMap = userService.list().stream().collect(Collectors.toMap(User::getId, User::getUsername)); Map<Long, String> id2UsernameMap = userService.list().stream().collect(Collectors.toMap(User::getId, User::getUsername));
List<FaultLog> logList = faultLogService.lambdaQuery().list(); List<FaultLog> logList = faultLogService.lambdaQuery().list();
...@@ -474,7 +477,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -474,7 +477,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
Collectors.toList()))); Collectors.toList())));
// 人 => 工单 // 人 => 工单
Map<Long, List<Task>> p2TaskMap = taskList.stream().collect(Collectors.groupingBy(Task::getActiveUser)); Map<Long, List<TaskVO>> p2TaskMap = taskList.stream().collect(Collectors.groupingBy(TaskVO::getActiveUser));
var resList = new ArrayList<Map<String, Object>>(); var resList = new ArrayList<Map<String, Object>>();
p2TaskMap.forEach((p, list) -> { p2TaskMap.forEach((p, list) -> {
var hourSum = taskId2HourMap.getOrDefault(p, 0D); var hourSum = taskId2HourMap.getOrDefault(p, 0D);
...@@ -482,7 +485,11 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -482,7 +485,11 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList(); var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList();
var expList = inList.stream().filter(v -> v.getExpDate().isAfter(LocalDate.now())).toList(); var expList = inList.stream().filter(v -> v.getExpDate().isAfter(LocalDate.now())).toList();
var finishList = taskList.stream().filter(t -> user2TaskIdMap.getOrDefault(p, List.of()).contains(t.getId())).toList(); var finishList = taskList.stream().filter(t -> user2TaskIdMap.getOrDefault(p, List.of()).contains(t.getId())).toList();
var storeIdSet = list.stream().map(Task::getStoreId).collect(Collectors.toSet()); // 未完成的工单数量 小于等于 unfinishNum 则不加入结果集
if (ObjUtil.isNotNull(unfinishNum) && inList.size() <= unfinishNum) {
return;
}
var storeIdSet = list.stream().map(TaskVO::getStoreId).collect(Collectors.toSet());
var storeNameList = storeList.stream().filter(v -> storeIdSet.contains(v.getId())).distinct().map(Store::getName).collect(Collectors.joining(",")); var storeNameList = storeList.stream().filter(v -> storeIdSet.contains(v.getId())).distinct().map(Store::getName).collect(Collectors.joining(","));
Map<String, Object> cntMap = Map.of("person", id2UsernameMap.get(p), Map<String, Object> cntMap = Map.of("person", id2UsernameMap.get(p),
"total", CollUtil.unionDistinct(finishList, inList), "total", CollUtil.unionDistinct(finishList, inList),
...@@ -499,9 +506,10 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -499,9 +506,10 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
} }
@Override @Override
public List<Map<String, Object>> proAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds) { public List<Map<String, Object>> proAnalysis(LocalDate startDate, LocalDate endDate, Integer source, List<Long> userIds, Long storeId) {
List<Task> taskList = this.lambdaQuery() List<Task> taskList = this.lambdaQuery()
.between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate) .between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate)
.eq(ObjUtil.isNotNull(storeId), Task::getStoreId, storeId)
.isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId) .isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(source, 2), Task::getTaskTempId) .isNull(ObjUtil.equals(source, 2), Task::getTaskTempId)
.in(ArrayUtil.isNotEmpty(userIds), Task::getActiveUser, userIds) .in(ArrayUtil.isNotEmpty(userIds), Task::getActiveUser, userIds)
......
...@@ -44,7 +44,7 @@ public class TaskTempVO { ...@@ -44,7 +44,7 @@ public class TaskTempVO {
*/ */
private String repairPhone; private String repairPhone;
/** /**
* 状态(1待确认、2已确认) * 状态 对应字典值 order_temp_status
*/ */
private Integer status; private Integer status;
private LocalDateTime createTime; private LocalDateTime createTime;
......
...@@ -62,9 +62,9 @@ public class TaskVO { ...@@ -62,9 +62,9 @@ public class TaskVO {
@ExcelColumn(order = 4, title = "联系方式") @ExcelColumn(order = 4, title = "联系方式")
private String repairPhone; private String repairPhone;
/** /**
* 状态:0待确认1进行中2已完成3挂起 * 状态 对应字典值 order_status
*/ */
@ExcelColumn(order = 6, title = "状态", mapping = "0:待确认,1:进行中,2:进行中,3:已完成,4:挂起,5:已关闭") @ExcelColumn(order = 6, title = "状态", mapping = "2:进行中,3:已完成,4:挂起,5:已关闭")
private Integer status; private Integer status;
/** /**
* 解决日期 * 解决日期
...@@ -75,7 +75,7 @@ public class TaskVO { ...@@ -75,7 +75,7 @@ public class TaskVO {
*/ */
private String faultReason; private String faultReason;
/** /**
* 解决措施:0产品BUG、1使用问题、2需求问题 * 解决措施
*/ */
private Integer solveType; private Integer solveType;
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!