Procházet zdrojové kódy

4/18 查询工单流程,查询工单详情

lwhhszx před 1 rokem
rodič
revize
cec3052f1d
19 změnil soubory, kde provedl 573 přidání a 43 odebrání
  1. 66 9
      src/main/java/com/example/xiaoshiweixinback/controller/TicketController.java
  2. 6 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoTicketFile.java
  3. 2 2
      src/main/java/com/example/xiaoshiweixinback/domain/Order.java
  4. 1 1
      src/main/java/com/example/xiaoshiweixinback/domain/Ticket.java
  5. 6 0
      src/main/java/com/example/xiaoshiweixinback/domain/TicketFlow.java
  6. 1 1
      src/main/java/com/example/xiaoshiweixinback/domain/Vip.java
  7. 17 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketFlowVO.java
  8. 17 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketUploadResultDTO.java
  9. 73 0
      src/main/java/com/example/xiaoshiweixinback/entity/vo/ticket/TicketDetailVO.java
  10. 55 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoTicketFileService.java
  11. 19 6
      src/main/java/com/example/xiaoshiweixinback/service/PersonService.java
  12. 14 0
      src/main/java/com/example/xiaoshiweixinback/service/TicketFillInService.java
  13. 116 4
      src/main/java/com/example/xiaoshiweixinback/service/TicketFlowService.java
  14. 14 0
      src/main/java/com/example/xiaoshiweixinback/service/TicketLitigationRespondingService.java
  15. 13 0
      src/main/java/com/example/xiaoshiweixinback/service/TicketPatentApplyService.java
  16. 16 1
      src/main/java/com/example/xiaoshiweixinback/service/TicketRightsProtectionService.java
  17. 113 18
      src/main/java/com/example/xiaoshiweixinback/service/TicketService.java
  18. 18 0
      src/main/java/com/example/xiaoshiweixinback/service/common/FileManagerService.java
  19. 6 1
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java

+ 66 - 9
src/main/java/com/example/xiaoshiweixinback/controller/TicketController.java

@@ -5,19 +5,17 @@ import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.checkLogin.checkLogin;
-import com.example.xiaoshiweixinback.entity.dto.ticket.AcceptTicketDTO;
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO;
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketQueryDTO;
+import com.example.xiaoshiweixinback.entity.dto.ticket.*;
 import com.example.xiaoshiweixinback.entity.product.ProductDTO;
-import com.example.xiaoshiweixinback.entity.dto.ticket.TicketDTO;
+import com.example.xiaoshiweixinback.entity.vo.ticket.TicketDetailVO;
+import com.example.xiaoshiweixinback.service.TicketFlowService;
 import com.example.xiaoshiweixinback.service.TicketService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 @Slf4j
 @RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/ticket")
@@ -25,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequiredArgsConstructor
 public class TicketController {
     private final TicketService ticketService;
+    private final TicketFlowService ticketFlowService;
 
     @checkLogin
     @Operation(summary = "添加工单")
@@ -56,7 +55,6 @@ public class TicketController {
         return Response.success(id);
     }
 
-
     @Operation(summary = "查询工单")
     @PostMapping("/queryTicket")
     @checkLogin
@@ -65,6 +63,7 @@ public class TicketController {
         return Response.success(records);
     }
 
+
     @Operation(summary = "受理工单")
     @PostMapping("/acceptTicket")
     @checkLogin
@@ -74,4 +73,62 @@ public class TicketController {
         records.setData(id);
         return Response.success(records);
     }
+
+
+    @Operation(summary = "上传工单结果")
+    @PostMapping("/uploadTicketResult")
+    @checkLogin
+    public Response uploadTicketResult(@RequestBody TicketUploadResultDTO ticketUploadResultDTO) {
+        Integer id = ticketService.uploadTicketResult(ticketUploadResultDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+
+    @Operation(summary = "查询工单结果")
+    @GetMapping("/getTicketResult")
+    @checkLogin
+    public Response getTicketResult(Integer ticketId) {
+        Records records = new Records();
+        try {
+            TicketFlowVO ticketFlowVO = ticketFlowService.getTicketResult(ticketId);
+            records.setData(ticketFlowVO);
+        }
+        catch (Exception e) {
+            return Response.error("607","查询错误");
+        }
+
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询工单流程")
+    @GetMapping("/queryTicketFlows")
+    @checkLogin
+    public Response queryTicketFlows(Integer ticketId) {
+        Records records = new Records();
+        try {
+            List<TicketFlowVO> ticketFlowVOs = ticketFlowService.getTicketFlows(ticketId);
+            records.setData(ticketFlowVOs);
+        } catch (Exception e) {
+            return Response.error("607","查询错误");
+        }
+
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询工单详情")
+    @GetMapping("/getTicketDetail")
+    @checkLogin
+    public Response getTicketDetail(Integer ticketId) {
+        Records records = new Records();
+        try {
+            TicketDetailVO ticketDetailVO = ticketService.getTicketDetail(ticketId);
+            records.setData(ticketDetailVO);
+        }
+        catch (Exception e) {
+            return Response.error("607","查询错误");
+        }
+        return Response.success(records);
+    }
 }

+ 6 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoTicketFile.java

@@ -3,8 +3,11 @@ package com.example.xiaoshiweixinback.domain;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 工单与附图关联表
+ *
  * @Author xiexiang
  * @Date 2024/4/8
  */
@@ -16,4 +19,7 @@ public class AssoTicketFile extends BaseEntity<AssoTicketFile> {
     private Integer ticketId;
 
     private String fileGuid;
+    private Integer type;
+    private Integer flowId;
+
 }

+ 2 - 2
src/main/java/com/example/xiaoshiweixinback/domain/Order.java

@@ -43,7 +43,7 @@ public class Order extends BaseEntity<Order> {
     /**
      * 原始价格
      */
-    private Integer orgPrice;
+    private Double orgPrice;
 
     /**
      * 
@@ -53,7 +53,7 @@ public class Order extends BaseEntity<Order> {
     /**
      * 真实价格
      */
-    private Integer truePrice;
+    private Double truePrice;
 
     /**
      * 

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/domain/Ticket.java

@@ -38,7 +38,7 @@ public class Ticket extends BaseEntity<Ticket> {
      */
     private Date createTime;
 
-    private Integer price;
+    private Double price;
     private String num;
     private String contactPerson;
     private String contactPhone;

+ 6 - 0
src/main/java/com/example/xiaoshiweixinback/domain/TicketFlow.java

@@ -36,4 +36,10 @@ public class TicketFlow extends BaseEntity<TicketFlow>  {
      */
     private String description;
 
+
+    private String remark;
+    private Integer ticketProcess;
+    private Integer ticketId;
+    private Boolean ifResult;
+
 }

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/domain/Vip.java

@@ -34,6 +34,6 @@ public class Vip extends BaseEntity<Vip> {
     private String name;
     private String vipUuid;
     private Integer lastTime;
-    private Integer price;
+    private Double price;
     private String configParameter;
 }

+ 17 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketFlowVO.java

@@ -0,0 +1,17 @@
+package com.example.xiaoshiweixinback.entity.dto.ticket;
+
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TicketFlowVO {
+    private String description;
+    private List<SystemFile> systemFiles;
+    private Date createTime;
+    private String createName;
+    private String remark;
+    private Integer ticketProcess;
+}

+ 17 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketUploadResultDTO.java

@@ -0,0 +1,17 @@
+package com.example.xiaoshiweixinback.entity.dto.ticket;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TicketUploadResultDTO {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    private List<String> fileGuids;
+    private String description;
+}

+ 73 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/ticket/TicketDetailVO.java

@@ -0,0 +1,73 @@
+package com.example.xiaoshiweixinback.entity.vo.ticket;
+
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import com.example.xiaoshiweixinback.entity.dto.ticket.TicketFlowVO;
+import com.example.xiaoshiweixinback.entity.vo.TicketFillInVO;
+import com.example.xiaoshiweixinback.entity.vo.TicketLitigationRespondingVO;
+import com.example.xiaoshiweixinback.entity.vo.TicketPatentApplyVO;
+import com.example.xiaoshiweixinback.entity.vo.TicketRightsProtectionVO;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TicketDetailVO {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 工单类型
+     */
+    private Integer ticketType;
+
+    /**
+     * 唯一工单号
+     */
+    private String num;
+
+    /**
+     * 工单进度
+     */
+    private Integer ticketProgress;
+
+    /**
+     * 联系人
+     */
+    private String contactPerson;
+
+    /**
+     * 联系电话
+     */
+    private String contactPhone;
+
+    /**
+     * 联系邮箱
+     */
+    private String contactMail;
+
+    /**
+     * 创建人
+     */
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 价格
+     */
+    private Integer price;
+
+    private TicketFillInVO ticketFillInVO;
+    private TicketPatentApplyVO ticketPatentApplyVO;
+    private TicketLitigationRespondingVO ticketLitigationRespondingVO;
+    private TicketRightsProtectionVO ticketRightsProtectionVO;
+
+    private List<SystemFile> systemFiles;
+    private TicketFlowVO ticketResult;
+}

+ 55 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoTicketFileService.java

@@ -1,17 +1,72 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.AssoTicketFile;
+import com.example.xiaoshiweixinback.domain.Ticket;
 import com.example.xiaoshiweixinback.mapper.AssoTicketFileMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 工单与附图关联Service
+ *
  * @Author xiexiang
  * @Date 2024/4/8
  */
 @Service
 @RequiredArgsConstructor
 public class AssoTicketFileService extends ServiceImpl<AssoTicketFileMapper, AssoTicketFile> {
+
+    /**
+     * 添加工单附件
+     */
+    public List<AssoTicketFile> addTicketFile(List<String> fileGuids, Integer fileType, Ticket ticket, Integer flowId) {
+
+        List<AssoTicketFile> assoTicketFiles = new ArrayList<>();
+        if (fileGuids == null) {
+            return assoTicketFiles;
+        }
+        fileGuids.forEach(item -> {
+            AssoTicketFile assoTicketFile = new AssoTicketFile();
+            assoTicketFile.setTicketId(ticket.getId());
+            assoTicketFile.setFileGuid(item);
+            assoTicketFile.setFlowId(flowId);
+            assoTicketFile.setType(fileType);
+            assoTicketFiles.add(assoTicketFile);
+        });
+        this.saveBatch(assoTicketFiles);
+        return assoTicketFiles;
+    }
+
+    /**
+     * 根据工单流程id获取文件
+     *
+     * @param flowId
+     * @return
+     */
+    public List<AssoTicketFile> queryFileByFlowId(Integer flowId) {
+        LambdaQueryWrapper<AssoTicketFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoTicketFile::getFlowId, flowId);
+        List<AssoTicketFile> assoTicketFiles = this.list(queryWrapper);
+        return assoTicketFiles;
+    }
+    /**
+     * 根据工单流程ids获取文件
+     *
+     * @param flowIds
+     * @return
+     */
+    public List<AssoTicketFile> queryFileByFlowIds(List<Integer> flowIds) {
+        if(flowIds.size()==0){
+            return new ArrayList<>();
+        }
+        LambdaQueryWrapper<AssoTicketFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(AssoTicketFile::getFlowId, flowIds);
+        List<AssoTicketFile> assoTicketFiles = this.list(queryWrapper);
+        return assoTicketFiles;
+    }
 }

+ 19 - 6
src/main/java/com/example/xiaoshiweixinback/service/PersonService.java

@@ -1,19 +1,32 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.Person;
 import com.example.xiaoshiweixinback.mapper.PersonMapper;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
-* @author admin
-* @description 针对表【person(人员表)】的数据库操作Service实现
-* @createDate 2024-03-29 16:21:25
-*/
+ * @author admin
+ * @description 针对表【person(人员表)】的数据库操作Service实现
+ * @createDate 2024-03-29 16:21:25
+ */
 @Service
-public class PersonService extends ServiceImpl<PersonMapper, Person>
-{
+public class PersonService extends ServiceImpl<PersonMapper, Person> {
+    public List<Person> getPersonsById(List<String> ids) {
+        List<Person> personList = new ArrayList<>();
+        if (ids == null || ids.size() <= 0) {
+            return personList;
+        }
+        LambdaQueryWrapper<Person> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(Person::getUuid, ids);
+        personList = this.list(queryWrapper);
+        return personList;
 
+    }
 }
 
 

+ 14 - 0
src/main/java/com/example/xiaoshiweixinback/service/TicketFillInService.java

@@ -1,8 +1,10 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.TicketFillIn;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketFillInAddDTO;
+import com.example.xiaoshiweixinback.entity.vo.TicketFillInVO;
 import com.example.xiaoshiweixinback.mapper.TicketFillInMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -28,4 +30,16 @@ public class TicketFillInService extends ServiceImpl<TicketFillInMapper, TicketF
         ticketFillIn.insert();
         return ticketFillIn.getTicketId();
     }
+
+    public TicketFillInVO  getVOByTicId(Integer ticketId) {
+        TicketFillInVO ticketFillInVO = new TicketFillInVO();
+        LambdaQueryWrapper<TicketFillIn> fillInWrapper = new LambdaQueryWrapper<>();
+        fillInWrapper.eq(TicketFillIn::getTicketId, ticketId);
+        TicketFillIn ticketFillIn = this.getOne(fillInWrapper, false);
+        if (ticketFillIn != null) {
+            BeanUtils.copyProperties(ticketFillIn, ticketFillInVO);
+        }
+        return  ticketFillInVO;
+    }
+
 }

+ 116 - 4
src/main/java/com/example/xiaoshiweixinback/service/TicketFlowService.java

@@ -1,18 +1,130 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoTicketFile;
+import com.example.xiaoshiweixinback.domain.Person;
+import com.example.xiaoshiweixinback.domain.Ticket;
 import com.example.xiaoshiweixinback.domain.TicketFlow;
+import com.example.xiaoshiweixinback.entity.dto.ticket.TicketFlowVO;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.mapper.TicketFlowMapper;
+import com.example.xiaoshiweixinback.service.common.FileManagerService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
-* @author admin
-* @description 针对表【ticket_flow(工单流程)】的数据库操作Service实现
-* @createDate 2024-04-17 18:47:48
-*/
+ * @author admin
+ * @description 针对表【ticket_flow(工单流程)】的数据库操作Service实现
+ * @createDate 2024-04-17 18:47:48
+ */
 @Service
 public class TicketFlowService extends ServiceImpl<TicketFlowMapper, TicketFlow> {
 
+    @Autowired
+    private CacheUtil cacheUtil;
+    @Autowired
+    private AssoTicketFileService assoTicketFileService;
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    @Autowired
+    private PersonService personService;
+    /**
+     * 添加工单流程
+     *
+     * @param ticket
+     * @param description
+     * @return
+     */
+    public TicketFlow addTicketFlow(Ticket ticket, String description, Boolean ifResult,String remark) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        TicketFlow ticketFlow = new TicketFlow();
+        ticketFlow.setTicketId(ticket.getId());
+        ticketFlow.setTicketProcess(ticket.getTicketProgress());
+        ticketFlow.setCreateId(personnelVO.getUuid());
+        ticketFlow.setDescription(description);
+        ticketFlow.setRemark(remark);
+        ticketFlow.setIfResult(ifResult);
+        ticketFlow.insert();
+        return ticketFlow;
+    }
+
+    /**
+     * 查询工单结果
+     *
+     * @param ticketId
+     */
+    public TicketFlowVO getTicketResult(Integer ticketId) throws Exception {
+        TicketFlowVO ticketFlowVO = new TicketFlowVO();
+        //根据工单id查询工单结果流程
+        LambdaQueryWrapper<TicketFlow> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TicketFlow::getTicketId, ticketId)
+                .eq(TicketFlow::getIfResult, true)
+                .orderByDesc(TicketFlow::getCreateTime);
+        TicketFlow ticketFlow = this.getOne(queryWrapper, false);
+        if (ticketFlow != null) {
+            //根据工单流程查询文件
+            List<TicketFlowVO> ticketFlowVOS = this.loadTicketFlows(Arrays.asList(ticketFlow));
+            ticketFlowVO = ticketFlowVOS.get(0);
+
+        }
+        return ticketFlowVO;
+    }
+
+    public List<TicketFlowVO> getTicketFlows(Integer ticketId) {
+        LambdaQueryWrapper<TicketFlow> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TicketFlow::getTicketId, ticketId)
+                .orderByDesc(TicketFlow::getCreateTime);
+        List<TicketFlow> ticketFlows = this.list(queryWrapper);
+
+        List<TicketFlowVO> ticketFlowVOS = this.loadTicketFlows(ticketFlows);
+        return ticketFlowVOS;
+    }
+
+    private List<TicketFlowVO> loadTicketFlows(List<TicketFlow> ticketFlows) {
+        List<TicketFlowVO> ticketFlowVOS = new ArrayList<>();
+        if(ticketFlows.size()==0){
+            return ticketFlowVOS;
+        }
+        List<Integer> ticketFlowIds = ticketFlows.stream().map(TicketFlow::getId).collect(Collectors.toList());
+       List<String> createIds =ticketFlows.stream().map(TicketFlow::getCreateId).collect(Collectors.toList());
+       List<Person>  personList=personService.getPersonsById(createIds);
+        List<AssoTicketFile> assoTicketFiles =new ArrayList<>();
+        //根据ids查询文件guid
+       assoTicketFiles = assoTicketFileService.queryFileByFlowIds(ticketFlowIds);
+        List<String> guids = assoTicketFiles.stream().map(AssoTicketFile::getFileGuid).collect(Collectors.toList());
+
+        //根据guid查询文件信息
+        List<SystemFile> systemFiles =fileManagerService.getSystemFileByGuids(guids);
+
+        for (TicketFlow ticketFlow : ticketFlows) {
+            TicketFlowVO ticketFlowVO = new TicketFlowVO();
+            BeanUtils.copyProperties(ticketFlow, ticketFlowVO);
+            List<AssoTicketFile> assoTicketFileList = assoTicketFiles.stream().filter(item -> item.getFlowId().equals(ticketFlow.getId())).collect(Collectors.toList());
+            if (assoTicketFileList.size() != 0) {
+                List<String> temGuids = assoTicketFileList.stream().map(AssoTicketFile::getFileGuid).collect(Collectors.toList());
+                List<SystemFile> temSystemFiles = systemFiles.stream().filter(item -> temGuids.contains(item.getGuid())).collect(Collectors.toList());
+                ticketFlowVO.setSystemFiles(temSystemFiles);
+            }
+           Person person= personList.stream().filter(item->item.getUuid().equals(ticketFlow.getCreateId())).findFirst().orElse(null);
+          if(person!=null){
+              ticketFlowVO.setCreateName(person.getName());
+          }
+            ticketFlowVOS.add(ticketFlowVO);
+        }
+        return ticketFlowVOS;
+    }
 }
 
 

+ 14 - 0
src/main/java/com/example/xiaoshiweixinback/service/TicketLitigationRespondingService.java

@@ -1,10 +1,12 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.TicketLitigationResponding;
 import com.example.xiaoshiweixinback.domain.TicketRightsProtection;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketLitigationRespondingAddDTO;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketRightsProtectionAddDTO;
+import com.example.xiaoshiweixinback.entity.vo.TicketLitigationRespondingVO;
 import com.example.xiaoshiweixinback.mapper.TicketLitigationRespondingMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -30,4 +32,16 @@ public class TicketLitigationRespondingService extends ServiceImpl<TicketLitigat
         ticketLitigationResponding.insert();
         return ticketLitigationResponding.getTicketId();
     }
+
+public TicketLitigationRespondingVO getVOByTicId(Integer ticketId){
+    TicketLitigationRespondingVO litigationRespondingVO = new TicketLitigationRespondingVO();
+    LambdaQueryWrapper<TicketLitigationResponding> respondingWrapper = new LambdaQueryWrapper<>();
+    respondingWrapper.eq(TicketLitigationResponding::getTicketId, ticketId);
+    TicketLitigationResponding ticketLitigationResponding = this.getOne(respondingWrapper, false);
+    if (ticketLitigationResponding != null) {
+        BeanUtils.copyProperties(ticketLitigationResponding, litigationRespondingVO);
+    }
+    return litigationRespondingVO;
+}
+
 }

