Browse Source

1、修改定时任务

2、合力的aj-report报表查询方法
develop
bobol 7 months ago
parent
commit
bf9733d8a3
  1. 2
      lzbi-admin/src/main/resources/application-dev.yml
  2. 9
      lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java
  3. 21
      lzbi-common/src/main/java/com/lzbi/common/utils/NumberUtils.java
  4. 2
      lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java
  5. 16
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java
  6. 9
      lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java
  7. 2
      lzbi-module/src/main/java/com/lzbi/common/controller/IOTCommonDataControler.java
  8. 2
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiBillModelMasterController.java
  9. 6
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java
  10. 39
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java
  11. 9
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java
  12. 6
      lzbi-module/src/main/java/com/lzbi/external/controller/ParamsController.java
  13. 2
      lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java
  14. 25
      lzbi-module/src/main/java/com/lzbi/report/controller/AjReportController.java
  15. 36
      lzbi-module/src/main/java/com/lzbi/report/domain/dto/ReportDTO.java
  16. 34
      lzbi-module/src/main/java/com/lzbi/report/domain/query/ReportQuery.java
  17. 19
      lzbi-module/src/main/java/com/lzbi/report/domain/req/ReportReq.java
  18. 28
      lzbi-module/src/main/java/com/lzbi/report/domain/vo/ReportVO.java
  19. 23
      lzbi-module/src/main/java/com/lzbi/report/mapper/AjReportMapper.java
  20. 159
      lzbi-module/src/main/java/com/lzbi/report/service/AjReportService.java
  21. 77
      lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java
  22. 46
      lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java
  23. 6
      lzbi-module/src/main/java/com/lzbi/task/domain/ReadQueryParams.java
  24. 2
      lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml
  25. 60
      lzbi-module/src/main/resources/mapper/report/AjReportMapper.xml
  26. 5
      lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java

2
lzbi-admin/src/main/resources/application-dev.yml

@ -49,7 +49,7 @@ spring:
# 配置一个连接在池中最大生存的时间,单位是毫秒 # 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000 maxEvictableIdleTimeMillis: 900000
# 查询等待时间 # 查询等待时间
# query-timeout: 60000 # ReportQuery-timeout: 60000
# 配置检测连接是否有效 # 配置检测连接是否有效
validationQuery: SELECT 1 validationQuery: SELECT 1
testWhileIdle: true testWhileIdle: true

9
lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java

