From b6d477ad41e2a8ff9393de2beba2e735c78cf781 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 22 七月 2024 18:06:45 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- /dev/null | 51 --- ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml | 69 +++- ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java | 198 ++------------ ycl-server/src/main/java/com/ycl/task/HKTask.java | 9 ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java | 99 ++----- ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java | 16 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java | 193 +++----------- ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java | 95 ------ ycl-common/src/main/java/enumeration/general/CountTypeEnum.java | 27 ++ 9 files changed, 209 insertions(+), 548 deletions(-) diff --git a/ycl-common/src/main/java/enumeration/general/CountTypeEnum.java b/ycl-common/src/main/java/enumeration/general/CountTypeEnum.java new file mode 100644 index 0000000..a3acb3c --- /dev/null +++ b/ycl-common/src/main/java/enumeration/general/CountTypeEnum.java @@ -0,0 +1,27 @@ +package enumeration.general; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 璁℃暟绫诲瀷 + * + * @author锛歺p + * @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; + } +} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java index 874f6d5..ae804d7 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java +++ b/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 Integer 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 Integer 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; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java deleted file mode 100644 index f695de5..0000000 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java +++ /dev/null @@ -1,61 +0,0 @@ -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; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 杞﹁締宸ュ崟闃堝�� - * - * @author锛歺p - * @date锛�2024/4/12 10:30 - */ -@Data -public class CarThresholdForm implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false) - @NotNull(message = "璇烽�夋嫨淇敼鏁版嵁") - private Integer id; - - @NotNull(message = "璇烽�夋嫨璁惧绫诲瀷") - private BusinessTypeEnum monitorType; - - /** 杩囪溅杈� */ - @NotNull(message = "璇峰~鍐欒繃杞︽暟鎹噺") - private Integer passCarNum; - private Integer passCarNumAuto; - - /** 杩囪溅缂哄け鐜� */ - @NotNull(message = "璇峰~鍐欒繃杞︾己澶辩巼") - private BigDecimal passCarMissRate; - private BigDecimal passCarMissRateAuto; - - /** 鏈夋晥杩囪溅鏁版嵁閲� */ - @NotNull(message = "璇峰~鍐欐湁鏁堣繃杞︽暟鎹噺") - private Integer passCarEffectiveNum; - private Integer passCarEffectiveNumAuto; - - /** 璁惧娲昏穬鐜� */ - @NotNull(message = "璇峰~鍐欒澶囨椿璺冪巼") - private BigDecimal deviceActiveRate; - private BigDecimal deviceActiveRateAuto; - - /** 鎶撴媿鍙婃椂鐜� */ - @NotNull(message = "璇峰~鍐欐姄鎷嶅強鏃剁巼") - private BigDecimal timelyCapture; - private BigDecimal timelyCaptureAuto; - - /** 鏃堕挓鍑嗙‘鐜� */ - @NotNull(message = "璇峰~鍐欐椂閽熷噯纭巼") - private BigDecimal timeAccuracy; - private BigDecimal timeAccuracyAuto; - -} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java deleted file mode 100644 index 2a0454b..0000000 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java +++ /dev/null @@ -1,61 +0,0 @@ -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; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 浜鸿劯宸ュ崟闃堝�� - * - * @author锛歺p - * @date锛�2024/4/12 10:30 - */ -@Data -public class FaceThresholdForm implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false) - @NotNull(message = "璇烽�夋嫨淇敼鏁版嵁") - private Integer id; - - @NotNull(message = "璇烽�夋嫨璁惧绫诲瀷") - private BusinessTypeEnum monitorType; - - /** 鎶撴媿閲� */ - @NotNull(message = "璇峰~鍐欐姄鎷嶉噺") - private Integer captureNum; - private Integer captureNumAuto; - - /** 鍙婃椂鐜� */ - @NotNull(message = "璇峰~鍐欏強鏃剁巼") - private BigDecimal timelyRate; - private BigDecimal timelyRateAuto; - - /** 寤惰繜閲� */ - @NotNull(message = "璇峰~鍐欏欢杩熼噺") - private Long delayAmount; - private Long delayAmountAuto; - - /** 璁惧娲昏穬鐜� */ - @NotNull(message = "璇峰~鍐欒澶囨椿璺冪巼") - private BigDecimal deviceActiveRate; - private BigDecimal deviceActiveRateAuto; - - /** 鎶撴媿鍙婃椂鐜� */ - @NotNull(message = "璇峰~鍐欐姄鎷嶅強鏃剁巼") - private BigDecimal timelyCapture; - private BigDecimal timelyCaptureAuto; - - /** 鏃堕挓鍑嗙‘鐜� */ - @NotNull(message = "璇峰~鍐欐椂閽熷噯纭巼") - private BigDecimal timeAccuracy; - private BigDecimal timeAccuracyAuto; - -} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java deleted file mode 100644 index bdb6b36..0000000 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java +++ /dev/null @@ -1,51 +0,0 @@ -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.NotEmpty; -import jakarta.validation.constraints.NotNull; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 瑙嗛宸ュ崟闃堝�� - * - * @author锛歺p - * @date锛�2024/4/12 10:30 - */ -@Data -public class VideoThresholdForm implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false) - @NotNull(message = "璇烽�夋嫨淇敼鏁版嵁") - private Integer id; - - @NotEmpty(message = "璇烽�夋嫨璁惧绫诲瀷") - private BusinessTypeEnum monitorType; - - /** 瑙嗛璐ㄩ噺 */ - @NotBlank(message = "璇烽�夋嫨瑙嗛璐ㄩ噺宸ュ崟闃堝��") - private String videoQuality; -// @NotBlank(message = "璇烽�夋嫨瑙嗛璐ㄩ噺涓嬪彂闃堝��") - private String videoQualityAuto; - - /** 鍥惧儚璐ㄩ噺 */ - @NotBlank(message = "璇烽�夋嫨鍥惧儚璐ㄩ噺宸ュ崟闃堝��") - private String imageQuality; -// @NotBlank(message = "璇烽�夋嫨鍥惧儚璐ㄩ噺涓嬪彂闃堝��") - private String imageQualityAuto; - - /** 鏍囨敞鍑嗙‘鐜� */ - @NotNull(message = "璇峰~鍐欐爣娉ㄥ噯纭巼宸ュ崟闃堝��") - private BigDecimal annotationAccuracy; -// @NotBlank(message = "璇峰~鍐欐爣娉ㄥ噯纭巼涓嬪彂闃堝��") - private BigDecimal annotationAccuracyAuto; - -} diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java b/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java index 7a660a9..33197f8 100644 --- a/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java +++ b/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; /** * 杩愮淮闃堝�糃ontroller * * @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)); - } - } diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java index 5180abe..38c8cf1 100644 --- a/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java +++ b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java @@ -9,16 +9,17 @@ * 杩愮淮闃堝�糓apper鎺ュ彛 * * @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); } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java b/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java index 019c780..58b5ad0 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java +++ b/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; /** * 杩愮淮闃堝�糞ervice鎺ュ彛 * * @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); } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java index 6b3703c..273be68 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java +++ b/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; /** * 杩愮淮闃堝�糞ervice涓氬姟灞傚鐞� * * @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; } } diff --git a/ycl-server/src/main/java/com/ycl/task/HKTask.java b/ycl-server/src/main/java/com/ycl/task/HKTask.java index 2f4ae43..e508811 100644 --- a/ycl-server/src/main/java/com/ycl/task/HKTask.java +++ b/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()); //瀛樻斁鍦╩ongo涓� mongoTemplate.insert(list); } else { diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml index d1f7c46..e969c66 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/YwThresholdMapper.xml +++ b/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> \ No newline at end of file -- Gitblit v1.8.0