+ 13 - 0
src/main/java/com/example/xiaoshiweixinback/service/TicketPatentApplyService.java

@@ -1,9 +1,11 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.TicketPatentApply;
 import com.example.xiaoshiweixinback.domain.TicketRightsProtection;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketPatentApplyAddDTO;
+import com.example.xiaoshiweixinback.entity.vo.TicketPatentApplyVO;
 import com.example.xiaoshiweixinback.mapper.TicketPatentApplyMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -29,4 +31,15 @@ public class TicketPatentApplyService extends ServiceImpl<TicketPatentApplyMappe
         ticketPatentApply.insert();
         return ticketPatentApply.getTicketId();
     }
+
+    public TicketPatentApplyVO getVOByTicId(Integer ticketId){
+        TicketPatentApplyVO patentApplyVO = new TicketPatentApplyVO();
+        LambdaQueryWrapper<TicketPatentApply> patentApplyWrapper = new LambdaQueryWrapper<>();
+        patentApplyWrapper.eq(TicketPatentApply::getTicketId, ticketId);
+        TicketPatentApply ticketPatentApply = this.getOne(patentApplyWrapper, false);
+        if (ticketPatentApply != null) {
+            BeanUtils.copyProperties(ticketPatentApply, patentApplyVO);
+        }
+        return  patentApplyVO;
+    }
 }

