Browse Source

排名

develop
bobol 5 months ago
parent
commit
044e39f46d
  1. 15
      lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java
  2. 73
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java
  3. 17
      lzbi-module/src/main/java/com/lzbi/bi/domain/dto/MultiOrgSomeReportEverydayData.java
  4. 4
      lzbi-module/src/main/java/com/lzbi/bi/domain/req/ReportDataReq.java
  5. 16
      lzbi-module/src/main/java/com/lzbi/bi/domain/vo/SomeReportDataRankingVO.java
  6. 20
      lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiDataScreenMainMapper.java
  7. 9
      lzbi-module/src/main/java/com/lzbi/bi/mapper/ScreenMockDataMapper.java
  8. 127
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java
  9. 27
      lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiMonthPlanBillMasterService.java
  10. 40
      lzbi-module/src/main/resources/mapper/DcBusiDataScreenMainMapper.xml

15
lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java

@ -22,7 +22,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -76,16 +75,15 @@ public class ChargeSystemService {
params.setGoalSource(BizConstants.GoalSource.CHARGE); params.setGoalSource(BizConstants.GoalSource.CHARGE);
List<DcBaseAssetContrastConfig> dcBaseAssetContrastConfigs = dcBaseAssetContrastConfigMapper.selectDcBaseAssetContrastConfigList(); List<DcBaseAssetContrastConfig> dcBaseAssetContrastConfigs = dcBaseAssetContrastConfigMapper.selectDcBaseAssetContrastConfigList();
if (CollectionUtils.isEmpty(dcBaseAssetContrastConfigs)) { if (CollectionUtils.isEmpty(dcBaseAssetContrastConfigs)) {
log.warn("系统中未配置统计单元与外部资产对照关系"); log.error("系统中未配置统计单元与外部资产对照关系");
return; return;
} }
RestTemplate restTemplate = new RestTemplateBuilder() RestTemplate restTemplate = new RestTemplateBuilder()
.setConnectTimeout(Duration.ofMinutes(5)) .setConnectTimeout(Duration.ofMinutes(1))
.setReadTimeout(Duration.ofMinutes(5)) .setReadTimeout(Duration.ofMinutes(20))
.build(); .build();
String str = restTemplate.getForObject(magicServerApiConfig.getChargeSystemParams(), String.class); String str = restTemplate.getForObject(magicServerApiConfig.getChargeSystemParams(), String.class);
if (StringUtils.isNotBlank(str)) { if (StringUtils.isNotBlank(str)) {
JSONObject jsonObject = JSONObject.parseObject(str); JSONObject jsonObject = JSONObject.parseObject(str);
Integer code = jsonObject.getInteger("code"); Integer code = jsonObject.getInteger("code");
@ -95,8 +93,11 @@ public class ChargeSystemService {
log.info("收费系统换热站参数:{}", jsonArray.toJSONString()); log.info("收费系统换热站参数:{}", jsonArray.toJSONString());
this.createParamBill(jsonArray); this.createParamBill(jsonArray);
} }
} else {
log.error("获取收费系统数据失败:{}", str);
} }
} else {
log.error("获取收费系统数据失败");
} }
} }
@ -126,7 +127,7 @@ public class ChargeSystemService {
paramsModelCodeList.add(ParamsModelCodeConstants.开栓已执行); paramsModelCodeList.add(ParamsModelCodeConstants.开栓已执行);
List<ChargeSystemParamsDTO> targetList = dcBaseAssetTargetMapper.selectChargeAssetContrastParams(paramsModelCodeList); List<ChargeSystemParamsDTO> targetList = dcBaseAssetTargetMapper.selectChargeAssetContrastParams(paramsModelCodeList);
Map<String, List<ChargeSystemParamsDTO>> goalAssetCodeMap = targetList.stream().collect(Collectors.groupingBy(ChargeSystemParamsDTO::getGoalAssetCode)); Map<String, List<ChargeSystemParamsDTO>> goalAssetCodeMap = targetList.stream().collect(Collectors.groupingBy(ChargeSystemParamsDTO::getGoalAssetCode));
Iterator iterator = jsonArray.iterator(); Iterator<Object> iterator = jsonArray.iterator();
while(iterator.hasNext()) { while(iterator.hasNext()) {
JSONObject next = (JSONObject) iterator.next(); JSONObject next = (JSONObject) iterator.next();

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

@ -25,6 +25,7 @@ import java.util.Optional;
/** /**
* 主数据大屏的页面接口 * 主数据大屏的页面接口
*
* @author : lienbo * @author : lienbo
* @date : 2024-05-30 * @date : 2024-05-30
*/ */
@ -32,7 +33,7 @@ import java.util.Optional;
@Api(tags = "主数据大屏的页面接口") @Api(tags = "主数据大屏的页面接口")
@RestController @RestController
@RequestMapping("/assetData/dataScreenMain") @RequestMapping("/assetData/dataScreenMain")
public class DcBusiDataScreenMainController extends BaseController{ public class DcBusiDataScreenMainController extends BaseController {
@Autowired @Autowired
private DcBusiDataScreenMainService dcBusiDataScreenMainService; private DcBusiDataScreenMainService dcBusiDataScreenMainService;
@ -42,6 +43,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 获取某个组织某天的某个图表数据 * 获取某个组织某天的某个图表数据
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -52,6 +54,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询下级组织某天的某个图表数据列表 * 查询下级组织某天的某个图表数据列表
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -62,6 +65,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询下级组织某天的某个图表的图形数据 * 查询下级组织某天的某个图表的图形数据
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -70,8 +74,20 @@ public class DcBusiDataScreenMainController extends BaseController{
return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataEchart(reportDataReq)); return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataEchart(reportDataReq));
} }
/**
* 查询下级组织某天的某个图表的图形数据
*
* @param reportDataReq
* @return
*/
@PostMapping("/getChildrenOrgSomedaySomeReportDataEchartHaveOrgId")
public AjaxResult selectChildrenOrgSomedaySomeReportDataEchartHaveOrgId(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataEchartHaveOrgId(reportDataReq));
}
/** /**
* 查询某组织某天的多个图表数据列表 * 查询某组织某天的多个图表数据列表
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -82,6 +98,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询某类型的下级组织某天的多图表数据--多柱形图 * 查询某类型的下级组织某天的多图表数据--多柱形图
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -92,6 +109,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询下级组织某天的某个图表的堆叠图形数据 * 查询下级组织某天的某个图表的堆叠图形数据
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -102,6 +120,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询某组织某个图表年度数据列表 * 查询某组织某个图表年度数据列表
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -112,6 +131,7 @@ public class DcBusiDataScreenMainController extends BaseController{
/** /**
* 查询地图上的组织列表 * 查询地图上的组织列表
*
* @param reportDataReq * @param reportDataReq
* @return * @return
*/ */
@ -120,6 +140,17 @@ public class DcBusiDataScreenMainController extends BaseController{
return AjaxResult.success(dcBusiDataScreenMainService.selectMapOrgList(reportDataReq)); return AjaxResult.success(dcBusiDataScreenMainService.selectMapOrgList(reportDataReq));
} }
/**
* 查询下级组织某个图表的排名列表
*
* @param reportDataReq
* @return
*/
@PostMapping("/getChildrenOrgSomeReportDataRankingList")
public AjaxResult selectSomeReportDataRankingList(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectSomeReportDataRankingList(reportDataReq));
}
/** /**
* 获取天气信息 * 获取天气信息
*/ */
@ -131,35 +162,37 @@ public class DcBusiDataScreenMainController extends BaseController{
String yikeapiAppid; String yikeapiAppid;
@Value("${luenmeilz.yikeapiAppsecret}") @Value("${luenmeilz.yikeapiAppsecret}")
String yikeapiAppsecret; String yikeapiAppsecret;
@GetMapping("/weather/{areaCode}") @GetMapping("/weather/{areaCode}")
public AjaxResult getWeather(@PathVariable String areaCode){ public AjaxResult getWeather(@PathVariable String areaCode) {
JSONObject ret=new JSONObject(); JSONObject ret = new JSONObject();
String url=StrUtil.format("https://v1.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}",yikeapiAppid,yikeapiAppsecret); String url = StrUtil.format("https://v1.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}", yikeapiAppid, yikeapiAppsecret);
JSONObject weather=JSONObject.parseObject(HttpUtil.get(url)); JSONObject weather = JSONObject.parseObject(HttpUtil.get(url));
JSONArray weatherInfo=Optional.ofNullable(weather.getJSONArray("data")).orElse(new JSONArray()); log.debug("天气接口返回数据:{}", weather);
JSONArray weatherInfo = Optional.ofNullable(weather.getJSONArray("data")).orElse(new JSONArray());
if (null != weatherInfo && !weatherInfo.isEmpty()) { if (null != weatherInfo && !weatherInfo.isEmpty()) {
JSONArray we_date=new JSONArray(); JSONArray we_date = new JSONArray();
JSONArray we_name=new JSONArray(); JSONArray we_name = new JSONArray();
JSONArray tem_day=new JSONArray(); JSONArray tem_day = new JSONArray();
JSONArray tem_night=new JSONArray(); JSONArray tem_night = new JSONArray();
we_date.add("天气日期:"); we_date.add("天气日期:");
we_name.add("天气情况:"); we_name.add("天气情况:");
tem_day.add("日间气温:"); tem_day.add("日间气温:");
tem_night.add("夜间气温:"); tem_night.add("夜间气温:");
weatherInfo.forEach(item->{ weatherInfo.forEach(item -> {
JSONObject jsb=JSONObject.from(item); JSONObject jsb = JSONObject.from(item);
we_date.add(jsb.getString("date")); we_date.add(jsb.getString("date"));
tem_day.add(jsb.getString("tem_day")); tem_day.add(jsb.getString("tem_day"));
tem_night.add(jsb.getString("tem_night")); tem_night.add(jsb.getString("tem_night"));
we_name.add(jsb.getString("wea")); we_name.add(jsb.getString("wea"));
}); });
JSONArray list=new JSONArray(); JSONArray list = new JSONArray();
list.add(we_date); list.add(we_date);
list.add(tem_day); list.add(tem_day);
list.add(tem_night); list.add(tem_night);
list.add(we_name); list.add(we_name);
ret.put("source",list); ret.put("source", list);
ret.put("realwe",weatherInfo.get(0)); ret.put("realwe", weatherInfo.get(0));
} else { } else {
log.error("天气接口未返回数据"); log.error("天气接口未返回数据");
} }
@ -167,18 +200,18 @@ public class DcBusiDataScreenMainController extends BaseController{
} }
@PostMapping("/mapInfo") @PostMapping("/mapInfo")
public AjaxResult getMapInfo(@RequestBody ReportDataReq vo){ public AjaxResult getMapInfo(@RequestBody ReportDataReq vo) {
return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(vo)); return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(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) {
depId=null; depId = null;
} }
List<SysDept> lsysDept = sysDeptService.selectCompany(depId); List<SysDept> lsysDept = sysDeptService.selectCompany(depId);
List<TreeSelect> treeSelects = sysDeptService.buildDeptTreeSelect(lsysDept); List<TreeSelect> treeSelects = sysDeptService.buildDeptTreeSelect(lsysDept);
return AjaxResult.success( treeSelects) ; return AjaxResult.success(treeSelects);
} }
} }

