Jelajahi Sumber

隐患问题、整改情况导出excel字段值及数量不对

jiawuxian 1 tahun lalu
induk
melakukan
695cbd5286

+ 4 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/question/dto/QuestionExportDto.java

@@ -1,5 +1,6 @@
 package com.xunmei.core.question.dto;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.format.DateTimeFormat;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
@@ -80,6 +81,9 @@ public class QuestionExportDto {
     @DateTimeFormat("yyyy-MM-dd")
     private Date reformDeadline;
 
+    @ExcelIgnore
+    private Integer confirmStatus;
+
     /**
      * 确认状态
      */

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/question/mapper/QuestionMapper.java

@@ -85,14 +85,14 @@ public interface QuestionMapper extends BaseMapper<Question> {
      * @param param
      * @return
      */
-    List<QuestionExportDto> selectQuestionExportList(@Param("param")QuestionPageDto param);
+    List<QuestionExportDto> selectQuestionExportList(@Param("params")QuestionPageDto param,@Param("today") Date today);
 
     /**
      * 获取导出数据
      * @param param
      * @return
      */
-    List<QuestionExportDto> selectReformExportList(@Param("param") ReformPageDto param);
+    List<QuestionExportDto> selectReformExportList(@Param("params") ReformPageDto param,@Param("today") Date today);
 
     int saveQuestionExceptionData(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("orgIds") List<Long> orgIds);
 }

+ 15 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/question/service/impl/QuestionReformServiceImpl.java

@@ -114,8 +114,7 @@ public class QuestionReformServiceImpl extends ServiceImpl<QuestionMapper, Quest
         //获取数据
         page = baseMapper.pageReform(page, query, DateUtil.beginOfDay(new Date()));
         page.getRecords().forEach(r -> {
-            if (ObjectUtil.notEqual(r.getConfirmStatus(), QuestionConfirmEnum.Closed.getValue()) &&
-                    r.getReformDeadline().before(DateUtil.beginOfDay(new Date()))) {
+            if (isOverdue(r.getConfirmStatus(),r.getReformDeadline())) {
                 //任务未结束并且过了整改结束日期
                 r.setOverdueStatus(QuestionReformEnum.OverDue.getValue());
             }
@@ -125,6 +124,15 @@ public class QuestionReformServiceImpl extends ServiceImpl<QuestionMapper, Quest
         return TableDataInfo.build(page);
     }
 
+    private boolean isOverdue(Integer confirmStatus,Date reformDeadLine){
+        if (ObjectUtil.notEqual(confirmStatus, QuestionConfirmEnum.Closed.getValue()) &&
+                reformDeadLine.before(DateUtil.beginOfDay(new Date()))) {
+            //任务未结束并且过了整改结束日期
+            return true;
+        }else{
+            return  false;
+        }
+    }
 
     /**
      * 整改
@@ -188,10 +196,14 @@ public class QuestionReformServiceImpl extends ServiceImpl<QuestionMapper, Quest
             pageDto.setReformRange(nd);
         }
 
-        List<QuestionExportDto> list = baseMapper.selectReformExportList(pageDto);
+        List<QuestionExportDto> list = baseMapper.selectReformExportList(pageDto, DateUtil.beginOfDay(new Date()));
         Integer index = 1;
         for (QuestionExportDto questionExportDto : list) {
             questionExportDto.setIndex(index++);
+            if (isOverdue(questionExportDto.getConfirmStatus(),questionExportDto.getReformDeadline())) {
+                //任务未结束并且过了整改结束日期
+                questionExportDto.setReformStatusText("已逾期");
+            }
         }
         response.setContentType("application/vnd.ms-excel");
         // 调用EasyExcel的导出方法

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

@@ -141,8 +141,12 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     }
 
     private boolean isOverdue(Question q){
-        if (ObjectUtil.notEqual(q.getConfirmStatus(), QuestionConfirmEnum.Closed.getValue()) &&
-                q.getReformDeadline().before(DateUtil.beginOfDay(new Date()))) {
+        return isOverdue(q.getConfirmStatus(),q.getReformDeadline());
+    }
+
+    private boolean isOverdue(Integer confirmStatus,Date reformDeadLine){
+        if (ObjectUtil.notEqual(confirmStatus, QuestionConfirmEnum.Closed.getValue()) &&
+                reformDeadLine.before(DateUtil.beginOfDay(new Date()))) {
             //任务未结束并且过了整改结束日期
             return true;
         }else{
@@ -306,9 +310,12 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             nd[1] = DateUtil.endOfDay(pageDto.getSubmitRange()[1]);
             pageDto.setSubmitRange(nd);
         }
-        List<QuestionExportDto> list = baseMapper.selectQuestionExportList(pageDto);
+        List<QuestionExportDto> list = baseMapper.selectQuestionExportList(pageDto, DateUtil.beginOfDay(new Date()));
         Integer index = 1;
         for (QuestionExportDto questionExportDto : list) {
+            if(isOverdue(questionExportDto.getConfirmStatus(),questionExportDto.getReformDeadline())){
+                questionExportDto.setConfirmStatusText("已逾期");
+            }
             questionExportDto.setIndex(index++);
         }
         response.setContentType("application/vnd.ms-excel");

+ 39 - 32
soc-modules/soc-modules-core/src/main/resources/mapper/question/QuestionMapper.xml

@@ -277,10 +277,9 @@
 
     <select id="pageQuestion" resultType="com.xunmei.core.question.domain.Question">
         select * from core_question q
-        inner join sys_org o on q.org_id =o.id
         where 1=1
         <if test="params.checkSub==true">
-            and o.path like concat((select path from sys_org where id=#{params.orgId}),"%")
+            and q.org_path like concat((select path from sys_org where id=#{params.orgId}),"%")
         </if>
         <if test="params.checkSub!=true">
             and q.org_id=#{params.orgId}
@@ -304,10 +303,9 @@
     </select>
     <select id="pageApp" resultType="com.xunmei.core.question.domain.Question">
         select * from core_question q
-        inner join sys_org o on q.org_id =o.id
         where 1=1
         <if test="params.checkSub==true">
-            and o.path like concat((select path from sys_org where id=#{params.orgId}),"%")
+            and q.org_path like concat((select path from sys_org where id=#{params.orgId}),"%")
         </if>
         <if test="params.checkSub!=true">
             and q.org_id=#{params.orgId}
@@ -334,10 +332,10 @@
     </select>
     <select id="pageReform" resultType="com.xunmei.core.question.domain.Question">
         select * from core_question q
-        inner join sys_org o on q.org_id =o.id
+<!--        inner join sys_org o on q.org_id =o.id-->
         where q.confirm_status>=2 and q.reform_status is not null
         <if test="params.checkSub==true">
-            and o.path like concat((select path from sys_org where id=#{params.orgId}),"%")
+            and q.org_path like concat((select path from sys_org where id=#{params.orgId}),"%")
         </if>
         <if test="params.checkSub!=true">
             and q.org_id=#{params.orgId}
@@ -391,6 +389,7 @@
         q.question_desc,
         q.submitor_name,
         q.submit_time,
+        q.confirm_status,
         q.reform_deadline,
         case q.src_type when 1 then '确认' else ( case f1.execute_status when 0 then '确认' when 1 then '提出异议' else
         '未确认'
@@ -408,21 +407,26 @@
         left join core_question_flow f2 on q.id = f2.question_id and f2.execute_step = 2
         left join core_question_flow f3 on q.id = f3.question_id and f3.execute_step = 11
         where 1=1
-        <if test="param.checkSub==true">
-            and q.org_path like concat((select `path` from sys_org where id = #{param.orgId}),'%')
+        <if test="params.checkSub==true">
+            and q.org_path like concat((select path from sys_org where id=#{params.orgId}),"%")
         </if>
-        <if test="param.checkSub==false">
-            and q.org_id=#{param.orgId}
+        <if test="params.checkSub!=true">
+            and q.org_id=#{params.orgId}
         </if>
-        <if test="param.confirmStatus!=null">
-            and q.confirm_status=#{param.confirmStatus}
+        <if test="params.confirmStatus!=null">
+            <if test="params.confirmStatus==4">
+                and (q.confirm_status!=3) and q.reform_deadline &lt; #{today}
+            </if>
+            <if test="params.confirmStatus!=4">
+                and q.confirm_status=#{params.confirmStatus}
+            </if>
         </if>
-        <if test="param.searchKey!=null">
-            and (q.check_item like concat('%',#{param.searchKey},'%') or q.src_task_name like
-            concat('%',#{param.searchKey},'%'))
+        <if test="params.submitRange!=null and params.submitRange.length==2">
+            and q.submit_time between #{params.submitRange[0]} and #{params.submitRange[1]}
         </if>
-        <if test="param.submitRange!=null and param.submitRange.length==2">
-            and q.submit_time between #{param.submitRange[0]} and #{param.submitRange[1]}
+        <if test="params.searchKey!=null">
+            and (q.question_desc like concat('%',#{params.searchKey},'%') or q.check_content like
+            concat('%',#{params.searchKey},'%'))
         </if>
         order by q.id desc
     </select>
@@ -434,6 +438,7 @@
         q.question_desc,
         q.submitor_name,
         q.submit_time,
+        q.confirm_status,
         q.reform_deadline,
         case q.src_type when 1 then '确认' else ( case f1.execute_status when 0 then '确认' when 1 then '提出异议' else
         '未确认'
@@ -450,25 +455,27 @@
         left join core_question_flow f1 on q.id = f1.question_id and f1.execute_step = 1
         left join core_question_flow f2 on q.id = f2.question_id and f2.execute_step = 2
         left join core_question_flow f3 on q.id = f3.question_id and f3.execute_step = 11
-        where 1=1
-        <if test="param.checkSub==true">
-            and q.org_path like concat((select `path` from sys_org where id = #{param.orgId}),'%')
-        </if>
-        <if test="param.checkSub==false">
-            and q.org_id=#{param.orgId}
+        where q.confirm_status>=2 and q.reform_status is not null
+        <if test="params.checkSub==true">
+            and q.org_path like concat((select path from sys_org where id=#{params.orgId}),"%")
         </if>
-        <if test="param.reformStatus==null">
-            and q.confirm_status>=2
+        <if test="params.checkSub!=true">
+            and q.org_id=#{params.orgId}
         </if>
-        <if test="param.reformStatus!=null">
-            and q.reform_status=#{param.reformStatus}
+        <if test="params.reformStatus!=null">
+            <if test="params.reformStatus==12">
+                and q.confirm_status!=3 and q.reform_deadline &lt; #{today}
+            </if>
+            <if test="params.reformStatus!=12">
+                and q.reform_status=#{params.reformStatus}
+            </if>
         </if>
-        <if test="param.searchKey!=null">
-            and (q.check_content like concat('%',#{param.searchKey},'%') or q.src_task_name like
-            concat('%',#{param.searchKey},'%'))
+        <if test="params.reformRange!=null and params.reformRange.length==2">
+            and q.reform_deadline between #{params.reformRange[0]} and #{params.reformRange[1]}
         </if>
-        <if test="param.reformRange!=null and param.reformRange.length==2">
-            and q.reform_deadline between #{param.reformRange[0]} and #{param.reformRange[1]}
+        <if test="params.searchKey!=null">
+            and (q.question_desc like concat('%',#{params.searchKey},'%') or q.check_content like
+            concat('%',#{params.searchKey},'%'))
         </if>
         order by q.id desc
     </select>