@ -5,6 +5,15 @@ package com.lzbi.common.constant;
*/ */
public interface BizConstants { public interface BizConstants {
/**
* T指标P参数
*/
interface ColumnType {
String TARGET = "T";
String PARAM = "P";
}
/** /**
* 数据来源;生产IOTwork;计费chargeErperp * 数据来源;生产IOTwork;计费chargeErperp
*/ */

21
lzbi-common/src/main/java/com/lzbi/common/utils/NumberUtils.java

@ -0,0 +1,21 @@
package com.lzbi.common.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class NumberUtils {
public static Double doubleScaleToDouble(Double number, int scale) {
if (null == number || scale < 0) {
return null;
}
return BigDecimal.valueOf(number).setScale(scale, RoundingMode.HALF_EVEN).doubleValue();
}
public static BigDecimal doubleScaleToBigDecimal(Double number, int scale) {
if (null == number || scale < 0) {
return null;
}
return BigDecimal.valueOf(number).setScale(scale, RoundingMode.HALF_EVEN);
}
}

2
lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java

@ -79,7 +79,7 @@ public class DcBusiWorkReadConfigController extends BaseController {
/** /**
* 获取互联参数读取数据对照详细信息 * 获取互联参数读取数据对照详细信息
*/ */
//@PreAuthorize("@ss.hasPermi('asset:assetExtConfig:query')") //@PreAuthorize("@ss.hasPermi('asset:assetExtConfig:ReportQuery')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigById(id)); return success(dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigById(id));

16
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java

@ -25,6 +25,9 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -239,7 +242,18 @@ public class DcBusiHisReportController extends BaseController {
//获取excel数据 1 excel设备参数为列模式 2 excel时间为列模式 3 浏览器设备参数为列模式 //获取excel数据 1 excel设备参数为列模式 2 excel时间为列模式 3 浏览器设备参数为列模式
//注意 excel有最大列数显示255 ,超出列数会报错 //注意 excel有最大列数显示255 ,超出列数会报错
private List<Map<String, Object>> getExcellData(LogTimeThreeQueryParamVo queryVo, int type) { private List<Map<String, Object>> getExcellData(LogTimeThreeQueryParamVo queryVo, int type) {
// 设置头部数据, // 设置头部数据
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startTime = LocalDateTime.parse(queryVo.getBeginTime(), dateTimeFormatter);
LocalDateTime endTime = LocalDateTime.parse(queryVo.getEndTime(), dateTimeFormatter);
LocalDate startDate = startTime.toLocalDate();
LocalDate endDate = endTime.toLocalDate();
if (endDate.isBefore(startDate)) {
throw new RuntimeException("结束日期不能小于开始日期");
}
if (startDate.plusMonths(1L).isBefore(endDate)) {
throw new RuntimeException("日期间隔不能大于1个月");
}
DcDymicHeaderQueryVo dcDymicHeaderQueryVo = new DcDymicHeaderQueryVo(); DcDymicHeaderQueryVo dcDymicHeaderQueryVo = new DcDymicHeaderQueryVo();
dcDymicHeaderQueryVo.setParamModels(queryVo.getQueryParamClass()); dcDymicHeaderQueryVo.setParamModels(queryVo.getQueryParamClass());
dcDymicHeaderQueryVo.setDeviceUuids(queryVo.getDeviceUuids()); dcDymicHeaderQueryVo.setDeviceUuids(queryVo.getDeviceUuids());

9
lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java

@ -7,6 +7,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@ -18,20 +20,25 @@ import java.util.List;
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value = "level3 日志查询参数",description = "") @ApiModel(value = "level3 日志查询参数",description = "")
public class LogTimeThreeQueryParamVo { public class LogTimeThreeQueryParamVo {
/** 开始时间 */ /** 开始时间 */
@ApiModelProperty(name = "开始时间",notes = "") @ApiModelProperty(name = "开始时间",notes = "")
@NotBlank(message = "请选择开始时间")
private String beginTime; private String beginTime;
/** 结束时间 */ /** 结束时间 */
@ApiModelProperty(name = "开始时间",notes = "") @ApiModelProperty(name = "结束时间",notes = "")
@NotBlank(message = "请选择结束时间")
private String endTime; private String endTime;
/** 中台设备UUID */ /** 中台设备UUID */
@ApiModelProperty(name = "中台设备UUID",notes = "") @ApiModelProperty(name = "中台设备UUID",notes = "")
@NotNull(message = "请选择设备")
private List<String> deviceUuids ; private List<String> deviceUuids ;
/** 参数列表 */ /** 参数列表 */
@ApiModelProperty(name = "参数列表",notes = "") @ApiModelProperty(name = "参数列表",notes = "")
private List<String> queryParamCodes ; private List<String> queryParamCodes ;
/** 参数模版列表 */ /** 参数模版列表 */
@ApiModelProperty(name = "参数模版列表",notes = "") @ApiModelProperty(name = "参数模版列表",notes = "")
@NotNull(message = "请选择统计参数")
private List<String> queryParamClass ; private List<String> queryParamClass ;
//private Integer pageNum; //private Integer pageNum;
// private Integer pageSize; // private Integer pageSize;

2
lzbi-module/src/main/java/com/lzbi/common/controller/IOTCommonDataControler.java

@ -45,7 +45,7 @@ public class IOTCommonDataControler extends BaseController{
/** /**
* 根据部门编号获取详细信息 * 根据部门编号获取详细信息
*/ */
//@PreAuthorize("@ss.hasPermi('system:dept:query')") //@PreAuthorize("@ss.hasPermi('system:dept:ReportQuery')")
@GetMapping(value = "/{deptId}") @GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) public AjaxResult getInfo(@PathVariable Long deptId)
{ {

2
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiBillModelMasterController.java

@ -76,7 +76,7 @@ public class DcBusiBillModelMasterController extends BaseController
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class), @ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class),
}) })
// @PreAuthorize("@ss.hasPermi('draft:billModel:query')") // @PreAuthorize("@ss.hasPermi('draft:billModel:ReportQuery')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {

6
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java

@ -127,7 +127,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
} }
@ApiOperation("驳回") @ApiOperation("驳回")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')") @PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:check')")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
}) })
@ -137,7 +137,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
} }
@ApiOperation("审核") @ApiOperation("审核")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')") @PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:check')")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
}) })
@ -148,7 +148,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
} }
@ApiOperation("反审核") @ApiOperation("反审核")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')") @PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:check')")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
}) })

39
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java

