| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String addLinkBasicInformation(LinkBasicInformation linkBasicInformation) { |
| | | System.out.println(linkBasicInformation.getLinkDetectionList()); |
| | | QueryWrapper<LinkBasicInformation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().select(LinkBasicInformation::getId).eq(LinkBasicInformation::getUid, linkBasicInformation.getUid()); |
| | | LinkBasicInformation linkBasicInformation1 = linkBasicInformationMapper.selectOne(queryWrapper); |
| | | Optional<Integer> optionalId = Optional.ofNullable(linkBasicInformation1) |
| | | .map(LinkBasicInformation::getId); |
| | | AtomicBoolean b=new AtomicBoolean(true); |
| | | optionalId.ifPresent(l->{ |
| | | //执行删除 |
| | | linkDetectionMapper.deleteByLinkbasic(linkBasicInformation1.getId()); |
| | | linkBasicInformationMapper.deleteByID(linkBasicInformation1.getId()); |
| | | QueryWrapper<LinkDetection>queryWrapperLd = new QueryWrapper<>(); |
| | | queryWrapperLd.lambda().select(LinkDetection::getInspectionStatus).eq(LinkDetection::getLinkBasicId,linkBasicInformation1.getId()); |
| | | List<LinkDetection> linkDetections = linkDetectionMapper.selectList(queryWrapperLd).stream().filter(ld->ld.getInspectionStatus()==2).collect(Collectors.toList()); |
| | | if(linkDetections.size()<1){ |
| | | //执行删除 |
| | | linkDetectionMapper.deleteByLinkbasic(linkBasicInformation1.getId()); |
| | | linkBasicInformationMapper.deleteByID(linkBasicInformation1.getId()); |
| | | b.set(false); |
| | | }else { |
| | | b.set(true); |
| | | } |
| | | }); |
| | | if(b.get()){ |
| | | return "提交失败,含有已报检样品"; |
| | | } |
| | | //委托编号 |
| | | String code = MyUtil.getTimeSixNumberCode("SL", "SL"); |
| | | linkBasicInformation.setEntrustCoding(code); |
| | |
| | | @Override |
| | | public List<Map<String,Object>> lookProByVer(String name, String mcode, String specifications,Integer version, Integer id) { |
| | | LinkDetection linkDetection = linkDetectionMapper.selectById(id); |
| | | System.out.println(linkDetection); |
| | | List<String> experiments = Arrays.stream(linkDetection.getExperiment().split(",")).collect(Collectors.toList()); |
| | | System.out.println(experiments); |
| | | System.out.println("=============================="); |
| | | //根据型号id和项目信息查询项目信息 |
| | | List<Map<String, Object>> products = new ArrayList<>(); |
| | | for (String exper : experiments) { |