package com.newfiber.termite.controller; import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.termite.domain.dto.*; import com.newfiber.termite.domain.request.*; import com.newfiber.termite.domain.response.DataUpResponse; import com.newfiber.termite.domain.response.TermiteInfoResponse; import com.newfiber.termite.service.ITermiteService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.newfiber.common.core.web.domain.Result; import com.newfiber.common.core.web.page.PageResult; import javax.annotation.Resource; import java.util.List; @RestController @RequestMapping("/termite") @Api(value = "白蚁防治", tags = "白蚁防治页面接口") public class TermiteController extends BaseController { @Resource private ITermiteService termiteService; /** * 白蚁防治数据接收 */ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) public Result<DataUpResponse> termiteDataup(TermiteDataDto dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } /** * 白蚁防治图片识别后数据上传 */ @PostMapping("/photoIdentify") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治图片识别后数据上传", position = 60) public Result<String> photoIdentify(PhotoIdentifyDto dataDto, MultipartFile image) throws Exception{ if("".equals(dataDto.getId())|| dataDto.getId()==null){ return Result.error("参数:id 不能为空"); } return success(termiteService.photoIdentify(dataDto,image)); } /** * 分页查询数据 */ @PostMapping("/querytermiteData") @ApiOperation(value = "分页查询数据", position = 60) public PageResult<List<TermiteInfoResponse>> querytermiteData(TermiteInfoQueryRequest request){ startPage(); List<TermiteInfoResponse> list = termiteService.querytermiteData(request); return pageResult(list); } /** * 列表查询所有站点数据信息 */ @PostMapping("/querytermiteDataByList") @ApiOperation(value = "列表查询所有站点数据信息", position = 60) public Result<List<TermiteInfoResponse>> querytermiteDataByList(TermiteInfoQueryRequest request){ List<TermiteInfoResponse> list = termiteService.querytermiteData(request); return success(list); } /** * 查询当前行数据 */ @PostMapping("/queryMonitorData") @ApiOperation(value = "查询当前行数据", position = 60) public Result<TermiteInfoResponse> queryMonitorData(TermiteHistoryQueryRequest request){ TermiteInfoResponse result = termiteService.queryMonitorData(request); return success(result); } /** * 更新监测数据 */ @PostMapping("/editMonitorData") @ApiOperation(value = "更新监测数据", position = 60) public Result<Object> updateMonitorData(TermiteInfoUpdateyRequest request){ return success(termiteService.updateMonitorData(request)); } /** * 查询历史数据集合 */ @PostMapping("/queryhistoryData") @ApiOperation(value = "查询历史数据", position = 60) public PageResult<List<TermiteInfoResponse>> queryhistoryData(TermiteHistoryQueryRequest request){ startPage(); List<TermiteInfoResponse> list =termiteService.queryhistoryData(request); return pageResult(list); } /** * 新增站点 */ @PostMapping("/insertMonitorDevice") @ApiOperation(value = "新增站点", position = 60) public Result<Object> insertMonitorDevice(TermiteInfoSaveRequest request){ return success(termiteService.insertMonitorDevice(request)); } /** * 修改站点信息 */ @PostMapping("/updateMonitorDevice") @ApiOperation(value = "修改站点信息", position = 60) public Result<Object> updateMonitorDevice(@RequestBody DeviceInfoUpdateRequest request){ return success(termiteService.updateMonitorDevice(request)); } /** * 删除站点 */ @PostMapping("/removeMonitorDevice") @ApiOperation(value = "删除站点", position = 60) public Result<Object> removeMonitorDevice(String id){ return success(termiteService.removeMonitorDevice(id)); } /** * 更新模型初始值 */ @PostMapping("/updateModlefirstData") @ApiOperation(value = "更新模型初始值", position = 60) public Result<Object> updateModlefirstData(String sn){ if("".equals(sn)|| sn==null){ return Result.error("参数:sn 不能为空"); } return success(termiteService.updateModlefirstData(sn)); } /** * 查询施工单位数据 */ @PostMapping("/queryUnitdata") @ApiOperation(value = "查询施工单位数据", position = 60) public Result<UnitInfoDto> queryUnitdata(){ return success(termiteService.queryUnitdata()); } /** * 查询报警数据信息 */ @PostMapping("/queryAlarmdata") @ApiOperation(value = "查询报警数据信息", position = 60) public Result<List<AlarmDataDto>> queryAlarmdata(@RequestBody TermiteInfoQueryRequest request){ return success(termiteService.queryAlarmdata(request.getProjectCode())); } /** * 站点报警统计 */ @PostMapping("/querySnalarmStatistic") @ApiOperation(value = "站点报警统计", position = 60) public Result<List<SnAlarmStatisticDto>> querySnalarmStatistic(@RequestBody TermiteInfoQueryRequest request){ return success(termiteService.querySnalarmStatistic(request.getProjectCode())); } /** * 查询天气实况 */ @PostMapping("/queryNowWeather") @ApiOperation(value = "获取当前天气实况", position = 60) public Result<Object> queryNowWeather(){ return success(termiteService.queryNowWeather()); } }