Browse Source

1、bi大屏接口

develop
bobol 9 months ago
parent
commit
b5fb5bfda9
  1. 4
      lzbi-common/src/main/java/com/lzbi/common/enums/ReportNameEnum.java
  2. 2
      lzbi-module/src/main/java/com/lzbi/bi/domain/FinishingRate.java
  3. 44
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenNewService.java
  4. 14
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewAggregateResVo.java
  5. 29
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftMonthAggregateResVo.java
  6. 3
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java
  7. 9
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftMonthMapper.java
  8. 42
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml
  9. 42
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftMonthMapper.xml

4
lzbi-common/src/main/java/com/lzbi/common/enums/ReportNameEnum.java

@ -25,7 +25,9 @@ public enum ReportNameEnum
WATER_SUPPLY_TEMPERATURE("供水温度"),
RETURN_WATER_TEMPERATURE("回水温度"),
NUMBER_OF_STEAM_FURNACES_IN_OPERATION("汽炉运行台数"),
NUMBER_OF_WATER_FURNACES_IN_OPERATION("水炉运行台数");
NUMBER_OF_WATER_FURNACES_IN_OPERATION("水炉运行台数"),
SECOND_NETWORK_ELECTRICITY_CONSUMPTION_RATE("二次网耗水率");
private final String name;

2
lzbi-module/src/main/java/com/lzbi/bi/domain/FinishingRateVO.java → lzbi-module/src/main/java/com/lzbi/bi/domain/FinishingRate.java

