Jelajahi Sumber

LY 作业票

ly 2 tahun lalu
induk
melakukan
2c9d1f2905

+ 23 - 8
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -689,9 +689,12 @@ public class TInvoiceBookingworkticketController extends BaseController {
                 row.createCell(6).setCellValue(t.getBookingworkticket().getContact());
                 //电话
                 row.createCell(7).setCellValue(t.getBookingworkticket().getPhonenumber());
-                //用户
-
-                row.createCell(8).setCellValue(t.getBookingworkticket().getUserMgDeptName() + " " + t.getBookingworkticket().getUserMgName() + " " + t.getBookingworkticket().getUserMgPhone());
+                //用户  承包商和用户单位一致时,用户显示为空;用户单位为CBP/C 时,用户显示为空;
+                if (t.getBookingworkticket().getWorkUnit().equals(t.getBookingworkticket().getUserMgDeptName()) || t.getBookingworkticket().getUserMgDeptName().equals("CBP/C")){
+                    row.createCell(8).setCellValue("");
+                }else {
+                    row.createCell(8).setCellValue(t.getBookingworkticket().getUserMgDeptName() + " " + t.getBookingworkticket().getUserMgName() + " " + t.getBookingworkticket().getUserMgPhone());
+                }
                 //票号
                 String ticketNo = t.getWhgzxkzh() + t.getDhzyxkzh() + t.getGczyxkzh() + t.getMbzyxkzh() + t.getXzkjxkzh() + t.getYqxkzh();
                 row.createCell(9).setCellValue(ticketNo.replaceAll("null", ""));
@@ -824,6 +827,16 @@ public class TInvoiceBookingworkticketController extends BaseController {
         return toAjax(tInvoiceBookingworkticketService.deleteTInvoiceBookingworkticketByIds(ids));
     }
 
+    /**
+     * 删除预约作业票台账
+     */
+    @PreAuthorize("@ss.hasPermi('invoice:bookingworkticket:remove')")
+    @Log(title = "预约作业票台账作废", businessType = BusinessType.DELETE)
+    @DeleteMapping("cancel/{id}")
+    public AjaxResult cancelBook(@PathVariable Long id) {
+        return toAjax(tInvoiceBookingworkticketService.cancelTInvoiceBookingworkticketById(id));
+    }
+
 
     /**
      * @param id 生成文件名
@@ -910,7 +923,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
             if (ticket.getUserMg() != null) {
                 SysUser sysUser = sysUserService.selectUserById(ticket.getUserMg());
                 if (!params.containsKey("userMg")) {
-                    if (sysUser.getSignUrl() != null) {
+                    if (sysUser.getSignUrl() != null && new File(sysUser.getSignUrl()).exists()  ) {
                         params.put("userMg", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
@@ -928,7 +941,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
             if (tApproveReserveInvoice.getUserId() != null) {
                 if (!params.containsKey("userName")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getUserId());
-                    if (sysUser.getSignUrl() != null) {
+                    if (sysUser.getSignUrl() != null && new File(sysUser.getSignUrl()).exists()) {
                         params.put("userName", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
@@ -1007,7 +1020,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
             if (tApproveReserveInvoice.getDevSupId() != null) {
                 if (!params.containsKey("zzUser")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getDevSupId());
-                    if (sysUser.getSignUrl() != null) {
+                    if (sysUser.getSignUrl() != null && new File(sysUser.getSignUrl()).exists()) {
                         params.put("zzUser", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
@@ -1023,7 +1036,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
             if (tApproveReserveInvoice.getDevEngineerId() != null) {
                 if (!params.containsKey("zjgcs")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getDevEngineerId());
-                    if (sysUser.getSignUrl() != null) {
+                    if (sysUser.getSignUrl() != null && new File(sysUser.getSignUrl()).exists()) {
                         params.put("zjgcs", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
@@ -1038,7 +1051,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
             if (tApproveReserveInvoice.getManagerconId() != null) {
                 if (!params.containsKey("zzjl")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getManagerconId());
-                    if (sysUser.getSignUrl() != null) {
+                    if (sysUser.getSignUrl() != null && new File(sysUser.getSignUrl()).exists()) {
                         params.put("zzjl", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
@@ -1075,6 +1088,8 @@ public class TInvoiceBookingworkticketController extends BaseController {
             logger.info("目录不存在,创建文件夹{}!", fileDir);
             dir.mkdirs();
         }
+        fileName = fileName.replaceAll("/" , "_"); //替换文件中敏感字段
+        logger.info("目录文件{}!", fileName);
         String filePath = fileDir + "/" + fileName;
         logger.info("目录{}!", filePath);
         // 读取模板渲染参数

+ 2 - 0
master/src/main/java/com/ruoyi/project/invoice/mapper/TInvoiceBookingworkticketMapper.java

@@ -77,4 +77,6 @@ public interface TInvoiceBookingworkticketMapper  extends BaseMapper<TInvoiceBoo
 
     @DataScope(deptAlias = "b")
     List<TInvoiceWorkcontent> selectTInvoiceWorkcontentList(TInvoiceBookingworkticket tInvoiceBookingworkticket);
+
+    int cancelTInvoiceBookingworkticketById(Long id);
 }

+ 1 - 0
master/src/main/java/com/ruoyi/project/invoice/mapper/TInvoiceContractorMapper.java

@@ -70,4 +70,5 @@ public interface TInvoiceContractorMapper
      *  查询承包商列表
      */
     List<String> selectTInvoiceContractorAllList();
+
 }

