Browse Source

jiahan.wu[CR] 集团大屏热好率和煤耗率排行

develop
eric777 10 months ago
parent
commit
5b0f60a330
  1. 19
      lzbi-common/src/main/java/com/lzbi/common/enums/HeatingPeriodEnum.java
  2. 15
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java
  3. 27
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java
  4. 4
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java
  5. 3
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java
  6. 6
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java
  7. 59
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml

19
lzbi-common/src/main/java/com/lzbi/common/enums/HeatingPeriodEnum.java

@ -0,0 +1,19 @@
package com.lzbi.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Getter
@AllArgsConstructor
public enum HeatingPeriodEnum
{
HEATING_ALL_PERIOD(Stream.of(1,2,3,11,12).collect(Collectors.toList())),
HEATING_NEXT_YREA_PERIOD(Stream.of(1,2,3).collect(Collectors.toList())),
HEATING_CURRENT_YREA_PERIOD(Stream.of(11,12).collect(Collectors.toList()));
private final List<Integer> months;
}

15
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java

@ -12,6 +12,7 @@ import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.domain.TreeSelect; import com.lzbi.common.core.domain.TreeSelect;
import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.ReportNameEnum;
import com.lzbi.common.utils.StringUtils; import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.system.service.impl.SysDeptServiceImpl; import com.lzbi.system.service.impl.SysDeptServiceImpl;
@ -27,6 +28,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 主数据大屏的页面接口 * 主数据大屏的页面接口
@ -156,6 +159,18 @@ public class DcBusiDataScreenMainController extends BaseController{
return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(vo)); return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(vo));
} }
@PostMapping("/heatRateRange")
public AjaxResult getHeatRateRange(@RequestBody TargetDraftDaynewReqVo vo){
vo.setReportNames(Stream.of(ReportNameEnum.HEAT_RATE.getName()).collect(Collectors.toList()));
return AjaxResult.success(dcBusiDataScreenMainService.getHeatingPeriodData(vo));
}
@PostMapping("/coalConsumptionRange")
public AjaxResult getCoalConsumptionRange(@RequestBody TargetDraftDaynewReqVo vo){
vo.setReportNames(Stream.of(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()).collect(Collectors.toList()));
return AjaxResult.success(dcBusiDataScreenMainService.getHeatingPeriodData(vo));
}
@GetMapping("/company/tree/{depId}") @GetMapping("/company/tree/{depId}")
public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){ public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){
if(depId==0){ if(depId==0){

27
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java

@ -1,6 +1,8 @@
package com.lzbi.bi.service; package com.lzbi.bi.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
@ -13,15 +15,19 @@ import com.lzbi.bi.domain.SysDeptLocation;
import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper;
import com.lzbi.common.constant.BizConstants; import com.lzbi.common.constant.BizConstants;
import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.HeatingPeriodEnum;
import com.lzbi.common.enums.ReportNameEnum; import com.lzbi.common.enums.ReportNameEnum;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; import com.lzbi.draft.service.DcBusiTargetDraftDaynewService;
import com.lzbi.system.service.ISysDeptService; import com.lzbi.system.service.ISysDeptService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -308,4 +314,25 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
public List<DcBusiDataScreenVo> selectSquareGroup(String qdate){ public List<DcBusiDataScreenVo> selectSquareGroup(String qdate){
return baseMapper.selectSquareGroup(qdate); return baseMapper.selectSquareGroup(qdate);
} }
public List<Map> getHeatingPeriodData(TargetDraftDaynewReqVo vo){
List<Map> res = Lists.newArrayList();
if (!HeatingPeriodEnum.HEATING_ALL_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) {
return res;
}
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build());
if (CollUtil.isEmpty(sysDepts)) {
return res;
}
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList());
vo.setAssetType("0").setAssetLevel("10").setOrgIds(orgIds);
String dateYear = vo.getDateYear();
if (HeatingPeriodEnum.HEATING_NEXT_YREA_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) {
dateYear = String.valueOf(Integer.parseInt(vo.getDateYear())-1);
}
vo.setBeginDate(StringUtils.join(dateYear, "1101")).setAssetType("0").setAssetLevel("10").setOrgIds(orgIds)
.setEndDate(StringUtils.join(vo.getDateYear(),vo.getDateMonth(),vo.getDateDay()));
res = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewRangeList(vo);
return res;
}
} }

4
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java

@ -36,4 +36,8 @@ public class TargetDraftDaynewReqVo {
private String assetType; private String assetType;
private String beginDate;
private String endDate;
} }

3
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java

@ -11,6 +11,7 @@ import com.lzbi.wechat.domain.vo.TargetResultVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 指标数据底稿日-新结构Mapper接口 * 指标数据底稿日-新结构Mapper接口
@ -91,5 +92,7 @@ public interface DcBusiTargetDraftDaynewMapper extends BaseMapper<DcBusiTargetDr
List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo); List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo);
List<Map> selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo);
List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo); List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo);
} }

6
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java

@ -1,6 +1,8 @@
package com.lzbi.draft.service; package com.lzbi.draft.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.lzbi.common.utils.DateUtils; import com.lzbi.common.utils.DateUtils;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
@ -94,4 +96,8 @@ public class DcBusiTargetDraftDaynewService extends ServiceImpl<DcBusiTargetDraf
public List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo){ public List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo){
return baseMapper.selectTargetDraftDaynewList(vo); return baseMapper.selectTargetDraftDaynewList(vo);
} }
public List<Map> selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo){
return baseMapper.selectTargetDraftDaynewRangeList(vo);
}
} }

59
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml

@ -321,6 +321,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</select> </select>
<select id="selectTargetDraftDaynewRangeList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="java.util.HashMap">
select GROUP_CONCAT(organize_name) as cname,GROUP_CONCAT(value_result) as cut, cdate from (
select
d.organize_name ,
c.report_name ,
d.value_result ,
m.target_unit,CONCAT(d.date_year, '-', d.date_month, '-' , d.date_day) as cdate
from
dc_busi_target_draft_daynew d,
dc_busi_report_target_config c,
dc_base_target_model m,
(
select
max(CONCAT( date_year , date_month , date_day)) max_date,
target_model_code,
organize_id
from
dc_busi_target_draft_daynew
where
organize_id in
<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
#{orgId}
</foreach>
and CONCAT(date_year , date_month , date_day) &gt;= #{beginDate}
and CONCAT(date_year , date_month , date_day) &lt;= #{endDate}
group by
target_model_code,
organize_id,date_year , date_month , date_day
) md,
(
select
max(asset_code) asset_code
from
dc_base_asset_info
where
org_id in
<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
#{orgId}
</foreach>
and asset_level = #{assetLevel}
and asset_type = #{assetType}
group by org_id
) a
where
d.asset_code = a.asset_code
and CONCAT(d.date_year , d.date_month , d.date_day) = md.max_date
and d.target_model_code = md.target_model_code
and d.organize_id = md.organize_id
and d.target_model_code = c.target_model_code
and d.target_model_code = m.target_model_code
and c.report_name in
<foreach item="reportName" collection="reportNames" open="(" separator="," close=")">
#{reportName}
</foreach>
order by md.max_date
)t group by cdate
</select>
<select id="selectTargetDraftDaynewAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo"> <select id="selectTargetDraftDaynewAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo">
select select
d.organize_name, d.organize_name,

Loading…
Cancel
Save