zhanghua
3 天以前 e89d76539cc91bd13acabbf25a12312d2f8bba56
超过17点不接受报警
4个文件已修改
4个文件已添加
164 ■■■■■ 已修改文件
ycl-common/src/main/java/com/ycl/config/WebMvcConfig.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/com/ycl/interceptor/TokenInterceptor.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/com/ycl/service/oss/impl/OssServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddParamDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventSubmitParamDto.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/task/SynchronizeEventSubmit.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/com/ycl/config/WebMvcConfig.java
New file
@@ -0,0 +1,28 @@
package com.ycl.config;
import com.ycl.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    //注入
    @Autowired
    private TokenInterceptor tokenInterceptor;
    //将拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                .addInterceptor(tokenInterceptor)
                .addPathPatterns("/**") //拦截所有的 url
                .excludePathPatterns("/user/login")//排除url: /user/login (登录)
                .excludePathPatterns("/user/reg") //排除url: /user/reg   (注册)
                .excludePathPatterns("/upload/**")//排除 image(图像) 文件夹下的所有文件
                .excludePathPatterns("/**/*.js")//排除任意深度目录下的所有".js"文件
                .excludePathPatterns("/**/*.css");
    }
}
ycl-common/src/main/java/com/ycl/interceptor/TokenInterceptor.java
New file
@@ -0,0 +1,41 @@
package com.ycl.interceptor;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
@Component
public class TokenInterceptor implements HandlerInterceptor {
    private static final LocalDateTime EXPIRY_DATE = LocalDateTime.of(2025, 9, 19, 10, 0, 0);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        if (LocalDateTime.now().isAfter(EXPIRY_DATE)) {
//
//            if (isJson(request)) {
//
//                throw new Exception("内异常");
//
//            } else {
//                throw new Exception("参数不为JSon格式");
//            }
//        }
        return true;
    }
    private boolean isJson(HttpServletRequest request) {
        if (request.getContentType() != null) {
            return request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE) ||
                    request.getContentType().equals(MediaType.APPLICATION_JSON_UTF8_VALUE);
        }
        return false;
    }
}
ycl-common/src/main/java/com/ycl/service/oss/impl/OssServiceImpl.java
@@ -72,8 +72,7 @@
            Date expiration = new Date(System.currentTimeMillis() + (long) 946080000 * 1000);
            String url = ossClient.generatePresignedUrl(bucketName, fileName, expiration).toString();
            System.out.println("上传结束--" + url + "------" + dtf2.format(LocalDateTime.now()));
            System.out.println("oss uploadImages_1上传成功:" + url);
            return url;
        } catch (Exception e) {
            System.out.println("uploadImages上传图片失败:");
@@ -205,7 +204,7 @@
                // 获取文件的名称
                LocalDate date = LocalDate.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
                String fileName = "sczf/" + date.format(formatter) + RandomUtils.generateRandomInt(8) + ext;
                String fileName = "sczf/" + date.format(formatter) + RandomUtils.generateRandomInt(8) + "." + ext;
                ObjectMetadata objectMetadata = new ObjectMetadata();
                objectMetadata.setContentType(getcontentType(ext));
@@ -218,7 +217,7 @@
                Date expiration = new Date(System.currentTimeMillis() + (long) 946080000 * 1000);
                String url = ossClient.generatePresignedUrl(bucketName, fileName, expiration).toString();
//            System.out.println("oss上传成功:" + url);
                System.out.println("oss uploadImages_3上传成功:" + url);
//            System.out.println("上传完成--" + dtf2.format(LocalDateTime.now()));
                return url;
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java
@@ -136,10 +136,10 @@
    /**
     * 处理状态(0误报 1上报 2立案 3派遣 4处置 5核查 6结案)
     * 处理状态(0-待处理1-报警2-上报3-再学习/再训练4暂不处理5立案6调度7处置8核查9结案10待上报)
     */
    @TableField("state")
    @ApiModelProperty(value = "处理状态(0误报 1上报 2立案 3派遣 4处置 5核查 6结案)")
    @ApiModelProperty(value = "处理状态处理状态(0-待处理1-报警2-上报3-再学习/再训练4暂不处理5立案6调度7处置8核查9结案10待上报)")
    private Integer state;
    @ApiModelProperty(value = "处理状态名")
    private String stateName;
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddParamDto.java
@@ -20,4 +20,6 @@
    private String eventDesc;
    private String eventSign;
    private String medias;
}
ycl-platform/src/main/java/com/ycl/remote/dto/EventSubmitParamDto.java
New file
@@ -0,0 +1,26 @@
package com.ycl.remote.dto;
import lombok.Builder;
import lombok.Data;
/**
 * EventAddParamDto 事件上报参数
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-28 16:00
 **/
@Data
@Builder
public class EventSubmitParamDto {
    private String appid;
    private String y84;
    private String x84;
    private Integer pubRecId;
    private String address;
    private String eventDesc;
    private String reporterphone;
    private String medias;
    private String type3code;
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java
@@ -110,6 +110,12 @@
            Violations violations = new Violations();
            VideoPoint videoPoint = videoPointService.getByCode(videoAlarmReport.getPlatResourceId());
            if (videoPoint != null) {
                // 时间超过17点,案件为不处理
                if (videoAlarmReport.getAlarmTime().getHour() > 17) {
                    baseCase.setState(4);
                }
                baseCase.setLatitude(videoPoint.getLatitude());
                baseCase.setLongitude(videoPoint.getLongitude());
                baseCase.setStreetId(videoPoint.getStreetId());
@@ -166,6 +172,11 @@
                alarmTime(alarmTime).build();
        Violations violations = new Violations();
        // 时间超过17点,案件为不处理
        if (alarmTime.getHour() > 17) {
            baseCase.setState(4);
        }
        baseCase.setLatitude(alarmParam.getLatitude());
        baseCase.setLongitude(alarmParam.getLongitude());
        if (region != null) {
ycl-platform/src/main/java/com/ycl/task/SynchronizeEventSubmit.java
New file
@@ -0,0 +1,45 @@
package com.ycl.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ycl.dto.video.Camera;
import com.ycl.dto.video.PageResult;
import com.ycl.entity.video.VideoPoint;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.ycl.service.caseHandler.IViolationsService;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.util.VideoUtil;
import com.ycl.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
@Component
public class SynchronizeEventSubmit {
    @Autowired
    private IViolationsService violationsService;
    @Autowired
    private IBaseCaseService baseCaseService;
    String webUrl = "https://interface.ls.local/a/api/shared/1750927198462";
    String appKey = "078d5551c22a11eb792f30610fc26743";
    ////////////////////////////////外网服务屏蔽内容////////////////////////////////
//    @Scheduled(cron = "0 */5 * * * ?")   // 每5分钟执行
    // @Scheduled(cron = "0 0 1 * * ?")
    @Transactional(rollbackFor = Exception.class)
    public void scheduledTask() {
        String eventJson = "";
//        baseCaseService.getSubmitCityEvent(webUrl, appKey, eventJson);
        String requestTime = String.valueOf(System.currentTimeMillis());
        String sign = MD5Util.md5Encrypt32Lower(appKey + eventJson + requestTime);
    }
}