+ 2 - 0
master/src/main/java/com/ruoyi/project/invoice/service/ITInvoiceBookingworkticketService.java

@@ -125,4 +125,6 @@ public interface ITInvoiceBookingworkticketService extends IService<TInvoiceBook
 
 
     List<TInvoiceWorkcontent> selectTInvoiceWorkcontentList(TInvoiceBookingworkticket tInvoiceBookingworkticket);
+
+    int cancelTInvoiceBookingworkticketById(Long id);
 }

+ 5 - 0
master/src/main/java/com/ruoyi/project/invoice/service/impl/TInvoiceBookingworkticketServiceImpl.java

@@ -191,4 +191,9 @@ public class TInvoiceBookingworkticketServiceImpl extends ServiceImpl<TInvoiceBo
     public List<TInvoiceWorkcontent> selectTInvoiceWorkcontentList(TInvoiceBookingworkticket tInvoiceBookingworkticket) {
         return tInvoiceBookingworkticketMapper.selectTInvoiceWorkcontentList(tInvoiceBookingworkticket);
     }
+
+    @Override
+    public int cancelTInvoiceBookingworkticketById(Long id) {
+        return tInvoiceBookingworkticketMapper.cancelTInvoiceBookingworkticketById(id);
+    }
 }

+ 216 - 216
master/src/main/java/com/ruoyi/project/officeConvert/OfficeConvertController.java

