parent
896cfa3752
commit
8d3a43d152
|
|
@ -152,8 +152,9 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getQuestions")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取问题类型", isPublic = true)
|
||||
public ApiResult<List<String>> getQuestions() {
|
||||
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题", "工况方案问题", "操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观"));
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题"
|
||||
, "工况方案问题", "客户操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观", "安装问题", "调试问题"
|
||||
, "外购件质量问题", "运输问题"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -164,7 +165,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取收藏夹", isPublic = true)
|
||||
public ApiResult<FavoritesVO> getFavorites(@RequestParam(defaultValue = "0") Integer id) {
|
||||
|
||||
return ApiResult.success(ticketFavoritesService.getMBList(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, id));
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getFavoritesTree")
|
||||
public ApiResult<FavoritesVO> getFavoritesTree(@RequestParam(defaultValue = "0") Integer id) {
|
||||
|
||||
return ApiResult.success(ticketFavoritesService.getTree(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, id));
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +186,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("addFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加收藏夹", isPublic = true)
|
||||
public ApiResult<Void> addFavorites(@Valid @RequestBody AdminFavoritesRequest request) {
|
||||
|
||||
ticketFavoritesService.addFavorites(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -198,7 +196,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("updateFavorites")
|
||||
public ApiResult<Void> updateFavorites(@Valid @RequestBody FavoritesUpdateRequest request) {
|
||||
|
||||
ticketFavoritesService.updateFavorites(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -211,7 +208,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("deleteFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "删除收藏夹", isPublic = true)
|
||||
public ApiResult<Void> deleteFavorites(@Valid @RequestParam @NotNull Integer favoritesId) {
|
||||
|
||||
ticketFavoritesService.deleteFavorites(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, favoritesId);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -222,7 +218,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("moveFavorites")
|
||||
public ApiResult<Void> moveFavorites(@Valid @RequestBody FavoritesMoveRequest request) {
|
||||
|
||||
ticketFavoritesService.moveFavorites(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -233,7 +228,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("moveFavoritesTicket")
|
||||
public ApiResult<Void> moveFavoritesTicket(@Valid @RequestBody FavoritesTicketMoveRequest request) {
|
||||
|
||||
ticketFavoritesService.moveFavoritesTicket(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -245,7 +239,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("followTiket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "关注工单")
|
||||
public ApiResult<Void> followTiket(@Valid @RequestBody AdminFollowRequest request) {
|
||||
|
||||
ticketFollowService.follow(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -256,7 +249,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@PostMapping("unfollowTicket")
|
||||
public ApiResult<Void> unfollowTicket(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
ticketFollowService.unfollow(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, Long.valueOf(ticketId));
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -268,7 +260,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getDeviceComponents")
|
||||
public ApiResult<List<ComponentInfo>> getDeviceComponents(@RequestParam String name) {
|
||||
|
||||
return ApiResult.success(partService.getSimpleList(name));
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +269,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getDeviceAgents")
|
||||
public ApiResult<List<DeviceAgentVO>> getDeviceAgents() {
|
||||
|
||||
return ApiResult.success(deviceService.getAgents());
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +280,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("searchTicket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "搜索工单")
|
||||
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request) {
|
||||
|
||||
return ApiResult.success(PageUtil.convert(ticketService.searchPage(request), d -> {
|
||||
d.setEvaluate(getTicketEvaluateForList(Math.toIntExact(d.getId())));
|
||||
return d;
|
||||
|
|
@ -298,7 +287,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private TicketEvaluateVO getTicketEvaluateForList(Integer ticketId) {
|
||||
|
||||
TicketEvaluate ticketEvaluate = ticketEvaluateService.lambdaQuery().eq(TicketEvaluate::getTicketId, ticketId).one();
|
||||
if (Objects.isNull(ticketEvaluate)) {
|
||||
return null;
|
||||
|
|
@ -354,7 +342,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getReason")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单根本原因分析", isPublic = true)
|
||||
public ApiResult<String> getReason(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
return ApiResult.success(ticket.getReason());
|
||||
|
|
@ -367,7 +354,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("exportSearchTicket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出搜索工单")
|
||||
public void exportSearchTicket(HttpServletResponse response, @Valid @RequestBody AdminTicketSearchRequest request) throws IOException {
|
||||
|
||||
request.setPageSize(Integer.MAX_VALUE);
|
||||
List<AdminTicketVO> datas = ticketService.exportSearch(request);
|
||||
EecExcelUtil.export("工单", "sheet1", datas, response);
|
||||
|
|
@ -381,7 +367,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "分派工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "分派工单")
|
||||
public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.assignmentTicket(request);
|
||||
ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds());
|
||||
ChatMessageDTO message = new ChatMessageDTO()
|
||||
|
|
@ -411,7 +396,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getTicketHandle")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
|
||||
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Long id) {
|
||||
|
||||
return ApiResult.success(ticketService.getTicketHandle(id));
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +407,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "添加工单处理人", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加工单处理人")
|
||||
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.getById(request.getTicketId());
|
||||
List<Integer> handleIds = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
// VUtils.trueThrowBusinessError(handleIds.stream().anyMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))
|
||||
|
|
@ -445,7 +428,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "完成工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "完成工单")
|
||||
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
|
||||
|
||||
for (Integer id : ids) {
|
||||
Ticket ticket = ticketService.completeTicket(id);
|
||||
ticketEventPublisher.publishTicketCompleteEvent(ticket);
|
||||
|
|
@ -477,7 +459,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "驳回工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "驳回工单")
|
||||
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
|
||||
|
||||
for (Integer id : ids) {
|
||||
Ticket ticket = ticketService.rejectTicket(id);
|
||||
// ticketEventPublisher.publishTicketCompleteEvent(ticket);
|
||||
|
|
@ -505,7 +486,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@GetMapping("revokedTicket")
|
||||
public ApiResult<Void> revokedTicket(@Valid @RequestParam @NotNull Integer id) {
|
||||
|
||||
ticketService.revokedFromAdmin(id);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -657,7 +637,7 @@ public class TicketController extends ControllerBase {
|
|||
} else if (Objects.nonNull(user.getAreaId())) {
|
||||
areaName = appAreaService.getById(user.getAreaId()).getName();
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
areaName = Optional.ofNullable(areaService.getById(user.getAreaId())).map(TBaseArea::getAreaName).orElse("");
|
||||
}
|
||||
}
|
||||
|
|
@ -736,7 +716,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private List<FileUploadVO> getFileVOs(String ids) {
|
||||
|
||||
if (StrUtil.isBlank(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -747,7 +726,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private TicketEvaluateVO getTicketEvaluate(Integer ticketId) {
|
||||
|
||||
TicketEvaluate ticketEvaluate = ticketEvaluateService.lambdaQuery().eq(TicketEvaluate::getTicketId, ticketId).one();
|
||||
if (Objects.isNull(ticketEvaluate)) {
|
||||
return null;
|
||||
|
|
@ -795,7 +773,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getChatMessages")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单聊天记录")
|
||||
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
Integer userId = AdminUserUtil.getUserId();
|
||||
MessageVO vo = new MessageVO();
|
||||
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(Long.valueOf(ticketId), userId);
|
||||
|
|
@ -835,7 +812,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@PostMapping("setChatMessageReaded")
|
||||
public ApiResult<Void> setChatMessageReaded(@RequestBody Long ticketId) {
|
||||
|
||||
stringRedisTemplate.delete("chatMessage:notreaded:" + ticketId + ":admin:" + AdminUserUtil.getUserId());
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -847,7 +823,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("addChatMessage")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加聊天记录")
|
||||
public ApiResult<Void> addChatMessage(@Valid @RequestBody AddChatMessageRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.getById(request.getTicketId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.Processing.getState()) > 1)
|
||||
|
|
@ -911,7 +886,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("withdrawChatMessage")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "撤回聊天记录")
|
||||
public ApiResult<Void> withdrawChatMessage(@Valid @RequestBody WithdrawChatMessageRequest request) {
|
||||
|
||||
ticketChatService.withdrawMessage(request.getTicketId(), request.getMessageId());
|
||||
//推送消息
|
||||
ssePushService.sendTicketMessageWithdrawToAdmin(request.getTicketId(), request.getMessageId());
|
||||
|
|
@ -973,7 +947,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getSolutionReviewDepartment")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单解决方案评审部门")
|
||||
public ApiResult<List<SolutionReviewDepartmentVO>> getSolutionReviewDepartment(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
return ApiResult.success(ticketSolutionAuditService.getByTicket(Long.valueOf(ticketId)));
|
||||
}
|
||||
|
||||
|
|
@ -984,7 +957,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("saveSolutionReviewDepartment")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "保存工单解决方案评审部门")
|
||||
public ApiResult<Void> saveSolutionReviewDepartment(@Valid @RequestBody SolutionReviewDepartmentSaveRequest request) {
|
||||
|
||||
ticketSolutionAuditService.saveSolutionReviewDepartment(request);
|
||||
adminMessageService.setReaded(AdminUserUtil.getUserId(), Long.valueOf(request.getTicketId()), MessageSubType.TicketCompletion.getState());
|
||||
return ApiResult.success();
|
||||
|
|
@ -997,7 +969,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("rejectSolution")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "驳回工单解决方案")
|
||||
public ApiResult<Void> rejectSolution(@Valid @RequestBody SolutionRejectRequest request) {
|
||||
|
||||
Ticket ticket = ticketSolutionAuditService.reject(request);
|
||||
if (Objects.nonNull(ticket)) {
|
||||
TicketSolutionAudit audit = ticketSolutionAuditService.lambdaQuery()
|
||||
|
|
@ -1030,7 +1001,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("passSolution")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "通过工单解决方案")
|
||||
public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
if (ticketSolutionAuditService.pass(ticketId)) {
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
ticketEventPublisher.publishTicketCloseEvent(ticket);
|
||||
|
|
@ -1058,7 +1028,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("exportTicketReport")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出工单报表")
|
||||
public void exportTicketReport(HttpServletResponse response, @Valid @RequestBody AdminTicketSearchRequest request) throws IOException {
|
||||
|
||||
request.setPageSize(Integer.MAX_VALUE);
|
||||
List<AdminTicketVO> datas = ticketService.exportSearch(request);
|
||||
EecExcelUtil.export("工单报表", "sheet1", Convert.toList(AdminTicketReportVO.class, datas), response);
|
||||
|
|
@ -1071,7 +1040,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("/exportTicketExcel")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出工单详情为excel")
|
||||
public void exportExcel(HttpServletResponse response, @Valid @RequestParam @NotNull Integer ticketId) throws Exception {
|
||||
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
|
|
@ -1273,7 +1241,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private void addMergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
|
||||
sheet.addMergedRegion(region);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
|
|
@ -1283,14 +1250,12 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private void createCell(Row row, int index, CellStyle style, String value) {
|
||||
|
||||
Cell cell = row.createCell(index);
|
||||
cell.setCellValue(value);
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
|
||||
private void bindPic(String url, Workbook workbook, Sheet sheet, int rowIndex, int colStart, int colEnd) {
|
||||
|
||||
try {
|
||||
byte[] imageBytes;
|
||||
try (InputStream inputStream = new URL(url).openStream()) {
|
||||
|
|
@ -1316,7 +1281,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getNormalStyle(Workbook workbook) {
|
||||
|
||||
CellStyle centerStyle = workbook.createCellStyle();
|
||||
centerStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||
centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1336,7 +1300,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getCenterStyle(Workbook workbook) {
|
||||
|
||||
CellStyle centerStyle = workbook.createCellStyle();
|
||||
centerStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1356,7 +1319,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getTitleStyle(Workbook workbook) {
|
||||
|
||||
CellStyle titleStyle = workbook.createCellStyle();
|
||||
titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1383,7 +1345,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("/getHandlers")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
|
||||
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Long ticketId) {
|
||||
|
||||
return ApiResult.success(ticketService.getTicketHandle(ticketId));
|
||||
}
|
||||
|
||||
|
|
@ -1609,7 +1570,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getShengWangChannelUsers")
|
||||
public ApiResult<List<Integer>> getShengWangChannelUsers(Long ticketId) throws IOException, InterruptedException {
|
||||
|
||||
return ApiResult.success(shengWangService.getChannelUsers("ticket" + ticketId).getUsers());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue