Commit af330ea3 authored by 李秀明's avatar 李秀明

feat: 预警接口增加请求参数

parent fa923e44
...@@ -28,14 +28,14 @@ public interface IMcbWarningService { ...@@ -28,14 +28,14 @@ public interface IMcbWarningService {
* *
* @return 预警信息列表 * @return 预警信息列表
*/ */
Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus); Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/** /**
* 预警信息总数 * 预警信息总数
* *
* @return 预警信息总数 * @return 预警信息总数
*/ */
Long queryWarningCount(Integer processingStatus); Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/** /**
* 问题信息列表 * 问题信息列表
......
...@@ -94,6 +94,16 @@ ...@@ -94,6 +94,16 @@
<if test="processingStatus != null"> <if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus} AND log.PROCESSING_STATUS = #{processingStatus}
</if> </if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where> </where>
ORDER BY ORDER BY
log.CREATE_DATE DESC log.CREATE_DATE DESC
...@@ -117,6 +127,16 @@ ...@@ -117,6 +127,16 @@
<if test="processingStatus != null"> <if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus} AND log.PROCESSING_STATUS = #{processingStatus}
</if> </if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where> </where>
</select> </select>
......
...@@ -45,16 +45,23 @@ public class McbWarningController { ...@@ -45,16 +45,23 @@ public class McbWarningController {
@GetMapping(value = "/warning/page") @GetMapping(value = "/warning/page")
public ResponseModel<Page<Map<String, Object>>> queryWarningPage(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber, public ResponseModel<Page<Map<String, Object>>> queryWarningPage(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize, @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
@RequestParam(value = "processingStatus", required = false) Integer processingStatus) { @RequestParam(value = "processingStatus", required = false) Integer processingStatus,
@RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize); Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
return ResponseHelper.buildResponse(mcbWarningService.queryWarningPage(page, processingStatus)); return ResponseHelper.buildResponse(mcbWarningService.queryWarningPage(page, processingStatus, eventLevel, createDate, warningSourceType));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息总数", notes = "[监测总览]预警信息总数") @ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息总数", notes = "[监测总览]预警信息总数")
@GetMapping(value = "/warning/count") @GetMapping(value = "/warning/count")
public ResponseModel<Map<String, Object>> queryWarningCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus) { public ResponseModel<Map<String, Object>> queryWarningCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus,
Long count = mcbWarningService.queryWarningCount(processingStatus); @RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType) {
Long count = mcbWarningService.queryWarningCount(processingStatus, eventLevel, createDate, warningSourceType);
Map<String, Object> result = new HashMap<String, Object>() {{ Map<String, Object> result = new HashMap<String, Object>() {{
this.put("count", count); this.put("count", count);
}}; }};
......
...@@ -37,7 +37,10 @@ public interface McbWarningMapper extends BaseMapper { ...@@ -37,7 +37,10 @@ public interface McbWarningMapper extends BaseMapper {
@Param("start") Long start, @Param("start") Long start,
@Param("offset") Long offset, @Param("offset") Long offset,
@Param("projectOrgCodes") List<String> projectOrgCodes, @Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus @Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
); );
/** /**
...@@ -47,7 +50,10 @@ public interface McbWarningMapper extends BaseMapper { ...@@ -47,7 +50,10 @@ public interface McbWarningMapper extends BaseMapper {
*/ */
Long queryWarningCount( Long queryWarningCount(
@Param("projectOrgCodes") List<String> projectOrgCodes, @Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus @Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
); );
/** /**
......
...@@ -54,12 +54,12 @@ public class McbWarningServiceImpl implements IMcbWarningService { ...@@ -54,12 +54,12 @@ public class McbWarningServiceImpl implements IMcbWarningService {
* @return 预警信息列表 * @return 预警信息列表
*/ */
@Override @Override
public Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus) { public Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes(); List<String> projectOrgCodes = this.getProjectOrgCodes();
long start = page.getCurrent() - 1; long start = page.getCurrent() - 1;
long offset = page.getSize() * page.getCurrent(); long offset = page.getSize() * page.getCurrent();
List<Map<String, Object>> records = mcbWarningMapper.queryWarningList(start, offset, projectOrgCodes, processingStatus); List<Map<String, Object>> records = mcbWarningMapper.queryWarningList(start, offset, projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
Long total = mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus); Long total = mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
page.setRecords(records); page.setRecords(records);
page.setTotal(total); page.setTotal(total);
return page; return page;
...@@ -72,9 +72,9 @@ public class McbWarningServiceImpl implements IMcbWarningService { ...@@ -72,9 +72,9 @@ public class McbWarningServiceImpl implements IMcbWarningService {
* @return 预警信息总数 * @return 预警信息总数
*/ */
@Override @Override
public Long queryWarningCount(Integer processingStatus) { public Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes(); List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus); return mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment