|
@@ -1,5 +1,6 @@
|
|
|
package com.example.xiaoshiweixinback.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -10,17 +11,16 @@ import com.example.xiaoshiweixinback.business.utils.CacheUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.LoginUtils;
|
|
|
import com.example.xiaoshiweixinback.domain.*;
|
|
|
import com.example.xiaoshiweixinback.entity.dto.ticket.*;
|
|
|
-import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
|
|
|
-import com.example.xiaoshiweixinback.entity.vo.TicketVO;
|
|
|
+import com.example.xiaoshiweixinback.entity.vo.*;
|
|
|
import com.example.xiaoshiweixinback.mapper.TicketMapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import javax.management.modelmbean.XMLParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author admin
|
|
@@ -38,13 +38,18 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
private final TicketPatentApplyService ticketPatentApplyService;
|
|
|
private final AssoTicketFileService assoTicketFileService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增or更新工单
|
|
|
+ * @param ticketDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Integer addorUpdateTicket(TicketAddDTO ticketAddDTO) {
|
|
|
+ public Integer addorUpdateTicket(TicketDTO ticketDTO) {
|
|
|
Integer reId = null;
|
|
|
Ticket ticket = new Ticket();
|
|
|
- if (ticketAddDTO.getId() == null) {
|
|
|
+ if (ticketDTO.getId() == null) {
|
|
|
//工单基本信息入库
|
|
|
- BeanUtils.copyProperties(ticketAddDTO, ticket);
|
|
|
+ BeanUtils.copyProperties(ticketDTO, ticket);
|
|
|
// PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
|
// ticket.setCreateId(personnelVO.getUuid());
|
|
|
ticket.setCreateId("123");
|
|
@@ -55,33 +60,33 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
|
|
|
Integer ticketId = ticket.getId();
|
|
|
//根据工单的不同类型 信息入库
|
|
|
- Integer ticketType = ticketAddDTO.getTicketType();
|
|
|
+ Integer ticketType = ticketDTO.getTicketType();
|
|
|
switch (ticketType) {
|
|
|
case 1:
|
|
|
//填写工单
|
|
|
TicketFillInAddDTO ticketFillInAddDTO = new TicketFillInAddDTO();
|
|
|
- BeanUtils.copyProperties(ticketAddDTO, ticketFillInAddDTO);
|
|
|
+ BeanUtils.copyProperties(ticketDTO, ticketFillInAddDTO);
|
|
|
ticketFillInAddDTO.setTicketId(ticketId);
|
|
|
reId = ticketFillInService.add(ticketFillInAddDTO);
|
|
|
break;
|
|
|
case 2:
|
|
|
//知识产权维权工单
|
|
|
TicketRightsProtectionAddDTO ticketRightsProtectionAddDTO = new TicketRightsProtectionAddDTO();
|
|
|
- BeanUtils.copyProperties(ticketAddDTO, ticketRightsProtectionAddDTO);
|
|
|
+ BeanUtils.copyProperties(ticketDTO, ticketRightsProtectionAddDTO);
|
|
|
ticketRightsProtectionAddDTO.setTicketId(ticketId);
|
|
|
reId = ticketRightsProtectionService.add(ticketRightsProtectionAddDTO);
|
|
|
break;
|
|
|
case 3:
|
|
|
//知识产权应诉工单
|
|
|
TicketLitigationRespondingAddDTO ticketLitigationRespondingAddDTO = new TicketLitigationRespondingAddDTO();
|
|
|
- BeanUtils.copyProperties(ticketAddDTO, ticketLitigationRespondingAddDTO);
|
|
|
+ BeanUtils.copyProperties(ticketDTO, ticketLitigationRespondingAddDTO);
|
|
|
ticketLitigationRespondingAddDTO.setTicketId(ticketId);
|
|
|
reId = ticketLitigationRespondingService.add(ticketLitigationRespondingAddDTO);
|
|
|
break;
|
|
|
case 4:
|
|
|
//我要申请专利工单
|
|
|
TicketPatentApplyAddDTO ticketPatentApplyAddDTO = new TicketPatentApplyAddDTO();
|
|
|
- BeanUtils.copyProperties(ticketAddDTO, ticketPatentApplyAddDTO);
|
|
|
+ BeanUtils.copyProperties(ticketDTO, ticketPatentApplyAddDTO);
|
|
|
ticketPatentApplyAddDTO.setTicketId(ticketId);
|
|
|
reId = ticketPatentApplyService.add(ticketPatentApplyAddDTO);
|
|
|
break;
|
|
@@ -91,7 +96,7 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
}
|
|
|
|
|
|
//处理工单的附件
|
|
|
- List<String> fileGuids = ticketAddDTO.getFileGuids();
|
|
|
+ List<String> fileGuids = ticketDTO.getFileGuids();
|
|
|
if (!fileGuids.isEmpty()) {
|
|
|
List<AssoTicketFile> assoTicketFiles = new ArrayList<>();
|
|
|
for (String fileGuid : fileGuids) {
|
|
@@ -107,8 +112,8 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
|
|
|
} else {
|
|
|
ticket = this.getById(ticket.getId());
|
|
|
- ticket.setName(ticketAddDTO.getName());
|
|
|
- ticket.setContentText(ticketAddDTO.getContentText());
|
|
|
+ ticket.setName(ticketDTO.getName());
|
|
|
+ ticket.setContentText(ticketDTO.getContentText());
|
|
|
ticket.updateById();
|
|
|
}
|
|
|
return reId;
|
|
@@ -117,6 +122,7 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Records queryTickets(TicketQueryDTO ticketQueryDTO) {
|
|
|
String name = ticketQueryDTO.getName();
|
|
|
+ String num = ticketQueryDTO.getNum();
|
|
|
Integer ticketType = ticketQueryDTO.getTicketType();
|
|
|
Boolean isAdmin = ticketQueryDTO.getIsAdmin();
|
|
|
Integer pageNum = ticketQueryDTO.getCurrent();
|
|
@@ -129,6 +135,9 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
if (ticketType != null) {
|
|
|
queryWrapper.lambda().eq(Ticket::getTicketType, ticketType);
|
|
|
}
|
|
|
+ if (num != null) {
|
|
|
+ queryWrapper.lambda().eq(Ticket::getNum, num);
|
|
|
+ }
|
|
|
if (!isAdmin.equals(true)) {
|
|
|
PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
|
Integer personType = personnelVO.getPersonType();
|
|
@@ -160,6 +169,61 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
for (Ticket ticket : tickets) {
|
|
|
TicketVO ticketVO = new TicketVO();
|
|
|
BeanUtils.copyProperties(ticket, ticketVO);
|
|
|
+ Integer ticketId = ticket.getId();
|
|
|
+ //附图
|
|
|
+ LambdaQueryWrapper<AssoTicketFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoTicketFile::getTicketId, ticketId);
|
|
|
+ List<AssoTicketFile> assoTicketFiles = assoTicketFileService.list(queryWrapper);
|
|
|
+ if (assoTicketFiles != null && !assoTicketFiles.isEmpty()) {
|
|
|
+ List<String> fileGuids = assoTicketFiles.stream().map(AssoTicketFile::getFileGuid).collect(Collectors.toList());
|
|
|
+ ticketVO.setFileGuids(fileGuids);
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer ticketType = ticket.getTicketType();
|
|
|
+ switch (ticketType) {
|
|
|
+ case 1:
|
|
|
+ TicketFillInVO ticketFillInVO = new TicketFillInVO();
|
|
|
+ LambdaQueryWrapper<TicketFillIn> fillInWrapper = new LambdaQueryWrapper<>();
|
|
|
+ fillInWrapper.eq(TicketFillIn::getTicketId, ticketId);
|
|
|
+ TicketFillIn ticketFillIn = ticketFillInService.getOne(fillInWrapper, false);
|
|
|
+ if (ticketFillIn != null) {
|
|
|
+ BeanUtils.copyProperties(ticketFillIn, ticketFillInVO);
|
|
|
+ }
|
|
|
+ ticketVO.setTicketFillInVO(ticketFillInVO);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ TicketRightsProtectionVO rightsProtectionVO = new TicketRightsProtectionVO();
|
|
|
+ LambdaQueryWrapper<TicketRightsProtection> rightsProtectionWrapper = new LambdaQueryWrapper<>();
|
|
|
+ rightsProtectionWrapper.eq(TicketRightsProtection::getTicketId, ticketId);
|
|
|
+ TicketRightsProtection ticketRightsProtection = ticketRightsProtectionService.getOne(rightsProtectionWrapper, false);
|
|
|
+ if (ticketRightsProtection != null) {
|
|
|
+ BeanUtils.copyProperties(ticketRightsProtection, rightsProtectionVO);
|
|
|
+ }
|
|
|
+ ticketVO.setTicketRightsProtectionVO(rightsProtectionVO);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ TicketLitigationRespondingVO litigationRespondingVO = new TicketLitigationRespondingVO();
|
|
|
+ LambdaQueryWrapper<TicketLitigationResponding> respondingWrapper = new LambdaQueryWrapper<>();
|
|
|
+ respondingWrapper.eq(TicketLitigationResponding::getTicketId, ticketId);
|
|
|
+ TicketLitigationResponding ticketLitigationResponding = ticketLitigationRespondingService.getOne(respondingWrapper, false);
|
|
|
+ if (ticketLitigationResponding != null) {
|
|
|
+ BeanUtils.copyProperties(ticketLitigationResponding, litigationRespondingVO);
|
|
|
+ }
|
|
|
+ ticketVO.setTicketLitigationRespondingVO(litigationRespondingVO);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ TicketPatentApplyVO patentApplyVO = new TicketPatentApplyVO();
|
|
|
+ LambdaQueryWrapper<TicketPatentApply> patentApplyWrapper = new LambdaQueryWrapper<>();
|
|
|
+ patentApplyWrapper.eq(TicketPatentApply::getTicketId, ticketId);
|
|
|
+ TicketPatentApply ticketPatentApply = ticketPatentApplyService.getOne(patentApplyWrapper, false);
|
|
|
+ if (ticketPatentApply != null) {
|
|
|
+ BeanUtils.copyProperties(ticketPatentApply, patentApplyVO);
|
|
|
+ }
|
|
|
+ ticketVO.setTicketPatentApplyVO(patentApplyVO);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
ticketVOS.add(ticketVO);
|
|
|
}
|
|
|
}
|
|
@@ -177,7 +241,6 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
Integer id = ticketProcessUpDTO.getId();
|
|
|
Integer process = ticketProcessUpDTO.getProcess();
|
|
|
Ticket ticket = this.getById(id);
|
|
|
-
|
|
|
Boolean flag = this.ifHavePermission(ticket.getCreateId());
|
|
|
if (!flag) {
|
|
|
return 0;
|