1
This commit is contained in:
parent
3b9c113720
commit
22418e657d
@ -29,30 +29,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.deepoove</groupId>
|
<groupId>com.deepoove</groupId>
|
||||||
<artifactId>poi-tl</artifactId>
|
<artifactId>poi-tl</artifactId>
|
||||||
<version>1.12.2</version>
|
<version>1.10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.minio</groupId>
|
|
||||||
<artifactId>minio</artifactId>
|
|
||||||
<version>8.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>dl-module-knowledge</artifactId>
|
|
||||||
<version>2.1.0-jdk8-snapshot</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>yudao-module-infra-biz</artifactId>
|
|
||||||
<version>2.1.0-jdk8-snapshot</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-test</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
@ -1,41 +1,27 @@
|
|||||||
package cn.iocoder.yudao.module.tickets.controller.admin;
|
package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
|
||||||
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
|
|
||||||
import cn.iocoder.yudao.module.infra.service.file.FileConfigService;
|
|
||||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
||||||
import cn.iocoder.yudao.module.knowledge.constants.Result;
|
|
||||||
import cn.iocoder.yudao.module.knowledge.controller.requestdto.TOperationDocRequest;
|
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||||
import cn.iocoder.yudao.module.tickets.tools.TOperaDocRequestUtil;
|
|
||||||
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.tencentcloudapi.ess.v20201111.models.FileInfo;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表(DlRepairTickets)表控制层
|
* 维修工单表(DlRepairTickets)表控制层
|
||||||
|
*
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 18:21 2024/9/13
|
* @date 18:21 2024/9/13
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/repair/tickets")
|
@RequestMapping("/repair/tickets")
|
||||||
public class DlRepairTicketsController {
|
public class DlRepairTicketsController {
|
||||||
@ -44,26 +30,19 @@ public class DlRepairTicketsController {
|
|||||||
*/
|
*/
|
||||||
@Resource
|
@Resource
|
||||||
private DlRepairTicketsService dlRepairTicketsService;
|
private DlRepairTicketsService dlRepairTicketsService;
|
||||||
@Autowired
|
|
||||||
private TOperaDocRequestUtil tOperaDocRequestUtil;
|
|
||||||
@Autowired
|
|
||||||
private FileService fileService;
|
|
||||||
@Resource
|
|
||||||
private FileConfigService fileConfigService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 新增
|
* 维修工单表 新增
|
||||||
*
|
*
|
||||||
|
* @param ticketsRespVO 新增对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 11:33 2024/9/20
|
* @date 11:33 2024/9/20
|
||||||
* @param ticketsRespVO 新增对象
|
**/
|
||||||
**/
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "维修工单表 新增")
|
@Operation(summary = "维修工单表 新增")
|
||||||
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO){
|
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO) {
|
||||||
dlRepairTicketsService.createTickets(ticketsRespVO);
|
dlRepairTicketsService.createTickets(ticketsRespVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
@ -71,17 +50,17 @@ public class DlRepairTicketsController {
|
|||||||
/**
|
/**
|
||||||
* 维修工单表 分页
|
* 维修工单表 分页
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsReqVO 查询对象
|
||||||
|
* @param pageNo 页码
|
||||||
|
* @param pageSize 条数
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 20:51 2024/9/20
|
* @date 20:51 2024/9/20
|
||||||
* @param repairTicketsReqVO 查询对象
|
**/
|
||||||
* @param pageNo 页码
|
|
||||||
* @param pageSize 条数
|
|
||||||
**/
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "维修工单表 分页")
|
@Operation(summary = "维修工单表 分页")
|
||||||
public CommonResult<?> getTicketsPage(DlRepairTicketsReqVO repairTicketsReqVO,
|
public CommonResult<?> getTicketsPage(DlRepairTicketsReqVO repairTicketsReqVO,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
|
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
|
||||||
return success(dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page));
|
return success(dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page));
|
||||||
}
|
}
|
||||||
@ -89,26 +68,26 @@ public class DlRepairTicketsController {
|
|||||||
/**
|
/**
|
||||||
* 获得一个工单的详细信息
|
* 获得一个工单的详细信息
|
||||||
*
|
*
|
||||||
|
* @param id 工单ID
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 16:05 2024/9/21
|
* @date 16:05 2024/9/21
|
||||||
* @param id 工单ID
|
**/
|
||||||
**/
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "查看一个工单的详细信息")
|
@Operation(summary = "查看一个工单的详细信息")
|
||||||
public CommonResult<?> getTicketsById(@RequestParam("id") String id){
|
public CommonResult<?> getTicketsById(@RequestParam("id") String id) {
|
||||||
return success(dlRepairTicketsService.getTicketsById(id));
|
return success(dlRepairTicketsService.getTicketsById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 作废
|
* 维修工单表 作废
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsReqVO 工单对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 19:46 2024/9/22
|
* @date 19:46 2024/9/22
|
||||||
* @param repairTicketsReqVO 工单对象
|
**/
|
||||||
**/
|
|
||||||
@PostMapping("/void")
|
@PostMapping("/void")
|
||||||
@Operation(summary = "维修工单表 作废")
|
@Operation(summary = "维修工单表 作废")
|
||||||
public CommonResult<?> setTicketsVoid(@RequestBody DlRepairTicketsReqVO repairTicketsReqVO){
|
public CommonResult<?> setTicketsVoid(@RequestBody DlRepairTicketsReqVO repairTicketsReqVO) {
|
||||||
dlRepairTicketsService.setTicketsVoid(repairTicketsReqVO);
|
dlRepairTicketsService.setTicketsVoid(repairTicketsReqVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
@ -116,49 +95,63 @@ public class DlRepairTicketsController {
|
|||||||
/**
|
/**
|
||||||
* 维修工单表 结算
|
* 维修工单表 结算
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsRespVO 工单
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 8:50 2024/9/23
|
* @date 8:50 2024/9/23
|
||||||
* @param repairTicketsRespVO 工单
|
**/
|
||||||
**/
|
|
||||||
@PostMapping("/paid")
|
@PostMapping("/paid")
|
||||||
@Operation(summary = "维修工单表 结算")
|
@Operation(summary = "维修工单表 结算")
|
||||||
public CommonResult<?> setTicketsPaid(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO){
|
public CommonResult<?> setTicketsPaid(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO) {
|
||||||
dlRepairTicketsService.setTicketsPaid(repairTicketsRespVO);
|
dlRepairTicketsService.setTicketsPaid(repairTicketsRespVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 维修工单表 导出
|
// * 维修工单表 导出
|
||||||
*
|
// *
|
||||||
* @author lzt
|
// * @param file 导出文件
|
||||||
* @date 2024年10月11日
|
// * @author lzt
|
||||||
* @param file 导出文件
|
// * @date 2024年10月11日
|
||||||
*/
|
// */
|
||||||
@PostMapping("/print")
|
// @PostMapping("/print")
|
||||||
@Operation(summary = "维修工单表 导出")
|
// @Operation(summary = "维修工单表 导出")
|
||||||
public ResponseEntity<Result<FileInfo>> printDocument(@RequestParam("file") MultipartFile file) {
|
// public ResponseEntity<Result<FileInfo>> printDocument(@RequestParam("file") MultipartFile file) {
|
||||||
if (file.isEmpty()) {
|
// if (file.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body(new Result<>(null, "文件不能为空"));
|
// return ResponseEntity.badRequest().body(new Result<>(null, "文件不能为空"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// FileDO fileInfo = fileService.createFileDetail(file.getOriginalFilename(), "/ticket", IoUtil.readBytes(file.getInputStream()));
|
||||||
|
// return ResponseEntity.ok(new Result<>(fileInfo, "文件上传成功"));
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// return ResponseEntity.status(500).body(new Result<>(null, "文件上传失败: " + e.getMessage()));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
try {
|
/**
|
||||||
FileDO fileInfo = fileService.createFileDetail(file.getOriginalFilename(), "/ticket", IoUtil.readBytes(file.getInputStream()));
|
* 维修工单打印
|
||||||
return ResponseEntity.ok(new Result<>(fileInfo, "文件上传成功"));
|
*
|
||||||
} catch (Exception e) {
|
* @param response HttpServletResponse
|
||||||
return ResponseEntity.status(500).body(new Result<>(null, "文件上传失败: " + e.getMessage()));
|
* @param id 维修工单id
|
||||||
}
|
* @author PQZ
|
||||||
|
* @date 13:48 2024/10/12
|
||||||
|
**/
|
||||||
|
@GetMapping("/print/{id}")
|
||||||
|
@Operation(summary = "维修工单打印")
|
||||||
|
public void printDocument(HttpServletResponse response, @PathVariable String id) {
|
||||||
|
dlRepairTicketsService.print(response,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户信息和车辆信息 新增、修改
|
* 客户信息和车辆信息 新增、修改
|
||||||
*
|
*
|
||||||
|
* @param customerAndCarVO 用户信息和车辆信息
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 9:25 2024/10/8
|
* @date 9:25 2024/10/8
|
||||||
* @param customerAndCarVO 用户信息和车辆信息
|
**/
|
||||||
**/
|
|
||||||
@PostMapping("/updateUserAndCar")
|
@PostMapping("/updateUserAndCar")
|
||||||
@Operation(summary = "客户信息和车辆信息 新增、修改")
|
@Operation(summary = "客户信息和车辆信息 新增、修改")
|
||||||
public CommonResult<?> updateCustomerAndCar(@RequestBody CustomerAndCarVO customerAndCarVO){
|
public CommonResult<?> updateCustomerAndCar(@RequestBody CustomerAndCarVO customerAndCarVO) {
|
||||||
dlRepairTicketsService.updateCustomerAndCar(customerAndCarVO);
|
dlRepairTicketsService.updateCustomerAndCar(customerAndCarVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对表【dl_repair_tickets(维修工单表)】的数据库操作Service
|
* 针对表【dl_repair_tickets(维修工单表)】的数据库操作Service
|
||||||
*
|
*
|
||||||
@ -19,54 +21,64 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
/**
|
/**
|
||||||
* 维修工单表 新增
|
* 维修工单表 新增
|
||||||
*
|
*
|
||||||
|
* @param ticketsRespVO 新增对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 11:33 2024/9/20
|
* @date 11:33 2024/9/20
|
||||||
* @param ticketsRespVO 新增对象
|
|
||||||
**/
|
**/
|
||||||
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 分页
|
* 维修工单表 分页
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsReqVO 查询对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 20:51 2024/9/20
|
* @date 20:51 2024/9/20
|
||||||
* @param repairTicketsReqVO 查询对象
|
|
||||||
**/
|
**/
|
||||||
IPage<DlRepairTickets> getTicketsPage(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
|
IPage<DlRepairTickets> getTicketsPage(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得一个工单的详细信息
|
* 获得一个工单的详细信息
|
||||||
*
|
*
|
||||||
|
* @param id 工单ID
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 16:05 2024/9/21
|
* @date 16:05 2024/9/21
|
||||||
* @param id 工单ID
|
|
||||||
**/
|
**/
|
||||||
DlRepairTicketsRespVO getTicketsById(String id);
|
DlRepairTicketsRespVO getTicketsById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 作废
|
* 维修工单表 作废
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsReqVO 工单对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 19:46 2024/9/22
|
* @date 19:46 2024/9/22
|
||||||
* @param repairTicketsReqVO 工单对象
|
|
||||||
**/
|
**/
|
||||||
void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO);
|
void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 结算
|
* 维修工单表 结算
|
||||||
*
|
*
|
||||||
|
* @param repairTicketsRespVO 工单
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 8:50 2024/9/23
|
* @date 8:50 2024/9/23
|
||||||
* @param repairTicketsRespVO 工单
|
|
||||||
**/
|
**/
|
||||||
void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO);
|
void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户信息和车辆信息 新增、修改
|
* 客户信息和车辆信息 新增、修改
|
||||||
*
|
*
|
||||||
|
* @param customerAndCarVO 用户信息和车辆信息
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 9:25 2024/10/8
|
* @date 9:25 2024/10/8
|
||||||
* @param customerAndCarVO 用户信息和车辆信息
|
|
||||||
**/
|
**/
|
||||||
void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO);
|
void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印工单
|
||||||
|
*
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param id String
|
||||||
|
* @author PQZ
|
||||||
|
* @date 14:00 2024/10/12
|
||||||
|
**/
|
||||||
|
void print(HttpServletResponse response, String id);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
|||||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
|
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||||
|
import cn.iocoder.yudao.module.tickets.tools.WordUtil;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||||
@ -41,13 +42,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -325,6 +331,34 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印工单
|
||||||
|
*
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param id String
|
||||||
|
* @author PQZ
|
||||||
|
* @date 14:00 2024/10/12
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void print(HttpServletResponse response, String id) {
|
||||||
|
Map<String,Object> params = new HashMap<>();
|
||||||
|
params.put("jobNumber","123456789");
|
||||||
|
String fileName = "结算单.docx";
|
||||||
|
String tmpPath = "D:\\"+fileName;
|
||||||
|
try{
|
||||||
|
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/gdmb.docx");
|
||||||
|
XWPFTemplate template = XWPFTemplate.compile(inputStream);
|
||||||
|
template.render(params);
|
||||||
|
FileOutputStream fos = new FileOutputStream(tmpPath);
|
||||||
|
template.write(fos);
|
||||||
|
fos.flush();
|
||||||
|
template.close();
|
||||||
|
WordUtil.down(response,tmpPath,fileName);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,96 +1,94 @@
|
|||||||
package cn.iocoder.yudao.module.tickets.tools;
|
//package cn.iocoder.yudao.module.tickets.tools;
|
||||||
|
//
|
||||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
//import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||||
import cn.iocoder.yudao.module.knowledge.constants.Result;
|
//import cn.iocoder.yudao.module.knowledge.constants.Result;
|
||||||
import cn.iocoder.yudao.module.tickets.controller.admin.DlRepairTicketsController;
|
//import cn.iocoder.yudao.module.tickets.controller.admin.DlRepairTicketsController;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
//import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
//import com.deepoove.poi.XWPFTemplate;
|
||||||
import com.deepoove.poi.config.Configure;
|
//import com.deepoove.poi.config.Configure;
|
||||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
//import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||||
import com.tencentcloudapi.ess.v20201111.models.FileInfo;
|
//import com.tencentcloudapi.ess.v20201111.models.FileInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
//import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.mock.web.MockMultipartFile;
|
//import org.springframework.mock.web.MockMultipartFile;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
//import org.springframework.web.multipart.MultipartFile;
|
||||||
|
//
|
||||||
import javax.annotation.Resource;
|
//import javax.annotation.Resource;
|
||||||
import java.io.ByteArrayInputStream;
|
//import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
//import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileNotFoundException;
|
//import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
|
//
|
||||||
import static com.fhs.core.trans.util.ConvertUtil.convert;
|
//
|
||||||
|
///**
|
||||||
|
// * 工单导出工具类
|
||||||
/**
|
// * @author lzt
|
||||||
* 工单导出工具类
|
// * @date 9:27 2024年10月11日
|
||||||
* @author lzt
|
// */
|
||||||
* @date 9:27 2024年10月11日
|
//@Component(value = "TOperaDocRequestUtil" )
|
||||||
*/
|
//public class TOperaDocRequestUtil {
|
||||||
@Component(value = "TOperaDocRequestUtil" )
|
//
|
||||||
public class TOperaDocRequestUtil {
|
// @Resource
|
||||||
|
// private FileService fileService;
|
||||||
@Resource
|
// @Value("${minio.bucketName:dev}")
|
||||||
private FileService fileService;
|
// private String bucketName;
|
||||||
@Value("${minio.bucketName:dev}")
|
//
|
||||||
private String bucketName;
|
// public TOperaDocRequestUtil() throws FileNotFoundException {
|
||||||
|
// }
|
||||||
public TOperaDocRequestUtil() throws FileNotFoundException {
|
//
|
||||||
}
|
//
|
||||||
|
// private static String TEMPLATE_PATH = "/templates/gdmb.docx";
|
||||||
|
//
|
||||||
private static String TEMPLATE_PATH = "/templates/gdmb.docx";
|
// @Autowired
|
||||||
|
// private DlRepairTicketsController dlRepairTicketsController;
|
||||||
@Autowired
|
//
|
||||||
private DlRepairTicketsController dlRepairTicketsController;
|
// public FileInfo export(DlRepairTicketsReqVO request) throws IOException {
|
||||||
|
// String fileStr = TEMPLATE_PATH;
|
||||||
public FileInfo export(DlRepairTicketsReqVO request) throws IOException {
|
//
|
||||||
String fileStr = TEMPLATE_PATH;
|
// if (fileStr != null) {
|
||||||
|
// byte[] inputStream = fileService.downloadFile(bucketName, fileStr);
|
||||||
if (fileStr != null) {
|
//
|
||||||
byte[] inputStream = fileService.downloadFile(bucketName, fileStr);
|
// // 数据循环填充
|
||||||
|
// LoopRowTableRenderPolicy loopRowTableRenderPolicy = new LoopRowTableRenderPolicy();
|
||||||
// 数据循环填充
|
// Configure configure = Configure.builder().bind("czTable", loopRowTableRenderPolicy).build();
|
||||||
LoopRowTableRenderPolicy loopRowTableRenderPolicy = new LoopRowTableRenderPolicy();
|
//
|
||||||
Configure configure = Configure.builder().bind("czTable", loopRowTableRenderPolicy).build();
|
// // word导出到本地
|
||||||
|
// MultipartFile convert = null;
|
||||||
// word导出到本地
|
// if (fileStr.contains("gdmb.docx")) {
|
||||||
MultipartFile convert = null;
|
// // 操作模板文件-数据填充
|
||||||
if (fileStr.contains("gdmb.docx")) {
|
// XWPFTemplate template = XWPFTemplate.compile(String.valueOf(inputStream), configure).render(
|
||||||
// 操作模板文件-数据填充
|
// new HashMap<String, Object>() {{
|
||||||
XWPFTemplate template = XWPFTemplate.compile(String.valueOf(inputStream), configure).render(
|
// // 填充数据 TODO
|
||||||
new HashMap<String, Object>() {{
|
// //put("requestData", request);
|
||||||
// 填充数据 TODO
|
//
|
||||||
//put("requestData", request);
|
// }}
|
||||||
|
// );
|
||||||
}}
|
// ByteArrayOutputStream outputStreamWord = new ByteArrayOutputStream();;
|
||||||
);
|
// template.writeAndClose(outputStreamWord);
|
||||||
ByteArrayOutputStream outputStreamWord = new ByteArrayOutputStream();;
|
// //IConverter converter = LocalConverter.builder().build();
|
||||||
template.writeAndClose(outputStreamWord);
|
// byte[] bytes = outputStreamWord.toByteArray();
|
||||||
//IConverter converter = LocalConverter.builder().build();
|
// ByteArrayInputStream inputStreamWord = new ByteArrayInputStream(bytes);
|
||||||
byte[] bytes = outputStreamWord.toByteArray();
|
//
|
||||||
ByteArrayInputStream inputStreamWord = new ByteArrayInputStream(bytes);
|
// ByteArrayOutputStream outputStreamPdf = new ByteArrayOutputStream();
|
||||||
|
//
|
||||||
ByteArrayOutputStream outputStreamPdf = new ByteArrayOutputStream();
|
// //converter.convert(inputStreamWord).as(DocumentType.DOCX).to(outputStreamPdf).as(DocumentType.PDF).execute();
|
||||||
|
// byte[] bytesPdf = outputStreamPdf.toByteArray();
|
||||||
//converter.convert(inputStreamWord).as(DocumentType.DOCX).to(outputStreamPdf).as(DocumentType.PDF).execute();
|
// ByteArrayInputStream inputStreamPdf = new ByteArrayInputStream(bytesPdf);
|
||||||
byte[] bytesPdf = outputStreamPdf.toByteArray();
|
//
|
||||||
ByteArrayInputStream inputStreamPdf = new ByteArrayInputStream(bytesPdf);
|
// // convert = new MultipartFile(fileStr.replace(".docx", ".pdf"), "application/pdf", inputStreamPdf.readAllBytes());
|
||||||
|
// convert = new MockMultipartFile("gdmb.pdf", bytes);
|
||||||
// convert = new MultipartFile(fileStr.replace(".docx", ".pdf"), "application/pdf", inputStreamPdf.readAllBytes());
|
// }
|
||||||
convert = new MockMultipartFile("gdmb.pdf", bytes);
|
// ResponseEntity<Result<FileInfo>> responseEntity = dlRepairTicketsController.printDocument(convert);
|
||||||
}
|
//
|
||||||
ResponseEntity<Result<FileInfo>> responseEntity = dlRepairTicketsController.printDocument(convert);
|
// // 获取 Result<FileInfo> 对象
|
||||||
|
// Result<FileInfo> fileupload = responseEntity.getBody();
|
||||||
// 获取 Result<FileInfo> 对象
|
// if (fileupload != null) {
|
||||||
Result<FileInfo> fileupload = responseEntity.getBody();
|
// return fileupload.getData();
|
||||||
if (fileupload != null) {
|
// }
|
||||||
return fileupload.getData();
|
// }
|
||||||
}
|
// return null;
|
||||||
}
|
// }
|
||||||
return null;
|
//}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package cn.iocoder.yudao.module.tickets.tools;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POI-TL工具类
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:49 2024/10/12
|
||||||
|
**/
|
||||||
|
public class WordUtil {
|
||||||
|
/**模版路径*/
|
||||||
|
public static String TEMPLATE_PATH = "/templates/gdmb.docx";
|
||||||
|
|
||||||
|
public static void down(HttpServletResponse response, String filePath, String fileName) {
|
||||||
|
String encodeName = null;
|
||||||
|
try {
|
||||||
|
encodeName = encodeStr(fileName);
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
|
||||||
|
response.setHeader("Content-disposition", "attachment; filename=" + encodeName + ";" + "filename*=" + "utf-8''" + encodeName);
|
||||||
|
response.setHeader("download-filename", encodeName);
|
||||||
|
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filePath));
|
||||||
|
// 输出流
|
||||||
|
BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());) {
|
||||||
|
byte[] buff = new byte[1024];
|
||||||
|
int len = 0;
|
||||||
|
while ((len = bis.read(buff)) > 0) {
|
||||||
|
bos.write(buff, 0, len);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码工具方法
|
||||||
|
*/
|
||||||
|
public static String encodeStr(String fileName) throws UnsupportedEncodingException {
|
||||||
|
return URLEncoder.encode(fileName,"UTF-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -124,12 +124,6 @@
|
|||||||
<groupId>org.apache.tika</groupId>
|
<groupId>org.apache.tika</groupId>
|
||||||
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun.oss</groupId>
|
|
||||||
<artifactId>aliyun-sdk-oss</artifactId>
|
|
||||||
<version>3.11.2</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileCreateReq
|
|||||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||||
import org.apache.tomcat.jni.FileInfo;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.xml.ws.Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件 Service 接口
|
* 文件 Service 接口
|
||||||
@ -67,16 +63,4 @@ public interface FileService {
|
|||||||
*/
|
*/
|
||||||
FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception;
|
FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载文件
|
|
||||||
*
|
|
||||||
* @author lzt
|
|
||||||
* @date 2024年10月11日
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param fileName 文件名称
|
|
||||||
* @return 文件下载响应
|
|
||||||
*/
|
|
||||||
byte[] downloadFile(String bucketName, String fileName);
|
|
||||||
|
|
||||||
// FileInfo uploadFile(MultipartFile file);
|
|
||||||
}
|
}
|
||||||
|
@ -144,44 +144,4 @@ public class FileServiceImpl implements FileService {
|
|||||||
return BeanUtils.toBean(presignedObjectUrl, FilePresignedUrlRespVO.class,
|
return BeanUtils.toBean(presignedObjectUrl, FilePresignedUrlRespVO.class,
|
||||||
object -> object.setConfigId(fileClient.getId()));
|
object -> object.setConfigId(fileClient.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
|
||||||
public byte[] downloadFile(String bucketName, String fileStr) {
|
|
||||||
// 获取文件存储客户端
|
|
||||||
FileClient client = fileConfigService.getFileClient(Long.valueOf(bucketName));
|
|
||||||
Assert.notNull(client, "客户端({}) 不能为空", bucketName);
|
|
||||||
|
|
||||||
// 获取文件内容
|
|
||||||
return client.getContent(fileStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public FileInfo uploadFile(MultipartFile file) {
|
|
||||||
// String bucketName = "xxxxx"; // 存储桶名称
|
|
||||||
// String fileName = file.getOriginalFilename();
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// // 上传文件到 OSS
|
|
||||||
// PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileName, file.getInputStream());
|
|
||||||
// ossClient.putObject(putObjectRequest);
|
|
||||||
//
|
|
||||||
// // 创建并返回 FileInfo 对象
|
|
||||||
// FileInfo fileInfo = new FileInfo();
|
|
||||||
// fileInfo.setFileName(fileName);
|
|
||||||
// fileInfo.setBucketName(bucketName);
|
|
||||||
// return fileInfo;
|
|
||||||
//
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// throw new RuntimeException("文件上传到 OSS 失败: " + e.getMessage());
|
|
||||||
// } finally {
|
|
||||||
// // 关闭 OSS 客户端
|
|
||||||
// ossClient.shutdown();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,8 @@ yudao:
|
|||||||
- /admin-api/rescue/driverLogin
|
- /admin-api/rescue/driverLogin
|
||||||
- /admin-api/rescuePayApi/payNotify
|
- /admin-api/rescuePayApi/payNotify
|
||||||
- /admin-api/payApi/payNotify
|
- /admin-api/payApi/payNotify
|
||||||
|
- /repair/tickets/print/**
|
||||||
|
- /admin-api/repair/tickets/print/**
|
||||||
websocket:
|
websocket:
|
||||||
enable: true # websocket的开关
|
enable: true # websocket的开关
|
||||||
path: /infra/ws # 路径
|
path: /infra/ws # 路径
|
||||||
@ -298,6 +300,8 @@ yudao:
|
|||||||
- /admin-api/payApi/payNotify
|
- /admin-api/payApi/payNotify
|
||||||
- /admin-api/base/notice/**
|
- /admin-api/base/notice/**
|
||||||
- /app-api/** #小程序端接口,不区分租户
|
- /app-api/** #小程序端接口,不区分租户
|
||||||
|
- /repair/tickets/print/**
|
||||||
|
- /admin-api/repair/tickets/print/**
|
||||||
ignore-tables:
|
ignore-tables:
|
||||||
- system_tenant
|
- system_tenant
|
||||||
- system_tenant_package
|
- system_tenant_package
|
||||||
|
BIN
yudao-server/src/main/resources/templates/gdmb.docx
Normal file
BIN
yudao-server/src/main/resources/templates/gdmb.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user