| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.GroupDao; |
| | | import com.example.jz.dao.GroupUserDao; |
| | | import com.example.jz.dao.ReportDao; |
| | | import com.example.jz.dao.UserDao; |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.modle.dto.AddReportDto; |
| | | import com.example.jz.modle.dto.ReportParamDto; |
| | | import com.example.jz.modle.entity.Group; |
| | |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.modle.entity.*; |
| | | import com.example.jz.modle.vo.ExportExcelReportVo; |
| | | import com.example.jz.modle.vo.ReportListVo; |
| | | import com.example.jz.service.MinIOService; |
| | | import com.example.jz.service.ReportService; |
| | | import lombok.SneakyThrows; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.Serializable; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | ArrayList<ImageData> imageDataList = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(a.getReportMaterials())) { |
| | | String[] urls = a.getReportMaterials().split(","); |
| | | for (int i = 0; i < urls.length; i++) { |
| | | int width=600; |
| | | if (urls.length == 1) { |
| | | int width = 600; |
| | | try { |
| | | ImageData imageData = new ImageData(); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[i])).openConnection().getInputStream())); |
| | | imageData.setLeft(width/ urls.length*i); |
| | | imageData.setRight(width-width/ urls.length*(i+1)); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[0])).openConnection().getInputStream())); |
| | | imageData.setRight(width / 2); |
| | | imageDataList.add(imageData); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } else { |
| | | for (int i = 0; i < urls.length; i++) { |
| | | int width = 600; |
| | | try { |
| | | ImageData imageData = new ImageData(); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[i])).openConnection().getInputStream())); |
| | | imageData.setLeft(width / urls.length * i); |
| | | imageData.setRight(width - width / urls.length * (i + 1)); |
| | | imageDataList.add(imageData); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | objectWriteCellData.setImageDataList(imageDataList); |
| | | exportExcelReportVo.setWriteCellData(objectWriteCellData); |
| | | exportExcelReportVos.add(exportExcelReportVo); |
| | | } |
| | | objectWriteCellData.setImageDataList(imageDataList); |
| | | exportExcelReportVo.setWriteCellData(objectWriteCellData); |
| | | exportExcelReportVos.add(exportExcelReportVo); |
| | | } |
| | | ); |
| | | String name = causeDao.selectOne(new QueryWrapper<Cause>().eq("id", id)).getName(); |
| | | response.setHeader("Content-disposition", "attachment;filename="+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))+URLEncoder.encode(name+".xlsx","utf-8")); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + URLEncoder.encode(name + ".xlsx", "utf-8")); |
| | | EasyExcel.write(response.getOutputStream(), ExportExcelReportVo.class).sheet("材料导出").doWrite(exportExcelReportVos); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId) { |
| | | Page<ReportListVo> aaa = reportDao.getPageByGroupId(page, reportParamDto,groupId); |
| | | Page<ReportListVo> aaa = reportDao.getPageByGroupId(page, reportParamDto, groupId); |
| | | aaa.getRecords().stream().forEach(x -> x.setIdcard(x.getIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"))); |
| | | return aaa; |
| | | } |
| | |
| | | .setModifyTime(new Date()).setUserRegtime(new Date()).setPic(addReportDto.getPic()); |
| | | userDao.insert(user); |
| | | } |
| | | // 添加人员进群组 |
| | | groupUserDao.insert(new GroupUser() |
| | | .setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", addReportDto.getCauseId())).getId()) |
| | | .setUserId(user.getId()).setCtime(new Date()) |
| | | .setBanSpeech(0)); |
| | | // 添加报案信息 |
| | | Report report = new Report(); |
| | | BeanUtils.copyProperties(addReportDto, report); |
| | | report |
| | | .setUserId(user.getId()) |
| | | .setCtime(new Date()) |
| | | .setStatus(0) |
| | | .setStatus(1) |
| | | .setReportMethod("现场录入") |
| | | .setIsCommission("0").setReportTime(new Date()); |
| | | .setIsCommission("0").setReportTime(new Date()) |
| | | .setCauseId(addReportDto.getCauseId()); |
| | | return reportDao.insert(report) > 0; |
| | | } |
| | | } |