报告模版配置联调
This commit is contained in:
@@ -20,20 +20,20 @@ public class LineFlowMealDetailVO implements Serializable {
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("监测点对应的设备id")
|
||||
private String DeviceId;
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("监测点对应的设备名称")
|
||||
private String DeviceName;
|
||||
private String deviceName;
|
||||
|
||||
|
||||
@ApiModelProperty("监测点对应的设备IP")
|
||||
private String DeviceIP;
|
||||
private String deviceIP;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String ElectricPowerCompany;
|
||||
private String electricPowerCompany;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String Substation;
|
||||
private String substation;
|
||||
|
||||
@ApiModelProperty("pid")
|
||||
private String pid;
|
||||
|
||||
@@ -842,17 +842,20 @@
|
||||
<select id="getNewDeviceFlowStatistics" resultType="LineFlowMealDetailVO">
|
||||
select t.*,
|
||||
(t.statisValue)/t.flowMeal flowProportion
|
||||
from (SELECT
|
||||
from (
|
||||
SELECT
|
||||
a.id,
|
||||
a.Name name,
|
||||
sub.Name substation,
|
||||
a.level,
|
||||
a.update_Time updateTime,
|
||||
b.run_flag runFlag,
|
||||
b.com_flag comFlag,
|
||||
b.id deviceId,
|
||||
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
|
||||
ifnull(m.Actual_Value,0) statisValue
|
||||
ROUND(ifnull(m.Actual_Value,0)/1024/1024,2) statisValue
|
||||
FROM pq_line a
|
||||
INNER JOIN pq_line sub ON sub.id = a.pid
|
||||
INNER JOIN pq_device b ON a.id = b.id
|
||||
LEFT JOIN cld_month_flow m ON b.id = m.Dev_Id
|
||||
LEFT JOIN cld_dev_meal c ON b.id = c.line_id
|
||||
@@ -863,7 +866,7 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
and
|
||||
a.Create_Time between #{startTime} and #{endTime}
|
||||
m.Time_Id between #{startTime} and #{endTime}
|
||||
and
|
||||
b.Run_Flag != 2
|
||||
) t ORDER BY flowProportion DESC
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public interface RStatLimitTargetMapper extends BaseMapper<RStatLimitTargetDPO> {
|
||||
|
||||
Page<MonitorOverLimitVO> getSumLimitRatePage(Page<RStatLimitRateDPO> p,
|
||||
Page<MonitorOverLimitVO> getSumLimitTargetPage(Page<RStatLimitRateDPO> p,
|
||||
@Param("ids") List<String> lineIndexes,
|
||||
@Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.njcn.harmonic.mapper.RStatLimitTargetMapper">
|
||||
<select id="getSumLimitRatePage" resultType="com.njcn.harmonic.pojo.vo.MonitorOverLimitVO">
|
||||
<select id="getSumLimitTargetPage" resultType="com.njcn.harmonic.pojo.vo.MonitorOverLimitVO">
|
||||
SELECT
|
||||
my_index AS id,
|
||||
SUM(all_time) AS overDay,
|
||||
|
||||
@@ -299,16 +299,17 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
p.setSize(param.getPageSize());
|
||||
p.setCurrent(param.getPageNum());
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
Page<MonitorOverLimitVO> sumLimitRatePage = targetMapper.getSumLimitRatePage(p, lineList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
||||
Page<MonitorOverLimitVO> sumLimitRatePage = targetMapper.getSumLimitTargetPage(p, lineList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||
List<MonitorOverLimitVO> pageRecords = sumLimitRatePage.getRecords();
|
||||
if (CollectionUtils.isEmpty(pageRecords)) {
|
||||
return page;
|
||||
}
|
||||
Map<String, List<MonitorOverLimitVO>> monMap = pageRecords.stream().collect(Collectors.groupingBy(MonitorOverLimitVO::getId));
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.addAll(monMap.keySet());
|
||||
PollutionParamDTO pollutionParamDTO = new PollutionParamDTO();
|
||||
pollutionParamDTO.setLineList(list);
|
||||
List<AreaLineInfoVO> data = lineFeignClient.getBaseLineAreaInfo(list).getData();
|
||||
System.out.println(data);
|
||||
List<OverLimitLineDTO> overLimitLineList = lineFeignClient.getOverLimitLineInfo(pollutionParamDTO).getData();
|
||||
List<RStatLimitTargetDPO> rStatLimitTargetDPOS = targetMapper.selectList(new QueryWrapper<RStatLimitTargetDPO>()
|
||||
.in("r_stat_limit_target_d.my_index", list).between("r_stat_limit_target_d.time_id",DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
||||
@@ -345,7 +346,6 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
// 谐波电压含有率超标天数
|
||||
long volContainOverDay = limitRateDPOS.stream().filter(t -> filterNotQualifiedUharmData(t)).count();
|
||||
// 谐波电流超标天数
|
||||
List<RStatLimitTargetDPO> collect = limitRateDPOS.stream().filter(t -> filterNotQualifiedUharmData(t)).collect(Collectors.toList());
|
||||
long harmCurOverDay = limitRateDPOS.stream().filter(t -> filterNotQualifiedIharmData(t)).count();
|
||||
// 间谐波电压含有率超标天数
|
||||
long intHarmOverDay = limitRateDPOS.stream().filter(t -> filterNotQualifiedInuharmData(t)).count();
|
||||
@@ -536,9 +536,7 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
}
|
||||
|
||||
private boolean filterNotQualifiedUharmData(RStatLimitTargetDPO t) {
|
||||
int i = t.getUharm2Overtime() + t.getUharm3Overtime() + t.getUharm4Overtime() + t.getUharm5Overtime() + t.getUharm6Overtime() + t.getUharm7Overtime() + t.getUharm8Overtime() + t.getUharm9Overtime() + t.getUharm10Overtime() + t.getUharm11Overtime() + t.getUharm12Overtime() + t.getUharm13Overtime() + t.getUharm14Overtime() + t.getUharm15Overtime() + t.getUharm16Overtime() + t.getUharm17Overtime() + t.getUharm18Overtime() + t.getUharm19Overtime() + t.getUharm20Overtime() + t.getUharm21Overtime() + t.getUharm22Overtime() + t.getUharm23Overtime() + t.getUharm24Overtime() + t.getUharm25Overtime();
|
||||
|
||||
if (i>0){
|
||||
if (t.getUharm2Overtime()!=0 || t.getUharm3Overtime()!=0 || t.getUharm4Overtime()!=0 || t.getUharm5Overtime()!=0 || t.getUharm6Overtime()!=0 || t.getUharm7Overtime()!=0 || t.getUharm8Overtime()!=0 || t.getUharm9Overtime()!=0 || t.getUharm10Overtime()!=0 || t.getUharm11Overtime()!=0 ||t.getUharm12Overtime()!=0 || t.getUharm13Overtime()!=0 || t.getUharm14Overtime()!=0 || t.getUharm15Overtime()!=0 || t.getUharm16Overtime()!=0 || t.getUharm17Overtime()!=0 ||t.getUharm18Overtime()!=0 || t.getUharm19Overtime() !=0|| t.getUharm20Overtime()!=0 || t.getUharm21Overtime() !=0|| t.getUharm22Overtime() !=0|| t.getUharm23Overtime() !=0|| t.getUharm24Overtime()!=0 || t.getUharm25Overtime() !=0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -53,10 +53,14 @@ public class EventDictParam {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class DictQueryParam extends BaseParam {
|
||||
@ApiModelProperty("pid")
|
||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hany
|
||||
|
||||
@@ -24,6 +24,9 @@ public class EventReportDictVO implements Serializable {
|
||||
@ApiModelProperty("父节点")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty("父节点名称")
|
||||
private String pidName;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@@ -112,6 +112,22 @@ public class EventDictController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典列表_新
|
||||
* @param dictQueryParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getReportDictList")
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("查询字典列表_新")
|
||||
@ApiImplicitParam(name = "dictQueryParam", value = "查询字典列表实体", required = true)
|
||||
public HttpResult<List<EventReportDictVO>> getReportDictList(@RequestBody EventDictParam.DictQueryParam dictQueryParam){
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
List<EventReportDictVO> res = iEventDictService.getReportDictList(dictQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -137,11 +153,11 @@ public class EventDictController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo
|
||||
@GetMapping("/DictTree")
|
||||
@PostMapping("/DictTree")
|
||||
@ApiOperation("字典树")
|
||||
public HttpResult<List<EventReportDictVO>> getDictTree(){
|
||||
public HttpResult<List<EventReportDictVO>> getDictTree(@RequestParam @Validated String type){
|
||||
String methodDescribe = getMethodDescribe("getDictTree");
|
||||
List<EventReportDictVO> list = iEventDictService.getDictTree();
|
||||
List<EventReportDictVO> list = iEventDictService.getDictTree(type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package com.njcn.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.dto.EventReportDictDTO;
|
||||
import com.njcn.system.pojo.po.ReportDict;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EventDictMapper extends BaseMapper<ReportDict> {
|
||||
|
||||
List<EventReportDictDTO> getAllDict();
|
||||
List<EventReportDictDTO> getAllDict(@Param("type") String type);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<mapper namespace="com.njcn.system.mapper.EventDictMapper">
|
||||
|
||||
<select id="getAllDict" resultType="EventReportDictDTO">
|
||||
SELECT * from report_dict WHERE State = 1
|
||||
SELECT * from report_dict WHERE State = 1 AND Type = #{type}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -40,6 +40,8 @@ public interface IEventDictService {
|
||||
*/
|
||||
Page<ReportDict> getList(EventDictParam.DictQueryParam dictQueryParam);
|
||||
|
||||
List<EventReportDictVO> getReportDictList (EventDictParam.DictQueryParam dictQueryParam);
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -50,6 +52,7 @@ public interface IEventDictService {
|
||||
/**
|
||||
* 获取字典树
|
||||
* @return
|
||||
* @param type
|
||||
*/
|
||||
List<EventReportDictVO> getDictTree();
|
||||
List<EventReportDictVO> getDictTree(String type);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -124,6 +125,51 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
||||
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(dictQueryParam),PageFactory.getPageSize(dictQueryParam)),queryWrapper);
|
||||
}
|
||||
|
||||
public List<EventReportDictVO> getReportDictList (EventDictParam.DictQueryParam dictQueryParam) {
|
||||
QueryWrapper<ReportDict> queryWrapper = new QueryWrapper<>();
|
||||
if (Objects.nonNull(dictQueryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(dictQueryParam.getSearchValue())) {
|
||||
//字典类型表,提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("report_dict.name",dictQueryParam.getSearchValue())
|
||||
.or().like("report_dict.report_describe",dictQueryParam.getSearchValue()));
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(dictQueryParam.getSortBy(), dictQueryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, dictQueryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(dictQueryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "report_dict.update_time");
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("report_dict.state", DataStateEnum.ENABLE.getCode());
|
||||
List<ReportDict> reportAllDicts = this.baseMapper.selectList(queryWrapper);
|
||||
List<ReportDict> reportDicts = new ArrayList<>();
|
||||
reportAllDicts.stream().filter(reportDict -> reportDict.getId().equals(dictQueryParam.getId())).forEach(reportDict -> {
|
||||
reportDicts.add(reportDict);
|
||||
getChild(reportDicts, reportDict, reportAllDicts);
|
||||
});
|
||||
Map<String, String> map = reportAllDicts.stream().collect(Collectors.toMap(ReportDict::getId, ReportDict::getName));
|
||||
List<EventReportDictVO> list = new ArrayList<>();
|
||||
reportDicts.forEach(dict -> {
|
||||
EventReportDictVO dictVO = new EventReportDictVO();
|
||||
BeanUtil.copyProperties(dict, dictVO);
|
||||
dictVO.setPidName(map.get(dict.getPid()));
|
||||
list.add(dictVO);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private void getChild(List<ReportDict> reportDicts, ReportDict reportDict, List<ReportDict> reportAllDicts) {
|
||||
for (ReportDict dict : reportAllDicts) {
|
||||
if (dict.getPid().equals(reportDict.getId())) {
|
||||
reportDicts.add(dict);
|
||||
getChild(reportDicts,dict,reportAllDicts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -137,11 +183,12 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
||||
/**
|
||||
* 获取字典树
|
||||
* @return
|
||||
* @param type
|
||||
*/
|
||||
@Override
|
||||
public List<EventReportDictVO> getDictTree() {
|
||||
public List<EventReportDictVO> getDictTree(String type) {
|
||||
List<EventReportDictVO> list = new ArrayList<>();
|
||||
List<EventReportDictDTO> dictList = eventDictMapper.getAllDict();
|
||||
List<EventReportDictDTO> dictList = eventDictMapper.getAllDict(type);
|
||||
dictList.forEach(item -> {
|
||||
EventReportDictVO dictVO = new EventReportDictVO();
|
||||
BeanUtil.copyProperties(item, dictVO);
|
||||
|
||||
Reference in New Issue
Block a user