Jelajahi Sumber

履职登记簿格式调整

zhulu 1 tahun lalu
induk
melakukan
66221846d7

+ 63 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/vo/QuestionPdfVo.java

@@ -0,0 +1,63 @@
+package com.xunmei.system.api.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+
+public class QuestionPdfVo  {
+    private Long id;
+
+    /** 隐患所属机构 */
+    private Long orgId;
+
+    /** 隐患所属机构名称 */
+    @ApiModelProperty(value = "隐患所属机构名称")
+    private String orgName;
+
+    /** 隐患所属机构path */
+    private String orgPath;
+
+    /** 来源,1:履职,2:安全检查 */
+    private Long srcType;
+
+    /** 来源任务id */
+    private Long srcTaskId;
+
+    /** 来源任务名称 */
+    @ApiModelProperty(value = "来源任务名称")
+    private String srcTaskName;
+
+    /** 检查内容 */
+    @ApiModelProperty(value = "检查内容")
+    private String checkContent;
+
+    /** 隐患描述 */
+    @ApiModelProperty(value = "隐患描述")
+    private String questionDesc;
+
+    /** 提出人id */
+    private Long submitorId;
+
+    /** 提出人名称 */
+    @ApiModelProperty(value = "提出人名称")
+    private String submitorName;
+
+    /** 发现时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "发现时间")
+    private Date submitTime;
+
+    /** 确认状态。0未确认,1提出异议,2已确认,3已关闭 */
+    @ApiModelProperty(value = "确认状态。0未确认,1提出异议,2已确认,3已关闭")
+    private Long confirmStatus;
+
+    /** 整改状态。5未整改,6已整改 */
+    @ApiModelProperty(value = "整改状态。5未整改,6已整改")
+    private Long reformStatus;
+
+}

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/question/service/IQuestionService.java

@@ -82,4 +82,6 @@ public interface IQuestionService extends IService<Question> {
 
     WebPanelResult selectWebIndexData(PanelListDto req);
     WebPanelResult selectWebIndexData2(PanelListDto req);
+
+    List<Question> selectQuestionByTaskIds(List<Long> taskIds);
 }

+ 7 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/question/service/impl/QuestionServiceImpl.java

@@ -363,6 +363,13 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 .nums(waitRectification).build();
     }
 
