1432-新增删除工单的功能

This commit is contained in:
10002617 2026-04-13 11:45:40 +08:00
parent 8d4fcf5ddc
commit e5ad0d5b5e
13 changed files with 72 additions and 17 deletions

View File

@ -399,6 +399,7 @@ public class TicketController extends ControllerBase {
@ApiMark(moduleName = "工单管理", apiName = "分派工单") @ApiMark(moduleName = "工单管理", apiName = "分派工单")
public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) { public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) {
Ticket ticket = ticketService.assignmentTicket(request); Ticket ticket = ticketService.assignmentTicket(request);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds()); ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds());
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -439,6 +440,7 @@ public class TicketController extends ControllerBase {
@ApiMark(moduleName = "工单管理", apiName = "添加工单处理人") @ApiMark(moduleName = "工单管理", apiName = "添加工单处理人")
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) { public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) {
Ticket ticket = ticketService.getById(request.getTicketId()); Ticket ticket = ticketService.getById(request.getTicketId());
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
List<Integer> handleIds = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList()); 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())) // VUtils.trueThrowBusinessError(handleIds.stream().anyMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))
// && request.getUserIds().stream().noneMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))) // && request.getUserIds().stream().noneMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId())))
@ -461,6 +463,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) { public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
Ticket ticket = ticketService.completeTicket(id); Ticket ticket = ticketService.completeTicket(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketCompleteEvent(ticket); ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -492,6 +495,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) { public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
Ticket ticket = ticketService.rejectTicket(id); Ticket ticket = ticketService.rejectTicket(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
// ticketEventPublisher.publishTicketCompleteEvent(ticket); // ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -658,6 +662,7 @@ public class TicketController extends ControllerBase {
@GetMapping("getTicket") @GetMapping("getTicket")
public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Integer id) { public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Integer id) {
Ticket ticket = ticketService.getById(id); Ticket ticket = ticketService.getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
AdminUser adminUser = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) ? adminUserService.getById(ticket.getUserId()) : null; AdminUser adminUser = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) ? adminUserService.getById(ticket.getUserId()) : null;
AppUser user = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_APP) ? appUserService.getById(ticket.getUserId()) : null; AppUser user = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_APP) ? appUserService.getById(ticket.getUserId()) : null;
String areaName = ""; String areaName = "";
@ -1034,6 +1039,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Integer ticketId) { public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Integer ticketId) {
if (ticketSolutionAuditService.pass(ticketId)) { if (ticketSolutionAuditService.pass(ticketId)) {
Ticket ticket = ticketService.getById(ticketId); Ticket ticket = ticketService.getById(ticketId);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketCloseEvent(ticket); ticketEventPublisher.publishTicketCloseEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -1603,4 +1609,10 @@ public class TicketController extends ControllerBase {
public ApiResult<List<Integer>> getShengWangChannelUsers(Long ticketId) throws IOException, InterruptedException { public ApiResult<List<Integer>> getShengWangChannelUsers(Long ticketId) throws IOException, InterruptedException {
return ApiResult.success(shengWangService.getChannelUsers("ticket" + ticketId).getUsers()); return ApiResult.success(shengWangService.getChannelUsers("ticket" + ticketId).getUsers());
} }
@PostMapping("deleteTicket")
public ApiResult<Boolean> deleteTicket(@RequestBody List<String> ticketIds) {
ticketService.removeByIds(ticketIds);
return ApiResult.success(true);
}
} }

View File

@ -187,6 +187,7 @@ public class TicketController extends ControllerBase {
Long ticketId; Long ticketId;
if (request.getType() == 0) { if (request.getType() == 0) {
Ticket ticket = ticketService.add(request, AppUserUtil.getUserId()); Ticket ticket = ticketService.add(request, AppUserUtil.getUserId());
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketId = Long.valueOf(ticket.getId()); ticketId = Long.valueOf(ticket.getId());
ticketEventPublisher.publishTicketCreateEvent(ticket, MultilingualUtil.getLanguage(), MultilingualUtil.getZone()); ticketEventPublisher.publishTicketCreateEvent(ticket, MultilingualUtil.getLanguage(), MultilingualUtil.getZone());
} else { } else {

View File

@ -392,6 +392,7 @@ public class TicketController extends ControllerBase {
@ApiMark(moduleName = "工单管理", apiName = "分派工单") @ApiMark(moduleName = "工单管理", apiName = "分派工单")
public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) { public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) {
GongfuTicket ticket = ticketService.assignmentTicket(request); GongfuTicket ticket = ticketService.assignmentTicket(request);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds()); ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds());
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -432,6 +433,7 @@ public class TicketController extends ControllerBase {
@ApiMark(moduleName = "工单管理", apiName = "添加工单处理人") @ApiMark(moduleName = "工单管理", apiName = "添加工单处理人")
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) { public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) {
GongfuTicket ticket = ticketService.getById(request.getTicketId()); GongfuTicket ticket = ticketService.getById(request.getTicketId());
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
List<Integer> handleIds = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList()); 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())) // VUtils.trueThrowBusinessError(handleIds.stream().anyMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))
// && request.getUserIds().stream().noneMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))) // && request.getUserIds().stream().noneMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId())))
@ -454,6 +456,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Long> ids) { public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Long> ids) {
for (Long id : ids) { for (Long id : ids) {
GongfuTicket ticket = ticketService.completeTicket(id); GongfuTicket ticket = ticketService.completeTicket(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketCompleteEvent(ticket); ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -485,6 +488,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Long> ids) { public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Long> ids) {
for (Long id : ids) { for (Long id : ids) {
GongfuTicket ticket = ticketService.rejectTicket(id); GongfuTicket ticket = ticketService.rejectTicket(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
// ticketEventPublisher.publishTicketCompleteEvent(ticket); // ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -632,6 +636,7 @@ public class TicketController extends ControllerBase {
@GetMapping("getTicket") @GetMapping("getTicket")
public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Long id) { public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Long id) {
GongfuTicket ticket = ticketService.getById(id); GongfuTicket ticket = ticketService.getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
AdminUser adminUser = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) ? adminUserService.getById(ticket.getUserId()) : null; AdminUser adminUser = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) ? adminUserService.getById(ticket.getUserId()) : null;
AppUser user = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_APP) ? appUserService.getById(ticket.getUserId()) : null; AppUser user = StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_APP) ? appUserService.getById(ticket.getUserId()) : null;
String areaName = ""; String areaName = "";
@ -993,6 +998,7 @@ public class TicketController extends ControllerBase {
public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Long ticketId) { public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Long ticketId) {
if (ticketSolutionAuditService.pass1(ticketId)) { if (ticketSolutionAuditService.pass1(ticketId)) {
GongfuTicket ticket = ticketService.getById(ticketId); GongfuTicket ticket = ticketService.getById(ticketId);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
ticketEventPublisher.publishTicketCloseEvent(ticket); ticketEventPublisher.publishTicketCloseEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO() ChatMessageDTO message = new ChatMessageDTO()
.setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr()) .setId(cn.hutool.core.util.IdUtil.getSnowflakeNextIdStr())
@ -1600,4 +1606,10 @@ public class TicketController extends ControllerBase {
// }).collect(Collectors.toList()) // }).collect(Collectors.toList())
// ); // );
} }
@PostMapping("deleteTicket")
public ApiResult<Boolean> deleteTicket(@RequestBody List<String> ticketIds) {
ticketService.removeByIds(ticketIds);
return ApiResult.success(true);
}
} }

View File

@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -167,4 +168,10 @@ public class GongfuTicket implements Serializable {
* 产量 * 产量
*/ */
private String throughput; private String throughput;
/**
* 是否删除01
*/
@TableLogic(value = "0", delval = "1")
private Integer isDelete;
} }

View File

@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -156,4 +157,10 @@ public class Ticket implements Serializable {
* 客户名称 * 客户名称
*/ */
private String customerName; private String customerName;
/**
* 是否删除01
*/
@TableLogic(value = "0", delval = "1")
private Integer isDelete;
} }

View File

@ -12,6 +12,7 @@ import com.nflg.mobilebroken.common.pojo.vo.CompanyStatisticsVO;
import com.nflg.mobilebroken.common.pojo.vo.EquipmentFailureRankingVO; import com.nflg.mobilebroken.common.pojo.vo.EquipmentFailureRankingVO;
import com.nflg.mobilebroken.common.pojo.vo.TicketVO; import com.nflg.mobilebroken.common.pojo.vo.TicketVO;
import com.nflg.mobilebroken.repository.entity.GongfuTicket; import com.nflg.mobilebroken.repository.entity.GongfuTicket;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
@ -47,4 +48,7 @@ public interface GongfuTicketMapper extends BaseMapper<GongfuTicket> {
List<EquipmentFailureRankingVO> getEquipmentFailureRanking(EquipmentFailureRankingSearchQuery qo); List<EquipmentFailureRankingVO> getEquipmentFailureRanking(EquipmentFailureRankingSearchQuery qo);
List<CompanyStatisticsVO> companyStatistics(CompanyStatisticsQuery qo); List<CompanyStatisticsVO> companyStatistics(CompanyStatisticsQuery qo);
@Select("select * from gongfu_ticket where create_time >= current_date() order by id desc limit 1")
GongfuTicket getLastTicket();
} }

