فهرست منبع

履职登记簿代码提交

jingyuanchao 1 سال پیش
والد
کامیت
23caac58e9

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

@@ -123,9 +123,8 @@ public class ApiPlanController {
     }
 
 
-
-    @GetMapping("/buildPdf")
-    public AjaxResult buildPdf(String dateStr) {
+    @GetMapping("/buildPdf/{dateStr}")
+    public AjaxResult buildPdf(@PathVariable("dateStr") String dateStr) {
         Date date;
         if (ObjectUtil.isEmpty(dateStr)) {
             date = new Date();
@@ -266,7 +265,8 @@ public class ApiPlanController {
     @GetMapping(value = "/buildResumptionPdf/{orgId}")
     AjaxResult buildResumptionPdf(@PathVariable("orgId") Long orgId) {
         final Date date = new Date();
-        return appPlanService.buildResumptionPdfDaily(orgId, date);
+        appPlanService.buildResumptionPdfDaily(orgId, date);
+        return AjaxResult.success();
     }
 
     /**

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/ResumptionMapper.java

@@ -94,6 +94,8 @@ public interface ResumptionMapper extends BaseMapper<Resumption> {
     List<Resumption> selectByYmdDateAndExec(@Param("date") Date date, @Param("exec") Integer exec, @Param("orgId") Long orgId);
     List<Resumption> selectByYmdDateAndExecList(@Param("date") Date date, @Param("exec") List<Integer> exec, @Param("orgId") Long orgId);
 
+    List<Resumption> selectBySubmitTimeAndPlanType(@Param("date") Date date, @Param("planType") List<Integer> planType, @Param("orgId") Long orgId);
+
     void batchInsertResumptionData(@Param("list") List<AppResumptionData> list);
 
     void batchInsertResumptionQuestion(@Param("list") List<Question> list);

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/AppPlanService.java

@@ -91,7 +91,7 @@ public interface AppPlanService extends IService<AppPlan> {
 
     void buildResumptionNotWorkTimePdf(Long orgId, Date date);
 
-    AjaxResult buildResumptionPdfDaily(Long orgId, Date date);
+    void buildResumptionPdfDaily(Long orgId, Date date);
 
     void buildResumptionAllDayPdf(Long orgId, Date date);
 

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

@@ -1,6 +1,7 @@
 package com.xunmei.core.resumption.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -51,9 +52,11 @@ import com.xunmei.core.thread.ThreadPoolConfig;
 import com.xunmei.system.api.RemoteFileService;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.ResumptionPdf;
+import com.xunmei.system.api.domain.SysDictData;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
 import com.xunmei.system.api.vo.QuestionPdfVo;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +78,7 @@ import java.util.stream.Collectors;
  * @description :
  * @modyified By:
  */
+@Slf4j
 @Service
 public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> implements AppPlanService {
     @Resource
@@ -1105,10 +1109,21 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
     @Async
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public AjaxResult buildResumptionPdfDaily(Long orgId, Date date) {
+    public void buildResumptionPdfDaily(Long orgId, Date date) {
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
         String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.SECURITY_PERFORMANCE, sysOrg.getName());
         Map<String, Object> data = this.getFtlResumptionDaily(orgId, date);
+        final List<SysDictData> dictCache = DictUtils.getDictCache(DictConstants.RESUMPTION_PLAN_EXEC);
+        final List<String> names = dictCache.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
+        List<ResumptionPdf> list = new ArrayList<>();
+        for (String name : names) {
+            final List<ResumptionPdf> pdfList = (List<ResumptionPdf>) data.get(name);
+
+            list.addAll(ObjectUtil.isNull(pdfList) ? new ArrayList<>() : pdfList);
+        }
+        if (ObjectUtil.isEmpty(list)) {
+            return;
+        }
         data.put("fileName", fileName);
         data.put("orgName", sysOrg.getShortName());
         data.put("dateStr", DateUtil.format(new Date(), Constants.DAILY_FORMAT));
@@ -1137,16 +1152,16 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
             }
             registerBookPdfService.saveOrUpdate(registerBookPdf);
         }, threadPoolTaskExecutor);
-
-
-        return AjaxResult.success("正在生成pdf,请稍后刷新页面查看!");
     }
 
     @Async
     @Override
     public void buildPdf(Date date) {
 
-        List<Resumption> resumptions = resumptionMapper.selectList(new LambdaQueryWrapper<Resumption>().like(Resumption::getSubmitTime, DateUtils.toLocalDate(date)).eq(Resumption::getStatus, 3));
+        List<Resumption> resumptions = resumptionMapper.selectList(new LambdaQueryWrapper<Resumption>()
+                .like(Resumption::getSubmitTime, DateUtils.toLocalDate(date))
+                .eq(Resumption::getStatus, 3)
+                .select(Resumption::getOrgId));
         List<Long> orgIds = resumptions.stream().map(Resumption::getOrgId).distinct().collect(Collectors.toList());
         for (Long orgId : orgIds) {
             buildResumptionPdfDaily(orgId, date);
@@ -1155,7 +1170,6 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         }
     }
 
-    //1703700546288825444
     @Override
     public void buildResumptionAllDayPdf(Long orgId, Date date) {
         final List<Map<String, Object>> mapList = this.getFtlResumptionAllDay(orgId, date);
@@ -1195,10 +1209,10 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 
         //查询执行时刻为全天的的履职数据
-        List<Resumption> allDayDataList = resumptionMapper.selectByYmdDateAndExecList(date, Arrays.asList(1), orgId);
+        List<Resumption> allDayDataList = resumptionMapper.selectBySubmitTimeAndPlanType(date, Arrays.asList(4, 5, 6), orgId);
         //全天的的履职数据需要生成三种登记簿,所以还需要跟根据任务类型来分组 // 4:“110”入侵报警系统测试 5:不间断电源(UPS)维护 6:离行式自助银行巡检
         final Map<Integer, List<Resumption>> listMap = allDayDataList.stream().filter(res -> Arrays.asList(4, 5, 6).contains(res.getPlanType())).collect(Collectors.groupingBy(Resumption::getPlanType));
-        final ArrayList<Map<String, Object>> maps = new ArrayList<>();
+        List<Map<String, Object>> maps = new ArrayList<>();
         for (Integer planType : listMap.keySet()) {
             String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.getEnums(planType), sysOrg.getName());
             Map<String, Object> data = new HashMap<>();
@@ -1221,7 +1235,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
     private Map<String, Object> getFtlResumptionNotWorkTime(Long orgId, Date date) {
         Map<String, Object> data = new HashMap<>();
-        List<Resumption> dataList = resumptionMapper.selectByYmdDateAndExecList(date, Arrays.asList(5), orgId);
+        List<Resumption> dataList = resumptionMapper.selectBySubmitTimeAndPlanType(date, Arrays.asList(7), orgId);
         List<AppResumptionDataInfoVo> notWorkTimeInfo = getItems(dataList);
         Map<Long, List<AppResumptionDataInfoVo>> afterf = notWorkTimeInfo.stream().collect(Collectors.groupingBy(AppResumptionDataInfoVo::getItemId));
         data.put(DictUtils.getDictLabel(DictConstants.RESUMPTION_PLAN_EXEC, 5), getResult(afterf));

+ 21 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionMapper.xml

@@ -361,6 +361,26 @@
             #{item}
         </foreach>
     </select>
+
+    <select id="selectBySubmitTimeAndPlanType" resultType="com.xunmei.core.resumption.domain.Resumption">
+        select res.*,pl.plan_exec as planExec,pl.plan_type as planType
+        from core_resumption res
+        left join core_resumption_plan pl on res.plan_id = pl.id
+        where  DATE(res.submit_time) = DATE(#{date})
+        and res.org_id = #{orgId}
+        and res.status = 3
+        and  pl.plan_type in
+        <foreach collection="planType" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+
+
+
+
+
+
     <insert id="saveResumptionExceptionList">
         insert into core_safety_exception_data (data_id, org_id, org_name, org_path, data_source, data_time,
         create_time,
@@ -528,4 +548,5 @@
         update core_resumption set parent_plan_id=#{newPlanParentId},plan_id=#{newPlanId} where plan_id=#{oldPlanId} and (status=0 or status=1)
     </update>
 
+
 </mapper>