+    @Override
+    public List<Question> selectQuestionByTaskIds(List<Long> taskIds) {
+        LambdaQueryWrapper<Question> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(Question::getSrcTaskId,taskIds);
+        return baseMapper.selectList(wrapper);
+    }
+
     /**
      * 当前用户的工作台。有所属机构+有整改权限的待整改、所属机构+有确认权限的待确认、异议提出人+异议状态的异议审批
      *

+ 5 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ApiPlanController.java

@@ -227,5 +227,10 @@ public class ApiPlanController {
 
     }
 
+    @ApiOperation(value = "生成履职登记簿")
+    @GetMapping(value = "/buildResumptionPdf/{orgId}")
+    AjaxResult buildResumptionPdf(@PathVariable("orgId") Long orgId) {
+        return appPlanService.buildResumptionPdf(orgId);
+    }
 
 }

+ 28 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -29,6 +29,7 @@ import com.xunmei.common.core.utils.IDHelper;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.question.QuestionSrcType;
+import com.xunmei.core.question.domain.Question;
 import com.xunmei.core.question.service.IQuestionService;
 import com.xunmei.core.registerbook.service.ICoreRegisterBookPdfService;
 import com.xunmei.core.resumption.domain.*;
@@ -52,6 +53,7 @@ import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.ResumptionPdf;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
+import com.xunmei.system.api.vo.QuestionPdfVo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -1056,7 +1058,9 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         Map<String, Object> data = new HashMap<>();
         //获取前一天
 //        Date date = DateUtils.addDays(new Date(), 0);
-        Date date = new Date();
+//        Date date = DateUtil.date().setField(DateField.DAY_OF_MONTH,26);//new Date(123,12,26);
+        Date date =new Date();
+
         //获取营业前的所有履职信息
         List<Resumption> before = resumptionMapper.selectByYmdDateAndExec(date, 2, orgId);
         //获取营业期间的所有履职信息
@@ -1074,6 +1078,29 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         data.put("营业前", getResult(bef));
         data.put("营业期间", getResult(ingf));
         data.put("营业终了", getResult(afterf));
+        // 提交人
+
+        List<String> submiterNames= before.stream().map(x->x.getSubmitorName()).collect(Collectors.toList());
+        submiterNames.addAll(ing.stream().map(x->x.getSubmitorName()).collect(Collectors.toList()));
+        submiterNames.addAll(after.stream().map(x->x.getSubmitorName()).collect(Collectors.toList()));
+        submiterNames=submiterNames.stream().distinct().collect(Collectors.toList());
+        data.put("submiterNames", String.join(",",submiterNames));
+        // 获取任务相关问题
+        List<QuestionPdfVo> questionPdfVos=new ArrayList<>();
+        List<Long> taskIds= before.stream().map(x->x.getId()).collect(Collectors.toList());
+        taskIds.addAll(ing.stream().map(x->x.getId()).collect(Collectors.toList()));
+        taskIds.addAll(after.stream().map(x->x.getId()).collect(Collectors.toList()));
+       if(ObjectUtil.isNotEmpty(taskIds)){
+           List<Question> questions = questionService.selectQuestionByTaskIds(taskIds);
+
+           questions.forEach(x->{
+               QuestionPdfVo questionPdfVo =new QuestionPdfVo();
+               BeanUtils.copyProperties(x, questionPdfVo);
+               questionPdfVos.add(questionPdfVo);
+           });
+       }
+
+        data.put("questions", questionPdfVos);
         return data;
     }
 

+ 7 - 6
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java

@@ -222,11 +222,11 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         p.setSpacingAfter(10f);
         document.add(p);
         //日期
-        String blankStr1 = "             ";
-        String blankStr2 = "                         ";
-        Paragraph p2 = new Paragraph(dataMap.get("orgName") + blankStr1 + dataMap.get("dateStr") + blankStr2, new Font(abf, 10, Font.NORMAL));
-        p2.setAlignment(Paragraph.ALIGN_RIGHT);
-        document.add(p2);
+//        String blankStr1 = "             ";
+//        String blankStr2 = "                         ";
+//        Paragraph p2 = new Paragraph(dataMap.get("orgName") + blankStr1 + dataMap.get("dateStr") + blankStr2, new Font(abf, 10, Font.NORMAL));
+//        p2.setAlignment(Paragraph.ALIGN_RIGHT);
+//        document.add(p2);
     }
 
     @Override
@@ -270,8 +270,9 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         // 外部字体
         BaseFont fs = BaseFont.createFont("/fonts/msyh.ttc,1", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
         Font tableFont = new Font(fs, 12, Font.NORMAL);
-        PdfPTable table = new PdfPTable(8);
+        PdfPTable table = new PdfPTable(10);
         table.setSpacingBefore(16f);
+        table.setWidthPercentage(95L);
         this.dealHeader(data, document, abf, fs);
         PdfUtil.dealResumptionBody(document, table, tableFont, data);
         document.close();

+ 50 - 12
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -10,6 +10,7 @@ import com.xunmei.file.vo.ItextPdfTableVo;
 import com.xunmei.system.api.domain.AccessDataVo;
 import com.xunmei.system.api.domain.CheckDataVo;
 import com.xunmei.system.api.domain.SafeCheckTaskRegisterBookVo;
+import com.xunmei.system.api.vo.QuestionPdfVo;
 import io.netty.util.internal.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
@@ -200,9 +201,24 @@ public class PdfUtil {
 
 
     public static void dealResumptionBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
-        PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_CENTER, 6, 0);
-        PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_CENTER, 0, 0);
-        PdfUtil.createPDFCell(tableFont, table, "登记人", Element.ALIGN_CENTER, 0, 0);
+        // 第一行
+        PdfUtil.createPDFCell(tableFont, table, "单位名称", Element.ALIGN_MIDDLE, 2, 0);
+        PdfUtil.createPDFCell(tableFont, table, data.get("orgName").toString(), Element.ALIGN_MIDDLE, 3, 0);
+        PdfUtil.createPDFCell(tableFont, table, "检查时间", Element.ALIGN_MIDDLE, 2, 0);
+        PdfUtil.createPDFCell(tableFont, table, data.get("dateStr").toString(), Element.ALIGN_MIDDLE, 3, 0);
+        // 第二行
+        PdfUtil.createPDFCell(tableFont, table, "检查人", Element.ALIGN_MIDDLE, 2, 0);
+        PdfUtil.createPDFCell(tableFont, table, data.get("submiterNames").toString(), Element.ALIGN_MIDDLE, 8, 0);
+        // 第三行
+        PdfUtil.createPDFCell(tableFont, table, "检查时间", Element.ALIGN_MIDDLE, 2, 0);
+        PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_MIDDLE, 6, 0);
+        PdfUtil.createPDFCell(tableFont, table,"检查情况", Element.ALIGN_MIDDLE, 2, 0);
+
+
+//        PdfUtil.createPDFCell(tableFont, table, "检查时间", Element.ALIGN_CENTER, 1, 0);
+//        PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_CENTER, 5, 0);
+//        PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_CENTER, 0, 0);
+//        PdfUtil.createPDFCell(tableFont, table, "登记人", Element.ALIGN_CENTER, 0, 0);
 
         List<String> names = new ArrayList<>();
         names.add("营业前");
@@ -216,31 +232,53 @@ public class PdfUtil {
                 continue;
             }
             //不同的执行时刻
-            PdfUtil.createPDFCell(tableFont, table, getLineStr(s), PdfPCell.ALIGN_MIDDLE, 0, lists.size());
+            PdfUtil.createPDFCell(tableFont, table, getLineStr(s), PdfPCell.ALIGN_MIDDLE, 2, lists.size());
             int o = 1;
             for (LinkedHashMap<String, Object> listVo : lists) {
                 // 检查内容
                 String rowContent = o + "、" + listVo.get("pointName");
-                PdfUtil.createPDFCell(tableFont, table, rowContent, Element.ALIGN_LEFT, 5, 0);
+                PdfUtil.createPDFCell(tableFont, table, rowContent, Element.ALIGN_LEFT, 6, 0);
                 // 检查情况
-                PdfUtil.createPDFCell(tableFont, table, ((Integer) listVo.get("resValue")) == 0 ? "√" : "×", Element.ALIGN_CENTER, 0, 0);
+                PdfUtil.createPDFCell(tableFont, table, ((Integer) listVo.get("resValue")) == 0 ? "正常" : "异常", Element.ALIGN_MIDDLE, 2, 0);
                 // 检查人
-                PdfUtil.createPDFCell(tableFont, table, String.valueOf(listVo.get("submitName")), Element.ALIGN_CENTER, 0, 0);
+                //PdfUtil.createPDFCell(tableFont, table, String.valueOf(listVo.get("submitName")), Element.ALIGN_CENTER, 0, 0);
                 o++;
             }
         }
 
+        PdfUtil.createPDFCell(tableFont, table, "发现问题情况", Element.ALIGN_MIDDLE, 10, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "序号", Element.ALIGN_MIDDLE, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "检查项目", Element.ALIGN_MIDDLE, 4, 1);
+        PdfUtil.createPDFCell(tableFont, table, "存在问题", Element.ALIGN_MIDDLE, 4, 1);
+
+        final List<LinkedHashMap> questionPdfVoList =  (List<LinkedHashMap>)data.get("questions");
+        if (ObjectUtil.isEmpty(questionPdfVoList)) {
+            PdfUtil.createPDFCell(tableFont, table, "1", Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_LEFT, 4, 1);
+            PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 4, 1);
+            document.add(table);
+            return;
+        }
+        int questionIndex=1;
+        for (int i = 0; i < questionPdfVoList.size(); i++) {
+
+            PdfUtil.createPDFCell(tableFont, table, String.valueOf(questionIndex++), Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, String.valueOf(questionPdfVoList.get(i).get("checkContent")), Element.ALIGN_MIDDLE, 4, 1);
+            PdfUtil.createPDFCell(tableFont, table, String.valueOf(questionPdfVoList.get(i).get("questionDesc")), Element.ALIGN_MIDDLE, 4, 1);
+        }
+
         // 备注数据
-        PdfUtil.createPDFCell(tableFont, table, getLineStr("备注"), PdfPCell.ALIGN_MIDDLE, 0, 0);
-        PdfUtil.createPDFCell(tableFont, table, data.get("remark").toString(), Element.ALIGN_LEFT, 7, 0);
+//        PdfUtil.createPDFCell(tableFont, table, getLineStr("备注"), PdfPCell.ALIGN_MIDDLE, 0, 0);
+//        PdfUtil.createPDFCell(tableFont, table, data.get("remark").toString(), Element.ALIGN_LEFT, 7, 0);
 
         document.add(table);
 
-        Paragraph foot = new Paragraph("                  注:检查情况正常打“√”;发现问题打“×”,并在备注中具体说明。", tableFont);
+//        Paragraph foot = new Paragraph("                  注:检查情况正常打“√”;发现问题打“×”,并在备注中具体说明。", tableFont);
 //        Paragraph foot = new Paragraph("                  注:检查情况正常打“√”;发现问题打“×”,并在备注中具体说明。", new Font(fs, 8, Font.NORMAL));
-        foot.setAlignment(Paragraph.ALIGN_LEFT);
+//        foot.setAlignment(Paragraph.ALIGN_LEFT);
         //在后方加入16个空格
-        document.add(foot);
+//        document.add(foot);
 
 
     }