|
|
@ -8,15 +8,19 @@ import com.baomidou.mybatisplus.extension.service.IService; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.lzbi.bi.domain.DcBusiDataScreenDto; |
|
|
|
import com.lzbi.bi.domain.SysDeptLocation; |
|
|
|
import com.lzbi.bi.domain.dto.SomeOrgSomedaySomeParamSummarizingDataDTO; |
|
|
|
import com.lzbi.bi.domain.req.ParamSummarizingDataReq; |
|
|
|
import com.lzbi.bi.domain.vo.*; |
|
|
|
import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; |
|
|
|
import com.lzbi.bi.mapper.ScreenMockDataMapper; |
|
|
|
import com.lzbi.common.constant.BizConstants; |
|
|
|
import com.lzbi.common.constant.ParamsModelCodeConstants; |
|
|
|
import com.lzbi.common.core.domain.entity.SysDept; |
|
|
|
import com.lzbi.common.enums.ReportNameEnum; |
|
|
|
import com.lzbi.bi.domain.dto.SomeOrgSomedayMultiReportDataDTO; |
|
|
|
import com.lzbi.bi.domain.dto.SomeTypeChildrenOrgSomedayMultiReportDataDTO; |
|
|
|
import com.lzbi.bi.domain.req.ReportDataReq; |
|
|
|
import com.lzbi.common.utils.bean.BeanUtils; |
|
|
|
import com.lzbi.draft.domain.vo.*; |
|
|
|
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; |
|
|
|
import com.lzbi.system.service.ISysDeptService; |
|
|
@ -25,6 +29,9 @@ import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
@ -45,8 +52,45 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
private ISysDeptService iSysDeptService; |
|
|
|
@Resource |
|
|
|
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService; |
|
|
|
@Resource |
|
|
|
private ScreenMockDataMapper baseMapper; |
|
|
|
// @Resource
|
|
|
|
// private ScreenMockDataMapper baseMapper;
|
|
|
|
|
|
|
|
/** |
|
|
|
* 供暖起始日期--月日 |
|
|
|
*/ |
|
|
|
private static final String HEATING_START_DATE = "11-01"; |
|
|
|
/** |
|
|
|
* 供暖结束日期--月日 |
|
|
|
*/ |
|
|
|
private static final String HEATING_END_DATE = "03-31"; |
|
|
|
/** |
|
|
|
* 非供暖起始日期--月日 |
|
|
|
*/ |
|
|
|
private static final String NO_HEATING_START_DATE = "04-01"; |
|
|
|
/** |
|
|
|
* 非供暖结束日期--月日 |
|
|
|
*/ |
|
|
|
private static final String NO_HEATING_END_DATE = "10-31"; |
|
|
|
|
|
|
|
private static final String GRMJ = "供热面积"; |
|
|
|
private static final String LWMJ = "联网面积"; |
|
|
|
private static final String AQGR = "安全供热"; |
|
|
|
private static final String RY = "热源"; |
|
|
|
private static final String HRZ = "换热站"; |
|
|
|
private static final String ZMJ = "总面积"; |
|
|
|
private static final String ZYH = "总用户"; |
|
|
|
private static final List<String> SPECIAL_REPORT_LIST; |
|
|
|
|
|
|
|
static { |
|
|
|
SPECIAL_REPORT_LIST = new ArrayList<>(); |
|
|
|
SPECIAL_REPORT_LIST.add(GRMJ); |
|
|
|
SPECIAL_REPORT_LIST.add(LWMJ); |
|
|
|
SPECIAL_REPORT_LIST.add(AQGR); |
|
|
|
SPECIAL_REPORT_LIST.add(RY); |
|
|
|
SPECIAL_REPORT_LIST.add(HRZ); |
|
|
|
SPECIAL_REPORT_LIST.add(ZMJ); |
|
|
|
SPECIAL_REPORT_LIST.add(ZYH); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询某个组织某天的某个图表数据 |
|
|
@ -55,7 +99,61 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
*/ |
|
|
|
public SomeOrgSomedaySomeReportDataVO selectSomeOrgSomedaySomeReportData(ReportDataReq reportDataReq) { |
|
|
|
this.buildReportDataReq(reportDataReq); |
|
|
|
return baseMapper.selectSomeOrgSomedaySomeReportData(reportDataReq); |
|
|
|
if (SPECIAL_REPORT_LIST.contains(reportDataReq.getReportName())) { |
|
|
|
return this.selectSpecialReportData(reportDataReq); |
|
|
|
} else { |
|
|
|
return baseMapper.selectSomeOrgSomedaySomeReportData(reportDataReq); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public SomeOrgSomedaySomeReportDataVO selectSpecialReportData(ReportDataReq reportDataReq) { |
|
|
|
ParamSummarizingDataReq paramSummarizingDataReq = new ParamSummarizingDataReq(); |
|
|
|
BeanUtils.copyBeanProp(paramSummarizingDataReq, reportDataReq); |
|
|
|
BigDecimal value = null; |
|
|
|
switch (reportDataReq.getReportName()) { |
|
|
|
case GRMJ: |
|
|
|
paramSummarizingDataReq.setTargetModelCode(ParamsModelCodeConstants.供暖面积); |
|
|
|
value = baseMapper.selectSomeOrgSomedaySomeParamSummarizingData(paramSummarizingDataReq); |
|
|
|
break; |
|
|
|
case LWMJ: |
|
|
|
paramSummarizingDataReq.setTargetModelCode(ParamsModelCodeConstants.开栓已执行); |
|
|
|
value = baseMapper.selectSomeOrgSomedaySomeParamSummarizingData(paramSummarizingDataReq); |
|
|
|
break; |
|
|
|
case AQGR: |
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|
|
|
String dateStr = reportDataReq.getDateYear() + "-" + reportDataReq.getDateMonth() + "-" + reportDataReq.getDateDay(); |
|
|
|
LocalDate date = LocalDate.parse(dateStr, dateTimeFormatter); |
|
|
|
int year = date.getYear(); |
|
|
|
String noHeatingStartDateStr = year + NO_HEATING_START_DATE; |
|
|
|
String noHeatingEndDateStr = year + NO_HEATING_END_DATE; |
|
|
|
LocalDate noHeatingStartDate = LocalDate.parse(noHeatingStartDateStr, dateTimeFormatter); |
|
|
|
LocalDate noHeatingEndDate = LocalDate.parse(noHeatingEndDateStr, dateTimeFormatter); |
|
|
|
String heatingStartDateStr = (year - 1) + HEATING_START_DATE; |
|
|
|
String heatingEndDateStr = year + HEATING_END_DATE; |
|
|
|
LocalDate heatingStartDate = LocalDate.parse(heatingStartDateStr, dateTimeFormatter); |
|
|
|
LocalDate heatingEndDate = LocalDate.parse(heatingEndDateStr, dateTimeFormatter); |
|
|
|
// 如果在非供暖期,就是获取最大值
|
|
|
|
if (date.isBefore(noHeatingEndDate) && date.isAfter(noHeatingStartDate)) { |
|
|
|
long daysDiff = ChronoUnit.DAYS.between(heatingEndDate, heatingStartDate); |
|
|
|
value = BigDecimal.valueOf(daysDiff); |
|
|
|
} else { |
|
|
|
long daysDiff = ChronoUnit.DAYS.between(date, heatingStartDate); |
|
|
|
value = BigDecimal.valueOf(daysDiff); |
|
|
|
} |
|
|
|
break; |
|
|
|
case RY: |
|
|
|
// iSysDeptService.selectCompany()
|
|
|
|
break; |
|
|
|
case HRZ: |
|
|
|
break; |
|
|
|
case ZMJ: |
|
|
|
break; |
|
|
|
case ZYH: |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
return new SomeOrgSomedaySomeReportDataVO(value, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -139,12 +237,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
Map<String, BigDecimal> reportNameValueMap = orgDataList.stream().collect(Collectors.toMap(SomeTypeChildrenOrgSomedayMultiReportDataDTO::getReportName, SomeTypeChildrenOrgSomedayMultiReportDataDTO::getValueResult, (v1, v2) -> v2)); |
|
|
|
head.add(orgDataList.get(0).getOrgName()); |
|
|
|
for (int i = 1; i < result.size(); i++) { |
|
|
|
int finalI = i; |
|
|
|
reportNameValueMap.forEach((reportName, valueResult) -> { |
|
|
|
if (result.get(finalI).get(0).equals(reportName)) { |
|
|
|
result.get(finalI).add(valueResult); |
|
|
|
} |
|
|
|
}); |
|
|
|
result.get(i).add(reportNameValueMap.get(String.valueOf(result.get(i).get(0)))); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -172,12 +265,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
Map<String, BigDecimal> reportNameMaxValueResultMap = dateYearDataList.stream().collect(Collectors.toMap(SomeOrgSomeReportYearlyDataVO::getReportName, SomeOrgSomeReportYearlyDataVO::getMaxValueResult, (v1, v2) -> v2)); |
|
|
|
head.add(dateYear); |
|
|
|
for (int i = 1; i < result.size(); i++) { |
|
|
|
int finalI = i; |
|
|
|
reportNameMaxValueResultMap.forEach((reportName, maxValueResult) -> { |
|
|
|
if (result.get(finalI).get(0).equals(reportName)) { |
|
|
|
result.get(finalI).add(maxValueResult); |
|
|
|
} |
|
|
|
}); |
|
|
|
result.get(i).add(reportNameMaxValueResultMap.get(String.valueOf(result.get(i).get(0)))); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -186,6 +274,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
} |
|
|
|
|
|
|
|
public List<MapOrgVO> selectMapOrgList(ReportDataReq reportDataReq) { |
|
|
|
this.buildChildrenOrgReportDataReq(reportDataReq); |
|
|
|
return baseMapper.selectMapOrgList(reportDataReq); |
|
|
|
} |
|
|
|
|
|
|
|