소스 검색

Merge branch 'V0.0.7' of http://10.87.21.221:8000/jzyd_yyds/soc into V0.0.7

zhulu 1 년 전
부모
커밋
f547372c0a

+ 25 - 0
project_data/sql/0.0.7/soc/soc.sql

@@ -111,6 +111,31 @@ CREATE PROCEDURE schema_change () BEGIN
     END IF;
 
 
+    -- 监控调阅任务表增加pdfUrl字段
+    IF NOT EXISTS (
+            SELECT * FROM INFORMATION_SCHEMA.COLUMNS
+            WHERE table_schema = DATABASE ()
+              AND TABLE_NAME = 'core_monitoring_retrieval_task'
+              AND COLUMN_NAME = 'pdf_url' )
+    THEN
+        alter table core_monitoring_retrieval_task
+            add pdf_url varchar(125) null comment '登记簿url';
+    END IF;
+
+    -- 监控调阅任务表增加签名图片字段
+    IF NOT EXISTS (
+            SELECT * FROM INFORMATION_SCHEMA.COLUMNS
+            WHERE table_schema = DATABASE ()
+              AND TABLE_NAME = 'core_monitoring_retrieval_task'
+              AND COLUMN_NAME = 'sign_img' )
+    THEN
+        alter table core_monitoring_retrieval_task
+            add sign_img varchar(125) null comment '签名图片地址';
+    END IF;
+
+
+
+
 END ??
 DELIMITER ;
 CALL schema_change ();

+ 1 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/AccessDataVo.java

@@ -23,4 +23,5 @@ public class AccessDataVo {
     private Integer status;
     private String abnormalIllustrate;
     private String areaName;
+    private String signImg;
 }

+ 2 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/AccessPdf.java

@@ -6,7 +6,6 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -36,5 +35,7 @@ public class AccessPdf {
     private String taskStartTime;
     @ApiModelProperty(value = "调阅人")
     private String checkUser;
+
+    private String signImg;
     private List<AccessDataVo>dataVos;
 }

+ 23 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.constant.DictConstants;
 import com.xunmei.common.core.constant.ErrorMsgConstants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan;
@@ -24,6 +25,7 @@ import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.redis.utils.RedisUtils;
+import com.xunmei.common.security.utils.DictUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.access.domain.TMonitoringRetrievalPlan;
 import com.xunmei.core.access.domain.TMonitoringRetrievalPlanToExecOrg;
@@ -44,6 +46,7 @@ import com.xunmei.system.api.RemoteRoleService;
 import com.xunmei.system.api.RemoteUserService;
 import com.xunmei.system.api.domain.*;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
+import io.netty.util.internal.StringUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -1573,7 +1576,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         if (StringUtils.isEmpty(url) || StringUtils.isEmpty(registerBookPdf.getFileName())) {
             throw new SystemException(ErrorMsgConstants.GENERATE_PDF_ERROR);
         }
-        registerBookPdfService.save(registerBookPdf);
+        registerBookPdfService.saveOrUpdate(registerBookPdf);
         CoreMonitoringRetrievalTask tem = new CoreMonitoringRetrievalTask();
         tem.setId(accessPdfVO.getTaskId());
         tem.setPdfUrl(url);
@@ -1582,6 +1585,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     }
 
     public AccessPdf buildSafetyCheckRegisterBookData(AccessPdfVO accessPdfVO) {
+        String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
+        String staticsPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
         AccessPdf accessPdf = new AccessPdf();
         accessPdf.setTaskTitle("标题");
         final SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
@@ -1599,22 +1604,29 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         accessPdf.setCheckUser(accessPdfVO.getCheckUser());
         accessPdf.setOrgId(accessPdfVO.getOrgId());
         accessPdf.setOrgName(accessPdfVO.getOrgName());
-        List<AccessDataVo> dataVos = new ArrayList<>();
+
         List<AccessDataVo> accessDataVos = baseMapper.selectPointByTask(accessPdfVO.getTaskId());
         for (AccessDataVo vo : accessDataVos) {
-            AccessDataVo v = new AccessDataVo();
-            v.setHostName(vo.getHostName());
-            v.setVideoChannelName(vo.getVideoChannelName());
-            v.setProject(vo.getProject());
-            v.setSituation(vo.getSituation());
-            v.setAreaName(vo.getAreaName());
-            v.setAbnormalIllustrate(vo.getAbnormalIllustrate());
-            dataVos.add(v);
+            vo.setProject(DictUtils.getDictLabel(DictConstants.CORE_REGISTRATION_PROJECT, Integer.parseInt(vo.getProject())));
         }
-        accessPdf.setDataVos(dataVos);
+        accessPdf.setDataVos(accessDataVos);
+        accessPdf.setSignImg(getFileRealPath(accessDataVos.get(0).getSignImg(), prefixPath, staticsPath));
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> remoteOrgService.selectOrgById(accessPdfVO.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
         String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.MONITOR_ACCESS, sysOrg);
         accessPdf.setDest(fileName);
         return accessPdf;
     }