17
lzbi-module/src/main/java/com/lzbi/bi/domain/dto/MultiOrgSomeReportEverydayData.java

@ -1,2 +1,17 @@
package com.lzbi.bi.domain.dto;public class MultiOrgSomeReportEverydayData { package com.lzbi.bi.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 多组织某个图标每一天的数据
*/
@Data
public class MultiOrgSomeReportEverydayData {
private Long orgId;
private String orgName;
private String date;
private BigDecimal value;
} }

4
lzbi-module/src/main/java/com/lzbi/bi/domain/req/ReportDataReq.java

@ -44,4 +44,8 @@ public class ReportDataReq {
private String orgType; private String orgType;
private String heatingStartDate;
private String heatingEndDate;
} }

16
lzbi-module/src/main/java/com/lzbi/bi/domain/vo/SomeReportDataRankingVO.java

@ -2,12 +2,22 @@ package com.lzbi.bi.domain.vo;
import lombok.Data; import lombok.Data;
/**
* 某个图标数据排名
*/
@Data @Data
public class ChildrenOrgReportDataRankingVO { public class SomeReportDataRankingVO {
/**
* 日期
*/
private String cdate; private String cdate;
/**
* 名称集
*/
private String cname; private String cname;
/**
* 数据集
*/
private String cut; private String cut;
} }

