wl
2022-12-12 a8a8b384f755b454242a709d86cfef6377a12d33
fix: 对外提供Api
9个文件已修改
3个文件已添加
262 ■■■■■ 已修改文件
ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/dto/cockpitManage/DelayDO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/IDispatchHandleServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/DelayVO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/EnforcementEventsVO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/VideoAndAreaVO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java
@@ -1,6 +1,8 @@
package com.ycl.controller.cockpit.aiIot;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ycl.api.CommonResult;
import com.ycl.entity.video.VideoPoint;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.util.CheckApiUtil;
import com.ycl.util.VideoUtil;
@@ -40,6 +42,7 @@
    @Autowired
    private VideoUtil videoUtil;
    @ApiOperation(value = "监测数据")
    @GetMapping("/detection")
    public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) {
@@ -57,7 +60,7 @@
    @GetMapping("/video")
    public CommonResult video(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        return CommonResult.success(iVideoPointService.list().stream().map(item -> {
        return CommonResult.success(iVideoPointService.list(new LambdaQueryWrapper<VideoPoint>().eq(params.getStreetId()==null,VideoPoint::getStreetId,params.getStreetId())).stream().map(item -> {
            VideoVO videoVO = new VideoVO();
            videoVO.setName(item.getName());
            videoVO.setBrand(item.getEquipmentBrand());
ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java
@@ -1,10 +1,13 @@
package com.ycl.controller.cockpit.enforcementEvents;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ycl.api.CommonResult;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.ycl.util.CheckApiUtil;
import com.ycl.vo.cockpit.CockpitVO;
import com.ycl.vo.cockpit.enforcementEvents.EnforcementEventsVO;
import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,33 +57,40 @@
    @ApiOperation(value = "事件类型")
    @GetMapping("/type")
    public CommonResult<EnforcementEventsVO.TypeAndSourceVO> type(@Validated CockpitVO params) {
    public CommonResult type(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>();
        EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO();
        EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null;
        for (int i = 0; i < 4; i++) {
            typeVO1 = new EnforcementEventsVO.TypeAndSourceVO1();
            typeVO1.setName("团结屯");
            typeVO1.setCount(20);
            typeVO1.setRatio(new BigDecimal("0.69").setScale(2, RoundingMode.HALF_UP));
            typeVO1s.add(typeVO1);
        }
        typeVO.setAll(100);
        typeVO.setRecords(typeVO1s);
        return CommonResult.success(typeVO);
        EnforcementEventsVO.TypeAndSourceVO typeAndSourceVO = new EnforcementEventsVO.TypeAndSourceVO();
        Long allCount = iBaseCaseService.count();
        Long violationCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getCategory, "1"));
        Long illegalBuildingCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getCategory, "2"));
        ArrayList<VideoAndAreaVO> typeAndSourceVO1s = new ArrayList<>();
        VideoAndAreaVO violationVO1 = new VideoAndAreaVO();
        violationVO1.setName("违规");
        violationVO1.setCount(violationCount);
        violationVO1.setRatio(new BigDecimal(violationCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP));
        VideoAndAreaVO illegalBuildingVO1 = new VideoAndAreaVO();
        illegalBuildingVO1.setName("违建");
        illegalBuildingVO1.setCount(illegalBuildingCount);
        illegalBuildingVO1.setRatio(new BigDecimal(illegalBuildingCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP));
        typeAndSourceVO1s.add(violationVO1);
        typeAndSourceVO1s.add(illegalBuildingVO1);
        typeAndSourceVO.setRecords(typeAndSourceVO1s);
        typeAndSourceVO.setAll(allCount);
        System.out.println(illegalBuildingCount / allCount);
        return CommonResult.success(typeAndSourceVO);
    }
    @ApiOperation(value = "视频抓拍告发点位")
    @GetMapping("/video")
    public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> video(@Validated CockpitVO params) {
    public CommonResult video(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>();
        EnforcementEventsVO.VideoAndAreaVO videoVO = null;
        List<VideoAndAreaVO> videoVOS = new ArrayList<>();
        VideoAndAreaVO videoVO = null;
        for (int i = 0; i < 4; i++) {
            videoVO = new EnforcementEventsVO.VideoAndAreaVO();
            videoVO = new VideoAndAreaVO();
            videoVO.setName("团结屯");
            videoVO.setCount(10);
            videoVO.setCount(10L);
            videoVO.setRatio(new BigDecimal("0.65").setScale(2, RoundingMode.HALF_UP));
            videoVOS.add(videoVO);
        }
@@ -91,50 +101,38 @@
    @GetMapping("/source")
    public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>();
        Long allCount = iBaseCaseService.count();
        Long alCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getEventSource, "1"));
        Long handCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getEventSource, "2"));
        List<VideoAndAreaVO> typeVO1s = new ArrayList<>();
        EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO();
        EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null;
        for (int i = 0; i < 4; i++) {
            typeVO1 = new EnforcementEventsVO.TypeAndSourceVO1();
            typeVO1.setName("团结屯");
            typeVO1.setCount(20);
            typeVO1.setRatio(new BigDecimal("0.69").setScale(2, RoundingMode.HALF_UP));
            typeVO1s.add(typeVO1);
        }
        typeVO.setAll(100);
        VideoAndAreaVO al = new VideoAndAreaVO();
        al.setName("视频巡查");
        al.setRatio(new BigDecimal(alCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP));
        al.setCount(alCount);
        typeVO1s.add(al);
        VideoAndAreaVO hand = new VideoAndAreaVO();
        hand.setName("人工上报");
        hand.setRatio(new BigDecimal(handCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP));
        hand.setCount(handCount);
        typeVO1s.add(hand);
        typeVO.setAll(allCount);
        typeVO.setRecords(typeVO1s);
        return CommonResult.success(typeVO);
    }
    @ApiOperation(value = "事件区域统计")
    @GetMapping("/area")
    public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> area(@Validated CockpitVO params) {
    public CommonResult area(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>();
        EnforcementEventsVO.VideoAndAreaVO videoVO = null;
        for (int i = 0; i < 4; i++) {
            videoVO = new EnforcementEventsVO.VideoAndAreaVO();
            videoVO.setName("团结屯");
            videoVO.setCount(10);
            videoVOS.add(videoVO);
        }
        return CommonResult.success(videoVOS);
        return CommonResult.success(iBaseCaseService.areaCount());
    }
    @ApiOperation(value = "延误事件")
    @GetMapping("/delay")
    public CommonResult<List<EnforcementEventsVO.DelayVO>> delay(@Validated CockpitVO params) {
    public CommonResult delay(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        List<EnforcementEventsVO.DelayVO> delayVOS = new ArrayList<>();
        EnforcementEventsVO.DelayVO delayVO = null;
        for (int i = 0; i < 4; i++) {
            delayVO = new EnforcementEventsVO.DelayVO();
            delayVO.setCode("201245555555");
            delayVO.setDescription("团结屯");
            delayVO.setDuration(30);
            delayVOS.add(delayVO);
        }
        return CommonResult.success(delayVOS);
        return CommonResult.success(iBaseCaseService.selectDelayList());
    }
    @ApiOperation(value = "事件信息")
@@ -146,8 +144,7 @@
        infoVO.setWeek(iBaseCaseService.weekCount());
        infoVO.setDispatch(iBaseCaseService.dispatchCount());
        infoVO.setIdentification(iBaseCaseService.alCount());
        infoVO.setEvent(iBaseCaseService.selectEventList(params.getBeginTime(),params.getEndTime()));
        infoVO.setEvent(iBaseCaseService.selectEventList(params.getBeginTime(), params.getEndTime()));
        return CommonResult.success(infoVO);
    }
}
ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java
@@ -189,7 +189,6 @@
        checkApiUtil.cockpit(params);
        LambdaQueryWrapper<TeamConstruction> queryWrapper = new LambdaQueryWrapper<TeamConstruction>().eq(TeamConstruction::getStatus, 1).eq(TeamConstruction::getIsDelete, 0);
        List<TeamConstruction> list = teamConstructionService.list(queryWrapper);
        return CommonResult.success(list);
    }
ycl-platform/src/main/java/com/ycl/dto/cockpitManage/DelayDO.java
New file
@@ -0,0 +1,14 @@
package com.ycl.dto.cockpitManage;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class DelayDO {
    private String code;
    private String description;
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private LocalDateTime limitTime;
}
ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java
@@ -5,13 +5,16 @@
import com.ycl.bo.casePool.CasePoolIllegalBuildingDO;
import com.ycl.bo.casePool.CasePoolViolationDO;
import com.ycl.dto.caseHandler.QueryForViolationParam;
import com.ycl.dto.cockpitManage.DelayDO;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.vo.casePool.BaseCaseVO;
import com.ycl.vo.casePool.CasePoolIllegalBuildingVO;
import com.ycl.vo.casePool.CasePoolViolationVO;
import com.ycl.vo.casePool.QueryForViolationVO;
import com.ycl.vo.cockpit.enforcementEvents.DelayVO;
import com.ycl.vo.cockpit.enforcementEvents.EnforcementEventsVO;
import com.ycl.vo.cockpit.enforcementEvents.EventVO;
import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -51,4 +54,8 @@
    Integer alCount();
    Long selectRegisterCount();
    List<VideoAndAreaVO> areaCount();
    List<DelayDO> selectDelayVOList();
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java
@@ -10,7 +10,9 @@
import com.ycl.entity.caseHandler.BaseCaseDetail;
import com.ycl.vo.casePool.BaseCaseVO;
import com.ycl.vo.casePool.QueryForViolationVO;
import com.ycl.vo.cockpit.enforcementEvents.DelayVO;
import com.ycl.vo.cockpit.enforcementEvents.EventVO;
import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
import java.util.ArrayList;
import java.util.List;
@@ -80,4 +82,8 @@
    Integer alCount();
    List<EventVO> selectEventList(String beginTime, String endTime);
    List<VideoAndAreaVO> areaCount();
    List<DelayVO> selectDelayList();
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
@@ -17,6 +17,7 @@
import com.ycl.dto.casePool.IllegalBuildingParam;
import com.ycl.dto.casePool.VideoInspectParam;
import com.ycl.dto.casePool.ViolationParam;
import com.ycl.dto.cockpitManage.DelayDO;
import com.ycl.entity.caseHandler.*;
import com.ycl.entity.dict.DataDictionary;
import com.ycl.entity.resources.ImageResources;
@@ -32,15 +33,19 @@
import com.ycl.service.caseHandler.IViolationsService;
import com.ycl.service.video.IVideoAlarmReportService;
import com.ycl.vo.casePool.*;
import com.ycl.vo.cockpit.enforcementEvents.DelayVO;
import com.ycl.vo.cockpit.enforcementEvents.EventVO;
import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sun.util.resources.cldr.dyo.LocaleNames_dyo;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -48,7 +53,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
 * <p>
@@ -474,4 +478,34 @@
    public List<EventVO> selectEventList(String beginTime, String endTime) {
        return baseCaseMapper.selectEventList(beginTime, endTime);
    }
    @Override
    public List<VideoAndAreaVO> areaCount() {
        List<VideoAndAreaVO> areaCountList = baseCaseMapper.areaCount();
        Long allCount = baseCaseMapper.selectCount(new LambdaQueryWrapper<>());
        areaCountList.stream().forEach(item -> item.setRatio(new BigDecimal(item.getCount() * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP)));
        return areaCountList;
    }
    @Override
    public List<DelayVO> selectDelayList() {
        List<DelayDO> delayDOS = baseCaseMapper.selectDelayVOList();
        ArrayList<DelayVO> delayVOS = new ArrayList<>();
        delayDOS.stream().forEach(item->{
            DelayVO delayVO = new DelayVO();
            delayVO.setDescription(item.getDescription());
            delayVO.setCode(item.getCode());
            Duration between;
            if (item.getEndTime()!=null){
                between = Duration.between(item.getEndTime(), item.getLimitTime());
            }else {
                between = Duration.between(LocalDateTime.now(), item.getLimitTime());
            }
            if (between.isNegative()){
                delayVO.setDuration(between.toMinutes());
                delayVOS.add(delayVO);
            }
        });
        return delayVOS;
    }
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/IDispatchHandleServiceImpl.java
@@ -89,6 +89,7 @@
        stepNextRecord.setStepName(stepNext.getName());
        stepNextRecord.setLimitTime(dispatchInfoParam.getDisposeDate());
        stepNextRecord.setHandlerId(dispatchInfoParam.getLawEnforcer());
        stepNextRecord.setHandlerRoleId(stepNext.getRoleId());
        //上传处置未结束
        stepNextRecord.setState(0);
        stepNextRecord.setStartTime(LocalDateTime.now());
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/DelayVO.java
New file
@@ -0,0 +1,14 @@
package com.ycl.vo.cockpit.enforcementEvents;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DelayVO {
    @ApiModelProperty(value = "事件编码(唯一)")
    private String code;
    @ApiModelProperty(value = "事件描述")
    private String description;
    @ApiModelProperty(value = "超期时间(分钟)")
    private Long duration;
}
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/EnforcementEventsVO.java
@@ -33,42 +33,9 @@
    @ApiModel(description = "事件类型/事件来源")
    public static class TypeAndSourceVO {
        @ApiModelProperty(value = "事件的总数")
        private Integer all;
        private Long all;
        @ApiModelProperty(value = "事件类型的数量、各占比")
        private List<EnforcementEventsVO.TypeAndSourceVO1> records;
    }
    @Data
    @ApiModel(description = "事件类型/事件来源")
    public static class TypeAndSourceVO1 {
        @ApiModelProperty(value = "名称")
        private String name;
        @ApiModelProperty(value = "数量")
        private Integer count;
        @ApiModelProperty(value = "比例")
        private BigDecimal ratio;
    }
    @Data
    @ApiModel(description = "视频抓拍高发点位/事件区域统计")
    public static class VideoAndAreaVO {
        @ApiModelProperty(value = "点位名称")
        private String name;
        @ApiModelProperty(value = "次数")
        private Integer count;
        @ApiModelProperty(value = "数据占比")
        private BigDecimal ratio;
    }
    @Data
    @ApiModel(description = "延误事件")
    public static class DelayVO {
        @ApiModelProperty(value = "事件编码(唯一)")
        private String code;
        @ApiModelProperty(value = "事件描述")
        private String description;
        @ApiModelProperty(value = "超期时间(分钟)")
        private Integer duration;
        private List<VideoAndAreaVO> records;
    }
    @Data
ycl-platform/src/main/java/com/ycl/vo/cockpit/enforcementEvents/VideoAndAreaVO.java
New file
@@ -0,0 +1,16 @@
package com.ycl.vo.cockpit.enforcementEvents;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class VideoAndAreaVO {
    @ApiModelProperty(value = "点位名称")
    private String name;
    @ApiModelProperty(value = "次数")
    private Long count;
    @ApiModelProperty(value = "数据占比")
    private BigDecimal ratio;
}
ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml
@@ -302,4 +302,28 @@
        </where>
    </select>
    <select id="areaCount" resultType="com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO">
        SELECT
            t2.region_name,
            COUNT( 1 ) AS count
        FROM
            `ums_base_case` t1
            LEFT JOIN ums_sccg_region t2 ON t1.street_id = t2.id
        GROUP BY
            street_id
    </select>
    <select id="selectDelayVOList" resultType="com.ycl.dto.cockpitManage.DelayDO">
        SELECT
            t1.`code`,
            t3.description,
            t2.start_time,
            t2.end_time,
            t2.limit_time
        FROM
            `ums_base_case` t1
                LEFT JOIN ums_dispose_record t2 ON t1.id = t2.base_case_id
                LEFT JOIN ums_violations t3 on t1.id=t3.id
        WHERE t2.workflow_config_step_id IN (1,2)
    </select>
</mapper>