|
|
|
@ -50,10 +50,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
|
import org.jfree.data.category.DefaultCategoryDataset; |
|
|
|
|
import org.springblade.core.mp.base.BaseEntity; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
@ -204,18 +201,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
return R.data("success"); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String name) { |
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String deptName) { |
|
|
|
|
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser(); |
|
|
|
|
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){ |
|
|
|
|
return R.fail("用户权限查询失败"); |
|
|
|
|
} |
|
|
|
|
R<String> deptNameR = sysClient.getDeptName(deptId); |
|
|
|
|
if (!deptNameR.isSuccess()) { |
|
|
|
|
return R.fail("暂无该机构"); |
|
|
|
|
} |
|
|
|
|
String deptName = deptNameR.getData(); |
|
|
|
|
// 赋值给导出表格名称
|
|
|
|
|
name=deptName; |
|
|
|
|
R<List<Dept>> deptR = sysClient.getDeptByType("200000", deptId, 4); |
|
|
|
|
if (!deptR.isSuccess() || deptR.getData() == null) { |
|
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
@ -229,12 +219,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.in(StationEntity::getRefDept, deptIds) |
|
|
|
|
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)); |
|
|
|
|
stationEntityList=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(stationEntityList)) { |
|
|
|
|
Integer commissionTime = stationEntityList.stream().map(s -> { |
|
|
|
|
int commissionTime = stationEntityList.stream().map(s -> { |
|
|
|
|
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now()); |
|
|
|
|
return (int) dur.toDays(); |
|
|
|
|
}).reduce(Integer::max).get(); |
|
|
|
|
map.put("commissionTime", commissionTime.toString()); |
|
|
|
|
map.put("commissionTime", String.valueOf(commissionTime)); |
|
|
|
|
}else { |
|
|
|
|
map.put("commissionTime", 0); |
|
|
|
|
} |
|
|
|
@ -782,11 +773,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
|
|
|
|
|
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) { |
|
|
|
|
Float planGeneration = 0f; |
|
|
|
|
if (CollectionUtil.isNotEmpty(planYearAll)) { |
|
|
|
|
if (Func.isNotEmpty(planYearAll)) { |
|
|
|
|
planGeneration = planYearAll.get(0).getPlanGeneration(); |
|
|
|
|
} |
|
|
|
|
Float planMonGeneration = 0f; |
|
|
|
|
if (CollectionUtil.isNotEmpty(planYearAll)) { |
|
|
|
|
if (Func.isNotEmpty(planMonAll)) { |
|
|
|
|
planMonGeneration = planMonAll.get(0).getPlanGeneration(); |
|
|
|
|
} |
|
|
|
|
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); |
|
|
|
|