| | |
| | | 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.*; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | //获取检验下单数据 |
| | | @Override |
| | | public Map<String, Object> selectInsOrderParameter(Page<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(Page<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | page.setOptimizeCountSql(false); |
| | | List<String> startAndEndTime = sampleOrderDto.getStartAndEndTime(); |
| | | String startTime = ""; |
| | |
| | | startTime = startAndEndTime.get(0) + " 00:00:00"; |
| | | endTime = startAndEndTime.get(1) + " 23:59:59"; |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //// map.put("head", PrintChina.printChina(SampleOrderDto.class)); |
| | | // //判断全部,个人,组织的权限 |
| | | // Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectInsOrderParameter"); |
| | | // User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | // Integer roleId = user.getRoleId(); |
| | | User user = userMapper.selectById(SecurityUtils.getUserId());;//当前登录的人 |
| | | // //获取当前人所属实验室id |
| | | // String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | // if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.isEmpty()) { |
| | | // String[] split = departLimsId.split(","); |
| | | // //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | // String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | // if (departLims.contains("实验室")) { |
| | | // laboratory = departLims; |
| | | // } |
| | | // } |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = ""; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.isEmpty()) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | // //判断是否是全部权限 |
| | | // SecurityUtils.hasPermi(""); |
| | | // Power power = powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "selectAllInsOrderParameter")); |
| | | // if (ObjectUtils.isEmpty(power)) { |
| | | // if (map1.get("look") == 1) { |
| | |
| | | i.setSampleCode(split[0]); |
| | | } |
| | | }); |
| | | map.put("body", sampleOrderDtoIPage); |
| | | return map; |
| | | return sampleOrderDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @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) { |