| | |
| | | package com.example.jz.service.impl; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.metadata.data.ImageData; |
| | | import com.alibaba.excel.metadata.data.WriteCellData; |
| | | import com.alibaba.excel.util.IoUtils; |
| | |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.modle.PageParam; |
| | | import com.example.jz.modle.dto.AddReportDto; |
| | | import com.example.jz.modle.dto.AddReportLoadDto; |
| | | import com.example.jz.modle.dto.ReportParamDto; |
| | | import com.example.jz.modle.entity.*; |
| | | import com.example.jz.modle.vo.ExportExcelReportVo; |
| | |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | .setCtime(new Date()) |
| | | .setStatus(0) |
| | | .setIsInGroup(0) |
| | | .setReportMethod("后台录入") |
| | | .setIsCommission("0").setReportTime(new Date()) |
| | | .setReportMethod("现场报案") |
| | | .setIsCommission("0") |
| | | .setReportTime(new Date()) |
| | | .setCauseId(addReportDto.getCauseId()); |
| | | return reportService.save(report); |
| | | } |
| | |
| | | public List<Report> listGroup(Integer id) { |
| | | return reportDao.selectListGroup(id); |
| | | } |
| | | |
| | | @Override |
| | | @SneakyThrows |
| | | public void loadFileReport(MultipartFile multipartFile, Integer causeId) { |
| | | EasyExcel.read(multipartFile.getInputStream(), AddReportLoadDto.class, new AnalysisEventListener<AddReportLoadDto>() { |
| | | @Override |
| | | public void invoke(AddReportLoadDto data, AnalysisContext context) { |
| | | if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getReporterName()) && com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getIdcard())) { |
| | | AddReportDto addReportDto = new AddReportDto(); |
| | | BeanUtils.copyProperties(data, addReportDto); |
| | | addReportDto.setCauseId(causeId); |
| | | addReport(addReportDto); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | |
| | | } |
| | | }) |
| | | .autoCloseStream(true) |
| | | .doReadAll(); |
| | | } |
| | | } |