xiangpei
2024-04-12 4bc39717f80af51e3d670a9d0ae5110a2a113578
运维阈值修改接口。删除新增、删除接口
4个文件已修改
4个文件已添加
313 ■■■■■ 已修改文件
ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
New file
@@ -0,0 +1,27 @@
package enumeration.general;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
/**
 * 三大板块
 *
 * @author:xp
 * @date:2024/4/12 10:21
 */
public enum BusinessTypeEnum {
    VIDEO("video", "视频"),
    CAR("CAR", "车辆"),
    FACE("face", "人脸");
    @EnumValue // 标明该字段存入数据库
    private final String code;
    @JsonValue // 标明在转JSON时使用该字段,即响应时
    private final String desc;
    BusinessTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java
New file
@@ -0,0 +1,61 @@
package com.ycl.platform.domain.form;
import com.ycl.platform.base.AbsForm;
import enumeration.general.BusinessTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * 车辆工单阈值
 *
 * @author:xp
 * @date:2024/4/12 10:30
 */
@Data
public class CarThresholdForm {
    @ApiModelProperty(value = "id,修改必传", required = false)
    @NotBlank(message = "请选择修改数据")
    private String id;
    @NotBlank(message = "请选择设备类型")
    private BusinessTypeEnum monitorType;
    @NotNull(message = "请输入超时天数")
    private Integer timeout;
    /** 过车辆 */
    @NotBlank(message = "请填写过车数据量")
    private String passCarNum;
    /** 过车缺失率 */
    @NotBlank(message = "请填写过车缺失率")
    private String passCarMissRate;
    /** 有效过车数据量 */
    @NotBlank(message = "请填写有效过车数据量")
    private String passCarEffectiveNum;
    /** 抽检量 */
    @NotBlank(message = "请填写抽检量")
    private String samplingInspectionNum;
    /** 设备活跃率 */
    @NotBlank(message = "请填写设备活跃率")
    private String deviceActiveRate;
    /** 抓拍及时率 */
    @NotBlank(message = "请填写抓拍及时率")
    private String timelyCapture;
    /** 时钟不准确率 */
    @NotBlank(message = "请填写时钟不准确率")
    private String timeNotAccuracy;
    /** 时钟准确率 */
    @NotBlank(message = "请填写时钟准确率")
    private String timeAccuracy;
}
ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java
New file
@@ -0,0 +1,61 @@
package com.ycl.platform.domain.form;
import com.ycl.platform.base.AbsForm;
import enumeration.general.BusinessTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * 人脸工单阈值
 *
 * @author:xp
 * @date:2024/4/12 10:30
 */
@Data
public class FaceThresholdForm {
    @ApiModelProperty(value = "id,修改必传", required = false)
    @NotBlank(message = "请选择修改数据")
    private String id;
    @NotBlank(message = "请选择设备类型")
    private BusinessTypeEnum monitorType;
    @NotNull(message = "请输入超时天数")
    private Integer timeout;
    /** 抓拍量 */
    @NotBlank(message = "请填写抓拍量")
    private String captureNum;
    /** 及时率 */
    @NotBlank(message = "请填写及时率")
    private String timelyRate;
    /** 延迟量 */
    @NotBlank(message = "请填写延迟量")
    private String delayAmount;
    /** 抽检量 */
    @NotBlank(message = "请填写抽检量")
    private String samplingInspectionNum;
    /** 设备活跃率 */
    @NotBlank(message = "请填写设备活跃率")
    private String deviceActiveRate;
    /** 抓拍及时率 */
    @NotBlank(message = "请填写抓拍及时率")
    private String timelyCapture;
    /** 时钟不准确率 */
    @NotBlank(message = "请填写时钟不准确率")
    private String timeNotAccuracy;
    /** 时钟准确率 */
    @NotBlank(message = "请填写时钟准确率")
    private String timeAccuracy;
}
ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java
New file
@@ -0,0 +1,42 @@
package com.ycl.platform.domain.form;
import com.ycl.platform.base.AbsForm;
import com.ycl.system.domain.group.Update;
import enumeration.general.BusinessTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * 视频工单阈值
 *
 * @author:xp
 * @date:2024/4/12 10:30
 */
@Data
public class VideoThresholdForm{
    @ApiModelProperty(value = "id,修改必传", required = false)
    @NotBlank(message = "请选择修改数据")
    private String id;
    @NotBlank(message = "请选择设备类型")
    private BusinessTypeEnum monitorType;
    @NotNull(message = "请输入超时天数")
    private Integer timeout;
    /** 采集设备总数 */
    @NotBlank(message = "请填写采集设备总数")
    private String collectionEquipmentTotalNum;
    /** 检测正常设备数 */
    @NotBlank(message = "请填写检测正常设备数")
    private String monitoringNormalEquipmentNum;
    /** 经纬度异常设备数 */
    @NotBlank(message = "请填写经纬度异常设备数")
    private String longitudeLatitudeExceptionNum;
}
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
@@ -2,14 +2,19 @@
import annotation.Log;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.form.CarThresholdForm;
import com.ycl.platform.domain.form.FaceThresholdForm;
import com.ycl.platform.domain.form.VideoThresholdForm;
import com.ycl.platform.service.IYwThresholdService;
import com.ycl.system.AjaxResult;
import com.ycl.system.controller.BaseController;
import com.ycl.system.domain.group.Update;
import com.ycl.system.page.TableDataInfo;
import com.ycl.utils.poi.ExcelUtil;
import enumeration.BusinessType;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -59,32 +64,33 @@
    }
    /**
     * 新增运维阈值
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:add')")
    @Log(title = "运维阈值", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YwThreshold ywThreshold) {
        return toAjax(ywThresholdService.insertYwThreshold(ywThreshold));
    }
    /**
     * 修改运维阈值
     * 修改人脸阈值
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
    @Log(title = "运维阈值", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YwThreshold ywThreshold) {
        return toAjax(ywThresholdService.updateYwThreshold(ywThreshold));
    @Log(title = "修改人脸运维阈值", businessType = BusinessType.UPDATE)
    @PutMapping("/face")
    public AjaxResult editFace(@RequestBody @Validated FaceThresholdForm form) {
        return toAjax(ywThresholdService.editFace(form));
    }
    /**
     * 删除运维阈值
     * 修改车辆阈值
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:remove')")
    @Log(title = "运维阈值", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(ywThresholdService.deleteYwThresholdByIds(ids));
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
    @Log(title = "修改车辆阈值", businessType = BusinessType.UPDATE)
    @PutMapping("/car")
    public AjaxResult editCar(@RequestBody @Validated CarThresholdForm form) {
        return toAjax(ywThresholdService.editCar(form));
    }
    /**
     * 修改视频阈值
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
    @Log(title = "修改视频阈值", businessType = BusinessType.UPDATE)
    @PutMapping("video")
    public AjaxResult editVideo(@RequestBody @Validated VideoThresholdForm form) {
        return toAjax(ywThresholdService.editVideo(form));
    }
}
ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
@@ -1,5 +1,6 @@
package com.ycl.platform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.platform.domain.entity.YwThreshold;
import java.util.List;
@@ -10,7 +11,7 @@
 * @author gonghl
 * @date 2024-03-25
 */
public interface YwThresholdMapper {
public interface YwThresholdMapper extends BaseMapper<YwThreshold> {
    /**
     * 查询运维阈值
     *
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
@@ -1,7 +1,12 @@
package com.ycl.platform.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.form.CarThresholdForm;
import com.ycl.platform.domain.form.FaceThresholdForm;
import com.ycl.platform.domain.form.VideoThresholdForm;
import com.ycl.platform.mapper.YwThresholdMapper;
import java.util.List;
@@ -59,4 +64,28 @@
     * @return 结果
     */
    public int deleteYwThresholdById(Integer id);
    /**
     * 修改人脸阈值
     *
     * @param form
     * @return
     */
    int editFace(FaceThresholdForm form);
    /**
     * 修改车辆阈值
     *
     * @param form
     * @return
     */
    int editCar(CarThresholdForm form);
    /**
     * 修改视频阈值
     *
     * @param form
     * @return
     */
    int editVideo(VideoThresholdForm form);
}
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
@@ -1,13 +1,20 @@
package com.ycl.platform.service.impl;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.form.CarThresholdForm;
import com.ycl.platform.domain.form.FaceThresholdForm;
import com.ycl.platform.domain.form.VideoThresholdForm;
import com.ycl.platform.mapper.YwThresholdMapper;
import com.ycl.platform.service.IYwThresholdService;
import com.ycl.utils.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
 * 运维阈值Service业务层处理
@@ -16,7 +23,7 @@
 * @date 2024-03-25
 */
@Service
public class YwThresholdServiceImpl implements IYwThresholdService {
public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService {
    @Autowired
    private YwThresholdMapper ywThresholdMapper;
@@ -87,4 +94,37 @@
    public int deleteYwThresholdById(Integer id) {
        return ywThresholdMapper.deleteYwThresholdById(id);
    }
    @Override
    public int editFace(FaceThresholdForm form) {
        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
        if (Objects.isNull(ywThreshold)) {
            throw new RuntimeException("数据不存在");
        }
        BeanUtils.copyProperties(form, ywThreshold);
        ywThreshold.setIndicator(JSON.toJSONString(form));
        return baseMapper.updateById(ywThreshold);
    }
    @Override
    public int editCar(CarThresholdForm form) {
        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
        if (Objects.isNull(ywThreshold)) {
            throw new RuntimeException("数据不存在");
        }
        BeanUtils.copyProperties(form, ywThreshold);
        ywThreshold.setIndicator(JSON.toJSONString(form));
        return baseMapper.updateById(ywThreshold);
    }
    @Override
    public int editVideo(VideoThresholdForm form) {
        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
        if (Objects.isNull(ywThreshold)) {
            throw new RuntimeException("数据不存在");
        }
        BeanUtils.copyProperties(form, ywThreshold);
        ywThreshold.setIndicator(JSON.toJSONString(form));
        return baseMapper.updateById(ywThreshold);
    }
}