|
@@ -8,12 +8,8 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
|
import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.CacheUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.LoginUtils;
|
|
|
-import com.example.xiaoshiweixinback.domain.Person;
|
|
|
-import com.example.xiaoshiweixinback.domain.Ticket;
|
|
|
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketAddDTO;
|
|
|
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketPriceUpDTO;
|
|
|
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO;
|
|
|
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketQueryDTO;
|
|
|
+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.mapper.TicketMapper;
|
|
@@ -22,6 +18,7 @@ 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;
|
|
|
|
|
@@ -35,24 +32,86 @@ import java.util.List;
|
|
|
public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
private final CacheUtil cacheUtil;
|
|
|
private final LoginUtils loginUtils;
|
|
|
+ private final TicketFillInService ticketFillInService;
|
|
|
+ private final TicketRightsProtectionService ticketRightsProtectionService;
|
|
|
+ private final TicketLitigationRespondingService ticketLitigationRespondingService;
|
|
|
+ private final TicketPatentApplyService ticketPatentApplyService;
|
|
|
+ private final AssoTicketFileService assoTicketFileService;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Integer addorUpdateTicket(TicketAddDTO ticketAddDTO) {
|
|
|
+ Integer reId = null;
|
|
|
Ticket ticket = new Ticket();
|
|
|
if (ticketAddDTO.getId() == null) {
|
|
|
+ //工单基本信息入库
|
|
|
BeanUtils.copyProperties(ticketAddDTO, ticket);
|
|
|
- PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
|
- ticket.setCreateId(personnelVO.getUuid());
|
|
|
+// PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
|
+// ticket.setCreateId(personnelVO.getUuid());
|
|
|
+ ticket.setCreateId("123");
|
|
|
ticket.setTicketProgress(0);
|
|
|
String num = BatchNoUtil.getBatchNo();
|
|
|
ticket.setNum(num);
|
|
|
+ ticket.insert();
|
|
|
+
|
|
|
+ Integer ticketId = ticket.getId();
|
|
|
+ //根据工单的不同类型 信息入库
|
|
|
+ Integer ticketType = ticketAddDTO.getTicketType();
|
|
|
+ switch (ticketType) {
|
|
|
+ case 1:
|
|
|
+ //填写工单
|
|
|
+ TicketFillInAddDTO ticketFillInAddDTO = new TicketFillInAddDTO();
|
|
|
+ BeanUtils.copyProperties(ticketAddDTO, ticketFillInAddDTO);
|
|
|
+ ticketFillInAddDTO.setTicketId(ticketId);
|
|
|
+ reId = ticketFillInService.add(ticketFillInAddDTO);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //知识产权维权工单
|
|
|
+ TicketRightsProtectionAddDTO ticketRightsProtectionAddDTO = new TicketRightsProtectionAddDTO();
|
|
|
+ BeanUtils.copyProperties(ticketAddDTO, ticketRightsProtectionAddDTO);
|
|
|
+ ticketRightsProtectionAddDTO.setTicketId(ticketId);
|
|
|
+ reId = ticketRightsProtectionService.add(ticketRightsProtectionAddDTO);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //知识产权应诉工单
|
|
|
+ TicketLitigationRespondingAddDTO ticketLitigationRespondingAddDTO = new TicketLitigationRespondingAddDTO();
|
|
|
+ BeanUtils.copyProperties(ticketAddDTO, ticketLitigationRespondingAddDTO);
|
|
|
+ ticketLitigationRespondingAddDTO.setTicketId(ticketId);
|
|
|
+ reId = ticketLitigationRespondingService.add(ticketLitigationRespondingAddDTO);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ //我要申请专利工单
|
|
|
+ TicketPatentApplyAddDTO ticketPatentApplyAddDTO = new TicketPatentApplyAddDTO();
|
|
|
+ BeanUtils.copyProperties(ticketAddDTO, ticketPatentApplyAddDTO);
|
|
|
+ ticketPatentApplyAddDTO.setTicketId(ticketId);
|
|
|
+ reId = ticketPatentApplyService.add(ticketPatentApplyAddDTO);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ reId = -1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理工单的附件
|
|
|
+ List<String> fileGuids = ticketAddDTO.getFileGuids();
|
|
|
+ if (!fileGuids.isEmpty()) {
|
|
|
+ List<AssoTicketFile> assoTicketFiles = new ArrayList<>();
|
|
|
+ for (String fileGuid : fileGuids) {
|
|
|
+ AssoTicketFile assoTicketFile = new AssoTicketFile();
|
|
|
+ assoTicketFile.setTicketId(ticketId);
|
|
|
+ assoTicketFile.setFileGuid(fileGuid);
|
|
|
+ assoTicketFiles.add(assoTicketFile);
|
|
|
+ }
|
|
|
+ if (!assoTicketFiles.isEmpty()) {
|
|
|
+ assoTicketFileService.saveBatch(assoTicketFiles);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
ticket = this.getById(ticket.getId());
|
|
|
ticket.setName(ticketAddDTO.getName());
|
|
|
ticket.setContentText(ticketAddDTO.getContentText());
|
|
|
+ ticket.updateById();
|
|
|
}
|
|
|
- ticket.insertOrUpdate();
|
|
|
- return ticket.getId();
|
|
|
+ return reId;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|