@@ -1,216 +1,216 @@
-//package com.ruoyi.project.officeConvert;
-//
-//import com.ruoyi.common.constant.Constants;
-//import com.ruoyi.common.constant.HttpStatus;
-//import com.ruoyi.common.utils.StringUtils;
-//import com.ruoyi.framework.config.RuoYiConfig;
-//import com.ruoyi.framework.web.controller.BaseController;
-//import com.ruoyi.framework.web.domain.AjaxResult;
-//
-//import org.jodconverter.DocumentConverter;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Component;
-//import org.springframework.web.bind.annotation.*;
-//import org.springframework.web.context.request.RequestContextHolder;
-//import org.springframework.web.context.request.ServletRequestAttributes;
-//
-//import javax.annotation.Resource;
-//import javax.servlet.http.HttpServletRequest;
-//import javax.servlet.http.HttpServletResponse;
-//import java.io.*;
-//import java.nio.charset.StandardCharsets;
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//import static com.ruoyi.project.officeConvert.PptPreview.pptToImage;
-//import static com.ruoyi.project.officeConvert.PptPreview.pptxToImage;
-//
-//
-//@Component
-//@RestController
-//@RequestMapping(value="/office",method = RequestMethod.POST)
-//public class OfficeConvertController {
-//
-//    // 第一步:转换器直接注入
-//    @Resource
-//    DocumentConverter documentConverter;
-//
-//    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
-//
-//    private static  String successMsg="请求成功!请预览文件!";
-//
-//    private static  String failMsg="暂不支持此格式类型文件预览,请下载后查看!";
-//
-//    private static  String codeMiss="若csv文件预览结果有乱码,请重新上传编码格式另存为ANSI的csv文件!";
-//
-//    private static  String fileMiss="您需要预览的文件不存在,可能已在本地删除,请重新上传即可!";
-//
-//
-//    /**
-//     office类型的文件
-//     先远程服务端获取文件
-//     然后转换
-//     然后读写缓冲区返回前台
-//     */
-//    @PostMapping("/toPdfFile")
-//    public AjaxResult toPdfFile(HttpServletRequest request, HttpServletResponse response,String filepath) {
-//        // 获取HttpServletResponse
-//        response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
-//        String newFilePath=filepath.replace("/profile","");
-//        // 需要转换的文件路径
-//        File file = new File(RuoYiConfig.getProfile()+newFilePath);
-//        boolean  flag= file.exists();
-//        if(flag==false){
-//            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
-//        }
-//        String converterPdf ="";  //生成的文件名
-//        try {
-//            // 转换之后文件生成的本地地址
-//            File newFile = new File(RuoYiConfig.getProfile());
-//            if (!newFile.exists()) {
-//                newFile.mkdirs();
-//            }
-//            String name =file.getName();
-//            int t=name.lastIndexOf(".");
-//            String newName=name.substring(0,t);
-//            //根据文件类型判断转换方式
-//            if(newFilePath.endsWith(".docx")||newFilePath.endsWith(".doc")||newFilePath.endsWith(".xlsx")
-//                    ||newFilePath.endsWith(".xls")||newFilePath.endsWith(".csv")||newFilePath.endsWith(".txt")){
-//                converterPdf =  newName+".html";
-//            }else if(newFilePath.endsWith(".mp4")||newFilePath.endsWith("pdf")||newFilePath.endsWith(".gif")
-//                    ||newFilePath.endsWith("jpg")||newFilePath.endsWith("png")
-//                    ||newFilePath.endsWith(".jpeg")){
-//                //浏览器可以直接打开的直接返回图片和视频的文件路径
-//                return   new AjaxResult(HttpStatus.SUCCESS,successMsg,Constants.RESOURCE_PREFIX+ "/" + newFilePath) ;
-//            }else {
-//                //其他类型都不支持就返回错误消息
-//                return new AjaxResult(HttpStatus.SUCCESS,failMsg,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
-//            }
-//            // 文件转化
-//            documentConverter.convert(file).to(new File(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf)).execute();
-//            //office文件需要给有表格的加一个边框 以免 排版出现问题
-//            if(newFilePath.endsWith(".xlsx")){
-//                this.doActionConvertedFile(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf);
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        //最后应该返回转换后的文件名称
-//        String pathFileName = Constants.RESOURCE_PREFIX+ File.separator +"temp" + File.separator + converterPdf;
-//        return  newFilePath.endsWith(".csv")? new AjaxResult(HttpStatus.SUCCESS,codeMiss,pathFileName): new AjaxResult(HttpStatus.SUCCESS,successMsg,pathFileName) ;
-//    }
-//
-//    @PostMapping("/toBookFile")
-//    public AjaxResult toBookFile(HttpServletRequest request, HttpServletResponse response,String filepath) {
-//        // 获取HttpServletResponse
-//        response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
-//        String newFilePath=filepath.replace("/profile","");
-//        // 需要转换的文件路径
-//        File file = new File(RuoYiConfig.getProfile()+newFilePath);
-//        boolean  flag= file.exists();
-//        if(flag==false){
-//            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
-//        }
-//        String converterPdf ="";  //生成的文件名
-//        try {
-//            // 转换之后文件生成的本地地址
-//            File newFile = new File(RuoYiConfig.getProfile());
-//            if (!newFile.exists()) {
-//                newFile.mkdirs();
-//            }
-//            String name =file.getName();
-//            int t=name.lastIndexOf(".");
-//            String newName=name.substring(0,t);
-//            //预约开票的word文档
-//                converterPdf =  newName+".pdf";
-//            // 文件转化
-//            documentConverter.convert(file).to(new File(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf)).execute();
-//            //office文件需要给有表格的加一个边框 以免 排版出现问题
-//           // this.doActionConvertedFile(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf);
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        //最后应该返回转换后的文件名称
-//        String pathFileName = Constants.RESOURCE_PREFIX+ File.separator +"temp" + File.separator + converterPdf;
-//        return   new AjaxResult(HttpStatus.SUCCESS,successMsg,pathFileName) ;
-//    }
-//
-//
-//    /**
-//    PPT文件需要根据不同格式类型区分一下
-//     */
-//    @PostMapping("/PPTransJPEG")
-//    public AjaxResult PPTransJPEG(HttpServletRequest request, HttpServletResponse response,String filepath) {
-//        Map<String, Object> resultMap = new HashMap<>();
-//        String newFilePath=filepath.replace("/profile","");
-//        // 需要转换的PPT文件路径
-//        File file = new File(RuoYiConfig.getProfile()+newFilePath);
-//        //判断ppt,pptx文件是否存在本地
-//        boolean  flag= file.exists();
-//        if(flag==false){
-//            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
-//        }
-//        File imageFile = new File(RuoYiConfig.getProfile() + File.separator + "temp");
-//        if (!imageFile.exists()){
-//            imageFile.mkdirs();
-//        } //判断生成文件路径是否已存在
-//        String name =file.getName();
-//        int t=name.lastIndexOf(".");
-//        String newName=name.substring(0,t); //将名字带到生成方法中以便于区分不同文件名的ppt
-//        List list =new ArrayList();
-//        if(newFilePath.endsWith("pptx")){
-//            list= pptToImage(file, imageFile,newName);
-//        }else {
-//            list= pptxToImage(file, imageFile,newName);
-//        }
-//        //将生成的图片传给前端
-//        resultMap.put("imagePathList", list);
-//        //  resultMap.put("reviewUrlPrefix",  Constants.RESOURCE_PREFIX+ "/" );
-//        return  new AjaxResult(HttpStatus.SUCCESS,successMsg,resultMap);
-//    }
-//
-//    private static final String getPathFileName(String uploadDir, String fileName) throws IOException
-//    {
-//        int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
-//        String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
-//        String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
-//        return pathFileName;
-//    }
-//
-//    /**
-//     * 对转换后的文件进行操作(改变编码方式)
-//     *
-//     * @param outFilePath 文件绝对路径
-//     */
-//    public void doActionConvertedFile(String outFilePath) {
-//        StringBuilder sb = new StringBuilder();
-//        try (InputStream inputStream = new FileInputStream(outFilePath);
-//             BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, System.getProperty("sun.jnu.encoding")))) {
-//            String line;
-//            while (null != (line = reader.readLine())) {
-//                if (line.contains("charset=gb2312")) {
-//                    line = line.replace("charset=gb2312", "charset=utf-8");
-//                }
-//                sb.append(line);
-//            }
-//            // 添加sheet控制头
-//            sb.append("<script src=\"js/jquery-3.0.0.min.js\" type=\"text/javascript\"></script>");
-//            sb.append("<script src=\"js/excel.header.js\" type=\"text/javascript\"></script>");
-//            sb.append("<link rel=\"stylesheet\" href=\"bootstrap/css/bootstrap.min.css\">");
-//        } catch (IOException e) {
-//            e.printStackTrace();
-//        }
-//        // 重新写入文件
-//        try (FileOutputStream fos = new FileOutputStream(outFilePath);
-//             BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))) {
-//            writer.write(sb.toString());
-//        } catch (IOException e) {
-//            e.printStackTrace();
-//        }
-//    }
-//
-//}
+package com.ruoyi.project.officeConvert;
+
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.constant.HttpStatus;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+
+import org.jodconverter.DocumentConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static com.ruoyi.project.officeConvert.PptPreview.pptToImage;
+import static com.ruoyi.project.officeConvert.PptPreview.pptxToImage;
+
+
+@Component
+@RestController
+@RequestMapping(value="/office",method = RequestMethod.POST)
+public class OfficeConvertController {
+
+    // 第一步:转换器直接注入
+    @Resource
+    DocumentConverter documentConverter;
+
+    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
+
+    private static  String successMsg="请求成功!请预览文件!";
+
+    private static  String failMsg="暂不支持此格式类型文件预览,请下载后查看!";
+
+    private static  String codeMiss="若csv文件预览结果有乱码,请重新上传编码格式另存为ANSI的csv文件!";
+
+    private static  String fileMiss="您需要预览的文件不存在,可能已在本地删除,请重新上传即可!";
+
+
+    /**
+     office类型的文件
+     先远程服务端获取文件
+     然后转换
+     然后读写缓冲区返回前台
+     */
+    @PostMapping("/toPdfFile")
+    public AjaxResult toPdfFile(HttpServletRequest request, HttpServletResponse response,String filepath) {
+        // 获取HttpServletResponse
+        response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
+        String newFilePath=filepath.replace("/profile","");
+        // 需要转换的文件路径
+        File file = new File(RuoYiConfig.getProfile()+newFilePath);
+        boolean  flag= file.exists();
+        if(flag==false){
+            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
+        }
+        String converterPdf ="";  //生成的文件名
+        try {
+            // 转换之后文件生成的本地地址
+            File newFile = new File(RuoYiConfig.getProfile());
+            if (!newFile.exists()) {
+                newFile.mkdirs();
+            }
+            String name =file.getName();
+            int t=name.lastIndexOf(".");
+            String newName=name.substring(0,t);
+            //根据文件类型判断转换方式
+            if(newFilePath.endsWith(".docx")||newFilePath.endsWith(".doc")||newFilePath.endsWith(".xlsx")
+                    ||newFilePath.endsWith(".xls")||newFilePath.endsWith(".csv")||newFilePath.endsWith(".txt")){
+                converterPdf =  newName+".html";
+            }else if(newFilePath.endsWith(".mp4")||newFilePath.endsWith("pdf")||newFilePath.endsWith(".gif")
+                    ||newFilePath.endsWith("jpg")||newFilePath.endsWith("png")
+                    ||newFilePath.endsWith(".jpeg")){
+                //浏览器可以直接打开的直接返回图片和视频的文件路径
+                return   new AjaxResult(HttpStatus.SUCCESS,successMsg,Constants.RESOURCE_PREFIX+ "/" + newFilePath) ;
+            }else {
+                //其他类型都不支持就返回错误消息
+                return new AjaxResult(HttpStatus.SUCCESS,failMsg,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
+            }
+            // 文件转化
+            documentConverter.convert(file).to(new File(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf)).execute();
+            //office文件需要给有表格的加一个边框 以免 排版出现问题
+            if(newFilePath.endsWith(".xlsx")){
+                this.doActionConvertedFile(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //最后应该返回转换后的文件名称
+        String pathFileName = Constants.RESOURCE_PREFIX+ File.separator +"temp" + File.separator + converterPdf;
+        return  newFilePath.endsWith(".csv")? new AjaxResult(HttpStatus.SUCCESS,codeMiss,pathFileName): new AjaxResult(HttpStatus.SUCCESS,successMsg,pathFileName) ;
+    }
+
+    @PostMapping("/toBookFile")
+    public AjaxResult toBookFile(HttpServletRequest request, HttpServletResponse response,String filepath) {
+        // 获取HttpServletResponse
+        response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
+        String newFilePath=filepath.replace("/profile","");
+        // 需要转换的文件路径
+        File file = new File(RuoYiConfig.getProfile()+newFilePath);
+        boolean  flag= file.exists();
+        if(flag==false){
+            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
+        }
+        String converterPdf ="";  //生成的文件名
+        try {
+            // 转换之后文件生成的本地地址
+            File newFile = new File(RuoYiConfig.getProfile());
+            if (!newFile.exists()) {
+                newFile.mkdirs();
+            }
+            String name =file.getName();
+            int t=name.lastIndexOf(".");
+            String newName=name.substring(0,t);
+            //预约开票的word文档
+                converterPdf =  newName+".pdf";
+            // 文件转化
+            documentConverter.convert(file).to(new File(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf)).execute();
+            //office文件需要给有表格的加一个边框 以免 排版出现问题
+           // this.doActionConvertedFile(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //最后应该返回转换后的文件名称
+        String pathFileName = Constants.RESOURCE_PREFIX+ File.separator +"temp" + File.separator + converterPdf;
+        return   new AjaxResult(HttpStatus.SUCCESS,successMsg,pathFileName) ;
+    }
+
+
+    /**
+    PPT文件需要根据不同格式类型区分一下
+     */
+    @PostMapping("/PPTransJPEG")
+    public AjaxResult PPTransJPEG(HttpServletRequest request, HttpServletResponse response,String filepath) {
+        Map<String, Object> resultMap = new HashMap<>();
+        String newFilePath=filepath.replace("/profile","");
+        // 需要转换的PPT文件路径
+        File file = new File(RuoYiConfig.getProfile()+newFilePath);
+        //判断ppt,pptx文件是否存在本地
+        boolean  flag= file.exists();
+        if(flag==false){
+            return new AjaxResult(HttpStatus.SUCCESS,fileMiss,Constants.RESOURCE_PREFIX+ "/" + newFilePath);
+        }
+        File imageFile = new File(RuoYiConfig.getProfile() + File.separator + "temp");
+        if (!imageFile.exists()){
+            imageFile.mkdirs();
+        } //判断生成文件路径是否已存在
+        String name =file.getName();
+        int t=name.lastIndexOf(".");
+        String newName=name.substring(0,t); //将名字带到生成方法中以便于区分不同文件名的ppt
+        List list =new ArrayList();
+        if(newFilePath.endsWith("pptx")){
+            list= pptToImage(file, imageFile,newName);
+        }else {
+            list= pptxToImage(file, imageFile,newName);
+        }
+        //将生成的图片传给前端
+        resultMap.put("imagePathList", list);
+        //  resultMap.put("reviewUrlPrefix",  Constants.RESOURCE_PREFIX+ "/" );
+        return  new AjaxResult(HttpStatus.SUCCESS,successMsg,resultMap);
+    }
+
+    private static final String getPathFileName(String uploadDir, String fileName) throws IOException
+    {
+        int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
+        String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
+        String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
+        return pathFileName;
+    }
+
+    /**
+     * 对转换后的文件进行操作(改变编码方式)
+     *
+     * @param outFilePath 文件绝对路径
+     */
+    public void doActionConvertedFile(String outFilePath) {
+        StringBuilder sb = new StringBuilder();
+        try (InputStream inputStream = new FileInputStream(outFilePath);
+             BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, System.getProperty("sun.jnu.encoding")))) {
+            String line;
+            while (null != (line = reader.readLine())) {
+                if (line.contains("charset=gb2312")) {
+                    line = line.replace("charset=gb2312", "charset=utf-8");
+                }
+                sb.append(line);
+            }
+            // 添加sheet控制头
+            sb.append("<script src=\"js/jquery-3.0.0.min.js\" type=\"text/javascript\"></script>");
+            sb.append("<script src=\"js/excel.header.js\" type=\"text/javascript\"></script>");
+            sb.append("<link rel=\"stylesheet\" href=\"bootstrap/css/bootstrap.min.css\">");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        // 重新写入文件
+        try (FileOutputStream fos = new FileOutputStream(outFilePath);
+             BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))) {
+            writer.write(sb.toString());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}

+ 6 - 7
master/src/main/java/com/ruoyi/project/sems/controller/TSpecdevYlrqController.java

@@ -518,8 +518,8 @@ public class TSpecdevYlrqController extends BaseController
         row0.createCell(5).setCellValue("检验单位");row0.getCell(5).setCellStyle(style);
         row0.createCell(6).setCellValue("定期检验日期");row0.getCell(6).setCellStyle(style);
         row0.createCell(7).setCellValue("安全状况等级");row0.getCell(7).setCellStyle(style);
-        row0.createCell(8).setCellValue("定期检验报告编号");row0.getCell(8).setCellStyle(style);
-        row0.createCell(9).setCellValue("下次定期检验日期");row0.getCell(9).setCellStyle(style);
+        row0.createCell(8).setCellValue("下次定期检验日期");row0.getCell(8).setCellStyle(style);
+        row0.createCell(9).setCellValue("定期检验报告编号");row0.getCell(9).setCellStyle(style);
 
         row0.createCell(10).setCellValue("年度检查日期");row0.getCell(10).setCellStyle(style);
         row0.createCell(11).setCellValue("年度检查结论");row0.getCell(11).setCellStyle(style);
@@ -534,18 +534,18 @@ public class TSpecdevYlrqController extends BaseController
             Row row = sheet.createRow(rowIndex);
             row.createCell(0).setCellValue(t.getId());
             row.createCell(1).setCellValue(t.getPlantCode());
-            row.createCell(2).setCellValue(t.getDevname());
-            row.createCell(3).setCellValue(t.getDevno());
+            row.createCell(2).setCellValue(t.getDevno());
+            row.createCell(3).setCellValue(t.getDevname());
             row.createCell(4).setCellValue(t.getUseno());
             row.createCell(5).setCellValue(t.getCheckUnit());
             if (t.getWarnDate()!= null){
                 row.createCell(6).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getWarnDate()));
             }
             row.createCell(7).setCellValue(t.getSafeClass());
-            row.createCell(8).setCellValue(t.getReportNo());
             if (t.getNextWarnDate()!= null){
-                row.createCell(9).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
+                row.createCell(8).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
             }
+            row.createCell(9).setCellValue(t.getReportNo());
             if (t.getYearWarnDate()!= null){
                 row.createCell(10).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getYearWarnDate()));
             }
