|
|
@@ -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));
|