Sfoglia il codice sorgente

安全检查pdf增加签名图片,样式调整等

jingyuanchao 1 anno fa
parent
commit
2ab1bcf850

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

@@ -88,6 +88,14 @@ CREATE PROCEDURE schema_change () BEGIN
                 COMMENT = '出入申请表';
     END IF;
 
+	-- 安全检查增加签名图片字段
+    IF NOT EXISTS (
+                SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_task' AND COLUMN_NAME = 'sign_img' ) THEN
+        alter table core_safety_task add sign_img varchar(125) null comment '签名图片';
+    END IF;
+
+
+
 END ??
 DELIMITER ;
 CALL schema_change ();

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

@@ -1,6 +1,5 @@
 package com.xunmei.system.api.domain;
 
-import com.xunmei.system.api.domain.CheckDataVo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -53,5 +52,7 @@ public class SafeCheckTaskRegisterBookVo {
 
   private String fileName;
 
+  private String signImg;
+
 
 }

+ 13 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/domain/CoreSafetyTask.java

@@ -1,26 +1,22 @@
 package com.xunmei.core.safetyCheck.domain;
 
-import java.util.Date;
-import java.util.List;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.xunmei.common.core.web.domain.BaseEntity;
 import com.xunmei.core.safetyCheck.vo.plan.SafetyPlanRoleVo;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.xunmei.common.core.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * 【请填写功能名称】对象 core_safety_task
@@ -284,6 +280,12 @@ public class CoreSafetyTask extends BaseEntity {
     @ApiModelProperty(value = "任务的执行角色")
     private List<SafetyPlanRoleVo> roles;
 
+
+    @TableField(value = "sign_img")
+    private String signImg;
+
+
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 28 - 10
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/CoreSafecheckPlanServiceImpl.java

@@ -296,7 +296,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
         }
 
         if (immediateEffect) {
-            safetyCheckJobBusiness.createTaskByPlans(hsPlans,dto.getId());
+            safetyCheckJobBusiness.createTaskByPlans(hsPlans, dto.getId());
         }
     }
 
@@ -370,7 +370,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
         }
 
         if (ObjectUtil.isNotEmpty(newlist)) {
-            safetyCheckJobBusiness.createTaskByPlans(newlist,id);
+            safetyCheckJobBusiness.createTaskByPlans(newlist, id);
         }
 
         return 1;
@@ -387,17 +387,18 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
             throw new ServiceException("已超过无周期任务的结束时间");
         }
     }
