| | |
| | | package com.ycl.platform.domain.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.format.DateTimeFormat; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | |
| | | @ExcelProperty("运维结束时间") |
| | | private Date endTime; |
| | | |
| | | @ExcelIgnore |
| | | private Boolean provinceTag; |
| | | |
| | | @ExcelProperty("是否省厅标签") |
| | | private String provinceTagString; |
| | | |
| | | @ExcelIgnore |
| | | private Boolean importantTag; |
| | | |
| | | @ExcelProperty("是否重点点位") |
| | | private String importantTagString; |
| | | |
| | | @ExcelIgnore |
| | | private Boolean importantCommandImageTag; |
| | | |
| | | @ExcelProperty("是否重点指挥图像") |
| | | private String importantCommandImageTagString; |
| | | } |
| | |
| | | |
| | | @PostMapping("/import/{unitId}") |
| | | @ApiOperation(value = "导入数据", notes = "导入数据") |
| | | public Result importData(MultipartFile file, @PathVariable("unitId") Integer unitId, Date startTime, Date endTime) throws IOException { |
| | | return ywPointService.importData(file, unitId, startTime, endTime); |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | * @param unitId 运维单位id |
| | | * @return |
| | | */ |
| | | Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime) throws IOException; |
| | | Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) throws IOException; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime) throws IOException { |
| | | public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) throws IOException { |
| | | Consumer<List<PointExport>> consumer = (dataList) -> { |
| | | this.updatePoint(dataList, unitId, startTime, endTime); |
| | | this.updatePoint(dataList, unitId, startTime, endTime, provinceTag, importantTag, 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) { |
| | | private void updatePoint(List<PointExport> dataList, Integer unitId, Date startTime, Date endTime, Boolean provinceTag, Boolean importantTag, Boolean importantCommandImageTag) { |
| | | if (CollectionUtils.isEmpty(dataList)) { |
| | | throw new RuntimeException("导入数据不能为空"); |
| | | } |
| | |
| | | .set(YwPoint::getUnitId, unitId) |
| | | .set(YwPoint::getStartTime, startTime) |
| | | .set(YwPoint::getEndTime, endTime) |
| | | .set(YwPoint::getProvinceTag, provinceTag) |
| | | .set(YwPoint::getImportantTag, importantTag) |
| | | .set(YwPoint::getImportantCommandImageTag, importantCommandImageTag) |
| | | .update(); |
| | | } |
| | | |
| | |
| | | m.ip, |
| | | yu.unit_name, |
| | | yp.start_time, |
| | | yp.end_time |
| | | yp.end_time, |
| | | yp.province_tag, |
| | | yp.important_tag, |
| | | yp.important_command_image_tag |
| | | FROM |
| | | t_yw_point yp |
| | | INNER JOIN t_monitor m ON yp.serial_number = m.serial_number |