@@ -564,5 +564,4 @@ public class TSpecdevYlrqController extends BaseController
         out.close();
         return AjaxResult.success(filename);
     }
-
 }

+ 10 - 10
master/src/main/resources/application.yml

@@ -172,16 +172,16 @@ xss:
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
 # 文件预览
-#jodconverter:
-#  local:
-#    enabled: true
-#    # 设置LibreOffice主目录
-#    #    office-home: /opt/libreoffice7.2  C:/Program Files/LibreOffice
-#    office-home: C:/Program Files/LibreOffice
-#    max-tasks-per-process: 100
-#    port-numbers: 8100
-#    # 开启多个LibreOffice进程,每个端口对应一个进程
-#    portNumbers: 9080,9081,9089
+jodconverter:
+  local:
+    enabled: true
+    # 设置LibreOffice主目录
+    #    office-home: /opt/libreoffice7.2  C:/Program Files/LibreOffice
+    office-home: C:/Program Files/LibreOffice
+    max-tasks-per-process: 100
+    port-numbers: 8100
+    # 开启多个LibreOffice进程,每个端口对应一个进程
+    portNumbers: 9080,9081,9089
 
 # 代码生成
 gen:

+ 7 - 0
master/src/main/resources/mybatis/invoice/TInvoiceBookingworkticketMapper.xml