-    private void checkPlanIsCreatingTask(Long planId,String msg)
-    {
-        String redisKey="SafeCheck_Creating_Task" + planId;
+
+    private void checkPlanIsCreatingTask(Long planId, String msg) {
+        String redisKey = "SafeCheck_Creating_Task" + planId;
         Boolean hasKey = RedisUtils.hasKey(redisKey);
         if (hasKey) {
-            throw new ServiceException("该任务正在生成中,现在不能被"+msg+",请稍后再试。");
+            throw new ServiceException("该任务正在生成中,现在不能被" + msg + ",请稍后再试。");
         }
     }
+
     @Override
     public void cheHui(Long id) {
-        checkPlanIsCreatingTask(id,"撤回");
+        checkPlanIsCreatingTask(id, "撤回");
         Date now = new Date();
         CoreSafecheckPlan plan = baseMapper.selectById(id);
         if (ObjectUtil.equal(plan.getTaskHasCompleted(), 1)) {
@@ -864,7 +865,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
     @Override
     public int deleteCoreSafecheckPlanByIds(Long[] ids) {
         for (Long id : ids) {
-            checkPlanIsCreatingTask(id,"删除");
+            checkPlanIsCreatingTask(id, "删除");
             CoreSafecheckPlan plan = baseMapper.selectById(id);
             List<CoreSafecheckPlan> plans = baseMapper.selectList(new LambdaQueryWrapper<CoreSafecheckPlan>()
                     .in(CoreSafecheckPlan::getId, ids).or().in(CoreSafecheckPlan::getParentId, ids)
@@ -1014,7 +1015,11 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
     }
 
     public SafeCheckTaskRegisterBookVo buildSafetyCheckRegisterBookData(CoreSafetyTask appSafetyCheckTask) {
+        String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
+        String staticsPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
+
         SafeCheckTaskRegisterBookVo registerBookVo = new SafeCheckTaskRegisterBookVo();
+        registerBookVo.setSignImg(getFileRealPath(appSafetyCheckTask.getSignImg(), prefixPath, staticsPath));
         registerBookVo.setTaskTitle(appSafetyCheckTask.getTitle() /*+ getRegisterBookCycleText(Math.toIntExact(appSafetyCheckTask.getCheckCycle()), appSafetyCheckTask.getSubmitTime())*/);
         final SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
         String dateStr = format.format(appSafetyCheckTask.getSubmitTime());
@@ -1036,12 +1041,12 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
 
         List<CheckDataVo> pointCheckDataList = new ArrayList<>();
         List<AppTaskRegisterPointVo> appTaskRegisterPointVos = coreSafetyTaskMapper.selectPointByTask(appSafetyCheckTask.getId());
-        for (AppTaskRegisterPointVo vo :appTaskRegisterPointVos) {
+        for (AppTaskRegisterPointVo vo : appTaskRegisterPointVos) {
             CheckDataVo v = new CheckDataVo();
             v.setItemName(vo.getItemName());
             v.setPointName(vo.getPointName());
             v.setResRemark(vo.getRemark());
-            v.setCheckStatus(vo.getStatus()==0);
+            v.setCheckStatus(vo.getStatus() == 0);
             v.setRectificationDeadline(vo.getRectificationDeadline());
             pointCheckDataList.add(v);
         }
@@ -1053,6 +1058,19 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
         return registerBookVo;
     }
 
+    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;
+    }
+
     private String getRegisterBookCycleText(int cycle, Date checkDate) {
 
 

+ 8 - 6
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -585,7 +585,7 @@ public class PdfUtil {
 
     }
 
-    public static void dealSafeCheckPBody(Document document, PdfPTable table, Font tableFont, SafeCheckTaskRegisterBookVo data) throws DocumentException {
+    public static void dealSafeCheckPBody(Document document, PdfPTable table, Font tableFont, SafeCheckTaskRegisterBookVo data) throws Exception {
         PdfUtil.createPDFCell(tableFont, table, "被查单位", Element.ALIGN_MIDDLE, 3, 1);
         PdfUtil.createPDFCell(tableFont, table, data.getOrgName(), Element.ALIGN_MIDDLE, 4, 1);
         PdfUtil.createPDFCell(tableFont, table, "检查日期", Element.ALIGN_MIDDLE, 3, 1);
@@ -604,9 +604,11 @@ public class PdfUtil {
         PdfUtil.createPDFCell(tableFont, table, "主查人", Element.ALIGN_MIDDLE, 3, 1);
         PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_MIDDLE, 4, 1);
         PdfUtil.createPDFCell(tableFont, table, "主查人签字", Element.ALIGN_MIDDLE, 3, 1);
-        PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_MIDDLE, 4, 1);
-
+        List<String> list = new ArrayList<>();
+        list.add(data.getSignImg());
+        dealEduImageCell(list, table, 1, 70, 40);
 
+        PdfUtil.createPDFCell(tableFont, table, "检查工作情况", Element.ALIGN_MIDDLE, 14, 1);
 
         List<CheckDataVo> normalDataList = data.getCheckDatas().stream().filter(d -> ObjectUtil.equal(Boolean.TRUE, d.getCheckStatus())).collect(Collectors.toList());
         if (normalDataList.size()>0){
@@ -615,8 +617,8 @@ public class PdfUtil {
             PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_MIDDLE, 6, 1);
             for (CheckDataVo checkDataVo : normalDataList) {
                 PdfUtil.createPDFCell(tableFont, table, String.valueOf(normalDataList.indexOf(checkDataVo)+1), Element.ALIGN_MIDDLE, 2, 1);
-                PdfUtil.createPDFCell(tableFont, table, checkDataVo.getPointName(), Element.ALIGN_MIDDLE, 6, 1);
-                PdfUtil.createPDFCell(tableFont, table, "正常", Element.ALIGN_MIDDLE, 6, 1);
+                PdfUtil.createPDFCell(tableFont, table, checkDataVo.getPointName(), Element.ALIGN_MIDDLE, 10, 1);
+                PdfUtil.createPDFCell(tableFont, table, "正常", Element.ALIGN_MIDDLE, 2, 1);
             }
         }
 
@@ -630,7 +632,7 @@ public class PdfUtil {
         PdfUtil.createPDFCell(tableFont, table, "存在问题", Element.ALIGN_MIDDLE, 6, 1);
         final Optional<CheckDataVo> optional = data.getCheckDatas().stream().filter(res -> ObjectUtil.isNotEmpty(res.getResRemark())).findAny();
         if (!optional.isPresent()) {
-            PdfUtil.createPDFCell(tableFont, table, "1", Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 2, 1);
             PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 6, 1);
             PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 6, 1);
             document.add(table);