区域报告接口

This commit is contained in:
zhuxinyu
2023-04-21 00:38:42 +08:00
parent 4119696ff3
commit 4457b0c076
10 changed files with 73 additions and 20 deletions

View File

@@ -844,24 +844,21 @@
(t.statisValue)/t.flowMeal flowProportion (t.statisValue)/t.flowMeal flowProportion
from ( from (
SELECT SELECT
a.id, device.Name name,
a.Name name,
sub.Name substation, sub.Name substation,
a.level,
m.Time_Id updateTime, m.Time_Id updateTime,
b.run_flag runFlag, b.run_flag runFlag,
b.com_flag comFlag, 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(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
ROUND(ifnull(m.Actual_Value,0)/1024/1024,2) statisValue ROUND(ifnull(m.Actual_Value,0)/1024/1024,2) statisValue
FROM pq_line a FROM cld_month_flow m
INNER JOIN pq_line sub ON sub.id = a.pid INNER JOIN pq_line device ON device.id=m.Dev_Id
INNER JOIN pq_device b ON a.id = b.id INNER JOIN pq_device b ON device.id=b.id
LEFT JOIN cld_month_flow m ON b.id = m.Dev_Id INNER JOIN pq_line sub ON device.pid = sub.id
LEFT JOIN cld_dev_meal c ON b.id = c.line_id LEFT JOIN cld_dev_meal c ON b.id = c.line_id
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
where a.id in where device.id in
<foreach item="item" collection="devs" separator="," open="(" close=")"> <foreach item="item" collection="devs" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>

View File

@@ -6,11 +6,11 @@
SELECT SELECT
ptm.Time_Id AS time, ptm.Time_Id AS time,
IFNULL(COUNT(ptm.Dev_Id),3.14159)AS deviceAbnormalNum IFNULL(COUNT(ptm.Dev_Id),3.14159)AS deviceAbnormalNum
FROM pq_line line FROM pqs_top_msg ptm
INNER JOIN pq_line vol ON line.pid=vol.id INNER JOIN pq_line device ON ptm.Dev_Id = device.Id
INNER JOIN pq_line device ON vol.pid=device.id INNER JOIN pq_line vol ON vol.pid = device.Id
LEFT JOIN pqs_top_msg ptm ON ptm.Dev_Id = device.Id INNER JOIN pq_line line ON line.pid = vol.id
LEFT JOIN pq_line_detail pld ON pld.Id=line.Id INNER JOIN pq_line_detail pld ON pld.Id=line.Id
WHERE WHERE
ptm.State=1 ptm.State=1
AND AND
@@ -19,7 +19,6 @@
AND pld.Line_Grade=#{lineGrade} AND pld.Line_Grade=#{lineGrade}
</if> </if>
GROUP BY ptm.Time_Id GROUP BY ptm.Time_Id
</select> </select>
<select id="getTopMsgDetail" resultType="com.njcn.device.pq.pojo.po.TopMsgPO"> <select id="getTopMsgDetail" resultType="com.njcn.device.pq.pojo.po.TopMsgPO">

View File

@@ -62,5 +62,14 @@ public class EventDictParam {
private String id; private String id;
/**
* 0.监测点模板 1.区域模板
*/
@ApiModelProperty("type")
@NotBlank(message = ValidMessage.DICT_TYPE_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String type;
} }
} }

View File

@@ -33,4 +33,6 @@ public class EventReportDictVO implements Serializable {
@ApiModelProperty("子级") @ApiModelProperty("子级")
List<EventReportDictVO> children; List<EventReportDictVO> children;
private Boolean flag;
} }

View File

@@ -10,6 +10,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.system.pojo.param.EventTemplateParam; import com.njcn.system.pojo.param.EventTemplateParam;
import com.njcn.system.pojo.po.EventTemplate; import com.njcn.system.pojo.po.EventTemplate;
import com.njcn.system.pojo.vo.EventReportDictVO;
import com.njcn.system.pojo.vo.EventTemplateVO; import com.njcn.system.pojo.vo.EventTemplateVO;
import com.njcn.system.service.IEventTemplateService; import com.njcn.system.service.IEventTemplateService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
@@ -155,4 +156,23 @@ public class EventTemplateController extends BaseController{
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_UNEXIST, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_UNEXIST, null, methodDescribe);
} }
} }
/**
* 根据模板id查询关系
* @param id
* @return
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/selectReleation")
@ApiOperation("根据模板id查询关系")
@ApiImplicitParam(name = "id", value = "角色索引", required = true)
public HttpResult<List<EventReportDictVO>> selectReleation(@RequestParam @Validated String id) {
String methodDescribe = getMethodDescribe("selectReleation");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, id);
List<EventReportDictVO> res = iEventTemplateService.selectReleation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
}
} }

View File

@@ -19,9 +19,11 @@ public interface TemplateRelMapper extends BaseMapper<TemplateRel> {
* @param ids * @param ids
* @return * @return
*/ */
List<TemplateRel> selectRelevance(@Param("ids") List<String> ids); List<TemplateRel> selectRelevance (@Param("ids") List<String> ids);
boolean batchInsert(@Param("list") List<TemplateRel> list); boolean batchInsert (@Param("list") List<TemplateRel> list);
boolean deleteByRtId(@Param("rtId") String id); boolean deleteByRtId (@Param("rtId") String id);
List<String> selectReleation (@Param("id") String id);
} }

