refactor(ticket): 将工单相关ID类型统一为Long,优化代码规范和查询逻辑

- 将AdminTicketVO、AssignmentTicketRequest等多处工单ID字段由Integer修改为Long类型,统一ID类型
- 修改GongfuTicketService及相关接口方法签名,ID参数改为Long类型,保证一致性
- 优化AppAreaServiceImpl代码格式及查询条件,改进父子节点的处理逻辑
- 修正GongfuDeviceMapper中getComponents方法参数由componentId改为modelNo,完善多语言支持
- 修正GongfuTicketMapper中权限查询逻辑,移除冗余条件
- 统一TicketFollowService中ticketId类型为Long,防止类型不匹配
- TicketMapper相关SQL使用视图v_device_part替代基础表,提高查询性能与维护性
- 调整Admin及CFS、Gongfu模块Controller中ticketId请求参数类型为Long
- 完善工单详情中区域信息获取逻辑,兼容不同用户类型的区域名称显示
- 优化工单聊天记录及消息推送方法,ID参数统一为Long,保证跨端一致
- 删除部分无用import及代码注释,提升代码整洁度和可读性
This commit is contained in:
曹鹏飞 2025-11-25 16:12:00 +08:00
parent 40b10e4ad6
commit 8daef9907f
24 changed files with 141 additions and 109 deletions

View File

@ -240,7 +240,7 @@ public class TicketController extends ControllerBase {
**/
@PostMapping("unfollowTicket")
public ApiResult<Void> unfollowTicket(@Valid @RequestParam @NotNull Integer ticketId) {
ticketFollowService.unfollow(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, ticketId);
ticketFollowService.unfollow(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, Long.valueOf(ticketId));
return ApiResult.success();
}
@ -272,7 +272,7 @@ public class TicketController extends ControllerBase {
@ApiMark(moduleName = "工单管理", apiName = "搜索工单")
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request) {
return ApiResult.success(PageUtil.convert(ticketService.searchPage(request), d -> {
d.setEvaluate(getTicketEvaluateForList(d.getId()));
d.setEvaluate(getTicketEvaluateForList(Math.toIntExact(d.getId())));
return d;
}));
}
@ -382,7 +382,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("getTicketHandle")
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Integer id) {
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Long id) {
return ApiResult.success(ticketService.getTicketHandle(id));
}
@ -714,7 +714,7 @@ public class TicketController extends ControllerBase {
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
Integer userId = AdminUserUtil.getUserId();
MessageVO vo = new MessageVO();
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(ticketId, userId);
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(Long.valueOf(ticketId), userId);
vo.setMessages(messageVOS);
String key = "chatMessage:readed:" + ticketId + ":admin:" + userId;
Set<String> readeds = stringRedisTemplate.opsForSet().members(key);
@ -1244,7 +1244,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("/getHandlers")
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Long ticketId) {
return ApiResult.success(ticketService.getTicketHandle(ticketId));
}

View File

@ -352,7 +352,7 @@ public class TicketController extends ControllerBase {
* @return 聊天记录
**/
@GetMapping("getChatMessages")
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Long ticketId) {
Integer userId = AppUserUtil.getUserId();
MessageVO vo = new MessageVO();
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(ticketId, userId);
@ -531,7 +531,7 @@ public class TicketController extends ControllerBase {
* @param ticketId 工单编号
*/
@GetMapping("/getHandlers")
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Long ticketId) {
return ApiResult.success(ticketService.getTicketHandle(ticketId));
}

View File

@ -10,7 +10,7 @@ public class AssignmentTicketRequest {
//工单id
@NotNull
private Integer ticketId;
private Long ticketId;
//紧急程度0非紧急1普通2紧急
@NotNull

View File

@ -11,7 +11,7 @@ public class TicketHandleAddRequest {
//工单id
@NotNull
private Integer ticketId;
private Long ticketId;
//用户id列表
@NotEmpty

View File

@ -25,7 +25,7 @@ public class TicketSearchRequest extends PageRequest {
private String deviceNo;
//问题部位
private Integer componentId;
private Long componentId;
//工单状态
private Integer state;

View File

@ -18,7 +18,7 @@ public class AdminTicketVO {
//工单id
@IgnoreExport
private int id;
private Long id;
//工单编号
@ExcelColumn("工单编号")

View File

@ -13,7 +13,7 @@ import java.util.List;
public class TicketVO {
//工单id
private int id;
private Long id;
//工单编号
private String no;

View File

@ -6,6 +6,7 @@ import com.nflg.mobilebroken.common.constant.STATE;
import com.nflg.mobilebroken.common.pojo.dto.UserDTO;
import java.util.List;
import java.util.Objects;
public class AppUserUtil {
@ -31,7 +32,11 @@ public class AppUserUtil {
public static Boolean isPrimary() {
VUtils.trueThrow(!SaTokenAppUtil.isLogin()).throwMessage(STATE.LoginError, "请重新登录");
return (Boolean) SaTokenAppUtil.getExtra("isPrimary");
Object type = SaTokenAppUtil.getExtra("isPrimary");
if (Objects.isNull(type)) {
return false;
}
return (Boolean) type;
}
public static String getFrom() {
@ -44,7 +49,11 @@ public class AppUserUtil {
*/
public static Boolean isAgent() {
VUtils.trueThrow(!SaTokenAppUtil.isLogin()).throwMessage(STATE.LoginError, "请重新登录");
return 0 == ((NumberWithFormat) SaTokenAppUtil.getExtra("type")).intValue();
Object type = SaTokenAppUtil.getExtra("type");
if (Objects.isNull(type)) {
return false;
}
return 0 == ((NumberWithFormat) type).intValue();
}
/**
@ -52,7 +61,11 @@ public class AppUserUtil {
*/
public static Boolean isEndUser() {
VUtils.trueThrow(!SaTokenAppUtil.isLogin()).throwMessage(STATE.LoginError, "请重新登录");
return 1 == ((NumberWithFormat) SaTokenAppUtil.getExtra("type")).intValue();
Object type = SaTokenAppUtil.getExtra("type");
if (Objects.isNull(type)) {
return false;
}
return 1 == ((NumberWithFormat) type).intValue();
}
public static String getCustomerName() {

View File

@ -40,7 +40,6 @@ import org.xhtmlrenderer.pdf.ITextRenderer;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.IOException;
@ -132,6 +131,9 @@ public class TicketController extends ControllerBase {
@Resource
private IGongfuTicketAreaService ticketAreaService;
@Resource
private ITBaseAreaService baseAreaService;
/**
* 获取问题类型
* @return 问题类型列表
@ -233,7 +235,7 @@ public class TicketController extends ControllerBase {
* @param ticketId 工单id
**/
@PostMapping("unfollowTicket")
public ApiResult<Void> unfollowTicket(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<Void> unfollowTicket(@Valid @RequestParam @NotNull Long ticketId) {
ticketFollowService.unfollow(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, ticketId);
return ApiResult.success();
}
@ -271,7 +273,7 @@ public class TicketController extends ControllerBase {
}));
}
private TicketEvaluateVO getTicketEvaluateForList(Integer ticketId) {
private TicketEvaluateVO getTicketEvaluateForList(Long ticketId) {
TicketEvaluate ticketEvaluate = ticketEvaluateService.lambdaQuery().eq(TicketEvaluate::getTicketId, ticketId).one();
if (Objects.isNull(ticketEvaluate)) {
return null;
@ -326,7 +328,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("getReason")
@ApiMark(moduleName = "工单管理", apiName = "获取工单根本原因分析", isPublic = true)
public ApiResult<String> getReason(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<String> getReason(@Valid @RequestParam @NotNull Long ticketId) {
GongfuTicket ticket = ticketService.getById(ticketId);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
return ApiResult.success(ticket.getReason());
@ -376,7 +378,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("getTicketHandle")
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Integer id) {
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Long id) {
return ApiResult.success(ticketService.getTicketHandle(id));
}
@ -408,8 +410,8 @@ public class TicketController extends ControllerBase {
@PostMapping("completeTicket")
@MethodInfoMark(value = "完成工单", menuName = "工单管理")
@ApiMark(moduleName = "工单管理", apiName = "完成工单")
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
for (Integer id : ids) {
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Long> ids) {
for (Long id : ids) {
GongfuTicket ticket = ticketService.completeTicket(id);
ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO()
@ -420,10 +422,10 @@ public class TicketController extends ControllerBase {
.setSenderName("服务助手")
.setContent("<b>工单已完成</b><br/>工单已完成,如需补充信息,请重新打开工单,继续留言。")
.setCreateTime(Instant.now());
ticketChatService.addMessage(Long.valueOf(id), message);
ticketChatService.addMessage(id, message);
//推送消息
ssePushService.sendTicketMessageToAdmin(Long.valueOf(id), message);
ssePushService.sendTicketMessageToApp(Long.valueOf(id), message);
ssePushService.sendTicketMessageToAdmin(id, message);
ssePushService.sendTicketMessageToApp(id, message);
}
return ApiResult.success();
}
@ -435,8 +437,8 @@ public class TicketController extends ControllerBase {
@PostMapping("rejectTicket")
@MethodInfoMark(value = "驳回工单", menuName = "工单管理")
@ApiMark(moduleName = "工单管理", apiName = "驳回工单")
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
for (Integer id : ids) {
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Long> ids) {
for (Long id : ids) {
GongfuTicket ticket = ticketService.rejectTicket(id);
// ticketEventPublisher.publishTicketCompleteEvent(ticket);
ChatMessageDTO message = new ChatMessageDTO()
@ -447,10 +449,10 @@ public class TicketController extends ControllerBase {
.setSenderName("服务助手")
.setContent("<b>工单驳回</b><br/>工单被驳回,请继续跟进处理。")
.setCreateTime(Instant.now());
ticketChatService.addMessage(Long.valueOf(id), message);
ticketChatService.addMessage(id, message);
//推送消息
ssePushService.sendTicketMessageToAdmin(Long.valueOf(id), message);
ssePushService.sendTicketMessageToApp(Long.valueOf(id), message);
ssePushService.sendTicketMessageToAdmin(id, message);
ssePushService.sendTicketMessageToApp(id, message);
}
return ApiResult.success();
}
@ -461,7 +463,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("exportPdf")
@ApiMark(moduleName = "工单管理", apiName = "导出工单为pdf")
public void exportPdf(HttpServletResponse response, @Valid @RequestParam @NotBlank(message = "工单编号不能为空") String id) {
public void exportPdf(HttpServletResponse response, @Valid @RequestParam @NotNull(message = "工单编号不能为空") Long id) {
GongfuTicket ticket = ticketService.getById(id);
AppUser user = appUserService.getById(ticket.getUserId());
List<Integer> companyIds = Arrays.stream(user.getCompanyId().split(",")).map(Integer::parseInt).collect(Collectors.toList());
@ -542,17 +544,27 @@ public class TicketController extends ControllerBase {
* @return 工单详情
**/
@GetMapping("getTicket")
public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Integer id) {
public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Long id) {
GongfuTicket ticket = ticketService.getById(id);
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;
String areaName = "";
if (Objects.nonNull(user))
if (Objects.nonNull(user)) {
if (user.getType() == 0) {
if (user.getIsPrimary()) {
areaName = StrUtil.join(",", customerService.getAreas(Arrays.stream(user.getCompanyId().split(",")).map(Integer::parseInt).collect(Collectors.toList())));
} else if (Objects.nonNull(user.getAreaId())) {
areaName = appAreaService.getById(user.getAreaId()).getName();
}
} else if (user.getType() == 1) {
if (Objects.nonNull(user.getAreaId())) {
TBaseArea area = baseAreaService.getById(user.getAreaId());
if (Objects.nonNull(area)) {
areaName = area.getAreaName();
}
}
}
}
// TBaseCustomer company = customerService.getById(Integer.valueOf(user.getCompanyId()));
DeviceInfoVO device = deviceService.getByDeviceNo(ticket.getDeviceNo());
String warrantyStateDesc = "";
@ -578,7 +590,7 @@ public class TicketController extends ControllerBase {
}
String area = "";
if (Objects.nonNull(ticket.getAreaId())) {
GongfuTicketArea area1 = ticketAreaService.lambdaQuery().likeLeft(GongfuTicketArea::getPath, ticket.getAreaId()).one();
GongfuTicketArea area1 = ticketAreaService.lambdaQuery().likeRight(GongfuTicketArea::getPath, ticket.getAreaId()).one();
if (Objects.nonNull(area1)) {
if (area1.getPath().contains(",")) {
List<String> ids = StrUtil.split(area1.getPath(), ",");
@ -688,7 +700,7 @@ public class TicketController extends ControllerBase {
**/
@GetMapping("getChatMessages")
@ApiMark(moduleName = "工单管理", apiName = "获取工单聊天记录")
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Long ticketId) {
Integer userId = AdminUserUtil.getUserId();
MessageVO vo = new MessageVO();
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(ticketId, userId);
@ -859,7 +871,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("/exportTicketExcel")
@ApiMark(moduleName = "工单管理", apiName = "导出工单详情为excel")
public void exportExcel(HttpServletResponse response, @Valid @RequestParam @NotNull Integer ticketId) throws Exception {
public void exportExcel(HttpServletResponse response, @Valid @RequestParam @NotNull Long ticketId) throws Exception {
GongfuTicket ticket = ticketService.getById(ticketId);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
Workbook workbook = new XSSFWorkbook();
@ -1143,7 +1155,7 @@ public class TicketController extends ControllerBase {
*/
@GetMapping("/getHandlers")
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Integer ticketId) {
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Long ticketId) {
return ApiResult.success(ticketService.getTicketHandle(ticketId));
}
@ -1318,7 +1330,7 @@ public class TicketController extends ControllerBase {
* @return 用户列表
*/
@GetMapping("getShengWangChannelUsers")
public ApiResult<List<Integer>> getShengWangChannelUsers(Integer ticketId) throws IOException, InterruptedException {
public ApiResult<List<Integer>> getShengWangChannelUsers(Long ticketId) throws IOException, InterruptedException {
return ApiResult.success(shengWangService.getChannelUsers("ticket" + ticketId).getUsers());
}

View File

@ -125,11 +125,11 @@ public class AdminUser implements Serializable {
* 是否是工服工单处理人
*/
@TableField("is_gongfu_handler")
private boolean isGongFuHandler;
private boolean gongFuHandler;
/**
* 是否是工服用户
*/
@TableField("is_gongfu")
private boolean isGongfu;
private boolean gongfu;
}

View File

@ -41,7 +41,7 @@ public class FileUploadRecord implements Serializable {
private String fileType;
/**
* 关联类型0工单1代理商2管理端账户3匿名工单4派工单5工服匿名工单
* 关联类型0工单1代理商2管理端账户3匿名工单4派工单
*/
private Byte source;

View File

@ -43,7 +43,7 @@ public interface GongfuDeviceMapper extends BaseMapper<GongfuDevice> {
void taskWarrantyStateNotOutsideWithinWarranty();
List<ComponentInfo> getComponents(Integer componentId, String language);
List<ComponentInfo> getComponents(String modelNo, String language);
List<DeviceAgentVO> getAgents();

View File

@ -28,7 +28,7 @@ public interface IGongfuTicketService extends IService<GongfuTicket> {
GongfuTicket assignmentTicket(AssignmentTicketRequest request);
GongfuTicket completeTicket(Integer id);
GongfuTicket completeTicket(Long id);
// Ticket closeTicket(TicketCloseRequest request);
@ -40,19 +40,19 @@ public interface IGongfuTicketService extends IService<GongfuTicket> {
List<GongfuTicket> getNonemergency(int days);
GongfuTicket revoked(Integer id);
GongfuTicket revoked(Long id);
GongfuTicket reopen(Integer id);
GongfuTicket reopen(Long id);
GongfuTicket addTicketHandle(TicketHandleAddRequest request);
List<GongfuTicket> getNonComment(int days);
List<AdminUserSimpleVO> getTicketHandle(Integer id);
List<AdminUserSimpleVO> getTicketHandle(Long id);
List<TicketVO> getAdminFavorites(Integer userId, String from, Integer favoritesId);
GongfuTicket rejectTicket(Integer id);
GongfuTicket rejectTicket(Long id);
boolean close(GongfuTicket ticket);
}

View File

@ -19,7 +19,7 @@ public interface ITicketFollowService extends IService<TicketFollow> {
void follow(AdminFollowRequest request, Integer userId,String from);
void unfollow(Integer userId,String from, Integer ticketId);
void unfollow(Integer userId, String from, Long ticketId);
void deleteFavorites(Integer userId,String from, Integer favoritesId);
}

View File

@ -50,7 +50,7 @@ public interface ITicketService extends IService<Ticket> {
List<Ticket> getNonComment(int days);
List<AdminUserSimpleVO> getTicketHandle(Integer id);
List<AdminUserSimpleVO> getTicketHandle(Long id);
List<TicketVO> getAdminFavorites(Integer userId,String from,Integer favoritesId);

View File

@ -42,7 +42,7 @@ public class TicketChatService {
mongoTemplate.save(ticketChatDTO);
}
public List<ChatMessageVO> getMessages(Integer ticketId,Integer userId) {
public List<ChatMessageVO> getMessages(Long ticketId, Integer userId) {
Query query = new Query(Criteria.where("ticketId").is(ticketId));
TicketChatDTO ticketChatDTO = mongoTemplate.findOne(query, TicketChatDTO.class);
if (Objects.isNull(ticketChatDTO)) {

View File

@ -31,7 +31,6 @@ import java.util.stream.Collectors;
* <p>
* 服务实现类
* </p>
*
* @author 曹鹏飞
* @since 2025-01-13
*/
@ -43,12 +42,12 @@ public class AppAreaServiceImpl extends ServiceImpl<AppAreaMapper, AppArea> impl
@Override
public boolean saveOrUpdate(AppArea entity) {
if (Objects.isNull(entity.getId()) || entity.getId()<=0){
if (Objects.isNull(entity.getId()) || entity.getId() <= 0) {
entity.setCreateBy(AppUserUtil.getUserName());
entity.setCreateById(AppUserUtil.getUserId());
entity.setCreateTime(LocalDateTime.now());
return save(entity);
}else {
} else {
entity.setUpdateBy(AppUserUtil.getUserName());
entity.setUpdateTime(LocalDateTime.now());
return updateById(entity);
@ -57,26 +56,26 @@ public class AppAreaServiceImpl extends ServiceImpl<AppAreaMapper, AppArea> impl
@Override
public IPage<AreaVO> search(AreaSearchRequest request) {
if (StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_ADMIN)){
if (StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_ADMIN)) {
return new Page<>(request.getPage(), request.getPageSize());
}
if (AppUserUtil.isPrimary()){
if (AppUserUtil.isEndUser() || AppUserUtil.isPrimary()) {
request.setCreateBy(AppUserUtil.getUserId());
}else {
} else {
request.setCreateBy(appUserService.getPrimaryByCompanyId(String.valueOf(AppUserUtil.getCompanyIds().get(0))).getId());
}
if (StrUtil.isBlank(request.getName()) && Objects.isNull(request.getEnabled())) {
return getPage(request);
}else {
} else {
LambdaQueryWrapper<AppArea> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AppArea::getCreateById, request.getCreateBy());
queryWrapper.eq(Objects.nonNull(request.getEnabled()),AppArea::getEnable, request.getEnabled());
queryWrapper.like(StrUtil.isNotBlank(request.getName()),AppArea::getName, request.getName());
queryWrapper.eq(Objects.nonNull(request.getEnabled()), AppArea::getEnable, request.getEnabled());
queryWrapper.like(StrUtil.isNotBlank(request.getName()), AppArea::getName, request.getName());
queryWrapper.orderByDesc(AppArea::getId);
List<AppArea> list = baseMapper.selectList(queryWrapper);
//找出非根节点
List<AppArea> roots = list.stream().filter(l -> Objects.equals(l.getParentId(), 0)).collect(Collectors.toList());
List<AreaVO> children = convert(CollectionUtil.subtractToList(list,roots));
List<AreaVO> children = convert(CollectionUtil.subtractToList(list, roots));
if (CollectionUtil.isEmpty(children)) {
return convertToPage1(roots, request.getPage(), request.getPageSize());
}
@ -168,23 +167,23 @@ public class AppAreaServiceImpl extends ServiceImpl<AppAreaMapper, AppArea> impl
return page;
}
private void getParent(AreaVO child,List<AreaVO> datas){
AppArea parent=lambdaQuery().eq(AppArea::getId, child.getParentId()).one();
if (Objects.nonNull(parent)){
if (datas.stream().noneMatch(i->i.getId().equals(parent.getId()))){
AreaVO p=convert(parent);
private void getParent(AreaVO child, List<AreaVO> datas) {
AppArea parent = lambdaQuery().eq(AppArea::getId, child.getParentId()).one();
if (Objects.nonNull(parent)) {
if (datas.stream().noneMatch(i -> i.getId().equals(parent.getId()))) {
AreaVO p = convert(parent);
datas.add(p);
getParent(p,datas);
getParent(p, datas);
}
}
}
private AreaVO convert(AppArea area){
return Convert.convert(AreaVO.class,area);
private AreaVO convert(AppArea area) {
return Convert.convert(AreaVO.class, area);
}
private List<AreaVO> convert(List<AppArea> areas){
return Convert.toList(AreaVO.class,areas);
private List<AreaVO> convert(List<AppArea> areas) {
return Convert.toList(AreaVO.class, areas);
}
private IPage<AreaVO> getPage(AreaSearchRequest request) {
@ -193,7 +192,7 @@ public class AppAreaServiceImpl extends ServiceImpl<AppAreaMapper, AppArea> impl
page.setSize(request.getPageSize());
lambdaQuery()
.eq(AppArea::getParentId, 0)
.eq(AppArea::getCreateById,request.getCreateBy())
.eq(AppArea::getCreateById, request.getCreateBy())
.eq(Objects.nonNull(request.getEnabled()), AppArea::getEnable, request.getEnabled())
.orderByAsc(AppArea::getId)
.page(page);
@ -208,8 +207,8 @@ public class AppAreaServiceImpl extends ServiceImpl<AppAreaMapper, AppArea> impl
}
private List<AreaVO> getChildren(Integer parentId, Boolean enable) {
List<AreaVO> datas=convert(lambdaQuery()
.eq(AppArea::getParentId,parentId)
List<AreaVO> datas = convert(lambdaQuery()
.eq(AppArea::getParentId, parentId)
.eq(Objects.nonNull(enable), AppArea::getEnable, enable)
.orderByAsc(AppArea::getId)
.list());

View File

@ -10,6 +10,7 @@ import com.nflg.mobilebroken.common.pojo.vo.DeviceAgentVO;
import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO;
import com.nflg.mobilebroken.common.pojo.vo.DeviceVO;
import com.nflg.mobilebroken.common.util.AppUserUtil;
import com.nflg.mobilebroken.common.util.MultilingualUtil;
import com.nflg.mobilebroken.repository.entity.GongfuDevice;
import com.nflg.mobilebroken.repository.mapper.GongfuDeviceMapper;
import com.nflg.mobilebroken.repository.service.IGongfuDeviceService;
@ -17,6 +18,8 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
@ -31,12 +34,11 @@ public class GongfuDeviceServiceImpl extends ServiceImpl<GongfuDeviceMapper, Gon
@Override
public DeviceInfoVO getByDeviceNo(String deviceNo) {
// DeviceInfoVO vo = baseMapper.getByDeviceNo(deviceNo);
// if (Objects.nonNull(vo)) {
// vo.setComponents(baseMapper.getComponents(vo.getComponentId(), MultilingualUtil.getLanguage()));
// }
// return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
return null;
DeviceInfoVO vo = baseMapper.getByDeviceNo(deviceNo);
if (Objects.nonNull(vo)) {
vo.setComponents(baseMapper.getComponents(vo.getModelNo(), MultilingualUtil.getLanguage()));
}
return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
}

View File

@ -101,7 +101,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
if (CollectionUtil.isNotEmpty(request.getImages())) {
for (String url : request.getImages()) {
FileUploadRecord record = fileUploadRecordService.lambdaQuery()
.eq(FileUploadRecord::getSource, (byte) 4)
.eq(FileUploadRecord::getSource, (byte) 0)
.eq(FileUploadRecord::getSourceId, 0)
.eq(FileUploadRecord::getUrl, url)
.one();
@ -115,7 +115,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
if (CollectionUtil.isNotEmpty(request.getAttachments())) {
for (String url : request.getAttachments()) {
FileUploadRecord record = fileUploadRecordService.lambdaQuery()
.eq(FileUploadRecord::getSource, (byte) 4)
.eq(FileUploadRecord::getSource, (byte) 0)
.eq(FileUploadRecord::getSourceId, 0)
.eq(FileUploadRecord::getUrl, url)
.one();
@ -240,7 +240,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
// .update();
// }
@Override
public GongfuTicket completeTicket(Integer id) {
public GongfuTicket completeTicket(Long id) {
GongfuTicket ticket = getById(id);
VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.Processing.getState()))
.throwMessage("非处理中状态不允许完成");
@ -320,7 +320,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
}
@Override
public GongfuTicket revoked(Integer id) {
public GongfuTicket revoked(Long id) {
GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单");
@ -335,7 +335,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
}
@Override
public GongfuTicket reopen(Integer id) {
public GongfuTicket reopen(Long id) {
GongfuTicket ticket = lambdaQuery().eq(GongfuTicket::getId, id).one();
VUtils.trueThrowBusinessError(!(Objects.equals(ticket.getUserId(), AppUserUtil.getUserId()) && StrUtil.equals(ticket.getUserPlatform(), AppUserUtil.getFrom())))
.throwMessage("无权操作该工单");
@ -374,7 +374,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
}
@Override
public List<AdminUserSimpleVO> getTicketHandle(Integer id) {
public List<AdminUserSimpleVO> getTicketHandle(Long id) {
GongfuTicket ticket = lambdaQuery().select(GongfuTicket::getHandle, GongfuTicket::getId).eq(GongfuTicket::getId, id).one();
List<Integer> handles = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList());
if (CollectionUtil.isEmpty(handles)) {
@ -389,7 +389,7 @@ public class GongfuTicketServiceImpl extends ServiceImpl<GongfuTicketMapper, Gon
}
@Override
public GongfuTicket rejectTicket(Integer id) {
public GongfuTicket rejectTicket(Long id) {
GongfuTicket ticket = getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("未找到工单");
VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.ProcessingCompleted.getState()))

View File

@ -69,7 +69,7 @@ public class TicketFollowServiceImpl extends ServiceImpl<TicketFollowMapper, Tic
}
@Override
public void unfollow(Integer userId,String from, Integer ticketId) {
public void unfollow(Integer userId, String from, Long ticketId) {
byte bf = (byte) (StrUtil.equals(from, "app") ? 0 : 1);
this.remove(new LambdaQueryWrapper<TicketFollow>()
.eq(TicketFollow::getTicketId, ticketId)

View File

@ -364,9 +364,14 @@ public class TicketServiceImpl extends ServiceImpl<TicketMapper, Ticket> impleme
}
@Override
public List<AdminUserSimpleVO> getTicketHandle(Integer id) {
public List<AdminUserSimpleVO> getTicketHandle(Long id) {
Ticket ticket = lambdaQuery().select(Ticket::getHandle, Ticket::getId).eq(Ticket::getId, id).one();
List<Integer> handles = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList());
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("未找到工单");
List<Integer> handles = StrUtil.split(ticket.getHandle(), ",")
.stream()
.filter(StrUtil::isNotBlank)
.map(Integer::parseInt)
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(handles)) {
return Collections.emptyList();
}

View File

@ -104,9 +104,10 @@
<select id="getComponents" resultType="com.nflg.mobilebroken.common.pojo.vo.ComponentInfo">
SELECT p.id, if(LENGTH(ld.language_value)>0,ld.language_value,p.part_name) AS 'name'
FROM gongfu_device_component_detail dcd
inner join gongfu_device_component dc ON dc.id = dcd.device_component_id
INNER JOIN gongfu_device_part p ON dcd.model_part_id = p.id
LEFT JOIN gongfu_device_part_language_data ld ON dcd.model_part_id = ld.source_id
WHERE p.enable=1 AND dcd.device_component_id=#{componentId} AND ld.language_code=#{language}
WHERE p.enable=1 AND dc.`enable` = 1 AND dc.model_no=#{modelNo} AND ld.language_code=#{language}
</select>
<select id="getAgents" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceAgentVO">

View File

@ -39,7 +39,7 @@
<where>
t.state!=4
<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 (t.user_platform='admin' AND t.user_id=#{userId}))
</if>
<if test="request.state!=null">
AND t.state=#{request.state}

View File

@ -103,8 +103,8 @@
LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=IF(#{from}='app',0,1)
LEFT JOIN ticket_evaluate te ON t.id=te.ticket_id AND t.state=2
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN t_base_language_data l ON p.id=l.source_id AND l.language_code=#{language}
LEFT JOIN v_device_part p ON t.component_id=p.id
LEFT JOIN v_device_part_language 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
<include refid="searchWhereCondition"/>
ORDER BY t.id DESC
@ -120,8 +120,8 @@
LEFT JOIN app_area a2 ON u.area_id=a2.id
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.from=IF(#{from}='app',0,1)
LEFT JOIN ticket_evaluate te ON t.id=te.ticket_id AND t.state=2
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN t_base_language_data l ON p.id=l.source_id AND l.language_code=#{language}
LEFT JOIN v_device_part p ON t.component_id=p.id
LEFT JOIN v_device_part_language 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
<include refid="searchWhereCondition"/>
ORDER BY t.id DESC
@ -137,8 +137,8 @@
LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=IF(#{from}='app',0,1)
LEFT JOIN ticket_evaluate te ON t.id=te.ticket_id AND t.state=2
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN t_base_language_data l ON p.id=l.source_id AND l.language_code=#{language}
LEFT JOIN v_device_part p ON t.component_id=p.id
LEFT JOIN v_device_part_language l ON p.id=l.source_id AND l.language_code=#{language}
LEFT JOIN v_all_device vd ON t.device_no=vd.device_no
WHERE t.state!=4
<if test="isPrimary!=null">
@ -172,7 +172,7 @@
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1
LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN v_device_part p ON t.component_id=p.id
<include refid="adminSearchWhereCondition"/>
ORDER BY t.state,t.id DESC
</select>
@ -195,7 +195,7 @@
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1
LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN v_device_part p ON t.component_id=p.id
<include refid="adminSearchWhereCondition"/>
ORDER BY t.state,t.id DESC
</select>
@ -218,7 +218,7 @@
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN v_device_part p ON t.component_id=p.id
<include refid="adminSearchWhereCondition"/>
ORDER BY t.state,t.id DESC
</select>
@ -240,7 +240,7 @@
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN v_device_part p ON t.component_id=p.id
<include refid="adminSearchWhereCondition"/>
ORDER BY t.state,t.id DESC
</select>
@ -276,7 +276,7 @@
LEFT JOIN dictionary_item di ON d.warranty_state=di.id
LEFT JOIN admin_user auc ON t.cqm=auc.id
LEFT JOIN admin_user auh ON t.current_handle=auh.id
LEFT JOIN t_base_part p ON t.component_id=p.id
LEFT JOIN v_device_part p ON t.component_id=p.id
ORDER BY t.state,t.id DESC
</select>