20
lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiDataScreenMainMapper.java

@ -3,16 +3,14 @@ package com.lzbi.bi.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.bi.domain.DcBusiDataScreenDto; import com.lzbi.bi.domain.DcBusiDataScreenDto;
import com.lzbi.bi.domain.dto.MultiOrgSomedaySomeParamSummarizingDataDTO; import com.lzbi.bi.domain.dto.*;
import com.lzbi.bi.domain.dto.SomeOrgSomedayMultiReportDataDTO;
import com.lzbi.bi.domain.dto.SomeOrgSomedaySomeParamSummarizingDataDTO;
import com.lzbi.bi.domain.dto.SomeTypeChildrenOrgSomedayMultiReportDataDTO;
import com.lzbi.bi.domain.req.ReportDataReq; import com.lzbi.bi.domain.req.ReportDataReq;
import com.lzbi.bi.domain.req.ParamSummarizingDataReq; import com.lzbi.bi.domain.req.ParamSummarizingDataReq;
import com.lzbi.bi.domain.vo.ChildrenOrgSomedaySomeReportDataVO; import com.lzbi.bi.domain.vo.ChildrenOrgSomedaySomeReportDataVO;
import com.lzbi.bi.domain.vo.MapOrgVO; import com.lzbi.bi.domain.vo.MapOrgVO;
import com.lzbi.bi.domain.vo.SomeOrgSomeReportYearlyDataVO; import com.lzbi.bi.domain.vo.SomeOrgSomeReportYearlyDataVO;
import com.lzbi.bi.domain.vo.SomeOrgSomedaySomeReportDataVO; import com.lzbi.bi.domain.vo.SomeOrgSomedaySomeReportDataVO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -88,4 +86,18 @@ public interface DcBusiDataScreenMainMapper extends BaseMapper<DcBusiDataScreenD
* @return * @return
*/ */
MultiOrgSomedaySomeParamSummarizingDataDTO selectMultiOrgSomedaySomeParamSummarizingData(ParamSummarizingDataReq paramSummarizingDataReq); MultiOrgSomedaySomeParamSummarizingDataDTO selectMultiOrgSomedaySomeParamSummarizingData(ParamSummarizingDataReq paramSummarizingDataReq);
/**
* 查询某组织下的换热站数量
* @param orgId
* @return
*/
Integer selectSomeOrgHeatExchangeStationCount(@Param("orgId") Long orgId);
/**
* 查询下级部门某图表每天的数据
* @param reportDataReq
* @return
*/
List<MultiOrgSomeReportEverydayData> selectChildOrgSomeReportEverydayDataList(ReportDataReq reportDataReq);
} }

