From df777ac84bffbbc6e429c8ffd3e5e9cf1c7e58f5 Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Thu, 12 Aug 2021 11:33:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A4=A7=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=202.=E6=96=B0=E5=A2=9E=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=B1=A1=E6=9F=93=E5=9B=A0=E5=AD=90=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstrumentAppResourceController.java | 92 +++++++++++++++++++ .../poll/PollAppResourceController.java | 2 +- .../mapper/alarmlog/alarm-log-mapper.xml | 4 + .../mapper/instrument/instrument-mapper.xml | 4 + 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/instrument/InstrumentAppResourceController.java diff --git a/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/instrument/InstrumentAppResourceController.java b/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/instrument/InstrumentAppResourceController.java new file mode 100644 index 0000000..fba0560 --- /dev/null +++ b/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/instrument/InstrumentAppResourceController.java @@ -0,0 +1,92 @@ +package com.cm.tenlion.pollutantdata.controller.app.resource.instrument; + + +import com.cm.common.base.AbstractController; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.pojo.ListPage; +import com.cm.common.result.ErrorResult; +import com.cm.common.result.SuccessResultList; +import com.cm.tenlion.pollutantdata.controller.app.resource.BigDataResult; +import com.cm.tenlion.pollutantdata.pojo.dtos.instrument.InstrumentDTO; +import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService; +import io.swagger.annotations.*; +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.lang.reflect.Array; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "数采仪接口") +@RestController +@RequestMapping(ISystemConstant.APP_PREFIX + "/instrument/" + ISystemConstant.APP_RELEASE_SUFFIX) +public class InstrumentAppResourceController extends AbstractController { + + + @Autowired + private IInstrumentService instrumentService; + + + private final static String[] ST_KEY = new String[]{ + "21","22","23","31","32","33","34","35","36","37","38","41","51","52" + }; + private final static String[] ST_VALUE = new String[]{ + "21 地表水监测","22 空气质量监测","23 区域环境噪声监控","31 大气环境污染源","32 地表水体环境污染源", + "33 地下水体环境污染源","34 海洋环境污染源","35 土壤环境污染源","36 声环境污染源","37 振动环境污染源", + "38 放射性环境污染源","41 电磁环境污染源","51 烟气排放过程监控","52 污水排放过程监控" + }; + + + + @ApiOperation(value = "数采仪分页列表", notes = "数采仪分页列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpage") + public SuccessResultList> listPage(ListPage page) { + Map params = requestParams(); + page.setParams(params); + return instrumentService.listPage(page); + } + + + @ApiOperation(value = "数采仪按系统编码统计", notes = "数采仪按系统编码统计接口") + @GetMapping("count-st") + public BigDataResult countSt(){ + BigDataResult result = new BigDataResult(); + List list = new ArrayList<>(); + for (int i = 0; i < ST_KEY.length; i++) { + Map params = new HashMap<>(); + params.put("st",ST_KEY[i]); + Integer count = instrumentService.count(params); + params.clear(); + String[] arr = new String[3]; + arr[0] = i+1+""; + arr[1] = ST_VALUE[i]; + arr[2] = count.toString(); + list.add(arr); + } + result.setList(list); + return result; + } + + + + + + + + + + + +} diff --git a/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/poll/PollAppResourceController.java b/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/poll/PollAppResourceController.java index b5f4d49..1d3088d 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/poll/PollAppResourceController.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/controller/app/resource/poll/PollAppResourceController.java @@ -61,7 +61,7 @@ public class PollAppResourceController extends AbstractController { List pollList = pollService.list(params); for (PollDTO pollDTO : pollList) { Map params1 = new HashMap<>(); - params1.put("id",pollDTO.getPollId()); + params1.put("id",pollDTO.getPollNo()); params1.put("name",pollDTO.getPollName()); list.add(params1); } diff --git a/src/main/resources/mybatis/mapper/alarmlog/alarm-log-mapper.xml b/src/main/resources/mybatis/mapper/alarmlog/alarm-log-mapper.xml index d81b140..bec305c 100644 --- a/src/main/resources/mybatis/mapper/alarmlog/alarm-log-mapper.xml +++ b/src/main/resources/mybatis/mapper/alarmlog/alarm-log-mapper.xml @@ -104,6 +104,10 @@ AND t1.instrument_id = #{instrumentId} + + + AND + t1.poll_id = #{pollId} ORDER BY t1.gmt_create DESC diff --git a/src/main/resources/mybatis/mapper/instrument/instrument-mapper.xml b/src/main/resources/mybatis/mapper/instrument/instrument-mapper.xml index 15e3adf..f0de18f 100644 --- a/src/main/resources/mybatis/mapper/instrument/instrument-mapper.xml +++ b/src/main/resources/mybatis/mapper/instrument/instrument-mapper.xml @@ -404,6 +404,10 @@ AND t1.enterprise_id = #{enterpriseId} + + AND + t1.st = #{st} + \ No newline at end of file