|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
|
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
|
|
|
import com.example.xiaoshiweixinback.business.exception.BusinessException;
|
|
|
import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.CacheUtil;
|
|
@@ -13,7 +14,9 @@ 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.*;
|
|
|
+import com.example.xiaoshiweixinback.entity.vo.ticket.TicketDetailVO;
|
|
|
import com.example.xiaoshiweixinback.mapper.TicketMapper;
|
|
|
+import com.example.xiaoshiweixinback.service.common.FileManagerService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -37,7 +40,8 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
private final TicketLitigationRespondingService ticketLitigationRespondingService;
|
|
|
private final TicketPatentApplyService ticketPatentApplyService;
|
|
|
private final AssoTicketFileService assoTicketFileService;
|
|
|
-
|
|
|
+ private final TicketFlowService ticketFlowService;
|
|
|
+ private final FileManagerService fileManagerService;
|
|
|
/**
|
|
|
* 新增or更新工单
|
|
|
*
|
|
@@ -275,8 +279,8 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
if (!flag) {
|
|
|
return 0;
|
|
|
}
|
|
|
- String ps = "" + price * 100;
|
|
|
- ticket.setPrice(Integer.parseInt(ps));
|
|
|
+
|
|
|
+ ticket.setPrice(price);
|
|
|
ticket.updateById();
|
|
|
return ticket.getId();
|
|
|
}
|
|
@@ -300,24 +304,115 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Integer acceptTicket(AcceptTicketDTO acceptTicketDTO) {
|
|
|
- Integer id =acceptTicketDTO.getId();
|
|
|
- Double price=acceptTicketDTO.getPrice();
|
|
|
- //根据id查询工单
|
|
|
- Ticket ticket =this.getById(id);
|
|
|
- if(ticket==null){
|
|
|
- throw new BusinessException("607","未查询到工单");
|
|
|
+ Integer id = acceptTicketDTO.getId();
|
|
|
+ Double price = acceptTicketDTO.getPrice();
|
|
|
+ //根据id查询工单
|
|
|
+ Ticket ticket = this.getById(id);
|
|
|
+ if (ticket == null) {
|
|
|
+ throw new BusinessException("607", "未查询到工单");
|
|
|
}
|
|
|
- if(ticket.getTicketProgress()>2){
|
|
|
- throw new BusinessException("607","此工单不可进行操作");
|
|
|
- }
|
|
|
- Double truePrice =price*100;
|
|
|
- Integer iPrice =truePrice.intValue();
|
|
|
- ticket.setPrice(iPrice);
|
|
|
- ticket.setTicketProgress(2);
|
|
|
- ticket.updateById();
|
|
|
- return ticket.getId();
|
|
|
+ if (ticket.getTicketProgress() > 2) {
|
|
|
+ throw new BusinessException("607", "此工单不可进行操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ ticket.setPrice(price);
|
|
|
+
|
|
|
+ ticket.setTicketProgress(2);
|
|
|
+ ticket.updateById();
|
|
|
+ return ticket.getId();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传工单结果
|
|
|
+ *
|
|
|
+ * @param ticketUploadResultDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Integer uploadTicketResult(TicketUploadResultDTO ticketUploadResultDTO) {
|
|
|
+ List<String> fileGuids = new ArrayList<>();
|
|
|
+ fileGuids = ticketUploadResultDTO.getFileGuids();
|
|
|
+ String description = ticketUploadResultDTO.getDescription();
|
|
|
+ Integer id = ticketUploadResultDTO.getId();
|
|
|
+ //根据id查询工单
|
|
|
+ Ticket ticket = this.getById(id);
|
|
|
+ if (ticket == null) {
|
|
|
+ throw new BusinessException("607", "未查询到工单");
|
|
|
+ }
|
|
|
+ if (ticket.getTicketProgress() > 3) {
|
|
|
+ throw new BusinessException("607", "此工单不可进行操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加工单流程
|
|
|
+ TicketFlow ticketFlow = ticketFlowService.addTicketFlow(ticket, description, true, "添加工单结果");
|
|
|
+
|
|
|
+ //添加结果
|
|
|
+ assoTicketFileService.addTicketFile(fileGuids, 1, ticket, ticketFlow.getId());
|
|
|
+ return ticket.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ public TicketDetailVO getTicketDetail(Integer ticketId) {
|
|
|
+ TicketDetailVO ticketDetailVO = new TicketDetailVO();
|
|
|
+ //根据id查询
|
|
|
+ Ticket ticket = this.getById(ticketId);
|
|
|
+ if (ticket == null) {
|
|
|
+ return ticketDetailVO;
|
|
|
+ }
|
|
|
+ ticketDetailVO = this.loadTicketDetail(ticket);
|
|
|
+ return ticketDetailVO;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public TicketDetailVO loadTicketDetail(Ticket ticket) {
|
|
|
+
|
|
|
+ TicketDetailVO ticketDetailVO = new TicketDetailVO();
|
|
|
+ BeanUtils.copyProperties(ticket, ticketDetailVO);
|
|
|
+ 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());
|
|
|
+ List<SystemFile> systemFiles= fileManagerService.getSystemFileByGuids(fileGuids);
|
|
|
+ ticketDetailVO.setSystemFiles(systemFiles);
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer ticketType = ticket.getTicketType();
|
|
|
+
|
|
|
+ switch (ticketType) {
|
|
|
+ case 1:
|
|
|
+ TicketFillInVO ticketFillInVO = ticketFillInService.getVOByTicId(ticketId);
|
|
|
+ ticketDetailVO.setTicketFillInVO(ticketFillInVO);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ TicketRightsProtectionVO rightsProtectionVO = ticketRightsProtectionService.getVOByTicId(ticketId);
|
|
|
+ ticketDetailVO.setTicketRightsProtectionVO(rightsProtectionVO);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+
|
|
|
+ TicketLitigationRespondingVO litigationRespondingVO = ticketLitigationRespondingService.getVOByTicId(ticketId);
|
|
|
+ ticketDetailVO.setTicketLitigationRespondingVO(litigationRespondingVO);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ TicketPatentApplyVO patentApplyVO = ticketPatentApplyService.getVOByTicId(ticketId);
|
|
|
+
|
|
|
+ ticketDetailVO.setTicketPatentApplyVO(patentApplyVO);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ TicketFlowVO ticketFlowVO =ticketFlowService.getTicketResult(ticketId);
|
|
|
+ ticketDetailVO.setTicketResult(ticketFlowVO);
|
|
|
+ }
|
|
|
+ catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return ticketDetailVO;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|