9
lzbi-module/src/main/java/com/lzbi/bi/mapper/ScreenMockDataMapper.java

@ -1,6 +1,7 @@
package com.lzbi.bi.mapper; package com.lzbi.bi.mapper;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.lzbi.bi.domain.req.ParamSummarizingDataReq;
import com.lzbi.bi.domain.vo.MapOrgVO; import com.lzbi.bi.domain.vo.MapOrgVO;
import com.lzbi.common.constant.BizConstants; import com.lzbi.common.constant.BizConstants;
import com.lzbi.bi.domain.dto.SomeOrgSomedayMultiReportDataDTO; import com.lzbi.bi.domain.dto.SomeOrgSomedayMultiReportDataDTO;
@ -180,4 +181,12 @@ public class ScreenMockDataMapper {
result.add(new MapOrgVO(214L, "沈阳国惠低碳", BigDecimal.valueOf(1134))); result.add(new MapOrgVO(214L, "沈阳国惠低碳", BigDecimal.valueOf(1134)));
return result; return result;
} }
public BigDecimal selectSomeOrgSomedaySomeParamSummarizingData(ParamSummarizingDataReq paramSummarizingDataReq) {
return BigDecimal.valueOf(1000);
}
public int selectSomeOrgHeatExchangeStationCount(Long orgId) {
return 50;
}
} }

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

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.bi.domain.DcBusiDataScreenDto; import com.lzbi.bi.domain.DcBusiDataScreenDto;
import com.lzbi.bi.domain.SysDeptLocation; import com.lzbi.bi.domain.SysDeptLocation;
import com.lzbi.bi.domain.dto.MultiOrgSomeReportEverydayData;
import com.lzbi.bi.domain.dto.SomeOrgSomedaySomeParamSummarizingDataDTO; import com.lzbi.bi.domain.dto.SomeOrgSomedaySomeParamSummarizingDataDTO;
import com.lzbi.bi.domain.req.ParamSummarizingDataReq; import com.lzbi.bi.domain.req.ParamSummarizingDataReq;
import com.lzbi.bi.domain.vo.*; import com.lzbi.bi.domain.vo.*;
@ -24,6 +25,7 @@ import com.lzbi.common.utils.bean.BeanUtils;
import com.lzbi.draft.domain.vo.*; import com.lzbi.draft.domain.vo.*;
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.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -54,23 +56,23 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService; private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService;
// @Resource // @Resource
// private ScreenMockDataMapper baseMapper; // private ScreenMockDataMapper baseMapper;
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
/** /**
* 供暖起始日期--月日 * 供暖起始日期--月日
*/ */
private static final String HEATING_START_DATE = "11-01"; private static final String HEATING_START_DATE = "-11-01";
/** /**
* 供暖结束日期--月日 * 供暖结束日期--月日
*/ */
private static final String HEATING_END_DATE = "03-31"; 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_START_DATE = "-04-01";
/** /**
* 非供暖结束日期--月日 * 非供暖结束日期--月日
*/ */
private static final String NO_HEATING_END_DATE = "10-31"; private static final String NO_HEATING_END_DATE = "-10-31";
private static final String GRMJ = "供热面积"; private static final String GRMJ = "供热面积";
private static final String LWMJ = "联网面积"; private static final String LWMJ = "联网面积";
@ -78,7 +80,6 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
private static final String RY = "热源"; private static final String RY = "热源";
private static final String HRZ = "换热站"; private static final String HRZ = "换热站";
private static final String ZMJ = "总面积"; private static final String ZMJ = "总面积";
private static final String ZYH = "总用户";
private static final List<String> SPECIAL_REPORT_LIST; private static final List<String> SPECIAL_REPORT_LIST;
static { static {
@ -89,7 +90,6 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
SPECIAL_REPORT_LIST.add(RY); SPECIAL_REPORT_LIST.add(RY);
SPECIAL_REPORT_LIST.add(HRZ); SPECIAL_REPORT_LIST.add(HRZ);
SPECIAL_REPORT_LIST.add(ZMJ); SPECIAL_REPORT_LIST.add(ZMJ);
SPECIAL_REPORT_LIST.add(ZYH);
} }
/** /**
@ -120,7 +120,6 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
value = baseMapper.selectSomeOrgSomedaySomeParamSummarizingData(paramSummarizingDataReq); value = baseMapper.selectSomeOrgSomedaySomeParamSummarizingData(paramSummarizingDataReq);
break; break;
case AQGR: case AQGR:
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateStr = reportDataReq.getDateYear() + "-" + reportDataReq.getDateMonth() + "-" + reportDataReq.getDateDay(); String dateStr = reportDataReq.getDateYear() + "-" + reportDataReq.getDateMonth() + "-" + reportDataReq.getDateDay();
LocalDate date = LocalDate.parse(dateStr, dateTimeFormatter); LocalDate date = LocalDate.parse(dateStr, dateTimeFormatter);
int year = date.getYear(); int year = date.getYear();
@ -134,21 +133,28 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
LocalDate heatingEndDate = LocalDate.parse(heatingEndDateStr, dateTimeFormatter); LocalDate heatingEndDate = LocalDate.parse(heatingEndDateStr, dateTimeFormatter);
// 如果在非供暖期,就是获取最大值 // 如果在非供暖期,就是获取最大值
if (date.isBefore(noHeatingEndDate) && date.isAfter(noHeatingStartDate)) { if (date.isBefore(noHeatingEndDate) && date.isAfter(noHeatingStartDate)) {
long daysDiff = ChronoUnit.DAYS.between(heatingEndDate, heatingStartDate); long daysDiff = ChronoUnit.DAYS.between(heatingStartDate, heatingEndDate);
value = BigDecimal.valueOf(daysDiff); value = BigDecimal.valueOf(daysDiff + 1);
} else { } else {
long daysDiff = ChronoUnit.DAYS.between(date, heatingStartDate); if (date.isAfter(noHeatingEndDate)) {
value = BigDecimal.valueOf(daysDiff); heatingStartDateStr = year + HEATING_START_DATE;
heatingStartDate = LocalDate.parse(heatingStartDateStr, dateTimeFormatter);
}
long daysDiff = ChronoUnit.DAYS.between(heatingStartDate, date);
value = BigDecimal.valueOf(daysDiff + 1);
} }
break; break;
case RY: case RY:
// iSysDeptService.selectCompany() int ryCount = iSysDeptService.selectSomeTypeChildrenDeptCount(reportDataReq.getOrgId(), BizConstants.DcDeptAttr.HEAT_SOURCE);
value = BigDecimal.valueOf(ryCount);
break; break;
case HRZ: case HRZ:
int hrzCount = baseMapper.selectSomeOrgHeatExchangeStationCount(reportDataReq.getOrgId());
value = BigDecimal.valueOf(hrzCount);
break; break;
case ZMJ: case ZMJ:
break; paramSummarizingDataReq.setTargetModelCode(ParamsModelCodeConstants.开栓已执行);
case ZYH: value = baseMapper.selectSomeOrgSomedaySomeParamSummarizingData(paramSummarizingDataReq);
break; break;
default: default:
break; break;
@ -184,6 +190,28 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
return result; return result;
} }
public List<JSONArray> selectChildrenOrgSomedaySomeReportDataEchartHaveOrgId(ReportDataReq reportDataReq) {
List<JSONArray> result = new ArrayList<>();
List<ChildrenOrgSomedaySomeReportDataVO> data = this.selectChildrenOrgSomedaySomeReportDataList(reportDataReq);
if (!CollectionUtils.isEmpty(data)) {
JSONArray head = new JSONArray();
head.add("name");
JSONArray body = new JSONArray();
body.add(reportDataReq.getReportName());
JSONArray idJsonArr = new JSONArray();
idJsonArr.add("orgId");
data.forEach(item -> {
head.add(item.getOrgName());
body.add(item.getValueResult());
idJsonArr.add(item.getOrgId());
});
result.add(head);
result.add(body);
result.add(idJsonArr);
}
return result;
}
public List<JSONArray> selectChildrenOrgSomedaySomeReportDataEchartStacking(ReportDataReq reportDataReq) { public List<JSONArray> selectChildrenOrgSomedaySomeReportDataEchartStacking(ReportDataReq reportDataReq) {
List<JSONArray> result = new ArrayList<>(); List<JSONArray> result = new ArrayList<>();
List<ChildrenOrgSomedaySomeReportDataVO> data = this.selectChildrenOrgSomedaySomeReportDataList(reportDataReq); List<ChildrenOrgSomedaySomeReportDataVO> data = this.selectChildrenOrgSomedaySomeReportDataList(reportDataReq);
@ -278,6 +306,75 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
return baseMapper.selectMapOrgList(reportDataReq); return baseMapper.selectMapOrgList(reportDataReq);
} }
public List<SomeReportDataRankingVO> selectSomeReportDataRankingList(ReportDataReq reportDataReq) {
List<SomeReportDataRankingVO> result = new ArrayList<>();
this.buildChildrenOrgReportDataReq(reportDataReq);
this.buildHeatingDate(reportDataReq);
List<MultiOrgSomeReportEverydayData> multiOrgSomeReportEverydayDataList = baseMapper.selectChildOrgSomeReportEverydayDataList(reportDataReq);
if (!CollectionUtils.isEmpty(multiOrgSomeReportEverydayDataList)) {
// 排序后的日期列表
List<String> dateSoredList = multiOrgSomeReportEverydayDataList.stream().map(MultiOrgSomeReportEverydayData::getDate).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList());
// 排序后的组织id列表
List<Long> orgIdSoredList = multiOrgSomeReportEverydayDataList.stream().map(MultiOrgSomeReportEverydayData::getOrgId).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList());
// 组织map
Map<Long, String> orgMap = multiOrgSomeReportEverydayDataList.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, MultiOrgSomeReportEverydayData::getOrgName, (v1, v2) -> v2));
// 按日期分组的map
Map<String, List<MultiOrgSomeReportEverydayData>> groupDateMap = multiOrgSomeReportEverydayDataList.stream().collect(groupingBy(MultiOrgSomeReportEverydayData::getDate));
dateSoredList.forEach(date -> {
SomeReportDataRankingVO someReportDataRankingVO = new SomeReportDataRankingVO();
someReportDataRankingVO.setCdate(date);
List<MultiOrgSomeReportEverydayData> data = groupDateMap.get(date);
Map<Long, MultiOrgSomeReportEverydayData> orgIdMap = data.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, item -> item, (v1, v2) -> v1));
List<String> orgNameList = new ArrayList<>();
List<BigDecimal> valueList = new ArrayList<>();
orgIdSoredList.forEach(orgId -> {
orgNameList.add(orgMap.get(orgId));
if (orgIdMap.containsKey(orgId)) {
valueList.add(orgIdMap.get(orgId).getValue());
} else {
valueList.add(null);
}
});
someReportDataRankingVO.setCname(StringUtils.join(orgNameList, ","));
someReportDataRankingVO.setCut(StringUtils.join(valueList, ","));
result.add(someReportDataRankingVO);
});
}
return result;
}
/**
* 构建供暖期
* @param reportDataReq
*/
private void buildHeatingDate(ReportDataReq reportDataReq) {
String dateStr = reportDataReq.getDateYear() + "-" + reportDataReq.getDateMonth() + "-" + reportDataReq.getDateDay();
LocalDate date = LocalDate.parse(dateStr, dateTimeFormatter);
int year = date.getYear();
String noHeatingEndDateStr = year + NO_HEATING_END_DATE;
LocalDate noHeatingEndDate = LocalDate.parse(noHeatingEndDateStr, dateTimeFormatter);
String heatingStartDateStr;
String heatingEndDateStr;
if (date.isAfter(noHeatingEndDate)) {
heatingStartDateStr = year + HEATING_START_DATE;
heatingEndDateStr = dateStr;
reportDataReq.setHeatingStartDate(heatingStartDateStr);
reportDataReq.setHeatingEndDate(heatingEndDateStr);
} else {
heatingStartDateStr = (year - 1) + HEATING_START_DATE;
String noHeatingStartDateStr = year + NO_HEATING_START_DATE;
LocalDate noHeatingStartDate = LocalDate.parse(noHeatingStartDateStr, dateTimeFormatter);
if (date.isAfter(noHeatingStartDate)) {
heatingEndDateStr = year + HEATING_END_DATE;
} else {
heatingEndDateStr = dateStr;
}
}
reportDataReq.setHeatingStartDate(heatingStartDateStr);
reportDataReq.setHeatingEndDate(heatingEndDateStr);
}
/** /**
* 查询某组织某天多图表数据DTO列表 * 查询某组织某天多图表数据DTO列表
* @param reportDataReq * @param reportDataReq

27
lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiMonthPlanBillMasterService.java

@ -11,7 +11,7 @@ import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.SecurityUtils; import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth; import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper; import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper;
import com.lzbi.system.service.impl.SysDeptServiceImpl; import com.lzbi.system.service.ISysDeptService;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
@ -22,6 +22,8 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 月计划单据Service业务层处理 * 月计划单据Service业务层处理
@ -34,7 +36,7 @@ public class DcBusiMonthPlanBillMasterService extends ServiceImpl<DcBusiMonthPla
{ {
@Autowired @Autowired
private SysDeptServiceImpl sysDeptService; private ISysDeptService sysDeptService;
@Resource @Resource
private DcBusiMonthPlanBillSubMapper dcBusiMonthPlanBillSubMapper; private DcBusiMonthPlanBillSubMapper dcBusiMonthPlanBillSubMapper;
@ -77,7 +79,26 @@ public class DcBusiMonthPlanBillMasterService extends ServiceImpl<DcBusiMonthPla
*/ */
public List<DcBusiMonthPlanBillMaster> selectDcBusiMonthPlanBillMasterList(DcBusiMonthPlanBillMaster dcBusiMonthPlanBillMaster) public List<DcBusiMonthPlanBillMaster> selectDcBusiMonthPlanBillMasterList(DcBusiMonthPlanBillMaster dcBusiMonthPlanBillMaster)
{ {
return baseMapper.selectDcBusiMonthPlanBillMasterList(dcBusiMonthPlanBillMaster); List<DcBusiMonthPlanBillMaster> dcBusiMonthPlanBillMasters = baseMapper.selectDcBusiMonthPlanBillMasterList(dcBusiMonthPlanBillMaster);
if (!CollectionUtils.isEmpty(dcBusiMonthPlanBillMasters)) {
List<Long> companyIdList = dcBusiMonthPlanBillMasters.stream().map(DcBusiMonthPlanBillMaster::getCompanyId).collect(Collectors.toList());
List<SysDept> companyList = sysDeptService.getDeptListByDeptIdList(companyIdList);
if (!CollectionUtils.isEmpty(companyList)) {
Map<Long, String> companyMap = companyList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName, (v1, v2) -> v2));
dcBusiMonthPlanBillMasters.forEach(item -> {
item.setCompanyName(companyMap.get(item.getCompanyId()));
});
}
List<Long> oragnizeIdList = dcBusiMonthPlanBillMasters.stream().map(DcBusiMonthPlanBillMaster::getOragnizeId).collect(Collectors.toList());
List<SysDept> oragnizeList = sysDeptService.getDeptListByDeptIdList(oragnizeIdList);
if (!CollectionUtils.isEmpty(oragnizeList)) {
Map<Long, String> oragnizeMap = oragnizeList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName, (v1, v2) -> v2));
dcBusiMonthPlanBillMasters.forEach(item -> {
item.setOrganizeName(oragnizeMap.get(item.getOragnizeId()));
});
}
}
return dcBusiMonthPlanBillMasters;
} }
/** /**

40
lzbi-module/src/main/resources/mapper/DcBusiDataScreenMainMapper.xml

@ -539,4 +539,44 @@
#{orgId} #{orgId}
</foreach> </foreach>
</select> </select>
<select id="selectSomeOrgHeatExchangeStationCount" resultType="java.lang.Integer">
SELECT
count(*)
FROM
dc_base_asset_info t1
INNER JOIN sys_dept t2 ON t1.org_id = t2.dept_id AND t1.asset_level = '30'
WHERE
FIND_IN_SET( #{orgId}, t2.ancestors )
OR t2.dept_id = #{orgId}
ORDER BY
t1.org_id,
t1.asset_code
</select>
<select id="selectChildOrgSomeReportEverydayDataList"
parameterType="com.lzbi.bi.domain.req.ReportDataReq"
resultType="com.lzbi.bi.domain.dto.MultiOrgSomeReportEverydayData">
SELECT
t5.dept_id AS "orgId",
t5.dept_name AS "orgName",
CONCAT( t1.date_year, '-', t1.date_month, '-', t1.date_day ) AS "date",
t1.value_result AS "value"
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name = #{reportName}
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
INNER JOIN sys_dept t5 ON t4.org_id = t5.dept_id
where
t5.parent_id = #{orgId}
AND CONCAT( t1.date_year, '-', t1.date_month, '-', t1.date_day ) &gt;= #{heatingStartDate}
AND CONCAT( t1.date_year, '-', t1.date_month, '-', t1.date_day ) &lt;= #{heatingEndDate}
ORDER BY
date,
orgId
</select>
</mapper> </mapper>
Loading…
Cancel
Save