Kaynağa Gözat

张丁 预约作业票4.0

zhangding 2 yıl önce
ebeveyn
işleme
0527b00577

+ 14 - 0
master/src/main/java/com/ruoyi/framework/web/controller/BaseController.java

@@ -78,6 +78,20 @@ public class BaseController
         return rspData;
     }
 
+    /**
+     * 响应请求分页数据
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    protected TableDataInfo getDataTable(List<?> list, List<?> list2 )
+    {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(new PageInfo(list2).getTotal());
+        return rspData;
+    }
+
     /**
      * 响应返回结果
      *

+ 81 - 21
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -81,7 +81,7 @@ public class TInvoiceBookingworkticketController extends BaseController
            }
 
         }
-        return getDataTable(newtInvoiceWorkcontentList);
+        return getDataTable(newtInvoiceWorkcontentList , bookingworkticketList);
     }
 
     /**
@@ -126,13 +126,6 @@ public class TInvoiceBookingworkticketController extends BaseController
      //   tInvoiceBookingworkticket.setPhonenumber(t.getPhonenumber());
         // 测试一下,先得到这个文件名 地址   在赋值插入 然后赋值 改文件名
         tInvoiceBookingworkticketService.insertTInvoiceBookingworkticket(tInvoiceBookingworkticket);
-        try {
-            String url=  PreView(tInvoiceBookingworkticket.getId());
-            tInvoiceBookingworkticket.setFilename(url);
-            tInvoiceBookingworkticketService.updateTInvoiceBookingworkticket(tInvoiceBookingworkticket);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
 
         Long didi=tInvoiceBookingworkticket.getId();
         List<TInvoiceWorkcontent>  w=tInvoiceBookingworkticket.gettInvoiceWorkcontentList();
@@ -142,6 +135,13 @@ public class TInvoiceBookingworkticketController extends BaseController
             wt.setBookingticketId(didi);
             tInvoiceBookingworkticketService.insertTInvoiceWorkcontent(wt);
         }
+        try {
+            String url=  PreView(tInvoiceBookingworkticket.getId());
+            tInvoiceBookingworkticket.setFilename(url);
+            tInvoiceBookingworkticketService.updateTInvoiceBookingworkticket(tInvoiceBookingworkticket);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
 
         return AjaxResult.success(didi);
     }
@@ -238,25 +238,85 @@ public class TInvoiceBookingworkticketController extends BaseController
         List<SysDictData> book_risk_level = iSysDictTypeService.selectDictDataByType("book_risk_level");
         List<SysDictData> book_work_area = iSysDictTypeService.selectDictDataByType("book_work_area");
         List<SysDictData> book_user_mg = iSysDictTypeService.selectDictDataByType("book_user_mg");
+        //构造模板的value
+        StringBuilder content=new StringBuilder();
+        StringBuilder contentUserUnit=new StringBuilder();
+        StringBuilder contentUserMg=new StringBuilder();
+        StringBuilder contentUserWorkUnit=new StringBuilder();
+        StringBuilder contentUserWorkType=new StringBuilder();
        for(int i =0;i<tInvoiceWorkcontentList.size();i++){
            TInvoiceWorkcontent tInvoiceWorkcontent=tInvoiceWorkcontentList.get(i);
-           params.put("content"+i, Texts.of(tInvoiceWorkcontent.getWorkDescription()+ticket.getWorkArea()).fontSize(12).bold().create());
+           //不为空的字段进行拼接
+          if(ticket.getWorkArea()!=null){
+              for (SysDictData p : book_work_area) {
+                  if (ticket.getWorkArea().toString().equals(p.getDictValue())) {
+                      content.append("具体工作内容:"+tInvoiceWorkcontent.getWorkDescription()+"\r\n"+"区域:"+p.getDictLabel());//装置名称
+                  }
+              }
+          }
+           if(tInvoiceWorkcontent.getRiskLevel()!=null){
+               for (SysDictData p : book_risk_level) {
+                   if (tInvoiceWorkcontent.getRiskLevel().toString().equals(p.getDictValue())) {
+                       content.append("风险提醒:"+p.getDictLabel());
+                   }
+               }
+           }
+           params.put("content"+i, Texts.of(content.toString()).fontSize(10).bold().create());
+           if(ticket.getUserUnit()!=null){
+               for (SysDictData p : book_user_unit) {
+                   if (ticket.getUserUnit().toString().equals(p.getDictValue())) {
+                       contentUserUnit.append(p.getDictLabel());//用户单位
+                   }
+               }
+               if(!params.containsKey("userUnit")){
+                   params.put("userUnit", Texts.of(contentUserWorkUnit.toString()).fontSize(10).bold().create());
+               }
+           }
+           if(ticket.getUserMg()!=null){
+               for (SysDictData p : book_user_mg) {
+                   if (ticket.getUserMg().toString().equals(p.getDictValue())) {
+                       contentUserMg.append(p.getDictLabel());//用户主管
+                   }
+               }
+               if(!params.containsKey("userMg")){
+                   params.put("userMg", Texts.of(contentUserWorkUnit.toString()).fontSize(10).bold().create());
+               }
+           }
+           if(ticket.getWorkUnit()!=null){
+               for (SysDictData p : book_work_unit) {
+                   if (ticket.getWorkUnit().toString().equals(p.getDictValue())) {
+                       contentUserWorkUnit.append(p.getDictLabel());//施工单位承包商
+                   }
+               }
+               if(!params.containsKey("workUnit")){
+               params.put("workUnit", Texts.of(contentUserWorkUnit.toString()).fontSize(10).bold().create());
+               }
+           }
+           if(tInvoiceWorkcontent.getWorkType()!=null){
+               for (SysDictData p : book_work_type) {
+                   if (tInvoiceWorkcontent.getWorkType().toString().equals(p.getDictValue())) {
+                       contentUserWorkType.append(p.getDictLabel());//作业类型
+                   }
+               }
+               params.put("workType"+i, Texts.of(contentUserWorkType.toString()).fontSize(10).bold().create());
+           }
+           if(ticket.getWorkStartTime()!=null){
+               params.put("workStartTime",Texts.of(DateUtils.dateTime(ticket.getWorkStartTime())).fontSize(10).bold().create());
+           }
+           if(ticket.getWorkEndTime()!=null){
+               params.put("workEndTime",Texts.of(DateUtils.dateTime(ticket.getWorkEndTime())).fontSize(10).bold().create());
+           }
+           params.put("urlImg", "C:\\Users\\shi'sen'yuan\\Downloads\\SamplePNGImage_3mbmb.png");
+           content.delete(0, content.length());
+           contentUserWorkType.delete(0, contentUserWorkType.length());
        }
         // 渲染文本
 
 
-        params.put("workStartTime",Texts.of(DateUtils.dateTime(ticket.getWorkStartTime())).fontSize(12).bold().create());
-        params.put("workEndTime",Texts.of(DateUtils.dateTime(ticket.getWorkEndTime())).fontSize(12).bold().create());
-        params.put("urlImg", "C:\\Users\\shi'sen'yuan\\Downloads\\SamplePNGImage_3mbmb.png");
-        if(ticket.getWorkUnit()!=null){
-            params.put("workUnit", Texts.of(ticket.getWorkUnit().toString()).fontSize(12).bold().create());
-        }
-        if(ticket.getUserUnit()!=null){
-            params.put("userUnit", Texts.of(ticket.getUserUnit().toString()).fontSize(12).bold().create());
-        }
-        if(ticket.getUserMg()!=null){
-            params.put("userMg", Texts.of(ticket.getUserMg().toString()).fontSize(12).bold().create());
-        }
+
+
+
+
         return params;
     };
 

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

@@ -128,7 +128,7 @@ public class OfficeConvertController {
             // 文件转化
             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);
+           // this.doActionConvertedFile(RuoYiConfig.getProfile() + File.separator +"temp" + File.separator +converterPdf);
         } catch (Exception e) {
             e.printStackTrace();
         }

BIN
master/src/main/resources/static/word/invoice/book.docx


+ 3 - 2
ui/src/views/invoice/bookingworkticket/index.vue

@@ -903,9 +903,10 @@ export default {
       else{
          const formatDate =new FormData();
       formatDate.append("filepath",row.bookingworkticket.filename)
-
+//       formatDate.append("filepath","/profile\\开票预约系统需求文档(4).pdf")
+     
       //调用文件预览api
-      let res= this.officeConvert.officeConvertCommon(formatDate)
+      let res= this.officeConvert.bookConvertCommon(formatDate)
 
 
       //查看接受的全局方法的返回结果 console.log(res)