zhousq
11 months ago
30 changed files with 1301 additions and 327 deletions
@ -0,0 +1,19 @@ |
|||
package com.lzbi.common.config; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 指标模板 |
|||
*/ |
|||
@Data |
|||
@Component |
|||
@ConfigurationProperties(prefix = "target-model") |
|||
public class TargetModelConfig { |
|||
|
|||
/** |
|||
* 用户 |
|||
*/ |
|||
private String user; |
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.lzbi.bi.controller; |
|||
|
|||
import com.lzbi.bi.domain.DcBusDataScreenNewReq; |
|||
import com.lzbi.bi.service.DcBusiDataScreenNewService; |
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 大屏控制器 |
|||
* @author : lienbo |
|||
* @date : 2023-12-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/assetData/dataScreenNew") |
|||
public class DcBusiDataScreenNewController extends BaseController { |
|||
|
|||
@Autowired |
|||
private DcBusiDataScreenNewService dcBusiDataScreenNewService; |
|||
|
|||
/** |
|||
* 用户总览 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/userOverview") |
|||
public AjaxResult userOverview (@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getUserOverview(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 供/回水均温 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/provideAnswerWaterAverageTemperature") |
|||
public AjaxResult provideAnswerWaterAverageTemperature(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getProvideAnswerWaterAverageTemperature(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
/** |
|||
* 锅炉统计 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/boilerStatistics") |
|||
public AjaxResult boilerStatistics(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getBoilerStatistics(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
/** |
|||
* 消耗 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/consumeStatistics") |
|||
public AjaxResult consumeStatistics(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getConsumesStatistics(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
/** |
|||
* 发热量 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/calorificValue") |
|||
public AjaxResult calorificValue(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getCalorificValue(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
/** |
|||
* 供热量 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/heatSupplied") |
|||
public AjaxResult heatSupplied(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getHeatSupplied(dcBusDataScreenNewReq)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 公司统计 |
|||
* @param dcBusDataScreenNewReq |
|||
* @return |
|||
*/ |
|||
@GetMapping("/corporateStatistics") |
|||
public AjaxResult corporateStatistics(@Validated DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
return success(dcBusiDataScreenNewService.getCorporateStatistics(dcBusDataScreenNewReq)); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 锅炉统计结果 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class BoilerStatisticsVO { |
|||
|
|||
private String label; |
|||
|
|||
private BigDecimal value; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 发热量 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class CalorificValueVO { |
|||
|
|||
private String label; |
|||
|
|||
/** |
|||
* 值 |
|||
*/ |
|||
private BigDecimal value; |
|||
|
|||
/** |
|||
* 百分比 |
|||
*/ |
|||
private double percentage; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 消耗统计结果 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ConsumesStatisticsVO { |
|||
|
|||
private String label; |
|||
|
|||
/** |
|||
* 水耗 |
|||
*/ |
|||
private BigDecimal water; |
|||
/** |
|||
* 电耗 |
|||
*/ |
|||
private BigDecimal electricity; |
|||
/** |
|||
* 煤耗 |
|||
*/ |
|||
private BigDecimal coal; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 公司统计 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class CorporateStatisticsVO { |
|||
|
|||
/** |
|||
* 面积 |
|||
*/ |
|||
private BigDecimal acreage; |
|||
|
|||
/** |
|||
* 发电量 |
|||
*/ |
|||
private BigDecimal outputOfPlant; |
|||
|
|||
/** |
|||
* 产热量 |
|||
*/ |
|||
private BigDecimal calorificValue; |
|||
|
|||
/** |
|||
* 供热量 |
|||
*/ |
|||
private BigDecimal heatSupplied; |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* 大屏请求参数 |
|||
*/ |
|||
@Data |
|||
public class DcBusDataScreenNewReq { |
|||
|
|||
/** |
|||
* 公司id |
|||
*/ |
|||
@NotNull(message = "请选择公司") |
|||
private Long companyId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private Long orgId; |
|||
|
|||
/** |
|||
* 指标编码 |
|||
*/ |
|||
private String targetCode; |
|||
|
|||
/** |
|||
* 年月日(yyyy-MM-dd) |
|||
*/ |
|||
@NotBlank(message = "请选择年月日") |
|||
private String yearMonthDay; |
|||
|
|||
private String year; |
|||
|
|||
private String month; |
|||
|
|||
private String day; |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 供热量 |
|||
*/ |
|||
@Data |
|||
public class HeatSuppliedVO { |
|||
|
|||
private List<String> labelArr; |
|||
|
|||
private List<BigDecimal> valueArr; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
public class ProvideAnswerWaterAverageTemperatureDTO { |
|||
|
|||
private String title; |
|||
|
|||
private BigDecimal provideWaterAverageTemperature; |
|||
|
|||
private BigDecimal answerWaterAverageTemperature; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 供、回水均温结果 |
|||
*/ |
|||
@Data |
|||
public class ProvideAnswerWaterAverageTemperatureVO { |
|||
|
|||
/** |
|||
* x轴 |
|||
*/ |
|||
private List<String> xArr; |
|||
|
|||
/** |
|||
* 供水均温 |
|||
*/ |
|||
private List<BigDecimal> yArr1; |
|||
|
|||
/** |
|||
* 回水均温 |
|||
*/ |
|||
private List<BigDecimal> yArr2; |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "ProvideAnswerWaterAverageTemperatureVO{" + |
|||
"xArr=" + xArr + |
|||
", yArr1=" + yArr1 + |
|||
", yArr2=" + yArr2 + |
|||
'}'; |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.lzbi.bi.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 用户总览结果 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UserIOverViewVO { |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 总值 |
|||
*/ |
|||
private BigDecimal total; |
|||
|
|||
/** |
|||
* 实际值 |
|||
*/ |
|||
private BigDecimal real; |
|||
} |
@ -0,0 +1,4 @@ |
|||
package com.lzbi.bi.mapper; |
|||
|
|||
public interface DcBusiDataScreenNewMapper { |
|||
} |
@ -0,0 +1,154 @@ |
|||
package com.lzbi.bi.service; |
|||
|
|||
import com.lzbi.bi.domain.*; |
|||
import com.lzbi.common.config.TargetModelConfig; |
|||
import com.lzbi.common.utils.bean.BeanUtils; |
|||
import com.lzbi.draft.domain.DcBusiTargetDraftDay; |
|||
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper; |
|||
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.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 大屏业务 |
|||
* @author : lienbo |
|||
* @date : 2023-12-14 |
|||
*/ |
|||
@Service |
|||
public class DcBusiDataScreenNewService { |
|||
|
|||
@Autowired |
|||
private TargetModelConfig targetModelConfig; |
|||
|
|||
@Resource |
|||
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper; |
|||
|
|||
public List<UserIOverViewVO> getUserOverview(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
List<UserIOverViewVO> list = new ArrayList<>(); |
|||
// list.add(new UserIOverViewVO("热源1", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
|
|||
// list.add(new UserIOverViewVO("热源2", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
|
|||
// list.add(new UserIOverViewVO("热源3", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
|
|||
// list.add(new UserIOverViewVO("热源4", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
|
|||
DcBusiTargetDraftDay params = new DcBusiTargetDraftDay(); |
|||
BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq); |
|||
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay(); |
|||
String[] yearMonthDayArr = yearMonthDay.split("-"); |
|||
params.setCountYear(yearMonthDayArr[0]); |
|||
params.setCountMonth(yearMonthDayArr[1]); |
|||
params.setTargetCode(targetModelConfig.getUser()); |
|||
List<DcBusiTargetDraftDay> dcBusiTargetDraftDayList = dcBusiTargetDraftDayMapper.selectDcBusiTargetDraftDayList(params); |
|||
if (CollectionUtils.isNotEmpty(dcBusiTargetDraftDayList)) { |
|||
Map<Object, List<DcBusiTargetDraftDay>> map; |
|||
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) { |
|||
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getOrgId)); |
|||
} else { |
|||
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getAssetCode)); |
|||
} |
|||
Class<DcBusiTargetDraftDay> dcBusiTargetDraftMonthClass = DcBusiTargetDraftDay.class; |
|||
map.forEach((key, value) -> { |
|||
UserIOverViewVO userIOverViewVO = new UserIOverViewVO(); |
|||
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) { |
|||
userIOverViewVO.setTitle(value.get(0).getOrgName()); |
|||
} else { |
|||
userIOverViewVO.setTitle(value.get(0).getAssetName()); |
|||
} |
|||
BigDecimal plan = new BigDecimal(0); |
|||
BigDecimal sum = new BigDecimal(0); |
|||
for (int i = 0, len = value.size(); i < len; i++) { |
|||
plan = plan.add(value.get(i).getValPlan()); |
|||
sum = sum.add(value.get(i).getValSum()); |
|||
} |
|||
userIOverViewVO.setTotal(plan); |
|||
userIOverViewVO.setReal(sum); |
|||
list.add(userIOverViewVO); |
|||
}); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
public ProvideAnswerWaterAverageTemperatureVO getProvideAnswerWaterAverageTemperature(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
ProvideAnswerWaterAverageTemperatureVO provideAnswerWaterAverageTemperatureVO = new ProvideAnswerWaterAverageTemperatureVO(); |
|||
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay(); |
|||
String[] yearMonthDayArr = yearMonthDay.split("-"); |
|||
dcBusDataScreenNewReq.setYear(yearMonthDayArr[0]); |
|||
dcBusDataScreenNewReq.setMonth(yearMonthDayArr[1]); |
|||
List<ProvideAnswerWaterAverageTemperatureDTO> provideAnswerWaterAverageTemperatureDTOS = dcBusiTargetDraftDayMapper.selectProvideAnswerWaterAverageTemperatureList(dcBusDataScreenNewReq); |
|||
if (CollectionUtils.isNotEmpty(provideAnswerWaterAverageTemperatureDTOS)) { |
|||
List<String> xArr = new ArrayList<>(); |
|||
List<BigDecimal> yArr1 = new ArrayList<>(); |
|||
List<BigDecimal> yArr2 = new ArrayList<>(); |
|||
provideAnswerWaterAverageTemperatureDTOS.forEach(value -> { |
|||
xArr.add(value.getTitle()); |
|||
yArr1.add(value.getProvideWaterAverageTemperature()); |
|||
yArr2.add(value.getAnswerWaterAverageTemperature()); |
|||
}); |
|||
provideAnswerWaterAverageTemperatureVO.setXArr(xArr); |
|||
provideAnswerWaterAverageTemperatureVO.setYArr1(yArr1); |
|||
provideAnswerWaterAverageTemperatureVO.setYArr2(yArr2); |
|||
} |
|||
return provideAnswerWaterAverageTemperatureVO; |
|||
} |
|||
|
|||
public List<BoilerStatisticsVO> getBoilerStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
List<BoilerStatisticsVO> list = new ArrayList<>(); |
|||
list.add(new BoilerStatisticsVO("热源1", BigDecimal.valueOf(248776))); |
|||
list.add(new BoilerStatisticsVO("热源2", BigDecimal.valueOf(248776))); |
|||
list.add(new BoilerStatisticsVO("热源3", BigDecimal.valueOf(248776))); |
|||
return list; |
|||
} |
|||
|
|||
public List<ConsumesStatisticsVO> getConsumesStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
List<ConsumesStatisticsVO> list = new ArrayList<>(); |
|||
list.add(new ConsumesStatisticsVO("热源1", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) )); |
|||
list.add(new ConsumesStatisticsVO("热源2", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) )); |
|||
list.add(new ConsumesStatisticsVO("热源3", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) )); |
|||
list.add(new ConsumesStatisticsVO("热源4", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) )); |
|||
list.add(new ConsumesStatisticsVO("热源5", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) )); |
|||
return list; |
|||
} |
|||
|
|||
public List<CalorificValueVO> getCalorificValue(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
List<CalorificValueVO> list = new ArrayList<>(); |
|||
list.add(new CalorificValueVO("热源1", BigDecimal.valueOf(7897), 17)); |
|||
list.add(new CalorificValueVO("热源2", BigDecimal.valueOf(9766), 21)); |
|||
list.add(new CalorificValueVO("热源3", BigDecimal.valueOf(5571), 12)); |
|||
list.add(new CalorificValueVO("热源4", BigDecimal.valueOf(7897), 17)); |
|||
list.add(new CalorificValueVO("热源5", BigDecimal.valueOf(9766), 21)); |
|||
list.add(new CalorificValueVO("热源6", BigDecimal.valueOf(5571), 12)); |
|||
return list; |
|||
} |
|||
|
|||
public HeatSuppliedVO getHeatSupplied(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
HeatSuppliedVO heatSuppliedVO = new HeatSuppliedVO(); |
|||
List<String> labelArr = new ArrayList<>(); |
|||
List<BigDecimal> valueArr = new ArrayList<>(); |
|||
labelArr.add("热源1"); |
|||
labelArr.add("热源2"); |
|||
labelArr.add("热源3"); |
|||
labelArr.add("热源4"); |
|||
labelArr.add("热源5"); |
|||
labelArr.add("热源6"); |
|||
valueArr.add(BigDecimal.valueOf(300)); |
|||
valueArr.add(BigDecimal.valueOf(500)); |
|||
valueArr.add(BigDecimal.valueOf(300)); |
|||
valueArr.add(BigDecimal.valueOf(100)); |
|||
valueArr.add(BigDecimal.valueOf(500)); |
|||
valueArr.add(BigDecimal.valueOf(100)); |
|||
heatSuppliedVO.setLabelArr(labelArr); |
|||
heatSuppliedVO.setValueArr(valueArr); |
|||
return heatSuppliedVO; |
|||
} |
|||
|
|||
public CorporateStatisticsVO getCorporateStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) { |
|||
CorporateStatisticsVO corporateStatisticsVO = new CorporateStatisticsVO(); |
|||
return new CorporateStatisticsVO(BigDecimal.valueOf(3820), BigDecimal.valueOf(3820), BigDecimal.valueOf(3820), BigDecimal.valueOf(3820)); |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.lzbi.draft.controller; |
|||
|
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.draft.entity.req.TargetDraftMonthReportReq; |
|||
import com.lzbi.draft.entity.vo.TargetDraftMonthReportVO; |
|||
import com.lzbi.draft.service.ReportService; |
|||
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; |
|||
|
|||
/** |
|||
* 报表Controller |
|||
* |
|||
* @author lienbo |
|||
* @date 2023-12-12 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/report") |
|||
public class ReportController { |
|||
|
|||
@Autowired |
|||
private ReportService reportService; |
|||
|
|||
@GetMapping("/targetDraftMonthReport") |
|||
public List<TargetDraftMonthReportVO> targetDraftMonthReport(TargetDraftMonthReportReq targetDraftMonthReportReq) { |
|||
return reportService.getTargetDraftMonthReport(targetDraftMonthReportReq); |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.lzbi.draft.entity.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 月指标报表查询dto |
|||
*/ |
|||
@Data |
|||
public class TargetDraftMonthReportValueDTO { |
|||
|
|||
/** |
|||
* 统计单元编码 |
|||
*/ |
|||
private String assetCode; |
|||
|
|||
/** |
|||
* 值 |
|||
*/ |
|||
private BigDecimal value; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.lzbi.draft.entity.req; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class TargetDraftMonthReportReq { |
|||
|
|||
/** |
|||
* 指标模型编码数组 |
|||
*/ |
|||
public static final String[] TARGET_MODEL_CODE_ARR = new String[]{"MJ01","SSLL01","SSRL01","LJRL01","GW01","HW01","GY01","HY01","GW02","HW02","GY02","HY02","FMGD01","FMFK01","SXSW01","YCGJ01","CNFS01","KGM201","JGM201","YC01","WC01","JW01","WC02","EJW01","YC02"}; |
|||
|
|||
/** |
|||
* 公司id |
|||
*/ |
|||
private Long companyId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private Long orgId; |
|||
|
|||
/** |
|||
* 专业编码 |
|||
*/ |
|||
private String fieldCode; |
|||
|
|||
/** |
|||
* 年 |
|||
*/ |
|||
private String year; |
|||
|
|||
/** |
|||
* 月 |
|||
*/ |
|||
private String month; |
|||
|
|||
/** |
|||
* 指标模型编码 |
|||
*/ |
|||
private String targetModelCode; |
|||
} |
@ -0,0 +1,144 @@ |
|||
package com.lzbi.draft.entity.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
public class TargetDraftMonthReportVO { |
|||
|
|||
/** |
|||
* 统计单元编码 |
|||
*/ |
|||
private String assetCode; |
|||
|
|||
/** |
|||
* 统计单元名称 |
|||
*/ |
|||
private String assetName; |
|||
|
|||
/** |
|||
* 面积 |
|||
*/ |
|||
private BigDecimal MJ01; |
|||
|
|||
/** |
|||
* 瞬时流量 |
|||
*/ |
|||
private BigDecimal SSLL01; |
|||
|
|||
/** |
|||
* 瞬时热量 |
|||
*/ |
|||
private BigDecimal SSRL01; |
|||
|
|||
/** |
|||
* 累计热量 |
|||
*/ |
|||
private BigDecimal LJRL01; |
|||
|
|||
/** |
|||
* 供温 |
|||
*/ |
|||
private BigDecimal GW01; |
|||
|
|||
/** |
|||
* 回温 |
|||
*/ |
|||
private BigDecimal HW01; |
|||
|
|||
/** |
|||
* 供压 |
|||
*/ |
|||
private BigDecimal GY01; |
|||
|
|||
/** |
|||
* 回压 |
|||
*/ |
|||
private BigDecimal HY01; |
|||
|
|||
/** |
|||
* 供温 |
|||
*/ |
|||
private BigDecimal GW02; |
|||
|
|||
/** |
|||
* 回温 |
|||
*/ |
|||
private BigDecimal HW02; |
|||
|
|||
/** |
|||
* 供压 |
|||
*/ |
|||
private BigDecimal GY02; |
|||
|
|||
/** |
|||
* 回压 |
|||
*/ |
|||
private BigDecimal HY02; |
|||
|
|||
/** |
|||
* 阀门给定 |
|||
*/ |
|||
private BigDecimal FMGD01; |
|||
|
|||
/** |
|||
* 阀门反馈 |
|||
*/ |
|||
private BigDecimal FMFK01; |
|||
|
|||
/** |
|||
* 水箱水位 |
|||
*/ |
|||
private BigDecimal SXSW01; |
|||
|
|||
/** |
|||
* 一次管径 |
|||
*/ |
|||
private BigDecimal YCGJ01; |
|||
|
|||
/** |
|||
* 采暖方式 |
|||
*/ |
|||
private BigDecimal CNFS01; |
|||
|
|||
/** |
|||
* KG/㎡ |
|||
*/ |
|||
private BigDecimal KGM201; |
|||
|
|||
/** |
|||
* JG/㎡ |
|||
*/ |
|||
private BigDecimal JGM201; |
|||
|
|||
/** |
|||
* 压差 |
|||
*/ |
|||
private BigDecimal YC01; |
|||
|
|||
/** |
|||
* 温差 |
|||
*/ |
|||
private BigDecimal WC01; |
|||
|
|||
/** |
|||
* 均温 |
|||
*/ |
|||
private BigDecimal JW01; |
|||
|
|||
/** |
|||
* 温差 |
|||
*/ |
|||
private BigDecimal WC02; |
|||
|
|||
/** |
|||
* 二均温 |
|||
*/ |
|||
private BigDecimal EJW01; |
|||
|
|||
/** |
|||
* 压差 |
|||
*/ |
|||
private BigDecimal YC02; |
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.lzbi.draft.service; |
|||
|
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.lzbi.draft.entity.dto.TargetDraftMonthReportValueDTO; |
|||
import com.lzbi.draft.entity.req.TargetDraftMonthReportReq; |
|||
import com.lzbi.draft.entity.vo.TargetDraftMonthReportVO; |
|||
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.lang.reflect.Field; |
|||
import java.util.List; |
|||
import java.util.concurrent.CountDownLatch; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class ReportService { |
|||
|
|||
@Resource |
|||
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper; |
|||
|
|||
@Autowired |
|||
private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
|||
|
|||
public List<TargetDraftMonthReportVO> getTargetDraftMonthReport(TargetDraftMonthReportReq targetDraftMonthReportReq) { |
|||
Class<TargetDraftMonthReportVO> targetDraftMonthReportVOClass = TargetDraftMonthReportVO.class; |
|||
List<TargetDraftMonthReportVO> list = dcBusiTargetDraftDayMapper.selectTargetDraftMonthReportVO(targetDraftMonthReportReq); |
|||
CountDownLatch countDownLatch = new CountDownLatch(TargetDraftMonthReportReq.TARGET_MODEL_CODE_ARR.length); |
|||
for (String targetModelCode : TargetDraftMonthReportReq.TARGET_MODEL_CODE_ARR) { |
|||
threadPoolTaskExecutor.execute(() -> { |
|||
TargetDraftMonthReportReq req = JSONObject.parseObject(JSONObject.toJSONString(targetDraftMonthReportReq), TargetDraftMonthReportReq.class); |
|||
req.setTargetModelCode(targetModelCode); |
|||
List<TargetDraftMonthReportValueDTO> targetDraftMonthReportValueDTOS = dcBusiTargetDraftDayMapper.selectTargetDraftMonthReportValue(req); |
|||
log.info("{} 执行完成,结果是 {}", targetModelCode, targetDraftMonthReportValueDTOS); |
|||
for (int i = 0, len = list.size(); i < len; i++) { |
|||
TargetDraftMonthReportVO targetDraftMonthReportVO = list.get(i); |
|||
for (int j = targetDraftMonthReportValueDTOS.size() - 1; j >= 0; j--) { |
|||
TargetDraftMonthReportValueDTO targetDraftMonthReportValueDTO = targetDraftMonthReportValueDTOS.get(j); |
|||
if (targetDraftMonthReportVO.getAssetCode().equals(targetDraftMonthReportValueDTO.getAssetCode())) { |
|||
try { |
|||
Field declaredField = targetDraftMonthReportVOClass.getDeclaredField(targetModelCode); |
|||
if (!declaredField.isAccessible()) { |
|||
declaredField.setAccessible(true); |
|||
} |
|||
declaredField.set(targetDraftMonthReportVO, targetDraftMonthReportValueDTO.getValue()); |
|||
} catch (NoSuchFieldException | IllegalAccessException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
targetDraftMonthReportValueDTOS.remove(j); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
countDownLatch.countDown(); |
|||
}); |
|||
} |
|||
try { |
|||
countDownLatch.await(); |
|||
} catch (InterruptedException e) { |
|||
log.error("门闩异常", e); |
|||
} |
|||
return list; |
|||
} |
|||
} |
Loading…
Reference in new issue