Merge remote-tracking branch 'origin/master'
# Conflicts:
# ycl-server/src/main/java/com/ycl/platform/mapper/TMonitorMapper.java
| | |
| | | @ExcelIgnore |
| | | private Boolean importantCommandImageTag; |
| | | |
| | | @ColumnWidth(16) |
| | | @ExcelProperty("是否重点指挥图像") |
| | | private String importantCommandImageTagString; |
| | | } |
| | |
| | | /** |
| | | * 每隔100条存储数据库,然后清理list ,方便内存回收 |
| | | */ |
| | | private static final int BATCH_COUNT = 100; |
| | | private static final int BATCH_COUNT = 500; |
| | | |
| | | /** |
| | | * 缓存的数据 |
| | |
| | | import com.ycl.system.domain.group.Add; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | @PostMapping("/import/{unitId}") |
| | | @ApiOperation(value = "导入数据", notes = "导入数据") |
| | | public Result importData(MultipartFile file, @PathVariable("unitId") Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) throws IOException { |
| | | return ywPointService.importData(file, unitId, startTime, endTime, provinceTag, importantTag, importantCommandImageTag); |
| | | public Result importData(MultipartFile file, |
| | | @PathVariable("unitId") Integer unitId, |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, |
| | | Boolean provinceTag, |
| | | Boolean importantCommandImageTag) throws IOException { |
| | | return ywPointService.importData(file, unitId, startTime, endTime, provinceTag, importantCommandImageTag); |
| | | } |
| | | |
| | | } |
| | |
| | | * @param page |
| | | * @param query |
| | | */ |
| | | IPage assetManagement(IPage<TMonitorVO> page, @Param("query") DataCenterQuery query); |
| | | void assetManagement(IPage<TMonitorVO> page, @Param("query") DataCenterQuery query); |
| | | |
| | | void deleteAll(); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<PointExport> export(@Param("query") YwPointQuery query); |
| | | |
| | | void deleteAll(); |
| | | } |
| | |
| | | * @param unitId 运维单位id |
| | | * @return |
| | | */ |
| | | Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) throws IOException; |
| | | Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantCommandImageTag) throws IOException; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) throws IOException { |
| | | public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantCommandImageTag) throws IOException { |
| | | Consumer<List<PointExport>> consumer = (dataList) -> { |
| | | this.updatePoint(dataList, unitId, startTime, endTime, provinceTag, importantTag, importantCommandImageTag); |
| | | this.updatePoint(dataList, unitId, startTime, endTime, provinceTag, importantCommandImageTag); |
| | | }; |
| | | EasyExcel.read(file.getInputStream(), PointExport.class , new CurrencyDataListener(consumer)).headRowNumber(1).doReadAll(); |
| | | return Result.ok(); |
| | |
| | | * @param dataList |
| | | * @param unitId |
| | | */ |
| | | private void updatePoint(List<PointExport> dataList, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) { |
| | | private void updatePoint(List<PointExport> dataList, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantCommandImageTag) { |
| | | if (CollectionUtils.isEmpty(dataList)) { |
| | | throw new RuntimeException("导入数据不能为空"); |
| | | } |
| | |
| | | .set(YwPoint::getStartTime, startTime) |
| | | .set(YwPoint::getEndTime, endTime) |
| | | .set(YwPoint::getProvinceTag, provinceTag) |
| | | .set(YwPoint::getImportantTag, importantTag) |
| | | .set(YwPoint::getImportantCommandImageTag, importantCommandImageTag) |
| | | .update(); |
| | | } |
| | |
| | | import com.ycl.platform.domain.result.UY.OneMachineFileResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.mapper.YwPointMapper; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import com.ycl.platform.service.YwPointService; |
| | | import com.ycl.system.entity.SysDictData; |
| | |
| | | @Autowired |
| | | private YwPointService ywPointService; |
| | | @Autowired |
| | | private YwPointMapper ywPointMapper; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //同步mongodb一机一档到数据库 |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void synchronize() { |
| | | // 获取Calendar实例,默认使用当前时区和语言环境 |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | SysDictData sysDictData = new SysDictData(); |
| | | sysDictData.setDictType("platform_important_site"); |
| | | List<SysDictData> DictDataList = dictDataService.selectDictDataList(sysDictData); |
| | | //采集区域为重点点位的集合 |
| | | List<String> importantSite = DictDataList.stream().map(SysDictData::getDictValue).collect(Collectors.toList()); |
| | | |
| | | //全年留存 |
| | |
| | | log.info("result集合{},设备集合{},点位集合{}", oneMachineFileResults.size(), monitorList.size(), ywPointList.size()); |
| | | //插入数据库 |
| | | if (!CollectionUtils.isEmpty(monitorList)) { |
| | | monitorService.saveOrUpdateBatch(monitorList); |
| | | monitorMapper.deleteAll(); |
| | | monitorService.saveBatch(monitorList); |
| | | } |
| | | if (!CollectionUtils.isEmpty(ywPointList)) { |
| | | ywPointService.saveOrUpdateBatch(ywPointList); |
| | | ywPointMapper.deleteAll(); |
| | | ywPointService.saveBatch(ywPointList); |
| | | } |
| | | //新的数据放入Redis中等待考核指标任务使用 |
| | | redisTemplate.opsForValue().set(RedisConstant.New_Monitor_Set, JSONArray.toJSONString(newMonitorList)); |
| | |
| | | ywPoint.setSerialNumber(result.getSerialNumber().getValue()); |
| | | ywPoint.setImportantTag(Boolean.FALSE); |
| | | ywPoint.setProvinceTag(Boolean.FALSE); |
| | | ywPoint.setImportantCommandImageTag(Boolean.FALSE); |
| | | ywPoint.setCreateTime(new Date()); |
| | | ywPoint.setUpdateTime(new Date()); |
| | | } |
| | | //比对是否是重点点位 |
| | | if (importantSite.contains(result.getSerialNumber().getValue())) { |
| | | if (importantSite.contains(result.getSxjcjqy().getValue())) { |
| | | ywPoint.setImportantTag(Boolean.TRUE); |
| | | } |
| | | //解析deptId |
| | |
| | | spring: |
| | | # 数据源配置 |
| | | datasource: |
| | | url: jdbc:mysql://101.35.247.188/zgyw?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://101.35.247.188/zgyw?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true |
| | | username: root |
| | | password: ycl@202466 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <delete id="deleteAll"> |
| | | delete from t_monitor |
| | | </delete> |
| | | |
| | | <resultMap id="dyMap" type="com.ycl.platform.domain.vo.TMonitorVO"> |
| | | <id column="id" property="id"/> |
| | | <result column="serial_number" property="serialNumber"/> |
| | |
| | | yu.unit_name, |
| | | yp.start_time, |
| | | yp.end_time, |
| | | yp.province_tag, |
| | | yp.important_tag, |
| | | yp.important_command_image_tag |
| | | CASE WHEN yp.province_tag = 0 THEN '' ELSE '省厅点位' END AS provinceTagString, |
| | | CASE WHEN yp.important_tag = 0 THEN '' ELSE '重点点位' END AS importantTagString, |
| | | CASE WHEN yp.important_command_image_tag = 0 THEN '' ELSE '重点指挥图像' END AS importantCommandImageTagString |
| | | FROM |
| | | t_yw_point yp |
| | | INNER JOIN t_monitor m ON yp.serial_number = m.serial_number |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <delete id="deleteAll"> |
| | | delete from t_yw_point |
| | | </delete> |
| | | </mapper> |