|
|
@@ -9,6 +9,9 @@ import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.ruoyi.business.domain.*; |
|
|
|
import com.ruoyi.business.domain.bo.ApplyStartBO; |
|
|
|
import com.ruoyi.business.domain.bo.JobQueryBO; |
|
|
@@ -21,9 +24,12 @@ import com.ruoyi.business.service.IResourceLibraryService; |
|
|
|
import com.ruoyi.business.util.YinDaoHttpUtils; |
|
|
|
import com.ruoyi.common.annotation.DataScope; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept; |
|
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
|
import com.ruoyi.common.core.page.TableSupport; |
|
|
|
import com.ruoyi.common.enums.PlanRunStatus; |
|
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils; |
|
|
|
import com.ruoyi.common.utils.sql.SqlUtil; |
|
|
|
import com.ruoyi.system.service.ISysDeptService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@@ -152,19 +158,19 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@DataScope(deptAlias = "apply") |
|
|
|
public List<ListApplyVO> list(List<ApplyPlan> planList, List<ApplyPlanLog> planLogList, Apply apply) { |
|
|
|
public List<ListApplyVO> list(Apply apply,List<ApplyPlan> planList, List<ApplyPlanLog> planLogList) { |
|
|
|
// 按照appId分组 |
|
|
|
Map<String, List<ApplyPlan>> planMap = planList.stream().collect(Collectors.groupingBy(ApplyPlan::getAppId)); |
|
|
|
// 日志按照app分组 |
|
|
|
Map<String, List<ApplyPlanLog>> planLogMap = planLogList.stream().collect(Collectors.groupingBy(ApplyPlanLog::getAppId)); |
|
|
|
|
|
|
|
List<ListApplyVO> listApplyVOS = baseMapper.selectApplyList(apply); |
|
|
|
List<ListApplyVO> newList = listApplyVOS.stream().map(e -> { |
|
|
|
listApplyVOS.forEach(e -> { |
|
|
|
// 根据appId获取执行计划 |
|
|
|
List<ApplyPlan> applyPlans = planMap.get(e.getAppId()); |
|
|
|
// 应用没有设置时间 |
|
|
|
if (null == applyPlans) { |
|
|
|
return e; |
|
|
|
return; |
|
|
|
} |
|
|
|
// 总计节约时间 (分钟) |
|
|
|
AtomicReference<BigDecimal> planTime = new AtomicReference<>(BigDecimal.ZERO); |
|
|
@@ -189,9 +195,8 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements |
|
|
|
} |
|
|
|
}); |
|
|
|
e.setTimeSaving(planTime.get() + ""); |
|
|
|
return e; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return newList; |
|
|
|
}); |
|
|
|
return listApplyVOS; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -220,7 +225,7 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements |
|
|
|
e.setManualTime(apply.getManualTime()); |
|
|
|
if (PlanRunStatus.FINISH.getKey().equals(e.getTaskStatus())) { |
|
|
|
// 计算节约时间 |
|
|
|
long diff = Long.parseLong(e.getManualTime()) - Long.parseLong(Optional.ofNullable(e.getPlanTime()).orElse("0")); |
|
|
|
double diff = Double.parseDouble(e.getManualTime()) - Double.parseDouble(Optional.ofNullable(e.getPlanTime()).orElse("0")); |
|
|
|
e.setTimeSaving(diff + ""); |
|
|
|
} |
|
|
|
applyPlanService.updateById(e); |
|
|
|