fuliqi
2024-07-22 2be2f6c3e5b2be2bae1562423a9a4d29aa174aae
工单阈值重构
7个文件已修改
1个文件已添加
3个文件已删除
879 ■■■■ 已修改文件
ycl-common/src/main/java/enumeration/general/CountTypeEnum.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java 193 ●●●● 补丁 | 查看 | 原始文档 | 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 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java 95 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java 198 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/HKTask.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/enumeration/general/CountTypeEnum.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 CountTypeEnum {
    INT("int", "整数"),
    PERCENT("percent", "比率"),
    SECOND("second", "秒");
    @EnumValue // 标明该字段存入数据库
    @JsonValue // 标明在转JSON时使用该字段
    private final String code;
    private final String desc;
    CountTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
@@ -1,175 +1,78 @@
package com.ycl.platform.domain.entity;
import annotation.Excel;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ycl.system.entity.BaseEntity;
import enumeration.general.BusinessTypeEnum;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
 * 运维阈值对象 t_yw_threshold
 *
 * @author gonghl
 * @date 2024-03-25
 * @date 2024-07-19
 */
@Data
@TableName("t_yw_threshold")
public class YwThreshold {
public class YwThreshold
{
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    /**  */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Long id;
    /** 设备类型 */
    @Excel(name = "设备类型")
    @TableField("monitor_type")
    private String monitorType;
    /** 计数类型 */
    @Excel(name = "计数类型")
    @TableField("count_type")
    private String countType;
    /** 阈值名 */
    @Excel(name = "阈值名")
    @TableField("name")
    private String name;
    /** 工单阈值 */
    @Excel(name = "工单阈值")
    @TableField("value")
    private String value;
    /** 下发阈值 */
    @Excel(name = "下发阈值")
    @TableField("value_auto")
    private String valueAuto;
    /** 描述 */
    @Excel(name = "描述")
    @TableField("description")
    private String description;
    /** 逻辑删除:0未删除 1删除 */
    @Excel(name = "逻辑删除:0未删除 1删除")
    private String deleted;
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    @Excel(name = "创建时间")
    private Date createTime;
    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    @TableField("update_time")
    @Excel(name = "更新时间")
    private Date updateTime;
    /**
     * 设备类型:1人脸 2车辆 3视频
     */
    @Excel(name = "设备类型")
    @TableField("monitor_type")
    private BusinessTypeEnum monitorType;
    /*----------------------------   视频字段 ----------------------------------------------*/
    /**
     * 视频质量工单阈值
     */
    @Excel(name = "视频质量工单阈值")
    @TableField("video_quality")
    private String videoQuality;
    /**
     * 视频质量工单阈值
     */
    @Excel(name = "视频质量下发阈值")
    @TableField("video_quality_auto")
    private String videoQualityAuto;
    /**
     * 图像质量工单阈值
     */
    @Excel(name = "图像质量工单阈值")
    @TableField("image_quality")
    private String imageQuality;
    /**
     * 图像质量下发阈值
     */
    @Excel(name = "图像质量下发阈值")
    @TableField("image_quality_auto")
    private String imageQualityAuto;
    /**
     * 标注准确率工单阈值
     */
    @Excel(name = "标注准确率工单阈值")
    @TableField("annotation_accuracy")
    private BigDecimal annotationAccuracy;
    /**
     * 标注准确率下发阈值
     */
    @Excel(name = "标注准确率下发阈值")
    @TableField("annotation_accuracy_auto")
    private BigDecimal annotationAccuracyAuto;
    /*----------------------------   人脸字段 ----------------------------------------------*/
    /** 抓拍量工单阈值 */
    @TableField("capture_num")
    private Integer captureNum;
    /** 抓拍量下发阈值 */
    @TableField("capture_num_auto")
    private Integer captureNumAuto;
    /** 及时率工单阈值 */
    @TableField("timely_rate")
    private BigDecimal timelyRate;
    /** 及时率下发阈值 */
    @TableField("timely_rate_auto")
    private BigDecimal timelyRateAuto;
    /** 延迟量工单阈值 */
    @TableField("delay_amount")
    private Long delayAmount;
    /** 延迟量下发阈值 */
    @TableField("delay_amount_auto")
    private Long delayAmountAuto;
    /*----------------------------   车辆字段 ----------------------------------------------*/
    /** 过车数据量工单阈值 */
    @TableField("pass_car_num")
    private Integer passCarNum;
    /** 过车数据量下发阈值 */
    @TableField("pass_car_num_auto")
    private Integer passCarNumAuto;
    /** 过车缺失率工单阈值 */
    @TableField("pass_car_miss_rate")
    private BigDecimal passCarMissRate;
    /** 过车缺失率下发阈值 */
    @TableField("pass_car_miss_rate_auto")
    private BigDecimal passCarMissRateAuto;
    /** 有效过车数据量工单阈值 */
    @TableField("pass_car_effective_num")
    private Integer passCarEffectiveNum;
    /** 有效过车数据量下发阈值 */
    @TableField("pass_car_effective_num_auto")
    private Integer passCarEffectiveNumAuto;
    /** 时钟准确率工单阈值 */
    @TableField("time_accuracy")
    private BigDecimal timeAccuracy;
    /** 时钟准确率下发阈值 */
    @TableField("time_accuracy_auto")
    private BigDecimal timeAccuracyAuto;
    /**
     * 逻辑删除:0未删除 1删除
     */
    @TableField("deleted")
    private String deleted;
    /*----------------------------   公共 ----------------------------------------------*/
    /** 设备活跃率工单阈值 */
    @TableField("device_active_rate")
    private BigDecimal deviceActiveRate;
    /** 设备活跃率下发阈值 */
    @TableField("device_active_rate_auto")
    private BigDecimal deviceActiveRateAuto;
    /** 抓拍及时率工单阈值 */
    @TableField("timely_capture")
    private BigDecimal timelyCapture;
    /** 抓拍及时率下发阈值 */
    @TableField("timely_capture_auto")
    private BigDecimal timelyCaptureAuto;
}
ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java
File was deleted
ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java
File was deleted
ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java
File was deleted
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
@@ -2,33 +2,30 @@
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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * 运维阈值Controller
 *
 * @author gonghl
 * @date 2024-03-25
 * @date 2024-07-19
 */
@RestController
@RequestMapping("/threshold")
public class YwThresholdController extends BaseController {
public class YwThresholdController extends BaseController
{
    @Autowired
    private IYwThresholdService ywThresholdService;
@@ -37,22 +34,10 @@
     */
    @PreAuthorize("@ss.hasPermi('ycl:threshold:list')")
    @GetMapping("/list")
    public TableDataInfo list(YwThreshold ywThreshold) {
        startPage();
        List<YwThreshold> list = ywThresholdService.selectYwThresholdList(ywThreshold);
        return getDataTable(list);
    }
    /**
     * 导出运维阈值列表
     */
    @PreAuthorize("@ss.hasPermi('ycl:threshold:export')")
    @Log(title = "运维阈值", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YwThreshold ywThreshold) {
        List<YwThreshold> list = ywThresholdService.selectYwThresholdList(ywThreshold);
        ExcelUtil<YwThreshold> util = new ExcelUtil<YwThreshold>(YwThreshold.class);
        util.exportExcel(response, list, "运维阈值数据");
    public AjaxResult list(YwThreshold ywThreshold)
    {
        Map<String, List<YwThreshold>> map = ywThresholdService.selectYwThresholdList(ywThreshold);
        return success(map);
    }
    /**
@@ -60,65 +45,41 @@
     */
    @PreAuthorize("@ss.hasPermi('ycl:threshold:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ywThresholdService.selectYwThresholdById(id));
    }
    /**
     * 获取人脸配置
     * 新增运维阈值
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:query')")
    @GetMapping(value = "/face/{id}")
    public AjaxResult getFace(@PathVariable("id") Integer id) {
        return success(ywThresholdService.getFace(id));
    @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:query')")
    @GetMapping(value = "/car/{id}")
    public AjaxResult getCar(@PathVariable("id") Integer id) {
        return success(ywThresholdService.getCar(id));
    }
    /**
     * 获取视频配置
     */
    // @PreAuthorize("@ss.hasPermi('ycl:threshold:query')")
    @GetMapping(value = "/video/{id}")
    public AjaxResult getVideo(@PathVariable("id") Integer id) {
        return success(ywThresholdService.getVideo(id));
    }
    /**
     * 修改人脸阈值
     * 修改运维阈值
     */
    @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
    @Log(title = "修改人脸运维阈值", businessType = BusinessType.UPDATE)
    @PutMapping("/face")
    public AjaxResult editFace(@RequestBody @Validated FaceThresholdForm form) {
        return toAjax(ywThresholdService.editFace(form));
    @Log(title = "运维阈值", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody List<YwThreshold> list)
    {
        return toAjax(ywThresholdService.updateYwThreshold(list));
    }
    /**
     * 修改车辆阈值
     * 删除运维阈值
     */
    @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:remove')")
    @Log(title = "运维阈值", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ywThresholdService.deleteYwThresholdByIds(ids));
    }
    /**
     * 修改视频阈值
     */
    @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
@@ -9,16 +9,17 @@
 * 运维阈值Mapper接口
 *
 * @author gonghl
 * @date 2024-03-25
 * @date 2024-07-19
 */
public interface YwThresholdMapper extends BaseMapper<YwThreshold> {
public interface YwThresholdMapper extends BaseMapper<YwThreshold>
{
    /**
     * 查询运维阈值
     *
     * @param id 运维阈值主键
     * @return 运维阈值
     */
    public YwThreshold selectYwThresholdById(Integer id);
    public YwThreshold selectYwThresholdById(Long id);
    /**
     * 查询运维阈值列表
@@ -50,7 +51,7 @@
     * @param id 运维阈值主键
     * @return 结果
     */
    public int deleteYwThresholdById(Integer id);
    public int deleteYwThresholdById(Long id);
    /**
     * 批量删除运维阈值
@@ -58,5 +59,10 @@
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteYwThresholdByIds(Integer[] ids);
    public int deleteYwThresholdByIds(Long[] ids);
    /**
     * 根据设备类型获取运维阈值
     */
    public List<YwThreshold> selectByType(String type);
}
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
@@ -1,32 +1,26 @@
package com.ycl.platform.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.platform.domain.dto.CarDTO;
import com.ycl.platform.domain.dto.FaceDTO;
import com.ycl.platform.domain.dto.VideoDTO;
import com.baomidou.mybatisplus.extension.service.IService;
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;
import java.util.Map;
/**
 * 运维阈值Service接口
 *
 * @author gonghl
 * @date 2024-03-25
 * @date 2024-07-19
 */
public interface IYwThresholdService {
public interface IYwThresholdService extends IService<YwThreshold>
{
    /**
     * 查询运维阈值
     *
     * @param id 运维阈值主键
     * @return 运维阈值
     */
    public YwThreshold selectYwThresholdById(Integer id);
    public YwThreshold selectYwThresholdById(Long id);
    /**
     * 查询运维阈值列表
@@ -34,7 +28,7 @@
     * @param ywThreshold 运维阈值
     * @return 运维阈值集合
     */
    public List<YwThreshold> selectYwThresholdList(YwThreshold ywThreshold);
    public Map<String, List<YwThreshold>> selectYwThresholdList(YwThreshold ywThreshold);
    /**
     * 新增运维阈值
@@ -50,7 +44,7 @@
     * @param ywThreshold 运维阈值
     * @return 结果
     */
    public int updateYwThreshold(YwThreshold ywThreshold);
    public Boolean updateYwThreshold(List<YwThreshold> ywThreshold);
    /**
     * 批量删除运维阈值
@@ -58,7 +52,7 @@
     * @param ids 需要删除的运维阈值主键集合
     * @return 结果
     */
    public int deleteYwThresholdByIds(Integer[] ids);
    public int deleteYwThresholdByIds(Long[] ids);
    /**
     * 删除运维阈值信息
@@ -66,74 +60,5 @@
     * @param id 运维阈值主键
     * @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);
    /**
     * 检查人脸数据是否要生成工单
     *
     * @param faceList 人脸数据
     * @return 是否生成工单
     */
    Boolean checkFace(List<FaceDTO> faceList);
    /**
     * 检查车辆数据是否要生成工单
     *
     * @param carList 车辆数据
     * @return 是否生成工单
     */
    Boolean checkCar(List<CarDTO> carList);
    /**
     * 检查视频数据是否要生成工单
     *
     * @param videoList
     * @return 是否生成工单
     */
    Boolean checkVideo(List<VideoDTO> videoList);
    /**
     * 获取人脸配置
     * @param id
     * @return
     */
    FaceThresholdForm getFace(Integer id);
    /**
     * 获取车辆配置
     * @param id
     * @return
     */
    CarThresholdForm getCar(Integer id);
    /**
     * 获取视频配置
     * @param id
     * @return
     */
    VideoThresholdForm getVideo(Integer id);
    public int deleteYwThresholdById(Long id);
}
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
@@ -1,36 +1,31 @@
package com.ycl.platform.service.impl;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.platform.domain.dto.CarDTO;
import com.ycl.platform.domain.dto.FaceDTO;
import com.ycl.platform.domain.dto.VideoDTO;
import com.ycl.platform.domain.entity.WorkOrder;
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.WorkOrderMapper;
import com.ycl.platform.mapper.YwThresholdMapper;
import com.ycl.platform.service.IYwThresholdService;
import com.ycl.utils.DateUtils;
import enumeration.general.BusinessTypeEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import utils.DateUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * 运维阈值Service业务层处理
 *
 * @author gonghl
 * @date 2024-03-25
 * @date 2024-07-19
 */
@Service
@RequiredArgsConstructor
public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService {
    private final YwThresholdMapper ywThresholdMapper;
public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService
{
    @Autowired
    private YwThresholdMapper ywThresholdMapper;
    /**
     * 查询运维阈值
@@ -39,7 +34,8 @@
     * @return 运维阈值
     */
    @Override
    public YwThreshold selectYwThresholdById(Integer id) {
    public YwThreshold selectYwThresholdById(Long id)
    {
        return ywThresholdMapper.selectYwThresholdById(id);
    }
@@ -50,11 +46,11 @@
     * @return 运维阈值
     */
    @Override
    public List<YwThreshold> selectYwThresholdList(YwThreshold ywThreshold) {
        List<YwThreshold> list = new LambdaQueryChainWrapper<>(baseMapper)
                .orderByDesc(YwThreshold::getCreateTime)
                .list();
        return list;
    public Map<String, List<YwThreshold>> selectYwThresholdList(YwThreshold ywThreshold)
    {
        List<YwThreshold> ywThresholds = ywThresholdMapper.selectYwThresholdList(ywThreshold);
        Map<String, List<YwThreshold>> map = ywThresholds.stream().collect(Collectors.groupingBy(YwThreshold::getMonitorType));
        return map;
    }
    /**
@@ -64,7 +60,8 @@
     * @return 结果
     */
    @Override
    public int insertYwThreshold(YwThreshold ywThreshold) {
    public int insertYwThreshold(YwThreshold ywThreshold)
    {
        ywThreshold.setCreateTime(DateUtils.getNowDate());
        return ywThresholdMapper.insertYwThreshold(ywThreshold);
    }
@@ -72,13 +69,14 @@
    /**
     * 修改运维阈值
     *
     * @param ywThreshold 运维阈值
     * @param list 运维阈值
     * @return 结果
     */
    @Override
    public int updateYwThreshold(YwThreshold ywThreshold) {
        ywThreshold.setUpdateTime(DateUtils.getNowDate());
        return ywThresholdMapper.updateYwThreshold(ywThreshold);
    public Boolean updateYwThreshold(List<YwThreshold> list)
    {
        list.forEach(item -> item.setCreateTime(new Date()));
        return updateBatchById(list);
    }
    /**
@@ -88,7 +86,8 @@
     * @return 结果
     */
    @Override
    public int deleteYwThresholdByIds(Integer[] ids) {
    public int deleteYwThresholdByIds(Long[] ids)
    {
        return ywThresholdMapper.deleteYwThresholdByIds(ids);
    }
@@ -99,145 +98,8 @@
     * @return 结果
     */
    @Override
    public int deleteYwThresholdById(Integer id) {
    public int deleteYwThresholdById(Long 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);
    }
    @Override
    public Boolean checkFace(List<FaceDTO> faceList) {
        YwThreshold faceEntity = new LambdaQueryChainWrapper<>(baseMapper)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.FACE)
                .one();
        if (Objects.isNull(faceEntity)) {
            throw new RuntimeException("请配置人脸的工单阈值");
        }
        // todo 遍历条件,生成工单
        return Boolean.FALSE;
    }
    @Override
    public Boolean checkCar(List<CarDTO> faceList) {
        YwThreshold carEntity = new LambdaQueryChainWrapper<>(baseMapper)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.CAR)
                .one();
        if (Objects.isNull(carEntity)) {
            throw new RuntimeException("请配置车辆的工单阈值");
        }
        // todo 遍历条件,生成工单
        return Boolean.FALSE;
    }
    @Override
    public Boolean checkVideo(List<VideoDTO> faceList) {
        YwThreshold videoEntity = new LambdaQueryChainWrapper<>(baseMapper)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.VIDEO)
                .one();
        if (Objects.isNull(videoEntity)) {
            throw new RuntimeException("请配置视频的工单阈值");
        }
        // todo 遍历条件,生成工单
        return Boolean.FALSE;
    }
    @Override
    public FaceThresholdForm getFace(Integer id) {
        YwThreshold result = new LambdaQueryChainWrapper<>(baseMapper)
                .select(YwThreshold::getId,
                        YwThreshold::getMonitorType,
                        YwThreshold::getCaptureNum,
                        YwThreshold::getCaptureNumAuto,
                        YwThreshold::getTimelyRate,
                        YwThreshold::getTimelyRateAuto,
                        YwThreshold::getDelayAmount,
                        YwThreshold::getDelayAmountAuto,
                        YwThreshold::getDeviceActiveRate,
                        YwThreshold::getDeviceActiveRateAuto,
                        YwThreshold::getTimeAccuracy,
                        YwThreshold::getTimeAccuracyAuto,
                        YwThreshold::getTimelyCapture,
                        YwThreshold::getTimelyCaptureAuto)
                .eq(YwThreshold::getId, id)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.FACE)
                .one();
        FaceThresholdForm form = new FaceThresholdForm();
        BeanUtils.copyProperties(result, form);
        return form;
    }
    @Override
    public CarThresholdForm getCar(Integer id) {
        YwThreshold result = new LambdaQueryChainWrapper<>(baseMapper)
                .select(YwThreshold::getId,
                        YwThreshold::getMonitorType,
                        YwThreshold::getPassCarNum,
                        YwThreshold::getPassCarNumAuto,
                        YwThreshold::getPassCarMissRate,
                        YwThreshold::getPassCarMissRateAuto,
                        YwThreshold::getPassCarEffectiveNum,
                        YwThreshold::getPassCarEffectiveNumAuto,
                        YwThreshold::getDeviceActiveRate,
                        YwThreshold::getDeviceActiveRateAuto,
                        YwThreshold::getTimeAccuracy,
                        YwThreshold::getTimeAccuracyAuto,
                        YwThreshold::getTimelyCapture,
                        YwThreshold::getTimelyCaptureAuto)
                .eq(YwThreshold::getId, id)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.CAR)
                .one();
        CarThresholdForm form = new CarThresholdForm();
        BeanUtils.copyProperties(result, form);
        return form;
    }
    @Override
    public VideoThresholdForm getVideo(Integer id) {
        YwThreshold result = new LambdaQueryChainWrapper<>(baseMapper)
                .select(YwThreshold::getImageQuality,
                        YwThreshold::getId,
                        YwThreshold::getMonitorType,
                        YwThreshold::getImageQualityAuto,
                        YwThreshold::getVideoQuality,
                        YwThreshold::getVideoQualityAuto,
                        YwThreshold::getAnnotationAccuracy,
                        YwThreshold::getAnnotationAccuracyAuto)
                .eq(YwThreshold::getId, id)
                .eq(YwThreshold::getMonitorType, BusinessTypeEnum.VIDEO)
                .one();
        VideoThresholdForm form = new VideoThresholdForm();
        BeanUtils.copyProperties(result, form);
        return form;
    }
}
ycl-server/src/main/java/com/ycl/task/HKTask.java
@@ -1,11 +1,15 @@
package com.ycl.task;
import com.alibaba.fastjson2.JSONObject;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.param.HK.FaceDeviceInspectionParam;
import com.ycl.platform.domain.param.HK.VehicleDeviceInspectionParam;
import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult;
import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult;
import com.ycl.platform.mapper.YwThresholdMapper;
import com.ycl.web.HKClient;
import enumeration.BusinessType;
import enumeration.general.BusinessTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
@@ -23,9 +27,10 @@
    @Autowired
    private MongoTemplate mongoTemplate;
    @Autowired
    private HKClient hkClient;
    @Autowired
    private YwThresholdMapper thresholdMapper;
    private final static Integer pageNo = 1;
    private final static Integer pageSize = 5000;
@@ -49,7 +54,7 @@
                throw new RuntimeException("车辆设备全检指标监测结果数据为空");
            }
            //TODO:同步的数据可能需要工单阈值等处理
            List<YwThreshold> ywThresholds = thresholdMapper.selectByType(BusinessTypeEnum.CAR.name());
            //存放在mongo中
            mongoTemplate.insert(list);
        } else {
ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml
@@ -1,71 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.platform.mapper.YwThresholdMapper">
    <resultMap type="YwThreshold" id="YwThresholdResult">
        <result property="id" column="id"/>
        <result property="monitorType" column="monitor_type"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="deleted" column="deleted"/>
        <result property="id"    column="id"    />
        <result property="monitorType"    column="monitor_type"    />
        <result property="countType"    column="count_type"    />
        <result property="name"    column="name"    />
        <result property="value"    column="value"    />
        <result property="valueAuto"    column="value_auto"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="description"    column="description"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
    <sql id="selectYwThresholdVo">
        select id, monitor_type, create_time, update_time, deleted
        from t_yw_threshold
        select id, monitor_type, count_type, name, value, value_auto, create_time, update_time, description, deleted from t_yw_threshold
    </sql>
    <select id="selectYwThresholdList" parameterType="YwThreshold" resultMap="YwThresholdResult">
        <include refid="selectYwThresholdVo"/>
        <where>
            <if test="monitorType != null  and monitorType != ''">and monitor_type = #{monitorType}</if>
        <where>
            <if test="monitorType != null  and monitorType != ''"> and monitor_type = #{monitorType}</if>
            <if test="countType != null  and countType != ''"> and count_type = #{countType}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="value != null  and value != ''"> and value = #{value}</if>
            <if test="valueAuto != null  and valueAuto != ''"> and value_auto = #{valueAuto}</if>
            <if test="description != null  and description != ''"> and description = #{description}</if>
            <if test="deleted != null  and deleted != ''"> and deleted = #{deleted}</if>
        </where>
    </select>
    <select id="selectYwThresholdById" parameterType="Integer" resultMap="YwThresholdResult">
    <select id="selectYwThresholdById" parameterType="Long" resultMap="YwThresholdResult">
        <include refid="selectYwThresholdVo"/>
        where id = #{id}
    </select>
    <insert id="insertYwThreshold" parameterType="YwThreshold" useGeneratedKeys="true" keyProperty="id">
        insert into t_yw_threshold
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="monitorType != null and monitorType != ''">monitor_type,</if>
            <if test="countType != null">count_type,</if>
            <if test="name != null">name,</if>
            <if test="value != null">value,</if>
            <if test="valueAuto != null">value_auto,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="description != null">description,</if>
            <if test="deleted != null">deleted,</if>
        </trim>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="monitorType != null and monitorType != ''">#{monitorType},</if>
            <if test="countType != null">#{countType},</if>
            <if test="name != null">#{name},</if>
            <if test="value != null">#{value},</if>
            <if test="valueAuto != null">#{valueAuto},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="description != null">#{description},</if>
            <if test="deleted != null">#{deleted},</if>
        </trim>
         </trim>
    </insert>
    <update id="updateYwThreshold" parameterType="YwThreshold">
        update t_yw_threshold
        <trim prefix="SET" suffixOverrides=",">
            <if test="monitorType != null and monitorType != ''">monitor_type = #{monitorType},</if>
            <if test="countType != null">count_type = #{countType},</if>
            <if test="name != null">name = #{name},</if>
            <if test="value != null">value = #{value},</if>
            <if test="valueAuto != null">value_auto = #{valueAuto},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="description != null">description = #{description},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteYwThresholdById" parameterType="Integer">
        delete
        from t_yw_threshold
        where id = #{id}
    <delete id="deleteYwThresholdById" parameterType="Long">
        delete from t_yw_threshold where id = #{id}
    </delete>
    <delete id="deleteYwThresholdByIds" parameterType="String">
        delete from t_yw_threshold where id in
        delete from t_yw_threshold where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
</mapper>