+
+    private String getFileRealPath(String filePath, String prefixPath, String staticsPath) {
+
+        if (ObjectUtil.isEmpty(filePath)) {
+            return StringUtil.EMPTY_STRING;
+        }
+
+        if (filePath.contains(staticsPath)) {
+            //删除 /statics 前缀路径
+            filePath = filePath.replace(staticsPath, StringUtil.EMPTY_STRING);
+        }
+        return prefixPath + filePath;
+    }
 }

+ 5 - 11
soc-modules/soc-modules-core/src/main/resources/mapper/access/TMonitoringRetrievalPlanMapper.xml

@@ -128,25 +128,19 @@
     </select>
     <select id="selectPointByTask" resultType="com.xunmei.system.api.domain.AccessDataVo">
         SELECT
-            e.device_name AS hostName,
-            d.device_name AS videoChannelName,
-            f.dict_label AS project,
+            ifnull(rt.sign_img,'') as signImg,
             c.situation as status,
             b.area_name as areaName,
+            c.project,
             IF
                 ( c.situation = 0, '正常', '异常' ) AS situation,
             c.abnormal_illustrate AS abnormalIllustrate
-        FROM
-            core_monitoring_task_registration a
-                LEFT JOIN core_monitoring_task_registration_monitor b ON a.id = b.task_registration_id
+        FROM core_monitoring_retrieval_task rt inner join core_monitoring_task_registration tr on rt.id=tr.task_id
+                LEFT JOIN core_monitoring_task_registration_monitor b ON tr.id = b.task_registration_id
                 LEFT JOIN core_monitoring_task_monitor_info c ON c.task_monitor_id = b.id
-                LEFT JOIN sys_device d ON b.video_channel = d.id
-                LEFT JOIN sys_device e ON e.id = d.host_id
-                LEFT JOIN sys_dict_data f ON f.dict_value = c.project
-                AND f.dict_type = 'core_registration_project'
         WHERE
             c.project IS NOT NULL
-          AND a.task_id = #{taskId}
+          AND rt.id = #{taskId}
     </select>
     <select id="selectTask" resultType="com.xunmei.core.access.vo.AccessPdfVO">
         SELECT

+ 4 - 1
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java

@@ -67,6 +67,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import static com.xunmei.file.utils.PdfUtil.dealImageCell;
 import static java.util.regex.Pattern.compile;
 
 /**
@@ -334,7 +335,9 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         PdfUtil.createPDFCell(titleFont, table, checkTime, Element.ALIGN_MIDDLE, 15, 1);
 
         PdfUtil.createPDFCell(titleFont, table, "调阅人签字", Element.ALIGN_MIDDLE, 4, 1);
-        PdfUtil.createPDFCell(titleFont, table, checkTime, Element.ALIGN_MIDDLE, 15, 1);
+        List<String> list = new ArrayList<>();
+        list.add(data.getSignImg());
+        dealImageCell(list, table, 1, 70, 40,15,1);
 
         PdfUtil.createPDFCell(titleFont, table, "监控调阅情况", Element.ALIGN_MIDDLE, 19, 1);
 

+ 23 - 26
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -155,19 +155,6 @@ public class PdfUtil {
         document.add(p);
     }
 
-    public static void dealEduHeader(PdfPTable table, BaseFont fs, String title, int fontSize) {
-        //文件title
-        PdfPCell pdfPCell = new PdfPCell();
-        final Paragraph p = new Paragraph(new Chunk(title, new Font(fs, fontSize)));
-        p.setAlignment(Paragraph.ALIGN_CENTER);
-        // 文件title 段落下空白
-        p.setSpacingAfter(10f);
-        pdfPCell.setColspan(6);
-        pdfPCell.addElement(p);
-        pdfPCell.setBorder(Rectangle.BOTTOM);
-        table.addCell(pdfPCell);
-    }
-
     public static void dealEduBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
         //第一行
         createPDFCell(tableFont, table, "时间", Element.ALIGN_MIDDLE, 1, 1);
@@ -423,24 +410,34 @@ public class PdfUtil {
         }
     }
 
-    public static void dealDrillImageCell(List<String> imageList, PdfPTable table) throws Exception {
+    public static void dealEduImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh) throws Exception {
         //签字区域
         PdfPCell outCell = new PdfPCell();
-        outCell.setColspan(5);
-        outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-        final int imageAddNums = imageList.size() % 3;
+        outCell.setNoWrap(false);
+        outCell.setColspan(6);
+        //  outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+        final int imageAddNums = imageList.size() % imageNumsOfRow;
         if (imageAddNums != 0) {
-            for (int i = 0; i < 3 - imageAddNums; i++) {
+            for (int i = 0; i < imageNumsOfRow - imageAddNums; i++) {
                 imageList.add("black.png");
             }
         }
-        PdfPTable imageInnerTable = new PdfPTable(3);
+        PdfPTable imageInnerTable = new PdfPTable(imageNumsOfRow);
+        imageInnerTable.setSplitRows(true);
+        imageInnerTable.setSplitLate(false);
+        imageInnerTable.setWidthPercentage(100F);
         for (String image : imageList) {
             Image imageData = convertFileToByteArray(new File(image));
             if (imageData != null) {
-                imageData.scaleAbsolute(120, 120);
+                imageData.scaleAbsolute(imageWith, imageHigh);
             }
             PdfPCell innerCell = new PdfPCell(imageData);
+            innerCell.setNoWrap(false);
+            innerCell.setPaddingTop(8f);
+            innerCell.setPaddingLeft(8f);
+            innerCell.setPaddingRight(8f);
+            innerCell.setPaddingBottom(8f);
+
             innerCell.setBorder(Rectangle.NO_BORDER);
             innerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
             innerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
@@ -450,12 +447,12 @@ public class PdfUtil {
         table.addCell(outCell);
     }
 
-    public static void dealEduImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh) throws Exception {
+    public static void dealImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh,Integer cosSpan,Integer rowSpan) throws Exception {
         //签字区域
         PdfPCell outCell = new PdfPCell();
         outCell.setNoWrap(false);
-        outCell.setColspan(6);
-        //  outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+        outCell.setColspan(cosSpan);
+        outCell.setRowspan(rowSpan);
         final int imageAddNums = imageList.size() % imageNumsOfRow;
         if (imageAddNums != 0) {
             for (int i = 0; i < imageNumsOfRow - imageAddNums; i++) {
@@ -568,7 +565,7 @@ public class PdfUtil {
         List<AccessDataVo> normalDataList = data.stream().filter(d -> ObjectUtil.equal(0, d.getStatus())).collect(Collectors.toList());
         if (ObjectUtil.isNotEmpty(normalDataList)) {
             for (int i = 1; i <= normalDataList.size(); i++) {
-                AccessDataVo accessDataVo = data.get(i - 1);
+                AccessDataVo accessDataVo = normalDataList.get(i - 1);
                 PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 1);
                 PdfUtil.createPDFCell(tableFont, table, accessDataVo.getAreaName(), Element.ALIGN_MIDDLE, 6, 1);
                 PdfUtil.createPDFCell(tableFont, table, accessDataVo.getProject(), Element.ALIGN_MIDDLE, 5, 1);
@@ -588,10 +585,10 @@ public class PdfUtil {
         PdfUtil.createPDFCell(tableTitleFont, table, "调阅项目", Element.ALIGN_MIDDLE, 5, 1);
         PdfUtil.createPDFCell(tableTitleFont, table, "存在问题", Element.ALIGN_MIDDLE, 6, 1);
 
-        List<AccessDataVo> exceptionDataList = data.stream().filter(d -> ObjectUtil.equal(0, d.getStatus())).collect(Collectors.toList());
+        List<AccessDataVo> exceptionDataList = data.stream().filter(d -> ObjectUtil.equal(1, d.getStatus())).collect(Collectors.toList());
         if (ObjectUtil.isNotEmpty(exceptionDataList)) {
             for (int i = 1; i <= exceptionDataList.size(); i++) {
-                AccessDataVo accessDataVo = data.get(i - 1);
+                AccessDataVo accessDataVo = exceptionDataList.get(i - 1);
                 PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 1);
                 PdfUtil.createPDFCell(tableFont, table, accessDataVo.getAreaName(), Element.ALIGN_MIDDLE, 6, 1);
                 PdfUtil.createPDFCell(tableFont, table, accessDataVo.getProject(), Element.ALIGN_MIDDLE, 5, 1);