ycl-pojo/src/main/java/com/ycl/platform/domain/excel/CalculateExport.java
@@ -29,6 +29,12 @@ @ExcelProperty({"自贡市公共视频监控系统续维合同", "规则名称"}) @ColumnWidth(130) private String ruleName; /** * 细则 */ @ExcelProperty({"自贡市公共视频监控系统续维合同", "细则"}) @ColumnWidth(130) private String detailName; /** * 数量 ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java
@@ -160,6 +160,7 @@ // log.error("CLIENT_QueryDeviceTime Failed!" + ToolKits.getErrorCodePrint()); return null; } log.info("OSD时间原始数据格式,{},toString格式{}",deviceTime,deviceTime.toStringTime()); Date checkTime = new Date(); osdResult.setCheckTime(checkTime); String date = deviceTime.toStringTime(); @@ -195,6 +196,7 @@ osdInfo.read(); NET_GBMODE_CUSTOMTITLE_INFO[] stuCustomTitle = osdInfo.stuCustomTitle; for (NET_GBMODE_CUSTOMTITLE_INFO title : stuCustomTitle) { log.info("OSD原始数据格式{}",title); String position = new String(title.szPositon, StandardCharsets.UTF_8).trim(); if("LeftDown".equals(position)) { NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD; ycl-server/src/main/java/com/ycl/platform/controller/CalculateReportController.java
@@ -69,8 +69,8 @@ @PostMapping("/export") @ApiOperation(value = "导出", notes = "导出") @PreAuthorize("@ss.hasPermi('system:calculate:report:export')") public void export(Integer calculateId,Integer contractId, HttpServletResponse response) { calculateReportService.export(calculateId,contractId, response); public void export(Integer whichYear,Integer whichMonth,Integer contractId, HttpServletResponse response) { calculateReportService.export(whichYear,whichMonth,contractId, response); } } ycl-server/src/main/java/com/ycl/platform/mapper/CalculateReportMapper.java
@@ -42,5 +42,5 @@ * 导出数据 * @return 数据 */ List<CalculateExport> exportData(Integer calculateId); List<CalculateExport> exportData(Integer whichYear,Integer whichMonth,Integer contractId); } ycl-server/src/main/java/com/ycl/platform/service/CalculateReportService.java
@@ -92,5 +92,5 @@ * 导出 * @param response 响应 */ void export(Integer calculateId,Integer contractId, HttpServletResponse response); void export(Integer whichYear,Integer whichMonth,Integer contractId, HttpServletResponse response); } ycl-server/src/main/java/com/ycl/platform/service/impl/CalculateReportServiceImpl.java
@@ -225,9 +225,9 @@ @Override @SneakyThrows public void export(Integer calculateId,Integer contractId, HttpServletResponse response) { public void export(Integer whichYear,Integer whichMonth,Integer contractId, HttpServletResponse response) { // 获取数据 List<CalculateExport> list = baseMapper.exportData(calculateId); List<CalculateExport> list = baseMapper.exportData(whichYear,whichMonth,contractId); CalculateExport calculateExport = new CalculateExport(); calculateExport.setRuleName("合计"); calculateExport.setNum(list.stream().mapToInt(CalculateExport::getNum).sum()); ycl-server/src/main/java/com/ycl/task/OsdTask.java
@@ -2,6 +2,11 @@ import com.mongodb.client.result.DeleteResult; import com.ycl.api.DH.lib.NetSDKLib; import com.ycl.api.DH.lib.structure.NET_CFG_GBMODE_INFO; import com.ycl.api.DH.lib.structure.NET_GBMODE_CUSTOMTITLE_INFO; import com.ycl.api.DH.lib.structure.NET_TITLE_OSD_INFO; import com.ycl.api.DH.module.LoginModule; import com.ycl.api.DH.utils.DHApi; import com.ycl.api.HK.HKApi; import com.ycl.api.YS.YSApi; @@ -29,6 +34,9 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -36,6 +44,8 @@ import java.util.concurrent.*; import java.util.function.Function; import java.util.stream.Collectors; import static com.ycl.api.DH.lib.enumeration.NET_EM_CFG_OPERATE_TYPE.NET_EM_CFG_GBMODE; @Slf4j @Component("OsdTask") @@ -60,6 +70,7 @@ public String YSUserName; @Value("${YS.password}") public String YSPassword; /** * 通过查mongoDB每日一机一档数据获取设备ip * 筛选视频设备 @@ -86,7 +97,7 @@ List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); //需要考核的数据 List<String> serialNumbers = oneMachineFileResults.stream().map(result -> result.getSerialNumber().getValue()).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(serialNumbers)) { if (!CollectionUtils.isEmpty(serialNumbers)) { ExecutorService executorService = new ThreadPoolExecutor(16, 128, 5000, @@ -116,7 +127,7 @@ List<OsdCheckResult> checkResults = new ArrayList<>(); Map<String, TMonitor> monitorMap = monitors.stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); for (OSDResult osdResult : osdResultList) { if(osdResult!=null) { if (osdResult != null) { TMonitor monitor = monitorMap.get(osdResult.getSerialNumber()); //封装OsdCheckResult OsdCheckResult osdCheckResult = getOsdCheckResult(osdResult, monitor); @@ -132,7 +143,7 @@ Query pyQuery = new Query(Criteria .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); DeleteResult result = mongoTemplate.remove(pyQuery, OsdCheckResult.class); pointService.setDeviceTagByGB(checkResults,CheckConstants.Rule_Category_Video); pointService.setDeviceTagByGB(checkResults, CheckConstants.Rule_Category_Video); //存放在mongo中 mongoTemplate.insertAll(checkResults); // 工单生成 @@ -170,7 +181,7 @@ } else { osdCheckResult.setOsdTimeCorrect(ApiConstants.OSD_Error); } }else { } else { osdCheckResult.setOsdTimeCorrect(ApiConstants.OSD_Unknown); } //检查通道名是否正确 @@ -181,7 +192,7 @@ } else { osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Error); } }else { } else { osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Unknown); } //检查省是否正确 @@ -191,7 +202,7 @@ } else { osdCheckResult.setOsdProvinceCorrect(ApiConstants.OSD_Error); } }else { } else { osdCheckResult.setOsdProvinceCorrect(ApiConstants.OSD_Unknown); } //检查市是否正确 @@ -201,7 +212,7 @@ } else { osdCheckResult.setOsdCityCorrect(ApiConstants.OSD_Error); } }else { } else { osdCheckResult.setOsdCityCorrect(ApiConstants.OSD_Unknown); } //检查区县是否正确 @@ -212,10 +223,15 @@ } else { osdCheckResult.setOsdPartCorrect(ApiConstants.OSD_Error); } }else { } else { osdCheckResult.setOsdPartCorrect(ApiConstants.OSD_Unknown); } } public void test() throws ExecutionException, InterruptedException { log.info("测试获取OSD"); OSDResult osd3 = DHApi.getOsd("51030446001320141102","51.95.68.3", DHUserName, DHPassword); log.info("大华结果数据:{}",osd3); } } ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
@@ -122,6 +122,7 @@ AND tcr.status=#{status} </if> </where> group by tcr.id ORDER BY tcr.create_time </select> @@ -146,14 +147,26 @@ </select> <select id="exportData" resultType="com.ycl.platform.domain.excel.CalculateExport"> SELECT a.rule_name, COUNT(b.id) AS num, IFNULL(-SUM(b.score), 0) AS score SELECT a.rule_name as ruleName, a.rule_condition as detailName, COUNT(b.id) AS num, IFNULL(-SUM(b.score), 0) AS score FROM t_calculate_rule a LEFT JOIN t_calculate_record tcr ON a.contract_id = tcr.contract_id And tcr.id = #{calculateId} LEFT JOIN t_contract_score b ON b.rule_id = a.id AND auditing_status = 'PASS' AND b.deleted = 0 AND YEAR (b.create_time) = tcr.which_year WHERE a.deleted = 0 GROUP BY a.rule_name LEFT JOIN t_calculate_record tcr ON a.contract_id = tcr.contract_id LEFT JOIN t_contract_score b ON b.rule_id = a.id AND auditing_status = 'PASS' AND b.deleted = 0 AND MONTH(b.create_time) = tcr.which_month AND YEAR(b.create_time) = tcr.which_year <where> a.deleted = 0 and a.contract_id = #{contractId} <if test="whichMonth!=null"> and tcr.which_month = #{whichMonth} </if> <if test="whichYear!=null"> and tcr.which_year = #{whichYear} </if> </where> GROUP BY a.id </select> </mapper>