package com.newfiber.termite.controller; import cn.hutool.core.date.DateUtil; import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; import com.newfiber.termite.domain.dto.PhotoIdentifyDto; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; import com.newfiber.termite.domain.jingchu.JingChuUploadInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoPictureSyncRequest; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; import com.newfiber.termite.domain.request.deviceInfo.ShuikeyuanUploadInfoRequest; import com.newfiber.termite.domain.response.DataUpResponse; import com.newfiber.termite.domain.response.DeviceInfoStateSyncResponse; import com.newfiber.termite.service.IDeviceInfoService; import com.newfiber.termite.service.IProjectInfoService; import com.newfiber.termite.service.ITermiteService; import com.newfiber.termite.util.CosUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.Date; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @Slf4j @RestController @RequestMapping("/termite") @Api(value = "白蚁防治", tags = "白蚁防治页面接口") public class TermiteController extends BaseController { @Resource private ITermiteService termiteService; @Resource private IProjectInfoService projectInfoService; @Resource private IDeviceInfoService deviceInfoService; /** * 白蚁防治数据接收 */ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) public Result<DataUpResponse> termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ String date = DateUtil.formatDateTime(new Date()); log.info("站点{}在{}时刻上传数据", dataDto.getSn(), date); String url = CosUtil.putFile(image); return success(termiteService.termiteDataup(dataDto, url)); } /** * 白蚁防治图片识别后数据上传 */ @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("/syncDeviceState") @ApiOperation(value = "同步设备状态信息", position = 60) public Result<DeviceInfoStateSyncResponse> syncDeviceState(DeviceInfoStateSyncRequest request) { return success(termiteService.syncDeviceState(request)); } /** */ @PostMapping("/termiteDataupSync") @ApiOperation(value = "白蚁防治图片上传结果同步", position = 60) public Result termitePictureDataupSync(DeviceInfoPictureSyncRequest request) { return success(termiteService.termitePictureDataupSync(request)); } /** */ @PostMapping("/shuikeyuanUploadInfo") @ApiOperation(value = "获取水科院设备编号信息", position = 60) public Result<JingChuUploadInfo> shuikeyuanUploadInfo(ShuikeyuanUploadInfoRequest request) { return success(termiteService.shuikeyuanUploadInfo(request)); } }