View File

@ -9,6 +9,7 @@ import com.nflg.mobilebroken.common.pojo.request.TicketSearchRequest;
import com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO; import com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO;
import com.nflg.mobilebroken.common.pojo.vo.TicketVO; import com.nflg.mobilebroken.common.pojo.vo.TicketVO;
import com.nflg.mobilebroken.repository.entity.Ticket; import com.nflg.mobilebroken.repository.entity.Ticket;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
@ -44,4 +45,7 @@ public interface TicketMapper extends BaseMapper<Ticket> {
IPage<AdminTicketVO> searchByFavouritesId(Integer userId, Integer favouritesId, Page<?> page); IPage<AdminTicketVO> searchByFavouritesId(Integer userId, Integer favouritesId, Page<?> page);
TicketDTO getDto(Long id); TicketDTO getDto(Long id);
@Select("select * from ticket where create_time >= current_date() order by id desc limit 1")
Ticket getLastTicket();
} }

View File

@ -68,11 +68,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Transactional @Transactional
@Override @Override
public GongfuTicket add(TicketAddRequest request, Integer userId) { public GongfuTicket add(TicketAddRequest request, Integer userId) {
GongfuTicket lastTicket = lambdaQuery() GongfuTicket lastTicket = getBaseMapper().getLastTicket();
.ge(GongfuTicket::getCreateTime, LocalDateTime.now().toLocalDate())
.orderByDesc(GongfuTicket::getId)
.last("LIMIT 1")
.one();
String no = lastTicket == null ? TicketUtil.getNextNo("GFGD", null) : TicketUtil.getNextNo("GFGD", lastTicket.getNo()); String no = lastTicket == null ? TicketUtil.getNextNo("GFGD", null) : TicketUtil.getNextNo("GFGD", lastTicket.getNo());
List<Integer> cqms = deviceTypeService.getCqms(request.getDeviceNo()); List<Integer> cqms = deviceTypeService.getCqms(request.getDeviceNo());
GongfuTicket ticket = new GongfuTicket() GongfuTicket ticket = new GongfuTicket()
@ -232,6 +228,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Override @Override
public GongfuTicket completeTicket(Long id) { public GongfuTicket completeTicket(Long id) {
GongfuTicket ticket = getById(id); GongfuTicket ticket = getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.Processing.getState())) VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.Processing.getState()))
.throwMessage("非处理中状态不允许完成"); .throwMessage("非处理中状态不允许完成");
List<Integer> tickerMangagers = adminUserService.getGongfuTickerMangagers(); List<Integer> tickerMangagers = adminUserService.getGongfuTickerMangagers();
@ -291,6 +288,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Override @Override
public GongfuTicket revokedFromApp(Long id) { public GongfuTicket revokedFromApp(Long id) {
GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one(); GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom()))) VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState()) VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState())
@ -306,6 +304,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Override @Override
public GongfuTicket revokedFromAdmin(Long id) { public GongfuTicket revokedFromAdmin(Long id) {
GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one(); GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) && Objects.equals(ticket.getUserId(), AdminUserUtil.getUserId()))) VUtils.trueThrowBusinessError(!(StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) && Objects.equals(ticket.getUserId(), AdminUserUtil.getUserId())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState()) VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState())
@ -321,6 +320,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Override @Override
public GongfuTicket reopen(Long id) { public GongfuTicket reopen(Long id) {
GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one(); GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom()))) VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.ProcessingCompleted.getState()) > 0) VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.ProcessingCompleted.getState()) > 0)
@ -360,6 +360,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
@Override @Override
public List<AdminUserSimpleVO> getTicketHandle(Long id) { public List<AdminUserSimpleVO> getTicketHandle(Long id) {
GongfuTicket ticket = lambdaQuery().select(GongfuTicket::getHandle, GongfuTicket::getId).eq(GongfuTicket::getId, id).one(); GongfuTicket ticket = lambdaQuery().select(GongfuTicket::getHandle, GongfuTicket::getId).eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
List<Integer> handles = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList()); List<Integer> handles = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList());
if (CollectionUtil.isEmpty(handles)) { if (CollectionUtil.isEmpty(handles)) {
return Collections.emptyList(); return Collections.emptyList();

View File

@ -66,11 +66,7 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
@Transactional @Transactional
@Override @Override
public Ticket add(TicketAddRequest request, Integer userId) { public Ticket add(TicketAddRequest request, Integer userId) {
Ticket lastTicket = lambdaQuery() Ticket lastTicket = getBaseMapper().getLastTicket();
.ge(Ticket::getCreateTime, LocalDateTime.now().toLocalDate())
.orderByDesc(Ticket::getId)
.last("LIMIT 1")
.one();
String no = lastTicket == null ? TicketUtil.getNextNo("YPSH", null) : TicketUtil.getNextNo("YPSH", lastTicket.getNo()); String no = lastTicket == null ? TicketUtil.getNextNo("YPSH", null) : TicketUtil.getNextNo("YPSH", lastTicket.getNo());
Ticket ticket = new Ticket() Ticket ticket = new Ticket()
.setNo(no) .setNo(no)
@ -247,6 +243,7 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
@Override @Override
public Ticket completeTicket(Integer id) { public Ticket completeTicket(Integer id) {
Ticket ticket = getById(id); Ticket ticket = getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.Processing.getState())) VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.Processing.getState()))
.throwMessage("非处理中状态不允许完成"); .throwMessage("非处理中状态不允许完成");
List<Integer> tickerMangagers = adminUserService.getTickerMangagers(); List<Integer> tickerMangagers = adminUserService.getTickerMangagers();
@ -328,6 +325,7 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
@Override @Override
public Ticket revokedFromApp(Integer id) { public Ticket revokedFromApp(Integer id) {
Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one(); Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom()))) VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState()) VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState())
@ -343,6 +341,7 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
@Override @Override
public Ticket revokedFromAdmin(Integer id) { public Ticket revokedFromAdmin(Integer id) {
Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one(); Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) && Objects.equals(ticket.getUserId(), AdminUserUtil.getUserId()))) VUtils.trueThrowBusinessError(!(StrUtil.equals(ticket.getUserPlatform(), Constant.FROM_ADMIN) && Objects.equals(ticket.getUserId(), AdminUserUtil.getUserId())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState()) VUtils.trueThrowBusinessError(ticket.getState() > TicketState.ProcessingCompleted.getState())
@ -358,6 +357,7 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
@Override @Override
public Ticket reopen(Integer id) { public Ticket reopen(Integer id) {
Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one(); Ticket ticket = lambdaQuery().eq(Ticket::getId, id).one();
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom()))) VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单"); .throwMessage("无权操作该工单");
VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.ProcessingCompleted.getState()) > 0) VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.ProcessingCompleted.getState()) > 0)

