Преглед изворни кода

Merge remote-tracking branch 'origin/master'

zhuang пре 8 месеци
родитељ
комит
c42072710c

+ 10 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxPmqManagementDistributionDetailDao.java

@@ -2,9 +2,12 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDetailDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.vo.pmq.ZhcxPmqManagementDistributionDetailVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  * 三单管理_派发质检确认人 Mapper 接口
@@ -36,4 +39,11 @@ public interface ZhcxPmqManagementDistributionDetailDao extends BaseMapper<ZhcxP
      * @return 未关闭的数量
      */
     String getNotClosedStateInSecondHalfFloorByPid(@Param("id") String id);
+
+    /**
+     * 外传接口_三单数据
+     * @param data
+     * @return
+     */
+    List<ZhcxPmqManagementDistributionDetailVo> getDataByTime(@Param("data") String data);
 }

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxPmqManagementDistributionDetailService.java

@@ -40,4 +40,11 @@ public interface ZhcxPmqManagementDistributionDetailService extends IService<Zhc
      * @return
      */
     R reassignment(Map<String, Object> map);
+
+    /**
+     * 外部访问接口/根据日期返回三单数据
+     * @param data 下发日期
+     * @return 数据
+     */
+    R getDataByTime(String data);
 }

+ 1 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxSeaBindProofService.java

@@ -1,7 +1,6 @@
 package com.rongwei.bscommon.sys.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.rongwei.bsentity.domain.ZhcxInspectionReportManageDo;
 import com.rongwei.bsentity.domain.ZhcxSeaBindProofDo;
 
 import javax.servlet.http.HttpServletResponse;
@@ -14,6 +13,6 @@ public interface ZhcxSeaBindProofService extends IService<ZhcxSeaBindProofDo> {
     void seabingPreviewExcel(HttpServletResponse response, ZhcxSeaBindProofDo zhcxSeaBindProofDo) throws Exception;
 
 
-
+     void  previewPdf(HttpServletResponse response, String id);
 
 }

+ 12 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxPmqManagementDistributionDetailServiceImpl.java

@@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDo;
 import com.rongwei.bsentity.domain.ZhcxPmqManagementDo;
 import com.rongwei.bsentity.domain.ZhcxPmqManagementRecoredDo;
+import com.rongwei.bsentity.vo.pmq.ZhcxPmqManagementDistributionDetailVo;
 import com.rongwei.rwcommon.base.R;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -112,4 +114,14 @@ public class ZhcxPmqManagementDistributionDetailServiceImpl extends ServiceImpl<
         this.updateById(detailDo);
         return R.ok("操作成功");
     }
+
+    @Override
+    public R getDataByTime(String data) {
+        List<ZhcxPmqManagementDistributionDetailVo> list = baseMapper.getDataByTime(data);
+        if(list.isEmpty()){
+            return R.ok("该下发日期下暂无数据");
+        }else {
+            return R.ok(list);
+        }
+    }
 }

+ 35 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxSeaBindProofServiceImpl.java

@@ -13,6 +13,9 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
 import com.google.zxing.common.BitMatrix;
 import com.google.zxing.qrcode.QRCodeWriter;
 import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.pdf.PdfReader;
+import com.lowagie.text.pdf.PdfStamper;
 import com.rongwei.bscommon.sys.dao.ZhcxSeaBindProofDao;
 import com.rongwei.bscommon.sys.service.ZhcxSeaBindProofDetalService;
 import com.rongwei.bscommon.sys.service.ZhcxSeaBindProofService;
@@ -61,7 +64,7 @@ public class ZhcxSeaBindProofServiceImpl extends ServiceImpl<ZhcxSeaBindProofDao
          throw new CustomException("参数异常,请联系管理员排查");
      }
 
-     // 获取模板文件
+     // 获取模板文件1
      SysFileItemDo templateFile = sysFileItemService.getById("351d7b0c79034a25882415ae4332d0c3");
 
      if (!excelUtils.GetLicense()) {
@@ -374,4 +377,35 @@ public class ZhcxSeaBindProofServiceImpl extends ServiceImpl<ZhcxSeaBindProofDao
         }
     }
 