@ -11,7 +11,7 @@ import java.util.List;
* 完成率
*/
@Data
public class FinishingRateVO {
public class FinishingRate {
private List<Label> labelArr;

44
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenNewService.java

@ -2,28 +2,21 @@ package com.lzbi.bi.service;
import cn.hutool.core.collection.CollUtil;
import com.lzbi.bi.domain.*;
import com.lzbi.common.config.TargetModelConfig;
import com.lzbi.common.constant.BizConstants;
import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.ReportNameEnum;
import com.lzbi.common.utils.bean.BeanUtils;
import com.lzbi.draft.domain.DcBusiTargetDraftDay;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper;
import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo;
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper;
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService;
import com.lzbi.system.service.ISysDeptService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@ -40,12 +33,6 @@ import static java.util.stream.Collectors.groupingBy;
@Service
public class DcBusiDataScreenNewService {
@Autowired
private TargetModelConfig targetModelConfig;
@Resource
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper;
@Resource
private DcBusiTargetDraftMonthMapper dcBusiTargetDraftMonthMapper;
@ -205,8 +192,8 @@ public class DcBusiDataScreenNewService {
return list;
}
public FinishingRateVO getFinishingRate(TargetDraftDaynewReqVo targetDraftDaynewReqVo) {
FinishingRateVO finishingRateVO = new FinishingRateVO();
public FinishingRate getFinishingRate(TargetDraftDaynewReqVo targetDraftDaynewReqVo) {
FinishingRate finishingRate = new FinishingRate();
// DcBusiTargetDraftDay params = new DcBusiTargetDraftDay();
// BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq);
// String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
@ -224,11 +211,11 @@ public class DcBusiDataScreenNewService {
// } else {
// map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getAssetCode));
// }
// List<FinishingRateVO.Label> labelArray = new ArrayList<>();
// List<FinishingRate.Label> labelArray = new ArrayList<>();
// List<BigDecimal> valueArr = new ArrayList<>();
// final BigDecimal[] max = {new BigDecimal(0)};
// map.forEach((key, value) -> {
// FinishingRateVO.Label label = new FinishingRateVO.Label();
// FinishingRate.Label label = new FinishingRate.Label();
// if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
// label.setName(value.get(0).getOrgName());
// } else {
@ -245,10 +232,25 @@ public class DcBusiDataScreenNewService {
// labelArray.add(label);
// });
// labelArray.stream().forEach(label -> label.setMax(max[0]));
// finishingRateVO.setLabelArr(labelArray);
// finishingRateVO.setValueArr(valueArr);
// finishingRate.setLabelArr(labelArray);
// finishingRate.setValueArr(valueArr);
// }
return finishingRateVO;
List<String> names = new ArrayList<>();
names.add(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName());
names.add(ReportNameEnum.SECOND_NETWORK_WATER_CONSUMPTION_RATE.getName());
names.add(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName());
names.add(ReportNameEnum.SECOND_NETWORK_ELECTRICITY_CONSUMPTION_RATE.getName());
names.add(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName());
targetDraftDaynewReqVo.setReportNames(names);
targetDraftDaynewReqVo.setAssetLevel(BizConstants.DcAssetLevel.COMPANY);
targetDraftDaynewReqVo.setAssetType(BizConstants.DcAssetType.REPORT);
List<Long> orgIds = new ArrayList<>();
orgIds.add(targetDraftDaynewReqVo.getOrgId());
targetDraftDaynewReqVo.setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(targetDraftDaynewReqVo);
List<TargetDraftMonthAggregateResVo> targetDraftMonthAggregateResVos = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMontAggregateList(targetDraftDaynewReqVo);
return finishingRate;
}
public CorporateStatisticsVO getCorporateStatistics(TargetDraftDaynewReqVo targetDraftDaynewReqVo) {

14
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewAggregateResVo.java

@ -2,9 +2,14 @@ package com.lzbi.draft.domain.vo;
import com.lzbi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 日计划累计值
*/
@Data
public class TargetDraftDaynewAggregateResVo {
@ApiModelProperty(name = "组织Id",notes = "organizeId")
@ -16,12 +21,9 @@ public class TargetDraftDaynewAggregateResVo {
@ApiModelProperty(name = "图表名称",notes = "reportName")
private String reportName;
@ApiModelProperty(name = "指标结果值",notes = "valueResult")
private BigDecimal valueResult = BigDecimal.ZERO;
@ApiModelProperty(name = "指标计划值",notes = "valueResult")
private BigDecimal valuePlan = BigDecimal.ZERO;
@Excel(name = "单位")
private String targetUnit;
@ApiModelProperty(name = "指标结果值",notes = "valueResult")
private BigDecimal valueResult = BigDecimal.ZERO;
}

29
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftMonthAggregateResVo.java

@ -0,0 +1,29 @@
package com.lzbi.draft.domain.vo;
import com.lzbi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 月指标累计值
*/
@Data
public class TargetDraftMonthAggregateResVo {
@ApiModelProperty(name = "组织Id",notes = "organizeId")
private String organizeId;
@ApiModelProperty(name = "组织名称",notes = "organizeName")
private String organizeName;
@ApiModelProperty(name = "图表名称",notes = "reportName")
private String reportName;
@Excel(name = "单位")
private String targetUnit;
@ApiModelProperty(name = "指标计划值",notes = "valueResult")
private BigDecimal valPlan = BigDecimal.ZERO;
}

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

@ -3,6 +3,7 @@ package com.lzbi.draft.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.bill.domain.DcBusiTargetInputMaster;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import com.lzbi.wechat.domain.dto.TargetModelValueDTO;
@ -89,4 +90,6 @@ public interface DcBusiTargetDraftDaynewMapper extends BaseMapper<DcBusiTargetDr
public int deleteDcBusiTargetDraftDaynewByIds(String[] ids);
List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo);
List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo);
}

9
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftMonthMapper.java

@ -4,6 +4,8 @@ import java.util.List;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo;
import com.lzbi.wechat.domain.dto.TargetModelValueDTO;
import com.lzbi.wechat.domain.vo.TargetPlanVO;
import org.apache.ibatis.annotations.Param;
@ -40,6 +42,13 @@ public interface DcBusiTargetDraftMonthMapper extends BaseMapper<DcBusiTargetDra
*/
List<TargetPlanVO> selectTotalTargetModelPlanValue(TargetModelValueDTO targetModelValueDTO);
/**
* 查询月指标累计值
* @param targetDraftDaynewReqVo
* @return
*/
List<TargetDraftMonthAggregateResVo> selectDcBusiTargetDraftMontAggregateList(TargetDraftDaynewReqVo targetDraftDaynewReqVo);
/**
* 新增指标数据底稿()
*

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

@ -270,7 +270,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectTargetDraftDaynewList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewResVo">
select
d.organize_name, d.organize_id, c.report_name, d.value_result, m.target_unit
@ -322,4 +321,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="selectTargetDraftDaynewAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo">
select
d.organize_name,
d.organize_id,
c.report_name,
m.target_unit,
SUM(d.value_result) as "value_result"
from
dc_busi_target_draft_daynew d,
dc_busi_report_target_config c,
dc_base_target_model m,
(
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) &lt;= CONCAT(#{dateYear}, #{dateMonth}, #{dateDay})
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>
GROUP BY
d.organize_name,
d.organize_id,
c.report_name,
m.target_unit
</select>
</mapper>

42
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftMonthMapper.xml

@ -83,6 +83,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.target_model_code
</select>
<select id="selectDcBusiTargetDraftMontAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo">
select
d.org_name,
d.org_id,
c.report_name,
m.target_unit,
SUM(d.val_plan) as "val_plan"
from
dc_busi_target_draft_month d,
dc_busi_report_target_config c,
dc_base_target_model m,
(
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.count_year, d.count_month) &lt;= CONCAT(#{dateYear}, #{dateMonth})
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>
GROUP BY
d.org_name,
d.org_id,
c.report_name,
m.target_unit
</select>
<insert id="insertDcBusiTargetDraftMonth" parameterType="DcBusiTargetDraftMonth" useGeneratedKeys="true" keyProperty="id">
insert into dc_busi_target_draft_month
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save