View File

@@ -25,4 +25,11 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectReleation" resultType="java.lang.String">
SELECT
rd.Name
FROM report_relevancy rr
INNER JOIN report_dict rd ON rr.Rd_Id = rd.Id
WHERE rr.Rt_Id = #{id}
</select>
</mapper> </mapper>

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.system.pojo.param.EventTemplateParam; import com.njcn.system.pojo.param.EventTemplateParam;
import com.njcn.system.pojo.po.EventTemplate; import com.njcn.system.pojo.po.EventTemplate;
import com.njcn.system.pojo.vo.EventReportDictVO;
import com.njcn.system.pojo.vo.EventTemplateVO; import com.njcn.system.pojo.vo.EventTemplateVO;
import java.util.List; import java.util.List;
@@ -51,4 +52,6 @@ public interface IEventTemplateService extends IService<EventTemplate> {
* @return * @return
*/ */
Boolean selectRelevance(List<String> ids); Boolean selectRelevance(List<String> ids);
List<EventReportDictVO> selectReleation (String id);
} }

View File

@@ -143,7 +143,7 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
queryWrapper.orderBy(true, true, "report_dict.update_time"); queryWrapper.orderBy(true, true, "report_dict.update_time");
} }
} }
queryWrapper.eq("report_dict.state", DataStateEnum.ENABLE.getCode()); queryWrapper.eq("report_dict.state", DataStateEnum.ENABLE.getCode()).eq("report_dict.Type",dictQueryParam.getType());
List<ReportDict> reportAllDicts = this.baseMapper.selectList(queryWrapper); List<ReportDict> reportAllDicts = this.baseMapper.selectList(queryWrapper);
List<ReportDict> reportDicts = new ArrayList<>(); List<ReportDict> reportDicts = new ArrayList<>();
reportAllDicts.stream().filter(reportDict -> reportDict.getId().equals(dictQueryParam.getId())).forEach(reportDict -> { reportAllDicts.stream().filter(reportDict -> reportDict.getId().equals(dictQueryParam.getId())).forEach(reportDict -> {

View File

@@ -16,6 +16,7 @@ import com.njcn.system.pojo.param.EventTemplateParam;
import com.njcn.system.pojo.po.EventTemplate; import com.njcn.system.pojo.po.EventTemplate;
import com.njcn.system.pojo.po.ReportTemplate; import com.njcn.system.pojo.po.ReportTemplate;
import com.njcn.system.pojo.po.TemplateRel; import com.njcn.system.pojo.po.TemplateRel;
import com.njcn.system.pojo.vo.EventReportDictVO;
import com.njcn.system.pojo.vo.EventTemplateVO; import com.njcn.system.pojo.vo.EventTemplateVO;
import com.njcn.system.service.IEventTemplateService; import com.njcn.system.service.IEventTemplateService;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
@@ -168,10 +169,23 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
} }
} }
@Override
public List<EventReportDictVO> selectReleation(String id) {
List<EventReportDictVO> list = new ArrayList<>();
List<String> configs = templateRelMapper.selectReleation(id);
configs.forEach(config -> {
EventReportDictVO eventReportDictVO = new EventReportDictVO();
eventReportDictVO.setName(config);
eventReportDictVO.setFlag(true);
list.add(eventReportDictVO);
});
return list;
}
/** /**
* 名称重复校验 * 名称重复校验
*/ */
private void checkName(EventTemplateParam eventTemplateParam,boolean flag){ private void checkName(EventTemplateParam eventTemplateParam,boolean flag) {
LambdaQueryWrapper<EventTemplate> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EventTemplate> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(EventTemplate::getName,eventTemplateParam.getName()) lambdaQueryWrapper.eq(EventTemplate::getName,eventTemplateParam.getName())
.eq(EventTemplate::getType,eventTemplateParam.getType()); .eq(EventTemplate::getType,eventTemplateParam.getType());