@ -1,6 +1,9 @@
package com.lzbi.draft.domain; package com.lzbi.draft.domain;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
import com.lzbi.common.annotation.Excel; import com.lzbi.common.annotation.Excel;
@ -190,6 +193,42 @@ public class DcBusiParamDraftDay extends BaseModuleEntity
private String assetName; private String assetName;
/**最后值 */ /**最后值 */
private Double valLast; private Double valLast;
public void calculate() {
Class<DcBusiParamDraftDay> clazz = DcBusiParamDraftDay.class;
valSum = 0D;
valMax = 0D;
valMin = Double.MAX_VALUE;
valTotal = 0;
try {
for (int i = 1; i <= 24; i++) {
String fieldName = "val" + String.format("%02d", i);
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
Object o = field.get(this);
if (null != o) {
valTotal ++;
Double v = (Double) o;
if (valMax.compareTo(v) < 0) {
valMax = v;
}
if (valMin.compareTo(v) > 0) {
valMin = v;
}
valLast = v;
valSum += v;
}
}
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
valSum = BigDecimal.valueOf(valSum).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
valAvg = BigDecimal.valueOf(valSum / 24).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
if (valMin.equals(Double.MAX_VALUE)) {
valMin = 0D;
}
}
public void setValForSeq(int key,Double value){ public void setValForSeq(int key,Double value){
switch (key){ switch (key){
case 0: case 0:

9
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java

@ -226,6 +226,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
lock.lock(); lock.lock();
try { try {
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo); DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
if (ObjectUtils.isEmpty(master)) {
throw new RuntimeException("审核失败,单据不存在");
}
if ("2".equals(master.getCheckStatus())) { if ("2".equals(master.getCheckStatus())) {
throw new RuntimeException("审核失败,单据已审核"); throw new RuntimeException("审核失败,单据已审核");
} }
@ -247,6 +250,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
try { try {
// 查询审核资产指标调整单主表数据 // 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo); DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
if (ObjectUtils.isEmpty(dcBusiTargetAdjustDayMasterDao)) {
throw new RuntimeException("审核失败,单据不存在");
}
if ("0".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) { if ("0".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) {
throw new RuntimeException("审核失败,单据未提交"); throw new RuntimeException("审核失败,单据未提交");
} }
@ -325,6 +331,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
try { try {
// 查询审核资产指标调整单主表数据 // 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo); DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
if (ObjectUtils.isEmpty(master)) {
throw new RuntimeException("反审核失败,单据不存在");
}
if ("0".equals(master.getCheckStatus())) { if ("0".equals(master.getCheckStatus())) {
throw new RuntimeException("反审核失败,单据未提交"); throw new RuntimeException("反审核失败,单据未提交");
} }

6
lzbi-module/src/main/java/com/lzbi/external/controller/ParamsController.java

@ -24,11 +24,11 @@ public class ParamsController {
} }
/** /**
* 获取供气面积 * 获取多资产供热面积
* @return * @return
*/ */
@PostMapping("/heat-supply-area/multipleAsset") @PostMapping("/heat-supply-area/multipleAsset")
public AjaxResult getGasSupplyArea(@RequestBody List<String> assetCodeList) { public AjaxResult getMultipleAssetSupplyArea(@RequestBody List<String> assetCodeList) {
return AjaxResult.success(paramsService.getGasSupplyArea(assetCodeList)); return AjaxResult.success(paramsService.getMultipleAssetSupplyArea(assetCodeList));
} }
} }

2
lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java

@ -23,7 +23,7 @@ public class ParamsService {
return dcBusiParamDraftDay.getValLast(); return dcBusiParamDraftDay.getValLast();
} }
public Map<String, Double> getGasSupplyArea(List<String> assetCodeList) { public Map<String, Double> getMultipleAssetSupplyArea(List<String> assetCodeList) {
if (CollectionUtils.isEmpty(assetCodeList)) { if (CollectionUtils.isEmpty(assetCodeList)) {
throw new RuntimeException("资产编码列表不能为空"); throw new RuntimeException("资产编码列表不能为空");
} }

25
lzbi-module/src/main/java/com/lzbi/report/controller/AjReportController.java

@ -0,0 +1,25 @@
package com.lzbi.report.controller;
import com.lzbi.report.domain.req.ReportReq;
import com.lzbi.report.domain.vo.ReportVO;
import com.lzbi.report.service.AjReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/report/aj")
public class AjReportController {
@Autowired
private AjReportService ajReportService;
@GetMapping("/heatExchangeStation/data")
public List<Map<String, Object>> getReportDataList(ReportReq reportReq) {
return ajReportService.getReportDataList(reportReq);
}
}

36
lzbi-module/src/main/java/com/lzbi/report/domain/dto/ReportDTO.java

@ -0,0 +1,36 @@
package com.lzbi.report.domain.dto;
import lombok.Data;
@Data
public class ReportDTO {
/**
* 统计单元编码
*/
private String assetCode;
/**
* 统计单元名称
*/
private String assetName;
/**
* 指标/参数编码
*/
private String targetModelCode;
/**
* 分区
*/
private String partition;
/**
* 和值
*/
private Double valSum;
/**
* 有效值数量
*/
private Integer valTotal;
/**
* 最新值
*/
private Double valLast;
}

34
lzbi-module/src/main/java/com/lzbi/report/domain/query/ReportQuery.java

@ -0,0 +1,34 @@
package com.lzbi.report.domain.query;
import lombok.Data;
import java.util.List;
@Data
public class ReportQuery {
/**
* 组织id
*/
private Long orgId;
/**
* 查询日期
*/
private String countDate;
/**
* 统计单元类别
*/
private String assetType;
/**
* 统计单元级别
*/
private String assetLevel;
/**
* 指标/参数模板编码列表
*/
private List<String> targetModelCodeList;
/**
* T指标P参数
*/
private String columnType;
}

19
lzbi-module/src/main/java/com/lzbi/report/domain/req/ReportReq.java

@ -0,0 +1,19 @@
package com.lzbi.report.domain.req;
import lombok.Data;
/**
* 报表查询参数
*/
@Data
public class ReportReq {
/**
* 组织id
*/
private Long orgId;
/**
* 查询日期
*/
private String countDate;
}

28
lzbi-module/src/main/java/com/lzbi/report/domain/vo/ReportVO.java

@ -0,0 +1,28 @@
package com.lzbi.report.domain.vo;
import lombok.Data;
import java.util.Map;
@Data
public class ReportVO {
/**
* 统计单元编码
*/
private String assetCode;
/**
* 统计单元名称
*/
private String assetName;
/**
* 分区
*/
private String partition;
/**
* 供热面积
*/
private Double supplyArea;
private Map<String, Double> values;
}

23
lzbi-module/src/main/java/com/lzbi/report/mapper/AjReportMapper.java

@ -0,0 +1,23 @@
package com.lzbi.report.mapper;
import com.lzbi.report.domain.dto.ReportDTO;
import com.lzbi.report.domain.query.ReportQuery;
import java.util.List;
public interface AjReportMapper {
/**
* 获取统计单元和分区组合字符串列表
* @param reportQuery
* @return concat(assetCode, -, partition)
*/
List<String> getAssetAndPartitionList(ReportQuery reportQuery);
/**
* 获取报表数据列表
* @param reportQuery
* @return
*/
List<ReportDTO> getReportDataList(ReportQuery reportQuery);
}

159
lzbi-module/src/main/java/com/lzbi/report/service/AjReportService.java

@ -0,0 +1,159 @@
package com.lzbi.report.service;
import com.lzbi.common.constant.BizConstants;
import com.lzbi.common.constant.ParamsModelCodeConstants;
import com.lzbi.common.constant.PartitionConstants;
import com.lzbi.common.utils.NumberUtils;
import com.lzbi.external.service.ParamsService;
import com.lzbi.report.domain.dto.ReportDTO;
import com.lzbi.report.domain.query.ReportQuery;
import com.lzbi.report.domain.req.ReportReq;
import com.lzbi.report.mapper.AjReportMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class AjReportService {
@Resource
private AjReportMapper ajReportMapper;
@Autowired
private ParamsService paramsService;
public List<Map<String, Object>> getReportDataList(ReportReq reportReq) {
List<Map<String, Object>> list = new ArrayList<>();
if (StringUtils.isBlank(reportReq.getCountDate())) {
reportReq.setCountDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
List<String> targetModelCodeList = new ArrayList<>(14);
targetModelCodeList.add(ParamsModelCodeConstants.瞬时流量);
targetModelCodeList.add(ParamsModelCodeConstants.瞬时热量);
targetModelCodeList.add(ParamsModelCodeConstants.累计热量);
targetModelCodeList.add(ParamsModelCodeConstants.一次网供温);
targetModelCodeList.add(ParamsModelCodeConstants.一次网回温);
targetModelCodeList.add(ParamsModelCodeConstants.一次网供压);
targetModelCodeList.add(ParamsModelCodeConstants.一次网回压);
targetModelCodeList.add(ParamsModelCodeConstants.二次网供水温);
targetModelCodeList.add(ParamsModelCodeConstants.二次网回水温);
targetModelCodeList.add(ParamsModelCodeConstants.二次网供水压力);
targetModelCodeList.add(ParamsModelCodeConstants.二次网回水压力);
targetModelCodeList.add(ParamsModelCodeConstants.电调阀开度给定);
targetModelCodeList.add(ParamsModelCodeConstants.电调阀开度反馈);
targetModelCodeList.add(ParamsModelCodeConstants.水箱水位计);
ReportQuery reportQuery = new ReportQuery();
reportQuery.setOrgId(reportReq.getOrgId());
reportQuery.setCountDate(reportReq.getCountDate());
reportQuery.setAssetLevel(BizConstants.DcAssetLevel.HEAT_EXCHANGE_STATION);
reportQuery.setAssetType(BizConstants.DcAssetType.COMPUTE);
reportQuery.setColumnType(BizConstants.ColumnType.PARAM);
reportQuery.setTargetModelCodeList(targetModelCodeList);
List<String> assetAndPartitionList = ajReportMapper.getAssetAndPartitionList(reportQuery);
if (CollectionUtils.isEmpty(assetAndPartitionList)) {
throw new RuntimeException("未配置统计单元");
}
List<ReportDTO> reportDataList = ajReportMapper.getReportDataList(reportQuery);
if (CollectionUtils.isEmpty(reportDataList)) {
throw new RuntimeException("无数据");
}
Map<String, List<ReportDTO>> reportDataMap = reportDataList.stream().collect(Collectors.groupingBy(item -> StringUtils.join(item.getAssetCode(), "-", item.getPartition())));
List<String> assetCodeList = reportDataList.stream().map(ReportDTO::getAssetCode).collect(Collectors.toList());
// 获取供热面积
Map<String, Double> multipleAssetSupplyArea = paramsService.getMultipleAssetSupplyArea(assetCodeList);
assetAndPartitionList.forEach(assetAndPartition -> {
if (reportDataMap.containsKey(assetAndPartition)) {
Map<String, Object> reportVO = new HashMap<>();
List<ReportDTO> reportDTOList = reportDataMap.get(assetAndPartition);
String assetCode = reportDTOList.get(0).getAssetCode();
reportVO.put("assetCode", assetCode);
reportVO.put("assetName", reportDTOList.get(0).getAssetName());
reportVO.put("partition", PartitionConstants.partition.get(reportDTOList.get(0).getPartition()));
if (!CollectionUtils.isEmpty(multipleAssetSupplyArea) && multipleAssetSupplyArea.containsKey(assetCode)) {
reportVO.put("supplyArea", multipleAssetSupplyArea.get(assetCode));
}
Map<String, ReportDTO> targetDataMap = reportDTOList.stream().collect(Collectors.toMap(ReportDTO::getTargetModelCode, item -> item, (v1, v2) -> v2));
targetModelCodeList.forEach(targetModelCode -> getValue(reportVO, targetDataMap.get(targetModelCode), targetModelCode));
this.calculateExtraCellValue(reportVO);
list.add(reportVO);
}
});
return list;
}
/**
* 计算其他单元格数值
* @param reportVO
*/
private void calculateExtraCellValue(Map<String, Object> reportVO) {
if (CollectionUtils.isEmpty(reportVO)) {
return;
}
Object b = reportVO.get("supplyArea");
Object d = reportVO.get(ParamsModelCodeConstants.瞬时流量);
Object e = reportVO.get(ParamsModelCodeConstants.瞬时热量);
Object g = reportVO.get(ParamsModelCodeConstants.一次网供温);
Object h = reportVO.get(ParamsModelCodeConstants.一次网回温);
Object i = reportVO.get(ParamsModelCodeConstants.一次网供压);
Object j = reportVO.get(ParamsModelCodeConstants.一次网回压);
Object k = reportVO.get(ParamsModelCodeConstants.二次网供水温);
Object l = reportVO.get(ParamsModelCodeConstants.二次网回水温);
Object m = reportVO.get(ParamsModelCodeConstants.二次网供水压力);
Object n = reportVO.get(ParamsModelCodeConstants.二次网回水压力);
if (null != d && null != e && !e.equals(0D)) {
BigDecimal d1 = BigDecimal.valueOf((Double) d * 1000D);
BigDecimal e1 = BigDecimal.valueOf((Double) e);
reportVO.put("c1", d1.divide(e1, 8, RoundingMode.HALF_EVEN));
}
if (null != b && null != e && !e.equals(0D)) {
BigDecimal b1 = BigDecimal.valueOf((Double) b);
BigDecimal e1 = BigDecimal.valueOf((Double) e);
reportVO.put("c2", e1.divide(b1, 8, RoundingMode.HALF_EVEN).toPlainString());
}
if (null != i && null != j) {
reportVO.put("c3", NumberUtils.doubleScaleToBigDecimal((Double) i - (Double) j, 2));
}
if (null != g && null != h) {
reportVO.put("c4", NumberUtils.doubleScaleToBigDecimal((Double) g - (Double) h, 2));
reportVO.put("c5", NumberUtils.doubleScaleToBigDecimal(((Double) g + (Double) h) / 2, 2));
}
if (null != k && null != l) {
reportVO.put("c6", NumberUtils.doubleScaleToBigDecimal((Double) k - (Double) l, 2));
reportVO.put("c7", NumberUtils.doubleScaleToBigDecimal(((Double) k + (Double) l) / 2, 2));
}
if (null != m && null != n) {
reportVO.put("c8", NumberUtils.doubleScaleToBigDecimal((Double) m - (Double) n, 2));
}
}
private void getValue(Map<String, Object> reportVO, ReportDTO reportDTO, String targetModelCode) {
Double value = null;
if (null != reportDTO) {
switch (reportDTO.getTargetModelCode()) {
case ParamsModelCodeConstants.累计热量:
value = reportDTO.getValLast();
break;
default:
if (null != reportDTO.getValSum() && null != reportDTO.getValTotal() && reportDTO.getValTotal() > 0) {
value = NumberUtils.doubleScaleToDouble(reportDTO.getValSum()/reportDTO.getValTotal(), 2);
}
break;
}
}
reportVO.put(targetModelCode, value);
}
}

77
lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java

@ -1,6 +1,8 @@
package com.lzbi.task; package com.lzbi.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzbi.common.utils.StringUtils; import com.lzbi.common.utils.StringUtils;
import com.lzbi.common.utils.spring.SpringUtils; import com.lzbi.common.utils.spring.SpringUtils;
import com.lzbi.draft.domain.DcBusiParamBillMaster; import com.lzbi.draft.domain.DcBusiParamBillMaster;
@ -10,12 +12,11 @@ import com.lzbi.draft.domain.ParamDraftQueryVo;
import com.lzbi.draft.service.DcBusiParamBillMasterService; import com.lzbi.draft.service.DcBusiParamBillMasterService;
import com.lzbi.draft.service.DcBusiParamBillSubService; import com.lzbi.draft.service.DcBusiParamBillSubService;
import com.lzbi.draft.service.DcBusiParamDraftDayService; import com.lzbi.draft.service.DcBusiParamDraftDayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Comparator; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -24,6 +25,7 @@ import java.util.stream.Collectors;
* TaskParamDfratProcess * TaskParamDfratProcess
* 处理参数底稿表数据 * 处理参数底稿表数据
*/ */
@Slf4j
@Component @Component
public class TaskParamDfratProcess { public class TaskParamDfratProcess {
@ -34,23 +36,48 @@ public class TaskParamDfratProcess {
DcBusiParamDraftDayService dBusiParamDraftDayService = SpringUtils.getBean(DcBusiParamDraftDayService.class); DcBusiParamDraftDayService dBusiParamDraftDayService = SpringUtils.getBean(DcBusiParamDraftDayService.class);
public void doBill(DcBusiParamBillMaster billMasterDao) { public void doBill(DcBusiParamBillMaster billMasterDao) {
if (Objects.isNull(billMasterDao)) {
log.error("单据不存在");
return;
}
DateTime date = DateUtil.date();
DcBusiParamBillSub billSub = new DcBusiParamBillSub(); DcBusiParamBillSub billSub = new DcBusiParamBillSub();
billSub.setBillNo(billMasterDao.getBillNo()); billSub.setBillNo(billMasterDao.getBillNo());
List<DcBusiParamBillSub> dcBusiParamBillSubs = dcBusiParamBillSubService.selectByVo(billSub); List<DcBusiParamBillSub> dcBusiParamBillSubs = dcBusiParamBillSubService.selectByVo(billSub);
Map<String, List<DcBusiParamBillSub>> collect = dcBusiParamBillSubs.stream().collect(Collectors.groupingBy(gp -> gp.getAssetCode() + ":" + gp.getParamCode() + ":" + gp.getFieldCode() + ":" + gp.getCountDate())); if (CollectionUtils.isEmpty(dcBusiParamBillSubs)) {
collect.forEach((key, value) -> { log.error("单据无数据");
String[] s = key.split(":"); return;
DcBusiParamDraftDay queryVo = new DcBusiParamDraftDay(); }
queryVo.setAssetCode(s[0]); List<String> assetCodeList = dcBusiParamBillSubs.stream().map(DcBusiParamBillSub::getAssetCode).collect(Collectors.toList());
queryVo.setParamCode(s[1]); List<String> paramCodeList = dcBusiParamBillSubs.stream().map(DcBusiParamBillSub::getParamCode).collect(Collectors.toList());
queryVo.setParamFieldCode(s[2]); List<String> paramFieldCodeList = dcBusiParamBillSubs.stream().map(DcBusiParamBillSub::getFieldCode).collect(Collectors.toList());
queryVo.setCountDate(s[3]); List<String> countDateList = dcBusiParamBillSubs.stream().map(DcBusiParamBillSub::getCountDate).collect(Collectors.toList());
DcBusiParamDraftDay dcBusiParamDraftDay = Optional.ofNullable(dBusiParamDraftDayService.selectOneByParam(queryVo)).orElse(new DcBusiParamDraftDay()); QueryWrapper<DcBusiParamDraftDay> queryWrapper = new QueryWrapper<>();
queryWrapper.in("param_code", paramCodeList);
queryWrapper.in("asset_code", assetCodeList);
queryWrapper.in("param_field_code", paramFieldCodeList);
queryWrapper.in("count_date", countDateList);
List<DcBusiParamDraftDay> paramDraftDayList = dBusiParamDraftDayService.list(queryWrapper);
Map<String, DcBusiParamDraftDay> paramDraftDayMap;
if (CollectionUtils.isEmpty(paramDraftDayList)) {
log.info("底稿表无数据");
paramDraftDayMap = new HashMap<>();
} else {
paramDraftDayMap = paramDraftDayList.stream().collect(Collectors.toMap(gp -> gp.getAssetCode() + ":" + gp.getParamCode() + ":" + gp.getParamFieldCode() + ":" + gp.getCountDate(), gp -> gp));
}
Map<String, List<DcBusiParamBillSub>> paramBillSubMap = dcBusiParamBillSubs.stream().collect(Collectors.groupingBy(gp -> gp.getAssetCode() + ":" + gp.getParamCode() + ":" + gp.getFieldCode() + ":" + gp.getCountDate()));
List<DcBusiParamDraftDay> insertDataList = new ArrayList<>();
List<DcBusiParamDraftDay> updateDataList = new ArrayList<>();
paramBillSubMap.forEach((key, value) -> {
DcBusiParamDraftDay dcBusiParamDraftDay = Optional.ofNullable(paramDraftDayMap.get(key)).orElse(new DcBusiParamDraftDay());
if (null == dcBusiParamDraftDay.getId()) {
insertDataList.add(dcBusiParamDraftDay);
} else {
updateDataList.add(dcBusiParamDraftDay);
}
List<DcBusiParamBillSub> subs = value.stream().sorted(Comparator.comparing(DcBusiParamBillSub::getCountHour)).collect(Collectors.toList()); List<DcBusiParamBillSub> subs = value.stream().sorted(Comparator.comparing(DcBusiParamBillSub::getCountHour)).collect(Collectors.toList());
subs.forEach(val -> { subs.forEach(val -> {
if (StringUtils.isNull(dcBusiParamDraftDay.getId())) { if (null == dcBusiParamDraftDay.getId()) {
dcBusiParamDraftDay.setCreatedTime(DateUtil.date());
dcBusiParamDraftDay.setCreatedBy("task");
dcBusiParamDraftDay.setParamFieldCode(val.getFieldCode()); dcBusiParamDraftDay.setParamFieldCode(val.getFieldCode());
dcBusiParamDraftDay.setParamCode(val.getParamCode()); dcBusiParamDraftDay.setParamCode(val.getParamCode());
dcBusiParamDraftDay.setCountDate(val.getCountDate()); dcBusiParamDraftDay.setCountDate(val.getCountDate());
@ -63,17 +90,21 @@ public class TaskParamDfratProcess {
dcBusiParamDraftDay.setAssetName(val.getAssetName()); dcBusiParamDraftDay.setAssetName(val.getAssetName());
dcBusiParamDraftDay.setCompanyId(billMasterDao.getCompanyId()); dcBusiParamDraftDay.setCompanyId(billMasterDao.getCompanyId());
dcBusiParamDraftDay.setCompanyName(billMasterDao.getCompanyName()); dcBusiParamDraftDay.setCompanyName(billMasterDao.getCompanyName());
dcBusiParamDraftDay.setValLast(val.getParamValue()); dcBusiParamDraftDay.setCreatedBy("task");
dcBusiParamDraftDay.setCreatedTime(date);
} }
dcBusiParamDraftDay.setUpdatedBy("task");
dcBusiParamDraftDay.setUpdatedTime(DateUtil.date());
dcBusiParamDraftDay.setValForSeq(val.getCountHour(), val.getParamValue()); dcBusiParamDraftDay.setValForSeq(val.getCountHour(), val.getParamValue());
dcBusiParamDraftDay.setValLast(val.getParamValue()); dcBusiParamDraftDay.setUpdatedBy("task");
dcBusiParamDraftDay.setUpdatedTime(date);
}); });
dBusiParamDraftDayService.saveOrUpdate(dcBusiParamDraftDay); dcBusiParamDraftDay.calculate();
}); });
if (!CollectionUtils.isEmpty(insertDataList)) {
dBusiParamDraftDayService.saveBatch(insertDataList);
}
if (!CollectionUtils.isEmpty(updateDataList)) {
dBusiParamDraftDayService.updateBatchById(updateDataList);
}
} }
public void doBills() { public void doBills() {

46
lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java

@ -21,10 +21,7 @@ import com.lzbi.task.service.WorkParamReadService;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -48,6 +45,14 @@ public class TaskWorkParamRead {
DcBusiParamBillMasterService dcBusiParamBillMasterService = SpringUtils.getBean(DcBusiParamBillMasterService.class); DcBusiParamBillMasterService dcBusiParamBillMasterService = SpringUtils.getBean(DcBusiParamBillMasterService.class);
boolean ifLog = false; boolean ifLog = false;
public void runTask(Boolean ifLog, String dateStr) {
this.ifLog = ifLog;
if (StringUtils.isBlank(dateStr)) {
dateStr = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), DatePattern.NORM_DATE_PATTERN);
}
createParamBill(dateStr);
}
public void runTask(Boolean ifLog) { public void runTask(Boolean ifLog) {
this.ifLog = ifLog; this.ifLog = ifLog;
String inDate = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), DatePattern.NORM_DATE_PATTERN); String inDate = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), DatePattern.NORM_DATE_PATTERN);
@ -63,13 +68,28 @@ public class TaskWorkParamRead {
* 从生产数据库获取配置的参数的值 * 从生产数据库获取配置的参数的值
* 按小时及性能分区统计"work" * 按小时及性能分区统计"work"
*/ */
public List<DcBusiWorkReadLog> getWorkReadVo(String inComeDate, List<String> pcl, List<String> dcl) { public List<DcBusiWorkReadLog> getWorkReadVo(String inComeDate, Set<String> pcl) {
List<DcBusiWorkReadLog> dcBusiWorkReadLogs = new ArrayList<>();
ReadQueryParams readQueryParams = new ReadQueryParams(); ReadQueryParams readQueryParams = new ReadQueryParams();
readQueryParams.setBeginTime(inComeDate + " 00:00:00"); readQueryParams.setBeginTime(inComeDate + " 00:00:00");
readQueryParams.setEndTime(inComeDate + " 23:59:59"); readQueryParams.setEndTime(inComeDate + " 23:59:59");
readQueryParams.setParamCodes(pcl); // readQueryParams.setParamCodes(pcl);
readQueryParams.setDeviceCodes(dcl); // readQueryParams.setDeviceCodes(dcl);
List<DcBusiWorkReadLog> dcBusiWorkReadLogs = workParamReadService.readWorkValue(readQueryParams); List<String> paramList = new ArrayList<>(pcl);
int len = paramList.size();
int range = 1000;
int count = len / range;
for (long i = 0; i <= count; i++) {
List<String> partParamList;
if (i < count) {
partParamList = paramList.stream().skip(i * range).limit((i + 1) * range).collect(Collectors.toList());
} else {
partParamList = paramList.stream().skip(i * range).collect(Collectors.toList());
}
readQueryParams.setParamCodes(new HashSet<>(partParamList));
List<DcBusiWorkReadLog> partBusiWorkReadLogs = workParamReadService.readWorkValue(readQueryParams);
dcBusiWorkReadLogs.addAll(partBusiWorkReadLogs);
}
if (ifLog) { if (ifLog) {
readQueryParams.setBeginTime(inComeDate); readQueryParams.setBeginTime(inComeDate);
saveRealLog(dcBusiWorkReadLogs, readQueryParams); saveRealLog(dcBusiWorkReadLogs, readQueryParams);
@ -105,16 +125,16 @@ public class TaskWorkParamRead {
billm.setBillIncomeDate(inComeDate); billm.setBillIncomeDate(inComeDate);
billm.setBillType("2"); billm.setBillType("2");
billm.setCheckType("1"); billm.setCheckType("1");
billm.setCheckStatus("1"); billm.setCheckStatus("0");
List<DcBusiParamBillSub> billSub = new ArrayList<>(); List<DcBusiParamBillSub> billSub = new ArrayList<>();
DcBusiWorkReadConfig dwrc = new DcBusiWorkReadConfig(); DcBusiWorkReadConfig dwrc = new DcBusiWorkReadConfig();
dwrc.setGoalSource(SOURCE); dwrc.setGoalSource(SOURCE);
List<DcBusiWorkReadConfig> dcBusiWorkReadConfigs = dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigList(dwrc); List<DcBusiWorkReadConfig> dcBusiWorkReadConfigs = dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigList(dwrc);
List<String> pcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamCode())).map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList()); Set<String> pcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamCode())).map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toSet());
List<String> dcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamExt1())).map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList()); // Set<String> dcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamExt1())).map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toSet());
List<DcBusiWorkReadLog> listRow = getWorkReadVo(inComeDate, pcl, dcl); List<DcBusiWorkReadLog> listRow = getWorkReadVo(inComeDate, pcl);
final String billNo_c = billNo; final String billNo_c = billNo;
listRow.stream().forEach(item -> { listRow.forEach(item -> {
Optional<DcBusiWorkReadConfig> find = dcBusiWorkReadConfigs.parallelStream().filter(info -> { Optional<DcBusiWorkReadConfig> find = dcBusiWorkReadConfigs.parallelStream().filter(info -> {
if (info.getGoalParamCode().equals(item.getParamCode())) { // && info.getGoalParamExt1().equals(item.getDeviceCode()) if (info.getGoalParamCode().equals(item.getParamCode())) { // && info.getGoalParamExt1().equals(item.getDeviceCode())
return true; return true;

6
lzbi-module/src/main/java/com/lzbi/task/domain/ReadQueryParams.java

@ -5,7 +5,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.Set;
/** /**
* @auth create by Administrator * @auth create by Administrator
@ -25,7 +25,7 @@ public class ReadQueryParams {
@DateTimeFormat(pattern = "yyyy-MM-dd HH") @DateTimeFormat(pattern = "yyyy-MM-dd HH")
private String endTime; private String endTime;
private List<String> deviceCodes; private Set<String> deviceCodes;
private List<String> paramCodes; private Set<String> paramCodes;
} }

2
lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml

@ -121,7 +121,7 @@
<delete id="deleteByParams" parameterType="com.lzbi.task.domain.ReadQueryParams"> <delete id="deleteByParams" parameterType="com.lzbi.task.domain.ReadQueryParams">
delete from dc_busi_work_read_log where date_count=#{beginTime} delete from dc_busi_work_read_log where date_count=#{beginTime}
<if test="deviceCodes != null and deviceCodes.size() > 0"> <if test="deviceCodes != null and deviceCodes.size() > 0">
and device_uuid in and device_code in
<foreach item="item" index="index" collection="deviceCodes" open="(" close=")" separator=","> <foreach item="item" index="index" collection="deviceCodes" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>

60
lzbi-module/src/main/resources/mapper/report/AjReportMapper.xml

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lzbi.report.mapper.AjReportMapper">
<select id="getAssetAndPartitionList"
parameterType="com.lzbi.report.domain.query.ReportQuery"
resultType="java.lang.String">
select
concat(t.asset_code, '-', t.goal_param_ext2)
from
(
select
distinct
t1.asset_code,
t2.goal_param_ext2
from
dc_base_asset_info t1
left join dc_busi_work_read_config t2 on t1.asset_code = t2.asset_code
where
t1.org_id = #{orgId}
and t1.asset_type = #{assetType}
and t1.asset_level = #{assetLevel}
order by
t1.asset_code asc,
t2.goal_param_ext2 asc
) t
</select>
<select id="getReportDataList"
parameterType="com.lzbi.report.domain.query.ReportQuery"
resultType="com.lzbi.report.domain.dto.ReportDTO">
select
t1.asset_code as "assetCode",
t1.asset_name as "assetName",
t2.target_model_code as "targetModelCode",
t3.goal_param_ext2 as "partition",
t4.val_sum as "valSum",
t4.val_total as "valTotal",
t4.val_last as "valLast"
from
dc_base_asset_info t1
left join dc_base_asset_target t2 on t1.asset_code = t2.asset_code
and t2.target_model_code in
<foreach collection="targetModelCodeList" item="targetModelCode" open="(" separator="," close=")">
#{targetModelCode}
</foreach>
and t2.column_type = #{columnType}
left join dc_busi_work_read_config t3 on t2.target_code = t3.asset_param_code
left join dc_busi_param_draft_day t4 on t2.target_code = t4.param_code and t4.count_date = #{countDate}
where
t1.org_id = #{orgId}
and t1.asset_type = #{assetType}
and t1.asset_level = #{assetLevel}
order by
t1.asset_code asc,
t3.goal_param_ext2 asc
</select>
</mapper>

5
lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java

@ -18,10 +18,11 @@ public class SyncIotSystemTask {
/** /**
* 同步参数 * 同步参数
* @param ifLog 是否存入日志 * @param ifLog 是否存入日志
* @param dateStr 同步数据的日期字符串
*/ */
public void syncIotParams(Boolean ifLog) { public void syncIotParams(Boolean ifLog, String dateStr) {
log.info("===========同步IOT参数开始,是否存入日志:{}============", ifLog); log.info("===========同步IOT参数开始,是否存入日志:{}============", ifLog);
taskWorkParamRead.runTask(ifLog); taskWorkParamRead.runTask(ifLog, dateStr);
log.info("===========同步IOT参数结束,是否存入日志:{}============", ifLog); log.info("===========同步IOT参数结束,是否存入日志:{}============", ifLog);
} }
} }

Loading…
Cancel
Save