| | |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.comparater.CustomComparator; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.excel.FiberRibboGeometricalParameterExcelData; |
| | | import com.ruoyi.inspect.mapper.*; |
| | |
| | | private InsProductUserMapper insProductUserMapper; |
| | | |
| | | private NumberGenerator<InsOrder> numberGenerator; |
| | | |
| | | private NumberGenerator<InsSample> sampleCodeGenerator; |
| | | |
| | | private NumberGenerator<InsFibers> fibersCodeGenerator; |
| | | |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | |
| | |
| | | String outEntrustCodePrefix = getOutEntrustCodePrefix(customCode, laboratoryCode); |
| | | String outEntrustCode = numberGenerator.generateNumberWithPrefix(5, outEntrustCodePrefix, InsOrder::getOutEntrustCode); |
| | | insOrder.setOutEntrustCode(outEntrustCode); |
| | | // String giveCode = this.giveCode.giveCode("JCZX-" + customCode + "-", "ins_sample", "", "yyMMdd"); |
| | | String giveCode = ""; |
| | | // insOrder.setOutEntrustCode(giveCode.giveCode3("ZT/" + code2 + "-" + code + "-", insOrder.getCompanyId(), insOrder.getLaboratory(), "ins_order", "", "yyMM")); |
| | | // String giveCode = this.giveCode.giveCode("JCZX-" + code + "-", "ins_sample", "", "yyMMdd"); |
| | | insOrderMapper.insert(insOrder); |
| | | //生成样品编号 |
| | | String currentDay = LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd")); |
| | | String generatedSampleCode = sampleCodeGenerator.generateNumberWithPrefix(3, currentDay, InsSample::getSampleCode); |
| | | AtomicInteger count = new AtomicInteger(); |
| | | List<FiberDto> fiberList = new ArrayList<>(); |
| | | list.forEach(a -> { |
| | |
| | | a.setId(null); |
| | | a.setInsOrderId(insOrder.getId()); |
| | | if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | a.setSampleCode(giveCode.split("-")[2] + "-" + count.get()); |
| | | a.setSampleCode(generatedSampleCode + "-" + count.get()); |
| | | } else { |
| | | //去除手输的样品编号中首尾可能包含的空格 |
| | | a.setSampleCode(a.getSampleCode().trim()); |
| | |
| | | for (FibersDto fibersDto : bushingDto.getFibers()) { |
| | | fibersDto.setInsBushingId(bushingDto.getId()); |
| | | if (StringUtils.isBlank(fibersDto.getCode())) { |
| | | // fibersDto.setCode(this.giveCode.giveCode("", "ins_fibers", "", "yyMMdd")); |
| | | fibersDto.setCode(""); |
| | | fibersDto.setCode(fibersCodeGenerator.generateNumberWithPrefix(3, currentDay, InsFibers::getCode)); |
| | | } |
| | | insFibersMapper.insert(fibersDto); |
| | | for (FiberDto fiberDto : fibersDto.getFiber()) { |
| | |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | | // else { |
| | | // throw new ErrorException("样品的光纤配置信息里面没有配置光纤带信息也没有光纤信息,请重新配置保存再提交下单!!!"); |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotEmpty(a.getInsulating())) { |
| | | List<InsProduct> ip2 = new ArrayList<>(); |
| | | for (Integer i = 0; i < a.getInsulating().getNum(); i++) { |
| | | for (int i = 0; i < a.getInsulating().getNum(); i++) { |
| | | ip2.addAll(a.getInsulating().getInsProduct()); |
| | | } |
| | | for (InsProduct product : ip2) { |
| | |
| | | b.setInsOrderId(insOrder.getId()); |
| | | b.setParentId(a.getId()); |
| | | if (StrUtil.isEmpty(b.getSampleCode())) { |
| | | // b.setSampleCode(this.giveCode.giveCode("", "ins_sample", "", "yyMMdd")); |
| | | b.setSampleCode(""); |
| | | b.setSampleCode(sampleCodeGenerator.generateNumberWithPrefix(3, currentDay, InsSample::getSampleCode)); |
| | | } |
| | | insSampleMapper.insert(b); |
| | | if (ObjectUtil.isNotEmpty(b.getInsProduct())) { |
| | |
| | | } else { |
| | | for (FibersDto fibersDto : bushingDto.getFibers()) { |
| | | fibersDto.setInsBushingId(bushingDto.getId()); |
| | | fibersDto.setCode(""); |
| | | fibersDto.setCode(fibersCodeGenerator.generateNumberWithPrefix(3, currentDay, InsFibers::getCode)); |
| | | insFibersMapper.insert(fibersDto); |
| | | for (FiberDto fiberDto : fibersDto.getFiber()) { |
| | | fiberDto.setInsFibersId(fibersDto.getId()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 没有进行光纤配置的熔接配对,直接添加样品 |
| | | // try { |
| | | // for (InsProduct insProduct : insProducts) { |
| | | // insProduct.setId(null); |
| | | // insProduct.setInsSampleId(insSample.getId()); |
| | | // insProductMapper.insert(insProduct); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // } |
| | | } |
| | | } |
| | | return insOrder.getId(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> selectSampleAndProductByOrderId(SampleProductDto2 sampleProductDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> headList = new ArrayList<>(); |
| | | public List<SampleProductDto2> selectSampleAndProductByOrderId(SampleProductDto2 sampleProductDto) { |
| | | List<SampleProductDto2> SampleProductDto2S = null; |
| | | if (!Objects.isNull(sampleProductDto.getId())) { |
| | | String laboratory = insOrderMapper.selectById(sampleProductDto.getId()).getLaboratory(); |
| | | if (laboratory.equals("电力产品实验室")) { |
| | | //电力试验室的数据查看,删除光纤配置相关字段 |
| | | // headList = PrintChina.printChina(SampleProductDTODL.class); |
| | | SampleProductDto2S = insOrderMapper.selectSampleAndProductByOrderId( |
| | | QueryWrappers.queryWrappers(sampleProductDto).orderByAsc("ins_product_id"), |
| | | sampleProductDto.getId()); |
| | | } else { |
| | | // headList = PrintChina.printChina(SampleProductDto2.class); |
| | | SampleProductDto2S = insOrderMapper.selectSampleAndProductByOrderId( |
| | | QueryWrappers.queryWrappers(sampleProductDto) |
| | | .orderByAsc("son_laboratory"), |
| | |
| | | } |
| | | collect2.addAll(list); |
| | | SampleProductDto2S = collect2; |
| | | // SampleProductDto2S.sort(new CustomComparator(enumService)); |
| | | SampleProductDto2S.sort(new CustomComparator(dictTypeService)); |
| | | } |
| | | } |
| | | for (SampleProductDto2 record : SampleProductDto2S) { |
| | |
| | | record.setLastValue(String.join(",", values)); |
| | | } |
| | | } |
| | | map.put("head", headList); |
| | | map.put("body", SampleProductDto2S); |
| | | return map; |
| | | return SampleProductDto2S; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void exportChecked(Map<String, Object> data, HttpServletResponse response) { |
| | | // Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | Integer userId = Integer.valueOf(String.valueOf(SecurityUtils.getLoginUser().getUserId())); |
| | | User user = userMapper.selectById(userId); |
| | | User user = userMapper.selectById(SecurityUtils.getLoginUser().getUserId()); |
| | | List<String> names = null; |
| | | String startTime = ""; |
| | | String endTime = ""; |
| | |
| | | } |
| | | temperatureCyclingList = temperatureCyclingList.stream().distinct().collect(Collectors.toList()); |
| | | //查询全色谱,过滤色标并排序 |
| | | List<String> colorList = dictTypeService.selectDictDataByType("color_type").stream() |
| | | List<String> colorList = dictTypeService.selectDictDataByType("fiber_color_type").stream() |
| | | .sorted(Comparator.comparing(SysDictData::getDictSort)) |
| | | .map(SysDictData::getDictLabel) |
| | | .collect(Collectors.toList()); |
| | |
| | | LocalDate today = LocalDate.parse(split[1]); |
| | | LocalTime end = LocalTime.of(23, 59, 59); |
| | | List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto), split[0], today.atTime(end).toString(), laboratory); |
| | | // double totalPrice = costStatisticsDtos.stream() |
| | | // .filter(dto -> dto.getPrice() != null) // 过滤掉价格为 null 的对象 |
| | | // .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum()) |
| | | // .sum(); |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (CostStatisticsDto dto : costStatisticsDtos) { |
| | | if (Objects.isNull(dto.getPrice()) || dto.getPrice().compareTo(BigDecimal.ZERO) == 0) { |