+ 16 - 1
src/main/java/com/example/xiaoshiweixinback/service/TicketRightsProtectionService.java

@@ -1,8 +1,10 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.domain.TicketRightsProtection;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketRightsProtectionAddDTO;
+import com.example.xiaoshiweixinback.entity.vo.TicketRightsProtectionVO;
 import com.example.xiaoshiweixinback.mapper.TicketRightsProtectionMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -10,6 +12,7 @@ import org.springframework.stereotype.Service;
 
 /**
  * 知识产权维权工单Service
+ *
  * @Author xiexiang
  * @Date 2024/4/7
  */
@@ -19,13 +22,25 @@ public class TicketRightsProtectionService extends ServiceImpl<TicketRightsProte
 
     /**
      * 知识产权维权工单
+     *
      * @param ticketRightsProtectionAddDTO
      * @return
      */
-    public Integer add(TicketRightsProtectionAddDTO ticketRightsProtectionAddDTO){
+    public Integer add(TicketRightsProtectionAddDTO ticketRightsProtectionAddDTO) {
         TicketRightsProtection ticketRightsProtection = new TicketRightsProtection();
         BeanUtils.copyProperties(ticketRightsProtectionAddDTO, ticketRightsProtection);
         ticketRightsProtection.insert();
         return ticketRightsProtection.getTicketId();
     }
+
+    public TicketRightsProtectionVO getVOByTicId(Integer ticketId) {
+        TicketRightsProtectionVO rightsProtectionVO = new TicketRightsProtectionVO();
+        LambdaQueryWrapper<TicketRightsProtection> rightsProtectionWrapper = new LambdaQueryWrapper<>();
+        rightsProtectionWrapper.eq(TicketRightsProtection::getTicketId, ticketId);
+        TicketRightsProtection ticketRightsProtection = this.getOne(rightsProtectionWrapper, false);
+        if (ticketRightsProtection != null) {
+            BeanUtils.copyProperties(ticketRightsProtection, rightsProtectionVO);
+        }
+        return  rightsProtectionVO;
+    }
 }

