ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
@@ -12,7 +12,7 @@ import java.util.List; /** * 考核积分明细对象 t_check_score * 考核积分明细对象 * * @author ruoyi * @date 2024-04-22 ycl-pojo/src/main/java/com/ycl/platform/domain/excel/CalculateExport.java
@@ -44,7 +44,7 @@ private Integer num; /** * 分数 * */ @ExcelProperty({"自贡市公共视频监控系统续维合同", "分数"}) private BigDecimal score; ycl-pojo/src/main/java/com/ycl/platform/domain/query/HomeQuery.java
@@ -40,4 +40,11 @@ * 数据类型1/2 累计数据/每日数据 */ private Integer category; /** * * 区域 */ private String area; } ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java
@@ -1,11 +1,14 @@ package com.ycl.platform.domain.query; import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.platform.base.AbsQuery; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; import java.util.List; /** @@ -44,5 +47,29 @@ @ApiModelProperty("故障类型") private List<String> errorTypeList; /** * 报备开始时时 */ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date reportTimeStart; /** * 报备结束时间 */ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date reportTimeEnd; /** * 有效开始时间 */ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date effectTimeStart; /** * 有效结束时间 */ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date effectTimeEnd; } ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -179,7 +179,7 @@ } } //分数保留一位小数 checkScores.stream().forEach(item -> item.setScore(item.getScore().setScale(1, RoundingMode.HALF_UP))); checkScores.stream().forEach(item -> item.setScore(item.getScore().setScale(3, RoundingMode.HALF_UP))); Map<Long, List<CheckScore>> map = checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId)); for (Map.Entry<Long, List<CheckScore>> entry : map.entrySet()) { List<CheckScore> tempList = getCheckScores(entry); @@ -205,13 +205,13 @@ if (!hasCar){ CheckScore car = new CheckScore(); car.setExamineCategory((short) 2); car.setScore(new BigDecimal("0.0")); car.setScore(new BigDecimal("0.00")); tempList.add(car); } if (!hasFace){ CheckScore face = new CheckScore(); face.setExamineCategory((short) 3); face.setScore(new BigDecimal("0.0")); face.setScore(new BigDecimal("0.00")); tempList.add(face); } ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -71,6 +71,7 @@ import java.util.*; import java.util.concurrent.*; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -1269,6 +1270,7 @@ @Override public Map<String, Object> videoHome(HomeQuery monitorQuery) throws ParseException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { List<HomeVideoVO> results = new ArrayList<>(); String month = monitorQuery.getDate(); if (StringUtils.isEmpty(month)) { //如果为空查本月的数据 @@ -1295,13 +1297,30 @@ MongoDatabase database = mongoTemplate.getDb(); MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum"); Integer examineTag = monitorQuery.getExamineTag(); String arealayerno = monitorQuery.getArea(); Document matchConditions = new Document("statTime", new Document("$gte", startDate).append("$lte", endDate)); // 根据examineTag的值动态添加额外的条件 if (examineTag != null && examineTag.equals(1)) { matchConditions.append("provinceTag", true); } else if (examineTag != null && examineTag.equals(2)) { matchConditions.append("deptTag", true); } else if(StringUtils.isNotBlank(arealayerno)){ matchConditions.append("arealayerno", new Document("$regex", "^" + arealayerno)); } Document noExpr = new Document("$and", Arrays.asList( new Document("$gte", Arrays.asList(new Document("$strLenCP", "$no"), 3)), new Document("$ne", Arrays.asList( new Document("$substrCP", Arrays.asList( "$no", new Document("$subtract", Arrays.asList(new Document("$strLenCP", "$no"), 3)), 1 )), "3" )) )); // 正确添加$expr条件(键为"$expr",值为上面定义的条件) matchConditions.append("$expr", noExpr); // 构建聚合管道 List<Document> pipeline = Arrays.asList( new Document("$match", matchConditions), @@ -1337,6 +1356,7 @@ homeVideoVO.setIntegrityNum(doc.getInteger("normalCount")); homeVideoVO.setLoseNum(doc.getInteger("loseCount")); homeVideoVO.setErrNum(doc.getInteger("errCount")); results.add(homeVideoVO); } @@ -1350,8 +1370,24 @@ onlineMatch.add(new Document("provinceTag", true)); } else if (examineTag != null && examineTag.equals(2)) { onlineMatch.add(new Document("deptTag", true)); } } else if(StringUtils.isNotBlank(arealayerno)){ Document noStartsWith = new Document("no", new Document("$regex", "^" + arealayerno)); // 构建倒数第三位不是3的条件 Document noThirdLastNot3 = new Document("$expr", new Document("$and", Arrays.asList( new Document("$gte", Arrays.asList(new Document("$strLenCP", "$no"), 3)), new Document("$ne", Arrays.asList( new Document("$substrCP", Arrays.asList( "$no", new Document("$subtract", Arrays.asList(new Document("$strLenCP", "$no"), 3)), 1 )), "3" )) ))); // 将两个条件用$and组合后添加到条件列表 onlineMatch.add(new Document("$and", Arrays.asList(noStartsWith, noThirdLastNot3))); } // 构建聚合管道 List<Document> onlinePipeline = Arrays.asList( new Document("$match", new Document("$and", onlineMatch)), @@ -1365,6 +1401,10 @@ )) ) ); //排除卡口集合 // 执行聚合查询并获取结果 AggregateIterable<Document> onlineResult = onlineCollection.aggregate(onlinePipeline); for (Document doc : onlineResult) { @@ -1496,10 +1536,13 @@ Integer examineTag = monitorQuery.getExamineTag(); // 构建基本的$match条件 List<Document> matchConditions = new ArrayList<>(); String arealayerno = monitorQuery.getArea(); matchConditions.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate))); matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_CAR))); if (examineTag != null && examineTag.equals(1)) { matchConditions.add(new Document("provinceTag", true)); }else if(StringUtils.isNotBlank(arealayerno)){ matchConditions.add(new Document("orgCode",new Document("$eq", arealayerno))); } // 构建聚合管道 List<Document> pipeline = Arrays.asList( @@ -1524,6 +1567,8 @@ onlineMatch.add(new Document("monitorType", new Document("$regex", "2"))); if (examineTag != null && examineTag.equals(1)) { onlineMatch.add(new Document("provinceTag", true)); }else if(StringUtils.isNotBlank(arealayerno)){ onlineMatch.add(new Document("no", new Document("$regex", "^" + arealayerno))); } // 构建聚合管道 List<Document> onlinePipeline = Arrays.asList( @@ -1602,6 +1647,7 @@ calendar.add(Calendar.DAY_OF_MONTH, -1); // 获取月份最后一天的Date Date endDate = calendar.getTime(); String arealayerno = monitorQuery.getArea(); //mongo查抓拍量 MongoDatabase database = mongoTemplate.getDb(); MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor"); @@ -1612,6 +1658,8 @@ matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_FACE))); if (examineTag != null && examineTag.equals(1)) { matchConditions.add(new Document("provinceTag", true)); }else if(StringUtils.isNotBlank(arealayerno)){ matchConditions.add(new Document("orgCode",new Document("$eq", arealayerno))); } // 构建聚合管道 List<Document> pipeline = Arrays.asList( @@ -1638,6 +1686,8 @@ onlineMatch.add(new Document("monitorType", new Document("$regex", "3"))); if (examineTag != null && examineTag.equals(1)) { onlineMatch.add(new Document("provinceTag", true)); }else if(StringUtils.isNotBlank(arealayerno)){ onlineMatch.add(new Document("no", new Document("$regex", "^" + arealayerno))); } // 构建聚合管道 List<Document> onlinePipeline = Arrays.asList( ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
@@ -119,7 +119,14 @@ WorkOrderServiceImpl self = applicationContext.getBean(WorkOrderServiceImpl.class); return self.batchAddWorkOrder(workOrderList); } private boolean isSameDay(Date date1, Date date2) { if (date1 == null || date2 == null) { return false; } LocalDate localDate1 = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate localDate2 = date2.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return localDate1.isEqual(localDate2); } @Transactional(rollbackFor = Exception.class) public Boolean batchAddWorkOrder(List<WorkOrder> workOrderList) { int total = workOrderList.size(); @@ -164,6 +171,15 @@ for (WorkOrder workOrder : workOrderList) { WorkOrder databaseWorkOrder = mapping.get(workOrder.getSerialNumber()); if (Objects.nonNull(databaseWorkOrder)) { //判断是否是今天的工单 if (!isSameDay(databaseWorkOrder.getCreateTime(), now)) { // 若为前一天的工单,不更新,直接当作新工单新增 workOrder.setCreateTime(now); workOrder.setUpdateTime(now); waitAddList.add(workOrder); continue; // 跳过后续的更新逻辑 } List<String> errorNameList = databaseWorkOrder.getErrorTypeList(); List<String> errorTypes = workOrder.getErrorTypeList(); if (errorNameList.containsAll(errorTypes)) { ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
@@ -37,7 +37,7 @@ LEFT JOIN t_yw_point pt ON r.serial_number = pt.serial_number and pt.deleted = 0 INNER JOIN t_report_error_type ret ON ret.report_id = r.id and ret.deleted = 0 <if test="query.errorTypeList != null and query.errorTypeList.size() > 0"> AND ret.error_type in <foreach collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach> </if> </if> WHERE r.deleted = 0 <if test="query.reportType != null and query.reportType != ''"> @@ -52,6 +52,15 @@ <if test="query.keyword != null and query.keyword != ''"> AND (pt.point_name like concat('%', #{query.keyword}, '%') OR p.yw_person_name like concat('%', #{query.keyword}, '%')) </if> <if test="query.reportTimeStart != null and query.reportTimeEnd != null"> AND r.create_time BETWEEN #{query.reportTimeStart} AND #{query.reportTimeEnd} </if> <if test="query.effectTimeStart != null"> AND r.begin_create_time >= #{query.effectTimeStart} </if> <if test="query.effectTimeEnd != null"> AND r.end_create_time <= #{query.effectTimeEnd} </if> GROUP BY r.id, r.report_materials, r.create_time, r.report_type, r.report_content, r.status, r.serial_number, r.begin_create_time, ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -414,6 +414,9 @@ <if test="deptTag!=null"> and p.dept_tag = #{deptTag} </if> <if test="address != null"> and p.dept_id = #{address} </if> ${params.dataScope} </where> </select>