1.大数据统计接口

2.新增企业监控污染因子接口
This commit is contained in:
ly19960718 2021-08-12 11:33:28 +08:00
parent 08fe8faf9d
commit df777ac84b
4 changed files with 101 additions and 1 deletions

View File

@ -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<List<InstrumentDTO>> listPage(ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return instrumentService.listPage(page);
}
@ApiOperation(value = "数采仪按系统编码统计", notes = "数采仪按系统编码统计接口")
@GetMapping("count-st")
public BigDataResult countSt(){
BigDataResult result = new BigDataResult();
List<String[]> list = new ArrayList<>();
for (int i = 0; i < ST_KEY.length; i++) {
Map<String,Object> 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;
}
}

View File

@ -61,7 +61,7 @@ public class PollAppResourceController extends AbstractController {
List<PollDTO> pollList = pollService.list(params); List<PollDTO> pollList = pollService.list(params);
for (PollDTO pollDTO : pollList) { for (PollDTO pollDTO : pollList) {
Map<String,Object> params1 = new HashMap<>(); Map<String,Object> params1 = new HashMap<>();
params1.put("id",pollDTO.getPollId()); params1.put("id",pollDTO.getPollNo());
params1.put("name",pollDTO.getPollName()); params1.put("name",pollDTO.getPollName());
list.add(params1); list.add(params1);
} }

View File

@ -104,6 +104,10 @@
<if test="instrumentId != null and instrumentId != ''"> <if test="instrumentId != null and instrumentId != ''">
AND AND
t1.instrument_id = #{instrumentId} t1.instrument_id = #{instrumentId}
</if>
<if test="pollId != null and pollId != ''">
AND
t1.poll_id = #{pollId}
</if> </if>
ORDER BY ORDER BY
t1.gmt_create DESC t1.gmt_create DESC

View File

@ -404,6 +404,10 @@
AND AND
t1.enterprise_id = #{enterpriseId} t1.enterprise_id = #{enterpriseId}
</if> </if>
<if test="st != null and st != ''">
AND
t1.st = #{st}
</if>
</select> </select>
</mapper> </mapper>