+ 113 - 18
src/main/java/com/example/xiaoshiweixinback/service/TicketService.java

@@ -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;
+    }
 }
 
 

+ 18 - 0
src/main/java/com/example/xiaoshiweixinback/service/common/FileManagerService.java

@@ -2,6 +2,7 @@ package com.example.xiaoshiweixinback.service.common;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
 import com.example.xiaoshiweixinback.entity.dto.common.FMSDeleteFileDTO;
 import com.google.gson.Gson;
 import lombok.RequiredArgsConstructor;
@@ -228,4 +229,21 @@ public class FileManagerService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
+    public List<SystemFile> getSystemFileByGuids(List<String> guids){
+
+        List<SystemFile> systemFiles = new ArrayList<>();
+
+        if (guids.size() != 0) {
+            try {
+                String res = this.getSystemFileFromFMS(guids);
+                systemFiles = JSONObject.parseArray(res, SystemFile.class);
+                if (systemFiles == null) {
+                    systemFiles = new ArrayList<>();
+                }
+            } catch (Exception e) {
+            }
+        }
+        return  systemFiles;
+    }
 }

+ 6 - 1
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java

@@ -101,7 +101,12 @@ public class WeixinPayService {
         jsApiDTO.setOut_trade_no(tradeNo);
         JsApiDTO.Amount amount = new JsApiDTO.Amount();
         amount.setCurrency("CNY");
-        amount.setTotal(order.getTruePrice());
+        Integer price =0;
+        if(order.getTruePrice()==null){
+            Double truePrice =order.getTruePrice()*100;
+            price =truePrice.intValue();
+        }
+        amount.setTotal(price);
         jsApiDTO.setAmount(amount);
         JsApiDTO.Payer payer = new JsApiDTO.Payer();
         jsApiDTO.setNotify_url("https://xsip.cn/xiaoshi-weixinback/weixinpay/success");