| | |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author gonghl |
| | |
| | | @Getter |
| | | public enum ContractRule { |
| | | |
| | | CONTRACT_RULE_1("视频平均在线率", Arrays.asList("CONTRACT_RULE_2", "CONTRACT_RULE_3", "CONTRACT_RULE_4", "CONTRACT_RULE_5")), |
| | | CONTRACT_RULE_2("≥98%", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_3("95%≤视频平均在线率<98%", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_4("90%≤视频平均在线率<95%", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_5("<90%", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_6("前端感知源治理工作", Arrays.asList("CONTRACT_RULE_7", "CONTRACT_RULE_8", "CONTRACT_RULE_9")), |
| | | CONTRACT_RULE_7("时钟同步(超过±3秒为不合格)", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_8("OSD标识", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_9("一机一档", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_10("存储故障", Arrays.asList("CONTRACT_RULE_11", "CONTRACT_RULE_12")), |
| | | CONTRACT_RULE_11("因存储设备、云存储软件等引起平台不能正常查看历史图像,须在24小时排除故障", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_12("因视频或者图片丢失导致重要案事件不能回放或查看", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_13("对于前端点位异常情况的处理", List.of("CONTRACT_RULE_14")), |
| | | CONTRACT_RULE_14("镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_15("建立数据监测维护机制", List.of("CONTRACT_RULE_16")), |
| | | CONTRACT_RULE_16("中标人应当建立数据监测维护机制,当发生数据异常情况时,应在 24 小时内恢复。(数据异常包括实时监控或录像视频拉流失败,图片获取失败、视觉计算解析异常等)。", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_17("确保录像完整不定期对所有点位录像完整性抽查", Arrays.asList("CONTRACT_RULE_18", "CONTRACT_RULE_19", "CONTRACT_RULE_20", "CONTRACT_RULE_21", "CONTRACT_RULE_22")), |
| | | CONTRACT_RULE_18("每路视频累计丢失10分钟以内", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_19("丢失10-60 分钟", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_20("丢失1 小时-4 小时(含)", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_21("丢失4 小时-12 小时(含)", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_22("丢失12 小时以上", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_23("确保图片完整不定期对所有人脸车辆以及智能前端抓拍的图片完整性抽查", List.of("CONTRACT_RULE_24")), |
| | | CONTRACT_RULE_24("发现后台存储不能调取前端设备图片", Collections.EMPTY_LIST), |
| | | CONTRACT_RULE_Online(1,"设备平均在线率", 0), |
| | | |
| | | CONTRACT_RULE_2(2,"前端感知源治理工作", 0), |
| | | CONTRACT_RULE_Time(3,"时钟同步(超过±3秒为不合格)", 2), |
| | | CONTRACT_RULE_OSD(4,"OSD标识", 2), |
| | | CONTRACT_RULE_OneFile(5,"一机一档", 2), |
| | | |
| | | CONTRACT_RULE_6(6,"存储故障", 0), |
| | | CONTRACT_RULE_7(7,"因存储设备、云存储软件等引起平台不能正常查看历史图像,须在24小时排除故障", 6), |
| | | CONTRACT_RULE_8(8,"因视频或者图片丢失导致重要案事件不能回放或查看", 6), |
| | | |
| | | CONTRACT_RULE_9(9,"对于前端点位异常情况的处理", 0), |
| | | CONTRACT_RULE_10(10,"镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮", 9), |
| | | |
| | | CONTRACT_RULE_13(13,"确保录像完整不定期对所有点位录像完整性抽查", 0), |
| | | |
| | | CONTRACT_RULE_19(19,"确保图片完整不定期对所有人脸车辆以及智能前端抓拍的图片完整性抽查", 0), |
| | | CONTRACT_RULE_20(20,"发现后台存储不能调取前端设备图片", 19), |
| | | |
| | | ; |
| | | |
| | | private final Integer id; |
| | | private final String name; |
| | | private final List<String> children; |
| | | private final Integer parentId; |
| | | |
| | | ContractRule(String name, List<String> children) { |
| | | ContractRule(Integer id, String name, Integer parentId) { |
| | | this.id = id; |
| | | this.name = name; |
| | | this.children = children; |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public static List<ContractRule> getParent() { |
| | | return Arrays.stream(ContractRule.values()).filter(contractRule -> !contractRule.getChildren().isEmpty()).toList(); |
| | | return Arrays.stream(ContractRule.values()).filter(contractRule -> contractRule.parentId ==0).toList(); |
| | | } |
| | | |
| | | public static List<ContractRule> getChildren(ContractRule parent) { |
| | | return parent.getChildren().stream().map(ContractRule::valueOf).collect(Collectors.toList()); |
| | | return Arrays.stream(ContractRule.values()).filter(contractRule -> parent.id.equals(contractRule.parentId)).toList(); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.apache.poi.ss.util.CellRangeAddressList; |
| | | import org.apache.poi.ss.util.CellReference; |
| | | import org.apache.poi.xssf.usermodel.XSSFDataValidation; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | * 所以能做的自定义操作很丰富 |
| | | */ |
| | | // static class CustomCellWriteHandler { |
| | | |
| | | @Override |
| | | public void afterCellDispose(CellWriteHandlerContext context) { |
| | | // 当前的 cell |
| | | Cell cell = context.getCell(); |
| | | // 这里可以对cell进行任何操作 |
| | | // 这里就要考虑 你要针对哪一列进行个性化处理 一定要记得加判断 因为每个 cell 都会执行到这里 所以要记得区分 |
| | | if (BooleanUtils.isTrue(context.getHead()) && cell.getColumnIndex() == 1) { |
| | | // 1 表示 省那一列 要对省市区进行联动下拉处理 |
| | | ExcelAreaUtil.writeAreaInfo(context, 0); |
| | | } |
| | | @Override |
| | | public void afterCellDispose(CellWriteHandlerContext context) { |
| | | // 当前的 cell |
| | | Cell cell = context.getCell(); |
| | | // 这里可以对cell进行任何操作 |
| | | // 这里就要考虑 你要针对哪一列进行个性化处理 一定要记得加判断 因为每个 cell 都会执行到这里 所以要记得区分 |
| | | if (BooleanUtils.isTrue(context.getHead()) && cell.getColumnIndex() == 1) { |
| | | // 1 表示 省那一列 要对省市区进行联动下拉处理 |
| | | ExcelAreaUtil.writeAreaInfo(context, 0); |
| | | } |
| | | } |
| | | // } |
| | | |
| | | public static class ExcelAreaUtil { |
| | |
| | | // 准备点数据 |
| | | List<AreaInfo> provinceList = new ArrayList<>(); |
| | | for (ContractRule contractRule : ContractRule.getParent()) { |
| | | provinceList.add(new AreaInfo(contractRule.getName(), ContractRule.getChildren(contractRule).stream().map(ContractRule::getName).toList())); |
| | | provinceList.add(new AreaInfo(contractRule.getName(), CollectionUtils.isEmpty(ContractRule.getChildren(contractRule)) ? null : ContractRule.getChildren(contractRule).stream().map(ContractRule::getName).toList())); |
| | | } |
| | | |
| | | // 获取到当前的 excel 因为要创建隐藏的 sheet 也就是省市区的实际内容都来自于隐藏的 sheet |
| | |
| | | for (AreaInfo pro : provinceList) { |
| | | String pName = pro.getName(); |
| | | List<String> cList = pro.getAreaList(); |
| | | Row cRow = hideSheet.createRow(rowId++); |
| | | cRow.createCell(0).setCellValue(pName); |
| | | for (int j = 0; j < cList.size(); j++) { |
| | | String cInfo = cList.get(j); |
| | | Cell cCell = cRow.createCell(j + 1); |
| | | cCell.setCellValue(cInfo); |
| | | if (!CollectionUtils.isEmpty(cList)) { |
| | | Row cRow = hideSheet.createRow(rowId++); |
| | | cRow.createCell(0).setCellValue(pName); |
| | | for (int j = 0; j < cList.size(); j++) { |
| | | String cInfo = cList.get(j); |
| | | Cell cCell = cRow.createCell(j + 1); |
| | | cCell.setCellValue(cInfo); |
| | | } |
| | | |
| | | // 添加名称管理器 |
| | | String range = getRange(1, rowId, cList.size()); |
| | | Name name = workbook.createName(); |
| | | // key不可重复 |
| | | name.setNameName(pName); |
| | | String formula = "area!" + range; |
| | | name.setRefersToFormula(formula); |
| | | } |
| | | |
| | | // 添加名称管理器 |
| | | String range = getRange(1, rowId, cList.size()); |
| | | Name name = workbook.createName(); |
| | | // key不可重复 |
| | | name.setNameName(pName); |
| | | String formula = "area!" + range; |
| | | name.setRefersToFormula(formula); |
| | | } |
| | | |
| | | // 给省添加下拉 |
| | | int lastRow = 100; |
| | | setDataValidation(sheet, 1, lastRow, startIndex, startIndex); |
| | |
| | | CellRangeAddressList provRangeAddressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol); |
| | | DataValidation provinceDataValidation = dvHelper.createValidation(provConstraint, provRangeAddressList); |
| | | // 验证 |
| | | provinceDataValidation.createErrorBox("error", "请选择正确的省份"); |
| | | provinceDataValidation.createErrorBox("error", "请选择正确的规则"); |
| | | provinceDataValidation.setShowErrorBox(true); |
| | | provinceDataValidation.setSuppressDropDownArrow(true); |
| | | sheetPro.addValidationData(provinceDataValidation); |
| | |
| | | |
| | | private static List<CalculateRule> getExcelData() { |
| | | ArrayList<CalculateRule> list = new ArrayList<>(); |
| | | CalculateRule calculateRule1 = new CalculateRule(); |
| | | calculateRule1.setId(1); |
| | | calculateRule1.setRuleName("视频平均在线率"); |
| | | calculateRule1.setRuleCondition("≥98%"); |
| | | calculateRule1.setMax(98D); |
| | | calculateRule1.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule1.setCalcFraction(0.00); |
| | | list.add(calculateRule1); |
| | | CalculateRule calculateRule2 = new CalculateRule(); |
| | | calculateRule2.setRuleName("视频平均在线率"); |
| | | calculateRule2.setRuleCondition("95%≤视频平均在线率<98%"); |
| | | calculateRule2.setMax(97D); |
| | | calculateRule2.setMin(95D); |
| | | calculateRule2.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule2.setCalcFraction(5.00); |
| | | list.add(calculateRule2); |
| | | CalculateRule calculateRule3 = new CalculateRule(); |
| | | calculateRule3.setRuleName("视频平均在线率"); |
| | | calculateRule3.setRuleCondition("90%≤视频平均在线率<95%"); |
| | | calculateRule3.setMax(94D); |
| | | calculateRule3.setMin(90D); |
| | | calculateRule3.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule3.setCalcFraction(10.00); |
| | | list.add(calculateRule3); |
| | | CalculateRule calculateRule33 = new CalculateRule(); |
| | | calculateRule33.setRuleName("视频平均在线率"); |
| | | calculateRule33.setRuleCondition("<90%"); |
| | | calculateRule33.setMin(89D); |
| | | calculateRule33.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule33.setCalcFraction(10.00); |
| | | list.add(calculateRule33); |
| | | CalculateRule calculateRule4 = new CalculateRule(); |
| | | calculateRule4.setId(2); |
| | | calculateRule4.setRuleName("前端感知源治理工作"); |
| | | calculateRule4.setRuleCondition("时钟同步(超过±3秒为不合格)"); |
| | | calculateRule4.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY); |
| | | calculateRule4.setCalcFraction(0.1); |
| | | list.add(calculateRule4); |
| | | CalculateRule calculateRule7 = new CalculateRule(); |
| | | calculateRule7.setRuleName("前端感知源治理工作"); |
| | | calculateRule7.setRuleCondition("OSD标识"); |
| | | list.add(calculateRule7); |
| | | CalculateRule calculateRule6 = new CalculateRule(); |
| | | calculateRule6.setRuleName("前端感知源治理工作"); |
| | | calculateRule6.setRuleCondition("一机一档"); |
| | | list.add(calculateRule6); |
| | | CalculateRule calculateRule5 = new CalculateRule(); |
| | | calculateRule5.setId(3); |
| | | calculateRule5.setRuleName("后台系统的保障"); |
| | | calculateRule5.setRuleCondition("单次故障时长若超出72小时不足144小时的,每超出12小时(不足12小时按12小时计)"); |
| | | calculateRule5.setMax(144D); |
| | | calculateRule5.setMin(72D); |
| | | calculateRule5.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_AFTER_DIVIDING_QUANTITY); |
| | | calculateRule5.setCalcFraction(2.00); |
| | | calculateRule5.setCalcUnit(12); |
| | | list.add(calculateRule5); |
| | | |
| | | setTemplateRule(list,1,"设备平均在线率","≥98%",null,98D,RuleDeductCategoryEnum.DEDUCT_POINTS,0.00); |
| | | setTemplateRule(list,null,"设备平均在线率","95%≤设备平均在线率<98%",97D,95D,RuleDeductCategoryEnum.DEDUCT_POINTS,5.00); |
| | | setTemplateRule(list,null,"设备平均在线率","90%≤设备平均在线率<95%",94D,90D,RuleDeductCategoryEnum.DEDUCT_POINTS,10.00); |
| | | setTemplateRule(list,null,"设备平均在线率","<90%",89D,null,RuleDeductCategoryEnum.DEDUCT_POINTS,20.00); |
| | | |
| | | setTemplateRule(list,2,"前端感知源治理工作","时钟同步(超过±3秒为不合格)",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | setTemplateRule(list,null,"前端感知源治理工作","OSD标识",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | setTemplateRule(list,null,"前端感知源治理工作","一机一档",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | |
| | | setTemplateRule(list,3,"存储故障","因存储设备、云存储软件等引起平台不能正常查看历史图像,单次故障时长在24小时以内的",24D,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"存储故障","因存储设备、云存储软件等引起平台不能正常查看历史图像,单次故障时长若超出24小时以上。",null,24D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | setTemplateRule(list,null,"存储故障","因视频或者图片丢失导致重要案事件不能回放或查看",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | setTemplateRule(list,4,"对于前端点位异常情况的处理","镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮,24小时后未修复的",null,24D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"对于前端点位异常情况的处理","镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮,48小时后未修复的",null,48D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | |
| | | setTemplateRule(list,5,"确保录像完整不定期对所有点位录像完整性抽查","每路视频累计丢失10分钟以内",10D,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.2); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失10-60 分钟",10D,60D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失1 小时-4 小时(含)",60D,240D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失4 小时-12 小时(含)",240D,720D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.5); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失12 小时以上",null,720D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | setTemplateRule(list,6,"确保图片完整不定期对所有人脸车辆以及智能前端抓拍的图片完整性抽查","发现后台存储不能调取前端设备图片",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | } |
| | | private static void setTemplateRule(ArrayList<CalculateRule> list,Integer id,String ruleName,String condition,Double max,Double min,RuleDeductCategoryEnum deductCategoryEnum,Double calcFraction) { |
| | | CalculateRule calculateRule = new CalculateRule(); |
| | | calculateRule.setId(id); |
| | | calculateRule.setRuleName(ruleName); |
| | | calculateRule.setRuleCondition(condition); |
| | | calculateRule.setMax(max); |
| | | calculateRule.setMin(min); |
| | | calculateRule.setDeductCategory(deductCategoryEnum); |
| | | calculateRule.setCalcFraction(calcFraction); |
| | | list.add(calculateRule); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private List<CalculateRule> getExcelData() { |
| | | ArrayList<CalculateRule> list = new ArrayList<>(); |
| | | CalculateRule calculateRule1 = new CalculateRule(); |
| | | calculateRule1.setId(1); |
| | | calculateRule1.setRuleName("视频平均在线率"); |
| | | calculateRule1.setRuleCondition("≥98%"); |
| | | calculateRule1.setMax(98D); |
| | | calculateRule1.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule1.setCalcFraction(0.00); |
| | | list.add(calculateRule1); |
| | | CalculateRule calculateRule2 = new CalculateRule(); |
| | | calculateRule2.setRuleName("视频平均在线率"); |
| | | calculateRule2.setRuleCondition("95%≤视频平均在线率<98%"); |
| | | calculateRule2.setMax(97D); |
| | | calculateRule2.setMin(95D); |
| | | calculateRule2.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule2.setCalcFraction(5.00); |
| | | list.add(calculateRule2); |
| | | CalculateRule calculateRule3 = new CalculateRule(); |
| | | calculateRule3.setRuleName("视频平均在线率"); |
| | | calculateRule3.setRuleCondition("90%≤视频平均在线率<95%"); |
| | | calculateRule3.setMax(94D); |
| | | calculateRule3.setMin(90D); |
| | | calculateRule3.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule3.setCalcFraction(10.00); |
| | | list.add(calculateRule3); |
| | | CalculateRule calculateRule33 = new CalculateRule(); |
| | | calculateRule33.setRuleName("视频平均在线率"); |
| | | calculateRule33.setRuleCondition("<90%"); |
| | | calculateRule33.setMin(89D); |
| | | calculateRule33.setDeductCategory(RuleDeductCategoryEnum.DEDUCT_POINTS); |
| | | calculateRule33.setCalcFraction(10.00); |
| | | list.add(calculateRule33); |
| | | CalculateRule calculateRule4 = new CalculateRule(); |
| | | calculateRule4.setId(2); |
| | | calculateRule4.setRuleName("前端感知源治理工作"); |
| | | calculateRule4.setRuleCondition("时钟同步(超过±3秒为不合格)"); |
| | | calculateRule4.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY); |
| | | calculateRule4.setCalcFraction(0.1); |
| | | list.add(calculateRule4); |
| | | CalculateRule calculateRule7 = new CalculateRule(); |
| | | calculateRule7.setRuleName("前端感知源治理工作"); |
| | | calculateRule7.setRuleCondition("OSD标识"); |
| | | calculateRule7.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY); |
| | | calculateRule7.setCalcFraction(0.1); |
| | | list.add(calculateRule7); |
| | | CalculateRule calculateRule6 = new CalculateRule(); |
| | | calculateRule6.setRuleName("前端感知源治理工作"); |
| | | calculateRule6.setRuleCondition("一机一档"); |
| | | calculateRule6.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY); |
| | | calculateRule6.setCalcFraction(0.1); |
| | | list.add(calculateRule6); |
| | | CalculateRule calculateRule5 = new CalculateRule(); |
| | | calculateRule5.setId(3); |
| | | calculateRule5.setRuleName("后台系统的保障"); |
| | | calculateRule5.setRuleCondition("单次故障时长若超出72小时不足144小时的,每超出12小时(不足12小时按12小时计)"); |
| | | calculateRule5.setMax(144D); |
| | | calculateRule5.setMin(72D); |
| | | calculateRule5.setDeductCategory(RuleDeductCategoryEnum.MULTIPLY_POINTS_AFTER_DIVIDING_QUANTITY); |
| | | calculateRule5.setCalcFraction(2.00); |
| | | calculateRule5.setCalcUnit(12); |
| | | list.add(calculateRule5); |
| | | setTemplateRule(list,1,"设备平均在线率","≥98%",null,98D,RuleDeductCategoryEnum.DEDUCT_POINTS,0.00); |
| | | setTemplateRule(list,null,"设备平均在线率","95%≤设备平均在线率<98%",97D,95D,RuleDeductCategoryEnum.DEDUCT_POINTS,5.00); |
| | | setTemplateRule(list,null,"设备平均在线率","90%≤设备平均在线率<95%",94D,90D,RuleDeductCategoryEnum.DEDUCT_POINTS,10.00); |
| | | setTemplateRule(list,null,"设备平均在线率","<90%",89D,null,RuleDeductCategoryEnum.DEDUCT_POINTS,20.00); |
| | | |
| | | setTemplateRule(list,2,"前端感知源治理工作","时钟同步(超过±3秒为不合格)",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | setTemplateRule(list,null,"前端感知源治理工作","OSD标识",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | setTemplateRule(list,null,"前端感知源治理工作","一机一档",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.1); |
| | | |
| | | setTemplateRule(list,3,"存储故障","因存储设备、云存储软件等引起平台不能正常查看历史图像,单次故障时长在24小时以内的",24D,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"存储故障","因存储设备、云存储软件等引起平台不能正常查看历史图像,单次故障时长若超出24小时以上。",null,24D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | setTemplateRule(list,null,"存储故障","因视频或者图片丢失导致重要案事件不能回放或查看",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | setTemplateRule(list,4,"对于前端点位异常情况的处理","镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮,24小时后未修复的",null,24D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"对于前端点位异常情况的处理","镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮,48小时后未修复的",null,48D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | |
| | | setTemplateRule(list,5,"确保录像完整不定期对所有点位录像完整性抽查","每路视频累计丢失10分钟以内",10D,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.2); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失10-60 分钟",60D,10D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,0.5); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失1 小时-4 小时(含)",240D,60D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.0); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失4 小时-12 小时(含)",720D,240D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,1.5); |
| | | setTemplateRule(list,null,"确保录像完整不定期对所有点位录像完整性抽查","丢失12 小时以上",null,720D,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | setTemplateRule(list,6,"确保图片完整不定期对所有人脸车辆以及智能前端抓拍的图片完整性抽查","发现后台存储不能调取前端设备图片",null,null,RuleDeductCategoryEnum.MULTIPLY_POINTS_BY_QUANTITY,2.0); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | private static void setTemplateRule(ArrayList<CalculateRule> list,Integer id,String ruleName,String condition,Double max,Double min,RuleDeductCategoryEnum deductCategoryEnum,Double calcFraction) { |
| | | CalculateRule calculateRule = new CalculateRule(); |
| | | calculateRule.setId(id); |
| | | calculateRule.setRuleName(ruleName); |
| | | calculateRule.setRuleCondition(condition); |
| | | calculateRule.setMax(max); |
| | | calculateRule.setMin(min); |
| | | calculateRule.setDeductCategory(deductCategoryEnum); |
| | | calculateRule.setCalcFraction(calcFraction); |
| | | list.add(calculateRule); |
| | | } |
| | | @Override |
| | | @Transactional |
| | | @SneakyThrows |
New file |
| | |
| | | package com.ycl.task; |
| | | |
| | | |
| | | import com.ycl.platform.mapper.TContractMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 合同考核定时任务 |
| | | */ |
| | | @Slf4j |
| | | @Component("contractTask") |
| | | public class ContractTask { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private TContractMapper contractMapper; |
| | | |
| | | /** |
| | | * 合同考核 在线率每日任务检测 |
| | | * 查生效的合同关联的公司,获取unitId集合 |
| | | * 根据unitId查询对应点位获取各个公司管理的设备Ids |
| | | * 查询三种设备在线不在线情况,封装为一个map<国标码,在线状态> |
| | | * 计算每日每家公司的在线率存入redis |
| | | * 月底计算平均值,根据在线率和合同标准扣减分数 |
| | | */ |
| | | public void onlineCheck() { |
| | | // contractMapper.selectByRuleName(); |
| | | } |
| | | |
| | | } |