+    @Override
+    public void previewPdf(HttpServletResponse response, String id) {
+        // 通过 id 获取 SysFileItemDo 对象
+        SysFileItemDo templateFile = sysFileItemService.getById(id);
+
+        // 获取 PDF 文件的路径
+        String filePath = templateFile.getFullpath();
+
+        // 设置响应头,告诉浏览器这是一个 PDF 文件,并且以预览方式显示
+        response.setContentType("application/pdf");
+        response.setHeader("Content-Disposition", "inline; filename=\"" + new File(filePath).getName() + "\"");
+
+        // 读取 PDF 文件并将其输出到响应流
+        try (FileInputStream pdfInputStream = new FileInputStream(filePath);
+             OutputStream outputStream = response.getOutputStream()) {
+            // 使用 iText 读取 PDF 文件
+            PdfReader pdfReader = new PdfReader(pdfInputStream);
+            PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream);
+
+            // 不做任何修改,直接将文件输出到响应流
+            pdfStamper.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            // 这里可以处理异常,例如返回一个错误信息
+        } catch (DocumentException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+
 }

+ 20 - 0
business-common/src/main/resources/mybatis/business/ZhcxPmqManagementDistributionDetailDao.xml

@@ -101,4 +101,24 @@ ORDER BY
                    END AS CLOSESTATUS
         FROM DUAL;
     </select>
+    <select id="getDataByTime" resultType="com.rongwei.bsentity.vo.pmq.ZhcxPmqManagementDistributionDetailVo">
+        SELECT
+            x.MACHINENO,
+            x.PROJECTNO,
+            x.PROJECTNAME,
+            x.CONFIRMER,
+            x.ESTIMATEDCLOSEDATA,
+            IFNULL(x.STATUS, '未关闭') AS STATUS,
+            x.SERIALNUMBER,
+            x.SUPPLEMENT,
+            r.DISTRIBUTETIME,
+            r.DEPTID,
+            r.DEPTNAME
+        FROM
+            INCONTROL.ZHCX_PMQ_MANAGEMENT_DISTRIBUTION x
+                LEFT JOIN INCONTROL.ZHCX_PMQ_MANAGEMENT_RECORED r ON r.ID = x.PID AND r.DELETED = '0'
+        WHERE
+            x.DELETED = '0' AND TRUNC(r.DISTRIBUTETIME) = TO_DATE(#{data}, 'YYYY-MM-DD')
+        ORDER BY r.DISTRIBUTETIME
+    </select>
 </mapper>

+ 77 - 0
business-entity/src/main/java/com/rongwei/bsentity/vo/pmq/ZhcxPmqManagementDistributionDetailVo.java

@@ -0,0 +1,77 @@
+package com.rongwei.bsentity.vo.pmq;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ZhcxPmqManagementDistributionDetailVo {
+
+    /**
+     * 机号
+     */
+    @TableField("MACHINENO")
+    private String machineno;
+
+    /**
+     * 项目工号
+     */
+    @TableField("PROJECTNO")
+    private String projectno;
+
+    /**
+     * 项目名称
+     */
+    @TableField("PROJECTNAME")
+    private String projectname;
+
+    /**
+     * 质检确认人
+     */
+    @TableField("CONFIRMER")
+    private String confirmer;
+
+    /**
+     * 预计关闭日期
+     */
+    @TableField("ESTIMATEDCLOSEDATA")
+    private Date estimatedclosedata;
+
+    /**
+     * 状态
+     */
+    @TableField("STATUS")
+    private String status;
+
+    /**
+     * 流水号
+     */
+    @TableField("SERIALNUMBER")
+    private String serialnumber;
+
+    /**
+     * 补充项
+     */
+    @TableField("SUPPLEMENT")
+    private String supplement;
+
+    /**
+     * 下发时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("DISTRIBUTETIME")
+    private Date distributetime;
+
+    /**
+     * 部门ID
+     */
+    @TableField("DEPTID")
+    private String deptid;
+    /**
+     * 部门
+     */
+    @TableField("DEPTNAME")
+    private String deptname;
+}

+ 15 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxPmqManagementController.java

@@ -98,5 +98,20 @@ public class ZhcxPmqManagementController {
             return R.error("三单执行页面改派异常");
         }
     }
+
+    @PostMapping("/getData")
+    @ApiOperation("三单页面数据回传")
+    public R getData(@RequestBody Map<String,Object> map){
+        try {
+            if(Objects.isNull(map.get("data"))){
+                return R.error("日期不能为空");
+            }
+            log.info("三单页面数据回传->接收的日期是:{}",map.get("data"));
+            return distributionDetailService.getDataByTime((String)map.get("data"));
+        } catch (Exception e) {
+            log.info(String.valueOf(e));
+            return R.error("三单页面数据回传异常");
+        }
+    }
 }
 

+ 8 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxSeaBindProofController.java

@@ -49,7 +49,15 @@ public class ZhcxSeaBindProofController {
     }
 
 
+    @RequestMapping("/previewPdf/{id}")
+    public void previewPdf(HttpServletResponse response,@PathVariable("id") String id) {
+        try {
 
+            zhcxSeaBindProofService.previewPdf(response,id);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }