From b9ff0ede78518a3c7c160f12942acd9410c33ce5 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期五, 28 二月 2025 14:41:01 +0800 Subject: [PATCH] 清除不符合品管理, 调整设备档案和维护保养 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 100 -------------------------------------------------- 1 files changed, 0 insertions(+), 100 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java index ae86eed..28495bc 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java @@ -557,112 +557,12 @@ return productDto2IPage; } - @Override - public IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - - //todo:浠呯湅鑷繁 - - IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - List<CostStatisticsDto> collect = dtoIPage.getRecords().stream().map(dto -> { - Set<String> uniqueTags = new HashSet<>(); - if (dto.getInspectionItem().contains(",")) { - for (String s : dto.getInspectionItem().split(",")) { - uniqueTags.add(s.split("@")[0]); - } - } else { - uniqueTags.add(dto.getInspectionItem().split("@")[0]); - } - dto.setInspectionItem(uniqueTags.toString()); - return dto; - }).collect(Collectors.toList()); - dtoIPage.setRecords(collect); - return dtoIPage; - } - - @Override - public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { - Map<String, Object> map = new HashMap<>(); - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - double totalPrice = costStatisticsDtos.stream() - .filter(dto -> dto.getPrice() != null) // 杩囨护鎺変环鏍间负 null 鐨勫璞� - .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum()) - .sum(); - map.put("total", totalPrice); - return map; - } - - @Override - public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { - List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); - Map<String, Object> map = new HashMap<>(); - map.put("records", sampleDefectsFatherVos); - Long aLong = insOrderMapper.getCount(inspectionItems, orderNumber); - map.put("total", aLong); - return map; - } @Override public int updateStatus(Integer id) { return insOrderMapper.updateStatus(id); } - - @Override - public void export(CostStatisticsDto costStatisticsDto, HttpServletResponse response) throws IOException { - //鏌ヨ瀵煎嚭鐨勮垂鐢ㄧ粺璁℃暟鎹� - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - costStatisticsDtos = costStatisticsDtos.stream().map(dto -> { - Set<String> uniqueTags = new HashSet<>(); - if (dto.getInspectionItem().contains(",")) { - for (String s : dto.getInspectionItem().split(",")) { - uniqueTags.add(s.split("@")[0]); - } - } else { - uniqueTags.add(dto.getInspectionItem().split("@")[0]); - } - dto.setInspectionItem(uniqueTags.toString()); - return dto; - }).collect(Collectors.toList()); - - response.setContentType("application/vnd.ms-excel"); - response.setCharacterEncoding("UTF-8"); - // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴 - String fileName = URLEncoder.encode("鏍峰搧璐圭敤缁熻瀵煎嚭", "UTF-8"); - response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); - Map<String, List<CostStatisticsDto>> groupByCompany = - costStatisticsDtos.stream().filter(e -> StrUtil.isNotEmpty(e.getCompany())) - .collect(Collectors.groupingBy(CostStatisticsDto::getCompany)); - try { - // 鏂板缓ExcelWriter - // 鏂板缓ExcelWriter - ExcelWriter excelWriter = - EasyExcel.write(response.getOutputStream()) - .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) - .build(); - for (Map.Entry<String, List<CostStatisticsDto>> companyDataEntry : groupByCompany.entrySet()) { - String sheetName = companyDataEntry.getKey(); - List<CostStatisticsDto> dataList = companyDataEntry.getValue(); - WriteSheet mainSheet = EasyExcel.writerSheet(sheetName) - .head(CostStatisticsDto.class) - .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) - .build(); - excelWriter.write(dataList, mainSheet); - } - // 鍏抽棴娴� - excelWriter.finish(); - } catch (IOException e) { - throw new RuntimeException("瀵煎嚭澶辫触"); - } - } /** * 鑾峰彇ifs搴撳瓨淇℃伅 -- Gitblit v1.9.3