| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.function.Function; |
| | | import java.util.function.Predicate; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | //判断是否是全部权限 |
| | | Power power = |
| | | powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "selectAllInsOrder")); |
| | | Power power = powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "selectAllInsOrder")); |
| | | if (ObjectUtils.isEmpty(power)) { |
| | | if (map1.get("look") == 1) { |
| | | //个人 |
| | |
| | | } |
| | | } |
| | | } |
| | | map.put("body", insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), |
| | | laboratory)); |
| | | map.put("body", insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | fiberDto.setInsFibersId(fibersDto.getId()); |
| | | insFiberMapper.insert(fiberDto); |
| | | addInsProductMethod(a.getId(), a.getInsProduct(), fiberDto.getId(), 2, true); |
| | | addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, |
| | | false); |
| | | addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, false); |
| | | } |
| | | //addInsProductMethod(a.getId(), a.getInsProduct(), fibersDto.getId(), 1); |
| | | addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1, false); |
| | |
| | | } |
| | | }); |
| | | for (List<Integer> i : pairing) { |
| | | SampleProductDto sample = JSON.parseObject(JSON.toJSONString(list.get(i.get(0) - 1)), |
| | | SampleProductDto.class); |
| | | SampleProductDto sample = JSON.parseObject(JSON.toJSONString(list.get(i.get(0) - 1)), SampleProductDto.class); |
| | | sample.setSampleCode(list.get(i.get(0) - 1).getSampleCode() + "/" + list.get(i.get(1) - 1).getSampleCode()); |
| | | sample.setId(null); |
| | | insSampleMapper.insert(sample); |
| | | try { |
| | | List<InsProduct> insProducts = |
| | | sample.getInsProduct().stream().filter(a -> Objects.equals(a.getInspectionItem(), "光纤接头损耗")).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = sample.getInsProduct().stream().filter(a -> Objects.equals(a.getInspectionItem(), "光纤接头损耗")).collect(Collectors.toList()); |
| | | for (InsProduct insProduct : insProducts) { |
| | | insProduct.setId(null); |
| | | insProduct.setInsSampleId(sample.getId()); |
| | |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type, |
| | | Boolean is) { |
| | | private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type, Boolean is) { |
| | | InsOrder insOrder = insOrderMapper.selectById(insSampleMapper.selectById(sampleId).getInsOrderId()); |
| | | for (InsProduct product : productList) { |
| | | if (product.getState() == 1 && !product.getInspectionItem().equals("光纤接头损耗")) { |
| | | //判断光缆的温度循环项目添加 |
| | | if (insOrder.getSampleType().equals("光缆") && product.getInspectionItem().equals("温度循环") && type != 0) { |
| | | List<InsProduct> insProductes = new ArrayList<>(); |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | String[] strings = product.getAsk().split(";"); |
| | | |
| | | for (int i = 0; i < strings.length; i++) { |
| | | int count = Integer.parseInt(strings[strings.length - 1]); |
| | | if (i != strings.length - 1) { |
| | | InsProduct insProduct = new InsProduct(); |
| | | switch (type) { |
| | | case 1: |
| | | insProduct.setInsFibersId(id); |
| | | break; |
| | | case 2: |
| | | insProduct.setInsFiberId(id); |
| | | break; |
| | | } |
| | | String[] split = strings[i].split(","); |
| | | if (split[0].equals("20℃")) { |
| | | insProduct.setInspectionItem(count + "");//检验项--循环次数 |
| | | } else { |
| | | insProduct.setInspectionItem("1");//检验项--循环次数 |
| | | } |
| | | insProduct.setInspectionItemSubclass(split[0]);//检验项--温度 |
| | | insProduct.setInspectionItemClass(split[1]);//检验项--光纤项目 |
| | | insProduct.setAsk(split[2]);//检验要求 |
| | | insProduct.setTell(strings[i]);//检验描述 |
| | | insProduct.setInsSampleId(sampleId); |
| | | insProduct.setState(1); |
| | | insProduct.setFactory(product.getFactory()); |
| | | insProduct.setLaboratory(product.getLaboratory()); |
| | | insProduct.setSampleType(product.getSampleType()); |
| | | insProduct.setSample(product.getSample()); |
| | | insProduct.setModel(product.getModel()); |
| | | insProduct.setSonLaboratory(product.getSonLaboratory()); |
| | | insProduct.setUnit(product.getUnit()); |
| | | insProduct.setManHourGroup(product.getManHourGroup()); |
| | | insProduct.setInspectionItemType("0"); |
| | | insProduct.setInspectionValueType("1"); |
| | | insProducts.add(insProduct); |
| | | insProductes.add(insProduct); |
| | | //判断选择的标准方法是委托要求还是其他标准方法 |
| | | String name = insSampleMapper.selMethodById(sampleId); |
| | | if (!name.equals("委托要求")) { |
| | | //判断标准方法的温度循环的要求描述是否有填写 |
| | | if (ObjectUtils.isEmpty(product.getTell()) || product.getTell().equals("")) { |
| | | throw new ErrorException("光缆的温度循环的要求描述为空,需要在标准库配置要求描述!!!"); |
| | | } else { |
| | | //最后一个数据是说明会循环多少次 |
| | | if (count > 1) { |
| | | //循环超过1次 |
| | | for (int j = 2; j <= count; j++) { |
| | | for (InsProduct insProduct : insProducts) { |
| | | if (!insProduct.getInspectionItemSubclass().equals("20℃") && !insProduct.getInspectionItemSubclass().equals("20℃(常温)")) { |
| | | InsProduct insProduct1 = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, insProduct1); |
| | | insProduct1.setInspectionItem(j + ""); |
| | | insProductes.add(insProduct1); |
| | | } |
| | | } |
| | | //解析(温度范围:20℃,-40℃,65℃;保温时间:12h; 循环次数:2次; 光纤(1310nm,1550nm)附加衰减不大于0.03dB/km) |
| | | String tell = product.getTell().replace(")", ")") |
| | | .replace("(", "(") |
| | | .replace(")", ")") |
| | | .replace(",", ",") |
| | | .replace(":", ":") |
| | | .replace(";", ";") |
| | | .replace("不大于", "≤") |
| | | .replace("不小于", "≥") |
| | | .replace("大于", ">") |
| | | .replace("小于", "<") |
| | | .replace("等于", "="); |
| | | String[] message=null; |
| | | String[] nm=null; |
| | | String ask=null; |
| | | String count=null; |
| | | try { |
| | | String[] strings = tell.split(";"); |
| | | //温度 |
| | | String temperature = strings[0]; |
| | | String[] split = temperature.split(":"); |
| | | message = split[1].split(","); |
| | | //循环次数 |
| | | count = strings[2].split(":")[1].split("次")[0]; |
| | | //光纤项目和要求值 |
| | | String string = strings[3]; |
| | | nm = string.split("(")[1].split(")")[0].split(","); |
| | | ask = string.split("衰减")[1].split("dB")[0]; |
| | | }catch (Exception e){ |
| | | throw new ErrorException("温度循环的要求描述格式异常,请参照温度范围:20℃,-40℃,65℃;保温时间:12h; 循环次数:2次; 光纤(1310nm,1550nm)附加衰减不大于0.03dB/km"); |
| | | } |
| | | //拼接 |
| | | String s=null; |
| | | for (int i = 0; i < nm.length; i++) { |
| | | s+= "20℃(常温)," + nm[i] + ",null;"; |
| | | for (int j = 0; j < message.length; j++) { |
| | | s+= message[j] + "," + nm[i] + "," + ask + ";" ; |
| | | } |
| | | } |
| | | s+=count; |
| | | product.setAsk(s); |
| | | insProductMapper.updateById(product); |
| | | dealWithTemperatureLoop(type,id,sampleId,product); |
| | | } |
| | | } |
| | | insProductService.saveBatch(insProductes); |
| | | else { |
| | | //20℃(常温),1310nm,null;-40℃,1310nm,≤0.2;75℃,1310nm,<0.3;20℃,1310nm,≤0.1;20℃(常温),1550nm,null;-40℃,1550nm,≤0.2;75℃,1550nm,<0.3;20℃,1550nm,≤0.1;3 |
| | | dealWithTemperatureLoop(type,id,sampleId,product); |
| | | } |
| | | } |
| | | //判断热循环项目的添加和温升试验项目的添加 |
| | | else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")) { |
| | |
| | | } |
| | | } |
| | | |
| | | //温度循环的处理 |
| | | private void dealWithTemperatureLoop(Integer type, Integer id,Integer sampleId,InsProduct product) { |
| | | List<InsProduct> insProductes = new ArrayList<>(); |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | String[] strings = product.getAsk().split(";"); |
| | | for (int i = 0; i < strings.length; i++) { |
| | | int count = Integer.parseInt(strings[strings.length - 1]); |
| | | if (i != strings.length - 1) { |
| | | InsProduct insProduct = new InsProduct(); |
| | | switch (type) { |
| | | case 1: |
| | | insProduct.setInsFibersId(id); |
| | | break; |
| | | case 2: |
| | | insProduct.setInsFiberId(id); |
| | | break; |
| | | } |
| | | String[] split = strings[i].split(","); |
| | | if (split[0].equals("20℃")) { |
| | | insProduct.setInspectionItem(count + "");//检验项--循环次数 |
| | | } else { |
| | | insProduct.setInspectionItem("1");//检验项--循环次数 |
| | | } |
| | | insProduct.setInspectionItemSubclass(split[0]);//检验项--温度 |
| | | insProduct.setInspectionItemClass(split[1]);//检验项--光纤项目 |
| | | insProduct.setAsk(split[2]);//检验要求 |
| | | insProduct.setTell(strings[i]);//检验描述 |
| | | insProduct.setInsSampleId(sampleId); |
| | | insProduct.setState(1); |
| | | insProduct.setFactory(product.getFactory()); |
| | | insProduct.setLaboratory(product.getLaboratory()); |
| | | insProduct.setSampleType(product.getSampleType()); |
| | | insProduct.setSample(product.getSample()); |
| | | insProduct.setModel(product.getModel()); |
| | | insProduct.setSonLaboratory(product.getSonLaboratory()); |
| | | insProduct.setUnit(product.getUnit()); |
| | | insProduct.setManHourGroup(product.getManHourGroup()); |
| | | insProduct.setInspectionItemType("0"); |
| | | insProduct.setInspectionValueType("1"); |
| | | insProducts.add(insProduct); |
| | | insProductes.add(insProduct); |
| | | } else { |
| | | //最后一个数据是说明会循环多少次 |
| | | if (count > 1) { |
| | | //循环超过1次 |
| | | for (int j = 2; j <= count; j++) { |
| | | for (InsProduct insProduct : insProducts) { |
| | | if (!insProduct.getInspectionItemSubclass().equals("20℃") && !insProduct.getInspectionItemSubclass().equals("20℃(常温)")) { |
| | | InsProduct insProduct1 = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, insProduct1); |
| | | insProduct1.setInspectionItem(j + ""); |
| | | insProductes.add(insProduct1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | insProductService.saveBatch(insProductes); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsOrder(Integer id) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | code = ""; |
| | | } |
| | | String code2 = customMapper.selectById(insOrder.getCompanyId()).getCode2(); |
| | | insOrder.setEntrustCode(giveCode.giveCode2("JCZX/" + code + "-" + code2 + "-", insOrder.getCompanyId(), |
| | | insOrder.getLaboratory(), "ins_order", "", "yyMM")); |
| | | insOrder.setEntrustCode(giveCode.giveCode2("JCZX/" + code + "-" + code2 + "-", insOrder.getCompanyId(), insOrder.getLaboratory(), "ins_order", "", "yyMM")); |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, |
| | | SampleProductDto2 sampleProductDto) { |
| | | public Map<String, Object> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(SampleProductDto2.class)); |
| | | map.put("body", insOrderMapper.selectSampleAndProductByOrderId(page, |
| | | QueryWrappers.queryWrappers(sampleProductDto))); |
| | | map.put("body", insOrderMapper.selectSampleAndProductByOrderId(page, QueryWrappers.queryWrappers(sampleProductDto))); |
| | | return map; |
| | | } |
| | | |
| | |
| | | map.put("head", PrintChina.printChina(CostStatisticsDto.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("costStatistics"); |
| | | if (map1.get("look") == 1) costStatisticsDto.setCreateUser(map1.get("userId")); |
| | | IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, |
| | | QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", |
| | | split[1] + " 23:59:59")); |
| | | 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(",")) { |
| | |
| | | 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")); |
| | | 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()) |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { |
| | | List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems |
| | | , 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); |
| | |
| | | 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")); |
| | | 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(",")) { |