|  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.respose.PageRegionInfoResponse; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Visits; | 
|---|
|  |  |  | import com.doumee.dao.web.response.platformReport.*; | 
|---|
|  |  |  | import com.doumee.service.business.VisitsService; | 
|---|
|  |  |  | import com.doumee.service.business.third.BoardService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | 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.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | 
|---|
|  |  |  | * @create 2024/10/28 13:42 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Api(tags = "安防管控大屏") | 
|---|
|  |  |  | @Api(tags = "【看板大屏】安防管控大屏") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/board/api/security") | 
|---|
|  |  |  | public class SecurityController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private BoardService boardService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitsService visitsService; | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("中心数据") | 
|---|
|  |  |  | @GetMapping("/centerData") | 
|---|
|  |  |  | public ApiResponse<SecurityBoardVO> centerData() { | 
|---|
|  |  |  | SecurityBoardVO data = new SecurityBoardVO(); | 
|---|
|  |  |  | Random random = new Random(); | 
|---|
|  |  |  | data.setParkingLotTotal(random.nextInt(200)); | 
|---|
|  |  |  | data.setFreeParkingLot(random.nextInt(data.getParkingLotTotal())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.setInternalCarTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setRelatedCarTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setVisitCarTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setInParkCarTotal(data.getInternalCarTotal() + data.getRelatedCarTotal() + data.getVisitCarTotal()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.setInternalTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setRelatedTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setVisitTotal(random.nextInt(100)); | 
|---|
|  |  |  | data.setInParkTotal(data.getInternalTotal() + data.getRelatedTotal() + data.getVisitTotal()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.setDeviceTotal(random.nextInt(20)); | 
|---|
|  |  |  | data.setErrTotal(random.nextInt(20)); | 
|---|
|  |  |  | data.setInternalJobCarTotal(random.nextInt(20)); | 
|---|
|  |  |  | data.setVisitJobCarTotal(random.nextInt(20)); | 
|---|
|  |  |  | data.setRelatedJobCarTotal(random.nextInt(20)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ApiResponse<SecurityBoardVO> centerSecurityData() { | 
|---|
|  |  |  | SecurityBoardVO data = boardService.centerSecurityData(); | 
|---|
|  |  |  | return ApiResponse.success(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("园区安防设备") | 
|---|
|  |  |  | @GetMapping("/securityDeviceData") | 
|---|
|  |  |  | public ApiResponse<List<SecurityDeviceDataVO>> securityDeviceData() { | 
|---|
|  |  |  | List<SecurityDeviceDataVO> list = new ArrayList<>(); | 
|---|
|  |  |  | Random random = new Random(); | 
|---|
|  |  |  | for (int i = 1; i <= 3; i++) { | 
|---|
|  |  |  | SecurityDeviceDataVO data = new SecurityDeviceDataVO(); | 
|---|
|  |  |  | data.setDeviceType("设备类型_"+i); | 
|---|
|  |  |  | data.setOnlineNum(random.nextInt(10)); | 
|---|
|  |  |  | data.setOfflineDeviceNum(random.nextInt(10)); | 
|---|
|  |  |  | data.setTotalNum(data.getOnlineNum() + data.getOfflineDeviceNum() ); | 
|---|
|  |  |  | list.add(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<SecurityDeviceDataVO> list = boardService.securityDeviceData(); | 
|---|
|  |  |  | return ApiResponse.success(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("安防告警接口") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型 0全部 1区域告警 2行为告警", required = false) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping("/warningEventData") | 
|---|
|  |  |  | public ApiResponse<WaningEventDataVO> warningEventData(Integer type) { | 
|---|
|  |  |  | WaningEventDataVO list = boardService.warningEventData(type); | 
|---|
|  |  |  | return ApiResponse.success(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("访客滞留情况") | 
|---|
|  |  |  | @GetMapping("/visitRetentionData") | 
|---|
|  |  |  | public ApiResponse<List<VisitRetentionDataVO>> visitRetentionData() { | 
|---|
|  |  |  | PageWrap<Visits> pageWrap = new PageWrap<>(); | 
|---|
|  |  |  | pageWrap.setCapacity(10); | 
|---|
|  |  |  | pageWrap.setPage(1); | 
|---|
|  |  |  | pageWrap.setModel(new Visits()); | 
|---|
|  |  |  | pageWrap.getModel().setLevelStatus(Constants.ZERO); | 
|---|
|  |  |  | pageWrap.getModel().setStatus(Constants.TWO); | 
|---|
|  |  |  | PageData<Visits>  resut =    visitsService.retentionPage(pageWrap); | 
|---|
|  |  |  | List<VisitRetentionDataVO> list = new ArrayList<>(); | 
|---|
|  |  |  | Random random = new Random(); | 
|---|
|  |  |  | for (int i = 1; i <= 3; i++) { | 
|---|
|  |  |  | VisitRetentionDataVO data = new VisitRetentionDataVO(); | 
|---|
|  |  |  | data.setName("小明_"+i); | 
|---|
|  |  |  | data.setCompanyName("运维组_"+i); | 
|---|
|  |  |  | data.setTimeOutMinute(Long.valueOf(random.nextInt(200))); | 
|---|
|  |  |  | list.add(data); | 
|---|
|  |  |  | if(resut !=null && resut.getRecords() !=null && resut.getRecords().size()>0){ | 
|---|
|  |  |  | for (Visits model : resut.getRecords()) { | 
|---|
|  |  |  | VisitRetentionDataVO data = new VisitRetentionDataVO(); | 
|---|
|  |  |  | data.setName(model.getName()); | 
|---|
|  |  |  | data.setCompanyName(model.getCompanyName()); | 
|---|
|  |  |  | data.setTimeOutMinute(Constants.formatIntegerNum(model.getTimeOut())); | 
|---|
|  |  |  | list.add(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ApiResponse.success(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("平铺结果区域集合接口") | 
|---|
|  |  |  | @GetMapping("/regionList") | 
|---|
|  |  |  | public ApiResponse<List<PageRegionInfoResponse>> regionList(CarmeraListVO param) { | 
|---|
|  |  |  | @PostMapping("/regionList") | 
|---|
|  |  |  | public ApiResponse<List<PageRegionInfoResponse>> regionList(@RequestBody  CarmeraListVO param) { | 
|---|
|  |  |  | return ApiResponse.success(boardService.regionList(param)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("获取监控流播放地址") | 
|---|
|  |  |  | @PostMapping("/getCarmeraPreviemUrl") | 
|---|
|  |  |  | public ApiResponse<String> getCarmeraPreviemUrl(@RequestBody CarmeraListVO param) { | 
|---|
|  |  |  | return ApiResponse.success(boardService.getCarmeraPreviemUrl(param)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("今日访客分析和滞留访客数据集合") | 
|---|
|  |  |  | @GetMapping("/visitSecurityData") | 
|---|
|  |  |  | public ApiResponse<VisitDataVO> visitSecurityData ( ){ | 
|---|
|  |  |  | VisitDataVO data = boardService.visitSecurityData(); | 
|---|
|  |  |  | return ApiResponse.success(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|