View File

@ -75,6 +75,7 @@ public class TicketSolutionAuditServiceImpl extends ServiceImpl<TicketSolutionAu
List<TicketSolutionAudit> forAdd = new ArrayList<>(); List<TicketSolutionAudit> forAdd = new ArrayList<>();
List<TicketSolutionAudit> forUpdate = new ArrayList<>(); List<TicketSolutionAudit> forUpdate = new ArrayList<>();
Ticket ticket = ticketService.getById(request.getTicketId()); Ticket ticket = ticketService.getById(request.getTicketId());
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
request.getDepartments().forEach(detp -> { request.getDepartments().forEach(detp -> {
TicketSolutionAudit audit = new TicketSolutionAudit(); TicketSolutionAudit audit = new TicketSolutionAudit();
if (Objects.isNull(detp.getId())) { if (Objects.isNull(detp.getId())) {

View File

@ -7,7 +7,10 @@
u.user_name AS 'userName',m.is_read AS 'isRead' u.user_name AS 'userName',m.is_read AS 'isRead'
FROM admin_message m FROM admin_message m
INNER JOIN admin_user u ON m.user_id=u.id INNER JOIN admin_user u ON m.user_id=u.id
LEFT JOIN ticket t ON m.source_id=t.id AND m.source=0 and t.is_delete = 0
LEFT JOIN gongfu_ticket gt ON m.source_id=gt.id AND m.source=3 and gt.is_delete = 0
WHERE m.user_id=#{userId} WHERE m.user_id=#{userId}
and ((m.source=0 and t.id is not null) or (m.source=3 and gt.id is not null) or m.source not in (0,3))
<if test="request.type != null"> <if test="request.type != null">
AND m.type=#{request.type} AND m.type=#{request.type}
</if> </if>

View File

@ -37,7 +37,7 @@
<sql id="adminSearchWhereCondition"> <sql id="adminSearchWhereCondition">
<where> <where>
t.state!=4 t.state!=4 AND t.is_delete = 0
<if test="!request.ticketManager"> <if test="!request.ticketManager">
AND (FIND_IN_SET(#{userId},t.handle)>0 OR (t.user_platform='admin' AND t.user_id=#{userId})) AND (FIND_IN_SET(#{userId},t.handle)>0 OR (t.user_platform='admin' AND t.user_id=#{userId}))
</if> </if>
@ -105,7 +105,7 @@
LEFT JOIN gongfu_ticket_evaluate te ON t.id=te.ticket_id AND t.state=2 LEFT JOIN gongfu_ticket_evaluate te ON t.id=te.ticket_id AND t.state=2
LEFT JOIN gongfu_device_part p ON t.component_id=p.id LEFT JOIN gongfu_device_part p ON t.component_id=p.id
LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language} LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language}
WHERE t.user_id=#{userId} AND t.user_platform=#{from} AND t.state!=4 WHERE t.user_id=#{userId} AND t.user_platform=#{from} AND t.state!=4 AND t.is_delete = 0
<include refid="searchWhereCondition"/> <include refid="searchWhereCondition"/>
ORDER BY t.id DESC ORDER BY t.id DESC
</select> </select>
@ -122,7 +122,7 @@
LEFT JOIN gongfu_ticket_evaluate te ON t.id=te.ticket_id AND t.state=2 LEFT JOIN gongfu_ticket_evaluate te ON t.id=te.ticket_id AND t.state=2
LEFT JOIN gongfu_device_part p ON t.component_id=p.id LEFT JOIN gongfu_device_part p ON t.component_id=p.id
LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language} LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language}
WHERE tf.user_id=#{userId} AND t.user_platform=#{from} AND t.state!=4 WHERE tf.user_id=#{userId} AND t.user_platform=#{from} AND t.state!=4 AND t.is_delete = 0
<include refid="searchWhereCondition"/> <include refid="searchWhereCondition"/>
ORDER BY t.id DESC ORDER BY t.id DESC
</select> </select>
@ -140,7 +140,7 @@
LEFT JOIN gongfu_device_part p ON t.component_id=p.id LEFT JOIN gongfu_device_part p ON t.component_id=p.id
LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language} LEFT JOIN gongfu_device_part_language_data l ON p.id=l.source_id AND l.language_code=#{language}
LEFT JOIN v_device vd ON t.device_no=vd.device_no LEFT JOIN v_device vd ON t.device_no=vd.device_no
WHERE t.state!=4 WHERE t.state!=4 AND t.is_delete = 0
<if test="isPrimary==false"> <if test="isPrimary==false">
AND FIND_IN_SET(#{companyId},u.company_id) AND vd.service_agent_code=#{companyCode} AND FIND_IN_SET(#{companyId},u.company_id) AND vd.service_agent_code=#{companyCode}
</if> </if>
@ -252,7 +252,7 @@
<select id="getAdminFavorites" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO"> <select id="getAdminFavorites" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
SELECT t.id, t.no, t.title SELECT t.id, t.no, t.title
FROM ticket_follow tf FROM ticket_follow tf
INNER JOIN gongfu_ticket t ON tf.ticket_id = t.id INNER JOIN gongfu_ticket t ON tf.ticket_id = t.id AND t.is_delete = 0
WHERE tf.`from` = 1 WHERE tf.`from` = 1
AND tf.user_id = #{userId} AND tf.from=IF(#{from}='app',0,1) AND tf.user_id = #{userId} AND tf.from=IF(#{from}='app',0,1)
AND tf.favorites_id = #{favoritesId} AND tf.favorites_id = #{favoritesId}
@ -283,6 +283,7 @@
LEFT JOIN admin_user auc ON t.cqm=auc.id LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN gongfu_device_part p ON t.component_id=p.id LEFT JOIN gongfu_device_part p ON t.component_id=p.id
where t.is_delete = 0
ORDER BY t.state,t.id DESC ORDER BY t.state,t.id DESC
</select> </select>
@ -302,7 +303,7 @@
SELECT d.agent_name as name,COUNT(1) as num SELECT d.agent_name as name,COUNT(1) as num
FROM gongfu_ticket t FROM gongfu_ticket t
INNER JOIN v_gongfu_device d ON t.device_no=d.device_no INNER JOIN v_gongfu_device d ON t.device_no=d.device_no
where t.create_time >= #{startDate} and t.create_time &lt; #{endDate} where t.is_delete = 0 and t.create_time >= #{startDate} and t.create_time &lt; #{endDate}
GROUP BY d.agent_name GROUP BY d.agent_name
ORDER BY COUNT(1) DESC ORDER BY COUNT(1) DESC
LIMIT #{num} LIMIT #{num}

View File

@ -40,7 +40,7 @@
<sql id="adminSearchWhereCondition"> <sql id="adminSearchWhereCondition">
<where> <where>
t.state!=4 t.state!=4 and t.is_delete = 0
<if test="!request.ticketManager"> <if test="!request.ticketManager">
AND (FIND_IN_SET(#{userId},t.handle)>0 OR fun_inAduit(t.id,#{userId})=1 OR (t.user_platform='admin' AND t.user_id=#{userId})) AND (FIND_IN_SET(#{userId},t.handle)>0 OR fun_inAduit(t.id,#{userId})=1 OR (t.user_platform='admin' AND t.user_id=#{userId}))
</if> </if>
@ -261,6 +261,7 @@
AND tf.user_id = #{userId} AND tf.from=IF(#{from}='app',0,1) AND tf.user_id = #{userId} AND tf.from=IF(#{from}='app',0,1)
AND tf.favorites_id = #{favoritesId} AND tf.favorites_id = #{favoritesId}
and tf.ticket_type=0 and tf.ticket_type=0
and t.is_delete = 0
ORDER BY t.state,t.id DESC ORDER BY t.state,t.id DESC
</select> </select>
@ -287,6 +288,7 @@
LEFT JOIN admin_user auc ON t.cqm=auc.id LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN v_device_part p ON t.component_id=p.id LEFT JOIN v_device_part p ON t.component_id=p.id
where t.is_delete = 0
ORDER BY t.state,t.id DESC ORDER BY t.state,t.id DESC
</select> </select>