@@ -388,5 +388,12 @@
             #{id}
         </foreach>
     </update>
+    <update id="cancelTInvoiceBookingworkticketById" parameterType="Long">
+        update t_invoice_bookingworkticket
+        set status = 7
+        where id = #{id}
+    </update>
+
+
 
 </mapper>

+ 8 - 0
ui/src/api/invoice/bookingworkticket.js

@@ -48,6 +48,14 @@ export function delBookingworkticket(id) {
   })
 }
 
+// 作废预约作业票台账
+export function cancelBookingworkticket(id) {
+  return request({
+    url: '/invoice/bookingworkticket/cancel/' + id,
+    method: 'delete'
+  })
+}
+
 // 导出预约作业票台账
 export function exportBookingworkticket(query) {
   return request({

+ 1 - 1
ui/src/views/ehs/jobticket/index.vue

@@ -483,7 +483,7 @@
       v-show="total>0"
       :total="total"
       :page.sync="queryParams.pageNum"
-      :page-sizes="[20,50,100]"
+      :page-sizes="[20,100,200,500]"
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />

+ 53 - 48
ui/src/views/invoice/bookingworkticket/index.vue

@@ -228,49 +228,40 @@
           </el-button>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding ">
-        <template slot-scope="scope">
+      <el-table-column label="操作" align="center" fixed="right" width="100" class-name="small-padding ">
+<!--        <template slot-scope="scope">-->
 <!--          <el-button-->
-<!--            v-if="scope.row.bookingworkticket.status== 0"-->
+<!--            v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10"-->
 <!--            size="mini"-->
 <!--            type="text"-->
-<!--            icon="el-icon-edit"-->
-<!--            @click="handleUpdate(scope.row)"-->
-<!--            v-hasPermi="['invoice:bookingworkticket:edit']"-->
-<!--          >修改-->
+<!--            icon="el-icon-view"-->
+<!--            @click="billSee(scope.row)"-->
+<!--          > 票据预览-->
 <!--          </el-button>-->
 <!--          <el-button-->
-<!--            v-if="scope.row.bookingworkticket.status== 0"-->
+<!--            v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10"-->
 <!--            size="mini"-->
 <!--            type="text"-->
-<!--            icon="el-icon-delete"-->
-<!--            @click="handleDelete(scope.row)"-->
-<!--          >删除-->
+<!--            icon="el-icon-download"-->
+<!--            @click="handleDownload(scope.row)"-->
+<!--          >下载申请单-->
 <!--          </el-button>-->
-          <el-button
-            v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10"
-            size="mini"
-            type="text"
-            icon="el-icon-view"
-            @click="billSee(scope.row)"
-          > 票据预览
-          </el-button>
-          <el-button
-            v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10"
-            size="mini"
-            type="text"
-            icon="el-icon-download"
-            @click="handleDownload(scope.row)"
-          >下载申请单
-          </el-button>
-<!--          <el-dropdown size="mini">-->
-<!--            <span class="el-dropdown-link" >其他操作<i class="el-icon-arrow-down el-icon&#45;&#45;right" /></span>-->
-<!--            <el-dropdown-menu slot="dropdown">-->
-<!--              <el-dropdown-item command="handleUpdate">编辑</el-dropdown-item>-->
-<!--              <el-dropdown-item  command="handleEnabled">启用</el-dropdown-item>-->
-<!--              <el-dropdown-item  command="handleDisabled">禁用</el-dropdown-item>-->
-<!--            </el-dropdown-menu>-->
-<!--          </el-dropdown>-->
+
+<!--        </template>-->
+        <template slot-scope="scope">
+          <el-button @click="handleCancel(scope.row)" v-if="scope.row.bookingworkticket.status== 3" type="text" size="small" style="margin-right: 6px">作废</el-button>
+          <el-dropdown v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10" size="mini" @command="(command) => handleCommand(command, scope.row)">
+      <span class="el-dropdown-link">
+        <el-button
+          type="text"
+          size="mini"
+        >更多<i class="el-icon-arrow-down"></i></el-button>
+      </span>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item command="billSee">票据预览</el-dropdown-item>
+              <el-dropdown-item  command="handleDownload" >下载申请单</el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
         </template>
       </el-table-column>
     </el-table>
@@ -279,6 +270,7 @@
       v-show="total>0"
       :total="total"
       :page.sync="queryParams.pageNum"
+      :page-sizes="[20,100,200,500]"
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
@@ -541,6 +533,7 @@ import {
   updateBookingworkticket,
   exportBookingworkticket,
   exportBookingworkticketZb,
+  cancelBookingworkticket,
   importTemplate,
   seeBookingworkticket,
   assion
@@ -695,7 +688,7 @@ export default {
       // 查询参数
       queryParams: {
         pageNum: 1,
-        pageSize: 20,
+        pageSize: 100,
         workUnit: null,
         workArea: null,
         unitNumber: null,
@@ -779,6 +772,9 @@ export default {
         gczyjb: [
           { validator: checkGczyjb, trigger: 'blur' }
         ],
+        tag: [
+          {required: true, message: "索引不能为空", trigger: "blur"}
+        ],
       }
     };
   },
@@ -1286,6 +1282,20 @@ export default {
         this.msgSuccess("删除成功");
       })
     },
+    /** 删除按钮操作 */
+    handleCancel(row) {
+      const id = row.bookingticketId;
+      this.$confirm('是否确认作废?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return cancelBookingworkticket(id);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      })
+    },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
@@ -1504,18 +1514,6 @@ export default {
             this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
             console.log(this.pdf.pdfUrl)
           }
-          // this.$nextTick(() => {
-          //   const iframe = window.frames['iFrame']
-          //   const handleLoad = () => {
-          //     setTimeout(() => {
-          //       const Do = (iframe.contentWindow || iframe.contentDocument)
-          //       console.log(Do.document.getElementsByTagName('table')[0])
-          //       Do.document.getElementsByTagName('table')[0].style.width = "100%"
-          //       Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
-          //     }, 500)
-          //   }
-          //   iframe.addEventListener('load', handleLoad, true)
-          // })
         }).catch(result => {
 
           //请求失败,关闭loading,pdf地址直接为为空,不显示
@@ -1526,6 +1524,13 @@ export default {
       }
 
     },
+    handleCommand(command,row) {
+      if (command == 'billSee') {
+        this.billSee(row)
+      }else if (command == 'handleDownload') {
+        this.handleDownload(row)
+      }
+    },
     //文件预览
     openPdf() {
       //ppt就跳路由预览,office就直接打开文件新页面